blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f61ac8df2d145ddcb015c64400f09f89ef21d95a | c634236c7fb442dde4913c665f89a46a5703583b | /Eem/libs/src/main/java/com/souja/lib/utils/pageTransformer/ZoomInTransform.java | e9f1e4d01b8fccbe687df29e62b010160198e2cb | [] | no_license | souja/EEM | 117850a4089e1bf95ee7a6d7e813bc0775503bf4 | 5f875eb0045260cd7bc0366c2ff0cb72e6a89fe7 | refs/heads/master | 2020-05-03T02:02:01.711413 | 2019-09-24T02:27:17 | 2019-09-24T02:27:17 | 178,355,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,072 | java | package com.souja.lib.utils.pageTransformer;
import android.support.v4.view.ViewPager;
import android.view.View;
import org.xutils.common.util.LogUtil;
public class ZoomInTransform implements ViewPager.PageTransformer {
@Override
public void transformPage(View page, float position) {
int width = page.getWidth();
int height = page.getHeight();
//這裏只對右邊的view做了操作
if (position > 0 && position <= 1) {//right scorlling
//position是1.0->0,但是沒有等於0
LogUtil.e("right----position====" + position);
//設置該view的X軸不動
page.setTranslationX(-width * position);
//設置縮放中心點在該view的正中心
page.setPivotX(width / 2);
page.setPivotY(height / 2);
//設置縮放比例(0.0,1.0]
page.setScaleX(1 - position);
page.setScaleY(1 - position);
} else if (position >= -1 && position < 0) {//left scrolling
} else {//center
}
}
} | [
"[email protected]"
] | |
39d8bd278377d02365a2100900454f84fa2889e8 | 74a56b8e657762f8b03b9b7bcadf74caed868e4b | /src/adrianpaz2.java | 939be9ee524e0f9c7b8f7bb05d4810e4016159fb | [
"Apache-2.0"
] | permissive | mrtnmmn/JavaPracticeHacktoberfest | 6b3d3e3053936b64addbd17a01a83be96916c2ec | 9c5d93a22391696a59e682bc4d60f43a484b9b05 | refs/heads/master | 2023-08-23T14:01:44.428372 | 2021-10-05T12:16:31 | 2021-10-05T12:16:31 | 413,803,069 | 0 | 0 | Apache-2.0 | 2021-10-05T12:11:48 | 2021-10-05T12:11:47 | null | UTF-8 | Java | false | false | 206 | java | public class adrianpaz2 {
public static void main(String[] args) {
int num1 = 1;
int num2 = 5;
int suma;
suma = num1 + num2;
System.out.println("La suma es: "+suma);
}
}
| [
"[email protected]"
] | |
96bb6cafcfb0c5c12dd68876716c60f0c83b76b6 | f2c03c784f9999e0e9219c84fda342a202678b96 | /5book/src/com/it/dao/UserDao.java | 99195aa0a8e77e346f9049a3d0d67f119a19d486 | [] | no_license | zzj314/JavaWeb | c284eb5ebb14bedb8ea91d6bfee2a193d967f7c3 | bef0018485a5fbea1af9e3730bdd366dfadf3795 | refs/heads/master | 2023-01-08T02:34:38.790273 | 2020-11-04T13:51:34 | 2020-11-04T13:51:34 | 310,017,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | package com.it.dao;
import com.it.pojo.User;
public interface UserDao {
public User queryUserByUsername(String username);
public User queryUserByUsernameAndPassword(String username,String password);
public int saveUser(User user);
}
| [
"[email protected]"
] | |
f6814626ebd1067842e4922bfd34618db1fd3c8e | da43836d728650803c8ae5ce776fbcc8c1513f07 | /ace-gate/ace-gateway-v2/src/main/java/com/bitcola/exchange/security/gate/v2/feign/IUserService.java | 9484fe8e418d20f54b31a50b0eaee493039b32a7 | [
"Apache-2.0"
] | permissive | wxpkerpk/exchange-base-examlple | 36253f96a1e478365feabad183636675ee1e4f4c | acb61eb9d8316c5cf290481362560203eaf682a7 | refs/heads/master | 2022-06-28T12:19:17.730542 | 2019-07-11T16:38:51 | 2019-07-11T16:38:51 | 196,430,856 | 1 | 4 | Apache-2.0 | 2022-06-21T01:26:27 | 2019-07-11T16:34:47 | Java | UTF-8 | Java | false | false | 1,206 | java | package com.bitcola.exchange.security.gate.v2.feign;
import com.alicp.jetcache.anno.CacheType;
import com.alicp.jetcache.anno.Cached;
import com.bitcola.exchange.security.gate.v2.fallback.UserServiceFallback;
import com.bitcola.exchange.security.api.vo.authority.PermissionInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.List;
/**
* ${DESCRIPTION}
*
* @author wx
* @create 2017-06-21 8:11
*/
@FeignClient(value = "ace-admin",fallback = UserServiceFallback.class)
public interface IUserService {
@RequestMapping(value="/api/user/un/{username}/permissions",method = RequestMethod.GET)
@Cached(name="getPermissionByUsername-", key="#username", expire = 120,cacheType = CacheType.LOCAL)
List<PermissionInfo> getPermissionByUsername(@PathVariable("username") String username);
@Cached(name="getAllPermissionInfo", expire = 60,cacheType = CacheType.LOCAL)
@RequestMapping(value="/api/permissions",method = RequestMethod.GET)
List<PermissionInfo> getAllPermissionInfo();
}
| [
"[email protected]"
] | |
d01c015330a2519340f971c02c9a5b0abd9bb6fc | dbb5a16966a1d59da4f3b1f13dc5755e1042c87e | /JAVA/Collections/Arraylist/Q8.java | 255ddb11464f7695526049107d56bfd74f3c5b23 | [] | no_license | shivaniadke/Edac-may-2021 | 7f671f7652dac005cd1b3851f37ff0014b43ca4f | 381fbffa2eefc9ce7c41a9a0ca62c308db860ea4 | refs/heads/main | 2023-06-16T21:06:30.803005 | 2021-07-11T14:06:36 | 2021-07-11T14:06:36 | 365,246,867 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 505 | java |
//8 Write a Java program to sort an element in an array list.
import java.util.*;
public class Q8 {
public static void main(String[] args) {
ArrayList <Integer> list = new ArrayList<Integer>();
list.add(2);
list.add(1);
list.add(5);
list.add(3);
list.add(4);
System.out.println(list);
Collections.sort(list);
System.out.println(list); //12345
//for descending
Collections.sort(list, Collections.reverseOrder());
System.out.println(list); //54321
}
}
| [
"[email protected]"
] | |
68f4121e8f222594dba4b403beaa7bf0b45e0e2f | 5148f53150bf20fc0eb7f527f5a8e2d183d4c4dc | /src/main/java/com/demo/code/FollowerController.java | c4c4f70e322b5fbbb52fdf5a4f1cfb584d5f71be | [] | no_license | reenaramanadham/followerApp | 37452672cf3899c2aa3465f77b614ff1104e8b7e | 424c990b51aee110d4197f5013b479e46ab124b0 | refs/heads/master | 2021-07-12T13:01:35.770711 | 2017-10-03T04:06:45 | 2017-10-03T04:06:45 | 104,974,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | package com.code.demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.websocket.server.PathParam;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@RestController
public class FollowerController {
@Autowired
private FollowerService followerService;
@RequestMapping(value="/follower/{userId}", method=RequestMethod.GET)
@Produces(MediaType.APPLICATION_JSON)
public Followers userFollower(final @PathVariable("userId") String userId)
{
return followerService.fetchFollowers(userId) ;
}
}
| [
"[email protected]"
] | |
8a316838aa3822fcbb88170f4eb16893676ba934 | ea0d0be52c92131ea5cbe643bdf3647b9e82bc12 | /src/main/java/coding/interview/Factorial.java | eccf41ae92034293a0d45a55b482b8b98a8a70c0 | [] | no_license | tarikadeepak/JavaInterviewPrep | 69249da0a28899402c862117fbf73d6d5dd7f251 | 55110c523d46cc9aa64244182efd79d96f6aad0a | refs/heads/master | 2022-12-11T08:04:36.109531 | 2020-09-17T00:11:36 | 2020-09-17T00:11:36 | 295,919,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 154 | java | package coding.interview;
public class Factorial {
int calculateFactorial(int n) {
if(n == 1)
return n;
return n * calculateFactorial(n-1);
}
}
| [
"[email protected]"
] | |
31c15e56b1bfe2037c2a400f863e842d74bce5ac | 482de50bc1949675afbce93b7064ebe9b283728d | /xc-framework-model/src/main/java/com/xuecheng/framework/domain/course/TeachplanMediaPub.java | 0d7e7d926892119cc5c6d94213a41521e6f2bd6f | [] | no_license | luoyecheng/XcLearining | 6c3950cd593eac75f0a6093385d03a0ece2439c7 | b21c68105c347ec2a79dc80a38fbf089dd180e08 | refs/heads/master | 2023-04-03T19:45:52.239356 | 2021-03-02T14:00:15 | 2021-03-02T14:00:15 | 343,771,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 933 | java | package com.xuecheng.framework.domain.course;
import lombok.Data;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Data
@ToString
@Entity
@Table(name="teachplan_media_pub")
@GenericGenerator(name = "jpa-assigned", strategy = "assigned")
public class TeachplanMediaPub implements Serializable {
private static final long serialVersionUID = -916357110051689485L;
@Id
@GeneratedValue(generator = "jpa-assigned")
@Column(name="teachplan_id")
private String teachplanId;
@Column(name="media_id")
private String mediaId;
@Column(name="media_fileoriginalname")
private String mediaFileOriginalName;
@Column(name="media_url")
private String mediaUrl;
@Column(name="courseid")
private String courseId;
@Column(name="timestamp")
private Date timestamp;//时间戳
}
| [
"[email protected]"
] | |
318f2da0c55731c62e0e0ffcc78e66d0e3576561 | 7d28a9cd32fa011e8b7b776f99d8cbf41b6da954 | /Java_2/Lesson2/src/MyArrayDataException.java | 3a6474a3e3729b494945bcb714a79f346cdb2db8 | [] | no_license | sablist99/GeekBrains | 009f0845b1e762ecfaecfcf5745f9ca09bd2fbf5 | 0ef179a8118d67d5d12a0dfc7727d7f6d18fd942 | refs/heads/master | 2022-11-17T17:58:53.320129 | 2020-07-17T15:38:59 | 2020-07-17T15:38:59 | 272,999,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 216 | java | public class MyArrayDataException extends NumberFormatException {
private String mes;
public String getMes() {
return mes;
}
public MyArrayDataException(String s) {
mes = s;
}
}
| [
"[email protected]"
] | |
9971cf58e830f858dfb20095be2777f6838a86ad | 2d666e65b8fce172523b4814d34bb88fdccf4a92 | /Basics/SortingDemo.java | b74d9890cb48579e825cb1574dadde5016849ab4 | [] | no_license | agnelrayan/java | b95c89a31f075edfa8c4b4b3ff3c1734da89119a | 3f6ba7b48320957e0f930e37f910cd041e4121ae | refs/heads/master | 2021-01-01T16:46:57.881527 | 2018-06-08T11:46:20 | 2018-06-08T11:46:20 | 97,918,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,120 | java | package com.expertzlab.Basics;
import java.util.Scanner;
/**
* Created by agnel on 3/5/18.
*/
public class SortingDemo {
public static void main(String[] args)
{
Scanner obj = new Scanner(System.in);
System.out.println("Enter the number to sort");
int input = obj.nextInt();
int a[] = new int[input];
System.out.println("Enter all the elements");
for(int i = 0;i<a.length;i++)
{
a[i] = obj.nextInt();
}
System.out.println("Print the given elements");
for(int i = 0;i<a.length;i++){
System.out.println(" " + a[i]);
}
sort(a);
System.out.println("After Sortting..");
for(int i=0;i<a.length;i++){
System.out.println(" "+a[i]);
}
}
public static void sort(int a[]){
for(int i=0;i<a.length-1;i++){
for(int j=0;j<a.length-1;j++){
if(a[j]>a[j+1]){
int temp = a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
}
}
| [
"[email protected]"
] | |
ab21e5e970727cddad3771942edb33a3c084a447 | 7197f6e4de2d5bd7a7df303a61460808f014616e | /src/main/java/structural/decorate/Shape.java | 48fd315ae7c87e9249b7cb802180cd55d77ce0a4 | [
"Apache-2.0"
] | permissive | githubmnume/Design-Pattern-In-Java | c69029ec16f2c66a3b001dcc7c85c05f9399dbcb | c9b3978d410bb2667d841a04f2af7750b6800d2e | refs/heads/master | 2020-04-08T18:48:16.825041 | 2018-11-29T07:43:27 | 2018-11-29T07:43:27 | 159,625,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 71 | java | package structural.decorate;
public interface Shape {
void draw();
}
| [
"[email protected]"
] | |
68577c4d6732cfc51b1b7d799b6babd1d5656dad | e969c8380add19d1019ae96ced3520b5b279a546 | /src/main/java/com/brain/crud/socialclub/model/Friend.java | 1f4ddb7d6ee58b1870ccce845a6c3eb6cab024d2 | [] | no_license | Wolfpredator/socialAvtoClub | 3b5a227d8ea92f8e368da9d7878c02d5396ce556 | f0c32a78ecf126e80381688b54d4871bd8c79e36 | refs/heads/master | 2021-05-11T22:55:00.720863 | 2018-01-15T06:21:24 | 2018-01-15T06:21:24 | 117,504,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 884 | java | package com.brain.crud.socialclub.model;
public class Friend {
private Long idFriend;
private Enum status;
public enum FriendStatus {
Subscribe,
SubscribeOnYou,
Friend
}
public Friend(Long idFriend, int idStatus) {
this.idFriend = idFriend;
parseStatus(idStatus);
}
public Long getIdFriend() {
return idFriend;
}
public Enum getStatus() {
return status;
}
private void parseStatus(int idForParse) {
switch (idForParse) {
case 0:
status = FriendStatus.Subscribe;
break;
case 1:
status = FriendStatus.SubscribeOnYou;
break;
case 2:
status = FriendStatus.Friend;
break;
default:
status = null;
}
}
}
| [
"[email protected]"
] | |
d087ade2f3dcecacb182152821401f6ec02e4fbe | 024bc11966dfbd8049a10c306025fa6bbcdeba29 | /src/com/vincent/practice/multithread/forkjoinpool/MyRecursiveAction.java | 74ec5ab21c8a65023de2d2eaa7f05a67ebc86131 | [] | no_license | ys588281/leetcode_practice | 5b8e4f8cca1519ff3d89d7d0b0d0c238c1cfb622 | 6f3ecdc18b95d906dc31d9e8faae3b4e6a9d8d29 | refs/heads/main | 2023-02-24T17:44:13.198698 | 2021-01-29T14:21:55 | 2021-01-29T14:21:55 | 334,167,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 870 | java | package com.vincent.practice.multithread.forkjoinpool;
import java.util.concurrent.RecursiveAction;
public class MyRecursiveAction extends RecursiveAction {
private static final int MAX = 5;
private int start;
private int end;
public MyRecursiveAction(int start, int end) {
this.start = start;
this.end = end;
}
@Override
protected void compute() {
if (end - start < MAX) {
for (int i = start; i < end; i++) {
System.out.println(Thread.currentThread().getName() + " i value : " + i);
}
} else {
int middle = start + (end - start) / 2;
MyRecursiveAction left = new MyRecursiveAction(start, middle);
MyRecursiveAction right = new MyRecursiveAction(middle, end);
left.fork();
right.fork();
}
}
}
| [
"[email protected]"
] | |
d6e24d50057a69c9e4c0c200079dfb2b7945a19b | ab92261ef3c0010f254304df5131f0952c0965e4 | /app/src/main/java/deb/com/firebaseapp/BlogDetails.java | b4427655382728a2d1f39ef4be66ef2b51b05419 | [] | no_license | PalashRoy975/Explore_BD_final | aead48f747451e9286fc698a740a1d705cd39f88 | 5dfa3320a30cf0ccc25c37b70c855f8afcf2da4f | refs/heads/master | 2021-07-25T14:52:33.415121 | 2017-11-07T17:09:28 | 2017-11-07T17:09:28 | 109,866,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,642 | java | package deb.com.firebaseapp;;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by palash on 9/26/17.
*/
public class BlogDetails implements Parcelable {
String tourId,tourName,tourdis;
String tourGenre;
String season;
float rb;
String guname;
String email;
String guno;
String gudesc;
String desc;
String image;
private long timeMilli;
int likes;
public BlogDetails() {
}
public BlogDetails(String image, String tourId, String tourName,String tourdis, String email, String tourGenre, String season, float rb, String guname, String guno, String gudesc, String desc, int likes) {
this.image = image;
this.tourId = tourId;
this.tourName = tourName;
this.tourdis = tourdis;
this.tourGenre = tourGenre;
this.season = season;
this.rb = rb;
this.guname = guname;
this.guno = guno;
this.gudesc = gudesc;
this.desc = desc;
this.email = email;
this.likes=likes;
// this.timeMilli=timeMilli;
}
public String getTourdis() {
return tourdis;
}
public void setTourdis(String tourdis) {
this.tourdis = tourdis;
}
public String getTourId() {
return tourId;
}
public void setTourId(String tourId) {
this.tourId = tourId;
}
public String getTourName() {
return tourName;
}
public void setTourName(String tourName) {
this.tourName = tourName;
}
public String getTourGenre() {
return tourGenre;
}
public void setTourGenre(String tourGenre) {
this.tourGenre = tourGenre;
}
public String getSeason() {
return season;
}
public void setSeason(String season) {
this.season = season;
}
public float getRb() {
return rb;
}
public void setRb(float rb) {
this.rb = rb;
}
public String getGuname() {
return guname;
}
public void setGuname(String guname) {
this.guname = guname;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getGuno() {
return guno;
}
public void setGuno(String guno) {
this.guno = guno;
}
public String getGudesc() {
return gudesc;
}
public void setGudesc(String gudesc) {
this.gudesc = gudesc;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public long getTimeMilli() {
return timeMilli;
}
public void setTimeMilli(long timeMilli) {
this.timeMilli = timeMilli;
}
public int getLikes() {
return likes;
}
public void setLikes(int likes) {
this.likes = likes;
}
public static Creator<BlogDetails> getCREATOR() {
return CREATOR;
}
protected BlogDetails(Parcel in) {
image = in.readString();
tourId = in.readString();
tourName = in.readString();
tourdis=in.readString();
tourGenre = in.readString();
season = in.readString();
rb = in.readFloat();
guname = in.readString();
email = in.readString();
guno = in.readString();
gudesc = in.readString();
desc = in.readString();
likes=in.readInt();
// timeMilli=in.readLong();
}
public static final Creator<BlogDetails> CREATOR = new Creator<BlogDetails>() {
@Override
public BlogDetails createFromParcel(Parcel in) {
return new BlogDetails(in);
}
@Override
public BlogDetails[] newArray(int size) {
return new BlogDetails[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(image);
parcel.writeString(tourId);
parcel.writeString(tourName);
parcel.writeString(tourdis);
parcel.writeString(tourGenre);
parcel.writeString(season);
parcel.writeFloat(rb);
parcel.writeString(guname);
parcel.writeString(email);
parcel.writeString(guno);
parcel.writeString(gudesc);
parcel.writeString(desc);
parcel.writeInt(likes);
// parcel.writeLong(timeMilli);
}
}
| [
"[email protected]"
] | |
bb46eb3747eed5a3ae62aca44c24947409dbf777 | aa411b1ecebada09fba2c8adaff596d59c79464f | /android/app/src/main/java/com/jigsaw/MainApplication.java | 59b3d3a45e3246d2c13c695900be7b5a402b12db | [] | no_license | ganganahmad1/rn-puzzle | 3403ea1fe4650d0905c656d94d225fc69c3e807c | 53cd0ff8fa9d983f29ac9e75d30f3ad00dd0ed7b | refs/heads/master | 2023-02-08T08:10:55.885359 | 2020-12-30T03:36:33 | 2020-12-30T03:36:33 | 325,445,165 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,708 | java | package com.jigsaw;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import fr.greweb.reactnativeviewshot.RNViewShotPackage;
import org.reactnative.maskedview.RNCMaskedViewPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.jigsaw.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
78ecf4e75c51c1a6080e2e344056169b3f9f77ab | 3e46bf355764f5ebb05e1223590720d7b1c49ffe | /rentaride/src/edu/uga/cs/rentaride/session/Session.java | dee6b11e8d3ee40ea156fe26a7a5aea436b501f7 | [] | no_license | emilyjackson2018/csx050 | 301cae51e40bcea0281a3b5333ffe85b93d997df | 45fc7455541cd52517dda91c98a4d0ef12ce30ec | refs/heads/master | 2021-08-23T13:36:12.944031 | 2017-12-05T02:59:56 | 2017-12-05T02:59:56 | 105,591,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,134 | java | package edu.uga.cs.rentaride.session;
import java.sql.Connection;
import java.util.Calendar;
import java.util.Date;
import org.apache.log4j.Logger;
import edu.uga.cs.rentaride.RARException;
import edu.uga.cs.rentaride.entity.User;
import edu.uga.cs.rentaride.LogicLayer;
import edu.uga.cs.rentaride.logic.impl.LogicLayerImpl;
import edu.uga.cs.rentaride.object.ObjectLayer;
import edu.uga.cs.rentaride.object.impl.ObjectLayerImpl;
import edu.uga.cs.rentaride.persistence.PersistenceLayer;
import edu.uga.cs.rentaride.persistence.impl.PersistenceLayerImpl;
public class Session
extends Thread
{
private Connection conn;
private ObjectLayer objectLayer;
private LogicLayer logicLayer;
private User user;
private String id;
private Date expiration;
private static Logger log = SessionManager.getLog();
public Session(Connection conn)
{
this.conn = conn;
objectLayer = new ObjectLayerImpl();
PersistenceLayer persistence = new PersistenceLayerImpl(conn, objectLayer);
objectLayer.setPersistence(persistence);
logicLayer = new LogicLayerImpl(objectLayer);
extendExpiration();
}
/***********************************************************
* Gets the JDBC connection information for the current session.
* @return current connection
*/
public Connection getConnection()
{
extendExpiration();
return conn;
}
public User getUser()
{
extendExpiration();
return user;
}
public void setUser(User user)
throws RARException
{
extendExpiration();
this.user = user;
}
public String getSessionId()
{
extendExpiration();
return id;
}
public void setSessionId(String id)
{
this.id = id;
}
public Date getExpiration()
{
return expiration;
}
public void setExpiration(Date expiration)
{
this.expiration = expiration;
}
private void extendExpiration(){
Calendar c = Calendar.getInstance();
c.add(Calendar.MINUTE, 30);
this.expiration = c.getTime();
}
public ObjectLayer getObjectLayer()
{
return objectLayer;
}
public void run()
{
long diff = expiration.getTime() - System.currentTimeMillis();
while (diff > 0) {
try {
sleep(diff);
}
catch(Exception e) {
break;
}
diff = expiration.getTime() - System.currentTimeMillis();
}
try {
SessionManager.removeSession(this);
}
catch(RARException e) {
log.error(e.toString(), e);
try {
throw e;
}
catch (RARException e1) {
e1.printStackTrace();
}
}
}
public LogicLayer getLogicLayer()
{
return logicLayer;
}
public void setLogicLayer(LogicLayer logicLayer)
{
this.logicLayer = logicLayer;
}
}
| [
"[email protected]"
] | |
4eb4750de4ab8e20bc7cd7cdd128cd0323a2ff44 | 8f529ca19279acd5ccb2fa11724954b2f0950e6e | /recursosInvestigacion/src/main/java/co/edu/unicundi/recursosInvestigacion/service/imp/DocenteServiceImp.java | 9f74312c337663c2065da556125e913a6ea16eeb | [] | no_license | aleon01/Proyecto | b19c49c2989d12068eda02c762347b89847e30fc | 881d72126b1721acee6a29cf44f3ad9e57cb5bc7 | refs/heads/main | 2023-07-17T09:11:03.400406 | 2021-08-25T04:55:41 | 2021-08-25T04:55:41 | 399,691,939 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,915 | java | package co.edu.unicundi.recursosInvestigacion.service.imp;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import co.edu.unicundi.recursosInvestigacion.dto.docenteDTO;
import co.edu.unicundi.recursosInvestigacion.entity.Docente;
import co.edu.unicundi.recursosInvestigacion.entity.RolUser;
import co.edu.unicundi.recursosInvestigacion.exception.ModelNotFoundException;
import co.edu.unicundi.recursosInvestigacion.repository.IDocenteRepo;
import co.edu.unicundi.recursosInvestigacion.repository.IRolUserRepo;
import co.edu.unicundi.recursosInvestigacion.service.IDocenteService;
@Service
public class DocenteServiceImp implements IDocenteService{
@Autowired
private IDocenteRepo repo;
@Autowired
private IRolUserRepo repoRol;
@Override
public List<docenteDTO> retornar() {
List<Docente> listaUser = repo.findAll();
List<docenteDTO> DTOuser = new ArrayList<>();
for(Docente listUsuario : listaUser) {
ModelMapper modelMapper = new ModelMapper();
docenteDTO dtousuarios = modelMapper.map(listUsuario, docenteDTO.class);
dtousuarios.getTdocId().setEstudiante(null);
dtousuarios.getTdocId().setAdministrativo(null);
dtousuarios.getTdocId().setDocente(null);
dtousuarios.getRolUser().setEstudiante(null);
dtousuarios.getRolUser().setDocente(null);
dtousuarios.getRolUser().setAdministrativo(null);
DTOuser.add(dtousuarios);
}
return DTOuser;
}
@Override
public docenteDTO retornarPorId(Integer id) throws ModelNotFoundException {
Optional<Docente> optional = repo.findById(id);
Docente user;
docenteDTO dtouser;
if (optional.isPresent()) {
user = optional.get();
ModelMapper modelMapper = new ModelMapper();
dtouser = modelMapper.map(user, docenteDTO.class);
dtouser.getTdocId().setEstudiante(null);
dtouser.getTdocId().setAdministrativo(null);
dtouser.getTdocId().setDocente(null);
dtouser.getRolUser().setEstudiante(null);
dtouser.getRolUser().setDocente(null);
dtouser.getRolUser().setAdministrativo(null);
} else {
throw new ModelNotFoundException("Docente no existe");
}
return dtouser;
}
@Override
public void guardar(Docente user) throws ModelNotFoundException {
Docente userCod = repo.findByDoceCodigo(user.getDoceCodigo());
if(userCod == null) {
}else {
throw new ModelNotFoundException("El codigo del usuario ya existe");
}
//-----
Docente userIden = repo.findByDoceDocumento(user.getDoceDocumento());
if(userIden == null) {
}else {
throw new ModelNotFoundException("El documeto del docente ya existe");
}
//-----
//Valida el ROl
Optional<RolUser> rolu = repoRol.findById(user.getRolUser().getRoluId());
if(rolu.isPresent()) {
}else {
throw new ModelNotFoundException("El Rol no existe");
}
//-----
Docente userUser = repo.findByDoceUsuario(user.getDoceUsuario());
if(userUser == null) {
}else {
throw new ModelNotFoundException("Este usuario ya existe");
}
repo.save(user);
}
@Override
public void editar(Docente user) throws ModelNotFoundException {
Optional<Docente> optional = repo.findById(user.getDoce_id());
Docente userBus;
if (optional.isPresent()) {
userBus = optional.get();
userBus.setDoceCodigo(user.getDoceCodigo());
userBus.setDoceNombre(user.getDoceNombre());
userBus.setDoceApellido(user.getDoceApellido());
userBus.setTdocId(user.getTdocId());
userBus.setDoceDocumento(user.getDoceDocumento());
userBus.setDoceDireccion(user.getDoceDireccion());
userBus.setDoceCorreo(user.getDoceCorreo());
userBus.setDoceTelCelular(user.getDoceTelCelular());
userBus.setDoceTelCelular1(user.getDoceTelCelular1());
userBus.setDoceSede(user.getDoceSede());
userBus.setDoceLugarNacimiento(user.getDoceLugarNacimiento());
userBus.setDoceFechaNacimiento(user.getDoceFechaNacimiento());
userBus.setDoceUsuario(user.getDoceUsuario());
userBus.setDoceContrasena(user.getDoceContrasena());
//VALIDA ROL
Optional<RolUser> rolu = repoRol.findById(user.getRolUser().getRoluId());
if(rolu.isPresent()) {
} else {
throw new ModelNotFoundException("Rol no existe");
}
repo.save(userBus);
}else {
throw new ModelNotFoundException("Doce no existe");
}
}
@Override
public void eliminar(Integer id) throws ModelNotFoundException {
Optional<Docente> user = repo.findById(id);
if(user.isPresent()) {
repo.deleteById(id);
}else {
new ModelNotFoundException("Usuario no se encontra Registrado");
}
}
@Override
public docenteDTO findByDoceUsuarioAndDoceContrasena(String doceUsuario, String doceContrasena)
throws ModelNotFoundException {
Docente optional = repo.findByDoceUsuarioAndDoceContrasena(doceUsuario, doceContrasena);
docenteDTO dtouser;
if (optional != null) {
ModelMapper modelMapper = new ModelMapper();
dtouser = modelMapper.map(optional, docenteDTO.class);
dtouser.getRolUser().setEstudiante(null);
dtouser.getRolUser().setDocente(null);
dtouser.getRolUser().setAdministrativo(null);
} else {
throw new ModelNotFoundException("Usuario no existe");
}
return dtouser;
}
@Override
public docenteDTO consultarUsuarioAndContrasena(String doceUsuario, String doceContrasena)
throws ModelNotFoundException {
Docente optional = repo.consultarUsuarioAndContrasena(doceUsuario, doceContrasena);;
docenteDTO dtouser;
if (optional != null) {
ModelMapper modelMapper = new ModelMapper();
dtouser = modelMapper.map(optional, docenteDTO.class);
dtouser.getRolUser().setEstudiante(null);
dtouser.getRolUser().setDocente(null);
dtouser.getRolUser().setAdministrativo(null);
} else {
throw new ModelNotFoundException("Usuario no existe");
}
return dtouser;
}
}
| [
"[email protected]"
] | |
c4376418857a45e5c384dee794a940a86e66b177 | 65b3f179b3b5097c63f5fbcf132745be5e83478d | /src/main/java/com/insidecoding/opium/agent/os/OsCommand.java | 2ce33e64487e01807e7a199385f3f7504b4dbeb9 | [
"Apache-2.0"
] | permissive | ludovicianul/opium.agent | 8872f8d5344c8dff85bb9e7112f6be4f71c34f4d | df0c6379a70a478e52b4704117c4056de3e10801 | refs/heads/master | 2021-01-17T13:03:26.637800 | 2020-03-03T12:41:10 | 2020-03-03T12:41:10 | 59,685,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,348 | java | package com.insidecoding.opium.agent.os;
import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecuteResultHandler;
import org.apache.commons.exec.DefaultExecutor;
import org.apache.commons.exec.PumpStreamHandler;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
public abstract class OsCommand {
private static final int DEFAULT_PROC_TIMEOUT = 10 * 1000;
/**
* Executes the given command and returns once the given "waitFor" string is found in the command
* output.
*
* @param waitFor - the String to wait for in the command output
* @param commandParams the additional command params
* @return the command output
* @throws IOException if something goes wrong
*/
public String executeAndWaitFor(String waitFor, String... commandParams) throws IOException {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
CommandLine commandLine = new CommandLine(this.getCommand());
commandLine.addArguments(commandParams, false);
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
DefaultExecutor executor = new DefaultExecutor();
PumpStreamHandler streamHandler = new PumpStreamHandler(outputStream);
executor.setStreamHandler(streamHandler);
executor.execute(commandLine, resultHandler);
try {
resultHandler.waitFor(DEFAULT_PROC_TIMEOUT);
boolean found = false;
while (!resultHandler.hasResult() && !found && !waitFor.isEmpty()) {
if (outputStream.toString().contains(waitFor)) {
found = true;
}
Thread.sleep(50);
}
if (resultHandler.hasResult() && resultHandler.getExitValue() != 0) {
throw new CommandFailedException(outputStream.toString());
}
} catch (InterruptedException e) {
throw new CommandFailedException(e);
}
return outputStream.toString();
}
}
public String execute(String... params) throws IOException {
return this.executeAndWaitFor("", params);
}
public abstract String getCommand();
}
| [
"[email protected]"
] | |
18a1ab3339e0bfd1bf081608e056067dc912c7f5 | a862bde3982a11e8a08739634470cdce15ee3f78 | /src/main/java/com/neuedu/vo/QinfoVo.java | f3ce4675d1f37324e6170ed397395b8670d81664 | [] | no_license | guoyang123/qinfo-20180927 | d3289476b40fca376b2ee0e0580b3fde4a9b5370 | 43e3ba4236deae2c90200e4223aa9d898630e46d | refs/heads/master | 2020-03-30T00:39:44.746565 | 2018-10-18T01:04:19 | 2018-10-18T01:04:19 | 150,535,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,454 | java | package com.neuedu.vo;
import java.io.Serializable;
/**
* 创建问卷后返回前端的vo类
*
* */
public class QinfoVo implements Serializable {
private String qno;//编号
private String qtitle;//问卷标题
private String result;// 1:succ 0:fail
private String message;//失败信息
public QinfoVo() {
}
public QinfoVo(String qno, String qtitle, String result, String message) {
this.qno = qno;
this.qtitle = qtitle;
this.result = result;
this.message = message;
}
public String getQno() {
return qno;
}
public void setQno(String qno) {
this.qno = qno;
}
public String getQtitle() {
return qtitle;
}
public void setQtitle(String qtitle) {
this.qtitle = qtitle;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
return "QinfoVo{" +
"qno='" + qno + '\'' +
", qtitle='" + qtitle + '\'' +
", result='" + result + '\'' +
", message='" + message + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
d7f108526d34336c1b3e16b23674d278fc179fac | 98e666e26aae281daf5d93455cfaa0cee1304823 | /src/primeirafase/algs4/SymbolGraph.java | f8486217419d0c537a9f827f99cc454c21d28475 | [] | no_license | PedroAlmeidacode/LinkedIn_graph_search | 1a627bb18628dcde0b5b225ed8d846f9a94b6c8c | 368a69d6364428feb097bdaf559b1c909dd22c0d | refs/heads/master | 2021-04-21T03:22:00.576935 | 2020-05-05T14:14:58 | 2020-05-05T14:14:58 | 249,745,331 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,664 | java | /******************************************************************************
* Compilation: javac SymbolGraph.java
* Execution: java SymbolGraph filename.txt delimiter
* Dependencies: ST.java Graph.java In.java StdIn.java StdOut.java
* Data files: https://algs4.cs.princeton.edu/41graph/routes.txt
* https://algs4.cs.princeton.edu/41graph/movies.txt
* https://algs4.cs.princeton.edu/41graph/moviestiny.txt
* https://algs4.cs.princeton.edu/41graph/moviesG.txt
* https://algs4.cs.princeton.edu/41graph/moviestopGrossing.txt
*
* % java SymbolGraph routes.txt " "
* JFK
* MCO
* ATL
* ORD
* LAX
* PHX
* LAS
*
* % java SymbolGraph movies.txt "/"
* Tin Men (1987)
* Hershey, Barbara
* Geppi, Cindy
* Jones, Kathy (II)
* Herr, Marcia
* ...
* Blumenfeld, Alan
* DeBoy, David
* Bacon, Kevin
* Woodsman, The (2004)
* Wild Things (1998)
* Where the Truth Lies (2005)
* Tremors (1990)
* ...
* Apollo 13 (1995)
* Animal House (1978)
*
*
* Assumes that input file is encoded using UTF-8.
* % iconv -f ISO-8859-1 -t UTF-8 movies-iso8859.txt > movies.txt
*
******************************************************************************/
package primeirafase.algs4;
/**
* The {@code SymbolGraph} class represents an undirected graph, where the
* vertex names are arbitrary strings.
* By providing mappings between string vertex names and integers,
* it serves as a wrapper around the
* {@link Graph} data type, which assumes the vertex names are integers
* between 0 and <em>V</em> - 1.
* It also supports initializing a symbol graph from a file.
* <p>
* This implementation uses an {@link ST} to map from strings to integers,
* an array to map from integers to strings, and a {@link Graph} to store
* the underlying graph.
* The <em>indexOf</em> and <em>contains</em> operations take time
* proportional to log <em>V</em>, where <em>V</em> is the number of vertices.
* The <em>nameOf</em> operation takes constant time.
* <p>
* For additional documentation, see <a href="https://algs4.cs.princeton.edu/41graph">Section 4.1</a> of
* <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne.
*
* @author Robert Sedgewick
* @author Kevin Wayne
*/
public class SymbolGraph {
private ST<String, Integer> st; // string -> index
private String[] keys; // index -> string
private Graph graph; // the underlying graph
/**
* Initializes a graph from a file using the specified delimiter.
* Each line in the file contains
* the name of a vertex, followed by a list of the names
* of the vertices adjacent to that vertex, separated by the delimiter.
* @param filename the name of the file
* @param delimiter the delimiter between fields
*/
public SymbolGraph(String filename, String delimiter) {
st = new ST<String, Integer>();
// First pass builds the index by reading strings to associate
// distinct strings with an index
In in = new In(filename);
// while (in.hasNextLine()) {
while (!in.isEmpty()) {
String[] a = in.readLine().split(delimiter);
for (int i = 0; i < a.length; i++) {
if (!st.contains(a[i]))
st.put(a[i], st.size());
}
}
// inverted index to get string keys in an array
keys = new String[st.size()];
for (String name : st.keys()) {
keys[st.get(name)] = name;
}
// second pass builds the graph by connecting first vertex on each
// line to all others
graph = new Graph(st.size());
in = new In(filename);
while (in.hasNextLine()) {
String[] a = in.readLine().split(delimiter);
int v = st.get(a[0]);
for (int i = 1; i < a.length; i++) {
int w = st.get(a[i]);
graph.addEdge(v, w);
}
}
}
/**
* Does the graph contain the vertex named {@code s}?
* @param s the name of a vertex
* @return {@code true} if {@code s} is the name of a vertex, and {@code false} otherwise
*/
public boolean contains(String s) {
return st.contains(s);
}
/**
* Returns the integer associated with the vertex named {@code s}.
* @param s the name of a vertex
* @return the integer (between 0 and <em>V</em> - 1) associated with the vertex named {@code s}
* @deprecated Replaced by {@link #indexOf(String)}.
*/
@Deprecated
public int index(String s) {
return st.get(s);
}
/**
* Returns the integer associated with the vertex named {@code s}.
* @param s the name of a vertex
* @return the integer (between 0 and <em>V</em> - 1) associated with the vertex named {@code s}
*/
public int indexOf(String s) {
return st.get(s);
}
/**
* Returns the name of the vertex associated with the integer {@code v}.
* @param v the integer corresponding to a vertex (between 0 and <em>V</em> - 1)
* @return the name of the vertex associated with the integer {@code v}
* @throws IllegalArgumentException unless {@code 0 <= v < V}
* @deprecated Replaced by {@link #nameOf(int)}.
*/
@Deprecated
public String name(int v) {
validateVertex(v);
return keys[v];
}
/**
* Returns the name of the vertex associated with the integer {@code v}.
* @param v the integer corresponding to a vertex (between 0 and <em>V</em> - 1)
* @throws IllegalArgumentException unless {@code 0 <= v < V}
* @return the name of the vertex associated with the integer {@code v}
*/
public String nameOf(int v) {
validateVertex(v);
return keys[v];
}
/**
* Returns the graph assoicated with the symbol graph. It is the client's responsibility
* not to mutate the graph.
* @return the graph associated with the symbol graph
* @deprecated Replaced by {@link #graph()}.
*/
@Deprecated
public Graph G() {
return graph;
}
/**
* Returns the graph assoicated with the symbol graph. It is the client's responsibility
* not to mutate the graph.
* @return the graph associated with the symbol graph
*/
public Graph graph() {
return graph;
}
// throw an IllegalArgumentException unless {@code 0 <= v < V}
private void validateVertex(int v) {
int V = graph.V();
if (v < 0 || v >= V)
throw new IllegalArgumentException("vertex " + v + " is not between 0 and " + (V-1));
}
/**
* Unit tests the {@code SymbolGraph} data type.
*
* @param args the command-line arguments
*/
public static void main(String[] args) {
String filename = args[0];
String delimiter = args[1];
SymbolGraph sg = new SymbolGraph(filename, delimiter);
Graph graph = sg.graph();
while (StdIn.hasNextLine()) {
String source = StdIn.readLine();
if (sg.contains(source)) {
int s = sg.index(source);
for (int v : graph.adj(s)) {
StdOut.println(" " + sg.name(v));
}
}
else {
StdOut.println("input not contain '" + source + "'");
}
}
}
}
/******************************************************************************
* Copyright 2002-2018, Robert Sedgewick and Kevin Wayne.
*
* This file is part of algs4.jar, which accompanies the textbook
*
* Algorithms, 4th edition by Robert Sedgewick and Kevin Wayne,
* Addison-Wesley Professional, 2011, ISBN 0-321-57351-X.
* http://algs4.cs.princeton.edu
*
*
* algs4.jar is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* algs4.jar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with algs4.jar. If not, see http://www.gnu.org/licenses.
******************************************************************************/
| [
"[email protected]"
] | |
caa7a97ee00c7ec006fd12c1afbc6b8c6591bccb | 1fae357939b3e440313e4ee0f36fa1a70fbbb6c1 | /src/main/java/Basic_test_Student_Bissell.java | 61ce8079c3acfe859176bc16f53ce0c48a72b723 | [] | no_license | andrasragany/moovs-automation | 15534087a4900b826abf4975d42350b084109413 | de42fe46fc47f41e59ec507e7d42da4d582ed936 | refs/heads/master | 2021-08-10T20:47:06.428101 | 2020-12-02T08:47:58 | 2020-12-02T08:47:58 | 228,189,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,962 | java | import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.opera.OperaDriver;
import org.openqa.selenium.opera.OperaOptions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.io.File;
import java.time.LocalDateTime;
import java.util.logging.FileHandler;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
public class Basic_test_Student_Bissell extends Thread{
private WebDriver driver;
private WebDriverWait waiter;
private String browsertype;
public Basic_test_Student_Bissell(String name, String browsertype) {
super(name);
this.browsertype = browsertype;
}
@Override
public void run() {
System.out.println("Thread- Started" + Thread.currentThread().getName());
try {
Thread.sleep(1000);
setUp(this.browsertype);
student();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
tearDown();
}
System.out.println("Thread- END " + Thread.currentThread().getName());
}
public void setUp(String browsertype) throws Exception {
if (browsertype.contains("Chrome")) {
driver = new ChromeDriver();
waiter = new WebDriverWait(driver, 5);
} else if (browsertype.contains("Firefox")) {
driver = new FirefoxDriver();
waiter = new WebDriverWait(driver, 5);
} else if (browsertype.contains("Opera")) {
OperaOptions options = new OperaOptions();
//options.setBinary(new File("c:\\Users\\randr\\AppData\\Local\\Programs\\Opera\\66.0.3515.44\\opera.exe"));
options.setBinary(new File("c:\\Users\\Rendszergazda\\AppData\\Local\\Programs\\Opera\\66.0.3515.44\\opera.exe"));
options.addArguments("--no-sandbox");
options.addArguments("--disable-dev-shm-usage");
driver = new OperaDriver(options);
waiter = new WebDriverWait(driver, 5);
} else if (browsertype.contains("Edge")) {
//System.setProperty("webdriver.edge.driver", "c:\\chromedriver\\msedgedriver.exe");
System.setProperty("webdriver.edge.driver", "c:\\Program Files\\JetBrains\\IntelliJ IDEA Community Edition 2019.2.3\\bin\\msedgedriver.exe");
driver = new EdgeDriver();
waiter = new WebDriverWait(driver, 5);
}
driver.manage().window().maximize();
}
public void tearDown() {
driver.quit();
}
public void student() throws Exception {
String filename = "Mylogfile" + _fc.parseDate(LocalDateTime.now()) + ".log";
String pathname = "c://temp//";
String abspath = pathname + filename;
File file = new File(pathname, filename);
file.createNewFile();
FileHandler fh = new FileHandler(abspath);
Logger logger = Logger.getLogger(abspath);
logger.addHandler(fh);
SimpleFormatter formatter = new SimpleFormatter();
fh.setFormatter(formatter);
_fc.gotourl(logger,driver,"https://test.bissellexpert.com/login");
_fc.login(logger, driver, waiter, "bissellstudent", "bissellstudentpassword");
_fc.navigatetoprofile(logger, driver, "https://test.bissellexpert.com/profile");
((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
_fc.editprofile(logger, driver, waiter);
_fc.changepreferreddevicetotablet(logger, driver, waiter);
_fc.saveprofile(logger, driver, waiter);
_fc.navigatetodashboard(logger, driver, waiter);
_fc.opentraining(driver, logger, waiter);
_fc.player(driver, logger, waiter);
_fc.exam(driver, logger, waiter);
}
public static void main(String[] argv) throws Exception {
Thread ChromeThread = new Basic_test_Student_Bissell("Thread Chrome", "Chrome");
Thread FireFoxThread = new Basic_test_Student_Bissell("Thread FireFox", "Firefox");
Thread OperaThread = new Basic_test_Student_Bissell("Thread Opera", "Opera");
Thread EdgeThread = new Basic_test_Student_Bissell("Thread Opera", "Edge");
System.out.println("Starting MyThreads");
ChromeThread.start();
ChromeThread.sleep(1000);
FireFoxThread.start();
FireFoxThread.sleep(1000);
OperaThread.start();
OperaThread.sleep(1000);
EdgeThread.start();
EdgeThread.sleep(1000);
System.out.println("Threads has been started");
}
} | [
"[email protected]"
] | |
186077dbf561b53d0a685369b0b988cd9407255a | b481d7a5abfa6aa1e89abf3824c89305e1bc9be1 | /src/main/java/Week2/Assignments/Assignment_5/WeaponInterface.java | 029572e54a918454d1183132f3962380ee18d966 | [] | no_license | Malleas/CST-135 | 76bc2727565433086936eb9266ea6b973baf9df5 | afbe34e9c05296222a3ee111239c2c3ea5f1c58b | refs/heads/master | 2020-09-16T18:19:27.979963 | 2019-12-18T18:44:20 | 2019-12-18T18:44:20 | 223,850,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 294 | java | package Week2.Assignments.Assignment_5;
/**
* All work is created by Matt Sievers on 12-09-2019 for use in CST-105
*/
public interface WeaponInterface {
public void fireWeapon();
public void fireweapon(int power);
public void activate(boolean isActive);
public int getPower();
}
| [
"[email protected]"
] | |
c8e91104f858fea8884678cdf56cad564e7586be | 55478169502b61f9bd9c81abff014eda17d94cfe | /app/src/main/java/lite/storeclerk/admin/playlazlo/com/storeclerklite/helper/GeoLocationUtil.java | 7c2e82a6fed86455b47cf189ffc16531ce95b922 | [] | no_license | mickychen0524/CL_Android | 9b5bf84f0a280aec38410fc9a755b61ae6de3145 | e36de1cf6a7661c3b3eab5ee965f9ca6b705667a | refs/heads/master | 2021-08-15T06:48:43.967114 | 2017-10-18T08:16:39 | 2017-10-18T08:16:39 | 106,808,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,074 | java | package lite.storeclerk.admin.playlazlo.com.storeclerklite.helper;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import java.util.Timer;
import java.util.TimerTask;
/**
* Created by Dev01 on 10/6/2017.
*/
public class GeoLocationUtil {
Timer timer1;
LocationManager lm;
LocationResult locationResult;
boolean gps_enabled=false;
boolean network_enabled=false;
public boolean getLocation(Context context, LocationResult result)
{
//use LocationResult callback class to pass location value
locationResult=result;
if(lm==null)
lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
//exceptions will be thrown if provider is not permitted.
try{gps_enabled=lm.isProviderEnabled(LocationManager.GPS_PROVIDER);}catch(Exception ex){}
try{network_enabled=lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER);}catch(Exception ex){}
//don't start listeners if no provider is enabled
if(!gps_enabled && !network_enabled)
return false;
try {
if(gps_enabled)
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 1609, locationListenerGps);
if(network_enabled)
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 1609, locationListenerNetwork);
} catch (SecurityException e) {
e.printStackTrace();
}
timer1=new Timer();
timer1.schedule(new GetLastLocation(), 20000);
return true;
}
LocationListener locationListenerGps = new LocationListener() {
public void onLocationChanged(Location location) {
timer1.cancel();
locationResult.gotLocation(location);
lm.removeUpdates(this);
lm.removeUpdates(locationListenerNetwork);
}
public void onProviderDisabled(String provider) {}
public void onProviderEnabled(String provider) {}
public void onStatusChanged(String provider, int status, Bundle extras) {}
};
LocationListener locationListenerNetwork = new LocationListener() {
public void onLocationChanged(Location location) {
timer1.cancel();
locationResult.gotLocation(location);
lm.removeUpdates(this);
lm.removeUpdates(locationListenerGps);
}
public void onProviderDisabled(String provider) {}
public void onProviderEnabled(String provider) {}
public void onStatusChanged(String provider, int status, Bundle extras) {}
};
class GetLastLocation extends TimerTask {
@Override
public void run() {
lm.removeUpdates(locationListenerGps);
lm.removeUpdates(locationListenerNetwork);
Location net_loc=null, gps_loc=null;
try {
if(gps_enabled)
gps_loc=lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if(network_enabled)
net_loc=lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
} catch (SecurityException e) {
e.printStackTrace();
}
//if there are both values use the latest one
if(gps_loc!=null && net_loc!=null){
if(gps_loc.getTime()>net_loc.getTime())
locationResult.gotLocation(gps_loc);
else
locationResult.gotLocation(net_loc);
return;
}
if(gps_loc!=null){
locationResult.gotLocation(gps_loc);
return;
}
if(net_loc!=null){
locationResult.gotLocation(net_loc);
return;
}
locationResult.gotLocation(null);
}
}
public static abstract class LocationResult{
public abstract void gotLocation(Location location);
}
}
| [
"[email protected]"
] | |
beac58fa4e754b28f9ea25d92ce52f1eb10ebf9d | b6d1154f0296bb20b96d8c19de1633594ee2cceb | /src/main/java/com/jilk/ros/rosapi/message/Service.java | a3e8d7821f74729eec20db9cb699d7603b7df986 | [
"MIT"
] | permissive | makingrobot/rosclient | f0be6d14f51504d4c692a2073932dbb7c062bb42 | c7b5bfe6b1699e5b28f243fb449f484ba00f7568 | refs/heads/master | 2020-07-14T14:02:18.911682 | 2019-08-30T07:49:21 | 2019-08-30T07:49:21 | 205,331,102 | 0 | 0 | MIT | 2020-05-08T19:17:59 | 2019-08-30T07:40:55 | Java | UTF-8 | Java | false | false | 1,127 | java | /**
* Copyright (c) 2014 Jilk Systems, Inc.
*
* This file is part of the Java ROSBridge Client.
*
* The Java ROSBridge Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Java ROSBridge Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Java ROSBridge Client. If not, see http://www.gnu.org/licenses/.
*
*/
package com.jilk.ros.rosapi.message;
import com.jilk.ros.message.Message;
import com.jilk.ros.message.MessageType;
@MessageType(string = "rosapi/Service")
public class Service extends Message {
public String service;
public Service() {}
public Service(String service) {
this.service = service;
}
} | [
"[email protected]"
] | |
ca0b1caa843bc5234533b54d89ce42833fd4080d | f6be8485b53eac490d85929780a3082a298b8e7a | /app/src/main/java/com/twitter/university/android/yamba/svc/YambaService.java | 7980a3e410803836006d2798ce32455e7c07d216 | [] | no_license | twitter-university/SyncAdapterYamba | 64d8bee45d6a44af9c50f5a7a33cb1a919489ad4 | f549a0e0f06ef4f795c189d79022bcbe781f2416 | refs/heads/master | 2021-01-17T15:21:17.119416 | 2014-07-23T21:09:30 | 2014-07-23T21:09:30 | 22,177,834 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,226 | java | package com.twitter.university.android.yamba.svc;
import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
public class YambaService extends IntentService {
private static final String TAG = "SVC";
private static final String PARAM_OP = "YambaService.OP";
private static final int OP_POST = -2;
private static final String PARAM_TWEET = "YambaService.TWEET";
public static void postTweet(Context ctxt, String tweet) {
Intent i = new Intent(ctxt, YambaService.class);
i.putExtra(PARAM_OP, OP_POST);
i.putExtra(PARAM_TWEET, tweet);
ctxt.startService(i);
}
private volatile YambaLogic helper;
public YambaService() { super(TAG); }
@Override
public void onCreate() {
super.onCreate();
helper = new YambaLogic(this);
}
@Override
protected void onHandleIntent(Intent intent) {
int op = intent.getIntExtra(PARAM_OP, 0);
switch(op) {
case OP_POST:
helper.doPost(intent.getStringExtra(PARAM_TWEET));
break;
default:
throw new IllegalArgumentException("Unrecognized op: " + op);
}
}
}
| [
"[email protected]"
] | |
5c169c6800de5cc864415c616621bd87528630e2 | 0c80bb4ce1b2cd2673298be9bc8e8f805e1def19 | /src/main/java/com/codegym/model/Product.java | 6c7e39522dec2e7e7bb3d8ff42fad174a749e67a | [] | no_license | tungnk0711/c0819h1-demo-springmvc | 47cd372ad169590bf900ffb971490b0dcc2df388 | a9e357e859eb9a9602dc98a2b28a945249137120 | refs/heads/master | 2020-08-17T19:01:52.897531 | 2019-10-18T07:27:22 | 2019-10-18T07:27:22 | 215,700,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package com.codegym.model;
public class Product {
private int id;
private String name;
private Double price;
public Product() {
}
public Product(int id, String name, Double price) {
this.id = id;
this.name = name;
this.price = price;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
}
| [
"[email protected]"
] | |
c47a872f02ff23b9741f41954388a5941a8bb45c | a90bcf10bf13c8514a3fa4840dd05dcd4e956341 | /src/com/proxy/dynamicproxy/DynamicProxy.java | 98112f51f661c1e3417de1c1aaaa23e2e0064c1c | [] | no_license | willenfoo/headfirst | cc60e83a757069b2dcfe3f53b3adcac84b07ca28 | 43fc2885bda209aa8b8823d8a78195a2b4138f02 | refs/heads/master | 2021-01-22T22:53:33.487639 | 2014-09-11T12:17:37 | 2014-09-11T12:17:37 | 12,633,230 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 107 | java | package com.proxy.dynamicproxy;
public interface DynamicProxy {
public String say(String name);
}
| [
"[email protected]"
] | |
e54c17a5c78ca9f7113cc57dd76143f65d0cc75b | 9b55fd3d1b0b7ece2a32a4896f05119186cf1815 | /Lab7/src/Lab7.java | 91161306dfa9769fba6482ba88c6c9047f391ea4 | [] | no_license | ItsCoolOnMars/Labs-for-CS2004 | 2a2ac7a4ec8ea5ee379e403e8b4de7c1042ba3db | 2c804e51b6f2d080600ee743ce945021e4b95d24 | refs/heads/master | 2020-04-29T11:44:07.182880 | 2019-03-17T20:56:59 | 2019-03-17T20:56:59 | 176,110,196 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,554 | java | import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
public class Lab7 {
public static void PrintArray (double [][] array){
System.out.println(Arrays.deepToString(array));
}
public static double[][] RandomArray(int n){
Random rand = new Random();
double matrix[][] = new double[n][n];
for(int i = 0; i < n; i++) {
for(int j = 0+i; j < n; j++) {
if(i==j) {
matrix[i][j]=0;
}else {
rand.setSeed(System.nanoTime());
Integer r = Math.abs(rand.nextInt() % 101);
matrix[i][j]=r;
matrix[j][i]=matrix[i][j];
}
}
}
return matrix;
}
public static long RunAlgorithm(int n)
{
long StartTime, EndTime, ElapsedTime;
double g[][] = RandomArray(n);
// Save the time before the algorithm run
StartTime=System.nanoTime();
// Run the algorithm
MST.PrimsMST(g);
// Save the time after the run
EndTime=System.nanoTime();
// Calculate the difference
ElapsedTime= EndTime- StartTime;
return ElapsedTime;
}
public static void main(String[] args) {
// Exercise 1
// double g[][] = {{0,1,2},{1,0,3},{2,3,0}};
// double mst[][] = MST.PrimsMST(g);
// PrintArray(mst);
// Exercise 2
// double g[][] = {{0,1,2,3,0},{1,0,6,0,5},{2,6,0,4,1},{3,0,4,0,2},{0,5,2,1,0}};
// double mst[][] = MST.PrimsMST(g);
// PrintArray(mst);
// Exercise 3
System.out.println("size,time");
for(int i = 100; i<=500;i+=10) {
for(int j = 0; j<10;j++) {
System.out.println(i+","+RunAlgorithm(i));
}
}
}
}
| ||
9a84794fdccf06914d2b24bfce010b7e947a7b9d | 0811724942b83be836976ef5f32f2852b5c9d1f7 | /kodilla-patterns2/src/main/java/com/kodilla/patterns2/decorator/pizza/AbstractPizzaOrderDecorator.java | cb1d68399e858846e49dd74cb5e51a449ecde349 | [] | no_license | J-Fi/jan-filipek-kodilla-java | 636e77ad67f2d86f6c17cfcb501114d622e3a852 | 47fc95165e24aa24a3210b94e40100f2a996683c | refs/heads/master | 2020-05-17T03:13:14.793586 | 2019-09-17T21:58:50 | 2019-09-17T21:58:50 | 183,472,658 | 0 | 0 | null | 2019-11-10T22:13:56 | 2019-04-25T16:35:55 | Java | UTF-8 | Java | false | false | 490 | java | package com.kodilla.patterns2.decorator.pizza;
import java.math.BigDecimal;
public class AbstractPizzaOrderDecorator implements PizzaOrder {
private final PizzaOrder pizzaOrder;
protected AbstractPizzaOrderDecorator(PizzaOrder pizzaOrder) {
this.pizzaOrder = pizzaOrder;
}
@Override
public BigDecimal getCost() {
return pizzaOrder.getCost();
}
@Override
public String getDescription() {
return pizzaOrder.getDescription();
}
}
| [
"[email protected]"
] | |
2e922a5442f0506d6af9a11e861fe80e509f1bfd | 770c9b6eb6666a5d6820d3c52b020277ea4b46a3 | /app/src/main/java/com/shlyren/mobilesecurity/LossFindSetup2Activity.java | c6de4dd52653d0f7ee528d93c4b2e76f3617764c | [
"MIT"
] | permissive | shlyren/MobileSecurity-Android | 380aac4d44726ebb4198ea758f97283551aa3158 | 35222710fa83a1a0f81881a98e5755026ffde063 | refs/heads/master | 2021-01-22T05:15:59.167499 | 2017-02-15T10:22:07 | 2017-02-15T10:22:07 | 81,636,581 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,151 | java | package com.shlyren.mobilesecurity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
/**
* Created by yuxiang on 2017/2/14.
*/
public class LossFindSetup2Activity extends BaseSetupActivity {
private CheckBox cb_banding_sim;
private TextView tv_banding_sim;
private SharedPreferences setting;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lossfindsetup2);
cb_banding_sim = (CheckBox) findViewById(R.id.cb_banding_sim);
tv_banding_sim = (TextView) findViewById(R.id.tv_banding_sim);
setting = getApplication().getSharedPreferences("setting", MODE_PRIVATE);
cb_banding_sim.setChecked(!setting.getString("sim_num", "").isEmpty());
if (cb_banding_sim.isChecked()) {
tv_banding_sim.setText("sim卡已绑定");
}else {
tv_banding_sim.setText("sim卡未绑定");
}
}
public void banding_sim(View view) {
SharedPreferences.Editor edit = setting.edit();
if (cb_banding_sim.isChecked()) { // 解绑
edit.putString("sim_num", "");
tv_banding_sim.setText("sim卡未绑定");
}else { //绑定
// TelephonyManager tm = (TelephonyManager) this.getSystemService(TELEPHONY_SERVICE);
// String line1Number = tm.getLine1Number(); // 获取sim绑定的电话号码
// String sim = tm.getSimSerialNumber(); // 获取sim卡序列号
edit.putString("sim_num", "sim");
tv_banding_sim.setText("sim卡已绑定");
}
cb_banding_sim.setChecked(!cb_banding_sim.isChecked());
edit.commit();
}
@Override
public void next_activity() {
startActivity(new Intent(this, LossFindSetup3Activity.class));
finish();
}
@Override
public void pre_activity() {
startActivity(new Intent(this, LossFindSetup1Activity.class));
finish();
}
}
| [
"[email protected]"
] | |
43630e57008c6d3e6b82e4c2e5d23082390366b2 | 677aaa5f4626b8c23e0bee07fb3ae80972386ad6 | /src/main/java/com/reign/framework/msgpack/ResponseList.java | d746b41b9a71117a69ead85b6288a1fe8fc9d794 | [] | no_license | WenXiangWu/reign_framework | faa9029c5adcde9bcfd4135545bae6ffa61b9dd7 | 7e28931d511002594e3b74250091c4d93f3bc2f5 | refs/heads/master | 2023-04-16T05:16:37.971872 | 2021-04-29T12:37:59 | 2021-04-29T12:37:59 | 355,860,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | package com.reign.framework.msgpack;
/**
* @ClassName: ResponseList
* @Description: TODO
* @Author: wuwx
* @Date: 2021-04-08 18:18
**/
public class ResponseList {
}
| [
"[email protected]"
] | |
f3bf1075eb816e247538002433fa43b10df620c2 | 0fb805f310dd1d1915fc6682423ca5dde1f35a59 | /src/Building/BuildingConstructor.java | c7a1f043a7b4e3968b7f009a10f01b3fba607dfd | [] | no_license | Jake1996/OOMD | 3d1b4ac98d7917b91958272cdc60b29617a6a894 | 702f7b276446611bb9105f9d5ef72f0c013cdcfa | refs/heads/master | 2021-05-07T01:46:01.933717 | 2017-11-17T05:43:54 | 2017-11-17T05:43:54 | 110,425,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | package Building;
import java.util.ArrayList;
import java.util.Iterator;
public class BuildingConstructor {
public static final int COMMERCIAL = 0;
public static final int FACTORY = 1;
public static final int RESIDENTIAL = 2;
private static int siteCount = 0;
private static ArrayList<Site> sites = new ArrayList<>();
public static Site getSite(int type,long length,long width) {
Site ret;
if(type == COMMERCIAL)
ret = new Commercial(siteCount++,length ,width);
else if(type == FACTORY)
ret = new Factory(siteCount++,length ,width);
else if(type == RESIDENTIAL)
ret = new Residential(siteCount++,length ,width);
else
return null;
sites.add(ret);
return ret;
}
public static Iterator<Site> getAllSites() {
return sites.iterator();
}
}
| [
"[email protected]"
] | |
77ad77b6ce21e6ac3fbfd3720b17ca5fdb5b9ef6 | 153dca3895b14b4980260bfd9078f6ea65d5d6f0 | /DemoOkHttp/src/test/java/com/dax/demo/ExampleUnitTest.java | 46701b0567697bec98c052bf96b8b65ec1eb1175 | [] | no_license | jerry0864/DemoDax | 2e9e5546e5eb023eba2b618b16ed91143a4942bf | 7bad2e0279f3258c193bc91495954022fd77fe3a | refs/heads/master | 2020-12-23T18:40:28.089841 | 2019-04-24T08:09:13 | 2019-04-24T08:09:13 | 57,119,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | package com.dax.demo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
7ac98bb01c565c2e7059f56bd6d3bbcd701690c7 | 8d4c193bc32f0aafe3df15bddb5bf6203ff96a99 | /time2020-common/src/main/java/org/timetracking/event/TimeTrackingEventConverter.java | 7fba349451f3b325fa7fbc3d469616b29899ca68 | [] | no_license | NicolasVanme/time-2020 | e3b97430e78b14039e189f22bc1e9d9a103969b6 | 82c7995bbedc0a79217b2760a55b4dee96e5f30e | refs/heads/main | 2023-01-13T15:38:04.986134 | 2020-11-22T10:06:23 | 2020-11-22T10:06:23 | 313,711,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,294 | java | package org.timetracking.event;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import static java.lang.String.format;
/**
* Used to :
* - Convert time tracking event to string
* - Convert string to time tracking event
*/
public class TimeTrackingEventConverter {
public String convertToString(TimeTrackingEvent event) {
return format("%d::%d::%s::%d",
event.getEmployeeId(),
event.getTaskId(),
event.getType().name(),
toSecond(event.getEventDateTime()));
}
public TimeTrackingEvent convertFromString(String message) {
String[] messageParts = message.split("::");
if (messageParts.length != 4) {
throw new IllegalArgumentException(format("Provided string '%s' is not correctly formatted", message));
}
return new TimeTrackingEvent(
Integer.parseInt(messageParts[0]),
Integer.parseInt(messageParts[1]),
TimeTrackingEventType.valueOf(messageParts[2]),
LocalDateTime.ofEpochSecond(Long.parseLong(messageParts[3]), 0, ZoneOffset.UTC));
}
private long toSecond(LocalDateTime localDateTime) {
return localDateTime.toInstant(ZoneOffset.UTC).getEpochSecond();
}
}
| [
"[email protected]"
] | |
0c94cc9946e86518b860d8c9e33a05a145c91519 | c1323ae0a91e39e9d338f135f2bc2bf38a782b71 | /Lab12/JdbcFirstExample.java | cae6a7855e2aada22400c4d68094e63d2a5f0686 | [] | no_license | cuongnv2812/JavaTraining | 65634828fb844d09809abc530ae4bad8c9fe71b8 | 919bc4e61abfc9a41bdc0792a3816f429490f392 | refs/heads/master | 2022-12-09T07:09:23.510666 | 2019-10-09T03:10:29 | 2019-10-09T03:10:29 | 107,261,518 | 0 | 0 | null | 2022-11-22T04:17:07 | 2017-10-17T11:50:51 | Java | UTF-8 | Java | false | false | 1,023 | java | package com.lab12.JDBC;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class JdbcFirstExample {
public static void main(String[] args) throws SQLException, ClassNotFoundException {
Connection connection = null;
Statement statement=null;
try {
File file = new File("./dbExample");
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
connection = DriverManager.getConnection("jdbc:derby:" + file.getAbsolutePath() + ";create=true");
statement=connection.createStatement();
String sql="create table student("+
"id bigint primary key generated always as identity(start with 1,increment by 1)," +
"name varchar(1000),"+
"age integer default 20)";
System.out.println(statement.execute(sql));
/*System.out.println("db path :" + file.getAbsolutePath());
System.out.println("Create DB successfully");*/
} finally {
statement.close();
connection.close();
}
}
}
| [
"[email protected]"
] | |
36756fabc95e7c923a8c15836f1844bad7b696e2 | 01dfb27f1288a9ed62f83be0e0aeedf121b4623a | /Cadastros/src/java/com/t2tierp/cadastros/servidor/PaisGridAction.java | cc0e57f125b31bdff074d8b953d788f1a7a2701e | [
"MIT"
] | permissive | FabinhuSilva/T2Ti-ERP-2.0-Java-OpenSwing | deb486a13c264268d82e5ea50d84d2270b75772a | 9531c3b6eaeaf44fa1e31b11baa630dcae67c18e | refs/heads/master | 2022-11-16T00:03:53.426837 | 2020-07-08T00:36:48 | 2020-07-08T00:36:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,133 | java | /*
* The MIT License
*
* Copyright: Copyright (C) 2014 T2Ti.COM
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* The author may be contacted at: [email protected]
*
* @author Claudio de Barros (T2Ti.com)
* @version 2.0
*/
package com.t2tierp.cadastros.servidor;
import com.t2tierp.padrao.servidor.HibernateUtil;
import com.t2tierp.padrao.java.Constantes;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.hibernate.Session;
import org.hibernate.type.Type;
import org.openswing.swing.message.receive.java.ErrorResponse;
import org.openswing.swing.message.receive.java.Response;
import org.openswing.swing.message.send.java.GridParams;
import org.openswing.swing.server.Action;
import org.openswing.swing.server.UserSessionParameters;
import org.openswing.swing.util.server.HibernateUtils;
public class PaisGridAction implements Action {
public PaisGridAction() {
}
public String getRequestName() {
return "paisGridAction";
}
public Response executeCommand(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) {
GridParams pars = (GridParams) inputPar;
Integer acao = (Integer) pars.getOtherGridParams().get("acao");
switch (acao) {
case Constantes.LOAD: {
return load(inputPar, userSessionPars, request, response, userSession, context);
}
case Constantes.INSERT: {
return insert(inputPar, userSessionPars, request, response, userSession, context);
}
case Constantes.UPDATE: {
return update(inputPar, userSessionPars, request, response, userSession, context);
}
case Constantes.DELETE: {
return delete(inputPar, userSessionPars, request, response, userSession, context);
}
}
return null;
}
private Response load(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) {
Session session = null;
GridParams pars = (GridParams) inputPar;
String baseSQL = "select PAIS from com.t2tierp.cadastros.java.PaisVO as PAIS";
try {
session = HibernateUtil.getSessionFactory().openSession();
Response res = HibernateUtils.getBlockFromQuery(
pars.getAction(),
pars.getStartPos(),
Constantes.TAMANHO_BLOCO, // block size...
pars.getFilteredColumns(),
pars.getCurrentSortedColumns(),
pars.getCurrentSortedVersusColumns(),
com.t2tierp.cadastros.java.PaisVO.class,
baseSQL,
new Object[0],
new Type[0],
"PAIS",
HibernateUtil.getSessionFactory(),
session);
return res;
} catch (Exception ex) {
ex.printStackTrace();
return new ErrorResponse(ex.getMessage());
} finally {
try {
session.close();
} catch (Exception ex1) {
}
}
}
public Response insert(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) {
return null;
}
public Response update(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) {
return null;
}
public Response delete(Object inputPar, UserSessionParameters userSessionPars, HttpServletRequest request, HttpServletResponse response, HttpSession userSession, ServletContext context) {
return null;
}
}
| [
"[email protected]"
] | |
0e50b4a7a98ba2a364174767c62deb7ac4491387 | 643c47e10d84f74ab9ce590c7dd57929103e7cdb | /src/main/java/com/wenjuan/dao/AdminUsersMapper.java | dc5e40e208da4ca0ac5c4772c5f3697c9872ee79 | [] | no_license | gst-group/vc-community | 0cf83c025a3d14eeec949854e3ad8282f4b9a0d1 | 96d40da8acf8706be0046541984feca2784eb1c3 | refs/heads/master | 2021-01-22T20:07:43.565960 | 2017-03-27T04:07:49 | 2017-03-27T04:07:49 | 85,279,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.wenjuan.dao;
import com.wenjuan.model.AdminUsers;
public interface AdminUsersMapper {
int deleteByPrimaryKey(Integer id);
int insert(AdminUsers record);
AdminUsers selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AdminUsers record);
int updateByPrimaryKey(AdminUsers record);
} | [
"[email protected]"
] | |
a62e1a465b2b0745dd42afe05024758799dc2c32 | 917bd7ef84e3c5a3192e9344fbac62f258b53127 | /src/controller/InformDetailsServlet.java | 5c8eceb5980dad47b64de77ca24d89bbeb21dfbf | [] | no_license | hekezhao/student | 416b1140cc104bbddd1d38661cd5784c44073249 | 688b91b488f36c9dad8f52954f6ff0a1f1207563 | refs/heads/master | 2020-12-02T18:51:14.305626 | 2020-01-11T08:39:58 | 2020-01-11T08:39:58 | 231,086,915 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 966 | java | package controller;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.Timestamp;
import bean.Inform;
import dao.InformDao;
import javax.servlet.annotation.WebServlet;
@WebServlet("/informdetails")
public class InformDetailsServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,IOException {
InformDao informDao=new InformDao();
Inform inform=new Inform();
String sno=request.getParameter("sno");//获取学号
Timestamp sendTime=Timestamp.valueOf(request.getParameter("sendTime"));//获取通知发送时间
try {
inform=informDao.findSpecificInform(sno,sendTime);//获取该通知
request.getSession().setAttribute("inform", inform);
response.sendRedirect("/student/details.jsp");//重定向到通知细节页面
}catch(Exception e) {
System.out.println(e);
}
}
}
| [
"[email protected]"
] | |
3af5a7113b9c1483c13c925f5af0bd4bf726661e | 0a564f3a3540659287746f3493dcca76c21079dd | /Facade/src/VideoConversionFacade.java | b759d9277d6a9bd3a713db48b6fb41877a658889 | [] | no_license | Matroso/Design_Patterns | e7dc83b072100afe017ccd65bb36c7235a2c7613 | 99964a4ab68b9c3f0001260a81fee4c2e77ddcc9 | refs/heads/master | 2023-02-01T17:46:44.967441 | 2020-11-28T18:20:16 | 2020-11-28T18:20:16 | 286,028,371 | 0 | 0 | null | 2020-11-28T18:20:17 | 2020-08-08T11:15:21 | Java | UTF-8 | Java | false | false | 863 | java | import Interface.Codec;
import java.io.File;
public class VideoConversionFacade {
public File convertVideo(String fileName, String format){
System.out.println("VideoConversionFacade: conversion started");
VideoFile file = new VideoFile(fileName);
Codec sourceCodec = CodecFactory.extract(file);
Codec destinationCodec;
if (format.equals("mp4")){
destinationCodec = new OggCompressionCodec();
} else {
destinationCodec = new MPEG4CompressionCodec();
}
VideoFile buffer = BitrateReader.read(file, sourceCodec);
VideoFile intermediateResult = BitrateReader.convert(buffer, destinationCodec);
File result = (new AudioMixer()).fix(intermediateResult);
System.out.println("VideoConversionFacade: conversion completed");
return result;
}
}
| [
"[email protected]"
] | |
65861d8b723c6e094268eebcd7c9db72afb1df68 | 7fcf829950af5f7ff28f5085a122cb2f1c130e05 | /src/main/java/com/mindedu/api/util/DateUtils.java | f7597e79c0507b1eafee26c85ec8c077eea20311 | [] | no_license | deepstudyDev/mindedu-api | 71b1c636a3fa489e97deb302874c436866bc7ee5 | b6900516bed3ca86e2afd7666f7d0f78690f0e65 | refs/heads/master | 2020-04-07T19:37:17.990314 | 2018-11-22T07:05:59 | 2018-11-22T07:05:59 | 158,627,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,231 | java | package com.mindedu.api.util;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import java.util.Date;
public class DateUtils {
public final static DateTimeZone UTC_TIME_ZONE = DateTimeZone.UTC;
public final static String DF_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
/**
* 데이트 객체를 패턴에 따라 문자로 변환한다.
*
* @param date 데이트 객체.
* @param pattern 문자열 패턴
* @return 패턴화 문자.
*/
public static String dateToStr(Date date, String pattern, DateTimeZone timeZone){
if(date == null){
return null;
}
DateTime dt = new DateTime(date, timeZone);
return dt.toString(pattern);
}
/**
* 현재 시각의 데이트 객체를 반환한다.
* @return
*/
public static Date now() {
DateTime dateTime = new DateTime();
return dateTime.toDate();
}
public static String nowToStrUTC() {
DateTime dt = new DateTime(now(), UTC_TIME_ZONE);
return dt.toString(DF_TIME_PATTERN);
}
public static void main(String[] args) {
System.out.println(nowToStrUTC());
//System.out.println(dateToStr(d));
}
}
| [
"[email protected]"
] | |
e5043557aa6286f21d6910fed460eef8c1b55795 | 926dbf21eec2cd5de0775bbff0216db795e07e78 | /shop-dao/src/main/java/com/lzh/shop/dao/GoodsPictureDao.java | 23f6703c0c0f611d6fcd7c5ba0ee8f293a2c3866 | [] | no_license | lihuihui123456/shop | f33e142483e70826651ec6f27690012ba642197e | c53c1f9c6c46305f587bb28eff0107a89bbd2f07 | refs/heads/hotfixBranch | 2022-06-22T18:22:15.615560 | 2020-04-05T11:20:04 | 2020-04-05T11:20:04 | 230,189,888 | 0 | 0 | null | 2022-06-17T02:49:28 | 2019-12-26T03:41:11 | Java | UTF-8 | Java | false | false | 248 | java | package com.lzh.shop.dao;
import com.lzh.shop.dao.writeDataSource.MyBatisDao;
import com.lzh.shopentity.GoodsPicture;
import org.springframework.stereotype.Repository;
@Repository
public class GoodsPictureDao extends MyBatisDao<GoodsPicture> {
} | [
"[email protected]"
] | |
363347ef907691e91473dd839ace8e99f7aec8c4 | 68f973a540e84fc253dab592dbd2dc73b4cf73f9 | /covidvaccine management system/src/Vaccine/User_quarantinecenter.java | c6df9ab75c6f98a3bbbac809fec1ef1e8883eb87 | [] | no_license | NidhiSingh25901/CovidVaccineManagementSystem | 859905086c48af4338107b7f650ce4a95f94064b | d4883c298d5e27f3d752ff7273ff46255bb2dc20 | refs/heads/master | 2023-06-20T08:15:17.554620 | 2021-07-15T11:31:08 | 2021-07-15T11:31:08 | 386,256,178 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,823 | java | package Vaccine;
import javax.swing.*;
import javax.swing.table.JTableHeader;
import javax.swing.table.DefaultTableModel;
import java.awt.event.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.awt.*;
public class User_quarantinecenter extends JFrame implements ActionListener {
public static void main(String[] args) {
new User_quarantinecenter();
}
JButton okbutton;
JTable table;
DefaultTableModel defaultTableModel;
public User_quarantinecenter() {
// frame size and styling
setBounds(500, 150, 760, 600);
setResizable(false);
setUndecorated(true);
setBackground(new Color(34, 54, 86, 250));
setLayout(null);
// vaccination center - title
JLabel quarantinehead = new JLabel("<html><u>QUARANTINE CENTER</u></html>");
quarantinehead.setBounds(250, 70, 550, 30);
quarantinehead.setForeground(Color.white);
quarantinehead.setFont(new Font("Tahoma", Font.BOLD, 20));
add(quarantinehead);
// table that fetches data from the database
defaultTableModel = new DefaultTableModel();
table = new JTable(defaultTableModel);
table.setBounds(300, 100, 200, 390);
table.setRowHeight(35);
table.setFont(new Font("Tahoma", Font.BOLD, 15));
table.setEnabled(false);
JTableHeader header = table.getTableHeader();
header.setForeground(Color.WHITE);
header.setBackground(Color.black);
header.setFont(new Font("Tahoma", Font.BOLD, 20));
JScrollPane sp = new JScrollPane(table);
sp.setBounds(150, 150, 480, 360);
add(sp);
defaultTableModel.addColumn("Center");
defaultTableModel.addColumn("Block");
try {
Conn con = new Conn();
String sql = "SELECT * FROM quarantinecenter";
PreparedStatement st = con.c.prepareStatement(sql);
ResultSet rs = st.executeQuery();
while (rs.next()) {
String centername = rs.getString(2);
String block = rs.getString(3);
String[] tbdata = { centername, block };
DefaultTableModel defaultTableModel = (DefaultTableModel) table.getModel();
defaultTableModel.addRow(tbdata);
}
} catch (Exception e) {
}
// ok button
okbutton = new JButton("OK");
okbutton.setBounds(300, 550, 70, 26);
okbutton.setBackground(Color.blue);
okbutton.setForeground(Color.white);
okbutton.addActionListener(this);
add(okbutton);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == okbutton) {
this.setVisible(false);
}
}
}
| [
"[email protected]"
] | |
217eb83ac0ee60f24e2849c482037c2dd379ad1e | 8ad49d1f5e821134a0cb49b8c6c4f414f44b968a | /spring/servlet/src/main/java/hello/servlet/basic/request/RequestHeaderServlet.java | 298acf7e4a65d7ec61cb07441b2805f0d5f588b5 | [] | no_license | wizdom-js/web | 00bcf00de693ed3f86cd25673f78bb98bf0523bb | 676d690732b940d9af3525179dfe6838dff502eb | refs/heads/master | 2023-08-14T04:34:12.204388 | 2021-10-11T13:27:24 | 2021-10-11T13:27:24 | 316,250,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,562 | java | package hello.servlet.basic.request;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Enumeration;
@WebServlet(name="requestHeaderServlet", urlPatterns = "/request-header")
public class RequestHeaderServlet extends HttpServlet {
@Override //protected로 !
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
printStartLine(request);
printHeaders(request);
printHeaderUtils(request);
printEtc(request);
}
//start line 정보
private void printStartLine(HttpServletRequest request) {
System.out.println("--- REQUEST-LINE - start ---");
System.out.println("request.getMethod() = " + request.getMethod()); //GET
System.out.println("request.getProtocal() = " + request.getProtocol()); //HTTP/1.1
System.out.println("request.getScheme() = " + request.getScheme()); //http
// http://localhost:8080/request-header
System.out.println("request.getRequestURL() = " + request.getRequestURL());
// /request-test
System.out.println("request.getRequestURI() = " + request.getRequestURI());
//username=hi
System.out.println("request.getQueryString() = " + request.getQueryString());
System.out.println("request.isSecure() = " + request.isSecure()); //https사용 유무
System.out.println("--- REQUEST-LINE - end ---");
System.out.println();
}
//Header 모든 정보
private void printHeaders(HttpServletRequest request) {
System.out.println("--- Headers - start ---");
// 이건 옛날방식
// request.getHeaderNames 하면 http 요청 메세지에 있는거 다꺼내서 출력할 수 있음
// Enumeration<String> headerNames = request.getHeaderNames();
// while (headerNames.hasMoreElements()) {
// String headerName = headerNames.nextElement();
// System.out.println(headerName + ": " + headerName);
// }
// 요즘 스타일
request.getHeaderNames().asIterator()
.forEachRemaining(headerName -> System.out.println(headerName + ": " + headerName));
// 헤더 정보 하나만 조회하고 싶을때
// request.getHeader("host");
System.out.println("--- Headers - end ---");
System.out.println();
}
//Header 편리한 조회
private void printHeaderUtils(HttpServletRequest request) { System.out.println("--- Header 편의 조회 start ---");
System.out.println("[Host 편의 조회]");
System.out.println("request.getServerName() = " +
request.getServerName()); //Host 헤더
System.out.println("request.getServerPort() = " +
request.getServerPort()); //Host 헤더
System.out.println();
System.out.println("[Accept-Language 편의 조회]");
request.getLocales().asIterator()
.forEachRemaining(locale -> System.out.println("locale = " + locale));
System.out.println("request.getLocale() = " + request.getLocale());
System.out.println();
System.out.println("[cookie 편의 조회]");
// 쿠키 정보 담아놓을 수 있고 쿠키 정보가 계속 넘어온다.
// 쿠키 모양이 여러데이터라서 보기 쉽지 않은데 보기 쉽도록 해준다.
if (request.getCookies() != null) {
for (Cookie cookie : request.getCookies()) {
System.out.println(cookie.getName() + ": " + cookie.getValue());
} }
System.out.println();
System.out.println("[Content 편의 조회]");
System.out.println("request.getContentType() = " +
request.getContentType());
System.out.println("request.getContentLength() = " +
request.getContentLength());
System.out.println("request.getCharacterEncoding() = " +
request.getCharacterEncoding());
System.out.println("--- Header 편의 조회 end ---");
System.out.println();
}
// 기타 정보
// http 메세지 오는건 아니고 내부에서 네트워크 커넥션이 맺어진 정보들을 가지고 알 수 있는 정
private void printEtc(HttpServletRequest request) {
System.out.println("--- 기타 조회 start ---");
// 요청 온거에 대한 정보
System.out.println("[Remote 정보]");
System.out.println("request.getRemoteHost() = " +
request.getRemoteHost()); //
System.out.println("request.getRemoteAddr() = " +
request.getRemoteAddr()); //
System.out.println("request.getRemotePort() = " +
request.getRemotePort()); //
System.out.println();
// 나의 서버에 대한 정보
System.out.println("[Local 정보]");
System.out.println("request.getLocalName() = " +
request.getLocalName()); //
System.out.println("request.getLocalAddr() = " +
request.getLocalAddr()); //
System.out.println("request.getLocalPort() = " +
request.getLocalPort()); //
System.out.println("--- 기타 조회 end ---");
System.out.println();
}
}
| [
"[email protected]"
] | |
9325098d46b151045cbcaf42e52469d2ef06c95f | c27413833b62f51ac77cefae21cef8298f02586f | /app/src/main/java/com/example2/harsh2/mysafetyapp/EmergencyActivity.java | 2b48b9d8f71c7eb92a97a88d4aeaf85ac96c9d65 | [] | no_license | mohith2017/IEEEUVCE_hackathon | 838275d695cd8e030a5a6bfcad19f13373049517 | bae85178956e6098ead78ef3ed87549d97d6139f | refs/heads/master | 2020-03-29T12:17:44.057669 | 2018-10-04T09:34:29 | 2018-10-04T09:34:29 | 149,892,439 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 358 | java | package com.example2.harsh2.mysafetyapp;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class EmergencyActivity extends AppCompatActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_emergency);
}
}
| [
"[email protected]"
] | |
7ce0e82bef37f57465750eb6e3a5f4ee8b72206a | 84f01073cbfbbbb9e0d284070bef594e466d5a48 | /src/main/java/com/javaneversleep/daydayup/lombok/MyTreeTranslator.java | 00dcafe110235dc232eb9d30e0831e75cd6dbd7b | [
"MIT"
] | permissive | elenazhao1004/day-day-up | 004d04d5ae2e31ee5e8562ae0c48d5e1c13afcc8 | d46b5c0bf636741b1735e610f807f67d080615b3 | refs/heads/master | 2020-08-12T07:47:12.131465 | 2019-06-18T05:00:33 | 2019-06-18T05:00:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,377 | java | package com.javaneversleep.daydayup.lombok;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
import com.sun.tools.javac.tree.JCTree.JCExpression;
import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
import com.sun.tools.javac.tree.JCTree.JCModifiers;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.tree.TreeMaker;
import com.sun.tools.javac.tree.TreeTranslator;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.Names;
public class MyTreeTranslator extends TreeTranslator {
private final TreeMaker treeMaker;
private final Names names;
private List<JCTree> getters = List.nil();
MyTreeTranslator(TreeMaker treeMaker, Names names) {
this.treeMaker = treeMaker;
this.names = names;
}
@Override
public void visitClassDef(JCClassDecl decl) {
super.visitClassDef(decl);
if (!getters.isEmpty()) {
decl.defs = decl.defs.appendList(this.getters);
}
this.result = decl;
}
@Override
public void visitVarDef(JCVariableDecl field) {
super.visitVarDef(field);
JCModifiers modifiers = field.getModifiers();
List<JCAnnotation> annotations = modifiers.getAnnotations();
if (annotations == null || annotations.size() <= 0) {
return;
}
for (JCAnnotation annotation : annotations) {
if (!MyGetter.class.getName().equals(annotation.type.toString())) {
continue;
}
String name = field.getName().toString();
String methodName = "get" + name.substring(0, 1).toUpperCase() + name.substring(1);
JCMethodDecl method = treeMaker.MethodDef(
treeMaker.Modifiers(Flags.PUBLIC),
names.fromString(methodName),
(JCExpression) field.getType(),
List.nil(),
List.nil(),
List.nil(),
treeMaker.Block(0L, List.of(treeMaker.Return(treeMaker.Select(treeMaker.Ident(names.fromString("this")),
names.fromString(field.getName().toString()))))),
null
);
this.getters = this.getters.append(method);
}
}
}
| [
"[email protected]"
] | |
4ddb68d90e0994367bcd4b4e29c9dceacb587caf | 16bacd6ef5d524c9c0fe99f32f2d2403d43b3aec | /instrument-simulator/system-modules/instrument-simulator-debug-model/src/main/java/com/shulie/instrument/simulator/module/model/trace2/StackEvent.java | 7f8623a9cdede3f02424770d71220739ebcb4573 | [
"Apache-2.0"
] | permissive | shulieTech/LinkAgent | cbcc9717d07ea636e791ebafe84aced9b03730e8 | 73fb7cd6d86fdce5ad08f0623c367b407e405d76 | refs/heads/main | 2023-09-02T11:21:57.784204 | 2023-08-31T07:02:01 | 2023-08-31T07:02:01 | 362,708,051 | 156 | 112 | Apache-2.0 | 2023-09-13T02:24:11 | 2021-04-29T06:05:47 | Java | UTF-8 | Java | false | false | 756 | java | /**
* Copyright 2021 Shulie Technology, Co.Ltd
* Email: [email protected]
* 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,
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.shulie.instrument.simulator.module.model.trace2;
/**
* @author jirenhe | [email protected]
* @since 2021/08/11 2:33 下午
*/
public enum StackEvent {
METHOD_CALL,
LINE_CALL
}
| [
"[email protected]"
] | |
5f86fba8c76e4cd4dfd4063b2afdad6448b35323 | 8cb5035cfb1a77bc7e77bf142126faf1623fa123 | /src/main/java/com/ericsson/internal/dtra/projectmanagement/domain/repository/WorkBreakdownStructureRepository.java | e4feaf60922448e2a8f5c14ab7f52deac90bb5b0 | [] | no_license | hofner/iwps-project-manager | b9d3267f67e19f5c7be037f4c077cb6d52b2ff47 | d0bd3c1009f3d78f44fa34ddb7b38fdcb484837c | refs/heads/master | 2021-01-14T07:04:10.173533 | 2020-02-24T03:02:29 | 2020-02-24T03:02:29 | 242,634,162 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 797 | java | package com.ericsson.internal.dtra.projectmanagement.domain.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Repository;
import com.ericsson.internal.dtra.projectmanagement.domain.entity.WorkBreakdownStructure;
@Repository
public interface WorkBreakdownStructureRepository extends JpaRepository<WorkBreakdownStructure, Integer> {
/**
* Gets a work breakdown structure
* @param projectId: Id of project
* @param id: Id of work break down structure
* @return wanted work breakdown structure
*/
public WorkBreakdownStructure findByProjectIdAndId(final Integer projectId, final Integer id);
@Modifying
public void deleteByIdIn(final Integer[] ids);
}
| [
"[email protected]"
] | |
9fbdea51b54ff0017771e7bbfed44b4e6079b6be | 4cc6fb1fde80a1730b660ba5ec13ad5f3228ea5c | /java-lihongjie/apache-kafka/spring-boot-with-spring-kafka-example/spring-boot-kafka-producer/src/main/java/com/example/lihongjie/kafka/SpringKafkaProducer.java | 14865dc56dd3eaec89acee7a545f79216e1b52f1 | [
"MIT"
] | permissive | lihongjie/tutorials | c598425b085549f5f7a29b1c7bf0c86ae9823c94 | c729ae0eac90564e6366bc4907dcb8a536519956 | refs/heads/master | 2023-08-19T05:03:23.754199 | 2023-08-11T08:25:29 | 2023-08-11T08:25:29 | 124,048,964 | 0 | 0 | MIT | 2018-04-01T06:26:19 | 2018-03-06T08:51:04 | Java | UTF-8 | Java | false | false | 1,007 | java | package com.example.lihongjie.kafka;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.concurrent.ListenableFuture;
import java.util.UUID;
/**
* 生产者
* 使用@EnableScheduling注解开启定时任务,每秒发送一次。
*/
@Component
@EnableScheduling
public class SpringKafkaProducer {
@Autowired
private KafkaTemplate kafkaTemplate;
@Scheduled(cron = "00/1 * * * * ?")
public void send() {
String message = UUID.randomUUID().toString();
ListenableFuture future = kafkaTemplate.send("app_log", "test", message);
future.addCallback(o -> System.out.println("send-消息发送成功: " + message), throwable -> System.out.println("消息发送失败: " + message));
}
}
| [
"[email protected]"
] | |
0306f64c1be1e317773ed5241d06417498476c86 | e682fa3667adce9277ecdedb40d4d01a785b3912 | /internal/fischer/mangf/A121022.java | 0ed2c787e708751b9d93678d1e1d95f6195736b2 | [
"Apache-2.0"
] | permissive | gfis/joeis-lite | 859158cb8fc3608febf39ba71ab5e72360b32cb4 | 7185a0b62d54735dc3d43d8fb5be677734f99101 | refs/heads/master | 2023-08-31T00:23:51.216295 | 2023-08-29T21:11:31 | 2023-08-29T21:11:31 | 179,938,034 | 4 | 1 | Apache-2.0 | 2022-06-25T22:47:19 | 2019-04-07T08:35:01 | Roff | UTF-8 | Java | false | false | 719 | java | package irvine.oeis.a121;
import irvine.math.z.Z;
import irvine.oeis.Sequence;
/**
* A121022 Even numbers containing a 2 in their decimal representation.
* @author Georg Fischer
*/
public class A121022 implements Sequence {
private Z mN;
private String mMultS;
private int mMult;
/** Construct the sequence. */
public A121022() {
this(2);
}
/**
* Generic constructor with parameters
* @param mult
*/
public A121022(final int mult) {
mN = Z.valueOf(-mult);
mMult = mult;
mMultS = String.valueOf(mult);
}
@Override
public Z next() {
while (true) {
mN = mN.add(mMult);
if (mN.toString().indexOf(mMultS) >= 0) {
return mN;
}
}
}
}
| [
"[email protected]"
] | |
ac0dd1f1e454124d85506d5eeaef559b44ea08c7 | 623ef934bf74b4ab4c51feef9e1405f69208ea34 | /src/views/FluxNbChoice.java | 8561d057e0655b670760a129f1b3e8172a12bda7 | [] | no_license | AndriyParkho/Klex_BDD | 5281b657d247f9d30b112801e4ffee0495ddd61c | 7bade220036c87556e836b22dacca0c6b00389c7 | refs/heads/master | 2023-03-01T22:25:11.895736 | 2020-12-11T17:08:42 | 2020-12-11T17:08:42 | 339,063,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,615 | java | package views;
import java.awt.CardLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import controller.FluxNbChoiceControl;
import model.aggregates.FichierFilm;
import model.aggregates.FichierPiste;
public class FluxNbChoice extends View{
private JSpinner nombreField = new JSpinner();
private JPanel container = new ChoixNbFluxPanel();
private FluxNbChoiceControl controller = new FluxNbChoiceControl(this);
private FichierFilm fichierFilm;
private FichierPiste fichierPiste;
public FluxNbChoice(JFrame fenetre, CardLayout switcherView, JPanel containerView, FichierFilm fichierFilm, FichierPiste fichierPiste) {
super(fenetre, switcherView, containerView, new String("Nombre de flux"));
this.fichierFilm = fichierFilm;
this.fichierPiste = fichierPiste;
super.getContainerView().add(container, "Nombre flux");
super.getPanels().add("Nombre flux");
super.getSwitcherView().show(super.getContainerView() , "Nombre flux");
super.getFenetre().setSize(282, 210);
super.getFenetre().setLocationRelativeTo(null);
}
class ChoixNbFluxPanel extends JPanel {
/**
* Create the panel.
*/
public ChoixNbFluxPanel() {
setLayout(null);
JLabel lblFluxDuFichier = new JLabel("Flux du fichier :");
lblFluxDuFichier.setFont(new Font("Tahoma", Font.BOLD, 18));
lblFluxDuFichier.setBounds(61, 23, 151, 16);
add(lblFluxDuFichier);
JLabel lblNombreDeFlux = new JLabel("Nombre de flux :");
lblNombreDeFlux.setBounds(58, 81, 96, 16);
add(lblNombreDeFlux);
nombreField.setModel(new SpinnerNumberModel(1, 1, null, 1));
nombreField.setBounds(166, 78, 46, 22);
add(nombreField);
JButton suivButton = new JButton("Suivant");
suivButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
controller.clicSuiv();
}
});
suivButton.setBounds(84, 137, 97, 25);
add(suivButton);
}
}
public JSpinner getNombreField() {
return nombreField;
}
public void setNombreField(JSpinner nombreField) {
this.nombreField = nombreField;
}
public FichierFilm getFichierFilm() {
return fichierFilm;
}
public void setFichierFilm(FichierFilm fichierFilm) {
this.fichierFilm = fichierFilm;
}
public FichierPiste getFichierPiste() {
return fichierPiste;
}
public void setFichierPiste(FichierPiste fichierPiste) {
this.fichierPiste = fichierPiste;
}
}
| [
"[email protected]"
] | |
de005dafdaa74662d418fa0322269ec877b6b642 | 2727bb9cf60f98034615e578cef6321d79c2bb23 | /app/src/main/java/com/xkcn/gallery/di/component/ActivityComponent.java | 987ebe5a16a2c802c2468460b28593cc77351c09 | [] | no_license | khoi-nguyen-2359/wallpaper-gallery | fec0c51bae66b06027808d12c194f3de8176642a | d6564aa4b3baccbba0ea897a481a9db45f2150e6 | refs/heads/master | 2021-01-21T14:40:00.711878 | 2016-07-15T09:54:32 | 2016-07-15T09:54:32 | 55,956,629 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package com.xkcn.gallery.di.component;
import android.app.Activity;
import com.xkcn.gallery.di.module.ActivityModule;
import com.xkcn.gallery.di.scope.PerActivity;
import dagger.Component;
@PerActivity
@Component(dependencies = ApplicationComponent.class, modules = ActivityModule.class)
public interface ActivityComponent {
Activity activity();
} | [
"[email protected]"
] | |
487dd52d92c7184158fa2550a6180fc9c6297f1e | 2b9036ad64c2139a4402fe449b4093080f26dbc1 | /src/LinkedList/ReorderList.java | 96825730bab0d5693667b1dc0b6860c595b25b7d | [] | no_license | harshaks23/DS | e40b7cdb62a04b67169ad8d6e38bb784883cf0ce | 2342a761cd68ac1110731f6944b41252bfdf8024 | refs/heads/master | 2020-03-18T17:10:05.344303 | 2018-09-21T06:13:42 | 2018-09-21T06:13:42 | 96,051,752 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,191 | java | package LinkedList;
public class ReorderList {
public void reorderList(ListNode head) {
if(head==null || head.next==null || head.next.next==null)
{ }
else{
ListNode slow=head;
ListNode fast=head;
ListNode prev=slow;
while(fast!=null && fast.next!=null)
{
prev=slow;
fast=fast.next.next;
slow=slow.next;
}
if(fast!=null)
{prev=slow;
slow=slow.next;
}
prev.next=null;
ListNode rev=null;
while(slow!=null)
{
ListNode temp=slow.next;
slow.next=rev;
rev=slow;
slow=temp;
}
slow=head;
while(rev!=null)
{
ListNode temp_rev=rev.next;
rev.next=slow.next;
slow.next=rev;
slow=rev.next;
rev=temp_rev;
}
}
}
public class ListNode {
int val;
ListNode next;
ListNode(int x) { val = x; }
}
}
| [
"[email protected]"
] | |
d60284916196dd122600337a00f5b8a0f6601dea | d7e668a4986dfea0455a4aaa80c87aaf5f8c92e8 | /gulimall-common/src/main/java/com/iflytek/gulimall/common/feign/vo/CartItemVO.java | d8228815418f70ac77fa023a4e44f8dda8116840 | [
"Apache-2.0",
"MIT"
] | permissive | ct16014515/gulimall | dce893c0567a71a74f891b31d0b6f4871b2b7a1c | 9e9b0f883c1f9205b57a57f4a503e9a3112efb36 | refs/heads/master | 2023-06-25T05:27:04.827561 | 2021-07-31T01:05:50 | 2021-07-31T01:05:50 | 391,222,181 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package com.iflytek.gulimall.common.feign.vo;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@Data
@ToString
public class CartItemVO implements Serializable {
private String skuTitle;//商品标题
private List<String> skuAttrs;//商品属性
private String skuImg;//商品图片
private BigDecimal skuPrice;//商品单价
private Integer skuCount;//商品数量
private BigDecimal skuTotalMoney;//sku总价
private Long skuId;
/**
* 0:选中 1:未选中
*/
private Integer isChecked=0;//是否选中
/**
* 0表示没货,1表示有货
*/
private Integer hasStock=1;
private BigDecimal weight;
}
| [
"[email protected]"
] | |
ae59c59e0d81aca0926cb9326efca1de016192d7 | 51c5d4aab989398f59269cf805ed47e73bdb4169 | /SinaApp/app/src/main/java/com/qdqy/admin/sinaapp/newsdata/News.java | 2d75389ace9a7ec4b8965f0a4f12dc4ffc04d8fa | [] | no_license | zfireear/NewsApp | 1998afa8c244b6c63a0a59da237f5febb02474a2 | a0983e1b02298115aa8067313bd28c1617074a97 | refs/heads/master | 2021-01-20T20:29:05.376701 | 2016-06-15T09:13:18 | 2016-06-15T09:13:18 | 60,664,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 946 | java | package com.qdqy.admin.sinaapp.newsdata;
import android.graphics.Bitmap;
public class News {
public String flag;
public String title;
public String date;
public String source;
public String summary;
public int comment;
public String url;
public Bitmap photo;
public String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Bitmap getPhoto() {
return photo;
}
public String getFlag(){
return flag;
}
public String getDate() {
return date;
}
public String getTitle() {
return title;
}
public String getSource() {
return source;
}
public String getSummary() {
return summary;
}
public int getComment() { return comment; }
public String getUrl() { return url; }
}
| [
"[email protected]"
] | |
9238aa4b6dddb2302a3f8caf12d82d818a90e912 | a8d09a190da2a81c6b507b2707d5e32bd2ae7076 | /medicfind/src/com/allexceedvn/medicfind/District.java | 0aadddf3b61810c1e2e039162019c83a8d68bc03 | [] | no_license | vebinhhoanggia/medicfind | ea35c9d2eacf7c97ed34ef52d85315ea25cad8eb | fc7e00a541753f6d544097c94caff5ce04ea55cb | refs/heads/master | 2020-04-28T11:28:48.870513 | 2015-03-24T04:34:47 | 2015-03-24T04:34:47 | 32,772,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 840 | java | package com.allexceedvn.medicfind;
public class District {
private int cityCd;
private int districtCd;
private String districtName;
public District(int cityCd, int districtCd, String districtName) {
super();
this.cityCd = cityCd;
this.districtCd = districtCd;
this.districtName = districtName;
}
public int getCityCd() {
return cityCd;
}
public void setCityCd(int cityCd) {
this.cityCd = cityCd;
}
public int getDistrictCd() {
return districtCd;
}
public void setDistrictCd(int districtCd) {
this.districtCd = districtCd;
}
public String getDistrictName() {
return districtName;
}
public void setDistrictName(String districtName) {
this.districtName = districtName;
}
}
| [
"[email protected]@8c10c88f-4520-9c7e-81e0-17176e7972b3"
] | [email protected]@8c10c88f-4520-9c7e-81e0-17176e7972b3 |
7a0b29bf05f334ca8bbea99162061f7d94aff313 | eb4c12ea2cc28f062358c52cb38dcff23f741343 | /autoTrade/src/TradeRecord.java | 9e1188aa5c13d88f40f1b681c92c8e0f8746de34 | [] | no_license | 4x/forex | a0e73106710840e835062e6c301645c4ce86887f | 7791134794874e1032497898f1d39004f500e1f6 | refs/heads/master | 2020-04-07T13:25:08.146892 | 2011-08-21T02:35:29 | 2011-08-21T02:35:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | import java.io.Serializable;
public class TradeRecord implements Serializable {
String signal;
String direction;
int amount;
String pl;
public TradeRecord(String signal, String direction, int amount, String pl){
this.signal=signal;
this.direction=direction;
this.amount=amount;
this.pl=pl;
}
}
| [
"[email protected]"
] | |
739566d229de66783605ef564c079b4b5f02e4f4 | 1a701c3598a27ce69e958d52639fa4e0106e00a9 | /nacos-feign/src/test/java/com/gzh/nacosfeign/NacosFeignApplicationTests.java | 99547d3d015c7b0a01fc54c1e092a8cdc0735e90 | [] | no_license | gzhkhd/springcloud | 414d52e9676a9f91371eeb4073b3a0ceb5ff3d5b | 1c24fbd8e1f83ba7496582a185b063b87603d65e | refs/heads/master | 2023-06-30T13:42:04.466503 | 2021-07-28T01:08:01 | 2021-07-28T01:08:01 | 381,330,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package com.gzh.nacosfeign;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class NacosFeignApplicationTests {
@Test
void contextLoads() {
}
}
| [
"gzh"
] | gzh |
3b4a98206fc57c30723646684da63fc66790bd3b | 9415646910b04fa12718ea128a096629dcc22733 | /2. godina/oop vezbe/cas01 - uvod/ParniBrojevi.java | cecc48d4e7c6b34db345de9ae6bcde1262ef14dc | [] | no_license | SvetlanaBicanin/MATF-materijali | 306b25fe8c28ea3a8077c83147e27316d55c892f | 21d7da5c62839115eda126819c7fd34a3399c022 | refs/heads/master | 2023-06-01T14:43:47.176006 | 2021-06-13T13:40:24 | 2021-06-13T13:40:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | import java.util.Scanner;
public class ParniBrojevi {
static void prikaziparne(int n){
for(int i = 2; i <= n; i += 2)
System.out.print(i + " ");
System.out.println();
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
prikaziparne(n);
sc.close();
}
}
| [
"[email protected]"
] | |
72c0567c0c8af0a02064e28c84e05b4d327b3658 | b675d109567b2e106a2cc169012243edb4e60b11 | /src/main/java/com/hrm/qa/pages/LoginPage.java | 46db026a984c2c85a043ad1edd92b9884418f65a | [] | no_license | Naween-Kumar/PageObjectModel | e493939cf7edc53aa18f284e142b3d3398af5519 | cdb70169fe40d2a42468a0884b6b9429db176a44 | refs/heads/master | 2023-04-24T06:47:34.480107 | 2021-05-16T21:57:08 | 2021-05-16T21:57:08 | 367,992,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 780 | java | package com.hrm.qa.pages;
import java.io.IOException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.hrm.qa.base.TestBase;
public class LoginPage extends TestBase {
@FindBy(name = "txtUsername")
WebElement Username;
@FindBy(name = "txtPassword")
WebElement Password;
@FindBy(name = "Submit")
WebElement btnLogin;
// Initializtion of all objects
public LoginPage() throws IOException {
PageFactory.initElements(driver, this);
}
public String validationLoginPageTitle() {
return driver.getTitle();
}
public HomePage login(String un, String pwd) {
Username.sendKeys(un);
Password.sendKeys(pwd);
btnLogin.click();
return new HomePage();
}
}
| [
"[email protected]"
] | |
00f34843c96526dfa07157b5fd38f1d27b3c7a36 | a915d83d3088d355d90ba03e5b4df4987bf20a2a | /src/Applications/jetty/util/security/UnixCrypt.java | c82e990a63e3f843aa96406c7e9386016b9ba545 | [] | no_license | worldeditor/Aegean | 164c74d961185231d8b40dbbb6f8b88dcd978d79 | 33a2c651e826561e685fb84c1e3848c44d2ac79f | refs/heads/master | 2022-02-15T15:34:02.074428 | 2019-08-21T03:52:48 | 2019-08-21T15:37:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,907 | java | /*
* @(#)UnixCrypt.java 0.9 96/11/25
*
* Copyright (c) 1996 Aki Yoshida. All rights reserved.
*
* Permission to use, copy, modify and distribute this software
* for non-commercial or commercial purposes and without fee is
* hereby granted provided that this copyright notice appears in
* all copies.
*/
/**
* Unix crypt(3C) utility
*
* @version 0.9, 11/25/96
* @author Aki Yoshida
* <p>
* modified April 2001
* by Iris Van den Broeke, Daniel Deville
*/
/**
* modified April 2001
* by Iris Van den Broeke, Daniel Deville
*/
package Applications.jetty.util.security;
/* ------------------------------------------------------------ */
/**
* Unix Crypt. Implements the one way cryptography used by Unix systems for
* simple password protection.
*
* @version $Id: UnixCrypt.java,v 1.1 2005/10/05 14:09:14 janb Exp $
* @author Greg Wilkins (gregw)
*/
public class UnixCrypt {
/* (mostly) Standard DES Tables from Tom Truscott */
private static final byte[] IP = { /* initial permutation */
58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7};
/* The final permutation is the inverse of IP - no table is necessary */
private static final byte[] ExpandTr = { /* expansion operation */
32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25, 24, 25, 26, 27, 28, 29,
28, 29, 30, 31, 32, 1};
private static final byte[] PC1 = { /* permuted choice table 1 */
57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36,
63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4};
private static final byte[] Rotates = { /* PC1 rotation schedule */
1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1};
private static final byte[] PC2 = { /* permuted choice table 2 */
9, 18, 14, 17, 11, 24, 1, 5, 22, 25, 3, 28, 15, 6, 21, 10, 35, 38, 23, 19, 12, 4, 26, 8, 43, 54, 16, 7, 27, 20, 13, 2,
0, 0, 41, 52, 31, 37, 47, 55, 0, 0, 30, 40, 51, 45, 33, 48, 0, 0, 44, 49, 39, 56, 34, 53, 0, 0, 46, 42, 50, 36, 29, 32};
private static final byte[][] S = { /* 48->32 bit substitution tables */
/* S[1] */
{14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9,
7, 3, 10, 5, 0, 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13},
/* S[2] */
{15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5, 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12,
6, 9, 3, 2, 15, 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9},
/* S[3] */
{10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1, 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2,
12, 5, 10, 14, 7, 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12},
/* S[4] */
{7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9, 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3,
14, 5, 2, 8, 4, 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14},
/* S[5] */
{2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6, 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12,
5, 6, 3, 0, 14, 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3},
/* S[6] */
{12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8, 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4,
10, 1, 13, 11, 6, 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13},
/* S[7] */
{4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6, 1, 4, 11, 13, 12, 3, 7, 14, 10, 15,
6, 8, 0, 5, 9, 2, 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12},
/* S[8] */
{13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2, 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10,
13, 15, 3, 5, 8, 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}};
private static final byte[] P32Tr = { /* 32-bit permutation function */
16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25};
private static final byte[] CIFP = { /*
* compressed/interleaved
* permutation
*/
1, 2, 3, 4, 17, 18, 19, 20, 5, 6, 7, 8, 21, 22, 23, 24, 9, 10, 11, 12, 25, 26, 27, 28, 13, 14, 15, 16, 29, 30, 31, 32,
33, 34, 35, 36, 49, 50, 51, 52, 37, 38, 39, 40, 53, 54, 55, 56, 41, 42, 43, 44, 57, 58, 59, 60, 45, 46, 47, 48, 61, 62, 63, 64};
private static final byte[] ITOA64 = { /* 0..63 => ascii-64 */
(byte) '.', (byte) '/', (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) 'A',
(byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F', (byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M',
(byte) 'N', (byte) 'O', (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U', (byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y',
(byte) 'Z', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f', (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j', (byte) 'k',
(byte) 'l', (byte) 'm', (byte) 'n', (byte) 'o', (byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', (byte) 't', (byte) 'u', (byte) 'v', (byte) 'w',
(byte) 'x', (byte) 'y', (byte) 'z'};
/* ===== Tables that are initialized at run time ==================== */
private static final byte[] A64TOI = new byte[128]; /* ascii-64 => 0..63 */
/* Initial key schedule permutation */
private static final long[][] PC1ROT = new long[16][16];
/* Subsequent key schedule rotation permutations */
private static final long[][][] PC2ROT = new long[2][16][16];
/* Initial permutation/expansion table */
private static final long[][] IE3264 = new long[8][16];
/* Table that combines the S, P, and E operations. */
private static final long[][] SPE = new long[8][64];
/* compressed/interleaved => final permutation table */
private static final long[][] CF6464 = new long[16][16];
/* ==================================== */
static {
byte[] perm = new byte[64];
byte[] temp = new byte[64];
// inverse table.
for (int i = 0; i < 64; i++)
A64TOI[ITOA64[i]] = (byte) i;
// PC1ROT - bit reverse, then PC1, then Rotate, then PC2
for (int i = 0; i < 64; i++)
perm[i] = (byte) 0;
for (int i = 0; i < 64; i++) {
int k;
if ((k = PC2[i]) == 0) continue;
k += Rotates[0] - 1;
if ((k % 28) < Rotates[0]) k -= 28;
k = PC1[k];
if (k > 0) {
k--;
k = (k | 0x07) - (k & 0x07);
k++;
}
perm[i] = (byte) k;
}
init_perm(PC1ROT, perm, 8);
// PC2ROT - PC2 inverse, then Rotate, then PC2
for (int j = 0; j < 2; j++) {
int k;
for (int i = 0; i < 64; i++)
perm[i] = temp[i] = 0;
for (int i = 0; i < 64; i++) {
if ((k = PC2[i]) == 0) continue;
temp[k - 1] = (byte) (i + 1);
}
for (int i = 0; i < 64; i++) {
if ((k = PC2[i]) == 0) continue;
k += j;
if ((k % 28) <= j) k -= 28;
perm[i] = temp[k];
}
init_perm(PC2ROT[j], perm, 8);
}
// Bit reverse, intial permupation, expantion
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
int k = (j < 2) ? 0 : IP[ExpandTr[i * 6 + j - 2] - 1];
if (k > 32)
k -= 32;
else if (k > 0) k--;
if (k > 0) {
k--;
k = (k | 0x07) - (k & 0x07);
k++;
}
perm[i * 8 + j] = (byte) k;
}
}
init_perm(IE3264, perm, 8);
// Compression, final permutation, bit reverse
for (int i = 0; i < 64; i++) {
int k = IP[CIFP[i] - 1];
if (k > 0) {
k--;
k = (k | 0x07) - (k & 0x07);
k++;
}
perm[k - 1] = (byte) (i + 1);
}
init_perm(CF6464, perm, 8);
// SPE table
for (int i = 0; i < 48; i++)
perm[i] = P32Tr[ExpandTr[i] - 1];
for (int t = 0; t < 8; t++) {
for (int j = 0; j < 64; j++) {
int k = (((j >> 0) & 0x01) << 5) | (((j >> 1) & 0x01) << 3)
| (((j >> 2) & 0x01) << 2)
| (((j >> 3) & 0x01) << 1)
| (((j >> 4) & 0x01) << 0)
| (((j >> 5) & 0x01) << 4);
k = S[t][k];
k = (((k >> 3) & 0x01) << 0) | (((k >> 2) & 0x01) << 1) | (((k >> 1) & 0x01) << 2) | (((k >> 0) & 0x01) << 3);
for (int i = 0; i < 32; i++)
temp[i] = 0;
for (int i = 0; i < 4; i++)
temp[4 * t + i] = (byte) ((k >> i) & 0x01);
long kk = 0;
for (int i = 24; --i >= 0; )
kk = ((kk << 1) | ((long) temp[perm[i] - 1]) << 32 | (temp[perm[i + 24] - 1]));
SPE[t][j] = to_six_bit(kk);
}
}
}
/**
* You can't call the constructer.
*/
private UnixCrypt() {
}
/**
* Returns the transposed and split code of a 24-bit code into a 4-byte
* code, each having 6 bits.
*/
private static int to_six_bit(int num) {
return (((num << 26) & 0xfc000000) | ((num << 12) & 0xfc0000) | ((num >> 2) & 0xfc00) | ((num >> 16) & 0xfc));
}
/**
* Returns the transposed and split code of two 24-bit code into two 4-byte
* code, each having 6 bits.
*/
private static long to_six_bit(long num) {
return (((num << 26) & 0xfc000000fc000000L) | ((num << 12) & 0xfc000000fc0000L) | ((num >> 2) & 0xfc000000fc00L) | ((num >> 16) & 0xfc000000fcL));
}
/**
* Returns the permutation of the given 64-bit code with the specified
* permutataion table.
*/
private static long perm6464(long c, long[][] p) {
long out = 0L;
for (int i = 8; --i >= 0; ) {
int t = (int) (0x00ff & c);
c >>= 8;
long tp = p[i << 1][t & 0x0f];
out |= tp;
tp = p[(i << 1) + 1][t >> 4];
out |= tp;
}
return out;
}
/**
* Returns the permutation of the given 32-bit code with the specified
* permutataion table.
*/
private static long perm3264(int c, long[][] p) {
long out = 0L;
for (int i = 4; --i >= 0; ) {
int t = (0x00ff & c);
c >>= 8;
long tp = p[i << 1][t & 0x0f];
out |= tp;
tp = p[(i << 1) + 1][t >> 4];
out |= tp;
}
return out;
}
/**
* Returns the key schedule for the given key.
*/
private static long[] des_setkey(long keyword) {
long K = perm6464(keyword, PC1ROT);
long[] KS = new long[16];
KS[0] = K & ~0x0303030300000000L;
for (int i = 1; i < 16; i++) {
KS[i] = K;
K = perm6464(K, PC2ROT[Rotates[i] - 1]);
KS[i] = K & ~0x0303030300000000L;
}
return KS;
}
/**
* Returns the DES encrypted code of the given word with the specified
* environment.
*/
private static long des_cipher(long in, int salt, int num_iter, long[] KS) {
salt = to_six_bit(salt);
long L = in;
long R = L;
L &= 0x5555555555555555L;
R = (R & 0xaaaaaaaa00000000L) | ((R >> 1) & 0x0000000055555555L);
L = ((((L << 1) | (L << 32)) & 0xffffffff00000000L) | ((R | (R >> 32)) & 0x00000000ffffffffL));
L = perm3264((int) (L >> 32), IE3264);
R = perm3264((int) (L & 0xffffffff), IE3264);
while (--num_iter >= 0) {
for (int loop_count = 0; loop_count < 8; loop_count++) {
long kp;
long B;
long k;
kp = KS[(loop_count << 1)];
k = ((R >> 32) ^ R) & salt & 0xffffffffL;
k |= (k << 32);
B = (k ^ R ^ kp);
L ^= (SPE[0][(int) ((B >> 58) & 0x3f)] ^ SPE[1][(int) ((B >> 50) & 0x3f)]
^ SPE[2][(int) ((B >> 42) & 0x3f)]
^ SPE[3][(int) ((B >> 34) & 0x3f)]
^ SPE[4][(int) ((B >> 26) & 0x3f)]
^ SPE[5][(int) ((B >> 18) & 0x3f)]
^ SPE[6][(int) ((B >> 10) & 0x3f)] ^ SPE[7][(int) ((B >> 2) & 0x3f)]);
kp = KS[(loop_count << 1) + 1];
k = ((L >> 32) ^ L) & salt & 0xffffffffL;
k |= (k << 32);
B = (k ^ L ^ kp);
R ^= (SPE[0][(int) ((B >> 58) & 0x3f)] ^ SPE[1][(int) ((B >> 50) & 0x3f)]
^ SPE[2][(int) ((B >> 42) & 0x3f)]
^ SPE[3][(int) ((B >> 34) & 0x3f)]
^ SPE[4][(int) ((B >> 26) & 0x3f)]
^ SPE[5][(int) ((B >> 18) & 0x3f)]
^ SPE[6][(int) ((B >> 10) & 0x3f)] ^ SPE[7][(int) ((B >> 2) & 0x3f)]);
}
// swap L and R
L ^= R;
R ^= L;
L ^= R;
}
L = ((((L >> 35) & 0x0f0f0f0fL) | (((L & 0xffffffff) << 1) & 0xf0f0f0f0L)) << 32 | (((R >> 35) & 0x0f0f0f0fL) | (((R & 0xffffffff) << 1) & 0xf0f0f0f0L)));
L = perm6464(L, CF6464);
return L;
}
/**
* Initializes the given permutation table with the mapping table.
*/
private static void init_perm(long[][] perm, byte[] p, int chars_out) {
for (int k = 0; k < chars_out * 8; k++) {
int l = p[k] - 1;
if (l < 0) continue;
int i = l >> 2;
l = 1 << (l & 0x03);
for (int j = 0; j < 16; j++) {
int s = ((k & 0x07) + ((7 - (k >> 3)) << 3));
if ((j & l) != 0x00) perm[i][j] |= (1L << s);
}
}
}
/**
* Encrypts String into crypt (Unix) code.
*
* @param key the key to be encrypted
* @param setting the salt to be used
* @return the encrypted String
*/
public static String crypt(String key, String setting) {
long constdatablock = 0L; /* encryption constant */
byte[] cryptresult = new byte[13]; /* encrypted result */
long keyword = 0L;
/* invalid parameters! */
if (key == null || setting == null) return "*"; // will NOT match under
// ANY circumstances!
int keylen = key.length();
for (int i = 0; i < 8; i++) {
keyword = (keyword << 8) | ((i < keylen) ? 2 * key.charAt(i) : 0);
}
long[] KS = des_setkey(keyword);
int salt = 0;
for (int i = 2; --i >= 0; ) {
char c = (i < setting.length()) ? setting.charAt(i) : '.';
cryptresult[i] = (byte) c;
salt = (salt << 6) | (0x00ff & A64TOI[c]);
}
long rsltblock = des_cipher(constdatablock, salt, 25, KS);
cryptresult[12] = ITOA64[(((int) rsltblock) << 2) & 0x3f];
rsltblock >>= 4;
for (int i = 12; --i >= 2; ) {
cryptresult[i] = ITOA64[((int) rsltblock) & 0x3f];
rsltblock >>= 6;
}
return new String(cryptresult, 0, 13);
}
public static void main(String[] arg) {
if (arg.length != 2) {
System.err.println("Usage - java org.eclipse.util.UnixCrypt <key> <salt>");
System.exit(1);
}
System.err.println("Crypt=" + crypt(arg[0], arg[1]));
}
}
| [
"[email protected]"
] | |
c69b33bb2597ed29eeb490f27ff00f5e2232e906 | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /test/irvine/oeis/a002/A002082Test.java | e63173bddbeea187a078a3581ae34d11c8aa814a | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package irvine.oeis.a002;
import irvine.oeis.AbstractSequenceTest;
/**
* Tests the corresponding class.
* @author Sean A. Irvine
*/
public class A002082Test extends AbstractSequenceTest {
}
| [
"[email protected]"
] | |
c4e1e082e3329c6d32733023a181ab99c0cc9c73 | 3645c2a0a6633f036b8e10b31ac72c8b85113c64 | /src/main/java/com/imooc/food/po/OrderDetailPO.java | da14b658ce892202539f20ac092bbf22fb779ab5 | [] | no_license | vleuschen/food | d56e18ec9a2d2f313d14ca6f5b59689913810ac0 | d4d0d78c0d8fd17c818bc7edd5c7eb6a5ee4731e | refs/heads/master | 2023-03-13T22:34:21.191006 | 2021-03-13T16:13:32 | 2021-03-13T16:13:32 | 347,408,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package com.imooc.food.po;
import com.imooc.food.enummeration.OrderStatusEnum;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.Date;
/**
* order_detal 表对应的Entity
*/
@Getter
@Setter
@ToString
public class OrderDetailPO {
private Integer id;
private OrderStatusEnum status;
private String address;
private Integer accountId;
private Integer productId;
private Integer deliverymanId;
private Integer settlementId;
private Integer rewardId;
private BigDecimal price;
private Date date;
} | [
"[email protected]"
] | |
99798c1bb2f8e31df7afb7f5cdb6872ca278c598 | 7224a3106edfb9ddc7d5d5d8a0a0d5a9c4b3e06f | /canalmate-api/src/main/java/com/ppdai/canalmate/api/dao/canal/server/DestinationsConfigMapper.java | ab7be22aac43b0397d91d949f7cbd9165e6c0594 | [] | no_license | waters321/canal-manager | 5acb0536c74130bcdafedb71db33d0af0b475f22 | da3db461a33f1814079a652c9abb39ecd7cdfc64 | refs/heads/master | 2020-04-11T15:20:35.488187 | 2018-12-20T04:03:47 | 2018-12-20T04:03:47 | 161,888,623 | 0 | 1 | null | 2018-12-20T04:00:18 | 2018-12-15T09:11:00 | Java | UTF-8 | Java | false | false | 894 | java | package com.ppdai.canalmate.api.dao.canal.server;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import com.ppdai.canalmate.api.model.canal.server.DestinationsConfig;
@Mapper
public interface DestinationsConfigMapper {
int deleteByPrimaryKey(Long id);
int insert(DestinationsConfig record);
int insertSelective(DestinationsConfig record);
DestinationsConfig selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DestinationsConfig record);
int updateByPrimaryKey(DestinationsConfig record);
Long selectCanalId(String canalServerName);
void deleteDestinationByDestinationName(String destinationName);
Map<String, Object> selectDestinationOldConfigByDestinationName(String destinationName);
void updateDestinationByDestinationName(DestinationsConfig record);
Map<String, Object> selectDestinationDeployInfo(String destinationName);
}
| [
"[email protected]"
] | |
c6282bd7bc0d4ab0c1bd79ff7e151c2611e46299 | 8d7cce31d9782ca53168974c155b164fefa88707 | /src/main/java/se/lexicon/model/Person.java | b96a05db22945359d6515ccd3b6186ffd1d51fb6 | [] | no_license | ReineMoberg/g34_oop-student-system | 0bce925d8506f9da616b3e2aa2239b138440c80d | 3e311300d62af30cfaa0bd911fbd493c9930e5fb | refs/heads/master | 2023-02-13T05:18:22.216589 | 2021-01-11T10:58:08 | 2021-01-11T10:58:08 | 328,714,090 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,987 | java | package se.lexicon.model;
import java.util.Objects;
// using abstract keyword : only can use for inheritance - cannot create and instance of it
public abstract class Person {
// fields
private String firstName;
private String lastName;
private int age;
private Gender gender;
// constructor
public Person() {
}
public Person(String firstName, String lastName, int age, Gender gender) {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.gender = gender;
}
// abstract method
public abstract String showInformation();
// getters/setters
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Gender getGender() {
return gender;
}
public void setGender(Gender gender) {
this.gender = gender;
}
// override methods
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Person person = (Person) o;
return age == person.age && Objects.equals(firstName, person.firstName) && Objects.equals(lastName, person.lastName) && gender == person.gender;
}
@Override
public int hashCode() {
return Objects.hash(firstName, lastName, age, gender);
}
@Override
public String toString() {
return "Person{" +
"firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", age=" + age +
", gender=" + gender +
'}';
}
}
| [
"[email protected]"
] | |
9ec3d6e7331ee16d2bcda7ee4fa77a0184fbd73c | a3a6250b107cdd064d713996496c1d29a3e6184e | /target/tomcat/work/Tomcat/localhost/_/org/apache/jsp/WEB_002dINF/view/loginPage/dlsb_jsp.java | ab8def781178e68020e57d149deab275c4abaf72 | [] | no_license | BiptPA/TheFirstMVCDemo1 | 1ce4b1dc92c1c1525aefd55cd8502c131d3d94f7 | 5406744355353cf01bc9ac9dcd68edc061d8da5d | refs/heads/master | 2022-12-25T08:27:39.770361 | 2019-05-28T12:54:53 | 2019-05-28T12:54:53 | 172,691,399 | 1 | 1 | null | 2022-12-16T09:45:10 | 2019-02-26T10:39:14 | Java | UTF-8 | Java | false | false | 7,324 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.47
* Generated at: 2019-05-27 14:01:45 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.WEB_002dINF.view.loginPage;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class dlsb_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html;charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write('\r');
out.write('\n');
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
out.write("\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf8\">\r\n");
out.write(" <title>登录失败</title>\r\n");
out.write(" <meta charset=\"utf-8\">\r\n");
out.write("\r\n");
out.write(" <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\r\n");
out.write("\r\n");
out.write(" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\r\n");
out.write("\r\n");
out.write(" <link href=\"../../../css/bootstrap.min.css\" rel=\"stylesheet\">\r\n");
out.write("\r\n");
out.write(" <script src=\"../../../js/jquery-1.9.1.js\"></script>\r\n");
out.write("\r\n");
out.write(" <script src=\"../../../js/bootstrap.min.js\"></script>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("<!--logo部分-->\r\n");
out.write("<div class=\"container\">\r\n");
out.write(" <div class=\"row\" >\r\n");
out.write(" <div class=\"col-lg-6 col-md-6 col-sm-6\">\r\n");
out.write(" <img src=\"../../../img/logo2.jpg\" width=\"160px\" height=\"80px\" />\r\n");
out.write(" </div>\r\n");
out.write(" <div align=\"right\" class=\"col-lg-6 col-md-6 col-sm-6\" style=\"padding-top: 25px;\">\r\n");
out.write("\r\n");
out.write(" </div>\r\n");
out.write(" </div>\r\n");
out.write("</div>\r\n");
out.write("\r\n");
out.write("<!--导航栏-->\r\n");
out.write("<div class=\"container\" style=\"margin-top: 10px;\">\r\n");
out.write(" <nav class=\"navbar navbar-inverse\">\r\n");
out.write(" <div class=\"container-fluid\">\r\n");
out.write(" <!-- Brand and toggle get grouped for better mobile display -->\r\n");
out.write(" <div class=\"navbar-header\">\r\n");
out.write(" <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#bs-example-navbar-collapse-1\" aria-expanded=\"false\">\r\n");
out.write(" <span class=\"sr-only\">Toggle navigation</span>\r\n");
out.write(" <span class=\"icon-bar\"></span>\r\n");
out.write(" <span class=\"icon-bar\"></span>\r\n");
out.write(" <span class=\"icon-bar\"></span>\r\n");
out.write(" </button>\r\n");
out.write(" <a class=\"navbar-brand\" href=\"/index.jsp\">首页</a>\r\n");
out.write(" </div>\r\n");
out.write("\r\n");
out.write(" <div class=\"collapse navbar-collapse\" id=\"bs-example-navbar-collapse-1\">\r\n");
out.write("\r\n");
out.write(" <form class=\"navbar-form navbar-right\" role=\"search\">\r\n");
out.write(" <div class=\"form-group\">\r\n");
out.write(" <input type=\"text\" class=\"form-control\" size=\"35\" placeholder=\"Search\">\r\n");
out.write(" </div>\r\n");
out.write(" <button type=\"submit\" class=\"btn btn-default\">搜索</button>\r\n");
out.write(" </form>\r\n");
out.write(" </div>\r\n");
out.write(" </div>\r\n");
out.write(" </nav>\r\n");
out.write("</div>\r\n");
out.write("<div class=\"container\">\r\n");
out.write("<b class=\"text-danger\" style=\"font-size: 20px;font-family: 华文楷体\">\r\n");
out.write("登录失败!请检查账号或密码出错!\r\n");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${message}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\r\n");
out.write("</b>\r\n");
out.write("<br >\r\n");
out.write("<a href=\"");
out.print(path);
out.write("/index.jsp\" rel=\"external nofollow\" style=\"text-decoration: none;font-family: 华文楷体\">返回</a>\r\n");
out.write("</div>\r\n");
out.write("</body>\r\n");
out.write("</html>\r\n");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"[email protected]"
] | |
b026786ffedf8d6d2b4ea68d0423737e01f02494 | 22423f81a1e5072de6ea2934e60ee9c383484021 | /src/uci/excutionToCallTree/Method.java | d188b4262ddf69a21f8adbf9f1ab2500adfa9423 | [] | no_license | lzccc/ExcutionTrace2CallTree | 241484bffa344f3d75be4be5bdbd4c559d07543d | 5de7d7fb189b0a88f40fb98b129da9926ba7970f | refs/heads/master | 2023-02-26T15:39:11.189293 | 2021-02-04T00:26:13 | 2021-02-04T00:26:13 | 335,791,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package uci.excutionToCallTree;
import java.util.ArrayList;
import java.util.List;
public class Method {
String name;
String className;
String id;
public Method(String name, String className, String id) {
this.name = name;
this.className = className;
this.id = id;
}
}
| [
"[email protected]"
] | |
a0f32ba89fd989ba1f8eb3364a7d4f8a84d8317f | 99b2d132a7d63ac1071f5f0efda832f98f1e22b6 | /src/controller/LogoutServlet.java | aea9a8b9bf47703593b533eaee32cde53f39e39c | [] | no_license | whale4u/ServletProject | 4fcd6ce3cfe8e4bcca14d4695ca5c3b981869314 | d4d959e1020d604856f3fd651afd785bc82bc4ec | refs/heads/master | 2022-05-09T09:32:38.159923 | 2020-04-21T14:24:10 | 2020-04-21T14:24:10 | 256,907,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,079 | java | package controller;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
@WebServlet("/logout")
public class LogoutServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
HttpSession session = req.getSession(false);
if (session == null) {
// 没登录,重定向到首页
String url = resp.encodeRedirectURL(req.getContextPath() + "/index.html");
resp.sendRedirect(url);
return;
}
// 从session中移除登录状态
//session.removeAttribute("userName");
session.invalidate();
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
}
| [
"[email protected]"
] | |
eb1388e0ae37d946bb24ada7a1eeca92637532cc | b19cd20d6f10d3c85b686481b3624c038716a8f2 | /src/main/java/com/hwj/server/core/HttpServer.java | 8d2d8898e6a920282c087484338675c15d08afdc | [] | no_license | HWJun94/HttpServer | ad1c5b14086ef7017d6bf6fa0ffbf4156e7175b2 | d93701bfc1f5ab3bb635d797857f14e4899335b4 | refs/heads/master | 2020-04-03T09:40:21.014746 | 2018-10-29T07:59:47 | 2018-10-29T07:59:47 | 155,172,661 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,055 | java | package com.hwj.server.core;
import com.hwj.server.RequestDispatcher;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import io.netty.handler.ssl.SslContext;
public class HttpServer {
private static boolean ssl;
private static SslContext sslContext;
private static String ip;
private static int serverPort;
private RequestDispatcher requestDispatcher;
//constructor
public HttpServer(RequestDispatcher rd) {
this("localhost", 8080, rd);
}
public HttpServer(String ip, int serverPort, RequestDispatcher rd) {
this(ip, serverPort, false, null, rd);
}
public HttpServer(String ip, int serverPort, boolean ssl, SslContext sslContext, RequestDispatcher rd) {
this.ip = ip;
this.serverPort = serverPort;
this.ssl = ssl;
this.sslContext = sslContext;
this.requestDispatcher = rd;
}
public void start() throws Exception {
//Configure the server
EventLoopGroup bossGroup = new NioEventLoopGroup(1);
EventLoopGroup workerGroup = new NioEventLoopGroup();
try {
ServerBootstrap boot = new ServerBootstrap();
boot.option(ChannelOption.SO_BACKLOG, 1024);
boot.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.handler(new LoggingHandler(LogLevel.INFO))
.childHandler(new HttpServerInitializer(sslContext, requestDispatcher));
Channel channel = boot.bind(ip, serverPort).sync().channel();
channel.closeFuture().sync();
} finally {
//Shutdown Gracefully
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
}
}
| [
"[email protected]"
] | |
3125936caea36d1709658ae18b7bfb7819d5a45b | 15b5c401aa32b5af7ab964ce2df7804cd1a88629 | /src/main/java/org/acme/emailservice/model/enums/ELabelRole.java | ab4903fe804128a77a0c5c92deb1d458c6c901a6 | [] | no_license | uma-email/email-service | 3eb6a6266f58003189b332032224c315847e1a2c | 14bec276f8a83c8bc430a421977c00a2ae7e981a | refs/heads/master | 2023-05-01T23:10:45.781862 | 2021-05-18T17:27:03 | 2021-05-18T17:27:03 | 335,661,641 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package org.acme.emailservice.model.enums;
public enum ELabelRole {
INBOX,
SNOOZED,
SENT,
DRAFTS,
OUTGOING,
INCOMING,
SPAM,
TRASH,
UNREAD,
STARRED,
IMPORTANT,
INVOICE,
CATEGORY_PERSONAL,
CATEGORY_SOCIAL,
CATEGORY_PROMOTIONS,
CATEGORY_UPDATES,
CATEGORY_FORUMS,
CATEGORY_BUSINESS,
CATEGORY_HEALTHCARE
}
| [
"[email protected]"
] | |
bfea5a54135e4b710d9db70aed2ae97b9f8b356b | 7ce6aa156a447e25f6c0aaf292b27a35245b73cb | /src/org/rapla/gui/internal/ConnectionOption.java | a58924e1255666feec7693223855d4638c56e9ae | [] | no_license | snadahalli/snadahalli-rapla | a1e4b5bb46b15c1a1be223a49f6872c792d6992f | 5305b50e61e9c31db602be2ef67cf1956f8ee530 | refs/heads/master | 2021-01-19T05:54:50.488074 | 2013-12-23T03:32:31 | 2013-12-23T03:32:31 | 32,133,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,954 | java | /*--------------------------------------------------------------------------*
| Copyright (C) 2006 Christopher Kohlhaas |
| |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by the |
| Free Software Foundation. A copy of the license has been included with |
| these distribution in the COPYING file, if not go to www.fsf.org |
| |
| As a special exception, you are granted the permissions to link this |
| program with every library, which license fulfills the Open Source |
| Definition as published by the Open Source Initiative (OSI). |
*--------------------------------------------------------------------------*/
package org.rapla.gui.internal;
import java.util.Locale;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.rapla.components.calendar.RaplaNumber;
import org.rapla.components.layout.TableLayout;
import org.rapla.entities.configuration.Preferences;
import org.rapla.facade.UpdateModule;
import org.rapla.framework.RaplaContext;
import org.rapla.framework.RaplaException;
import org.rapla.gui.OptionPanel;
import org.rapla.gui.RaplaGUIComponent;
public class ConnectionOption extends RaplaGUIComponent implements OptionPanel {
JPanel panel = new JPanel();
RaplaNumber seconds = new RaplaNumber(new Double(10),new Double(10),null, false);
Preferences preferences;
public ConnectionOption(RaplaContext sm) {
super( sm);
seconds.getNumberField().setBlockStepSize( 60);
seconds.getNumberField().setStepSize( 10);
double pre = TableLayout.PREFERRED;
double fill = TableLayout.FILL;
panel.setLayout( new TableLayout(new double[][] {{pre, 5, pre,5, pre}, {pre,fill}}));
panel.add( new JLabel(getString("refresh") + ": " + getI18n().format("interval.format", "","")),"0,0" );
panel.add( seconds,"2,0");
panel.add( new JLabel(getString("seconds")),"4,0" );
addCopyPaste( seconds.getNumberField());
}
public JComponent getComponent() {
return panel;
}
public String getName(Locale locale) {
return getString("connection");
}
public void setPreferences( Preferences preferences) {
this.preferences = preferences;
}
public void show() throws RaplaException {
int delay = preferences.getEntryAsInteger( UpdateModule.REFRESH_INTERVAL_ENTRY, UpdateModule.REFRESH_INTERVAL_DEFAULT);
seconds.setNumber( new Long(delay / 1000));
}
public void commit() {
int delay = seconds.getNumber().intValue() * 1000;
preferences.putEntry( UpdateModule.REFRESH_INTERVAL_ENTRY, delay );
}
}
| [
"[email protected]@f78d5ace-84b9-81af-d60f-742a6fa3a8cb"
] | [email protected]@f78d5ace-84b9-81af-d60f-742a6fa3a8cb |
87134b15502d8cde705e388bc3950bd90ddb4d0e | 715408827dd135d21458b0d2c5f570769bc5601e | /app/src/main/java/world/Regiment.java | 5f9616bc7801cccfd0d72a9746e545391b5ed551 | [] | no_license | julkk-a-project/Bolshevism-in-the-horisont | 5d55b587b7d77b22426fc2a8dbb591ff84d37387 | fc3af41755d503a0b584ee4259a28843ed686b6d | refs/heads/master | 2023-04-01T08:45:15.994411 | 2023-03-16T18:56:44 | 2023-03-16T18:56:44 | 162,921,404 | 0 | 0 | null | 2022-12-13T18:29:50 | 2018-12-23T20:21:07 | Java | UTF-8 | Java | false | false | 2,510 | java | package world;
public class Regiment {
private String name;
private final char shortName;
private Nation nation;
private double organization = 1;
private double manpower = 1000;
private double discipline = 1;
private double tactics = 1;
private int range = 1;
private int desiredRange = 1;
private int speed = 1;
private int distFront = 0;
private int distSide = 0;
private boolean backrow = false;
//testing
public int distTEST = 0;
public int numTarg = 0;
@Override
public String toString(){
return name;
}
public Regiment(String name, int range, int speed, double disciplinen, double tactics, boolean backrow) {
this.name = name;
this.shortName = name.charAt(0);
this.range = range;
desiredRange = range;
this.speed = speed;
this.discipline = disciplinen;
this.tactics = tactics;
this.backrow = backrow;
}
public char getShortName() {
return shortName;
}
public void setName(String newName){
this.name = newName;
}
public String getName() {
return name;
}
public static int distance(Regiment shooter, Regiment shootee) {
int dist = shooter.getDistFront() + shootee.getDistFront();
int aux = Math.abs(shooter.getDistSide() - shootee.getDistSide());
return dist+aux;
}
public void move(){
distFront = distFront-speed;
}
public void setDistFront(int distFront) {
this.distFront = distFront;
}
public void setDistSide(int distSide) {
this.distSide = distSide;
}
public int getDistFront() {
return distFront;
}
public int getDistSide() {
return distSide;
}
public double attack(){
return discipline*organization*manpower/10;//*Math.random();
}
public void damage(double damage){
damage = damage*(2-tactics);
manpower = manpower-damage;
organization = organization-(damage/1000);
}
public double getManpower() {
return manpower;
}
public double getOrganization() {
return organization;
}
public int getDesiredRange() {
return desiredRange;
}
public int getRange() {
return range;
}
public int getSpeed() {
return speed;
}
public Nation getNation() {
return nation;
}
public boolean getBackrow() {
return backrow;
}
}
| [
"[email protected]"
] | |
43ffa45e53be88b99f44c6b380dd1aeaa294a284 | 8a59fc6208231e2d7843e523cfdc9a3a362813b4 | /org.caleydo.view.stratomex/src/org/caleydo/view/stratomex/brick/IContextMenuBrickFactory.java | 770c6ce43b4ec0f3270b5c8d4fd5f4518e06074b | [] | no_license | Caleydo/caleydo | 17c51b10a465512a0c077e680da648d9a6061136 | c2f1433baf5bd2c0c5bea8c0990d67e946ed5412 | refs/heads/develop | 2020-04-07T06:26:03.464510 | 2016-12-15T17:07:08 | 2016-12-15T17:07:08 | 9,451,506 | 37 | 11 | null | 2016-12-15T17:07:08 | 2013-04-15T15:13:38 | Java | UTF-8 | Java | false | false | 1,075 | java | /*******************************************************************************
* Caleydo - Visualization for Molecular Biology - http://caleydo.org
* Copyright (c) The Caleydo Team. All rights reserved.
* Licensed under the new BSD license, available at http://caleydo.org/license
******************************************************************************/
package org.caleydo.view.stratomex.brick;
import org.caleydo.core.data.perspective.table.TablePerspective;
import org.caleydo.core.view.contextmenu.AContextMenuItem;
import org.caleydo.view.stratomex.column.BrickColumn;
/**
* extension point interface for creating context menu entries for the gl brick used for triggering scoring
*
* @author Samuel Gratzl
*
*/
public interface IContextMenuBrickFactory {
public static final String EXTENSION_ID = "org.caleydo.view.stratomex.brick.contextmenu";
public Iterable<AContextMenuItem> createGroupEntries(BrickColumn referenceColumn, TablePerspective groupTable);
public Iterable<AContextMenuItem> createStratification(BrickColumn referenceColumn);
}
| [
"[email protected]"
] | |
19da6b563b7b53836819a344c8b4d336b43aee0d | dd3b5e0bc87e9e1ae061a45a3ead6dbd59543329 | /src/main/java/com/learning/automic/WrongWayToAdd.java | cc91cab3a1f96f0df50fd7d777a70c0ce064f147 | [] | no_license | angrylittlebird/juc | d2ae43a0ca21297d2a5e30efde5900222196d880 | c9db3b9b36bb8930f26c6627b6379d287df25a3d | refs/heads/master | 2023-05-24T06:07:00.723566 | 2023-05-18T14:11:45 | 2023-05-18T14:11:45 | 239,099,068 | 0 | 0 | null | 2020-10-13T19:46:10 | 2020-02-08T09:16:29 | Java | UTF-8 | Java | false | false | 725 | java | package com.learning.automic;
import org.junit.Assert;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @Author: ZHANG
* @Date: 2020/2/27
* @Description: 演示 a++ 方法为非原子性操作
*/
public class WrongWayToAdd {
private static volatile int a;
public static void main(String[] args) {
int count = 100000;
ExecutorService executorService = Executors.newFixedThreadPool(10);
for (int i = 0; i < count; i++) {
executorService.execute(() -> a++);
}
executorService.shutdown();
while (!executorService.isTerminated()) ;
Assert.assertTrue(a < count);
System.out.println(a);
}
}
| [
"[email protected]"
] | |
c252d9d0d6c1bcf4edd8c1f53a39f4e0399b7c1b | 8d8ffbe7d835dc15a9b92bdd0c7b9a1417af2524 | /app/src/main/java/com/tohier/cartercoin/activity/ReceivablesActivity.java | 6fd4824a3db4dc53180284795b0028e2d43c7f61 | [] | no_license | OnClickListener2048/ctc_and_v9 | 6e53eb7baee87b1a7ed75326efbbe2db36760da7 | e757f1962ba8052ae0a753fc3e16ff2578f93c9b | refs/heads/master | 2021-07-11T12:27:55.022279 | 2017-10-11T16:25:17 | 2017-10-11T16:25:17 | 106,579,730 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,923 | java | package com.tohier.cartercoin.activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.BitmapImageViewTarget;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import com.tohier.cartercoin.R;
import com.tohier.cartercoin.config.HttpConnect;
import com.tohier.cartercoin.config.LoginUser;
import net.sf.json.JSONObject;
import java.io.IOException;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* Created by Administrator on 2016/12/21.
*/
public class ReceivablesActivity extends MyBackBaseActivity {
private ImageView ivBack,iv_member_level_icon,iv_bill_erweima;
private TextView tvBill,tv_member_level_msg,tv_member_name;
private LinearLayout linearLayout_into_capture;
private CircleImageView circleImageView;
private View.OnClickListener onClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId())
{
case R.id.iv_back2:
finish();
break;
case R.id.tv_bill:
startActivity(new Intent(ReceivablesActivity.this,BillListActivity.class));
break;
case R.id.linearLayout_into_capture:
startActivityForResult(new Intent(ReceivablesActivity.this, CaptureActivity.class), 0);
break;
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_receivables_layout);
initData();
setUpView();
loadWolletAddress();
// SliderConfig mConfig = new SliderConfig.Builder()
// .primaryColor(Color.TRANSPARENT)
// .secondaryColor(Color.TRANSPARENT)
// .position(SliderPosition.LEFT)
// .edge(false)
// .build();
//
// ISlider iSlider = SliderUtils.attachActivity(this, mConfig);
// mConfig.setPosition(SliderPosition.LEFT);
// iSlider.setConfig(mConfig);
}
@Override
public void initData() {
ivBack = (ImageView) this.findViewById(R.id.iv_back2);
circleImageView = (CircleImageView) this.findViewById(R.id.iv_member_head_img);
iv_member_level_icon = (ImageView) this.findViewById(R.id.iv_member_level_icon);
iv_bill_erweima = (ImageView) this.findViewById(R.id.iv_bill_erweima);
tvBill = (TextView) this.findViewById(R.id.tv_bill);
tv_member_level_msg = (TextView) this.findViewById(R.id.tv_member_level_msg);
tv_member_name = (TextView) this.findViewById(R.id.tv_member_name);
linearLayout_into_capture = (LinearLayout) this.findViewById(R.id.linearLayout_into_capture);
if(!TextUtils.isEmpty(LoginUser.getInstantiation(getApplicationContext()).getLoginUser().getType()))
{
if(LoginUser.getInstantiation(getApplicationContext()).getLoginUser().getType().equals("10"))
{
tv_member_level_msg.setText("注册会员");
iv_member_level_icon.setImageResource(R.mipmap.putong);
}else if(LoginUser.getInstantiation(getApplicationContext()).getLoginUser().getType().equals("20"))
{
tv_member_level_msg.setText("铂金会员");
iv_member_level_icon.setImageResource(R.mipmap.baijin);
}else if(LoginUser.getInstantiation(getApplicationContext()).getLoginUser().getType().equals("30"))
{
tv_member_level_msg.setText("钻石会员");
iv_member_level_icon.setImageResource(R.mipmap.zhuanshi);
}else if(LoginUser.getInstantiation(getApplicationContext()).getLoginUser().getType().equals("40"))
{
tv_member_level_msg.setText("皇冠会员");
iv_member_level_icon.setImageResource(R.mipmap.huangguan);
}
}
String name = LoginUser.getInstantiation(getApplicationContext()).getLoginUser().getNickName();
if(!TextUtils.isEmpty(name)&&!name.equals("")) {
tv_member_name.setText(name);
}
String headUrl = LoginUser.getInstantiation(getApplicationContext()).getLoginUser().getHeadUrl();
if(!TextUtils.isEmpty(headUrl)&&!headUrl.equals("")) {
Glide.with(this).load(headUrl).asBitmap().centerCrop().into(new BitmapImageViewTarget(circleImageView) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(getResources(), resource);
circularBitmapDrawable.setCircular(true);
circleImageView.setImageDrawable(circularBitmapDrawable);
}
});
}
}
private void setUpView() {
ivBack.setOnClickListener(onClickListener);
tvBill.setOnClickListener(onClickListener);
linearLayout_into_capture.setOnClickListener(onClickListener);
}
private void loadWolletAddress() {
HttpConnect.post(this, "member_collection_qr", null, new Callback() {
@Override
public void onResponse(Response arg0) throws IOException {
JSONObject data = JSONObject.fromObject(arg0.body().string());
if (data.get("status").equals("success")) {
if (data.getJSONArray("data").getJSONObject(0)
.getString("address") != null) {
final String address = data.getJSONArray("data")
.getJSONObject(0).getString("address");
Handler dataHandler = new Handler(
getContext().getMainLooper()) {
@Override
public void handleMessage(
final Message msg)
{
Bitmap bitmap = createCode(address);
iv_bill_erweima.setImageBitmap(bitmap);
}
};
dataHandler.sendEmptyMessage(0);
}
} else {
// sToast(data.getString("msg"));
}
}
@Override
public void onFailure(Request arg0, IOException arg1) {
// sToast("链接超时!");
}
});
}
private Bitmap bitMatrix2Bitmap(BitMatrix matrix) {
int w = matrix.getWidth();
int h = matrix.getHeight();
int[] rawData = new int[w * h];
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
int color = Color.WHITE;
if (matrix.get(i, j)) {
color = Color.BLACK;
}
rawData[i + (j * w)] = color;
}
}
Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.RGB_565);
bitmap.setPixels(rawData, 0, w, 0, 0, w, h);
return bitmap;
}
private Bitmap createCode(String url) {
int width = 180;
int height = 180;
Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
hints.put(EncodeHintType.MARGIN, 0);
BitMatrix bitMatrix;
try {
QRCodeWriter writer = new QRCodeWriter();
bitMatrix = writer.encode(url,// id
BarcodeFormat.QR_CODE, width, height, hints);
return bitMatrix2Bitmap(bitMatrix);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == 0) {
String scanResult = data.getStringExtra(CaptureActivity.EXTRA_RESULT);
if (scanResult != null && scanResult.length() > 0) {
thisPersonExist(scanResult);
// startActivity(new Intent(ReceivablesActivity.this,PayMoneyActivity.class));
}
}
}
}
/**
* 验证付款人是否存在
*/
public void thisPersonExist(final String linkcode)
{
Map<String, String> par = new HashMap<String, String>();
par.put("linkcode", linkcode);
HttpConnect.post(this, "member_payment_val", par, new Callback() {
@Override
public void onResponse(Response arg0) throws IOException {
final JSONObject data = JSONObject.fromObject(arg0.body().string());
if (data.get("status").equals("success"))
{
Handler dataHandler = new Handler(
getContext().getMainLooper()) {
@Override
public void handleMessage(
final Message msg)
{
final String pic = data.getJSONArray("data").getJSONObject(0).getString("Pic");
final String name = data.getJSONArray("data").getJSONObject(0).getString("Name");
final String nickname = data.getJSONArray("data").getJSONObject(0).getString("Nickname");
Intent intent = new Intent(ReceivablesActivity.this,PayMoneyActivity.class);
intent.putExtra("pic",pic);
intent.putExtra("nickname",nickname);
intent.putExtra("linkcode",linkcode);
startActivity(intent);
}
};
dataHandler.sendEmptyMessage(0);
} else
{
Handler dataHandler = new Handler(
getContext().getMainLooper()) {
@Override
public void handleMessage(
final Message msg)
{
sToast("请提供正确的二维码以便扫描");
}
};
dataHandler.sendEmptyMessage(0);
}
}
@Override
public void onFailure(Request arg0, IOException arg1)
{
// sToast("链接超时!");
}
});
}
}
| [
"[email protected]"
] | |
e3a7a9702bc83eee039fc595e281f1ebf7281399 | adbc858b0dccc819942ff98fbfec6e4d6de04ea2 | /Learning/src/basic/jdk8/MyConsumerDemo.java | 39afdcbe389c30fc45f3c1ec3835ccaae38a6031 | [] | no_license | Naturer/data-structure-and-algorithm | 18e1459480ea22c37e00be0668c1717cbc53bc6c | 0941e472dc087a4481f638168a4f82c43c24f01e | refs/heads/master | 2023-02-07T05:02:36.882410 | 2020-12-31T01:06:48 | 2020-12-31T01:06:48 | 256,197,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package basic.jdk8;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
public class MyConsumerDemo {
public static void foreach(List<String> list, Consumer consumer){
list.forEach(consumer);
}
public static void main(String[] args) {
String[] array = {"hello", "world", "I", "love", "you", "!"};
List<String> list = Arrays.asList(array);
foreach(list, System.out::println);
list.forEach(System.out::print);
}
}
| [
"[email protected]"
] | |
e8b1154ef45ae3dc3795a467ec32d3d23bb75057 | a0ac0c37201059354221d115b4383a5a6e7bc997 | /BurgerKing/src/main/java/com/burger/event/model/NStoreDAO.java | 8ec9b741157bcd2b0603200fda09b18035aac3a9 | [] | no_license | hyeeerin/BurgerKing | c04cb63c93e747a7a31ce904c6ecd0db4c717fc0 | 7873683ce439bc6cf0d84a94931afc291a6d8f51 | refs/heads/main | 2023-06-30T01:43:43.171353 | 2021-08-03T06:54:06 | 2021-08-03T06:54:06 | 391,600,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 946 | java | package com.burger.event.model;
import java.util.List;
import com.burger.cs.model.PageDTO;
public interface NStoreDAO {
public int getListCount(); // 전체 게시물 수를 확인하는 메서드.
public List<NStoreDTO> getStoreList(PageDTO dto); // 전체 리스트를 호출 추상메서드.
public int insertStore(NStoreDTO dto); // 게시물 추가 호출 추상메서드.
public void readCount(int no); // 조회수를 증가시키는 추상메서드.
public NStoreDTO storeCont(int no); // 게시물 상세 내역 호출 추상메서드.
public int updateStore(NStoreDTO dto); // 게시물 수정 호출 추상메서드.
public int deleteStore(int no); // 게시물 삭제 호출 추상메서드.
public void reSequence(int no); // 삭제 시 게시물 번호 재작업 추상메서드.
}
| [
"[email protected]"
] | |
995f57d8ccd599996a2139996c34e4aec1fdeda1 | 4f130583045aab4ab1761b314117478340ca998d | /src/ArtistGetTag.java | 0a7ab690d55991f239140816f75c708f97c66802 | [] | no_license | Mengxue/IntellIO-2 | 8c1aad6713905e03803751b9134406b50e24d6a7 | 7b88d3bbe2909b82c841b0a5d95e72d066cd1bfc | refs/heads/master | 2020-06-04T14:24:04.699153 | 2013-05-02T22:50:12 | 2013-05-02T22:50:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,625 | java | import java.util.List;
public class ArtistGetTag {
private String artist_name;
private TopTags toptags;
private double score;
public ArtistGetTag()
{
super();
}
public ArtistGetTag(String artist_name, TopTags toptags) {
this.toptags = toptags;
this.artist_name = artist_name;
}
//-------------------getter and setter-------------------//
public String getArtist_name() {
return artist_name;
}
public void setArtist_name(String artist_name) {
this.artist_name = artist_name;
}
public TopTags getToptags() {
return toptags;
}
public void setToptags(TopTags toptags) {
this.toptags = toptags;
}
public double getScore() {
return score;
}
public void setScore(double score) {
this.score = score;
}
//-------------------Additional Functions-----------------//
//clean the tag list to make sure all tags have count>0
public void getUsefulTags()
{
List<Tag> alltags = this.toptags.getTags();
int usefultags = 0;
for(ArtistGetTag.Tag eachtag:alltags)
{
int tag_count = eachtag.getCount();
if(tag_count<=0)
break;
usefultags++;
}
alltags = alltags.subList(0, usefultags);
this.toptags.setTags(alltags);
}
//get all path from artist to its own
public int totalPath()
{
int score = 0;
List<Tag> tags= this.getToptags().getTags();
for(Tag tag: tags)
{
score = score + tag.getCount()*tag.getCount();
}
return score;
}
//get count of a particular tag
public Tag getTagCount(Tag tag)
{
List<Tag> tags = this.getToptags().getTags();
for(Tag eachtag: tags)
{
if(eachtag.getName().equals(tag.getName()))
return eachtag;
}
return null;
}
//--------------------TopTags Class---------------------//
public class TopTags
{
private List<Tag> tag;
public TopTags(List<Tag> tags)
{
this.tag = tags;
}
public List<Tag> getTags() {
return tag;
}
public void setTags(List<Tag> tags) {
this.tag = tags;
}
}
//---------------------Tag Class-----------------------//
public class Tag
{
private String name;
private int count;
private String url;
public Tag(String name, int count, String url)
{
this.name = name;
this.count =count;
this.url = url;
}
public Tag()
{
super();
}
//-------------------getter and setter-----------------//
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
}
| [
"[email protected]"
] | |
4828fbe0bc9b4dd71ea1da02afc1e22b0378eab8 | 6ada090d9654721ad8f61f7119d18595925c72e3 | /src/org/engine/graph/InstancedMesh.java | b941feef14bd8a86ed400c21928527e4e974ade6 | [] | no_license | Ajikozau/MirajiEngineLWJGL | a456dc53b90e5db97086328582835b34a39a7f64 | 1b7ada52692c0d34682c0b05a57c0e7869a80b29 | refs/heads/master | 2021-01-11T16:39:42.746426 | 2017-03-04T10:53:29 | 2017-03-04T10:53:29 | 80,134,008 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,006 | java | package org.engine.graph;
import java.nio.FloatBuffer;
import java.util.List;
import org.joml.Matrix4f;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL15.*;
import static org.lwjgl.opengl.GL20.*;
import static org.lwjgl.opengl.GL30.*;
import static org.lwjgl.opengl.GL31.*;
import static org.lwjgl.opengl.GL33.*;
import org.lwjgl.system.MemoryUtil;
import org.engine.elements.GameElement;
public class InstancedMesh extends Mesh {
private static final int FLOAT_SIZE_BYTES = 4;
private static final int VECTOR4F_SIZE_BYTES = 4 * FLOAT_SIZE_BYTES;
private static final int MATRIX_SIZE_FLOATS = 4 * 4;
private static final int MATRIX_SIZE_BYTES = MATRIX_SIZE_FLOATS * FLOAT_SIZE_BYTES;
private static final int INSTANCE_SIZE_BYTES = MATRIX_SIZE_BYTES * 2 + FLOAT_SIZE_BYTES * 2;
private static final int INSTANCE_SIZE_FLOATS = MATRIX_SIZE_FLOATS * 2 + 2;
private final int numInstances;
private final int instanceDataVBO;
private FloatBuffer instanceDataBuffer;
public InstancedMesh(float[] positions, float[] textCoords, float[] normals, int[] indices, int numInstances, float[] bounds) {
super(positions, textCoords, normals, indices, createEmptyIntArray(MAX_WEIGHTS * positions.length / 3, 0), createEmptyFloatArray(MAX_WEIGHTS * positions.length / 3, 0), bounds);
this.numInstances = numInstances;
glBindVertexArray(vaoId);
// Model View Matrix
instanceDataVBO = glGenBuffers();
vboIdList.add(instanceDataVBO);
instanceDataBuffer = MemoryUtil.memAllocFloat(numInstances * INSTANCE_SIZE_FLOATS);
glBindBuffer(GL_ARRAY_BUFFER, instanceDataVBO);
int start = 5;
int strideStart = 0;
for (int i = 0; i < 4; i++) {
glVertexAttribPointer(start, 4, GL_FLOAT, false, INSTANCE_SIZE_BYTES, strideStart);
glVertexAttribDivisor(start, 1);
start++;
strideStart += VECTOR4F_SIZE_BYTES;
}
// Light view matrix
for (int i = 0; i < 4; i++) {
glVertexAttribPointer(start, 4, GL_FLOAT, false, INSTANCE_SIZE_BYTES, strideStart);
glVertexAttribDivisor(start, 1);
start++;
strideStart += VECTOR4F_SIZE_BYTES;
}
// Texture offsets
glVertexAttribPointer(start, 2, GL_FLOAT, false, INSTANCE_SIZE_BYTES, strideStart);
glVertexAttribDivisor(start, 1);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
}
@Override
public void cleanUp() {
super.cleanUp();
if (this.instanceDataBuffer != null) {
MemoryUtil.memFree(this.instanceDataBuffer);
this.instanceDataBuffer = null;
}
}
@Override
protected void initRender() {
super.initRender();
int start = 5;
int numElements = 4 * 2 + 1;
for (int i = 0; i < numElements; i++) {
glEnableVertexAttribArray(start + i);
}
}
@Override
protected void endRender() {
int start = 5;
int numElements = 4 * 2 + 1;
for (int i = 0; i < numElements; i++) {
glDisableVertexAttribArray(start + i);
}
super.endRender();
}
public void renderListInstanced(List<GameElement> gameItems, Transformation transformation, Matrix4f viewMatrix, Matrix4f lightViewMatrix) {
renderListInstanced(gameItems, false, transformation, viewMatrix, lightViewMatrix);
}
public void renderListInstanced(List<GameElement> gameItems, boolean billBoard, Transformation transformation, Matrix4f viewMatrix, Matrix4f lightViewMatrix) {
initRender();
int chunkSize = numInstances;
int length = gameItems.size();
for (int i = 0; i < length; i += chunkSize) {
int end = Math.min(length, i + chunkSize);
List<GameElement> subList = gameItems.subList(i, end);
renderChunkInstanced(subList, billBoard, transformation, viewMatrix, lightViewMatrix);
}
endRender();
}
private void renderChunkInstanced(List<GameElement> gameItems, boolean billBoard, Transformation transformation, Matrix4f viewMatrix, Matrix4f lightViewMatrix) {
this.instanceDataBuffer.clear();
int i = 0;
Texture text = getMaterial().getTexture();
for (GameElement gameItem : gameItems) {
Matrix4f modelMatrix = transformation.buildModelMatrix(gameItem);
if (viewMatrix != null) {
if (billBoard) {
viewMatrix.transpose3x3(modelMatrix);
}
Matrix4f modelViewMatrix = transformation.buildModelViewMatrix(modelMatrix, viewMatrix);
modelViewMatrix.get(INSTANCE_SIZE_FLOATS * i, instanceDataBuffer);
}
if (lightViewMatrix != null) {
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
modelLightViewMatrix.get(INSTANCE_SIZE_FLOATS * i + MATRIX_SIZE_FLOATS, this.instanceDataBuffer);
}
if (text != null) {
int col = gameItem.getTextPos() % text.getNumCols();
int row = gameItem.getTextPos() / text.getNumCols();
float textXOffset = (float) col / text.getNumCols();
float textYOffset = (float) row / text.getNumRows();
int buffPos = INSTANCE_SIZE_FLOATS * i + MATRIX_SIZE_FLOATS * 2;
this.instanceDataBuffer.put(buffPos, textXOffset);
this.instanceDataBuffer.put(buffPos + 1, textYOffset);
}
i++;
}
glBindBuffer(GL_ARRAY_BUFFER, instanceDataVBO);
glBufferData(GL_ARRAY_BUFFER, instanceDataBuffer, GL_DYNAMIC_DRAW);
glDrawElementsInstanced(
GL_TRIANGLES, getVertexCount(), GL_UNSIGNED_INT, 0, gameItems.size());
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
}
| [
"[email protected]"
] | |
beb8e3f9924e17b545d9f2c58872e81fdee2ee97 | 399351f815f652622599f3c254c1f7f3d7a4691d | /src/main/java/com/flamingos/osp/dto/ConfigParamDTO.java | e2ee9f9cddad449a5d270e3da9c165fa4958fef2 | [] | no_license | mrinmoy1000/osp | 0f423f70af731da639b577dfa1a5befab3206c3b | 4b7eebb685926fe2717aa0ac37f427dee5aaa2fc | refs/heads/master | 2021-01-10T06:47:48.014387 | 2018-06-01T09:54:46 | 2018-06-01T09:54:46 | 48,763,333 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | package com.flamingos.osp.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
public class ConfigParamDTO {
private int parameterid;
@JsonIgnore
private String code;
@JsonIgnore
private String name;
private String value;
@JsonIgnore
private String description;
public int getParameterid() {
return parameterid;
}
public void setParameterid(int parameterid) {
this.parameterid = parameterid;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"[email protected]"
] | |
0a6e60ca5f7aee39a8276c5eeeafc2738beee924 | 39a80fd0892834f17fcdc7caf15dc0f933896a1a | /JAVA/Laboratorio IV/SegundoParcial/src/MODELO/DetalleVenta.java | 58b2832c416850492207a339b1e8dc59405815cc | [] | no_license | PauloL89/Mis_Trabajos | db3f99d9bae70bc807baab6b96614956e474d77e | 4325d4b5b2150ca8733208cbf8d83abf4ac4ef9a | refs/heads/master | 2023-06-29T02:34:08.195360 | 2021-08-05T23:49:06 | 2021-08-05T23:49:06 | 323,385,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,065 | java |
package MODELO;
public class DetalleVenta
{
private Venta venta;
private Articulo articulo;
private float precioUnitario;
public DetalleVenta(Venta venta, Articulo articulo, float precioUnitario)
{
this.venta = venta;
this.articulo = articulo;
this.precioUnitario = precioUnitario;
}
public Venta getVenta()
{
return venta;
}
public void setVenta(Venta venta)
{
this.venta = venta;
}
public Articulo getArticulo()
{
return articulo;
}
public void setArticulo(Articulo articulo)
{
this.articulo = articulo;
}
public float getPrecioUnitario()
{
return precioUnitario;
}
public void setPrecioUnitario(float precioUnitario)
{
this.precioUnitario = precioUnitario;
}
@Override
public String toString()
{
return "venta: " + venta
+ "\n articulo: " + articulo
+ "\n precio Unitario: " + precioUnitario;
}
}
| [
"[email protected]"
] | |
0b743b07053b842ef9c7dc25a1219059306081e3 | 6599e66f0d7e5829f66f74d25228dc320ab6e12b | /photos-web/src/main/java/ru/systemoteh/photos/web/util/RoutingUtils.java | fbd3fbf865319a0822011c8f71278934a48eacf9 | [] | no_license | systemoteh/photos | 5d8d8068386a40f87eb79ed50ae3cb95654ab808 | c118a8736bfccb99b2e2afdb24c05edeab081061 | refs/heads/master | 2021-06-15T11:15:37.924332 | 2020-05-13T17:19:58 | 2020-05-13T17:19:58 | 189,717,907 | 0 | 0 | null | 2021-04-26T19:19:47 | 2019-06-01T10:07:48 | JavaScript | UTF-8 | Java | false | false | 1,841 | java | package ru.systemoteh.photos.web.util;
import javax.json.JsonObject;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
public class RoutingUtils {
public static void forwardToPage(String pageName, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setAttribute("currentPage", String.format("../view/%s.jsp", pageName));
request.getRequestDispatcher("/WEB-INF/template/page-template.jsp").forward(request, response);
}
public static void forwardToFragment(String fragmentName, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getRequestDispatcher(String.format("/WEB-INF/fragment/%s.jsp", fragmentName)).forward(request, response);
}
public static void redirectToUrl(String url, HttpServletRequest request, HttpServletResponse response) throws IOException {
response.sendRedirect(url);
}
public static void sendJson(JsonObject json, HttpServletRequest request, HttpServletResponse response) throws IOException {
sendJson("application/json", json, request, response);
}
private static void sendJson(String contentType, JsonObject json, HttpServletRequest request, HttpServletResponse response) throws IOException {
String content = json.toString();
int length = content.getBytes(StandardCharsets.UTF_8).length;
response.setContentType(contentType);
response.setContentLength(length);
try (Writer wr = response.getWriter()) {
wr.write(content);
wr.flush();
}
}
private RoutingUtils() {
}
}
| [
"[email protected]"
] | |
a3824ed032589453a8eec128c36740840de3357a | f041f0f8bcdf45936c37e445b43d9e26ddada5f7 | /MiniCluedo.java | 7ec42c97933a685b1bcd0361ccf62684dfa8bdc2 | [] | no_license | adolfopalma/miniCluedo | a7446452ecddc51a67b22e40c03a97457a359bfe | 90a5d4b56945e45f8f59e7590335b0f530b920c3 | refs/heads/master | 2023-02-16T16:26:34.740640 | 2021-01-19T19:21:38 | 2021-01-19T19:21:38 | 331,066,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,343 | java | import java.util.*;
public class MiniCluedo {
public static void main(String[] args) throws Exception {
String armas[] = new String[5];
String habitaciones[] = new String[6];
String personajes[] = new String[8];
String combinacionSecreta[] = new String[3];
boolean esElArma = false;
boolean esLaHabitacion = false;
boolean esElPersonaje = false;
Scanner entrada = new Scanner(System.in);
String respuesta;
armas[0] = "Pistola";
armas[1] = "Cuchillo";
armas[2] = "Herramienta";
armas[3] = "Candelabro";
armas[4] = "Lapiz";
habitaciones[0] = "Salon de baile";
habitaciones[1] = "Cocina";
habitaciones[2] = "Aseo";
habitaciones[3] = "Despacho";
habitaciones[4] = "Dormitorio";
habitaciones[5] = "Salon de billar";
personajes[0] = "Adolfo";
personajes[1] = "Sergio";
personajes[2] = "Ines";
personajes[3] = "Feli";
personajes[4] = "Pablo";
personajes[5] = "Adriana";
personajes[6] = "Leire";
personajes[7] = "Uriel";
combinacionSecreta[0] = armas[(int) (Math.random() * 5)];
combinacionSecreta[1] = habitaciones[(int) (Math.random() * 6)];
combinacionSecreta[2] = personajes[(int) (Math.random() * 8)];
System.out.println(Arrays.toString(combinacionSecreta));
while (esElArma == false) {
System.out.println("Adivina el arma, aun no has dicho las siguientes:");
System.out.println(Arrays.toString(armas));
respuesta = entrada.nextLine();
if (respuesta.equals(combinacionSecreta[0])) {
System.out.println("Has acertado");
esElArma = true;
} else {
for (int i = 0; i < armas.length; i++) {
if (respuesta.equals(armas[i])) {
armas[i] = "X";
}
}
}
}
while (esLaHabitacion == false) {
System.out.println("Adivina la habitacion, aun no has dicho las siguientes:");
System.out.println(Arrays.toString(habitaciones));
respuesta = entrada.nextLine();
if (respuesta.equals(combinacionSecreta[1])) {
System.out.println("Has acertado");
esLaHabitacion = true;
} else {
for (int i = 0; i < habitaciones.length; i++) {
if (respuesta.equals(habitaciones[i])) {
habitaciones[i] = "X";
}
}
}
}
while (esElPersonaje == false) {
System.out.println("Adivina el asesino, aun no has dicho los siguientes:");
System.out.println(Arrays.toString(personajes));
respuesta = entrada.nextLine();
if (respuesta.equals(combinacionSecreta[2])) {
System.out.println("Has acertado y ganado el juego !!!!!!!!!");
esElPersonaje = true;
} else {
for (int i = 0; i < personajes.length; i++) {
if (respuesta.equals(personajes[i])) {
personajes[i] = "X";
}
}
}
}
}
} | [
"[email protected]"
] | |
c610d86ac957abb39862120bce63f7f3e7b9fc9e | 120ab8e14a5ad0913f6dd9eaef18f3df7dbf0060 | /Realm/app/src/main/java/com/example/realm/App.java | 8e76c9d94cf94b412094781a72fb39509172beed | [] | no_license | abhipandey09/AndroidAssingment | b90741029bf6d854a16a7cdd5fcaae60b4098952 | d600e660723f3fb4927262111568a57321c79689 | refs/heads/master | 2020-06-16T01:06:02.127903 | 2019-07-05T17:20:37 | 2019-07-05T17:20:37 | 195,439,988 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 228 | java | package com.example.realm;
import android.app.Application;
import io.realm.Realm;
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
Realm.init(this);
}
}
| [
"[email protected]"
] | |
17d353e58423e65bb1b365da52ecb733a759ee47 | 1c2b19e4c5639a62ef760628da5d6ac210792666 | /polling-app-server/src/main/java/com/example/polls/service/TaskService.java | 350c60a2f0d8c9500d971bf892c91e00e813ca2a | [] | no_license | busa2004/df | 458d1ef3b09b2f68338abe7f36c5c6b49ebd1c65 | 053e8496ea2225f249e97e726edf729bb5b5cbd7 | refs/heads/master | 2020-05-17T06:13:45.816924 | 2019-04-29T06:19:34 | 2019-04-29T06:19:34 | 183,554,754 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,213 | java | package com.example.polls.service;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.stereotype.Service;
import com.example.polls.exception.BadRequestException;
import com.example.polls.exception.ResourceNotFoundException;
import com.example.polls.model.Status;
import com.example.polls.model.Task;
import com.example.polls.payload.PageResponse;
import com.example.polls.payload.PagedResponse;
import com.example.polls.repository.TaskRepository;
import com.example.polls.util.AppConstants;
@Service
public class TaskService {
@Autowired
private TaskRepository taskRepository;
public void createTask(Task taskRequest) {
Task task = new Task();
task.setTitle(taskRequest.getTitle());
task.setContent(taskRequest.getContent());
task.setStatus(Status.PROGRESS);
taskRepository.save(task);
}
public PageResponse<Task> getAllTask(int page, int size) {
Pageable pageable = PageRequest.of(page, size, new Sort(Direction.DESC, "createdAt"));
Page<Task> taskPage = taskRepository.findByStatus(Status.PROGRESS,pageable);
PageResponse<Task> pageResponse = pageConstructor(taskPage);
if(taskPage.getNumberOfElements() == 0) {
pageResponse.setContent(Collections.emptyList());
}else {
pageResponse.setContent(taskPage.getContent());
}
return pageResponse;
}
public void deleteTask(Task taskRequest) {
Task task = taskRepository.findById(taskRequest.getId()).orElseThrow(
() -> new ResourceNotFoundException("Task", "id", taskRequest.getId()));
task.setStatus(Status.END);
taskRepository.save(task);
}
public void updateTask(Task taskRequest) {
Task task = taskRepository.findById(taskRequest.getId()).orElseThrow(
() -> new ResourceNotFoundException("Task", "id", taskRequest.getId()));
task.setTitle(taskRequest.getTitle());
task.setContent(taskRequest.getContent());
taskRepository.save(task);
}
private PageResponse<Task> pageConstructor(Page<Task> taskPage) {
PageResponse<Task> pageResponse = new PageResponse<Task>(
taskPage.getNumber(),
taskPage.getSize(),
taskPage.getTotalPages(),
taskPage.getNumberOfElements(),
taskPage.getTotalElements(),
taskPage.hasPrevious(),
taskPage.isFirst(),
taskPage.hasNext(),
taskPage.isLast(),
taskPage.nextPageable(),
taskPage.previousPageable(),
taskPage.getSort()
);
return pageResponse;
}
public List<Task> getAllTaskNoPage() {
return taskRepository.findByStatus(Status.PROGRESS);
}
}
| [
"[email protected]"
] | |
74ee2e62d860aefefdb754fcac3ea268e464833b | 6eed833a2c2b76dc5e1d0faced7ee44c65216cd0 | /1.JavaSyntax/task07/task0715/Solution.java | 9304003447a03c153978c7c4dd8fd8252b42f61e | [] | no_license | poojakumari11228/JavaCodeGym | a3a8633e130f4b5fac214248e3679d8c5137f1c2 | e93a3d1728398344a697aa6bea1e48961160b7ae | refs/heads/master | 2022-09-30T15:26:20.312235 | 2020-03-26T17:32:56 | 2020-03-26T17:32:56 | 245,409,415 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 565 | java | package com.codegym.task.task07.task0715;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
More Sam-I-Am
*/
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
ArrayList<String> list = new ArrayList<String>();
list.add("Sam");
list.add("I");
list.add("Am");
list.add(1,"Ham");
list.add(3,"Ham");
list.add(5,"Ham");
for ( String x : list)
System.out.println(x);
}
}
| [
"[email protected]"
] | |
0e2896994947484bd9cdfd377c29ad5d3359a39d | ffceb91368cb6e42876e27e77836a7210b0805b0 | /src/com/dcyp/game/ui/ChallengesUI.java | e197bb18962d39bd3b959cd49b260cd0508c1347 | [] | no_license | amator77/DChessYoUp | b618ca7475f0191f4a9fa6e00661497d4051c864 | d1ca5ce28a73297fc6a11d9fccc273d1fa94210b | refs/heads/master | 2020-12-24T13:53:12.284796 | 2013-02-15T16:18:58 | 2013-02-15T16:18:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,720 | java | package com.dcyp.game.ui;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.DefaultListModel;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.ListCellRenderer;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import com.cyp.game.IChallenge;
import com.cyp.transport.Util;
import com.dcyp.task.Task;
import com.dcyp.task.TaskManager;
public class ChallengesUI extends JComponent implements ActionListener {
/**
* serial ID
*/
private static final long serialVersionUID = 1L;
private JList<IChallenge> challanges;
private ChallangesAdapter adapter;
private JPopupMenu challangesMenu;
private JMenuItem mItemCancel;
private JMenuItem mItemReject;
private JMenuItem mItemAccept;
private Task acceptChallangeTask;
private Task rejectChallangeTask;
private Task abortChallangeTask;
public ChallengesUI() {
this.adapter = new ChallangesAdapter();
this.initUI();
this.installListeners();
}
public void actionPerformed(ActionEvent e) {
if( this.getSelectedChallenge().isReceived() ){
this.mItemAccept.setVisible(true);
this.mItemReject.setEnabled(true);
this.mItemCancel.setVisible(false);
}
else{
this.mItemAccept.setVisible(false);
this.mItemReject.setEnabled(false);
this.mItemCancel.setVisible(true);
}
if (e.getSource() == this.mItemCancel) {
if (this.abortChallangeTask != null) {
TaskManager.getManager().runTask(abortChallangeTask);
}
} else if (e.getSource() == this.mItemReject) {
if (this.rejectChallangeTask != null) {
TaskManager.getManager().runTask(rejectChallangeTask);
}
} else if (e.getSource() == this.mItemAccept) {
if (this.acceptChallangeTask != null) {
TaskManager.getManager().runTask(acceptChallangeTask);
}
}
}
public Task getAcceptChallangeTask() {
return acceptChallangeTask;
}
public void setAcceptChallangeTask(Task acceptChallangeTask) {
this.acceptChallangeTask = acceptChallangeTask;
}
public Task getRejectChallangeTask() {
return rejectChallangeTask;
}
public void setRejectChallangeTask(Task rejectChallangeTask) {
this.rejectChallangeTask = rejectChallangeTask;
}
public Task getAbortChallangeTask() {
return abortChallangeTask;
}
public void setAbortChallangeTask(Task abortChallangeTask) {
this.abortChallangeTask = abortChallangeTask;
}
private void initUI() {
this.challanges = new JList<IChallenge>();
this.challanges.setModel(this.adapter);
this.challanges.setCellRenderer(this.adapter);
JScrollPane sc = new JScrollPane(this.challanges);
this.setLayout(new BorderLayout());
this.add(sc, BorderLayout.CENTER);
this.challangesMenu = new JPopupMenu();
this.mItemCancel = new JMenuItem("Cancel chalange");
this.mItemReject = new JMenuItem("Reject chalange");
this.mItemAccept = new JMenuItem("Accept chalange");
this.challangesMenu.add(this.mItemAccept);
this.challangesMenu.add(this.mItemReject);
this.challangesMenu.add(this.mItemCancel);
}
private void installListeners() {
this.mItemAccept.addActionListener(this);
this.mItemReject.addActionListener(this);
this.mItemAccept.addActionListener(this);
this.challanges.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
IChallenge selected = challanges.getSelectedValue();
if (selected != null) {
Rectangle r = challanges.getCellBounds(
challanges.getSelectedIndex(),
challanges.getSelectedIndex());
challangesMenu.show(challanges, r.x, r.y);
}
}
});
this.challanges.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
IChallenge selected = challanges.getSelectedValue();
if (selected != null) {
challangesMenu.show(challanges, e.getX(), e.getY());
}
}
}
});
}
public void addChallenge(IChallenge challenge) {
this.adapter.addElement(challenge);
}
public void removeChallenge(IChallenge challenge) {
this.adapter.removeElement(challenge);
}
private class ChallangesAdapter extends DefaultListModel<IChallenge>
implements ListCellRenderer<IChallenge> {
/**
* serial ID
*/
private static final long serialVersionUID = 1L;
private JPanel ui;
private JLabel challangeLabel;
private JLabel avatarLabel;
public ChallangesAdapter() {
this.ui = new JPanel(new BorderLayout(2, 2));
this.ui.setOpaque(false);
this.challangeLabel = new JLabel();
this.avatarLabel = new JLabel();
this.ui.add(this.challangeLabel, BorderLayout.CENTER);
this.ui.add(this.avatarLabel, BorderLayout.EAST);
}
public Component getListCellRendererComponent(
JList<? extends IChallenge> list, IChallenge value, int index,
boolean isSelected, boolean cellHasFocus) {
this.challangeLabel.setIcon(value.isReceived() ? ResourceManager
.getManager().loadImageAsIcon("receive.png")
: ResourceManager.getManager().loadImageAsIcon("send"));
this.challangeLabel.setText(Util.getContactFromId(value
.getRemoteContact().getId()));
this.avatarLabel.setIcon(ResourceManager.getManager()
.createAvatarIcon(value.getRemoteContact().getAvatar()));
return this.ui;
}
}
public IChallenge getSelectedChallenge() {
return this.challanges.getSelectedValue();
}
}
| [
"[email protected]"
] | |
cb3576fd71f06a9f600ac18575e819b2248080b4 | 581e6f17bfa2494294c0de66b5cf65571ebafa80 | /SHOPPING_BACK/src/main/java/com/fixthepro/shopping_back/dao/EmployeeDao.java | 1b85e51d4f16843b7958f061cc9e39b2d53c7d18 | [] | no_license | JaganmohanDevendraguru/shopping | bae312d2fc1c664b14507c3b3a1904243a687779 | 9d69ff891ab3d32078292d3fa6c41d31dcbec495 | refs/heads/master | 2022-11-19T17:12:03.769907 | 2020-07-12T16:47:06 | 2020-07-12T16:47:06 | 276,375,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 439 | java | package com.fixthepro.shopping_back.dao;
import java.util.List;
import com.fixthepro.shopping_back.dto.Employee;
public interface EmployeeDao {
public List<Employee> findAll();
public List<Employee> findAllActive();
public boolean save(Employee c);
public boolean update(Employee c);
public boolean delete(int id);
public Employee findById(int id);
public List<Employee> findLikeName(String name);
}
| [
"[email protected]"
] | |
d8c59aeb95eafa16a1b72e6dfa948d3d8f5c864b | 8bfdaeb6177968687c524f91dd21ec5ca4d13217 | /src/objetos/Pajaro.java | 8d9de9bc02f174f75cbb9f9ba2b980d709eb2400 | [] | no_license | gnbryan/FlappyBird | 624b83a21e8c5d0d078ba8f2db646eab0c8043f5 | 3a97155a1800c0464d8a4710aae6457cb0263ffe | refs/heads/master | 2021-01-01T17:32:45.500344 | 2015-02-02T15:57:05 | 2015-02-02T15:57:05 | 30,194,031 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 2,490 | java | package objetos;
import org.newdawn.slick.Animation;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.Circle;
import org.newdawn.slick.geom.Shape;
import patrones.I_Salto;
import patrones.I_Pajaro;
import estados.PartidaDia;
import estados.PartidaNoche;
public abstract class Pajaro implements I_Pajaro {
protected float x, y, velocidad, rotacion, velRotacion, gravedad, radio;
protected Shape colision;
protected Image[] imagenesPajaro;
protected Animation animacionPajaro;
protected I_Salto salto;
public Pajaro() throws SlickException {
x = 100; y = 200;
rotacion = 0;
gravedad = 0.3f;
radio = 13;
setColision(new Circle(getX(), getY(), radio));
}
public void volar(Input tecla) {
/*
* El pájaro vuela con una rotación y velocidad determinada siempre que no se haya llegado al fin de la partida,
* mientras esté dentro del juego verticalmente (evita que se salga fuera del juego por la parte de arriba)
* y mientras se haya pulsado la tecla para volar: la 'V'
*/
if(!PartidaDia.finPartida && getY() > 10 && tecla.isKeyDown(Input.KEY_V) || !PartidaNoche.finPartida && getY() > 10 && tecla.isKeyDown(Input.KEY_V)) {
setVelocidad(-4.0f);
rotacion = -45;
}
// Generación del efecto gravitatorio del pájaro y patrón estrategia
velRotacion = salto.asignarSalto();
setY(getY() + getVelocidad());
setVelocidad(getVelocidad() + gravedad);
// Ubicación del círculo que ejercerá como colisionador del pájaro contra el suelo y los tubos
getColision().setLocation(getX(), getY());
getColision().setCenterX(getX());
getColision().setCenterY(getY());
// Efecto de rotación del pájaro
rotacion += velRotacion;
}
public float getRotacion() {
return rotacion;
}
public void setRotacion(float r) {
rotacion = r;
}
public Animation getPajaroAnimacion() {
return animacionPajaro;
}
public void setPajaroAnimacion(Animation p) {
animacionPajaro = p;
}
public void setSalto(I_Salto s) {
salto = s;
}
public float getX() {
return x;
}
public float getY() {
return y;
}
public Shape getColision(){
return colision;
}
public float getVelocidad() {
return velocidad;
}
public void setX(float otraX) {
x = otraX;
}
public void setY(float otraY) {
y = otraY;
}
public void setVelocidad(float v) {
velocidad = v;
}
public void setColision(Shape c) {
colision = c;
}
} | [
"[email protected]"
] | |
b9cf85251383f0255869f9d6bf7217c9a9372e7f | 23938caf60333cccd1f8e5aeda2d2d322e37f53d | /src/main/java/com/nbc/convergencerepo/SpringBootAdminApplication.java | 8237d12b4c574ba8504a072c749737f13115b47e | [] | no_license | pravin-singh/admin_server | 7434afe9409f37547280a64e50a8e2f8114a752e | afef163ab914cda22e2e0377e1c61edc1e1869ab | refs/heads/master | 2020-03-19T20:45:30.231928 | 2018-07-10T06:51:37 | 2018-07-10T06:51:37 | 136,915,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package com.nbc.convergencerepo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import de.codecentric.boot.admin.config.EnableAdminServer;
@EnableAdminServer
@SpringBootApplication
public class SpringBootAdminApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootAdminApplication.class, args);
}
}
| [
"[email protected]"
] | |
12b93777d3d0d6980c64491e067e9ade84d49083 | fbf4f80946320420ee4eb6d6893057da8aa10fc3 | /GaRanKHN/src/Database/Controller/Sevrlet_Menu_Garan.java | 0aac0687228545b23012e4c354cb25203667a8ad | [] | no_license | Nhom1-DoAn1/myPersonal-Project | e68ad5abea23a22b2339d86d2050bc6b1b65b8ba | 0421b40b27fc94eb68415aa1a8b8d1a49ab9afe7 | refs/heads/master | 2020-04-01T03:39:20.605706 | 2018-10-16T17:15:09 | 2018-10-16T17:15:09 | 152,830,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,469 | java | package Database.Controller;
import java.io.IOException;
import java.sql.ResultSet;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.sun.xml.internal.bind.CycleRecoverable.Context;
/**
* Servlet implementation class Menu_Garan
*/
public class Sevrlet_Menu_Garan extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public Sevrlet_Menu_Garan() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
session.setAttribute("activekey", 1);
request.setAttribute("key", 1);
RequestDispatcher dr = request.getRequestDispatcher("Menu_garan.jsp");
dr.forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
}
| [
"[email protected]"
] | |
f1c9210ec106e1cb7834e9af6ddaeabeaf9e1895 | 229f64864036a9ff23a562c557e9e7fc11ad4250 | /src/test/java/com/example/student_enrollment/CourseControllerTest.java | 94c105e7317e7b7d48bf0e8d2ce904b40b771eba | [] | no_license | akshat1499/student_enrollment_api | 006aae981e5018fcbb545ed490e2d9474b6b98a4 | 29ef79e0653248474f45b43f518b8b63a18c354b | refs/heads/main | 2023-07-07T08:53:52.728403 | 2021-08-12T09:26:28 | 2021-08-12T09:26:28 | 391,833,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,640 | java | package com.example.student_enrollment;
import com.example.student_enrollment.entities.Course;
import com.example.student_enrollment.entities.Department;
import com.example.student_enrollment.pojos.CoursePOJO;
import com.example.student_enrollment.repositories.CourseRepository;
import com.example.student_enrollment.services.CourseService;
import com.example.student_enrollment.utillities.DateGenerator;
import com.example.student_enrollment.utillities.Status;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import java.util.*;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.notNullValue;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
@ActiveProfiles("test")
public class CourseControllerTest {
private static final ObjectMapper om = new ObjectMapper();
@Autowired
private MockMvc mockMvc;
@MockBean
private CourseService courseService;
@MockBean
private CourseRepository courseRepository;
@Test
public void saveCourse_success() throws Exception{
Date createdOn = DateGenerator.getDateFromString("2021-09-08 22:22:22");
Date updatedOn= DateGenerator.getDateFromString("2021-09-08 22:22:22");
Department d1 = new Department("Dept1", Status.ACTIVE);
d1.setId(1L);
d1.setCreatedOn(createdOn);
d1.setUpdatedOn(updatedOn);
Course course = new Course();
course.setStatus(Status.ACTIVE);
course.setCreatedOn(createdOn);
course.setFee(30000L);
course.setName("Course1");
course.setUpdatedOn(updatedOn);
course.setInstructor(null);
course.setDepartment(d1);
course.setId(1L);
course.setSemesterList(null);
CoursePOJO coursePOJO = new CoursePOJO();
coursePOJO.setFee(30000L);
coursePOJO.setName("Course1");
coursePOJO.setStatus(Status.ACTIVE);
coursePOJO.setDeptId(1L);
coursePOJO.setInstId(1L);
Mockito.when(courseRepository.save(course)).thenReturn(course);
Mockito.when(courseService.saveCourse(ArgumentMatchers.any())).thenReturn(course);
//TODO: Why argument Matachers.any and not COurseOJO
MockHttpServletRequestBuilder mockRequest = MockMvcRequestBuilders.post("/courses")
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.content(this.om.writeValueAsString(coursePOJO));
mockMvc.perform(mockRequest)
.andExpect(status().isOk())
.andExpect(jsonPath("$", notNullValue()))
.andExpect(jsonPath("$.name").value("Course1"));
}
}
| [
"[email protected]"
] | |
f4f06402f1c44732601a1b2e00d02c3579bb0d0e | 658ae38d6bdda96f0924fd175818916ff75a6e59 | /ProyectoPSP4/app/src/main/java/com/aprendiz/ragp/proyectopsp4/controllers/MenuPrincipal.java | 8263cead1008a3095f8231354a5f77166bd8f76b | [] | no_license | DARWorldSkills/ProyectoPSP4 | 8c8abe3ebd96f340cf3c34036cd77dc1ba643685 | c20ae0f894a0a76cf866d4ff52836018beac6a71 | refs/heads/master | 2020-03-25T00:53:05.823464 | 2018-08-01T21:31:25 | 2018-08-01T21:31:25 | 143,210,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,264 | java | package com.aprendiz.ragp.proyectopsp4.controllers;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Adapter;
import android.widget.EditText;
import com.aprendiz.ragp.proyectopsp4.R;
import com.aprendiz.ragp.proyectopsp4.models.AdapterP;
import com.aprendiz.ragp.proyectopsp4.models.ManagerDB;
import com.aprendiz.ragp.proyectopsp4.models.Proyecto;
import java.util.List;
public class MenuPrincipal extends AppCompatActivity {
RecyclerView recyclerView;
FloatingActionButton btnAgregar;
public static Proyecto proyecto= new Proyecto();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu_principal);
inizialite();
inputAdapter();
btnAgregar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
final AlertDialog.Builder builder = new AlertDialog.Builder(MenuPrincipal.this);
builder.setTitle("Agregar Proyecto");
LayoutInflater inflater = getLayoutInflater();
final View view = inflater.inflate(R.layout.item_ingresarp,null);
final EditText txtProyecto = view.findViewById(R.id.txtNombreP2);
builder.setView(view);
builder.setPositiveButton("Agreagar", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
ManagerDB managerDB = new ManagerDB(MenuPrincipal.this);
Proyecto proyecto = new Proyecto();
proyecto.setNombre(txtProyecto.getText().toString());
if (proyecto.getNombre().length()>1) {
managerDB.inputProyecto(proyecto);
dialog.cancel();
inputAdapter();
Snackbar.make(v,"Se ha agregado el proyecto "+proyecto.getNombre(),Snackbar.LENGTH_SHORT).show();
}else {
Snackbar.make(v,"Para poder agreagar un proyecto por favor no deje el campo vacio",Snackbar.LENGTH_SHORT).show();
}
}catch (Exception e){
Snackbar.make(v,"Por favor ingrese un nombre",Snackbar.LENGTH_SHORT).show();
}
}
});
builder.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();
}
});
}
private void inizialite() {
recyclerView = findViewById(R.id.recyclerView);
btnAgregar = findViewById(R.id.btnAgregar);
}
private void inputAdapter() {
ManagerDB managerDB = new ManagerDB(this);
final List<Proyecto> proyectoList = managerDB.proyectoList();
AdapterP adapterP = new AdapterP(proyectoList);
recyclerView.setAdapter(adapterP);
recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false));
recyclerView.setHasFixedSize(true);
adapterP.setMlistener(new AdapterP.OnItemClickListener() {
@Override
public void itemClick(int position) {
proyecto= proyectoList.get(position);
Intent intent = new Intent(MenuPrincipal.this,MenuProyecto.class);
startActivity(intent);
}
});
}
}
| [
"[email protected]"
] | |
7f196b83e7a4c26dab119db124ed1a74f6e3ca28 | deb24c1abeb590c5b8a900697adb0e2110cee5e8 | /android/app/src/main/java/com/expensetracker/MainApplication.java | 5c9187e99890a25b0478acc61131c5408ca4261e | [] | no_license | SoeMoeAung21/ExpenseTracker | d82ff5bfe6ec92786b20b9ae921795e313a86e6a | b9ae162ce893f1d5bd1de9f815112263429bb290 | refs/heads/master | 2020-03-23T09:37:52.334395 | 2018-10-09T18:51:25 | 2018-10-09T18:51:25 | 141,399,925 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,115 | java | package com.expensetracker;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.horcrux.svg.SvgPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new SvgPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"[email protected]"
] | |
f8bd21c1c0f172640f2502a08c7f556502a60317 | 3e176296759f1f211f7a8bcfbba165abb1a4d3f1 | /gosu-core/src/main/java/gw/internal/gosu/parser/LengthProperty.java | 5eef03ac7b5f6cbf9cf6b04eec49f2f380f313c9 | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | gosu-lang/old-gosu-repo | 6335ac90cd0c635fdec6360e3e208ba12ac0a39e | 48c598458abd412aa9f2d21b8088120e8aa9de00 | refs/heads/master | 2020-05-18T03:39:34.631550 | 2014-04-21T17:36:38 | 2014-04-21T17:36:38 | 1,303,622 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,432 | java | /*
* Copyright 2013 Guidewire Software, Inc.
*/
package gw.internal.gosu.parser;
import gw.lang.parser.Keyword;
import gw.lang.reflect.IAnnotationInfo;
import gw.lang.reflect.IPresentationInfo;
import gw.lang.reflect.IPropertyAccessor;
import gw.lang.reflect.ITypeInfo;
import gw.lang.reflect.TypeSystem;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.util.Collections;
import java.util.List;
public class LengthProperty extends JavaPropertyInfo
{
private IPropertyAccessor _accessor;
LengthProperty(ITypeInfo typeInfo) throws IntrospectionException
{
super( typeInfo,
new PropertyDescriptorJavaPropertyDescriptor(new PropertyDescriptor( Keyword.KW_length.toString(), null, null )
{
@Override
public Class getPropertyType()
{
return Integer.TYPE;
}
} , TypeSystem.getCurrentModule()));
_accessor = LengthAccessor.INSTANCE;
}
@Override
public IPropertyAccessor getAccessor()
{
return _accessor;
}
@Override
public IPresentationInfo getPresentationInfo()
{
return IPresentationInfo.Default.GET;
}
@Override
public boolean isPublic()
{
return true;
}
@Override
public boolean isReadable()
{
return true;
}
@Override
public List<IAnnotationInfo> getAnnotations()
{
return Collections.emptyList();
}
}
| [
"[email protected]"
] | |
4b7f1481097b53bdee3361a4ee614845b4ab7b32 | 3ac36bd8ed2a1cb49aa9d1631f74493223bd4d8d | /src/main/java/com/ming/graph/io/Line.java | eb75752670958e415a93ffb4c2207f7b5b6d5c3e | [] | no_license | bbrighttaer/GraphProject | 186543f08aacd7efd376bf45ba1d5b9bf69fb4ae | 6f50d434830f8405556813bdba46549f7107c0ed | refs/heads/master | 2021-04-27T17:37:15.270696 | 2018-03-12T10:16:41 | 2018-03-12T10:16:41 | 122,324,506 | 0 | 1 | null | 2018-03-09T09:18:01 | 2018-02-21T10:54:10 | Java | UTF-8 | Java | false | false | 700 | java | package com.ming.graph.io;
import java.util.LinkedList;
/**
* Author: bbrighttaer
*/
public abstract class Line<T> {
protected LinkedList<T> line;
public Line() {
this(null);
}
public Line(LinkedList<T> line) {
this.line = line;
}
public LinkedList<T> getLine() {
return line;
}
public void setLine(LinkedList<T> line) {
this.line = line;
}
public abstract String print();
public abstract String println();
public <L extends Line<T>> L join(L l) {
line.addAll(l.line);
l.setLine(this.line);
return l;
}
@Override
public String toString() {
return print();
}
}
| [
"[email protected]"
] | |
705ce8824237563d997935bf72a57ec0dca4630f | a45643b57e168da129bfbabe7274a65b33279ad7 | /mongo/src/main/java/org/axonframework/eventsourcing/eventstore/mongo/AbstractEventStorageStrategy.java | 47b55127b9d03e7a479bff3c5834fe460e5c7f48 | [
"Apache-2.0"
] | permissive | gamesthinking/AxonFramework | d89bd63aaccd6fbfdefe8bf9ed06c8ac56433131 | f8489b841cc6e0bb5c3b53bb397f79263af3b87c | refs/heads/master | 2022-11-11T16:47:39.848224 | 2016-06-12T17:09:24 | 2016-06-12T17:09:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,270 | java | /*
* Copyright (c) 2010-2016. Axon Framework
* 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.axonframework.eventsourcing.eventstore.mongo;
import com.mongodb.*;
import org.axonframework.common.Assert;
import org.axonframework.eventhandling.EventMessage;
import org.axonframework.eventsourcing.DomainEventMessage;
import org.axonframework.eventsourcing.eventstore.DomainEventData;
import org.axonframework.eventsourcing.eventstore.TrackedEventData;
import org.axonframework.eventsourcing.eventstore.TrackingToken;
import org.axonframework.eventsourcing.eventstore.legacy.LegacyTrackingToken;
import org.axonframework.eventsourcing.eventstore.mongo.documentperevent.EventEntryConfiguration;
import org.axonframework.serialization.Serializer;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.util.stream.StreamSupport.stream;
/**
* @author Rene de Waele
*/
public abstract class AbstractEventStorageStrategy implements StorageStrategy {
private static final long DEFAULT_GAP_DETECTION_INTERVAL = 10000L;
protected static final int ORDER_ASC = 1, ORDER_DESC = -1;
private final EventEntryConfiguration eventConfiguration;
private final long gapDetectionInterval;
public AbstractEventStorageStrategy(EventEntryConfiguration eventConfiguration) {
this(eventConfiguration, DEFAULT_GAP_DETECTION_INTERVAL);
}
public AbstractEventStorageStrategy(EventEntryConfiguration eventConfiguration, long gapDetectionInterval) {
this.eventConfiguration = eventConfiguration;
this.gapDetectionInterval = gapDetectionInterval;
}
@Override
public void appendEvents(DBCollection eventCollection, List<? extends EventMessage<?>> events,
Serializer serializer) throws MongoException.DuplicateKey {
eventCollection.insert(createEventDocuments(events, serializer).collect(Collectors.toList()));
}
protected abstract Stream<DBObject> createEventDocuments(List<? extends EventMessage<?>> events,
Serializer serializer);
@Override
public void appendSnapshot(DBCollection snapshotCollection, DomainEventMessage<?> snapshot,
Serializer serializer) throws MongoException.DuplicateKey {
snapshotCollection.insert(createSnapshotDocument(snapshot, serializer));
}
protected abstract DBObject createSnapshotDocument(DomainEventMessage<?> snapshot, Serializer serializer);
@Override
public void deleteSnapshots(DBCollection snapshotCollection, String aggregateIdentifier) {
DBObject mongoEntry =
BasicDBObjectBuilder.start().add(eventConfiguration.aggregateIdentifierProperty(), aggregateIdentifier)
.get();
snapshotCollection.find(mongoEntry).forEach(snapshotCollection::remove);
}
@Override
public List<? extends DomainEventData<?>> findDomainEvents(DBCollection eventCollection, String aggregateIdentifier,
long firstSequenceNumber, int batchSize) {
DBCursor cursor = eventCollection.find(BasicDBObjectBuilder.start()
.add(eventConfiguration().aggregateIdentifierProperty(),
aggregateIdentifier)
.add(eventConfiguration().sequenceNumberProperty(),
new BasicDBObject("$gte", firstSequenceNumber)).get())
.sort(new BasicDBObject(eventConfiguration().sequenceNumberProperty(), ORDER_ASC));
cursor = applyBatchSize(cursor, batchSize);
try {
return stream(cursor.spliterator(), false).flatMap(this::extractDomainEvents)
.filter(event -> event.getSequenceNumber() >= firstSequenceNumber).limit(batchSize)
.collect(Collectors.toList());
} finally {
cursor.close();
}
}
protected abstract Stream<? extends DomainEventData<?>> extractDomainEvents(DBObject object);
@Override
public List<? extends TrackedEventData<?>> findTrackedEvents(DBCollection eventCollection, TrackingToken lastToken,
int batchSize) {
DBCursor cursor;
if (lastToken == null) {
cursor = eventCollection.find(BasicDBObjectBuilder.start().get());
} else {
Assert.isTrue(lastToken instanceof LegacyTrackingToken,
String.format("Token %s is of the wrong type", lastToken));
LegacyTrackingToken legacyTrackingToken = (LegacyTrackingToken) lastToken;
cursor = eventCollection.find(BasicDBObjectBuilder.start().add(eventConfiguration.timestampProperty(),
new BasicDBObject("$gte", legacyTrackingToken
.getTimestamp().toString()))
.add(eventConfiguration.sequenceNumberProperty(),
new BasicDBObject("$gte",
legacyTrackingToken.getSequenceNumber()))
.get());
}
cursor = cursor.sort(new BasicDBObject(eventConfiguration().timestampProperty(), ORDER_ASC)
.append(eventConfiguration().sequenceNumberProperty(), ORDER_ASC));
cursor = applyBatchSize(cursor, batchSize);
try {
return stream(cursor.spliterator(), false).flatMap(this::extractTrackedEvents)
.filter(event -> event.trackingToken().isAfter(lastToken)).limit(batchSize)
.collect(Collectors.toList());
} finally {
cursor.close();
}
}
@Override
public TrackingToken getTokenForGapDetection(TrackingToken token) {
if (token == null) {
return null;
}
Assert.isTrue(token instanceof LegacyTrackingToken, String.format("Token %s is of the wrong type", token));
LegacyTrackingToken legacyToken = (LegacyTrackingToken) token;
return new LegacyTrackingToken(legacyToken.getTimestamp().minusMillis(gapDetectionInterval),
legacyToken.getAggregateIdentifier(), legacyToken.getSequenceNumber());
}
protected abstract DBCursor applyBatchSize(DBCursor cursor, int batchSize);
protected abstract Stream<? extends TrackedEventData<?>> extractTrackedEvents(DBObject object);
@Override
public Optional<? extends DomainEventData<?>> findLastSnapshot(DBCollection snapshotCollection,
String aggregateIdentifier) {
DBObject mongoEntry =
BasicDBObjectBuilder.start().add(eventConfiguration.aggregateIdentifierProperty(), aggregateIdentifier)
.get();
try (DBCursor cursor = snapshotCollection.find(mongoEntry)
.sort(new BasicDBObject(eventConfiguration.sequenceNumberProperty(), ORDER_DESC)).limit(1)) {
return stream(cursor.spliterator(), false).findFirst().map(this::extractSnapshot);
}
}
protected abstract DomainEventData<?> extractSnapshot(DBObject object);
@Override
public void ensureIndexes(DBCollection eventsCollection, DBCollection snapshotsCollection) {
eventsCollection.ensureIndex(new BasicDBObject(eventConfiguration.aggregateIdentifierProperty(), ORDER_ASC)
.append(eventConfiguration.sequenceNumberProperty(), ORDER_ASC),
"uniqueAggregateIndex", true);
eventsCollection.ensureIndex(new BasicDBObject(eventConfiguration.timestampProperty(), ORDER_ASC)
.append(eventConfiguration.sequenceNumberProperty(), ORDER_ASC),
"orderedEventStreamIndex", false);
snapshotsCollection.ensureIndex(new BasicDBObject(eventConfiguration.aggregateIdentifierProperty(), ORDER_ASC)
.append(eventConfiguration.sequenceNumberProperty(), ORDER_ASC),
"uniqueAggregateIndex", true);
}
protected EventEntryConfiguration eventConfiguration() {
return eventConfiguration;
}
}
| [
"[email protected]"
] | |
cc60db0b400a8040b1f83cb2059b5802534828f2 | c4e8acd46e3387661e02df7d0c0158509d2c67be | /implementacao/src/main/java/com/ithappens/interview/services/PedidoService.java | 007b74915e6f53f72da660e71ce7a9634251bc98 | [] | no_license | machadolucasvp/test-ithappens-1304 | 15c1f354d440f6ec3dbe99c459e907f179b8f752 | 963e24907136957054fe684259d0587e24c0e3bd | refs/heads/master | 2022-11-30T14:46:12.561728 | 2020-03-25T02:53:59 | 2020-03-25T02:53:59 | 248,555,340 | 1 | 0 | null | 2020-07-31T15:37:50 | 2020-03-19T16:44:34 | null | UTF-8 | Java | false | false | 6,926 | java | package com.ithappens.interview.services;
import com.ithappens.interview.dtos.*;
import com.ithappens.interview.enums.Status;
import com.ithappens.interview.enums.Tipo;
import com.ithappens.interview.models.*;
import com.ithappens.interview.repositories.ItemPedidoRepository;
import com.ithappens.interview.repositories.PedidoRepository;
import org.hibernate.ObjectNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@Service
public class PedidoService {
@Autowired
private PedidoRepository pedidoRepository;
@Autowired
private ItemPedidoRepository itemPedidoRepository;
@Autowired
private UsuarioService usuarioService;
@Autowired
private FilialService filialService;
@Autowired
private ClienteService clienteService;
@Autowired
private ProdutoService produtoService;
public Pedido findById(Integer id) {
Optional<Pedido> filial = pedidoRepository.findById(id);
return filial.orElseThrow(() -> new ObjectNotFoundException(id, this.getClass().getName()));
}
public PedidoDTO addPedido(Integer filialId, Pedido pedidoDTO, Tipo tipo) {
Filial filial = filialService.findById(filialId);
Usuario usuario = usuarioService.findById(pedidoDTO.getUsuario().getId());
Cliente cliente = clienteService.findById(pedidoDTO.getCliente().getId());
Pedido pedido = Pedido.builder().tipo(tipo).filial(filial)
.usuario(usuario)
.observacao(pedidoDTO.getObservacao())
.pagamento(pedidoDTO.getPagamento())
.cliente(cliente)
.build();
Set<ItemPedido> itemPedidos = pedidoDTO.getItemsPedido().stream().map(
item -> {
item.setId(null);
item.setSubTotal(item.calculaSubTotal());
item.setPedido(pedido);
if (tipo.equals(Tipo.SAIDA)) {
filialService.removeProduto(item.getProduto(), filial, item.getQuantidade());
return item;
} else if (tipo.equals(Tipo.ENTRADA)) {
if (pedido.getItemsPedido().size() > 0 &&
containsProdutoAndPedidoOpen(pedido, item)) {
throw new DataIntegrityViolationException("Não foi possível realizar a entrada" +
"do pedido, existem produtos duplicados em status ATIVO ou " +
"PROCESSANDO");
}
filialService.addProduto(item.getProduto(), filial, item.getQuantidade());
pedido.getItemsPedido().add(item);
return item;
} else {
throw new IllegalArgumentException("Não foi possível identificar o tipo do pedido");
}
}
).collect(Collectors.toSet());
pedido.setCustoTotal(pedidoDTO.calculaCustoTotal());
pedido.getPagamento().setCusto(pedido.getCustoTotal());
pedido.setItemsPedido(itemPedidos);
pedidoRepository.save(pedido);
itemPedidoRepository.saveAll(itemPedidos);
return this.asDTO(pedido);
}
private boolean containsProdutoAndPedidoOpen(Pedido pedido, ItemPedido itemPedido) {
Set<ItemPedido> itemPedidos = pedido.getItemsPedido().stream().filter(
item -> item.getProduto().getId().equals(itemPedido.getProduto().getId()) &&
!item.getStatus().equals(Status.CANCELADO)
).collect(Collectors.toSet());
return itemPedidos.size() > 0;
}
public boolean updateItemPedidoStatus(Integer pedidoId, Integer itemId, String status, Boolean isToProcess) {
Pedido pedido = this.findById(pedidoId);
if (!isToProcess) {
return pedido.getItemsPedido().stream().anyMatch(
item -> {
if (item.getId().equals(itemId)) {
item.setStatus(Status.valueOf(status));
pedidoRepository.save(pedido);
return true;
}
return false;
}
);
} else {
Set<ItemPedido> itemsPedidosProcessados = pedido.getItemsPedido().stream().map(
item -> {
item.setStatus(Status.PROCESSADO);
return item;
}
).collect(Collectors.toSet());
pedido.setItemsPedido(itemsPedidosProcessados);
pedidoRepository.save(pedido);
return true;
}
}
public PedidoDTO asDTO(Pedido pedido) {
return PedidoDTO.builder().id(pedido.getId())
.observacao(pedido.getObservacao()).tipo(pedido.getTipo())
.custoTotal(pedido.getCustoTotal())
.pagamento(pedido.getPagamento())
.cliente(clienteService.asDTO(pedido.getCliente()))
.usuario(usuarioService.asDTO(pedido.getUsuario()))
.filial(filialService.filialPedidoAsDTO(pedido.getFilial()))
.itemsPedido(pedido.getItemsPedido().stream().map(
item -> this.itemPedidoAsDTO(item, produtoService.asDTO(item.getProduto()))
).collect(Collectors.toSet()))
.build();
}
public ItemPedidoDTO itemPedidoAsDTO(ItemPedido itemPedido, ProdutoDTO produtoDTO) {
return ItemPedidoDTO.builder().id(itemPedido.getId())
.custoUnitario(itemPedido.getCustoUnitario())
.quantidade(itemPedido.getQuantidade())
.subTotal(itemPedido.getSubTotal())
.status(itemPedido.getStatus())
.produto(produtoDTO).build();
}
public Page<PedidoDTO> findPedidosPageable(Integer page, Integer size,
String direction, String orderBy, Integer filialId) {
Page<Pedido> pedido;
if (filialId > 0) {
Filial filial = filialService.findById(filialId);
pedido = pedidoRepository.findByFilial(filial, PageRequest.of(page, size,
Sort.Direction.valueOf(direction), orderBy));
} else {
pedido = pedidoRepository.findAll(PageRequest.of(page, size,
Sort.Direction.valueOf(direction), orderBy));
}
return pedido.map(this::asDTO);
}
}
| [
"[email protected]"
] | |
6329403a6058bee2ed68d010a8fd20dfdda7ce04 | 06791a6fd4bfba770f14622e9630d1a80805a679 | /SoyAgaci/src/mustafa/base/Listeleme.java | f3dd8fb711ee97c862c2f9ca429712daa83c01b9 | [] | no_license | Mustafa1919/vektorel | 46971d55e4e01fbb602c2160ad6eb23c80657458 | a33f614390ce10dcad17194c0db4ea5860661d8a | refs/heads/master | 2020-04-11T09:46:27.877030 | 2019-05-05T08:26:29 | 2019-05-05T08:26:29 | 161,691,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,029 | java | package mustafa.base;
import java.util.Scanner;
public class Listeleme {
private Scanner input;
public Listeleme() {
input = new Scanner(System.in);
}
//private Insan init() {return this.ben = new Insan("Mustafa" , "Senyurt");}
public void listeKisiEkle(Insan head , String isim , String soyisim) {
Insan temp = head;
/*
* Bulamayinca hata verdir.
*/
while(!temp.getAd().toLowerCase().equals(isim.toLowerCase()) ||
!temp.getSoyad().toLowerCase().equals(soyisim.toLowerCase())) {
temp = temp.sonraki;
}
if(temp.isEmptyAnne() || temp.isEmptyBaba()) {
/*
* ilk olusturulandan sonra sonraki bilgisine listede anne
* annenin ardindan da baba eklenerek liste olusturuluyor
* kisinin anne ve baba bilgileri girildikten sonra kisinin
* sonraki bilgisine annesi annesinin ardina da babasi eklenmektedir
*
*
*Anne ve baba bilgileri girilicek anne ve baba isim soyisimleri
*bilgileri okunarak parametre olarak verilir
*
*temp.setAnne(ad, soyad);
*temp.sonraki = temp.getAnne();
*temp.setBaba(ad, soyad);
*temp.getAnne().sonraki = temp.getBaba();
*/
System.out.print("Anne ismini giriniz : ");
String girdi = input.nextLine();
String[] adSoyad = girdi.split(" ");
if(adSoyad.length < 2)
System.out.println("Eksik Girdi");
else {
temp.setAnne(adBul(adSoyad), adSoyad[adSoyad.length-1]);
listeyeEkle(head, temp.getAnne());
}
System.out.print("Baba ismini giriniz : ");
girdi = input.nextLine();
adSoyad = girdi.split(" ");
if(adSoyad.length < 2)
System.out.println("Eksik Girdi");
else {
temp.setBaba(adBul(adSoyad), adSoyad[adSoyad.length-1]);
listeyeEkle(head, temp.getBaba());
}
}
else
System.out.println("Eklemek istediginiz kisinin anne baba "
+ "bilgileri girili...");
}
public void listeyeEkle(Insan head , Insan eklenecek) {
Insan temp = head;
while(temp.inEmptySonraki()) {
temp = temp.sonraki;
}
temp.sonraki = eklenecek;
}
public String adBul(String[] adSoyad) {
String ad="";
if(adSoyad.length == 2)
return adSoyad[0];
else {
for(int i=0; i<adSoyad.length-1;i++)
ad = ad + adSoyad[i];
return ad;
}
}
public void listele(Insan head) {
/*
* Listeyi bastan sonra listeleme yapar
* Baslangic yani beni parametre olarak alir
*/
Insan temp = head;
while(temp != null) {
yazdir(temp);
temp = temp.sonraki;
}
}
public void yazdir(Insan insan) {
/*
* Anne ve baba bilgileri kontrol edilir
* eger bilgiler yok ise sadece isim ve soyisim yazdirilir
* bilgileri var ise tum bilgiler yan yana yazdirilir.
*/
if(insan.isEmptyAnne() && insan.isEmptyBaba())
System.out.println("Ad : " + insan.getAd() + "\tSoyad : " +
insan.getSoyad() + "\n\tAnne ve Baba bilgileri girilmemis.");
else
System.out.println("Ad : " + insan.getAd() + "\tSoyad : " +
insan.getSoyad() + "\n\tBabasi : " + insan.getBaba().getAd() +
"\tAnnesi : " + insan.getAnne().getAd());
}
}
| [
"[email protected]"
] | |
cfac503ec96510cbc01e76551f62699c875f5f65 | 672e1cb6e2faab0471d77a6d4a2eae0f19c16047 | /src/main/java/com/noahaguilera/customtags/SpecialDayTag.java | 15c03813a77c18defda38361144320138f6773fc | [] | no_license | noahaguilera/customtags | 19462c3796f40263dacd0c7bdc7939e2eaac457b | f5fc72f9c830ccbb2130250e61e8b50a3e55a49d | refs/heads/master | 2023-04-27T20:01:24.304123 | 2021-05-02T10:32:30 | 2021-05-02T10:32:30 | 363,623,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,833 | java | package com.noahaguilera.customtags;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Returns Message based on Holiday/Special Days
*/
public class SpecialDayTag extends SimpleTagSupport {
@Override
public void doTag() throws JspException, IOException {
super.doTag();
JspWriter out = getJspContext().getOut();
SimpleDateFormat dateFormat = new SimpleDateFormat ("dd/MM");
Date today = new Date();
try {
Date christmas = dateFormat.parse("25/12");
if(dateFormat.format(christmas).equals(dateFormat.format(today))) {
out.println("Merry Christmas!");
}
} catch (ParseException e) {
e.printStackTrace();
}
try {
Date halloween = dateFormat.parse("31/10");
if(dateFormat.format(halloween).equals(dateFormat.format(today))) {
out.println("Happy Halloween!");
}
} catch (ParseException e) {
e.printStackTrace();
}
try {
Date fourthOfJuly = dateFormat.parse("04/07");
if(dateFormat.format(fourthOfJuly).equals(dateFormat.format(today))) {
out.println("Happy 4th of July!");
}
} catch (ParseException e) {
e.printStackTrace();
}
try {
Date birthday = dateFormat.parse("30/08");
if(dateFormat.format(birthday).equals(dateFormat.format(today))) {
out.println("Happy Birthday Noah!");
}
} catch (ParseException e) {
e.printStackTrace();
}
}
} | [
"[email protected]"
] | |
50880f07aa1a2e96b4eac859bcfda55a9d89b26f | d408a617e0e58b4b77a283c24637909a79a5833d | /gradle-project/rest1/src/main/java/com/rest1/postcode/jsonform/postcode/Address.java | 01ea2b483ec808bf9efe55d9a4057b6b580ebbf3 | [] | no_license | ktkt11122334/RestAPI_postdata | 638b39d6420b01328a5b549e288cea13d0a717cc | 7d3fd572c3523032f5642f017fa8931358789126 | refs/heads/master | 2022-12-20T13:16:16.670869 | 2020-10-10T13:08:02 | 2020-10-10T13:08:02 | 301,165,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 473 | java | package com.rest1.postcode.jsonform.postcode;
import javax.validation.constraints.NotNull;
import lombok.Setter;
@Setter
public class Address {
@NotNull
String prefecture;
@NotNull
String city;
@NotNull
String town;
public String getPrefecture() {
return (prefecture != null) ? prefecture : "";
}
public String getCity() {
return (city != null) ? city : "";
}
public String getTown() {
return (town != null) ? town : "";
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.