blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5f65572cf530d9350943a89958b675d937b3a418 | 164a170802834e39da22058fbb4e5f96562fa2da | /src/Triangle/AbstractSyntaxTrees/RecDeclaration.java | 5fa9ec09ac88f5fbbd85d4eb3a5eb22939c56538 | [] | no_license | WillyGn/FinalMortal | bf6590aba9a11161261dd8b5ad3ae5bab45dc98f | f7c86d3dfd49ee91850503d3d694017c6a7df507 | refs/heads/master | 2020-03-16T18:27:20.244567 | 2018-05-13T14:38:29 | 2018-05-13T14:38:29 | 132,873,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 619 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Triangle.AbstractSyntaxTrees;
import Triangle.SyntacticAnalyzer.SourcePosition;
/**
*
* @author Jorge
*/
public class RecDeclaration extends Declaration {
public RecDeclaration (Declaration dAST, SourcePosition thePosition) {
super (thePosition);
I = dAST;
}
public Object visit(Visitor v, Object o) {
return v.visitRecDeclaration(this, o);
}
public Declaration I;
}
| [
"willy100h@gmail.com"
] | willy100h@gmail.com |
7310718fd64167786928d57b21b834c78e73817f | 7ada115a93e82e5543f29693e77efe0b18eea61b | /Sneha_Pai_assignment3/INFO6205-master /src/main/java/edu/neu/coe/info6205/sort/simple/SelectionSort.java | 5f4586f7ea8f5b7d175389a75dc14c191848b71e | [
"Apache-2.0"
] | permissive | snehapai2508/PSA | 2ee1e8ac909c5f7cca99ce8f2c610289c6db55af | 4e2e6eaac68b8042cb1c7dd1629c873d29a09b4f | refs/heads/master | 2020-03-22T12:36:44.838111 | 2018-08-04T02:15:38 | 2018-08-04T02:15:38 | 140,050,670 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package edu.neu.coe.info6205.sort.simple;
import static edu.neu.coe.info6205.sort.simple.Helper.less;
import static edu.neu.coe.info6205.sort.simple.Helper.swap;
public class SelectionSort<X extends Comparable<X>> implements Sort<X> {
@Override
public void sort(X[] xs, int from, int to) {
// TODO implement selection sort
for(int i=from;i<to;i++)
{
int min = i;
for(int j=i+1;j<to;j++)
{
if(less(xs[j],xs[min]))
{
min = j;
}
}
swap(xs, i, min);
}
}
}
| [
"pai.sn@husky.neu.edu"
] | pai.sn@husky.neu.edu |
123d6808a512dda7ef63158796b7a60516d87833 | e656a711c0a23ff88a6b85ac4b79a68f1fb17059 | /AccessModifiersDemo/src/demo/BankAccountDemo.java | b6aa290643268e6313f8b479750adbd563ded439 | [] | no_license | sanrustrainingcentre/java-training-feb32018 | bd1153f01bfbac68362439a8f6a3091af7c33344 | 8ac6c3ca5c9913d8d47cd00948af0f2005396fbf | refs/heads/master | 2021-09-15T08:06:43.071989 | 2018-05-29T00:14:19 | 2018-05-29T00:14:19 | 122,844,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package demo;
import accessmodifiers.bank.BankAccount;
public class BankAccountDemo {
public static void main(String[] args) {
BankAccount savingsAccount = new BankAccount("Savings Account", "12345", 50);
savingsAccount.balance = -100;
savingsAccount.accNo = "12345";
savingsAccount.name = "Savings A/C";
}
}
| [
"santhoshgutta@gmail.com"
] | santhoshgutta@gmail.com |
57d3c3594936a14ceae7836331df38772ef66910 | f60304de7dceab2a18666ac0d59ac23a5dd5dede | /SchollAdmission/src/main/java/com/elegnat/school/dao/SchoolDao.java | 541011e0014008348bf0bf6f9af7da1579bfc2af | [] | no_license | rpolu/JSP | a4c3406a1ce1aa98fa104adad8e33c8bba3a9119 | 6854c3f467d19e3315730867408b7c8a12be8e8b | refs/heads/master | 2021-01-13T17:56:27.407371 | 2020-09-18T03:37:22 | 2020-09-18T03:37:22 | 242,448,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 449 | java | package com.elegnat.school.dao;
import java.util.List;
import com.elegnat.school.model.StudentModel;
public interface SchoolDao {
public void saveStudent(StudentModel studentModel);
public boolean loginStudent(String userName, String password);
public StudentModel getStudent(String userName);
public List<StudentModel> getStudents();
public void updateStudent(StudentModel studentModel);
public void deleteStudent(String userName);
}
| [
"rpolu@192.168.1.102"
] | rpolu@192.168.1.102 |
0e368ac1e2c6ea547dfbf6a3f7d9dd727c47ecef | 030f36c22e1875ae531abec7e5519c0750ddecda | /new_sqlite/src/main/java/com/example/new_sqlite/AddToDataSource.java | 51f127d18fe2d5b9df04df26a753dae4a6bdef2b | [] | no_license | AshishSatpute/Testing | 664cdb6ef5904366fb4b3a0f8366e3b6138fbc93 | b7dddd7581aeb6e42ebe0815f547ae18095363e9 | refs/heads/master | 2020-04-27T16:06:22.228774 | 2019-03-27T13:22:15 | 2019-03-27T13:22:15 | 174,472,688 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,806 | java | package com.example.new_sqlite;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import java.util.ArrayList;
class AddToDataSource extends DatabaseHelper {
private SQLiteDatabase sqLiteDatabase;
public static final String TABLE_NAME = "data";
public static final String COLUMN_NAME = "name";
public static final String COLUMN_PASS = "pass";
public static final String CREATE_TABLE_ADD = "CREATE TABLE " + TABLE_NAME +
"("
+ COLUMN_NAME
+ " TEXT NOT NULL, "
+ COLUMN_PASS
+ " TEXT NOT NULL "
+ " );";
public static final String selectQuery = "SELECT * FROM " + TABLE_NAME + ";";
public AddToDataSource(Context context) {
super(context);
}
public void addData(Module module) {
sqLiteDatabase = getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COLUMN_NAME, module.getName());
contentValues.put(COLUMN_PASS, module.getPass());
sqLiteDatabase.insert(TABLE_NAME, null, contentValues);
}
public ArrayList showList() {
ArrayList<Module> lists = new ArrayList<>();
SQLiteDatabase sqLiteDatabase = getWritableDatabase();
Cursor cursor = sqLiteDatabase.rawQuery(selectQuery, null);
if (cursor.moveToFirst()) {
do {
Module module = new Module();
module.setName(cursor.getString(cursor.getColumnIndex(COLUMN_NAME)));
module.setPass(cursor.getString(cursor.getColumnIndex(COLUMN_PASS)));
lists.add(module);
} while (cursor.moveToNext());
}
return lists;
}
}
| [
"satpute2727@gmail.com"
] | satpute2727@gmail.com |
f8a170a2e87eede4dbc86aa66a80e94854aad4e9 | 4f3f0f5e6128bd2d033fadb60f744043f86e5885 | /FastOmiai/src/com/sogou/fastomiai/ConfirmActivity.java | 5a8013af61ab88c0a53fbc47969045fd1ca2e8c9 | [
"MIT"
] | permissive | Flame-Team/FastOmiai | 4ab62313303ef41dab130553c6d28ead77861b93 | c335393e3733cfed725a4940525c083e2ecde767 | refs/heads/master | 2021-01-17T15:42:29.786959 | 2015-05-31T02:04:52 | 2015-05-31T02:04:52 | 36,065,303 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,686 | java | package com.sogou.fastomiai;
import java.util.Timer;
import java.util.TimerTask;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class ConfirmActivity extends Activity {
static private long sTotalTime = 60 * 60 * 24;
private TextView mTextCountDown = null;
static private Timer mTimer = null;
private Button mBtnHomePage = null;
private Button mBtnFilter = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (null != savedInstanceState) {
sTotalTime = savedInstanceState.getLong("time", sTotalTime);
}
setContentView(R.layout.activity_confirm);
mBtnHomePage = (Button) findViewById(R.id.btn_homepage);
mBtnHomePage.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), HomePageActivity.class);
intent.putExtra("from", "ConfirmActivity");
startActivity(intent);
}
});
mBtnFilter = (Button) findViewById(R.id.btn_filter);
mBtnFilter.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "筛选", Toast.LENGTH_SHORT).show();
}
});
mTextCountDown = (TextView) findViewById(R.id.text_countdown);
if (null != mTimer) {
mTimer.cancel();
}
mTimer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
sTotalTime--;
mTextCountDown.setText(getString(R.string.confirm_wait) + "\n" +
sTotalTime / (60 * 60) + ":" +
(sTotalTime % (60 * 60)) / 60 + ":" +
((sTotalTime % (60 * 24)) % 60));
if(sTotalTime < 0){
mTimer.cancel();
}
}
});
}
};
mTimer.schedule(task, 0, 1000);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putLong("time", sTotalTime);
}
}
| [
"Olivia-realmandl@163.com"
] | Olivia-realmandl@163.com |
40caa932f82b3b4980c1009f6363e5eca2e23a75 | fe07aecbf4f69b06bd0e781f12b908f91d1adf72 | /ShapeLab/src/Shapes/Parallelogram.java | 64c49c947b7d6a9a0dc4c7704bc48fd959a90182 | [] | no_license | dravvin7937/Classwork | 252fd18ed5d254284a5edc61d7646929dc257c6d | c3c3664c7a19ef93197faa583aa3ff41fe912691 | refs/heads/master | 2021-09-04T01:20:11.973746 | 2018-01-13T23:57:48 | 2018-01-13T23:57:48 | 107,158,022 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package Shapes;
public class Parallelogram implements Shape{
private double base;
private double height;
private double diagonalSide;
public Parallelogram(double base, double height, double diagonalSide)
{
this.base = base;
this.height = height;
this.diagonalSide = diagonalSide;
}
public double perimeter()
{
return base*2+diagonalSide*2;
}
public double area()
{
return base*height;
}
@Override
public String toString()
{
return "Base: " + base + "\t Height: " + height + "\t Diagonal Side: "+ diagonalSide + "\t Perimeter: " + this.perimeter() + "\t Area: " + this.area();
}
}
| [
"BT_1N3_26@BT_1N3_26.bktech.local"
] | BT_1N3_26@BT_1N3_26.bktech.local |
b62234813a326de2f44a39498f2f2acff68bc16d | 16a7a5d045e8f4bdea837fe3fb3607d7e6b68f13 | /module1/src/concurrentCollection/CopyOnWriteArrayListEx1.java | c4737083588948e0a71ef891410c5beca5af762e | [] | no_license | Pratik-Singh786/new_core_java | 2d19cf74c629b70a3400a26000a30e6396b03f4a | 6fa7186cd5f60d7030e95b4030e15800ee19b045 | refs/heads/main | 2023-09-03T07:44:12.908410 | 2021-11-20T13:22:08 | 2021-11-20T13:22:08 | 430,109,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 949 | java | package concurrentCollection;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;
public class CopyOnWriteArrayListEx1 extends Thread
{
static CopyOnWriteArrayList l=new CopyOnWriteArrayList();
public void run()
{
try
{
Thread.sleep(1000);
}
catch(Exception e)
{
}
System.out.println("Child thread updating list");
l.add("C");
}
public static void main(String [] args) throws Exception
{
l.add("A");
l.add("B");
CopyOnWriteArrayListEx1 cw= new CopyOnWriteArrayListEx1();//class obj
cw.start();
Iterator itr= l.iterator();
while(itr.hasNext())
{
String s1=(String) itr.next();
System.out.println("Main thread iterating List and currently object is: "+s1);
Thread.sleep(3000);
}
System.out.println(l);
}
}
| [
"pratik.rxl@gmail.com"
] | pratik.rxl@gmail.com |
66d19aedaea40723e5bf49abb3d69e7d6b33b196 | 3ca4466c8c241e0a1d4a69f96e52eaca436b60d6 | /src/java/com/model/inVisit/action/InvisitAction.java | 905ae0d3412e1809221e82eadce882a85cb48bea | [] | no_license | sangeetha56/Plexus1.6 | 07380e8fd2ba87c0053cfefa28f6c750cb4b71a1 | 7d6c81c685921b4ca49d403f908be9469afe5344 | refs/heads/master | 2020-04-07T13:45:42.311882 | 2018-03-07T10:20:42 | 2018-03-07T10:20:42 | 124,216,849 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 984 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.model.inVisit.action;
import com.model.inVisit.service.InVisitService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author Administrator
*/
public class InvisitAction {
HttpServletRequest request;
HttpServletResponse response;
String url;
public InvisitAction(HttpServletRequest request, HttpServletResponse response) {
this.request = request;
this.response = response;
}
public String execute(String action) {
if (action.equalsIgnoreCase("deletePatientVisit")) {
url = deletePatientVisit();
}
return url;
}
private String deletePatientVisit() {
Long id= new InVisitService(request, response).deletePatientVisit();
return "Controller?process=InPatientProcess&action=viewDetails&id="+id;
}
}
| [
"33964122+sangeetha56@users.noreply.github.com"
] | 33964122+sangeetha56@users.noreply.github.com |
2cb2339a701ed00eab1f1de17817f87e1930d681 | 94f62ccfb5184d950f6fcdd72b9862c338a2b25e | /day16Proj/Consignment1.java | 7237c46a4336560fcc9cdc321a512506230e5903 | [] | no_license | vipin978/EYTraining | d28da092a125bd7728ccf3048f4fba562b85f34f | ddd45cc65225cbb52d6755b163afa423214a21bf | refs/heads/main | 2023-04-10T20:44:13.174361 | 2021-04-22T03:17:13 | 2021-04-22T03:17:13 | 340,357,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,021 | java | package day16Proj;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.LocalTime;
public class Consignment1 {
public static void main(String[] args) {
PackageTracker pt = new PackageTracker(LocalDateTime.now(), 200, 5);
System.out.println(pt.calculateReachTime());
}
}
class PackageTracker{
LocalDateTime startDatetime;
LocalDateTime endDatetime;
int distance;
int speed;
int totalHours;
public PackageTracker(LocalDateTime startDateTime,int distance,int speed) {
this.startDatetime = startDateTime;
this.distance = distance;
this.speed = speed;
this.totalHours = PackageTrackerUtil.findTimeTake(distance, speed);
}
public LocalDateTime calculateReachTime() {
LocalDateTime startDt = this.startDatetime;
LocalDateTime endDt = PackageTrackerUtil.getEndDateTime(startDt);
int breakHrs = 0;
System.out.println(this.totalHours);
while(this.totalHours > 0) {
System.out.println(" "+ startDt +" "+endDt);
Duration dur = Duration.between(startDt, endDt);
long hours = dur.toHours();
if(WeekEndDays.isWeekEnd(startDt)) {
startDt = endDt.minusHours(0);
endDt = endDt.plusHours(24);
}
else {
breakHrs = PackageTrackerUtil.tbh.durationHours(startDt, endDt);
// System.out.println("Break Hours ...."+breakHrs+"Total hours ...."+this.totalHours);
this.totalHours -= (hours-(breakHrs/60));
// System.out.println("Break Hours 2 ...."+breakHrs+"Total hours 2...."+this.totalHours);
startDt = endDt.minusHours(0);
endDt = endDt.plusHours(hours);
}
}
if(Math.abs(this.totalHours) > 0) {
startDt = startDt.minusHours(24);
endDt = endDt.minusHours(24);
//System.out.println("DURATION [ "+startDt +" "+ endDt+" ]");
endDt = endDt.minusHours(Math.abs(this.totalHours));
//System.out.println("DURATION [ "+startDt +" "+ endDt+" ]");
int bHrs = (breakHrs-PackageTrackerUtil.tbh.durationHours(startDt, endDt));
endDt = endDt.minusHours(bHrs/60);
}
return endDt;
}
}
class PackageTrackerUtil{
static TotalBreakHours tbh = new TotalBreakHours();
public static int findTimeTake(int distance,int speed) {
return distance / speed;
}
public static LocalDateTime getEndDateTime(LocalDateTime start) {
LocalDateTime end;
if(start.getHour() < 6) {
end = start.with(LocalTime.of(6, 0));
}
else {
end = start.plusDays(1).with(LocalTime.of(6, 0));
}
return end;
}
}
class WeekEndDays{
public static boolean isWeekEnd(LocalDateTime LDT) {
if(LDT.getDayOfWeek().getValue() == 6 && LDT.getHour() > 6) {
return true;
}
if(LDT.getDayOfWeek().getValue() == 1 && LDT.getHour() < 6) {
return true;
}
if(LDT.getDayOfWeek().getValue() == 7) {
return true;
}
return false;
}
}
abstract class BreakHours{
abstract public int durationHours(LocalDateTime start,LocalDateTime end);
}
class TotalBreakHours extends BreakHours{
LunchBreakHour lunchBreak = new LunchBreakHour();
EveningBreakHour eveBreak = new EveningBreakHour();
MorningBreakHour mrngBreak = new MorningBreakHour();
@Override
public int durationHours(LocalDateTime start, LocalDateTime end) {
mrngBreak.setMorningBreakTime(start.with(LocalTime.of(10, 30)));
lunchBreak.setLunchBreakTime(start.with(LocalTime.of(13, 30)));
eveBreak.setEveningBreakTime(start.with(LocalTime.of(17, 30)));
int totalHours = 0;
totalHours = mrngBreak.durationHours(start, end) + lunchBreak.durationHours(start, end)
+eveBreak.durationHours(start, end);
return totalHours;
}
}
class MorningBreakHour extends BreakHours{
public static int offset = 15;
private LocalDateTime morningBreakTime;
public void setMorningBreakTime(LocalDateTime mrngDT) {
this.morningBreakTime = mrngDT;
}
@Override
public int durationHours(LocalDateTime start, LocalDateTime end) {
if(start == null && end == null) {
return offset;
}
else {
if(start.compareTo(morningBreakTime) < 0 && end.compareTo(morningBreakTime) > 0) {
return offset;
}
}
return 0;
}
}
class LunchBreakHour extends BreakHours{
public static int offset = 60;
private LocalDateTime lunchBreakTime;
public void setLunchBreakTime(LocalDateTime lunchDT) {
this.lunchBreakTime = lunchDT;
}
@Override
public int durationHours(LocalDateTime start, LocalDateTime end) {
if(start == null && end == null) {
return offset;
}
else {
if(start.compareTo(lunchBreakTime) < 0 && end.compareTo(lunchBreakTime) > 0) {
return offset;
}
}
return 0;
}
}
class EveningBreakHour extends BreakHours{
public static int offset = 15;
private LocalDateTime eveningBreakTime;
public void setEveningBreakTime(LocalDateTime eveDT) {
this.eveningBreakTime = eveDT;
}
@Override
public int durationHours(LocalDateTime start, LocalDateTime end) {
if(start == null && end == null) {
return offset;
}
else {
if(start.compareTo(eveningBreakTime) < 0 && end.compareTo(eveningBreakTime) > 0) {
return offset;
}
}
return 0;
}
} | [
"54683308+vipin978@users.noreply.github.com"
] | 54683308+vipin978@users.noreply.github.com |
f47723d94f3c57a7ac8236d57b37390a420c7d01 | 923703cbd1f04e66e92d5f4ad4cda88b173b34c6 | /src/main/java/tn/esprit/kidzone/repository/ListParticipantsRepository.java | a79f4e86b35dd48e8fca66a73f032ea769b1a8a8 | [] | no_license | DOMINATORS2021/KidZoneB | 0f775ce74aca6ab5fa62cca83771bada92c6d136 | 110eaa73292d1b2155b52da9985edd511843225d | refs/heads/master | 2023-06-10T06:52:16.727236 | 2021-07-04T20:07:56 | 2021-07-04T20:07:56 | 355,497,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,062 | java | package tn.esprit.kidzone.repository;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import tn.esprit.kidzone.entity.Event;
import tn.esprit.kidzone.entity.ListParticipants;
import tn.esprit.kidzone.entity.User;
@Repository
public interface ListParticipantsRepository extends CrudRepository<ListParticipants, Integer> {
@Query("select DISTINCT e from User e " + "join e.list_participants l " + "join l.event m " + "where m.id=:eventId")
public List<User> getAllUserByEvent(@Param("eventId") int eventId);
@Query("select DISTINCT e from Event e " + "join e.list_participants l " + "join l.user m " + "where m.id=:userId")
public List<Event> getAllEventByUser(@Param("userId") Long userId);
@Query("SELECT a from ListParticipants a where a.user.id=:id AND a.event.id=:ide ")
public ListParticipants annuler(@Param("id") Long id, @Param("ide") int ide);
}
| [
"mouradjomaa9@gmail.com"
] | mouradjomaa9@gmail.com |
645a93f89aea427e3d2f9d23da13d038128665be | 8d3aa2531b2758d78085a4e016a20a10c6b1926b | /src/main/java/pl/nescior/wordsgrouping/cli/Runner.java | 1390d27506388afcc2945dfb4a427e17e7529cfd | [] | no_license | pnescior/words-grouping | 44cc2201f4907910485776718578ae98cca4fb8b | 6d76bf98bebcbe835c5e19e2af95606c0898dcec | refs/heads/main | 2022-05-03T16:27:48.613422 | 2022-03-16T22:23:07 | 2022-03-16T22:23:07 | 240,946,262 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,726 | java | package pl.nescior.wordsgrouping.cli;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import pl.nescior.wordsgrouping.Group;
import pl.nescior.wordsgrouping.WordsGrouper;
import java.io.File;
import java.nio.file.Files;
import java.util.List;
import java.util.concurrent.Callable;
import static java.util.stream.Collectors.toList;
@Command(
name = "words-grouping",
description = "tool for listing most common words from a file with given tolerance for each group (using Levenshtein distance)",
sortOptions = false
)
class Runner implements Callable<Integer> {
@Option(
names = {"-f", "--file"},
required = true,
description = {"input file to read data from", "words will be read from each line in the file, splitted by a space or any special character"}
)
private File inputFile;
@Option(names = {"-o", "--output"}, description = "file where the CSV result will be written to")
private File outputFile;
@Option(names = {"-p", "--print"}, description = "whether the results should be printed to console")
private boolean printToConsole;
@Option(names = "--max-distance", description = "max Levenshtein distance for a single words group")
private double maxDistance = 2.5;
@Option(names = {"-h", "--help"}, usageHelp = true, description = "display help message")
private boolean helpRequested = false;
private static final WordsGrouper wordsGrouper = new WordsGrouper();
private static final CsvPrinter csvPrinter = new CsvPrinter();
@Override
public Integer call() throws Exception {
List<String> strings = Files.readAllLines(inputFile.toPath());
List<Group> groups = wordsGrouper.analyze(strings, maxDistance);
if (printToConsole) {
printFormattedGroups(groups);
}
if (outputFile != null) {
csvPrinter.printGroups(groups, outputFile);
}
return 0;
}
public static void main(String[] args) {
int exitCode = new CommandLine(new Runner()).execute(args);
System.exit(exitCode);
}
private static void printFormattedGroups(List<Group> groups) {
groups.stream()
.map(Runner::formatGroup)
.forEachOrdered(System.out::println);
}
private static String formatGroup(Group group) {
List<String> wordsWithCount = group.getWords().stream()
.sorted()
.map(word -> String.format("%s %d", word.get(), word.getCount()))
.collect(toList());
return String.format("[%s]: %d", String.join(", ", wordsWithCount), group.getCount());
}
}
| [
"pavel.henry@gmail.com"
] | pavel.henry@gmail.com |
138c15784df19493ebea479f97003175ff45d1cb | ff8382c10d95036e4c31b9a866d88499ecd56c9d | /src/test/java/com/dsg/cucumber/pages/pdp/ProductDetailsPage.java | 1e1d13c5450b03a8941f3ff67a34ef76853ebb32 | [] | no_license | nashua1985/testrepo | c27284ac60d4412355938a84d026c75fc4c46b86 | 5996bc62f20e5d86946ca45adc2d1eb56434585c | refs/heads/master | 2023-08-29T21:35:31.999768 | 2021-11-09T14:40:39 | 2021-11-09T14:40:39 | 421,069,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,745 | java | package com.dsg.cucumber.pages.pdp;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class ProductDetailsPage {
//from plp or search results
public static By firstProductInGrid = By.xpath("//*[@class='card_image']");
public static By clearFilters= By.className("dsg-react-hyperlink");
//Product details
public static By productName= By.className("title");
public static By currentPrice= By.className("product-price ng-star-inserted");
//Buttons and links
/*@FindBy(how= how = How.xpath,using=("//div[@id='facet_list_label_Color']"))
public static WebElement colorDropdown;
public static By bluebutton=By.xpath("//span[@style=\\\"background-color: blue;\\\"]");*/
public static By addToCart = By.id("add-to-cart");
public static By goToCart = By.xpath("//a[contains(text(),'GO TO CART')]");
public static By cart_title = By.xpath("//title[contains(text(), 'Cart')]");
public static By continueShopping = By.className("dsg-button dsg-button-tertiary medium-height");
public static By customNext = By.id("sliderRight");
public static By customSaveSelection = By.id("formSubmit");
public static By quantityBox = By.id("inputQty");
public static By topNav = By.xpath("//li[@id='dropbtn']/span/span");
public static By shopDepartments = By.xpath("//span[contains(text(),'Shop Departments')]");
public static By topBrands= By.xpath("//span[contains(text(),'Top Brands')]");
public static By YetiBrand= By.xpath("//a[contains(text(),'Yeti')]");
public static By outdoorRec= By.xpath("//span[contains(text(),'Outdoor & Recreation')]");
public static By Fishing= By.xpath("//strong[contains(text(),' Fishing')]");
public static By rods= By.xpath("//a[@title='Rods']");
public static By BikesCycling= By.xpath("//strong[contains(text(),'Bikes & Cycling')]");
public static By bikes= By.xpath("//a[@title='Bikes']");
public static By closeButton = By.xpath("//button[@class='btn btn-close']/i");
public static By detail = By.xpath("//i[@class='material-icons details-toggle-icon']");//div[@class='d-flex align-items-center']/p[contains(text(),'Details')]
public static By ratingsButton = By.xpath("//button[@class='bv_main_container_row_flex']");
public static By reviewSearch = By.xpath("//button[@class='bv-content-btn bv-content-search-btn bv-focusable']");
public static By reviewFilterBtn = By.xpath("//button[@class='bv-content-btn bv-filter-control bv-expand-filter-button bv-focusable']");
public static By ownedforDropdown = By.xpath("//button[@class='bv-focusable']/span[@class='bv-dropdown-title' and contains(text(),'Owned for')]");
public static By oneMonthorLess = By.xpath("//li[@data-bv-dropdown-value='1month']");
public static By changeStorelink = By.xpath("//span[contains(text(),'Change Store')]");
public static By zipcodeSearch=By.xpath("//button[@class='search-button']");
public static By showStoresCheckbox=By.xpath("//input[@class='hmf-input-checkbox']");
public static By selectStoreradio=By.xpath("//span[@class='store-select-radio-custom']");
public static By selectStoreButton=By.xpath("//button/span[contains(text(),'Set Store')]");
public static By notifyMeButton=By.xpath("//button[contains(text(),'Notify Me When Available')]");
public static By notAvailable=By.xpath("//span[contains(text(),'Not Available at ')]");
public static By linkStoreInfo=By.xpath("//button[@class='store-details-dropdown']");
public static By rodLengthDropdown=By.xpath("//div[@id='facet_list_label_Rod Length']");
public static By viewAllSizes=By.xpath("//div[contains(text(),'View All Sizes')]");
//Attributes
//Colors
public static By colorNavy = By.xpath("//button[@aria-label='Navy']");
public static By colorBlack = By.xpath("//button[@aria-label='Black']");
public static By colorRed = By.xpath("//button[contains(@aria-label,'Red')]");
public static By colorChrome = By.xpath("//button[@aria-label='Chrome']");
public static By colorRedShoe = By.xpath("//div[@aria-labelledby='3232_facet_value_Red']");
public static By colorMatteBlack = By.xpath("//button[@aria-label='Matte Black']");
public static By colorWhiteBlackWhite = By.xpath("//button[@aria-label='White/Black/White']");
public static By colorBlackFacemask = By.xpath("//button[@id='facemaskcolor-riddellmaskcolor-black']");
public static By colorFilter = By.xpath("//div[@id='facet_list_label_Color']");
public static By saleFilter = By.xpath("//div[@id='facet_list_label_Sale']");
public static By genderFilter = By.xpath("//div[@id='facet_list_label_Gender']");
public static By gendermens = By.xpath("//div[@aria-labelledby='5495_facet_value_Men_s']/input");
public static By saletogglebutton = By.xpath("//div[@class='mdc-switch__thumb']");
public static By priceFilter = By.xpath("//div[@id='facet_list_label_Price']");
public static By under25 = By.xpath("//div[@aria-labelledby='dickssportinggoodsofferprice_facet_value_*-25']/span[@class='dsg-checkmark-wrapper']");
public static By under50 = By.xpath("//div[@aria-labelledby='dickssportinggoodsofferprice_facet_value_25-50']/span[@class='dsg-checkmark-wrapper']");
public static By colorBlackHoodie = By.xpath("//div[@aria-labelledby='3232_facet_value_Black']");
public static By sizeFilter = By.xpath("//div[@id='facet_list_label_Size']");
public static By SizeMediumHoodie = By.xpath("//div[@aria-labelledby='299_facet_value_M']");
public static By ShoeSizeFilter = By.xpath("//div[@id='facet_list_label_Mens_Shoe_Size']");
public static By ShoeSize11 = By.xpath("//div[@aria-labelledby='[object Object]_facet_value_11.0']");
//Sizes
public static By sizeMedium = By.xpath("//span[text()='M']");
public static By customSizeMedium = By.id("size-m");
public static By sizeLarge = By.id("block-swatch_Size_3");
public static By customSizeLarge = By.id("size-l");
public static By rodLength7 = By.id("block-swatch_RodLength_1");
public static By rodPower = By.xpath("//button[@aria-label='Medium']");
public static By frameSize3 = By.id("block-swatch_FrameSize_3");
public static By shoeSize11 = By.xpath("//button[@aria-label='11.0']");
public static By shoeSize9 = By.xpath("//button[@aria-label='9.0']");
public static By pantSize32 = By.xpath("//button[@aria-label='32']");
public static By inseam32 = By.xpath("//button[@aria-label='32']");
public static By batLength32 = By.xpath("//button[@aria-label='32\"']");
public static By batWeight29 = By.xpath("//button[@aria-label='29 OZ']");
public static By customSize52 = By.xpath("//button[@aria-label='52']");
public static By frameSize15 = By.xpath("//button[@aria-label='15\"']");
public static By frameSize17 = By.xpath("//button[@aria-label='17\"']");
public static By frameSize19= By.xpath("//button[@aria-label='19\"']");
public static By frameSize21= By.xpath("//button[@aria-label='21\"']");
//Fields
public static By textLine1 = By.id("textLine1");
public static By textLine2 = By.id("textLine2");
public static By textLine3 = By.id("textLine3");
public static By personalizationNum = By.id("numberLine1");
public static By customJerseyName = By.id("teamplayernamestaticcolor-playerNameInput");
public static By customJerseyNumber = By.id("teamplayernumberstaticcolor-playerNumberInput");
public static By customTitle = By.id("responsiveTitle");
public static By searchReviewtext = By.id("bv-text-field-search-contentSearch1");
public static By searchReviewLightBoxtext= By.id("bv-text-field-search-contentSearch1-lightboxSearch");
public static By reviewDropdown= By.xpath("//div/button[@aria-labelledby='bv-dropdown-reviews-menu bv-dropdown-select-reviews bv-dropdown-title-reviews']");
public static By mostRecent= By.xpath("//li[@id='data-bv-dropdown-item-mostRecent']");
public static By zipcodeText = By.xpath("//input[@id='zip-code']");
//Custom
public static By facemaskS2BDHS4 = By.xpath("//button[@aria-label='riddell_victor_helmet_s2bdsp']");
public static By genderWomens = By.xpath("//button[@aria-label='Women's']");
public static By handLeft = By.xpath("//button[@aria-label='LH']");
public static By loft9 = By.xpath("//button[@aria-label='loft-9']");
public static By loftDropdown = By.id("select-loft");
public static By shaftManufacturerDropDown = By.id("select-shaft_manufacturer");
public static By shaftFujikura = By.id("shaft_manufacturer-fujikura");
public static By driverLengthDropdown = By.id("select-length");
public static By driverLengthWomensStandard = By.id("length-women’s standard");
public static By gripBrandDropdown = By.id("select-gripbrand");
public static By gripBuildDropdown = By.id("select-gripsize");
public static By shaftMaterialSteel = By.id("shaft_material-steel-label");
public static By handLeftIron = By.xpath("//button[@id='hand-lh']");
public static By setMakeUp = By.xpath("//button[@aria-label='5-PW, UW, SW']");
public static By indiIronSelectionToggle = By.xpath("//div[@id='ironSelectionTogglerIndividualIronSelection']");
public static By fiveIron = By.xpath("//button[@ria-label='5 iron']");
public static By lieDropdown = By.xpath("//select[@id='select-lie']");
public static By filterButton=By.xpath("//div[@class='rs-filter-svg']");
//page titles
public static By sizeChartTitle = By.xpath("//div[contains(text(),'Size Chart')]");
public static By promodescTitle = By.xpath("//div[contains(text(),'Promotion Details')]");
}
| [
"nashua.1985@gmail.com"
] | nashua.1985@gmail.com |
d2fa0c888bc16ef5db10087ba787dcc4d112d42c | 58dd9f1a7fa07b340eac29dfcadd40b534fe601d | /src/newcoder/Solution_10.java | 140fc0a519ad15e8487407bc779106b032cb536e | [] | no_license | guitarcw/newcoder | 82d4304241922a049c5413b37e8bcce0bc821a2a | ec275e5239cd4fbe29ac56fa5b1e5e6982971939 | refs/heads/master | 2021-01-01T04:09:40.565856 | 2017-09-09T07:31:21 | 2017-09-09T07:31:21 | 97,135,277 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 281 | java | package newcoder;
/* 输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。*/
public class Solution_10 {
public int NumberOf1(int n) {
int count=0;
while (n!=0) {
count++;
n=(n-1)&n;
}
return count;
}
}
| [
"cw_bupt@163.com"
] | cw_bupt@163.com |
2c01eb8b8c3a6ba8abdfd433a8ac727e8b81d9bd | c2641e424b909ceefa72591ed0f03ad0ba887eef | /src/test/java/pages/HeaderPage.java | 59f01bee0c46eaa05f677be40de05f18a2fa3d23 | [] | no_license | elciak82/Ombre_Selenium_Project | d0f8c09ea612b07f43b5e7e2c9e1ed93111d7984 | ab6302a8b690bd797e7cc8e4588f896db860c652 | refs/heads/master | 2020-05-29T22:47:53.487870 | 2019-06-13T18:42:24 | 2019-06-13T18:42:24 | 189,419,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 639 | java | package pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class HeaderPage extends GenericPage{
public HeaderPage(WebDriver driver) {
super(driver);
PageFactory.initElements(driver, this);
}
@FindBy (css = "[href='/cart']")
WebElement cartIcon;
public CartPage openCartPage(){
GenericPage genericPage = new GenericPage(driver);
genericPage.fluentWaitForElementDisplayed(cartIcon);
cartIcon.click();
return new CartPage(driver);
}
}
| [
"ewelina@10.12.0.165"
] | ewelina@10.12.0.165 |
0f7ea59ea71d4031201424ca1f1819c3b2cee828 | 33bb78375c94f2b0b074691745142c8747fc49fb | /src/test/java/musicPlayTests/Userflow.java | 763636058a2fd6ab47989c4f9377d4a4dd628e82 | [] | no_license | Faatima7861/global-kinetic-android-assessment | 30a491081bd12c80e7a07d64631dee8eb5b677bc | caeec7fd67a2919f56bebfcccc5762e04dbde661 | refs/heads/master | 2023-01-14T11:43:35.262983 | 2020-11-18T09:24:16 | 2020-11-18T09:24:16 | 313,877,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,275 | java | package musicPlayTests;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import TestData.DataGenerator;
import io.appium.java_client.MobileElement;
import io.appium.java_client.TouchAction;
import static io.appium.java_client.touch.TapOptions.tapOptions;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import musicPlay.Base;
import pageObjects.UserFlowPF;
public class Userflow extends Base {
@Test(priority = 0)
public void genres() {
UserFlowPF uf = new UserFlowPF(driver);
// AndroidDriver<AndroidElement> driver = capabilities();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
uf.genres.click();
System.out.println("Success - Genre Clicked");
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
}
@Test(priority = 1)
public void rock() {
UserFlowPF uf = new UserFlowPF(driver);
uf.rock.click();
System.out.println("Success - Selected Rock");
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
}
@Test(priority = 2)
public void motoCrossSong() throws IOException, InterruptedException {
UserFlowPF uf = new UserFlowPF(driver);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
uf.motoCross.click();
driver.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS);
System.out.println("Success - Playing motocross");
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
}
@Test(priority = 3)
public void pause() throws IOException, InterruptedException {
UserFlowPF uf = new UserFlowPF(driver);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
uf.PlayPause.click();
System.out.println("Success - Paused song");
}
}
| [
"mac@Faatimas-MBP.Dlink"
] | mac@Faatimas-MBP.Dlink |
1a4fbed60f76323e308794cc8e0af794a5a8b962 | 0a2924f4ae6dafaa6aa28e2b947a807645494250 | /dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/UpdateIndicatorGroupSetAction.java | a815ed09a5a758e973240e2e0677c0c3703e793c | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | filoi/ImmunizationRepository | 9483ee02afd0b46d0f321a1e1ff8a0f6d8ca7f71 | efb9f2bb9ae3da8c6ac60e5d5661b8a79a6939d5 | refs/heads/master | 2023-03-16T03:26:34.564453 | 2023-03-06T08:32:07 | 2023-03-06T08:32:07 | 126,012,725 | 0 | 0 | BSD-3-Clause | 2022-12-16T05:59:21 | 2018-03-20T12:17:24 | Java | UTF-8 | Java | false | false | 4,009 | java | package org.hisp.dhis.dd.action.indicatorgroupset;
/*
* Copyright (c) 2004-2015, University of Oslo
* 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 the HISP project 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 OWNER 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.
*/
import com.opensymphony.xwork2.Action;
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.indicator.IndicatorGroupSet;
import org.hisp.dhis.indicator.IndicatorService;
import java.util.ArrayList;
import java.util.List;
/**
* @author Tran Thanh Tri
*/
public class UpdateIndicatorGroupSetAction
implements Action
{
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
private IndicatorService indicatorService;
public void setIndicatorService( IndicatorService indicatorService )
{
this.indicatorService = indicatorService;
}
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
private Integer id;
public void setId( Integer id )
{
this.id = id;
}
private String name;
public void setName( String name )
{
this.name = name;
}
private String description;
public void setDescription( String description )
{
this.description = description;
}
private boolean compulsory;
public void setCompulsory( boolean compulsory )
{
this.compulsory = compulsory;
}
private List<String> ingSelected = new ArrayList<>();
public void setIngSelected( List<String> ingSelected )
{
this.ingSelected = ingSelected;
}
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@Override
public String execute()
throws Exception
{
IndicatorGroupSet indicatorGroupSet = indicatorService.getIndicatorGroupSet( id );
indicatorGroupSet.setName( StringUtils.trimToNull( name ) );
indicatorGroupSet.setDescription( StringUtils.trimToNull( description ) );
indicatorGroupSet.setCompulsory( compulsory );
indicatorGroupSet.getMembers().clear();
for ( String id : ingSelected )
{
indicatorGroupSet.getMembers().add( indicatorService.getIndicatorGroup( id ) );
}
indicatorService.updateIndicatorGroupSet( indicatorGroupSet );
return SUCCESS;
}
}
| [
"neeraj@filoi.in"
] | neeraj@filoi.in |
59a0e67e5aa402868154929450a8301326e5c6ec | 2d2281eeba8d495e567adc3c31c8d4ffa0f1a67a | /src/main/java/FizzBuzz.java | cf65c4fc49ca4753f40dbac3b5e183b68c56e8a3 | [] | no_license | ShuwenKANG/fizz-buzz | 4e6946e212053c46389fcc29fd9aa62385c9ffc6 | f86859449e815815ab1cd953a748dbcaa8a26a4d | refs/heads/master | 2020-12-09T07:25:07.436762 | 2020-01-11T14:24:04 | 2020-01-11T14:24:04 | 233,235,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,806 | java | import java.util.Arrays;
import java.util.List;
public class FizzBuzz {
public String fizzBuzz(int i) {
List<String> strategyList = Arrays.asList("isFizzBuzzWhizz", "isFizzBuzz", "isBuzzWhizz", "isFizzWhizz", "isFizz",
"isBuzz", "isWhizz");
if(hasX(i, 7)) {
strategyList = Arrays.asList("has3", "isFizzWhizz", "isFizz", "isWhizz");
return this.applyStrategies(i, strategyList);
}
if(hasX(i, 5)) {
strategyList = Arrays.asList("isBuzzWhizz", "isBuzz", "isWhizz");
return this.applyStrategies(i, strategyList);
}
if(hasX(i, 3)) {
return "Fizz";
}
return this.applyStrategies(i, strategyList);
}
public static void main(String[] args){
FizzBuzz fizzBuzz = new FizzBuzz();
for(int i=0; i<120; i++) {
System.out.println(fizzBuzz.fizzBuzz(i));
}
}
private String applyStrategies(int i, List<String> strategyList) {
for(String strategy: strategyList) {
switch (strategy) {
case "has3":
if(hasX(i, 3)) {
return "Fizz";
}
break;
case "isFizzBuzzWhizz":
if(isFizzBuzzWhizz(i)) {
return "FizzBuzzWhizz";
}
break;
case "isFizzBuzz":
if(isFizzBuzz(i)) {
return "FizzBuzz";
}
break;
case "isFizzWhizz":
if(isFizzWhizz(i)) {
return "FizzWhizz";
}
break;
case "isBuzzWhizz":
if(isBuzzWhizz(i)) {
return "BuzzWhizz";
}
break;
case "isFizz":
if(isFizz(i)) {
return "Fizz";
}
break;
case "isBuzz":
if(isBuzz(i)) {
return "Buzz";
}
break;
case "isWhizz":
if(isWhizz(i)) {
return "Whizz";
}
break;
default:
throw new IllegalStateException("Unexpected value: " + strategy);
}
}
return String.valueOf(i);
}
private boolean hasX(int i, int x) {
return String.valueOf(i).contains(String.valueOf(x));
}
private boolean isFizzWhizz(int i) {
return isFizz(i) && isWhizz(i);
}
private boolean isBuzzWhizz(int i) {
return isBuzz(i) && isWhizz(i);
}
private boolean isFizzBuzz(int i) {
return isFizz(i) && isBuzz(i);
}
private boolean isFizzBuzzWhizz(int i) {
return isFizz(i) && isBuzz(i) && isWhizz(i);
}
private boolean isWhizz(int i) {
return isMultiplesOfX(i, 7);
}
private boolean isBuzz(int i) {
return isMultiplesOfX(i, 5);
}
private boolean isFizz(int i) {
return isMultiplesOfX(i, 3);
}
private boolean isMultiplesOfX(int i, int x) {
return i%x == 0;
}
}
| [
"shuwen.kang@exxonmobil.com"
] | shuwen.kang@exxonmobil.com |
66e99f9247b7af7cf51fb0a442cb5054f3db6a53 | ffb51aa15e6e8d2f259843c783e66af7c0a85ff8 | /src/java/com/tsp/sct/dao/dto/ClienteCampoAdicional.java | 3c22d32f154d0657654174b9c32d768614be4f65 | [] | no_license | Karmaqueda/SGFENS_BAFAR-1 | c9c9b0ffad3ac948b2a76ffbbd5916c1a8751c51 | 666f858fc49abafe7612600ac0fd468c54c37bfe | refs/heads/master | 2021-01-18T16:09:08.520888 | 2016-08-01T18:49:40 | 2016-08-01T18:49:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,222 | java | /*
* This source file was generated by FireStorm/DAO.
*
* If you purchase a full license for FireStorm/DAO you can customize this header file.
*
* For more information please visit http://www.codefutures.com/products/firestorm
*/
package com.tsp.sct.dao.dto;
import com.tsp.sct.dao.dao.*;
import com.tsp.sct.dao.factory.*;
import com.tsp.sct.dao.exceptions.*;
import java.io.Serializable;
import java.util.*;
public class ClienteCampoAdicional implements Serializable
{
/**
* This attribute maps to the column ID_CLIENTE_CAMPO in the cliente_campo_adicional table.
*/
protected int idClienteCampo;
/**
* This attribute represents whether the attribute idClienteCampo has been modified since being read from the database.
*/
protected boolean idClienteCampoModified = false;
/**
* This attribute maps to the column ID_EMPRESA in the cliente_campo_adicional table.
*/
protected int idEmpresa;
/**
* This attribute represents whether the attribute idEmpresa has been modified since being read from the database.
*/
protected boolean idEmpresaModified = false;
/**
* This attribute maps to the column ID_ESTATUS in the cliente_campo_adicional table.
*/
protected int idEstatus;
/**
* This attribute represents whether the primitive attribute idEstatus is null.
*/
protected boolean idEstatusNull = true;
/**
* This attribute represents whether the attribute idEstatus has been modified since being read from the database.
*/
protected boolean idEstatusModified = false;
/**
* This attribute maps to the column LABEL_NOMBRE in the cliente_campo_adicional table.
*/
protected String labelNombre;
/**
* This attribute represents whether the attribute labelNombre has been modified since being read from the database.
*/
protected boolean labelNombreModified = false;
/**
* This attribute maps to the column TIPO_LABEL in the cliente_campo_adicional table.
*/
protected int tipoLabel;
/**
* This attribute represents whether the primitive attribute tipoLabel is null.
*/
protected boolean tipoLabelNull = true;
/**
* This attribute represents whether the attribute tipoLabel has been modified since being read from the database.
*/
protected boolean tipoLabelModified = false;
/**
* Method 'ClienteCampoAdicional'
*
*/
public ClienteCampoAdicional()
{
}
/**
* Method 'getIdClienteCampo'
*
* @return int
*/
public int getIdClienteCampo()
{
return idClienteCampo;
}
/**
* Method 'setIdClienteCampo'
*
* @param idClienteCampo
*/
public void setIdClienteCampo(int idClienteCampo)
{
this.idClienteCampo = idClienteCampo;
this.idClienteCampoModified = true;
}
/**
* Sets the value of idClienteCampoModified
*/
public void setIdClienteCampoModified(boolean idClienteCampoModified)
{
this.idClienteCampoModified = idClienteCampoModified;
}
/**
* Gets the value of idClienteCampoModified
*/
public boolean isIdClienteCampoModified()
{
return idClienteCampoModified;
}
/**
* Method 'getIdEmpresa'
*
* @return int
*/
public int getIdEmpresa()
{
return idEmpresa;
}
/**
* Method 'setIdEmpresa'
*
* @param idEmpresa
*/
public void setIdEmpresa(int idEmpresa)
{
this.idEmpresa = idEmpresa;
this.idEmpresaModified = true;
}
/**
* Sets the value of idEmpresaModified
*/
public void setIdEmpresaModified(boolean idEmpresaModified)
{
this.idEmpresaModified = idEmpresaModified;
}
/**
* Gets the value of idEmpresaModified
*/
public boolean isIdEmpresaModified()
{
return idEmpresaModified;
}
/**
* Method 'getIdEstatus'
*
* @return int
*/
public int getIdEstatus()
{
return idEstatus;
}
/**
* Method 'setIdEstatus'
*
* @param idEstatus
*/
public void setIdEstatus(int idEstatus)
{
this.idEstatus = idEstatus;
this.idEstatusNull = false;
this.idEstatusModified = true;
}
/**
* Method 'setIdEstatusNull'
*
* @param value
*/
public void setIdEstatusNull(boolean value)
{
this.idEstatusNull = value;
this.idEstatusModified = true;
}
/**
* Method 'isIdEstatusNull'
*
* @return boolean
*/
public boolean isIdEstatusNull()
{
return idEstatusNull;
}
/**
* Sets the value of idEstatusModified
*/
public void setIdEstatusModified(boolean idEstatusModified)
{
this.idEstatusModified = idEstatusModified;
}
/**
* Gets the value of idEstatusModified
*/
public boolean isIdEstatusModified()
{
return idEstatusModified;
}
/**
* Method 'getLabelNombre'
*
* @return String
*/
public String getLabelNombre()
{
return labelNombre;
}
/**
* Method 'setLabelNombre'
*
* @param labelNombre
*/
public void setLabelNombre(String labelNombre)
{
this.labelNombre = labelNombre;
this.labelNombreModified = true;
}
/**
* Sets the value of labelNombreModified
*/
public void setLabelNombreModified(boolean labelNombreModified)
{
this.labelNombreModified = labelNombreModified;
}
/**
* Gets the value of labelNombreModified
*/
public boolean isLabelNombreModified()
{
return labelNombreModified;
}
/**
* Method 'getTipoLabel'
*
* @return int
*/
public int getTipoLabel()
{
return tipoLabel;
}
/**
* Method 'setTipoLabel'
*
* @param tipoLabel
*/
public void setTipoLabel(int tipoLabel)
{
this.tipoLabel = tipoLabel;
this.tipoLabelNull = false;
this.tipoLabelModified = true;
}
/**
* Method 'setTipoLabelNull'
*
* @param value
*/
public void setTipoLabelNull(boolean value)
{
this.tipoLabelNull = value;
this.tipoLabelModified = true;
}
/**
* Method 'isTipoLabelNull'
*
* @return boolean
*/
public boolean isTipoLabelNull()
{
return tipoLabelNull;
}
/**
* Sets the value of tipoLabelModified
*/
public void setTipoLabelModified(boolean tipoLabelModified)
{
this.tipoLabelModified = tipoLabelModified;
}
/**
* Gets the value of tipoLabelModified
*/
public boolean isTipoLabelModified()
{
return tipoLabelModified;
}
/**
* Method 'equals'
*
* @param _other
* @return boolean
*/
public boolean equals(Object _other)
{
if (_other == null) {
return false;
}
if (_other == this) {
return true;
}
if (!(_other instanceof ClienteCampoAdicional)) {
return false;
}
final ClienteCampoAdicional _cast = (ClienteCampoAdicional) _other;
if (idClienteCampo != _cast.idClienteCampo) {
return false;
}
if (idClienteCampoModified != _cast.idClienteCampoModified) {
return false;
}
if (idEmpresa != _cast.idEmpresa) {
return false;
}
if (idEmpresaModified != _cast.idEmpresaModified) {
return false;
}
if (idEstatus != _cast.idEstatus) {
return false;
}
if (idEstatusNull != _cast.idEstatusNull) {
return false;
}
if (idEstatusModified != _cast.idEstatusModified) {
return false;
}
if (labelNombre == null ? _cast.labelNombre != labelNombre : !labelNombre.equals( _cast.labelNombre )) {
return false;
}
if (labelNombreModified != _cast.labelNombreModified) {
return false;
}
if (tipoLabel != _cast.tipoLabel) {
return false;
}
if (tipoLabelNull != _cast.tipoLabelNull) {
return false;
}
if (tipoLabelModified != _cast.tipoLabelModified) {
return false;
}
return true;
}
/**
* Method 'hashCode'
*
* @return int
*/
public int hashCode()
{
int _hashCode = 0;
_hashCode = 29 * _hashCode + idClienteCampo;
_hashCode = 29 * _hashCode + (idClienteCampoModified ? 1 : 0);
_hashCode = 29 * _hashCode + idEmpresa;
_hashCode = 29 * _hashCode + (idEmpresaModified ? 1 : 0);
_hashCode = 29 * _hashCode + idEstatus;
_hashCode = 29 * _hashCode + (idEstatusNull ? 1 : 0);
_hashCode = 29 * _hashCode + (idEstatusModified ? 1 : 0);
if (labelNombre != null) {
_hashCode = 29 * _hashCode + labelNombre.hashCode();
}
_hashCode = 29 * _hashCode + (labelNombreModified ? 1 : 0);
_hashCode = 29 * _hashCode + tipoLabel;
_hashCode = 29 * _hashCode + (tipoLabelNull ? 1 : 0);
_hashCode = 29 * _hashCode + (tipoLabelModified ? 1 : 0);
return _hashCode;
}
/**
* Method 'createPk'
*
* @return ClienteCampoAdicionalPk
*/
public ClienteCampoAdicionalPk createPk()
{
return new ClienteCampoAdicionalPk(idClienteCampo);
}
/**
* Method 'toString'
*
* @return String
*/
public String toString()
{
StringBuffer ret = new StringBuffer();
ret.append( "com.tsp.sct.dao.dto.ClienteCampoAdicional: " );
ret.append( "idClienteCampo=" + idClienteCampo );
ret.append( ", idEmpresa=" + idEmpresa );
ret.append( ", idEstatus=" + idEstatus );
ret.append( ", labelNombre=" + labelNombre );
ret.append( ", tipoLabel=" + tipoLabel );
return ret.toString();
}
}
| [
"ing.gloriapalmagonzalez@gmail.com"
] | ing.gloriapalmagonzalez@gmail.com |
46701a1da6761a3a934efd8b25894f04caa7a389 | a94b994351e621047de315efcd7ea479ffba6a07 | /src/main/java/com/jFinal/project/creation/business/hr/HrRoutes.java | 2d8360de30fec9e4df8bf88d8b34743064ee8425 | [] | no_license | liangyushijiu/jFinalProject | eaeb34d885cc87d5beec5ea97d4cb395fd0a521d | 3fb371bd12a585f77b3778b9a317f887d3febd20 | refs/heads/master | 2023-04-16T05:56:08.030852 | 2021-04-29T07:58:32 | 2021-04-29T07:58:32 | 355,557,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 280 | java | package com.jFinal.project.creation.business.hr;
import com.jfinal.config.Routes;
/**
* @author 凉雨时旧
*/
public class HrRoutes extends Routes {
@Override
public void config() {
setBaseViewPath("/_view/");
add("/hr", HrController.class);
}
}
| [
"liangyushijiu@outlook.com"
] | liangyushijiu@outlook.com |
6be3b3e46e98fd2eb22d8e7e1a499a671af68a7e | 9818de00102d45ced0f45cc4cc4e8396fdd9f428 | /bog/bog-webapp/src/test/java/com/cyxd/test/InterfaceTest.java | a4442fa77bdcedbe97c351c474b6755305ab1dde | [] | no_license | Cyxd/myeh | ecf88e0fdc1ddbe623cf8461906c0fdcc28b131d | 02270398e832d48f38b7f7bccf10879c2b38ae68 | refs/heads/master | 2021-01-16T23:16:05.318256 | 2016-11-22T10:10:56 | 2016-12-01T10:06:03 | 65,177,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 416 | java | package com.cyxd.test;
import java.lang.reflect.Constructor;
public class InterfaceTest {
public static void main(String[] args) {
Class<Eat> cls = Eat.class;
Constructor<?>[] cons = cls.getConstructors();
System.out.println("constructors" + cons);
for (Constructor<?> constructor : cons) {
System.out.println("constructor -->" + constructor.getName());
}
}
}
interface Eat{
} | [
"xdjiemao@163.com"
] | xdjiemao@163.com |
7ad0f223e99dabce1a8d81dedadf08ff63ab986b | 031b1c5b0c404f23ccd61a08845695bd4c3827f2 | /project/Pat/learn/src/main/java/com/zixin/learn/sgg/datastructure/graph/Graph.java | 910f1bfdcbb2c6d46917e9e0a92e9269d8803825 | [] | no_license | AndyFlower/zixin | c8d957fd8b1e6ca0e1ae63389bc8151ab93dbb55 | 647705e5f14fae96f82d334ba1eb8a534735bfd9 | refs/heads/master | 2022-12-23T21:10:44.872371 | 2021-02-10T07:15:21 | 2021-02-10T07:15:21 | 232,578,547 | 1 | 0 | null | 2022-12-16T15:41:14 | 2020-01-08T14:13:25 | Java | UTF-8 | Java | false | false | 5,431 | java | package com.zixin.learn.sgg.datastructure.graph;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
public class Graph {
private ArrayList<String> vertexList; //存储顶点集合
private int[][] edges; //存储图对应的邻结矩阵
private int numOfEdges; //表示边的数目
//定义给数组boolean[], 记录某个结点是否被访问
private boolean[] isVisited;
public static void main(String[] args) {
//测试一把图是否创建ok
int n = 8; //结点的个数
//String Vertexs[] = {"A", "B", "C", "D", "E"};
String Vertexs[] = {"1", "2", "3", "4", "5", "6", "7", "8"};
//创建图对象
Graph graph = new Graph(n);
//循环的添加顶点
for(String vertex: Vertexs) {
graph.insertVertex(vertex);
}
//添加边
//A-B A-C B-C B-D B-E
// graph.insertEdge(0, 1, 1); // A-B
// graph.insertEdge(0, 2, 1); //
// graph.insertEdge(1, 2, 1); //
// graph.insertEdge(1, 3, 1); //
// graph.insertEdge(1, 4, 1); //
//更新边的关系
graph.insertEdge(0, 1, 1);
graph.insertEdge(0, 2, 1);
graph.insertEdge(1, 3, 1);
graph.insertEdge(1, 4, 1);
graph.insertEdge(3, 7, 1);
graph.insertEdge(4, 7, 1);
graph.insertEdge(2, 5, 1);
graph.insertEdge(2, 6, 1);
graph.insertEdge(5, 6, 1);
//显示一把邻结矩阵
graph.showGraph();
//测试一把,我们的dfs遍历是否ok
System.out.println("深度遍历");
graph.dfs(); // A->B->C->D->E [1->2->4->8->5->3->6->7]
// System.out.println();
System.out.println("广度优先!");
graph.bfs(); // A->B->C->D-E [1->2->3->4->5->6->7->8]
}
//构造器
public Graph(int n) {
//初始化矩阵和vertexList
edges = new int[n][n];
vertexList = new ArrayList<String>(n);
numOfEdges = 0;
}
//得到第一个邻接结点的下标 w
/**
*
* @param index
* @return 如果存在就返回对应的下标,否则返回-1
*/
public int getFirstNeighbor(int index) {
for(int j = 0; j < vertexList.size(); j++) {
if(edges[index][j] > 0) {
return j;
}
}
return -1;
}
//根据前一个邻接结点的下标来获取下一个邻接结点
public int getNextNeighbor(int v1, int v2) {
for(int j = v2 + 1; j < vertexList.size(); j++) {
if(edges[v1][j] > 0) {
return j;
}
}
return -1;
}
//深度优先遍历算法
//i 第一次就是 0
private void dfs(boolean[] isVisited, int i) {
//首先我们访问该结点,输出
System.out.print(getValueByIndex(i) + "->");
//将结点设置为已经访问
isVisited[i] = true;
//查找结点i的第一个邻接结点w
int w = getFirstNeighbor(i);
while(w != -1) {//说明有
if(!isVisited[w]) {
dfs(isVisited, w);
}
//如果w结点已经被访问过
w = getNextNeighbor(i, w);
}
}
//对dfs 进行一个重载, 遍历我们所有的结点,并进行 dfs
public void dfs() {
isVisited = new boolean[vertexList.size()];
//遍历所有的结点,进行dfs[回溯]
for(int i = 0; i < getNumOfVertex(); i++) {
if(!isVisited[i]) {
dfs(isVisited, i);
}
}
}
//对一个结点进行广度优先遍历的方法
private void bfs(boolean[] isVisited, int i) {
int u ; // 表示队列的头结点对应下标
int w ; // 邻接结点w
//队列,记录结点访问的顺序
LinkedList queue = new LinkedList();
//访问结点,输出结点信息
System.out.print(getValueByIndex(i) + "=>");
//标记为已访问
isVisited[i] = true;
//将结点加入队列
queue.addLast(i);
while( !queue.isEmpty()) {
//取出队列的头结点下标
u = (Integer)queue.removeFirst();
//得到第一个邻接结点的下标 w
w = getFirstNeighbor(u);
while(w != -1) {//找到
//是否访问过
if(!isVisited[w]) {
System.out.print(getValueByIndex(w) + "=>");
//标记已经访问
isVisited[w] = true;
//入队
queue.addLast(w);
}
//以u为前驱点,找w后面的下一个邻结点
w = getNextNeighbor(u, w); //体现出我们的广度优先
}
}
}
//遍历所有的结点,都进行广度优先搜索
public void bfs() {
isVisited = new boolean[vertexList.size()];
for(int i = 0; i < getNumOfVertex(); i++) {
if(!isVisited[i]) {
bfs(isVisited, i);
}
}
}
//图中常用的方法
//返回结点的个数
public int getNumOfVertex() {
return vertexList.size();
}
//显示图对应的矩阵
public void showGraph() {
for(int[] link : edges) {
System.err.println(Arrays.toString(link));
}
}
//得到边的数目
public int getNumOfEdges() {
return numOfEdges;
}
//返回结点i(下标)对应的数据 0->"A" 1->"B" 2->"C"
public String getValueByIndex(int i) {
return vertexList.get(i);
}
//返回v1和v2的权值
public int getWeight(int v1, int v2) {
return edges[v1][v2];
}
//插入结点
public void insertVertex(String vertex) {
vertexList.add(vertex);
}
//添加边
/**
*
* @param v1 表示点的下标即使第几个顶点 "A"-"B" "A"->0 "B"->1
* @param v2 第二个顶点对应的下标
* @param weight 表示
*/
public void insertEdge(int v1, int v2, int weight) {
edges[v1][v2] = weight;
edges[v2][v1] = weight;
numOfEdges++;
}
}
| [
"1308445442@qq.com"
] | 1308445442@qq.com |
0670bc9cc11d1cdcb353287d841fceddb6edf54d | c21de99edaacf93004a4dbde3be34c47173dba3e | /stickyNotesWithSwing/src/main/java/patterns/iterator/Iterator.java | 826bc909dd85a3383f5e648f2066fd088a2a6165 | [] | no_license | ptruta/design-patterns-swing-project-java | 3253f957285b9df88052dad95ed62b706373aa3d | 32a8f59af22223816d990e0cc732ced1e4764795 | refs/heads/master | 2022-08-03T02:54:02.287001 | 2020-05-21T12:35:21 | 2020-05-21T12:35:21 | 265,839,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java | package patterns.iterator;
// We could also use Java.Util.Iterator
public interface Iterator
{
// indicates whether there are more elements to
// iterate over
boolean hasNext();
// returns the next element
String next();
// to return the actual string
String getActual();
void setPos();
} | [
"georgianatruta.pt@gmail.com"
] | georgianatruta.pt@gmail.com |
d6403a1c02febbfeed07c577af1217855eea93f1 | 73ae91ca4a0580b52342004f9b012bf0022718f9 | /workspace/ms-contratos/src/main/java/com/ifsp/edu/hto/sge/contratos/repository/EmpresaRepository.java | ee346cffc28ba058777a843a5b6b71b72b1fdd74 | [] | no_license | LenilsonTeixeira/SGE-IFSP | 136f8f6294ec4844016a2238b669bd0cc5bce47a | 1cad446189680adf7d16c1338ecac02f447071f7 | refs/heads/master | 2023-01-12T18:47:34.291042 | 2021-11-03T19:47:55 | 2021-11-03T19:47:55 | 195,275,482 | 1 | 0 | null | 2023-01-07T07:29:29 | 2019-07-04T16:48:11 | CSS | UTF-8 | Java | false | false | 525 | java | package com.ifsp.edu.hto.sge.contratos.repository;
import com.ifsp.edu.hto.sge.contratos.entity.Empresa;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface EmpresaRepository extends JpaRepository<Empresa, Long> {
Page<Empresa> findByNomeContainingIgnoreCase(String nome, Pageable pageable);
Empresa findByCodigo(Integer codigo);
}
| [
"lenilson.teixeira@sensedia.com"
] | lenilson.teixeira@sensedia.com |
5c1d70dba5dfc86d5caa5d0cd8298fc375f43808 | 6c6e0d6e4663a4fc3d7e797814ae1a9bd2f16942 | /H264Demo/app/src/main/java/com/example/qiandu/h264demo/MainActivity.java | ba670d26afc66c65e816d9aff228586506d0c9e9 | [] | no_license | y6692/MyLive | 4cd6b6400f8cbfde74d8798305de916194139f50 | 2e2e0298900d412ed62e2b37bb9a90173bab7762 | refs/heads/master | 2022-12-04T00:31:22.371291 | 2020-08-22T09:19:09 | 2020-08-22T09:19:09 | 290,097,705 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,782 | java | package com.example.qiandu.h264demo;
import android.content.Intent;
import android.media.projection.MediaProjection;
import android.media.projection.MediaProjectionManager;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import org.java_websocket.WebSocket;
import org.java_websocket.handshake.ClientHandshake;
import org.java_websocket.server.WebSocketServer;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
/**
* Created by LQD ON 2018/5/29 0029
*/
public class MainActivity extends AppCompatActivity implements ScreenCaputre.ScreenCaputreListener {
private final static String TAG = MainActivity.class.getSimpleName();
private ScreenCaputre screenCaputre;
private static final int REQUEST_CODE = 1;
private MediaProjectionManager mMediaProjectionManager;
private MediaProjection mediaProjection;
private TextView mInfo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mInfo = (TextView) findViewById(R.id.info);
startServer1();
}
private OutputStream os;
private MyWebSocketServer myWebSocketServer = new MyWebSocketServer(16886);
private WebSocket mWebSocket;
private void startServer1() {
myWebSocketServer.start();
}
private class MyWebSocketServer extends WebSocketServer {
public MyWebSocketServer(int port) {
super(new InetSocketAddress(port));
}
@Override
public void onOpen(WebSocket webSocket, ClientHandshake clientHandshake) {
mWebSocket = webSocket;
Log.v(TAG, "onOpen");
setInfo("WebSocket onOpen");
}
@Override
public void onClose(WebSocket webSocket, int i, String s, boolean b) {
Log.v(TAG, "onClose");
setInfo("WebSocket onClose");
}
@Override
public void onMessage(WebSocket webSocket, String s) {
Log.v(TAG, "onMessage");
setInfo("WebSocket onMessage: " + s);
}
@Override
public void onError(WebSocket webSocket, Exception e) {
Log.v(TAG, "onError");
setInfo("WebSocket onError: " + e);
}
}
private Handler mHandler = new Handler();
private void setInfo(final String message) {
mHandler.post(new Runnable() {
@Override
public void run() {
mInfo.setText(message);
}
});
}
public void start(View view) {
if (null == screenCaputre) {
prepareScreen();
} else {
screenCaputre.start();
}
}
public void stop(View view) {
screenCaputre.stop();
}
public void prepareScreen() {
mMediaProjectionManager = (MediaProjectionManager) getSystemService(MEDIA_PROJECTION_SERVICE);
Intent captureIntent = mMediaProjectionManager.createScreenCaptureIntent();
startActivityForResult(captureIntent, REQUEST_CODE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != RESULT_OK || requestCode != REQUEST_CODE) return;
mediaProjection = mMediaProjectionManager.getMediaProjection(resultCode, data);
if (mediaProjection == null) {
return;
}
DisplayMetrics dm = getResources().getDisplayMetrics();
screenCaputre = new ScreenCaputre(dm.widthPixels, dm.heightPixels, mediaProjection);
screenCaputre.setScreenCaputreListener(this);
screenCaputre.start();
}
@Override
public void onImageData(byte[] buf) {
if (null != os) {
try {
byte[] bytes = new byte[buf.length + 4];
byte[] head = intToBuffer(buf.length);
System.arraycopy(head, 0, bytes, 0, head.length);
System.arraycopy(buf, 0, bytes, head.length, buf.length);
os.write(bytes);
} catch (IOException e) {
e.printStackTrace();
}
}
if (null != mWebSocket) {
setInfo("发送H264数据成功,长度:" + buf.length);
mWebSocket.send(buf);
}
}
public static byte[] intToBuffer(int value) {
byte[] src = new byte[4];
src[3] = (byte) ((value>>24) & 0xFF);
src[2] = (byte) ((value>>16) & 0xFF);
src[1] = (byte) ((value>>8) & 0xFF);
src[0] = (byte) (value & 0xFF);
return src;
}
}
| [
"y6692509"
] | y6692509 |
02fbecda51e69d444f1b54b05a4d6d8b01e0d953 | 57a06fbb664df4081e48dd96dcad168022c37d29 | /app/src/main/java/com/the_canuck/openpodcast/data/podcast/PodcastServiceApiImpl.java | 90705d4a92f4dfb193f200775836066652a97a65 | [
"Apache-2.0"
] | permissive | PeterMorrison1/Open-Podcast | ba196a2eb2f0aee39b0538c0db540c9e6009f023 | ea1a8d87f8e65d6cffbca861447c750cf2e831f4 | refs/heads/master | 2021-12-25T01:45:34.122982 | 2021-11-28T20:53:19 | 2021-11-28T20:53:19 | 133,269,791 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,624 | java | package com.the_canuck.openpodcast.data.podcast;
import android.os.Handler;
import com.the_canuck.openpodcast.Podcast;
import com.the_canuck.openpodcast.sqlite.MySQLiteHelper;
import java.util.List;
import javax.inject.Inject;
public class PodcastServiceApiImpl implements PodcastServiceApi {
MySQLiteHelper sqLiteHelper;
@Inject
public PodcastServiceApiImpl(MySQLiteHelper sqLiteHelper) {
this.sqLiteHelper = sqLiteHelper;
}
@Override
public void subscribe(final Podcast podcast, final int autoUpdate) {
new Thread(new Runnable() {
@Override
public void run() {
sqLiteHelper.subscribe(podcast, autoUpdate);
}
}).start();
}
@Override
public void unsubscribe(final Podcast podcast) {
new Thread(new Runnable() {
@Override
public void run() {
sqLiteHelper.unsubscribe(podcast);
}
}).start();
}
@Override
public void updatePodcast(final Podcast podcast, final int autoUpdate) {
new Thread(new Runnable() {
@Override
public void run() {
sqLiteHelper.updatePodcast(podcast, autoUpdate);
}
}).start();
}
@Override
public void getSubscribedPodcasts(final PodcastServiceCallback<List<Podcast>> callback) {
final Handler handler = new Handler();
new Thread(new Runnable() {
@Override
public void run() {
final List<Podcast> podcastList = sqLiteHelper.getSubscribedPodcasts();
handler.post(new Runnable() {
@Override
public void run() {
callback.onLoaded(podcastList);
}
});
}
}).start();
}
@Override
public void doesPodcastExist(final Podcast podcast, final GetPodcastExistCallback callback) {
final Handler handler = new Handler();
new Thread(new Runnable() {
@Override
public void run() {
final boolean exists = sqLiteHelper.doesPodcastExist(podcast);
handler.post(new Runnable() {
@Override
public void run() {
callback.onExistLoaded(exists);
}
});
}
}).start();
}
@Override
public void getPodcastArtwork600(final int collectionId, final GetArtworkCallback callback) {
final Handler handler = new Handler();
new Thread(new Runnable() {
@Override
public void run() {
final String artwork = sqLiteHelper.getPodcastArtwork600(collectionId);
handler.post(new Runnable() {
@Override
public void run() {
callback.onArtworkLoaded(artwork);
}
});
}
}).start();
}
@Override
public void getAutoUpdatePodcasts(final PodcastServiceCallback<List<Podcast>> callback) {
final Handler handler = new Handler();
new Thread(new Runnable() {
@Override
public void run() {
final List<Podcast> podcastList = sqLiteHelper.getAutoUpdatePods();
handler.post(new Runnable() {
@Override
public void run() {
callback.onLoaded(podcastList);
}
});
}
}).start();
}
}
| [
"morrisonman56@gmail.com"
] | morrisonman56@gmail.com |
db60458b80072cb87efcb6ff1357441fe2632768 | 64ad798d1e37fd6e1197f5079154e200e122dc57 | /src/main/java/com/queroevento/models/Event.java | 34a40aafa1ca2aaca93f9cf208896005b0cb3816 | [] | no_license | joaopaulonunesm/queroevento | 9df645e97291294dca46854b9234f8d68809c86e | cf55143d7fa840adb683789a188337d0a5bd4840 | refs/heads/master | 2021-09-22T10:34:57.008418 | 2021-09-17T13:30:08 | 2021-09-17T13:30:08 | 101,457,357 | 0 | 2 | null | 2018-10-03T01:13:47 | 2017-08-26T02:38:33 | HTML | UTF-8 | Java | false | false | 2,291 | java | package com.queroevento.models;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Type;
import com.queroevento.enums.CatalogStatusEvent;
import com.queroevento.enums.StatusEvent;
import com.queroevento.enums.TurbineType;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
public class Event {
@Id
@SequenceGenerator(name = "EVENTSEQ", sequenceName = "EVENT_SEQ", initialValue = 1, allocationSize = 1)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "EVENTSEQ")
private Long id;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "id_company", nullable = false)
private Company company;
private String title;
private String urlTitle;
@ManyToOne
@JoinColumn(name = "id_category", nullable = false)
private Category category;
@Lob
@Type(type = "org.hibernate.type.TextType")
private String imageUrl;
private String state;
private String city;
private String local;
private Double price;
private String keyword;
private Long views;
@JoinColumn(name = "event_date")
@Temporal(TemporalType.TIMESTAMP)
private Date eventDate;
@JoinColumn(name = "create_event_date")
@Temporal(TemporalType.TIMESTAMP)
private Date createEventDate;
@Lob
@Type(type = "org.hibernate.type.TextType")
private String shortDescription;
@Lob
@Type(type = "org.hibernate.type.TextType")
private String completeDescription;
@JoinColumn(name = "people_estimate")
private Integer peopleEstimate;
@JoinColumn(name = "show_phone_numer")
private Boolean showPhoneNumber;
@JoinColumn(name = "show_email")
private Boolean showEmail;
@Type(type = "org.hibernate.type.EnumType")
private StatusEvent status;
@Type(type = "org.hibernate.type.EnumType")
private CatalogStatusEvent catalogStatus;
@Type(type = "org.hibernate.type.EnumType")
private TurbineType turbineType;
} | [
"joaopaulonunesm@hotmail.com"
] | joaopaulonunesm@hotmail.com |
1bab753ced069b92b1c536716cafa1cd51daa6f5 | 2b5e1596e1f5bb2118ecffe1f20a212e2aecc8d1 | /resource-server/src/main/java/com/project/resourceserver/repository/MaterialRepository.java | 0c7bde4a82797c7970cbe3af30b7cc30058d73c1 | [] | no_license | jacobfrench/route-app | eae21eaab529ce31bdb1e5960abe4348a48267e7 | 6efbc59fe1edd457844057ec04b72a1b9b1438c5 | refs/heads/master | 2023-01-02T11:58:51.356290 | 2020-10-23T07:02:55 | 2020-10-23T07:02:55 | 264,564,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package com.project.resourceserver.repository;
import com.project.resourceserver.model.Material;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface MaterialRepository extends JpaRepository<Material, Long> {
} | [
"jakefrench1984@gmail.com"
] | jakefrench1984@gmail.com |
4bc32c6a9eb638af797da4b913289fd8aceee911 | 8b71d735852e4f853e2c3ff37a509e098109f058 | /src/Common/src/uk/ac/ox/zoo/seeg/abraid/mp/common/web/LoggingHandlerInterceptor.java | b53f33760cd425f7b8116df5f9d23722dd127e40 | [
"Apache-2.0"
] | permissive | SEEG-Oxford/ABRAID-MP | bc25cd5100cc92d256fd177fa5209e357e8ce2bf | 1ba03a68107eb6c195f9374a82e3f9d7e2c81212 | refs/heads/master | 2021-01-17T08:20:00.149538 | 2016-03-30T10:21:14 | 2016-03-30T10:21:14 | 15,733,510 | 2 | 2 | null | 2016-03-30T10:21:14 | 2014-01-08T11:23:25 | Java | UTF-8 | Java | false | false | 4,853 | java | package uk.ac.ox.zoo.seeg.abraid.mp.common.web;
import org.apache.log4j.Logger;
import org.springframework.util.StringUtils;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.security.Principal;
/**
* A Spring interceptor that logs controller method requests.
*
* Copyright (c) 2014 University of Oxford
*/
public class LoggingHandlerInterceptor extends HandlerInterceptorAdapter {
private static final Logger LOGGER = Logger.getLogger(LoggingHandlerInterceptor.class);
private static final String REQUEST_LOG_MESSAGE = "(%s) Calling %s.%s using %s %s";
private static final String DURATION_LOG_MESSAGE = "Took %.3f seconds";
private static final String START_TIME_ATTRIBUTE_NAME = "LoggingHandlerInterceptor_startTime";
private static final double MINIMUM_REQUEST_DURATION_SECONDS = 0.3;
private static final double MILLISECONDS_TO_SECONDS = 1000.0;
/**
* Logs an HTTP request, before it is received by a controller.
* @param request The HTTP request.
* @param response The HTTP response.
* @param handler The handler object.
* @return Always returns true so that processing can continue.
* @throws Exception if an error occurs
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
String requestDetails = getRequestDetails(request, handler);
if (requestDetails != null) {
LOGGER.info(requestDetails);
}
// This is for the benefit of the postHandle() method below
if (LOGGER.isDebugEnabled()) {
request.setAttribute(START_TIME_ATTRIBUTE_NAME, System.currentTimeMillis());
}
return true;
}
/**
* Logs an HTTP request, after it is processed by a controller.
* @param request The HTTP request.
* @param response The HTTP response.
* @param handler The handler object.
* @param modelAndView The model and view.
* @throws Exception if an error occurs
*/
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
// If DEBUG level logging is enabled, log all response times arising from a call to a controller method
if (LOGGER.isDebugEnabled()) {
Long startTime = (Long) request.getAttribute(START_TIME_ATTRIBUTE_NAME);
if (startTime != null) {
double durationInSeconds = getRequestDuration(startTime);
if (durationInSeconds >= MINIMUM_REQUEST_DURATION_SECONDS) {
LOGGER.debug(String.format(DURATION_LOG_MESSAGE, durationInSeconds));
}
}
}
}
/**
* Gets the details of the HTTP request, for logging purposes.
* This only includes requests that call controller methods.
* @param request The HTTP request.
* @param handler The handler object.
* @return The details of the HTTP request, or null if the handler is not a HandlerMethod.
*/
public String getRequestDetails(HttpServletRequest request, Object handler) {
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
String className = handlerMethod.getMethod().getDeclaringClass().getName();
String methodName = handlerMethod.getMethod().getName();
String requestMethodName = request.getMethod();
String username = getUsername(request);
String fullURL = getFullURL(request);
return String.format(REQUEST_LOG_MESSAGE, username, className, methodName, requestMethodName, fullURL);
}
return null;
}
private String getUsername(HttpServletRequest request) {
Principal principal = request.getUserPrincipal();
return (principal == null) ? "anonymous" : principal.getName();
}
private String getFullURL(HttpServletRequest request) {
StringBuffer requestURL = request.getRequestURL();
String queryString = request.getQueryString();
// Returns the full request URL, including query parameters (if any)
if (StringUtils.hasText(queryString)) {
return requestURL.append('?').append(queryString).toString();
} else {
return requestURL.toString();
}
}
private double getRequestDuration(long startTime) {
long endTime = System.currentTimeMillis();
return (endTime - startTime) / MILLISECONDS_TO_SECONDS;
}
}
| [
"edward.wiles@tessella.com"
] | edward.wiles@tessella.com |
d57db0be33463651fd7d50f6d9bf25aae6211369 | 6352c89c995288a1fa5e122756588338c0428310 | /Whereismycar/app/src/main/java/android/whereismycar/AddCarActivity.java | 180db1fe72f09fb8930026f21dd522aeca14330a | [] | no_license | dekeeu/whereismycar | da03efde982af3387a8e4543ea88510d94941f14 | aeb9d5168751cd5246b7ede2f25989a5df0e37d6 | refs/heads/master | 2021-09-03T09:02:58.201196 | 2018-01-07T21:50:12 | 2018-01-07T21:50:12 | 108,773,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,555 | java | package android.whereismycar;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.whereismycar.Domain.Car;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.Map;
public class AddCarActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
private Spinner spinner;
private static final String[] carBrands = {"Seat", "Opel", "BMW", "Mercedes", "Ferrari"};
private String selectedBrand;
private static final String REQUIRED = "REQUIRED";
private EditText carModel;
private EditText carColor;
private EditText carLicensePlate;
private String _carModel;
private String _carColor;
private String _carLicensePlate;
private FirebaseAuth mAuth;
private DatabaseReference mDatabase;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_car);
this.carModel = (EditText)findViewById(R.id.carModelText);
this.carColor = (EditText)findViewById(R.id.carColorText);
this.carLicensePlate = (EditText)findViewById(R.id.licensePlateText);
this.mAuth = FirebaseAuth.getInstance();
this.mDatabase = FirebaseDatabase.getInstance().getReference();
populateSpinner();
}
public void populateSpinner(){
spinner = (Spinner)findViewById(R.id.brandSpinner);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(AddCarActivity.this, android.R.layout.simple_spinner_item, carBrands);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(this);
}
public void getInputValues(){
this._carModel = this.carModel.getText().toString();
this._carColor = this.carColor.getText().toString();
this._carLicensePlate = this.carLicensePlate.getText().toString();
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
selectedBrand = carBrands[position];
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
selectedBrand = "";
}
public void showAlert(){
AlertDialog alertDialog = new AlertDialog.Builder(AddCarActivity.this).create();
alertDialog.setTitle("Car added !");
alertDialog.setMessage("The car was added !");
alertDialog.show();
}
public void handleAddCar(View view) {
getInputValues();
if(!TextUtils.isEmpty(selectedBrand)){
if(!TextUtils.isEmpty(_carModel)){
if(!TextUtils.isEmpty(_carColor)){
if(!TextUtils.isEmpty(_carLicensePlate)){
String userID = mAuth.getCurrentUser().getUid();
String key = mDatabase.child("Cars").push().getKey();
Car car = new Car(key, selectedBrand, _carModel, _carColor, _carLicensePlate, userID, 0);
Map<String, Object> postValues = car.toMap();
mDatabase.child("Cars").child(key).setValue(postValues);
mDatabase.child("Users").child(userID).child("owned_cars").child(key).setValue(true);
Toast.makeText(this, _carLicensePlate + " was added !", Toast.LENGTH_LONG).show();
finish();
}else{
Toast.makeText(this, R.string.selectLicensePlateNo, Toast.LENGTH_SHORT).show();
carLicensePlate.setError(REQUIRED);
}
}else{
Toast.makeText(this, R.string.selectCarColor, Toast.LENGTH_SHORT).show();
carColor.setError(REQUIRED);
}
}else{
Toast.makeText(this, R.string.selectCarModel, Toast.LENGTH_SHORT).show();
carModel.setError(REQUIRED);
}
}else{
Toast.makeText(this, R.string.selectCarBrand, Toast.LENGTH_SHORT).show();
}
}
}
| [
"dekeeu@gmail.com"
] | dekeeu@gmail.com |
933a9c24e9717f5d9f91f7c3da6a4db2766eaa8e | 67b55665765a056d5a89b90ba97ee1128e59c5db | /TestNGStudyProject/src/main/java/com/java/general/study/TestPropertiesUsingClass.java | 7cd35ce37b036d100774c48ddfa5981b53933d17 | [] | no_license | vaibhavbshinde/IntellijStudyProject | d4fa5d5cfee6aa6d9b27579674d1833e3c6597ae | 642bff7f476812b4a209aab7ad6732bf94392af6 | refs/heads/master | 2022-05-31T05:19:53.276340 | 2019-07-10T08:08:11 | 2019-07-10T08:08:11 | 195,261,374 | 0 | 0 | null | 2022-05-20T21:02:23 | 2019-07-04T14:59:10 | HTML | UTF-8 | Java | false | false | 323 | java | package com.java.general.study;
import java.util.Properties;
public class TestPropertiesUsingClass {
public static void main(String[] args){
Properties p = System.getProperties();
p.list(System.out);
System.out.println( "User Name property Value is : "+p.getProperty("user.name"));
}
}
| [
"vaibhavshinde.in@gmail.com"
] | vaibhavshinde.in@gmail.com |
b5e3615998c5d62eb0321158c50589dcc0243d6e | ba5073ccb71098b9f9014338a4f9f844a3b3ab44 | /src/main/java/com/ua/sasha/bogush/springbootmicrocervices/model/node/copybody/NodeCopyModel.java | 93fe0cada64c7a6776dca323d34d351a6e9f7b70 | [
"Apache-2.0"
] | permissive | sandhya0423/springboot-microcervices | 1cb48977ecb03bce4399ea2497e141bcd4d5f972 | 55bb711aabc70bd7e83da73bb5e802c31e8ca9b2 | refs/heads/master | 2023-03-18T02:07:54.873591 | 2021-01-22T15:14:33 | 2021-01-22T15:14:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,816 | java |
package com.ua.sasha.bogush.springbootmicrocervices.model.node.copybody;
import com.fasterxml.jackson.annotation.*;
import javax.validation.Valid;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* @author Oleksandr Bogush
* @version 1.0
* @since 30.12.2020
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"targetParentId",
"name"
})
public class NodeCopyModel implements Serializable {
@JsonProperty("targetParentId")
private String targetParentId;
@JsonProperty("name")
private String name;
@JsonIgnore
@Valid
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
private final static long serialVersionUID = 1696381421870355861L;
/**
* No args constructor for use in serialization
*/
public NodeCopyModel() {
}
/**
* @param targetParentId
* @param name
*/
public NodeCopyModel(String targetParentId, String name) {
super();
this.targetParentId = targetParentId;
this.name = name;
}
@JsonProperty("targetParentId")
public String getTargetParentId() {
return targetParentId;
}
@JsonProperty("targetParentId")
public void setTargetParentId(String targetParentId) {
this.targetParentId = targetParentId;
}
@JsonProperty("name")
public String getName() {
return name;
}
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
| [
"sashabogush@gmail.com"
] | sashabogush@gmail.com |
0bb4118db27a9ee98e3d5a49e5b2a635f49480e8 | e70ce367ad9b84eff514423f9035651ae8cf61f9 | /src/main/java/com/vspavlov/demoorm/controller/UserController.java | abd94398c3cd4cf6a80cdb11a450994e4421a63e | [] | no_license | shopengauer/DemoORM | 6e995bc08df6cef8cb2bbbfc95199f00f9ae3c19 | 3c0535c5d592e5c1e3eef53f114d75bbd02e516a | refs/heads/master | 2020-05-09T03:42:20.893584 | 2015-06-11T17:51:19 | 2015-06-11T17:51:19 | 34,729,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,779 | java | package com.vspavlov.demoorm.controller;
import com.vspavlov.demoorm.domain.users.MdbUser;
import com.vspavlov.demoorm.dto.MdbUserCreateForm;
import com.vspavlov.demoorm.registration.OnRegistrationCompleteEvent;
import com.vspavlov.demoorm.repository.VerificationTokenRepository;
import com.vspavlov.demoorm.service.MdbUserService;
import com.vspavlov.demoorm.service.MdbUserServiceImpl;
import com.vspavlov.demoorm.validator.MdbUserCreateFormValidator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Profile;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.validation.Errors;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.context.request.WebRequest;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Locale;
/**
* Created by Vasiliy on 25.05.2015.
*/
@Controller
public class UserController implements ApplicationEventPublisherAware{
private final Logger logger = LoggerFactory.getLogger(getClass());
// private final MdbUserCreateFormValidator mdbUserCreateFormValidator;
// private final MdbUserService mdbUserService;
private ApplicationEventPublisher eventPublisher;
@Autowired
private MessageSource messageSource;
@Autowired
private VerificationTokenRepository verificationTokenRepository;
@Autowired
private MdbUserService mdbUserService;
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.eventPublisher = applicationEventPublisher;
}
// @Autowired
// public UserController(MdbUserCreateFormValidator mdbUserCreateFormValidator,MdbUserService mdbUserService) {
// this.mdbUserCreateFormValidator = mdbUserCreateFormValidator;
// this.mdbUserService = mdbUserService;
// }
// @InitBinder("registerForm")
// public void initBinder(WebDataBinder binder) {
// binder.addValidators(mdbUserCreateFormValidator);
// }
@RequestMapping(value = "/logindev",method = RequestMethod.GET)
public String mylogdev(Model model){
return "logindev";
}
@RequestMapping(value = "/registerdev",method = RequestMethod.GET)
public String getMdbUserRegisterPage(Model model){
model.addAttribute("registerForm",new MdbUserCreateForm());
return "registerdev";
}
@RequestMapping(value = "/registerdev",method = RequestMethod.POST)
public String handleMdbUserCreateForm(@Valid @ModelAttribute("registerForm") MdbUserCreateForm form,
BindingResult bindingResult,
HttpServletRequest request){
if(bindingResult.hasErrors()){
return "registerdev";
}
String appUrl = request.getContextPath();
Locale locale = request.getLocale();
MdbUser registered = mdbUserService.create(form);
eventPublisher.publishEvent(new OnRegistrationCompleteEvent(this,registered,locale,appUrl));
return "redirect:/successregister";
}
}
| [
"localducks@gmail.com"
] | localducks@gmail.com |
0f4fb3b37055eecc5effc89cf74d22bb3d6fdff7 | 788cc4ea248d9322460961fa7f6cbc2f7d410905 | /src/ProblemSolvingDayByDay/Array/TwoDArray/TransposeMatrix.java | 1c85012d622faa91a3466c1ad7df9c2367f0fb22 | [] | no_license | uzzal-mondal/Codeforces-Hacker-Rank-Uri- | e9fae89ce56c38a39cce5fac569abdedf742bcd4 | 68f5126e82a4d83fe0f516dc7e90321df52c08c1 | refs/heads/main | 2023-08-04T20:05:25.605185 | 2021-09-25T15:36:04 | 2021-09-25T15:36:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,477 | java | package ProblemSolvingDayByDay.Array.TwoDArray;
import java.util.Scanner;
public class TransposeMatrix {
public static void main(String[] args) {
int[][] numMatrix = new int[10][10];
int[][] transPose = new int[10][10];
Scanner sc = new Scanner(System.in);
System.out.print("Enter rows and cols: ");
int row = sc.nextInt();
int col = sc.nextInt();
//user input to matrix:
System.out.println("Matrix elements input: ");
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
System.out.printf("Num Matrix [%d][%d] : ", i, j);
numMatrix[i][j] = sc.nextInt();
}
}
//print to matrix:
System.out.println("Matrix result: ");
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
System.out.printf("%d ", numMatrix[i][j]);
}
System.out.println();
}
// transpose matrix:-
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
transPose[j][i] = numMatrix[i][j];
}
//System.out.println();
}
System.out.println("Transpose matrix: ");
for (int j = 0; j < col; j++) {
for (int i = 0; i < row; i++) {
System.out.printf("%d ", transPose[j][i]);
}
System.out.println();
}
}
}
| [
"uzzalcontact@gmail.com"
] | uzzalcontact@gmail.com |
d531f3ce57820ca7b93bc96e0540726ec8e354a1 | 3ef55e152decb43bdd90e3de821ffea1a2ec8f75 | /large/module1692_public/tests/unittests/src/java/module1692_public_tests_unittests/a/Foo1.java | c29a85a892f3f261efcfb87d038152a383c6b473 | [
"BSD-3-Clause"
] | permissive | salesforce/bazel-ls-demo-project | 5cc6ef749d65d6626080f3a94239b6a509ef145a | 948ed278f87338edd7e40af68b8690ae4f73ebf0 | refs/heads/master | 2023-06-24T08:06:06.084651 | 2023-03-14T11:54:29 | 2023-03-14T11:54:29 | 241,489,944 | 0 | 5 | BSD-3-Clause | 2023-03-27T11:28:14 | 2020-02-18T23:30:47 | Java | UTF-8 | Java | false | false | 1,701 | java | package module1692_public_tests_unittests.a;
import java.rmi.*;
import java.nio.file.*;
import java.sql.*;
/**
* Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
* labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
* Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
*
* @see java.util.logging.Filter
* @see java.util.zip.Deflater
* @see javax.annotation.processing.Completion
*/
@SuppressWarnings("all")
public abstract class Foo1<H> extends module1692_public_tests_unittests.a.Foo0<H> implements module1692_public_tests_unittests.a.IFoo1<H> {
javax.lang.model.AnnotatedConstruct f0 = null;
javax.management.Attribute f1 = null;
javax.naming.directory.DirContext f2 = null;
public H element;
public static Foo1 instance;
public static Foo1 getInstance() {
return instance;
}
public static <T> T create(java.util.List<T> input) {
return module1692_public_tests_unittests.a.Foo0.create(input);
}
public String getName() {
return module1692_public_tests_unittests.a.Foo0.getInstance().getName();
}
public void setName(String string) {
module1692_public_tests_unittests.a.Foo0.getInstance().setName(getName());
return;
}
public H get() {
return (H)module1692_public_tests_unittests.a.Foo0.getInstance().get();
}
public void set(Object element) {
this.element = (H)element;
module1692_public_tests_unittests.a.Foo0.getInstance().set(this.element);
}
public H call() throws Exception {
return (H)module1692_public_tests_unittests.a.Foo0.getInstance().call();
}
}
| [
"gwagenknecht@salesforce.com"
] | gwagenknecht@salesforce.com |
99d8d393ae2c56a8468b92377786eead5f57c98c | 4e10cf8f876b7c663fdb5e0534a6b2d09fccf39f | /RabbitMQ Assignment/src/main/java/com/rabbitmq/assignment/dto/OrderStatus.java | 49946e960dd1630d9b8eb57a00c899e2f28852c1 | [] | no_license | kbskumar/Capgemini_Solutions | c1a40acf4b0ae27f8733813e856f576eef76885d | f6ae4f1382f7661e7a6ac0e5d2decc4c65a3b7a6 | refs/heads/master | 2023-04-11T17:22:40.081446 | 2021-05-17T12:33:10 | 2021-05-17T12:33:10 | 353,302,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 523 | java | package com.rabbitmq.assignment.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class OrderStatus {
private Order order;
private String status;//progress,completed
private String message;
public OrderStatus() {
}
public OrderStatus(Order order, String status, String message) {
super();
this.order = order;
this.status = status;
this.message = message;
}
}
| [
"kbskumar1999@gmail.com"
] | kbskumar1999@gmail.com |
3ae5324464599360a0ffec97b11d248615e5722b | 8ed5cb5031e98785c00a8d2fc601904143b24715 | /cfg4j-core/src/test/java/org/cfg4j/source/files/TempConfigurationFileRepo.java | 9caf93368144735334f080a468c40583f46a0dae | [
"Apache-2.0"
] | permissive | arkadutta87/cfg4j | b75cd47322955ff63d3ff9ba7d4ee6cfaa4a8484 | ed4edd96338db517cfa3a4e4fd75798b0f25bd31 | refs/heads/master | 2020-03-20T09:34:59.123718 | 2019-02-04T07:24:32 | 2019-02-04T07:24:32 | 137,341,480 | 0 | 1 | Apache-2.0 | 2018-07-24T06:17:00 | 2018-06-14T10:09:49 | Java | UTF-8 | Java | false | false | 2,571 | java | /*
* Copyright 2015-2016 Norbert Potocki (norbert.potocki@nort.pl)
*
* 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.cfg4j.source.files;
import org.cfg4j.utils.FileUtils;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
/**
* Temporary local file repository that contains configuration files.
*/
public class TempConfigurationFileRepo {
public Path dirPath;
/**
* Create temporary, local file repository. When you're done using it remove it by invoking {@link #remove()}
* method.
*
* @throws IOException when unable to create local directories
*/
public TempConfigurationFileRepo(String dirName) throws IOException {
dirPath = Files.createTempDirectory(dirName);
}
/**
* Change the {@code key} property to {@code value} and store it in a {@code propFilePath} properties file
*
* @param propFilePath relative path to the properties file in this repository
* @param key property key
* @param value property value
* @throws IOException when unable to modify properties file
*/
public void changeProperty(Path propFilePath, String key, String value) throws IOException {
Files.createDirectories(dirPath.resolve(propFilePath).getParent());
writePropertyToFile(propFilePath, key, value);
}
/**
* Delete file from this repository.
*
* @param filePath relative file path to delete
*/
public void deleteFile(Path filePath) throws IOException {
new FileUtils().deleteDir(dirPath.resolve(filePath));
}
/**
* Remove this repository.
*
* @throws IOException when unable to remove directory
*/
public void remove() throws IOException {
new FileUtils().deleteDir(dirPath);
}
private void writePropertyToFile(Path propFilePath, String key, String value) throws IOException {
OutputStream out = new FileOutputStream(dirPath.resolve(propFilePath).toFile());
out.write((key + "=" + value).getBytes());
out.close();
}
}
| [
"norbert.potocki@nort.pl"
] | norbert.potocki@nort.pl |
33e10472200b61f83f759e18f18fffb9eb062bef | 5e59507a1bccb8ff29e8290662820c81e940c75e | /src/main/java/ca/simplestep/repository/UserRepository.java | 2204efe5aabe0c48b83dd1245d23dae9b60cfadb | [] | no_license | sdoxsee/myhipster | a7ec96d494a6ae9ade676853c1d47850a5235d6c | f10fa10e1f287893d899c531e93c70c9c445455c | refs/heads/master | 2022-12-21T23:34:25.807905 | 2019-11-14T15:34:29 | 2019-11-14T15:34:29 | 146,331,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,571 | java | package ca.simplestep.repository;
import ca.simplestep.domain.User;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
import java.time.Instant;
/**
* Spring Data JPA repository for the {@link User} entity.
*/
@Repository
public interface UserRepository extends JpaRepository<User, Long> {
String USERS_BY_LOGIN_CACHE = "usersByLogin";
String USERS_BY_EMAIL_CACHE = "usersByEmail";
Optional<User> findOneByActivationKey(String activationKey);
List<User> findAllByActivatedIsFalseAndActivationKeyIsNotNullAndCreatedDateBefore(Instant dateTime);
Optional<User> findOneByResetKey(String resetKey);
Optional<User> findOneByEmailIgnoreCase(String email);
Optional<User> findOneByLogin(String login);
@EntityGraph(attributePaths = "authorities")
Optional<User> findOneWithAuthoritiesById(Long id);
@EntityGraph(attributePaths = "authorities")
@Cacheable(cacheNames = USERS_BY_LOGIN_CACHE)
Optional<User> findOneWithAuthoritiesByLogin(String login);
@EntityGraph(attributePaths = "authorities")
@Cacheable(cacheNames = USERS_BY_EMAIL_CACHE)
Optional<User> findOneWithAuthoritiesByEmailIgnoreCase(String email);
Page<User> findAllByLoginNot(Pageable pageable, String login);
}
| [
"stephen@doxsee.org"
] | stephen@doxsee.org |
5481f261a5448ae081f4b11ead1971a9991237b5 | bf2966abae57885c29e70852243a22abc8ba8eb0 | /aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/transform/DeviceSecretVerifierConfigTypeJsonUnmarshaller.java | 8450d61ee9a3ae6e30cd31f6f450e7ac691da9e3 | [
"Apache-2.0"
] | permissive | kmbotts/aws-sdk-java | ae20b3244131d52b9687eb026b9c620da8b49935 | 388f6427e00fb1c2f211abda5bad3a75d29eef62 | refs/heads/master | 2021-12-23T14:39:26.369661 | 2021-07-26T20:09:07 | 2021-07-26T20:09:07 | 246,296,939 | 0 | 0 | Apache-2.0 | 2020-03-10T12:37:34 | 2020-03-10T12:37:33 | null | UTF-8 | Java | false | false | 3,183 | java | /*
* Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.cognitoidp.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.cognitoidp.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* DeviceSecretVerifierConfigType JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DeviceSecretVerifierConfigTypeJsonUnmarshaller implements Unmarshaller<DeviceSecretVerifierConfigType, JsonUnmarshallerContext> {
public DeviceSecretVerifierConfigType unmarshall(JsonUnmarshallerContext context) throws Exception {
DeviceSecretVerifierConfigType deviceSecretVerifierConfigType = new DeviceSecretVerifierConfigType();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("PasswordVerifier", targetDepth)) {
context.nextToken();
deviceSecretVerifierConfigType.setPasswordVerifier(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("Salt", targetDepth)) {
context.nextToken();
deviceSecretVerifierConfigType.setSalt(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return deviceSecretVerifierConfigType;
}
private static DeviceSecretVerifierConfigTypeJsonUnmarshaller instance;
public static DeviceSecretVerifierConfigTypeJsonUnmarshaller getInstance() {
if (instance == null)
instance = new DeviceSecretVerifierConfigTypeJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
a800cf818efde6652b85e5adf59ffe5283b27658 | 6df78fff7ad130bd5ab4ea04688308e111dab6bb | /CourseProjects/CourseProjects/JavaEclipseProjects/DesignPatternsExercises/src/patterns/command/start/Command.java | eaa3f0b7a6a4250ac4dc81da4e455ad4e9fdd6b6 | [] | no_license | AJLogan/DesignPatterns | 9cbeee86d8019d41cea78a6fbdbe042b37bdac1f | e85f0cbdd8639833aa9cfcd1f4cd407e4ae9ae38 | refs/heads/master | 2021-05-29T13:41:00.837937 | 2015-08-19T15:20:12 | 2015-08-19T15:20:12 | 40,884,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | package patterns.command.start;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
public abstract class Command {
protected Scanner scanner = new Scanner(System.in);
protected List<String> list = new LinkedList<String>();
public Command(Scanner scanner, List<String> list){
super();
this.scanner = scanner;
this.list = list;
}
public abstract void execute();
}
| [
"andrew@ajlogan.net"
] | andrew@ajlogan.net |
adcc79c3386a2b2ba802df182b7291e5eb684e20 | d2f7872b0d57bb05864952191e8720228f0f5d78 | /src/main/java/ru/sbt/mipt/oop/HomeComponents/Door.java | ba10e333e07eebf279e4cf38e976fb3f2ab58f73 | [] | no_license | jahoncenter/smart-home-2018 | 22c57d7f4935b5b75b99083e457fbdfefccbbd83 | 6f8d20b9042bcd68831cdd1cc94cac8d9402a054 | refs/heads/master | 2022-04-06T17:43:12.533906 | 2020-02-07T11:22:35 | 2020-02-07T11:22:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 719 | java | package ru.sbt.mipt.oop.HomeComponents;
public class Door implements Actionable {
private final String id;
private boolean isOpen;
public Door(boolean isOpen, String id) {
this.isOpen = isOpen;
this.id = id;
}
public String getId() {
return id;
}
public void setOpen(boolean open) {
isOpen = open;
if(open){
System.out.println("Door №: " + id + " was open.");
}
else {
System.out.println("Door №: " + id + " was close.");
}
}
public boolean getIsOpen() {
return isOpen;
}
@Override
public void executeAction(Action action) {
action.execute(this);
}
}
| [
"isabaev@phystech.edu"
] | isabaev@phystech.edu |
259fc12297f9e8decf728d54069e85213f40d746 | 7192cb7b7825bb72c0401f157030202899a8dbf8 | /server/src/main/java/nextrandomproject/server/GameController.java | 09f143794f8d749d881e35940cf20eeffabe04cb | [] | no_license | sn-lp/next-random | e83902c6a7098e40dc721ba0bc8cf5828ba4b7ac | 11ed54f50966f10fd899f48459baea7398917679 | refs/heads/main | 2023-09-06T06:20:03.430576 | 2021-11-04T22:03:03 | 2021-11-04T22:03:03 | 422,913,728 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,373 | java | package nextrandomproject.server;
import nextrandomproject.core.Player;
import nextrandomproject.core.PlayerTurnRequest;
import nextrandomproject.core.Game;
import nextrandomproject.core.GameState;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.stereotype.Controller;
@Controller
public class GameController {
private Game game = new Game();
// create new player
@RequestMapping(value="/create_player", method=RequestMethod.POST)
public ResponseEntity<Player> createPlayer(@RequestBody String playerName){
if(!game.CanAddPlayer(playerName)) {
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
}
Player newPlayer = game.AddPlayer(playerName);
if (newPlayer == null) {
return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR);
}
return new ResponseEntity<Player>(newPlayer, HttpStatus.CREATED);
}
// make a playyer's turn on a game id
@RequestMapping(value="/player_turn",method=RequestMethod.POST)
public ResponseEntity<Boolean> playerTurn(@RequestBody PlayerTurnRequest playerTurnRequest) {
Boolean playerTurnExecuted = this.game.MakePlay(playerTurnRequest.getPlayerId(), playerTurnRequest.getColumn());
return new ResponseEntity<Boolean>(playerTurnExecuted, HttpStatus.OK);
}
// get current game status
@RequestMapping(value="/game_status",method=RequestMethod.GET)
public ResponseEntity<GameState> gameStatus() {
GameState gameStatus = new GameState();
gameStatus.setBoard(this.game.GetBoard());
gameStatus.setNextPlayerId(this.game.GetNextPlayerId());
gameStatus.setStatus(this.game.GetStatus());
return new ResponseEntity<GameState>(gameStatus, HttpStatus.OK);
}
// make a playyer's turn on a game id
@RequestMapping(value="/player_disconnect",method=RequestMethod.POST)
public ResponseEntity<Boolean> disconnectPlayer(@RequestBody int playerId) {
Boolean playerDisconnected = this.game.DisconnectPlayer(playerId);
return new ResponseEntity<Boolean>(playerDisconnected, HttpStatus.OK);
}
}
| [
"sofia.pereira@ucdconnect.ie"
] | sofia.pereira@ucdconnect.ie |
060558cb35afb269c6f54977660aab54cda43b84 | 2258ae8f4b5e018d189e4eb6cb95e81007932885 | /STARS/sense.diagram/src/sense/diagram/navigator/SenseNavigatorSorter.java | ba1bcd7294ba05305b0101fec57f4921cceb2564 | [] | no_license | utwente-fmt/STARS | f918aeb3006e1aa855532ab0f6d677a9a2524d40 | be225fcffd06f941d685b0beecadfa710938407f | refs/heads/master | 2021-01-10T02:04:14.319098 | 2016-04-11T09:48:14 | 2016-04-11T09:48:14 | 53,322,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 792 | java | /*
*
*/
package sense.diagram.navigator;
import org.eclipse.jface.viewers.ViewerSorter;
import sense.diagram.part.SenseVisualIDRegistry;
/**
* @generated
*/
public class SenseNavigatorSorter extends ViewerSorter {
/**
* @generated
*/
private static final int GROUP_CATEGORY = 4005;
/**
* @generated
*/
private static final int SHORTCUTS_CATEGORY = 4004;
/**
* @generated
*/
public int category(Object element) {
if (element instanceof SenseNavigatorItem) {
SenseNavigatorItem item = (SenseNavigatorItem) element;
if (item.getView().getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
return SHORTCUTS_CATEGORY;
}
return SenseVisualIDRegistry.getVisualID(item.getView());
}
return GROUP_CATEGORY;
}
}
| [
"jjgmeijer@gmail.com"
] | jjgmeijer@gmail.com |
64d1b8c0759bb0b5dea89132f76d7e302f2ffca2 | 71c5439acee4c997522e3ff9d6335d63a34a2552 | /Projekat/src/gui/WorkspaceTreeCellRendered.java | 42ef40a5deb93bedd9441c36d49e6a59405c70fe | [] | no_license | waking-eni/java-mvc-project | 57d586039424573c1f0b9b1343cd7eb27d1da13f | 696a60506ca45f314cd1332a07749bea0892d712 | refs/heads/master | 2022-04-09T23:58:35.238362 | 2020-03-16T19:42:15 | 2020-03-16T19:42:15 | 246,307,311 | 0 | 0 | null | 2020-03-16T19:42:16 | 2020-03-10T13:24:26 | null | UTF-8 | Java | false | false | 1,575 | java | package gui;
import java.awt.Component;
import java.net.URL;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;
import model.DiagramTreeNode;
import model.ProjectTreeNode;
public class WorkspaceTreeCellRendered extends DefaultTreeCellRenderer{
public WorkspaceTreeCellRendered() {
// TODO Auto-generated constructor stub
}
public Component getTreeCellRendererComponent(
JTree tree,
Object value,
boolean sel,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, sel,expanded, leaf, row,hasFocus);
if (value instanceof DiagramTreeNode ) {
URL imageURL = getClass().getResource("../images/code_icon.png");
Icon icon = null;
if (imageURL != null)
icon = new ImageIcon(imageURL);
setIcon(icon);
} else if (value instanceof ProjectTreeNode ) {
URL imageURL = getClass().getResource("../images/proj_node.png");
Icon icon = null;
if (imageURL != null)
icon = new ImageIcon(imageURL);
setIcon(icon);
}
return this;
}
} | [
"61460471+waking-eni@users.noreply.github.com"
] | 61460471+waking-eni@users.noreply.github.com |
0628c919190ce7a648beb52830c725b13b2a66a7 | 20a16494bf6c63301891b0a0a0377544074ac030 | /OneAPI/src/org/gsm/oneapi/sms/SMSRetrieve.java | fd88d0ab20b6c9f6b7f522730e0e75b7ae000bdb | [
"Apache-2.0"
] | permissive | lichao20000/Mail-1 | f2fce5235640850dc2cae548a9a8e89ed24a4efb | 534e2672ab62a40e560c8c447124d60a2a99d0b9 | refs/heads/master | 2021-12-11T04:42:19.196553 | 2016-10-20T01:55:29 | 2016-10-20T01:55:29 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 13,202 | java | package org.gsm.oneapi.sms;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URLEncoder;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.codehaus.jackson.map.ObjectMapper;
import org.gsm.oneapi.endpoints.ServiceEndpoints;
import org.gsm.oneapi.endpoints.ServiceEndpointsInterface;
import org.gsm.oneapi.foundation.CommandLineOptions;
import org.gsm.oneapi.foundation.FormParameters;
import org.gsm.oneapi.foundation.JSONRequest;
import org.gsm.oneapi.responsebean.RequestError;
import org.gsm.oneapi.responsebean.sms.InboundSMSMessageNotification;
import org.gsm.oneapi.responsebean.sms.InboundSMSMessageNotificationWrapper;
import org.gsm.oneapi.responsebean.sms.RetrieveSMSResponse;
import org.gsm.oneapi.responsebean.sms.SMSMessageReceiptSubscriptionResponse;
import org.gsm.oneapi.server.OneAPIServlet;
/**
* The main API interface for the OneAPI SMS Retrieve methods
*/
public class SMSRetrieve {
static Logger logger=Logger.getLogger(SMSRetrieve.class);
ServiceEndpointsInterface endPoints=null;
String authorisationHeader=null;
public static boolean dumpRequestAndResponse=false;
private static JSONRequest<RetrieveSMSResponse> retrieveSMSprocessor=new JSONRequest<RetrieveSMSResponse>(new RetrieveSMSResponse());
private static JSONRequest<SMSMessageReceiptSubscriptionResponse> smsMessageReceiptSubscriptionProcessor=new JSONRequest<SMSMessageReceiptSubscriptionResponse>(new SMSMessageReceiptSubscriptionResponse());
/**
Creates a new instance of the Receive SMS API main interface. Requires endPoints to define the URL targets of the various Receive SMS network calls and authorisationHeader containing the username/password used for HTTP Basic authorisation with the OneAPI server.
@param endPoints contains a set of service/ call specific endpoints
@param authorisationHeader Base 64 encoded username/ password
@see org.gsm.oneapi.endpoints.ServiceEndpoints
@see org.gsm.oneapi.foundation.JSONRequest#getAuthorisationHeader(String, String)
*/
public SMSRetrieve(ServiceEndpointsInterface endPoints, String authorisationHeader) {
this.endPoints=endPoints;
this.authorisationHeader=authorisationHeader;
}
/**
Creates a new instance of the Receive SMS API main interface. Requires endPoints to define the URL targets of the various Receive SMS network calls and the username/password used for HTTP Basic authorisation with the OneAPI server.
@param endPoints contains a set of service/ call specific endpoints
@param username is the account name allocated for use of the service
@param password is the corresponding authentication password
@see org.gsm.oneapi.endpoints.ServiceEndpoints
*/
public SMSRetrieve(ServiceEndpointsInterface endPoints, String username, String password) {
String authorisationHeader=null;
if (username!=null && password!=null) {
authorisationHeader=JSONRequest.getAuthorisationHeader(username, password);
}
this.authorisationHeader=authorisationHeader;
this.endPoints=endPoints;
}
/**
Can be used to update the service endpoints
@param endPoints contains a set of service/ call specific endpoints
@see org.gsm.oneapi.endpoints.ServiceEndpoints
*/
public void setEndpoints(ServiceEndpoints endPoints) {
this.endPoints=endPoints;
}
/**
Can be used to update the service authorisation header
@param authorisationHeader Base 64 encoded username/ password
@see org.gsm.oneapi.foundation.JSONRequest#getAuthorisationHeader(String, String)
*/
public void setAuthorisationHeader(String authorisationHeader) {
this.authorisationHeader=authorisationHeader;
}
/**
Retrieve SMS messages sent to your Web application
@param registrationId (mandatory) is agreed with your network operator for receiving messages
@param maxBatchSize (mandatory) is the maximum number of messages to retrieve in this request
@see RetrieveSMSResponse
*/
public RetrieveSMSResponse retrieveMessages(String registrationId, int maxBatchSize) {
RetrieveSMSResponse response=new RetrieveSMSResponse();
if (registrationId!=null && maxBatchSize>=0) {
int responseCode=0;
String contentType = null;
try {
logger.debug("endpoint="+endPoints.getRetrieveSMSEndpoint());
String endpoint=endPoints.getRetrieveSMSEndpoint().replaceAll("\\{registrationId\\}", URLEncoder.encode(registrationId, "utf-8")).replaceAll("\\{maxBatchSize\\}", String.valueOf(maxBatchSize));
if (dumpRequestAndResponse) JSONRequest.dumpRequestVariables(endpoint, authorisationHeader, null);
HttpURLConnection con = JSONRequest.setupConnection(endpoint, authorisationHeader);
responseCode=con.getResponseCode();
contentType = con.getContentType();
response.setHTTPResponseCode(responseCode);
response.setContentType(contentType);
response=retrieveSMSprocessor.getResponse(con, OneAPIServlet.OK);
} catch (Exception e) {
logger.error("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
e.printStackTrace();
response.setHTTPResponseCode(responseCode);
response.setContentType(contentType);
response.setRequestError(new RequestError(RequestError.SERVICEEXCEPTION, "SVCJAVA", e.getMessage(), e.getClass().getName()));
}
}
return response;
}
/**
Start subscribing to notifications of SMS messages sent to your application
@param destinationAddress (mandatory) is the address/ MSISDN, or code agreed with the operator, to which people may send an SMS to your application
@param notifyURL (mandatory) is the URL to which you would like a notification of message receipts sent
@param criteria (optional) is case-insensitve text to match against the first word of the message, ignoring any leading whitespace. This allows you to reuse a short code among various applications, each of which can register their own subscription with different criteria
@param notificationFormat (optional) is the content type that notifications will be sent in Ð for OneAPI v1.0 only JSON is supported
@param clientCorrelator (optional) uniquely identifies this create subscription request. If there is a communication failure during the request, using the same clientCorrelator when retrying the request allows the operator to avoid creating a duplicate subscription
@param callbackData (optional) is a function name or other data that you would like included when the POST is sent to your application
@see SMSMessageReceiptSubscriptionResponse
*/
public SMSMessageReceiptSubscriptionResponse subscribeToReceiptNotifications(String destinationAddress, String notifyURL, String criteria, String notificationFormat, String clientCorrelator, String callbackData) {
SMSMessageReceiptSubscriptionResponse response=new SMSMessageReceiptSubscriptionResponse();
if (destinationAddress!=null && notifyURL!=null) {
FormParameters formParameters=new FormParameters();
formParameters.put("destinationAddress", destinationAddress);
formParameters.put("notifyURL", notifyURL);
formParameters.put("criteria", criteria);
formParameters.put("notificationFormat", notificationFormat);
formParameters.put("clientCorrelator", clientCorrelator);
formParameters.put("callbackData", callbackData);
int responseCode=0;
String contentType = null;
try {
String endpoint=endPoints.getSMSReceiptSubscriptionsEndpoint();
if (dumpRequestAndResponse) JSONRequest.dumpRequestVariables(endpoint, authorisationHeader, formParameters);
HttpURLConnection con = JSONRequest.setupConnection(endpoint, authorisationHeader);
con.setDoOutput(true);
OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream());
String requestBody=JSONRequest.formEncodeParams(formParameters);
out.write(requestBody);
out.close();
responseCode=con.getResponseCode();
contentType = con.getContentType();
response=smsMessageReceiptSubscriptionProcessor.getResponse(con, OneAPIServlet.CREATED);
} catch (Exception e) {
response.setHTTPResponseCode(responseCode);
response.setContentType(contentType);
response.setRequestError(new RequestError(RequestError.SERVICEEXCEPTION, "SVCJAVA", e.getMessage(), e.getClass().getName()));
logger.error("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
}
}
return response;
}
/**
Stop subscribing to message receipt notifications for all your received SMS
@param subscriptionId (mandatory) contains the subscriptionId of a previously created SMS message receipt subscription
*/
public int cancelReceiptNotifications(String subscriptionId) {
int responseCode=0;
if (subscriptionId!=null) {
try {
logger.debug("endpoint="+endPoints.getCancelSMSReceiptSubscriptionEndpoint());
String endpoint=endPoints.getCancelSMSReceiptSubscriptionEndpoint().replaceAll("\\{subscriptionId\\}", URLEncoder.encode(subscriptionId, "utf-8"));
if (dumpRequestAndResponse) JSONRequest.dumpRequestVariables(endpoint, authorisationHeader, null);
HttpURLConnection con = JSONRequest.setupConnection(endpoint, authorisationHeader);
con.setRequestMethod("DELETE");
responseCode=con.getResponseCode();
} catch (Exception e) {
logger.error("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
e.printStackTrace();
}
}
return responseCode;
}
/**
* Utility function to process a received JSON formatted message received notification into a usable class instance of InboundSMSMessageNotification
* @param request the HttpServletRequest - make sure the input stream has not been read before calling
* @return InboundSMSMessageNotification
*/
public static InboundSMSMessageNotification convertInboundSMSMessageNotification(HttpServletRequest request) {
InboundSMSMessageNotification inboundSMSMessageNotification=null;
if (request.getContentType()!=null && request.getContentType().equalsIgnoreCase("application/json")) {
try {
ServletInputStream inputStream=request.getInputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int i;
while ((i = (byte) inputStream.read()) != -1) baos.write(i);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ObjectMapper mapper=new ObjectMapper();
InboundSMSMessageNotificationWrapper wrapper=mapper.readValue(bais, InboundSMSMessageNotificationWrapper.class);
if (wrapper!=null) inboundSMSMessageNotification=wrapper.getInboundSMSMessageNotification();
} catch (java.io.IOException e) {
logger.error("IOException "+e.getMessage());
}
}
return inboundSMSMessageNotification;
}
public static void main(String[] args) {
BasicConfigurator.configure();
dumpRequestAndResponse=true;
ServiceEndpoints serviceEndpoints=CommandLineOptions.getServiceEndpoints(args);
String username=CommandLineOptions.getUsername(args);
String password=CommandLineOptions.getPassword(args);
if (username==null) username="Fred.Jones";
if (password==null) password="1234";
if (serviceEndpoints==null) serviceEndpoints=new ServiceEndpoints();
logger.debug("Demonstration of inbound SMS API");
String authorisationHeader=JSONRequest.getAuthorisationHeader(username, password);
SMSRetrieve me=new SMSRetrieve(serviceEndpoints, authorisationHeader);
logger.debug("SMS receive endpoint="+serviceEndpoints.getRetrieveSMSEndpoint());
RetrieveSMSResponse retrieveResponse=me.retrieveMessages("3456", 2);
if (retrieveResponse!=null) {
logger.debug("Have SMS retrieve response:\n"+retrieveResponse.toString());
} else {
logger.debug("No response obtained");
}
String notifyURL="http://test.com/notifyThis/Message="+JSONRequest.urlEncode("This is encoded");
logger.debug("Register a message receipt notification endpoint="+serviceEndpoints.getSMSReceiptSubscriptionsEndpoint());
SMSMessageReceiptSubscriptionResponse receiptSubscription=me.subscribeToReceiptNotifications("3456", notifyURL, "Vote%", "JSON", "12345", "doSomething()");
if (receiptSubscription!=null) {
logger.debug("SMSMessageReceiptSubscriptionResponse="+receiptSubscription.toString());
} else {
logger.debug("No response obtained");
}
logger.debug("Cancel message receipt notification endpoint="+serviceEndpoints.getCancelSMSReceiptSubscriptionEndpoint());
int cancelSubscriptionResponse=me.cancelReceiptNotifications("sub789");
logger.debug("Cancel receipt subscription response code="+cancelSubscriptionResponse);
}
}
| [
"zapjx@hotmail.com"
] | zapjx@hotmail.com |
93aa23833c1df13b1ccac011d506117267132bdc | a5704a553e910a25e9f6b824b2356b3b51ad96b9 | /ssm/MyBatis+Spring/CombineDemo/src/cn/com/sm/po/company_sys/User.java | 49e0506557475b8b5c10c7d43ffcfccb7ba91058 | [] | no_license | ZhuoZhuoCrayon/my-Nodes | 19ab1ce19ab0c89582071c3ca318f608f8ac94de | 54119f3c141017b5b2f6b1c15c9677ba9fbb564b | refs/heads/master | 2022-12-20T04:40:50.317306 | 2021-01-22T12:18:24 | 2021-01-22T12:18:24 | 200,957,098 | 57 | 18 | null | 2022-12-16T07:48:12 | 2019-08-07T02:28:51 | Java | UTF-8 | Java | false | false | 980 | java | package cn.com.sm.po.company_sys;
import java.io.Serializable;
public class User implements Serializable {
private Long id;
private String username;
private String password;
private String salt;
public User(){}
public User(Long id,String username,String password,String salt){
this.id = id;
this.password = password;
this.username = username;
this.salt = salt;
}
public void setId(Long id) {
this.id = id;
}
public void setPassword(String password) {
this.password = password;
}
public void setUsername(String username) {
this.username = username;
}
public void setSalt(String salt) {
this.salt = salt;
}
public Long getId() {
return id;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public String getSalt() {
return salt;
}
}
| [
"873217631@qq.com"
] | 873217631@qq.com |
0d088a5e968e6e20c132f3bf36217df01748f9d3 | 929989d1be4471cc76619f7877ba14733a09b168 | /Hrms-Backend/src/main/java/kodlamaio/Hrms/business/concretes/JobAdFavoritesManager.java | 8be3a00c4e7a2744ce5dff95f2102e8dd2a39b86 | [] | no_license | ADBERILGEN35/Hrms | f78d5e79bc0dc7604e05b549beb65ffad7c730a3 | 23550f90eb055c65d91cb6cc7252269a53b3fa4d | refs/heads/main | 2023-06-30T12:09:35.732906 | 2021-07-23T18:49:34 | 2021-07-23T18:49:34 | 374,986,314 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,052 | java | package kodlamaio.Hrms.business.concretes;
import kodlamaio.Hrms.business.abstracts.JobAdFavoritesService;
import kodlamaio.Hrms.core.utilities.results.*;
import kodlamaio.Hrms.dataAccess.abstracts.CandidateDao;
import kodlamaio.Hrms.dataAccess.abstracts.JobAdDao;
import kodlamaio.Hrms.dataAccess.abstracts.JobAdFavoritesDao;
import kodlamaio.Hrms.entities.concretes.JobAdFavorites;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class JobAdFavoritesManager implements JobAdFavoritesService {
private JobAdFavoritesDao jobAdFavoritesDao;
private CandidateDao candidateDao;
private JobAdDao jobAdDao;
@Autowired
public JobAdFavoritesManager(JobAdFavoritesDao jobAdFavoritesDao, CandidateDao candidateDao, JobAdDao jobAdDao) {
this.jobAdFavoritesDao = jobAdFavoritesDao;
this.candidateDao = candidateDao;
this.jobAdDao = jobAdDao;
}
@Override
public DataResult<List<JobAdFavorites>> getByCandidateId(int candidateId) {
if (!this.candidateDao.existsById(candidateId)) {
return new ErrorDataResult<List<JobAdFavorites>>("Böyle bir kullanıcı yok");
}
return new SuccessDataResult<List<JobAdFavorites>>(this.jobAdFavoritesDao.findByCandidateId(candidateId), "Data listelendi");
}
@Override
public Result addFavorite(int candidateId, int jobAdId) {
if (!this.candidateDao.existsById(candidateId)) {
return new ErrorResult("Böyle bir kullanıcı yok");
} else if (!this.jobAdDao.existsById(jobAdId)) {
return new ErrorResult("Böyle bir ilan yok");
}
JobAdFavorites jobAdFavorites = new JobAdFavorites();
jobAdFavorites.setCandidate(this.candidateDao.findById(candidateId).get());
jobAdFavorites.setJobAd(this.jobAdDao.findById(jobAdId).get());
this.jobAdFavoritesDao.save(jobAdFavorites);
return new SuccessResult("İlan facorilere eklendi");
}
}
| [
"91200001205@ogrenci.ege.edu.tr"
] | 91200001205@ogrenci.ege.edu.tr |
8067107af47f3461e253c1f3487b42787dab2bcf | 4927361cfd41599b111833cc770d0f5dd8dc81ab | /src/test/java/com/lordjoe/distributed/SparkWordCountTest.java | f012496e14b0821eb13b8cc285a216a2364f4019 | [
"Apache-2.0"
] | permissive | lordjoe/SparkHydraV2 | ac9b58e3d1ec4bd598f773e50a4147e9d10a15c3 | ab039d3bd93a06da442207eed709e8ceb0ccea26 | refs/heads/master | 2022-07-22T21:23:02.901862 | 2020-06-15T23:39:54 | 2020-06-15T23:39:54 | 132,197,816 | 0 | 0 | Apache-2.0 | 2020-06-15T20:54:46 | 2018-05-04T23:22:33 | Java | UTF-8 | Java | false | false | 371 | java | package com.lordjoe.distributed;
import com.lordjoe.distributed.test.*;
import org.junit.*;
/**
* com.lordjoe.distributed.SparkWordCount
* User: Steve
* Date: 9/12/2014
*/
public class SparkWordCountTest {
// works but runs too long
//@Test
public void testWordCount() {
WordCountOperator.validateWordCount(SparkMapReduce.FACTORY);
}
}
| [
"smlewis@lordjoe.com"
] | smlewis@lordjoe.com |
2f7e03e43e1e2b3b6a89e3fb536866859c3264b7 | 7f20b1bddf9f48108a43a9922433b141fac66a6d | /core3/api/tags/api-parent-3.0.0-beta1/presentation-api/src/main/java/org/cytoscape/view/presentation/property/ArrowShapeVisualProperty.java | 3729c7fb62e2dedfece545589407cd01e7d5ac11 | [] | no_license | ahdahddl/cytoscape | bf783d44cddda313a5b3563ea746b07f38173022 | a3df8f63dba4ec49942027c91ecac6efa920c195 | refs/heads/master | 2020-06-26T16:48:19.791722 | 2013-08-28T04:08:31 | 2013-08-28T04:08:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,791 | java | package org.cytoscape.view.presentation.property;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import org.cytoscape.model.CyIdentifiable;
import org.cytoscape.view.model.AbstractVisualProperty;
import org.cytoscape.view.model.DiscreteRange;
import org.cytoscape.view.presentation.property.values.AbstractVisualPropertyValue;
import org.cytoscape.view.presentation.property.values.ArrowShape;
/**
* Visual Property for {@link ArrowShape} values.
* This implementation provides basic default shapes. Rendering
* Engines can provide others.
*
* @CyAPI.Final.Class
*/
public final class ArrowShapeVisualProperty extends AbstractVisualProperty<ArrowShape> {
/** No arrow */
public static final ArrowShape NONE = new ArrowShapeImpl("None", "NONE");
/** Diamond shaped arrow */
public static final ArrowShape DIAMOND = new ArrowShapeImpl("Diamond", "DIAMOND");
/** Triangle shaped arrow */
public static final ArrowShape DELTA = new ArrowShapeImpl("Delta", "DELTA");
/** Pointy triangle shaped arrow */
public static final ArrowShape ARROW = new ArrowShapeImpl("Arrow", "ARROW");
/** T shaped arrow */
public static final ArrowShape T = new ArrowShapeImpl("T", "T");
/** Circle shaped arrow */
public static final ArrowShape CIRCLE = new ArrowShapeImpl("Circle", "CIRCLE");
/** Top Half of a triangle shaped arrow */
public static final ArrowShape HALF_TOP = new ArrowShapeImpl("Half Top", "HALF_TOP");
/** Bottom Half of a triangle shaped arrow */
public static final ArrowShape HALF_BOTTOM = new ArrowShapeImpl("Half Bottom", "HALF_BOTTOM");
private static final DiscreteRange<ArrowShape> ARROW_SHAPE_RANGE;
private static final Map<String, ArrowShape> DEFAULT_SHAPES;
static {
DEFAULT_SHAPES = new HashMap<String, ArrowShape>();
DEFAULT_SHAPES.put(NONE.getSerializableString().toUpperCase(), NONE);
DEFAULT_SHAPES.put(DIAMOND.getSerializableString().toUpperCase(), DIAMOND);
DEFAULT_SHAPES.put(DELTA.getSerializableString().toUpperCase(), DELTA);
DEFAULT_SHAPES.put(ARROW.getSerializableString().toUpperCase(), ARROW);
DEFAULT_SHAPES.put(T.getSerializableString().toUpperCase(), T);
DEFAULT_SHAPES.put(CIRCLE.getSerializableString().toUpperCase(), CIRCLE);
DEFAULT_SHAPES.put(HALF_TOP.getSerializableString().toUpperCase(), HALF_TOP);
DEFAULT_SHAPES.put(HALF_BOTTOM.getSerializableString().toUpperCase(), HALF_BOTTOM);
ARROW_SHAPE_RANGE = new DiscreteRange<ArrowShape>(ArrowShape.class, new HashSet<ArrowShape>(DEFAULT_SHAPES.values()));
}
/**
* Constructor.
* @param defaultValue The default arrow shape.
* @param id A machine readable string identifying this visual property used for XML serialization.
* @param displayName A human readable string used for displays and user interfaces.
* @param modelDataType The model data type associated with this visual property, e.g. CyNode, CyEdge, or CyNetwork.
*/
public ArrowShapeVisualProperty(ArrowShape defaultValue, String id, String displayName,
Class<? extends CyIdentifiable> modelDataType) {
super(defaultValue, ARROW_SHAPE_RANGE, id, displayName, modelDataType);
}
@Override
public String toSerializableString(ArrowShape value) {
return value.getSerializableString();
}
@Override
public ArrowShape parseSerializableString(String value) {
ArrowShape shape = null;
if (value != null)
shape = DEFAULT_SHAPES.get(value.toUpperCase());
return shape;
}
public static boolean isDefaultShape(final ArrowShape shape) {
return DEFAULT_SHAPES.containsValue(shape);
}
private static final class ArrowShapeImpl extends AbstractVisualPropertyValue implements ArrowShape {
public ArrowShapeImpl(final String displayName, final String serializableString) {
super(displayName, serializableString);
}
}
}
| [
"mes@0ecc0d97-ab19-0410-9704-bfe1a75892f5"
] | mes@0ecc0d97-ab19-0410-9704-bfe1a75892f5 |
03c09cbb381ca75f91e506d7bf77602814f7faab | b64a1c3a9ef10610a286d55108e8ca16bf9c0dd0 | /src/main/java/br/com/zup/bootcamp/proposta/domain/service/BloqueiaCartaoService.java | 52caa7ad03dc0fef619cbb8255455c3c6bd3a891 | [
"Apache-2.0"
] | permissive | CarlosEduardo12/proposta | f94885a933345cc0afafb284856dcdeb30116408 | e1066b10c44211faac29f60cbc206d4a790f4e29 | refs/heads/master | 2023-01-07T01:02:40.205001 | 2020-11-12T20:32:03 | 2020-11-12T20:32:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,715 | java | package br.com.zup.bootcamp.proposta.domain.service;
import br.com.zup.bootcamp.proposta.api.externalsystem.LegadoSistemaCartao;
import br.com.zup.bootcamp.proposta.domain.entity.Cartao;
import br.com.zup.bootcamp.proposta.domain.service.enums.EstadoCartao;
import br.com.zup.bootcamp.proposta.domain.repository.BloqueioRepository;
import br.com.zup.bootcamp.proposta.domain.repository.CartaoRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.util.UriComponentsBuilder;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
@Service
public class BloqueiaCartaoService {
@Autowired //1
private LegadoSistemaCartao sistemaCartao;
@Autowired //1
private CartaoRepository cartaoRepository;
@Autowired //1
private BloqueioRepository bloqueioRepository;
private final Logger logger = LoggerFactory.getLogger(BloqueiaCartaoService.class);
//1
public ResponseEntity<?> processaBloqueio(HttpServletRequest httpRequest, Cartao cartao, UriComponentsBuilder uri) {
logger.info("Processando bloqueio do cartao com o id: {}, IP da requisão: {}, user-agent: {}",
cartao.getId(), httpRequest.getRemoteAddr(), httpRequest.getHeader("User-Agent"));
//1
if (cartao.getEstadoCartao().equals(EstadoCartao.BLOQUEADO)) {
logger.warn("Cartão com o id {} ja esta bloqueado", cartao.getId());
return ResponseEntity.unprocessableEntity().build();
}
var responseBloqueio = sistemaCartao.bloqueiaCartaoPorIdCartao(cartao.getIdCartaoEmitido(),
Map.of("sistemaResponsavel", httpRequest.getHeader("User-Agent")));
logger.info("Request realizada no sistema legado retornou o status code {}", responseBloqueio.getStatusCodeValue());
//1
if (!responseBloqueio.getStatusCode().is2xxSuccessful()) {
return ResponseEntity.badRequest().build();
}
cartao.adicionarBloqueioDoCartao(httpRequest.getRemoteAddr(), httpRequest.getHeader("User-Agent"));
cartaoRepository.save(cartao);
var ultimoBloqueio = bloqueioRepository.findFirstByOrderByBloqueadoEmDesc();
logger.info("Bloqueio do cartão do id {} realizado com sucesso", cartao.getId());
return ResponseEntity.created(uri.path("/cartoes/bloqueios/{id}").
buildAndExpand(ultimoBloqueio.getId()).toUri()).build();
}
}
| [
"carlosdudujunior@hotmail.com"
] | carlosdudujunior@hotmail.com |
5db30976f4980961257958d55d910f3dfad5c7a2 | 7868e8b3cbd9d3845ad937e24e11030310075fc6 | /src/main/java/com/hpp/controllers/HppController.java | a42f1db6f11adec38dc775ddeaff0600166c0797 | [] | no_license | wsnwsn321/WechatPayImplementation | 4930882fdd5ce57c561e786584ced9f19de57649 | 943b7c94cb37127c737fac5ff1fd50000eb50498 | refs/heads/master | 2022-12-21T23:20:18.336140 | 2019-08-09T05:35:34 | 2019-08-09T05:35:34 | 194,992,275 | 0 | 0 | null | 2022-12-15T23:24:36 | 2019-07-03T06:24:14 | JavaScript | UTF-8 | Java | false | false | 1,539 | java | package com.hpp.controllers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicLong;
import com.hpp.entities.Profile;
import com.hpp.service.ProfileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.hpp.dto.HppDto;
@RestController
@RequestMapping("/hpp")
public class HppController {
private static final String template = "Hello, %s!";
private final AtomicLong counter = new AtomicLong();
private final HashMap data = new HashMap<Integer, String>();
@Autowired
private ProfileService ProfileService;
@RequestMapping("/test")
public ArrayList<HppDto> test(@RequestParam(value="id", defaultValue="1") Integer id) {
data.put(1, "Example_1");
data.put(2, "Example_2");
data.put(3, "Example_3");
ArrayList r = new ArrayList<HppDto>();
// data.forEach((k, v) -> {
// HppDto t = new HppDto();
// t.setId((Integer) k);
// t.setName((String) v);
// r.add(t);
// });
return r;
}
@RequestMapping("/profile")
public Profile profile(
@RequestParam(
value="id",
defaultValue="1"
) Integer id)
{
Profile p = ProfileService.getProfile(id);
return p;
}
} | [
"tcwsn321@gmail.com"
] | tcwsn321@gmail.com |
37229dba499baad8be4dcf2eaaf14c4f5511daef | 184bac9f7eb932f0491c23fb6147efd4251cd5c5 | /app/src/main/java/com/xmut/harmony/Activity/GoodDetailActivity.java | 6798ddb36239429ed05be709c12929f2ff2f6adb | [] | no_license | soulzzz/Harmony | 2dd8a23cca1566dd9d52268a82b466c97c224afb | 26403d39a117ab6248d9a743b4bd7477c85740f5 | refs/heads/master | 2023-07-25T08:08:42.609329 | 2021-09-08T03:33:19 | 2021-09-08T03:33:19 | 385,976,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,721 | java | package com.xmut.harmony.Activity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.xmut.harmony.Adapter.CommentAdapter;
import com.xmut.harmony.Adapter.RecommendAdapter;
import com.xmut.harmony.Fragment.MainFragment;
import com.xmut.harmony.R;
import com.xmut.harmony.entity.Product;
import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
public class GoodDetailActivity extends AppCompatActivity {
Context context;
Product product ;
int num = 1;
ImageView img,leave,add_bt,sub_bt;
TextView name,price,gotopay,product_num;
RecyclerView recyclerView,recyclerView2;
static GoodDetailActivity instance;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.good_total_layout);
instance = this;
context = this;
product= (Product) getIntent().getSerializableExtra("goods");
Init();
}
private void Init() {
add_bt = findViewById(R.id.add_bt);
sub_bt = findViewById(R.id.subtract_bt);
product_num = findViewById(R.id.product_num);
add_bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
num = Math.min(++num,product.getProduct_stock());
if(num==1){
sub_bt.setVisibility(View.GONE);
}else {
sub_bt.setVisibility(View.VISIBLE);
product_num.setText(String.valueOf(num));
}
product_num.setText(String.valueOf(num));
}
});
sub_bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
num = Math.max(--num,1);
if(num==1){
sub_bt.setVisibility(View.GONE);
}else {
sub_bt.setVisibility(View.VISIBLE);
product_num.setText(String.valueOf(num));
}
product_num.setText(String.valueOf(num));
}
});
leave = findViewById(R.id.leave);
img=findViewById(R.id.goods_img);
name = findViewById(R.id.goodsname);
price = findViewById(R.id.goodsprice);
gotopay = findViewById(R.id.gotopay);
recyclerView =findViewById(R.id.comments);
recyclerView2 = findViewById(R.id.recommend);
List<Product> temp = new ArrayList<>();
RecommendAdapter recommendAdapter = new RecommendAdapter(context);
int i=0;
for(Product p: MainFragment.products){
if(p.getProduct_category().equals(product.getProduct_category()) && !p.getProduct_id().equals(product.getProduct_id())){
temp.add(p);
i++;
if(i>=6) break;
}
}
System.out.println("Size:"+temp.size());
recommendAdapter.setProductList(temp);
leave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
CommentAdapter commentAdapter =new CommentAdapter(context);
commentAdapter.setProductList(product.getProductCommentList());
recyclerView2.setAdapter(recommendAdapter);
recyclerView2.setLayoutManager(new GridLayoutManager(context,3));
recyclerView.setAdapter(commentAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(context));
Glide.with(this).load(product.getProduct_img()).placeholder(R.drawable.ic_error).into(img);
name.setText(product.getProduct_name());
price.setText(String.valueOf(product.getProduct_price() ));
gotopay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List<Product> productList = new ArrayList<>();
product.setProduct_num(num);
productList.add(product);
Intent it = new Intent(context,OrderActivity.class);
it.putExtra("list",(Serializable) productList);
startActivity(it);
}
});
}
} | [
"983187389@qq.com"
] | 983187389@qq.com |
e28090f771f00f1e306370658ea6aa8ce66382a0 | 9cf1358c912068cf73c70de6fc6212f17987a87a | /src/by/itacademy/lessson5/task3/ShowBankName.java | bc4927727de0d2d1b9b833881bea5fa954a5362b | [] | no_license | hristofor-alex/Lesson5 | 3fcb9922680c621670c68c651e98376043e1c7d5 | cac8cd9a6b9f6f8d36b08eff1b0124c825c3fcca | refs/heads/master | 2021-09-16T04:27:09.276691 | 2018-06-16T14:29:24 | 2018-06-16T14:29:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 98 | java | package by.itacademy.lessson5.task3;
public interface ShowBankName {
void showBankName();
}
| [
"hristofor.alex@gmail.com"
] | hristofor.alex@gmail.com |
fc3b4cd0d7aa0556a4338e6cd02b3b42be7400e9 | 4ed13753f5bc20ec143dc25039280f80c3edddd8 | /gosu-test/src/test/java/gw/internal/gosu/compiler/TypeInfoReflectionTest.java | 242f325b806b34c5b8973dde322ec1593ced139a | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause"
] | permissive | hmsck/gosu-lang | 180a96aab69ff0184700e70876bb0cf10c8a938f | 78c5f6c839597a81ac5ec75a46259cbb6ad40545 | refs/heads/master | 2021-02-13T06:53:30.208378 | 2019-10-31T23:15:13 | 2019-10-31T23:15:13 | 244,672,021 | 0 | 0 | Apache-2.0 | 2020-03-03T15:27:47 | 2020-03-03T15:27:46 | null | UTF-8 | Java | false | false | 30,672 | java | /*
* Copyright 2014 Guidewire Software, Inc.
*/
package gw.internal.gosu.compiler;
import gw.lang.reflect.TypeSystem;
import gw.lang.reflect.IType;
import gw.lang.reflect.ReflectUtil;
import gw.lang.reflect.IConstructorHandler;
import gw.lang.reflect.java.JavaTypes;
public class TypeInfoReflectionTest extends ByteCodeTestBase
{
private static final String SIMPLE_REFLECTION_CLASS = "gw.internal.gosu.compiler.sample.reflection.SampleReflectionClass";
private static final String SIMPLE_SUB_REFLECTION_CLASS = "gw.internal.gosu.compiler.sample.reflection.SubSampleReflectionClass";
private static final String GENERIC_REFLECTION_CLASS = "gw.internal.gosu.compiler.sample.reflection.GenericReflectionClass";
public void testBasicReflectiveConstruction()
{
makeSimpleReflectionClass();
}
public void testReflectiveConstructionWithArgs()
{
assertEquals( "foo", ReflectUtil.getProperty( ReflectUtil.construct( SIMPLE_REFLECTION_CLASS, "foo" ), "StringProp" ) );
assertEquals( true, ReflectUtil.getProperty( ReflectUtil.construct( SIMPLE_REFLECTION_CLASS, true ), "BoolProp" ) );
assertEquals( (byte) 1, ReflectUtil.getProperty( ReflectUtil.construct( SIMPLE_REFLECTION_CLASS, (byte) 1 ), "ByteProp" ) );
assertEquals( (char) 1, ReflectUtil.getProperty( ReflectUtil.construct( SIMPLE_REFLECTION_CLASS, (char) 1 ), "CharProp" ) );
assertEquals( (short) 1, ReflectUtil.getProperty( ReflectUtil.construct( SIMPLE_REFLECTION_CLASS, (short) 1 ), "ShortProp" ) );
assertEquals( (int) 1, ReflectUtil.getProperty( ReflectUtil.construct( SIMPLE_REFLECTION_CLASS, (int) 1 ), "IntProp" ) );
assertEquals( (long) 1, ReflectUtil.getProperty( ReflectUtil.construct( SIMPLE_REFLECTION_CLASS, (long) 1 ), "LongProp" ) );
assertEquals( (float) 1, ReflectUtil.getProperty( ReflectUtil.construct( SIMPLE_REFLECTION_CLASS, (float) 1 ), "FloatProp" ) );
assertEquals( (double) 1, ReflectUtil.getProperty( ReflectUtil.construct( SIMPLE_REFLECTION_CLASS, (double) 1 ), "DoubleProp" ) );
}
public void testConstructorAccessiblity() {
assertNotNull( ReflectUtil.construct( SIMPLE_REFLECTION_CLASS, 1, 1 ) ); // private
assertNotNull( ReflectUtil.construct( SIMPLE_REFLECTION_CLASS, 1, 1, 1 ) ); // internal
assertNotNull( ReflectUtil.construct( SIMPLE_REFLECTION_CLASS, 1, 1, 1, 1 ) ); // protected
}
public void testSimpleFunctionInvocation()
{
Object o = makeSimpleReflectionClass();
assertEquals( "plain function", ReflectUtil.invokeMethod( o, "plainFunction" ));
}
public void testMethodAccessiblity() {
Object o = makeSimpleReflectionClass();
assertEquals( "private function", ReflectUtil.invokeMethod( o, "privateFunction" ));
assertEquals( "internal function", ReflectUtil.invokeMethod( o, "internalFunction" ));
assertEquals( "protected function", ReflectUtil.invokeMethod( o, "protectedFunction" ));
}
public void testFunctionWithStringArgInvocation()
{
Object o = makeSimpleReflectionClass();
assertEquals( "test", ReflectUtil.invokeMethod( o, "functionWStringArg", "test" ));
}
public void testFunctionWithPrimitiveArgInvocations()
{
Object o = makeSimpleReflectionClass();
assertEquals( true, ReflectUtil.invokeMethod( o, "functionWBooleanArg", true ));
assertEquals( (byte) 1, ReflectUtil.invokeMethod( o, "functionWByteArg", (byte) 1 ));
assertEquals( (char) 1, ReflectUtil.invokeMethod( o, "functionWCharArg", (char) 1 ));
assertEquals( (short) 1, ReflectUtil.invokeMethod( o, "functionWShortArg", (short) 1 ));
assertEquals( (int) 1, ReflectUtil.invokeMethod( o, "functionWIntArg", (int) 1 ));
assertEquals( (long) 1, ReflectUtil.invokeMethod( o, "functionWLongArg", (long) 1 ));
assertEquals( (float) 1, ReflectUtil.invokeMethod( o, "functionWFloatArg", (float) 1 ));
assertEquals( (double) 1, ReflectUtil.invokeMethod( o, "functionWDoubleArg", (double) 1 ));
}
public void testSetters()
{
Object o = makeSimpleReflectionClass();
ReflectUtil.invokeMethod( o, "setWStringArg", "foo" );
assertEquals( "foo", ReflectUtil.getProperty(o, "StringProp" ));
ReflectUtil.invokeMethod( o, "setWBooleanArg", true );
assertEquals( true, ReflectUtil.getProperty(o, "BoolProp" ));
ReflectUtil.invokeMethod( o, "setWByteArg", (byte) 1 );
assertEquals( (byte) 1, ReflectUtil.getProperty(o, "ByteProp" ));
ReflectUtil.invokeMethod( o, "setWCharArg", (char) 1 );
assertEquals( (char) 1, ReflectUtil.getProperty(o, "CharProp" ));
ReflectUtil.invokeMethod( o, "setWShortArg", (short) 1 );
assertEquals( (short) 1, ReflectUtil.getProperty(o, "ShortProp" ));
ReflectUtil.invokeMethod( o, "setWIntArg", (int) 1 );
assertEquals( (int) 1, ReflectUtil.getProperty(o, "IntProp" ));
ReflectUtil.invokeMethod( o, "setWLongArg", (long) 1 );
assertEquals( (long) 1, ReflectUtil.getProperty(o, "LongProp" ));
ReflectUtil.invokeMethod( o, "setWFloatArg", (float) 1 );
assertEquals( (float) 1, ReflectUtil.getProperty(o, "FloatProp" ));
ReflectUtil.invokeMethod( o, "setWDoubleArg", (double) 1 );
assertEquals( (double) 1, ReflectUtil.getProperty(o, "DoubleProp" ));
}
public void testStaticSimpleFunctionInvocation()
{
Object o = makeSimpleReflectionClass();
assertEquals( "plain function", ReflectUtil.invokeMethod( o, "staticPlainFunction" ));
}
public void testStaticFunctionWithStringArgInvocation()
{
Object o = makeSimpleReflectionClass();
assertEquals( "test", ReflectUtil.invokeMethod( o, "staticFunctionWStringArg", "test" ));
}
public void testStaticFunctionWithPrimitiveArgInvocations()
{
Object o = makeSimpleReflectionClass();
assertEquals( true, ReflectUtil.invokeMethod( o, "staticFunctionWBooleanArg", true ));
assertEquals( (byte) 1, ReflectUtil.invokeMethod( o, "staticFunctionWByteArg", (byte) 1 ));
assertEquals( (char) 1, ReflectUtil.invokeMethod( o, "staticFunctionWCharArg", (char) 1 ));
assertEquals( (short) 1, ReflectUtil.invokeMethod( o, "staticFunctionWShortArg", (short) 1 ));
assertEquals( (int) 1, ReflectUtil.invokeMethod( o, "staticFunctionWIntArg", (int) 1 ));
assertEquals( (long) 1, ReflectUtil.invokeMethod( o, "staticFunctionWLongArg", (long) 1 ));
assertEquals( (float) 1, ReflectUtil.invokeMethod( o, "staticFunctionWFloatArg", (float) 1 ));
assertEquals( (double) 1, ReflectUtil.invokeMethod( o, "staticFunctionWDoubleArg", (double) 1 ));
}
public void testGenericFunctionInvocation()
{
Object o = makeSimpleReflectionClass();
assertEquals( "foo", ReflectUtil.invokeMethod( o, "genericFunction", "foo" ));
assertEquals( JavaTypes.OBJECT(), ReflectUtil.invokeMethod( o, "genericFunctionReturnsT", "foo" ));
assertEquals( JavaTypes.CHAR_SEQUENCE(), ReflectUtil.invokeMethod( o, "genericFunctionReturnsBoundedT", "foo" ));
}
public void testStaticGenericFunctionInvocation()
{
Object o = makeSimpleReflectionClass();
assertEquals( "foo", ReflectUtil.invokeMethod( o, "staticGenericFunction", "foo" ));
assertEquals( JavaTypes.OBJECT(), ReflectUtil.invokeMethod( o, "staticGenericFunctionReturnsT", "foo" ));
assertEquals( JavaTypes.CHAR_SEQUENCE(), ReflectUtil.invokeMethod( o, "staticGenericFunctionReturnsBoundedT", "foo" ));
}
public void testSimplePropertyGetInvocation() throws ClassNotFoundException
{
Object o = makeSimpleReflectionClass();
assertEquals( "Default Value", ReflectUtil.getProperty( o, "StringProp" ));
}
public void testPropertyAccessibility() throws ClassNotFoundException
{
Object o = makeSimpleReflectionClass();
assertEquals( "Private Property", ReflectUtil.getProperty( o, "PrivateProperty" ));
assertEquals( "Internal Property", ReflectUtil.getProperty( o, "InternalProperty" ));
assertEquals( "Protected Property", ReflectUtil.getProperty( o, "ProtectedProperty" ));
}
public void testPropertySetterAccessibility() throws ClassNotFoundException
{
Object o = makeSimpleReflectionClass();
ReflectUtil.setProperty( o, "PrivateProperty", "foo" );
assertEquals( "foo", ReflectUtil.getProperty( o, "PrivateProperty" ));
ReflectUtil.setProperty( o, "InternalProperty", "bar" );
assertEquals( "bar", ReflectUtil.getProperty( o, "InternalProperty" ));
ReflectUtil.setProperty( o, "ProtectedProperty", "doh" );
assertEquals( "doh", ReflectUtil.getProperty( o, "ProtectedProperty" ));
}
public void testPropertyAccessibilityOnSub() throws ClassNotFoundException
{
Object o = makeSimpleReflectionClass();
assertEquals( "Private Property", ReflectUtil.getProperty( o, "PrivateProperty" ));
assertEquals( "Internal Property", ReflectUtil.getProperty( o, "InternalProperty" ));
assertEquals( "Protected Property", ReflectUtil.getProperty( o, "ProtectedProperty" ));
}
public void testSimplePropertySetInvocation() throws ClassNotFoundException
{
Object o = makeSimpleReflectionClass();
assertEquals( "Default Value", ReflectUtil.getProperty( o, "StringProp" ));
ReflectUtil.setProperty( o, "StringProp", "New Value" );
assertEquals( "New Value", ReflectUtil.getProperty( o, "StringProp" ));
}
public void testEnhancementSimpleFunctionInvocation()
{
Object o = makeSimpleReflectionClass();
assertEquals( "plain function", ReflectUtil.invokeMethod( o, "e_plainFunction" ));
}
public void testEnhancementFunctionWithStringArgInvocation()
{
Object o = makeSimpleReflectionClass();
assertEquals( "test", ReflectUtil.invokeMethod( o, "e_functionWStringArg", "test" ));
}
public void testEnhancementFunctionWithPrimitiveArgInvocations()
{
Object o = makeSimpleReflectionClass();
assertEquals( true, ReflectUtil.invokeMethod( o, "e_functionWBooleanArg", true ));
assertEquals( (byte) 1, ReflectUtil.invokeMethod( o, "e_functionWByteArg", (byte) 1 ));
assertEquals( (char) 1, ReflectUtil.invokeMethod( o, "e_functionWCharArg", (char) 1 ));
assertEquals( (short) 1, ReflectUtil.invokeMethod( o, "e_functionWShortArg", (short) 1 ));
assertEquals( (int) 1, ReflectUtil.invokeMethod( o, "e_functionWIntArg", (int) 1 ));
assertEquals( (long) 1, ReflectUtil.invokeMethod( o, "e_functionWLongArg", (long) 1 ));
assertEquals( (float) 1, ReflectUtil.invokeMethod( o, "e_functionWFloatArg", (float) 1 ));
assertEquals( (double) 1, ReflectUtil.invokeMethod( o, "e_functionWDoubleArg", (double) 1 ));
}
public void testEnhancementSetters()
{
Object o = makeSimpleReflectionClass();
ReflectUtil.invokeMethod( o, "e_setWStringArg", "foo" );
assertEquals( "foo", ReflectUtil.getProperty(o, "e_StringProp" ));
ReflectUtil.invokeMethod( o, "e_setWBooleanArg", true );
assertEquals( true, ReflectUtil.getProperty(o, "e_BoolProp" ));
ReflectUtil.invokeMethod( o, "e_setWByteArg", (byte) 1 );
assertEquals( (byte) 1, ReflectUtil.getProperty(o, "e_ByteProp" ));
ReflectUtil.invokeMethod( o, "e_setWCharArg", (char) 1 );
assertEquals( (char) 1, ReflectUtil.getProperty(o, "e_CharProp" ));
ReflectUtil.invokeMethod( o, "e_setWShortArg", (short) 1 );
assertEquals( (short) 1, ReflectUtil.getProperty(o, "e_ShortProp" ));
ReflectUtil.invokeMethod( o, "e_setWIntArg", (int) 1 );
assertEquals( (int) 1, ReflectUtil.getProperty(o, "e_IntProp" ));
ReflectUtil.invokeMethod( o, "e_setWLongArg", (long) 1 );
assertEquals( (long) 1, ReflectUtil.getProperty(o, "e_LongProp" ));
ReflectUtil.invokeMethod( o, "e_setWFloatArg", (float) 1 );
assertEquals( (float) 1, ReflectUtil.getProperty(o, "e_FloatProp" ));
ReflectUtil.invokeMethod( o, "e_setWDoubleArg", (double) 1 );
assertEquals( (double) 1, ReflectUtil.getProperty(o, "e_DoubleProp" ));
}
public void testEnhancementStaticSimpleFunctionInvocation()
{
Object o = makeSimpleReflectionClass();
assertEquals( "plain function", ReflectUtil.invokeMethod( o, "e_staticPlainFunction" ));
}
public void testEnhancementStaticFunctionWithStringArgInvocation()
{
Object o = makeSimpleReflectionClass();
assertEquals( "test", ReflectUtil.invokeMethod( o, "e_staticFunctionWStringArg", "test" ));
}
public void testEnhancementStaticFunctionWithPrimitiveArgInvocations()
{
Object o = makeSimpleReflectionClass();
assertEquals( true, ReflectUtil.invokeMethod( o, "e_staticFunctionWBooleanArg", true ));
assertEquals( (byte) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWByteArg", (byte) 1 ));
assertEquals( (char) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWCharArg", (char) 1 ));
assertEquals( (short) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWShortArg", (short) 1 ));
assertEquals( (int) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWIntArg", (int) 1 ));
assertEquals( (long) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWLongArg", (long) 1 ));
assertEquals( (float) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWFloatArg", (float) 1 ));
assertEquals( (double) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWDoubleArg", (double) 1 ));
}
public void testEnhancementGenericFunctionInvocation()
{
Object o = makeSimpleReflectionClass();
assertEquals( "foo", ReflectUtil.invokeMethod( o, "e_genericFunction", "foo" ));
assertEquals( JavaTypes.OBJECT(), ReflectUtil.invokeMethod( o, "e_genericFunctionReturnsT", "foo" ));
assertEquals( JavaTypes.CHAR_SEQUENCE(), ReflectUtil.invokeMethod( o, "e_genericFunctionReturnsBoundedT", "foo" ));
}
public void testEnhancementStaticGenericFunctionInvocation()
{
Object o = makeSimpleReflectionClass();
assertEquals( "foo", ReflectUtil.invokeMethod( o, "e_staticGenericFunction", "foo" ));
assertEquals( JavaTypes.OBJECT(), ReflectUtil.invokeMethod( o, "e_staticGenericFunctionReturnsT", "foo" ));
assertEquals( JavaTypes.CHAR_SEQUENCE(), ReflectUtil.invokeMethod( o, "e_staticGenericFunctionReturnsBoundedT", "foo" ));
}
public void testEnhancementSimplePropertyGetInvocation() throws ClassNotFoundException
{
Object o = makeSimpleReflectionClass();
assertEquals( "Default Value", ReflectUtil.getProperty( o, "e_StringProp" ));
}
public void testEnhancementSimplePropertySetInvocation() throws ClassNotFoundException
{
Object o = makeSimpleReflectionClass();
assertEquals( "Default Value", ReflectUtil.getProperty( o, "e_StringProp" ));
ReflectUtil.setProperty( o, "e_StringProp", "New Value" );
assertEquals( "New Value", ReflectUtil.getProperty( o, "e_StringProp" ));
}
public void testGenericReflectiveConstruction()
{
makeGenericReflectionClass();
}
public void testGenericMethodInvocationWorks()
{
Object o = makeGenericReflectionClass();
assertEquals( JavaTypes.STRING(), ReflectUtil.invokeMethod( o, "getT" ) );
}
public void testGenericEnhancementMethodInvocationWorks()
{
Object o = makeGenericReflectionClass();
assertEquals( JavaTypes.STRING(), ReflectUtil.invokeMethod( o, "e_getT" ) );
}
public void testGenericEnhancementMethodInvocationWorksWhenUnboundNoUpperBound()
{
Object o = makeGenericReflectionClass();
assertEquals( JavaTypes.OBJECT(), ReflectUtil.invokeMethod( o, "e_getQ" ) );
}
public void testGenericEnhancementMethodInvocationWorksWhenUnboundWUpperBound()
{
Object o = makeGenericReflectionClass();
assertEquals( JavaTypes.STRING(), ReflectUtil.invokeMethod( o, "e_getR" ) );
}
public void testGenericEnhancementPropertyInvocationWorks()
{
Object o = makeGenericReflectionClass();
assertEquals( JavaTypes.STRING(), ReflectUtil.getProperty( o, "e_PropT" ) );
}
public void testGenericEnhancementPropertyInvocationWorksWhenUnboundNoUpperBound()
{
Object o = makeGenericReflectionClass();
assertEquals( JavaTypes.OBJECT(), ReflectUtil.getProperty( o, "e_PropQ" ) );
}
public void testGenericEnhancementPropertyInvocationWorksWhenUnboundWUpperBound()
{
Object o = makeGenericReflectionClass();
assertEquals( JavaTypes.STRING(), ReflectUtil.getProperty( o, "e_PropR" ) );
}
public void testGenericReflectiveConstructionWithArgs()
{
assertEquals( "foo", ReflectUtil.getProperty( ReflectUtil.construct( GENERIC_REFLECTION_CLASS, "foo" ), "StringProp" ) );
assertEquals( true, ReflectUtil.getProperty( ReflectUtil.construct( GENERIC_REFLECTION_CLASS, true ), "BoolProp" ) );
assertEquals( (byte) 1, ReflectUtil.getProperty( ReflectUtil.construct( GENERIC_REFLECTION_CLASS, (byte) 1 ), "ByteProp" ) );
assertEquals( (char) 1, ReflectUtil.getProperty( ReflectUtil.construct( GENERIC_REFLECTION_CLASS, (char) 1 ), "CharProp" ) );
assertEquals( (short) 1, ReflectUtil.getProperty( ReflectUtil.construct( GENERIC_REFLECTION_CLASS, (short) 1 ), "ShortProp" ) );
assertEquals( (int) 1, ReflectUtil.getProperty( ReflectUtil.construct( GENERIC_REFLECTION_CLASS, (int) 1 ), "IntProp" ) );
assertEquals( (long) 1, ReflectUtil.getProperty( ReflectUtil.construct( GENERIC_REFLECTION_CLASS, (long) 1 ), "LongProp" ) );
assertEquals( (float) 1, ReflectUtil.getProperty( ReflectUtil.construct( GENERIC_REFLECTION_CLASS, (float) 1 ), "FloatProp" ) );
assertEquals( (double) 1, ReflectUtil.getProperty( ReflectUtil.construct( GENERIC_REFLECTION_CLASS, (double) 1 ), "DoubleProp" ) );
}
public void testGenericSimpleFunctionInvocation()
{
Object o = makeGenericReflectionClass();
assertEquals( "plain function", ReflectUtil.invokeMethod( o, "plainFunction" ));
}
public void testGenericFunctionWithStringArgInvocation()
{
Object o = makeGenericReflectionClass();
assertEquals( "test", ReflectUtil.invokeMethod( o, "functionWStringArg", "test" ));
}
public void testGenericFunctionWithPrimitiveArgInvocations()
{
Object o = makeGenericReflectionClass();
assertEquals( true, ReflectUtil.invokeMethod( o, "functionWBooleanArg", true ));
assertEquals( (byte) 1, ReflectUtil.invokeMethod( o, "functionWByteArg", (byte) 1 ));
assertEquals( (char) 1, ReflectUtil.invokeMethod( o, "functionWCharArg", (char) 1 ));
assertEquals( (short) 1, ReflectUtil.invokeMethod( o, "functionWShortArg", (short) 1 ));
assertEquals( (int) 1, ReflectUtil.invokeMethod( o, "functionWIntArg", (int) 1 ));
assertEquals( (long) 1, ReflectUtil.invokeMethod( o, "functionWLongArg", (long) 1 ));
assertEquals( (float) 1, ReflectUtil.invokeMethod( o, "functionWFloatArg", (float) 1 ));
assertEquals( (double) 1, ReflectUtil.invokeMethod( o, "functionWDoubleArg", (double) 1 ));
}
public void testGenericSetters()
{
Object o = makeGenericReflectionClass();
ReflectUtil.invokeMethod( o, "setWStringArg", "foo" );
assertEquals( "foo", ReflectUtil.getProperty(o, "StringProp" ));
ReflectUtil.invokeMethod( o, "setWBooleanArg", true );
assertEquals( true, ReflectUtil.getProperty(o, "BoolProp" ));
ReflectUtil.invokeMethod( o, "setWByteArg", (byte) 1 );
assertEquals( (byte) 1, ReflectUtil.getProperty(o, "ByteProp" ));
ReflectUtil.invokeMethod( o, "setWCharArg", (char) 1 );
assertEquals( (char) 1, ReflectUtil.getProperty(o, "CharProp" ));
ReflectUtil.invokeMethod( o, "setWShortArg", (short) 1 );
assertEquals( (short) 1, ReflectUtil.getProperty(o, "ShortProp" ));
ReflectUtil.invokeMethod( o, "setWIntArg", (int) 1 );
assertEquals( (int) 1, ReflectUtil.getProperty(o, "IntProp" ));
ReflectUtil.invokeMethod( o, "setWLongArg", (long) 1 );
assertEquals( (long) 1, ReflectUtil.getProperty(o, "LongProp" ));
ReflectUtil.invokeMethod( o, "setWFloatArg", (float) 1 );
assertEquals( (float) 1, ReflectUtil.getProperty(o, "FloatProp" ));
ReflectUtil.invokeMethod( o, "setWDoubleArg", (double) 1 );
assertEquals( (double) 1, ReflectUtil.getProperty(o, "DoubleProp" ));
}
public void testGenericStaticSimpleFunctionInvocation()
{
Object o = makeGenericReflectionClass();
assertEquals( "plain function", ReflectUtil.invokeMethod( o, "staticPlainFunction" ));
}
public void testGenericStaticFunctionWithStringArgInvocation()
{
Object o = makeGenericReflectionClass();
assertEquals( "test", ReflectUtil.invokeMethod( o, "staticFunctionWStringArg", "test" ));
}
public void testGenericStaticFunctionWithPrimitiveArgInvocations()
{
Object o = makeGenericReflectionClass();
assertEquals( true, ReflectUtil.invokeMethod( o, "staticFunctionWBooleanArg", true ));
assertEquals( (byte) 1, ReflectUtil.invokeMethod( o, "staticFunctionWByteArg", (byte) 1 ));
assertEquals( (char) 1, ReflectUtil.invokeMethod( o, "staticFunctionWCharArg", (char) 1 ));
assertEquals( (short) 1, ReflectUtil.invokeMethod( o, "staticFunctionWShortArg", (short) 1 ));
assertEquals( (int) 1, ReflectUtil.invokeMethod( o, "staticFunctionWIntArg", (int) 1 ));
assertEquals( (long) 1, ReflectUtil.invokeMethod( o, "staticFunctionWLongArg", (long) 1 ));
assertEquals( (float) 1, ReflectUtil.invokeMethod( o, "staticFunctionWFloatArg", (float) 1 ));
assertEquals( (double) 1, ReflectUtil.invokeMethod( o, "staticFunctionWDoubleArg", (double) 1 ));
}
public void testGenericGenericFunctionInvocation()
{
Object o = makeGenericReflectionClass();
assertEquals( "foo", ReflectUtil.invokeMethod( o, "genericFunction", "foo" ));
assertEquals( JavaTypes.OBJECT(), ReflectUtil.invokeMethod( o, "genericFunctionReturnsQ", "foo" ));
assertEquals( JavaTypes.CHAR_SEQUENCE(), ReflectUtil.invokeMethod( o, "genericFunctionReturnsBoundedQ", "foo" ));
}
public void testGenericStaticGenericFunctionInvocation()
{
Object o = makeGenericReflectionClass();
assertEquals( "foo", ReflectUtil.invokeMethod( o, "staticGenericFunction", "foo" ));
assertEquals( JavaTypes.OBJECT(), ReflectUtil.invokeMethod( o, "staticGenericFunctionReturnsQ", "foo" ));
assertEquals( JavaTypes.CHAR_SEQUENCE(), ReflectUtil.invokeMethod( o, "staticGenericFunctionReturnsBoundedQ", "foo" ));
}
public void testGenericSimplePropertyGetInvocation() throws ClassNotFoundException
{
Object o = makeGenericReflectionClass();
assertEquals( "Default Value", ReflectUtil.getProperty( o, "StringProp" ));
}
public void testGenericSimplePropertySetInvocation() throws ClassNotFoundException
{
Object o = makeGenericReflectionClass();
assertEquals( "Default Value", ReflectUtil.getProperty( o, "StringProp" ));
ReflectUtil.setProperty( o, "StringProp", "New Value" );
assertEquals( "New Value", ReflectUtil.getProperty( o, "StringProp" ));
}
public void testGenericEnhancementSimpleFunctionInvocation()
{
Object o = makeGenericReflectionClass();
assertEquals( "plain function", ReflectUtil.invokeMethod( o, "e_plainFunction" ));
}
public void testGenericEnhancementFunctionWithStringArgInvocation()
{
Object o = makeGenericReflectionClass();
assertEquals( "test", ReflectUtil.invokeMethod( o, "e_functionWStringArg", "test" ));
}
public void testGenericEnhancementFunctionWithPrimitiveArgInvocations()
{
Object o = makeGenericReflectionClass();
assertEquals( true, ReflectUtil.invokeMethod( o, "e_functionWBooleanArg", true ));
assertEquals( (byte) 1, ReflectUtil.invokeMethod( o, "e_functionWByteArg", (byte) 1 ));
assertEquals( (char) 1, ReflectUtil.invokeMethod( o, "e_functionWCharArg", (char) 1 ));
assertEquals( (short) 1, ReflectUtil.invokeMethod( o, "e_functionWShortArg", (short) 1 ));
assertEquals( (int) 1, ReflectUtil.invokeMethod( o, "e_functionWIntArg", (int) 1 ));
assertEquals( (long) 1, ReflectUtil.invokeMethod( o, "e_functionWLongArg", (long) 1 ));
assertEquals( (float) 1, ReflectUtil.invokeMethod( o, "e_functionWFloatArg", (float) 1 ));
assertEquals( (double) 1, ReflectUtil.invokeMethod( o, "e_functionWDoubleArg", (double) 1 ));
}
public void testGenericEnhancementSetters()
{
Object o = makeGenericReflectionClass();
ReflectUtil.invokeMethod( o, "e_setWStringArg", "foo" );
assertEquals( "foo", ReflectUtil.getProperty(o, "e_StringProp" ));
ReflectUtil.invokeMethod( o, "e_setWBooleanArg", true );
assertEquals( true, ReflectUtil.getProperty(o, "e_BoolProp" ));
ReflectUtil.invokeMethod( o, "e_setWByteArg", (byte) 1 );
assertEquals( (byte) 1, ReflectUtil.getProperty(o, "e_ByteProp" ));
ReflectUtil.invokeMethod( o, "e_setWCharArg", (char) 1 );
assertEquals( (char) 1, ReflectUtil.getProperty(o, "e_CharProp" ));
ReflectUtil.invokeMethod( o, "e_setWShortArg", (short) 1 );
assertEquals( (short) 1, ReflectUtil.getProperty(o, "e_ShortProp" ));
ReflectUtil.invokeMethod( o, "e_setWIntArg", (int) 1 );
assertEquals( (int) 1, ReflectUtil.getProperty(o, "e_IntProp" ));
ReflectUtil.invokeMethod( o, "e_setWLongArg", (long) 1 );
assertEquals( (long) 1, ReflectUtil.getProperty(o, "e_LongProp" ));
ReflectUtil.invokeMethod( o, "e_setWFloatArg", (float) 1 );
assertEquals( (float) 1, ReflectUtil.getProperty(o, "e_FloatProp" ));
ReflectUtil.invokeMethod( o, "e_setWDoubleArg", (double) 1 );
assertEquals( (double) 1, ReflectUtil.getProperty(o, "e_DoubleProp" ));
}
public void testGenericEnhancementStaticSimpleFunctionInvocation()
{
Object o = makeGenericReflectionClass();
assertEquals( "plain function", ReflectUtil.invokeMethod( o, "e_staticPlainFunction" ));
}
public void testGenericEnhancementStaticFunctionWithStringArgInvocation()
{
Object o = makeGenericReflectionClass();
assertEquals( "test", ReflectUtil.invokeMethod( o, "e_staticFunctionWStringArg", "test" ));
}
public void testGenericEnhancementStaticFunctionWithPrimitiveArgInvocations()
{
Object o = makeGenericReflectionClass();
assertEquals( true, ReflectUtil.invokeMethod( o, "e_staticFunctionWBooleanArg", true ));
assertEquals( (byte) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWByteArg", (byte) 1 ));
assertEquals( (char) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWCharArg", (char) 1 ));
assertEquals( (short) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWShortArg", (short) 1 ));
assertEquals( (int) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWIntArg", (int) 1 ));
assertEquals( (long) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWLongArg", (long) 1 ));
assertEquals( (float) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWFloatArg", (float) 1 ));
assertEquals( (double) 1, ReflectUtil.invokeMethod( o, "e_staticFunctionWDoubleArg", (double) 1 ));
}
public void testGenericEnhancementGenericFunctionInvocation()
{
Object o = makeGenericReflectionClass();
assertEquals( "foo", ReflectUtil.invokeMethod( o, "e_genericFunction", "foo" ));
assertEquals( JavaTypes.OBJECT(), ReflectUtil.invokeMethod( o, "e_genericFunctionReturnsS", "foo" ));
assertEquals( JavaTypes.CHAR_SEQUENCE(), ReflectUtil.invokeMethod( o, "e_genericFunctionReturnsBoundedS", "foo" ));
}
public void testGenericEnhancementStaticGenericFunctionInvocation()
{
Object o = makeGenericReflectionClass();
assertEquals( "foo", ReflectUtil.invokeMethod( o, "e_staticGenericFunction", "foo" ));
assertEquals( JavaTypes.OBJECT(), ReflectUtil.invokeMethod( o, "e_staticGenericFunctionReturnsS", "foo" ));
assertEquals( JavaTypes.CHAR_SEQUENCE(), ReflectUtil.invokeMethod( o, "e_staticGenericFunctionReturnsBoundedS", "foo" ));
}
public void testGenericEnhancementSimplePropertyGetInvocation() throws ClassNotFoundException
{
Object o = makeGenericReflectionClass();
assertEquals( "Default Value", ReflectUtil.getProperty( o, "e_StringProp" ));
}
public void testGenericEnhancementSimplePropertySetInvocation() throws ClassNotFoundException
{
Object o = makeGenericReflectionClass();
assertEquals( "Default Value", ReflectUtil.getProperty( o, "e_StringProp" ));
ReflectUtil.setProperty( o, "e_StringProp", "New Value" );
assertEquals( "New Value", ReflectUtil.getProperty( o, "e_StringProp" ));
}
public void testArrayCreationAndManipulation()
{
IType clazz = TypeSystem.getByFullName( SIMPLE_REFLECTION_CLASS );
Object o = clazz.makeArrayInstance( 3 );
assertTrue( o instanceof Object[] );
assertEquals( 3, clazz.getArrayLength( o ) );
for( int i = 0; i < 3; i++ )
{
assertNull( clazz.getArrayComponent( o, i ) );
}
for( int i = 0; i < 3; i++ )
{
clazz.setArrayComponent( o, i, makeSimpleReflectionClass() );
}
for( int i = 0; i < 3; i++ )
{
assertNotNull( clazz.getArrayComponent( o, i ) );
}
}
public void testArrayOfArraysCreationAndManipulation()
{
IType clazz = TypeSystem.getByFullName( SIMPLE_REFLECTION_CLASS );
IType arrayType = clazz.getArrayType();
Object o = arrayType.makeArrayInstance( 3 );
assertTrue( o instanceof Object[][] );
assertEquals( 3, arrayType.getArrayLength( o ) );
for( int i = 0; i < 3; i++ )
{
assertTrue( arrayType.getArrayComponent( o, i ) instanceof Object[] );
}
}
public void testArrayOfArrayOfArraysCreationAndManipulation()
{
IType clazz = TypeSystem.getByFullName( SIMPLE_REFLECTION_CLASS );
IType arrayType = clazz.getArrayType();
IType arrayArrayType = arrayType.getArrayType();
Object o = arrayArrayType.makeArrayInstance( 3 );
assertTrue( o instanceof Object[][][] );
assertEquals( 3, arrayType.getArrayLength( o ) );
for( int i = 0; i < 3; i++ )
{
assertTrue( arrayType.getArrayComponent( o, i ) instanceof Object[][] );
}
}
private Object makeSimpleReflectionClass()
{
Object o = ReflectUtil.construct( SIMPLE_REFLECTION_CLASS );
assertNotNull( o );
Class<?> aClass = null;
try
{
aClass = GosuClassLoader.instance().findClass( SIMPLE_REFLECTION_CLASS );
}
catch( ClassNotFoundException e )
{
throw new RuntimeException( e );
}
assertTrue( aClass.isInstance( o ) );
return o;
}
private Object makeGenericReflectionClass()
{
IType genericClass = TypeSystem.getByFullName( GENERIC_REFLECTION_CLASS );
IType parameterizedType = genericClass.getParameterizedType( JavaTypes.STRING(), JavaTypes.OBJECT(), JavaTypes.STRING() );
IConstructorHandler iConstructorHandler = parameterizedType.getTypeInfo().getConstructor().getConstructor();
Object o = iConstructorHandler.newInstance();
Class<?> aClass = null;
try
{
aClass = GosuClassLoader.instance().findClass( GENERIC_REFLECTION_CLASS );
}
catch( ClassNotFoundException e )
{
throw new RuntimeException( e );
}
assertTrue( aClass.isInstance( o ) );
return o;
}
}
| [
"lboasso@guidewire.com"
] | lboasso@guidewire.com |
d04c901286e2686fd2b2d4860aed335d9301a227 | a4abef7e172a7e94fba4c4d4c4ec94def25de62b | /src/PB_371_GetSum/Solution_371.java | 91506d58e15e1e1131a20415833d875a7e489956 | [] | no_license | SugarRay1/LeetCode_1 | 1aecea7f861f24ce75743ed80a6f335dc83de28e | 4005cc2b46a76cfbaf9731afc35e3016a51a43bd | refs/heads/master | 2020-12-22T14:10:57.291550 | 2020-07-11T08:51:49 | 2020-07-11T08:51:49 | 236,815,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package PB_371_GetSum;
public class Solution_371 {
public int getSum(int a, int b) {
return Math.addExact(a, b);
}
}
| [
"petershao1996@outlook.com"
] | petershao1996@outlook.com |
100f3e8a4bf5826f5fe478275b05e90beb8c5002 | 09f7b72e2eeaadae06493237f5d49057e38214f4 | /app/src/main/java/com/mehdi/myproject/LoginActivity.java | 4ce57193418db944cd99fd799d6d815a98c6f85d | [] | no_license | mehdideg2/androidApp | 17fe514dbf3d4527357ab3874cc12206d2816eda | 9972c27204d9c31259fe142d9cf9b852034490d9 | refs/heads/master | 2020-05-18T01:20:18.590582 | 2019-04-29T14:37:18 | 2019-04-29T14:37:18 | 184,076,810 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,800 | java | package com.mehdi.myproject;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.GoogleAuthProvider;
import java.util.Objects;
public class LoginActivity extends AppCompatActivity implements GoogleApiClient.OnConnectionFailedListener {
EditText loginEmail;
EditText loginPassword;
Button loginButton;
Button registerButton;
Button newPassButton;
private static final int RC_SIGN_IN = 9001;
private SignInButton googleSignInButton;
FirebaseAuth firebaseAuth;
GoogleApiClient mGoogleApiClient;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_layout);
loginEmail = findViewById(R.id.loginEmailInput);
loginPassword = findViewById(R.id.loginPasswordInput);
loginButton = findViewById(R.id.loginButton);
registerButton = findViewById(R.id.gotoRegisterButton);
googleSignInButton = findViewById(R.id.googleLoginButton);
newPassButton = findViewById(R.id.forgetPasswordButton);
firebaseAuth = FirebaseAuth.getInstance();
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(LoginActivity.this,this)
.addApi(Auth.GOOGLE_SIGN_IN_API,gso)
.build();
googleSignInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
signIn();
}
});
if(firebaseAuth.getCurrentUser()!=null){
startActivity(new Intent(getApplicationContext(), HomeActivity.class));
}
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (loginEmail.getText().toString().isEmpty()) {
Toast.makeText(LoginActivity.this, "email required", Toast.LENGTH_SHORT).show();
} else if (loginPassword.getText().toString().isEmpty()) {
Toast.makeText(LoginActivity.this, "password required", Toast.LENGTH_SHORT).show();
} else {
// forceHideKeyboard();
logIn(loginEmail.getText().toString(), loginPassword.getText().toString());
}
}
});
}
private void logIn(String username, String password) {
final ProgressDialog process = ProgressDialog.show(LoginActivity.this, null, "please wait", true);
FirebaseAuth mAuth = FirebaseAuth.getInstance();
mAuth.signInWithEmailAndPassword(username, password)
.addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// forceHideKeyboard();
// Sign in success, update UI with the signed-in user's information
Log.e("tag", "signInWithEmail:success");
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
LoginActivity.this.startActivity(intent);
} else {
// If sign in fails, display a message to the user.
Log.w("tag", "signInWithEmail:failure " + Objects.requireNonNull(task.getException()).getMessage());
Toast.makeText(LoginActivity.this,
LoginActivity.this.getResources().getString(R.string.authentication_failed) + task.getException().getMessage(),
Toast.LENGTH_SHORT)
.show();
}
process.dismiss();
}
});
}
private void signIn() {
Intent signIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signIntent,RC_SIGN_IN);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==RC_SIGN_IN){
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
System.out.println(result);
if(result.isSuccess()){
GoogleSignInAccount account = result.getSignInAccount();
authWithGoogle(account);
}
}
}
private void authWithGoogle(GoogleSignInAccount account) {
AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(),null);
firebaseAuth.signInWithCredential(credential).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
startActivity(new Intent(getApplicationContext(), HomeActivity.class));
finish();
}
else{
Toast.makeText(getApplicationContext(),"Auth Error",Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
}
}
| [
"m.deghdache@yumitechnology.com"
] | m.deghdache@yumitechnology.com |
5b4d5ee08fed0b8172400a177ae0d180554b1192 | 0ae9455f8602eaf225972f5912eea09227580dc4 | /InnerClassExample/src/com/example/innerclassexample/InnerClassExample.java | 91d2e9f2936a9a4fd5061bb5322125f986b20cd2 | [] | no_license | canmurat/myworkspace | 7fcb269ae881557ad4cd31450e6a8644311a8de2 | 7ddc97a40609b652cf2b7e5304b1c29a4d4b4393 | refs/heads/master | 2016-09-06T00:27:08.858902 | 2014-04-01T19:46:56 | 2014-04-01T19:46:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,343 | java | package com.example.innerclassexample;
import java.util.Random;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class InnerClassExample extends Activity {
private View mColorRegion;
private int[] mColorChoices =
{ Color.BLACK, Color.BLUE};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_inner_class_example);
mColorRegion = findViewById(R.id.textView1);
Button colorButton = (Button)findViewById(R.id.button1);
colorButton.setOnClickListener(new ColorRandomizer());
}
private void setRegionColor(int color) {
mColorRegion.setBackgroundColor(color);
}
private class ColorRandomizer implements OnClickListener {
@Override
public void onClick(View v) {
Random generator = new Random();
int index = generator.nextInt(mColorChoices.length);
setRegionColor(mColorChoices[index]);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.inner_class_example, menu);
return true;
}
}
| [
"can.murat@bil.omu.edu.tr"
] | can.murat@bil.omu.edu.tr |
f2dc3a7502bc43c087cc5a77dca74b3bae8c60d8 | 880b617aa946e4180ec8096fd6a0abe17f70f92d | /src/main/java/com/github/thesmartenergy/sparql/generate/jena/engine/SelectPlan.java | 9ce7549012b245cd67441bec4b5ddb685412ab7d | [
"Apache-2.0"
] | permissive | noorbakerally/sparql-generate-jena | f864a9d410496b751700725bfa8b7da2e2c5a20c | cf2031418f3dedcb9e613f8092b5868be9d74431 | refs/heads/master | 2021-01-21T09:43:04.833679 | 2016-04-19T08:58:17 | 2016-04-19T08:58:17 | 53,410,041 | 0 | 0 | null | 2016-03-08T12:24:27 | 2016-03-08T12:24:26 | null | UTF-8 | Java | false | false | 1,463 | java | /*
* Copyright 2016 ITEA 12004 SEAS Project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.thesmartenergy.sparql.generate.jena.engine;
import com.github.thesmartenergy.sparql.generate.jena.engine.impl.BindingHashMapOverwrite;
import java.util.List;
import org.apache.jena.query.Dataset;
import org.apache.jena.sparql.core.Var;
/**
* Executes generated SPARQL SELECT query.
* @author maxime.lefrancois
*/
public interface SelectPlan {
/**
* Updates a values block with the execution of a SPARQL SELECT query.
*
* @param inputDataset the Dataset to use for the SPARQL SELECT part of the
* query.
* @param variables the set of bound variables.
* @param values the set of bindings.
*/
void exec(
final Dataset inputDataset,
final List<Var> variables,
final List<BindingHashMapOverwrite> values);
}
| [
"maxime.lefrancois@FAYOL-PRET07.fayol.emse2000.local"
] | maxime.lefrancois@FAYOL-PRET07.fayol.emse2000.local |
ebbb02dca61b4e681010b681120f42818c1be45b | 7786048efe1fce6d88bf8e44234213018e60e0eb | /sysinfo/src/main/java/com/sys/pojo/AdminUser.java | 869ba2542c47112c5eb992088bbab925cfca7b3c | [] | no_license | pampersnow/trs-sysinfo | 6a5d2f6c398ce74dc6afab27827891fa42ef2378 | b7deb4d3c1391770168d63d26436ed189fcefaea | refs/heads/master | 2021-08-16T05:51:36.273997 | 2019-01-04T03:18:29 | 2019-01-04T03:18:29 | 153,086,969 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,099 | java | package com.sys.pojo;
import java.io.Serializable;
/**
* Copyright (C) Beijing TRS information technology co. LTD.In
* @ClassName: AdminUser
* @Description: 管理员用户表
* @author JYB
* @date 2018年9月9日上午8:50:22
* @version 1.00
*/
public class AdminUser implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
/** 用户名*/
private String account;
/** 密码 */
private String password;
/** 密码盐 */
private String passwordSalt;
/** 禁用/启用 */
private Boolean isDisabled;
/** 是否删除*/
private Boolean isDeleted;
public AdminUser() {
super();
}
public AdminUser(String account) {
super();
this.account = account;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPasswordSalt() {
return passwordSalt;
}
public void setPasswordSalt(String passwordSalt) {
this.passwordSalt = passwordSalt;
}
public Boolean getIsDisabled() {
return isDisabled;
}
public void setIsDisabled(Boolean isDisabled) {
this.isDisabled = isDisabled;
}
public Boolean getIsDeleted() {
return isDeleted;
}
public void setIsDeleted(Boolean isDeleted) {
this.isDeleted = isDeleted;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.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;
AdminUser other = (AdminUser) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
| [
"17611309300@163.com"
] | 17611309300@163.com |
56dae2722e35b52440aff6adca063e22cc742e94 | b52457b2675707febb6104e57d88cdaf65281b5b | /36.Boot-SingleSignOnWithOktaServer/src/main/java/com/example/demo/Application.java | ef1a53cdf4a36cb02a1d9c9ef5098a8e3e49a31a | [] | no_license | princedj07/SpringBoot1.1 | 03a6d6850b82abd596374ca0af0c7e74ffa89e1a | efd7d12e211b2b567098f5862474c2e15d782d8e | refs/heads/master | 2022-11-21T20:59:40.098189 | 2020-07-18T03:21:30 | 2020-07-18T03:21:30 | 280,401,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 739 | java | package com.example.demo;
import java.security.Principal;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@EnableOAuth2Sso
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@GetMapping("/")
public String echoTheUsersEmailAddress(Principal principal) {
return "Hey there! Your email address is: " + principal.getName();
}
}
| [
"Prince@LAPTOP-KFIKPE1S"
] | Prince@LAPTOP-KFIKPE1S |
85fc73d9a2404c21dca4fe8d94c2bf47ea5aefeb | 397b1d6d285df01066a48b2299da2ac6508f2900 | /platform/src/main/java/net/happyonroad/platform/services/ServicePackageManager.java | 32db1eb261d4db0d2efe254c1c846a1f514be0d4 | [] | no_license | SoftwareKing/spring-service-components | fccb582acdd7882b7484b21b57b4f60a6fc2b953 | f6141f91b37476098093e11d87d13cec9bb19937 | refs/heads/master | 2021-01-17T06:50:35.382130 | 2014-12-08T12:02:26 | 2014-12-08T12:02:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,290 | java | /**
* Developer: Kadvin Date: 14-7-14 下午5:55
*/
package net.happyonroad.platform.services;
import net.happyonroad.platform.config.DefaultAppConfig;
import net.happyonroad.platform.config.DefaultServiceConfig;
import net.happyonroad.spring.ApplicationSupportBean;
import net.happyonroad.component.container.ComponentLoader;
import net.happyonroad.component.container.ComponentRepository;
import net.happyonroad.component.container.event.ContainerEvent;
import net.happyonroad.component.container.event.ContainerStartedEvent;
import net.happyonroad.component.container.event.ContainerStoppingEvent;
import net.happyonroad.component.container.feature.ApplicationFeatureResolver;
import net.happyonroad.component.container.feature.ServiceFeatureResolver;
import net.happyonroad.component.core.Component;
import net.happyonroad.component.core.ComponentContext;
import net.happyonroad.component.core.exception.DependencyNotMeetException;
import net.happyonroad.component.core.exception.InvalidComponentNameException;
import net.happyonroad.component.core.support.DefaultComponent;
import net.happyonroad.component.core.support.Dependency;
import org.springframework.beans.factory.access.BootstrapException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextException;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ApplicationEventMulticaster;
import java.io.File;
import java.io.FilenameFilter;
import java.util.*;
/**
* The service package manager
*/
public class ServicePackageManager extends ApplicationSupportBean
implements ApplicationListener<ContainerEvent>, FilenameFilter {
public static final String DEFAULT_CONFIG = "Default-Config";
public static final String DEFAULT_APP_CONFIG = DefaultAppConfig.class.getName();
public static final String DEFAULT_SERVICE_CONFIG = DefaultServiceConfig.class.getName();
private final String defaultDbRepository, defaultWebRepository;
public ServicePackageManager(String defaultDbRepository, String defaultWebRepository) {
this.defaultDbRepository = defaultDbRepository;
this.defaultWebRepository = defaultWebRepository;
}
@Autowired
private ComponentLoader componentLoader;
@Autowired
private ComponentContext componentContext;
@Autowired
private ComponentRepository componentRepository;
List<Component> loadedServicePackages = new LinkedList<Component>();
@Override
public void onApplicationEvent(ContainerEvent event) {
if (event instanceof ContainerStartedEvent) {
try {
loadServicePackages();
publish(new ServicePackagesEvent.LoadedEvent(this));
} catch (Exception e) {
throw new BootstrapException("Can't load service packages", e);
}
} else if (event instanceof ContainerStoppingEvent) {
try {
unloadServicePackages();
publish(new ServicePackagesEvent.UnloadedEvent(this));
} catch (Exception e) {
throw new ApplicationContextException("Can't unload service packages", e);
}
}
}
void loadServicePackages() throws Exception {
File repository = new File(System.getProperty("app.home"), "repository");
File[] packageJars = repository.listFiles(this);
if (packageJars == null)
packageJars = new File[0]; /*也可能在目录下没有jar*/
logger.debug("Loading {} service packages from: {}", packageJars.length, repository.getAbsolutePath());
// sort the model packages by them inner dependency
//componentRepository.sortCandidates(packageJars);
//outputPackageJars(packageJars);
// TODO 不知道为什么,排序结果中会出错
// 临时规则,让系统能先正常的跑起来,以后再来解决
Arrays.sort(packageJars, new ServicePackageComparator());
outputPackageJars(packageJars);
for (File jar : packageJars) {
loadServicePackage(jar);
}
}
private void outputPackageJars(File[] packageJars)
throws DependencyNotMeetException, InvalidComponentNameException {
StringBuilder sb = new StringBuilder();
for (File packageJar : packageJars) {
Component pkg = componentRepository.resolveComponent(packageJar.getName());
sb.append("\t").append(pkg.getBriefId()).append("\n");
}
logger.debug("Sorted service packages is list as: \n{}", sb);
}
void loadServicePackage(File jar)
throws InvalidComponentNameException, DependencyNotMeetException, ServicePackageException {
Dependency dependency = Dependency.parse(jar.getName());
Component component = componentRepository.resolveComponent(dependency);
try {
logger.info("Loading service package: {}", component);
//仅发给容器
publish(new ServicePackageEvent.LoadingEvent(component));
//TODO 这段全局附加特性放在这里存在问题;
// 当依赖排序出错时,如 net.happyonroad.menu 被依赖,但排序之后被最后一个加载
// 这样就会出现 在加载某个业务模型时,将 net.happyonroad.menu 视为无缺省配置的模型加载
// 而后这里将其视为服务模型加载时,系统认为其已经加载,而不继续加载
applyDefaultConfig(component);
componentLoader.load(component);
loadedServicePackages.add(component);
DefaultComponent comp = (DefaultComponent) component;
registerMbean(comp, comp.getObjectName());
publish(new ServicePackageEvent.LoadedEvent(component));
logger.info("Loaded service package: {}", component);
} catch (Exception e) {
logger.error("Can't load service package: " + component + ", ignore it and going on", e);
}
}
private void applyDefaultConfig(Component component) {
String defaultConfig = component.getManifestAttribute(DEFAULT_CONFIG);
if( defaultConfig != null ){
defaultConfig = defaultConfig.toUpperCase();
if( defaultConfig.equalsIgnoreCase("true") ) defaultConfig = "A,S,W,D";
if( defaultConfig.contains("A")){
component.setManifestAttribute(ApplicationFeatureResolver.APP_CONFIG, DEFAULT_APP_CONFIG);
}
if( defaultConfig.contains("S")){
component.setManifestAttribute(ServiceFeatureResolver.SERVICE_CONFIG, DEFAULT_SERVICE_CONFIG);
}
if( defaultConfig.contains("D")){
component.setManifestAttribute(MybatisFeatureResolver.DB_REPOSITORY, defaultDbRepository);
}
if( defaultConfig.contains("W")){
component.setManifestAttribute(SpringMvcFeatureResolver.WEB_REPOSITORY, defaultWebRepository);
}
}
}
void unloadServicePackages() throws Exception {
List<Component> servicePackages = new LinkedList<Component>(loadedServicePackages);
componentRepository.sortComponents(servicePackages);
Collections.reverse(servicePackages);
for (Component component : servicePackages) {
unloadServicePackage(component);
}
}
void unloadServicePackage(Component component) {
logger.info("Unloading service package: {}", component);
publish(new ServicePackageEvent.UnloadingEvent(component));
componentLoader.unloadSingle(component);
loadedServicePackages.remove(component);
//这个事件就仅发给容器
publish(new ServicePackageEvent.UnloadedEvent(component));
logger.info("Unloaded service package: {}", component);
}
protected void publish(ApplicationEvent event) {
ApplicationContext mainApp = componentContext.getMainApp();
if (mainApp != null)
//通过 pom class world's main component 进行广播
mainApp.publishEvent(event);
else//通过当前(platform application context) 向外广播
applicationContext.publishEvent(event);
//向业已加载的服务包广播事件,为了避免上层容器收到额外的消息,不向他们的parent发送
for (Component component : loadedServicePackages) {
ApplicationContext app = component.getApplication();
if (app != null) {
ApplicationEventMulticaster multicaster = app.getBean(ApplicationEventMulticaster.class);
multicaster.multicastEvent(event);
}
}
}
@Override
public boolean accept(File dir, String name) {
if (!name.endsWith(".jar")) return false;
Dependency dependency;
try {
dependency = Dependency.parse(name);
} catch (InvalidComponentNameException e) {
return false;
}
String id = dependency.getArtifactId().toLowerCase();
return !id.endsWith("_api");
}
}
| [
"kadvin@gmail.com"
] | kadvin@gmail.com |
bf906936a7fe16c7f1a55bd9b697a53420ec3d53 | 3ca7d7bc44cbc6cc87edacd107315592175c59d4 | /portfolio/src/main/java/com/citi/portfolio/entity/Stock.java | 16c52b3547188752e71178891529e09991fc68ae | [] | no_license | EasyWork1/PortfolioManagement | 375ea732c7ff3fe34f8be0211b615f22a51922b3 | 1e248271d7a5a5df9b4b0cfc077cde1997b51fc4 | refs/heads/master | 2021-01-02T22:28:53.127586 | 2017-08-10T12:47:52 | 2017-08-10T12:47:52 | 99,326,553 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,292 | java | package com.citi.portfolio.entity;
import java.util.Date;
public class Stock {
private String symbol;
private String name;
private Double lastsale;
private Long marketcap;
private Integer ipoyear;
private String sector;
private String industry;
private Date date;
private String currency;
public Stock(String symbol, String name, Double lastsale, Long marketcap, Integer ipoyear, String sector, String industry, Date date, String currency) {
this.symbol = symbol;
this.name = name;
this.lastsale = lastsale;
this.marketcap = marketcap;
this.ipoyear = ipoyear;
this.sector = sector;
this.industry = industry;
this.date = date;
this.currency = currency;
}
public Stock() {
super();
}
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol == null ? null : symbol.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Double getLastsale() {
return lastsale;
}
public void setLastsale(Double lastsale) {
this.lastsale = lastsale;
}
public Long getMarketcap() {
return marketcap;
}
public void setMarketcap(Long marketcap) {
this.marketcap = marketcap;
}
public Integer getIpoyear() {
return ipoyear;
}
public void setIpoyear(Integer ipoyear) {
this.ipoyear = ipoyear;
}
public String getSector() {
return sector;
}
public void setSector(String sector) {
this.sector = sector == null ? null : sector.trim();
}
public String getIndustry() {
return industry;
}
public void setIndustry(String industry) {
this.industry = industry == null ? null : industry.trim();
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency == null ? null : currency.trim();
}
} | [
"385121039@qq.com"
] | 385121039@qq.com |
d8542f582b54d39eb8578a31b649a99c09265815 | dcff46e655077a31d0d7788214a452cfa92b3623 | /game01/core/src/main/java/sut/game01/core/sprite/Mice.java | e1d60dd51cb26f68274b7670df81d7d2447e76c0 | [] | no_license | Wanlika/CatchMe | 0137302f2f51e61b8cd9833c951f100b0fc838c8 | ae2a5cfdb9ae9d9b8a03ca18f43a04b11f9df817 | refs/heads/master | 2020-03-29T20:01:54.164760 | 2014-03-24T16:47:49 | 2014-03-24T16:47:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,109 | java | package sut.game01.core.sprite;
import org.jbox2d.dynamics.Body;
import playn.core.Layer;
import playn.core.PlayN;
import playn.core.util.Callback;
import playn.core.util.Clock;
import org.jbox2d.collision.shapes.PolygonShape;
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.*;
import org.jbox2d.dynamics.contacts.Contact;
import playn.core.*;
import playn.core.util.Callback;
import playn.core.util.Clock;
import sut.game01.core.screen.GameScreen;
/**
* Created by Yambok on 3/3/2557.
*/
public class Mice {
private Sprite sprite;
private int spriteIndex=0;
private boolean hasLoaded = false;
public Body body;
private Body other;
private boolean contacted;
private int contactCheck;
private float y;
private float x;
private int n;
public enum State{
IDLE,RUN,THROW
};
private State state = State.IDLE;
private int e=0;
private int offset=0;
public Mice(final float x_px,final float y_px){
this.sprite = SpriteLoader.getSprite("images/sprite/mice.json");
this.sprite.addCallback(new Callback<Sprite>() {
@Override
public void onSuccess(Sprite result) {
sprite.setSprite(spriteIndex);
sprite.layer().setOrigin((sprite.width()) / 2f, (sprite.height()) / 2f);
sprite.layer().setTranslation(x_px, y_px);
hasLoaded = true;
y = y_px;
x = x_px;
}
@Override
public void onFailure(Throwable cause) {
PlayN.log().error("Error loading image!", cause);
}
});
}
public Layer layer(){
return sprite.layer();
}
public void update(int delta){
if (!hasLoaded) return;
e+=delta;
if (e > 150){
switch (state){
case IDLE: offset=0;
spriteIndex=-1;
break;
case THROW:offset=2;
state = State.IDLE;
break;
case RUN: offset =4;
n = n+60;
break;
}
spriteIndex = offset + ((spriteIndex+1)%2);
sprite.setSprite(spriteIndex);
e=0;
}
}
public void micethrow(){
state = State.THROW;
spriteIndex = 0;
}
public void run(){
state = State.RUN;
spriteIndex = -1;
sprite.layer().setSize(120f,80f);
}
public void paint(Clock clock) {
if (!hasLoaded)return;
if (state==State.RUN){
if ((x+n)>=640+sprite.layer().width()){
sprite.layer().setTranslation(x,y);
offset = 0;
spriteIndex=-1;
n = 0;
}
else {
sprite.layer().setTranslation(x+n,y);
}
}
}
public Body getBody(){
return this.body;
}
}
| [
"yambok01@gmail.com"
] | yambok01@gmail.com |
30bcd56825c7aa7852431dbd7d3ff366bf3d7313 | f70db425df3e5dd6b17c1833b863e699065997d9 | /src/main/java/simulator/playerdata/SwallowsData.java | 482e03fdf43dc40e996d7fc274d2ea726c585f23 | [] | no_license | taichiw/baseballSimulator | fc718f80e4ddc9e879d7f0df8fb2d85b402ec4c6 | 7fc7a988a285483d3226fab7a87aa3119e98821e | refs/heads/master | 2021-04-28T19:46:05.454815 | 2018-04-23T16:18:35 | 2018-04-23T16:18:35 | 121,907,162 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 884 | java | package simulator.playerdata;
import java.util.List;
public class SwallowsData implements TeamPlayersDataInterface {
private final static String CSV = "\"山田哲人\",\"526\",\"130\",\"25\",\"1\",\"24\",\"91\"\n"
+ "\"坂口智隆\",\"535\",\"155\",\"16\",\"2\",\"4\",\"59\"\n"
+ "\"バレンティン\",\"445\",\"113\",\"14\",\"1\",\"32\",\"70\"\n"
+ "\"中村悠平\",\"419\",\"102\",\"14\",\"4\",\"4\",\"42\"\n"
+ "\"大引啓次\",\"273\",\"62\",\"11\",\"0\",\"5\",\"27\"\n"
+ "\"藤井亮太\",\"292\",\"75\",\"3\",\"0\",\"2\",\"9\"\n"
+ "\"雄平\",\"281\",\"86\",\"21\",\"0\",\"2\",\"12\"\n"
+ "\"山崎晃大朗\",\"219\",\"53\",\"10\",\"2\",\"1\",\"18\"\n";
@Override
public List<PlayerData> getPlayerData() {
return PlayersDataUtil.getPlayerDataWithPitcher(CSV);
}
} | [
"taichi.watanabe@rakuten.com"
] | taichi.watanabe@rakuten.com |
dfd0d1c7593b856b7573f33776568ce1f867d355 | 99d5a4215e643fbf5b498b83337bca1702ea5c07 | /app/src/main/java/com/ican/skeleton/utils/NetworkUtil.java | 579ad3be0900380bbd2973f34d1db5d9bb3f29b4 | [] | no_license | tuwenyuan/Skeleton | a2be39e7d4c1cc7167449b74f6a1f005cd3c80e7 | 0b55fbf6d2961d83d63d84af36d056dfc60e0ca4 | refs/heads/master | 2021-05-09T07:07:14.284162 | 2018-03-28T07:23:33 | 2018-03-28T07:23:33 | 119,349,475 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,387 | java | package com.ican.skeleton.utils;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* Created by twy on 2018/1/29.
*/
public class NetworkUtil {
/**
* 判断网络是否可用
* @return
*/
public static boolean isAvailable(Context context){
if (context == null) {
return false;
}
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo == null ? false : activeNetworkInfo.isAvailable();
}
/**
* 判断当前连接是否为WiFi
* @param context
* @return 无网络与其它网络返回false
*/
public static boolean isWifi(Context context){
if (context == null) {
return false;
}
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo == null || activeNetworkInfo.isAvailable() == false) {
return false;
}
int type = activeNetworkInfo.getType();
return type == ConnectivityManager.TYPE_WIFI;
}
}
| [
"499216359@qq.com"
] | 499216359@qq.com |
62b5de1f3e8f0a02710439bf45464bbd67f15fb1 | 4bf3544d6675ede676ab9bb2bc498689ca871a4b | /src/main/java/com/catpp/springbootpro/service/GoodsService.java | 449c88750a6ea83b9016ffe73e84b7c53c27dc33 | [] | no_license | Maopp/springbootpro | 1d6825619e210c3c272bdcd52d85e76060869de0 | 31c8a40534104799503cb7b8ceec77183b0d6186 | refs/heads/master | 2022-06-21T14:37:37.976374 | 2018-12-06T09:06:51 | 2018-12-06T09:06:51 | 152,026,395 | 0 | 0 | null | 2022-06-17T02:45:43 | 2018-10-08T06:05:08 | Java | UTF-8 | Java | false | false | 277 | java | package com.catpp.springbootpro.service;
import com.catpp.springbootpro.pojo.GoodInfo;
/**
* com.catpp.springbootpro.service
*
* @Author cat_pp
* @Date 2018/11/1
* @Description
*/
public interface GoodsService {
Integer save(GoodInfo goodInfo) throws Exception;
}
| [
"1121266440@qq.com"
] | 1121266440@qq.com |
c060626013eebd1b87c211a17985a19a3a33d699 | 07b54991087cb335aab23cc6b575294760c3cd11 | /bt-gateway-service/src/main/java/com/bt/configuration/ConfigurationService.java | e60ae50c489b8bf685322dcff888a52baf431e2e | [] | no_license | khotvishwajeet/btgateway | e843e1c4d6bdcf094a3de15a4b06f368c3be5933 | 9f1d475aa88ae98a53a6316c83766ab934db46ce | refs/heads/main | 2023-03-30T09:31:41.763809 | 2021-03-24T09:55:10 | 2021-03-24T09:55:10 | 333,168,286 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 560 | java | package com.bt.configuration;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
@RefreshScope
@Configuration
@Component
@Getter
@Setter
public class ConfigurationService {
@Value("${cats.auth.external.secret}")
private String authSecret;
@Value("${cats.auth.external.header}")
private String authHeader;
}
| [
"khotvishwajeet@gmail.com"
] | khotvishwajeet@gmail.com |
740caab1445ca54dcf08e413b2b38d5b7c0ac10e | 1cf90d282a0fff1e8e5825c3301892e07d56b87e | /app/src/main/java/com/relinns/viegram/Activity/Splash_screen.java | da0eee775e5c45efc3f6476a3560649550dfc4ba | [] | no_license | mukulraw/Viegram | 79a15ab39efa0a2db111e96ddd97d7bac704d779 | 6dc08084103236f6928e52f1eba0ba3f324c2d1c | refs/heads/master | 2021-05-03T09:12:02.597490 | 2018-02-07T06:19:43 | 2018-02-07T06:19:46 | 120,571,747 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,326 | java | package com.relinns.viegram.Activity;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.CountDownTimer;
import android.os.Bundle;
import android.util.Log;
import com.crashlytics.android.Crashlytics;
import com.google.firebase.iid.FirebaseInstanceId;
import com.relinns.viegram.R;
import com.relinns.viegram.service.MyFirebaseInstanceIDService;
import io.fabric.sdk.android.Fabric;
public class Splash_screen extends Activity {
private SharedPreferences preferences;
private CountDownTimer timer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
if(FirebaseInstanceId.getInstance()==null){
Log.d("instance","nhi");
}
else {
Log.d("instance","hai");
}
new Thread() {
@Override
public void run() {
//If there are stories, add them to the table
try {
// code runs in a thread
runOnUiThread(new Runnable() {
@Override
public void run() {
// new MyFirebaseInstanceIDService().onTokenRefresh();
}
});
} catch (final Exception ignored) {
}
}
}.start();
Fabric.with(this, new Crashlytics());
preferences = getSharedPreferences("Viegram", MODE_PRIVATE);
if (!preferences.getString("user_id", "").equals("")) {
Intent i = new Intent(Splash_screen.this, Timeline.class);
startActivity(i);
overridePendingTransition(R.anim.enter, R.anim.exit);
} else {
timer = new CountDownTimer(3000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
}
@Override
public void onFinish() {
Intent i = new Intent(Splash_screen.this, Login_Screen.class);
startActivity(i);
overridePendingTransition(R.anim.enter, R.anim.exit);
}
}.start();
}
}
}
| [
"mukulraw199517@gmail.com"
] | mukulraw199517@gmail.com |
78fca049b99a820c05b2ad2e4462395355129310 | ca2e22c8c37e6af1ecc3e80331d3ca31f4142b38 | /server/web-interface/src/main/java/com/redwerk/likelabs/web/rest/resource/mapping/LinkHeaderBuilder.java | f7e8c1bfeb9a0dd4fed6647c5a041ed2dd6bc852 | [] | no_license | redwerk/likelabs | ecb8e33ff808d83dfa0ef91b5f36f11f296c3e60 | 23ae2bdd9b91caee96b7c33d0cd69a6c485e74de | refs/heads/master | 2020-05-17T09:22:53.971345 | 2012-07-09T14:52:48 | 2012-07-09T14:52:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 818 | java | package com.redwerk.likelabs.web.rest.resource.mapping;
public class LinkHeaderBuilder {
private final String baseUrl;
private final StringBuilder header = new StringBuilder();
public LinkHeaderBuilder(String baseUrl) {
this.baseUrl = baseUrl;
}
public LinkHeaderBuilder append(String url, String rel) {
appendLinkHeader(url, rel);
return this;
}
public LinkHeaderBuilder appendRelated(String url) {
appendLinkHeader(url, "related");
return this;
}
private void appendLinkHeader(String url, String rel) {
if(header.length() != 0) {
header.append(", ");
}
header.append("<").append(baseUrl).append(url.startsWith("/") ? "" : "/").append(">; rel=\"").append(rel).append("\"");
}
}
| [
"yarik_mic@5beb62dc-ff0c-0410-899a-bd8837d9df5a"
] | yarik_mic@5beb62dc-ff0c-0410-899a-bd8837d9df5a |
f905021c4113b1c8750a490aca32219c1f0830fc | 35e8a12f96c6f46aa77907c3a3ee2af30c8c8d3f | /hub.sam.sdl.model/src/hub/sam/sdl/SdlStatePartitionInstance.java | 3443cf8b71f116616f15d17d366db1b5bfe2f578 | [] | no_license | markus1978/tef | 36049dee71a99d24401d4a01fe33a3018e7bb776 | 38bfc24dc64822b7b3ed74e41f85b3a8c10c1955 | refs/heads/master | 2020-04-06T04:30:58.699975 | 2015-08-13T07:51:37 | 2015-08-13T07:51:37 | 25,520,279 | 1 | 2 | null | 2015-08-13T07:51:37 | 2014-10-21T12:13:17 | Java | UTF-8 | Java | false | false | 1,286 | java | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package hub.sam.sdl;
import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Sdl State Partition Instance</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link hub.sam.sdl.SdlStatePartitionInstance#getActualState <em>Actual State</em>}</li>
* </ul>
* </p>
*
* @see hub.sam.sdl.EmfSdlPackage#getSdlStatePartitionInstance()
* @model
* @generated
*/
public interface SdlStatePartitionInstance extends SdlStateInstance {
/**
* Returns the value of the '<em><b>Actual State</b></em>' reference list.
* The list contents are of type {@link hub.sam.sdl.SdlStateInstance}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Actual State</em>' reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Actual State</em>' reference list.
* @see hub.sam.sdl.EmfSdlPackage#getSdlStatePartitionInstance_ActualState()
* @model required="true" ordered="false"
* @generated
*/
EList<SdlStateInstance> getActualState();
} // SdlStatePartitionInstance
| [
"do@not.use"
] | do@not.use |
7d682ad6b044d6318ce38b08b5b08edcedcd674f | 60f0c5a270ced12ecd00a44c9346d8a055101727 | /src/main/java/jpabook/jpashop/controller/ItemController.java | d7723d0f361e38fe6d8a7a52f50996c8b5e52ccb | [] | no_license | mokhs00/jpaStudy | 58d2b0bee3d1e6474bac36838ea9fd7a595205f1 | dbd6200f1cafbb3c955ea192b683145b5397aecd | refs/heads/main | 2023-03-18T06:27:52.516074 | 2021-03-04T03:57:47 | 2021-03-04T03:57:47 | 325,010,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,362 | java | package jpabook.jpashop.controller;
import jpabook.jpashop.domain.item.Book;
import jpabook.jpashop.domain.item.Item;
import jpabook.jpashop.service.ItemService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
@Controller
@RequiredArgsConstructor
@Slf4j
public class ItemController {
private final ItemService itemService;
@GetMapping("/items/new")
public String createForm(Model model) {
model.addAttribute("form", new BookForm());
return "items/createItemForm";
}
@PostMapping("/items/new")
public String create(BookForm form) {
Book book = new Book();
book.setName(form.getName());
book.setPrice(form.getPrice());
book.setStockQuantity(form.getStockQuantity());
book.setAuthor(form.getAuthor());
book.setIsbn(form.getIsbn());
itemService.saveItem(book);
return "redirect:/";
}
@GetMapping("/items")
public String list(Model model) {
List<Item> items = itemService.findItems();
model.addAttribute("items", items);
return "items/itemList";
}
/**
* 상품 수정 폼
*/
@GetMapping("/items/{itemId}/edit")
public String editForm(@PathVariable("itemId") Long itemId, Model model) {
Book item = (Book) itemService.findOne(itemId);
BookForm form = new BookForm();
form.setId(item.getId());
form.setName(item.getName());
form.setPrice(item.getPrice());
form.setStockQuantity(item.getStockQuantity());
form.setAuthor(item.getAuthor());
form.setIsbn(item.getIsbn());
model.addAttribute("form", form);
return "items/updateItemForm";
}
/**
* 상품 수정, 권장 코드
*/
@PostMapping(value = "/items/{itemId}/edit")
public String updateItem(@ModelAttribute("form") BookForm form) {
itemService.updateItem(form.getId(), form.getName(), form.getPrice());
return "redirect:/items";
}
}
| [
"mokhs00@naver.com"
] | mokhs00@naver.com |
25d219541b09cc7100e9b8da16efe8f5c899dfb5 | 0299fcc64fd197f46f5f25beb786ebe202559803 | /src/patterns/decorator/DarkRoast.java | 24e0106ef23b93653797ea707a54a0c73ecee243 | [] | no_license | viniciosbastos/hands-on-design-patterns | b9ff7f2d3e1419fa6ca5abf1855ba79d7534e1cb | 1ea65f946d12c308f6517d8e26e7c0ff390c1505 | refs/heads/master | 2020-07-15T16:45:37.103027 | 2019-09-01T23:57:50 | 2019-09-01T23:57:50 | 205,608,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 184 | java | package patterns.decorator;
public class DarkRoast extends Beverage{
public DarkRoast() {
this.description = "DarkRoast";
}
@Override
public Float cost() {
return .99F;
}
}
| [
"aurelio.vinicios1996@gmail.com"
] | aurelio.vinicios1996@gmail.com |
b924bf130d26e6abb75013789c8b89b2475d2cd3 | 28fc8c23d3546a9d12e74f42e45f5955fe8fbb07 | /app/src/main/java/com/arshad/webservice/CustomerManagement/mapper/CustomerMapper.java | 5309779e87c029c972174fd6989b8303a926d4be | [] | no_license | shubhampal261/customer | a2b727133b2804b8395be573c15849399d098d96 | ccba5ca69c2404ff139748d1e696a1c00468e836 | refs/heads/master | 2023-02-10T16:46:59.463274 | 2021-01-14T20:03:53 | 2021-01-14T20:03:53 | 328,352,623 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package com.arshad.webservice.CustomerManagement.mapper;
import com.arshad.webservice.CustomerManagement.beans.Customer;
import com.arshad.webservice.CustomerManagement.beans.CustomerResponseModel;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper(unmappedTargetPolicy = ReportingPolicy.WARN)
public interface CustomerMapper {
CustomerMapper INSTANCE = Mappers.getMapper(CustomerMapper.class);
CustomerResponseModel mapToCustomerResponseModel(final Customer customer);
List<CustomerResponseModel> mapToCustomerResponseModelList(final List<Customer> customerList);
}
| [
"shubhampal261@gmail.com"
] | shubhampal261@gmail.com |
eb8496427b4acc1a12514b7a79a9704645b4990c | c611245deff767af46bfec4f3b3667434ecbce6b | /CcjhNosql/src/com/lsp/suc/web/AjaxAction.java | e3c71b6a03b46f060b9253bd01a2cf5aded050bf | [] | no_license | liushaopeng/pskjyf | e888b3b381a6206ecf934ff10857e808b3275a8b | 578c327338694b9fe32b0b262e8a33543796604d | refs/heads/master | 2021-01-22T20:54:20.603402 | 2018-01-29T08:33:22 | 2018-01-29T08:33:22 | 85,369,304 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,612 | java | package com.lsp.suc.web;
import java.util.HashMap;
import java.util.Map;
import net.sf.json.JSONArray;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;
import com.lsp.pub.dao.BaseDao;
import com.lsp.pub.db.MongoSequence;
import com.lsp.pub.entity.GetAllFunc;
import com.lsp.pub.entity.WxToken;
import com.lsp.pub.util.Struts2Utils;
import com.lsp.pub.util.WeiXinUtil;
import com.lsp.pub.web.GeneralAction;
import com.lsp.website.service.WwzService;
/***
* 资源管理
* @author lsp
*
*/
@Namespace("/suc")
@Results({ @org.apache.struts2.convention.annotation.Result(name = "reload", location = "ajax.action", type = "redirect") })
public class AjaxAction extends GeneralAction {
private static final long serialVersionUID = -7868703949557549292L;
@Autowired
private BaseDao baseDao;
@Autowired
private WwzService wwzService;
private MongoSequence mongoSequence;
@Autowired
public void setMongoSequence(MongoSequence mongoSequence) {
this.mongoSequence = mongoSequence;
}
@Override
public Object getModel() {
// TODO Auto-generated method stub
return null;
}
@Override
public String input() throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public String update() throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public String save() throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public String delete() throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
protected void prepareModel() throws Exception {
// TODO Auto-generated method stub
}
/**
* ajax获取微信分享url
* @throws Exception
* @throws NumberFormatException
*/
public void share() throws NumberFormatException, Exception {
String url=Struts2Utils.getParameter("url");
Map<String, Object> sub_map = new HashMap<String, Object>();
WxToken token=GetAllFunc.wxtoken.get(custid);
if(token.getSqlx()>0){
token=GetAllFunc.wxtoken.get(wwzService.getparentcustid(custid));
}
token=WeiXinUtil.getAjaxSignature(token,url);
token.put("url",wwzService.getshareurl(custid, url));
sub_map.put("token",token);
String json = JSONArray.fromObject(sub_map).toString();
Struts2Utils.renderJson(json.substring(1, json.length() - 1), new String[0]);
}
}
| [
"Administrator@chongzi"
] | Administrator@chongzi |
743249f7caae554ba00a702958aec48acd80f0e2 | 19f5ba673f4eb0e0ee7fd7c9c13964a76694a8de | /Graduate_Server/app/src/main/java/zhangchongantest/neu/edu/graduate_server/RecyclerView/RecyclerViewAdapter.java | b0d02e72e82d143ff7c04d023134a101af09f775 | [] | no_license | johncheung233/MyDemo | 4c85196bee76ba144459cad47b6fec925128d918 | bb4a19fff416f973bcd7f4905ff60d37e6aa158f | refs/heads/master | 2020-06-12T17:31:37.637261 | 2019-06-29T06:28:14 | 2019-06-29T06:39:59 | 194,373,035 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,331 | java | package zhangchongantest.neu.edu.graduate_server.RecyclerView;
import android.content.Context;
import android.content.pm.ProviderInfo;
import android.graphics.Bitmap;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import zhangchongantest.neu.edu.graduate_server.Config;
import zhangchongantest.neu.edu.graduate_server.ObjectConfig;
import zhangchongantest.neu.edu.graduate_server.R;
/**
* Created by Cheung SzeOn on 2019/4/19.
*/
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
private final int AccountViewType = 1;
private final int CarViewType = 2;
private final int ParkingDeviceViewType = 3;
private final int EmptyDataViewType = 4;
private boolean isShowEmptyView = false;
private boolean isBottomView = false;
private LayoutInflater layoutInflater;
private List<ObjectConfig> dataList;
private Context context;
public RecyclerViewAdapter(Context context, List<ObjectConfig> dataList) {
layoutInflater = LayoutInflater.from(context);
this.context = context;
this.dataList = dataList;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == AccountViewType){
View view = layoutInflater.inflate(R.layout.viewholder_account_type,parent,false);
return new AccountViewHolder(view);
}else if (viewType == CarViewType){
View view = layoutInflater.inflate(R.layout.viewholder_account_type,parent,false);
return new CarViewHolder(view);
}else if (viewType == ParkingDeviceViewType){
View view = layoutInflater.inflate(R.layout.viewholder_account_type,parent,false);
return new ParkingDeviceViewHolder(view);
}else if (viewType == EmptyDataViewType){
View view = layoutInflater.inflate(R.layout.viewholder_emptydata_type,parent,false);
return new EmptyDataViewHolder(view);
}
return null;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
String action = null;
if (!dataList.isEmpty()) {
switch (Integer.parseInt(dataList.get(position).getCmd())) {
case Config.CMD_CAR_IN:
action = "车辆入场";
break;
case Config.CMD_CAR_OUT:
action = "车辆离场";
break;
case Config.CMD_PRE_OUT:
action = "车辆获取停车费";
break;
case Config.CMD_REGISTER_IN:
action = "用户注册";
break;
case Config.CMD_REGISTER_LOGIN:
action = "用户登录";
break;
case Config.CMD_REGISTER_LOGOUT:
action = "用户注销";
break;
case Config.CMD_PARKING_CHECK:
action = "车位绑定";
break;
case Config.CMD_INIT_CHECK:
action = "初始化获取";
break;
}
}
if (holder instanceof AccountViewHolder){
((AccountViewHolder)holder).imageView.setImageResource(R.mipmap.server_user);
((AccountViewHolder)holder).tv_item1.setText(dataList.get(position).getAccountName());
((AccountViewHolder)holder).tv_item2.setText(action);
((AccountViewHolder)holder).tv_item3.setText(dataList.get(position).getSocketType());
}else if (holder instanceof CarViewHolder){
((CarViewHolder)holder).imageView.setImageResource(R.mipmap.server_car);
((CarViewHolder)holder).tv_item1.setText(dataList.get(position).getCarID());
((CarViewHolder)holder).tv_item2.setText(action);
((CarViewHolder)holder).tv_item3.setText(dataList.get(position).getSocketType());
}else if (holder instanceof ParkingDeviceViewHolder){
((ParkingDeviceViewHolder)holder).imageView.setImageResource(R.mipmap.server_device);
((ParkingDeviceViewHolder)holder).tv_item1.setText(dataList.get(position).getBookingSpaceId());
((ParkingDeviceViewHolder)holder).tv_item2.setText(dataList.get(position).getGetSocketIP().getHostAddress());
((ParkingDeviceViewHolder)holder).tv_item3.setText(dataList.get(position).getSocketType());
}else if (holder instanceof EmptyDataViewHolder){
((EmptyDataViewHolder)holder).imageView.setImageResource(R.mipmap.server_emptydata);
((EmptyDataViewHolder)holder).tv_item0.setText(R.string.empty_request_data);
}
}
@Override
public int getItemCount() {
if (dataList.isEmpty()){
isShowEmptyView = true;
return dataList.size()+1;
}
return dataList.size();
}
@Override
public int getItemViewType(int position) {
if (isShowEmptyView==true){
return EmptyDataViewType;
}
int itemViewType=0;
int cmd = Integer.parseInt(dataList.get(position).getCmd());
switch (cmd){
case Config.CMD_CAR_IN:
case Config.CMD_PRE_OUT:
case Config.CMD_CAR_OUT:
itemViewType = CarViewType;
break;
case Config.CMD_REGISTER_LOGIN:
case Config.CMD_REGISTER_LOGOUT:
case Config.CMD_REGISTER_IN:
case Config.CMD_INIT_CHECK:
itemViewType = AccountViewType;
break;
case Config.CMD_PARKING_CHECK:
itemViewType = ParkingDeviceViewType;
break;
}
return itemViewType;
}
public void dataUpdata(List<ObjectConfig> updataList){
//notifyDataSetChanged();
// if (!dataList.isEmpty()&&isShowEmptyView){
// int size = dataList.size();
// dataList.clear();
// notifyItemRangeRemoved(0, size);
// }
if (!updataList.isEmpty()){
if (isShowEmptyView==true){
isShowEmptyView = false;
dataList.clear();
notifyItemRemoved(0);
}
int oldPosition = dataList.size();
dataList.addAll(dataList.size(),updataList);
notifyItemRangeInserted(oldPosition, updataList.size());
}
// else {
// if (dataList.isEmpty()) {
// if (showEmptyView != true) {
// showEmptyView = true;
// notifyItemInserted(0);
// }
// }
// }
}
public List<ObjectConfig> getDataList() {
return dataList;
}
public boolean getShowEmptyView() {
return isShowEmptyView;
}
public void setEmptyView(){
if (dataList.size()!=0){
dataList.clear();
notifyItemRangeRemoved(0,dataList.size());
}
if (isShowEmptyView!=true){
isShowEmptyView=true;
notifyItemInserted(0);
}
}
}
| [
"875677993@qq.com"
] | 875677993@qq.com |
dd882de71ee4b731fd5fbad45accffc4c556304c | e9beb3c64cc0e100c40e0369d69498360543c28b | /app/src/main/java/com/example/flixster/MainActivity.java | 50f882ed509a233b1945906fcc26c44a6baf76fe | [] | no_license | miamichellee/Flixster2 | 5ca08cff45690d2b406350c9ab068a5a1ea19c6a | 85f324edb74b60be8adf6780f04d783caa3d960e | refs/heads/master | 2023-02-25T02:39:10.885510 | 2021-02-04T00:54:54 | 2021-02-04T00:54:54 | 335,493,304 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,490 | java | package com.example.flixster;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import android.util.Log;
import com.codepath.asynchttpclient.AsyncHttpClient;
import com.codepath.asynchttpclient.callback.JsonHttpResponseHandler;
import com.example.flixster.adapters.MovieAdapter;
import com.example.flixster.models.Movie;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import okhttp3.Headers;
public class MainActivity extends AppCompatActivity {
public static final String NOW_PLAYING_URL = "https://api.themoviedb.org/3/movie/now_playing?api_key=a07e22bc18f5cb106bfe4cc1f83ad8ed";
public static final String TAG = "MainActivity";
List<Movie> movies;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RecyclerView rvMovies = findViewById(R.id.rvMovies);
movies = new ArrayList<>();
//create adapter
MovieAdapter movieAdapter = new MovieAdapter(this, movies);
//Set adapter on recyclerview
rvMovies.setAdapter(movieAdapter);
//set layout manager on the recyclerview
rvMovies.setLayoutManager(new LinearLayoutManager(this));
AsyncHttpClient client = new AsyncHttpClient();
client.get(NOW_PLAYING_URL, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Headers headers, JSON json) {
Log.d(TAG, "onSuccess");
JSONObject jsonObject = json.jsonObject;
try {
JSONArray results = jsonObject.getJSONArray("results");
Log.i(TAG, "Results: " + results.toString());
movies.addAll(Movie.fromJsonArray(results));
movieAdapter.notifyDataSetChanged();
Log.i(TAG, "Movies: " + movies.size());
} catch (JSONException e) {
Log.e(TAG, "Hit json exception", e);
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Headers headers, String s, Throwable throwable) {
Log.d(TAG, "onFailure");
}
});
}
} | [
"tramia1.mcgee@famu.edu"
] | tramia1.mcgee@famu.edu |
72573762b78d8f634fe769679441931530d3bd61 | cf8893a9a68dc602adfafe0c87f434a1e6d8416f | /src/main/java/com/engine/player/Player.java | 2d09b73aa78d72760db6b220129aa7cc94e0c321 | [] | no_license | DanielDimitrovD/CleanCode | ade6c0d5d5a0bbfad4dbe1ea9255bf9c9a3b8ad1 | c63013e2310b274af8615483d210ce7154381844 | refs/heads/master | 2021-05-20T08:58:47.215814 | 2021-03-09T07:39:58 | 2021-03-09T07:39:58 | 252,209,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,861 | java | package com.engine.player;
import com.engine.Alliance;
import com.engine.board.Board;
import com.engine.moves.Move;
import com.engine.moves.MoveStatus;
import com.engine.moves.MoveTransition;
import com.engine.pieces.King;
import com.engine.pieces.Piece;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public abstract class Player {
protected final Board board;
protected final King playerKing;
protected final Collection<Move> legalMoves;
private final boolean isInCheck;
Player(final Board board, final Collection<Move> playerLegals, final Collection<Move> opponentLegals) {
this.board = board;
this.playerKing = establishKing();
this.isInCheck = calculateIfPlayerIsInCheck(opponentLegals);
playerLegals.addAll(calculateKingCastles(playerLegals, opponentLegals));
this.legalMoves = Collections.unmodifiableCollection(playerLegals);
}
public abstract Collection<Piece> getActivePieces();
public abstract Alliance getAlliance();
public abstract Player getOpponent();
protected abstract Collection<Move> calculateKingCastles(Collection<Move> playerLegals, Collection<Move> opponentLegals);
public MoveTransition makeMove(final Move move) {
if (!this.legalMoves.contains(move)) {
return new MoveTransition(this.board, this.board, move, MoveStatus.ILLEGAL_MOVE);
}
final Board transitionBoard = move.execute();
final Player currentPlayer = transitionBoard.getCurrentPlayer();
final Player opponent = currentPlayer.getOpponent();
return opponent.isInCheck() ? new MoveTransition(this.board, this.board, move, MoveStatus.LEAVES_PLAYER_IN_CHECK) :
new MoveTransition(this.board, transitionBoard, move, MoveStatus.DONE);
}
protected static Collection<Move> calculateAttacksOnTile(final int tileNumber, final Collection<Move> moves) {
return moves.stream()
.filter(move -> move.getDestinationCoordinate() == tileNumber)
.collect(Collectors.toUnmodifiableList());
}
private King establishKing() {
return (King) getActivePieces().stream()
.filter(piece -> piece.getPieceType() == Piece.PieceType.KING)
.findAny()
.orElseThrow(RuntimeException::new);
}
private boolean hasEscapeMoves() {
return this.legalMoves.stream()
.anyMatch(move -> makeMove(move).getMoveStatus().isDone());
}
public boolean calculateIfPlayerIsInCheck(final Collection<Move> opponentMoves) {
int playerKingPosition = this.playerKing.getPiecePosition();
Collection<Move> attacksAgainstKing = Player.calculateAttacksOnTile(playerKingPosition, opponentMoves );
return attacksAgainstKing.size() > 0;
}
protected boolean hasCastleOpportunities() {
return !this.isInCheck && !this.playerKing.isCastled() &&
(this.playerKing.isKingSideCastleCapable() || this.playerKing.isQueenSideCastleCapable());
}
public boolean isInCheck() {
return this.isInCheck;
}
public boolean isInCheckMate() {
return this.isInCheck && !hasEscapeMoves();
}
public boolean isInStaleMate() {
return !this.isInCheck && !hasEscapeMoves();
}
public boolean isCastled() {
return false;
}
public King getPlayerKing() {
return this.playerKing;
}
public Collection<Move> getLegalMoves() {
return this.legalMoves;
}
public boolean isKingSideCastleCapable() {
return this.playerKing.isKingSideCastleCapable();
}
public boolean isQueenSideCastleCapable() {
return this.playerKing.isQueenSideCastleCapable();
}
}
| [
"dakata619@gmail.com"
] | dakata619@gmail.com |
126988768184f193f99d5a69d6d97f32749aa304 | 1b9cfb871abca1914ecf27dfcd6e999970252075 | /app/src/main/java/cn/edu/gdmec/s07150850/intent/IntentDemo2.java | d871a93266bfabcd30c47693416e8e38a6654293 | [] | no_license | gdmec07150850/Intent | 74b5aa44106994b74e0f6ff43d17bf978702aa41 | 8724ce49d3140445161197596d0ce3f34640effd | refs/heads/master | 2021-01-17T15:23:08.748094 | 2016-10-25T03:44:45 | 2016-10-25T03:44:45 | 71,856,919 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 739 | java | package cn.edu.gdmec.s07150850.intent;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class IntentDemo2 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_intent_demo2);
}
public void upper(View v){
Intent intent=getIntent();
Bundle bundle=intent.getExtras();
final String value=bundle.getString("value").toUpperCase();
Intent intentresult=new Intent();
intentresult.putExtra("result",value);
setResult(RESULT_OK,intentresult);
finish();
}
}
| [
"626713393@qq.com"
] | 626713393@qq.com |
8e393438bef05e6faa263e6279fb4f99da3da9f5 | bdb50baaefe5b31c8019b70b3badff17d770cc20 | /target/generated-sources/jaxb/com/wetter_service/java/GetTemperaturResponse.java | a036f477d829d209f9ed71a82ef58e68908cc1ce | [] | no_license | FitimFaiku/smart-home-service-soap | 848c4cc0c82bbee61d5a3331c8eac320e4cb3390 | da133d04f7032b57b45eb3735dcf383d1fd7d073 | refs/heads/master | 2022-11-08T04:37:18.635348 | 2020-06-25T22:46:25 | 2020-06-25T22:46:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,648 | java | //
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2 generiert
// Siehe <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Änderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2020.06.26 um 12:04:43 AM CEST
//
package com.wetter_service.java;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java-Klasse für anonymous complex type.
*
* <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="temperatur" type="{http://www.w3.org/2001/XMLSchema}double"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"temperatur"
})
@XmlRootElement(name = "getTemperaturResponse")
public class GetTemperaturResponse {
protected double temperatur;
/**
* Ruft den Wert der temperatur-Eigenschaft ab.
*
*/
public double getTemperatur() {
return temperatur;
}
/**
* Legt den Wert der temperatur-Eigenschaft fest.
*
*/
public void setTemperatur(double value) {
this.temperatur = value;
}
}
| [
"faikufitim@gmail.com"
] | faikufitim@gmail.com |
6a32112321e878ff6dc013a48926b50beb57c8a4 | ed268ce80c22dd8ab4d27f01518f7c82629a89f4 | /web/src/main/java/com/facultative/web/command/student/DoDelMarkCommand.java | 28b0278aa329b1be17bf04f17e03ce0d9b8b8cc8 | [] | no_license | ralmnsk/srvlts | f0a66b4014b465fa6f331ddb407c13170b3ef2d2 | 478c085d543132a9062228ad45ad85f17d2ee0c5 | refs/heads/master | 2022-07-15T15:36:50.212730 | 2020-03-11T09:10:48 | 2020-03-11T09:10:48 | 238,431,957 | 0 | 0 | null | 2022-06-21T02:44:46 | 2020-02-05T11:13:59 | Java | UTF-8 | Java | false | false | 1,813 | java | package com.facultative.web.command.student;
import com.facultative.model.Mark;
import com.facultative.model.Person;
import com.facultative.service.IMarkService;
import com.facultative.service.MarkServiceImpl;
import com.facultative.service.config.ConfigurationManager;
import com.facultative.service.messages.MessageManager;
import com.facultative.web.command.ActionCommand;
import javax.servlet.http.HttpServletRequest;
import static com.facultative.service.constants.Constants.*;
public class DoDelMarkCommand implements ActionCommand {
private IMarkService<Mark> markService = MarkServiceImpl.getInstance();
@Override
public String execute(HttpServletRequest request) {
if(request.getSession().getAttribute(MARK_ID) != null){
long markId = (Long)request.getSession().getAttribute(MARK_ID);
Mark mark = markService.get(markId);
if (mark != null ){
Person student = mark.getStudent();
if (student !=null){
long studentIdFromMark = student.getId();
if (request.getSession().getAttribute(USER_ID) != null){
long userId = (long)request.getSession().getAttribute(USER_ID);
if (userId == studentIdFromMark){
markService.delete(markId);
request.getSession().removeAttribute(MARK_ID);
request.setAttribute(SEND_REDIRECT,true);
return CONTROLLER_COMMAND_VIEW_MARKS;
}
}
}
}
}
request.setAttribute(NULL_PAGE, MessageManager.getProperty("message.enroll.error"));
return ConfigurationManager.getProperty("path.page.error");
}
}
| [
"ralmnsk@gmail.com"
] | ralmnsk@gmail.com |
b6ad703c408d3a7e8e924bd4941f826eadb3bf4e | 89c78dbed3189664c330eee277782c7f482cb8a7 | /JavaWeb学习/20201125/05_HttpServletResquest相关介绍/src/com/mystudy/controller/OneServlet.java | 9d541fad4f783d9efa2ec89a263b342994121fb5 | [] | no_license | nanguling/JavaWeb | 83965632b81bdc96d2606c87f6e447c2f44253ce | 4aa15dcd701de4a5a19e1ade6f8c11a89d8cd8a7 | refs/heads/master | 2023-01-30T13:54:03.794598 | 2020-12-10T06:01:38 | 2020-12-10T06:01:38 | 318,940,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,232 | java | package com.mystudy.controller;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class OneServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//1.通过请求对象,读取【请求行】中【url】信息
String url = request.getRequestURL().toString();
//2.通过请求对象,读取【请求行】中【method】信息
String method = request.getMethod();
//3.通过请求对象,读取【请求行】中【uri】信息
/**
* URI:资源文件精准定位地址,在请求行中并没有URI这个属性
* 实际上是从URL中截取的一个字符串,这个字符串格式"/网站名/资源文件名"
* URI用于Http服务器对被访问的资源文件进行定位处理
*/
String uri = request.getRequestURI();//subString
System.out.println("URL: "+url);
System.out.println("method: "+method);
System.out.println("URI: "+uri);
}
}
| [
"814846779@qq.com"
] | 814846779@qq.com |
c1f978f64ec89692baa22d47f5751a0b83804398 | b9e03d95ba49e9679896fcdd2bfaf344bef535ce | /src/main/java/com/codeoftheweb/salvo/SalvoApplication.java | 0227e2048ac085b7f9576cc8650c0a6150526ba3 | [] | no_license | MicaelaV/SalvoGame | 63ca8b9e6976368765d1980d40c05581c78a2074 | 90425606ccd5966f8ef336a8143b869a8c23d39e | refs/heads/master | 2020-11-25T00:39:40.560389 | 2019-12-17T19:13:50 | 2019-12-17T19:13:50 | 228,412,528 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,110 | java | package com.codeoftheweb.salvo;
import com.codeoftheweb.salvo.Models.*;
import com.codeoftheweb.salvo.repository.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.authentication.configuration.GlobalAuthenticationConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.WebAttributes;
import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@SpringBootApplication
public class SalvoApplication {
public static void main(String[] args) {
SpringApplication.run(SalvoApplication.class, args);
/*System.out.printf("Hello World");*/
}
@Bean
public PasswordEncoder passwordEncoder() {
return PasswordEncoderFactories.createDelegatingPasswordEncoder();
}
/*Ahora podemos escribir
@Autowire
PasswordEncoder passwordEncoder;
en cualquier clase que necesite codificar contraseñas. */
@Bean
public CommandLineRunner initData (PlayerRepository player,
GameRepository game,
GamePlayerRepository gamePlayer,
ShipRepository ship,
SalvoRepository salvo,
ScoreRepository score){
return (args)->{
/*
Date date1 = new Date();
game.save(new Game(date1));
game.save(new Game(Date.from(date1.toInstant().plusSeconds(3600))));*/
Player player1 = new Player("lola@lola.com", passwordEncoder().encode("123"));
player.save(player1);
Player player2 = new Player("pablo@lola.com", passwordEncoder().encode("123"));
player.save(player2);
Date date1 = new Date();
Game game1 = new Game();
game1.setCreationDate(Date.from(date1.toInstant().plusSeconds(3600)));
game.save(game1);
Game game3 = new Game();
game3.setCreationDate(Date.from(game3.getCreationDate().toInstant().plusSeconds(3600)));
game.save(game3);
GamePlayer gamePlayer1 = new GamePlayer(player1,game1);
gamePlayer.save(gamePlayer1);
GamePlayer gamePlayer2 = new GamePlayer(player2,game1);
gamePlayer.save(gamePlayer2);
GamePlayer gamePlayer3 = new GamePlayer(player2,game3);
gamePlayer.save(gamePlayer3);
GamePlayer gamePlayer4 = new GamePlayer(player1,game3);
gamePlayer.save(gamePlayer4);
List<String> locations1 = new ArrayList<>();
locations1.add("H1");
locations1.add("H2");
locations1.add("H3");
Ship ship1 = new Ship("destroyer", locations1, gamePlayer1);
Ship ship2 = new Ship("submarine", Arrays.asList("E1","F1","G1"),gamePlayer2);
ship.save(ship1);
ship.save(ship2);
Salvo salvo1 = new Salvo(1,Arrays.asList("B5","F1","D5"),gamePlayer1);
salvo.save(salvo1);
Salvo salvo2 = new Salvo(1,Arrays.asList("E1","H1","D5"),gamePlayer2);
salvo.save(salvo2);
Score score1 = new Score(player1,game1,1.0D);
score.save(score1);
Score score2 = new Score(player2,game1,0.5D);
score.save(score2);
};
}
}
@Configuration
class WebSecurityConfiguration extends GlobalAuthenticationConfigurerAdapter {
@Autowired
PlayerRepository playerRepository;
@Override
/*define un método que devuelve una clase UserDetailsService con un método loadUserByUsername ( name ).
Se define que el método para obtener el jugador con el nombre, y si lo hay, y devuelven un
DetallesUsuario objeto con el nombre del jugador y contraseña.*/
public void init(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(inputName-> {
Player player = playerRepository.findByEmail(inputName);/*Obtiene el player y verifica q no sea null, crea una instancia y valida el pass recien crea un rol*/
if (player != null) {
return new User(player.getEmail(), player.getPassword(),
AuthorityUtils.createAuthorityList("USER"));//Crea el Rol, se puede agregar el ADMI
} else {
throw new UsernameNotFoundException("Unknown user: " + inputName);
}
});
}
} /* le decimos la nueva ruto es esa para el login, y le mandamos los parametros de name y password*/
/*M5 T1 P3*/
/*In this new class, the rules for what is public, how information is sent, and so on,
is specified in the definition of the configure() method.*/
@EnableWebSecurity
@Configuration
class WebSecurityConfig extends WebSecurityConfigurerAdapter {
/*In this class, you define one method, configure(). In that method, you write the rules describing
how the browser should get the user name and password to send the web application
the patterns of URLs that are and are not accessible to different types of users*/
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/web/**").permitAll()
.antMatchers("/api/game_view/**").hasAuthority("USER")
.antMatchers("/api/games").permitAll();
http.formLogin()
.usernameParameter("username")
.passwordParameter("password")
.loginPage("/api/login");
http.logout().logoutUrl("/api/logout");
// turn off checking for CSRF tokens
http.csrf().disable();
// if user is not authenticated, just send an authentication failure response
http.exceptionHandling().authenticationEntryPoint((req, res, exc) -> res.sendError(HttpServletResponse.SC_UNAUTHORIZED));
// if login is successful, just clear the flags asking for authentication
http.formLogin().successHandler((req, res, auth) -> clearAuthenticationAttributes(req));
// if login fails, just send an authentication failure response
http.formLogin().failureHandler((req, res, exc) -> res.sendError(HttpServletResponse.SC_UNAUTHORIZED));
// if logout is successful, just send a success response
http.logout().logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
}
private void clearAuthenticationAttributes(HttpServletRequest request) {
HttpSession session = request.getSession(false);
if (session != null) {
session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
}
}
} | [
"msv1991@hotmail.com"
] | msv1991@hotmail.com |
ba1bc6ed337cf5dabc3e23b0db95ea87becb4ff9 | 5a28de136ea44769519502303364c580f3452614 | /src/main/java/com/ghosthack/turismo/util/ClassForName.java | affabdf372d2626bccc5ee09ed8c2bc2ce711a18 | [
"Apache-2.0"
] | permissive | ghosthack/turismo | e349bffe5530580afa5a113c2f4e2bb28ecd6b53 | 47370effc2b59aa5d836b30f3788c21b31059bd6 | refs/heads/master | 2021-01-25T04:03:00.544843 | 2019-05-23T20:55:08 | 2019-05-23T20:55:08 | 2,303,057 | 13 | 7 | NOASSERTION | 2020-10-12T18:15:41 | 2011-08-31T17:48:59 | Java | UTF-8 | Java | false | false | 1,839 | java | /*
* Copyright (c) 2011 Adrian Fernandez
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.ghosthack.turismo.util;
public class ClassForName {
public static class ClassForNameException extends Exception {
public ClassForNameException(Exception e) {
super(e);
}
private static final long serialVersionUID = 1L;
}
public static <T> T createInstance(String implClassName,
Class<T> interfaceClass) throws ClassForNameException {
Class<? extends T> impl;
try {
impl = forName(implClassName, interfaceClass);
T instance = impl.newInstance();
return instance;
} catch (ClassNotFoundException e) {
throw new ClassForNameException(e);
} catch (InstantiationException e) {
throw new ClassForNameException(e);
} catch (IllegalAccessException e) {
throw new ClassForNameException(e);
}
}
public static <T> Class<? extends T> forName(String implClassName,
Class<T> interfaceClass) throws ClassNotFoundException {
Class<?> clazz = Class.forName(implClassName);
Class<? extends T> impl = clazz.asSubclass(interfaceClass);
return impl;
}
}
| [
"adrian@ghosthack.com"
] | adrian@ghosthack.com |
da85bf8535f02f6e2d294a95786f2ba70cf0951b | 224e750c45cf9383db0fb7332125bc7ac82739f1 | /PigFiler/PigUDF/src/minmaxUDF/SequenceToByteArray.java | 9eb9c3e8294016ba22ec9e02ed8e0f344644409a | [] | no_license | KimonoMyHouse/BachelorProjekt | d9c49b590a7fd1a734097a1b947fe2d46e300586 | 48b1448370d5a03415e5bef0d2db3c0b83fdc791 | refs/heads/master | 2021-01-22T04:48:20.746708 | 2015-06-06T17:40:14 | 2015-06-06T17:40:14 | 32,458,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,580 | java | package minmaxUDF;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Hashtable;
import java.util.Map;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.DataByteArray;
import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.logicalLayer.schema.Schema;
public class SequenceToByteArray extends EvalFunc<DataByteArray>{
Map<Character,Byte> Bases;
char gg;
@Override
public DataByteArray exec(Tuple input) throws IOException {
if (input == null || input.size() == 0)
return(null);
try{
String theString = (String) input.get(0);
String program = (String) input.get(1);
if(Bases == null){
initBases(program);
}
DataByteArray byteSequence = mapStringToByteArray(theString);
return byteSequence;
}catch(Exception e){
throw new IOException("LoadAsIntArray: Input string could not be transformed. Following error " + e + "and character " + gg);
}
}
private void initBases(String program){
Bases = new Hashtable<Character,Byte>();
if(program.toLowerCase().equals("rna")){
Bases.put('a', (byte) 0);
Bases.put('c', (byte) 1);
Bases.put('g', (byte) 2);
Bases.put('u', (byte) 3);
Bases.put('A', (byte) 0);
Bases.put('C', (byte) 1);
Bases.put('G', (byte) 2);
Bases.put('U', (byte) 3);
Bases.put('n', (byte) 4);
Bases.put('N', (byte) 4);
}
else{
if(program.toLowerCase().equals("dna")){
Bases.put('a', (byte) 0);
Bases.put('c', (byte) 1);
Bases.put('g', (byte) 2);
Bases.put('t', (byte) 3);
Bases.put('A', (byte) 0);
Bases.put('C', (byte) 1);
Bases.put('G', (byte) 2);
Bases.put('T', (byte) 3);
Bases.put('n', (byte) 4);
Bases.put('N', (byte) 4);
}
else{
throw new IllegalArgumentException("program must either be rna or dna, the input given was: " + program );
}
}
}
private DataByteArray mapStringToByteArray(String str){
try{
int strlen = str.length();
DataByteArray byteSeq = new DataByteArray();
byte[] temp = new byte[strlen];
for(int i = 0; i < strlen; i++){
gg = str.charAt(i);
temp[i] = Bases.get(gg);
if(temp[i] == 4){
return null;
}
}
byteSeq.append(temp);
return byteSeq;
}catch(NullPointerException e){
return null;
}
}
public Schema outputSchema(Schema input) {
try{
Schema bagSchema = new Schema();
bagSchema.add(new Schema.FieldSchema("byteSeq", DataType.BYTEARRAY));
return bagSchema;
}catch (Exception e){
return null;
}
}
}
| [
"mehdinadif@hotmail.com"
] | mehdinadif@hotmail.com |
be142c6403fe82f18046d87c4fcce5d498ace07d | e78904d8699b3fddb00f48c4a53208ad538c7f62 | /src/main/java/hellfirepvp/astralsorcery/common/item/gem/GemAttributeHelper.java | bf0cf039051cf7e535d85daeb3f3d18b76ab29d9 | [] | no_license | jblosser/AstralSorcery | c621469144bb8e74c45b157bed7d37e83975999c | bc299b56a6dce9a8dbfa29b54d785495ef06622d | refs/heads/master | 2023-01-23T07:59:54.683583 | 2020-12-06T09:23:41 | 2020-12-06T09:23:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,171 | java | /*******************************************************************************
* HellFirePvP / Astral Sorcery 2020
*
* All rights reserved.
* The source code is available on github: https://github.com/HellFirePvP/AstralSorcery
* For further details, see the License file there.
******************************************************************************/
package hellfirepvp.astralsorcery.common.item.gem;
import hellfirepvp.astralsorcery.common.data.config.registry.WeightedPerkAttributeRegistry;
import hellfirepvp.astralsorcery.common.data.config.registry.sets.PerkAttributeEntry;
import hellfirepvp.astralsorcery.common.perk.DynamicModifierHelper;
import hellfirepvp.astralsorcery.common.perk.modifier.DynamicAttributeModifier;
import hellfirepvp.astralsorcery.common.perk.type.ModifierType;
import hellfirepvp.astralsorcery.common.perk.type.PerkAttributeType;
import hellfirepvp.astralsorcery.common.util.MiscUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.UUID;
/**
* This class is part of the Astral Sorcery Mod
* The complete source code for this mod can be found on github.
* Class: GemAttributeHelper
* Created by HellFirePvP
* Date: 09.08.2019 / 07:41
*/
public class GemAttributeHelper {
private static final Random rand = new Random();
//TODO this. at some point.
private static float chance3Modifiers = 0.4F;
private static float chance4Modifiers = 0.15F;
private static boolean allowDuplicateTypes = false;
private static float incModifierLower = 0.05F;
private static float incModifierHigher = 0.08F;
private static boolean allowNegativeModifiers = false;
private static float chanceNegative = 0.25F;
private static float decModifierLower = -0.05F;
private static float decModifierHigher = -0.08F;
private static boolean allowMoreLessModifiers = false;
private static float chanceMultiplicative = 0.1F;
private static float moreModifierLower = 0.05F;
private static float moreModifierHigher = 0.08F;
private static float lessModifierLower = -0.05F;
private static float lessModifierHigher = -0.08F;
public static boolean rollGem(ItemStack gem) {
return rollGem(gem, rand);
}
public static boolean rollGem(ItemStack gem, Random random) {
if (!DynamicModifierHelper.getStaticModifiers(gem).isEmpty()) {
return false;
}
GemType gemType = ItemPerkGem.getGemType(gem);
if (gemType == null) {
return false;
}
int rolls = getPotentialMods(random, gemType.countModifier);
List<DynamicAttributeModifier> mods = new ArrayList<>();
List<PerkAttributeEntry> configuredModifiers = WeightedPerkAttributeRegistry.INSTANCE.getConfiguredValues();
for (int i = 0; i < rolls; i++) {
PerkAttributeEntry entry = null;
if (allowDuplicateTypes) {
entry = MiscUtils.getWeightedRandomEntry(configuredModifiers, random, PerkAttributeEntry::getWeight);
} else {
List<PerkAttributeEntry> keys = new ArrayList<>(configuredModifiers);
while (!keys.isEmpty() && entry == null) {
PerkAttributeEntry item = getWeightedResultAndRemove(keys, random);
if (item != null) {
boolean foundType = false;
for (DynamicAttributeModifier m : mods) {
if (m.getAttributeType().equals(item.getType())) {
foundType = true;
break;
}
}
if (foundType) {
continue;
}
entry = item;
}
}
}
if (entry == null) {
continue;
}
boolean isNegative = allowNegativeModifiers && random.nextFloat() < chanceNegative;
boolean isMultiplicative = allowMoreLessModifiers && random.nextFloat() < chanceMultiplicative;
float lower = isNegative ? (isMultiplicative ? lessModifierLower : decModifierLower) : (isMultiplicative ? moreModifierLower : incModifierLower);
float higher = isNegative ? (isMultiplicative ? lessModifierHigher : decModifierHigher) : (isMultiplicative ? moreModifierHigher : incModifierHigher);
float value;
if (lower > higher) {
value = lower;
} else {
float exp = 1F / gemType.amplifierModifier;
float multiplierScale = (float) Math.pow(random.nextFloat(), exp);
value = lower + (MathHelper.clamp(multiplierScale, 0F, 1F) * (higher - lower));
}
ModifierType mode = isMultiplicative ? ModifierType.STACKING_MULTIPLY : ModifierType.ADDED_MULTIPLY;
float rValue = isMultiplicative ? 1F + value : value;
PerkAttributeType type = entry.getType();
if (allowDuplicateTypes) {
DynamicAttributeModifier existing = MiscUtils.iterativeSearch(mods,
mod -> mod.getAttributeType().equals(type) && mod.getMode().equals(mode));
if (existing != null) {
mods.remove(existing);
float combinedValue;
if (isMultiplicative) {
combinedValue = (existing.getRawValue() - 1F) + (rValue - 1F);
} else {
combinedValue = existing.getRawValue() + rValue;
}
if (combinedValue != 0F) {
mods.add(new DynamicAttributeModifier(UUID.randomUUID(), type, mode, isMultiplicative ? combinedValue + 1 : combinedValue));
} //If == 0 -> don't re-add anything.
} else {
mods.add(new DynamicAttributeModifier(UUID.randomUUID(), type, mode, rValue));
}
} else {
mods.add(new DynamicAttributeModifier(UUID.randomUUID(), type, mode, rValue));
}
}
DynamicModifierHelper.addModifiers(gem, mods);
return true;
}
@Nullable
private static PerkAttributeEntry getWeightedResultAndRemove(List<PerkAttributeEntry> list, Random random) {
if (list.isEmpty()) {
return null;
}
PerkAttributeEntry result = MiscUtils.getWeightedRandomEntry(list, random, PerkAttributeEntry::getWeight);
if (result != null) {
list.remove(result);
}
return result;
}
private static int getPotentialMods(Random random, float countModifier) {
int mods = 2;
if (random.nextFloat() < (chance3Modifiers + countModifier)) {
mods++;
if (random.nextFloat() < (chance4Modifiers + countModifier)) {
mods++;
}
}
return mods;
}
}
| [
"7419378+HellFirePvP@users.noreply.github.com"
] | 7419378+HellFirePvP@users.noreply.github.com |
6ab53615e30a9a56bd02c449878fe06916f458ad | 37d8b470e71ea6edff6ed108ffd2b796322b7943 | /zcms/src/com/zving/framework/ResponseImpl.java | 1fc8861a54293065945f2dfc62228c196cac67b0 | [] | no_license | haifeiforwork/myfcms | ef9575be5fc7f476a048d819e7c0c0f2210be8ca | fefce24467df59d878ec5fef2750b91a29e74781 | refs/heads/master | 2020-05-15T11:37:50.734759 | 2014-06-28T08:31:55 | 2014-06-28T08:31:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,244 | java | package com.zving.framework;
import com.zving.framework.data.DataCollection;
public class ResponseImpl extends DataCollection
{
private static final long serialVersionUID = 1L;
public int Status = 1;
public String Message = "";
public String getMessage()
{
return this.Message;
}
public void setError(String message)
{
setMessage(message);
setStatus(0);
}
public void setMessage(String message)
{
this.Message = message;
put("_ZVING_MESSAGE", this.Message);
}
public int getStatus()
{
return this.Status;
}
public void setStatus(int status)
{
this.Status = status;
put("_ZVING_STATUS", this.Status);
}
public void setLogInfo(int status, String message)
{
this.Status = status;
put("_ZVING_STATUS", this.Status);
this.Message = message;
put("_ZVING_MESSAGE", this.Message);
}
public String toXML()
{
put("_ZVING_STATUS", this.Status);
return super.toXML();
}
}
/* Location: F:\JAVA\Tomcat5.5\webapps\zcms\WEB-INF\classes\
* Qualified Name: com.zving.framework.ResponseImpl
* JD-Core Version: 0.5.3
*/ | [
"yourfei@live.cn@c1c2bf6e-ae9d-b823-7fc2-ff1dc594729e"
] | yourfei@live.cn@c1c2bf6e-ae9d-b823-7fc2-ff1dc594729e |
bbcd31733323bbbfc61788692e36f2c203067b71 | 3f6060738337853e3dd7e5286dcd528cb6724bec | /Lab5_Tasks/src/tasks/Exercise1.java | 6919390ba3da262eea598a930617eb32a6196d05 | [] | no_license | notoroius2pac/javaPractice | e8b41d9dd4bd3a9be3dcfa9be7545d1798b1df44 | 58bcccc6a2aa8c03b1624de1905a7bbe66f81ff5 | refs/heads/main | 2023-03-27T22:08:58.485842 | 2021-03-26T09:17:00 | 2021-03-26T09:17:00 | 345,968,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package tasks;
import java.util.Scanner;
class InvalidAgeException extends Exception{
InvalidAgeException(String s){
super(s);
}
}
public class Exercise1 {
static void validate(int age)throws InvalidAgeException{
if(age<15)
throw new InvalidAgeException("not valid");
else
System.out.println("welcome to vote");
}
public static void main(String args[]){
int age;
Scanner sc= new Scanner(System.in);
System.out.println("Enter your age:- ");
age = sc.nextInt();
try{
validate(age);
}catch(Exception m){System.out.println("You are Underage");}
sc.close();
}
}
| [
"saurabh.sharma1998@gmail.com"
] | saurabh.sharma1998@gmail.com |
3399f8f85c1d0eac9ed485a36c8a9dc82aa00171 | c7829e0c745e3db6dab43fa0bb5fb91d5661fe4c | /src/test/java/org/pb/x12/SegmentTest.java | 0c7e533a95e1d91e76897b621234a930806e778a | [
"Apache-2.0"
] | permissive | marcino239/x12-parser | 3209abbeb748b749282cd0ab121fd800d6007145 | 3451cb1c41cb83eb79ac1e88e8c7a5a8d2f54ff2 | refs/heads/master | 2020-11-30T08:00:45.952699 | 2019-12-27T03:34:49 | 2019-12-27T03:34:49 | 230,352,589 | 0 | 0 | Apache-2.0 | 2019-12-27T01:38:18 | 2019-12-27T01:38:18 | null | UTF-8 | Java | false | false | 4,522 | java | package org.pb.x12;
import static org.junit.Assert.*;
import org.junit.Test;
public class SegmentTest {
@Test
public void testSegmentEmpty() {
Segment s = new Segment(new Context('~', '*', ':'));
assertNotNull(s);
}
@Test
public void testAddElementString() {
Segment s = new Segment(new Context('~', '*', ':'));
assertEquals(new Boolean(true), s.addElement("ISA"));
}
@Test
public void testAddElements() {
Segment s = new Segment(new Context('~', '*', ':'));
assertEquals(new Boolean(true), s.addElements("ISA", "ISA01", "ISA02"));
}
@Test
public void testAddCompositeElementStringArray() {
Segment s = new Segment(new Context('~', '*', ':'));
assertEquals(new Boolean(true), s.addCompositeElement("AB", "CD", "EF"));
}
@Test
public void testAddElementIntString() {
Segment s = new Segment(new Context('~', '*', ':'));
s.addElements("ISA", "ISA01", "ISA02");
assertEquals(new Boolean(true), s.addCompositeElement("ISA03_1", "ISA03_2", "ISA03_3"));
}
@Test
public void testAddCompositeElementIntStringArray() {
Segment s = new Segment(new Context('~', '*', ':'));
s.addElements("ISA", "ISA01", "ISA02", "ISA04");
s.addCompositeElement(3, "ISA03_1", "ISA03_2", "ISA03_3");
assertEquals("ISA03_1:ISA03_2:ISA03_3", s.getElement(3));
}
@Test
public void testGetContext() {
Segment s = new Segment(new Context('~', '*', ':'));
assertEquals("[~,*,:]", s.getContext().toString());
}
@Test
public void testGetElement() {
Segment s = new Segment(new Context('~', '*', ':'));
s.addElements("ISA", "ISA01", "ISA02", "ISA03");
assertEquals("ISA02", s.getElement(2));
}
@Test
public void testIterator() {
Segment s = new Segment(new Context('~', '*', ':'));
s.addElements("ISA", "ISA01", "ISA02", "ISA03");
assertNotNull(s.iterator());
}
@Test
public void testRemoveElement() {
Segment s = new Segment(new Context('~', '*', ':'));
s.addElements("ISA", "ISA01", "ISA02", "ISA03");
s.removeElement(2);
assertEquals("ISA*ISA01*ISA03", s.toString());
}
@Test
public void testRemoveElementTwo() {
Segment s = new Segment(new Context('~', '*', ':'));
s.addElements("ISA", "ISA01", "ISA02", "ISA03");
s.removeElement(3);
assertEquals("ISA*ISA01*ISA02", s.toString());
}
@Test
public void testSetContext() {
Segment s = new Segment(new Context('~', '*', ':'));
s.setContext(new Context('s', 'e', 'c'));
assertEquals("[s,e,c]", s.getContext().toString());
}
@Test
public void testSetElement() {
Segment s = new Segment(new Context('~', '*', ':'));
s.addElements("ISA", "ISA01", "ISA02", "ISA04", "ISA04");
s.setElement(3, "ISA03");
assertEquals("ISA03", s.getElement(3));
}
@Test
public void testSetCompositeElement() {
Segment s = new Segment(new Context('~', '*', ':'));
s.addElements("ISA", "ISA01", "ISA02", "ISA04", "ISA04");
s.setCompositeElement(3, "ISA03_1", "ISA03_2", "ISA03_3");
assertEquals("ISA03_1:ISA03_2:ISA03_3", s.getElement(3));
}
@Test
public void testSize() {
Segment s = new Segment(new Context('~', '*', ':'));
s.addElements("ISA", "ISA01", "ISA02", "ISA03", "ISA04");
assertEquals(new Integer(5), new Integer(s.size()));
}
@Test
public void testToString() {
Segment s = new Segment(new Context('~', '*', ':'));
s.addElements("ISA", "ISA01", "ISA02", "ISA03", "ISA04");
s.setCompositeElement(3, "ISA03_1", "ISA03_2", "ISA03_3");
assertEquals("ISA*ISA01*ISA02*ISA03_1:ISA03_2:ISA03_3*ISA04", s.toString());
}
@Test
public void testToStringRemoveTrailingEmptyElements() {
Segment s = new Segment(new Context('~', '*', ':'));
s.addElements("ISA", "ISA01", "ISA02", "ISA03", "ISA04", "", "", "");
assertEquals("ISA*ISA01*ISA02*ISA03*ISA04", s.toString(true));
}
@Test
public void testToStringRemoveTrailingNullElements() {
Segment s = new Segment(new Context('~', '*', ':'));
s.addElements("ISA", "ISA01", "ISA02", "ISA03", "ISA04", null, null, null);
assertEquals("ISA*ISA01*ISA02*ISA03*ISA04", s.toString(true));
}
@Test
public void testToXML() {
Segment s = new Segment(new Context('~', '*', ':'));
s.addElements("ISA", "01", "02", "03", "04");
s.setCompositeElement(3, "03_1", "03_2", "03_3");
assertEquals(
"<ISA><ISA01><![CDATA[01]]></ISA01><ISA02><![CDATA[02]]></ISA02><ISA03><![CDATA[03_1:03_2:03_3]]></ISA03><ISA04><![CDATA[04]]></ISA04></ISA>",
s.toXML());
}
}
| [
"p2bp2b@gmail.com"
] | p2bp2b@gmail.com |
6d1787b42e516640b8825d87db31cb83bf6151c6 | 5a85ba12cf585a682dd5b833a4c6f5237e756327 | /Java8Features/HibernateProject/src/com/HQL/Address.java | 9b9bf3dd6a2870541f008d027c1ea69209e55805 | [] | no_license | kiranbsjnvm/JavaWorkspace | 02bfe123446347802c77ff7cfefb9a4832202253 | 20db1312578d32456007df8b4e4b3d4c42c32870 | refs/heads/master | 2021-04-09T13:06:41.641574 | 2018-03-17T09:17:38 | 2018-03-17T09:17:38 | 125,605,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,138 | java | package com.HQL;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
@Entity
@Table(name = "ADDRESS")
public class Address {
@Id
@Column(name = "address_id")
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Column(name = "address_line1")
private String addressLine1;
@Column(name = "zipcode")
private String zipcode;
@Column(name = "city")
private String city;
@OneToOne(mappedBy="address")
private Employee employee;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getAddressLine1() {
return addressLine1;
}
public void setAddressLine1(String addressLine1) {
this.addressLine1 = addressLine1;
}
public String getZipcode() {
return zipcode;
}
public void setZipcode(String zipcode) {
this.zipcode = zipcode;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public Employee getEmployee() {
return employee;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
}
| [
"kiranbs.jnvm@gmail.com"
] | kiranbs.jnvm@gmail.com |
26783dd424c691632478100552cdcc4451818199 | 671f4333b13ae6f1db51759bc7e27042ceda9ef5 | /src/br/usjt/transportadora/controller/cmd/Command.java | eb5ba17da71b460aaede0cb65fd1ec33e5273bf0 | [] | no_license | davidxp12/TutorialFCFilter | 909a158664efb2be38e23b931dbb4d6ab509acc0 | b8e4b721fb8cc7b3590340a9127b9b5bf36784d9 | refs/heads/master | 2021-01-06T20:46:55.772378 | 2013-11-04T16:58:35 | 2013-11-04T16:58:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,429 | java | package br.usjt.transportadora.controller.cmd;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import br.usjt.transportadora.model.Veiculo;
public abstract class Command {
public abstract String executar(HttpServletRequest request,
HttpServletResponse response) throws Exception;
/**
* Metodo para selecionar veiculo na lista de pesquisa.
*
* @param request
* @param response
* @return
* @throws ServletException
* @throws IOException
*/
protected Veiculo selecionarVeiculo(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
List<Veiculo> retorno = null;
Veiculo veiculoSelecionado = null;
//
// Verificacao para garantir que usuario selecionou
// um item na lista de Veiculos
//
if (request.getParameter("item") != null) {
List<Veiculo> veiculos =
(List) request.getSession().getAttribute("listaVeiculos");
Long l = Long.parseLong(request.getParameter("item"));
for (Iterator<Veiculo> it = veiculos.iterator(); it.hasNext();) {
veiculoSelecionado = (Veiculo) it.next();
if (veiculoSelecionado.getId().equals(l)) {
break;
}
}
request.getSession().setAttribute("veiculoss", veiculoSelecionado);
}
return veiculoSelecionado;
}
}
| [
"davidxp12@gmail.com"
] | davidxp12@gmail.com |
8c9d3e87a2f7d5c20309dd8a9fae5d7d96ee05c7 | 160acbd20a67a747584d0e6d7b093ee0c38605fa | /src/test/java/com/miro/TestEntityFactory.java | fac4a0b0083d9599d182b67b36f85b89bbe3ca04 | [] | no_license | burdeynyy/widgets | c511099b7e4a97183782e3f1fc57257796419b53 | d3d7426866d5541518c7e5b0d74c723aa1ee9160 | refs/heads/master | 2023-07-19T23:51:58.045840 | 2020-04-24T08:18:37 | 2020-04-24T08:18:37 | 257,062,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,862 | java | package com.miro;
import com.miro.entity.Widget;
import com.miro.web.dto.WidgetDto;
import static com.miro.TestConstants.*;
import static com.miro.TestConstants.Y_CHANGED;
/**
* Factory to create test objects.
*/
public final class TestEntityFactory {
private TestEntityFactory() {
throw new UnsupportedOperationException();
}
public static Widget createDefaultWidget() {
Widget widget = new Widget();
widget.setX(X);
widget.setY(Y);
widget.setZ(Z_INDEX);
widget.setWidth(WIDTH);
widget.setHeight(HEIGHT);
return widget;
}
public static WidgetDto createDefaultWidgetDto() {
WidgetDto widget = new WidgetDto();
widget.setX(X);
widget.setY(Y);
widget.setZ(Z_INDEX);
widget.setWidth(WIDTH);
widget.setHeight(HEIGHT);
return widget;
}
public static Widget createChangedDefaultWidget(Integer id) {
Widget widget = new Widget();
widget.setId(id);
widget.setX(X_CHANGED);
widget.setY(Y_CHANGED);
widget.setZ(Z_INDEX_CHANGED);
widget.setWidth(WIDTH_CHANGED);
widget.setHeight(HEIGHT_CHANGED);
return widget;
}
public static Widget createWidgetWithZSpecified(Integer zIndex) {
Widget widget = new Widget();
widget.setX(X);
widget.setY(Y);
widget.setZ(zIndex);
widget.setWidth(WIDTH);
widget.setHeight(HEIGHT);
return widget;
}
public static Widget createDefaultWidgetWithIdAndZSpecified(Integer id, Integer zIndexChanged) {
Widget widget = new Widget();
widget.setId(id);
widget.setX(X);
widget.setY(Y);
widget.setZ(zIndexChanged);
widget.setWidth(WIDTH);
widget.setHeight(HEIGHT);
return widget;
}
}
| [
"kirill.burdeynyy@noveogroup.com"
] | kirill.burdeynyy@noveogroup.com |
02101a42c41b2311fe7d8da71c0b60ee32067457 | 139960e2d7d55e71c15e6a63acb6609e142a2ace | /mobile_app1/module666/src/main/java/module666packageJava0/Foo121.java | f187de859482444c1ea98987b2f2689ff61ed72c | [
"Apache-2.0"
] | permissive | uber-common/android-build-eval | 448bfe141b6911ad8a99268378c75217d431766f | 7723bfd0b9b1056892cef1fef02314b435b086f2 | refs/heads/master | 2023-02-18T22:25:15.121902 | 2023-02-06T19:35:34 | 2023-02-06T19:35:34 | 294,831,672 | 83 | 7 | Apache-2.0 | 2021-09-24T08:55:30 | 2020-09-11T23:27:37 | Java | UTF-8 | Java | false | false | 719 | java | package module666packageJava0;
import java.lang.Integer;
public class Foo121 {
Integer int0;
Integer int1;
public void foo0() {
new module666packageJava0.Foo120().foo13();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
public void foo6() {
foo5();
}
public void foo7() {
foo6();
}
public void foo8() {
foo7();
}
public void foo9() {
foo8();
}
public void foo10() {
foo9();
}
public void foo11() {
foo10();
}
public void foo12() {
foo11();
}
public void foo13() {
foo12();
}
}
| [
"oliviern@uber.com"
] | oliviern@uber.com |
af92c2985f114f85101edadc91664263cb071c03 | 4de7eaad20c8447f0e8b52f7ec148d015f2c9bcb | /src/com/leweiyou/service/valid/ValidAspect.java | 5af445d568cb69b2ce215cb758dd167b07f2ada7 | [] | no_license | zhangweican/x-download-jar | 78b9a778ab361a3c5a4eb0c0454ef3c53b3b2e63 | 0ccdd73db235168819fe31e5a770d7d40cce0202 | refs/heads/master | 2021-01-01T03:46:41.676324 | 2016-05-12T07:48:58 | 2016-05-12T07:48:58 | 58,619,215 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,965 | java | package com.leweiyou.service.valid;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.apache.commons.lang.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BeanPropertyBindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.Validator;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONArray;
import com.leweiyou.service.entity.ValidErrorEntity;
import com.leweiyou.service.util.CXT;
/**
* 定义AOP支持前台页面的校验,通过反射加载对应的校验方法。
* @author Zhangweican
*
*/
@Controller
@Aspect
public class ValidAspect {
private static final String ValidPrix = "Valid";
@Autowired
private Validator validator;
@Around("@annotation(com.leweiyou.service.valid.Valid)")
public Object doValid(ProceedingJoinPoint pjp) throws Throwable{
MethodSignature signature = (MethodSignature) pjp.getSignature();
Method method = signature.getMethod();
Object[] args = pjp.getArgs();
Valid valid = method.getAnnotation(Valid.class);
boolean isJs = method.isAnnotationPresent(ResponseBody.class);
String validFunction = valid.validFunction();
String errorView = valid.errorView();
int parmPosion = valid.parameterPosition();
if(StringUtils.isEmpty(validFunction)){
validFunction = ValidPrix + method.getName();
}
if(StringUtils.isEmpty(errorView)){
errorView = method.getAnnotation(RequestMapping.class).value()[0];
}
//调用spring的Validation,进行字段的校验
Object target = pjp.getTarget();
Object obj = args[parmPosion > args.length - 1 ? 0 : parmPosion];
BeanPropertyBindingResult br = new BeanPropertyBindingResult(obj,obj.getClass().getName());
validator.validate(obj, br);
ValidErrorEntity map = CXT.getValidErrorMap();
if(br.hasErrors()){
for(FieldError error : br.getFieldErrors()){
map.addValidError(error.getField(), error.getDefaultMessage());
}
return setReturn(method,isJs,map,errorView);
}
//扩展校验,反射进校验方法,继续校验
for(Method m : target.getClass().getDeclaredMethods()){
if(validFunction.equals(m.getName())){
Object[] targetArgs = (args != null && args.length > 0) ? args : null;
if(args != null && args.length > m.getParameterTypes().length){
targetArgs = Arrays.copyOfRange(args, 0, m.getParameterTypes().length);
}
m.setAccessible(true);
m.invoke(target, targetArgs);
}
}
if(map.isHaveError()){
return setReturn(method,isJs,map,errorView);
}
return pjp.proceed();
}
/**
* 根据结果做出不同的返回
* @param method
* @param isJs
* @param map
* @param errorView
* @return
*/
private Object setReturn(Method method,boolean isJs,ValidErrorEntity map,String errorView){
Class returnClass = method.getReturnType();
if(isJs || returnClass == null){
boolean isError = false;
String json = "";
if(map.isHaveError()){
isError = true;
}
json += "," + JSONArray.toJSONString(map.all());
return "{isError:" + isError + json + "}";
}else{
Object o = new Object();
try {
o = returnClass.newInstance();
} catch (Exception e) {
e.printStackTrace();
}
if(o instanceof String){
return new String(errorView);
}else if(o instanceof ModelAndView){
return new ModelAndView(errorView);
}else{
return new String("/common/error");
}
}
}
}
| [
"515632400@qq.com"
] | 515632400@qq.com |
ab7ff86189afe14aa21245f90d0ea98eeea9be85 | a1c1b6c936a6beac421b08fd5e7e2e5dfbaff441 | /java/aula5/aula4/src/test/java/br/com/crescer/aula4/tema/LocacaoDaoTest.java | 9ca617a7ce1245de138c3d319a9ca83b448911c8 | [] | no_license | cwi-crescer-2017-1/tais.silva | 5ca6cc537e79e563ecf9fa70294e34366453557b | 8b0486bb27fc15dacf9893d7c9091656e15c38ec | refs/heads/master | 2021-01-19T08:05:51.068238 | 2017-07-06T00:37:43 | 2017-07-06T00:37:43 | 87,600,099 | 6 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,351 | java | package br.com.crescer.aula4.tema;
import java.util.List;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author carloshenrique
*/
public class LocacaoDaoTest extends AbstractDaoTest {
private final LocacaoDao locacaoDao;
public LocacaoDaoTest() {
this.locacaoDao = new LocacaoDaoImpl(getEntityManager());
}
/**
* Test of findAll method, of class LocacaoDao.
*/
@Test
public void testFindAll() {
final Locacao genero = this.createLocacao();
final List<Locacao> generos = locacaoDao.findAll();
assertTrue(generos.stream()
.map(Locacao::getIdCliente)
.anyMatch(genero.getIdCliente()::equals));
}
/**
* Test of loadById method, of class LocacaoDao.
*/
@Test
public void testLoadById() {
final Locacao locacao = this.createLocacao();
assertEquals(locacao.getIdCliente(), locacaoDao.loadById(locacao.getId()).getIdCliente());
}
/**
* Test of save method, of class LocacaoDao.
*/
@Test
public void testSave() {
final Locacao locacao = new Locacao();
locacao.setIdCliente(createCliente());
locacaoDao.save(locacao);
assertEquals(locacao.getIdCliente(), getEntityManager().find(Locacao.class, locacao.getId()).getIdCliente());
}
/**
* Test of remove method, of class LocacaoDao.
*/
@Test
public void testRemove() {
final Locacao locacao = createLocacao();
locacaoDao.remove(locacao);
assertNull(getEntityManager().find(Locacao.class, locacao.getId()));
}
private Locacao createLocacao() {
final Locacao locacao = new Locacao();
locacao.setIdCliente(createCliente());
getEntityManager().getTransaction().begin();
getEntityManager().persist(locacao);
getEntityManager().getTransaction().commit();
return locacao;
}
private Cliente createCliente() {
final Cliente cliente = new Cliente();
cliente.setNome("Carlos Henrique Nonnemacher");
cliente.setCpf("01041158076");
cliente.setCelular("9999999999");
getEntityManager().getTransaction().begin();
getEntityManager().persist(cliente);
getEntityManager().getTransaction().commit();
return cliente;
}
}
| [
"tais.silva@cwi.com.br"
] | tais.silva@cwi.com.br |
7c60b238ad79f79da45c65770d43ee3b3d1affca | ee5e9e2bacbbc461911146c64dc992d49d892387 | /src/org/kabuki/queues/mpsc/MPSC_SlotType.java | 708130da37ce1d64043d7eb60a10622a87fdbdcb | [
"Apache-2.0"
] | permissive | anton-loskutov/kabuki | 107821528a1e4a0c1a5b993e10579c7017e96602 | a8a8b68d03ac68076f8f7b61952bc7fdbac51e9c | refs/heads/master | 2016-08-12T04:30:37.270471 | 2015-09-24T13:48:07 | 2015-09-24T13:48:07 | 36,734,123 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,277 | java | package org.kabuki.queues.mpsc;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.function.Function;
import static java.util.stream.Collectors.reducing;
public class MPSC_SlotType {
public static final MPSC_SlotType ZERO = new MPSC_SlotType(0,0);
public final int ps;
public final int os;
public MPSC_SlotType(int ps, int os) {
if (ps < 0 || os < 0) {
throw new IllegalArgumentException();
}
this.ps = ps;
this.os = os;
}
public boolean matches(MPSC_SlotType type) {
return ps <= type.ps && os <= type.os;
}
public static MPSC_SlotType get(Method m) {
Function<Boolean, Integer> counter = (primitive) -> Arrays.asList(m.getParameterTypes()).stream().collect(reducing(0, (a) -> primitive ^ a.isPrimitive() ? 0 : 1, Integer::sum));
return new MPSC_SlotType(counter.apply(true),counter.apply(false));
}
public static MPSC_SlotType get(Class<?> c) {
return Arrays.asList(c.getMethods()).stream().collect(reducing(ZERO, MPSC_SlotType::get, MPSC_SlotType::max));
}
public static MPSC_SlotType max(MPSC_SlotType t1, MPSC_SlotType t2) {
return new MPSC_SlotType(Math.max(t1.ps, t2.ps), Math.max(t1.os, t2.os));
}
}
| [
"alo@expcapital.com"
] | alo@expcapital.com |
103264408f9e49e83d7e84ec86dc54d43c5ff9d6 | 2f9be9f8e68212b77ad542699587edab65c8a197 | /src/Dabar/Login.java | 79c4035d8007cc20046500591b434b8f9c06e051 | [] | no_license | MuhammadZaqkiJalal/UTS-BP-JAVA-NPM-18100090 | ed03900970f2b465a0f9a5036406d50dca301e01 | 2c5188e9c670329b30d76c402b321f8f80005dc9 | refs/heads/master | 2023-05-13T11:59:37.860408 | 2021-06-05T13:51:01 | 2021-06-05T13:51:01 | 373,899,364 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,892 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Dabar;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
/**
*
* @author User
*/
public class Login extends javax.swing.JFrame {
/**
* Creates new form Login
*/
public Login() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jPasswordField1 = new javax.swing.JPasswordField();
jLabel4 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
formMouseClicked(evt);
}
});
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setFont(new java.awt.Font("Cooper Black", 1, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 0));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("Silahkan Masukkan Username dan Password");
getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 11, 770, -1));
jLabel9.setFont(new java.awt.Font("Comic Sans MS", 1, 12)); // NOI18N
jLabel9.setForeground(new java.awt.Color(255, 255, 255));
jLabel9.setText("BY MUHAMMAD ZAQKI JALAL");
getContentPane().add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(570, 340, -1, -1));
jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("Username");
getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 70, 90, 30));
jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setText("Password");
getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 130, 80, 30));
getContentPane().add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 70, 210, 30));
jButton1.setBackground(new java.awt.Color(255, 204, 0));
jButton1.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jButton1.setText("LOGIN");
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
}
});
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 200, -1, 40));
getContentPane().add(jPasswordField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 130, 210, 30));
jLabel4.setIcon(new javax.swing.ImageIcon("C:\\Users\\W10\\Pictures\\Bismilah.jpg")); // NOI18N
getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, 360));
pack();
}// </editor-fold>//GEN-END:initComponents
private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked
// TODO add your handling code here:
try {
String password;
password = new String (jPasswordField1.getPassword());
Connection conn =(Connection)Dabar.koneksi.koneksiDB();
Statement st = conn.createStatement();
String sql = "SELECT * from admin where username ='"+ jTextField1.getText()+"'and password = ('"+ password +"')";
ResultSet set = st.executeQuery(sql);
int baris = 0;
while (set.next()){
baris = set.getRow();
}
if (baris==1){
Admin hal = new Admin();
hal.setVisible(true);
dispose();
}else {
JOptionPane.showMessageDialog(null, "TERJADI KESALAHAN");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_formMouseClicked
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
// TODO add your handling code here:
Admin hal = new Admin();
hal.setVisible(true);
dispose();
}//GEN-LAST:event_jButton1MouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Login().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel9;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JTextField jTextField1;
// End of variables declaration//GEN-END:variables
}
| [
"W10@DESKTOP-BJO34AE"
] | W10@DESKTOP-BJO34AE |
1fcdd8db7b4faf251cbd75b9f5be325a36a22e64 | 0269093dc8054dec2fd365ec99849c7015c8530b | /app/src/androidTest/java/Objetos/Tweet.java | 001f222dfc7b864a619b9ce79e8ace787969fe38 | [] | no_license | DoddyCastillo/AMST-TA4 | 049a5dacc5a15a6e4a42473ff86ebdc27a5de3d5 | 55871a3a8b3c85b0cc416636452b5d1c067a9a3a | refs/heads/master | 2020-09-11T09:29:13.408141 | 2019-11-16T00:11:15 | 2019-11-16T00:11:15 | 222,021,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package Objetos;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class Tweet {
private String autor;
private String tweet;
private String fecha;
Tweet(String autor, String tweet) {
this.autor = autor;
this.tweet = tweet;
}
public void publicarTweet(){
String fecha_actual = new SimpleDateFormat("dd-MM- yyyy", Locale.getDefault()).format(new Date());
this.fecha = fecha_actual;
}
} | [
"djcastil@espol.edu.ec"
] | djcastil@espol.edu.ec |
8d7263c1505a8cd2bca908b18f47a8bb7cc49598 | feed898abc082458f0c2e1c2f3b266923c803347 | /chapter_002/src/main/java/ru/job4j/chess/Logic.java | 5231e6632e5aac79a288f38d2fd734865d1704b8 | [
"Apache-2.0"
] | permissive | Zhekbland/job4j | c256466c72b417e437c6b304750438d4c5737daf | 118ff2565f1b44498faa47e5143606607700d5c6 | refs/heads/master | 2022-11-28T08:51:45.943457 | 2020-04-19T09:14:45 | 2020-04-19T09:14:45 | 137,885,095 | 1 | 0 | Apache-2.0 | 2022-11-16T12:23:57 | 2018-06-19T11:55:31 | Java | UTF-8 | Java | false | false | 1,530 | java | package ru.job4j.chess;
import ru.job4j.chess.figures.Cell;
/**
* //TODO add comments.
*
* @author Petr Arsentev (parsentev@yandex.ru)
* @version $Id$
* @since 0.1
*/
public class Logic {
private Figure[] figures = new Figure[32];
private int index = 0;
public void add(Figure figure) {
this.figures[this.index++] = figure;
}
public boolean move(Cell source, Cell dest) throws ImpossibleMoveException,
OccupiedWayException, FigureNotFoundException {
boolean rst = false;
int index = this.findBy(source);
if ((index == -1)) {
throw new FigureNotFoundException("Figure not found");
}
Cell[] steps = this.figures[index].way(source, dest);
for (Cell cell : steps) {
if (this.findBy(cell) != -1) {
throw new OccupiedWayException("The cell is busy!");
}
}
this.figures[index] = this.figures[index].copy(dest);
rst = true;
return rst;
}
public void clean() {
for (int position = 0; position != this.figures.length; position++) {
this.figures[position] = null;
}
this.index = 0;
}
private int findBy(Cell cell) {
int rst = -1;
for (int index = 0; index != this.figures.length; index++) {
if (this.figures[index] != null && this.figures[index].position().equals(cell)) {
rst = index;
break;
}
}
return rst;
}
} | [
"eshpytev@mail.ru"
] | eshpytev@mail.ru |
bbdc8a1ea2df70c5f561f328e132ef47436441f2 | 96987a173604edf32cb4b98072384bfa3668b9c7 | /src/test/java/com/driver/Driver.java | 199d636ee4f67765e2225e33d2c2261cd691b7e0 | [] | no_license | suhasreddy25/thriveWebPOC | 324a9202fea8d389f6ed5482d3308a7279aad4b1 | 32f983e3d0f4cc09c13bcc8380b111f074490603 | refs/heads/main | 2023-07-20T07:10:27.603532 | 2021-09-01T12:43:55 | 2021-09-01T12:43:55 | 402,056,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 879 | java | package com.driver;
import java.util.Properties;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import com.utilities.ReadPropertiesFile;
public class Driver {
public static WebDriver driver = null;
public static final String filename = null;
public ReadPropertiesFile readfile = new ReadPropertiesFile();
public Properties prop = readfile.readPropertiesFile(filename);
public static void init(String browser) {
if (browser.equalsIgnoreCase("chrome")) {
System.setProperty("webdriver.chrome.driver",
System.getProperty("user.dir") + "\\drivers\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
} else if (browser.equalsIgnoreCase("firefox")) {
driver = new FirefoxDriver();
driver.manage().window().maximize();
}
}
}
| [
"suhasr.m25@gmail.com"
] | suhasr.m25@gmail.com |
7e718fd304bff70d408dbb9745c11547f1fff125 | 8add6d03d5f0186e52e0ff14943f36cced55ddfb | /chapter_001/src/main/java/ru/job4j/condition/Max.java | e788c84a30766a1ee0c08f8b29c64f6fabaa9002 | [] | no_license | vera-khamanova/job4j | 1f6062d7064de1eb9b2924d2aedd4e5a736aac8b | fa742ce1aec46873835341cd7eeaaf820b24958c | refs/heads/master | 2021-07-22T03:11:05.266641 | 2020-04-14T12:48:43 | 2020-04-14T12:48:43 | 222,785,684 | 0 | 0 | null | 2020-10-13T17:40:12 | 2019-11-19T20:41:03 | Java | UTF-8 | Java | false | false | 218 | java | package ru.job4j.condition;
public class Max {
public static int max(int first, int second) {
boolean condition = first > second;
int result = condition?first:second;
return result;
}
} | [
"mona81lj@gmail.com"
] | mona81lj@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.