blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c3ddf7104150ffa58b44eaf328d6adc2bc390d4d | fadcd6e4c8af4de6b273d731f445ac3196fcc0d7 | /app/src/androidTest/java/com/example/martinzou/android_exp_4/ExampleInstrumentedTest.java | 34600a1f19f7f13e2d23c3553599657e7d516fb4 | []
| no_license | MartinZou0/Android_EXP_4 | 143434db26457afc4ad7c429e77afc496223ce5e | 79bb0abb0449bb28428ffe9eb0b8f796ebc2c798 | refs/heads/master | 2020-03-18T17:32:46.432851 | 2018-05-27T10:28:59 | 2018-05-27T10:28:59 | 135,034,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 771 | java | package com.example.martinzou.android_exp_4;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.martinzou.android_exp_4", appContext.getPackageName());
}
}
| [
"[email protected]"
]
| |
4bc5137598033391b517cd63d5db0e850166e35c | 118a8dfcf48078b083a53101db37815fa6d8a06b | /ZEngine - Vulkan/src/com/zekrom_64/ze/vulkan/spirv/enums/SPIRVDecoration.java | 4ba1b56b73d2cddef2c8f069c700e428665dbbec | []
| no_license | Zekrom64/ZEngine | 3d97c5a3bd64b3929febb93968167fa5d6c38af9 | 7b20347eed796d33acc8d63b0c2b7a4c782f7d90 | refs/heads/master | 2021-01-11T14:37:01.036022 | 2019-06-13T18:13:08 | 2019-06-13T18:13:08 | 80,166,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,218 | java | package com.zekrom_64.ze.vulkan.spirv.enums;
import java.util.ArrayList;
public enum SPIRVDecoration {
RELAXED_PRECISION,
SPEC_ID,
BLOCK,
BUFFER_BLOCK,
ROW_MAJOR,
COL_MAJOR,
ARRAY_STRIDE,
MATRIX_STRIDE,
GLSL_SHARED,
GLSL_PACKED,
C_PACKED,
BUILT_IN,
NO_PERSPECTIVE,
FLAT,
PATCH,
CENTROID,
SAMPLE,
INVARIANT,
RESTRICT,
ALIASED,
VOLATILE,
CONSTANT,
COHERENT,
NON_WRITABLE,
NON_READABLE,
UNIFORM,
UNIFORM_ID,
SATURATED_CONVERSION,
STREAM,
LOCATION,
COMPONENT,
INDEX,
BINDING,
DESCRIPTOR_SET,
OFFSET,
XFB_BUFFER,
XFB_STRIDE,
FUNC_PARAM_ATTR,
FP_ROUNDING_MODE,
FP_FAST_MATH_MODE,
LINKAGE_ATTRIBUTES,
NO_CONTRACTION,
INPUT_ATTACHMENT_INDEX,
ALIGNMENT,
MAX_BYTE_OFFSET,
ALIGNMENT_ID,
MAX_BYTE_OFFSET_ID,
// SPV_KHR_no_integer_wrap_decoration
NO_SIGNED_WRAP(4469),
NO_UNSIGNED_WRAP(4470),
// SPV_AMD_shader_explicit_vertex_parameter
EXPLICIT_INTERP_AMD(4999),
// SPV_NV_sample_mask_override_coverage
OVERRIDE_COVERAGE_NV(5248),
// SPV_NV_geometry_shader_passthrough
PASSTHROUGH_NV(5250),
VIEWPORT_RELATIVE_NV(5252),
// SPV_NV_stereo_view_rendering
SECONDARY_VIEWPORT_RELATIVE_NV(5256),
// SPV_NV_mesh_shader
PER_PRIMITIVE_NV(5271),
PER_VIEW_NV(5272),
PER_TASK_NV(5273),
// SPV_NV_fragment_shader_barycentric
PER_VERTEX_NV(5285),
NON_UNIFORM_EXT(5300),
COUNTER_BUFFER(5634),
USER_SEMANTIC(5635),
// SPV_EXT_physical_storage_buffer
RESTRICT_POINTER_EXT(5355),
ALIASED_POINTER_EXT(5356);
public final int value;
private SPIRVDecoration() {
value = ordinal();
}
private SPIRVDecoration(int val) {
value = val;
}
private static SPIRVDecoration[] linearValues;
static {
ArrayList<SPIRVDecoration> vals = new ArrayList<>();
for(SPIRVDecoration e : values()) {
if (e.ordinal() == e.value) {
vals.ensureCapacity(e.value+1);
vals.set(e.value, e);
}
}
linearValues = vals.toArray(new SPIRVDecoration[0]);
}
public static SPIRVDecoration parse(int val) {
if (val < 0) return null;
if (val < linearValues.length) {
SPIRVDecoration eval = linearValues[val];
if (eval != null) return eval;
}
for(SPIRVDecoration eval : values()) if (eval.value == val) return eval;
return null;
}
}
| [
"[email protected]"
]
| |
9d8e8426632b2f3b0586b0c727bfc426ae195da6 | 274f84362808387502642ceebc055ae6d299cab7 | /src/com/fang/roll/DataColumn.java | f017f4a728974b59d1a8301a90a4fdb09aa82637 | []
| no_license | qiufengyouyang/MyFirstWEB | d5311db0cfb00eb2f1402d2e00ee1aa5c83ffc5e | 45d3b4f773feb5776f47d26433626e5032ad9312 | refs/heads/master | 2021-01-12T13:17:40.084927 | 2016-12-02T01:13:07 | 2016-12-02T01:13:07 | 72,180,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,412 | java | //package com.fang.roll;
//
//import com.mysql.jdbc.StringUtils;
//
//public class DataColumn {
// private boolean readOnly; // 只读
//
// //private DataTable table; // dataTable的引用
//
// private String columnName; // 列名
//
// private String captionName; // 显示名称
//
// private Object tag;// //通过tag对象保存公式配置
//
// private int columnIndex;// 列索引
//
// private int dataType;// 列数据类型
//
// private String dataTypeName;// 数据类型名称
//
// private boolean isDisplayed = true; // 是否显示
//
// public DataColumn() {
// this("default1");
// }
//
// public DataColumn(int dataType) {
// this("default1", dataType);
// }
//
// public DataColumn(String columnName) {
// this(columnName, 0);
// }
//
// public DataColumn(String columnName, int dataType) {
// this.setDataType(dataType);
// this.columnName = columnName;
// }
//
// public String getColumnName() {
// return this.columnName;
// }
//
// public void setColumnName(String columnName) {
// this.columnName = columnName;
// captionName = columnName;
// }
//
// public String getCaptionName() {
// return captionName;
// }
//
// public void setCaptionName(String captionName) {
// this.captionName = captionName;
// }
//
// public boolean isReadOnly() {
// return this.readOnly;
// }
//
// public void setReadOnly(boolean readOnly) {
// this.readOnly = readOnly;
// }
//
// public DataTable getTable() {
// return this.table;
// }
//
// public void setTable(DataTable table) {
// this.table = table;
// }
//
// /**
// * @param dataType
// */
// public void setDataType(int dataType) {
// this.dataType = dataType;
// }
//
// /**
// * @return the dataType
// */
// public int getDataType() {
// return dataType;
// }
//
// /**
// * @param columnIndex
// */
// public void setColumnIndex(int columnIndex) {
// this.columnIndex = columnIndex;
// }
//
// /**
// * @return the columnIndex
// */
// public int getColumnIndex() {
// return columnIndex;
// }
//
// public String getDataTypeName() {
// return DataTypes.getDataTypeName(dataType);
// }
//
// /**
// * 功能描述: 将输入数据转为当前列的数据类型返回
// *
// * @param
// * @return: Object
// * @author: James Cheung
// * @version: 2.0
// */
// public Object convertTo(Object value) {
// return value;
// }
//
// @Override
// public String toString() {
// return this.columnName;
// }
//
// /**
// * @param tag
// */
// public void setTag(Object tag) {
// this.tag = tag;
// }
//
// /**
// * @return the tag
// */
// public Object getTag() {
// return tag;
// }
//
// /**
// * @return the isDisplayed
// */
// public boolean isDisplayed() {
// return isDisplayed;
// }
//
// /**
// * @param isDisplayed
// */
// public void setDisplayed(boolean isDisplayed) {
// this.isDisplayed = isDisplayed;
// }
//
//}
| [
"[email protected]"
]
| |
d9d4a05cb572f30cabd0bc0b08a61f01fbe5908d | dc646645d88c21f4fe025df2cd30fd35ecf64b5a | /src/main/java/com/xyz/portal/domain/entity/DefaultConfig.java | 725e9c3176166988220dd366522283eaf2b35549 | []
| no_license | Dalgee/portal | 0381b7fee7d19b819cea5d912aa594605b074209 | 34baeebac02b3651272daf82c24fdfa3e9a6f86c | refs/heads/master | 2020-03-28T23:04:31.893107 | 2018-09-19T08:16:39 | 2018-09-19T08:16:39 | 149,274,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 523 | java | package com.xyz.portal.domain.entity;
import lombok.Data;
import lombok.ToString;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Data
@ToString
@Table(name="default_config")
public class DefaultConfig implements Serializable {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
@Column(name="default_config_id")
private long defaultConfigId;
@Column(name="name", nullable=false)
private String name;
@Column(name="value", nullable=false)
private String value;
}
| [
"[email protected]"
]
| |
bcee7360ee17128e582cc7be6cfbb4fdf6a2bbc4 | 3f6ad6b21eb854190bce796f01fac012a9cdf261 | /springiocaop/src/main/java/cursojava/spring/ioc/anotaciones/Asinc.java | cdc7755b19fdc5d745016edd32065c39dfaa0b61 | []
| no_license | Jermaniac/Java-Spring-Formacion | b3592035c2b2d38bb928496e6d761d9ff2bda83e | 9917eec04ef100052ed539bb9507b1979867ba27 | refs/heads/master | 2023-03-14T15:26:23.087497 | 2021-03-10T15:48:53 | 2021-03-10T15:48:53 | 346,408,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 456 | java | package cursojava.spring.ioc.anotaciones;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.beans.factory.annotation.Qualifier;
@Target({ElementType.TYPE,ElementType.FIELD,ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Qualifier("asincrono")
public @interface Asinc {
boolean value() default true;
}
| [
"[email protected]"
]
| |
6cbff9cbd5e4dff0b133bcdf8066992cd7a90182 | 36eb18e3d0fc534bc46e2807a1122983dc904a9f | /Java/Udemy/src/com/exercises/WallApp.java | 979a60630c4a1bbc1b84da017d1dbb9a3151e59c | []
| no_license | kunica777/Employees-management-application | bb66c201241c74a16925033dd717251486469366 | dfe26c6f33efd8b64fa6fc151c0754adb54514db | refs/heads/master | 2022-12-18T05:58:29.976899 | 2020-09-13T07:11:18 | 2020-09-13T07:11:18 | 294,995,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package com.exercises;
public class WallApp {
public static void main(String[] args) {
Wall wall = new Wall(-1.25,-1.25);
System.out.println("height = "+wall.getHeight());
System.out.println("width = "+wall.getWidth());
System.out.println("area= " + wall.getArea());
}
}
| [
"[email protected]"
]
| |
4304ae18943ef14eebf5d52724046d40e03a7973 | 0daa0492562f2fb2e59f91ae0d2f1755f065fe53 | /1_Java/ch13_interface/src/com/tj/ex09/Main.java | cdbcd958e69dc3595f62d26273c875c371e1ae91 | []
| no_license | bbarkji-programer/Today-what-I-have-learned | e4848a77f41977617493f540f6dfe170e663e2cf | 2bb56f2ce9d53a3fb196bf0907594d616c75be35 | refs/heads/master | 2020-12-10T22:30:36.392357 | 2020-01-14T01:12:21 | 2020-01-14T01:12:21 | 233,727,988 | 0 | 1 | null | null | null | null | TIS-620 | Java | false | false | 227 | java | package com.tj.ex09;
public class Main {
public static void main(String[] args) {
// I a = new A(); -> A method() รโทย
I a = new B(); // -> B method() รโทย
User user = new User();
user.use(a);
}
}
| [
"[email protected]"
]
| |
12180b96cf7cd7cdc08d13e50b519769cd77178c | 5037e5194be1406fc2259b79c550a28dddd230f3 | /src/test/java/pl/coderstrust/figures/TrapezoidTest.java | 1656a27f54b1edf3d996ae8662095fa2951646aa | []
| no_license | JKubicaLedzion/java-tasks | 36cd91cc92c11a275b020f0fc3081be9d62ef0c6 | ea017b9c2ea75fa0970ad4abc138929a454087bc | refs/heads/master | 2020-03-19T08:13:21.383880 | 2018-06-06T10:44:27 | 2018-06-06T10:44:27 | 134,691,691 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 903 | java | package pl.coderstrust.figures;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.InputMismatchException;
import static org.hamcrest.CoreMatchers.is;
@RunWith(JUnitParamsRunner.class)
public class TrapezoidTest {
@Test(expected = InputMismatchException.class)
public void calculateAreaWhenNegativeInputExceptionThrown() {
Trapezoid trapezoid = new Trapezoid(-2, 7, 1);
}
@Test
@Parameters({"1, 3, 1, 2", "0, 1, 3, 0", "0.6, 0.9, 0.3, 0.36", "4.27, 11.35, 5, 34.91"})
public void calculateAreaWhenPositiveInputAreaReturned(
double height, double base1, double base2, double expectedResult) {
Trapezoid trapezoid = new Trapezoid(height, base1, base2);
double result = trapezoid.calculateArea();
Assert.assertThat(result, is(expectedResult));
}
}
| [
"[email protected]"
]
| |
f330561f8d36b70d208ae3f5ac16b54ef5e58cdd | a1b7be9737ca5e5e3f5d29582739b04059db6382 | /src/com/leetcode/leetcode_problems/No1640.java | 50b0a59f7038863e9422eea1bca7fc240bb3f9eb | []
| no_license | kc-54/leetcode_problems | a74f489d00274cb1be14f10f109b3216b2904b35 | 55c491f265be7e04806b45f02b6404c55ac64921 | refs/heads/master | 2023-01-22T19:05:28.871084 | 2020-11-30T08:14:01 | 2020-11-30T08:14:01 | 310,336,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,675 | java | package com.leetcode.leetcode_problems;
public class No1640 {
//https://leetcode.com/problems/check-array-formation-through-concatenation/
//1640. Check Array Formation Through Concatenation
public static void main(String[] args) {
// TODO Auto-generated method stub
int [] arr = {91,4,64,78};
int [][]pieces = {{78}, {4,64}, {91}};
System.out.println(canFormArray(arr, pieces));
}
//Using stringbuilder
//runtime 1 ms
public static boolean canFormArray(int[] arr, int[][] pieces) {
StringBuilder sb = new StringBuilder();
for(int i : arr) {
sb.append(i);
sb.append(",");
}
for(int i = 0; i < pieces.length; i++) {
StringBuilder cur = new StringBuilder();
for(int j = 0; j < pieces[i].length; j++) {
cur.append(pieces[i][j]);
cur.append(",");
}
if(!sb.toString().contains(cur.toString()))return false;
}
return true;
}
//using brute force
//run time 7ms
public static boolean canFormArray_1(int[] arr, int[][] pieces) {
for(int i = 0; i < arr.length; i++) {
boolean found = false;
for(int j = 0; j < pieces.length; j++) {
System.out.println("b " + arr[i] + " " + pieces[j][0]);
if(arr[i] == pieces[j][0]) {
int k = pieces[j].length;
int l = 1;
while(l < k) {
i++;
System.out.println("a " + arr[i] + " " + pieces[j][l]);
if(arr[i] != pieces[j][l])return false;
l++;
}
found = true;
}
}
System.out.println(i);
if(!found)return false;
}
return true;
}
}
| [
"[email protected]"
]
| |
9852448f9b904bf4fc2183451abffe653ef69a95 | 2564b66f90fe133d5ca32406ad3b6ecd1180b2ab | /src/main/java/com/lookbr/backend/domain/Signup.java | 5c9eb651d5b622469b325dad10843d82545d5438 | []
| no_license | BulkSecurityGeneratorProject/lookbrbackendv2 | 712c88ac697d1fb12736bef83c04107898b290a0 | 5495365c9e6ea4254a9f3481c078ce3d167ecd71 | refs/heads/master | 2022-12-15T02:18:37.395195 | 2017-12-11T21:29:37 | 2017-12-11T21:29:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,359 | java | package com.lookbr.backend.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import org.springframework.data.elasticsearch.annotations.Document;
import java.io.Serializable;
import java.util.Objects;
import com.lookbr.backend.domain.enumeration.LoginType;
/**
* A Signup.
*/
@Entity
@Table(name = "signup")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "signup")
public class Signup implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "email")
private String email;
@Enumerated(EnumType.STRING)
@Column(name = "login_type")
private LoginType loginType;
@Column(name = "jhi_password")
private String password;
@Column(name = "profile_photo_url")
private String profilePhotoUrl;
@Column(name = "profile_photo")
private String profilePhoto;
@Column(name = "username")
private String username;
@Column(name = "token")
private String token;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEmail() {
return email;
}
public Signup email(String email) {
this.email = email;
return this;
}
public void setEmail(String email) {
this.email = email;
}
public LoginType getLoginType() {
return loginType;
}
public Signup loginType(LoginType loginType) {
this.loginType = loginType;
return this;
}
public void setLoginType(LoginType loginType) {
this.loginType = loginType;
}
public String getPassword() {
return password;
}
public Signup password(String password) {
this.password = password;
return this;
}
public void setPassword(String password) {
this.password = password;
}
public String getProfilePhotoUrl() {
return profilePhotoUrl;
}
public Signup profilePhotoUrl(String profilePhotoUrl) {
this.profilePhotoUrl = profilePhotoUrl;
return this;
}
public void setProfilePhotoUrl(String profilePhotoUrl) {
this.profilePhotoUrl = profilePhotoUrl;
}
public String getProfilePhoto() {
return profilePhoto;
}
public Signup profilePhoto(String profilePhoto) {
this.profilePhoto = profilePhoto;
return this;
}
public void setProfilePhoto(String profilePhoto) {
this.profilePhoto = profilePhoto;
}
public String getUsername() {
return username;
}
public Signup username(String username) {
this.username = username;
return this;
}
public void setUsername(String username) {
this.username = username;
}
public String getToken() {
return token;
}
public Signup token(String token) {
this.token = token;
return this;
}
public void setToken(String token) {
this.token = token;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Signup signup = (Signup) o;
if (signup.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), signup.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Signup{" +
"id=" + getId() +
", email='" + getEmail() + "'" +
", loginType='" + getLoginType() + "'" +
", password='" + getPassword() + "'" +
", profilePhotoUrl='" + getProfilePhotoUrl() + "'" +
", profilePhoto='" + getProfilePhoto() + "'" +
", username='" + getUsername() + "'" +
", token='" + getToken() + "'" +
"}";
}
}
| [
"[email protected]"
]
| |
55752edb86811988ee6e50b9ae1280cafc0e2d72 | 543d71663dddf364777ef8715390748163bf2567 | /src/main/java/com/egfavre/MicroblogSpringApplication.java | ccde4ffc60f1f21d5c94a13123ef1eba24f69c7a | []
| no_license | egfavre/SpringMicroblog | adc1fc0d6b377fb6174e33d959b70d988ed23aef | f1b197d5bcc424562f3e4175ca081ef9b074396d | refs/heads/master | 2020-03-28T05:27:08.180470 | 2016-06-20T20:42:15 | 2016-06-20T20:42:15 | 61,578,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | package com.egfavre;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MicroblogSpringApplication {
public static void main(String[] args) {
SpringApplication.run(MicroblogSpringApplication.class, args);
}
}
| [
"[email protected]"
]
| |
da430fd951e52cb45fe2f19e9e56c456799686e5 | e5962e643f438cf99eadb053e693374b5e316973 | /src/SERVEUR/ClientThread.java | e3d6eba04f1fd0b673b2e6b31bdd42d1f1b6ad12 | []
| no_license | AntoineMaringue/SNS | 2ef6340b790b3cf09a40780fdee6ffc10b30a3d8 | 6ca97f96606732e57bcc7fe3be2a5bc1ef648298 | refs/heads/master | 2016-09-05T13:05:22.133093 | 2013-09-02T09:24:08 | 2013-09-02T09:24:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,711 | java | package SERVEUR;
import java.net.*;
import java.io.*;
class ClientThread implements Runnable
{
private Thread _t; // contiendra le thread du client
private Socket _s; // recevra le socket liant au client
private PrintWriter _out; // pour gestion du flux de sortie
private BufferedReader _in; // pour gestion du flux d'entree
private Serveur _servSns; // pour utilisation des methodes de la classe principale
private int _numClient=0; // contiendra le numero de client gere par ce thread
public ClientThread(Socket s, Serveur sns)
{
_servSns=sns;
_s=s;
try
{
// fabrication d'une variable permettant l'utilisation du flux de sortie avec des string
_out = new PrintWriter(_s.getOutputStream());
// fabrication d'une variable permettant l'utilisation du flux d'entr�e avec des string
_in = new BufferedReader(new InputStreamReader(_s.getInputStream()));
// ajoute le flux de sortie dans la liste et r�cup�ration de son numero
_numClient = sns.addClient(_out);
}
catch (IOException e){ }
_t = new Thread(this); // instanciation du thread
_t.start(); // demarrage du thread, la fonction run() est ici lanc�e
}
public void run()
{
//R�cup�ration des informations envoy�e par le t�l�phone android
//BufferedReader br = null;
String isbn = "";
//Envoi des donn�es sur le (status) des traitements effectu� par le serveur
DataOutputStream dos = null;
// on indique dans la console la connection d'un nouveau client
System.out.println("Un nouveau client s'est connecte, no "+_numClient);
try
{
//r�cup�ration du code envoy� par le smartphone
//String isbn = _in.readLine();
//br = new BufferedReader(new InputStreamReader(_s.getInputStream()));
isbn = _in.readLine();//br.readLine();
if(!isbn.isEmpty() || !isbn.equals("q"))
{
dos=new DataOutputStream(_s.getOutputStream());
dos.writeBoolean(_servSns.traitement(isbn));
}
else if(isbn.equals("q"))
{
//System.exit(1);
}
}
catch (Exception e){ }
finally // finally se produira le plus souvent lors de la deconnexion du client
{
try
{
// on indique � la console la deconnexion du client
System.out.println("Le client no "+_numClient+" s'est deconnecte");
_servSns.delClient(_numClient); // on supprime le client de la liste
_s.close(); // fermeture du socket si il ne l'a pas d�j� �t� (� cause de l'exception lev�e plus haut)
}
catch (IOException e){ }
}
}
} | [
"[email protected]"
]
| |
e6c5b2bef002b84eaab9cb84baa75f71c0fbe2c9 | 570e571362e121890ade4e24c6b63dcf9089f7db | /src/main/java/net/fenton/core/event/InventoryClickListener.java | c4f6db73e032d6fff95c0eacec27bcbe97c71b5a | []
| no_license | Mikie/FentonCore | 94da8df21a6992db6e85cc98f20b5c5de2bf7c7b | 943d387f625fcb3587cf2b54b830b6776c2a5806 | refs/heads/master | 2021-01-20T06:28:48.321733 | 2017-04-29T15:50:21 | 2017-04-29T15:50:21 | 89,884,972 | 1 | 1 | null | 2017-05-01T00:10:10 | 2017-05-01T00:10:10 | null | UTF-8 | Java | false | false | 1,164 | java | package net.fenton.core.event;
import net.fenton.core.inventory.FentonInventory;
import net.fenton.core.inventory.FentonInventoryHandler;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import java.util.Map;
/**
*
* Created by Encast (2016-12-16 4:07 PM)
*
*/
public class InventoryClickListener implements Listener {
@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked();
Inventory i = e.getInventory();
ItemStack c = e.getCurrentItem();
Map<String, FentonInventory> menus = FentonInventoryHandler.getInstance().getAllMenus();
String inventoryName = ChatColor.stripColor(i.getName());
for(String s : menus.keySet()) {
if(inventoryName.equalsIgnoreCase(ChatColor.stripColor(menus.get(s).getName()))) {
e.setCancelled(true);
menus.get(s).onClick(p, c);
}
}
}
}
| [
"[email protected]"
]
| |
059f0cb95ea6762315990a7ca6f3496bba7f1eb2 | de101b04abfbd850e502756622c8e77fb1fcea97 | /StudentProjects/2015/Individual/M3113057_Faizal-Hamung-Nugroho/Praktikum 6/src/main/java/com/example/personal/aralist/MainActivity.java | 5b59928c22f018310cfb97adb4f604f8134a5a69 | []
| no_license | ivankusuma07/UNS_D3TI_ANDROID_CLASS | be5babf16db533ac3af0b7286d36ed5ecd218809 | 297392ed03d7e5675104970a9035273eb0a0589c | refs/heads/master | 2022-11-18T20:44:21.259809 | 2016-01-05T03:01:09 | 2016-01-05T03:01:09 | 41,787,680 | 0 | 0 | null | 2015-09-02T07:51:35 | 2015-09-02T07:51:35 | null | UTF-8 | Java | false | false | 1,993 | java | package com.example.personal.aralist;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import java.util.ArrayList;
public class MainActivity extends Activity implements OnClickListener
{
private Button btnAdd;
private Button btnDel;
private EditText et;
private ListView lv;
ArrayList<String> list = new ArrayList<String>();
ArrayAdapter<String> adapter;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnAdd = (Button)findViewById(R.id.addTaskBtn);
btnAdd.setOnClickListener(this);
btnDel = (Button)findViewById(R.id.DeleteButton);
btnDel.setOnClickListener(this);
et = (EditText)findViewById(R.id.editText);
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, list);
// set the lv variable to your list in the xml
lv=(ListView)findViewById(R.id.list);
lv.setAdapter(adapter);
}
int posisitask;
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.addTaskBtn:
String input = et.getText().toString();
if(input.length() > 0)
{
// add string to the adapter, not the listview
adapter.add(input);
// no need to call adapter.notifyDataSetChanged(); as it is done by the adapter.add() method
}
break;
case R.id.DeleteButton:
list.remove(posisitask);
et.setText("");
lv.setAdapter(adapter);
default:
break;
}
}
} | [
"[email protected]"
]
| |
399dd7768c3b648c9af0412a5664bb03dc48e598 | f7a25da32609d722b7ac9220bf4694aa0476f7b2 | /net/minecraft/stats/RecipeBook.java | c4889950bcc85ca0108cdb6d6797a6c223cdf81a | []
| no_license | basaigh/temp | 89e673227e951a7c282c50cce72236bdce4870dd | 1c3091333f4edb2be6d986faaa026826b05008ab | refs/heads/master | 2023-05-04T22:27:28.259481 | 2021-05-31T17:15:09 | 2021-05-31T17:15:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,554 | java | package net.minecraft.stats;
import net.minecraft.world.inventory.SmokerMenu;
import net.minecraft.world.inventory.BlastFurnaceMenu;
import net.minecraft.world.inventory.FurnaceMenu;
import net.minecraft.world.inventory.RecipeBookMenu;
import javax.annotation.Nullable;
import net.minecraft.world.item.crafting.Recipe;
import java.util.Collection;
import com.google.common.collect.Sets;
import net.minecraft.resources.ResourceLocation;
import java.util.Set;
public class RecipeBook {
protected final Set<ResourceLocation> known;
protected final Set<ResourceLocation> highlight;
protected boolean guiOpen;
protected boolean filteringCraftable;
protected boolean furnaceGuiOpen;
protected boolean furnaceFilteringCraftable;
protected boolean blastingFurnaceGuiOpen;
protected boolean blastingFurnaceFilteringCraftable;
protected boolean smokerGuiOpen;
protected boolean smokerFilteringCraftable;
public RecipeBook() {
this.known = (Set<ResourceLocation>)Sets.newHashSet();
this.highlight = (Set<ResourceLocation>)Sets.newHashSet();
}
public void copyOverData(final RecipeBook ys) {
this.known.clear();
this.highlight.clear();
this.known.addAll((Collection)ys.known);
this.highlight.addAll((Collection)ys.highlight);
}
public void add(final Recipe<?> ber) {
if (!ber.isSpecial()) {
this.add(ber.getId());
}
}
protected void add(final ResourceLocation qv) {
this.known.add(qv);
}
public boolean contains(@Nullable final Recipe<?> ber) {
return ber != null && this.known.contains(ber.getId());
}
public void remove(final Recipe<?> ber) {
this.remove(ber.getId());
}
protected void remove(final ResourceLocation qv) {
this.known.remove(qv);
this.highlight.remove(qv);
}
public boolean willHighlight(final Recipe<?> ber) {
return this.highlight.contains(ber.getId());
}
public void removeHighlight(final Recipe<?> ber) {
this.highlight.remove(ber.getId());
}
public void addHighlight(final Recipe<?> ber) {
this.addHighlight(ber.getId());
}
protected void addHighlight(final ResourceLocation qv) {
this.highlight.add(qv);
}
public boolean isGuiOpen() {
return this.guiOpen;
}
public void setGuiOpen(final boolean boolean1) {
this.guiOpen = boolean1;
}
public boolean isFilteringCraftable(final RecipeBookMenu<?> azq) {
if (azq instanceof FurnaceMenu) {
return this.furnaceFilteringCraftable;
}
if (azq instanceof BlastFurnaceMenu) {
return this.blastingFurnaceFilteringCraftable;
}
if (azq instanceof SmokerMenu) {
return this.smokerFilteringCraftable;
}
return this.filteringCraftable;
}
public boolean isFilteringCraftable() {
return this.filteringCraftable;
}
public void setFilteringCraftable(final boolean boolean1) {
this.filteringCraftable = boolean1;
}
public boolean isFurnaceGuiOpen() {
return this.furnaceGuiOpen;
}
public void setFurnaceGuiOpen(final boolean boolean1) {
this.furnaceGuiOpen = boolean1;
}
public boolean isFurnaceFilteringCraftable() {
return this.furnaceFilteringCraftable;
}
public void setFurnaceFilteringCraftable(final boolean boolean1) {
this.furnaceFilteringCraftable = boolean1;
}
public boolean isBlastingFurnaceGuiOpen() {
return this.blastingFurnaceGuiOpen;
}
public void setBlastingFurnaceGuiOpen(final boolean boolean1) {
this.blastingFurnaceGuiOpen = boolean1;
}
public boolean isBlastingFurnaceFilteringCraftable() {
return this.blastingFurnaceFilteringCraftable;
}
public void setBlastingFurnaceFilteringCraftable(final boolean boolean1) {
this.blastingFurnaceFilteringCraftable = boolean1;
}
public boolean isSmokerGuiOpen() {
return this.smokerGuiOpen;
}
public void setSmokerGuiOpen(final boolean boolean1) {
this.smokerGuiOpen = boolean1;
}
public boolean isSmokerFilteringCraftable() {
return this.smokerFilteringCraftable;
}
public void setSmokerFilteringCraftable(final boolean boolean1) {
this.smokerFilteringCraftable = boolean1;
}
}
| [
"[email protected]"
]
| |
1d1c9a959bacb513039d6f9f841df0d4e76a85d7 | c2d02aea7bad8320fb0b7437a6a493a61468d3b1 | /src/com/designpatterns/facade/TrasferBookingImpl.java | 525b5b88897b5ce07f698c3fb7c296824648bc2f | []
| no_license | shobhan-m/nisumpocs | ea703ef8e0c2b8f0f19c4d82b50baf0cd3358f7f | c06e2a3d9d4afb5527bcedfe6d2d65c1604851b7 | refs/heads/master | 2021-05-14T07:12:02.106821 | 2018-01-04T12:28:28 | 2018-01-04T12:28:28 | 116,256,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package com.designpatterns.facade;
public class TrasferBookingImpl implements TrasferBooking{
@Override
public void book() {
System.out.println("Transfer booked successfully");
}
} | [
"[email protected]"
]
| |
256d0115e02dd2a190cf49e8166232376726e81c | a2fb305d626767e56e126bed6ced7ae7f7b40472 | /android/app/src/main/java/generatorapp/generator_app/MainActivity.java | 20ec8acd50a3efce8772bc6c649ab1b405ea2291 | []
| no_license | HostelIG/firebase_flutter | 93abe4d4a93606ad17a88db820a0594bad948c76 | 1f036ddec7a2a3b3d13da935f5ce17bf0ad32f29 | refs/heads/master | 2021-05-23T01:01:10.333071 | 2020-04-03T05:39:43 | 2020-04-03T05:39:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 430 | java | package flutter.firebase_app;
import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
| [
"[email protected]"
]
| |
9a5de0b893f04a9d525d81d46cfb0fa72af3fb6e | bddcad41d21bd431c01cb6977b656cd153136af5 | /xds/src/test/java/io/grpc/xds/XdsClientTest.java | 70cc3ef253c2cdd25b304696401804943ec1fcc3 | [
"Apache-2.0"
]
| permissive | heroInCommunity/grpc-test | cacb4d9ff6ee87a06cfe363343b63f472adb658f | 08030e290057b20879bdd113d049a2c43d5dabe5 | refs/heads/master | 2021-01-01T07:56:00.164550 | 2020-06-08T15:23:30 | 2020-06-08T15:23:30 | 239,182,662 | 0 | 0 | Apache-2.0 | 2020-10-13T19:23:18 | 2020-02-08T18:29:20 | Java | UTF-8 | Java | false | false | 4,191 | java | /*
* Copyright 2019 The gRPC Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.grpc.xds;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import io.grpc.xds.XdsClient.ClusterUpdate;
import io.grpc.xds.XdsClient.RefCountedXdsClientObjectPool;
import io.grpc.xds.XdsClient.XdsClientFactory;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/**
* Unit tests for {@link XdsClient}.
*/
@RunWith(JUnit4.class)
public class XdsClientTest {
@Rule
public final ExpectedException thrown = ExpectedException.none();
@Test
public void buildClusterUpdate_defaultToClusterNameWhenEdsServiceNameNotSet() {
ClusterUpdate clusterUpdate1 =
ClusterUpdate.newBuilder()
.setClusterName("foo.googleapis.com")
.setEdsServiceName("bar.googleapis.com")
.setLbPolicy("round_robin")
.build();
assertThat(clusterUpdate1.getEdsServiceName()).isEqualTo("bar.googleapis.com");
ClusterUpdate clusterUpdate2 =
ClusterUpdate.newBuilder()
.setClusterName("foo.googleapis.com")
.setLbPolicy("round_robin")
.build();
assertThat(clusterUpdate2.getEdsServiceName()).isEqualTo("foo.googleapis.com");
}
@Test
public void refCountedXdsClientObjectPool_getObjectShouldMatchReturnObject() {
XdsClientFactory xdsClientFactory = new XdsClientFactory() {
@Override
XdsClient createXdsClient() {
return mock(XdsClient.class);
}
};
RefCountedXdsClientObjectPool xdsClientPool =
new RefCountedXdsClientObjectPool(xdsClientFactory);
// getObject once
XdsClient xdsClient = xdsClientPool.getObject();
assertThat(xdsClient).isNotNull();
// getObject twice
assertThat(xdsClientPool.getObject()).isSameInstanceAs(xdsClient);
// returnObject once
assertThat(xdsClientPool.returnObject(xdsClient)).isNull();
verify(xdsClient, never()).shutdown();
// returnObject twice
assertThat(xdsClientPool.returnObject(xdsClient)).isNull();
verify(xdsClient).shutdown();
assertThat(xdsClientPool.xdsClient).isNull();
thrown.expect(IllegalStateException.class);
// returnOject for the 3rd time
xdsClientPool.returnObject(xdsClient);
}
@Test
public void refCountedXdsClientObjectPool_returnWrongObjectShouldThrow() {
XdsClientFactory xdsClientFactory = new XdsClientFactory() {
@Override
XdsClient createXdsClient() {
return mock(XdsClient.class);
}
};
RefCountedXdsClientObjectPool xdsClientPool =
new RefCountedXdsClientObjectPool(xdsClientFactory);
xdsClientPool.getObject();
thrown.expect(IllegalStateException.class);
xdsClientPool.returnObject(mock(XdsClient.class));
}
@Test
public void refCountedXdsClientObjectPool_getObjectCreatesNewInstanceIfAlreadyShutdown() {
XdsClientFactory xdsClientFactory = new XdsClientFactory() {
@Override
XdsClient createXdsClient() {
return mock(XdsClient.class);
}
};
RefCountedXdsClientObjectPool xdsClientPool =
new RefCountedXdsClientObjectPool(xdsClientFactory);
XdsClient xdsClient1 = xdsClientPool.getObject();
verify(xdsClient1, never()).shutdown();
assertThat(xdsClientPool.returnObject(xdsClient1)).isNull();
verify(xdsClient1).shutdown();
XdsClient xdsClient2 = xdsClientPool.getObject();
assertThat(xdsClient2).isNotSameInstanceAs(xdsClient1);
}
}
| [
"[email protected]"
]
| |
54ab512e3b27f5b6abeecdb468f45ec184e4ab1c | 26609f49d6cbfd18f6d482a1e6327dbdbc7116ca | /conference/conference-first-boot-app/src/main/java/com/learning/conference/conferencefirstbootapp/repositories/SessionRepository.java | 284fe44f291195381cffc13ba8de0e809ad4a15e | []
| no_license | KamiNoZetsubou/SpringBeginner | dfc737ffecaea7bf49046c373755547be00ab6a8 | 5df8d9924d3beaa5913e0312e12fba52ce51338f | refs/heads/main | 2023-06-24T20:42:09.219421 | 2021-07-16T03:56:59 | 2021-07-16T03:56:59 | 389,330,527 | 0 | 0 | null | 2021-07-25T11:24:42 | 2021-07-25T11:24:42 | null | UTF-8 | Java | false | false | 427 | java | package com.learning.conference.conferencefirstbootapp.repositories;
import com.learning.conference.conferencefirstbootapp.models.Session;
import org.springframework.data.jpa.repository.JpaRepository;
public interface SessionRepository extends JpaRepository<Session, Long> {
// derived query method
// the naming of the method is not arbitrary - it must follow certain rules
boolean existsSessionById(Long id);
}
| [
"[email protected]"
]
| |
67c73ba88842ad6c9be694771c45bcb81268ea55 | cfc769559622c15e0e35154f98f5d00d2406e284 | /workspace/chartBuilder/src/chartBuilder/Arrow.java | f80acb0bd5221443ad63c874b84a088140cf87ac | []
| no_license | micster88/schoolwork | f87477688c107cb5861abd585c95413c725598cc | b656e5053445057717e43d35e1cb96ebd2eb392f | refs/heads/master | 2021-01-20T11:17:25.154101 | 2017-04-29T21:31:20 | 2017-04-29T21:31:20 | 66,963,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,080 | java | package chartBuilder;
import csci348.drawings.SimpleDrawing;
//Arrow Class
class Arrow extends Shape {
private Line l1;
private Line l2;
private Line l3;
private int x1;
private int y1;
//Constructor
protected Arrow(int x, int y, int x1, int y1, SimpleDrawing draw) {
super(x, y, draw);
this.x1=x1;
this.y1=y1;
draw();
}
//Draws the Arrow, Algorithm had help from Kevin Dorsett
@Override
protected void draw(){
int width=x1-x;
int height=y1-y;
int xDist=width/10;
int yDist=height/10;
int nX=x1-xDist;
int nY=y1-yDist;
l1=new Line(x,y,x1,y1,draw);
l2=new Line(x1,y1,nX+yDist,nY-xDist,draw);
l3=new Line(x1,y1,nX-yDist,nY+xDist,draw);
}
//Erases the Arrow
@Override
protected void erase(){
l1.erase();
l2.erase();
l3.erase();
}
//Checks the Point by checking each line
@Override
protected boolean checkPoint(int pX, int pY){
if(l1.checkPoint(pX, pY)==true){
return true;
}
else if(l2.checkPoint(pX, pY)==true){
return true;
}
else if(l3.checkPoint(pX, pY)==true){
return true;
}
return false;
}
}
| [
"[email protected]"
]
| |
9a6f124864cb220285fa3479dc4f1c319efe1d41 | dcaa6931e184188fb295d7d8276147119d0e6733 | /app/src/main/java/com/chen/mingkai/flashgallery/PhotoBaseHelper.java | 27fab127bbe0247c02977c6f0df4b6c461684c28 | []
| no_license | mingkaic/QuickGalleryAndroid | de5b70a0c6a48fc40ea6e30c2a333d0fab57fa9b | 9ce102da41a32bc8b2687ad112f8579194f3b5e0 | refs/heads/master | 2021-05-01T16:39:48.925088 | 2015-10-18T21:38:19 | 2015-10-18T21:38:19 | 44,224,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,053 | java | package com.chen.mingkai.flashgallery;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.chen.mingkai.flashgallery.PhotoDbSchema.PhotoTable;
public class PhotoBaseHelper extends SQLiteOpenHelper {
private static final int VERSION = 1;
private static final String DATABASE_NAME = "photoBase.db";
public PhotoBaseHelper(Context context) {
super(context, DATABASE_NAME, null, VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table " + PhotoTable.NAME +
"( _id integer primary key autoincrement, " +
PhotoTable.Cols.UUID + ", " +
PhotoTable.Cols.Title + ", " +
PhotoTable.Cols.Date + ", " +
PhotoTable.Cols.Description +
")"
);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
| [
"[email protected]"
]
| |
f971262a689fa947296bc7b5eaad251f0304afcc | 943b3819b8b06387a9e18188fec3b17edca005ef | /boot/src/main/java/cn/remex/core/reflect/ReflectFeatureStatus.java | 982c6ff5742358ac723837303cb084c487d81313 | [
"MIT"
]
| permissive | miniants/miniarch | f762689c43545881b429e8d2b56afccbb2d38505 | 1df3cd6e3f089f0708fbbe127b39c73867487dfe | refs/heads/master | 2021-01-21T13:41:28.578415 | 2016-05-31T14:52:38 | 2016-05-31T14:52:38 | 46,357,929 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,772 | java | package cn.remex.core.reflect;
import cn.remex.RemexConstants;
import cn.remex.core.reflect.ReflectUtil.SPFeature;
/**
* 为了提高复制和置值的效率,设计此中转类<br>使状态值集中存储 节省计算和迭代的开销
* @author HengYang Liu
*/
public class ReflectFeatureStatus{
boolean isSPFeatureOn =false;
boolean ConvertNull2EmptyString=false;
boolean ConvertZero2EmptyString=false;
boolean IgnoreEmptyStringValue=false;
boolean EnableNullValue=false;
boolean enableDeeplyCopy=false;
boolean CopyIdAndDataStatus=false;
boolean CopyId=false;
boolean CopyDataStatus=false;
boolean IgnoreCase=false;
boolean JustUseNamePreffix=false;
boolean RemoveTargetGatherItemWhenSourceExclude = false;
boolean enableMethodMap=false;
boolean isDebugEnabled = RemexConstants.logger.isDebugEnabled();
SPFeature[] features;
public boolean enableCodeMap = false;
/**
* @rmx.summary 对特性功能的是否启用的布尔值进行遍历赋值<br>
* @param features 入参为8中特性功能的枚举数组
* @rmx.call ReflectUtil copyProperties
* @rmx.call ReflectUtil setProperties
* @rmx.call ReflectUtil invokeSetterIgnoreNoSetter
* @rmx.call MapHelper toObjcet
* @see ReflectUtil.SPFeature
*/
public ReflectFeatureStatus(SPFeature[] features) {
this.features = features;
isSPFeatureOn = null != features && features.length > 0;
// 特性功能
if (isSPFeatureOn) {
for (final SPFeature feature : features) {
switch (feature) {
case ConvertNull2EmptyString:// 将null转化为空字符串
ConvertNull2EmptyString=true;
break;
case ConvertZero2EmptyString:// 将0/0.0转化为空字符串
ConvertZero2EmptyString=true;
break;
case IgnoreEmptyStringValue:// 赋值时忽略空字符串,“”
IgnoreEmptyStringValue = true;
break;
case EnableNullValue: // 赋值时将对null使用。比如从源对象A中通过getName获得值null,将赋值给B.setName(null)。
// 此时原来B无论Name是否为null将被覆盖。
EnableNullValue = true;
break;
case DeeplyCopy:
enableDeeplyCopy = true;
break;
case CopyIdAndDataStatus:
CopyIdAndDataStatus=true;
CopyDataStatus=true;
CopyId=true;
break;
case IgnoreCase:
IgnoreCase=true;
break;
case JustUseNamePreffix:
JustUseNamePreffix=true;
break;
case RemoveTargetGatherItemWhenSourceExclude:
RemoveTargetGatherItemWhenSourceExclude=true;
break;
case CopyDataStatus:
CopyDataStatus=true;
CopyIdAndDataStatus = CopyId&&CopyDataStatus;
break;
case CopyId:
CopyId=true;
CopyIdAndDataStatus = CopyId&&CopyDataStatus;
break;
default:
break;
}
}
}
}
}
| [
"[email protected]"
]
| |
cf65bf3e5eba6aeafae985e376e257c1530a7788 | fec5a7157473a25b68db77de911e3ead805fab5b | /javatest/src/main/java/com/example/designpattern/facade/Sensor.java | aa2b37d413b450a19104016a2292741dae0547a0 | []
| no_license | oceanhai/MyFrame | b0c75b8af0d61fa4102842c0817e419773c5f7e8 | 1bc59b114db07edcbf432c07b2c9043eeab2a0e5 | refs/heads/master | 2020-04-12T10:09:44.064775 | 2019-07-31T14:26:09 | 2019-07-31T14:26:09 | 65,266,635 | 17 | 8 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | package com.example.designpattern.facade;
/**
* Created by wuhai on 2017/10/24 13:54.
* 描述:
*/
public class Sensor {
public void Activate()
{
Console.WriteLine("Activating the sensor.");
}
public void Deactivate()
{
Console.WriteLine("Deactivating the sensor.");
}
public void Trigger()
{
Console.WriteLine("The sensor has triggered.");
}
}
| [
"[email protected]"
]
| |
052cfface97e29d9c91925aacb93fb8b6f1525ce | 9601847ed1aa02432bcd94c03149d1b2b2da50c7 | /app/src/test/java/com/honesty/jnistudy/ExampleUnitTest.java | 0927ebdab4c1da8283491f9987732c225d10314d | []
| no_license | honestyfly/JNIStudy | 6609d91d221ff468f1e306b61c8aa7098761c424 | 1e1f15e99377a986e0f1e5c3bd892e175bc4a7d4 | refs/heads/master | 2020-04-30T16:42:06.333175 | 2019-03-21T14:04:32 | 2019-03-21T14:04:32 | 176,956,579 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package com.honesty.jnistudy;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
ee4147ab1bfab5e11e7086b4d74ce8e0ab49bfe4 | 64a59a72a4d6d198ea8d1eaf455c9db35b8bba6f | /sqaLearningMaven/src/main/java/basicLearning/Hw0110Exercise5.java | e28e6e81c123102742a2822338cd02d608ccc0e7 | []
| no_license | DungNguyenSQA/sqa_repo | df0536d9e99bd7974cd9e3f6a666596ac0db5027 | 877a54e3bbe8e4d6378f460fd990b9b1729a5a73 | refs/heads/master | 2020-12-30T09:57:30.850191 | 2015-04-09T05:25:37 | 2015-04-09T05:25:37 | 29,897,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package basicLearning;
public class Hw0110Exercise5 {
public static void main(String[] args) {
// Exercise 5: Define a function �addArray� that:
// � Accepts one int array
// � Print the size of the array
// � Returns the sum of array to caller.
//
int varSize = 5;
int[] varArr = new int[varSize];
for (int i = 0; i < varSize; i++){
varArr[i] = i+1;
}
System.out.println("Sum of array : "+addArray(varArr));
}
public static int addArray(int[] inputArr){
int sum=0;
System.out.println("Size of array : "+inputArr.length);
for (int i=0; i<inputArr.length; i++){ // or use for(int element : inputArr){
sum += inputArr[i]; // sum += element;}
}
return sum;
}
} | [
"[email protected]"
]
| |
4c9bf95b989c809c2ae36312fcac337936230f94 | ba39c24e4176fea1c606c2b53dece6d1a354609a | /app/src/main/java/com/aboluo/model/UnaryDetailBean.java | f1c5cc11704aea22f0c86e76ffd4cc7e9fbc007e | []
| no_license | woaicaojing0/AboluoProject | b6c2fecb9a90fe26b10284d1c514f11bf9063308 | 6ada3ac88bb8ed4c27026f6f808e513ebe44e47f | refs/heads/master | 2023-08-31T15:01:51.197742 | 2023-08-31T08:22:41 | 2023-08-31T08:22:41 | 67,567,984 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,292 | java | package com.aboluo.model;
import com.google.gson.Gson;
/**
* Created by cj on 2017/5/2.
*/
public class UnaryDetailBean {
/**
* AddTotalCount : 1
* OneTimes : 1007
* MemberNickName : ✨浩丿冬祭
* ThisWinLotteryNumber : 无
* LastWinLotteryNumber : 无
* IsSuccess : true
* Message : null
* Result : null
*/
private int AddTotalCount;
private String OneTimes;
private String MemberNickName;
private String ThisWinLotteryNumber;
private String LastWinLotteryNumber;
private boolean IsSuccess;
private Object Message;
private Object Result;
public static UnaryDetailBean objectFromData(String str) {
return new Gson().fromJson(str, UnaryDetailBean.class);
}
public int getAddTotalCount() {
return AddTotalCount;
}
public void setAddTotalCount(int AddTotalCount) {
this.AddTotalCount = AddTotalCount;
}
public String getOneTimes() {
return OneTimes;
}
public void setOneTimes(String OneTimes) {
this.OneTimes = OneTimes;
}
public String getMemberNickName() {
return MemberNickName;
}
public void setMemberNickName(String MemberNickName) {
this.MemberNickName = MemberNickName;
}
public String getThisWinLotteryNumber() {
return ThisWinLotteryNumber;
}
public void setThisWinLotteryNumber(String ThisWinLotteryNumber) {
this.ThisWinLotteryNumber = ThisWinLotteryNumber;
}
public String getLastWinLotteryNumber() {
return LastWinLotteryNumber;
}
public void setLastWinLotteryNumber(String LastWinLotteryNumber) {
this.LastWinLotteryNumber = LastWinLotteryNumber;
}
public boolean isIsSuccess() {
return IsSuccess;
}
public void setIsSuccess(boolean IsSuccess) {
this.IsSuccess = IsSuccess;
}
public Object getMessage() {
return Message;
}
public void setMessage(Object Message) {
this.Message = Message;
}
public Object getResult() {
return Result;
}
public void setResult(Object Result) {
this.Result = Result;
}
}
| [
"[email protected]"
]
| |
89f7f63d7bf0a457d151c1f3366c8586555e01a6 | 82ce4db22d32aab8262a7fc0faf1ba7c1d4cb451 | /exam/src/com/company/track/ProjectRecord/FixedProjectRecord.java | a8313e3fa4df3aa2f0f2468c6359022c592c7824 | []
| no_license | Dinindu98/Android-login-system | 93b7a83695d57a970661abbe518536fad3c93a4b | 43e1fa5d397233c43048f0d755e3be7c93c82c4b | refs/heads/master | 2020-08-16T21:56:13.038077 | 2019-10-21T18:19:08 | 2019-10-21T18:19:08 | 215,558,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 104 | java | package com.company.track.ProjectRecord;
public class FixedProjectRecord extends ProjectRecord {
}
| [
"[email protected]"
]
| |
7b59b2ced40e41b70a70ed6b26dc34ac095c3cbf | 86cd1090b1182f2832f0c6b2ccf28fb0b345610e | /AdvancedProgramming/DesignPattern/Code/src/main/java/test/pattern/action/command/impl/NoCommand.java | 8164f5e12855a9017ae96761528ec87b7312668a | []
| no_license | wanglei949758173/study | a7ada3fd81d706a518e7470b4a8aa3ddc497c0e2 | d54b7e6da9bc0baaea6d7590732ba2e77a663a69 | refs/heads/master | 2022-10-12T17:55:07.486651 | 2021-04-21T14:08:26 | 2021-04-21T14:08:26 | 174,473,949 | 0 | 0 | null | 2022-10-04T23:56:36 | 2019-03-08T05:20:26 | C# | UTF-8 | Java | false | false | 380 | java | /*
* 模块编号
* 功能描述
* 文件名 NoCommand.java
* 作者 王磊
* 编写日期 2020年05月07日
*/
package test.pattern.action.command.impl;
import test.pattern.action.command.Command;
public class NoCommand implements Command {
@Override
public void execute() {
// Nothing to do
}
@Override
public void undo() {
// Nothing to do
}
}
| [
"[email protected]"
]
| |
e870e9051bf848e0a42ce1d919a81ae9916fe3c5 | 0e32920be36664dc72af571f1e719fed16327260 | /gen/com/amirz/queryz/BuildConfig.java | 5685fca2f82bff68eefa2de84db82b29f6846e69 | [
"MIT"
]
| permissive | amimaro/queryz | 4c3f8d0dae1d3b3fbb537e092a26b76fde309fdf | b11189ac807bac4e56c69528e32837f04f8eb696 | refs/heads/master | 2022-09-08T14:27:20.453681 | 2020-05-24T13:23:56 | 2020-05-24T13:23:56 | 266,522,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | /** Automatically generated file. DO NOT MODIFY */
package com.amirz.queryz;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"[email protected]"
]
| |
6c359b61f9509a2ed91305c75030d098ca154a28 | 59909578ac83c84cf7aebb09b79c72e0900e88e6 | /src/main/java/com/fiskaly/sdk/results/ResultRequest.java | 7f7916b64880e9aee759def76c981ddc6a06db48 | [
"MIT"
]
| permissive | fiskaly/fiskaly-sdk-java | 225d224d5696df180e1a9c11267aa36bee623a0a | 346c2426fe201fa9616ae14e9f912383e5473b3f | refs/heads/master | 2023-07-09T16:15:44.629425 | 2021-05-12T16:31:50 | 2021-05-12T16:31:50 | 256,512,265 | 6 | 1 | MIT | 2021-08-12T09:41:54 | 2020-04-17T13:35:04 | Java | UTF-8 | Java | false | false | 371 | java | package com.fiskaly.sdk.results;
public class ResultRequest {
public final Response response;
public final String context;
public ResultRequest(final Response response, final String context) {
this.response = response;
this.context = context;
}
@Override
public String toString() {
return "ResultRequest{" + "response=" + response + '}';
}
}
| [
"[email protected]"
]
| |
61247b2f9905a65c3f7881867ea1d5c13c7eca27 | 9613181d25a7e4edb31c67ae94dbb415d205e70b | /src/main/java/com/spring/controller/TrainSetmealInforListController.java | f61ec0561f1e8ad79aeaeb4c6a1eb0bb33231c33 | []
| no_license | Desiom/brainsaas-train | 015d9a23a2ceb30bfa5d095c4d8424c2392506e0 | ff6e02d7dff98953bb48b5a304a7bb9b996e1664 | refs/heads/master | 2020-03-27T04:32:05.464759 | 2018-08-24T06:06:20 | 2018-08-24T06:06:20 | 145,948,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,291 | java | package com.spring.controller;
import com.spring.entity.TrainSetmealInforList;
import com.spring.enums.ResultEnum;
import com.spring.model.trainSetmealInforList.CreateTrainSetmealInforListModel;
import com.spring.model.trainSetmealInforList.UpdateTrainSetmealInforListModel;
import com.spring.servlet.trainSetmealInforList.TrainSetmealInforListService;
import com.spring.util.ResultVOUtil;
import com.spring.vo.ResultVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by Desiom on 2018/8/23.
*/
@RestController
@RequestMapping(value = "trainSetmealInforList")
public class TrainSetmealInforListController {
//使用log打印
private final static Logger logger = LoggerFactory.getLogger(TrainSetmealInforListController.class );
@Autowired
private TrainSetmealInforListService trainSetmealInforListService;
@RequestMapping("/toCreate")
public String toCreate(){
return "pages/trainSetmealInforList/create";
}
@RequestMapping("/create")
@ResponseBody
public ResultVO create(@Validated CreateTrainSetmealInforListModel trainSetmealInforListModel, BindingResult bindingResult){
// public ResultVO create(@Validated trainSetmealInforList trainSetmealInforListModel, BindingResult bindingResult){
trainSetmealInforListService.save(trainSetmealInforListModel);
return ResultVOUtil.success();
}
@RequestMapping("/toUpdate/{id}")
public String toUpdate(@PathVariable("id")String id, ModelMap modelMap){
TrainSetmealInforList trainSetmealInforList = trainSetmealInforListService.get(id);
modelMap.put("trainSetmealInforList",trainSetmealInforList);
return "pages/trainSetmealInforList/update";
}
@RequestMapping("/update")
@ResponseBody
public ResultVO update(@Validated UpdateTrainSetmealInforListModel trainSetmealInforListModel, BindingResult bindingResult){
// public ResultVO update(@Validated trainSetmealInforList trainSetmealInforListModel, BindingResult bindingResult){
trainSetmealInforListService.update(trainSetmealInforListModel);
return ResultVOUtil.success();
}
@RequestMapping("/delete/{ids}")
@ResponseBody
public ResultVO delete(@PathVariable("ids")String ids){
trainSetmealInforListService.delete(ids);
return ResultVOUtil.success();
}
/**
* 根据量表ID获取量表
* @param id
* @return
*/
@RequestMapping("/get/{id}")
@ResponseBody
public ResultVO get(@PathVariable("id")String id){
TrainSetmealInforList trainSetmealInforList = trainSetmealInforListService.get(id);
if (trainSetmealInforList == null) {
return ResultVOUtil.error(ResultEnum.GET_ERROR);
}
return ResultVOUtil.success(trainSetmealInforList);
}
}
| [
"[email protected]"
]
| |
60389f51a2e7ec44932e836fd73031949326566e | 856fa761c7d55efd994a8347fddaca93a0446354 | /src/main/java/com/cap/biz/repository/ProductRepository.java | be30ce0a5f8fe02dc890cf4527a540064f5fd97a | []
| no_license | nilesh456kumar/biz | 54521847824e067d8bfa0c9fcdff2f9ed08c0a46 | 13a5b60c9de7dd8b7dc1f6552f92ec3b24d0b282 | refs/heads/master | 2020-04-27T11:38:12.529357 | 2019-03-07T08:26:29 | 2019-03-07T08:26:29 | 174,302,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 514 | java | package com.cap.biz.repository;
import java.util.List;
import com.cap.biz.pojo.Product;
import com.cap.biz.repositoryImpl.ProductNotFoundException;
public interface ProductRepository {
void addProduct(Product product);
Product findByPid(String id)throws ProductNotFoundException;
List<Product> getProductList();
boolean deleteProduct(String id)throws ProductNotFoundException ;
Product editUser(Product toEditProduct)throws ProductNotFoundException;
}
| [
"[email protected]"
]
| |
da705674dc03dcfa7ce01aff6ac84e81a7cf8693 | b864111cd960035bd58d00f2e3608c1acdea14ff | /src/br/com/exemplo/generics/TesteMain.java | 804f454963ecc729d2d9eab0e85566d9f4dd2101 | []
| no_license | BrunoCarvalho18/generics-estudos-java | 202dd028cb1b14e06af1bcff6eeb5eb903b4875c | 908975d81ccf24fdc861f3ea1a0dc193097379b1 | refs/heads/master | 2020-12-20T20:25:48.208721 | 2020-01-25T17:11:11 | 2020-01-25T17:11:11 | 236,201,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java | package br.com.exemplo.generics;
public class TesteMain {
public static void main(String[] args) {
Teste<Integer> iObjeto = new Teste<Integer>(15);
System.out.println(iObjeto.getObjecto());
Teste<String> sObjeto = new Teste<String>("Bruno Aprendendo Java");
System.out.println(sObjeto.getObjecto());
}
}
| [
"[email protected]"
]
| |
c59725f5edeb8a89ac2652458b249bffa0220d96 | 6b40cb7735b48fd397af0288b03895a4010a031a | /src/main/java/com/w951/zsbus/news/action/OutsideAction.java | 2c2bb46e89b43a61677d50ed0ac488dc63be0f43 | []
| no_license | W951-ZSBUS/java-web-zsbus-news | c69908c3354ad27fd471d934b7252bb2d02aa213 | 71013bdf189f7a7bdbf0c3a15a1a991f5b928891 | refs/heads/master | 2016-09-02T03:49:05.969553 | 2014-06-06T08:49:46 | 2014-06-06T08:49:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,553 | java | package com.w951.zsbus.news.action;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import com.w951.util.action.CommonAction;
import com.w951.util.bean.BeanUtil;
import com.w951.util.date.DateUtil;
import com.w951.util.dto.User;
import com.w951.zsbus.news.dto.OutsideDTO;
import com.w951.zsbus.news.entity.Outside;
import com.w951.zsbus.news.service.OutsideService;
public class OutsideAction extends CommonAction {
private static final long serialVersionUID = -1L;
private JSONObject result;
private JSONArray resultArray;
private Map<String, Object> request;
private Map<String, Object> session;
@Resource
private OutsideService outsideService;
// 参数
private Outside outside;
private int page;
private int rows;
// Action
@Override
public String insert() throws Exception {
User admin = (User) session.get("admin");
outside.setOutsideCreatename(admin.getUserName());
outside.setOutsideCreatedate(DateUtil.getDateTime());
String message = outsideService.insert(outside);
if (message != null) {
jsonData.put("message", message);
}
result = JSONObject.fromObject(jsonData);
return SUCCESS;
}
@Override
public String delete() throws Exception {
String message = outsideService.delete(outside);
if (message != null) {
jsonData.put("message", message);
}
result = JSONObject.fromObject(jsonData);
return SUCCESS;
}
@Override
public String update() throws Exception {
String message = outsideService.update(outside);
if (message != null) {
jsonData.put("message", message);
}
result = JSONObject.fromObject(jsonData);
return SUCCESS;
}
@Override
public String query() throws Exception {
List<Outside> list = outsideService.queryPageList(page, rows);
OutsideDTO dto = null;
List<OutsideDTO> dtos = new ArrayList<OutsideDTO>();
if (list != null && list.size() > 0) {
for (Outside obj : list) {
dto = new OutsideDTO();
BeanUtil.beanToBean(dto, obj);
dtos.add(dto);
}
}
jsonData.put("total", outsideService.getCount());
jsonData.put("rows", dtos);
result = JSONObject.fromObject(jsonData);
return SUCCESS;
}
// Array
public String queryTreeArray() throws Exception {
List<OutsideDTO> dtos = outsideService.queryTreeByPid("0");
resultArray = JSONArray.fromObject(dtos);
return "array";
}
// getter setter
public Map<String, Object> getRequest() {
return request;
}
public void setRequest(Map<String, Object> request) {
this.request = request;
}
public Map<String, Object> getSession() {
return session;
}
public void setSession(Map<String, Object> session) {
this.session = session;
}
public JSONObject getResult() {
return result;
}
public void setResult(JSONObject result) {
this.result = result;
}
public Outside getOutside() {
return outside;
}
public void setOutside(Outside outside) {
this.outside = outside;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getRows() {
return rows;
}
public void setRows(int rows) {
this.rows = rows;
}
public JSONArray getResultArray() {
return resultArray;
}
public void setResultArray(JSONArray resultArray) {
this.resultArray = resultArray;
}
}
| [
"[email protected]"
]
| |
a010a1d6fccd0ebac6f7e34e8bc1526e4903c198 | a729373d8903d00494ba6d03c837dc2019028528 | /src/main/java/com/linkFlow/manager/common/dao/CommonTicketDao.java | 9d492513f0e896eee28ab259cb84a1897faaef12 | []
| no_license | LinkFlowDevTeam/manager | cbd41eb1536921c325ddf03f671e9ef2b5ad164a | 4a391e7f10016b9a743c89ec68580fa818f38fe4 | refs/heads/master | 2023-03-18T15:09:12.229603 | 2021-03-23T10:27:20 | 2021-03-23T10:27:20 | 350,665,421 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 610 | java | package com.linkFlow.manager.common.dao;
import com.linkFlow.manager.common.model.vo.CommonTicketVO;
import com.test32.common.generic.GenericDaoForBigInt;
import org.apache.ibatis.annotations.Mapper;
import java.util.Map;
@Mapper
public interface CommonTicketDao extends GenericDaoForBigInt<CommonTicketVO>
{
boolean updateSign(Map<String, Object> parameter);
boolean updateDate(Map<String, Object> parameter);
boolean increaseErrorCount(Map<String, Object> parameter);
boolean deleteByUpdateDate(Map<String, Object> parameter);
boolean deleteOverSecond(Map<String, Object> parameter);
} | [
"[email protected]"
]
| |
91d44afddbaa3c618e697bd663486ab853284db5 | d60bd7144cb4428a6f7039387c3aaf7b295ecc77 | /ScootAppSource/com/scootapp/tv/services/a.java | d6b1ee5d47ef682975216f8895524b77bfaeda21 | []
| no_license | vaquarkhan/Scoot-mobile-app | 4f58f628e7e2de0480f7c41998cdc38100dfef12 | befcfb58c1dccb047548f544dea2b2ee187da728 | refs/heads/master | 2020-06-10T19:14:25.985858 | 2016-12-08T04:39:10 | 2016-12-08T04:39:10 | 75,902,491 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,244 | java | package com.scootapp.tv.services;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.util.Log;
import com.b.a.y;
import com.parse.ParseObject;
import com.sagar.taxiapp.beans.o;
import com.scootapp.tv.a.z;
import com.scootapp.tv.b.c;
import com.scootapp.tv.receivers.OlaTrackRideReceiver;
import org.json.JSONObject;
final class a
implements y<JSONObject>
{
a(OlaBookingTrackingService paramOlaBookingTrackingService, String paramString) {}
public void a(JSONObject paramJSONObject)
{
for (Object localObject1 = paramJSONObject.optString("booking_status");; localObject1 = "mins")
{
Object localObject2;
Object localObject3;
Object localObject4;
try
{
OlaBookingTrackingService.a(this.b).putString("olaBookingId", this.a).apply();
if ("PENDING".equalsIgnoreCase((String)localObject1))
{
localObject2 = new Intent();
((Intent)localObject2).setAction("BOOKING_UPDATED");
((Intent)localObject2).putExtra("BOOKING_UPDATED", "ALLOTMENT_FAILED");
this.b.sendBroadcast((Intent)localObject2);
}
if ("ALLOTMENT_FAILED".equalsIgnoreCase((String)localObject1))
{
c.a(this.a, "cancelled");
paramJSONObject = new Intent(this.b.getApplicationContext(), OlaTrackRideReceiver.class);
paramJSONObject.putExtra(z.s, "");
PendingIntent.getBroadcast(this.b.getApplicationContext(), 1, paramJSONObject, 268435456);
paramJSONObject = new Intent();
paramJSONObject.setAction("BOOKING_UPDATED");
paramJSONObject.putExtra("BOOKING_UPDATED", "ALLOTMENT_FAILED");
this.b.sendBroadcast(paramJSONObject);
paramJSONObject = ParseObject.createWithoutData("OlaRideBookings", this.b.getSharedPreferences("olaBookingDetails", 0).getString("objectId", ""));
paramJSONObject.put("status", "cancelled");
paramJSONObject.saveInBackground();
return;
}
if ("CALL_DRIVER".equals(localObject1))
{
localObject3 = new Intent();
((Intent)localObject3).setAction("BOOKING_UPDATED");
((Intent)localObject3).putExtra("BOOKING_UPDATED", "CALL_DRIVER");
localObject4 = this.b.getApplicationContext().getSharedPreferences("olaBookingDetails", 0).edit();
((SharedPreferences.Editor)localObject4).putString("driverLat", paramJSONObject.optString("driver_lat")).apply();
((SharedPreferences.Editor)localObject4).putString("driverLng", paramJSONObject.optString("driver_lng")).apply();
JSONObject localJSONObject = paramJSONObject.optJSONObject("duration");
if (localJSONObject != null)
{
localObject2 = localJSONObject.optString("unit");
if ("MINUTE".equals(localObject2)) {
continue;
}
localObject1 = localObject2;
if ("MINUTES".equals(localObject2)) {
continue;
}
((Intent)localObject3).putExtra("driverETA", String.format("%s %s", new Object[] { localJSONObject.optString("value"), localObject1 }));
Log.v("Scoot", "In Service Driver ETA " + String.format("%s %s", new Object[] { localJSONObject.optString("value"), localObject1 }));
}
if (paramJSONObject.optString("vehicle_type").equalsIgnoreCase("auto"))
{
((SharedPreferences.Editor)localObject4).putString("driver_name", paramJSONObject.optString("driver_name")).apply();
((SharedPreferences.Editor)localObject4).putString("driver_number", paramJSONObject.optString("driver_number")).apply();
((SharedPreferences.Editor)localObject4).putString("vehicle_type", paramJSONObject.optString("vehicle_type")).apply();
((SharedPreferences.Editor)localObject4).putString("vehicle_number", paramJSONObject.optString("vehicle_number")).apply();
}
Log.v("Scoot", "In Service Driver Lat " + paramJSONObject.optString("driver_lat") + " Lng " + paramJSONObject.optString("driver_lng"));
this.b.sendBroadcast((Intent)localObject3);
return;
}
}
catch (Exception paramJSONObject)
{
localObject1 = ParseObject.createWithoutData("OlaRideBookings", this.b.getSharedPreferences("olaBookingDetails", 0).getString("objectId", ""));
((ParseObject)localObject1).put("exception", paramJSONObject.getMessage());
((ParseObject)localObject1).saveInBackground();
return;
}
if ("IN_PROGRESS".equals(localObject1))
{
localObject1 = this.b.getApplicationContext().getSharedPreferences("olaBookingDetails", 0).edit();
((SharedPreferences.Editor)localObject1).putString("driverLat", paramJSONObject.optString("driver_lat")).apply();
((SharedPreferences.Editor)localObject1).putString("driverLng", paramJSONObject.optString("driver_lng")).apply();
Log.v("Scoot", "In Service Driver Lat " + paramJSONObject.optString("driver_lat") + " Lng " + paramJSONObject.optString("driver_lng"));
paramJSONObject = new Intent();
paramJSONObject.setAction("BOOKING_UPDATED");
paramJSONObject.putExtra("BOOKING_UPDATED", "IN_PROGRESS");
this.b.sendBroadcast(paramJSONObject);
return;
}
if ("NO_BOOKING".equals(localObject1))
{
c.a(this.a, "cancelled");
paramJSONObject = new Intent(this.b.getApplicationContext(), OlaTrackRideReceiver.class);
paramJSONObject.putExtra(z.s, "");
paramJSONObject = PendingIntent.getBroadcast(this.b.getApplicationContext(), 1, paramJSONObject, 268435456);
((AlarmManager)this.b.getSystemService("alarm")).cancel(paramJSONObject);
paramJSONObject = new Intent();
paramJSONObject.setAction("BOOKING_UPDATED");
paramJSONObject.putExtra("BOOKING_UPDATED", "NO_BOOKING");
this.b.sendBroadcast(paramJSONObject);
paramJSONObject = ParseObject.createWithoutData("OlaRideBookings", this.b.getSharedPreferences("olaBookingDetails", 0).getString("objectId", ""));
paramJSONObject.put("status", "cancelled");
paramJSONObject.saveInBackground();
Log.v("Scoot", "In Service No Booking ");
return;
}
if ("BOOKING_CANCELLED".equalsIgnoreCase((String)localObject1))
{
c.a(this.a, "cancelled");
paramJSONObject = new Intent(this.b.getApplicationContext(), OlaTrackRideReceiver.class);
paramJSONObject.putExtra(z.s, "");
paramJSONObject = PendingIntent.getBroadcast(this.b.getApplicationContext(), 1, paramJSONObject, 268435456);
((AlarmManager)this.b.getSystemService("alarm")).cancel(paramJSONObject);
paramJSONObject = new Intent();
paramJSONObject.setAction("BOOKING_UPDATED");
paramJSONObject.putExtra("BOOKING_UPDATED", "cancelled");
this.b.sendBroadcast(paramJSONObject);
paramJSONObject = ParseObject.createWithoutData("OlaRideBookings", this.b.getSharedPreferences("olaBookingDetails", 0).getString("objectId", ""));
paramJSONObject.put("status", "cancelled");
paramJSONObject.saveInBackground();
Log.v("Scoot", "In Service No Booking ");
return;
}
if ("COMPLETED".equals(localObject1))
{
Log.v("Scoot", "In Service Booking Complete ");
paramJSONObject = paramJSONObject.optJSONObject("trip_info");
OlaBookingTrackingService.a(this.b).putString("olaBookingId", this.a).apply();
OlaBookingTrackingService.a(this.b).putBoolean("showFeedbackScreen", true).apply();
if (paramJSONObject != null)
{
c.a(this.a, "COMPLETED");
localObject2 = new o();
try
{
((o)localObject2).a(this.a);
((o)localObject2).a(paramJSONObject.optInt("amount"));
localObject3 = paramJSONObject.optJSONObject("distance");
if (localObject3 == null) {
break label1567;
}
((o)localObject2).b(((JSONObject)localObject3).optLong("value") + " " + ((JSONObject)localObject3).optString("unit"));
localObject3 = new Intent();
((Intent)localObject3).setAction("BOOKING_UPDATED");
((Intent)localObject3).putExtra("BOOKING_UPDATED", "COMPLETED");
((Intent)localObject3).putExtra(z.p, ((o)localObject2).b());
((Intent)localObject3).putExtra(z.g, ((o)localObject2).c());
this.b.sendBroadcast((Intent)localObject3);
c.a((o)localObject2);
}
catch (Exception localException2)
{
for (;;)
{
localObject4 = ParseObject.createWithoutData("OlaRideBookings", this.b.getSharedPreferences("olaBookingDetails", 0).getString("objectId", ""));
((ParseObject)localObject4).put("exception", localException2.getMessage());
((ParseObject)localObject4).saveInBackground();
}
}
localObject3 = new Intent(this.b.getApplicationContext(), OlaTrackRideReceiver.class);
((Intent)localObject3).putExtra(z.s, "");
localObject3 = PendingIntent.getBroadcast(this.b.getApplicationContext(), 1, (Intent)localObject3, 268435456);
((AlarmManager)this.b.getSystemService("alarm")).cancel((PendingIntent)localObject3);
localObject3 = ParseObject.createWithoutData("OlaRideBookings", this.b.getSharedPreferences("olaBookingDetails", 0).getString("objectId", ""));
((ParseObject)localObject3).put("rideCompleteResp", paramJSONObject);
((ParseObject)localObject3).put("amount", Integer.valueOf(((o)localObject2).b()));
((ParseObject)localObject3).put("distance", ((o)localObject2).c());
((ParseObject)localObject3).put("status", localObject1);
((ParseObject)localObject3).saveInBackground();
}
for (;;)
{
if ("N/A".equals(this.b.getSharedPreferences("shareddata", 0).getString("yourDestination", "N/A")))
{
paramJSONObject = this.b.getSharedPreferences("olaBookingDetails", 0);
localObject1 = new Intent(this.b.getApplicationContext(), BookingGeocodeAddressService.class);
((Intent)localObject1).putExtra("com.scootapp.FETCH_TYPE_EXTRA", 2);
((Intent)localObject1).putExtra("com.scootapp.BOOKING_ID", this.a);
((Intent)localObject1).putExtra("com.scootapp.LOCATION_LATITUDE_DATA_EXTRA", Double.parseDouble(paramJSONObject.getString("driverLat", "")));
((Intent)localObject1).putExtra("com.scootapp.LOCATION_LONGITUDE_DATA_EXTRA", Double.parseDouble(paramJSONObject.getString("driverLng", "")));
this.b.startService((Intent)localObject1);
return;
label1567:
((o)localObject2).b("OE");
break;
c.a(this.a, "COMPLETED");
paramJSONObject = new o();
try
{
paramJSONObject.a(this.a);
paramJSONObject.a(0);
paramJSONObject.b("OEN");
localObject2 = new Intent();
((Intent)localObject2).setAction("BOOKING_UPDATED");
((Intent)localObject2).putExtra("BOOKING_UPDATED", "COMPLETED");
((Intent)localObject2).putExtra(z.p, paramJSONObject.b());
((Intent)localObject2).putExtra(z.g, paramJSONObject.c());
this.b.sendBroadcast((Intent)localObject2);
c.a(paramJSONObject);
localObject2 = new Intent(this.b.getApplicationContext(), OlaTrackRideReceiver.class);
((Intent)localObject2).putExtra(z.s, "");
localObject2 = PendingIntent.getBroadcast(this.b.getApplicationContext(), 1, (Intent)localObject2, 268435456);
((AlarmManager)this.b.getSystemService("alarm")).cancel((PendingIntent)localObject2);
localObject2 = ParseObject.createWithoutData("OlaRideBookings", this.b.getSharedPreferences("olaBookingDetails", 0).getString("objectId", ""));
((ParseObject)localObject2).put("amount", Integer.valueOf(paramJSONObject.b()));
((ParseObject)localObject2).put("distance", paramJSONObject.c());
((ParseObject)localObject2).put("status", localObject1);
((ParseObject)localObject2).saveInBackground();
}
catch (Exception localException1)
{
for (;;)
{
ParseObject localParseObject = ParseObject.createWithoutData("OlaRideBookings", this.b.getSharedPreferences("olaBookingDetails", 0).getString("objectId", ""));
localParseObject.put("exception", localException1.getMessage());
localParseObject.saveInBackground();
}
}
}
}
}
return;
}
}
}
/* Location: D:\Android\dex2jar-2.0\classes-dex2jar.jar!\com\scootapp\tv\services\a.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
]
| |
d97061f45fcbd9d6615a21170804e5e1433c9445 | 673fdea3a8ef50f9fbc61e9fe96d8d4112a2aa07 | /Myapplicationx1/app/src/main/java/com/example/home/myapplicationx1/Main2Activity.java | cc920bbad687d8bf74a63cbb55f69cdae55a2242 | []
| no_license | samrat213/TrAc-FIR | 7a7c22fe4e52249072a2b671038536f90fd23bd0 | 0ca17a6a63cf53fc86c6fe5f048516c2922a3abb | refs/heads/master | 2021-01-01T20:43:57.534878 | 2017-08-01T14:38:41 | 2017-08-01T14:38:41 | 98,918,919 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,234 | java | package com.example.home.myapplicationx1;
import android.content.Intent;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class Main2Activity extends AppCompatActivity {
Button next_button,gps_button,save_button;
private DatabaseReference mDatabase;
private EditText mNameField;
private EditText mNameField1;
private EditText mNameField2;
private EditText mNameField3;
private EditText mNameField4;
private EditText mNameField5;
private EditText mNameField8;
private EditText mNameField9;
private EditText mNameField10;
private EditText mNameField11;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
next_button = (Button)findViewById(R.id.next_button2);
gps_button = (Button)findViewById(R.id.get_location);
save_button = (Button)findViewById(R.id.save_button);
mNameField = (EditText) findViewById(R.id.fir_entry);
mNameField1 = (EditText) findViewById(R.id.time_entry);
mNameField2 = (EditText) findViewById(R.id.police_station_entry);
mNameField3 = (EditText) findViewById(R.id.no_of_non_motor_vehicles);
mNameField4 = (EditText) findViewById(R.id.no_of_motor_vehicles);
mNameField5 = (EditText) findViewById(R.id.no_of_pedestrians);
mNameField8 = (EditText) findViewById(R.id.road_name_entry);
mNameField9 = (EditText) findViewById(R.id.road_no_entry);
mNameField10 = (EditText) findViewById(R.id.landmark_entry);
mNameField11 = (EditText) findViewById(R.id.road_chainage_entry);
mDatabase = FirebaseDatabase.getInstance().getReference();
save_button.setOnClickListener(
new Button.OnClickListener()
{
public void onClick(View v)
{
if(TextUtils.isEmpty(mNameField.getText().toString().trim()))
mDatabase.push().setValue(mNameField.getText().toString().trim());
else mDatabase.push().setValue("NONE");
if(TextUtils.isEmpty(mNameField1.getText().toString().trim()))
mDatabase.push().setValue(mNameField1.getText().toString().trim());
else mDatabase.push().setValue("NONE");
if(TextUtils.isEmpty(mNameField2.getText().toString().trim()))
mDatabase.push().setValue(mNameField2.getText().toString().trim());
else mDatabase.push().setValue("NONE");
if(TextUtils.isEmpty(mNameField3.getText().toString().trim()))
mDatabase.push().setValue(mNameField3.getText().toString().trim());
else mDatabase.push().setValue("NONE");
if(TextUtils.isEmpty(mNameField4.getText().toString().trim()))
mDatabase.push().setValue(mNameField4.getText().toString().trim());
else mDatabase.push().setValue("NONE");
if(TextUtils.isEmpty(mNameField5.getText().toString().trim()))
mDatabase.push().setValue(mNameField5.getText().toString().trim());
else mDatabase.push().setValue("NONE");
if(TextUtils.isEmpty(mNameField8.getText().toString().trim()))
mDatabase.push().setValue(mNameField8.getText().toString().trim());
else mDatabase.push().setValue("NONE");
if(TextUtils.isEmpty(mNameField9.getText().toString().trim()))
mDatabase.push().setValue(mNameField9.getText().toString().trim());
else mDatabase.push().setValue("NONE");
if(TextUtils.isEmpty(mNameField10.getText().toString().trim()))
mDatabase.push().setValue(mNameField10.getText().toString().trim());
else mDatabase.push().setValue("NONE");
if(TextUtils.isEmpty(mNameField11.getText().toString().trim()))
mDatabase.push().setValue(mNameField11.getText().toString().trim());
else mDatabase.push().setValue("NONE");
}
}
);
next_button.setOnClickListener(
new Button.OnClickListener()
{
public void onClick(View v)
{
startActivity(new Intent(getApplicationContext(), Main3Activity.class));
}
}
);
}
}
| [
"[email protected]"
]
| |
dba9950453fa9e2389049cac55cbca29f08b0ca2 | e18e505995361b0d7f46c67c02da10b011d3ff40 | /gamification/src/main/java/microservices/gamification/controller/UserStatsController.java | f1ad8061c6f29d8d870bb256b9f0cca7013a63f3 | []
| no_license | chohanjoo/springboot-microservice | efde0e0ae913a99c2a5f1c340d6bc938d3f2274f | 6671d0385eebac421312e883c2cdf518b8e157c5 | refs/heads/master | 2022-12-28T13:42:30.942679 | 2020-02-05T08:59:27 | 2020-02-05T08:59:27 | 237,356,854 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 835 | java |
package microservices.gamification.controller;
import microservices.gamification.domain.GameStats;
import microservices.gamification.service.GameService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* Gamification 사용자 통계 서비스의 REST API
*/
@RestController
@RequestMapping("/stats")
class UserStatsController {
private final GameService gameService;
public UserStatsController(final GameService gameService) {
this.gameService = gameService;
}
@GetMapping
public GameStats getStatsForUser(@RequestParam("userId") final Long userId) {
return gameService.retrieveStatsForUser(userId);
}
}
| [
"[email protected]"
]
| |
9e244a39e5ad9c334f87c2c4e70a9bf697b0d0cf | 3417cb10ed81cf26937f8613067006108789ba52 | /복습/2020-05/2020-05-28/testWork/workProj/src/dynamic_p_05_26/CastingClassMain.java | a8ac367d8afb71b9b8723e218033d5c0837b5822 | []
| no_license | psun2/Korea-IT-Academy | a32c4eadfe4f5f10c3c624ea47253e0bf4640200 | 670642f7618b05e2df8926492a0c2a3eec032463 | refs/heads/master | 2021-03-17T14:36:33.108779 | 2020-12-06T20:40:19 | 2020-12-06T20:40:19 | 246,997,229 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,428 | java | package dynamic_p_05_26;
//부모형으로 형변환시 맴버변수는 heap 에 생기고 메소드는 class 의 메소드 영역에 생기므로,
//상속 받은 자식이 부모로 형변환 했을때, 자식의 맴버변수는 hiding 되고, 부모가 가지고 있지
//않는 메소드는 접근이 불가 하지만, 자식에서 오버로딩 하였다면, 오버로딩한 메소드가 사용됩니다.
class CastingClass {
String name = "부모";
int a = 10, b = 20;
void meth_1() {
System.out.println("부모 meth_1()" + a + ", " + b);
}
void meth_2() {
System.out.println("부모 meth_2()");
}
}
class CastingChild extends CastingClass {
String name = "자식";
int a = 1000, c = 2000;
void meth_1() {
System.out.println("자식 meth_1()" + a + ", " + b + ", " + c);
}
void meth_2() {
System.out.println("자식 meth_2()");
}
}
public class CastingClassMain {
public static void main(String[] args) {
CastingClass pp = new CastingClass();
CastingClass pc = new CastingChild();
// CastingChild cp = new CastingClass();
CastingChild cc = new CastingChild();
System.out.println("pp.name: " + pp.name); // pp.name: 부모
System.out.println("✔pc.name: " + pc.name); // ✔ pc.name: 부모
System.out.println("cc.name: " + cc.name); // cc.name: 자식
pp.meth_1(); // 부모 meth_1()
pc.meth_1(); // ✔ 자식 meth_1()
cc.meth_1(); // 자식 meth_1()
System.out.println(pp instanceof CastingClass);
System.out.println(pp instanceof CastingChild);
cc.a = 123;
System.out.println("cc.a: " + cc.a); // 1000
System.out.println("cc.c: " + cc.c); // 1000
CastingClass pcc = cc;
System.out.println("pcc.a: " + pcc.a); // 10
// System.out.println("pcc.c: " + pcc.c); // 1000
CastingChild cpcc = (CastingChild) pcc;
System.out.println("cpcc.a: " + cpcc.a); // 10
System.out.println("cpcc.c: " + cpcc.c); // 1000
System.out.println("instanceof 는 생성기준 ");
System.out.println(pp instanceof CastingClass); // true
System.out.println(pp instanceof CastingChild); // false
System.out.println(cc instanceof CastingClass); // true
System.out.println(cc instanceof CastingChild); // true
System.out.println(pcc instanceof CastingClass); // true
System.out.println(pcc instanceof CastingChild); // true
System.out.println(cpcc instanceof CastingClass); // true
System.out.println(cpcc instanceof CastingChild); // true
}
} | [
"[email protected]"
]
| |
32af428179f7534efe0a2730dc83a07cc4144675 | ea8c4f30c33cc8a6bef2e0bb7e97fd6298bb87c8 | /Strings/ToLowerCase.java | 2a314821185077b518cef64ac015fefbef757eff | []
| no_license | chrismaltais/Java-Exercises | d9d629f78428a0cb3e30e98c0a6701c08538cd52 | a346413138e5fb90bb56435e3c946b4cfe6dc288 | refs/heads/master | 2018-11-12T12:08:02.382604 | 2018-10-02T18:17:23 | 2018-10-02T18:17:23 | 111,286,954 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 584 | java | // Implement function ToLowerCase() that has a string parameter str,
// and returns the same string in lowercase.
// ASCII:
// A = 65
// Z = 90
// a = 97
// z = 122
class Solution {
public String toLowerCase(String str) {
char[] letters = new char[str.length()];
int asciiKey;
for (int i = 0; i < str.length(); i++) {
asciiKey = (int)str.charAt(i);
if (asciiKey <= 90 && asciiKey >= 65) {
asciiKey += 32;
}
letters[i] = (char)asciiKey;
}
return new String(letters);
}
}
| [
"[email protected]"
]
| |
8b294354427cb736e8acc3f01132901bea987160 | 1e21278da534cacc1ec2453611d4d42d0379276f | /src/main/java/ru/mail/jira/plugins/groovy/util/Base64Util.java | 56356f15cb88718b90d270809a89c493f29021a9 | [
"BSD-2-Clause"
]
| permissive | atlascommunity/jira-plugins-groovy | 22be5a798756222ecaf18a0236e0d2d064f7195c | ef39c5118d1b36aac531c9d03ba06aeaa03ead2e | refs/heads/jira8 | 2023-03-07T21:59:26.079917 | 2022-02-10T14:57:34 | 2022-02-10T14:57:34 | 128,378,066 | 52 | 36 | BSD-2-Clause | 2023-01-27T04:27:29 | 2018-04-06T09:57:26 | Java | UTF-8 | Java | false | false | 714 | java | package ru.mail.jira.plugins.groovy.util;
import java.util.Base64;
public final class Base64Util {
private static final String BASE64_PREFIX = "b64_";
private Base64Util() {};
public static String encode(String value) {
if (value == null) {
return null;
}
return BASE64_PREFIX + Base64.getEncoder().encodeToString(value.getBytes());
}
public static String decode(String value) {
if (value == null) {
return null;
}
if (value.startsWith(BASE64_PREFIX)) {
return new String(Base64.getDecoder().decode(value.substring(BASE64_PREFIX.length())));
} else {
return value;
}
}
}
| [
"[email protected]"
]
| |
c70122c7cb4171d1e3714afdf094216d4a62948a | 57fe973c06a7d765b4c2e65445166e199fef3ead | /ExercicioUm.java | d168c75e0615efa3e3a3889b89286819e6bcb612 | []
| no_license | gabrielleite751/Lista_1_de_Java | 987194aa64c21a7b88a3e0f1355b73c580b8742a | ae7eeb5fd4151b3758d8b1022ab21fe0db69a538 | refs/heads/master | 2020-07-24T20:24:14.995098 | 2019-09-12T11:48:56 | 2019-09-12T11:48:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,438 | java | package br.com.cesar.lista1;
import br.com.cesar.lista1.Objetos.Calculadora;
import java.util.Scanner;
public class ExercicioUm {
public static void main(String[] args) {
Calculadora calculadora = new Calculadora();
Scanner scan = new Scanner(System.in);
int x,y;
System.out.println("Calculadora:");
System.out.print(">> ");
x = scan.nextInt();
System.out.print(">>> ");
String resp = scan.next();
System.out.print(">> ");
y = scan.nextInt();
switch (resp) {
case "+": {
System.out.println("Resposta:");
calculadora.soma(x,y);
break;
}
case "-":{
System.out.println("Resposta:");
calculadora.subtracao(x,y);
break;
}
case "/":{
System.out.println("Resposta:");
calculadora.divide(x,y);
break;
}
case "^":{
System.out.println("Resposta:");
calculadora.potencia(x, y);
break;
}
case "*":{
System.out.println("Resposta:");
calculadora.produto(x,y);
break;
}
default: {
System.out.println("Invalid");
break;
}
}
}
} | [
"[email protected]"
]
| |
f97e7aff863d015c79bcf085b41b43a6ea8de022 | e05071d575dd3ede69a8ff6a282d169f0574410a | /src/main/java/com/github/GBSEcom/model/PaymentTokenCreditTransaction.java | c996d7f9ee36e98cb7c67ba9b7b7e2a363813477 | []
| no_license | GBSEcom/java | 6c4f2c08f3d0ce5f6273060f34630b5c1d3a51ef | f934d68a050e001bdb22bdcce755727c9232f257 | refs/heads/master | 2022-05-26T10:20:17.355268 | 2021-11-19T21:53:38 | 2021-11-19T21:53:38 | 136,058,114 | 2 | 4 | null | 2022-05-20T20:53:03 | 2018-06-04T17:10:09 | Java | UTF-8 | Java | false | false | 4,299 | java | /*
* Payment Gateway API Specification.
* The documentation here is designed to provide all of the technical guidance required to consume and integrate with our APIs for payment processing. To learn more about our APIs please visit https://docs.firstdata.com/org/gateway.
*
* The version of the OpenAPI document: 21.5.0.20211029.001
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.github.GBSEcom.model;
import java.util.Objects;
import java.util.Arrays;
import com.github.GBSEcom.model.Amount;
import com.github.GBSEcom.model.CurrencyConversion;
import com.github.GBSEcom.model.Order;
import com.github.GBSEcom.model.PaymentTokenCreditTransactionAllOf;
import com.github.GBSEcom.model.PaymentTokenPaymentMethod;
import com.github.GBSEcom.model.PrimaryTransaction;
import com.github.GBSEcom.model.TransactionOrigin;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* Request to create credit transaction using payment token.
*/
@ApiModel(description = "Request to create credit transaction using payment token.")
public class PaymentTokenCreditTransaction extends PrimaryTransaction {
public static final String SERIALIZED_NAME_PAYMENT_METHOD = "paymentMethod";
@SerializedName(SERIALIZED_NAME_PAYMENT_METHOD)
private PaymentTokenPaymentMethod paymentMethod = null;
public static final String SERIALIZED_NAME_CURRENCY_CONVERSION = "currencyConversion";
@SerializedName(SERIALIZED_NAME_CURRENCY_CONVERSION)
private CurrencyConversion currencyConversion;
public PaymentTokenCreditTransaction paymentMethod(PaymentTokenPaymentMethod paymentMethod) {
this.paymentMethod = paymentMethod;
return this;
}
/**
* Get paymentMethod
* @return paymentMethod
**/
@ApiModelProperty(required = true, value = "")
public PaymentTokenPaymentMethod getPaymentMethod() {
return paymentMethod;
}
public void setPaymentMethod(PaymentTokenPaymentMethod paymentMethod) {
this.paymentMethod = paymentMethod;
}
public PaymentTokenCreditTransaction currencyConversion(CurrencyConversion currencyConversion) {
this.currencyConversion = currencyConversion;
return this;
}
/**
* Get currencyConversion
* @return currencyConversion
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public CurrencyConversion getCurrencyConversion() {
return currencyConversion;
}
public void setCurrencyConversion(CurrencyConversion currencyConversion) {
this.currencyConversion = currencyConversion;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PaymentTokenCreditTransaction paymentTokenCreditTransaction = (PaymentTokenCreditTransaction) o;
return Objects.equals(this.paymentMethod, paymentTokenCreditTransaction.paymentMethod) &&
Objects.equals(this.currencyConversion, paymentTokenCreditTransaction.currencyConversion) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(paymentMethod, currencyConversion, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class PaymentTokenCreditTransaction {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" paymentMethod: ").append(toIndentedString(paymentMethod)).append("\n");
sb.append(" currencyConversion: ").append(toIndentedString(currencyConversion)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"[email protected]"
]
| |
2218aa0d2f61b825de44c23ed6056691239be13b | c130a094e04eb448201ca2ab8ed4fe56cd1d80bc | /samples/client/petstore/java/okhttp-gson-nextgen/src/test/java/org/openapitools/client/model/MammalTest.java | 531d9b28688ead9846fae3197a2b760f30c0c057 | [
"Apache-2.0"
]
| permissive | janweinschenker/openapi-generator | 83fb57f9a5a94e548e9353cbf289f4b4172a724e | 2d927a738b1758c2213464e10985ee5124a091c6 | refs/heads/master | 2022-02-01T17:22:05.604745 | 2022-01-19T10:43:39 | 2022-01-19T10:43:39 | 221,860,152 | 1 | 0 | Apache-2.0 | 2019-11-15T06:36:25 | 2019-11-15T06:36:24 | null | UTF-8 | Java | false | false | 1,746 | java | /*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import org.openapitools.client.model.Pig;
import org.openapitools.client.model.Whale;
import org.openapitools.client.model.Zebra;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Mammal
*/
public class MammalTest {
private final Mammal model = new Mammal();
/**
* Model tests for Mammal
*/
@Test
public void testMammal() {
// TODO: test Mammal
}
/**
* Test the property 'hasBaleen'
*/
@Test
public void hasBaleenTest() {
// TODO: test hasBaleen
}
/**
* Test the property 'hasTeeth'
*/
@Test
public void hasTeethTest() {
// TODO: test hasTeeth
}
/**
* Test the property 'className'
*/
@Test
public void classNameTest() {
// TODO: test className
}
/**
* Test the property 'type'
*/
@Test
public void typeTest() {
// TODO: test type
}
}
| [
"[email protected]"
]
| |
7d4a14696af3ee48cd4f63633b8d5be1c199d6bc | 91f7dc07b2c0d07cf02ecee54b8548d42fe2f720 | /sources/archive/modules/server/tool-broker-service/src/main/java/eu/scy/ws/example/mock/api/GeoImageCollector.java | efd262a37f8e92e714de8f3403409fb26c0877d2 | []
| no_license | yattias/scy | 8996a485de7dfef22ac9ae69005cfb12be91dbc3 | e80421c7457e5ba27874abeef06668196ed8125a | refs/heads/master | 2021-01-10T01:15:04.267584 | 2013-04-03T09:32:50 | 2013-04-03T09:32:50 | 36,696,984 | 0 | 0 | null | null | null | null | ISO-8859-15 | Java | false | false | 823 | java | package eu.scy.ws.example.mock.api;
import javax.xml.bind.annotation.*;
import java.util.List;
/**
* Created: 11.feb.2009 09:50:17
*
* @author Bjørge Næss
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "geoimagecollector")
@XmlType(name = "geoimagecollector", namespace = "http://scy.eu")
public class GeoImageCollector {
private String name;
private List<String> images;
public GeoImageCollector() {}
public GeoImageCollector(String name, List<String> images) {
this.name = name;
this.images = images;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<String> getImages() {
return images;
}
public void setImages(List<String> images) {
this.images = images;
}
}
| [
"jakob.sikken@b2e416e9-8f50-0410-b9aa-47b31ee1ff64"
]
| jakob.sikken@b2e416e9-8f50-0410-b9aa-47b31ee1ff64 |
69420c2018ed5fd467b8d5fbff99a497b963a1ef | 92fff9080a88127b6b712293624a254e32cc5854 | /src/main/java/learning/work/first/head/test/page301/DateFormat.java | 02b3df2e883060a39ec3a8617a0ed7b463ef8027 | []
| no_license | liuqiong0319/JavaCodeLearning | bd2ce1079e723ee418e682d346d1ea47829c2d58 | a8d10991dcb9de62f315010fc75cd8a60553e264 | refs/heads/master | 2021-10-20T03:15:38.616414 | 2019-02-25T10:09:38 | 2019-02-25T10:09:38 | 115,206,965 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 615 | java | package learning.work.first.head.test.page301;
import java.util.Date;
/**
* Created by qiong.liu on 2018/10/25.
*/
public class DateFormat {
public static void main(String[] args) {
// 日期转化使用%t
// %tc表示完整的日期与时间
System.out.println(String.format("%tc",new Date()));
// %tr只有时间
System.out.println(String.format("%tr",new Date()));
// %tA %tB %tC 表示周\月\日,<表示格式化的时候重复利用之前用过的参数,注意%放在第一位.
System.out.println(String.format("%tA,%<tB,%<tC",new Date()));
}
}
| [
"[email protected]"
]
| |
797d6471f20524f75fc3cebedf119a8cf9c0cb21 | 86175bb8fba2e2737c65baf45533328a2ba49a54 | /sts-manager/sts-manager/src/main/java/com/bjsts/manager/service/role/impl/RoleServiceImpl.java | 5d2942f11ea3224d219d6aa11ea57a5370f350c1 | []
| no_license | likunpeng06/bjsts | 81ba530de8d1b5059d17eb00445c10c7ab079c29 | fe98203e0eb0239c2a0e035d6e879d2b1033523e | refs/heads/master | 2020-12-24T06:13:49.585973 | 2016-10-20T07:42:11 | 2016-10-20T07:42:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,537 | java | package com.bjsts.manager.service.role.impl;
import com.bjsts.core.enums.EnableDisableStatus;
import com.bjsts.manager.entity.role.RoleEntity;
import com.bjsts.manager.repository.role.RoleResourceRepository;
import com.google.common.collect.Lists;
import com.bjsts.manager.entity.role.RoleResourceEntity;
import com.bjsts.manager.repository.role.RoleRepository;
import com.bjsts.manager.service.role.RoleService;
import com.bjsts.manager.core.service.AbstractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @author jinsheng
* @since 2016-04-28 15:59
*/
@Service
@Transactional
public class RoleServiceImpl extends AbstractService<RoleEntity, Long> implements RoleService {
@Autowired
private RoleRepository roleRepository;
@Autowired
private RoleResourceRepository roleResourceRepository;
@Override
public List<Long> findResourceIdByRoleIdIn(List<Long> roleIdList) {
return roleResourceRepository.findByRoleIdIn(roleIdList).stream().map(RoleResourceEntity::getResourceId).collect(Collectors.toList());
}
@Override
public void bindResource(Long roleId, List<Long> resourceIdList) {
List<RoleResourceEntity> roleResourceEntityList = roleResourceRepository.findByRoleIdIn(Lists.newArrayList(roleId));
if (roleResourceEntityList != null && !roleResourceEntityList.isEmpty()) {
roleResourceRepository.deleteInBatch(roleResourceEntityList);
}
if (resourceIdList != null && !resourceIdList.isEmpty()) {
List<RoleResourceEntity> saveRoleResourceEntityList = Lists.newArrayList();
resourceIdList.forEach(resourceId -> {
RoleResourceEntity roleResourceEntity = new RoleResourceEntity();
roleResourceEntity.setRoleId(roleId);
roleResourceEntity.setResourceId(resourceId);
saveRoleResourceEntityList.add(roleResourceEntity);
});
roleResourceRepository.save(saveRoleResourceEntityList);
}
}
@Override
public void updateValid(Long id, EnableDisableStatus toStatus) {
RoleEntity roleEntity = roleRepository.findOne(id);
if (Objects.equals(roleEntity.getValid(), toStatus)) {
return;
}
roleEntity.setValid(toStatus);
roleRepository.saveAndFlush(roleEntity);
}
}
| [
"[email protected]"
]
| |
a308b2c9572856147a978ecdbcb6a313619431e5 | 9c7e8ffeac14f451a90bf559383ec5566ea81d1b | /projects/sor/src/main/java/sor/EDU/oswego/cs/dl/util/concurrent/TimedCallable.java | 2c971b7acb6b946183217e234836169751de3dff | [
"MIT"
]
| permissive | mc-imperial/jtool-sct | fc2209f2d6c6273e9dae7a37a8209291914a7195 | 80811bb88e1cec0234bc720b5b47ec9e2cdf6364 | refs/heads/master | 2021-01-12T12:46:55.912768 | 2016-10-26T11:07:18 | 2016-10-26T11:07:20 | 69,858,207 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,828 | java | /*
TimedCallable.java
Originally written by Joseph Bowbeer and released into the public domain.
This may be used for any purposes whatsoever without acknowledgment.
Originally part of jozart.swingutils.
Adapted by Doug Lea for util.concurrent.
History:
Date Who What
11dec1999 dl Adapted for util.concurrent
*/
package sor.EDU.oswego.cs.dl.util.concurrent;
/**
* TimedCallable runs a Callable function for a given length of time.
* The function is run in its own thread. If the function completes
* in time, its result is returned; otherwise the thread is interrupted
* and an InterruptedException is thrown.
* <p>
* Note: TimedCallable will always return within the given time limit
* (modulo timer inaccuracies), but whether or not the worker thread
* stops in a timely fashion depends on the interrupt handling in the
* Callable function's implementation.
*
* @author Joseph Bowbeer
* @version 1.0
*
* <p>[<a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html"> Introduction to this package. </a>]
*/
public class TimedCallable extends ThreadFactoryUser implements Callable {
private final Callable function;
private final long millis;
public TimedCallable(Callable function, long millis) {
this.function = function;
this.millis = millis;
}
public Object call() throws Exception {
FutureResult result = new FutureResult();
Thread thread = getThreadFactory().newThread(result.setter(function));
thread.start();
try {
return result.timedGet(millis);
}
catch (InterruptedException ex) {
/* Stop thread if we were interrupted or timed-out
while waiting for the result. */
thread.interrupt();
throw ex;
}
}
}
| [
"[email protected]"
]
| |
cb6ba801b7de97523568efa20baeb2587d039bf2 | 8f4fb8d4579138e3a0d396dcf7364dd959eea08c | /Console_Version/Word.java | ac689174c8e10192b4e8091f54939d4f8b7e1f32 | []
| no_license | andrew-sakaylyuk/Compiler | 07d4ac44ad19c3d1a5159af3b9700eb8acadb946 | f28fd3a54851f94d91bd1bc652aa7068fd53c53f | refs/heads/master | 2021-01-19T17:31:36.026323 | 2015-05-30T17:00:11 | 2015-05-30T17:00:11 | 101,068,095 | 1 | 1 | null | null | null | null | WINDOWS-1251 | Java | false | false | 518 | java | //клас токена для зарезервованих слів та ідентифікаторів
public class Word extends Token {
public String lexeme = "";
public Word(String s, int tag) { super(tag); lexeme = s; }
public String toString() {
return lexeme;
}
public static final Word
and = new Word( "&&", Tag.AND ), or = new Word( "||", Tag.OR ),
eq = new Word( "==", Tag.EQ ), inc = new Word( "++", Tag.INC ),
Var = new Word( "var", Tag.BASIC ), Const = new Word( "const", Tag.BASIC );
}
| [
"[email protected]"
]
| |
9052d0c6d904f2495797eda874303b46171fb9f5 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/9/9_e6ef12f638cbc3ca27ff9223e6e96d579761ffc7/Suspend/9_e6ef12f638cbc3ca27ff9223e6e96d579761ffc7_Suspend_t.java | 15abd5e32487318ecc0413da4dc535448ea0b538 | []
| no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 5,733 | java | /*
* Copyright 2012 Jeanfrancois Arcand
*
* 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.
*/
/*
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2007-2008 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*
*/
package org.atmosphere.annotation;
import org.atmosphere.cpr.AtmosphereResourceEventListener;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.concurrent.TimeUnit;
/**
* Suspend the underlying response. Once suspended, a response might be allowed
* to consume {@link Broadcast} events, depending on the scope ([@link Suspend#SCOPE}).
* By default, a suspended response is suspended able to consume
* any broadcasted events executed inside the same application (SCOPE.APPLICATION).
* The period can also be per suspended response (SCOPE.REQUEST) or available to other
* application (SCOPE.VM).
*
* @author Jeanfrancois Arcand
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Suspend {
/**
* How long a response stay suspended in {@link #timeUnit}, default is -1
*
* @return
*/
int period() default -1;
/**
* @return
*/
TimeUnit timeUnit() default TimeUnit.MILLISECONDS;
enum SCOPE {
REQUEST, APPLICATION, VM
}
/**
* The Scope of the {@link org.atmosphere.cpr.Broadcaster} that will be created once the
* response gets suspended. One final word on Broadcaster: by default,
* a Broadcaster will broadcast using
* all resources/classes on which the response has been suspended.
* This behavior is configurable and you can configure it setting the appropriate scope<ul>
* <li>REQUEST: broadcast events only to the suspended response associated with the current request.</li>
* <li>APPLICATION: broadcast events to all suspended responses associated with the current application.</li>
* <li>VM: broadcast events to all suspended responses created inside the current virtual machine.</li>
* </ul>
*
* @return The Scope of the {@link org.atmosphere.cpr.Broadcaster} that will be created once the
* response gets suspended.
*/
SCOPE scope() default SCOPE.APPLICATION;
/**
* By default, output some comments when suspending the connection.
*/
boolean outputComments() default true;
/**
* Resume all suspended response on the first broadcast operation.
*/
public boolean resumeOnBroadcast() default false;
/**
* Add {@link AtmosphereResourceEventListener} to the broadcast operation.
*/
public Class<? extends AtmosphereResourceEventListener>[] listeners() default {};
/**
* Write the returned entity back to the calling connection. Default is false.
* @return true if the entity needs to be written back to the calling connection.
*/
public boolean writeEntity() default true;
/**
* If the @Produces annotation is missing, this value will be used instead.
* @return the default content-type used if the @Produces annotation is missing.
*/
public String contentType() default "";
}
| [
"[email protected]"
]
| |
b5c176eb78e83188ffcf50231329ae95fc6865d2 | 9e710f86d771baab34484bbdb1fcb130a4ce0de2 | /app/src/main/java/net/fkm/searchviewtest/MainActivity.java | c999fc5464a70f8b392b8a8d240c11962316d5c6 | []
| no_license | fukaimei/SearchViewTest | 357de70563f5ff9f6c63c5352664ffa9edc40fca | 932d81ba9f48617ace05fc86d926e98e4a4f97fb | refs/heads/master | 2020-04-29T03:01:00.909348 | 2019-03-15T09:46:25 | 2019-03-15T09:46:25 | 175,792,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,574 | java | package net.fkm.searchviewtest;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import net.fkm.searchviewbar.SearchFragment;
import net.fkm.searchviewbar.custom.IOnSearchClickListener;
public class MainActivity extends AppCompatActivity implements IOnSearchClickListener, Toolbar.OnMenuItemClickListener {
private SearchFragment searchFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setTitle("搜索栏");
setSupportActionBar(toolbar);
searchFragment = SearchFragment.newInstance();
toolbar.setOnMenuItemClickListener(this);
searchFragment.setOnSearchClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
switch (menuItem.getItemId()) {
case R.id.action_search:
searchFragment.showFragment(getSupportFragmentManager(), SearchFragment.TAG);
break;
}
return true;
}
@Override
public void OnSearchClick(String keyword) {
Toast.makeText(MainActivity.this, keyword, Toast.LENGTH_LONG).show();
}
}
| [
"[email protected]"
]
| |
eca402247e884550c2e7d2ebd43d50e573382ad3 | 6b3a781d420c88a3a5129638073be7d71d100106 | /AdProxyServer/src/main/java/com/ocean/proxy/api/service/WankaV1AdSupplier.java | 6eba30c52fb3f42597362e603fc88e2910b5677d | []
| no_license | Arthas-sketch/FrexMonitor | 02302e8f7be1a68895b9179fb3b30537a6d663bd | 125f61fcc92f20ce948057a9345432a85fe2b15b | refs/heads/master | 2021-10-26T15:05:59.996640 | 2019-04-13T07:52:57 | 2019-04-13T07:52:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,365 | java | package com.ocean.proxy.api.service;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import com.inveno.util.CollectionUtils;
import com.ocean.core.common.JsonUtils;
import com.ocean.core.common.system.SystemContext;
import com.ocean.core.common.threadpool.Parameter;
import com.ocean.core.common.threadpool.workthread.AsynAbstractTask;
import com.ocean.core.common.threadpool.workthread.Task.DataFormat;
import com.ocean.core.common.threadpool.workthread.Task.InvokeType;
import com.ocean.persist.api.proxy.AdPullException;
import com.ocean.persist.api.proxy.wanka_v1.SignatureGen;
import com.ocean.persist.api.proxy.wanka_v1.WankaAd;
import com.ocean.persist.api.proxy.wanka_v1.WankaAdPullParams;
import com.ocean.persist.api.proxy.wanka_v1.WankaAdSlot;
import com.ocean.persist.api.proxy.wanka_v1.WankaApp;
import com.ocean.persist.api.proxy.wanka_v1.WankaDevice;
import com.ocean.persist.api.proxy.wanka_v1.WankaGps;
import com.ocean.persist.api.proxy.wanka_v1.WankaMaterial;
import com.ocean.persist.api.proxy.wanka_v1.WankaNetwork;
import com.ocean.persist.api.proxy.wanka_v1.WankaReport;
import com.ocean.persist.api.proxy.wanka_v1.WankaReq;
import com.ocean.persist.api.proxy.wanka_v1.WankaResponse;
import com.ocean.persist.api.proxy.wanka_v1.WankaTracker;
import com.ocean.persist.api.proxy.woso.WosoAd;
import com.ocean.persist.api.proxy.woso.WosoAdResponse;
import com.ocean.persist.common.ProxyConstants;
import com.ocean.persist.model.proxy.DSPPosition;
import com.ocean.proxy.api.base.AbstractAsynAdSupplier;
import com.ocean.proxy.serverdis.AdProxyWankaV1Task;
import com.ocean.proxy.thrift.entity.AdContent;
import com.ocean.proxy.thrift.entity.AdImg;
import com.ocean.proxy.thrift.entity.AdMutiAction;
import com.ocean.proxy.thrift.entity.AdRecomReply;
import com.ocean.proxy.thrift.entity.AdRecomReq;
import com.ocean.proxy.thrift.entity.AdUserInfo;
/** * @author Alex & E-mail:[email protected]
@date 2018年2月28日
@version 1.0
*/
@Component(value="WankaV1AdSupplier")
public class WankaV1AdSupplier extends AbstractAsynAdSupplier {
public static final String WK_MACRO_DOWN_X= "\\$\\{down_x\\}";
public static final String WK_MACRO_DOWN_Y = "\\$\\{down_y\\}";
public static final String WK_MACRO_UP_X = "\\$\\{up_x\\}";
public static final String WK_MACRO_UP_Y = "\\$\\{up_y\\}";
public static final String WK_MACRO_RELATIVE_DOWN_X= "\\$\\{relative_down_x\\}";
public static final String WK_MACRO_RELATIVE_DOWN_Y = "\\$\\{relative_down_y\\}";
public static final String WK_MACRO_RELATIVE_UP_X = "\\$\\{relative_up_x\\}";
public static final String WK_MACRO_RELATIVE_UP_Y = "\\$\\{relative_up_y\\}";
public static final String WK_MACRO_CLICKID="\\$\\{click_id\\}";
public AdRecomReply invoke(InvokeAttribute attribute)
throws AdPullException {
// TODO Auto-generated method stub
AdRecomReq adreq = attribute.getAdreq();
DSPPosition positionInfo = attribute.getDspPosition();
// 参数转换
WankaAdPullParams params = parseParams(adreq, positionInfo);
// 调用API
WankaResponse response = (WankaResponse) invoke(params,WankaResponse.class,adreq.getHash()
,String.valueOf(adreq.getUserAdSpaceAttri().getAdSpaceId()));
// 解析结果
return parseResult(response);
}
private WankaAdPullParams parseParams(AdRecomReq adreq,
DSPPosition positionInfo) throws AdPullException {
if(StringUtils.isEmpty(positionInfo.getText1())||StringUtils.isEmpty(positionInfo.getText2())||StringUtils.isEmpty(positionInfo.getText3())){
throw new AdPullException("app id /token or pkg name is empty!");
}
AdUserInfo userInfo=adreq.getUserinfo();
WankaAdPullParams param =new WankaAdPullParams();
String channel=SystemContext.getDynamicPropertyHandler().get(ProxyConstants.WANKA_CHANNEL);
param.setChannel_id(channel);
long timestamp=System.currentTimeMillis();
param.setTimestamp(timestamp);
WankaReq req=new WankaReq();
req.setApi_version("3.0.0");
//app
WankaApp app =new WankaApp();
app.setApp_id(positionInfo.getText1());
app.setApp_version(formatAV(adreq.getVersion()));
app.setPackage_name(positionInfo.getText3());
req.setApp(app);
//device
WankaDevice device =new WankaDevice();
device.setDevice_type(4);
String os = userInfo.getOs();
if(OS_ANDROID.equals(os)){
device.setOs_type(OS_ANDROID);
device.setOs_version(this.convOSVersion(userInfo.getOsversion()));
}else{
device.setOs_type("ios");
device.setIdfa(userInfo.getIdfa());
}
device.setLanguage("zh");
device.setAndroid_advertising_id("");
device.setOpenudid("");
device.setCountry("China");
device.setResolution("0*0");
device.setOrientation(0);
device.setReferer("");
device.setIsroot(0);
device.setBtmac("");
device.setPdunid("");
device.setCputy("");
device.setCpusn("");
device.setIccid("");
device.setVendor(userInfo.getBrand_name());
device.setModel(userInfo.getPhonemodel());
device.setAndroid_id(userInfo.getAdid());
device.setAndroid_id_md5(DigestUtils.md5Hex(userInfo.getAdid()));
device.setImei(userInfo.getImei());
device.setImei_md5(DigestUtils.md5Hex(userInfo.getImei()));
device.setW(userInfo.getDevice_width());
device.setH(userInfo.getDevice_height());
device.setUa(userInfo.getUa());
device.setImsi(userInfo.getImsi());
device.setMac(userInfo.getMac());
if(StringUtils.isNotEmpty(userInfo.getDensity())){
device.setDpi(Integer.parseInt(userInfo.getDensity()));
}
req.setDevice(device);
//adslot
WankaAdSlot slot=new WankaAdSlot();
slot.setAdslot_id(positionInfo.getPos());
slot.setRender_type(0);
slot.setDeeplink(1);
req.setAdslot(slot);
//network
WankaNetwork network=new WankaNetwork();
network.setIp(userInfo.getClient_ip());
network.setConnect_type(getNetwork(adreq.getNet()));
network.setCarrier(getOp(userInfo.getMobile()));
network.setMcc("460");
network.setCellular_id("");
network.setBss_id("");
network.setLac("");
network.setNetwk_id("");
network.setSsid("");
network.setLksd(0);
network.setRoaming(0);
req.setNetwork(network);
//gps
if(StringUtils.isNotEmpty(userInfo.getLat())&&StringUtils.isNotEmpty(userInfo.getLon())){
WankaGps gps=new WankaGps();
gps.setCoordinate_type(4);
gps.setLon(Double.parseDouble(userInfo.getLon()));
gps.setLat(Double.parseDouble(userInfo.getLat()));
gps.setCoord_time(timestamp);
gps.setLocation_accuracy(10);
req.setGps(gps);
}
URL url=this.getUrl(SystemContext.getDynamicPropertyHandler().get(ProxyConstants.WANKA_URL));
if(url==null){
System.out.println("url:"+url);
throw new AdPullException("request url is empty!");
}
String reqJson=JsonUtils.toJson(req);
param.setReqjson(reqJson);
try {
param.setSignature(SignatureGen.generateToken("POST", url.getHost(), url.getPath(),positionInfo.getText2(), reqJson,timestamp));
} catch (Exception e) {
// TODO Auto-generated catch block
throw new AdPullException("get sinature error {}"+e.getMessage());
}
return param;
}
private String formatAV(String appVersion){
final String DEF_VERSION="1.1.1";
if(StringUtils.isEmpty(appVersion)){
return DEF_VERSION;
}
Pattern pattern = Pattern.compile("^\\d+(\\.\\d+){2,2}$");
Matcher matcher = pattern.matcher(appVersion);
if (matcher.find()){
return appVersion;
}else{
return DEF_VERSION;
}
}
private int getNetwork(String net){
if(NETWORK_WIFI.equals(net)){
return 2;
}else if(NETWORK_2G.equals(net)){
return 4;
}
else if(NETWORK_3G.equals(net)){
return 5;
}
else if(NETWORK_4G.equals(net)){
return 6;
}
return 0;
}
private int getOp(String op){
if(MOBILE_CMCC.equals(op)){
return 1;
}else if(MOBILE_CUCC.equals(op)){
return 3;
}else if(MOBILE_CTCC.equals(op)){
return 2;
}
return 0;
}
private URL getUrl(String url){
try {
return new URL(url);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
private AdRecomReply parseResult(WankaResponse body)
throws AdPullException {
if(body == null||CollectionUtils.isEmpty(body.getAdms())){
return null;
}
if(0!=body.getError_code()){
throw new AdPullException("ad request error, return error code:"+body.getError_code());
}
AdRecomReply reply=new AdRecomReply();
reply.setStatus(status);
reply.setAd_contents(this.dealAds(body));
return reply;
}
private List<AdContent> dealAds(WankaResponse resp){
List<AdContent> list=new ArrayList<AdContent> ();
for(WankaAd ad:resp.getAdms()){
//***********************BEGIN 常规设置*************
AdContent content = new AdContent();
AdMutiAction action = new AdMutiAction();
String title = defTitle;
String marketTitle=defTitle;
// 内容类型1表示链接推广,2表示应用推广,3未使用 4表示电话推广
int acType=ACTION_WEB;
//图片
List<AdImg> imgs = new ArrayList<AdImg>();
//上报
Map<String, List<String>> map = new HashMap<String, List<String>>();
//***********************END 常规设置***************
if(StringUtils.isNotEmpty(ad.getClkurl())){
String link=format(REPORT_TYPE_REQ,ad.getClkurl());
content.setLinkurl(link);
action.setLinkurl(link);
}else if(StringUtils.isNotEmpty(ad.getDplk())){
content.setLinkurl(ad.getDplk());
action.setLinkurl(ad.getDplk());
}
if(StringUtils.isNotEmpty(ad.getHtml_segment())){
content.setHtmlSnippet(ad.getHtml_segment());
content.setIsHtmlAd(true);
}
if(ad.getInteraction_type()==2){
acType=ACTION_APP;
}
if(StringUtils.isNotEmpty(ad.getBundle())){
action.setCpPackage(ad.getBundle());
}
WankaMaterial mat=ad.getMaterialVO();
if(mat!=null){
title=mat.getTitle();
for(String url:mat.getImgurl()){
AdImg img=new AdImg();
img.setSrc(url);
imgs.add(img);
}
}
WankaReport report=ad.getReportVO();
List<String> showL=new ArrayList<String>();
if(CollectionUtils.isNotEmpty(report.getImptrackers())){
for(WankaTracker tracker:report.getImptrackers()){
showL.add(format(REPORT_TYPE_PV,tracker.getUrl()));
}
}
map.put(SHOW,showL);
List<String> clickL=new ArrayList<String>();
if(CollectionUtils.isNotEmpty(report.getClktrackers())){
for(WankaTracker tracker:report.getClktrackers()){
if(tracker.getTemplate_type()==1&&ad.getInteraction_type()==2){
//获取正式下载链接
String url=format(REPORT_TYPE_CLICK,tracker.getUrl());
content.setLinkurl(url);
action.setLinkurl(url);
action.setLinkurl_type(1);
clickL.add(url);
}else{
clickL.add(format(REPORT_TYPE_CLICK,tracker.getUrl()));
}
}
}
if(CollectionUtils.isNotEmpty(report.getDwnlsts())){
for(WankaTracker tracker:report.getDwnlsts()){
clickL.add(format(REPORT_TYPE_CLICK,tracker.getUrl()));
}
}
map.put(CLICK, clickL);
List<String> downL=new ArrayList<String>();
if(CollectionUtils.isNotEmpty(report.getDplktrackers())){
for(WankaTracker tracker:report.getDplktrackers()){
downL.add(format(REPORT_TYPE_DOWNLOAD,tracker.getUrl()));
}
}
map.put(DOWNLOAD, downL);
List<String> installL=new ArrayList<String>();
if(CollectionUtils.isNotEmpty(report.getIntltrackers())){
for(WankaTracker tracker:report.getIntltrackers()){
installL.add(format(REPORT_TYPE_INSTALL,tracker.getUrl()));
}
}
map.put(INSTALL,installL);
List<String> activeL=new ArrayList<String>();
if(CollectionUtils.isNotEmpty(report.getActvtrackers())){
for(WankaTracker tracker:report.getActvtrackers()){
activeL.add(format(REPORT_TYPE_ACTIVE,tracker.getUrl()));
}
}
map.put(ACTIVE,activeL);
content.setThirdReportLinks(map);
content.setImglist(imgs);
action.setType(acType);
content.setMarketTitle(marketTitle);
content.setGuideTitle(title);
content.setMutiAction(Collections.singletonList(action));
list.add(content);
}
return list;
}
private static String format(int type ,String str){
if(type==REPORT_TYPE_PV){
str=str.replaceAll(WK_MACRO_DOWN_X, MACRO_CLICK_DEFUALT).replaceAll(WK_MACRO_DOWN_Y,MACRO_CLICK_DEFUALT)
.replaceAll(WK_MACRO_UP_X,MACRO_CLICK_DEFUALT).replaceAll(WK_MACRO_UP_Y, MACRO_CLICK_DEFUALT)
.replaceAll(WK_MACRO_RELATIVE_DOWN_X, MACRO_CLICK_DEFUALT).replaceAll(WK_MACRO_RELATIVE_DOWN_Y,MACRO_CLICK_DEFUALT)
.replaceAll(WK_MACRO_RELATIVE_UP_X, MACRO_CLICK_DEFUALT).replaceAll(WK_MACRO_RELATIVE_UP_Y,MACRO_CLICK_DEFUALT);
}else{
str=str.replaceAll(WK_MACRO_DOWN_X, MACRO_DOWN_X).replaceAll(WK_MACRO_DOWN_Y,MACRO_DOWN_Y)
.replaceAll(WK_MACRO_UP_X, MACRO_UP_X).replaceAll(WK_MACRO_UP_Y, MACRO_UP_Y)
.replaceAll(WK_MACRO_RELATIVE_DOWN_X, MACRO_DOWN_X).replaceAll(WK_MACRO_RELATIVE_DOWN_Y,MACRO_DOWN_Y)
.replaceAll(WK_MACRO_RELATIVE_UP_X, MACRO_UP_X).replaceAll(WK_MACRO_RELATIVE_UP_Y, MACRO_UP_Y);
}
String format= str.replaceAll(WK_MACRO_CLICKID, MACRO_CLICK_ID);
return format;
}
@Override
public AsynAbstractTask packageTask(Parameter params, String hashCode) {
// TODO Auto-generated method stub
AdProxyWankaV1Task task=new AdProxyWankaV1Task();
//heard
Map<String, String> headers = new HashMap<String, String>(2);
headers.put("Content-Type", "application/json;utf-8");
headers.put("Accept-Encoding", "gzip");
task.setHeaders(headers);
WankaAdPullParams param = (WankaAdPullParams) params;
task.setParam(param);
task.setDataFormat(DataFormat.DATA_FORMAT_STREAM);
task.setInvokeType(InvokeType.INVOKE_TYPE_POST);
task.setHashCode(hashCode);
task.setUrl(SystemContext.getDynamicPropertyHandler().get(ProxyConstants.WANKA_URL));
return task;
}
}
| [
"[email protected]"
]
| |
cc5410e59f823324a035c5c9b8aaa49fb7207adf | abec58d5e75f8ad682dc7f815f10044c8a7c1d37 | /part03-Part03_29.LastWords/src/main/java/LastWords.java | f6b79598f9c6c39b8bc15f7e150fbae8b2169e3d | []
| no_license | yhegazy/mooc-java-programming-i | 9d1de697989bef95520d9e90d953904473a32b41 | d4a5c087be6bf1f1a9192337fe443391d78b471c | refs/heads/master | 2022-12-22T20:58:10.638018 | 2020-09-25T13:18:46 | 2020-09-25T13:18:46 | 286,482,636 | 2 | 0 | null | 2020-08-10T13:26:56 | 2020-08-10T13:26:55 | null | UTF-8 | Java | false | false | 438 | java |
import java.util.Scanner;
public class LastWords {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (true) {
String line = scanner.nextLine();
if (line.isEmpty()) {
break;
}
String[] pieces = line.split(" ");
int i = pieces.length - 1;
System.out.println(pieces[i]);
}
}
}
| [
"[email protected]"
]
| |
ff0530d8e04274d007c2a86d6be96627c3dc472e | 1039556f2e3408010e15676d4862499b2da4fbe7 | /src/test/java/autoTests/TestSiute/iGov/dvs_732.java | 2a588ef1b632e5a4362b7502d4fbe3827b31cd3a | []
| no_license | protows/iTest | 935e2be6449230a2ce462e5c9b241487305274a1 | f13a77b59d5fd0c7b6f6fcba6ab88a43481195da | refs/heads/master | 2020-04-21T06:23:08.606087 | 2018-09-07T06:21:32 | 2018-09-07T06:21:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,140 | java | package autoTests.TestSiute.iGov;
import autoTests.CustomMethods;
import autoTests.pages.main.TemplatePage;
import org.junit.Test;
/**
* Created by Privat24 on 09.09.2016.
*/
public class dvs_732 extends CustomMethods {
//<editor-fold desc="Тестовый пример заполнение полей">
@Test
public void default_test() throws Exception {
/**
* ***************************************объявляем элементы
* страниц******************************************
*/
TemplatePage o = new TemplatePage();
// Вносим в переменные название услуги начиная с точки ._test_fields_bankid_--_ и до начала названия поля
String sBP = "dvs_732";
String email = "[email protected]";
openURLservice(getBaseUrl() + "/service/112/general");
// 2016-11-23 Убираем проверку на открытие нужной услуги.
// Считаем, что мы ее правильно по прямому пути выше
// _step("2. Проверить, что открылась нужная услуга");
// assertThis(driver, o.usluga, "Видача розрахунку заборгованості зі сплати аліментів");
o.selectRegion("Дніпропетровська");
o.mokAuthorization();
setFieldAutocomplete("sID_Public_SubjectOrganJoin", "Васильківський районний відділ ДВС ГТУЮ у Дніпропетровській обл.");
setFieldValue("phone", "+380999999999");
setFieldValue("email", email);
setFieldValue("sDebtorLastname", "Прізвище боржника");
setFieldValue("sDebtorFirstname", "Ім'я боржника");
setFieldValue("sDebtorMiddlename", "По батькові боржника");
setFieldSelectByText("anAmount", "1");
setFieldValue("sChildName1", "ПІБ дитини (1)");
setFieldValue("sChildBirth1", "1/01/2010");
setFieldValue("sDocName", "Назва документа");
setFieldValue("sDocNumber", "№1 від 01/01/2011");
setFieldValue("sDocOrgan", "Найменування органу");
setFieldCalendar(sBP, "dStartDate", "2016/12/25");
click(o.buttonSendingForm);
o.checkMessageSuccess("Шановний(-а) MockUser MockUser!\n"
+ "Ваше звернення х-хххххххх успішно зареєстровано\n"
+ "(номер також відправлено Вам електронною поштою на Ваш e-mail " + email + ") Результати будуть спрямовані також на email.\n"
+ "Звертаємо увагу, що Іноді листи потрапляють у спам або у розділ \"Реклама\" (для Gmail).");
click(o.buttonLogOut);
}
//</editor-fold>
}
| [
"[email protected]"
]
| |
8dc16548165b94671cbd733dbe75056b8e314dcc | 75eb5eaa31a1729c472bca052a45005eb1df866f | /app/src/main/java/com/sjh/sjhone/model/HomeModel.java | 21e2ce32045fbdce3eec23dc31b1d7e53b20d309 | []
| no_license | 596030631/AppDemo | 0cec29412a881956a9d22078fac97710f7e8ccb4 | f496c4331bb4034c860bd9a5ae242ce7f2508798 | refs/heads/master | 2020-08-17T14:26:58.688070 | 2019-10-25T08:52:12 | 2019-10-25T08:52:12 | 215,678,186 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package com.sjh.sjhone.model;
import com.sjh.sjhone.base.BaseModel;
import com.sjh.sjhone.http.bean.BaseBean;
import com.sjh.sjhone.http.bean.BaseObjectBean;
import com.sjh.sjhone.http.bean.TouTiaoBean;
import io.reactivex.Observer;
/**
* date: 2019/10/20
* author:SJH
* description:
*/
public interface HomeModel extends BaseModel {
void getNews(Observer<BaseBean<BaseObjectBean<TouTiaoBean>>> observer);
}
| [
"[email protected]"
]
| |
b5e7c175fbb393cdc356100390d802d6388e8c0a | 5c41afe41f647980ff7f7e48d5995a503e214124 | /2.JavaCore/src/com/javarush/task/task16/task1619/Solution.java | f2649b09003253c0fddbaee7211e9542c2acbbad | []
| no_license | darkpradoJava/JavaRushTasks | a56b27a30ed4f426a93703cb30f35804e4576043 | cc5e6534a4448ae7ed12ecf5fe99627acc3f8965 | refs/heads/master | 2020-04-27T11:26:21.707881 | 2019-05-24T06:08:13 | 2019-05-24T06:08:13 | 174,295,357 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 761 | java | package com.javarush.task.task16.task1619;
/*
А без interrupt слабо?
*/
public class Solution {
public static boolean doIt = true;
public static void main(String[] args) throws InterruptedException {
Thread t = new Thread(new TestThread());
t.start();
Thread.sleep(3000);
ourInterruptMethod();
}
public static void ourInterruptMethod() {
doIt = false;
}
public static class TestThread implements Runnable {
public void run() {
while (Solution.doIt) {
try {
System.out.println("he-he");
Thread.sleep(500);
} catch (InterruptedException e) {
}
}
}
}
}
| [
"[email protected]"
]
| |
8111989b0627585ed7709de3b4a6fe292189a4e6 | 4dc83e37b7144ddbc7debf746ab154f88518b84e | /3xlsystem/src/xlsystem/load/CacheException.java | 660a76def48b4b429df9c866f54f19eefab7471f | []
| no_license | xiufengliu/3XL | 5fe1a1ee7bb7d1808433fb8d380d3c41fb1294f1 | 6f6e628351efb8148b701fb2bb1f6817fa1a860a | refs/heads/master | 2021-01-10T01:21:19.085354 | 2015-10-16T07:26:30 | 2015-10-16T07:26:30 | 43,630,776 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,050 | java | /*
*
* Copyright (c) 2011, Xiufeng Liu ([email protected]) and the eGovMon Consortium
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*
*/
package xlsystem.load;
public class CacheException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
public CacheException() {
}
public CacheException(String msg) {
super(msg);
}
}
| [
"[email protected]"
]
| |
9e16fa9cbfe3ef753c072a9101e2ee4326d357aa | 9575753863ad63e9f948aab4be19d83d5f02526f | /CitizenApp/app/src/main/java/it/polimi/guardian/citizenapp/SearchResultListAdapter.java | eed4f8ab6e2e10f6ff34187e197c38040a77e743 | []
| no_license | chelo26/yoBUSco | f8e701bf82da7c3a3ee0ceb17244bf96a6d30fcf | 6d6bdf6b3cc3102982045a5d42b380a55cccec0c | refs/heads/master | 2020-04-10T11:03:04.094652 | 2019-01-30T23:07:15 | 2019-01-30T23:07:15 | 160,982,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,047 | java | package it.polimi.guardian.citizenapp;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class SearchResultListAdapter extends ArrayAdapter {
private final Activity context;
private final TicketAvailabilityInfo[] tickets;
public SearchResultListAdapter(Activity context, TicketAvailabilityInfo[] tickets) {
super(context, R.layout.search_result_list_item, tickets);
this.context=context;
this.tickets = tickets;
}
public View getView(int position, View view, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View rowView = inflater.inflate(R.layout.search_result_list_item, parent,false);
ImageView iv_icon = (ImageView) rowView.findViewById(R.id.search_result_item_icon);
TextView tv_company = (TextView) rowView.findViewById(R.id.search_result_item_company);
TextView tv_time_info = (TextView) rowView.findViewById(R.id.search_result_item_time_info);
TextView tv_price = (TextView) rowView.findViewById(R.id.search_result_item_price);
tv_company.setText(tickets[position].getCompany());
tv_time_info.setText(tickets[position].getDepartureDate()+" "+tickets[position].getDepartureTime()+"--->"+tickets[position].getArrivalDate()+" "+tickets[position].getArrivalTime());
tv_price.setText(String.valueOf(tickets[position].getPrice())+" "+tickets[position].getCurrency());
switch (tickets[position].getCompany()) {
case "La Paz Tours":
iv_icon.setImageResource(R.drawable.flame_gray);
break;
case "P":
iv_icon.setImageResource(R.drawable.police_badge_gray);
break;
default:
iv_icon.setImageResource(R.drawable.ambulance_gray);
break;
}
return rowView;
}
} | [
"[email protected]"
]
| |
caec74984d1eae44c3db45a7989047752ac57cb0 | 0a53608bb39770b1aff38b705003144072582d0d | /app/src/main/java/com/example/medicines/MedsAdapter.java | 77e805c0947d0a4e6cff581ea3fe2452cea2c3c1 | []
| no_license | ashik024/Medicines | ef00df16ba0b54b8246cdc4b2257355ff9058fdf | 3539c2c3758e6571ddf12b540fe79e19e75bffe6 | refs/heads/master | 2023-02-20T13:00:42.620381 | 2021-01-21T10:18:41 | 2021-01-21T10:18:41 | 331,589,546 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,053 | java | package com.example.medicines;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class MedsAdapter extends RecyclerView.Adapter <MedsAdapter.MedsViewholder>{
private Context mcontext;
private ArrayList<Meds> meds;
public MedsAdapter(Context context,ArrayList<Meds>arrayList){
mcontext = context;
meds=arrayList;
}
@NonNull
@Override
public MedsViewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mcontext).inflate(R.layout.med_name_card,parent,false);
return new MedsViewholder(view);
}
@Override
public void onBindViewHolder(@NonNull MedsViewholder holder, int position) {
Meds currentMeds = meds.get(position);
String medsName = currentMeds.getMedicines();
holder.name.setText("Name: "+ medsName);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String des1 = currentMeds.getIndications();
String des2 = currentMeds.getTherapeutic_class();
String des3 = currentMeds.getPharmacology();
String des4 = currentMeds.getDosage();
String des5 = currentMeds.getInteraction();
String des6 = currentMeds.getContraindications();
String des7 = currentMeds.getSide_effects();
String des8 = currentMeds.getPregnancy();
String des9 = currentMeds.getPrecautions();
String des10 = currentMeds.getStorage();
Intent intent = new Intent(mcontext,DetailsMed.class);
intent.putExtra("medname",medsName);
intent.putExtra("medDes1",des1);
intent.putExtra("medDes2",des2);
intent.putExtra("medDes3",des3);
intent.putExtra("medDes4",des4);
intent.putExtra("medDes5",des5);
intent.putExtra("medDes6",des6);
intent.putExtra("medDes7",des7);
intent.putExtra("medDes8",des8);
intent.putExtra("medDes9",des9);
intent.putExtra("medDes10",des10);
mcontext.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return meds.size();
}
public class MedsViewholder extends RecyclerView.ViewHolder{
public TextView name;
public MedsViewholder(@NonNull View itemView) {
super(itemView);
name = itemView.findViewById(R.id.medname);
}
}
}
| [
"[email protected]"
]
| |
224c89e689ad47b5125685d3183ca58d2560b340 | 0544c17ae3e3bb01e06f45c7145328317796a494 | /app/ifood-test-service-music/src/main/java/br/com/jicecold/ifood/music/provider/spatialdata/client/SpatialDataFeignClient.java | 6187a602a5b44dc50c1d8431a17a6f3071e8a21d | []
| no_license | jicecold/ifood-backend-advanced-test | 764a0d38b81aaedf753b971896136cee1d625407 | 0196fb7f6babc0c547201c7602ef4419487eef5d | refs/heads/master | 2020-03-18T13:31:58.473306 | 2018-06-08T04:22:56 | 2018-06-08T04:22:56 | 134,790,015 | 3 | 0 | null | 2018-05-25T01:59:02 | 2018-05-25T01:59:02 | null | UTF-8 | Java | false | false | 1,148 | java | package br.com.jicecold.ifood.music.provider.spatialdata.client;
import br.com.jicecold.ifood.architecture.generic.model.ResponseModel;
import br.com.jicecold.ifood.music.provider.spatialdata.fallback.SpatialDataFeignClientFallback;
import br.com.jicecold.ifood.music.provider.spatialdata.model.Weather;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(name = "ifood-test-service-spatial-data",
configuration = FeignClientsConfiguration.class,
fallback = SpatialDataFeignClientFallback.class)
public interface SpatialDataFeignClient {
@GetMapping(value = "/spatial-data/weather/city")
ResponseModel<Weather> getWeatherByCityName(@RequestParam(name = "name") String name);
@GetMapping(value = "/spatial-data/weather/coordinates")
ResponseModel<Weather> getWeatherByCoodinates(@RequestParam(name = "lat") Double latitude,
@RequestParam(name = "lon") Double longitude);
}
| [
"[email protected]"
]
| |
ccf3b50c55901f766606e53261c155add0cfa945 | 6ae482cdcf4d9a497fcb1b12c78a0501199d64f1 | /src/main/java/primary/sortAndSearch/SelectionSort.java | 5ab00d8a0875c928c6ec44c688607ed9b932f00a | []
| no_license | yestermorrow/leetcode | 017cde7af67ea205384538e17138e14cd4408d8c | d0358eba2333144e27d87d34caf80e382d01cc38 | refs/heads/master | 2020-03-25T03:57:37.467608 | 2018-11-02T08:25:40 | 2018-11-02T08:25:40 | 143,266,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 915 | java | package primary.sortAndSearch;
/**
* 选择排序
*
* 时间复杂度O(N^2),额外空间复杂度O(1)
*
* 它的工作原理是每一次从待排序的数据元素中选出最小(或最大)的一个元素,存放在序列的起始位置,直到全部待排序的数据元素排完
*/
public class SelectionSort {
public static int[] selectionSort(int[] arr) {
if (arr == null || arr.length < 2)
return null;
for (int i = 0; i < arr.length - 1; i++) {
int minIndex = i;
for (int j = i + 1; j < arr.length - 1; j ++) {
minIndex = arr[j] < arr[j+1] ? j : minIndex;
}
int tmp = arr[i];
arr[i] = arr[minIndex];
arr[minIndex] = tmp;
}
return arr;
}
public static void main(String[] args) {
int[] arr = {2,3,4,5,1,6};
selectionSort(arr);
}
}
| [
"[email protected]"
]
| |
9eaa5df737a633e42f364c0f493d8d1aa85d63ca | 66cd45a61694610d0ca71b93ae4fa4bde85f6a5a | /MainActivity.java | c228d93b43ec7bc19e6c11452c20e714ee235a31 | []
| no_license | brahmadeo1/ShimmerEffect | 48183d38a3c8893ea263c7120686390a67c18833 | a708bc688a3787a87766ec9f9e6a03d4e1e06c08 | refs/heads/master | 2020-07-08T00:26:47.098231 | 2019-08-21T06:26:21 | 2019-08-21T06:26:21 | 203,517,307 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,431 | java | package mytest.xigmapro.com.shimmereffect;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
import com.facebook.shimmer.ShimmerFrameLayout;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Retrofit;
public class MainActivity extends AppCompatActivity {
private ShimmerFrameLayout mShimmerViewContainer;
private ListView playlistDataLV;
private Adapter adapter;
private Handler handler;
private List<ShopDetails> shopDetails1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mShimmerViewContainer = findViewById(R.id.shimmer_view_container);
playlistDataLV = (ListView)findViewById(R.id.playlistDataLV);
handler = new Handler();
// I am using Retrofit Client for fetching data from an API.
// API Call Using Retrofit Client
String userId = "XXXX";
// Retrofit retrofit = RetrofitClient.getClient();
//getPlaylists(userId, retrofit);
ShopDetails shopDetails = new ShopDetails();
for (int i=0; i<6; i++){
shopDetails1 = new ArrayList<>();
shopDetails.setId(1);
shopDetails.setName("promo");
shopDetails.setImage(R.drawable.food_img);
shopDetails1.add(shopDetails);
}
Log.i("aaa", shopDetails1.get(0).getName());
handler.postDelayed(new Runnable() {
@Override
public void run() {
adapter = new Adapter(MainActivity.this, R.layout.item_row, shopDetails1);
playlistDataLV.setAdapter(adapter);
mShimmerViewContainer.stopShimmerAnimation();
mShimmerViewContainer.setVisibility(View.GONE);
}
}, 5000);
}
private void getPlaylists(String userId, Retrofit retrofit) {
/*
ApiServices apiServices = retrofit.create(ApiServices.class);
Call<List<Playlist>> accountPlaylists = apiServices.getAccountPlaylists(userId);
accountPlaylists.enqueue(new Callback<List<Playlist>>() {
@Override
public void onResponse(Call<List<Playlist>> call, Response<List<Playlist>> response) {
if (response.isSuccessful()) {
if (response.code() == 200) {
//TODO: Set data in ListView
}
// Stopping Shimmer Effect's animation after data is loaded to ListView
mShimmerViewContainer.stopShimmerAnimation();
mShimmerViewContainer.setVisibility(View.GONE);
}
}
@Override
public void onFailure(Call<List<Playlist>> call, Throwable t) {
Log.e("TAG", "=======onFailure: " + t.toString());
t.printStackTrace();
}
});*/
}
@Override
public void onResume() {
super.onResume();
mShimmerViewContainer.startShimmerAnimation();
}
@Override
protected void onPause() {
mShimmerViewContainer.stopShimmerAnimation();
super.onPause();
}
}
| [
"[email protected]"
]
| |
8750dd89a22c350261f27739faaeba800a96494e | d165c1f6bb8b1f557d1b7f4c63db1191b9221c36 | /OOb/gui/src/main/java/com/itgo/swing/body/ItgoTabbedPane.java | 2dc117c4293e00ed3965d49456483a3b02a0d96f | []
| no_license | kobeHub/Course_2018 | 5eeffca53b00f99d6cc63bfee7bcfeaafc234c37 | dbe23cb0233813bfb7f8add98eb2b19d81ade394 | refs/heads/master | 2020-03-18T04:13:53.350141 | 2018-12-24T10:45:07 | 2018-12-24T10:45:07 | 129,339,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,795 | java | package com.itgo.swing.body;
import javax.swing.*;
import java.awt.*;
public class ItgoTabbedPane {
private int tabIndex = 0;
public int getTabIndex() {
return tabIndex;
}
private JTabbedPane tabbedPane;
public JTabbedPane getTabbedPane() {
return tabbedPane;
}
public ItgoTabbedPane() {
tabbedPane = new JTabbedPane();
}
public void addTextAreaTab(String title) {
// new tab
this.addTextAreaTab(title, null, null);
}
public void addTextAreaTab(String title, Icon icon, Color bgColor) {
// textArea
JTextArea textArea = new JTextArea();
textArea.setBackground(bgColor);
textArea.setFont(new Font("SimSun", Font.PLAIN, 16));
// new tab
new ItgoTabPane(title, textArea, tabIndex++, icon, this);
}
public void addTab(String title, Component oneTab) {
new ItgoTabPane(title, oneTab, tabIndex++, this);
}
public void addTab(String title, Component oneTab, Icon icon) {
new ItgoTabPane(title, oneTab, tabIndex++, icon, this);
}
public void removeTab(Component compent) {
int index = tabbedPane.indexOfComponent(compent);
System.out.println("closing index:"+index);
if (index < 0) {
System.out.println("closing error");
} else {
tabbedPane.removeTabAt(index);
this.tabIndex--;
}
}
public void removeTab(int index) {
System.out.println("closing index:"+index);
if (index < 0 || index > tabIndex) {
System.out.println("closing error");
} else {
tabbedPane.removeTabAt(index);
this.tabIndex--;
}
}
}
| [
"[email protected]"
]
| |
d04131603fa88c1064be79e42938916d351eb384 | 9a86a55ccfb7a8fdf1cf848136227acd3d8af8bd | /src/bishi/pdd3/Main2.java | 636acebf853c6f3f1b723bcc7c9fa806002cc717 | []
| no_license | Demo-du/jzof | bb6347e35ba7256deacbcbd7e027a05b90791705 | a2883d579cb44d3301265e07570d245eb395d8bb | refs/heads/master | 2021-06-24T21:01:23.344784 | 2018-09-26T09:08:14 | 2018-09-26T09:08:14 | 96,866,748 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package bishi.pdd3;
import java.util.Scanner;
/**
* Created by Administrator on 2018\9\21 0021.
*/
public class Main2 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while (sc.hasNext()){
int N=sc.nextInt();
int []nums=new int[N];
for (int i=0;i<N;i++){
nums[i]=sc.nextInt();
}
if (N<8)
System.out.println(nums[N/2]);
}
}
}
| [
"[email protected]"
]
| |
c1fdad1827ea0ce9b6ff001330101a5e159804d9 | fd8dbd3b0c397bff7e93d2027cea2831827aa2fa | /src/main/java/com/github/shynixn/petblocks/business/bukkit/PetBlocksPlugin.java | 6278e5870dd3b6db730a1b0983cb92b3db828320 | [
"Apache-2.0"
]
| permissive | OhBlihv/PetBlocks | 890263a704e5cf8593163b7537f76b21b6b7b5ae | 45533cad05d7fec797ed550f9e371debaebd1776 | refs/heads/master | 2021-01-20T00:23:45.478313 | 2017-04-23T07:44:21 | 2017-04-23T07:44:21 | 89,123,884 | 0 | 0 | null | 2017-04-23T07:09:24 | 2017-04-23T07:09:24 | null | UTF-8 | Java | false | false | 2,700 | java | package com.github.shynixn.petblocks.business.bukkit;
import com.github.shynixn.petblocks.api.PetBlocksApi;
import com.github.shynixn.petblocks.business.Config;
import com.github.shynixn.petblocks.business.Language;
import com.github.shynixn.petblocks.business.bukkit.nms.NMSRegistry;
import com.github.shynixn.petblocks.lib.AsyncRunnable;
import com.github.shynixn.petblocks.lib.BukkitUtilities;
import com.github.shynixn.petblocks.lib.PluginLoader;
import com.github.shynixn.petblocks.lib.ReflectionLib;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author Shynixn!
*
*/
public final class PetBlocksPlugin extends JavaPlugin {
public static final String PREFIX_CONSOLE = ChatColor.AQUA + "[PetBlocks] ";
private boolean disabled;
@Override
public void onEnable() {
this.saveDefaultConfig();
if(!BukkitUtilities.isVersionSupported()) {
BukkitUtilities.sendColorMessage("================================================", ChatColor.RED, PREFIX_CONSOLE);
BukkitUtilities.sendColorMessage("Petblocks does not support your server version", ChatColor.RED, PREFIX_CONSOLE);
BukkitUtilities.sendColorMessage("Install v1.8.0 - v1.11.0", ChatColor.RED, PREFIX_CONSOLE);
BukkitUtilities.sendColorMessage("Plugin gets now disabled!", ChatColor.RED, PREFIX_CONSOLE);
BukkitUtilities.sendColorMessage("================================================", ChatColor.RED, PREFIX_CONSOLE);
this.disabled = true;
Bukkit.getPluginManager().disablePlugin(this);
}
else {
BukkitUtilities.sendColorMessage("Loading PetBlocks ...", ChatColor.GREEN, PREFIX_CONSOLE);
PluginLoader.load(this, AsyncRunnable.class);
Language.reload(this);
Config.initiliaze(this);
NMSRegistry.registerAll();
ReflectionLib.invokeMethodByClazz(PetBlocksApi.class, "init", this);
BukkitUtilities.startFiltering();
BukkitUtilities.sendColorMessage("Enabled PetBlocks " + this.getDescription().getVersion() + " by Shynixn", ChatColor.GREEN, PREFIX_CONSOLE);
}
}
@Override
public void onDisable() {
if(!this.disabled) {
NMSRegistry.unregisterAll();
ReflectionLib.invokeMethodByClazz(PetBlocksApi.class, "dispose", this);
}
}
@Override
public List<Class<?>> getDatabaseClasses() {
final List<Class<?>> list = new ArrayList<>();
this.saveDefaultConfig();
if(this.getConfig().getBoolean("sql-enabled")) {
if(BukkitUtilities.isVersionSupported()) {
list.add(ReflectionLib.getClassFromName("com.github.shynixn.petblocks.business.logic.persistence.PetData"));
}
}
return list;
}
public void setupDatabase() {
this.installDDL();
}
}
| [
"[email protected]"
]
| |
a8c1abaf7dc3df71bcd415a0fc764ecc68fbb40c | f6f23825811090e12a1bab5561bb3c02d54d8964 | /src/main/java/com/ag777/util/lang/EmojiUtils.java | 3551e8d6c5c79689303963708deaa978b03c6439 | []
| no_license | ag777/utils | 00ef84fcfd90413e90e3666d0f9284ee995dcead | bfa26f05f8ec2ad59f129f96c33ed54e8c3234ef | refs/heads/master | 2023-08-17T20:39:15.887551 | 2023-08-16T08:19:31 | 2023-08-16T08:19:31 | 95,071,236 | 2 | 2 | null | 2022-05-20T21:42:10 | 2017-06-22T03:35:48 | Java | UTF-8 | Java | false | false | 2,470 | java | package com.ag777.util.lang;
/**
* 有关 <code>emoji表情</code> 工具类。
* <p>
* 代码来自http://blog.csdn.net/et198901/article/details/49906797
* </p>
*
* @author
* @version create on 2017年10月29日,last modify at 2017年10月29日
*/
public class EmojiUtils {
private EmojiUtils() {}
/**
* 检测是否有emoji字符
* @param source 需要判断的字符串
* @return 一旦含有就抛出
*/
public static boolean containsEmoji(String source) {
if(source == null) {
return false;
}
int len = source.length();
for (int i = 0; i < len; i++) {
char codePoint = source.charAt(i);
if (!notisEmojiCharacter(codePoint)) {
//判断确认有表情字符
return true;
}
}
return false;
}
/**
* 非emoji表情字符判断
* @param codePoint codePoint
* @return
*/
private static boolean notisEmojiCharacter(char codePoint) {
return (codePoint == 0x0) ||
(codePoint == 0x9) ||
(codePoint == 0xA) ||
(codePoint == 0xD) ||
((codePoint >= 0x20) && (codePoint <= 0xD7FF)) ||
((codePoint >= 0xE000) && (codePoint <= 0xFFFD)) ||
((codePoint >= 0x10000) && (codePoint <= 0x10FFFF));
}
/**
* 过滤emoji 或者 其他非文字类型的字符
* @param source 需要过滤的字符串
* @return
*/
public static String clearEmoji(String source) {
if (!containsEmoji(source)) {
return source;//如果不包含,直接返回
}
StringBuilder buf = null;//该buf保存非emoji的字符
int len = source.length();
for (int i = 0; i < len; i++) {
char codePoint = source.charAt(i);
if (notisEmojiCharacter(codePoint)) {
if (buf == null) {
buf = new StringBuilder(source.length());
}
buf.append(codePoint);
}
}
if (buf == null) {
return "";//如果没有找到非emoji的字符,则返回无内容的字符串
} else {
if (buf.length() == len) {
buf = null;
return source;
} else {
return buf.toString();
}
}
}
} | [
"[email protected]"
]
| |
14d8483df07577349090263e9d45293f61c64ebe | 7a48f24f83533e1240c9c1d4d2ec3213b8aae949 | /src/edu/epidata/jpa/Libro.java | 0d5525ec2816a8238e71b61a845b88d43de0f2f4 | []
| no_license | Alvaiin/MavenJPAHibernate | 2fa0f07d82238e9baaa34a06ad3dd8396acffe98 | 0d2378d382c73b6cbaee0b3e342e4a418adee659 | refs/heads/main | 2023-01-28T11:30:02.401525 | 2020-12-08T23:24:07 | 2020-12-08T23:24:07 | 318,596,836 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 1,060 | java | package edu.epidata.jpa;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
@Entity
public class Libro {
@Id // Indica que es el identificador de las personas
//@GeneratedValue(strategy = GenerationType.AUTO) // Y que se crea automáticamente
private int id;
@Column
private String nombre;
@Column
private int anio;
@ManyToMany
private List<Persona> editores = new ArrayList<>(); //Un libro tiene muchos capítulos, pero un capitulo está en un solo libro
//El mapeo es realizado por Capitulo.
@OneToMany(mappedBy = "libro")
private List<Capitulo> capitulos = new ArrayList<>();
public Libro() {
//Requerido
}
public Libro(int id, String nombre, int anio, List<Persona> editores) {
this.id = id;
this.nombre = nombre;
this.anio = anio;
this.editores.addAll(editores);
}
} | [
"[email protected]"
]
| |
e1843189c4152790b20bcb184e1a8da9bd9d0eaf | 89109dcbbc32a3c95071c80afe73e53900a96fdd | /PM-BE/pm-realtime-service/src/main/java/com/company/pm/realtimeservice/main/config/RealtimeServiceConfiguration.java | 22a10b0f68c52a5eae80bf70a360ebc1a0939845 | []
| no_license | hieuvubk/CNW_20202 | cff56ffa1440f6f29e970ccb1e822ab0d32de2d0 | 7c9a7b5293b1918afe111764717d2a05736553ed | refs/heads/master | 2023-06-15T12:48:05.047156 | 2021-05-30T21:40:06 | 2021-05-30T21:40:06 | 385,541,868 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 476 | java | package com.company.pm.realtimeservice.main.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@ComponentScan(basePackages = {
"com.company.pm.realtimeservice",
"com.company.pm.chatservice",
"com.company.pm.interactionservice"
})
@Import({RSocketConfiguration.class})
public class RealtimeServiceConfiguration {
}
| [
"[email protected]"
]
| |
f8797157344bd0fba1937ee2cf27bc4af03b790e | 1d129cfb031ed96d9db41b0134fc9c9593fe1c35 | /src/com/observer/ObserverDemo.java | e0b0c6da31e74140b1ed958896951999e1468242 | [
"MIT"
]
| permissive | barisoztop/DesginPatterns | e4a84a7c4a5e0e3e6d0579b5497e37d8357b3ced | 2205a09c476c06fff904d7d66da987bffdf96279 | refs/heads/master | 2016-08-11T22:09:14.330221 | 2016-02-07T23:17:58 | 2016-02-07T23:17:58 | 51,036,849 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 455 | java | package com.observer;
public class ObserverDemo {
public static void main(String[] args) {
ConcreteSubject subject = new ConcreteSubject();
ConcreteObserver1 observer1 = new ConcreteObserver1();
ConcreteObserver2 observer2 = new ConcreteObserver2();
subject.registerObserver(observer1);
subject.registerObserver(observer2);
subject.setValueToBeObserved(0);
subject.removeObserver(observer2);
subject.setValueToBeObserved(1);
}
}
| [
"[email protected]"
]
| |
fe79e699850459eb883136e4dc053b24d8d05558 | f95c4a522892ddb9fad64dd2f866274eb51a6b0d | /src/main/java/com/mapmaker/service/MarkerService.java | 350751c7fb2b841531a222c29fedafec50ef90ce | []
| no_license | victolee93/mapmaker | faf51db2c734acf9a1a5a4f7b352ab94cec1e1df | 8c6037cb3284381d45b35e22cfb6317dc2b84e4b | refs/heads/master | 2020-07-30T06:06:07.384281 | 2020-01-18T06:07:15 | 2020-01-18T06:37:56 | 210,111,546 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,440 | java | package com.mapmaker.service;
import com.mapmaker.domain.entity.MarkerEntity;
import com.mapmaker.domain.entity.Travel.TravelEntity;
import com.mapmaker.domain.repository.MarkerRepository;
import com.mapmaker.dto.MarkerDto;
import com.mapmaker.dto.PositionsDto;
import com.mapmaker.dto.Travel.TravelDto;
import com.mapmaker.util.JsonManager;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@Service
@AllArgsConstructor
public class MarkerService {
private MarkerRepository markerRepository;
// 마커 리스트를 가져옴
@Transactional
public List<MarkerDto> getList(List<TravelDto> travelDtoList) {
List<MarkerDto> markerList = new ArrayList<>();
for (TravelDto travelDto : travelDtoList) {
TravelEntity travelEntity = travelDto.toEntity();
List<MarkerEntity> markerEntities = markerRepository.findAllByTravelEntity(travelEntity);
if (markerEntities.isEmpty()) continue;
for (MarkerEntity markerEntity : markerEntities) {
markerList.add(convertEntityToDto(markerEntity, travelEntity));
}
}
return markerList;
}
// 마커 리스트를 가져옴
@Transactional
public List<MarkerDto> getList(TravelDto travelDto) {
List<MarkerDto> markerList = new ArrayList<>();
TravelEntity travelEntity = travelDto.toEntity();
List<MarkerEntity> markerEntities = markerRepository.findAllByTravelEntity(travelEntity);
if (markerEntities.isEmpty()) return null;
for (MarkerEntity markerEntity : markerEntities) {
markerList.add(convertEntityToDto(markerEntity, travelEntity));
}
return markerList;
}
// 마커 정보를 저장
@Transactional
public boolean saveMaker(MarkerDto markerDto) {
String positionsJson = markerDto.getMarkerPositions();
List<PositionsDto> positionsDtoList = JsonManager.covnertJsonToDto(PositionsDto.class , positionsJson);
if (positionsDtoList.isEmpty()) return false;
for (PositionsDto positionsDto : positionsDtoList) {
markerDto.setLatitude(positionsDto.getLatitude());
markerDto.setLongitude(positionsDto.getLongitude());
markerRepository.save(markerDto.toEntity());
}
return true;
}
// Json 포맷의 위치 정보들을 가져옴
public List<String> getPositions(List<MarkerDto> markerList) {
List<String> positionsList = new ArrayList<>();
for (MarkerDto markerDto : markerList) {
PositionsDto positionsDto = PositionsDto.builder()
.id(markerDto.getId())
.latitude(markerDto.getLatitude())
.longitude(markerDto.getLongitude())
.build();
positionsList.add(JsonManager.convertDtoToJson(positionsDto));
}
return positionsList;
}
private MarkerDto convertEntityToDto(MarkerEntity markerEntity, TravelEntity travelEntity) {
return MarkerDto.builder()
.id(markerEntity.getId())
.latitude(markerEntity.getLatitude())
.longitude(markerEntity.getLongitude())
.travelEntity(travelEntity)
.build();
}
}
| [
"[email protected]"
]
| |
bf9ae61d03279f01a6315657f955b0376f2e6e05 | 90aecadd77c27e2b30c2ac4ee556cf76ffbae786 | /ocean-common/src/main/java/ocean/common/model/vo/ValidResultVO.java | 7dd21a52f9b68288ce9165d6f0316e8de28bb4c7 | []
| no_license | rojarsmith/ocean | a74990dfc1caa29ea3a828a66f5dc36a20f9ecea | 0f786082b1575f84ea1eaa773f968df1ef3420c3 | refs/heads/master | 2023-07-03T05:16:11.237553 | 2021-07-29T07:00:24 | 2021-07-29T07:00:24 | 384,027,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 812 | java | package ocean.common.model.vo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.Data;
/**
* @author Rojar Smith
*
* @date 2021-07-17
*/
@Data
public class ValidResultVO {
Map<String, List<Map<String, String>>> data;
List<Map<String, String>> errors;
public ValidResultVO() {
this.data = new HashMap<>();
this.errors = new ArrayList<>();
this.data.put("errors", errors);
}
public void add(String type, String name, String message) {
Map<String, String> error = new HashMap<>();
error.put("type", type);
error.put("name", name);
error.put("message", message);
this.errors.add(error);
this.data.put("errors", errors);
}
public boolean isError() {
if (errors.size() > 0) {
return true;
}
return false;
}
}
| [
"[email protected]"
]
| |
58bec1e1269a3de9905f93a1da806277d3b9e125 | 5243c517ce256c0f1c654e509775d5641d9a7342 | /beer-buddy-core/src/test/java/com/beerbuddy/core/model/UnsecureUserWrapper.java | 4cc68caab89317d48b50d9894f6fe8d3e1519c73 | []
| no_license | benbaxter/beer-buddy | d5eafb25bc7846c1c7d8166a183620ec633a15dd | 0087541672a2d891c92aaed5617f5cb79d7f20df | refs/heads/master | 2016-08-06T15:32:12.498003 | 2015-04-23T21:24:46 | 2015-04-23T21:24:46 | 28,948,234 | 2 | 11 | null | 2015-04-30T03:32:06 | 2015-01-08T04:08:40 | Java | UTF-8 | Java | false | false | 364 | java | package com.beerbuddy.core.model;
import com.beerbuddy.core.model.User;
import com.beerbuddy.core.model.UserWrapper;
public class UnsecureUserWrapper extends UserWrapper {
public UnsecureUserWrapper(User user) {
super(user);
}
public User getUser() {
if( user instanceof UserWrapper ) {
return ((UserWrapper) user).getUser();
}
return user;
}
} | [
"[email protected]"
]
| |
c0efb927f064a2642cd53cec8fa57cc29489a575 | 898c132df64b78f8d7a59b0d2a8577f3e87a1ef6 | /app/src/main/java/com/ku4irka/giphyapp/view/fragments/BaseFragment.java | 9d4a6f8ebd9bd977523216d123d5b5d75eb9fd8c | []
| no_license | ku4irka/GiphyApp | f7019b741004f79921ee1ffb28d456a442b2ebdc | dfaf7a36343b467a0e466e48cc48a0f888dd81ec | refs/heads/master | 2021-05-10T12:56:41.256132 | 2018-01-25T07:58:32 | 2018-01-25T07:58:32 | 118,454,813 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package com.ku4irka.giphyapp.view.fragments;
import android.support.v4.app.Fragment;
import android.widget.Toast;
public abstract class BaseFragment extends Fragment{
protected void showToastMessage(String message) {
Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();
}
} | [
"[email protected]"
]
| |
22834db1b1347230ecb6ca3996e0d5a91b6841d3 | 01f104ae3b85398fb8611526300a9e261dbd365a | /Main.java | defbfe4e958cf97308b69457950842e8e0c55bc1 | []
| no_license | permag/JAVA-search-algorithms | cd4b9bd7b542fe0456282d6195f91c42c6f81fe7 | eaeb0ce1cf2210b2ea1ddcc594c0d20c186b7a16 | refs/heads/master | 2021-01-18T18:32:11.579116 | 2014-08-12T22:15:51 | 2014-08-12T22:15:51 | 22,894,146 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,740 | java | import a2.A2Main;
import a2.A2Item;
import java.io.Console;
import java.util.TreeSet;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Iterator;
import java.util.AbstractMap;
import java.util.Comparator;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class Main implements A2Main {
public static void main(String[] args) {
A2Main main = new Main();
List<A2Item> items = new ArrayList<A2Item>();
items = main.readCSVFile("input.txt");
// compare algorithms
main.doCompareAlgorithms(items);
// create HashMap
main.createHashMap(items);
}
public void doCompareAlgorithms(List<A2Item> items) {
// TreeSet compare algorithms
TreeSet<Map.Entry<String, Long>> treeSet = this.compareAlgorithms(items);
this.printResults(treeSet);
}
public void createHashMap(List<A2Item> items) {
// create HashMap with all items. no duplicates allowed.
HashMap<Integer, A2Item> hashMap = new HashMap<Integer, A2Item>();
for (Iterator<A2Item> iter = items.iterator(); iter.hasNext();) {
A2Item item = iter.next();
hashMap.put(item.hashCode(), item);
}
// print HashMap
System.out.println("\nPrinting HashMap content of size " + hashMap.size() + ":\n");
for (Map.Entry<Integer, A2Item> entry : hashMap.entrySet()) {
Integer key = entry.getKey();
A2Item value = entry.getValue();
String performer = value.getPerformer();
double transactionValue = value.getTransactionValue();
String date = value.getDate();
System.out.println("Key: " + key + ", Name: " + performer +
", Transaction value: " + transactionValue + ", Date: " + date + ".");
}
System.out.println();
}
public List<A2Item> readCSVFile(String filename) {
List<A2Item> items = new ArrayList<A2Item>();
try {
File file = new File(filename);
FileReader fileReader = new FileReader(file);
BufferedReader bufferedReader = new BufferedReader(fileReader);
String line;
while ((line = bufferedReader.readLine()) != null) {
String[] arr = line.split(",");
A2Item item = new Item(arr[0], Double.parseDouble(arr[1]), arr[2]);
items.add(item);
}
fileReader.close();
} catch (IOException e) {
e.printStackTrace();
}
return items;
}
/** Sort array by transaction value with bubble sort algorithm */
public long bubbleSortByTransactionValue(List<A2Item> array) {
// start time measurement
long startTime = System.nanoTime();
A2Item temp;
int size = array.size();
for (int i=0; i<size; i++) {
for (int j=i+1; j<size; j++) {
if (array.get(j).getTransactionValue() < array.get(i).getTransactionValue()) {
temp = array.get(i);
array.set(i, array.get(j));
array.set(j, temp);
}
}
}
// stop time measurement
long stopTime = System.nanoTime();
long elapsedTime = stopTime - startTime;
return elapsedTime;
}
/** Sort array by transaction value with quick sort algorithm */
public long quickSortByTransactionValue(List<A2Item> array) {
// start time measurement
long startTime = System.nanoTime();
// sort
QuickSort quickSort = new QuickSort(array);
// stop time measurement
long stopTime = System.nanoTime();
long elapsedTime = stopTime - startTime;
return elapsedTime;
}
/** Sort array by transaction value with merging sort algorithm, using priority queue and comparator */
public long mergeSortByTransactionValue(List<A2Item> array) {
// start time measurement
long startTime = System.nanoTime();
// sort
MergeSort mergeSort = new MergeSort();
mergeSort.sort(array);
// stop time measurement
long stopTime = System.nanoTime();
long elapsedTime = stopTime - startTime;
return elapsedTime;
}
public TreeSet<Map.Entry<String, Long>> compareAlgorithms(List<A2Item> array) {
TreeSet<Map.Entry<String, Long>> treeSet = new TreeSet<Map.Entry<String, Long>>();
treeSet.add(new MyEntry<String, Long>("MergeSort", this.mergeSortByTransactionValue(array)));
treeSet.add(new MyEntry<String, Long>("QuickSort", this.quickSortByTransactionValue(array)));
treeSet.add(new MyEntry<String, Long>("BubbleSort", this.bubbleSortByTransactionValue(array)));
return treeSet;
}
public void printResults(TreeSet<Map.Entry<String, Long>> results) {
System.out.println("\nComparing " + results.size() + " sorting algorithms:\n");
System.out.println("ALGORITHM NAME\t\tTIME SPENT");
for (Iterator<Map.Entry<String, Long>> iter = results.iterator(); iter.hasNext();) {
Map.Entry<String, Long> obj = iter.next();
System.out.println(obj.getKey() + "\t\t" + obj.getValue() + " ns.");
}
System.out.println();
}
}
| [
"[email protected]"
]
| |
bbafd3e6f89b9751d0b0056b2ca7f4feaed09ca1 | bac1e66a9118934e948319f18abddbabae19f902 | /JavaPractice/src/org/java/multithreading/Test_3.java | b3023c9ce1db1ef1ff76e0685f475223960641c0 | []
| no_license | pankajsaroha/Java8Features | 388007b455e3efd45389e6df85d469fa89ac9a60 | 0390f20cf57b0904587b679027eeb8112a74bf39 | refs/heads/master | 2021-06-03T01:43:47.564590 | 2020-01-23T02:05:56 | 2020-01-23T02:05:56 | 148,458,273 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,562 | java | package org.java.multithreading;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test_3 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("N , M :");
String nm_1 = br.readLine();
String nm[] = nm_1.trim().split(" ");
int n = Integer.parseInt(nm[0]);
int m = Integer.parseInt(nm[1]);
char city[][] = new char[n][m];
for(int i=0; i<n; i++) {
System.out.println("Row : ");
String row1 = br.readLine();
String[] row = row1.trim().split(" ");
for(int j=0; j<row.length; j++) {
city[i][j] = row[j].charAt(0);
}
}
System.out.println("cost : ");
String cost1 = br.readLine();
String cost[] = cost1.trim().split(" ");
int LCost = Integer.parseInt(cost[0]);
int RCost = Integer.parseInt(cost[1]);
int UCost = Integer.parseInt(cost[2]);
int DCost = Integer.parseInt(cost[3]);
System.out.println("address : ");
String address = br.readLine();
String adr[] = address.trim().split(" ");
int stx = Integer.parseInt(adr[0]) - 1;
int sty = Integer.parseInt(adr[1]) - 1;
System.out.println("q : ");
int visited = 0;
int q = Integer.parseInt(br.readLine());
for(int i=0; i<q; i++) {
System.out.println("Amount :");
int amount = Integer.parseInt(br.readLine());
int j = stx;
int k = sty;
while(amount >= 0) {
if(city[j][k] == '.' && city[j][k++] == '.') {
amount = amount-RCost;
}
}
}
}
}
| [
"[email protected]"
]
| |
7ed9eef8f65f2b264faf41292ac6898d06fa6a21 | 1bfbe05e5697ee538da2b00f5e82783d23310523 | /org.oonsql/src/org/oonsql/lng/util/AbstractOpcodeInputStream.java | 1d31e6b535d4144a8f96a80225b65940840ab743 | []
| no_license | bernardobreder/database-java | 01e7a85763332ae4b7fa79de9bcb4f8dc74a4c11 | b310f9c6c7b322cfb27d51b1f07934654e882c36 | refs/heads/master | 2021-07-01T20:31:38.306939 | 2017-09-23T00:40:41 | 2017-09-23T00:40:41 | 104,510,145 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 472 | java | package org.oonsql.lng.util;
import java.io.IOException;
/**
* Stream de Opcode
*
* @author bernardobreder
*
*/
public abstract class AbstractOpcodeInputStream extends AbstractDataInputStream {
/**
* Realiza a leitura de um opcode
*
* @return opcode
* @throws IOException
*/
public int readOpcode() throws IOException {
return this.read();
}
/**
* Anda com n bytes
*
* @param n
*/
public abstract void goTo(int n);
}
| [
"[email protected]"
]
| |
94160ed1df06b5ee5e21b03e40a0c4df792f83c0 | bc622c7d7fb8d856e4c537dda071c45ae484008f | /app/build/generated/source/buildConfig/debug/com/mycompany/myvalet/BuildConfig.java | b5b91de975f99ef5f317d2c7bd8564d28064831e | []
| no_license | ebook-wd/MyValet | 53d38b3a21c63b8fc6980da3421b76c493d0eb87 | 4fe8e47cdabe83eb16795bf754c5d2dacb1dcb8f | refs/heads/master | 2021-01-23T13:16:29.954455 | 2017-06-06T17:09:49 | 2017-06-06T17:09:49 | 93,236,830 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 449 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.mycompany.myvalet;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.mycompany.myvalet";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"[email protected]"
]
| |
642759b7ed64636c13aeacadecfdc85e7e07aa08 | 0f66288fdab9ed33c5db97a4919ad6d58528c7ad | /src/main/java/com/coffeeshop/model/WorkingShift.java | 26adbcfd9f357ed65765a7182d57dc8b7ca09c7c | []
| no_license | EugeneGrim/CoffeeShop | 1821b56916a7833c1d6f6d6256a7be59875ba77e | f945a626db35547a0469b00c4d6b3ec93a0d34e5 | refs/heads/master | 2020-03-17T20:57:21.984848 | 2018-07-05T20:17:58 | 2018-07-05T20:17:58 | 133,582,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,043 | java | package com.coffeeshop.model;
import lombok.Getter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Getter
public class WorkingShift {
private Date startShiftTime;
private Date endShiftTime;
private User user;
enum ShiftStatus {
STARTED,
CLOSED
}
private ShiftStatus shiftStatus;
private List<Order> ordersList = new ArrayList<>();
public WorkingShift(User user) {
startShiftTime = new Date();
shiftStatus = ShiftStatus.STARTED;
this.user = user;
}
public WorkingShift addOrder(Order order) {
ordersList.add(order);
return this;
}
private double getProceeds() {
return ordersList.stream()
.filter(order -> order.getStatus() == Order.Status.SERVICED)
.mapToDouble(Order::getPrice)
.sum();
}
private int countOfServicedOrders() {
return ordersList.stream()
.filter(order -> order.getStatus() == Order.Status.SERVICED)
.mapToInt(order -> 1)
.sum();
}
private int countOfCanceledOrders() {
return ordersList.stream()
.filter(order -> order.getStatus() == Order.Status.CANCELED)
.mapToInt(order -> 1)
.sum();
}
private int countOfErrorOrders() {
return ordersList.stream()
.filter(order -> order.getStatus() == Order.Status.ERROR)
.mapToInt(order -> 1)
.sum();
}
@Override
public String toString() {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy EE");
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm");
return "WORKING SHIFT " +
dateFormat.format(startShiftTime) + System.lineSeparator() +
"====================" + System.lineSeparator() +
"Shift status: " + shiftStatus + System.lineSeparator() +
"Shift starts at: " +
timeFormat.format(startShiftTime) + System.lineSeparator() +
"Shift ends at: " +
(shiftStatus == ShiftStatus.CLOSED ? timeFormat.format(endShiftTime) : "") +
System.lineSeparator() + "--------------------" + System.lineSeparator() +
"Total orders: " + ordersList.size() + System.lineSeparator() +
"Serviced orders: " + countOfServicedOrders() + System.lineSeparator() +
"Canceled orders: " + countOfCanceledOrders() + System.lineSeparator() +
"Error orders: " + countOfErrorOrders() + System.lineSeparator() +
"--------------------" + System.lineSeparator() +
"TOTAL PROCEEDS: " + getProceeds() + " RUB" + System.lineSeparator() +
"--------------------" + System.lineSeparator();
}
public void close() {
endShiftTime = new Date();
shiftStatus = ShiftStatus.CLOSED;
}
}
| [
"[email protected]"
]
| |
290bad8f50582306a5a1493ba9a64566ba92d944 | db96b76094730056966dd1bb04b2fb4a88271549 | /services/Car/tests/CarDeveloperOptions/src/com/android/car/developeroptions/development/featureflags/FeatureFlagPreference.java | b8d4306ec7aee0cd055443f4133917ac28d43ebb | []
| no_license | dylanbroodryk/Android-system-apps | 48335f66d3fad6532cda19e192f11af1f69dce00 | 50f6f11f70906260a710cbeb66a92fba72410504 | refs/heads/master | 2022-03-14T16:15:33.277628 | 2022-02-12T04:56:41 | 2022-02-12T04:56:41 | 228,542,760 | 0 | 0 | null | 2019-12-17T05:50:11 | 2019-12-17T05:50:10 | null | UTF-8 | Java | false | false | 1,917 | java | /*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.car.developeroptions.development.featureflags;
import android.content.Context;
import android.util.FeatureFlagUtils;
import androidx.preference.SwitchPreference;
public class FeatureFlagPreference extends SwitchPreference {
private final String mKey;
private final boolean mIsPersistent;
public FeatureFlagPreference(Context context, String key) {
super(context);
mKey = key;
setKey(key);
setTitle(key);
mIsPersistent = FeatureFlagPersistent.isPersistent(key);
boolean isFeatureEnabled;
if (mIsPersistent) {
isFeatureEnabled = FeatureFlagPersistent.isEnabled(context, key);
} else {
isFeatureEnabled = FeatureFlagUtils.isEnabled(context, key);
}
setCheckedInternal(isFeatureEnabled);
}
@Override
public void setChecked(boolean isChecked) {
setCheckedInternal(isChecked);
if (mIsPersistent) {
FeatureFlagPersistent.setEnabled(getContext(), mKey, isChecked);
} else {
FeatureFlagUtils.setEnabled(getContext(), mKey, isChecked);
}
}
private void setCheckedInternal(boolean isChecked) {
super.setChecked(isChecked);
setSummary(Boolean.toString(isChecked));
}
}
| [
"[email protected]"
]
| |
53793993e6c6c503749f664a5d98ee041ad65f79 | 7d9228a747fee989b50a3070024d90bba2fbabc3 | /src/nuc/web/servlet/HistoryServlet.java | cf30f6c70d6087f5c7e125d5440ac1ed0cb7e590 | [
"Apache-2.0"
]
| permissive | 16071041/hr | 098c178b1ddbf5da5ff06d67c5ee2498c57cadf8 | e080492048a749e6a4b4527341ac472666c53487 | refs/heads/master | 2020-09-20T18:41:21.926013 | 2019-11-30T01:18:32 | 2019-11-30T01:18:32 | 224,561,422 | 2 | 1 | Apache-2.0 | 2019-11-29T08:59:35 | 2019-11-28T03:19:35 | JavaScript | UTF-8 | Java | false | false | 4,223 | java | package nuc.web.servlet;
import nuc.web.dao.EmpDao;
import nuc.web.dao.HistoryDao;
import nuc.web.pojo.Employee;
import nuc.web.pojo.History;
import javax.servlet.Servlet;
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 java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@WebServlet("/HistoryServlet")
public class HistoryServlet extends HttpServlet {
public HistoryServlet() {
super();
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//获取方法参数名称
String name = req.getParameter("method");
try {
//动态获取目标方法名称,参数类型,调用目标方法
Method method = this.getClass().getDeclaredMethod(name, HttpServletRequest.class, HttpServletResponse.class);
method.invoke(this, req, resp);
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//设置请求,响应,返回内容编码格式
req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8");
doGet(req, resp);
}
protected void findHistoryById(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String hid = request.getParameter("id");
int id = Integer.parseInt(hid);
HistoryDao dao = new HistoryDao();
History his = dao.selectHistoryById(id);
System.out.println("查看成功。");
if (his != null) {
request.setAttribute("history", his);
request.getRequestDispatcher("history_detail.jsp").forward(request, response);
} else {
request.getRequestDispatcher("/EmpServlet?method=findHistorylist").forward(request, response);
}
}
/**
* 获取当前修改对象,跳转修改界面
*
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
protected void toUpdateHistory(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String hid = request.getParameter("id");
int id = Integer.parseInt(hid);
HistoryDao dao = new HistoryDao();
History his = dao.selectHistoryById(id);
if (his != null) {
request.setAttribute("history", his);
System.out.println("update1 成功");
request.getRequestDispatcher("/history_update.jsp").forward(request, response);
} else {
request.getRequestDispatcher("/EmpServlet?method=findHistorylist").forward(request, response);
}
}
protected void doUpdateHistoryById(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String hid = request.getParameter("id");
int id = Integer.parseInt(hid);
HistoryDao dao = new HistoryDao();
String name = request.getParameter("name");
String gender = request.getParameter("gender");
String date = request.getParameter("date");
String telephone = request.getParameter("telephone");
String email = request.getParameter("email");
String address = request.getParameter("address");
String education = request.getParameter("education");
History his = new History(id, name, gender, date, telephone, email, address, education);
int i = dao.updateHistory(his);
System.out.println("update2 成功。");
request.getRequestDispatcher("/EmpServlet?method=findHistorylist").forward(request, response);
}
}
| [
"[email protected]"
]
| |
3f64450a0f51051c4440fbc47f56ee0a6dff1348 | 1741cc647d47abc38d5cd995ed7008fea1d0ea92 | /MetaHackerCup2022/src/round0/problema/secondhands/SecondHandsSolver.java | 41141311aeb7766ddbaf719ea62d603f0b81d01c | [
"Apache-2.0"
]
| permissive | atanasg/fb-hackercup-solutions | 3275c60add93ffccedbe0f2b513c73d0772300d2 | cf5dab9099c1fa28894188b88be26470c94e84bb | refs/heads/master | 2022-09-30T20:18:32.559910 | 2022-09-12T20:28:13 | 2022-09-12T20:29:40 | 140,725,375 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,718 | java | package round0.problema.secondhands;
import java.io.BufferedReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
/**
* @see https://www.facebook.com/codingcompetitions/hacker-cup/2022/qualification-round/problems/A
* @author atanasg
*/
public class SecondHandsSolver {
private static final Path RES_FOLDER = Paths.get("res", "round0", "problema", "secondhands");
private static final String WHITESPACE = " ";
private static final String TRUE_CASE = "YES";
private static final String FALSE_CASE = "NO";
private static int numOfCases;
private static List<String> outputLines;
private static void initStaticVariables(int num) {
numOfCases = num;
outputLines = new LinkedList<String>();
}
private static void writeOutputToFile(Path file) throws IOException {
// force UNIX line endings
String defaultSystemSeparator = System.getProperty("line.separator");
System.setProperty("line.separator", "\n");
Files.write(file, outputLines);
// set back default separator
System.setProperty("line.separator", defaultSystemSeparator);
}
private static String determineIfPartsFitInShowcases(int n, int k, List<Integer> partsList) {
boolean isSolutionPossible = true;
if (n > (2 * k)) {
// too many parts for the two displays
isSolutionPossible = false;
}
int[] styles = new int[101];
Arrays.fill(styles, 0);
for(int p : partsList) {
styles[p] = styles[p] + 1;
if (styles[p] >= 3) {
// a same style will be twice in one of the displays
isSolutionPossible = false;
break;
}
}
if (isSolutionPossible) {
return TRUE_CASE;
} else {
return FALSE_CASE;
}
}
public static void main(String[] args) throws IOException {
BufferedReader buff = Files.newBufferedReader(RES_FOLDER.resolve("input.txt"));
initStaticVariables(Integer.parseInt(buff.readLine()));
for (int i = 0; i < numOfCases; i++) {
String nk = buff.readLine();
String[] nkArray = nk.split(WHITESPACE);
int n = Integer.parseInt(nkArray[0]);
int k = Integer.parseInt(nkArray[1]);
String parts = buff.readLine();
String[] partsArray = parts.split(WHITESPACE);
List<Integer> partsList = new LinkedList<>();
for (String p : partsArray) {
partsList.add(Integer.parseInt(p));
}
//Arrays.stream(partsArray).map(p -> Integer.parseInt(p)).collect(Collectors.toList());
String yesOrNo = determineIfPartsFitInShowcases(n, k, partsList);
outputLines.add("Case #" + (i + 1) + ": " + yesOrNo);
}
buff.close();
writeOutputToFile(RES_FOLDER.resolve("output.txt"));
}
}
| [
"[email protected]"
]
| |
ef2bb638281e4ef9a2eee87f5f061314a744c01b | cd916b8616c1a6de7d09975b656d4d4a276eb84c | /app/src/main/java/com/sx/base/BaseObserver.java | bbbdc0942148fb6a789642299e1e2e01ef2579b1 | []
| no_license | Zs0926/ProjectModel | a976ec3a9fdb9171bf64e69552392bb53e248411 | 4773f15ef9de77c317d7cd374c40e5b4cde596d6 | refs/heads/master | 2020-07-02T23:28:34.714586 | 2019-08-11T02:20:36 | 2019-08-11T02:20:36 | 201,698,163 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,378 | java | package com.sx.base;
import com.sx.http.ApiException;
import io.reactivex.Observer;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import retrofit2.HttpException;
public abstract class BaseObserver<T> implements Observer<T> {
//管理每次网络请求
CompositeDisposable compositeDisposable = new CompositeDisposable();
@Override
public void onSubscribe(Disposable d) {
compositeDisposable.add(d);
}
@Override
public void onNext(T value) {
onSuccess(value);
}
@Override
public void onError(Throwable e) {
//网络请求成功
if (e instanceof ApiException) {
ApiException apiException= (ApiException) e;
int errorCode = apiException.getErrorCode();
switch (errorCode){
case 1:
}
error(apiException.getErrorMsg());
//网络请求失败
}else if(e instanceof HttpException){
error(e.getMessage());
}
if (compositeDisposable != null) {
compositeDisposable.clear();
}
}
@Override
public void onComplete() {
if (compositeDisposable != null) {
compositeDisposable.clear();
}
}
abstract <T> void onSuccess(T data);
abstract<T> void error(T error);
}
| [
"[email protected]"
]
| |
632f8e4943107d1d9e8a41fa60e9017b71cc9d0d | ee49859ac5150da6a47efdd6f41773656aee128e | /src/main/java/com/parfka/command/ParseUploadCommand.java | 817fcdc11841d4817f7972f82a907d261ef098d9 | []
| no_license | parfka/parfka-java | dd0dc2e562d5abfa5d72dfe4bf11bc0a2bd6bd5e | 27ed828acd8c02cb916e5fa2de8d36d1e346ed7a | refs/heads/master | 2020-05-20T19:15:15.800461 | 2019-05-21T00:41:08 | 2019-05-21T00:41:08 | 185,721,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,163 | java | package com.parfka.command;
import java.io.IOException;
import com.parfka.Parfka;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.entity.ByteArrayEntity;
import com.parfka.ParseConstants;
import com.parfka.ParfkaUser;
import com.parfka.callback.ProgressCallback;
import com.parfka.http.CountingHttpEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ParseUploadCommand extends ParseCommand {
private String endPoint;
private String contentType;
private byte[] data;
private ProgressCallback progressCallback;
private static Logger LOGGER = LoggerFactory.getLogger(ParfkaUser.class);
public ParseUploadCommand(String endPoint) {
this.endPoint = endPoint;
}
@Override
public HttpRequestBase getRequest() throws IOException {
String url = Parfka.getParseAPIUrl(endPoint);
LOGGER.info(url);
HttpPost httppost = new HttpPost(url);
setupHeaders(httppost, false);
if(contentType != null) {
httppost.addHeader(ParseConstants.HEADER_CONTENT_TYPE, contentType);
}
LOGGER.info("data size: " + data.length);
if (data != null) {
if(progressCallback != null) {
httppost.setEntity(new CountingHttpEntity(new ByteArrayEntity(data), progressCallback));
}
else {
httppost.setEntity(new ByteArrayEntity(data));
}
}
return httppost;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public void setData(byte[] data) {
this.data = data;
}
public void setProgressCallback(ProgressCallback progressCallback) {
this.progressCallback = progressCallback;
}
/*
@Override
public ParseResponse perform() throws ParseException {
try {
HttpClient httpclient = createSingleClient();
HttpResponse httpResponse = httpclient.execute(getRequest());
ParseResponse response = new ParseResponse(httpResponse);
return response;
}
catch (ClientProtocolException e) {
throw ParseResponse.getConnectionFailedException(e.getMessage());
}
catch (IOException e) {
throw ParseResponse.getConnectionFailedException(e.getMessage());
}
}
*/
}
| [
"[email protected]"
]
| |
9c89fd606b71b47d080edf04eba8846c946c961b | f0bb0bb7851ffa8ef62da07d5639b7d569674397 | /src/test/java/com/crud/tasks/service/SimpleEmailServiceTest.java | abe96a6f9bfd2f9263cb1ab659e83a5dd3947761 | []
| no_license | MichalKoperski/tasks | 5764b5571e8d9b85c627cb27d293a2cc1bebdcad | f8e382e8c18c57b49ea5a038094f2db1c67e8402 | refs/heads/master | 2020-03-19T08:39:42.818724 | 2018-08-15T00:10:05 | 2018-08-15T00:10:05 | 136,225,114 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,183 | java | package com.crud.tasks.service;
import com.crud.tasks.domain.Mail;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import static org.junit.Assert.*;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@RunWith(MockitoJUnitRunner.class)
public class SimpleEmailServiceTest {
@InjectMocks
private SimpleEmailService simpleEmailService;
@Mock
private JavaMailSender javaMailSender;
@Test
public void shouldSendEmail() {
//Given
Mail mail = new Mail("[email protected]", "test","test message","");
SimpleMailMessage mailMessage = new SimpleMailMessage();
mailMessage.setTo(mail.getMailTo());
mailMessage.setSubject(mail.getSubject());
mailMessage.setText(mail.getMessage());
mailMessage.setCc(mail.getToCC());
//When
simpleEmailService.send(mail);
//Then
verify(javaMailSender, times(1)).send(mailMessage);
}
} | [
"[email protected]"
]
| |
de9d13fd047b3fbb4e8fdf7a6a96f56702e70847 | 72edca495e9760c65646e88d4e6825a2b680ce75 | /src/main/java/runner/GoodSuspendCompany.java | 193dabd208aebd9d29424534c48372c2f5cb9c74 | []
| no_license | unil19/thread-demo | b05c5d668d6dc8a8fdcdbd61d51fede75f764e95 | 7efde963a9b4055262903ff515624ab24e0013e6 | refs/heads/master | 2020-04-15T04:57:18.891815 | 2019-01-09T13:23:41 | 2019-01-09T13:23:41 | 164,403,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package runner;
import config.ThreadApplication;
public class GoodSuspendCompany extends Thread{
public void run() {
while (true) {
synchronized (ThreadApplication.object){
System.out.println("in read");
}
Thread.yield();
}
}
}
| [
"unil"
]
| unil |
7efcdfbdf572f05f9fd09e223b1a1a3fd34b7c18 | b7bd7deb4f2b3e55e3a4f88837b782ae0ae9b3c3 | /src/level1/Solution_같은숫자는싫어.java | 8f0de30af77ff1e5e2cb28d8518c172d3d45732a | []
| no_license | sksms17456/Programmers | 0ddd9021b57135bd456c7bc31e11398555e26fd0 | 687e0e853ae0c7d2dfc00bc47c5cf94c8126808f | refs/heads/master | 2020-06-09T16:10:08.293918 | 2019-10-06T08:18:19 | 2019-10-06T08:18:19 | 193,465,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,410 | java | //문제 설명
//배열 arr가 주어집니다. 배열 arr의 각 원소는 숫자 0부터 9까지로 이루어져 있습니다. 이때, 배열 arr에서 연속적으로 나타나는 숫자는 하나만 남기고 전부 제거하려고 합니다. 단, 제거된 후 남은 수들을 반환할 때는 배열 arr의 원소들의 순서를 유지해야 합니다. 예를 들면,
//
//arr = [1, 1, 3, 3, 0, 1, 1] 이면 [1, 3, 0, 1] 을 return 합니다.
//arr = [4, 4, 4, 3, 3] 이면 [4, 3] 을 return 합니다.
//배열 arr에서 연속적으로 나타나는 숫자는 제거하고 남은 수들을 return 하는 solution 함수를 완성해 주세요.
//
//제한사항
//배열 arr의 크기 : 1,000,000 이하의 자연수
//배열 arr의 원소의 크기 : 0보다 크거나 같고 9보다 작거나 같은 정수
//입출력 예
//arr answer
//[1,1,3,3,0,1,1] [1,3,0,1]
//[4,4,4,3,3] [4,3]
//입출력 예 설명
//입출력 예 #1,2
//문제의 예시와 같습니다.
package level1;
import java.util.*;
class Solution_같은숫자는싫어 {
public int[] solution(int[] arr) {
ArrayList<Integer> list = new ArrayList<>();
list.add(arr[0]);
for(int i=1; i<arr.length; i++) {
if(arr[i]==list.get(list.size()-1)) {
continue;
}
list.add(arr[i]);
}
int[] answer = new int[list.size()];
for(int i=0; i<list.size(); i++) {
answer[i] = list.get(i);
}
return answer;
}
}
| [
"[email protected]"
]
| |
ee1ebd727f13538e28df50e1d9269d2bc0dd5754 | 18eef5171b76a5e40c0dd8f5e2f31c2dfdb5f8b3 | /src/main/java/com/seleniummaster/jdbc/jdbc_1/atguigu5/blob/InsertTest.java | b8e2ce8a2ac60600b02a921fb9d811464b19c59a | []
| no_license | UyCoder/APITesting-karate | 076fc3ccd8dc6d43ad22ba78ab1e4b828d807893 | c44ebaeec67303d83563ba1f6f04f70c31a04c06 | refs/heads/master | 2023-07-12T16:48:42.362215 | 2021-07-29T18:40:00 | 2021-07-29T18:40:00 | 390,819,097 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,380 | java | package com.seleniummaster.jdbc.jdbc_1.atguigu5.blob;
import com.seleniummaster.jdbc.jdbc_1.atguigu3.util.JDBCUtils;
import org.junit.Test;
import java.sql.Connection;
import java.sql.PreparedStatement;
/*
* 使用PreparedStatement实现批量数据的操作
*
* update、delete本身就具有批量操作的效果。
* 此时的批量操作,主要指的是批量插入。使用PreparedStatement如何实现更高效的批量插入?
*
* 题目:向goods表中插入20000条数据
* CREATE TABLE goods(
id INT PRIMARY KEY AUTO_INCREMENT,
NAME VARCHAR(25)
);
* 方式一:使用Statement
* Connection conn = JDBCUtils.getConnection();
* Statement st = conn.createStatement();
* for(int i = 1;i <= 20000;i++){
* String sql = "insert into goods(name)values('name_" + i + "')";
* st.execute(sql);
* }
*
*/
public class InsertTest {
//批量插入的方式二:使用PreparedStatement
@Test
public void testInsert1() {
Connection conn = null;
PreparedStatement ps = null;
try {
long start = System.currentTimeMillis();
conn = JDBCUtils.getConnection();
String sql = "insert into goods(name)values(?)";
ps = conn.prepareStatement(sql);
for (int i = 1; i <= 20000; i++) {
ps.setObject(1, "name_" + i);
ps.execute();
}
long end = System.currentTimeMillis();
System.out.println("花费的时间为:" + (end - start));//20000:83065
} catch (Exception e) {
e.printStackTrace();
} finally {
JDBCUtils.closeResource(conn, ps);
}
}
/*
* 批量插入的方式三:
* 1.addBatch()、executeBatch()、clearBatch()
* 2.mysql服务器默认是关闭批处理的,我们需要通过一个参数,让mysql开启批处理的支持。
* ?rewriteBatchedStatements=true 写在配置文件的url后面
* 3.使用更新的mysql 驱动:mysql-connector-java-5.1.37-bin.jar
*/
@Test
public void testInsert2() {
Connection conn = null;
PreparedStatement ps = null;
try {
long start = System.currentTimeMillis();
conn = JDBCUtils.getConnection();
String sql = "insert into goods(name)values(?)";
ps = conn.prepareStatement(sql);
for (int i = 1; i <= 1000000; i++) {
ps.setObject(1, "name_" + i);
//1."攒"sql
ps.addBatch();
if (i % 500 == 0) {
//2.执行batch
ps.executeBatch();
//3.清空batch
ps.clearBatch();
}
}
long end = System.currentTimeMillis();
System.out.println("花费的时间为:" + (end - start));//20000:83065 -- 565
} catch (Exception e) { //1000000:16086
e.printStackTrace();
} finally {
JDBCUtils.closeResource(conn, ps);
}
}
//批量插入的方式四:设置连接不允许自动提交数据
@Test
public void testInsert3() {
Connection conn = null;
PreparedStatement ps = null;
try {
long start = System.currentTimeMillis();
conn = JDBCUtils.getConnection();
//设置不允许自动提交数据
conn.setAutoCommit(false);
String sql = "insert into goods(name)values(?)";
ps = conn.prepareStatement(sql);
for (int i = 1; i <= 1000000; i++) {
ps.setObject(1, "name_" + i);
//1."攒"sql
ps.addBatch();
if (i % 500 == 0) {
//2.执行batch
ps.executeBatch();
//3.清空batch
ps.clearBatch();
}
}
//提交数据
conn.commit();
long end = System.currentTimeMillis();
System.out.println("花费的时间为:" + (end - start));//20000:83065 -- 565
} catch (Exception e) { //1000000:16086 -- 5114
e.printStackTrace();
} finally {
JDBCUtils.closeResource(conn, ps);
}
}
}
| [
"[email protected]"
]
| |
bef54da9d7a9eb0eac4f15ec371ba918b25e9d3a | 5751141d21e4caac0ed4a9882c49c249a695a861 | /ShowTime/src/controller/LogIn.java | fbc16f5d2e0af74a842ea71f558caa06164b50a1 | []
| no_license | ArijitKundu996/HireMax | b272d0acf803212ba35d3afde3fed327ab9861db | f5c09b3b0bf931579f4ecb304767910c2053edb9 | refs/heads/master | 2020-09-28T04:05:53.067059 | 2019-12-08T14:25:24 | 2019-12-08T14:25:24 | 226,677,877 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,487 | java | package controller;
import java.sql.*;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
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 connector.Db2Connector;
/**
* Servlet implementation class LogIn
*/
@WebServlet("/LogIn")
public class LogIn extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
*/
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
try
{
PrintWriter out = response.getWriter();
String id,password;
id = request.getParameter("userid");
password = request.getParameter("password");
String sql = "select password from booking where id=?";
Connection cn = Db2Connector.getCn();
PreparedStatement ps = cn.prepareStatement(sql);
ps.setString(1, id);
ResultSet rs = ps.executeQuery();
HttpSession a = request.getSession(false);
String cont = (String)a.getAttribute("continu"); /*To check if seat booking is in process*/
if(rs.next())
{
if(password.equals(rs.getString(1)))
{
HttpSession user = request.getSession();
user.setAttribute("session", id);
if(cont.equalsIgnoreCase("true")) /*Continue with the payment*/
{
RequestDispatcher rd = request.getRequestDispatcher("payment.jsp");
rd.forward(request, response);
}
if(cont.equals("") || cont==null)
{
RequestDispatcher rd = request.getRequestDispatcher("banner.html");
rd.forward(request, response);
}
}
else
{
RequestDispatcher rd = request.getRequestDispatcher("forgpass.jsp");
rd.include(request, response);
out.println("<h2><font color='yellow'>Incorrect Password..!!</font></h2>");
}
}
else
{
RequestDispatcher rd = request.getRequestDispatcher("signup.html");
rd.include(request, response);
out.println("<h2><font color='yellow'>You are not a registered user..!!\nPlease Register</font></h2>");
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}
| [
"Arijit@Arijits-Laptop"
]
| Arijit@Arijits-Laptop |
cd1056f8f46b54dae4ccd6c72d9ddfc4429d360f | 6b48f6adce63ef1aa0089ee6fee27f57299b9d6d | /SpaceQuestMapEditor/src/ca/viaware/rpg/mapeditor/EnemyEditor.java | 8ca1ed685f8089f56604f25d1e68cee2f70adc5a | []
| no_license | Stolous/SpaceQuest | b36e7e9b8b4a258e7f1f5b581fb74d716b85831b | 4b313bd4e6e1c1411c3b57df81679f91a6fbf733 | refs/heads/master | 2021-01-14T10:13:23.510617 | 2013-01-18T20:49:02 | 2013-01-18T20:49:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,886 | java | package ca.viaware.rpg.mapeditor;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JTextField;
public class EnemyEditor extends JFrame {
private Enemy selectedEnemy = null;
private JComboBox enemyList = new JComboBox();
private JButton submit = new JButton();
private JTextField enemyLevel = new JTextField();
public void createEditor() {
setTitle("Enemy Editor");
setSize(200, 200);
setLocation(0, 700);
setLayout(new GridLayout(5, 1));
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
showComponents();
}
private void showComponents() {
Container cont = getContentPane();
cont.add(enemyList);
cont.add(enemyLevel);
cont.add(submit);
submit.setText("Submit");
for (EnemyType eType : Globals.enemyTypes) {
enemyList.addItem(object(eType.getName()));
}
enemyList.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
selectedEnemy.setType(Globals.enemyTypes.get(enemyList.getSelectedIndex()));
}
});
submit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
selectedEnemy.setLevel(Integer.parseInt(enemyLevel.getText()));
} catch (NumberFormatException e1) {
System.out.println("Invalid number");
}
}
});
}
public Enemy getSelectedEnemy() {
return selectedEnemy;
}
public void setEnemy(Enemy e) {
selectedEnemy = e;
enemyList.setSelectedIndex(Globals.enemyTypes.indexOf(selectedEnemy.getType()));
enemyLevel.setText(Integer.toString(selectedEnemy.getLevel()));
}
private Object object(final String item) {
return new Object() {
public String toString() {
return item;
}
};
}
}
| [
"[email protected]"
]
| |
5bc59a10d8d904ec21d22383110577cb6d2afdeb | 63c6ec3077d6b344b3fc8d3914eff1e9d5b753ae | /src/main/java/mattjohns/common/immutable/userinterface/font/FontSymbolList.java | 7d66cf779e317934a82c14419b22dacf5a46f81e | []
| no_license | MattJohns/BoneMealControl | 11beb3ce11270cd4c68e779b6816e1c6563f30f2 | 27dc789a3b3dd7c3e1b6282d945f637aed29db3c | refs/heads/master | 2022-08-24T18:06:26.890332 | 2022-07-28T01:22:23 | 2022-07-28T01:22:23 | 177,415,636 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 964 | java | package mattjohns.common.immutable.userinterface.font;
import com.google.common.collect.ImmutableList;
import mattjohns.common.immutable.Immutable;
import mattjohns.common.immutable.list.ListImmutableBase;
public final class FontSymbolList extends ListImmutableBase<FontSymbol, FontSymbolList> {
protected FontSymbolList(ImmutableList<FontSymbol> internalList) {
super(internalList);
}
public static FontSymbolList of() {
return new FontSymbolList(ImmutableList.of());
}
@Override
protected final FontSymbolList copy(ImmutableList<FontSymbol> internalList) {
return new FontSymbolList(internalList);
}
public static final class Builder extends ListImmutableBase.Builder<FontSymbol, FontSymbolList, Builder> {
@Override
protected Builder concreteCopy(Immutable<?> source) {
return new Builder();
}
@Override
protected FontSymbolList upcastList(ImmutableList<FontSymbol> baseList) {
return new FontSymbolList(baseList);
}
}
}
| [
"[email protected]"
]
| |
3b769173f333bc5f6382e6949e50e78262162ab8 | 366084e6c039629bc537b2c7a341c0d220db2537 | /src/Cache.java | c72d39e54538a4d272408cbdac6d90ceae177bee | []
| no_license | patrick-luo/OS-Project1 | 07672a27f638bfdcd77e5d0334ef35711b6eb2a2 | bc8c99ea2fd3e72037cf374511ca4d85654d2e93 | refs/heads/master | 2020-05-17T12:35:16.054246 | 2014-11-05T00:26:50 | 2014-11-05T00:26:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 617 | java | import java.util.concurrent.ConcurrentHashMap;
public class Cache<K, V> {
private ConcurrentHashMap<K, V> cache;
public Cache() {
this.cache = new ConcurrentHashMap<K, V>();
}
public void put(K key, V value) {
this.cache.put(key, value);
}
public boolean isHit(K key) {
return this.cache.containsKey(key);
}
public V get(K key) {
return this.cache.get(key);
}
public void remove(K key) {
this.cache.remove(key);
}
public void printCache() {
System.out.println("+++++++++++");
for (K k : this.cache.keySet()) {
System.out.println(k);
}
System.out.println("+++++++++++");
}
}
| [
"[email protected]"
]
| |
22329836302aaf0845b99248c035ddd3b68faf58 | 5f6fe81c662a62864771bdfb3e93ab830a9ad035 | /app/src/main/java/com/project/firebase/ui/home/HomeFragment.java | ad2599c53b00b5ff9313a540068f5561468fe759 | []
| no_license | khaliq-almel/Firebase | c5e2afe6430e4904850ee1b621bd3937419b0f07 | 14164165275e326d8efd39cf0a82f46cad9628f5 | refs/heads/master | 2020-08-20T18:51:09.625679 | 2019-10-18T15:35:31 | 2019-10-18T15:35:31 | 216,055,787 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,131 | java | package com.project.firebase.ui.home;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.project.firebase.R;
public class HomeFragment extends Fragment {
private HomeViewModel homeViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
homeViewModel =
ViewModelProviders.of(this).get(HomeViewModel.class);
View root = inflater.inflate(R.layout.fragment_home, container, false);
final TextView textView = root.findViewById(R.id.text_home);
homeViewModel.getText().observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
} | [
"[email protected]"
]
| |
fb2fc7eaf1ae09b679f3840c6161347dc9fed082 | 861d04600d8ce3d155ab0cdaa096d2304402ecd9 | /profileservice/src/main/java/com/imadelfetouh/profileservice/dal/configuration/Executer.java | bbde249635731841c002d8e8572313c11aac4af5 | []
| no_license | imadfetouh/profileservice | f68ad284750a0559579d1b11ba690cd293174fa3 | d9938da8a4ef048441753d640f89b5dc2ab10de8 | refs/heads/main | 2023-05-22T02:00:19.652672 | 2021-06-13T15:10:29 | 2021-06-13T15:10:29 | 357,817,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 985 | java | package com.imadelfetouh.profileservice.dal.configuration;
import com.imadelfetouh.profileservice.model.response.ResponseModel;
import com.imadelfetouh.profileservice.model.response.ResponseType;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Executer<T> extends SessionHelper {
private static final Logger logger = Logger.getLogger(Executer.class.getName());
public Executer(SessionType sessionType) {
super(sessionType);
}
public ResponseModel<T> execute(QueryExecuter<T> queryExecuter) {
ResponseModel<T> responseModel = new ResponseModel<>();
try {
responseModel = queryExecuter.executeQuery(getSession());
}
catch (Exception e) {
logger.log(Level.ALL, e.getMessage());
rollback();
responseModel.setResponseType(ResponseType.ERROR);
}
finally {
closeSession();
}
return responseModel;
}
}
| [
"[email protected]"
]
| |
60df2086261b7d5cfea7d32ffe1b7ff0f2214fcb | fce24a523c0209e82a68e22b074e9aef181f02cd | /Algorithm/Special_algo/Bellman Ford Algorithm .java | d19ac42627d4dcbeef1be91c1bc41bf919272e80 | [
"MIT",
"LicenseRef-scancode-free-unknown"
]
| permissive | jyotidhatarwal/Algo-Tree | 4f4482c832d8df37ce7a87ffa9734b1ed5494588 | 707a16b95f3eb69f2c6406c1a356f95bcebc085c | refs/heads/main | 2023-05-02T13:01:29.714286 | 2021-04-04T15:20:10 | 2021-04-04T15:20:10 | 350,303,422 | 0 | 0 | MIT | 2021-04-04T15:20:11 | 2021-03-22T10:37:30 | C++ | UTF-8 | Java | false | false | 2,032 | java |
// BELLMAN FORD ALGORITHM -> SINGLE SOURCE SHORTEST PATH ALGORITHM
/*
Constraints
1<= N <= 10^4
1<= M <= 10^6
1<= ai, bi <= N
-1000 <= wi <= 1000
*/
/*
Input Fprmat
First line contains two space separated integers,N and M. Then M lines follow, each line has 3 space separated integers ai, bi and wi.
*/
/* Sample Input
5 5
1 2 5
1 3 2
3 4 1
1 4 6
3 5 5
*/
/*
Output Format
Print the shortest distances from the source vertex (vertex number 1) to all other vertices in a line. Print 10^9 in case the vertex can't be reached form the source vertex.
*/
/*
Sample Output
5 2 3 7
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedList;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] st = br.readLine().split(" ");
int n = Integer.parseInt(st[0]);
int m = Integer.parseInt(st[1]);
int[][] arr = new int[m][3];
for(int i=0;i<m;i++){
st = br.readLine().split(" ");
arr[i][0] = Integer.parseInt(st[0])-1;
arr[i][1] = Integer.parseInt(st[1])-1;
arr[i][2] = Integer.parseInt(st[2]);
}
int[] path = new int[n];
Arrays.fill(path,Integer.MAX_VALUE);
path[0] = 0;
for(int i =0 ;i<n-1;i++){
for(int j= 0;j<m;j++){
int u = arr[j][0];
int v = arr[j][1];
int wt = arr[j][2];
if(path[u] == Integer.MAX_VALUE){
continue;
}
if(path[u] + wt < path[v]){
path[v] = path[u] + wt;
}
}
}
for(int i=1;i<n;i++){
if(path[i] != Integer.MAX_VALUE){
System.out.print(path[i] +" ");
}else{
System.out.print("1000000000");
}
}
System.out.println();
}
}
| [
"[email protected]"
]
| |
672d9769100354b16fb1690a4b9dbdb06195779f | 62acd49e0e8a7e2c66ffdcea99abbf3198bd1557 | /app/src/main/java/com/android/face/nfc/EncrypDecryp.java | 90c921bafacedc18750c730c3f0857ef4b6d69a3 | []
| no_license | liujingyi1/Translator-5 | 29dee688ec6a5c3f86e2ba8b6804314cc436610e | 2627486d80a1d4aa4dbb2360da1a96f5d6234d26 | refs/heads/master | 2020-09-10T04:24:54.444148 | 2019-11-14T08:29:41 | 2019-11-14T08:29:41 | 221,647,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,878 | java | package com.android.face.nfc;
public class EncrypDecryp {
private static final char[] BitIP = { 25, 17, 54, 33, 9, 38, 34, 1, 11, 48,
29, 56, 27, 50, 51, 40, 19, 58, 21, 5, 44, 31, 45, 7, 61, 47, 13,
57, 23, 15, 53, 46, 24, 16, 8, 39, 0, 26, 18, 10, 2, 49, 12, 4, 36,
30, 14, 6, 41, 59, 63, 22, 62, 32, 37, 42, 28, 20, 43, 52, 3, 35,
60, 55 };
private static final char[] BitCP = { 36, 7, 40, 60, 43, 19, 47, 23, 34, 4,
39, 8, 42, 26, 46, 29, 33, 1, 38, 16, 57, 18, 51, 28, 32, 0, 37,
12, 56, 10, 45, 21, 53, 3, 6, 61, 44, 54, 5, 35, 15, 48, 55, 58,
20, 22, 31, 25, 9, 41, 13, 14, 59, 30, 2, 63, 11, 27, 17, 49, 62,
24, 52, 50 };
private static final char[][] BitPMC = {
{ 56, 0, 53, 29, 17, 44, 24, 8, 20, 23, 43, 16, 7, 46, 36, 57, 2,
19, 42, 35, 32, 15, 31, 26, 54, 60, 33, 9, 38, 11, 61, 30,
10, 47, 40, 5, 52, 25, 41, 27, 62, 63, 6, 58, 13, 21, 3,
28, 18, 49, 55, 59, 39, 51, 12, 37, 14, 1, 4, 34, 22, 45,
48, 50 },
{ 63, 10, 47, 58, 39, 38, 51, 42, 23, 54, 3, 21, 14, 55, 49, 29,
37, 28, 56, 40, 61, 43, 60, 18, 16, 57, 26, 9, 30, 34, 11,
33, 1, 27, 53, 12, 36, 48, 52, 22, 46, 8, 45, 44, 59, 15,
5, 6, 13, 24, 35, 31, 2, 62, 41, 0, 4, 25, 50, 20, 7, 17,
32, 19 },
{ 8, 5, 46, 4, 39, 44, 63, 52, 2, 54, 56, 62, 21, 32, 50, 48, 20,
22, 47, 57, 60, 37, 12, 34, 9, 41, 27, 11, 6, 18, 33, 14,
24, 31, 28, 55, 36, 23, 16, 40, 51, 25, 61, 43, 17, 3, 35,
53, 0, 7, 10, 58, 15, 1, 13, 19, 38, 45, 29, 42, 49, 26,
59, 30 },
{ 26, 52, 25, 7, 48, 49, 56, 30, 27, 11, 22, 47, 8, 16, 40, 10, 9,
24, 50, 62, 57, 44, 34, 14, 4, 55, 59, 5, 39, 23, 17, 58,
12, 3, 63, 43, 6, 20, 51, 42, 45, 28, 31, 54, 53, 1, 41,
35, 13, 60, 21, 61, 19, 2, 46, 15, 36, 33, 18, 37, 0, 32,
38, 29 },
{ 42, 48, 16, 38, 41, 57, 53, 3, 52, 14, 61, 33, 26, 19, 32, 58,
10, 1, 9, 24, 43, 8, 15, 5, 56, 2, 40, 36, 7, 0, 17, 20,
45, 37, 6, 13, 25, 34, 11, 27, 30, 12, 63, 31, 28, 47, 4,
51, 62, 22, 55, 44, 29, 35, 59, 23, 46, 50, 39, 60, 49, 18,
21, 54 },
{ 51, 44, 45, 12, 10, 19, 9, 57, 53, 0, 49, 8, 29, 7, 22, 36, 13,
58, 35, 15, 50, 23, 59, 52, 63, 4, 30, 43, 26, 33, 42, 1,
14, 24, 55, 38, 5, 32, 48, 28, 21, 31, 17, 46, 41, 47, 60,
25, 20, 11, 61, 3, 6, 16, 2, 40, 39, 18, 62, 37, 34, 27,
56, 54 },
{ 19, 61, 20, 15, 0, 59, 60, 12, 10, 16, 35, 36, 34, 5, 27, 8, 43,
3, 54, 7, 57, 58, 26, 56, 13, 1, 23, 50, 11, 6, 25, 22, 31,
44, 62, 53, 14, 33, 39, 48, 52, 2, 40, 41, 29, 17, 18, 4,
47, 28, 63, 24, 9, 32, 21, 46, 49, 30, 38, 37, 51, 45, 42,
55 },
{ 33, 24, 29, 28, 30, 51, 20, 25, 0, 57, 22, 34, 13, 44, 31, 17,
49, 16, 18, 50, 4, 48, 5, 38, 41, 12, 63, 26, 55, 37, 52,
60, 27, 9, 21, 19, 45, 39, 54, 15, 53, 7, 43, 46, 62, 11,
14, 36, 56, 1, 10, 23, 42, 61, 8, 35, 40, 59, 47, 32, 2,
58, 6, 3 }
};
public static char[][] Mw = new char[8][8];
public static void makeKeyData(char[] pkey, char[] pTable) {
char[] ucKey = new char[3];
int i = 0;
ucKey[0] = pTable[0];
ucKey[1] = pTable[1];
ucKey[2] = pTable[2];
for (i = 0; i < 3; i++)
pkey[i] = ucKey[i];
for (i = 0; i < 3; i++)
pkey[3 + i] = ucKey[i];
for (i = 0; i < 2; i++)
pkey[6 + i] = ucKey[i];
}
private static void desData(int k, char[] inData, char[] outData,
char[][] subkey) {
if (k == 0) {
for (int i = 0; i < 8; i++)
for (int j = 0; j < 8; j++)
inData[j] = (char) (inData[j] ^ subkey[i][j]);
for (int j = 0; j < 8; j++)
outData[j] = inData[j];
} else if (k == 1) {
for (int i = 7; i >= 0; i--)
for (int j = 0; j < 8; j++)
inData[j] = (char) (inData[j] ^ subkey[i][j]);
for (int j = 0; j < 8; j++)
outData[j] = inData[j];
}
}
private static void makeKey(char[] inKey, char[][] outKey) {
char newData[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
int i, j, k;
for (i = 0; i < outKey.length; i++) {
for (j = 0; j < outKey[0].length; j++) {
outKey[i][j] = 0;
}
}
for (i = 0; i < 8; i++) {
for (j = 0; j < 64; j++)
if ((inKey[BitPMC[i][j] >> 3] & (1 << (7 - (BitPMC[i][j] & 7)))) != 0)
newData[j >> 3] = (char) (newData[j >> 3] | (1 << (7 - (j & 7))));
for (k = 0; k < 8; k++)
outKey[i][k] = newData[k];
for (int n = 0; n < newData.length; n++) {
newData[n] = 0;
}
}
}
private static void initPermutation(char[] inData) {
char[] newData = { 0, 0, 0, 0, 0, 0, 0, 0 };
int i;
for (i = 0; i < 64; i++) {
if ((inData[BitIP[i] >> 3] & (1 << (7 - (BitIP[i] & 7)))) != 0)
newData[i >> 3] = (char) (newData[i >> 3] | (1 << (7 - (i & 7))));
}
for (i = 0; i < 8; i++)
inData[i] = newData[i];
}
public static byte EncryStr(char[] str, char[] key, char[] presult)// ���ܺ���8���ֽ�
{
char[][] subkey = new char[8][8];
makeKey(key, subkey);
initPermutation(str);
desData(0, str, presult, subkey);
return 1;
}
private static void conversePermutation(char[] inData) {
char[] newData = { 0, 0, 0, 0, 0, 0, 0, 0 };
int i;
for (i = 0; i < 64; i++) {
if ((inData[BitCP[i] >> 3] & (1 << (7 - (BitCP[i] & 7)))) != 0)
newData[i >> 3] = (char) (newData[i >> 3] | (1 << (7 - (i & 7))));
}
for (i = 0; i < 8; i++)
inData[i] = newData[i];
}
public static char DecryStr(char[] str, char[] key, char[] presult)// ���ܺ���8���ֽ�
{
char[][] subkey = new char[8][8];
makeKey(key, subkey);
desData(1, str, presult, subkey);
conversePermutation(presult);
return 1;
}
public static void Encryptionr(char[] SourceData, char[] key,
char[] PurposeData) {
int i, j;
char[][] uckey64 = new char[8][8];
for (i = 0; i < 8; i++) {
uckey64[0][i] = key[i];
}
for (i = 0; i < 8; i++) {
uckey64[1][i] = key[7 - i];
}
for (i = 0; i < 7; i++) {
uckey64[2][i] = key[i + 1];
}
uckey64[2][7] = key[0];
for (i = 0; i < 6; i++) {
uckey64[3][i] = key[i + 2];
}
for (i = 0; i < 2; i++) {
uckey64[3][6 + i] = key[i];
}
for (i = 0; i < 5; i++) {
uckey64[4][i] = key[i + 3];
}
for (i = 0; i < 3; i++) {
uckey64[4][5 + i] = key[i];
}
for (i = 0; i < 4; i++) {
uckey64[5][i] = key[i + 4];
}
for (i = 0; i < 4; i++) {
uckey64[5][4 + i] = key[i];
}
for (i = 0; i < 3; i++) {
uckey64[6][i] = key[i + 5];
}
for (i = 0; i < 5; i++) {
uckey64[6][3 + i] = key[i];
}
for (i = 0; i < 2; i++) {
uckey64[7][i] = key[i + 6];
}
for (i = 0; i < 6; i++) {
uckey64[7][2 + i] = key[i];
}
for (j = 0; j < 8; j++) {
for (i = 0; i < 8; i++)
Mw[j][i] = SourceData[j * 8 + i];
}
for (j = 0; j < 8; j++)
EncryStr(Mw[j], uckey64[j], Mw[j]);
for (j = 0; j < 8; j++) {
for (i = 0; i < 8; i++)
PurposeData[j * 8 + i] = Mw[j][i];
}
}
public static void Encryptionx(char[] SourceData, char[] key,
char[] PurposeData, char iIndex) {
int i, j;
for (j = 0; j < iIndex; j++) {
for (i = 0; i < 8; i++)
Mw[j][i] = SourceData[j * 8 + i];
}
for (j = 0; j < iIndex; j++)
EncryStr(Mw[j], key, Mw[j]);
for (j = 0; j < iIndex; j++) {
for (i = 0; i < 8; i++)
PurposeData[j * 8 + i] = Mw[j][i];
}
}
public static void Decryptionr(char[] SourceData, char[] key,
char[] PurposeData) {
int i, j;// ,iBlock1;
char[][] uckey64 = new char[8][8];
char[][] ucMw = new char[8][8];
for (i = 0; i < 8; i++) {
uckey64[0][i] = key[i];
}
for (i = 0; i < 8; i++) {
uckey64[1][i] = key[7 - i];
}
for (i = 0; i < 7; i++) {
uckey64[2][i] = key[i + 1];
}
uckey64[2][7] = key[0];
for (i = 0; i < 6; i++) {
uckey64[3][i] = key[i + 2];
}
for (i = 0; i < 2; i++) {
uckey64[3][6 + i] = key[i];
}
for (i = 0; i < 5; i++) {
uckey64[4][i] = key[i + 3];
}
for (i = 0; i < 3; i++) {
uckey64[4][5 + i] = key[i];
}
for (i = 0; i < 4; i++) {
uckey64[5][i] = key[i + 4];
}
for (i = 0; i < 4; i++) {
uckey64[5][4 + i] = key[i];
}
for (i = 0; i < 3; i++) {
uckey64[6][i] = key[i + 5];
}
for (i = 0; i < 5; i++) {
uckey64[6][3 + i] = key[i];
}
for (i = 0; i < 2; i++) {
uckey64[7][i] = key[i + 6];
}
for (i = 0; i < 6; i++) {
uckey64[7][2 + i] = key[i];
}
for (j = 0; j < 8; j++) {
for (i = 0; i < 8; i++)
ucMw[j][i] = SourceData[j * 8 + i];
}
for (j = 0; j < 8; j++)
DecryStr(ucMw[j], uckey64[j], ucMw[j]);
for (j = 0; j < 8; j++) {
for (i = 0; i < 8; i++)
PurposeData[j * 8 + i] = ucMw[j][i];
}
}
public static void Decryptionx(char[] SourceData, char[] key,
char[] PurposeData, char iIndex) {
int i, j;
char[][] ucMw = new char[8][8];
for (j = 0; j < iIndex; j++) {
for (i = 0; i < 8; i++)
ucMw[j][i] = SourceData[j * 8 + i];
}
for (j = 0; j < iIndex; j++)
DecryStr(ucMw[j], key, ucMw[j]);
for (j = 0; j < iIndex; j++) {
for (i = 0; i < 8; i++)
PurposeData[j * 8 + i] = ucMw[j][i];
}
}
} | [
"[email protected]"
]
| |
8a773d260dde2714b31347fc8300275981d7ea92 | 81dbe0b00b8a6f61fa562d848acbefdec3cf9387 | /app/src/main/java/com/tizzone/go4lunch/models/detail/Southwest.java | 4ea7f7af4e8b4a52e0205d2b28f82671ecbe2eda | []
| no_license | docteurmabuse/Go4Lunch | 938e47ea16f66e69c6f7474578f989e35d719e36 | babd46ca3cab64f57a86033a36e9910fd7412e8e | refs/heads/main | 2023-04-01T20:08:44.394055 | 2021-03-17T11:19:21 | 2021-03-17T11:19:21 | 303,948,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 541 | java | package com.tizzone.go4lunch.models.detail;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Southwest {
@SerializedName("lat")
@Expose
private Double lat;
@SerializedName("lng")
@Expose
private Double lng;
public Double getLat() {
return lat;
}
public void setLat(Double lat) {
this.lat = lat;
}
public Double getLng() {
return lng;
}
public void setLng(Double lng) {
this.lng = lng;
}
}
| [
"[email protected]"
]
| |
568e2cfd8053b34f59b1c5f1cfeafc4cf7a06134 | b744ca4d2a40c73e1f518a58c7c45d1e98ead7bb | /abstract-factory/src/main/java/io/github/bijeshos/designpatterns/abstractfactory/HomeFactory.java | 8dbd6cfe2ce75d874593a6169787e6c33d214fd5 | [
"MIT"
]
| permissive | AjZahir/java-design-patterns | 8e23b524135aaff33270444c9ddeec24a01b61b9 | 24eea85c6949656a5e2cfc7cfd65a672820936ac | refs/heads/master | 2022-04-08T11:52:19.738214 | 2020-02-22T11:59:07 | 2020-02-22T11:59:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 172 | java | package io.github.bijeshos.designpatterns.abstractfactory;
public interface HomeFactory {
Hall buildHall();
Bedroom buildBedroom();
Kitchen buildKitchen();
}
| [
"[email protected]"
]
| |
27e4788e86b607dffdb98f812af5d9a9be60223f | 9b4ea69e5a0cd263bbe2cd0cfdce85be4c8e438e | /fly-rest/src/br/com/softctrl/net/util/Constants.java | 4d9fb1ad8d87926022eb983753d531ae732aa594 | [
"MIT"
]
| permissive | softctrl/fly-rest | 95505e9ad1ea1cf7a4a4505572dccdf3d7ea0894 | 84dbe65ccc27ec3fecd7cdec5b1080757c0dd00b | refs/heads/master | 2021-01-24T22:27:19.512916 | 2018-02-23T17:40:30 | 2018-02-23T17:40:30 | 39,248,805 | 2 | 1 | MIT | 2018-01-23T18:19:05 | 2015-07-17T10:26:13 | Java | UTF-8 | Java | false | false | 1,952 | java | package br.com.softctrl.net.util;
import java.nio.charset.Charset;
/*
The MIT License (MIT)
Copyright (c) 2015 Carlos Timoshenko Rodrigues Lopes
http://www.0x09.com.br
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.
*/
/**
* @author [email protected]
*/
public final class Constants {
public static final Charset UTF_8 = Charset.forName("UTF-8");
public static final int CONNECT_TIMEOUT = 5000; // 5 seconds
public static final int READ_TIMEOUT = CONNECT_TIMEOUT;
public static final String ACCEPT_ENCODING = "Accept-Encoding";
public static final String CONTENT_TYPE = "Content-Type";
public static final String APPLICATION_JSON = "application/json";
//
public static final String TLS = "TLS";
public static final String RSA = "RSA";
public static final String ECDHE_RSA = "ECDHE_RSA";
public static final String ECDHE_ECDSA = "ECDHE_ECDSA";
public static final String X_509 = "X509";
public static final String SHA1 = "SHA1";
}
| [
"[email protected]"
]
| |
7dc4a966889d6fc0140f70cf1a29b03e7eed5211 | 2d999691a65053795e32ace920da3dd5a9475c42 | /AdminDeleteWashPackage/src/main/java/com/AdminDeleteWashPackage/AdminDeleteWashPackageApplication.java | a22f3642f421bd3a64be89cd9722cc5a295006e8 | []
| no_license | pavankalyanimmadi/carWashCaseStudy | 583af9d082f8bd2429b386a1ea3be66022f032c9 | a0c72817f33dc2fe3895535bc4e6d6d7581294f7 | refs/heads/master | 2022-12-23T23:50:57.817212 | 2020-09-22T03:52:03 | 2020-09-22T03:52:03 | 296,305,585 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 351 | java | package com.AdminDeleteWashPackage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class AdminDeleteWashPackageApplication {
public static void main(String[] args) {
SpringApplication.run(AdminDeleteWashPackageApplication.class, args);
}
}
| [
"[email protected]"
]
| |
8191982253a20ea4b110af556033a609899f4806 | d34f74965413964f3f694c3725d662daf571b615 | /module_Gorge/src/androidTest/java/com/anubis/module_gorge/ExampleInstrumentedTest.java | 12fbbcafa68d973ee7b41a7f8b33f87956d1e9e8 | []
| no_license | Seachal/KT_SAK | 33d88c70dd9e57b9a5942982002e1c367cc24c0a | eb3a34e7465de3b12edf786818a2a1c4db3b401b | refs/heads/master | 2023-02-06T13:45:17.239891 | 2018-07-27T02:49:08 | 2018-07-27T02:49:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 735 | java | package com.anubis.module_gorge;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.anubis.module_gorge.test", appContext.getPackageName());
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.