blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
list | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
โ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
โ | gha_stargazers_count
int32 0
112k
โ | gha_forks_count
int32 0
39.4k
โ | gha_open_issues_count
int32 0
11k
โ | gha_language
stringlengths 1
21
โ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
list | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f4f501601cc526e435a608b961ea118f07559feb | 29,935,922,094,403 | e5a5163f0bc4ce4f8e8a412086f3d6b87f22cbf3 | /src/com/kakao/TokenManager.java | a3a4cbd0ce72b87b8b65469902f51228d50217ef | [] | no_license | KJH-Sun/kakao-2021blind | https://github.com/KJH-Sun/kakao-2021blind | 84cd7adf7f47297f3cdc899fec8c63234faf5b36 | 98008855cdb14c00b006d8de218f0835b7a5feb7 | refs/heads/main | 2023-08-11T20:12:06.371000 | 2021-09-21T16:12:39 | 2021-09-21T16:12:39 | 408,887,151 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kakao;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
public class TokenManager {
private static TokenManager instance = null;
private String token = "";
public static TokenManager getInstance() {
if (instance == null) {
instance = new TokenManager();
}
return instance;
}
public String getToken() {
return this.token;
}
public synchronized String createToken(int problemId) {
String response = HttpUtil.getInstance().start(problemId);
switch (response) {
case "400":
System.out.println("400:: problem_id ์๋ชป๋จ");
break;
case "401":
System.out.println("401:: X-Auth-Token Header๊ฐ ์๋ชป๋จ");
break;
case "403":
System.out.println("403:: user_key๊ฐ ์๋ชป๋์๊ฑฐ๋ 10์ด ์ด๋ด์ ์์ฑํ ํ ํฐ์ด ์กด์ฌ");
token = loadTokenFile();
break;
case "500":
System.out.println("500:: ์๋ฒ ์๋ฌ, ๋ฌธ์ ํ์");
break;
default:
saveTokenFile(response/* token */);
token = response;
response = "200";
break;
}
return response;
}
private void saveTokenFile(String token) {
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(new File("./res/token")));
bw.write(token);
bw.flush();
bw.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private String loadTokenFile() {
String token = null;
try {
BufferedReader br = new BufferedReader(new FileReader(new File("./res/token")));
token = br.readLine();
br.close();
} catch (Exception e) {
e.printStackTrace();
}
return token;
}
}
| UTF-8 | Java | 2,075 | java | TokenManager.java | Java | [] | null | [] | package com.kakao;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
public class TokenManager {
private static TokenManager instance = null;
private String token = "";
public static TokenManager getInstance() {
if (instance == null) {
instance = new TokenManager();
}
return instance;
}
public String getToken() {
return this.token;
}
public synchronized String createToken(int problemId) {
String response = HttpUtil.getInstance().start(problemId);
switch (response) {
case "400":
System.out.println("400:: problem_id ์๋ชป๋จ");
break;
case "401":
System.out.println("401:: X-Auth-Token Header๊ฐ ์๋ชป๋จ");
break;
case "403":
System.out.println("403:: user_key๊ฐ ์๋ชป๋์๊ฑฐ๋ 10์ด ์ด๋ด์ ์์ฑํ ํ ํฐ์ด ์กด์ฌ");
token = loadTokenFile();
break;
case "500":
System.out.println("500:: ์๋ฒ ์๋ฌ, ๋ฌธ์ ํ์");
break;
default:
saveTokenFile(response/* token */);
token = response;
response = "200";
break;
}
return response;
}
private void saveTokenFile(String token) {
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(new File("./res/token")));
bw.write(token);
bw.flush();
bw.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private String loadTokenFile() {
String token = null;
try {
BufferedReader br = new BufferedReader(new FileReader(new File("./res/token")));
token = br.readLine();
br.close();
} catch (Exception e) {
e.printStackTrace();
}
return token;
}
}
| 2,075 | 0.520678 | 0.506228 | 73 | 26.493151 | 20.859034 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.520548 | false | false | 4 |
aaf6ffac2d1e06eb14a9e0db318ef194d3115828 | 8,607,114,477,827 | a39b96a5aa87ef82f98815f584eec26190937cfd | /actionlibrary/src/main/java/com/axway/ats/action/processes/RemoteProcessExecutor.java | 179b5dcb5bde0bbb61b051d21a2fd66c903f3e14 | [
"Apache-2.0"
] | permissive | Axway/ats-framework | https://github.com/Axway/ats-framework | 1dcb16cd69ffa171903ee637bb7aa9d4c7fd4006 | c3e97bc27a4a46c95253dbde1c1b303849066069 | refs/heads/master_wo_log4j2 | 2023-08-21T19:23:57.108000 | 2023-03-28T13:48:28 | 2023-03-28T13:48:28 | 83,046,783 | 37 | 61 | Apache-2.0 | false | 2023-04-14T17:16:16 | 2017-02-24T14:00:11 | 2022-09-29T10:33:24 | 2023-04-14T17:16:16 | 15,776 | 33 | 14 | 4 | Java | false | false | /*
* Copyright 2017 Axway Software
*
* 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.axway.ats.action.processes;
import com.axway.ats.agent.components.system.operations.clients.InternalProcessOperations;
import com.axway.ats.agent.core.action.CallerRelatedInfoRepository;
import com.axway.ats.agent.core.exceptions.AgentException;
import com.axway.ats.common.process.ProcessExecutorException;
import com.axway.ats.core.events.TestcaseStateEventsDispacher;
import com.axway.ats.core.process.model.IProcessExecutor;
import java.util.Map;
public class RemoteProcessExecutor implements IProcessExecutor {
private String atsAgent;
private String internalId;
private String standardOutputFile;
private String errorOutputFile;
private String workDirectory;
private boolean logStandardOutput;
private boolean logErrorOutput;
private InternalProcessOperations remoteProcessOperations;
public RemoteProcessExecutor( String atsAgent,
String command,
String... commandArguments ) {
this.atsAgent = atsAgent;
this.remoteProcessOperations = new InternalProcessOperations(atsAgent);
try {
this.internalId = this.remoteProcessOperations.initProcessExecutor(command, commandArguments);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public void execute() {
execute(true);
}
@Override
public void execute(
boolean waitForCompletion ) {
try {
this.remoteProcessOperations.startProcess(internalId,
workDirectory,
standardOutputFile,
errorOutputFile,
logStandardOutput,
logErrorOutput,
waitForCompletion);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public void kill() {
try {
this.remoteProcessOperations.killProcess(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public void killAll() {
try {
this.remoteProcessOperations.killProcessAndItsChildren(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public int getProcessId() {
try {
return this.remoteProcessOperations.getProcessId(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public int getExitCode() {
try {
return this.remoteProcessOperations.getProcessExitCode(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public String getStandardOutput() {
try {
return this.remoteProcessOperations.getProcessStandardOutput(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public String getErrorOutput() {
try {
return this.remoteProcessOperations.getProcessErrorOutput(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public void setStandardOutputFile(
String standardOutputFile ) {
this.standardOutputFile = standardOutputFile;
}
@Override
public void setErrorOutputFile(
String errorOutputFile ) {
this.errorOutputFile = errorOutputFile;
}
@Override
public void setLogStandardOutput(
boolean logStandardOutput ) {
this.logStandardOutput = logStandardOutput;
}
@Override
public void setLogErrorOutput(
boolean logErrorOutput ) {
this.logErrorOutput = logErrorOutput;
}
@Override
public void setWorkDirectory(
String workDirectory ) {
this.workDirectory = workDirectory;
}
@Override
public String setEnvVariable(String variableName, String variableValue ) {
try {
return this.remoteProcessOperations.setEnvVariable(internalId, variableName, variableValue);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override public String removeEnvVariable( String variableName ) {
try {
return this.remoteProcessOperations.removeEnvVariable(internalId, variableName);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public void appendToEnvVariable(
String variableName,
String variableValueToAppend ) {
try {
this.remoteProcessOperations.appendToEnvVariable(internalId, variableName, variableValueToAppend);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public String getEnvVariable(
String variableName ) {
try {
return this.remoteProcessOperations.getEnvVariable(internalId, variableName);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public Map<String, String> getEnvVariables() {
try {
return this.remoteProcessOperations.getEnvVariables(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public String getCurrentStandardOutput() {
try {
return this.remoteProcessOperations.getProcessCurrentStandardOutput(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public String getCurrentErrorOutput() {
try {
return this.remoteProcessOperations.getProcessCurrentErrorOutput(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public boolean isStandardOutputFullyRead() {
try {
return this.remoteProcessOperations.isStandardOutputFullyRead(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public boolean isErrorOutputFullyRead() {
try {
return this.remoteProcessOperations.isErrorOutputFullyRead(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
/**
* The Process Executor instance on a remote agent may keep lots of
* output data.
*
* Here, when this object is garbage collected, we ask the agent to
* discard its related Process Executor instance.
*
* Of course this does not guarantee the prevention of Out of memory errors on the agent,
* but it is still some form of unattended cleanup.
*/
@Override
protected void finalize() throws Throwable {
TestcaseStateEventsDispacher.getInstance()
.cleanupInternalObjectResources(atsAgent,
CallerRelatedInfoRepository.KEY_PROCESS_EXECUTOR
+ internalId);
super.finalize();
}
}
| UTF-8 | Java | 8,690 | java | RemoteProcessExecutor.java | Java | [
{
"context": "/*\n * Copyright 2017 Axway Software\n * \n * Licensed under the Apache License, Version",
"end": 35,
"score": 0.994117021560669,
"start": 21,
"tag": "NAME",
"value": "Axway Software"
}
] | null | [] | /*
* Copyright 2017 <NAME>
*
* 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.axway.ats.action.processes;
import com.axway.ats.agent.components.system.operations.clients.InternalProcessOperations;
import com.axway.ats.agent.core.action.CallerRelatedInfoRepository;
import com.axway.ats.agent.core.exceptions.AgentException;
import com.axway.ats.common.process.ProcessExecutorException;
import com.axway.ats.core.events.TestcaseStateEventsDispacher;
import com.axway.ats.core.process.model.IProcessExecutor;
import java.util.Map;
public class RemoteProcessExecutor implements IProcessExecutor {
private String atsAgent;
private String internalId;
private String standardOutputFile;
private String errorOutputFile;
private String workDirectory;
private boolean logStandardOutput;
private boolean logErrorOutput;
private InternalProcessOperations remoteProcessOperations;
public RemoteProcessExecutor( String atsAgent,
String command,
String... commandArguments ) {
this.atsAgent = atsAgent;
this.remoteProcessOperations = new InternalProcessOperations(atsAgent);
try {
this.internalId = this.remoteProcessOperations.initProcessExecutor(command, commandArguments);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public void execute() {
execute(true);
}
@Override
public void execute(
boolean waitForCompletion ) {
try {
this.remoteProcessOperations.startProcess(internalId,
workDirectory,
standardOutputFile,
errorOutputFile,
logStandardOutput,
logErrorOutput,
waitForCompletion);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public void kill() {
try {
this.remoteProcessOperations.killProcess(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public void killAll() {
try {
this.remoteProcessOperations.killProcessAndItsChildren(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public int getProcessId() {
try {
return this.remoteProcessOperations.getProcessId(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public int getExitCode() {
try {
return this.remoteProcessOperations.getProcessExitCode(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public String getStandardOutput() {
try {
return this.remoteProcessOperations.getProcessStandardOutput(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public String getErrorOutput() {
try {
return this.remoteProcessOperations.getProcessErrorOutput(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public void setStandardOutputFile(
String standardOutputFile ) {
this.standardOutputFile = standardOutputFile;
}
@Override
public void setErrorOutputFile(
String errorOutputFile ) {
this.errorOutputFile = errorOutputFile;
}
@Override
public void setLogStandardOutput(
boolean logStandardOutput ) {
this.logStandardOutput = logStandardOutput;
}
@Override
public void setLogErrorOutput(
boolean logErrorOutput ) {
this.logErrorOutput = logErrorOutput;
}
@Override
public void setWorkDirectory(
String workDirectory ) {
this.workDirectory = workDirectory;
}
@Override
public String setEnvVariable(String variableName, String variableValue ) {
try {
return this.remoteProcessOperations.setEnvVariable(internalId, variableName, variableValue);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override public String removeEnvVariable( String variableName ) {
try {
return this.remoteProcessOperations.removeEnvVariable(internalId, variableName);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public void appendToEnvVariable(
String variableName,
String variableValueToAppend ) {
try {
this.remoteProcessOperations.appendToEnvVariable(internalId, variableName, variableValueToAppend);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public String getEnvVariable(
String variableName ) {
try {
return this.remoteProcessOperations.getEnvVariable(internalId, variableName);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public Map<String, String> getEnvVariables() {
try {
return this.remoteProcessOperations.getEnvVariables(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public String getCurrentStandardOutput() {
try {
return this.remoteProcessOperations.getProcessCurrentStandardOutput(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public String getCurrentErrorOutput() {
try {
return this.remoteProcessOperations.getProcessCurrentErrorOutput(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public boolean isStandardOutputFullyRead() {
try {
return this.remoteProcessOperations.isStandardOutputFullyRead(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
@Override
public boolean isErrorOutputFullyRead() {
try {
return this.remoteProcessOperations.isErrorOutputFullyRead(internalId);
} catch (AgentException e) {
throw new ProcessExecutorException(e);
}
}
/**
* The Process Executor instance on a remote agent may keep lots of
* output data.
*
* Here, when this object is garbage collected, we ask the agent to
* discard its related Process Executor instance.
*
* Of course this does not guarantee the prevention of Out of memory errors on the agent,
* but it is still some form of unattended cleanup.
*/
@Override
protected void finalize() throws Throwable {
TestcaseStateEventsDispacher.getInstance()
.cleanupInternalObjectResources(atsAgent,
CallerRelatedInfoRepository.KEY_PROCESS_EXECUTOR
+ internalId);
super.finalize();
}
}
| 8,682 | 0.591139 | 0.590219 | 283 | 29.706715 | 28.536919 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.30742 | false | false | 4 |
4ceba3df72d7227ad4368f58f503afb575cb3338 | 11,072,425,726,084 | 030ccc64510effb78fb0a99f31c012abd8d4e665 | /app/src/main/java/com/github/marsor/mtaxi/account/view/IView.java | 980cf400b6ad1accb4a6336ffd0f7f0733365805 | [] | no_license | Marsor707/MTaxi | https://github.com/Marsor707/MTaxi | d80e025865c5319b8db986b53bf34cdf2c22e587 | 222a21e669666a72fba689ba7d06c301124b38ed | refs/heads/master | 2021-07-11T03:36:07.716000 | 2017-10-15T11:49:35 | 2017-10-15T11:49:35 | 106,838,870 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.github.marsor.mtaxi.account.view;
/**
* Author: Marsor
* Github: https://github.com/Marsor707
* Email: 369135912@qq.com
*/
public interface IView {
/**
* ๆพ็คบloading
*/
void showLoading();
/**
* ๆพ็คบ้่ฏฏ
*/
void showError(int Code, String msg);
}
| UTF-8 | Java | 309 | java | IView.java | Java | [
{
"context": ".github.marsor.mtaxi.account.view;\n\n/**\n * Author: Marsor\n * Github: https://github.com/Marsor707\n * Email:",
"end": 68,
"score": 0.9987338185310364,
"start": 62,
"tag": "USERNAME",
"value": "Marsor"
},
{
"context": "*\n * Author: Marsor\n * Github: https://github.com/Marsor707\n * Email: 369135912@qq.com\n */\n\npublic interface ",
"end": 108,
"score": 0.999637246131897,
"start": 99,
"tag": "USERNAME",
"value": "Marsor707"
},
{
"context": " * Github: https://github.com/Marsor707\n * Email: 369135912@qq.com\n */\n\npublic interface IView {\n\n /**\n * ๆพ็คบl",
"end": 135,
"score": 0.9998059868812561,
"start": 119,
"tag": "EMAIL",
"value": "369135912@qq.com"
}
] | null | [] | package com.github.marsor.mtaxi.account.view;
/**
* Author: Marsor
* Github: https://github.com/Marsor707
* Email: <EMAIL>
*/
public interface IView {
/**
* ๆพ็คบloading
*/
void showLoading();
/**
* ๆพ็คบ้่ฏฏ
*/
void showError(int Code, String msg);
}
| 300 | 0.589226 | 0.548822 | 20 | 13.85 | 14.234729 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 4 |
6595287cae255eea143b89701e47583407e5900e | 32,865,089,816,488 | 475be5a57e55920f9b6502084ff178d42599280e | /Assignments/day3/StudentMain.java | 22ff5952e1ef34c90b24d387cbbe5e6f57095014 | [] | no_license | shubham-8496/Java_Assignments | https://github.com/shubham-8496/Java_Assignments | 3ea9f9d7786219d9a13071d7c87da1e184eac74e | bae7ccd452d39ac32c9c7c509ceeda9064949324 | refs/heads/main | 2022-12-25T03:20:14.234000 | 2020-10-06T17:38:02 | 2020-10-06T17:38:02 | 301,432,937 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
Create a class Student with 2 data members rno and name.
Create one method setData() that takes roll number and student name as parameter and stores them in data members rno and name.
Create one more method showData() to print the data member values.
Create another class ( main class) StudentDemo that creates Student class object and calls setData() and showData() methods.
*/
import java.util.Scanner;
class Student{
private int sRollNo;
private String sName;
void setData(int roll, String name){
sRollNo = roll;
sName = name;
}
void showData(){
System.out.println("Roll no: "+sRollNo+" Name: "+sName);
}
}
class StudentMain{
public static void main (String args[]){
Scanner sc = new Scanner(System.in);
System.out.print("Enter Student's name: ");
String sName = sc.nextLine();
System.out.print("Enter roll number: ");
int rollNo = sc.nextInt();
Student s =new Student();
s.setData(rollNo,sName);
s.showData();
}
} | UTF-8 | Java | 963 | java | StudentMain.java | Java | [] | null | [] | /*
Create a class Student with 2 data members rno and name.
Create one method setData() that takes roll number and student name as parameter and stores them in data members rno and name.
Create one more method showData() to print the data member values.
Create another class ( main class) StudentDemo that creates Student class object and calls setData() and showData() methods.
*/
import java.util.Scanner;
class Student{
private int sRollNo;
private String sName;
void setData(int roll, String name){
sRollNo = roll;
sName = name;
}
void showData(){
System.out.println("Roll no: "+sRollNo+" Name: "+sName);
}
}
class StudentMain{
public static void main (String args[]){
Scanner sc = new Scanner(System.in);
System.out.print("Enter Student's name: ");
String sName = sc.nextLine();
System.out.print("Enter roll number: ");
int rollNo = sc.nextInt();
Student s =new Student();
s.setData(rollNo,sName);
s.showData();
}
} | 963 | 0.71028 | 0.709242 | 41 | 22.512196 | 29.585033 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.170732 | false | false | 4 |
a65d614348c83702a74b13ee6319481a10eefd5c | 9,199,819,969,457 | e14e32b13dcd0e1ee8293ecb26c4e3f5346fb552 | /src/Ejercicio_3/Semana.java | c8aea80716a7617511b72aedc47cd4a943c0baad | [] | no_license | DiegoRamirezV/Taller-Relaciones | https://github.com/DiegoRamirezV/Taller-Relaciones | 1432e7c541d4f0caea63a28599b09e103afc73ad | af7d1038fdb6d793b0b2543bbc4c3fd4ac26b938 | refs/heads/master | 2021-01-19T11:26:33.151000 | 2017-04-21T19:03:33 | 2017-04-21T19:03:33 | 87,968,462 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Ejercicio_3;
import java.util.ArrayList;
/**
*
* @author Diego
*/
public class Semana {
private int numero;
private Dia[] diasHabiles = new Dia[5];
private ArrayList<Sala> salas = new ArrayList<Sala>();
public Semana(int numero) {
this.numero = numero;
}
public int getNumero() {
return numero;
}
public void setNumero(int numero) {
this.numero = numero;
}
public Dia[] getDiasHabiles() {
return diasHabiles;
}
public void addDiaHabil(int i,Dia diaHabil) {
this.diasHabiles[i]=diaHabil;
}
public ArrayList<Sala> getSalas() {
return salas;
}
public void addSala(Sala sala) {
this.salas.add(sala);
}
public ArrayList<Segmento> getDiasLibres(int dia) {
return this.diasHabiles[dia].getSegmentos();
}
}
| UTF-8 | Java | 1,111 | java | Semana.java | Java | [
{
"context": "import java.util.ArrayList;\r\n\r\n/**\r\n *\r\n * @author Diego\r\n */\r\npublic class Semana {\r\n private int numero",
"end": 270,
"score": 0.9944979548454285,
"start": 265,
"tag": "NAME",
"value": "Diego"
}
] | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Ejercicio_3;
import java.util.ArrayList;
/**
*
* @author Diego
*/
public class Semana {
private int numero;
private Dia[] diasHabiles = new Dia[5];
private ArrayList<Sala> salas = new ArrayList<Sala>();
public Semana(int numero) {
this.numero = numero;
}
public int getNumero() {
return numero;
}
public void setNumero(int numero) {
this.numero = numero;
}
public Dia[] getDiasHabiles() {
return diasHabiles;
}
public void addDiaHabil(int i,Dia diaHabil) {
this.diasHabiles[i]=diaHabil;
}
public ArrayList<Sala> getSalas() {
return salas;
}
public void addSala(Sala sala) {
this.salas.add(sala);
}
public ArrayList<Segmento> getDiasLibres(int dia) {
return this.diasHabiles[dia].getSegmentos();
}
}
| 1,111 | 0.592259 | 0.590459 | 52 | 19.365385 | 19.780554 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.326923 | false | false | 4 |
722a0a403546c15042f48aeb4b45f614018a8c1a | 36,412,732,771,499 | 8dc49f037b885dae5f198d625129c96edce2bc1e | /study/bill/org/jdesktop/swingx/plaf/HyperlinkAddon.java | 8a0ff3be74fdb319461eef93bf520a02121414a8 | [] | no_license | Dlyyy/javaproject | https://github.com/Dlyyy/javaproject | 65460e0d281f017a346776f3f4b6efff6b284642 | 0d37584bf1b3fb4302afbe9571850a7c7f70a11a | refs/heads/master | 2020-04-10T21:33:09.102000 | 2019-01-26T01:33:20 | 2019-01-26T01:33:20 | 161,299,205 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /* */ package org.jdesktop.swingx.plaf;
/* */
/* */ import javax.swing.plaf.ColorUIResource;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class HyperlinkAddon
/* */ extends AbstractComponentAddon
/* */ {
/* */ public HyperlinkAddon()
/* */ {
/* 33 */ super("JXHyperlink");
/* */ }
/* */
/* */ protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults)
/* */ {
/* 38 */ super.addBasicDefaults(addon, defaults);
/* */
/* 40 */ defaults.add("HyperlinkUI", "org.jdesktop.swingx.plaf.basic.BasicHyperlinkUI");
/* */
/* 42 */ defaults.add("Hyperlink.linkColor", new ColorUIResource(0, 51, 255));
/* 43 */ defaults.add("Hyperlink.visitedColor", new ColorUIResource(153, 0, 153));
/* 44 */ defaults.add("Hyperlink.hoverColor", new ColorUIResource(255, 51, 0));
/* 45 */ defaults.add("Hyperlink.activeColor", new ColorUIResource(255, 51, 0));
/* */ }
/* */ }
/* Location: E:\java\javaๅญฆไน \hutubill\lib\all.jar!\org\jdesktop\swingx\plaf\HyperlinkAddon.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | UTF-8 | Java | 1,368 | java | HyperlinkAddon.java | Java | [] | null | [] | /* */ package org.jdesktop.swingx.plaf;
/* */
/* */ import javax.swing.plaf.ColorUIResource;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class HyperlinkAddon
/* */ extends AbstractComponentAddon
/* */ {
/* */ public HyperlinkAddon()
/* */ {
/* 33 */ super("JXHyperlink");
/* */ }
/* */
/* */ protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults)
/* */ {
/* 38 */ super.addBasicDefaults(addon, defaults);
/* */
/* 40 */ defaults.add("HyperlinkUI", "org.jdesktop.swingx.plaf.basic.BasicHyperlinkUI");
/* */
/* 42 */ defaults.add("Hyperlink.linkColor", new ColorUIResource(0, 51, 255));
/* 43 */ defaults.add("Hyperlink.visitedColor", new ColorUIResource(153, 0, 153));
/* 44 */ defaults.add("Hyperlink.hoverColor", new ColorUIResource(255, 51, 0));
/* 45 */ defaults.add("Hyperlink.activeColor", new ColorUIResource(255, 51, 0));
/* */ }
/* */ }
/* Location: E:\java\javaๅญฆไน \hutubill\lib\all.jar!\org\jdesktop\swingx\plaf\HyperlinkAddon.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | 1,368 | 0.491202 | 0.457478 | 53 | 24.754717 | 27.97027 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45283 | false | false | 4 |
6387e1cdc94584e37ffcda4b9487dfc3c54f9b93 | 34,574,486,775,047 | 4f7582d95979ea4115f1389b4302913247abadc8 | /ia4_project/src/fr/utc/ia04/behaviour/ProximityBehaviour.java | 8cf4401ca5e19257b3d98fa9426ae1ad08378dfb | [] | no_license | qkeunebr/ia04 | https://github.com/qkeunebr/ia04 | b28ef7ab95089613bb14b8bf6ef119ad1d375750 | 4a2ab16a63c9a2952317c7c03f40e681cce7d6e8 | refs/heads/master | 2020-04-06T04:35:54.761000 | 2013-06-17T13:31:39 | 2013-06-17T13:31:39 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fr.utc.ia04.behaviour;
import fr.utc.ia04.agent.Agent;
import fr.utc.ia04.agent.Human;
public abstract class ProximityBehaviour extends Behaviour {
Agent other;
double minDist;
public ProximityBehaviour(Human h, String id, Agent o, double minDist) {
super(h, id);
this.minDist = minDist;
this.other = o;
}
public boolean preCond() {
return h.distance(other) <= minDist;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
ProximityBehaviour beh = (ProximityBehaviour) obj;
return this.other == beh.other;
}
}
| UTF-8 | Java | 625 | java | ProximityBehaviour.java | Java | [] | null | [] | package fr.utc.ia04.behaviour;
import fr.utc.ia04.agent.Agent;
import fr.utc.ia04.agent.Human;
public abstract class ProximityBehaviour extends Behaviour {
Agent other;
double minDist;
public ProximityBehaviour(Human h, String id, Agent o, double minDist) {
super(h, id);
this.minDist = minDist;
this.other = o;
}
public boolean preCond() {
return h.distance(other) <= minDist;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
ProximityBehaviour beh = (ProximityBehaviour) obj;
return this.other == beh.other;
}
}
| 625 | 0.7008 | 0.6912 | 32 | 18.53125 | 18.656406 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.65625 | false | false | 4 |
00a770850dd0a32e30f5d00efaf3e65ad761f759 | 36,490,042,173,188 | 4d16aca35b10908dfb59aabcee30fac5a7628466 | /src/command/Product.java | 5a92e750e86892b1e60098543833506661c85018 | [
"MIT"
] | permissive | hyakkali/SLogo | https://github.com/hyakkali/SLogo | c87f99114a509c24493c892cf8a1a4dc28306f36 | 339b38169b0bf49aadbf39dc6cdc223f0b7bcef2 | refs/heads/master | 2021-04-05T23:54:45.063000 | 2018-03-10T08:14:53 | 2018-03-10T08:14:53 | 124,737,246 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package command;
import controller.Controller;
/**
* Returns the product of two numbers
* @author dylanpowers
*
*/
public class Product implements Command {
private double expr1;
private double expr2;
/**
* Initializes values of expr1 and expr2
*/
public Product(double expr1, double expr2) {
this.expr1 = expr1;
this.expr2 = expr2;
}
/**
* Returns the product of expr1 and expr2
* @return expr1 * expr2
*/
@Override
public double execute(Controller controller) {
return expr1 * expr2;
}
}
| UTF-8 | Java | 525 | java | Product.java | Java | [
{
"context": "*\n * Returns the product of two numbers\n * @author dylanpowers\n *\n */\npublic class Product implements Command {\n",
"end": 112,
"score": 0.9995979070663452,
"start": 101,
"tag": "USERNAME",
"value": "dylanpowers"
}
] | null | [] | package command;
import controller.Controller;
/**
* Returns the product of two numbers
* @author dylanpowers
*
*/
public class Product implements Command {
private double expr1;
private double expr2;
/**
* Initializes values of expr1 and expr2
*/
public Product(double expr1, double expr2) {
this.expr1 = expr1;
this.expr2 = expr2;
}
/**
* Returns the product of expr1 and expr2
* @return expr1 * expr2
*/
@Override
public double execute(Controller controller) {
return expr1 * expr2;
}
}
| 525 | 0.691429 | 0.660952 | 30 | 16.5 | 15.645554 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 4 |
c22cdbf37c526ad355a4f6a5eb1d2c627efd43ee | 37,778,532,360,837 | 9c1b68058272537dd4eec3df40982a7e06c1826d | /CharStack.java | 01d61dc9329fc213f92df070492c4311fc84a1a0 | [] | no_license | jpbatz/Module2_Stacks | https://github.com/jpbatz/Module2_Stacks | 5f16bb70ece149096b7f736c33f2701852b34eee | 34ca6ffa0368dbc034133af723a6f47268420900 | refs/heads/master | 2020-04-26T17:38:05.194000 | 2019-03-10T20:32:36 | 2019-03-10T20:32:36 | 173,719,762 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package Module2_Stacks;
/**
* @author jph
*
*/
public class CharStack {
private char [] charStack;
private int tos;
public CharStack() {
this.charStack = new char[10];
tos = -1;
}
public boolean isEmpty() {
return (this.tos <= -1);
}
public void push(char item) {
System.out.println("push(" + item + ")");
if (this.tos < this.charStack.length - 1) {
this.charStack[++this.tos] = item;
} else {
System.out.println("Stack Full");
}
}
public char pop() {
if (this.tos > -1) {
char item = this.charStack[this.tos];
System.out.println("pop => " + item);
this.charStack[this.tos] = 'x';
this.tos--;
return item;
} else {
System.out.println("Stack is Empty");
return 'x';
}
}
public int size() {
int stackSize = this.tos+1;
System.out.println("Size = " + stackSize);
return stackSize;
}
public void displayCharStack() {
for (int i = 0; i<10; i++) {
System.out.print(this.charStack[i] + " ");
}
System.out.println();
}
public void fillCharStack() {
for (int i=0; i<10; i++) {
this.charStack[i] = 'o';
}
}
/**
* @param args
*/
// public static void main(String[] args) {
//
// CharStack testCharStack = new CharStack();
//
//
// System.out.println("Empty: " + testCharStack.isEmpty());
//
// testCharStack.displayCharStack();
// testCharStack.size();
//
// System.out.println(testCharStack.pop());
// testCharStack.push('0');
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.push('9');
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.push('8');
// testCharStack.push('7');
// testCharStack.push('6');
// testCharStack.push('5');
// testCharStack.push('4');
// testCharStack.push('3');
// testCharStack.push('2');
// testCharStack.push('1');
// testCharStack.push('0');
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// System.out.println(testCharStack.isEmpty());
// }
}
| UTF-8 | Java | 3,039 | java | CharStack.java | Java | [
{
"context": "**\n * \n */\npackage Module2_Stacks;\n\n/**\n * @author jph\n *\n */\npublic class CharStack {\n\n\tprivate char []",
"end": 55,
"score": 0.9995499849319458,
"start": 52,
"tag": "USERNAME",
"value": "jph"
}
] | null | [] | /**
*
*/
package Module2_Stacks;
/**
* @author jph
*
*/
public class CharStack {
private char [] charStack;
private int tos;
public CharStack() {
this.charStack = new char[10];
tos = -1;
}
public boolean isEmpty() {
return (this.tos <= -1);
}
public void push(char item) {
System.out.println("push(" + item + ")");
if (this.tos < this.charStack.length - 1) {
this.charStack[++this.tos] = item;
} else {
System.out.println("Stack Full");
}
}
public char pop() {
if (this.tos > -1) {
char item = this.charStack[this.tos];
System.out.println("pop => " + item);
this.charStack[this.tos] = 'x';
this.tos--;
return item;
} else {
System.out.println("Stack is Empty");
return 'x';
}
}
public int size() {
int stackSize = this.tos+1;
System.out.println("Size = " + stackSize);
return stackSize;
}
public void displayCharStack() {
for (int i = 0; i<10; i++) {
System.out.print(this.charStack[i] + " ");
}
System.out.println();
}
public void fillCharStack() {
for (int i=0; i<10; i++) {
this.charStack[i] = 'o';
}
}
/**
* @param args
*/
// public static void main(String[] args) {
//
// CharStack testCharStack = new CharStack();
//
//
// System.out.println("Empty: " + testCharStack.isEmpty());
//
// testCharStack.displayCharStack();
// testCharStack.size();
//
// System.out.println(testCharStack.pop());
// testCharStack.push('0');
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.push('9');
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.push('8');
// testCharStack.push('7');
// testCharStack.push('6');
// testCharStack.push('5');
// testCharStack.push('4');
// testCharStack.push('3');
// testCharStack.push('2');
// testCharStack.push('1');
// testCharStack.push('0');
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// testCharStack.pop();
// testCharStack.displayCharStack();
// testCharStack.size();
//
// System.out.println(testCharStack.isEmpty());
// }
}
| 3,039 | 0.622244 | 0.614018 | 146 | 19.815069 | 14.554105 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.226027 | false | false | 4 |
ea652c8ecfba96f5f5e68706cf8633f0c350dbac | 38,680,475,492,578 | ef5486bc07dd322f763e3c1b8b4519ccf295a5ab | /Students/app/src/main/java/ru/innopolis/view/EditLessonActivity.java | 600d6ae07a968d040d8f52639ebd2b7bffc23f35 | [] | no_license | ibrohimkhan/stc_projects | https://github.com/ibrohimkhan/stc_projects | f404580b35c96183f248556e944d303391b086cb | 5d0520ab0f001930b12e8825bd74e479638f1489 | refs/heads/master | 2021-01-21T15:12:40.199000 | 2017-07-14T05:58:54 | 2017-07-14T05:58:54 | 95,377,313 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.innopolis.view;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.TimePicker;
import java.util.ArrayList;
import java.util.Date;
import ru.innopolis.manager.GroupManager;
import ru.innopolis.manager.LessonManager;
import ru.innopolis.model.Group;
import ru.innopolis.model.Lesson;
import ru.innopolis.utils.DateUtils;
import ru.innopolis.view.component.BaseActivity;
public class EditLessonActivity extends BaseActivity {
public static final String LESSON = "lesson";
private TextView dateTxv;
private Button setDateBtn;
private TextView timeTxv;
private Button setTimeBtn;
private EditText subjectEtx;
private EditText descriptionEtx;
private Button submitBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_lesson);
final Lesson lesson = getIntent().getParcelableExtra(LESSON);
dateTxv = (TextView) findViewById(R.id.dateTxv);
setDateBtn = (Button) findViewById(R.id.setDateBtn);
timeTxv = (TextView) findViewById(R.id.timeTxv);
setTimeBtn = (Button) findViewById(R.id.setTimeBtn);
subjectEtx = (EditText) findViewById(R.id.subjectEtx);
descriptionEtx = (EditText) findViewById(R.id.descriptionEtx);
submitBtn = (Button) findViewById(R.id.submitBtn);
dateTxv.setText(parseDate(lesson.getDate()));
timeTxv.setText(parseTime(lesson.getDate()));
subjectEtx.setText(lesson.getSubject());
if (lesson.getDescription() != null) descriptionEtx.setText(lesson.getDescription());
final Date date = lesson.getDate();
final Date newDate = new Date();
setDateBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DatePickerDialog.OnDateSetListener dateSetListener = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int i, int i1, int i2) {
newDate.setYear(i);
newDate.setMonth(i1);
newDate.setDate(i2);
dateTxv.setText(DateUtils.formatDate(newDate));
}
};
DatePickerDialog datePicker = new DatePickerDialog(EditLessonActivity.this, dateSetListener, date.getYear(), date.getMonth(), date.getDay());
datePicker.show();
}
});
setTimeBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TimePickerDialog.OnTimeSetListener timeSetListener = new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker timePicker, int i, int i1) {
newDate.setHours(i);
newDate.setMinutes(i1);
timeTxv.setText(DateUtils.formatTime(newDate));
}
};
TimePickerDialog timePicker = new TimePickerDialog(EditLessonActivity.this, timeSetListener, date.getHours(), date.getMinutes(), false);
timePicker.show();
}
});
submitBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(EditLessonActivity.this);
builder.setMessage("All your changes will be saved!");
builder.setTitle("Edit Lesson");
ArrayList<Group> groups = (ArrayList<Group>) GroupManager.getAllGroups();
final Intent intent = new Intent(EditLessonActivity.this, ListofLessonsActivity.class);
intent.putParcelableArrayListExtra(ListofLessonsActivity.ALL_GROUPS, groups);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
lesson.setDate(newDate);
lesson.setSubject(subjectEtx.getText().toString());
lesson.setDescription(descriptionEtx.getText().toString());
LessonManager.updateLesson(lesson);
startActivity(intent);
dialogInterface.dismiss();
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
startActivity(intent);
dialogInterface.cancel();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
});
}
private String parseTime(Date date) {
String formated = DateUtils.formatDateToString(date).split(" ")[1];
return formated;
}
private String parseDate(Date date) {
String formated = DateUtils.formatDateToString(date).split(" ")[0];
return formated;
}
}
| UTF-8 | Java | 5,705 | java | EditLessonActivity.java | Java | [] | null | [] | package ru.innopolis.view;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.TimePicker;
import java.util.ArrayList;
import java.util.Date;
import ru.innopolis.manager.GroupManager;
import ru.innopolis.manager.LessonManager;
import ru.innopolis.model.Group;
import ru.innopolis.model.Lesson;
import ru.innopolis.utils.DateUtils;
import ru.innopolis.view.component.BaseActivity;
public class EditLessonActivity extends BaseActivity {
public static final String LESSON = "lesson";
private TextView dateTxv;
private Button setDateBtn;
private TextView timeTxv;
private Button setTimeBtn;
private EditText subjectEtx;
private EditText descriptionEtx;
private Button submitBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_lesson);
final Lesson lesson = getIntent().getParcelableExtra(LESSON);
dateTxv = (TextView) findViewById(R.id.dateTxv);
setDateBtn = (Button) findViewById(R.id.setDateBtn);
timeTxv = (TextView) findViewById(R.id.timeTxv);
setTimeBtn = (Button) findViewById(R.id.setTimeBtn);
subjectEtx = (EditText) findViewById(R.id.subjectEtx);
descriptionEtx = (EditText) findViewById(R.id.descriptionEtx);
submitBtn = (Button) findViewById(R.id.submitBtn);
dateTxv.setText(parseDate(lesson.getDate()));
timeTxv.setText(parseTime(lesson.getDate()));
subjectEtx.setText(lesson.getSubject());
if (lesson.getDescription() != null) descriptionEtx.setText(lesson.getDescription());
final Date date = lesson.getDate();
final Date newDate = new Date();
setDateBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DatePickerDialog.OnDateSetListener dateSetListener = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int i, int i1, int i2) {
newDate.setYear(i);
newDate.setMonth(i1);
newDate.setDate(i2);
dateTxv.setText(DateUtils.formatDate(newDate));
}
};
DatePickerDialog datePicker = new DatePickerDialog(EditLessonActivity.this, dateSetListener, date.getYear(), date.getMonth(), date.getDay());
datePicker.show();
}
});
setTimeBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TimePickerDialog.OnTimeSetListener timeSetListener = new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker timePicker, int i, int i1) {
newDate.setHours(i);
newDate.setMinutes(i1);
timeTxv.setText(DateUtils.formatTime(newDate));
}
};
TimePickerDialog timePicker = new TimePickerDialog(EditLessonActivity.this, timeSetListener, date.getHours(), date.getMinutes(), false);
timePicker.show();
}
});
submitBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(EditLessonActivity.this);
builder.setMessage("All your changes will be saved!");
builder.setTitle("Edit Lesson");
ArrayList<Group> groups = (ArrayList<Group>) GroupManager.getAllGroups();
final Intent intent = new Intent(EditLessonActivity.this, ListofLessonsActivity.class);
intent.putParcelableArrayListExtra(ListofLessonsActivity.ALL_GROUPS, groups);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
lesson.setDate(newDate);
lesson.setSubject(subjectEtx.getText().toString());
lesson.setDescription(descriptionEtx.getText().toString());
LessonManager.updateLesson(lesson);
startActivity(intent);
dialogInterface.dismiss();
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
startActivity(intent);
dialogInterface.cancel();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
});
}
private String parseTime(Date date) {
String formated = DateUtils.formatDateToString(date).split(" ")[1];
return formated;
}
private String parseDate(Date date) {
String formated = DateUtils.formatDateToString(date).split(" ")[0];
return formated;
}
}
| 5,705 | 0.617353 | 0.615951 | 149 | 37.288589 | 30.933636 | 157 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.691275 | false | false | 4 |
de8f1d0e451879288150de74ec431b779e257618 | 34,411,278,032,363 | 54d47b517d239c8efc0787cd5e2358d66200cb4c | /src/main/java/com/java/iterator/predicate/PredicateImpl.java | b02e5426debd759c3aa5daac3892b2add8216a80 | [] | no_license | malalanayake/Java-iterator | https://github.com/malalanayake/Java-iterator | 27f8cf564d8ee61ba32d2cc594f13d22a86ae43a | f391bd86635ba66a50e3eaef7692c5ed173f5ca2 | refs/heads/master | 2020-04-05T22:49:43.787000 | 2014-11-04T04:46:42 | 2014-11-04T04:46:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.java.iterator.predicate;
import com.java.iterator.collection.Predicate;
/**
*
* @author malalanayake
*/
public class PredicateImpl implements Predicate<Integer> {
@Override
public boolean isValid(Integer element) {
if (element > 2) {
return true;
}
return false;
}
}
| UTF-8 | Java | 334 | java | PredicateImpl.java | Java | [
{
"context": ".iterator.collection.Predicate;\n\n/**\n *\n * @author malalanayake\n */\npublic class PredicateImpl implements Predica",
"end": 116,
"score": 0.9974468946456909,
"start": 104,
"tag": "USERNAME",
"value": "malalanayake"
}
] | null | [] | package com.java.iterator.predicate;
import com.java.iterator.collection.Predicate;
/**
*
* @author malalanayake
*/
public class PredicateImpl implements Predicate<Integer> {
@Override
public boolean isValid(Integer element) {
if (element > 2) {
return true;
}
return false;
}
}
| 334 | 0.634731 | 0.631737 | 19 | 16.578947 | 17.915932 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.210526 | false | false | 4 |
2001c4005abe050a0fb56c6f7a8f1831b3cc2684 | 35,948,876,310,892 | 9d1963f3fb3c0cbdfc372b5084dad24c6d66c6bf | /src/main/java/ua/edu/ucu/tempseries/TemperatureSeriesAnalysis.java | 1b97670c8287dcc5204fa00e4df8593e7daf7fe7 | [] | no_license | kubatska/apps19kubatska-hw1 | https://github.com/kubatska/apps19kubatska-hw1 | f98fc5178420aca42235354b7a4e317b869786ae | 9c7b422ce3490c17374be40670e63c69e12d51d9 | refs/heads/master | 2020-08-17T00:49:28.758000 | 2019-10-18T10:13:49 | 2019-10-18T10:13:49 | 215,582,103 | 0 | 0 | null | false | 2020-10-13T16:48:09 | 2019-10-16T15:27:29 | 2019-10-18T10:14:03 | 2020-10-13T16:48:07 | 70 | 0 | 0 | 1 | Java | false | false | package ua.edu.ucu.tempseries;
import java.util.Arrays;
import java.util.InputMismatchException;
public class TemperatureSeriesAnalysis {
static final int MIN_TEMPERATURE = -273;
private double[] temperatures;
private int number;
private int capacity;
public TemperatureSeriesAnalysis() {
temperatures = new double[1];
capacity = 1;
number = 0;
}
public TemperatureSeriesAnalysis(double[] temperatureSeries) {
temperatures = Arrays.copyOf(temperatureSeries,
temperatureSeries.length);
number = temperatures.length;
capacity = number;
for (int i = 0; i < number; i++) {
if (temperatures[i] < MIN_TEMPERATURE) {
throw new InputMismatchException();
}
}
}
public void check() {
if (number == 0) {
throw new IllegalArgumentException();
}
}
public double average() {
check();
double sum = 0;
for (int i = 0; i < number; i++) {
sum += temperatures[i];
}
return sum/number;
}
public double deviation() {
check();
double expectedSum = 0;
double mean = average();
for (int i = 0; i < number; i++) {
expectedSum += (temperatures[i] - mean)*(temperatures[i] - mean);
}
return Math.sqrt(expectedSum/number);
}
public double min() {
check();
double minTemp = temperatures[0];
for (int i = 0; i < number; i++) {
minTemp = Math.min(minTemp, temperatures[i]);
}
return minTemp;
}
public double max() {
check();
double maxTemp = temperatures[0];
for (int i = 0; i < number; i++) {
maxTemp = Math.max(maxTemp, temperatures[i]);
}
return maxTemp;
}
public double findTempClosestToZero() {
return findTempClosestToValue(0.0);
}
public double findTempClosestToValue(double tempValue) {
check();
double closest = temperatures[0];
double curClosest = Math.abs(closest - tempValue);
for (int i = 1; i < number; i++) {
double current = Math.abs(temperatures[i] - tempValue);
if (current < curClosest) {
closest = temperatures[i];
curClosest = current;
}
}
return closest;
}
public double[] findTempsLessThen(double tempValue) {
check();
int size = 0;
for (int i = 0; i < number; i++) {
if (temperatures[i] < tempValue) {
size += 1;
}
}
double[] arrLess = new double[size];
int j = 0;
for (int i = 0; i < number; i++) {
if (temperatures[i] < tempValue) {
arrLess[j] = temperatures[i];
j += 1;
}
}
return arrLess;
}
public double[] findTempsGreaterThen(double tempValue) {
check();
int size = 0;
for (int i = 0; i < number; i++) {
if (temperatures[i] >= tempValue) {
size += 1;
}
}
double[] arrGreater = new double[size];
int j = 0;
for (int i = 0; i < number; i++) {
if (temperatures[i] >= tempValue) {
arrGreater[j] = temperatures[i];
j += 1;
}
}
return arrGreater;
}
public TempSummaryStatistics summaryStatistics() {
check();
return new TempSummaryStatistics(average(), deviation(), min(), max());
}
public int addTemps(double... temps) {
check();
if (temps.length >= 1) {
double[] arr = new double[number*2];
System.arraycopy(temperatures, 0, arr, 0, number);
capacity *= 2;
temperatures = arr;
}
for (int i = 0; i < temps.length; i++) {
if (temps[i] < MIN_TEMPERATURE) {
throw new InputMismatchException();
}
temperatures[number] = temps[i];
number += 1;
}
return number;
}
}
| UTF-8 | Java | 4,231 | java | TemperatureSeriesAnalysis.java | Java | [] | null | [] | package ua.edu.ucu.tempseries;
import java.util.Arrays;
import java.util.InputMismatchException;
public class TemperatureSeriesAnalysis {
static final int MIN_TEMPERATURE = -273;
private double[] temperatures;
private int number;
private int capacity;
public TemperatureSeriesAnalysis() {
temperatures = new double[1];
capacity = 1;
number = 0;
}
public TemperatureSeriesAnalysis(double[] temperatureSeries) {
temperatures = Arrays.copyOf(temperatureSeries,
temperatureSeries.length);
number = temperatures.length;
capacity = number;
for (int i = 0; i < number; i++) {
if (temperatures[i] < MIN_TEMPERATURE) {
throw new InputMismatchException();
}
}
}
public void check() {
if (number == 0) {
throw new IllegalArgumentException();
}
}
public double average() {
check();
double sum = 0;
for (int i = 0; i < number; i++) {
sum += temperatures[i];
}
return sum/number;
}
public double deviation() {
check();
double expectedSum = 0;
double mean = average();
for (int i = 0; i < number; i++) {
expectedSum += (temperatures[i] - mean)*(temperatures[i] - mean);
}
return Math.sqrt(expectedSum/number);
}
public double min() {
check();
double minTemp = temperatures[0];
for (int i = 0; i < number; i++) {
minTemp = Math.min(minTemp, temperatures[i]);
}
return minTemp;
}
public double max() {
check();
double maxTemp = temperatures[0];
for (int i = 0; i < number; i++) {
maxTemp = Math.max(maxTemp, temperatures[i]);
}
return maxTemp;
}
public double findTempClosestToZero() {
return findTempClosestToValue(0.0);
}
public double findTempClosestToValue(double tempValue) {
check();
double closest = temperatures[0];
double curClosest = Math.abs(closest - tempValue);
for (int i = 1; i < number; i++) {
double current = Math.abs(temperatures[i] - tempValue);
if (current < curClosest) {
closest = temperatures[i];
curClosest = current;
}
}
return closest;
}
public double[] findTempsLessThen(double tempValue) {
check();
int size = 0;
for (int i = 0; i < number; i++) {
if (temperatures[i] < tempValue) {
size += 1;
}
}
double[] arrLess = new double[size];
int j = 0;
for (int i = 0; i < number; i++) {
if (temperatures[i] < tempValue) {
arrLess[j] = temperatures[i];
j += 1;
}
}
return arrLess;
}
public double[] findTempsGreaterThen(double tempValue) {
check();
int size = 0;
for (int i = 0; i < number; i++) {
if (temperatures[i] >= tempValue) {
size += 1;
}
}
double[] arrGreater = new double[size];
int j = 0;
for (int i = 0; i < number; i++) {
if (temperatures[i] >= tempValue) {
arrGreater[j] = temperatures[i];
j += 1;
}
}
return arrGreater;
}
public TempSummaryStatistics summaryStatistics() {
check();
return new TempSummaryStatistics(average(), deviation(), min(), max());
}
public int addTemps(double... temps) {
check();
if (temps.length >= 1) {
double[] arr = new double[number*2];
System.arraycopy(temperatures, 0, arr, 0, number);
capacity *= 2;
temperatures = arr;
}
for (int i = 0; i < temps.length; i++) {
if (temps[i] < MIN_TEMPERATURE) {
throw new InputMismatchException();
}
temperatures[number] = temps[i];
number += 1;
}
return number;
}
}
| 4,231 | 0.497518 | 0.488301 | 166 | 24.487951 | 19.705585 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.596386 | false | false | 4 |
5e7b4aaadeb43be96ff69633214f62b017d2dcef | 11,510,512,403,735 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/27/27_5aa1cf25ec8f10c224728361f241898167985efe/CTCP/27_5aa1cf25ec8f10c224728361f241898167985efe_CTCP_t.java | 0f248dee69542bd04e3d86e9cd9c367d8c6f4bbf | [] | no_license | zhongxingyu/Seer | https://github.com/zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516000 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | false | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | 2023-06-21T00:53:27 | 2023-06-22T07:55:57 | 2,849,868 | 2 | 2 | 0 | null | false | false | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package lighting;
/**
*
* @author StompingBrokenGlass <stompingbrokenglass@gmail.com>
* @since 2013-06-20
*/
public class CTCP {
public String processCTCP(String query){
String response = "";
int space = query.indexOf(" ");
String command ;
String paramenters ;
if (space < 0){
command = query;
} else {
command = query.substring(0,space);
paramenters = query.substring(space+1);
}
switch (command){
case "VERSION" :
response = "VERSION Lighting-catbot ALPHA";
break;
default:
// send an error message identifying an unknown command
response = "ERRMSG " + query + " :Unknown CTCP query";
}
return response;
}
}
| UTF-8 | Java | 993 | java | 27_5aa1cf25ec8f10c224728361f241898167985efe_CTCP_t.java | Java | [
{
"context": "or.\n */\n package lighting;\n \n /**\n *\n * @author StompingBrokenGlass <stompingbrokenglass@gmail.com>\n * @since 2013-0",
"end": 165,
"score": 0.9998466372489929,
"start": 146,
"tag": "NAME",
"value": "StompingBrokenGlass"
},
{
"context": "ting;\n \n /**\n *\n * @author StompingBrokenGlass <stompingbrokenglass@gmail.com>\n * @since 2013-06-20\n */\n public class CTCP {\n",
"end": 196,
"score": 0.9999305605888367,
"start": 167,
"tag": "EMAIL",
"value": "stompingbrokenglass@gmail.com"
}
] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package lighting;
/**
*
* @author StompingBrokenGlass <<EMAIL>>
* @since 2013-06-20
*/
public class CTCP {
public String processCTCP(String query){
String response = "";
int space = query.indexOf(" ");
String command ;
String paramenters ;
if (space < 0){
command = query;
} else {
command = query.substring(0,space);
paramenters = query.substring(space+1);
}
switch (command){
case "VERSION" :
response = "VERSION Lighting-catbot ALPHA";
break;
default:
// send an error message identifying an unknown command
response = "ERRMSG " + query + " :Unknown CTCP query";
}
return response;
}
}
| 971 | 0.511581 | 0.500504 | 41 | 23.195122 | 19.986849 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.365854 | false | false | 4 |
9290a67ad8c25028f2dbe22787658a0bf22e3535 | 386,547,115,945 | e306c87c817ef8abda68386c1ce1e6dba0bdb98a | /src/MyThread2/MyThread.java | 804f3c0bf56224c21d833ded14380ed8d4d81b95 | [] | no_license | xueery/Practice | https://github.com/xueery/Practice | ae242ef69e786bb08b41368b57912274bb20fc67 | d5574f74e36852d3b47e881d11f9545457c9ad9b | refs/heads/master | 2021-06-21T01:42:32.792000 | 2021-03-07T11:36:48 | 2021-03-07T11:36:48 | 194,472,563 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package MyThread2;
/**
* @author:wangxue
* @date:2019/11/10 9:10
*/
public class MyThread {
public static void main(String[] args) throws InterruptedException {
Thread thread=new Thread(new Runnable() {
@Override
public void run() {
System.out.println("ๆๅคฉ่ฆๅๆไบ");
}
});
thread.start();
//ไธ่ฐ็จjoinๆถ๏ผๅๅปบ็บฟ็จไผ่ๆถ่พ้ฟ๏ผไธ่พน็mainๆนๆณ็ไปฃ็ ไผๅ
ๆง่ก
//ๅฆๆ่ฐ็จjoin๏ผ่กจ็คบthread๏ผ็บฟ็จ็ๅผ็จ๏ผไผๅ ๅ
ฅๅฝๅ็บฟ็จ๏ผjavaMainไธป็บฟ็จ๏ผ๏ผ็ญๅพ
threadๆง่กๅฎๆฏๅๆง่กๅ้ขไปฃ็
thread.join();
//ไธ่พนไปฃ็ ๅธธๅธธไผๅ
ๆง่ก๏ผๅ ไธบไปฅไธๅๅปบ็บฟ็จ้จๅๅพ่ๆถใ
System.out.println("ไปๅคฉ่ฟ่ฆไธ่ฏพ");
}
}
| UTF-8 | Java | 803 | java | MyThread.java | Java | [
{
"context": "package MyThread2;\n\n/**\n * @author:wangxue\n * @date:2019/11/10 9:10\n */\npublic class MyThrea",
"end": 42,
"score": 0.9985334873199463,
"start": 35,
"tag": "USERNAME",
"value": "wangxue"
}
] | null | [] | package MyThread2;
/**
* @author:wangxue
* @date:2019/11/10 9:10
*/
public class MyThread {
public static void main(String[] args) throws InterruptedException {
Thread thread=new Thread(new Runnable() {
@Override
public void run() {
System.out.println("ๆๅคฉ่ฆๅๆไบ");
}
});
thread.start();
//ไธ่ฐ็จjoinๆถ๏ผๅๅปบ็บฟ็จไผ่ๆถ่พ้ฟ๏ผไธ่พน็mainๆนๆณ็ไปฃ็ ไผๅ
ๆง่ก
//ๅฆๆ่ฐ็จjoin๏ผ่กจ็คบthread๏ผ็บฟ็จ็ๅผ็จ๏ผไผๅ ๅ
ฅๅฝๅ็บฟ็จ๏ผjavaMainไธป็บฟ็จ๏ผ๏ผ็ญๅพ
threadๆง่กๅฎๆฏๅๆง่กๅ้ขไปฃ็
thread.join();
//ไธ่พนไปฃ็ ๅธธๅธธไผๅ
ๆง่ก๏ผๅ ไธบไปฅไธๅๅปบ็บฟ็จ้จๅๅพ่ๆถใ
System.out.println("ไปๅคฉ่ฟ่ฆไธ่ฏพ");
}
}
| 803 | 0.589916 | 0.569748 | 22 | 26.045454 | 20.541481 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | false | false | 4 |
59deac6b0a250ea6a4ac2f551a722df12dddf038 | 7,791,070,719,694 | 98e11600f1e45f2781ae25747444954ea145cf73 | /src/com/starDoctor/Dao/Patientreport.java | 00045acc5e5b714d5ff014f099fe5153e3e0917d | [] | no_license | qq29oo/starDoctor | https://github.com/qq29oo/starDoctor | 0b3b6091abe233014c48053bf75b9aff4c482666 | ada0b9348ef9673401afd490c35c479f1cc04c66 | refs/heads/master | 2018-01-10T20:51:20.251000 | 2016-03-28T08:25:33 | 2016-03-28T08:25:33 | 54,868,117 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.starDoctor.Dao;
import java.sql.Timestamp;
/**
* Patientreport entity. @author MyEclipse Persistence Tools
*/
public class Patientreport implements java.io.Serializable {
// Fields
private Integer id;
private Integer patientId;
private Integer type;
private String title;
private String hospitalName;
private Timestamp date;
private String pictureUrl;
private Integer authority;
// Constructors
/** default constructor */
public Patientreport() {
}
/** minimal constructor */
public Patientreport(Integer patientId, Integer type, String title,
String hospitalName, Timestamp date, String pictureUrl) {
this.patientId = patientId;
this.type = type;
this.title = title;
this.hospitalName = hospitalName;
this.date = date;
this.pictureUrl = pictureUrl;
}
/** full constructor */
public Patientreport(Integer patientId, Integer type, String title,
String hospitalName, Timestamp date, String pictureUrl,
Integer authority) {
this.patientId = patientId;
this.type = type;
this.title = title;
this.hospitalName = hospitalName;
this.date = date;
this.pictureUrl = pictureUrl;
this.authority = authority;
}
// Property accessors
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getPatientId() {
return this.patientId;
}
public void setPatientId(Integer patientId) {
this.patientId = patientId;
}
public Integer getType() {
return this.type;
}
public void setType(Integer type) {
this.type = type;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public String getHospitalName() {
return this.hospitalName;
}
public void setHospitalName(String hospitalName) {
this.hospitalName = hospitalName;
}
public Timestamp getDate() {
return this.date;
}
public void setDate(Timestamp date) {
this.date = date;
}
public String getPictureUrl() {
return this.pictureUrl;
}
public void setPictureUrl(String pictureUrl) {
this.pictureUrl = pictureUrl;
}
public Integer getAuthority() {
return this.authority;
}
public void setAuthority(Integer authority) {
this.authority = authority;
}
} | UTF-8 | Java | 2,242 | java | Patientreport.java | Java | [] | null | [] | package com.starDoctor.Dao;
import java.sql.Timestamp;
/**
* Patientreport entity. @author MyEclipse Persistence Tools
*/
public class Patientreport implements java.io.Serializable {
// Fields
private Integer id;
private Integer patientId;
private Integer type;
private String title;
private String hospitalName;
private Timestamp date;
private String pictureUrl;
private Integer authority;
// Constructors
/** default constructor */
public Patientreport() {
}
/** minimal constructor */
public Patientreport(Integer patientId, Integer type, String title,
String hospitalName, Timestamp date, String pictureUrl) {
this.patientId = patientId;
this.type = type;
this.title = title;
this.hospitalName = hospitalName;
this.date = date;
this.pictureUrl = pictureUrl;
}
/** full constructor */
public Patientreport(Integer patientId, Integer type, String title,
String hospitalName, Timestamp date, String pictureUrl,
Integer authority) {
this.patientId = patientId;
this.type = type;
this.title = title;
this.hospitalName = hospitalName;
this.date = date;
this.pictureUrl = pictureUrl;
this.authority = authority;
}
// Property accessors
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getPatientId() {
return this.patientId;
}
public void setPatientId(Integer patientId) {
this.patientId = patientId;
}
public Integer getType() {
return this.type;
}
public void setType(Integer type) {
this.type = type;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public String getHospitalName() {
return this.hospitalName;
}
public void setHospitalName(String hospitalName) {
this.hospitalName = hospitalName;
}
public Timestamp getDate() {
return this.date;
}
public void setDate(Timestamp date) {
this.date = date;
}
public String getPictureUrl() {
return this.pictureUrl;
}
public void setPictureUrl(String pictureUrl) {
this.pictureUrl = pictureUrl;
}
public Integer getAuthority() {
return this.authority;
}
public void setAuthority(Integer authority) {
this.authority = authority;
}
} | 2,242 | 0.720785 | 0.720785 | 118 | 18.008474 | 17.311941 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.432203 | false | false | 4 |
d9a46705147152526355ccc24bafcdef118d6c7f | 35,124,242,565,965 | 02f39a68e888f0362e7faef0c7d22963ed7663b7 | /src/my_jdbc_1/UpdateRecords2.java | 00d5a4007d6fb14517435a8fb72bb80018cf1b5e | [] | no_license | Cache-Hibernate/JDBCExample | https://github.com/Cache-Hibernate/JDBCExample | b89d4ace11febb1d3b0c3440859a775e8dd812c4 | 6deb92bacd20ba93365fa4584d2eb8500bc451d1 | refs/heads/master | 2021-01-01T05:52:08.718000 | 2015-03-17T14:11:01 | 2015-03-17T14:11:01 | 32,396,634 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package my_jdbc_1;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
/**
* @author Aleksandr Konstantinovitch
* @version 1.0
* @date 21/01/2015
* {@link http://javatalks.ru/topics/7147}
* {@link http://www.tutorialspoint.com/jdbc/jdbc-drop-database.htm}
* {@link http://www.tutorialspoint.com/jdbc/updating-result-sets.htm}
* {@link http://www.quizful.net/post/using-jdbc}
* {@link http://devcolibri.com/477}
* {@link http://javaxblog.ru/article/java-jdbc-1/}
* {@link http://www.mkyong.com/jdbc/jdbc-preparestatement-example-update-a-record/}
* {@link http://www.javaportal.ru/java/tutorial/tutorialJDBC/preparedstatement.html}
*/
public class UpdateRecords2 {
public static Connection dbConnection = null;
public static PreparedStatement preparedStatement = null;
private static final String DB_DRIVER = "com.mysql.jdbc.Driver";
private static final String DB_CONNECTION = "jdbc:mysql://localhost:3306/bookstore?characterEncoding=utf8";
private static final String DB_USER = "root";
private static final String DB_PASSWORD = "1978";
// ะขะฐะบ ะผั ะดะตะปะฐะตะผ ะพะฑะฝะพะฒะปะตะฝะธะต ะทะฐะฟะธัะธ ะธะท ัะฐะฑะปะธัั ะฒ ะฑะฐะทะต:
// private static final String UPDATE_RECORDS_QUERY = "UPDATE books SET title=?,comment=?,author=? WHERE id=?";
private static final String UPDATE_RECORDS_QUERY = "UPDATE books SET title=?,comment=?,author=? WHERE id IN(?)";
public static void main(String[] argv) {
try {
updateRecord();
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
private static void updateRecord() throws SQLException {
try {
/**
* ะะปะฐัั 'java.sql.Connection' - ะฟัะตะดััะฐะฒะปัะตั ะฒ JDBC ัะตะฐะฝั ัะฐะฑะพัั ั ะฑะฐะทะพะน ะดะฐะฝะฝัั
(ะพะฝ ะฟัะตะดะพััะฐะฒะปัะตั ะฟัะธะปะพะถะตะฝะธั ะพะฑัะตะบัั Statement ะดะปั ััะพะณะพ ัะตะฐะฝัะฐ).
* ะะพ ัะผะพะปัะฐะฝะธั ะบะฐะถะดะฐั ะบะพะผะฐะฝะดะฐ ะฒัะฟะพะปะฝัะตััั ะฒ ะพัะดะตะปัะฝะพะน ััะฐะฝะทะฐะบัะธะธ.
* ะะฑัะตะบั Connection ะฟะพะทะฒะพะปัะตั ะพัะบะปััะธัั ััะฝะบัะธั "Autocommit" (ะฐะฒัะพะผะฐัะธัะตัะบะพะณะพ ะทะฐะฒะตััะตะฝะธั ััะฐะฝะทะฐะบัะธะธ) - ะฒ ััะพะผ ัะปััะฐะต ััะตะฑัะตััั ัะฒะฝะพ ะทะฐะฒะตััะธัั ััะฐะฝะทะฐะบัะธั, ะธะฝะฐัะต ัะตะทัะปััะฐัั ะฒัะฟะพะปะฝะตะฝะธั ะฒัะตั
ะบะพะผะฐะฝะด ะฑัะดัั ะฟะพัะตััะฝั.
* *********************************************************************
* public void close() throws SQLException // ะฟะพะทะฒะพะปัะตั ะฒัััะฝัั ะพัะฒะพะฑะพะดะธัั ะฒัะต ัะตััััั, ัะฐะบะธะต ะบะฐะบ ัะตัะตะฒัะต ัะพะตะดะธะฝะตะฝะธั ะธ ะฑะปะพะบะธัะพะฒะบะธ ะฑะฐะทั ะดะฐะฝะฝัั
, ัะฒัะทะฐะฝะฝัะต ั ะดะฐะฝะฝัะผ ะพะฑัะตะบัะพะผ Connection.
* public Statement createStatement() throws SQLException // ัะพะทะดะฐะตั ะพะฑัะตะบั Statement, ัะฒัะทะฐะฝะฝัะน ั ัะตะฐะฝัะพะผ Connection, ะดะปั ะบะพัะพัะพะณะพ ัะบะทะตะผะฟะปััั ResultSet ะธะผะตัั ัะธะฟ ัะพะปัะบะพ ะดะปั ััะตะฝะธั ะธ ะฟะตัะตะผะตัะตะฝะธั ะฒ ะฟััะผะพะผ ะฝะฐะฟัะฐะฒะปะตะฝะธะธ.
* public boolean getAutoCommit() throws SQLException // ะฟะพ ัะผะพะปัะฐะฝะธั ะฒัะต ะพะฑัะตะบัั Connection ะฝะฐั
ะพะดัััั ะฒ ัะตะถะธะผะต ะฐะฒัะพะทะฐะฒะตััะตะฝะธั. ะ ััะพะผ ัะตะถะธะผะต ะบะฐะถะดะฐั ะบะพะผะฐะฝะดะฐ ะทะฐะฒะตััะฐะตััั ััะฐะทั ะฟะพัะปะต ะฒัะฟะพะปะฝะตะฝะธั.
* public void setAutoCommit(boolean ac) throws SQLException // ะผะตัะพะด setAutoCommit() ะธัะฟะพะปัะทัะตััั ะดะปั ะพัะบะปััะตะฝะธั ะฐะฒัะพะทะฐะฒะตััะตะฝะธั ะฒัััะฝัั ะทะฐะฒะตััะธัั ัะตัะธั ะบะพะผะฐะฝะด ะฒ ะฟัะธะปะพะถะตะฝะธะธ ะบะฐะบ ะตะดะธะฝัั ััะฐะฝะทะฐะบัะธั.
* public void commit() throws SQLException // ะดะตะปะฐะตั ะฟะพััะพัะฝะฝัะผะธ ะธะทะผะตะฝะตะฝะธั, ะฟัะพะธะทะฒะตะดะตะฝะฝัะต ะฒัะตะผะธ ะบะพะผะฐะฝะดะฐะผะธ, ัะฒัะทะฐะฝะฝัะผะธ ั ะดะฐะฝะฝัะผ ัะพะตะดะธะฝะตะฝะธะตะผ.
* public DatabaseMetaData getMetaData() throws SQLException // ะฟัะตะดะพััะฐะฒะปัะตั ัะฒะตะดะตะฝะธั ะพัะฝะพัััะธะตัั ะบ ะฑะฐะทะต ะดะฐะฝะฝัั
ะธ ะดะฐะฝะฝะพะผั Connection.
* *********************************************************************
*/
dbConnection = dbConnection();
/**
* ะญะบะทะตะผะฟะปััั 'PreparedStatement' - ะฟะพะผะฝัั ัะบะพะผะฟะธะปะธัะพะฒะฐะฝะฝัะต SQL-ะฒััะฐะถะตะฝะธั.
* ะพะฑัะตะบัั 'PreparedStatement' ะฟัะตะบะพะผะฟะธะปะธัะพะฒะฐะฝะฝั, ะธัะฟะพะปะฝะตะฝะธะต ััะธั
ะทะฐะฟัะพัะพะฒ ะผะพะถะตั ะฟัะพะธัั
ะพะดะธัั ะฝะตัะบะพะปัะบะพ ะฑััััะตะต, ัะตะผ ะฒ ะพะฑัะตะบัะฐั
Statement.
*/
preparedStatement = dbConnection.prepareStatement(UPDATE_RECORDS_QUERY);
preparedStatement.setString(1, "a1");
preparedStatement.setString(2, "a1a1a1a1a1a1a1a1");
preparedStatement.setString(3, "A1");
preparedStatement.setInt(4, 2);
// ะะฑัะฐัะธัะต ะฒะฝะธะผะฐะฝะธะต, ััะพ ะพะฑะฝะพะฒะปะตะฝะธะต ัััะพะบะธ ะฒ ัะฐะฑะปะธัะต ั ะฟะพะผะพััั PreparedStatement.executeUpdate().
int countRecords = preparedStatement.executeUpdate();
System.out.println("******************************");
System.out.println("Update Record: " + countRecords);
System.out.println("******************************");
} catch (SQLException e) {
System.out.println(e.getMessage());
} finally {
if (preparedStatement != null) {
preparedStatement.close();
}
if (dbConnection != null) {
dbConnection.close();
}
}
}
private static Connection dbConnection() {
Connection dbConnection = null;
try {
Class.forName(DB_DRIVER);
} catch (ClassNotFoundException e) {
System.out.println(e.getMessage());
}
try {
dbConnection = DriverManager.getConnection(DB_CONNECTION, DB_USER, DB_PASSWORD);
return dbConnection;
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return dbConnection;
}
} | UTF-8 | Java | 6,491 | java | UpdateRecords2.java | Java | [
{
"context": "ent;\nimport java.sql.SQLException;\n\n/**\n * @author Aleksandr Konstantinovitch\n * @version 1.0\n * @date 21/01/2015\n * {@link htt",
"end": 186,
"score": 0.9998415112495422,
"start": 160,
"tag": "NAME",
"value": "Aleksandr Konstantinovitch"
},
{
"context": "vate static final String DB_PASSWORD = \"1978\";\n // ะขะฐะบ ะผั ะดะตะปะฐะตะผ ะพะฑะฝะพะฒะปะตะฝะธะต ะทะฐะฟะธัะธ ะธะท ัะฐะฑะปะธ",
"end": 1201,
"score": 0.9991980791091919,
"start": 1197,
"tag": "PASSWORD",
"value": "1978"
}
] | null | [] | package my_jdbc_1;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
/**
* @author <NAME>
* @version 1.0
* @date 21/01/2015
* {@link http://javatalks.ru/topics/7147}
* {@link http://www.tutorialspoint.com/jdbc/jdbc-drop-database.htm}
* {@link http://www.tutorialspoint.com/jdbc/updating-result-sets.htm}
* {@link http://www.quizful.net/post/using-jdbc}
* {@link http://devcolibri.com/477}
* {@link http://javaxblog.ru/article/java-jdbc-1/}
* {@link http://www.mkyong.com/jdbc/jdbc-preparestatement-example-update-a-record/}
* {@link http://www.javaportal.ru/java/tutorial/tutorialJDBC/preparedstatement.html}
*/
public class UpdateRecords2 {
public static Connection dbConnection = null;
public static PreparedStatement preparedStatement = null;
private static final String DB_DRIVER = "com.mysql.jdbc.Driver";
private static final String DB_CONNECTION = "jdbc:mysql://localhost:3306/bookstore?characterEncoding=utf8";
private static final String DB_USER = "root";
private static final String DB_PASSWORD = "<PASSWORD>";
// ะขะฐะบ ะผั ะดะตะปะฐะตะผ ะพะฑะฝะพะฒะปะตะฝะธะต ะทะฐะฟะธัะธ ะธะท ัะฐะฑะปะธัั ะฒ ะฑะฐะทะต:
// private static final String UPDATE_RECORDS_QUERY = "UPDATE books SET title=?,comment=?,author=? WHERE id=?";
private static final String UPDATE_RECORDS_QUERY = "UPDATE books SET title=?,comment=?,author=? WHERE id IN(?)";
public static void main(String[] argv) {
try {
updateRecord();
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
private static void updateRecord() throws SQLException {
try {
/**
* ะะปะฐัั 'java.sql.Connection' - ะฟัะตะดััะฐะฒะปัะตั ะฒ JDBC ัะตะฐะฝั ัะฐะฑะพัั ั ะฑะฐะทะพะน ะดะฐะฝะฝัั
(ะพะฝ ะฟัะตะดะพััะฐะฒะปัะตั ะฟัะธะปะพะถะตะฝะธั ะพะฑัะตะบัั Statement ะดะปั ััะพะณะพ ัะตะฐะฝัะฐ).
* ะะพ ัะผะพะปัะฐะฝะธั ะบะฐะถะดะฐั ะบะพะผะฐะฝะดะฐ ะฒัะฟะพะปะฝัะตััั ะฒ ะพัะดะตะปัะฝะพะน ััะฐะฝะทะฐะบัะธะธ.
* ะะฑัะตะบั Connection ะฟะพะทะฒะพะปัะตั ะพัะบะปััะธัั ััะฝะบัะธั "Autocommit" (ะฐะฒัะพะผะฐัะธัะตัะบะพะณะพ ะทะฐะฒะตััะตะฝะธั ััะฐะฝะทะฐะบัะธะธ) - ะฒ ััะพะผ ัะปััะฐะต ััะตะฑัะตััั ัะฒะฝะพ ะทะฐะฒะตััะธัั ััะฐะฝะทะฐะบัะธั, ะธะฝะฐัะต ัะตะทัะปััะฐัั ะฒัะฟะพะปะฝะตะฝะธั ะฒัะตั
ะบะพะผะฐะฝะด ะฑัะดัั ะฟะพัะตััะฝั.
* *********************************************************************
* public void close() throws SQLException // ะฟะพะทะฒะพะปัะตั ะฒัััะฝัั ะพัะฒะพะฑะพะดะธัั ะฒัะต ัะตััััั, ัะฐะบะธะต ะบะฐะบ ัะตัะตะฒัะต ัะพะตะดะธะฝะตะฝะธั ะธ ะฑะปะพะบะธัะพะฒะบะธ ะฑะฐะทั ะดะฐะฝะฝัั
, ัะฒัะทะฐะฝะฝัะต ั ะดะฐะฝะฝัะผ ะพะฑัะตะบัะพะผ Connection.
* public Statement createStatement() throws SQLException // ัะพะทะดะฐะตั ะพะฑัะตะบั Statement, ัะฒัะทะฐะฝะฝัะน ั ัะตะฐะฝัะพะผ Connection, ะดะปั ะบะพัะพัะพะณะพ ัะบะทะตะผะฟะปััั ResultSet ะธะผะตัั ัะธะฟ ัะพะปัะบะพ ะดะปั ััะตะฝะธั ะธ ะฟะตัะตะผะตัะตะฝะธั ะฒ ะฟััะผะพะผ ะฝะฐะฟัะฐะฒะปะตะฝะธะธ.
* public boolean getAutoCommit() throws SQLException // ะฟะพ ัะผะพะปัะฐะฝะธั ะฒัะต ะพะฑัะตะบัั Connection ะฝะฐั
ะพะดัััั ะฒ ัะตะถะธะผะต ะฐะฒัะพะทะฐะฒะตััะตะฝะธั. ะ ััะพะผ ัะตะถะธะผะต ะบะฐะถะดะฐั ะบะพะผะฐะฝะดะฐ ะทะฐะฒะตััะฐะตััั ััะฐะทั ะฟะพัะปะต ะฒัะฟะพะปะฝะตะฝะธั.
* public void setAutoCommit(boolean ac) throws SQLException // ะผะตัะพะด setAutoCommit() ะธัะฟะพะปัะทัะตััั ะดะปั ะพัะบะปััะตะฝะธั ะฐะฒัะพะทะฐะฒะตััะตะฝะธั ะฒัััะฝัั ะทะฐะฒะตััะธัั ัะตัะธั ะบะพะผะฐะฝะด ะฒ ะฟัะธะปะพะถะตะฝะธะธ ะบะฐะบ ะตะดะธะฝัั ััะฐะฝะทะฐะบัะธั.
* public void commit() throws SQLException // ะดะตะปะฐะตั ะฟะพััะพัะฝะฝัะผะธ ะธะทะผะตะฝะตะฝะธั, ะฟัะพะธะทะฒะตะดะตะฝะฝัะต ะฒัะตะผะธ ะบะพะผะฐะฝะดะฐะผะธ, ัะฒัะทะฐะฝะฝัะผะธ ั ะดะฐะฝะฝัะผ ัะพะตะดะธะฝะตะฝะธะตะผ.
* public DatabaseMetaData getMetaData() throws SQLException // ะฟัะตะดะพััะฐะฒะปัะตั ัะฒะตะดะตะฝะธั ะพัะฝะพัััะธะตัั ะบ ะฑะฐะทะต ะดะฐะฝะฝัั
ะธ ะดะฐะฝะฝะพะผั Connection.
* *********************************************************************
*/
dbConnection = dbConnection();
/**
* ะญะบะทะตะผะฟะปััั 'PreparedStatement' - ะฟะพะผะฝัั ัะบะพะผะฟะธะปะธัะพะฒะฐะฝะฝัะต SQL-ะฒััะฐะถะตะฝะธั.
* ะพะฑัะตะบัั 'PreparedStatement' ะฟัะตะบะพะผะฟะธะปะธัะพะฒะฐะฝะฝั, ะธัะฟะพะปะฝะตะฝะธะต ััะธั
ะทะฐะฟัะพัะพะฒ ะผะพะถะตั ะฟัะพะธัั
ะพะดะธัั ะฝะตัะบะพะปัะบะพ ะฑััััะตะต, ัะตะผ ะฒ ะพะฑัะตะบัะฐั
Statement.
*/
preparedStatement = dbConnection.prepareStatement(UPDATE_RECORDS_QUERY);
preparedStatement.setString(1, "a1");
preparedStatement.setString(2, "a1a1a1a1a1a1a1a1");
preparedStatement.setString(3, "A1");
preparedStatement.setInt(4, 2);
// ะะฑัะฐัะธัะต ะฒะฝะธะผะฐะฝะธะต, ััะพ ะพะฑะฝะพะฒะปะตะฝะธะต ัััะพะบะธ ะฒ ัะฐะฑะปะธัะต ั ะฟะพะผะพััั PreparedStatement.executeUpdate().
int countRecords = preparedStatement.executeUpdate();
System.out.println("******************************");
System.out.println("Update Record: " + countRecords);
System.out.println("******************************");
} catch (SQLException e) {
System.out.println(e.getMessage());
} finally {
if (preparedStatement != null) {
preparedStatement.close();
}
if (dbConnection != null) {
dbConnection.close();
}
}
}
private static Connection dbConnection() {
Connection dbConnection = null;
try {
Class.forName(DB_DRIVER);
} catch (ClassNotFoundException e) {
System.out.println(e.getMessage());
}
try {
dbConnection = DriverManager.getConnection(DB_CONNECTION, DB_USER, DB_PASSWORD);
return dbConnection;
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return dbConnection;
}
} | 6,477 | 0.633579 | 0.625461 | 104 | 51.125 | 52.479794 | 231 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.528846 | false | false | 4 |
dcdb06a497a1740076ad5551be76167c0b7e561d | 29,540,785,099,014 | 5e471825c109efa12de44bdb7f5e5c75d50157f4 | /src/main/java/com/example/demo/util/MyWebAppConfigurer.java | ecc7b4f346bfb24ef65fe3fbf47cf5484e70b210 | [] | no_license | theWakeningDog/demo | https://github.com/theWakeningDog/demo | 923e843df64416fd9a9e0f202d577c66f27186fd | ba58ff7badd7dfc40b555203fb7d821ffb785b6d | refs/heads/master | 2020-03-08T09:43:41.469000 | 2018-05-01T09:55:21 | 2018-05-01T09:55:21 | 128,054,020 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.demo.util;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* ็จไบๅจๆๆทปๅ ่ตๆบ่ฟ่ก็ปดๆคไฝฟ็จ
* Created by zhangwei on 2018/3/30 0030.
*/
@Configuration
public class MyWebAppConfigurer extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/myres/**").addResourceLocations("classpath:/myres/");
}
}
| UTF-8 | Java | 622 | java | MyWebAppConfigurer.java | Java | [
{
"context": "gurerAdapter;\n\n/**\n * ็จไบๅจๆๆทปๅ ่ตๆบ่ฟ่ก็ปดๆคไฝฟ็จ\n * Created by zhangwei on 2018/3/30 0030.\n */\n@Configuration\npublic clas",
"end": 302,
"score": 0.9996111392974854,
"start": 294,
"tag": "USERNAME",
"value": "zhangwei"
}
] | null | [] | package com.example.demo.util;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* ็จไบๅจๆๆทปๅ ่ตๆบ่ฟ่ก็ปดๆคไฝฟ็จ
* Created by zhangwei on 2018/3/30 0030.
*/
@Configuration
public class MyWebAppConfigurer extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/myres/**").addResourceLocations("classpath:/myres/");
}
}
| 622 | 0.79798 | 0.779461 | 18 | 32 | 32.588341 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.277778 | false | false | 4 |
147364f174155688f9abee6da6ae9f89bffd75e7 | 3,221,225,482,938 | 1e8010ff7589b1737a8d5eac926ef4d5ec84586c | /src/main/java/com/kamadhenu/warehousemanagementsystem/repository/warehouse/InwardTruckInvoiceRepository.java | 7a1a1b3fbdb813a843748acf54a817ece7df7e4e | [] | no_license | santoshorig/warehousemanagementsystem | https://github.com/santoshorig/warehousemanagementsystem | db1881ebe0eff8fb1fe0265aa429cb81375da4b2 | 3eba800b214ecadb9f576adf5b4b8e111e1eda63 | refs/heads/master | 2023-03-22T02:48:22.181000 | 2021-03-17T05:36:41 | 2021-03-17T05:36:41 | 348,593,001 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kamadhenu.warehousemanagementsystem.repository.warehouse;
import com.kamadhenu.warehousemanagementsystem.model.db.warehouse.InwardTruck;
import com.kamadhenu.warehousemanagementsystem.model.db.warehouse.InwardTruckInvoice;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Inward Truck Invoice repository class
*/
@Repository
public interface InwardTruckInvoiceRepository extends JpaRepository<InwardTruckInvoice, Integer> {
/**
* Find inward invoice by inward truck
*
* @param inwardTruck
* @return
*/
List<InwardTruckInvoice> findByInwardTruck(InwardTruck inwardTruck);
}
| UTF-8 | Java | 716 | java | InwardTruckInvoiceRepository.java | Java | [] | null | [] | package com.kamadhenu.warehousemanagementsystem.repository.warehouse;
import com.kamadhenu.warehousemanagementsystem.model.db.warehouse.InwardTruck;
import com.kamadhenu.warehousemanagementsystem.model.db.warehouse.InwardTruckInvoice;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Inward Truck Invoice repository class
*/
@Repository
public interface InwardTruckInvoiceRepository extends JpaRepository<InwardTruckInvoice, Integer> {
/**
* Find inward invoice by inward truck
*
* @param inwardTruck
* @return
*/
List<InwardTruckInvoice> findByInwardTruck(InwardTruck inwardTruck);
}
| 716 | 0.796089 | 0.796089 | 23 | 30.130434 | 31.652054 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.347826 | false | false | 4 |
93d94ac0011e837eecd19f6aba39798897d93d7f | 35,244,501,652,360 | 4daafcdf92c3a7fddc90e036ca200f7743e6a965 | /src/main/java/it/sevenbits/javaformatter/lexer/ILexer.java | 24167884644c0cbfa599d375d8f18bbb129bd1d2 | [] | no_license | hey-gleb/back-end-homework | https://github.com/hey-gleb/back-end-homework | 5d5e14d9cfa9780c51b17e14a1fd7b11595dd2db | 72e943a1a2cd9e9ff30613fc5dce6778654566b4 | refs/heads/master | 2021-10-09T04:31:52.923000 | 2018-12-21T08:19:36 | 2018-12-21T08:19:36 | 153,241,160 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package it.sevenbits.javaformatter.lexer;
import it.sevenbits.javaformatter.lexer.token.IToken;
/**
* Interface with function to read tokens from stream and check for more tokens
*/
public interface ILexer {
/**
* Create token from character sequence
*
* @return new token
* @throws LexerException is thrown, if something wrong with lexeme
*/
IToken readToken() throws LexerException;
/**
* Checks is there another one token or not
*
* @return true if there is another token, false - not
* @throws LexerException is thrown, if something wrong with lexeme
*/
boolean hasMoreTokens() throws LexerException;
}
| UTF-8 | Java | 678 | java | ILexer.java | Java | [] | null | [] | package it.sevenbits.javaformatter.lexer;
import it.sevenbits.javaformatter.lexer.token.IToken;
/**
* Interface with function to read tokens from stream and check for more tokens
*/
public interface ILexer {
/**
* Create token from character sequence
*
* @return new token
* @throws LexerException is thrown, if something wrong with lexeme
*/
IToken readToken() throws LexerException;
/**
* Checks is there another one token or not
*
* @return true if there is another token, false - not
* @throws LexerException is thrown, if something wrong with lexeme
*/
boolean hasMoreTokens() throws LexerException;
}
| 678 | 0.690265 | 0.690265 | 24 | 27.25 | 26.161757 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.291667 | false | false | 4 |
f79275f8a98e0a53e0aec68900e48f20b2b29039 | 35,485,019,824,398 | cc0312efde9cd1e947c7b8d71ba0402fd5726171 | /server/src/main/java/com/voxelwind/server/game/level/manager/LevelPacketManager.java | 5e5eccf1f3d66de4ff769d93feb4c27a922539cf | [
"MIT"
] | permissive | rdstonech/VW | https://github.com/rdstonech/VW | 661831511a075546f1bdf413ba750249fdeb221d | 0bf33f4ebd6d343b1fca5d792f9b5f2a9795c0a5 | refs/heads/master | 2021-07-22T17:54:37.320000 | 2017-11-04T13:50:18 | 2017-11-04T13:50:18 | 109,412,545 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.voxelwind.server.game.level.manager;
import com.voxelwind.api.game.entities.Entity;
import com.voxelwind.server.game.entities.BaseEntity;
import com.voxelwind.server.game.level.VoxelwindLevel;
import com.voxelwind.server.network.NetworkPackage;
import com.voxelwind.server.network.session.PlayerSession;
import gnu.trove.map.TLongObjectMap;
import gnu.trove.map.hash.TLongObjectHashMap;
import lombok.Synchronized;
import java.util.ArrayDeque;
import java.util.List;
import java.util.Optional;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
public class LevelPacketManager
{
private static final int ENTITY_VIEW_DISTANCE_SQ = 64 * 64;
private final Queue<NetworkPackage> broadcastQueue = new ConcurrentLinkedQueue<> ();
private final TLongObjectMap<Queue<NetworkPackage>> specificEntityViewerQueue = new TLongObjectHashMap<> ();
private final VoxelwindLevel level;
public LevelPacketManager (VoxelwindLevel level)
{
this.level = level;
}
public void onTick ()
{
List<PlayerSession> playersInWorld = level.getEntityManager ().getPlayers ();
NetworkPackage np;
while ((np = broadcastQueue.poll ()) != null)
{
for (PlayerSession session : playersInWorld)
{
if (!session.isRemoved ())
{
session.getMcpeSession ().addToSendQueue (np);
}
}
}
synchronized (specificEntityViewerQueue)
{
specificEntityViewerQueue.forEachEntry ((eid, queue) ->
{
Optional<BaseEntity> entityById = level.getEntityManager ().findEntityById (eid);
if (entityById.isPresent ())
{
Entity entity = entityById.get ();
for (PlayerSession session : playersInWorld)
{
if (session == entity) continue; // Don't move ourselves
if (session.getPosition ().distanceSquared (entity.getPosition ()) <= ENTITY_VIEW_DISTANCE_SQ && !session.isRemoved ())
{
for (NetworkPackage aPackage : queue)
{
session.getMcpeSession ().addToSendQueue (aPackage);
}
}
}
}
return true;
});
specificEntityViewerQueue.clear ();
}
}
@Synchronized ("specificEntityViewerQueue")
public void queuePacketForViewers (Entity entity, NetworkPackage netPackage)
{
Queue<NetworkPackage> packageQueue = specificEntityViewerQueue.get (entity.getEntityId ());
if (packageQueue == null)
{
specificEntityViewerQueue.put (entity.getEntityId (), packageQueue = new ArrayDeque<> ());
}
packageQueue.add (netPackage);
}
public void queuePacketForPlayers (NetworkPackage netPackage)
{
broadcastQueue.add (netPackage);
}
}
| UTF-8 | Java | 2,570 | java | LevelPacketManager.java | Java | [] | null | [] | package com.voxelwind.server.game.level.manager;
import com.voxelwind.api.game.entities.Entity;
import com.voxelwind.server.game.entities.BaseEntity;
import com.voxelwind.server.game.level.VoxelwindLevel;
import com.voxelwind.server.network.NetworkPackage;
import com.voxelwind.server.network.session.PlayerSession;
import gnu.trove.map.TLongObjectMap;
import gnu.trove.map.hash.TLongObjectHashMap;
import lombok.Synchronized;
import java.util.ArrayDeque;
import java.util.List;
import java.util.Optional;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
public class LevelPacketManager
{
private static final int ENTITY_VIEW_DISTANCE_SQ = 64 * 64;
private final Queue<NetworkPackage> broadcastQueue = new ConcurrentLinkedQueue<> ();
private final TLongObjectMap<Queue<NetworkPackage>> specificEntityViewerQueue = new TLongObjectHashMap<> ();
private final VoxelwindLevel level;
public LevelPacketManager (VoxelwindLevel level)
{
this.level = level;
}
public void onTick ()
{
List<PlayerSession> playersInWorld = level.getEntityManager ().getPlayers ();
NetworkPackage np;
while ((np = broadcastQueue.poll ()) != null)
{
for (PlayerSession session : playersInWorld)
{
if (!session.isRemoved ())
{
session.getMcpeSession ().addToSendQueue (np);
}
}
}
synchronized (specificEntityViewerQueue)
{
specificEntityViewerQueue.forEachEntry ((eid, queue) ->
{
Optional<BaseEntity> entityById = level.getEntityManager ().findEntityById (eid);
if (entityById.isPresent ())
{
Entity entity = entityById.get ();
for (PlayerSession session : playersInWorld)
{
if (session == entity) continue; // Don't move ourselves
if (session.getPosition ().distanceSquared (entity.getPosition ()) <= ENTITY_VIEW_DISTANCE_SQ && !session.isRemoved ())
{
for (NetworkPackage aPackage : queue)
{
session.getMcpeSession ().addToSendQueue (aPackage);
}
}
}
}
return true;
});
specificEntityViewerQueue.clear ();
}
}
@Synchronized ("specificEntityViewerQueue")
public void queuePacketForViewers (Entity entity, NetworkPackage netPackage)
{
Queue<NetworkPackage> packageQueue = specificEntityViewerQueue.get (entity.getEntityId ());
if (packageQueue == null)
{
specificEntityViewerQueue.put (entity.getEntityId (), packageQueue = new ArrayDeque<> ());
}
packageQueue.add (netPackage);
}
public void queuePacketForPlayers (NetworkPackage netPackage)
{
broadcastQueue.add (netPackage);
}
}
| 2,570 | 0.729572 | 0.728016 | 88 | 28.204546 | 29.090048 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.465909 | false | false | 4 |
d5c2e2d72a0f4dfebd16941bf5903e30ecad738f | 28,887,950,103,637 | f0d76501101769d39e5faa1f1517f9af8411dc38 | /src/tableModel/ManageBookTM.java | e364b6614828c9dacd7fd0bd24fb30c009a0dade | [] | no_license | MadushankaJaffna/library | https://github.com/MadushankaJaffna/library | 6588663c281230d4748feba923670aaacdb84c1c | 35ef5cfe3105c6c280defc78cb577d62f46f0369 | refs/heads/master | 2020-07-30T15:26:49.829000 | 2019-09-23T13:31:29 | 2019-09-23T13:31:29 | 210,105,262 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tableModel;
public class ManageBookTM {
private String id;
private String name;
private String Auther;
private int price;
private int qty;
private int exactQty;
public ManageBookTM(){
}
public ManageBookTM(String id, String name, String auther, int price, int qty, int exactQty) {
this.id = id;
this.name = name;
Auther = auther;
this.price = price;
this.qty = qty;
this.exactQty = exactQty;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuther() {
return Auther;
}
public void setAuther(String auther) {
Auther = auther;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public int getQty() {
return qty;
}
public void setQty(int qty) {
this.qty = qty;
}
public int getExactQty() {
return exactQty;
}
public void setExactQty(int exactQty) {
this.exactQty = exactQty;
}
@Override
public String toString() {
return "ManageBookTM{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", Auther='" + Auther + '\'' +
", price=" + price +
", qty=" + qty +
", exactQty=" + exactQty +
'}';
}
}
| UTF-8 | Java | 1,706 | java | ManageBookTM.java | Java | [
{
"context": "'\" + name + '\\'' +\r\n \", Auther='\" + Auther + '\\'' +\r\n \", price=\" + price +\r",
"end": 1545,
"score": 0.8407275676727295,
"start": 1541,
"tag": "NAME",
"value": "Auth"
}
] | null | [] | package tableModel;
public class ManageBookTM {
private String id;
private String name;
private String Auther;
private int price;
private int qty;
private int exactQty;
public ManageBookTM(){
}
public ManageBookTM(String id, String name, String auther, int price, int qty, int exactQty) {
this.id = id;
this.name = name;
Auther = auther;
this.price = price;
this.qty = qty;
this.exactQty = exactQty;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuther() {
return Auther;
}
public void setAuther(String auther) {
Auther = auther;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public int getQty() {
return qty;
}
public void setQty(int qty) {
this.qty = qty;
}
public int getExactQty() {
return exactQty;
}
public void setExactQty(int exactQty) {
this.exactQty = exactQty;
}
@Override
public String toString() {
return "ManageBookTM{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", Auther='" + Auther + '\'' +
", price=" + price +
", qty=" + qty +
", exactQty=" + exactQty +
'}';
}
}
| 1,706 | 0.478312 | 0.478312 | 83 | 18.554216 | 16.351009 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.433735 | false | false | 4 |
f160264fbe677b35216709cc6e335d5f8ec8670d | 30,339,648,979,262 | fa616d76ea605d4aa0390a2c3080d1cb1a7f82d5 | /src/com/magicallinone/app/datasets/DeckCardTable.java | dcb0b560987360958599c897521c71a1fb3c8489 | [] | no_license | tonycorp/MagicAllInOne | https://github.com/tonycorp/MagicAllInOne | 328610611a144ed8901b29d6fceddcfe3556f947 | d195310ca63b24573128960551617eab5d7a2959 | refs/heads/master | 2020-04-09T02:08:30.835000 | 2014-03-24T23:33:59 | 2014-03-24T23:33:59 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.magicallinone.app.datasets;
import com.magicallinone.app.providers.DatabaseTable;
import java.util.Map;
public class DeckCardTable extends DatabaseTable {
public static final String TABLE_NAME = "deck_card_table";
public class Columns extends DatabaseTable.Columns {
public static final String DECK_ID = "deck_id";
public static final String CARD_ID = "card_id";
public static final String QUANTITY = "quantity";
}
@Override
protected Map<String, String> getColumnTypes() {
Map<String, String> columnTypes = super.getColumnTypes();
columnTypes.put(Columns.DECK_ID, "INTEGER");
columnTypes.put(Columns.CARD_ID, "INTEGER");
columnTypes.put(Columns.QUANTITY, "INTEGER");
return columnTypes;
}
@Override
protected String getConstraint() {
return "UNIQUE (" + Columns.DECK_ID + ", " + Columns.CARD_ID + ") ON CONFLICT REPLACE";
}
@Override
public String getName() {
return TABLE_NAME;
}
}
| UTF-8 | Java | 940 | java | DeckCardTable.java | Java | [] | null | [] | package com.magicallinone.app.datasets;
import com.magicallinone.app.providers.DatabaseTable;
import java.util.Map;
public class DeckCardTable extends DatabaseTable {
public static final String TABLE_NAME = "deck_card_table";
public class Columns extends DatabaseTable.Columns {
public static final String DECK_ID = "deck_id";
public static final String CARD_ID = "card_id";
public static final String QUANTITY = "quantity";
}
@Override
protected Map<String, String> getColumnTypes() {
Map<String, String> columnTypes = super.getColumnTypes();
columnTypes.put(Columns.DECK_ID, "INTEGER");
columnTypes.put(Columns.CARD_ID, "INTEGER");
columnTypes.put(Columns.QUANTITY, "INTEGER");
return columnTypes;
}
@Override
protected String getConstraint() {
return "UNIQUE (" + Columns.DECK_ID + ", " + Columns.CARD_ID + ") ON CONFLICT REPLACE";
}
@Override
public String getName() {
return TABLE_NAME;
}
}
| 940 | 0.729787 | 0.729787 | 36 | 25.111111 | 24.477629 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.527778 | false | false | 4 |
389a466317417b2fb6b62b03acd2f40ecf291945 | 27,101,243,709,376 | 97595a74fdc11abb3ac3f0cb93c0f617e602d511 | /src/model/services/UsuarioService.java | 563fcf6d2f6344ddc47b66b8736269721b2cf67f | [] | no_license | AndreLuSantana/projeto-unidos-pra-cachorro | https://github.com/AndreLuSantana/projeto-unidos-pra-cachorro | 8f5ba3135d9028c21c8ceb08a0eb67098c755275 | 947a9336b899b923afc4c1fc218b642bf668fcfb | refs/heads/master | 2022-12-17T04:53:11.381000 | 2020-09-13T03:15:02 | 2020-09-13T03:15:02 | 272,709,951 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package model.services;
import java.util.List;
import model.dao.DaoFactory;
import model.dao.UsuarioDao;
import model.entities.Animal;
import model.entities.Usuario;
public class UsuarioService {
private UsuarioDao dao = DaoFactory.createUsuarioDao();
public void insertOrUpdate(Usuario obj) {
if(obj.getIdUsuario() == null) {
dao.insert(obj);
}else {
dao.update(obj);
}
}
public void deleteById(int idUsuario) {
dao.deleteById(idUsuario);
}
public List<Usuario> findAll(){
return dao.findAll();
}
public List<Usuario> findByName(String nomeUsuario){
return dao.findByName(nomeUsuario);
}
public Usuario findByID(int idUsuario){
return dao.findById(idUsuario);
}
}
| UTF-8 | Java | 715 | java | UsuarioService.java | Java | [] | null | [] | package model.services;
import java.util.List;
import model.dao.DaoFactory;
import model.dao.UsuarioDao;
import model.entities.Animal;
import model.entities.Usuario;
public class UsuarioService {
private UsuarioDao dao = DaoFactory.createUsuarioDao();
public void insertOrUpdate(Usuario obj) {
if(obj.getIdUsuario() == null) {
dao.insert(obj);
}else {
dao.update(obj);
}
}
public void deleteById(int idUsuario) {
dao.deleteById(idUsuario);
}
public List<Usuario> findAll(){
return dao.findAll();
}
public List<Usuario> findByName(String nomeUsuario){
return dao.findByName(nomeUsuario);
}
public Usuario findByID(int idUsuario){
return dao.findById(idUsuario);
}
}
| 715 | 0.724476 | 0.724476 | 40 | 16.875 | 16.935448 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.275 | false | false | 4 |
6cdaf57081bf5911dd730bc9c23fdf1471201009 | 4,664,334,486,119 | abbe07a628993b92a37028fa65d37cf44624c319 | /lypoker/src/main/java/com/luyuan/poker/game/poker/round/dealing/ExposePrivateCardsRound.java | 7371c633a27101bf7b37e69acb1fb904a6ec5ea8 | [] | no_license | xuepomh/javademo | https://github.com/xuepomh/javademo | 941af79c59d6026ed78618a7e4476faf6a0d598a | 586d990e0cfdecde9733592bbda448f292e6650c | refs/heads/master | 2016-08-08T20:10:06.854000 | 2015-10-20T10:42:03 | 2015-10-20T10:42:03 | 44,526,537 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.luyuan.poker.game.poker.round.dealing;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.luyuan.poker.game.poker.action.PokerAction;
import com.luyuan.poker.game.poker.adapter.ServerAdapterHolder;
import com.luyuan.poker.game.poker.context.PokerContext;
import com.luyuan.poker.game.poker.hand.ExposeCardsHolder;
import com.luyuan.poker.game.poker.player.PokerPlayer;
import com.luyuan.poker.game.poker.result.RevealOrderCalculator;
import com.luyuan.poker.game.poker.round.Round;
import com.luyuan.poker.game.poker.round.RoundVisitor;
import java.util.List;
public class ExposePrivateCardsRound implements Round {
private static final long serialVersionUID = 1L;
private static transient Logger log = LoggerFactory.getLogger(ExposePrivateCardsRound.class);
private final PokerContext context;
private final ServerAdapterHolder serverAdapterHolder;
public ExposePrivateCardsRound(PokerContext context, ServerAdapterHolder serverAdapterHolder, RevealOrderCalculator revealOrderCalculator) {
this.context = context;
this.serverAdapterHolder = serverAdapterHolder;
exposeShowdownCards(revealOrderCalculator.calculateRevealOrder(
context.getCurrentHandSeatingMap(),
context.getLastPlayerToBeCalled(),
context.getPlayerInDealerSeat(),
context.countNonFoldedPlayers()));
}
/**
* Exposes all pocket cards for players still in the hand
* i.e. not folded. Will set a flag so that sequential calls
* will not generate any outgoing packets.
*
* @param playerRevealOrder the order in which cards should be revealed.
*/
private void exposeShowdownCards(List<Integer> playerRevealOrder) {
ExposeCardsHolder holder = new ExposeCardsHolder();
for (int playerId : playerRevealOrder) {
PokerPlayer player = context.getPlayer(playerId);
if (player == null) {
log.error("Player is null in expose showdown! playerId: " + playerId + " playerMap: " + context.getPlayerMap().values() + " seatingMap: " +
context.getCurrentHandSeatingMap() + " reveal order: " + playerRevealOrder);
continue;
}
if (!player.hasFolded() && !player.isExposingPocketCards()) {
holder.setExposedCards(playerId, player.getPrivatePocketCards());
player.setExposingPocketCards(true);
}
}
if (holder.hasCards()) {
exposePrivateCards(holder);
}
}
private void exposePrivateCards(ExposeCardsHolder holder) {
serverAdapterHolder.get().exposePrivateCards(holder);
}
@Override
public boolean act(PokerAction action) {
log.debug("Perform action not allowed during DealPocketCardsRound. Action received: " + action);
return false;
}
@Override
public String getStateDescription() {
return getClass().getSimpleName();
}
@Override
public boolean isFinished() {
return true;
}
@Override
public void visit(RoundVisitor visitor) {
visitor.visit(this);
}
@Override
public void timeout() {
}
}
| UTF-8 | Java | 3,333 | java | ExposePrivateCardsRound.java | Java | [] | null | [] | package com.luyuan.poker.game.poker.round.dealing;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.luyuan.poker.game.poker.action.PokerAction;
import com.luyuan.poker.game.poker.adapter.ServerAdapterHolder;
import com.luyuan.poker.game.poker.context.PokerContext;
import com.luyuan.poker.game.poker.hand.ExposeCardsHolder;
import com.luyuan.poker.game.poker.player.PokerPlayer;
import com.luyuan.poker.game.poker.result.RevealOrderCalculator;
import com.luyuan.poker.game.poker.round.Round;
import com.luyuan.poker.game.poker.round.RoundVisitor;
import java.util.List;
public class ExposePrivateCardsRound implements Round {
private static final long serialVersionUID = 1L;
private static transient Logger log = LoggerFactory.getLogger(ExposePrivateCardsRound.class);
private final PokerContext context;
private final ServerAdapterHolder serverAdapterHolder;
public ExposePrivateCardsRound(PokerContext context, ServerAdapterHolder serverAdapterHolder, RevealOrderCalculator revealOrderCalculator) {
this.context = context;
this.serverAdapterHolder = serverAdapterHolder;
exposeShowdownCards(revealOrderCalculator.calculateRevealOrder(
context.getCurrentHandSeatingMap(),
context.getLastPlayerToBeCalled(),
context.getPlayerInDealerSeat(),
context.countNonFoldedPlayers()));
}
/**
* Exposes all pocket cards for players still in the hand
* i.e. not folded. Will set a flag so that sequential calls
* will not generate any outgoing packets.
*
* @param playerRevealOrder the order in which cards should be revealed.
*/
private void exposeShowdownCards(List<Integer> playerRevealOrder) {
ExposeCardsHolder holder = new ExposeCardsHolder();
for (int playerId : playerRevealOrder) {
PokerPlayer player = context.getPlayer(playerId);
if (player == null) {
log.error("Player is null in expose showdown! playerId: " + playerId + " playerMap: " + context.getPlayerMap().values() + " seatingMap: " +
context.getCurrentHandSeatingMap() + " reveal order: " + playerRevealOrder);
continue;
}
if (!player.hasFolded() && !player.isExposingPocketCards()) {
holder.setExposedCards(playerId, player.getPrivatePocketCards());
player.setExposingPocketCards(true);
}
}
if (holder.hasCards()) {
exposePrivateCards(holder);
}
}
private void exposePrivateCards(ExposeCardsHolder holder) {
serverAdapterHolder.get().exposePrivateCards(holder);
}
@Override
public boolean act(PokerAction action) {
log.debug("Perform action not allowed during DealPocketCardsRound. Action received: " + action);
return false;
}
@Override
public String getStateDescription() {
return getClass().getSimpleName();
}
@Override
public boolean isFinished() {
return true;
}
@Override
public void visit(RoundVisitor visitor) {
visitor.visit(this);
}
@Override
public void timeout() {
}
}
| 3,333 | 0.667867 | 0.666967 | 90 | 35.033333 | 32.221954 | 155 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.422222 | false | false | 4 |
aaca6afb9be301a7c2e80b26b93486ffe6cd5b03 | 21,182,778,706,547 | 3fc8e9865e8675d5e39493e9e28211acc494af28 | /src/test/java/dukecooks/logic/parser/health/ListRecordCommandParserTest.java | 72fa3c2e766cf81456b0b641fc1197c424801438 | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | AY1920S1-CS2103T-T10-2/main | https://github.com/AY1920S1-CS2103T-T10-2/main | d51e3aa96bb6b63780ebb348139eb074751ee474 | a3516960584f4705adf7c13b3ca3db8e510aaa75 | refs/heads/master | 2020-07-23T06:38:53.970000 | 2019-11-15T12:12:06 | 2019-11-15T12:12:06 | 207,470,044 | 0 | 2 | NOASSERTION | true | 2019-11-14T16:16:28 | 2019-09-10T05:08:18 | 2019-11-14T16:11:26 | 2019-11-14T16:16:28 | 86,357 | 0 | 6 | 14 | Java | false | false | package dukecooks.logic.parser.health;
import java.util.function.Predicate;
import org.junit.jupiter.api.Test;
import dukecooks.commons.core.Messages;
import dukecooks.logic.commands.CommandTestUtil;
import dukecooks.logic.commands.ListCommand;
import dukecooks.logic.commands.health.ListHealthByTypeCommand;
import dukecooks.logic.commands.health.ListHealthCommand;
import dukecooks.logic.parser.CliSyntax;
import dukecooks.logic.parser.CommandParserTestUtil;
import dukecooks.model.health.components.Record;
import dukecooks.model.health.components.Type;
public class ListRecordCommandParserTest {
private static final String REMARK_EMPTY = " " + CliSyntax.PREFIX_REMARK;
private static final String MESSAGE_INVALID_FORMAT =
String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, ListHealthCommand.MESSAGE_USAGE);
private ListRecordCommandParser parser = new ListRecordCommandParser();
@Test
public void parse_invalidPreamble_failure() {
// invalid arguments being parsed as preamble
CommandParserTestUtil.assertParseFailure(parser, "some random string", MESSAGE_INVALID_FORMAT);
// invalid prefix being parsed as preamble
CommandParserTestUtil.assertParseFailure(parser, "zxc/ string", MESSAGE_INVALID_FORMAT);
}
@Test
public void parse_invalidValue_failure() {
CommandParserTestUtil.assertParseFailure(parser, CommandTestUtil.INVALID_TYPE_DESC,
Type.messageConstraints()); // invalid type
CommandParserTestUtil.assertParseFailure(parser, CliSyntax.PREFIX_TYPE + " ",
MESSAGE_INVALID_FORMAT); // empty type arg
}
@Test
public void parse_typeSpecified_success() {
// valid calories
Predicate<Record> expectedPredicate = x -> x.getType()
.equals(Type.valueOf(CommandTestUtil.VALID_TYPE_CALORIES));
ListCommand expectedCommand = new ListHealthByTypeCommand(expectedPredicate);
CommandParserTestUtil.assertParseSuccess(parser, CommandTestUtil.TYPE_DESC_CALORIES, expectedCommand);
// valid glucose
expectedPredicate = x -> x.getType()
.equals(Type.valueOf(CommandTestUtil.VALID_TYPE_GLUCOSE));
expectedCommand = new ListHealthByTypeCommand(expectedPredicate);
CommandParserTestUtil.assertParseSuccess(parser, CommandTestUtil.TYPE_DESC_GLUCOSE, expectedCommand);
}
@Test
public void parse_multipleRepeatedFields_acceptsLast() {
// same repeated fields
Predicate<Record> expectedPredicate = x -> x.getType()
.equals(Type.valueOf(CommandTestUtil.VALID_TYPE_CALORIES));
ListCommand expectedCommand = new ListHealthByTypeCommand(expectedPredicate);
String userInput = CommandTestUtil.TYPE_DESC_CALORIES + CommandTestUtil.TYPE_DESC_CALORIES;
CommandParserTestUtil.assertParseSuccess(parser, userInput, expectedCommand);
// different repeated fields
expectedPredicate = x -> x.getType()
.equals(Type.valueOf(CommandTestUtil.VALID_TYPE_CALORIES));
expectedCommand = new ListHealthByTypeCommand(expectedPredicate);
userInput = CommandTestUtil.TYPE_DESC_GLUCOSE + CommandTestUtil.TYPE_DESC_CALORIES;
CommandParserTestUtil.assertParseSuccess(parser, userInput, expectedCommand);
}
}
| UTF-8 | Java | 3,351 | java | ListRecordCommandParserTest.java | Java | [] | null | [] | package dukecooks.logic.parser.health;
import java.util.function.Predicate;
import org.junit.jupiter.api.Test;
import dukecooks.commons.core.Messages;
import dukecooks.logic.commands.CommandTestUtil;
import dukecooks.logic.commands.ListCommand;
import dukecooks.logic.commands.health.ListHealthByTypeCommand;
import dukecooks.logic.commands.health.ListHealthCommand;
import dukecooks.logic.parser.CliSyntax;
import dukecooks.logic.parser.CommandParserTestUtil;
import dukecooks.model.health.components.Record;
import dukecooks.model.health.components.Type;
public class ListRecordCommandParserTest {
private static final String REMARK_EMPTY = " " + CliSyntax.PREFIX_REMARK;
private static final String MESSAGE_INVALID_FORMAT =
String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, ListHealthCommand.MESSAGE_USAGE);
private ListRecordCommandParser parser = new ListRecordCommandParser();
@Test
public void parse_invalidPreamble_failure() {
// invalid arguments being parsed as preamble
CommandParserTestUtil.assertParseFailure(parser, "some random string", MESSAGE_INVALID_FORMAT);
// invalid prefix being parsed as preamble
CommandParserTestUtil.assertParseFailure(parser, "zxc/ string", MESSAGE_INVALID_FORMAT);
}
@Test
public void parse_invalidValue_failure() {
CommandParserTestUtil.assertParseFailure(parser, CommandTestUtil.INVALID_TYPE_DESC,
Type.messageConstraints()); // invalid type
CommandParserTestUtil.assertParseFailure(parser, CliSyntax.PREFIX_TYPE + " ",
MESSAGE_INVALID_FORMAT); // empty type arg
}
@Test
public void parse_typeSpecified_success() {
// valid calories
Predicate<Record> expectedPredicate = x -> x.getType()
.equals(Type.valueOf(CommandTestUtil.VALID_TYPE_CALORIES));
ListCommand expectedCommand = new ListHealthByTypeCommand(expectedPredicate);
CommandParserTestUtil.assertParseSuccess(parser, CommandTestUtil.TYPE_DESC_CALORIES, expectedCommand);
// valid glucose
expectedPredicate = x -> x.getType()
.equals(Type.valueOf(CommandTestUtil.VALID_TYPE_GLUCOSE));
expectedCommand = new ListHealthByTypeCommand(expectedPredicate);
CommandParserTestUtil.assertParseSuccess(parser, CommandTestUtil.TYPE_DESC_GLUCOSE, expectedCommand);
}
@Test
public void parse_multipleRepeatedFields_acceptsLast() {
// same repeated fields
Predicate<Record> expectedPredicate = x -> x.getType()
.equals(Type.valueOf(CommandTestUtil.VALID_TYPE_CALORIES));
ListCommand expectedCommand = new ListHealthByTypeCommand(expectedPredicate);
String userInput = CommandTestUtil.TYPE_DESC_CALORIES + CommandTestUtil.TYPE_DESC_CALORIES;
CommandParserTestUtil.assertParseSuccess(parser, userInput, expectedCommand);
// different repeated fields
expectedPredicate = x -> x.getType()
.equals(Type.valueOf(CommandTestUtil.VALID_TYPE_CALORIES));
expectedCommand = new ListHealthByTypeCommand(expectedPredicate);
userInput = CommandTestUtil.TYPE_DESC_GLUCOSE + CommandTestUtil.TYPE_DESC_CALORIES;
CommandParserTestUtil.assertParseSuccess(parser, userInput, expectedCommand);
}
}
| 3,351 | 0.737392 | 0.737392 | 80 | 40.887501 | 34.557198 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false | 4 |
cff24b45db9f0a352951f0c369a8ea106ef26349 | 23,158,463,678,715 | fc2da198e6d0ce98a916e4258998c98df8c660ec | /ServerReceiver.java | 6ca60ca3afca82977cb5e73bdafea39d7e307923 | [] | no_license | giacomofiorindo/messagging-system | https://github.com/giacomofiorindo/messagging-system | 5c94cf05bba34f707439aa2aa25577ba0b6ac53a | 8c07a567fd7e76f989245fb8eef05afb5e5401a3 | refs/heads/master | 2020-04-04T15:16:11.415000 | 2018-11-03T23:22:37 | 2018-11-03T23:22:37 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
// Gets messages from client and puts them in a queue, for another
// thread to forward to the appropriate client.
public class ServerReceiver extends Thread {
private String myClientsName;
private BufferedReader myClient;
private ClientTable clientTable;
private ServerSender companion;
private ArrayList<Message> myList;
/**
* Constructs a new server receiver.
*
* @param n
* the name of the client with which this server is communicating
* @param c
* the reader with which this receiver will read data
* @param t
* the table of known clients and connections
* @param s
* the corresponding sender for this receiver
*/
public ServerReceiver(String n, BufferedReader c, ClientTable t, ServerSender s) {
myClientsName = n;
myClient = c;
clientTable = t;
companion = s;
myList = clientTable.getList(myClientsName);
}
/**
* Starts this server receiver.
*/
public void run() {
try {
while (true) {
synchronized (myClient) {
String userInput = myClient.readLine(); // Matches CCCCC in ClientSender.java
if (userInput == null || userInput.equals(Commands.QUIT)) {
// Either end of stream reached, just give up, or user wants to quit
break;
}
if (userInput.equals(Commands.REGISTER)) {
String username = myClient.readLine();
register(username);
continue;
} else if (userInput.equals(Commands.LOGIN)) {
String username = myClient.readLine();
login(username);
continue;
}
//User is moved back to the temp account
if (userInput.equals(Commands.LOGOUT)) {
myClientsName = "temp";
myList = clientTable.getList(myClientsName);
companion.clientList = myList;
print("LOGGED OUT");
continue;
}
if (userInput.equals(Commands.PREVIOUS)) {
if (myList.get(0).getNum() > 1)
updateCurrent(-1);
else
print("ERROR: There aren't previous messages");
continue;
}
if (userInput.equals(Commands.NEXT)) {
if (myList.get(0).getNum() < myList.size() - 1)
updateCurrent(1);
else if (myList.get(0).getNum() < 0)
updateCurrent(3);
else
print("ERROR: There aren't more recent messages");
continue;
}
if (userInput.equals(Commands.DELETE)) {
delete();
continue;
}
if (userInput.equals(Commands.SEND)) {
String recipient = myClient.readLine();
String text = myClient.readLine(); // Matches DDDDD in ClientSender.java
if (recipient.equals("temp")) {
Report.error("'" + recipient + "' cannot receive messages");
continue;
}
if (text != null) {
Message msg = new Message(myClientsName, text);
ArrayList<Message> recipientsList = clientTable.getList(recipient); // Matches EEEEE in
// ServerSender.java
if (recipientsList != null) {
recipientsList.add(msg);
//Increases the current message index. When a new message is sent to the user it
//will become the new current one whatever the current message is.
if (recipientsList.get(0).getNum() != recipientsList.size() - 2)
recipientsList.set(0, new Message("", String.valueOf(recipientsList.size() - 1)));
else
recipientsList.set(0,
new Message("", String.valueOf(recipientsList.get(0).getNum() + 1)));
} else {
Report.error("Message for unexistent client " + recipient + ": " + text);
}
} else {
// No point in closing socket. Just give up.
return;
}
}
}
}
} catch (IOException e) {
Report.error("Something went wrong with the client " + myClientsName + " " + e.getMessage());
// No point in trying to close sockets. Just give up.
// We end this thread (we don't do System.exit(1)).
}
Report.behaviour("Server receiver ending");
companion.interrupt();
}
//When a message is deleted it moves the current message to the previous one
//If it is impossible to the next one
//If there are no messages left it communicates it to the user
private void delete() {
synchronized (myList) {
if (myList.size() == 1) {
print("ERROR: There aren't messages to be deleted");
} else {
myList.remove(Math.abs(myList.get(0).getNum()));
if (myList.get(0).getNum() > 1)
updateCurrent(-1);
else if (Math.abs(myList.get(0).getNum()) < myList.size()) {
//Trick to allow all client connected to the same user to receive the new message
//Only case where the current message index can be negative
if (myList.get(0).getNum() > 0)
updateCurrent(-2);
else
updateCurrent(2);
} else {
print("THERE ARE NO MESSAGES TO BE SHOWN");
myList.set(0, new Message("", String.valueOf(1)));
updateCurrent(-1);
}
}
}
}
private void login(String username) {
if (!clientTable.contains(username)) {
print("ERROR: Unknown username");
} else {
access(username);
companion.clientList = myList;
}
}
private void register(String username) {
if (!clientTable.contains(username)) {
clientTable.add(username);
access(username);
//ArrayList[0] stores the current message. Once a user is created its initial current message is set to zero
myList.add(new Message("", "0"));
companion.clientList = myList;
} else {
print("ERROR: Username already in use");
}
}
synchronized private void updateCurrent(int i) {
myList.set(0, new Message("", String.valueOf(myList.get(0).getNum() + i)));
}
//Change all the information accordingly to the user connected (both in ServerReceiver and ServerSender)
private void access(String username) {
myClientsName = username;
myList = clientTable.getList(myClientsName);
print(Commands.LOGIN);
print("LOGGED IN");
Report.behaviour(myClientsName + " connected");
}
private void print(String message) {
companion.client.println(message);
companion.client.flush();
}
}
| UTF-8 | Java | 6,142 | java | ServerReceiver.java | Java | [] | null | [] |
import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
// Gets messages from client and puts them in a queue, for another
// thread to forward to the appropriate client.
public class ServerReceiver extends Thread {
private String myClientsName;
private BufferedReader myClient;
private ClientTable clientTable;
private ServerSender companion;
private ArrayList<Message> myList;
/**
* Constructs a new server receiver.
*
* @param n
* the name of the client with which this server is communicating
* @param c
* the reader with which this receiver will read data
* @param t
* the table of known clients and connections
* @param s
* the corresponding sender for this receiver
*/
public ServerReceiver(String n, BufferedReader c, ClientTable t, ServerSender s) {
myClientsName = n;
myClient = c;
clientTable = t;
companion = s;
myList = clientTable.getList(myClientsName);
}
/**
* Starts this server receiver.
*/
public void run() {
try {
while (true) {
synchronized (myClient) {
String userInput = myClient.readLine(); // Matches CCCCC in ClientSender.java
if (userInput == null || userInput.equals(Commands.QUIT)) {
// Either end of stream reached, just give up, or user wants to quit
break;
}
if (userInput.equals(Commands.REGISTER)) {
String username = myClient.readLine();
register(username);
continue;
} else if (userInput.equals(Commands.LOGIN)) {
String username = myClient.readLine();
login(username);
continue;
}
//User is moved back to the temp account
if (userInput.equals(Commands.LOGOUT)) {
myClientsName = "temp";
myList = clientTable.getList(myClientsName);
companion.clientList = myList;
print("LOGGED OUT");
continue;
}
if (userInput.equals(Commands.PREVIOUS)) {
if (myList.get(0).getNum() > 1)
updateCurrent(-1);
else
print("ERROR: There aren't previous messages");
continue;
}
if (userInput.equals(Commands.NEXT)) {
if (myList.get(0).getNum() < myList.size() - 1)
updateCurrent(1);
else if (myList.get(0).getNum() < 0)
updateCurrent(3);
else
print("ERROR: There aren't more recent messages");
continue;
}
if (userInput.equals(Commands.DELETE)) {
delete();
continue;
}
if (userInput.equals(Commands.SEND)) {
String recipient = myClient.readLine();
String text = myClient.readLine(); // Matches DDDDD in ClientSender.java
if (recipient.equals("temp")) {
Report.error("'" + recipient + "' cannot receive messages");
continue;
}
if (text != null) {
Message msg = new Message(myClientsName, text);
ArrayList<Message> recipientsList = clientTable.getList(recipient); // Matches EEEEE in
// ServerSender.java
if (recipientsList != null) {
recipientsList.add(msg);
//Increases the current message index. When a new message is sent to the user it
//will become the new current one whatever the current message is.
if (recipientsList.get(0).getNum() != recipientsList.size() - 2)
recipientsList.set(0, new Message("", String.valueOf(recipientsList.size() - 1)));
else
recipientsList.set(0,
new Message("", String.valueOf(recipientsList.get(0).getNum() + 1)));
} else {
Report.error("Message for unexistent client " + recipient + ": " + text);
}
} else {
// No point in closing socket. Just give up.
return;
}
}
}
}
} catch (IOException e) {
Report.error("Something went wrong with the client " + myClientsName + " " + e.getMessage());
// No point in trying to close sockets. Just give up.
// We end this thread (we don't do System.exit(1)).
}
Report.behaviour("Server receiver ending");
companion.interrupt();
}
//When a message is deleted it moves the current message to the previous one
//If it is impossible to the next one
//If there are no messages left it communicates it to the user
private void delete() {
synchronized (myList) {
if (myList.size() == 1) {
print("ERROR: There aren't messages to be deleted");
} else {
myList.remove(Math.abs(myList.get(0).getNum()));
if (myList.get(0).getNum() > 1)
updateCurrent(-1);
else if (Math.abs(myList.get(0).getNum()) < myList.size()) {
//Trick to allow all client connected to the same user to receive the new message
//Only case where the current message index can be negative
if (myList.get(0).getNum() > 0)
updateCurrent(-2);
else
updateCurrent(2);
} else {
print("THERE ARE NO MESSAGES TO BE SHOWN");
myList.set(0, new Message("", String.valueOf(1)));
updateCurrent(-1);
}
}
}
}
private void login(String username) {
if (!clientTable.contains(username)) {
print("ERROR: Unknown username");
} else {
access(username);
companion.clientList = myList;
}
}
private void register(String username) {
if (!clientTable.contains(username)) {
clientTable.add(username);
access(username);
//ArrayList[0] stores the current message. Once a user is created its initial current message is set to zero
myList.add(new Message("", "0"));
companion.clientList = myList;
} else {
print("ERROR: Username already in use");
}
}
synchronized private void updateCurrent(int i) {
myList.set(0, new Message("", String.valueOf(myList.get(0).getNum() + i)));
}
//Change all the information accordingly to the user connected (both in ServerReceiver and ServerSender)
private void access(String username) {
myClientsName = username;
myList = clientTable.getList(myClientsName);
print(Commands.LOGIN);
print("LOGGED IN");
Report.behaviour(myClientsName + " connected");
}
private void print(String message) {
companion.client.println(message);
companion.client.flush();
}
}
| 6,142 | 0.639857 | 0.634321 | 236 | 25.021187 | 25.709663 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.309322 | false | false | 4 |
d15cb8e5efe9b5f343eccbaae1c47b468fa09e37 | 23,433,341,570,788 | 7a5969b9f7eb6645d81ff78556729bd15b130406 | /src/org/raqet/util/FileUtilities.java | 9590c3e74220797464fdeeae0b074b3d76abf400 | [
"Apache-2.0"
] | permissive | norsig/acquisition-server | https://github.com/norsig/acquisition-server | e8a7d24e7a00cd0d808b6b6f404c95207dc6364b | 1742ee5caed4a1c4574cb2d043522bb0f5bca0b8 | refs/heads/master | 2021-01-20T13:39:05.790000 | 2016-11-08T14:28:07 | 2016-11-08T14:28:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (c) 2009-2012, 2015, Netherlands Forensic Institute
* All rights reserved.
*/
package org.raqet.util;
import static com.javaforge.reifier.check.ArgumentChecker.argNotNegative;
import java.io.Closeable;
import java.io.IOException;
/**
* Provides miscellaneous utility methods applicable to files and other types
* of data sources or destinations.
*/
public final class FileUtilities {
// Constructor to prevent instantiation of utility class
private FileUtilities() {
}
/**
* Closes the given {@code resource} if not {@code null}.
* <p>
* The following code illustrates how to use this method.
* If the constructor of {@code FileOutputStream} fails, the object
* {@code out} will be {@code null} and no resource will be closed.
* <pre>
* OutputStream out = null;
* try {
* out = new FileOutputStream(myFile);
* out.write(bytes);
* }
* finally {
* closeResource(out);
* }
* </pre>
*
* @param resource the resource to close, which can be {@code null}
*/
public static void closeResource(final Closeable resource) {
if (resource != null) {
try {
resource.close();
}
catch (final IOException e) {
// How to handle such errors?
}
}
}
/**
* Converts a number of {@code bytes} to a user-friendly text representation.
* <p>
* For example, {@code 2938274582L} will be represented as {@code 2.7G}.
*
* @param bytes the number of bytes
* @return the user-friendly text describing the number of {@code bytes}
*
* @throws IllegalArgumentException if {@code bytes} is negative
*/
public static String toUserFriendlyByteString(final long bytes) {
argNotNegative("bytes", bytes);
if (bytes < 1024L) {
return Long.toString(bytes);
}
long integer = bytes;
for (final char suffix : "kMGTP".toCharArray()) {
final long fraction = (((integer * 10L) / 1024L) % 10L);
integer /= 1024L;
if (integer < 1024L) {
return String.format("%d.%d%c", integer, fraction, suffix);
}
}
// Last suffix, which is 'E' for exabyte
final long fraction = (((integer * 10L) / 1024L) % 10L);
integer /= 1024L;
return String.format("%d.%dE", integer, fraction);
}
}
| UTF-8 | Java | 2,568 | java | FileUtilities.java | Java | [] | null | [] | /*
* Copyright (c) 2009-2012, 2015, Netherlands Forensic Institute
* All rights reserved.
*/
package org.raqet.util;
import static com.javaforge.reifier.check.ArgumentChecker.argNotNegative;
import java.io.Closeable;
import java.io.IOException;
/**
* Provides miscellaneous utility methods applicable to files and other types
* of data sources or destinations.
*/
public final class FileUtilities {
// Constructor to prevent instantiation of utility class
private FileUtilities() {
}
/**
* Closes the given {@code resource} if not {@code null}.
* <p>
* The following code illustrates how to use this method.
* If the constructor of {@code FileOutputStream} fails, the object
* {@code out} will be {@code null} and no resource will be closed.
* <pre>
* OutputStream out = null;
* try {
* out = new FileOutputStream(myFile);
* out.write(bytes);
* }
* finally {
* closeResource(out);
* }
* </pre>
*
* @param resource the resource to close, which can be {@code null}
*/
public static void closeResource(final Closeable resource) {
if (resource != null) {
try {
resource.close();
}
catch (final IOException e) {
// How to handle such errors?
}
}
}
/**
* Converts a number of {@code bytes} to a user-friendly text representation.
* <p>
* For example, {@code 2938274582L} will be represented as {@code 2.7G}.
*
* @param bytes the number of bytes
* @return the user-friendly text describing the number of {@code bytes}
*
* @throws IllegalArgumentException if {@code bytes} is negative
*/
public static String toUserFriendlyByteString(final long bytes) {
argNotNegative("bytes", bytes);
if (bytes < 1024L) {
return Long.toString(bytes);
}
long integer = bytes;
for (final char suffix : "kMGTP".toCharArray()) {
final long fraction = (((integer * 10L) / 1024L) % 10L);
integer /= 1024L;
if (integer < 1024L) {
return String.format("%d.%d%c", integer, fraction, suffix);
}
}
// Last suffix, which is 'E' for exabyte
final long fraction = (((integer * 10L) / 1024L) % 10L);
integer /= 1024L;
return String.format("%d.%dE", integer, fraction);
}
}
| 2,568 | 0.56581 | 0.544003 | 82 | 29.317074 | 25.531845 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.365854 | false | false | 4 |
0c82c5c75caabc24040ff49f7ccf7f7ed0fc18e9 | 3,015,067,086,322 | 79b6587fbd2e5ba6bd0ef4cae427c7047d385e41 | /ACSCImport/src/au/gov/asd/acsc/constellation/plugins/importexport/jdbc/ImportController.java | aef503d91b6a98b5c6d3cbf1410b08020a9044c2 | [
"Apache-2.0"
] | permissive | cdwatman/constellation_cyber_plugins | https://github.com/cdwatman/constellation_cyber_plugins | 7c0122745fb0026745be49737a21ef66726ea0cf | b59b356c5f19f53aed7efe6141244e93ac6401ab | refs/heads/master | 2021-04-19T07:00:10.331000 | 2020-07-23T23:55:47 | 2020-07-23T23:55:47 | 249,589,334 | 1 | 0 | Apache-2.0 | true | 2020-07-14T21:32:35 | 2020-03-24T02:02:40 | 2020-07-14T00:37:23 | 2020-07-14T21:32:34 | 3,646 | 1 | 0 | 0 | Java | false | false | /*
* Copyright 2010-2020 Australian Signals Directorate
*
* 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 au.gov.asd.acsc.constellation.plugins.importexport.jdbc;
import au.gov.asd.tac.constellation.graph.Attribute;
import au.gov.asd.tac.constellation.graph.Graph;
import au.gov.asd.tac.constellation.graph.GraphAttribute;
import au.gov.asd.tac.constellation.graph.GraphElementType;
import au.gov.asd.tac.constellation.graph.GraphReadMethods;
import au.gov.asd.tac.constellation.graph.ReadableGraph;
import au.gov.asd.tac.constellation.graph.attribute.BooleanAttributeDescription;
import au.gov.asd.tac.constellation.graph.file.opener.GraphOpener;
import au.gov.asd.tac.constellation.graph.manager.GraphManager;
import au.gov.asd.tac.constellation.graph.manager.GraphManagerListener;
import au.gov.asd.tac.constellation.graph.schema.SchemaFactory;
import au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute;
import au.gov.asd.tac.constellation.plugins.PluginException;
import au.gov.asd.tac.constellation.plugins.PluginExecutor;
import au.gov.asd.tac.constellation.plugins.importexport.ImportExportPluginRegistry;
import au.gov.asd.tac.constellation.plugins.importexport.ImportExportPreferenceKeys;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.prefs.Preferences;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.TextArea;
import org.openide.util.NbPreferences;
public class ImportController {
/**
* Pseudo-attribute to indicate directed transactions.
*/
public static final String DIRECTED = "__directed__";
/**
* Limit the number of rows shown in the preview.
*/
private static final int PREVIEW_ROW_LIMIT = 100;
private final JDBCImporterStage stage;
private JDBCConnection connection;
private String query;
private String username;
private String password;
private List<String[]> currentData = new ArrayList<>();
private String[] currentColumns = new String[0];
private ConfigurationPane configurationPane;
private boolean schemaInitialised;
private String attributeFilter = "";
private ImportDestination<?> currentDestination;
// Attributes that exist in the graph or schema.
private final Map<String, Attribute> autoAddedVertexAttributes;
private final Map<String, Attribute> autoAddedTransactionAttributes;
// Attributes that have been manually added by the user.
private final Map<String, Attribute> manuallyAddedVertexAttributes;
private final Map<String, Attribute> manuallyAddedTransactionAttributes;
private boolean clearManuallyAdded;
private Map<String, Attribute> displayedVertexAttributes;
private Map<String, Attribute> displayedTransactionAttributes;
private final Set<Integer> keys;
public ImportController(final JDBCImporterStage stage) {
this.stage = stage;
schemaInitialised = true;
autoAddedVertexAttributes = new HashMap<>();
autoAddedTransactionAttributes = new HashMap<>();
manuallyAddedVertexAttributes = new HashMap<>();
manuallyAddedTransactionAttributes = new HashMap<>();
clearManuallyAdded = true;
displayedVertexAttributes = new HashMap<>();
displayedTransactionAttributes = new HashMap<>();
keys = new HashSet<>();
}
public JDBCImporterStage getStage() {
return stage;
}
public ConfigurationPane getConfigurationPane() {
return configurationPane;
}
public void setConfigurationPane(final ConfigurationPane configurationPane) {
this.configurationPane = configurationPane;
if (currentDestination != null) {
setDestination(currentDestination);
}
}
public boolean hasDBConnection() {
return !(connection == null);
}
public void setDBConnection(final JDBCConnection connection) {
this.connection = connection;
}
public void setQuery(String query)
{
this.query = query;
}
public void setUsername(String username)
{
this.username = username;
}
public void setPassword(String password)
{
this.password = password;
}
/**
* Whether the ImportController should clear the manually added attributes
* in setDestination().
* <p>
* Defaults to true, but when attributes have been added manually by a
* loaded template, should be false.
*
* @param b True to cause the manually added attributes to be cleared, false
* otherwise.
*/
public void setClearManuallyAdded(final boolean b) {
clearManuallyAdded = b;
}
public void setDestination(final ImportDestination<?> destination) {
if (destination != null) {
currentDestination = destination;
}
if (currentDestination == null) {
return;
}
// Clearing the manually added attributes removes them when loading a template.
// The destination is set with clearmanuallyAdded true before loading the
// template, so there are no other left-over attributes to clear out after
// loading a template.
if (clearManuallyAdded) {
manuallyAddedVertexAttributes.clear();
manuallyAddedTransactionAttributes.clear();
}
keys.clear();
final boolean showSchemaAttributes = true;
loadAllSchemaAttributes(currentDestination, showSchemaAttributes);
updateDisplayedAttributes();
}
/**
* Load all the schema attributes of the graph
*
* @param destination the destination for the imported data.
* @param showSchemaAttributes specifies whether schema attributes should be
* included.
*/
public void loadAllSchemaAttributes(final ImportDestination<?> destination, final boolean showSchemaAttributes) {
final Graph graph = destination.getGraph();
final ReadableGraph rg = graph.getReadableGraph();
try {
updateAutoAddedAttributes(GraphElementType.VERTEX, autoAddedVertexAttributes, rg, showSchemaAttributes);
updateAutoAddedAttributes(GraphElementType.TRANSACTION, autoAddedTransactionAttributes, rg, showSchemaAttributes);
} finally {
rg.release();
}
}
/**
* True if the specified attribute is known, false otherwise.
* <p>
* Only the auto added attributes are checked.
*
* @param elementType The element type of the attribute.
* @param label The attribute label.
*
* @return True if the specified attribute is known, false otherwise.
*/
public boolean hasAttribute(final GraphElementType elementType, final String label) {
switch (elementType) {
case VERTEX:
return autoAddedVertexAttributes.containsKey(label);
case TRANSACTION:
return autoAddedTransactionAttributes.containsKey(label);
default:
throw new IllegalArgumentException("Element type must be VERTEX or TRANSACTION");
}
}
/**
* Get the specified attribute.
* <p>
* Both the auto added and manually added attributes are checked.
*
* @param elementType The element type of the attribute.
* @param label The attribute label.
*
* @return The specified attribute, or null if the attribute is not found.
*/
public Attribute getAttribute(final GraphElementType elementType, final String label) {
switch (elementType) {
case VERTEX:
return autoAddedVertexAttributes.containsKey(label) ? autoAddedVertexAttributes.get(label) : manuallyAddedVertexAttributes.get(label);
case TRANSACTION:
return autoAddedTransactionAttributes.containsKey(label) ? autoAddedTransactionAttributes.get(label) : manuallyAddedTransactionAttributes.get(label);
default:
throw new IllegalArgumentException("Element type must be VERTEX or TRANSACTION");
}
}
/**
* Get the attributes that will automatically be added to the attribute
* list.
*
* @param elementType
* @param attributes
* @param rg
*/
private void updateAutoAddedAttributes(final GraphElementType elementType, final Map<String, Attribute> attributes, final GraphReadMethods rg, final boolean showSchemaAttributes) {
attributes.clear();
// Add attributes from the graph
int attributeCount = rg.getAttributeCount(elementType);
for (int i = 0; i < attributeCount; i++) {
int attributeId = rg.getAttribute(elementType, i);
Attribute attribute = new GraphAttribute(rg, attributeId);
attributes.put(attribute.getName(), attribute);
}
// Add attributes from the schema
if (showSchemaAttributes && rg.getSchema() != null) {
final SchemaFactory factory = rg.getSchema().getFactory();
for (final SchemaAttribute sattr : factory.getRegisteredAttributes(elementType).values()) {
final Attribute attribute = new GraphAttribute(elementType, sattr.getAttributeType(), sattr.getName(), sattr.getDescription());
if (!attributes.containsKey(attribute.getName())) {
attributes.put(attribute.getName(), attribute);
}
}
}
// Add pseudo-attributes
if (elementType == GraphElementType.TRANSACTION) {
final Attribute attribute = new GraphAttribute(elementType, BooleanAttributeDescription.ATTRIBUTE_NAME, DIRECTED, "Is this transaction directed?");
attributes.put(attribute.getName(), attribute);
}
// Add primary keys
for (int key : rg.getPrimaryKey(elementType)) {
keys.add(key);
}
}
public void deleteAttribute(final Attribute attribute) {
if (attribute.getElementType() == GraphElementType.VERTEX) {
manuallyAddedVertexAttributes.remove(attribute.getName());
} else {
manuallyAddedTransactionAttributes.remove(attribute.getName());
}
if (configurationPane != null) {
configurationPane.deleteAttribute(attribute);
}
}
public void updateDisplayedAttributes() {
if (configurationPane != null) {
displayedVertexAttributes = createDisplayedAttributes(autoAddedVertexAttributes, manuallyAddedVertexAttributes);
displayedTransactionAttributes = createDisplayedAttributes(autoAddedTransactionAttributes, manuallyAddedTransactionAttributes);
for (Attribute attribute : configurationPane.getAllocatedAttributes()) {
if (attribute.getElementType() == GraphElementType.VERTEX) {
if (!displayedVertexAttributes.containsKey(attribute.getName())) {
Attribute newAttribute = new NewAttribute(attribute);
displayedVertexAttributes.put(newAttribute.getName(), newAttribute);
}
} else {
if (!displayedTransactionAttributes.containsKey(attribute.getName())) {
Attribute newAttribute = new NewAttribute(attribute);
displayedTransactionAttributes.put(newAttribute.getName(), newAttribute);
}
}
}
configurationPane.setDisplayedAttributes(displayedVertexAttributes, displayedTransactionAttributes, keys);
}
}
private Map<String, Attribute> createDisplayedAttributes(final Map<String, Attribute> autoAddedAttributes, final Map<String, Attribute> manuallyAddedAttributes) {
final Map<String, Attribute> displayedAttributes = new HashMap<>();
if (attributeFilter != null && attributeFilter.length() > 0) {
for (final String attributeName : autoAddedAttributes.keySet()) {
if (attributeName.toLowerCase().contains(attributeFilter.toLowerCase())) {
displayedAttributes.put(attributeName, autoAddedAttributes.get(attributeName));
}
}
for (final String attributeName : manuallyAddedAttributes.keySet()) {
if (attributeName.toLowerCase().contains(attributeFilter.toLowerCase())) {
displayedAttributes.put(attributeName, manuallyAddedAttributes.get(attributeName));
}
}
} else {
displayedAttributes.putAll(manuallyAddedAttributes);
displayedAttributes.putAll(autoAddedAttributes);
}
return displayedAttributes;
}
public void createManualAttribute(final Attribute attribute) {
Map<String, Attribute> attributes = attribute.getElementType() == GraphElementType.VERTEX ? manuallyAddedVertexAttributes : manuallyAddedTransactionAttributes;
if (!attributes.containsKey(attribute.getName())) {
attributes.put(attribute.getName(), attribute);
if (configurationPane != null) {
updateDisplayedAttributes();
}
}
}
public String showSetDefaultValueDialog(final String attributeName, final String currentDefaultValue) {
DefaultAttributeValueDialog dialog = new DefaultAttributeValueDialog(stage, attributeName, currentDefaultValue);
dialog.showAndWait();
return dialog.getDefaultValue();
}
public ImportDestination<?> getDestination() {
return currentDestination;
}
/**
* A List<ImportDefinition> where each list element corresponds to a
* RunPane tab.
*
* @return A List<ImportDefinition> where each list element
* corresponds to a RunPane tab.
*/
public List<ImportDefinition> getDefinitions() {
return configurationPane.createDefinitions();
}
public void processImport() throws IOException, InterruptedException, PluginException {
final List<ImportDefinition> definitions = configurationPane.createDefinitions();
final Graph importGraph = currentDestination.getGraph();
final boolean schema = schemaInitialised;
if (currentDestination instanceof SchemaDestination) {
GraphManager.getDefault().addGraphManagerListener(new GraphManagerListener() {
boolean opened = false;
@Override
public void graphOpened(Graph graph) {
}
@Override
public void graphClosed(Graph graph) {
}
@Override
public synchronized void newActiveGraph(Graph graph) {
if (graph == importGraph && !opened) {
opened = true;
GraphManager.getDefault().removeGraphManagerListener(this);
PluginExecutor.startWith(ImportJDBCPlugin.class.getName(), false)
.set(ImportJDBCPlugin.DEFINITIONS_PARAMETER_ID, definitions)
.set(ImportJDBCPlugin.CONNECTION_PARAMETER_ID, connection)
.set(ImportJDBCPlugin.SCHEMA_PARAMETER_ID, schema)
.set(ImportJDBCPlugin.QUERY_PARAMETER_ID, query)
.set(ImportJDBCPlugin.USERNAME_PARAMETER_ID, username)
.set(ImportJDBCPlugin.PASSWORD_PARAMETER_ID, password)
.executeWriteLater(importGraph);
}
}
});
GraphOpener.getDefault().openGraph(importGraph, "graph");
} else {
PluginExecutor.startWith(ImportJDBCPlugin.class.getName(), false)
.set(ImportJDBCPlugin.DEFINITIONS_PARAMETER_ID, definitions)
.set(ImportJDBCPlugin.CONNECTION_PARAMETER_ID, connection)
.set(ImportJDBCPlugin.QUERY_PARAMETER_ID, query)
.set(ImportJDBCPlugin.USERNAME_PARAMETER_ID, username)
.set(ImportJDBCPlugin.PASSWORD_PARAMETER_ID, password)
.set(ImportJDBCPlugin.SCHEMA_PARAMETER_ID, schema)
.executeWriteLater(importGraph);
}
}
public void cancelImport() {
stage.close();
}
public void updateSampleData() {
if (connection == null || query == null || query.isBlank()) {
currentColumns = new String[0];
currentData = new ArrayList<>();
} else {
try {
try ( Connection dbConnection = connection.getConnection(username, password))
{
if (!query.toLowerCase().contains(" limit ") && query.toLowerCase().startsWith("select "))
{
query += " limit " + PREVIEW_ROW_LIMIT;
}
try (PreparedStatement ps = dbConnection.prepareStatement(query))
{
try (ResultSet rs = ps.executeQuery())
{
int count = 0;
currentData.clear();
while (rs.next() && count < PREVIEW_ROW_LIMIT)
{
count++;
String[] d = new String[ps.getMetaData().getColumnCount()];
for (int i=0;i<ps.getMetaData().getColumnCount();i++)
{
d[i] = rs.getString(i+1);
}
currentData.add(d);
}
currentColumns = new String[ps.getMetaData().getColumnCount()+1];
currentColumns[0]="Row";
ResultSetMetaData rsmd =ps.getMetaData();
for (int i=0;i< rsmd.getColumnCount(); i++)
{
currentColumns[i+1] = rsmd.getColumnName(i+1);
}
}
}
}
} catch (MalformedURLException | ClassNotFoundException | SQLException | NoSuchMethodException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Query error");
alert.setResizable(true);
TextArea ta = new TextArea(ex.getMessage());
ta.setEditable(false);
ta.setWrapText(true);
alert.getDialogPane().setContent(ta);
alert.showAndWait();
}
}
if (configurationPane != null) {
configurationPane.setSampleData(currentColumns, currentData);
}
}
public void createNewRun() {
if (configurationPane != null) {
configurationPane.createNewRun(displayedVertexAttributes, displayedTransactionAttributes, keys, currentColumns, currentData);
}
}
public boolean isSchemaInitialised() {
return schemaInitialised;
}
public void setSchemaInitialised(final boolean schemaInitialised) {
this.schemaInitialised = schemaInitialised;
}
public void setAttributeFilter(final String attributeFilter) {
this.attributeFilter = attributeFilter;
}
public String[] getCurrentColumns() {
return currentColumns;
}
public List<String[]> getCurrentData() {
return currentData;
}
public Attribute showNewAttributeDialog(final GraphElementType elementType) {
NewAttributeDialog dialog = new NewAttributeDialog(stage, elementType);
dialog.showAndWait();
return dialog.getAttribute();
}
public Set<Integer> getKeys() {
return Collections.unmodifiableSet(keys);
}
}
| UTF-8 | Java | 21,028 | java | ImportController.java | Java | [
{
"context": "ame(String username)\n {\n this.username = username;\n }\n \n public void setPassword(String pa",
"end": 5073,
"score": 0.9410451054573059,
"start": 5065,
"tag": "USERNAME",
"value": "username"
},
{
"context": "ord(String password)\n {\n this.password = password;\n }\n\n /**\n * Whether the ImportControll",
"end": 5169,
"score": 0.9966760277748108,
"start": 5161,
"tag": "PASSWORD",
"value": "password"
}
] | null | [] | /*
* Copyright 2010-2020 Australian Signals Directorate
*
* 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 au.gov.asd.acsc.constellation.plugins.importexport.jdbc;
import au.gov.asd.tac.constellation.graph.Attribute;
import au.gov.asd.tac.constellation.graph.Graph;
import au.gov.asd.tac.constellation.graph.GraphAttribute;
import au.gov.asd.tac.constellation.graph.GraphElementType;
import au.gov.asd.tac.constellation.graph.GraphReadMethods;
import au.gov.asd.tac.constellation.graph.ReadableGraph;
import au.gov.asd.tac.constellation.graph.attribute.BooleanAttributeDescription;
import au.gov.asd.tac.constellation.graph.file.opener.GraphOpener;
import au.gov.asd.tac.constellation.graph.manager.GraphManager;
import au.gov.asd.tac.constellation.graph.manager.GraphManagerListener;
import au.gov.asd.tac.constellation.graph.schema.SchemaFactory;
import au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute;
import au.gov.asd.tac.constellation.plugins.PluginException;
import au.gov.asd.tac.constellation.plugins.PluginExecutor;
import au.gov.asd.tac.constellation.plugins.importexport.ImportExportPluginRegistry;
import au.gov.asd.tac.constellation.plugins.importexport.ImportExportPreferenceKeys;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.prefs.Preferences;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.TextArea;
import org.openide.util.NbPreferences;
public class ImportController {
/**
* Pseudo-attribute to indicate directed transactions.
*/
public static final String DIRECTED = "__directed__";
/**
* Limit the number of rows shown in the preview.
*/
private static final int PREVIEW_ROW_LIMIT = 100;
private final JDBCImporterStage stage;
private JDBCConnection connection;
private String query;
private String username;
private String password;
private List<String[]> currentData = new ArrayList<>();
private String[] currentColumns = new String[0];
private ConfigurationPane configurationPane;
private boolean schemaInitialised;
private String attributeFilter = "";
private ImportDestination<?> currentDestination;
// Attributes that exist in the graph or schema.
private final Map<String, Attribute> autoAddedVertexAttributes;
private final Map<String, Attribute> autoAddedTransactionAttributes;
// Attributes that have been manually added by the user.
private final Map<String, Attribute> manuallyAddedVertexAttributes;
private final Map<String, Attribute> manuallyAddedTransactionAttributes;
private boolean clearManuallyAdded;
private Map<String, Attribute> displayedVertexAttributes;
private Map<String, Attribute> displayedTransactionAttributes;
private final Set<Integer> keys;
public ImportController(final JDBCImporterStage stage) {
this.stage = stage;
schemaInitialised = true;
autoAddedVertexAttributes = new HashMap<>();
autoAddedTransactionAttributes = new HashMap<>();
manuallyAddedVertexAttributes = new HashMap<>();
manuallyAddedTransactionAttributes = new HashMap<>();
clearManuallyAdded = true;
displayedVertexAttributes = new HashMap<>();
displayedTransactionAttributes = new HashMap<>();
keys = new HashSet<>();
}
public JDBCImporterStage getStage() {
return stage;
}
public ConfigurationPane getConfigurationPane() {
return configurationPane;
}
public void setConfigurationPane(final ConfigurationPane configurationPane) {
this.configurationPane = configurationPane;
if (currentDestination != null) {
setDestination(currentDestination);
}
}
public boolean hasDBConnection() {
return !(connection == null);
}
public void setDBConnection(final JDBCConnection connection) {
this.connection = connection;
}
public void setQuery(String query)
{
this.query = query;
}
public void setUsername(String username)
{
this.username = username;
}
public void setPassword(String password)
{
this.password = <PASSWORD>;
}
/**
* Whether the ImportController should clear the manually added attributes
* in setDestination().
* <p>
* Defaults to true, but when attributes have been added manually by a
* loaded template, should be false.
*
* @param b True to cause the manually added attributes to be cleared, false
* otherwise.
*/
public void setClearManuallyAdded(final boolean b) {
clearManuallyAdded = b;
}
public void setDestination(final ImportDestination<?> destination) {
if (destination != null) {
currentDestination = destination;
}
if (currentDestination == null) {
return;
}
// Clearing the manually added attributes removes them when loading a template.
// The destination is set with clearmanuallyAdded true before loading the
// template, so there are no other left-over attributes to clear out after
// loading a template.
if (clearManuallyAdded) {
manuallyAddedVertexAttributes.clear();
manuallyAddedTransactionAttributes.clear();
}
keys.clear();
final boolean showSchemaAttributes = true;
loadAllSchemaAttributes(currentDestination, showSchemaAttributes);
updateDisplayedAttributes();
}
/**
* Load all the schema attributes of the graph
*
* @param destination the destination for the imported data.
* @param showSchemaAttributes specifies whether schema attributes should be
* included.
*/
public void loadAllSchemaAttributes(final ImportDestination<?> destination, final boolean showSchemaAttributes) {
final Graph graph = destination.getGraph();
final ReadableGraph rg = graph.getReadableGraph();
try {
updateAutoAddedAttributes(GraphElementType.VERTEX, autoAddedVertexAttributes, rg, showSchemaAttributes);
updateAutoAddedAttributes(GraphElementType.TRANSACTION, autoAddedTransactionAttributes, rg, showSchemaAttributes);
} finally {
rg.release();
}
}
/**
* True if the specified attribute is known, false otherwise.
* <p>
* Only the auto added attributes are checked.
*
* @param elementType The element type of the attribute.
* @param label The attribute label.
*
* @return True if the specified attribute is known, false otherwise.
*/
public boolean hasAttribute(final GraphElementType elementType, final String label) {
switch (elementType) {
case VERTEX:
return autoAddedVertexAttributes.containsKey(label);
case TRANSACTION:
return autoAddedTransactionAttributes.containsKey(label);
default:
throw new IllegalArgumentException("Element type must be VERTEX or TRANSACTION");
}
}
/**
* Get the specified attribute.
* <p>
* Both the auto added and manually added attributes are checked.
*
* @param elementType The element type of the attribute.
* @param label The attribute label.
*
* @return The specified attribute, or null if the attribute is not found.
*/
public Attribute getAttribute(final GraphElementType elementType, final String label) {
switch (elementType) {
case VERTEX:
return autoAddedVertexAttributes.containsKey(label) ? autoAddedVertexAttributes.get(label) : manuallyAddedVertexAttributes.get(label);
case TRANSACTION:
return autoAddedTransactionAttributes.containsKey(label) ? autoAddedTransactionAttributes.get(label) : manuallyAddedTransactionAttributes.get(label);
default:
throw new IllegalArgumentException("Element type must be VERTEX or TRANSACTION");
}
}
/**
* Get the attributes that will automatically be added to the attribute
* list.
*
* @param elementType
* @param attributes
* @param rg
*/
private void updateAutoAddedAttributes(final GraphElementType elementType, final Map<String, Attribute> attributes, final GraphReadMethods rg, final boolean showSchemaAttributes) {
attributes.clear();
// Add attributes from the graph
int attributeCount = rg.getAttributeCount(elementType);
for (int i = 0; i < attributeCount; i++) {
int attributeId = rg.getAttribute(elementType, i);
Attribute attribute = new GraphAttribute(rg, attributeId);
attributes.put(attribute.getName(), attribute);
}
// Add attributes from the schema
if (showSchemaAttributes && rg.getSchema() != null) {
final SchemaFactory factory = rg.getSchema().getFactory();
for (final SchemaAttribute sattr : factory.getRegisteredAttributes(elementType).values()) {
final Attribute attribute = new GraphAttribute(elementType, sattr.getAttributeType(), sattr.getName(), sattr.getDescription());
if (!attributes.containsKey(attribute.getName())) {
attributes.put(attribute.getName(), attribute);
}
}
}
// Add pseudo-attributes
if (elementType == GraphElementType.TRANSACTION) {
final Attribute attribute = new GraphAttribute(elementType, BooleanAttributeDescription.ATTRIBUTE_NAME, DIRECTED, "Is this transaction directed?");
attributes.put(attribute.getName(), attribute);
}
// Add primary keys
for (int key : rg.getPrimaryKey(elementType)) {
keys.add(key);
}
}
public void deleteAttribute(final Attribute attribute) {
if (attribute.getElementType() == GraphElementType.VERTEX) {
manuallyAddedVertexAttributes.remove(attribute.getName());
} else {
manuallyAddedTransactionAttributes.remove(attribute.getName());
}
if (configurationPane != null) {
configurationPane.deleteAttribute(attribute);
}
}
public void updateDisplayedAttributes() {
if (configurationPane != null) {
displayedVertexAttributes = createDisplayedAttributes(autoAddedVertexAttributes, manuallyAddedVertexAttributes);
displayedTransactionAttributes = createDisplayedAttributes(autoAddedTransactionAttributes, manuallyAddedTransactionAttributes);
for (Attribute attribute : configurationPane.getAllocatedAttributes()) {
if (attribute.getElementType() == GraphElementType.VERTEX) {
if (!displayedVertexAttributes.containsKey(attribute.getName())) {
Attribute newAttribute = new NewAttribute(attribute);
displayedVertexAttributes.put(newAttribute.getName(), newAttribute);
}
} else {
if (!displayedTransactionAttributes.containsKey(attribute.getName())) {
Attribute newAttribute = new NewAttribute(attribute);
displayedTransactionAttributes.put(newAttribute.getName(), newAttribute);
}
}
}
configurationPane.setDisplayedAttributes(displayedVertexAttributes, displayedTransactionAttributes, keys);
}
}
private Map<String, Attribute> createDisplayedAttributes(final Map<String, Attribute> autoAddedAttributes, final Map<String, Attribute> manuallyAddedAttributes) {
final Map<String, Attribute> displayedAttributes = new HashMap<>();
if (attributeFilter != null && attributeFilter.length() > 0) {
for (final String attributeName : autoAddedAttributes.keySet()) {
if (attributeName.toLowerCase().contains(attributeFilter.toLowerCase())) {
displayedAttributes.put(attributeName, autoAddedAttributes.get(attributeName));
}
}
for (final String attributeName : manuallyAddedAttributes.keySet()) {
if (attributeName.toLowerCase().contains(attributeFilter.toLowerCase())) {
displayedAttributes.put(attributeName, manuallyAddedAttributes.get(attributeName));
}
}
} else {
displayedAttributes.putAll(manuallyAddedAttributes);
displayedAttributes.putAll(autoAddedAttributes);
}
return displayedAttributes;
}
public void createManualAttribute(final Attribute attribute) {
Map<String, Attribute> attributes = attribute.getElementType() == GraphElementType.VERTEX ? manuallyAddedVertexAttributes : manuallyAddedTransactionAttributes;
if (!attributes.containsKey(attribute.getName())) {
attributes.put(attribute.getName(), attribute);
if (configurationPane != null) {
updateDisplayedAttributes();
}
}
}
public String showSetDefaultValueDialog(final String attributeName, final String currentDefaultValue) {
DefaultAttributeValueDialog dialog = new DefaultAttributeValueDialog(stage, attributeName, currentDefaultValue);
dialog.showAndWait();
return dialog.getDefaultValue();
}
public ImportDestination<?> getDestination() {
return currentDestination;
}
/**
* A List<ImportDefinition> where each list element corresponds to a
* RunPane tab.
*
* @return A List<ImportDefinition> where each list element
* corresponds to a RunPane tab.
*/
public List<ImportDefinition> getDefinitions() {
return configurationPane.createDefinitions();
}
public void processImport() throws IOException, InterruptedException, PluginException {
final List<ImportDefinition> definitions = configurationPane.createDefinitions();
final Graph importGraph = currentDestination.getGraph();
final boolean schema = schemaInitialised;
if (currentDestination instanceof SchemaDestination) {
GraphManager.getDefault().addGraphManagerListener(new GraphManagerListener() {
boolean opened = false;
@Override
public void graphOpened(Graph graph) {
}
@Override
public void graphClosed(Graph graph) {
}
@Override
public synchronized void newActiveGraph(Graph graph) {
if (graph == importGraph && !opened) {
opened = true;
GraphManager.getDefault().removeGraphManagerListener(this);
PluginExecutor.startWith(ImportJDBCPlugin.class.getName(), false)
.set(ImportJDBCPlugin.DEFINITIONS_PARAMETER_ID, definitions)
.set(ImportJDBCPlugin.CONNECTION_PARAMETER_ID, connection)
.set(ImportJDBCPlugin.SCHEMA_PARAMETER_ID, schema)
.set(ImportJDBCPlugin.QUERY_PARAMETER_ID, query)
.set(ImportJDBCPlugin.USERNAME_PARAMETER_ID, username)
.set(ImportJDBCPlugin.PASSWORD_PARAMETER_ID, password)
.executeWriteLater(importGraph);
}
}
});
GraphOpener.getDefault().openGraph(importGraph, "graph");
} else {
PluginExecutor.startWith(ImportJDBCPlugin.class.getName(), false)
.set(ImportJDBCPlugin.DEFINITIONS_PARAMETER_ID, definitions)
.set(ImportJDBCPlugin.CONNECTION_PARAMETER_ID, connection)
.set(ImportJDBCPlugin.QUERY_PARAMETER_ID, query)
.set(ImportJDBCPlugin.USERNAME_PARAMETER_ID, username)
.set(ImportJDBCPlugin.PASSWORD_PARAMETER_ID, password)
.set(ImportJDBCPlugin.SCHEMA_PARAMETER_ID, schema)
.executeWriteLater(importGraph);
}
}
public void cancelImport() {
stage.close();
}
public void updateSampleData() {
if (connection == null || query == null || query.isBlank()) {
currentColumns = new String[0];
currentData = new ArrayList<>();
} else {
try {
try ( Connection dbConnection = connection.getConnection(username, password))
{
if (!query.toLowerCase().contains(" limit ") && query.toLowerCase().startsWith("select "))
{
query += " limit " + PREVIEW_ROW_LIMIT;
}
try (PreparedStatement ps = dbConnection.prepareStatement(query))
{
try (ResultSet rs = ps.executeQuery())
{
int count = 0;
currentData.clear();
while (rs.next() && count < PREVIEW_ROW_LIMIT)
{
count++;
String[] d = new String[ps.getMetaData().getColumnCount()];
for (int i=0;i<ps.getMetaData().getColumnCount();i++)
{
d[i] = rs.getString(i+1);
}
currentData.add(d);
}
currentColumns = new String[ps.getMetaData().getColumnCount()+1];
currentColumns[0]="Row";
ResultSetMetaData rsmd =ps.getMetaData();
for (int i=0;i< rsmd.getColumnCount(); i++)
{
currentColumns[i+1] = rsmd.getColumnName(i+1);
}
}
}
}
} catch (MalformedURLException | ClassNotFoundException | SQLException | NoSuchMethodException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Query error");
alert.setResizable(true);
TextArea ta = new TextArea(ex.getMessage());
ta.setEditable(false);
ta.setWrapText(true);
alert.getDialogPane().setContent(ta);
alert.showAndWait();
}
}
if (configurationPane != null) {
configurationPane.setSampleData(currentColumns, currentData);
}
}
public void createNewRun() {
if (configurationPane != null) {
configurationPane.createNewRun(displayedVertexAttributes, displayedTransactionAttributes, keys, currentColumns, currentData);
}
}
public boolean isSchemaInitialised() {
return schemaInitialised;
}
public void setSchemaInitialised(final boolean schemaInitialised) {
this.schemaInitialised = schemaInitialised;
}
public void setAttributeFilter(final String attributeFilter) {
this.attributeFilter = attributeFilter;
}
public String[] getCurrentColumns() {
return currentColumns;
}
public List<String[]> getCurrentData() {
return currentData;
}
public Attribute showNewAttributeDialog(final GraphElementType elementType) {
NewAttributeDialog dialog = new NewAttributeDialog(stage, elementType);
dialog.showAndWait();
return dialog.getAttribute();
}
public Set<Integer> getKeys() {
return Collections.unmodifiableSet(keys);
}
}
| 21,030 | 0.638672 | 0.637388 | 520 | 39.438461 | 34.621025 | 217 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.540385 | false | false | 4 |
a227542adb40c2d3ec27042be9cacc8002aab703 | 17,386,027,617,067 | ad8c36506d271bf8ad12dc83325d4ac3d5619663 | /201116041/WrapperTest/src/WrapperTest.java | 15fe60dc4cc81d9f8e580387aa719fdb5a449549 | [] | no_license | NebulaPark/Java | https://github.com/NebulaPark/Java | 3adc66f2bfc8c04b551651aea6a9b1839d036f25 | 1eee33c1261062722350775405c19f6d74d1af28 | refs/heads/master | 2021-01-10T15:52:22.020000 | 2016-11-04T12:56:37 | 2016-11-04T12:56:37 | 45,553,851 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.lang.*;
public class WrapperTest {
public static void main(String[] args) {
/*
//byte
byte b= 12;
Byte ob = new Byte(b);
Byte ob1 =new Byte(b);
String str =ob.toString();
System.out.println("str= " +str);
boolean bo =ob1.equals(ob);
System.out.println("bo= " +bo);
short s = 32;
Short os = new Short(s);
double d= 7.6;
Double od = new Double(d);
String str1 =od.toString();
System.out.println("str1= " +str1);
float f = 32.24f;
Float of = new Float(f);
//๋ฌธ์์ด๋ก ๋ฐ๋๊ฒ ->์์น๋ก..
//string-> ์ซ์
Double dnum = Double.parseDouble(str1);
System.out.println("dnum= " +dnum);
dnum = Double.valueOf(str1);
System.out.println("dnum= " +dnum);
*/
String str1 = "124";
String str2 = "73";
String str3 = "4.987";
int i = Integer.parseInt(str1);
Byte ob = new Byte(str2);
Double od = Double.valueOf(str3);
System.out.println(i);
System.out.println(ob.byteValue());
System.out.println(od.doubleValue());
}
}
| UHC | Java | 1,086 | java | WrapperTest.java | Java | [] | null | [] | import java.lang.*;
public class WrapperTest {
public static void main(String[] args) {
/*
//byte
byte b= 12;
Byte ob = new Byte(b);
Byte ob1 =new Byte(b);
String str =ob.toString();
System.out.println("str= " +str);
boolean bo =ob1.equals(ob);
System.out.println("bo= " +bo);
short s = 32;
Short os = new Short(s);
double d= 7.6;
Double od = new Double(d);
String str1 =od.toString();
System.out.println("str1= " +str1);
float f = 32.24f;
Float of = new Float(f);
//๋ฌธ์์ด๋ก ๋ฐ๋๊ฒ ->์์น๋ก..
//string-> ์ซ์
Double dnum = Double.parseDouble(str1);
System.out.println("dnum= " +dnum);
dnum = Double.valueOf(str1);
System.out.println("dnum= " +dnum);
*/
String str1 = "124";
String str2 = "73";
String str3 = "4.987";
int i = Integer.parseInt(str1);
Byte ob = new Byte(str2);
Double od = Double.valueOf(str3);
System.out.println(i);
System.out.println(ob.byteValue());
System.out.println(od.doubleValue());
}
}
| 1,086 | 0.568738 | 0.538606 | 53 | 18.037735 | 13.844094 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.283019 | false | false | 4 |
2f8d0ebab29a75c98b7658697445926a52b3c7dc | 180,388,631,648 | fe617399dcce328f29b5ecbbc86783d7de674790 | /src/protoss/Dragoon.java | 811f885c95020123abd46e328944d0b53b615075 | [] | no_license | jinau98/javaclass | https://github.com/jinau98/javaclass | ec56f13ad3f7369891d2ed837b305f543827d8ad | 1b6efbd6ec573d69448cc5059989c34e105b7e57 | refs/heads/master | 2020-06-15T01:43:24.955000 | 2019-07-04T09:29:07 | 2019-07-04T09:29:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package protoss;
//object(๊ฐ์ฒด) ์ํ์ ํ๋์ ๊ฐ์ง๋ค.
public class Dragoon {
public Dragoon() {
this(100,100,20,1);
}
//๋งค๊ฐ๋ณ์์ ํ์
์ด๋ ๊ฐ์๊ฐ ๋ค๋ฅด๋ฉด ์ค๋ฒ๋ก๋ฉ
public Dragoon(int st, int sh, int attack, int armor){
this.st=st;
this.sh=sh;
this.attack=attack;
this.armor=armor;
System.out.println("I had returned");
}
final String name="๋๋ผ๊ตฐ";
int st; //์ฒด๋ ฅ
int sh; //์ค๋
int attack;
int armor;
}
| UHC | Java | 472 | java | Dragoon.java | Java | [
{
"context": "println(\"I had returned\");\n\t}\n\tfinal String name=\"๋๋ผ๊ตฐ\";\n\tint st;\t\t//์ฒด๋ ฅ\n\tint sh;\t\t//์ค๋\n\tint attack;\n\tint",
"end": 336,
"score": 0.999853253364563,
"start": 333,
"tag": "NAME",
"value": "๋๋ผ๊ตฐ"
}
] | null | [] | package protoss;
//object(๊ฐ์ฒด) ์ํ์ ํ๋์ ๊ฐ์ง๋ค.
public class Dragoon {
public Dragoon() {
this(100,100,20,1);
}
//๋งค๊ฐ๋ณ์์ ํ์
์ด๋ ๊ฐ์๊ฐ ๋ค๋ฅด๋ฉด ์ค๋ฒ๋ก๋ฉ
public Dragoon(int st, int sh, int attack, int armor){
this.st=st;
this.sh=sh;
this.attack=attack;
this.armor=armor;
System.out.println("I had returned");
}
final String name="๋๋ผ๊ตฐ";
int st; //์ฒด๋ ฅ
int sh; //์ค๋
int attack;
int armor;
}
| 472 | 0.645729 | 0.623116 | 24 | 15.583333 | 12.906447 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false | 4 |
ba061641ea8f2e514ad8a790a67f18ed2859d75b | 20,444,044,346,828 | 1b7b072b7d97b35797c573108b69dc3ff7785a17 | /Lab9/src/com/r177219086/q6/Converter2.java | 85e07939b3ceaf6c46c32f45abc0698bd0ea9cd1 | [] | no_license | geekunny/OOPS | https://github.com/geekunny/OOPS | fad09e7601d579a5caca826d31acb34c81e80a2c | 67030abf4753070af64f533073b9c3af858f9f8a | refs/heads/master | 2023-04-23T17:28:08.801000 | 2021-05-03T09:39:17 | 2021-05-03T09:39:17 | 343,399,025 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.r177219086.q6;
public class Converter2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
float f1=10.02f;
// float to Float
Float f2=new Float(f1);
System.out.println(f2.getClass());
// Float to String
String s1=Float.toString(f2);
System.out.println(s1.getClass());
// String to float
String s2="12.34";
float f3=Float.parseFloat(s2);
System.out.println(f3+1);
// float to String
String s3=String.valueOf(f1);
System.out.println(s3+1);
// String to Float
Float f4=Float.parseFloat(s2);
System.out.println(f4.getClass());
// Float to float
Float f5=20.02f;
float f6=f5.floatValue();
System.out.println(f6);
}
} | UTF-8 | Java | 699 | java | Converter2.java | Java | [] | null | [] | package com.r177219086.q6;
public class Converter2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
float f1=10.02f;
// float to Float
Float f2=new Float(f1);
System.out.println(f2.getClass());
// Float to String
String s1=Float.toString(f2);
System.out.println(s1.getClass());
// String to float
String s2="12.34";
float f3=Float.parseFloat(s2);
System.out.println(f3+1);
// float to String
String s3=String.valueOf(f1);
System.out.println(s3+1);
// String to Float
Float f4=Float.parseFloat(s2);
System.out.println(f4.getClass());
// Float to float
Float f5=20.02f;
float f6=f5.floatValue();
System.out.println(f6);
}
} | 699 | 0.680973 | 0.615165 | 30 | 22.333334 | 11.524853 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.066667 | false | false | 4 |
b11f6e6a23cfae755f514b656b5cec651b5620c9 | 1,821,066,155,022 | fe06f97c2cf33a8b4acb7cb324b79a6cb6bb9dac | /java/dao/CLMS_AP/IWorkitemDAO.java | 5ed14ba0cc5ff519c7aa949a95afce8e3a343528 | [] | no_license | HeimlichLin/TableSchema | https://github.com/HeimlichLin/TableSchema | 3f67dae0b5b169ee3a1b34837ea9a2d34265f175 | 64b66a2968c3a169b75d70d9e5cf75fa3bb65354 | refs/heads/master | 2023-02-11T09:42:47.210000 | 2023-02-01T02:58:44 | 2023-02-01T02:58:44 | 196,526,843 | 0 | 0 | null | false | 2022-06-29T18:53:55 | 2019-07-12T07:03:58 | 2019-11-13T06:10:54 | 2022-06-29T18:53:54 | 452 | 0 | 0 | 4 | Java | false | false | package com.doc.common.dao;
public interface IWorkitemDAO {
}
| UTF-8 | Java | 67 | java | IWorkitemDAO.java | Java | [] | null | [] | package com.doc.common.dao;
public interface IWorkitemDAO {
}
| 67 | 0.731343 | 0.731343 | 5 | 12.4 | 13.994285 | 31 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 4 |
d68765c75780ed7157b92154220b52585691bdf2 | 19,284,403,222,995 | e22b474b2d896820a921fb20c0b1c6235dcaa821 | /app/src/main/java/com/gallosdata/net/responses/BaseResponse.java | 8ce0334b110dadc809782c6791602cf06ddc6306 | [] | no_license | sidmobileapps/gcda | https://github.com/sidmobileapps/gcda | 9f3600656b74eb1e0fe19c87bced639ea6cbedc6 | 8ad2eed8c5be486fcd0f0be72a67a1c69949abcf | refs/heads/master | 2018-12-25T08:56:53.591000 | 2018-12-17T20:27:01 | 2018-12-17T20:27:01 | 140,046,920 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gallosdata.net.responses;
import com.google.gson.annotations.SerializedName;
/**
* Created by apelipets on 4/13/16.
*/
public class BaseResponse {
}
| UTF-8 | Java | 166 | java | BaseResponse.java | Java | [
{
"context": "son.annotations.SerializedName;\n\n/**\n * Created by apelipets on 4/13/16.\n */\npublic class BaseResponse {\n\n}\n",
"end": 118,
"score": 0.9995432496070862,
"start": 109,
"tag": "USERNAME",
"value": "apelipets"
}
] | null | [] | package com.gallosdata.net.responses;
import com.google.gson.annotations.SerializedName;
/**
* Created by apelipets on 4/13/16.
*/
public class BaseResponse {
}
| 166 | 0.746988 | 0.716867 | 10 | 15.6 | 18.461853 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 4 |
8050c59950d4d9e046d5468183cb9a5faef829a0 | 13,846,974,570,969 | 82f337f1ff61debb40433e61f9a43c7eb75cb30e | /cevi-db-client/src/main/java/ch/cevi/db/client/gui/statusbar/StatusBar.java | 03054fa90d9ef98a47b607e02663e6a39d750714 | [
"MIT"
] | permissive | Cevi-Uster/hitobitoclient | https://github.com/Cevi-Uster/hitobitoclient | 796a01e4edaa0210a836e70d35754aa16f7a8a3a | d5d352cadc91f9916a3fa2d8e327ff722100b397 | refs/heads/master | 2023-05-25T21:08:24.341000 | 2023-05-04T15:25:35 | 2023-05-04T15:25:35 | 176,808,707 | 1 | 0 | MIT | false | 2022-06-29T19:51:03 | 2019-03-20T20:06:06 | 2022-01-25T21:21:49 | 2022-06-29T19:51:01 | 701 | 1 | 0 | 0 | Java | false | false | package ch.cevi.db.client.gui.statusbar;
import javax.swing.JPanel;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
public class StatusBar extends JPanel {
public StatusBar() {
initGui();
}
private void initGui() {
FormLayout layout = new FormLayout("5px, left:0px:none, 5px, right:pref:grow, 5px", "pref, 2px");
CellConstraints cc = new CellConstraints();
this.setLayout(layout);
this.add(new MemoryPanelProgressBar(), cc.xy(4, 1));
}
}
| UTF-8 | Java | 506 | java | StatusBar.java | Java | [] | null | [] | package ch.cevi.db.client.gui.statusbar;
import javax.swing.JPanel;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
public class StatusBar extends JPanel {
public StatusBar() {
initGui();
}
private void initGui() {
FormLayout layout = new FormLayout("5px, left:0px:none, 5px, right:pref:grow, 5px", "pref, 2px");
CellConstraints cc = new CellConstraints();
this.setLayout(layout);
this.add(new MemoryPanelProgressBar(), cc.xy(4, 1));
}
}
| 506 | 0.731225 | 0.717391 | 20 | 24.299999 | 25.408857 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.65 | false | false | 4 |
213ac3ba316c6ce7c0a9401644dec06e184dd991 | 13,846,974,569,176 | 54249414267c4e3dfd6f01699e7cc1dc334266e0 | /OldEclipse/src/com/ninetiesteam/classmates/view/meSecondPage/set/FragmentSet.java | 0535b7ca5bd21a736a5d0f1cb30204d9e620c684 | [] | no_license | XiaoWenHan/90TC_Android | https://github.com/XiaoWenHan/90TC_Android | 08464379af2a76750e7904294f004d8f6f13e920 | f29396aa9b5791f4e3ba46931cc859d7d1832627 | refs/heads/master | 2016-08-12T09:35:31.531000 | 2016-03-16T05:19:09 | 2016-03-16T05:19:09 | 53,996,458 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ninetiesteam.classmates.view.meSecondPage.set;
import java.io.File;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.myworkframe.activity.MeBaseFragment;
import com.myworkframe.http.MeFileHttpResponseListener;
import com.myworkframe.http.MeHttpUtil;
import com.myworkframe.http.MeRequestParams;
import com.myworkframe.http.MeStringHttpResponseListener;
import com.myworkframe.util.GetGsondata;
import com.myworkframe.util.MeAppUtil;
import com.myworkframe.view.progress.MeHorizontalProgressBar;
import com.ninetiesteam.classmates.R;
import com.ninetiesteam.classmates.control.method.Sharedprences;
import com.ninetiesteam.classmates.db.CommonDbHelper;
import com.ninetiesteam.classmates.modle.VersionUpdateModel;
import com.ninetiesteam.classmates.push.PushUtil;
import com.ninetiesteam.classmates.utils.Const;
import com.ninetiesteam.classmates.utils.HttpsUtil;
import com.ninetiesteam.classmates.utils.StringPath;
import com.ninetiesteam.classmates.view.login.ActivityLoginRegister;
import com.ninetiesteam.classmates.view.meSecondPage.ActivitySecondPageMe;
import com.ninetiesteam.classmates.view.meSecondPage.set.threePage.FragmentPartTimeInvite;
import com.ninetiesteam.classmates.view.meSecondPage.set.threePage.FragmentSetChangePass;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.umeng.analytics.MobclickAgent;
/**
* ่ฎพ็ฝฎ้กต้ข
*
* @author Administrator
*
*/
public class FragmentSet extends MeBaseFragment implements OnClickListener {
private Button loginOutBtn;
private MeHttpUtil mHttp;
private CommonDbHelper dbHelper;
private MeHorizontalProgressBar mProgressBar;
private TextView numberText, maxText;
private int max = 100;
private int progress = 0;
private Dialog d;
private int mHandlerNumber = 0;
private TimeCount mTimeCount;
private ActivitySecondPageMe mActivity;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
layoutId = R.layout.fragment_set;
mHttp = MeHttpUtil.getInstance(getActivity());
dbHelper = CommonDbHelper.getInstance(getActivity());
mActivity = (ActivitySecondPageMe) getActivity();
d = new Dialog(getActivity());
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.fmSetPartTimeInviteRelative:
FragmentPartTimeInvite invite = new FragmentPartTimeInvite();
addFragment(invite);
break;
case R.id.set_loginout_btn:// ้ๅบ็ปๅฝ
logingOutAction();
break;
case R.id.fmSetChangePassRelative:// ไฟฎๆนๅฏ็
FragmentSetChangePass changePass = new FragmentSetChangePass();
addFragment(changePass);
break;
case R.id.update_version:// ็ๆฌๆดๆฐ
updataVersion();
break;
case R.id.fmSetClearLayout:// ๆธ
้ค็ผๅญ
clearWebViewCache();
mTimeCount.start();
break;
case R.id.fmSetBackLayout:// ่ฟๅ
getActivity().finish();
getActivity().overridePendingTransition(R.anim.remove_out, R.anim.remove_in);
break;
}
}
/**
* ๆธ
้คWebView็ผๅญ
*/
public void clearWebViewCache() {
// ๆธ
็Webview็ผๅญๆฐๆฎๅบ
try {
getActivity().deleteDatabase("webview.db");
getActivity().deleteDatabase("webviewCache.db");
} catch (Exception e) {
e.printStackTrace();
}
// WebView ็ผๅญๆไปถ
File appCacheDir = new File(getActivity().getFilesDir().getAbsolutePath() + StringPath.APP_CACAHE_DIRNAME);
File webviewCacheDir = new File(getActivity().getCacheDir().getAbsolutePath() + "/webviewCache");
// ๅ ้คwebview ็ผๅญ็ฎๅฝ
if (webviewCacheDir.exists()) {
deleteFile(webviewCacheDir);
}
// ๅ ้คwebview ็ผๅญ ็ผๅญ็ฎๅฝ
if (appCacheDir.exists()) {
deleteFile(appCacheDir);
}
// ImageLoader.getInstance().init(mActivity.imageLoaderConfig);
ImageLoader.getInstance().clearDiskCache();
ImageLoader.getInstance().clearMemoryCache();
ImageLoader.getInstance().destroy();
}
/**
* ้ๅฝๅ ้ค ๆไปถ/ๆไปถๅคน
*
* @param file
*/
public void deleteFile(File file) {
System.out.println("delete file path=" + file.getAbsolutePath());
if (file.exists()) {
if (file.isFile()) {
file.delete();
} else if (file.isDirectory()) {
File files[] = file.listFiles();
for (int i = 0; i < files.length; i++) {
deleteFile(files[i]);
}
}
file.delete();
} else {
System.out.println("delete file path=" + file.getAbsolutePath());
;
}
}
/**
* ๆทปๅ fragmentๅๆข
*
* @param fragment
*/
private void addFragment(MeBaseFragment fragment) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.add(R.id.acSecondPageMeFrame, fragment);
transaction.hide(FragmentSet.this);
transaction.addToBackStack(null);
transaction.setCustomAnimations(R.anim.fragment_in, R.anim.fragment_out);
transaction.commit();
}
/**
* ๆง่ก่ชๅจๆดๆฐ
*/
private void IsCheckUpdate(String urlTmp) {
String url = urlTmp;
mHttp.get(url, new MeFileHttpResponseListener(url) {
@Override
public void onStart() {
super.onStart();
View v = LayoutInflater.from(getActivity()).inflate(R.layout.progress_bar_horizontal, null, false);
mProgressBar = (MeHorizontalProgressBar) v.findViewById(R.id.horizontalProgressBar);
numberText = (TextView) v.findViewById(R.id.numberText);
maxText = (TextView) v.findViewById(R.id.maxText);
maxText.setText(progress + "/" + String.valueOf(max));
mProgressBar.setMax(max);
mProgressBar.setProgress(progress);
Dialog d = new Dialog(getActivity());
d.setContentView(v);
d.setTitle("ไธ่ฝฝไธญ....");
d.show();
}
@Override
public void onSuccess(int statusCode, File file) {
super.onSuccess(statusCode, file);
MeAppUtil.installApk(getActivity(), file);
getActivity().finish();
}
@Override
public void onProgress(int bytesWritten, int totalSize) {
super.onProgress(bytesWritten, totalSize);
maxText.setText(bytesWritten / (totalSize / max) + "/" + max);
mProgressBar.setProgress(bytesWritten / (totalSize / max));
}
@Override
public void onFinish() {
super.onFinish();
if (d != null) {
d.cancel();
d = null;
getActivity().finish();
}
getActivity().finish();
}
@Override
public void onFailure(int statusCode, String content, Throwable error) {
super.onFailure(statusCode, content, error);
mActivity.showToast(getActivity(), "่ฝฏไปถๆดๆฐๅคฑ่ดฅ่ฏท็จๅๅ่ฏ๏ผ", 1000);
}
});
}
/**
* ็ๆฌๆดๆฐ
*
* void TODO 2015ๅนด3ๆ27ๆฅ
*/
private void updataVersion() {
PackageInfo pinfo1 = null;
try {
pinfo1 = getActivity().getPackageManager().getPackageInfo("com.ninetiesteam.classmates",
PackageManager.GET_CONFIGURATIONS);
} catch (NameNotFoundException e1) {
e1.printStackTrace();
}
MeRequestParams mParams = new MeRequestParams();
mParams.put("VERSION", pinfo1.versionName);
mParams.put("CLIENTTYPE", "1");
mHttp.post(Const.SYSTEM_VERSION, HttpsUtil.getNewHttpClient(), mParams, new MeStringHttpResponseListener() {
@Override
public void onStart() {
super.onStart();
if (mActivity.mHandler != null) {
mActivity.mHandler.sendEmptyMessage(10);
}
}
@Override
public void onSuccess(int statusCode, String content) {
super.onSuccess(statusCode, content);
try {
VersionUpdateModel model = GetGsondata.getgson(content, VersionUpdateModel.class);
if (model.getHAS_NEW().equals("1")) {
String mes = model.getDESCRIPTION() + "\n่ฝฏไปถๅคงๅฐ:" + model.getSIZE() + "\nๆดๆฐๆถ้ด:"
+ model.getUPDATETIME();
showDialog(mes, model.getDOWNLOAD_URL());
} else {
mActivity.showToast(getActivity(), "ๅฝๅๆฏๆๆฐ็ๆฌ", 1000);
}
} catch (Exception e) {
// TODO: handle exception
}
}
@Override
public void onFailure(int statusCode, String content, Throwable error) {
super.onFailure(statusCode, content, error);
showToast(content);
}
@Override
public void onFinish() {
super.onFinish();
if (mActivity.mHandler != null) {
mActivity.mHandler.sendEmptyMessage(20);
}
}
});
}
private void showDialog(String mes, final String url) {
AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
b.setTitle("ๅ็ฐๆฐ็ๆฌๆฏๅฆๆดๆฐ?");
b.setMessage(mes);
b.setPositiveButton("ๆฏ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
IsCheckUpdate(url);
}
});
b.setNegativeButton("ๅฆ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
b.create();
b.show();
}
/**
* ้ๅบ
*
* void TODO 2015ๅนด3ๆ19ๆฅ
*/
private void logingOutAction() {
MeRequestParams mParams = new MeRequestParams();
if (dbHelper.isExistUser()) {
mParams.put("UID", dbHelper.selectUser().getUID());
} else {
mParams.put("UID", "");
}
mHttp.post(Const.LOGOUT, HttpsUtil.getNewHttpClient(), mParams, new MeStringHttpResponseListener() {
@Override
public void onStart() {
super.onStart();
if (mActivity.mHandler != null) {
mActivity.mHandler.sendEmptyMessage(10);
}
}
@Override
public void onSuccess(int statusCode, String content) {
super.onSuccess(statusCode, content);
mActivity.showToast(getActivity(), "้ๅบๆๅ", 1000);
// ๅ
ณ้ญๆจ้
PushUtil.stopPush(getActivity());
dbHelper.clearUser();
Sharedprences.clearIdState(getActivity());
Intent in = new Intent(getActivity(), ActivityLoginRegister.class);
in.putExtra("IMAGE_NAME", mActivity.mImageName);
in.putExtra("JOB_TYPE", mActivity.mTypeName);
in.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(in);
;
getActivity();
getActivity().setResult(Activity.RESULT_OK);
getActivity().finish();
}
@Override
public void onFailure(int statusCode, String content, Throwable error) {
super.onFailure(statusCode, content, error);
showToast(content);
}
@Override
public void onFinish() {
super.onFinish();
if (mActivity.mHandler != null) {
mActivity.mHandler.sendEmptyMessage(20);
}
}
});
}
@Override
protected void init() {
LinearLayout backLayout = (LinearLayout) getOwnView(R.id.fmSetBackLayout);
RelativeLayout inviteRelative = (RelativeLayout) getOwnView(R.id.fmSetPartTimeInviteRelative);
RelativeLayout clearLayout = (RelativeLayout) getOwnView(R.id.fmSetClearLayout);
RelativeLayout changePassRelative = (RelativeLayout) getOwnView(R.id.fmSetChangePassRelative);
RelativeLayout updateRelative = (RelativeLayout) getOwnView(R.id.update_version);
loginOutBtn = (Button) getOwnView(R.id.set_loginout_btn);
loginOutBtn.setOnClickListener(this);
inviteRelative.setOnClickListener(this);
changePassRelative.setOnClickListener(this);
updateRelative.setOnClickListener(this);
clearLayout.setOnClickListener(this);
backLayout.setOnClickListener(this);
mTimeCount = new TimeCount(1500, 1000);
}
/**
* ๅ่ฎกๆถ
*
* @author Administrator
*
*/
class TimeCount extends CountDownTimer {
public TimeCount(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
@Override
public void onTick(long millisUntilFinished) {
showCProgressDialog("ๆธ
็ไธญ...");
}
@Override
public void onFinish() {
removeCProgressDialog();
mActivity.showToast(getActivity(), "ๆธ
็ๆๅ", 1000);
}
}
@Override
public void onResume() {
super.onResume();
// ๅ็
MobclickAgent.onPageStart("FragmentSet"); // ็ป่ฎก้กต้ข
}
@Override
public void onPause() {
super.onPause();
MobclickAgent.onPageEnd("FragmentSet"); // ็ป่ฎก้กต้ข
}
}
| UTF-8 | Java | 12,391 | java | FragmentSet.java | Java | [
{
"context": "alytics.MobclickAgent;\n\n/**\n * ่ฎพ็ฝฎ้กต้ข\n * \n * @author Administrator\n *\n */\npublic class FragmentSet extends MeBaseFra",
"end": 2015,
"score": 0.5591440200805664,
"start": 2002,
"tag": "USERNAME",
"value": "Administrator"
},
{
"context": "nt(1500, 1000);\n\n\t}\n\n\t/**\n\t * ๅ่ฎกๆถ\n\t * \n\t * @author Administrator\n\t *\n\t */\n\tclass TimeCount extends CountDownTimer ",
"end": 11461,
"score": 0.9850071668624878,
"start": 11448,
"tag": "NAME",
"value": "Administrator"
}
] | null | [] | package com.ninetiesteam.classmates.view.meSecondPage.set;
import java.io.File;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.myworkframe.activity.MeBaseFragment;
import com.myworkframe.http.MeFileHttpResponseListener;
import com.myworkframe.http.MeHttpUtil;
import com.myworkframe.http.MeRequestParams;
import com.myworkframe.http.MeStringHttpResponseListener;
import com.myworkframe.util.GetGsondata;
import com.myworkframe.util.MeAppUtil;
import com.myworkframe.view.progress.MeHorizontalProgressBar;
import com.ninetiesteam.classmates.R;
import com.ninetiesteam.classmates.control.method.Sharedprences;
import com.ninetiesteam.classmates.db.CommonDbHelper;
import com.ninetiesteam.classmates.modle.VersionUpdateModel;
import com.ninetiesteam.classmates.push.PushUtil;
import com.ninetiesteam.classmates.utils.Const;
import com.ninetiesteam.classmates.utils.HttpsUtil;
import com.ninetiesteam.classmates.utils.StringPath;
import com.ninetiesteam.classmates.view.login.ActivityLoginRegister;
import com.ninetiesteam.classmates.view.meSecondPage.ActivitySecondPageMe;
import com.ninetiesteam.classmates.view.meSecondPage.set.threePage.FragmentPartTimeInvite;
import com.ninetiesteam.classmates.view.meSecondPage.set.threePage.FragmentSetChangePass;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.umeng.analytics.MobclickAgent;
/**
* ่ฎพ็ฝฎ้กต้ข
*
* @author Administrator
*
*/
public class FragmentSet extends MeBaseFragment implements OnClickListener {
private Button loginOutBtn;
private MeHttpUtil mHttp;
private CommonDbHelper dbHelper;
private MeHorizontalProgressBar mProgressBar;
private TextView numberText, maxText;
private int max = 100;
private int progress = 0;
private Dialog d;
private int mHandlerNumber = 0;
private TimeCount mTimeCount;
private ActivitySecondPageMe mActivity;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
layoutId = R.layout.fragment_set;
mHttp = MeHttpUtil.getInstance(getActivity());
dbHelper = CommonDbHelper.getInstance(getActivity());
mActivity = (ActivitySecondPageMe) getActivity();
d = new Dialog(getActivity());
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.fmSetPartTimeInviteRelative:
FragmentPartTimeInvite invite = new FragmentPartTimeInvite();
addFragment(invite);
break;
case R.id.set_loginout_btn:// ้ๅบ็ปๅฝ
logingOutAction();
break;
case R.id.fmSetChangePassRelative:// ไฟฎๆนๅฏ็
FragmentSetChangePass changePass = new FragmentSetChangePass();
addFragment(changePass);
break;
case R.id.update_version:// ็ๆฌๆดๆฐ
updataVersion();
break;
case R.id.fmSetClearLayout:// ๆธ
้ค็ผๅญ
clearWebViewCache();
mTimeCount.start();
break;
case R.id.fmSetBackLayout:// ่ฟๅ
getActivity().finish();
getActivity().overridePendingTransition(R.anim.remove_out, R.anim.remove_in);
break;
}
}
/**
* ๆธ
้คWebView็ผๅญ
*/
public void clearWebViewCache() {
// ๆธ
็Webview็ผๅญๆฐๆฎๅบ
try {
getActivity().deleteDatabase("webview.db");
getActivity().deleteDatabase("webviewCache.db");
} catch (Exception e) {
e.printStackTrace();
}
// WebView ็ผๅญๆไปถ
File appCacheDir = new File(getActivity().getFilesDir().getAbsolutePath() + StringPath.APP_CACAHE_DIRNAME);
File webviewCacheDir = new File(getActivity().getCacheDir().getAbsolutePath() + "/webviewCache");
// ๅ ้คwebview ็ผๅญ็ฎๅฝ
if (webviewCacheDir.exists()) {
deleteFile(webviewCacheDir);
}
// ๅ ้คwebview ็ผๅญ ็ผๅญ็ฎๅฝ
if (appCacheDir.exists()) {
deleteFile(appCacheDir);
}
// ImageLoader.getInstance().init(mActivity.imageLoaderConfig);
ImageLoader.getInstance().clearDiskCache();
ImageLoader.getInstance().clearMemoryCache();
ImageLoader.getInstance().destroy();
}
/**
* ้ๅฝๅ ้ค ๆไปถ/ๆไปถๅคน
*
* @param file
*/
public void deleteFile(File file) {
System.out.println("delete file path=" + file.getAbsolutePath());
if (file.exists()) {
if (file.isFile()) {
file.delete();
} else if (file.isDirectory()) {
File files[] = file.listFiles();
for (int i = 0; i < files.length; i++) {
deleteFile(files[i]);
}
}
file.delete();
} else {
System.out.println("delete file path=" + file.getAbsolutePath());
;
}
}
/**
* ๆทปๅ fragmentๅๆข
*
* @param fragment
*/
private void addFragment(MeBaseFragment fragment) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.add(R.id.acSecondPageMeFrame, fragment);
transaction.hide(FragmentSet.this);
transaction.addToBackStack(null);
transaction.setCustomAnimations(R.anim.fragment_in, R.anim.fragment_out);
transaction.commit();
}
/**
* ๆง่ก่ชๅจๆดๆฐ
*/
private void IsCheckUpdate(String urlTmp) {
String url = urlTmp;
mHttp.get(url, new MeFileHttpResponseListener(url) {
@Override
public void onStart() {
super.onStart();
View v = LayoutInflater.from(getActivity()).inflate(R.layout.progress_bar_horizontal, null, false);
mProgressBar = (MeHorizontalProgressBar) v.findViewById(R.id.horizontalProgressBar);
numberText = (TextView) v.findViewById(R.id.numberText);
maxText = (TextView) v.findViewById(R.id.maxText);
maxText.setText(progress + "/" + String.valueOf(max));
mProgressBar.setMax(max);
mProgressBar.setProgress(progress);
Dialog d = new Dialog(getActivity());
d.setContentView(v);
d.setTitle("ไธ่ฝฝไธญ....");
d.show();
}
@Override
public void onSuccess(int statusCode, File file) {
super.onSuccess(statusCode, file);
MeAppUtil.installApk(getActivity(), file);
getActivity().finish();
}
@Override
public void onProgress(int bytesWritten, int totalSize) {
super.onProgress(bytesWritten, totalSize);
maxText.setText(bytesWritten / (totalSize / max) + "/" + max);
mProgressBar.setProgress(bytesWritten / (totalSize / max));
}
@Override
public void onFinish() {
super.onFinish();
if (d != null) {
d.cancel();
d = null;
getActivity().finish();
}
getActivity().finish();
}
@Override
public void onFailure(int statusCode, String content, Throwable error) {
super.onFailure(statusCode, content, error);
mActivity.showToast(getActivity(), "่ฝฏไปถๆดๆฐๅคฑ่ดฅ่ฏท็จๅๅ่ฏ๏ผ", 1000);
}
});
}
/**
* ็ๆฌๆดๆฐ
*
* void TODO 2015ๅนด3ๆ27ๆฅ
*/
private void updataVersion() {
PackageInfo pinfo1 = null;
try {
pinfo1 = getActivity().getPackageManager().getPackageInfo("com.ninetiesteam.classmates",
PackageManager.GET_CONFIGURATIONS);
} catch (NameNotFoundException e1) {
e1.printStackTrace();
}
MeRequestParams mParams = new MeRequestParams();
mParams.put("VERSION", pinfo1.versionName);
mParams.put("CLIENTTYPE", "1");
mHttp.post(Const.SYSTEM_VERSION, HttpsUtil.getNewHttpClient(), mParams, new MeStringHttpResponseListener() {
@Override
public void onStart() {
super.onStart();
if (mActivity.mHandler != null) {
mActivity.mHandler.sendEmptyMessage(10);
}
}
@Override
public void onSuccess(int statusCode, String content) {
super.onSuccess(statusCode, content);
try {
VersionUpdateModel model = GetGsondata.getgson(content, VersionUpdateModel.class);
if (model.getHAS_NEW().equals("1")) {
String mes = model.getDESCRIPTION() + "\n่ฝฏไปถๅคงๅฐ:" + model.getSIZE() + "\nๆดๆฐๆถ้ด:"
+ model.getUPDATETIME();
showDialog(mes, model.getDOWNLOAD_URL());
} else {
mActivity.showToast(getActivity(), "ๅฝๅๆฏๆๆฐ็ๆฌ", 1000);
}
} catch (Exception e) {
// TODO: handle exception
}
}
@Override
public void onFailure(int statusCode, String content, Throwable error) {
super.onFailure(statusCode, content, error);
showToast(content);
}
@Override
public void onFinish() {
super.onFinish();
if (mActivity.mHandler != null) {
mActivity.mHandler.sendEmptyMessage(20);
}
}
});
}
private void showDialog(String mes, final String url) {
AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
b.setTitle("ๅ็ฐๆฐ็ๆฌๆฏๅฆๆดๆฐ?");
b.setMessage(mes);
b.setPositiveButton("ๆฏ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
IsCheckUpdate(url);
}
});
b.setNegativeButton("ๅฆ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
b.create();
b.show();
}
/**
* ้ๅบ
*
* void TODO 2015ๅนด3ๆ19ๆฅ
*/
private void logingOutAction() {
MeRequestParams mParams = new MeRequestParams();
if (dbHelper.isExistUser()) {
mParams.put("UID", dbHelper.selectUser().getUID());
} else {
mParams.put("UID", "");
}
mHttp.post(Const.LOGOUT, HttpsUtil.getNewHttpClient(), mParams, new MeStringHttpResponseListener() {
@Override
public void onStart() {
super.onStart();
if (mActivity.mHandler != null) {
mActivity.mHandler.sendEmptyMessage(10);
}
}
@Override
public void onSuccess(int statusCode, String content) {
super.onSuccess(statusCode, content);
mActivity.showToast(getActivity(), "้ๅบๆๅ", 1000);
// ๅ
ณ้ญๆจ้
PushUtil.stopPush(getActivity());
dbHelper.clearUser();
Sharedprences.clearIdState(getActivity());
Intent in = new Intent(getActivity(), ActivityLoginRegister.class);
in.putExtra("IMAGE_NAME", mActivity.mImageName);
in.putExtra("JOB_TYPE", mActivity.mTypeName);
in.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(in);
;
getActivity();
getActivity().setResult(Activity.RESULT_OK);
getActivity().finish();
}
@Override
public void onFailure(int statusCode, String content, Throwable error) {
super.onFailure(statusCode, content, error);
showToast(content);
}
@Override
public void onFinish() {
super.onFinish();
if (mActivity.mHandler != null) {
mActivity.mHandler.sendEmptyMessage(20);
}
}
});
}
@Override
protected void init() {
LinearLayout backLayout = (LinearLayout) getOwnView(R.id.fmSetBackLayout);
RelativeLayout inviteRelative = (RelativeLayout) getOwnView(R.id.fmSetPartTimeInviteRelative);
RelativeLayout clearLayout = (RelativeLayout) getOwnView(R.id.fmSetClearLayout);
RelativeLayout changePassRelative = (RelativeLayout) getOwnView(R.id.fmSetChangePassRelative);
RelativeLayout updateRelative = (RelativeLayout) getOwnView(R.id.update_version);
loginOutBtn = (Button) getOwnView(R.id.set_loginout_btn);
loginOutBtn.setOnClickListener(this);
inviteRelative.setOnClickListener(this);
changePassRelative.setOnClickListener(this);
updateRelative.setOnClickListener(this);
clearLayout.setOnClickListener(this);
backLayout.setOnClickListener(this);
mTimeCount = new TimeCount(1500, 1000);
}
/**
* ๅ่ฎกๆถ
*
* @author Administrator
*
*/
class TimeCount extends CountDownTimer {
public TimeCount(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
@Override
public void onTick(long millisUntilFinished) {
showCProgressDialog("ๆธ
็ไธญ...");
}
@Override
public void onFinish() {
removeCProgressDialog();
mActivity.showToast(getActivity(), "ๆธ
็ๆๅ", 1000);
}
}
@Override
public void onResume() {
super.onResume();
// ๅ็
MobclickAgent.onPageStart("FragmentSet"); // ็ป่ฎก้กต้ข
}
@Override
public void onPause() {
super.onPause();
MobclickAgent.onPageEnd("FragmentSet"); // ็ป่ฎก้กต้ข
}
}
| 12,391 | 0.719993 | 0.714865 | 428 | 27.245327 | 24.297478 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.609813 | false | false | 4 |
518984a395a4d41091ea8803a604943471ad96c8 | 15,968,688,460,170 | 6bde6c2e1c955c6f5d851b05e184e5e947ea3bf9 | /src/main/java/com/timposu/intel/dao/KabupatenDAO.java | dbfe608d695411d39ed449db4ebbea89e0a338ef | [] | no_license | timposu/bank-data-kjt | https://github.com/timposu/bank-data-kjt | 80bb676ae0abde3d88ea7d67ca80524a15f12b58 | ff4c9ddf8c0c52d09efd1c937c8053b50f3bf16f | refs/heads/master | 2016-08-09T02:10:41.468000 | 2015-10-09T06:15:12 | 2015-10-09T06:15:12 | 43,335,601 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.timposu.intel.dao;
import org.springframework.stereotype.Component;
import com.timposu.intel.GenericDaoMain;
import com.timposu.intel.model.Kabupaten;
@Component
public class KabupatenDAO extends GenericDaoMain<Kabupaten> { }
| UTF-8 | Java | 241 | java | KabupatenDAO.java | Java | [] | null | [] | package com.timposu.intel.dao;
import org.springframework.stereotype.Component;
import com.timposu.intel.GenericDaoMain;
import com.timposu.intel.model.Kabupaten;
@Component
public class KabupatenDAO extends GenericDaoMain<Kabupaten> { }
| 241 | 0.829876 | 0.829876 | 9 | 25.777779 | 22.542688 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 4 |
0e1e3d7d7ec21c0007abf2b0a574a41385ffd1e4 | 23,613,730,207,534 | 17e8438486cb3e3073966ca2c14956d3ba9209ea | /tc-messaging/branches/private/voltron/src/test/java/com/tc/l2/msg/ActiveJoinMessageTest.java | 5d27d21e4b400e693d91a7d5fc4f96cc843dc4c0 | [] | no_license | sirinath/Terracotta | https://github.com/sirinath/Terracotta | fedfc2c4f0f06c990f94b8b6c3b9c93293334345 | 00a7662b9cf530dfdb43f2dd821fa559e998c892 | refs/heads/master | 2021-01-23T05:41:52.414000 | 2015-07-02T15:21:54 | 2015-07-02T15:21:54 | 38,613,711 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright
* notice. All rights reserved.
*/
package com.tc.l2.msg;
import com.tc.io.TCByteBufferInputStream;
import com.tc.io.TCByteBufferOutputStream;
import com.tc.net.GroupID;
import com.tc.net.ServerID;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class ActiveJoinMessageTest {
private void validate(ActiveJoinMessage ajm, ActiveJoinMessage ajm1) {
assertEquals(ajm.getType(), ajm1.getType());
assertEquals(ajm.getMessageID(), ajm1.getMessageID());
assertEquals(ajm.inResponseTo(), ajm1.inResponseTo());
assertEquals(ajm.messageFrom(), ajm1.messageFrom());
assertEquals(ajm.getGroupID(), ajm1.getGroupID());
assertEquals(ajm.getServerID(), ajm1.getServerID());
}
@SuppressWarnings("resource")
private ActiveJoinMessage writeAndRead(ActiveJoinMessage ajm) throws Exception {
TCByteBufferOutputStream bo = new TCByteBufferOutputStream();
ajm.serializeTo(bo);
System.err.println("Written : " + ajm);
TCByteBufferInputStream bi = new TCByteBufferInputStream(bo.toArray());
ActiveJoinMessage ajm1 = new ActiveJoinMessage();
ajm1.deserializeFrom(bi);
System.err.println("Read : " + ajm1);
return ajm1;
}
@Test
public void testBasicSerialization() throws Exception {
ActiveJoinMessage ajm = (ActiveJoinMessage) ActiveJoinMessage
.createActiveJoinMessage(new GroupID(100), new ServerID("30001", new byte[] { 54, -125, 34, -4 }));
ActiveJoinMessage ajm1 = writeAndRead(ajm);
validate(ajm, ajm1);
ajm = (ActiveJoinMessage) ActiveJoinMessage.createActiveLeftMessage(new GroupID(100));
ajm1 = writeAndRead(ajm);
validate(ajm, ajm1);
}
}
| UTF-8 | Java | 1,782 | java | ActiveJoinMessageTest.java | Java | [
{
"context": "/*\n * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted ",
"end": 43,
"score": 0.5207021832466125,
"start": 42,
"tag": "NAME",
"value": "T"
}
] | null | [] | /*
* All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright
* notice. All rights reserved.
*/
package com.tc.l2.msg;
import com.tc.io.TCByteBufferInputStream;
import com.tc.io.TCByteBufferOutputStream;
import com.tc.net.GroupID;
import com.tc.net.ServerID;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class ActiveJoinMessageTest {
private void validate(ActiveJoinMessage ajm, ActiveJoinMessage ajm1) {
assertEquals(ajm.getType(), ajm1.getType());
assertEquals(ajm.getMessageID(), ajm1.getMessageID());
assertEquals(ajm.inResponseTo(), ajm1.inResponseTo());
assertEquals(ajm.messageFrom(), ajm1.messageFrom());
assertEquals(ajm.getGroupID(), ajm1.getGroupID());
assertEquals(ajm.getServerID(), ajm1.getServerID());
}
@SuppressWarnings("resource")
private ActiveJoinMessage writeAndRead(ActiveJoinMessage ajm) throws Exception {
TCByteBufferOutputStream bo = new TCByteBufferOutputStream();
ajm.serializeTo(bo);
System.err.println("Written : " + ajm);
TCByteBufferInputStream bi = new TCByteBufferInputStream(bo.toArray());
ActiveJoinMessage ajm1 = new ActiveJoinMessage();
ajm1.deserializeFrom(bi);
System.err.println("Read : " + ajm1);
return ajm1;
}
@Test
public void testBasicSerialization() throws Exception {
ActiveJoinMessage ajm = (ActiveJoinMessage) ActiveJoinMessage
.createActiveJoinMessage(new GroupID(100), new ServerID("30001", new byte[] { 54, -125, 34, -4 }));
ActiveJoinMessage ajm1 = writeAndRead(ajm);
validate(ajm, ajm1);
ajm = (ActiveJoinMessage) ActiveJoinMessage.createActiveLeftMessage(new GroupID(100));
ajm1 = writeAndRead(ajm);
validate(ajm, ajm1);
}
}
| 1,782 | 0.734007 | 0.709877 | 52 | 33.26923 | 29.577223 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.826923 | false | false | 4 |
a59bb3bb0372a5101dde3cf69bdbcc8631880052 | 5,050,881,543,066 | 6ae2976d45a6e3348464a08b6d6a3f44112def04 | /backend/endingCredit/src/main/java/com/database/endingCredit/domain/user/controller/AccountCountroller.java | b712fe17f1211b5bbc9862a88a0f659fa4d44aa9 | [] | no_license | sywtit/2020DBProject | https://github.com/sywtit/2020DBProject | 5f99160e4cc65bc999cb2c5d305d4446f8f37d4c | 3a8c54bd2a725b0652f1fb21978d688cf118dc22 | refs/heads/main | 2023-03-27T10:34:04.651000 | 2021-03-30T13:39:10 | 2021-03-30T13:39:10 | 319,054,370 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.database.endingCredit.domain.user.controller;
import com.database.endingCredit.domain.user.dto.SignUpDTO;
import com.database.endingCredit.domain.user.dto.UserIdDTO;
import com.database.endingCredit.domain.user.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/account")
public class AccountCountroller {
@Autowired
private AccountService service;
//get account info
@CrossOrigin(origins = "*")
@PostMapping("/info")
@ResponseStatus(value = HttpStatus.OK)
public SignUpDTO getUserInfo(@RequestBody UserIdDTO userIdDTO) {
return service.getinfo(userIdDTO);
}
}
| UTF-8 | Java | 1,108 | java | AccountCountroller.java | Java | [] | null | [] | package com.database.endingCredit.domain.user.controller;
import com.database.endingCredit.domain.user.dto.SignUpDTO;
import com.database.endingCredit.domain.user.dto.UserIdDTO;
import com.database.endingCredit.domain.user.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/account")
public class AccountCountroller {
@Autowired
private AccountService service;
//get account info
@CrossOrigin(origins = "*")
@PostMapping("/info")
@ResponseStatus(value = HttpStatus.OK)
public SignUpDTO getUserInfo(@RequestBody UserIdDTO userIdDTO) {
return service.getinfo(userIdDTO);
}
}
| 1,108 | 0.805054 | 0.805054 | 29 | 37.206898 | 23.720179 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.482759 | false | false | 4 |
81608972e1919fbae4e8111d5fb23533bcb903f9 | 446,676,657,359 | a212cbcde30c23765b143be3c276730a3ab5c337 | /cinnabar-core/src/main/java/cinnabar/core/component/redis/RedisHelper.java | 9a7ec33c8e552f78e750fcf445f21a3ad68d1c27 | [] | no_license | chuningfan/Cinnabar2 | https://github.com/chuningfan/Cinnabar2 | ec4043055e64a7f53ee7ebd67f98a3ed03889468 | 7b50eb366946c7a83b65d28981aef3efe598dcbe | refs/heads/master | 2020-03-17T16:47:30.841000 | 2018-06-04T06:39:33 | 2018-06-04T06:39:33 | 133,762,801 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cinnabar.core.component.redis;
import java.io.IOException;
import org.springframework.data.redis.core.RedisTemplate;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
*
* get object from redis
*
* @author Vic.Chu
*
* @param <K>
* @param <V>
*/
public class RedisHelper<K, V> extends RedisTemplate<K, V> {
public V getObject(Object source, Class<V> clazz) throws JsonParseException, JsonMappingException, IOException {
ObjectMapper mapper = new ObjectMapper();
if (source instanceof String) {
return mapper.readValue(source.toString(), clazz);
} else {
byte[] byteArray = mapper.writeValueAsBytes(source);
return mapper.readerFor(clazz).readValue(byteArray);
}
}
}
| UTF-8 | Java | 828 | java | RedisHelper.java | Java | [
{
"context": ";\n\n/**\n * \n * get object from redis\n * \n * @author Vic.Chu\n *\n * @param <K>\n * @param <V>\n */\npublic class R",
"end": 350,
"score": 0.9998263120651245,
"start": 343,
"tag": "NAME",
"value": "Vic.Chu"
}
] | null | [] | package cinnabar.core.component.redis;
import java.io.IOException;
import org.springframework.data.redis.core.RedisTemplate;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
*
* get object from redis
*
* @author Vic.Chu
*
* @param <K>
* @param <V>
*/
public class RedisHelper<K, V> extends RedisTemplate<K, V> {
public V getObject(Object source, Class<V> clazz) throws JsonParseException, JsonMappingException, IOException {
ObjectMapper mapper = new ObjectMapper();
if (source instanceof String) {
return mapper.readValue(source.toString(), clazz);
} else {
byte[] byteArray = mapper.writeValueAsBytes(source);
return mapper.readerFor(clazz).readValue(byteArray);
}
}
}
| 828 | 0.748792 | 0.748792 | 32 | 24.875 | 27.426891 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.125 | false | false | 4 |
df7447f8b9344beb9b3529a176db2ec0ea81a91e | 8,211,977,531,715 | fef775085cd2035460aa190d7f65f39d494bb757 | /src/main/java/com/javatribe/pojo/AboutManager.java | 78417c41e569cda6a0e4e3d63e3d49134eee7454 | [] | no_license | terasa-J/javatribe | https://github.com/terasa-J/javatribe | b11d79c5801997edfbdfd1e8eda1c5d50ab38483 | a9aa0d861eea5898fe09a5624d1cc9e790fec327 | refs/heads/master | 2021-01-11T07:05:57.509000 | 2017-02-24T08:21:24 | 2017-02-24T08:21:24 | 83,016,164 | 0 | 2 | null | false | 2018-04-01T16:13:26 | 2017-02-24T07:53:40 | 2018-02-11T09:37:00 | 2017-02-24T09:11:22 | 120,929 | 0 | 5 | 1 | Java | false | null | package com.javatribe.pojo;
public class AboutManager {
private Integer id;
private Integer aboutManageId;
private String name;
private String phone;
private String shortPhone;
private String qq;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAboutManageId() {
return aboutManageId;
}
public void setAboutManageId(Integer aboutManageId) {
this.aboutManageId = aboutManageId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getShortPhone() {
return shortPhone;
}
public void setShortPhone(String shortPhone) {
this.shortPhone = shortPhone == null ? null : shortPhone.trim();
}
public String getQq() {
return qq;
}
public void setQq(String qq) {
this.qq = qq == null ? null : qq.trim();
}
} | UTF-8 | Java | 1,266 | java | AboutManager.java | Java | [] | null | [] | package com.javatribe.pojo;
public class AboutManager {
private Integer id;
private Integer aboutManageId;
private String name;
private String phone;
private String shortPhone;
private String qq;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAboutManageId() {
return aboutManageId;
}
public void setAboutManageId(Integer aboutManageId) {
this.aboutManageId = aboutManageId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getShortPhone() {
return shortPhone;
}
public void setShortPhone(String shortPhone) {
this.shortPhone = shortPhone == null ? null : shortPhone.trim();
}
public String getQq() {
return qq;
}
public void setQq(String qq) {
this.qq = qq == null ? null : qq.trim();
}
} | 1,266 | 0.564771 | 0.564771 | 63 | 18.126984 | 18.452419 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.301587 | false | false | 4 |
9cf34791b75129317bac8af086993f479b5cfc28 | 8,211,977,530,493 | cb0ab50c68ca6c69ddc408bf9a948c4812500e2f | /app/src/main/java/com/example/administrator/xiangou/home/adapter/ReferralsAdapterRV.java | 508249df02c31703d28982fdaa02625a162de3da | [
"Apache-2.0"
] | permissive | tj1334311578/xiangou | https://github.com/tj1334311578/xiangou | a9f93a06693c09a13258b237fd4781631b360c15 | ad982dc754ad4d5ce917725523409abf78bc5739 | refs/heads/master | 2020-12-02T22:48:38.470000 | 2017-06-21T14:09:09 | 2017-06-21T14:09:09 | 96,184,570 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.administrator.xiangou.home.adapter;
import android.content.Context;
import android.widget.TextView;
import com.example.administrator.xiangou.R;
import com.example.administrator.xiangou.base.RVBaseAdapter;
import com.example.administrator.xiangou.base.RVBaseViewHolder;
import com.example.administrator.xiangou.home.model.HomeDataBean;
import com.example.administrator.xiangou.tool.CustomImageView;
import java.util.List;
/**
* Created by zhouzongyao on 2017/3/8.
*/
public class ReferralsAdapterRV extends RVBaseAdapter<HomeDataBean.DataBean.GoodsPerfectBean> {
public ReferralsAdapterRV(Context context, int mLayoutResId, List<HomeDataBean.DataBean.GoodsPerfectBean> mDatas) {
super(context, mLayoutResId, mDatas);
}
@Override
protected void bindData(RVBaseViewHolder holder, HomeDataBean.DataBean.GoodsPerfectBean goodsPerfectBean, int position) {
CustomImageView mCustomImageView = holder.getCustomView(R.id.civ_item_referrals_recycle);
if (goodsPerfectBean.getOriginal_img()!=null)
loadImg(goodsPerfectBean.getOriginal_img(),mCustomImageView);
TextView mTextView = holder.getTextView(R.id.tv_item_referrals_recycle);
mTextView.setText(goodsPerfectBean.getName());
}
}
| UTF-8 | Java | 1,278 | java | ReferralsAdapterRV.java | Java | [
{
"context": "eView;\n\nimport java.util.List;\n\n\n/**\n * Created by zhouzongyao on 2017/3/8.\n */\n\npublic class ReferralsAdapterRV",
"end": 475,
"score": 0.9992759823799133,
"start": 464,
"tag": "USERNAME",
"value": "zhouzongyao"
}
] | null | [] | package com.example.administrator.xiangou.home.adapter;
import android.content.Context;
import android.widget.TextView;
import com.example.administrator.xiangou.R;
import com.example.administrator.xiangou.base.RVBaseAdapter;
import com.example.administrator.xiangou.base.RVBaseViewHolder;
import com.example.administrator.xiangou.home.model.HomeDataBean;
import com.example.administrator.xiangou.tool.CustomImageView;
import java.util.List;
/**
* Created by zhouzongyao on 2017/3/8.
*/
public class ReferralsAdapterRV extends RVBaseAdapter<HomeDataBean.DataBean.GoodsPerfectBean> {
public ReferralsAdapterRV(Context context, int mLayoutResId, List<HomeDataBean.DataBean.GoodsPerfectBean> mDatas) {
super(context, mLayoutResId, mDatas);
}
@Override
protected void bindData(RVBaseViewHolder holder, HomeDataBean.DataBean.GoodsPerfectBean goodsPerfectBean, int position) {
CustomImageView mCustomImageView = holder.getCustomView(R.id.civ_item_referrals_recycle);
if (goodsPerfectBean.getOriginal_img()!=null)
loadImg(goodsPerfectBean.getOriginal_img(),mCustomImageView);
TextView mTextView = holder.getTextView(R.id.tv_item_referrals_recycle);
mTextView.setText(goodsPerfectBean.getName());
}
}
| 1,278 | 0.780125 | 0.77543 | 37 | 33.540539 | 37.008102 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.567568 | false | false | 4 |
c899c2d903c1320e85961f5dbd683914371056fe | 16,166,256,961,876 | ee84e66e62d421f7a73dac1071025596695036e2 | /clouddriver-cloudfoundry/src/main/java/com/netflix/spinnaker/clouddriver/cloudfoundry/client/Logs.java | ceb4e165d4b161a9a0e59b8de1e9bd817dbe1f08 | [
"Apache-2.0"
] | permissive | spinnaker/clouddriver | https://github.com/spinnaker/clouddriver | 454918499187caf19aad7fe1aba32dc37fb665e3 | 98204860175e00f8b1e01b43f8fa06670cc4cd2e | refs/heads/master | 2023-09-04T09:32:14.381000 | 2023-08-29T18:44:20 | 2023-08-29T18:44:20 | 37,556,951 | 462 | 1,334 | Apache-2.0 | false | 2023-09-14T03:13:59 | 2015-06-16T21:26:02 | 2023-09-02T06:33:30 | 2023-09-14T03:13:58 | 46,086 | 412 | 1,028 | 24 | Groovy | false | false | /*
* Copyright 2019 Pivotal, Inc.
*
* 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.netflix.spinnaker.clouddriver.cloudfoundry.client;
import static com.netflix.spinnaker.clouddriver.cloudfoundry.client.CloudFoundryClientUtils.safelyCall;
import static java.util.stream.Collectors.joining;
import com.netflix.spinnaker.clouddriver.cloudfoundry.client.api.DopplerService;
import java.util.Comparator;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.cloudfoundry.dropsonde.events.EventFactory.Envelope;
import org.cloudfoundry.dropsonde.events.EventFactory.Envelope.EventType;
import org.cloudfoundry.dropsonde.events.LogFactory.LogMessage;
@RequiredArgsConstructor
public class Logs {
private final DopplerService api;
public String recentApplicationLogs(String applicationGuid, int instanceIndex) {
return recentLogsFiltered(applicationGuid, "APP/PROC/WEB", instanceIndex);
}
public String recentTaskLogs(String applicationGuid, String taskName) {
return recentLogsFiltered(applicationGuid, "APP/TASK/" + taskName, 0);
}
public List<Envelope> recentLogs(String applicationGuid) {
return safelyCall(() -> api.recentLogs(applicationGuid))
.orElseThrow(IllegalStateException::new);
}
private String recentLogsFiltered(
String applicationGuid, String logSourceFilter, int instanceIndex) {
List<Envelope> envelopes = recentLogs(applicationGuid);
return envelopes.stream()
.filter(e -> e.getEventType().equals(EventType.LogMessage))
.map(Envelope::getLogMessage)
.filter(
logMessage ->
logSourceFilter.equals(logMessage.getSourceType())
&& logMessage.getSourceInstance().equals(String.valueOf(instanceIndex)))
.sorted(Comparator.comparingLong(LogMessage::getTimestamp))
.map(msg -> msg.getMessage().toStringUtf8())
.collect(joining("\n"));
}
}
| UTF-8 | Java | 2,445 | java | Logs.java | Java | [] | null | [] | /*
* Copyright 2019 Pivotal, Inc.
*
* 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.netflix.spinnaker.clouddriver.cloudfoundry.client;
import static com.netflix.spinnaker.clouddriver.cloudfoundry.client.CloudFoundryClientUtils.safelyCall;
import static java.util.stream.Collectors.joining;
import com.netflix.spinnaker.clouddriver.cloudfoundry.client.api.DopplerService;
import java.util.Comparator;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.cloudfoundry.dropsonde.events.EventFactory.Envelope;
import org.cloudfoundry.dropsonde.events.EventFactory.Envelope.EventType;
import org.cloudfoundry.dropsonde.events.LogFactory.LogMessage;
@RequiredArgsConstructor
public class Logs {
private final DopplerService api;
public String recentApplicationLogs(String applicationGuid, int instanceIndex) {
return recentLogsFiltered(applicationGuid, "APP/PROC/WEB", instanceIndex);
}
public String recentTaskLogs(String applicationGuid, String taskName) {
return recentLogsFiltered(applicationGuid, "APP/TASK/" + taskName, 0);
}
public List<Envelope> recentLogs(String applicationGuid) {
return safelyCall(() -> api.recentLogs(applicationGuid))
.orElseThrow(IllegalStateException::new);
}
private String recentLogsFiltered(
String applicationGuid, String logSourceFilter, int instanceIndex) {
List<Envelope> envelopes = recentLogs(applicationGuid);
return envelopes.stream()
.filter(e -> e.getEventType().equals(EventType.LogMessage))
.map(Envelope::getLogMessage)
.filter(
logMessage ->
logSourceFilter.equals(logMessage.getSourceType())
&& logMessage.getSourceInstance().equals(String.valueOf(instanceIndex)))
.sorted(Comparator.comparingLong(LogMessage::getTimestamp))
.map(msg -> msg.getMessage().toStringUtf8())
.collect(joining("\n"));
}
}
| 2,445 | 0.752147 | 0.748057 | 62 | 38.435482 | 30.362658 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.483871 | false | false | 4 |
72e45df954f26899e9b22d9e936cbde1f3dcf304 | 28,080,496,235,078 | 5b48715e7fb86e393299f195dbd6e67595477499 | /src/main/java/se/eldfluga/dropwizardlab/DropWizardLabApplication.java | 698ccb1104158c50188bcc2df6eebcf9d47913e5 | [] | no_license | froderik/dropwizardlab | https://github.com/froderik/dropwizardlab | 3f43ebdcf8b5fdedc1a348fdc4b24cddbf4c14b0 | 49a6dd2332d77483e7d6b08a8587647026deb9e2 | refs/heads/master | 2021-01-01T18:22:06.630000 | 2014-05-01T18:47:46 | 2014-05-01T18:47:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package se.eldfluga.dropwizardlab;
import io.dropwizard.Application;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import org.apache.derby.jdbc.EmbeddedDriver;
import org.skife.jdbi.v2.DBI;
import org.skife.jdbi.v2.Handle;
import java.io.File;
public class DropWizardLabApplication extends Application<DropWizardLabConfiguration> {
private DBI dbi;
public static void main(String[] args) throws Exception {
new DropWizardLabApplication().run(args);
}
@Override
public String getName() {
return "dropwizardlab";
}
@Override
public void initialize(Bootstrap<DropWizardLabConfiguration> bootstrap) {
try {
Class.forName(EmbeddedDriver.class.getName());
String dbName = getName() + "db";
if(new File(dbName).exists()) {
dbi = new DBI("jdbc:derby:" + dbName);
} else {
dbi = new DBI("jdbc:derby:" + dbName + ";create=true" );
initializeDatabase();
}
} catch (Exception e) {
e.printStackTrace();
throw new IllegalStateException(e);
}
}
private void initializeDatabase() {
Handle h = dbi.open();
try {
h.execute("create table user_viewers (viewer bigint, viewed bigint, timestamp timestamp)");
h.execute("create index viewed_index on user_viewers(viewed)");
} finally {
h.close();
}
}
@Override
public void run(DropWizardLabConfiguration configuration,
Environment environment) {
final UserViewerResource viewerResource = new UserViewerResource(dbi);
environment.healthChecks().register("roundtrip", new DropWizardLabHealthCheck(viewerResource));
environment.jersey().register(viewerResource);
}
}
| UTF-8 | Java | 1,874 | java | DropWizardLabApplication.java | Java | [] | null | [] | package se.eldfluga.dropwizardlab;
import io.dropwizard.Application;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import org.apache.derby.jdbc.EmbeddedDriver;
import org.skife.jdbi.v2.DBI;
import org.skife.jdbi.v2.Handle;
import java.io.File;
public class DropWizardLabApplication extends Application<DropWizardLabConfiguration> {
private DBI dbi;
public static void main(String[] args) throws Exception {
new DropWizardLabApplication().run(args);
}
@Override
public String getName() {
return "dropwizardlab";
}
@Override
public void initialize(Bootstrap<DropWizardLabConfiguration> bootstrap) {
try {
Class.forName(EmbeddedDriver.class.getName());
String dbName = getName() + "db";
if(new File(dbName).exists()) {
dbi = new DBI("jdbc:derby:" + dbName);
} else {
dbi = new DBI("jdbc:derby:" + dbName + ";create=true" );
initializeDatabase();
}
} catch (Exception e) {
e.printStackTrace();
throw new IllegalStateException(e);
}
}
private void initializeDatabase() {
Handle h = dbi.open();
try {
h.execute("create table user_viewers (viewer bigint, viewed bigint, timestamp timestamp)");
h.execute("create index viewed_index on user_viewers(viewed)");
} finally {
h.close();
}
}
@Override
public void run(DropWizardLabConfiguration configuration,
Environment environment) {
final UserViewerResource viewerResource = new UserViewerResource(dbi);
environment.healthChecks().register("roundtrip", new DropWizardLabHealthCheck(viewerResource));
environment.jersey().register(viewerResource);
}
}
| 1,874 | 0.631804 | 0.630736 | 61 | 29.721312 | 27.107033 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.491803 | false | false | 4 |
8d330b0cec72fc80c6b4a6f6a41ed63f8a43721b | 4,406,636,463,654 | d490827eff7743a1bf453d03df69521bb0d37d81 | /netcoreanodridlibrary/src/main/java/android/mw/com/netcoreanodridlibrary/api/RetrofitBuilder.java | e7d2cff476eed7f25a1fcb225b5ca41f88dc7531 | [] | no_license | xiguanxingxiahuaxian/PrRxMVPLibrary | https://github.com/xiguanxingxiahuaxian/PrRxMVPLibrary | 45a35caaa96ad5826a40efa3d66d9bc96ba51a38 | fe9790fb227a648c8752cdb8d1a95227dacecb62 | refs/heads/master | 2021-09-22T14:37:24.232000 | 2021-09-13T07:59:03 | 2021-09-13T07:59:03 | 144,117,369 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package android.mw.com.netcoreanodridlibrary.api;
import android.app.Application;
import android.mw.com.netcoreanodridlibrary.base.BaseApp;
import android.mw.com.netcoreanodridlibrary.utils.CatcheInterceptor;
import android.mw.com.netcoreanodridlibrary.utils.sslsocketclient;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.File;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* ้กน็ฎๅ็งฐ๏ผIeptproject
* ็ฑปๆ่ฟฐ๏ผ
* ๅๅปบไบบ๏ผmaw@neuqsoft.com
* ๅๅปบๆถ้ด๏ผ 2018/6/22 9:55
* ไฟฎๆนๅคๆณจ
*/
public class RetrofitBuilder {
Retrofit retrofit;
// construct this for a new builder of retrofit
public RetrofitBuilder(NewBuilder newBuilder) {
this.retrofit = newBuilder.retrofit;
}
//return back retrofit
public Retrofit getRetrofit() {
return retrofit;
}
//inner class
public static class NewBuilder {
private String baseUrl;
private Retrofit retrofit;
private RetrofitBuilder retrofitBuilder;
public NewBuilder() {
}
;
// get baseurl
public NewBuilder baseUrl(String baseUrl) {
this.baseUrl = baseUrl;
return this;
}
// init retrofit
public NewBuilder initRetrofit() {
retrofit = new Retrofit.Builder().baseUrl(baseUrl).client(defaultHttpClient(null))
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create(gson()))
.build();
return this;
}
public NewBuilder initRetrofit(Application application) {
retrofit = new Retrofit.Builder().baseUrl(baseUrl).client(defaultHttpClient(application))
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create(gson()))
.build();
return this;
}
//apply build
public RetrofitBuilder Build() {
if (retrofitBuilder == null) {
// wander, you have a retrofitBuilder , not need ohter one of this
retrofitBuilder = new RetrofitBuilder(this);
}
return retrofitBuilder;
}
//gson
private Gson gson() {
return new GsonBuilder().serializeNulls().enableComplexMapKeySerialization().create();
}
//okhttp add net interceptor and set new client
private OkHttpClient defaultHttpClient(Application application) {
// in develope, you can print log
HttpLoggingInterceptor.Level level = HttpLoggingInterceptor.Level.BODY;
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
@Override
public void log(String message) {
Log.i("OkHttpClient", "OkHttpMessage:" + message);
}
});
loggingInterceptor.setLevel(level);
if (application == null) {
return new OkHttpClient.Builder().cache(cache()).addNetworkInterceptor(new CatcheInterceptor())
.sslSocketFactory(sslsocketclient.getSSLSocketFactory()).hostnameVerifier(sslsocketclient.getHostnameVerifier()).addInterceptor(loggingInterceptor)
.build();
} else {
return new OkHttpClient.Builder().addNetworkInterceptor(new CatcheInterceptor()).
sslSocketFactory(sslsocketclient.getSSLSocketFactory()).hostnameVerifier(sslsocketclient.getHostnameVerifier()).addInterceptor(loggingInterceptor)
.build();
}
}
// method of cache
public Cache cache(Application application) {
File file = application.getExternalFilesDir(AppConfig.CATCHE_DIRECTORY);
return new Cache(file, AppConfig.CATCHE_SIZE);
}
public Cache cache() {
File file = BaseApp.getInstance().getExternalFilesDir(AppConfig.CATCHE_DIRECTORY);
return new Cache(file, AppConfig.CATCHE_SIZE);
}
}
}
| UTF-8 | Java | 4,442 | java | RetrofitBuilder.java | Java | [
{
"context": "rFactory;\n\n/**\n * ้กน็ฎๅ็งฐ๏ผIeptproject\n * ็ฑปๆ่ฟฐ๏ผ\n * ๅๅปบไบบ๏ผmaw@neuqsoft.com\n * ๅๅปบๆถ้ด๏ผ 2018/6/22 9:55\n * ไฟฎๆนๅคๆณจ\n */\npublic class ",
"end": 684,
"score": 0.9999281167984009,
"start": 668,
"tag": "EMAIL",
"value": "maw@neuqsoft.com"
}
] | null | [] | package android.mw.com.netcoreanodridlibrary.api;
import android.app.Application;
import android.mw.com.netcoreanodridlibrary.base.BaseApp;
import android.mw.com.netcoreanodridlibrary.utils.CatcheInterceptor;
import android.mw.com.netcoreanodridlibrary.utils.sslsocketclient;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.File;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* ้กน็ฎๅ็งฐ๏ผIeptproject
* ็ฑปๆ่ฟฐ๏ผ
* ๅๅปบไบบ๏ผ<EMAIL>
* ๅๅปบๆถ้ด๏ผ 2018/6/22 9:55
* ไฟฎๆนๅคๆณจ
*/
public class RetrofitBuilder {
Retrofit retrofit;
// construct this for a new builder of retrofit
public RetrofitBuilder(NewBuilder newBuilder) {
this.retrofit = newBuilder.retrofit;
}
//return back retrofit
public Retrofit getRetrofit() {
return retrofit;
}
//inner class
public static class NewBuilder {
private String baseUrl;
private Retrofit retrofit;
private RetrofitBuilder retrofitBuilder;
public NewBuilder() {
}
;
// get baseurl
public NewBuilder baseUrl(String baseUrl) {
this.baseUrl = baseUrl;
return this;
}
// init retrofit
public NewBuilder initRetrofit() {
retrofit = new Retrofit.Builder().baseUrl(baseUrl).client(defaultHttpClient(null))
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create(gson()))
.build();
return this;
}
public NewBuilder initRetrofit(Application application) {
retrofit = new Retrofit.Builder().baseUrl(baseUrl).client(defaultHttpClient(application))
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create(gson()))
.build();
return this;
}
//apply build
public RetrofitBuilder Build() {
if (retrofitBuilder == null) {
// wander, you have a retrofitBuilder , not need ohter one of this
retrofitBuilder = new RetrofitBuilder(this);
}
return retrofitBuilder;
}
//gson
private Gson gson() {
return new GsonBuilder().serializeNulls().enableComplexMapKeySerialization().create();
}
//okhttp add net interceptor and set new client
private OkHttpClient defaultHttpClient(Application application) {
// in develope, you can print log
HttpLoggingInterceptor.Level level = HttpLoggingInterceptor.Level.BODY;
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
@Override
public void log(String message) {
Log.i("OkHttpClient", "OkHttpMessage:" + message);
}
});
loggingInterceptor.setLevel(level);
if (application == null) {
return new OkHttpClient.Builder().cache(cache()).addNetworkInterceptor(new CatcheInterceptor())
.sslSocketFactory(sslsocketclient.getSSLSocketFactory()).hostnameVerifier(sslsocketclient.getHostnameVerifier()).addInterceptor(loggingInterceptor)
.build();
} else {
return new OkHttpClient.Builder().addNetworkInterceptor(new CatcheInterceptor()).
sslSocketFactory(sslsocketclient.getSSLSocketFactory()).hostnameVerifier(sslsocketclient.getHostnameVerifier()).addInterceptor(loggingInterceptor)
.build();
}
}
// method of cache
public Cache cache(Application application) {
File file = application.getExternalFilesDir(AppConfig.CATCHE_DIRECTORY);
return new Cache(file, AppConfig.CATCHE_SIZE);
}
public Cache cache() {
File file = BaseApp.getInstance().getExternalFilesDir(AppConfig.CATCHE_DIRECTORY);
return new Cache(file, AppConfig.CATCHE_SIZE);
}
}
}
| 4,433 | 0.640291 | 0.636653 | 123 | 34.747967 | 33.4133 | 171 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.382114 | false | false | 4 |
b056705c548dc275ccceb462cfa64d995111579b | 4,406,636,464,261 | 54ba1a7d67469d7905120591468ce47b8a591faa | /src/info/nordbyen/Ziputils/transform/StringZipEntryTransformer.java | 8f31a2ae1b1e4f316674af452ba73ea58ba23226 | [] | no_license | Roboten22/SurvivalHeaven | https://github.com/Roboten22/SurvivalHeaven | 21aa26ebf539eeaae9fbc58d798ea2606f55632e | 9232cc8b6f5fafbe298bd846d859e73855af51ce | refs/heads/master | 2021-01-22T08:39:01.276000 | 2015-03-30T23:48:49 | 2015-03-30T23:48:49 | 33,213,356 | 0 | 0 | null | true | 2015-03-31T22:23:23 | 2015-03-31T22:23:23 | 2015-03-30T23:48:50 | 2015-03-30T23:48:49 | 27,733 | 0 | 0 | 0 | null | null | null | /*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <alexmsagen@gmail.com> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Alexander Sagen
* ----------------------------------------------------------------------------
*/
package info.nordbyen.Ziputils.transform;
import info.nordbyen.Ziputils.ByteSource;
import info.nordbyen.Ziputils.commons.IOUtils;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* The Class StringZipEntryTransformer.
*/
public abstract class StringZipEntryTransformer implements ZipEntryTransformer {
/** The encoding. */
private final String encoding;
/**
* Instantiates a new string zip entry transformer.
*/
public StringZipEntryTransformer() {
this(null);
}
/**
* Instantiates a new string zip entry transformer.
*
* @param encoding
* the encoding
*/
public StringZipEntryTransformer(String encoding) {
this.encoding = encoding;
}
/*
* (non-Javadoc)
*
* @see
* info.nordbyen.Ziputils.transform.ZipEntryTransformer#transform(java.io
* .InputStream, java.util.zip.ZipEntry, java.util.zip.ZipOutputStream)
*/
@Override
public void transform(InputStream in, ZipEntry zipEntry, ZipOutputStream out)
throws IOException {
String data = IOUtils.toString(in, encoding);
data = transform(zipEntry, data);
byte[] bytes = encoding == null ? data.getBytes() : data
.getBytes(encoding);
ByteSource source = new ByteSource(zipEntry.getName(), bytes);
ZipEntrySourceZipEntryTransformer.addEntry(source, out);
}
/**
* Transform.
*
* @param zipEntry
* the zip entry
* @param input
* the input
* @return the string
* @throws IOException
* Signals that an I/O exception has occurred.
*/
protected abstract String transform(ZipEntry zipEntry, String input)
throws IOException;
}
| UTF-8 | Java | 2,133 | java | StringZipEntryTransformer.java | Java | [
{
"context": "---\n * \"THE BEER-WARE LICENSE\" (Revision 42):\n * <alexmsagen@gmail.com> wrote this file. As long as you retain this not",
"end": 149,
"score": 0.9999293684959412,
"start": 129,
"tag": "EMAIL",
"value": "alexmsagen@gmail.com"
},
{
"context": "ff is worth it, you can buy me a beer in return. Alexander Sagen\n * ----------------------------------------------",
"end": 364,
"score": 0.9998824000358582,
"start": 349,
"tag": "NAME",
"value": "Alexander Sagen"
}
] | null | [] | /*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <<EMAIL>> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. <NAME>
* ----------------------------------------------------------------------------
*/
package info.nordbyen.Ziputils.transform;
import info.nordbyen.Ziputils.ByteSource;
import info.nordbyen.Ziputils.commons.IOUtils;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* The Class StringZipEntryTransformer.
*/
public abstract class StringZipEntryTransformer implements ZipEntryTransformer {
/** The encoding. */
private final String encoding;
/**
* Instantiates a new string zip entry transformer.
*/
public StringZipEntryTransformer() {
this(null);
}
/**
* Instantiates a new string zip entry transformer.
*
* @param encoding
* the encoding
*/
public StringZipEntryTransformer(String encoding) {
this.encoding = encoding;
}
/*
* (non-Javadoc)
*
* @see
* info.nordbyen.Ziputils.transform.ZipEntryTransformer#transform(java.io
* .InputStream, java.util.zip.ZipEntry, java.util.zip.ZipOutputStream)
*/
@Override
public void transform(InputStream in, ZipEntry zipEntry, ZipOutputStream out)
throws IOException {
String data = IOUtils.toString(in, encoding);
data = transform(zipEntry, data);
byte[] bytes = encoding == null ? data.getBytes() : data
.getBytes(encoding);
ByteSource source = new ByteSource(zipEntry.getName(), bytes);
ZipEntrySourceZipEntryTransformer.addEntry(source, out);
}
/**
* Transform.
*
* @param zipEntry
* the zip entry
* @param input
* the input
* @return the string
* @throws IOException
* Signals that an I/O exception has occurred.
*/
protected abstract String transform(ZipEntry zipEntry, String input)
throws IOException;
}
| 2,111 | 0.656821 | 0.655884 | 75 | 27.440001 | 26.099932 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.173333 | false | false | 4 |
d10c5c72fcd65bd28bc3dffaf7e24e5214002ffb | 3,049,426,785,917 | 20aeb38ce620097eda9897160f886abcf3c8d7f9 | /Dostringu.java | 6a66ac9f5c7c589a7656d28f4e0a67405533f3ba | [] | no_license | Gabriela-Kowalczuk/Java-exercises3 | https://github.com/Gabriela-Kowalczuk/Java-exercises3 | 6b59946e5b8b59a1acaeb184014b6142ef3cb401 | e7c3ba5ec4a094b1ce779794b96f40386e46e25c | refs/heads/master | 2022-11-05T21:48:25.298000 | 2020-06-21T21:19:18 | 2020-06-21T21:19:18 | 273,982,670 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package GabrielaK;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
import java.util.Scanner;
public class Dostringu {
int dzien;
int miesiac;
int rok;
public int getDzien() {
return dzien;
}
public void setDzien(int dzien) {
this.dzien = dzien;
}
public int getMiesiac() {
return miesiac;
}
public void setMiesiac(int miesiac) {
this.miesiac = miesiac;
}
public int getRok() {
return rok;
}
public void setRok(int rok) {
this.rok = rok;
}
public static String[] miesiact = { "","styczen", "luty", "marzec", "kwiecieล", "maj", "czerwiec", "lipiec", "sierpieล",
"wrzesieล", "paลผdziernik", "listopad", "grudzien"};
public static String[] dzien_tyg = { "poniedzialek", "wtorek", "sroda", "czwartek", "piatek", "sobota",
"niedziela"};
public static int liczbaDni[] =
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
public static boolean przestepny(int rok) {
return ((rok % 4 == 0 && rok % 100 != 0) || rok % 400 == 0);
}
public static int dzienTygodnia(int dzien, int miesiac, int rok) {
int yy, c, g;
int wynik;
int dzienRoku = dzien + liczbaDni[miesiac - 1];
if ((miesiac > 2) && (przestepny(rok) ==true))
dzienRoku++;
yy = (rok - 1) % 100;
c = (rok - 1) - yy;
g = yy + (yy / 4);
wynik = (((((c / 100) % 4) * 5) + g) % 7);
wynik += dzienRoku - 1;
wynik %= 7;
return wynik;
}
public static String[] getDzien_tyg() {
return dzien_tyg;
}
public String toString(int dzien, int miesiac, int rok) {
return " {" +
"dzien = " + dzien_tyg[dzienTygodnia(dzien, miesiac, rok)] +" "+
+dzien+
", miesiac = " + miesiact[miesiac] +
", rok = " + rok +
'}';
}
}
| UTF-8 | Java | 2,168 | java | Dostringu.java | Java | [
{
"context": "lipiec\", \"sierpieล\",\r\n \"wrzesieล\", \"paลผdziernik\", \"listopad\", \"grudzien\"};\r\n public static Str",
"end": 851,
"score": 0.6240274906158447,
"start": 843,
"tag": "NAME",
"value": "dziernik"
}
] | null | [] | package GabrielaK;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
import java.util.Scanner;
public class Dostringu {
int dzien;
int miesiac;
int rok;
public int getDzien() {
return dzien;
}
public void setDzien(int dzien) {
this.dzien = dzien;
}
public int getMiesiac() {
return miesiac;
}
public void setMiesiac(int miesiac) {
this.miesiac = miesiac;
}
public int getRok() {
return rok;
}
public void setRok(int rok) {
this.rok = rok;
}
public static String[] miesiact = { "","styczen", "luty", "marzec", "kwiecieล", "maj", "czerwiec", "lipiec", "sierpieล",
"wrzesieล", "paลผdziernik", "listopad", "grudzien"};
public static String[] dzien_tyg = { "poniedzialek", "wtorek", "sroda", "czwartek", "piatek", "sobota",
"niedziela"};
public static int liczbaDni[] =
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
public static boolean przestepny(int rok) {
return ((rok % 4 == 0 && rok % 100 != 0) || rok % 400 == 0);
}
public static int dzienTygodnia(int dzien, int miesiac, int rok) {
int yy, c, g;
int wynik;
int dzienRoku = dzien + liczbaDni[miesiac - 1];
if ((miesiac > 2) && (przestepny(rok) ==true))
dzienRoku++;
yy = (rok - 1) % 100;
c = (rok - 1) - yy;
g = yy + (yy / 4);
wynik = (((((c / 100) % 4) * 5) + g) % 7);
wynik += dzienRoku - 1;
wynik %= 7;
return wynik;
}
public static String[] getDzien_tyg() {
return dzien_tyg;
}
public String toString(int dzien, int miesiac, int rok) {
return " {" +
"dzien = " + dzien_tyg[dzienTygodnia(dzien, miesiac, rok)] +" "+
+dzien+
", miesiac = " + miesiact[miesiac] +
", rok = " + rok +
'}';
}
}
| 2,168 | 0.494917 | 0.468577 | 92 | 21.456522 | 24.375422 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.804348 | false | false | 4 |
fabb885ab48a80c9c07fee4a5f19545d786e5690 | 20,091,857,029,268 | 88fb8cfa813558f681e621cf6f968b616bb90ebb | /src/main/java/com/revomatico/internship2019/demo1/model/ModelHandler.java | d561b00a403012d3e51adb933c08f9053ee0f78a | [
"Apache-2.0"
] | permissive | Revomatico/java-internship-2019 | https://github.com/Revomatico/java-internship-2019 | 72916061dffa48e2bec506581c0a5352b6b827df | 779b7ced86a8f2f0090f9fe9d2f1dbb1737bd595 | refs/heads/master | 2020-06-14T12:56:41.815000 | 2019-07-25T10:21:21 | 2019-07-25T10:21:21 | 195,010,144 | 4 | 6 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.revomatico.internship2019.demo1.model;
public class ModelHandler {
}
| UTF-8 | Java | 82 | java | ModelHandler.java | Java | [] | null | [] | package com.revomatico.internship2019.demo1.model;
public class ModelHandler {
}
| 82 | 0.817073 | 0.756098 | 4 | 19.5 | 20.670027 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 4 |
5beeddf3d5ef0d3ae0f8c7d2588a79832cf81478 | 22,153,441,368,138 | d1371a773d8a1277c50bf063bbbb264cc453c8f9 | /app/src/main/java/cs4720/cs/virginia/edu/checklist/DeleteDropboxFile.java | 4febfd18672ecfcf0fab7cc8c8f64bede54cb40f | [] | no_license | PikachuXD/CheckList | https://github.com/PikachuXD/CheckList | e44842badc4161753bd04d3b7dfca95334c35021 | 05525f4d23f6adb3f541f4245dce9d51519bb754 | refs/heads/master | 2021-01-13T02:23:26.840000 | 2015-12-04T08:18:20 | 2015-12-04T08:18:20 | 42,563,877 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cs4720.cs.virginia.edu.checklist;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Handler;
import android.widget.Toast;
import com.dropbox.client2.DropboxAPI;
import com.dropbox.client2.exception.DropboxException;
/**
* Created by rbk on 12/3/15.
*/
public class DeleteDropboxFile extends AsyncTask<Void, Void, Boolean> {
private DropboxAPI<?> dropbox;
private String path;
private Context context;
private String fileName;
public DeleteDropboxFile(Context context, DropboxAPI<?> dropbox,
String path, String fileName) {
this.context = context;
this.fileName = fileName;
this.dropbox = dropbox;
this.path = path;
}
@Override
protected Boolean doInBackground(Void... params) {
try {
dropbox.delete(path + "/" + fileName);
return true;
} catch (DropboxException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
@Override
protected void onPostExecute(Boolean result) {
}
}
| UTF-8 | Java | 1,156 | java | DeleteDropboxFile.java | Java | [
{
"context": "nt2.exception.DropboxException;\n\n/**\n * Created by rbk on 12/3/15.\n */\npublic class DeleteDropboxFile ex",
"end": 277,
"score": 0.9994576573371887,
"start": 274,
"tag": "USERNAME",
"value": "rbk"
}
] | null | [] | package cs4720.cs.virginia.edu.checklist;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Handler;
import android.widget.Toast;
import com.dropbox.client2.DropboxAPI;
import com.dropbox.client2.exception.DropboxException;
/**
* Created by rbk on 12/3/15.
*/
public class DeleteDropboxFile extends AsyncTask<Void, Void, Boolean> {
private DropboxAPI<?> dropbox;
private String path;
private Context context;
private String fileName;
public DeleteDropboxFile(Context context, DropboxAPI<?> dropbox,
String path, String fileName) {
this.context = context;
this.fileName = fileName;
this.dropbox = dropbox;
this.path = path;
}
@Override
protected Boolean doInBackground(Void... params) {
try {
dropbox.delete(path + "/" + fileName);
return true;
} catch (DropboxException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
@Override
protected void onPostExecute(Boolean result) {
}
}
| 1,156 | 0.634083 | 0.624567 | 46 | 24.130434 | 19.544386 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.543478 | false | false | 4 |
68899076203eb438885de241858a9961e5d4a7d4 | 17,729,625,061,054 | dcfe2f397bad56e998df3239d8cdfb40b874fd1b | /app/src/main/java/app/taxi/newtaxi/Login.java | 79674c9d9dddc698941ce281b95d4d2df27d4739 | [] | no_license | Dolphin-PC/T.T | https://github.com/Dolphin-PC/T.T | d9af2f5c9d9dbf5d4a5d6c890c86da46503d0f65 | 80ffd9473bf4661d8b792de3d82be789e1f3c4f3 | refs/heads/master | 2023-03-10T19:23:22.268000 | 2021-02-25T09:15:57 | 2021-02-25T09:15:57 | 180,379,286 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package app.taxi.newtaxi;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.appcompat.app.AppCompatActivity;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.kakao.auth.ISessionCallback;
import com.kakao.auth.Session;
import com.kakao.usermgmt.LoginButton;
import com.kakao.usermgmt.UserManagement;
import com.kakao.usermgmt.callback.LogoutResponseCallback;
import com.kakao.util.exception.KakaoException;
import com.kakao.util.helper.log.Logger;
import java.security.MessageDigest;
public class Login extends AppCompatActivity {
private BackPressCloseHandler backPressCloseHandler;
private FirebaseAuth mAuth;
private EditText emailText;
private EditText pwText;
private FirebaseAuth.AuthStateListener mAuthListener;
private LoginButton KakaoLoginbtn;
SessionCallback callback;
private DatabaseReference mDatabase;
private DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference();
private DatabaseReference mUserInfo;
ConstraintLayout LAY1;
Button emailLogin;
CheckBox IDcheck;
TextView registerButton;
void init() {
getAppKeyHash();
emailText = findViewById(R.id.emailText);
pwText = findViewById(R.id.pwText);
LAY1 = findViewById(R.id.LAY1);
emailLogin = findViewById(R.id.emailButton);
KakaoLoginbtn = findViewById(R.id.btn_kakao_login);
registerButton = findViewById(R.id.registerButton);
IDcheck = findViewById(R.id.IDcheck);
}
void Auth() {
mAuth = FirebaseAuth.getInstance();
}
void click() {
LAY1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(emailText.getWindowToken(), 0);
}
});
KakaoLoginbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
callback = new SessionCallback();
Session.getCurrentSession().addCallback(callback);
/*Session session = Session.getCurrentSession();
session.addCallback(new SessionCallback());
session.open(AuthType.KAKAO_LOGIN_ALL, Login.this);*/
}
});
registerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), register.class);
startActivity(intent);
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
init();
Auth();
click();
backPressCloseHandler = new BackPressCloseHandler(this);
callback = new SessionCallback();
Session.getCurrentSession().addCallback(callback);
UserManagement.requestLogout(new LogoutResponseCallback() {
@Override
public void onCompleteLogout() {
//์นด์นด์คํก ๋ก๊ทธ์์ ์ฑ๊ณต ํ ํ๊ณ ์ถ์ ๋ด์ฉ ์ฝ๋ฉ ~
}
});
SharedPreferences positionDATA = getSharedPreferences("positionDATA", MODE_PRIVATE);
final SharedPreferences.Editor editor = positionDATA.edit();
if (!positionDATA.getString("LOGIN_EMAIL", "").equals("")) {
emailText.setText(positionDATA.getString("LOGIN_EMAIL", ""));
IDcheck.setChecked(true);
}
emailLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (emailText.getText().toString().equals("") || pwText.getText().toString().equals("")) {
Toast.makeText(Login.this, "ID์ PW๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.", Toast.LENGTH_SHORT).show();
} else {
if (IDcheck.isChecked()) {
editor.putString("LOGIN_EMAIL", emailText.getText().toString());
editor.apply();
} else {
editor.remove("LOGIN_EMAIL");
editor.apply();
}
loginUser(emailText.getText().toString(), pwText.getText().toString());
}
}
});
mAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
//user is signed in
Intent intent = new Intent(getApplicationContext(), main.class);
intent.putExtra("Nickname", "");
intent.putExtra("ID", "");
intent.putExtra("Profile", "");
intent.putExtra("Email", mAuth.getCurrentUser());
intent.putExtra("MESSAGE", "๋ก๊ทธ์ธ ์ฑ๊ณต");
startActivity(intent);
finish();
}
}
};
}
private void loginUser(String email, String password) {
mAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {
Toast.makeText(getApplicationContext(), "๋ก๊ทธ์ธ ์คํจ\nID์ PW๋ฅผ ํ์ธ ํ, ์ฌ์๋ํด์ฃผ์ธ์.", Toast.LENGTH_SHORT).show();
} else {
// If sign in fails, display a message to the user.
Toast.makeText(Login.this, "๋ก๊ทธ์ธ ์ฑ๊ณต!", Toast.LENGTH_SHORT).show(); //์ด๋ฉ์ผ,ํจ์ค์๋ ์
๋ ฅ ๋ก๊ทธ์ธ
}
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (Session.getCurrentSession().handleActivityResult(requestCode, resultCode, data)) {
return;
}
super.onActivityResult(requestCode, resultCode, data);
}
@Override
protected void onDestroy() {
super.onDestroy();
Session.getCurrentSession().removeCallback(callback);
}
@Override
public void onStart() {
super.onStart();
mAuth.addAuthStateListener(mAuthListener);
}
@Override
public void onStop() {
super.onStop();
if (mAuthListener != null) {
mAuth.removeAuthStateListener(mAuthListener);
}
}
private class SessionCallback implements ISessionCallback {
@Override
public void onSessionOpened() {
redirectSignupActivity();
}
@Override
public void onSessionOpenFailed(KakaoException exception) {
if (exception != null) {
Logger.e(exception);
}
setContentView(R.layout.login);
}
}
protected void redirectSignupActivity() { //์ธ์
์ฐ๊ฒฐ ์ฑ๊ณต ์ SignupActivity๋ก ๋๊น
final Intent intent = new Intent(this, KakaoSignupActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
finish();
}
private void getAppKeyHash() {
try {
PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md;
md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String something = new String(Base64.encode(md.digest(), 0));
Log.e("Hash key", something);
}
} catch (Exception e) {
Log.e("name not found", e.toString());
}
}
}
| UTF-8 | Java | 9,061 | java | Login.java | Java | [] | null | [] | package app.taxi.newtaxi;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.appcompat.app.AppCompatActivity;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.kakao.auth.ISessionCallback;
import com.kakao.auth.Session;
import com.kakao.usermgmt.LoginButton;
import com.kakao.usermgmt.UserManagement;
import com.kakao.usermgmt.callback.LogoutResponseCallback;
import com.kakao.util.exception.KakaoException;
import com.kakao.util.helper.log.Logger;
import java.security.MessageDigest;
public class Login extends AppCompatActivity {
private BackPressCloseHandler backPressCloseHandler;
private FirebaseAuth mAuth;
private EditText emailText;
private EditText pwText;
private FirebaseAuth.AuthStateListener mAuthListener;
private LoginButton KakaoLoginbtn;
SessionCallback callback;
private DatabaseReference mDatabase;
private DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference();
private DatabaseReference mUserInfo;
ConstraintLayout LAY1;
Button emailLogin;
CheckBox IDcheck;
TextView registerButton;
void init() {
getAppKeyHash();
emailText = findViewById(R.id.emailText);
pwText = findViewById(R.id.pwText);
LAY1 = findViewById(R.id.LAY1);
emailLogin = findViewById(R.id.emailButton);
KakaoLoginbtn = findViewById(R.id.btn_kakao_login);
registerButton = findViewById(R.id.registerButton);
IDcheck = findViewById(R.id.IDcheck);
}
void Auth() {
mAuth = FirebaseAuth.getInstance();
}
void click() {
LAY1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(emailText.getWindowToken(), 0);
}
});
KakaoLoginbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
callback = new SessionCallback();
Session.getCurrentSession().addCallback(callback);
/*Session session = Session.getCurrentSession();
session.addCallback(new SessionCallback());
session.open(AuthType.KAKAO_LOGIN_ALL, Login.this);*/
}
});
registerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), register.class);
startActivity(intent);
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
init();
Auth();
click();
backPressCloseHandler = new BackPressCloseHandler(this);
callback = new SessionCallback();
Session.getCurrentSession().addCallback(callback);
UserManagement.requestLogout(new LogoutResponseCallback() {
@Override
public void onCompleteLogout() {
//์นด์นด์คํก ๋ก๊ทธ์์ ์ฑ๊ณต ํ ํ๊ณ ์ถ์ ๋ด์ฉ ์ฝ๋ฉ ~
}
});
SharedPreferences positionDATA = getSharedPreferences("positionDATA", MODE_PRIVATE);
final SharedPreferences.Editor editor = positionDATA.edit();
if (!positionDATA.getString("LOGIN_EMAIL", "").equals("")) {
emailText.setText(positionDATA.getString("LOGIN_EMAIL", ""));
IDcheck.setChecked(true);
}
emailLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (emailText.getText().toString().equals("") || pwText.getText().toString().equals("")) {
Toast.makeText(Login.this, "ID์ PW๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.", Toast.LENGTH_SHORT).show();
} else {
if (IDcheck.isChecked()) {
editor.putString("LOGIN_EMAIL", emailText.getText().toString());
editor.apply();
} else {
editor.remove("LOGIN_EMAIL");
editor.apply();
}
loginUser(emailText.getText().toString(), pwText.getText().toString());
}
}
});
mAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
//user is signed in
Intent intent = new Intent(getApplicationContext(), main.class);
intent.putExtra("Nickname", "");
intent.putExtra("ID", "");
intent.putExtra("Profile", "");
intent.putExtra("Email", mAuth.getCurrentUser());
intent.putExtra("MESSAGE", "๋ก๊ทธ์ธ ์ฑ๊ณต");
startActivity(intent);
finish();
}
}
};
}
private void loginUser(String email, String password) {
mAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {
Toast.makeText(getApplicationContext(), "๋ก๊ทธ์ธ ์คํจ\nID์ PW๋ฅผ ํ์ธ ํ, ์ฌ์๋ํด์ฃผ์ธ์.", Toast.LENGTH_SHORT).show();
} else {
// If sign in fails, display a message to the user.
Toast.makeText(Login.this, "๋ก๊ทธ์ธ ์ฑ๊ณต!", Toast.LENGTH_SHORT).show(); //์ด๋ฉ์ผ,ํจ์ค์๋ ์
๋ ฅ ๋ก๊ทธ์ธ
}
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (Session.getCurrentSession().handleActivityResult(requestCode, resultCode, data)) {
return;
}
super.onActivityResult(requestCode, resultCode, data);
}
@Override
protected void onDestroy() {
super.onDestroy();
Session.getCurrentSession().removeCallback(callback);
}
@Override
public void onStart() {
super.onStart();
mAuth.addAuthStateListener(mAuthListener);
}
@Override
public void onStop() {
super.onStop();
if (mAuthListener != null) {
mAuth.removeAuthStateListener(mAuthListener);
}
}
private class SessionCallback implements ISessionCallback {
@Override
public void onSessionOpened() {
redirectSignupActivity();
}
@Override
public void onSessionOpenFailed(KakaoException exception) {
if (exception != null) {
Logger.e(exception);
}
setContentView(R.layout.login);
}
}
protected void redirectSignupActivity() { //์ธ์
์ฐ๊ฒฐ ์ฑ๊ณต ์ SignupActivity๋ก ๋๊น
final Intent intent = new Intent(this, KakaoSignupActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
finish();
}
private void getAppKeyHash() {
try {
PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md;
md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String something = new String(Base64.encode(md.digest(), 0));
Log.e("Hash key", something);
}
} catch (Exception e) {
Log.e("name not found", e.toString());
}
}
}
| 9,061 | 0.611741 | 0.610618 | 240 | 36.116665 | 26.397028 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.679167 | false | false | 4 |
8fa19f83b724a8e1382499cf41e6aecaae167903 | 18,622,978,259,312 | ec6e140ea9df8d3187ee48db6f939f82b0588fc6 | /src/main/java/org/ngs/add/cfg/NgsConfig.java | 0bcd78c487aa559f9fa5f1261ed1d0b31c7f3ca3 | [] | no_license | dv1520/ngspice-idea-plugin | https://github.com/dv1520/ngspice-idea-plugin | 2b3121084e5f7328939f55de2e0d98f037435f17 | 24ad185b363fed2999d41fda6935bb947e270f6c | refs/heads/master | 2021-09-03T07:43:54.157000 | 2018-01-07T07:24:05 | 2018-01-07T07:24:05 | 116,221,419 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.ngs.add.cfg;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import org.jdom.Element;
import org.jetbrains.annotations.Nullable;
/**
* Created by z on 22.08.17.
*/
@State(name = "NGspiceConfiguration", storages = @Storage("ngspice.xml"))
public class NgsConfig implements PersistentStateComponent<Element> {
private String ngsBinaryPath = "";
private boolean isExpertOptionsEnabled;
private String downloadUrl;
private String unpackDir;
@Nullable
@Override
public Element getState() {
Element path = new Element("path");
path.addContent(ngsBinaryPath);
Element rootElement = new Element("state");
rootElement.addContent(path);
return rootElement;
}
@Override
public void loadState(Element state) {
Element path = state.getChild("path");
ngsBinaryPath = path.getText();
}
public static NgsConfig getInstance() {
return ServiceManager.getService(NgsConfig.class);
}
public String getNgsBinaryPath() {
return ngsBinaryPath;
}
public void setNgsBinaryPath(String ngsBinaryPath) {
this.ngsBinaryPath = ngsBinaryPath;
}
public boolean isExpertOptionsEnabled() {
return isExpertOptionsEnabled;
}
public void setExpertOptionsEnabled(boolean expertOptionsEnabled) {
isExpertOptionsEnabled = expertOptionsEnabled;
}
public String getDownloadUrl() {
return downloadUrl;
}
public void setDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
}
public String getUnpackDir() {
return unpackDir;
}
public void setUnpackDir(String unpackDir) {
this.unpackDir = unpackDir;
}
}
| UTF-8 | Java | 1,913 | java | NgsConfig.java | Java | [
{
"context": "jetbrains.annotations.Nullable;\n\n/**\n * Created by z on 22.08.17.\n */\n@State(name = \"NGspiceConfigurat",
"end": 328,
"score": 0.9395367503166199,
"start": 327,
"tag": "USERNAME",
"value": "z"
}
] | null | [] | package org.ngs.add.cfg;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import org.jdom.Element;
import org.jetbrains.annotations.Nullable;
/**
* Created by z on 22.08.17.
*/
@State(name = "NGspiceConfiguration", storages = @Storage("ngspice.xml"))
public class NgsConfig implements PersistentStateComponent<Element> {
private String ngsBinaryPath = "";
private boolean isExpertOptionsEnabled;
private String downloadUrl;
private String unpackDir;
@Nullable
@Override
public Element getState() {
Element path = new Element("path");
path.addContent(ngsBinaryPath);
Element rootElement = new Element("state");
rootElement.addContent(path);
return rootElement;
}
@Override
public void loadState(Element state) {
Element path = state.getChild("path");
ngsBinaryPath = path.getText();
}
public static NgsConfig getInstance() {
return ServiceManager.getService(NgsConfig.class);
}
public String getNgsBinaryPath() {
return ngsBinaryPath;
}
public void setNgsBinaryPath(String ngsBinaryPath) {
this.ngsBinaryPath = ngsBinaryPath;
}
public boolean isExpertOptionsEnabled() {
return isExpertOptionsEnabled;
}
public void setExpertOptionsEnabled(boolean expertOptionsEnabled) {
isExpertOptionsEnabled = expertOptionsEnabled;
}
public String getDownloadUrl() {
return downloadUrl;
}
public void setDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
}
public String getUnpackDir() {
return unpackDir;
}
public void setUnpackDir(String unpackDir) {
this.unpackDir = unpackDir;
}
}
| 1,913 | 0.69472 | 0.691584 | 75 | 24.506666 | 21.844526 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.373333 | false | false | 4 |
38b71007dd92231ed1f9eda3f1c02dcd9220776c | 22,351,009,816,265 | c76b486cdec0dcc991ec5efdb0bf5519c67360a6 | /Tour/app/src/main/java/shashi/com/tour/models/UpdateECInput.java | 4d5239185b22614bff289e865baff35f6bf91fc3 | [] | no_license | ashakbhat/Projects | https://github.com/ashakbhat/Projects | 70fff2b7b8f4e70c9b8ab8ab2c3666ea993ac885 | 7f5a58595cf1a9c2447eebfadadb7922197deedc | refs/heads/master | 2020-12-23T05:46:43.473000 | 2020-01-29T18:04:50 | 2020-01-29T18:04:50 | 237,047,268 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package shashi.com.tour.models;
public class UpdateECInput {
public String user_id;
public String eme_1;
public String eme_2;
public String eme_3;
public UpdateECInput(String user_id, String eme_1, String eme_2, String eme_3) {
this.user_id = user_id;
this.eme_1 = eme_1;
this.eme_2 = eme_2;
this.eme_3 = eme_3;
}
}
| UTF-8 | Java | 389 | java | UpdateECInput.java | Java | [] | null | [] | package shashi.com.tour.models;
public class UpdateECInput {
public String user_id;
public String eme_1;
public String eme_2;
public String eme_3;
public UpdateECInput(String user_id, String eme_1, String eme_2, String eme_3) {
this.user_id = user_id;
this.eme_1 = eme_1;
this.eme_2 = eme_2;
this.eme_3 = eme_3;
}
}
| 389 | 0.588689 | 0.557841 | 15 | 23.933332 | 19.64168 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false | 4 |
c32aad5178cb23e8995f4e3a12286358fdb5afcf | 3,899,830,368,380 | a69aa21b4a78ce3c56350c91d39dada4d5a41c19 | /app/src/main/java/com/gtsr/gtsr/loginModule/SplashScreen.java | 91529c66debafd3fa944faff670c091d4af5973b | [] | no_license | Vedas-Labs/GTSR | https://github.com/Vedas-Labs/GTSR | df5a1da0b758fe2f13de284a1cf13e164fa67653 | 0e0a8bb8d99bbdde0d52b17711363cb4aed97eb6 | refs/heads/master | 2023-03-19T09:27:56.207000 | 2021-03-18T04:57:13 | 2021-03-18T04:57:13 | 333,645,980 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gtsr.gtsr.loginModule;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.util.Base64;
import android.util.Log;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.gtsr.gtsr.R;
import com.gtsr.gtsr.WifiReceiver;
import java.security.MessageDigest;
public class SplashScreen extends AppCompatActivity {
private static final int REQUEST = 112;
final static int REQUEST_LOCATION = 199;
Context mContext = this;
Handler handler;
WifiReceiver exampleBroadcastReceiver = new WifiReceiver();
// private GoogleApiClient googleApiClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_scree);
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)) {
Log.e("moves", "Build.VERSION.SDK_INT >= Build.VERSION_CODES.M");
String[] PERMISSIONS = {
// Manifest.permission.READ_PHONE_STATE,
// Manifest.permission.ACCESS_NETWORK_STATE,
// Manifest.permission.ACCESS_WIFI_STATE,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.CAMERA,
};
if (!hasPermissions(mContext, PERMISSIONS)) {
Log.e("ccada", "cc");
//enableLoc();
ActivityCompat.requestPermissions((Activity) mContext, PERMISSIONS, REQUEST);
} else {
checker();
}
} else {
Log.e("ccada", "ccc");
// startActivity(new Intent(getApplicationContext(), LoginViewController.class));
checker();
}
}
protected void onStart(){
super.onStart();
IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
registerReceiver(exampleBroadcastReceiver, filter);
}
@Override
protected void onStop(){
super.onStop();
unregisterReceiver(exampleBroadcastReceiver);
}
public void checkAppFlow() {
//Get User Location
LocationTracker.getInstance().fillContext(getApplicationContext());
LocationTracker.getInstance().startLocation();
// GET USer Informaion.
handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Log.e("starting", "startLogin1");
startActivity(new Intent(getApplicationContext(), LoginActivity.class));
}
}, 1000);
}
@Override
public void onResume() {
super.onResume();
// clear the notification area when the app is opened
}
////////////Multiple Premession and alerts//////
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case REQUEST: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
////// callNextActivity///////////
checkAppFlow();
} else {
Toast.makeText(mContext, "PERMISSIONS Denied", Toast.LENGTH_LONG).show();
}
}
}
}
private static boolean hasPermissions(Context context, String... permissions) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context != null && permissions != null) {
for (String permission : permissions) {
if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
return false;
}
}
}
return true;
}
public void checker() {
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
Log.e("ddfsd", "da");
// StartAnimations();
checkAppFlow();
} else {
Log.e("ddfsd", "da1");
// enableLoc();
handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Log.e("allenable", "startLogin1");
startActivity(new Intent(getApplicationContext(), LoginActivity.class));
}
}, 1000);
}
}
/* //// Below 6.0.1 Laction can be on /////
private void enableLoc() {
if (googleApiClient == null) {
Log.e("flow", "flow :");
googleApiClient = new GoogleApiClient.Builder(this)
.addApi(LocationServices.API)
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle bundle) {
Log.e("checkk", "flow1");
// StartAnimations();
}
@Override
public void onConnectionSuspended(int i) {
Log.e("checkk", "flow2");
googleApiClient.connect();
}
})
.addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Log.e("Location error", "Location error " + connectionResult.getErrorCode());
Log.e("Location error", "Location error " + connectionResult.getErrorCode());
}
}).build();
googleApiClient.connect();
LocationRequest locationRequest = LocationRequest.create();
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
locationRequest.setInterval(30 * 1000);
locationRequest.setFastestInterval(5 * 1000);
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder()
.addLocationRequest(locationRequest);
builder.setAlwaysShow(true); //this is the key ingredient
PendingResult<LocationSettingsResult> result =
LocationServices.SettingsApi.checkLocationSettings(googleApiClient, builder.build());
result.setResultCallback(new ResultCallback<LocationSettingsResult>() {
@Override
public void onResult(LocationSettingsResult result) {
final Status status = result.getStatus();
switch (status.getStatusCode()) {
case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
try {
Log.e("eee", "status");
// Show the dialog by calling startResolutionForResult(),
// and check the result in onActivityResult().
status.startResolutionForResult(SplashScreen.this, REQUEST_LOCATION);
} catch (IntentSender.SendIntentException e) {
Log.e("eee", "aa" + e.getMessage());
// Ignore the error.
}
break;
}
}
});
}
}
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQUEST_LOCATION:
switch (resultCode) {
case Activity.RESULT_CANCELED: {
// The user was asked to change settings, but chose not to
finish();
break;
}
case Activity.RESULT_OK: {
// The user was asked to change settings, but chose not to
checkAppFlow();
break;
}
default: {
break;
}
}
break;
}
}
@Override
public void onBackPressed() { //when click on phone backbutton
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}
| UTF-8 | Java | 9,840 | java | SplashScreen.java | Java | [] | null | [] | package com.gtsr.gtsr.loginModule;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.util.Base64;
import android.util.Log;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.gtsr.gtsr.R;
import com.gtsr.gtsr.WifiReceiver;
import java.security.MessageDigest;
public class SplashScreen extends AppCompatActivity {
private static final int REQUEST = 112;
final static int REQUEST_LOCATION = 199;
Context mContext = this;
Handler handler;
WifiReceiver exampleBroadcastReceiver = new WifiReceiver();
// private GoogleApiClient googleApiClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_scree);
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)) {
Log.e("moves", "Build.VERSION.SDK_INT >= Build.VERSION_CODES.M");
String[] PERMISSIONS = {
// Manifest.permission.READ_PHONE_STATE,
// Manifest.permission.ACCESS_NETWORK_STATE,
// Manifest.permission.ACCESS_WIFI_STATE,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.CAMERA,
};
if (!hasPermissions(mContext, PERMISSIONS)) {
Log.e("ccada", "cc");
//enableLoc();
ActivityCompat.requestPermissions((Activity) mContext, PERMISSIONS, REQUEST);
} else {
checker();
}
} else {
Log.e("ccada", "ccc");
// startActivity(new Intent(getApplicationContext(), LoginViewController.class));
checker();
}
}
protected void onStart(){
super.onStart();
IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
registerReceiver(exampleBroadcastReceiver, filter);
}
@Override
protected void onStop(){
super.onStop();
unregisterReceiver(exampleBroadcastReceiver);
}
public void checkAppFlow() {
//Get User Location
LocationTracker.getInstance().fillContext(getApplicationContext());
LocationTracker.getInstance().startLocation();
// GET USer Informaion.
handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Log.e("starting", "startLogin1");
startActivity(new Intent(getApplicationContext(), LoginActivity.class));
}
}, 1000);
}
@Override
public void onResume() {
super.onResume();
// clear the notification area when the app is opened
}
////////////Multiple Premession and alerts//////
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case REQUEST: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
////// callNextActivity///////////
checkAppFlow();
} else {
Toast.makeText(mContext, "PERMISSIONS Denied", Toast.LENGTH_LONG).show();
}
}
}
}
private static boolean hasPermissions(Context context, String... permissions) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context != null && permissions != null) {
for (String permission : permissions) {
if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
return false;
}
}
}
return true;
}
public void checker() {
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
Log.e("ddfsd", "da");
// StartAnimations();
checkAppFlow();
} else {
Log.e("ddfsd", "da1");
// enableLoc();
handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Log.e("allenable", "startLogin1");
startActivity(new Intent(getApplicationContext(), LoginActivity.class));
}
}, 1000);
}
}
/* //// Below 6.0.1 Laction can be on /////
private void enableLoc() {
if (googleApiClient == null) {
Log.e("flow", "flow :");
googleApiClient = new GoogleApiClient.Builder(this)
.addApi(LocationServices.API)
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle bundle) {
Log.e("checkk", "flow1");
// StartAnimations();
}
@Override
public void onConnectionSuspended(int i) {
Log.e("checkk", "flow2");
googleApiClient.connect();
}
})
.addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Log.e("Location error", "Location error " + connectionResult.getErrorCode());
Log.e("Location error", "Location error " + connectionResult.getErrorCode());
}
}).build();
googleApiClient.connect();
LocationRequest locationRequest = LocationRequest.create();
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
locationRequest.setInterval(30 * 1000);
locationRequest.setFastestInterval(5 * 1000);
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder()
.addLocationRequest(locationRequest);
builder.setAlwaysShow(true); //this is the key ingredient
PendingResult<LocationSettingsResult> result =
LocationServices.SettingsApi.checkLocationSettings(googleApiClient, builder.build());
result.setResultCallback(new ResultCallback<LocationSettingsResult>() {
@Override
public void onResult(LocationSettingsResult result) {
final Status status = result.getStatus();
switch (status.getStatusCode()) {
case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
try {
Log.e("eee", "status");
// Show the dialog by calling startResolutionForResult(),
// and check the result in onActivityResult().
status.startResolutionForResult(SplashScreen.this, REQUEST_LOCATION);
} catch (IntentSender.SendIntentException e) {
Log.e("eee", "aa" + e.getMessage());
// Ignore the error.
}
break;
}
}
});
}
}
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQUEST_LOCATION:
switch (resultCode) {
case Activity.RESULT_CANCELED: {
// The user was asked to change settings, but chose not to
finish();
break;
}
case Activity.RESULT_OK: {
// The user was asked to change settings, but chose not to
checkAppFlow();
break;
}
default: {
break;
}
}
break;
}
}
@Override
public void onBackPressed() { //when click on phone backbutton
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}
| 9,840 | 0.56565 | 0.56189 | 254 | 37.740158 | 27.841145 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.610236 | false | false | 4 |
bc48595fd529b0d84cb648e3e1a510c48d15522a | 5,411,658,859,590 | 25d1bf25b4964f62ee65ed2c1e016c1c22ba6526 | /app/src/main/java/com/example/u17/moudle_search/activity/ProgramMainActivity.java | 9f1e2cec202d6532d37141f788d583ff2eac01c3 | [] | no_license | pengyongshun/U17 | https://github.com/pengyongshun/U17 | 9908d229fd2db380611f349c89dbf88dc73c12c6 | adf9ca5e16241c3739a28b5661da32a35a2b4790 | refs/heads/master | 2020-12-04T21:32:47.011000 | 2020-06-26T02:57:52 | 2020-06-26T02:57:52 | 67,663,393 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.u17.moudle_search.activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.TextView;
import android.widget.Toast;
import com.example.u17.R;
import com.example.u17.base_http.BaseUrl;
import com.example.u17.module_login.activity.LoginActivity;
import com.example.u17.moudle_search.adapter.CommenAdapter;
import com.example.u17.moudle_search.ascytask.CommenAscyTask;
import com.example.u17.moudle_search.bean.CommentBean;
import com.example.u17.moudle_search.url.SerachUrl;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
public class ProgramMainActivity extends AppCompatActivity implements View.OnClickListener {
@BindView(R.id.activity_program_tool_actionbar)
public Toolbar toolbar;
@BindView(R.id.activity_program_lv_list)
public ListView mListView;
@BindView(R.id.activity_program_ll_write_comment)
public LinearLayout llWriteComment;
@BindView(R.id.activity_program_tv_show_comment)
public TextView tvShowComment;
private List<CommentBean.DataBean.ReturnDataBean.CommentListBean> beens=new ArrayList<>();
private CommenAdapter mCommenAdapter;
private String id;
private PopupWindow popupWindow;
private int width;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_program_main);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
//ๅนณๅๅฑๅน
Display display = getWindowManager().getDefaultDisplay();
width = display.getWidth();
//ไปไธไธไธช็้ขๆฅๆถid
Intent intent = getIntent();
Bundle bundle = intent.getBundleExtra("bundle");
id = bundle.getString("id");
initAdapter();
loadData();
}
private void loadData() {
if (id==null){
return;
}
new CommenAscyTask(new CommenAscyTask.CommenCallBack() {
@Override
public void callBack(CommentBean commentBean) {
if (commentBean==null){
return;
}
List<CommentBean.DataBean.ReturnDataBean.CommentListBean> commentList = commentBean.getData().getReturnData().getCommentList();
beens.addAll(commentList);
mCommenAdapter.notifyDataSetChanged();
}
}).execute(BaseUrl.COMMEN_BASE_URL+id+BaseUrl.COMMEN_BOTTOM_URL);
}
private void initAdapter() {
if (beens==null){
return;
}
mCommenAdapter = new CommenAdapter(this,beens);
mListView.setAdapter(mCommenAdapter);
}
public void onClick(View view){
switch (view.getId()){
case R.id.activity_program_ll_write_comment:
CreatePupawindow();
break;
case R.id.activity_program_tool_back:
if (popupWindow!=null){
popupWindow.dismiss();
}
finish();
break;
case R.id.program_popuwindow_btn_nicke:
//่ฝฌ่ทณๅฐๅๅธ็้ข
Intent intent1=new Intent(ProgramMainActivity.this,PublishActivity.class);
startActivity(intent1);
break;
case R.id.program_popuwindow_btn_login:
//่ฝฌ่ทณๅฐ็ปๅฝ็้ข
popupWindow.dismiss();
Intent intent=new Intent(ProgramMainActivity.this, LoginActivity.class);
startActivity(intent);
break;
}
}
private void CreatePupawindow(){
View view= LayoutInflater.from(this).inflate(R.layout.program_popuwindow,null);
Button btnNicke = (Button) view.findViewById(R.id.program_popuwindow_btn_nicke);
Button btnLogin = (Button) view.findViewById(R.id.program_popuwindow_btn_login);
popupWindow=new PopupWindow(view, width,400);
popupWindow.showAtLocation(view, Gravity.BOTTOM, 0, 0);
btnLogin.setOnClickListener(this);
btnNicke.setOnClickListener(this);
}
}
| UTF-8 | Java | 4,543 | java | ProgramMainActivity.java | Java | [] | null | [] | package com.example.u17.moudle_search.activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.TextView;
import android.widget.Toast;
import com.example.u17.R;
import com.example.u17.base_http.BaseUrl;
import com.example.u17.module_login.activity.LoginActivity;
import com.example.u17.moudle_search.adapter.CommenAdapter;
import com.example.u17.moudle_search.ascytask.CommenAscyTask;
import com.example.u17.moudle_search.bean.CommentBean;
import com.example.u17.moudle_search.url.SerachUrl;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
public class ProgramMainActivity extends AppCompatActivity implements View.OnClickListener {
@BindView(R.id.activity_program_tool_actionbar)
public Toolbar toolbar;
@BindView(R.id.activity_program_lv_list)
public ListView mListView;
@BindView(R.id.activity_program_ll_write_comment)
public LinearLayout llWriteComment;
@BindView(R.id.activity_program_tv_show_comment)
public TextView tvShowComment;
private List<CommentBean.DataBean.ReturnDataBean.CommentListBean> beens=new ArrayList<>();
private CommenAdapter mCommenAdapter;
private String id;
private PopupWindow popupWindow;
private int width;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_program_main);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
//ๅนณๅๅฑๅน
Display display = getWindowManager().getDefaultDisplay();
width = display.getWidth();
//ไปไธไธไธช็้ขๆฅๆถid
Intent intent = getIntent();
Bundle bundle = intent.getBundleExtra("bundle");
id = bundle.getString("id");
initAdapter();
loadData();
}
private void loadData() {
if (id==null){
return;
}
new CommenAscyTask(new CommenAscyTask.CommenCallBack() {
@Override
public void callBack(CommentBean commentBean) {
if (commentBean==null){
return;
}
List<CommentBean.DataBean.ReturnDataBean.CommentListBean> commentList = commentBean.getData().getReturnData().getCommentList();
beens.addAll(commentList);
mCommenAdapter.notifyDataSetChanged();
}
}).execute(BaseUrl.COMMEN_BASE_URL+id+BaseUrl.COMMEN_BOTTOM_URL);
}
private void initAdapter() {
if (beens==null){
return;
}
mCommenAdapter = new CommenAdapter(this,beens);
mListView.setAdapter(mCommenAdapter);
}
public void onClick(View view){
switch (view.getId()){
case R.id.activity_program_ll_write_comment:
CreatePupawindow();
break;
case R.id.activity_program_tool_back:
if (popupWindow!=null){
popupWindow.dismiss();
}
finish();
break;
case R.id.program_popuwindow_btn_nicke:
//่ฝฌ่ทณๅฐๅๅธ็้ข
Intent intent1=new Intent(ProgramMainActivity.this,PublishActivity.class);
startActivity(intent1);
break;
case R.id.program_popuwindow_btn_login:
//่ฝฌ่ทณๅฐ็ปๅฝ็้ข
popupWindow.dismiss();
Intent intent=new Intent(ProgramMainActivity.this, LoginActivity.class);
startActivity(intent);
break;
}
}
private void CreatePupawindow(){
View view= LayoutInflater.from(this).inflate(R.layout.program_popuwindow,null);
Button btnNicke = (Button) view.findViewById(R.id.program_popuwindow_btn_nicke);
Button btnLogin = (Button) view.findViewById(R.id.program_popuwindow_btn_login);
popupWindow=new PopupWindow(view, width,400);
popupWindow.showAtLocation(view, Gravity.BOTTOM, 0, 0);
btnLogin.setOnClickListener(this);
btnNicke.setOnClickListener(this);
}
}
| 4,543 | 0.664663 | 0.659096 | 122 | 35.811474 | 23.661316 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.688525 | false | false | 4 |
d8408e7000c6c8f3dbce89b65769a093986b2640 | 30,760,555,786,874 | 1cf5b80e011f4d379a1b46a2eb4e8844bdfdca25 | /Spring/spring-mvc-spring-boot/src/main/java/com/example/demo/service/UserService.java | 1e27d5dc5d29733029e201b205425a39759813f1 | [] | no_license | ShreePatangay/Spring | https://github.com/ShreePatangay/Spring | 77ad426fb1d98a8ed3a1615f197f25f02594d936 | a90b0b5167999488371c11a6d7b1d7cb80f8153f | refs/heads/main | 2023-07-29T06:58:03.549000 | 2021-09-13T20:04:00 | 2021-09-13T20:04:00 | 406,112,309 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.demo.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.demo.model.User;
import com.example.demo.model.UserRepository;
@Service
public class UserService {
@Autowired
UserRepository repository;
public User createUser(Integer id,String name,String role) {
User user = new User(id,name,role);
return repository.save(user);
}
public List<User> getUsers() {
return repository.findAll();
}
public User updateUser(Integer id,String name,String role) {
User user = repository.getById(id);
user.setName(name);
user.setRole(role);
return repository.save(user);
}
public void deleteUser(Integer id) {
repository.deleteById(id);
}
}
| UTF-8 | Java | 833 | java | UserService.java | Java | [] | null | [] | package com.example.demo.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.demo.model.User;
import com.example.demo.model.UserRepository;
@Service
public class UserService {
@Autowired
UserRepository repository;
public User createUser(Integer id,String name,String role) {
User user = new User(id,name,role);
return repository.save(user);
}
public List<User> getUsers() {
return repository.findAll();
}
public User updateUser(Integer id,String name,String role) {
User user = repository.getById(id);
user.setName(name);
user.setRole(role);
return repository.save(user);
}
public void deleteUser(Integer id) {
repository.deleteById(id);
}
}
| 833 | 0.715486 | 0.715486 | 37 | 20.405405 | 19.442862 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.405405 | false | false | 4 |
5f0ef1a97f3c2fb8f471367b85fc6ac5f798ad07 | 33,956,011,442,194 | 954968749ee579e0d2eb219c30b5ba239a66cf17 | /src/main/java/com/hplatform/core/mapper/MailDictMapper.java | c74a08ac1e2b5bc76231ed9973b9c9cacca89398 | [] | no_license | caocf/HPlatform | https://github.com/caocf/HPlatform | d95de3f86924be246a44e0bebcf2268ad6a0bb82 | cc593624d9470b81e8360e6f159294e8826676e0 | refs/heads/master | 2020-12-31T07:32:23.593000 | 2017-01-04T10:00:52 | 2017-01-04T10:00:52 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hplatform.core.mapper;
import com.hplatform.core.common.annotation.MyBatisMapper;
import com.hplatform.core.entity.MailDict;
/**
* ็จๅบๅ็งฐ๏ผ MailDict.java
* ็จๅบ่ฏดๆ๏ผ ๆไปถmapper
* ็ๆไฟกๆฏ๏ผ Copyright XXXXXXXXXๆ้ๅ
ฌๅธ
* ๆถ้ด๏ผ 2012-2-24
*
* @author๏ผ lib
* @version๏ผ Ver 0.1
*/
@MyBatisMapper
public interface MailDictMapper extends BaseMapper<MailDict> {
} | UTF-8 | Java | 413 | java | MailDictMapper.java | Java | [
{
"context": "ght XXXXXXXXXๆ้ๅ
ฌๅธ\n * ๆถ้ด๏ผ 2012-2-24\n * \n * @author๏ผ lib\n * @version๏ผ Ver 0.1\n */\n@MyBatisMapper\npublic in",
"end": 254,
"score": 0.9967694878578186,
"start": 251,
"tag": "USERNAME",
"value": "lib"
}
] | null | [] | package com.hplatform.core.mapper;
import com.hplatform.core.common.annotation.MyBatisMapper;
import com.hplatform.core.entity.MailDict;
/**
* ็จๅบๅ็งฐ๏ผ MailDict.java
* ็จๅบ่ฏดๆ๏ผ ๆไปถmapper
* ็ๆไฟกๆฏ๏ผ Copyright XXXXXXXXXๆ้ๅ
ฌๅธ
* ๆถ้ด๏ผ 2012-2-24
*
* @author๏ผ lib
* @version๏ผ Ver 0.1
*/
@MyBatisMapper
public interface MailDictMapper extends BaseMapper<MailDict> {
} | 413 | 0.739612 | 0.714681 | 19 | 18.052631 | 18.972206 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.210526 | false | false | 4 |
6208c2bc566906e9c155c396ede7f6dfb6c8e66f | 17,858,474,056,280 | e70b3a4ef242186a490319258a0011eabb88479e | /src/main/java/com/awccis/admin/model/ModifyP.java | 3955cd36af19cfdbf0e1a4111741f814d8f3d5ad | [] | no_license | xiaoxiangdy/edemo | https://github.com/xiaoxiangdy/edemo | 4164c968ab7428eef3c472765b4e9586cc500fb8 | 0a4434c650f7c1e8bc97da6d8f1eaa7065f0f29c | refs/heads/master | 2020-04-03T05:19:22.640000 | 2018-10-28T06:41:22 | 2018-10-28T06:41:22 | 155,041,856 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.awccis.admin.model;
public class ModifyP {
private String driver1;
private String discount1;
private String selectValue1;
private int awards1;
private String reason1;
public String getReason1() {
return reason1;
}
public void setReason1(String reason1) {
this.reason1 = reason1;
}
public String getDriver1() {
return driver1;
}
public void setDriver1(String driver1) {
this.driver1 = driver1;
}
public String getDiscount1() {
return discount1;
}
public void setDiscount1(String discount1) {
this.discount1 = discount1;
}
public String getSelectValue1() {
return selectValue1;
}
public void setSelectValue1(String selectValue1) {
this.selectValue1 = selectValue1;
}
public int getAwards1() {
return awards1;
}
public void setAwards1(int awards1) {
this.awards1 = awards1;
}
}
| UTF-8 | Java | 981 | java | ModifyP.java | Java | [] | null | [] | package com.awccis.admin.model;
public class ModifyP {
private String driver1;
private String discount1;
private String selectValue1;
private int awards1;
private String reason1;
public String getReason1() {
return reason1;
}
public void setReason1(String reason1) {
this.reason1 = reason1;
}
public String getDriver1() {
return driver1;
}
public void setDriver1(String driver1) {
this.driver1 = driver1;
}
public String getDiscount1() {
return discount1;
}
public void setDiscount1(String discount1) {
this.discount1 = discount1;
}
public String getSelectValue1() {
return selectValue1;
}
public void setSelectValue1(String selectValue1) {
this.selectValue1 = selectValue1;
}
public int getAwards1() {
return awards1;
}
public void setAwards1(int awards1) {
this.awards1 = awards1;
}
}
| 981 | 0.625892 | 0.590214 | 52 | 17.865385 | 16.390697 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false | 4 |
180b5144a563c7c1f87e99fce0b28702da57f75d | 17,858,474,054,887 | 95708c9e9f906f2dde26dfaed6a01e101de34d9d | /src/main/java/net/minekingdom/MyCommands/MyCommands.java | 0c514a0c5a6a573b3ffaa5885792869d351a1642 | [] | no_license | MineKingdom/MyCommands | https://github.com/MineKingdom/MyCommands | 2b8893c67090d71506aa5ad7f927368998a88847 | e8a872f5cb77e6c6b4faaedca861a18c43319796 | refs/heads/master | 2019-01-01T12:41:40.044000 | 2013-07-11T06:16:28 | 2013-07-11T06:16:28 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.minekingdom.MyCommands;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minekingdom.MyCommands.annotated.CommandLoadOrder;
import net.minekingdom.MyCommands.annotated.CommandRegister;
import net.minekingdom.MyCommands.annotated.CommandLoadOrder.Order;
import net.minekingdom.MyCommands.config.PluginConfig;
import org.spout.api.UnsafeMethod;
import org.spout.api.command.CommandSource;
import org.spout.api.command.Executor;
import org.spout.api.command.annotated.Command;
import org.spout.api.plugin.Plugin;
import org.spout.cereal.config.ConfigurationException;
public class MyCommands extends Plugin {
private static MyCommands instance;
private static Logger logger;
private File componentFolder;
private File configFolder;
private PluginConfig config;
private ConfigurationManager configurationManager;
private Set<CommandInfo> replacedCommands;
@Override
@UnsafeMethod
public void onEnable() {
instance = this;
logger = getLogger();
try {
config = new PluginConfig(getDataFolder());
config.load();
} catch (ConfigurationException e) {
log(Level.SEVERE, "There is an error in the configuration file. Please fix the error or delete the file to regenerate a new one.");
log(Level.SEVERE, e.getMessage());
getPluginLoader().disablePlugin(this);
return;
}
configurationManager = new ConfigurationManager();
this.componentFolder = new File(getDataFolder() + File.separator + "components");
if (!this.componentFolder.exists())
this.componentFolder.mkdirs();
this.configFolder = new File(getDataFolder() + File.separator + "config");
if (!this.configFolder.exists())
this.configFolder.mkdirs();
this.getEngine().getEventManager().registerEvents(new CoreListener(), this);
this.replacedCommands = new HashSet<CommandInfo>();
loadComponents();
log("MyCommands v" + this.getDescription().getVersion() + " enabled.");
}
private void loadComponents() {
List<File> files = new ArrayList<File>();
addTree(this.componentFolder, files);
List<Class<?>> components = new LinkedList<Class<?>>();
List<String> classes = new ArrayList<String>();
List<URL> urls = new ArrayList<URL>();
// Adds the url of every jar file.
{
try {
urls.add(this.componentFolder.toURI().toURL());
} catch (MalformedURLException ex) {}
for (File file : files) {
if (file.getName().endsWith(".jar")) {
try {
urls.add(new URL("jar:" + file.toURI().toURL() + "!/"));
classes.add(file.getName().substring(0, file.getName().length() - 4));
} catch (MalformedURLException ex) {}
continue;
}
classes.add(file.getName().substring(0, file.getName().length() - 6));
}
}
URLClassLoader ucl = new URLClassLoader(urls.toArray(new URL[urls.size()]), this.getClassLoader());
// loads every class and puts them into the components list
{
int normalIndex = 0;
for (String name : classes) {
try {
Class<?> c = Class.forName(name, true, ucl);
CommandLoadOrder loadOrder = c.getAnnotation(CommandLoadOrder.class);
if (loadOrder != null) {
if (loadOrder.value().equals(Order.FIRST)) {
normalIndex++;
components.add(0, c);
continue;
} else if (loadOrder.value().equals(Order.LAST)) {
components.add(c);
continue;
}
}
components.add(normalIndex, c);
} catch (ClassNotFoundException ex) {}
}
}
// Registers the commands and the listeners
{
for (Class<?> c : components) {
if (PluginConfig.REPLACE_COMMANDS.getBoolean()) {
for (Method m : c.getMethods()) {
Command annotation = m.getAnnotation(Command.class);
if (annotation == null)
continue;
/*for (String name : annotation.aliases()) {
this.getEngine().getCommandManager().getRootCommand().removeChild(name);
}*/
}
}
try {
CommandRegister.register(c);
log(c.getName() + " component sucessfully loaded.");
} catch (Throwable t) {
log(Level.SEVERE, c.getName() + " failed to load.\n");
t.printStackTrace();
}
}
}
try {
ucl.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
private void addTree(File file, List<File> files) {
File[] children = file.listFiles();
if (children != null) {
for (File child : children) {
if ((child.getName().endsWith(".class") || child.getName().endsWith(".jar")))
files.add(child);
addTree(child, files);
}
}
}
public void restoreReplacedCommands() {
for (CommandInfo cmd : this.replacedCommands) {
this.getEngine().getCommandManager().getCommand(cmd.getPreferredName(), false)
.setExecutor(cmd.getExecutor())
.addAlias(cmd.getAliases())
.setArgumentBounds(cmd.getMinArguments(), cmd.getMaxArguments())
.setHelp(cmd.getHelp())
.setPermission(cmd.getPemission())
.setUsage(cmd.getUsage());
}
}
@Override
public void onReload() {
try {
config.load();
} catch (ConfigurationException e) {
log(Level.SEVERE, "There is an error in the configuration file. Please fix the error or delete the file to regenerate a new one.");
log(Level.SEVERE, e.getMessage());
getPluginLoader().disablePlugin(this);
return;
}
if (!PluginConfig.REPLACE_COMMANDS.getBoolean() && !this.replacedCommands.isEmpty()) {
restoreReplacedCommands();
}
this.configurationManager.flush();
loadComponents();
}
@Override
@UnsafeMethod
public void onDisable() {
this.configurationManager.save();
log("MyCommands v" + this.getDescription().getVersion() + " disabled.");
}
public static void log(String msg) {
log(Level.INFO, msg);
}
public static void log(Level level, String msg) {
logger.log(level, msg);
}
public static MyCommands getInstance() {
return instance;
}
public static void sendMessage(CommandSource source, String message) {
source.sendMessage(message);
}
public ConfigurationManager getConfigurationManager() {
return this.configurationManager;
}
public File getConfigFolder() {
return this.configFolder;
}
public class CommandInfo {
private Executor executor;
private List<String> aliases;
private String help;
private String usage;
private String permission;
private int min;
private int max;
public CommandInfo(org.spout.api.command.Command command) {
this.help = command.getHelp();
this.aliases = command.getAliases();
this.usage = command.getUsage();
this.permission = command.getPermission();
this.executor = command.getExecutor();
this.min = command.getMinArguments();
this.max = command.getMaxArguments();
}
public String getPemission() {
return this.permission;
}
public String getUsage() {
return this.usage;
}
public String getHelp() {
return this.help;
}
public int getMaxArguments() {
return this.max;
}
public int getMinArguments() {
return this.min;
}
public String[] getAliases() {
String[] out = new String[this.aliases.size()];
this.aliases.toArray(out);
return out;
}
public Executor getExecutor() {
return this.executor;
}
public String getPreferredName() {
return aliases.get(0);
}
}
} | UTF-8 | Java | 9,699 | java | MyCommands.java | Java | [] | null | [] | package net.minekingdom.MyCommands;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minekingdom.MyCommands.annotated.CommandLoadOrder;
import net.minekingdom.MyCommands.annotated.CommandRegister;
import net.minekingdom.MyCommands.annotated.CommandLoadOrder.Order;
import net.minekingdom.MyCommands.config.PluginConfig;
import org.spout.api.UnsafeMethod;
import org.spout.api.command.CommandSource;
import org.spout.api.command.Executor;
import org.spout.api.command.annotated.Command;
import org.spout.api.plugin.Plugin;
import org.spout.cereal.config.ConfigurationException;
public class MyCommands extends Plugin {
private static MyCommands instance;
private static Logger logger;
private File componentFolder;
private File configFolder;
private PluginConfig config;
private ConfigurationManager configurationManager;
private Set<CommandInfo> replacedCommands;
@Override
@UnsafeMethod
public void onEnable() {
instance = this;
logger = getLogger();
try {
config = new PluginConfig(getDataFolder());
config.load();
} catch (ConfigurationException e) {
log(Level.SEVERE, "There is an error in the configuration file. Please fix the error or delete the file to regenerate a new one.");
log(Level.SEVERE, e.getMessage());
getPluginLoader().disablePlugin(this);
return;
}
configurationManager = new ConfigurationManager();
this.componentFolder = new File(getDataFolder() + File.separator + "components");
if (!this.componentFolder.exists())
this.componentFolder.mkdirs();
this.configFolder = new File(getDataFolder() + File.separator + "config");
if (!this.configFolder.exists())
this.configFolder.mkdirs();
this.getEngine().getEventManager().registerEvents(new CoreListener(), this);
this.replacedCommands = new HashSet<CommandInfo>();
loadComponents();
log("MyCommands v" + this.getDescription().getVersion() + " enabled.");
}
private void loadComponents() {
List<File> files = new ArrayList<File>();
addTree(this.componentFolder, files);
List<Class<?>> components = new LinkedList<Class<?>>();
List<String> classes = new ArrayList<String>();
List<URL> urls = new ArrayList<URL>();
// Adds the url of every jar file.
{
try {
urls.add(this.componentFolder.toURI().toURL());
} catch (MalformedURLException ex) {}
for (File file : files) {
if (file.getName().endsWith(".jar")) {
try {
urls.add(new URL("jar:" + file.toURI().toURL() + "!/"));
classes.add(file.getName().substring(0, file.getName().length() - 4));
} catch (MalformedURLException ex) {}
continue;
}
classes.add(file.getName().substring(0, file.getName().length() - 6));
}
}
URLClassLoader ucl = new URLClassLoader(urls.toArray(new URL[urls.size()]), this.getClassLoader());
// loads every class and puts them into the components list
{
int normalIndex = 0;
for (String name : classes) {
try {
Class<?> c = Class.forName(name, true, ucl);
CommandLoadOrder loadOrder = c.getAnnotation(CommandLoadOrder.class);
if (loadOrder != null) {
if (loadOrder.value().equals(Order.FIRST)) {
normalIndex++;
components.add(0, c);
continue;
} else if (loadOrder.value().equals(Order.LAST)) {
components.add(c);
continue;
}
}
components.add(normalIndex, c);
} catch (ClassNotFoundException ex) {}
}
}
// Registers the commands and the listeners
{
for (Class<?> c : components) {
if (PluginConfig.REPLACE_COMMANDS.getBoolean()) {
for (Method m : c.getMethods()) {
Command annotation = m.getAnnotation(Command.class);
if (annotation == null)
continue;
/*for (String name : annotation.aliases()) {
this.getEngine().getCommandManager().getRootCommand().removeChild(name);
}*/
}
}
try {
CommandRegister.register(c);
log(c.getName() + " component sucessfully loaded.");
} catch (Throwable t) {
log(Level.SEVERE, c.getName() + " failed to load.\n");
t.printStackTrace();
}
}
}
try {
ucl.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
private void addTree(File file, List<File> files) {
File[] children = file.listFiles();
if (children != null) {
for (File child : children) {
if ((child.getName().endsWith(".class") || child.getName().endsWith(".jar")))
files.add(child);
addTree(child, files);
}
}
}
public void restoreReplacedCommands() {
for (CommandInfo cmd : this.replacedCommands) {
this.getEngine().getCommandManager().getCommand(cmd.getPreferredName(), false)
.setExecutor(cmd.getExecutor())
.addAlias(cmd.getAliases())
.setArgumentBounds(cmd.getMinArguments(), cmd.getMaxArguments())
.setHelp(cmd.getHelp())
.setPermission(cmd.getPemission())
.setUsage(cmd.getUsage());
}
}
@Override
public void onReload() {
try {
config.load();
} catch (ConfigurationException e) {
log(Level.SEVERE, "There is an error in the configuration file. Please fix the error or delete the file to regenerate a new one.");
log(Level.SEVERE, e.getMessage());
getPluginLoader().disablePlugin(this);
return;
}
if (!PluginConfig.REPLACE_COMMANDS.getBoolean() && !this.replacedCommands.isEmpty()) {
restoreReplacedCommands();
}
this.configurationManager.flush();
loadComponents();
}
@Override
@UnsafeMethod
public void onDisable() {
this.configurationManager.save();
log("MyCommands v" + this.getDescription().getVersion() + " disabled.");
}
public static void log(String msg) {
log(Level.INFO, msg);
}
public static void log(Level level, String msg) {
logger.log(level, msg);
}
public static MyCommands getInstance() {
return instance;
}
public static void sendMessage(CommandSource source, String message) {
source.sendMessage(message);
}
public ConfigurationManager getConfigurationManager() {
return this.configurationManager;
}
public File getConfigFolder() {
return this.configFolder;
}
public class CommandInfo {
private Executor executor;
private List<String> aliases;
private String help;
private String usage;
private String permission;
private int min;
private int max;
public CommandInfo(org.spout.api.command.Command command) {
this.help = command.getHelp();
this.aliases = command.getAliases();
this.usage = command.getUsage();
this.permission = command.getPermission();
this.executor = command.getExecutor();
this.min = command.getMinArguments();
this.max = command.getMaxArguments();
}
public String getPemission() {
return this.permission;
}
public String getUsage() {
return this.usage;
}
public String getHelp() {
return this.help;
}
public int getMaxArguments() {
return this.max;
}
public int getMinArguments() {
return this.min;
}
public String[] getAliases() {
String[] out = new String[this.aliases.size()];
this.aliases.toArray(out);
return out;
}
public Executor getExecutor() {
return this.executor;
}
public String getPreferredName() {
return aliases.get(0);
}
}
} | 9,699 | 0.533354 | 0.532632 | 291 | 31.336769 | 26.242786 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.498282 | false | false | 4 |
565c2842f9c10cd0248f0938ce4b73cfca9f4909 | 4,389,456,620,133 | cdc5459d19dde31381f00a4dac7fb19baad1eb85 | /Anual/src/main/java/utn/dds/partido/PartidoHome.java | 441810e0950ebffcfb39dd8a1047d450f4952b63 | [] | no_license | santiagopereztorre/tp-anual-futbol-dds-2014-2c | https://github.com/santiagopereztorre/tp-anual-futbol-dds-2014-2c | 203044cdc740de6f556f45f85cfe8b32cc8225ee | 02ab20df338300b0b90e6c945e1fe435a09cbaee | refs/heads/master | 2021-01-17T11:54:42.669000 | 2014-11-24T18:42:32 | 2014-11-24T18:42:32 | 30,208,064 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package utn.dds.partido;
import java.util.List;
import javax.persistence.Query;
import org.apache.commons.collections15.Predicate;
import org.uqbar.commons.model.CollectionBasedHome;
import utn.dds.db.EntityManagerHelper;
import utn.dds.jugador.Jugador;
public class PartidoHome extends CollectionBasedHome<Partido>{
private static PartidoHome instancia;
public Partido createExample() {
return new Partido();
}
public Class<Partido> getEntityType() {
return Partido.class;
}
protected Predicate<Partido> getCriterio(Partido example){
return null;
}
public static PartidoHome getInstancia() {
if (instancia == null) {
instancia = new PartidoHome();
}
return instancia;
}
@SuppressWarnings("unchecked")
public List<Partido> getPartidos()
{
Query query = EntityManagerHelper.createQuery("from Partido");
return query.getResultList();
}
@SuppressWarnings("unchecked")
private List<Jugador> getEquipoPorPartido(String equipo, Integer id)
{
Query query = EntityManagerHelper.createQuery("select "+ equipo +" from Partido p where p.id = ?1");
query.setParameter(1,id);
return query.getResultList();
}
@SuppressWarnings("unchecked")
public List<Jugador> getEquipo1PorPartido(Integer id)
{
return getEquipoPorPartido("equipo1", id);
}
@SuppressWarnings("unchecked")
public List<Jugador> getEquipo2PorPartido(Integer id)
{
return getEquipoPorPartido("equipo2", id);
}
}
| UTF-8 | Java | 1,441 | java | PartidoHome.java | Java | [] | null | [] | package utn.dds.partido;
import java.util.List;
import javax.persistence.Query;
import org.apache.commons.collections15.Predicate;
import org.uqbar.commons.model.CollectionBasedHome;
import utn.dds.db.EntityManagerHelper;
import utn.dds.jugador.Jugador;
public class PartidoHome extends CollectionBasedHome<Partido>{
private static PartidoHome instancia;
public Partido createExample() {
return new Partido();
}
public Class<Partido> getEntityType() {
return Partido.class;
}
protected Predicate<Partido> getCriterio(Partido example){
return null;
}
public static PartidoHome getInstancia() {
if (instancia == null) {
instancia = new PartidoHome();
}
return instancia;
}
@SuppressWarnings("unchecked")
public List<Partido> getPartidos()
{
Query query = EntityManagerHelper.createQuery("from Partido");
return query.getResultList();
}
@SuppressWarnings("unchecked")
private List<Jugador> getEquipoPorPartido(String equipo, Integer id)
{
Query query = EntityManagerHelper.createQuery("select "+ equipo +" from Partido p where p.id = ?1");
query.setParameter(1,id);
return query.getResultList();
}
@SuppressWarnings("unchecked")
public List<Jugador> getEquipo1PorPartido(Integer id)
{
return getEquipoPorPartido("equipo1", id);
}
@SuppressWarnings("unchecked")
public List<Jugador> getEquipo2PorPartido(Integer id)
{
return getEquipoPorPartido("equipo2", id);
}
}
| 1,441 | 0.748092 | 0.74254 | 65 | 21.169231 | 22.816708 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.338462 | false | false | 4 |
fb404c2eb4c7ded05e7112351bd66ce2bcb09962 | 16,973,710,801,060 | cb171f9e2cc470b3d4d13c02128eff705e11bded | /app/src/main/java/com/rdc/ruan/zzia/Main/AsyncTask/ScoreTask.java | 1e0ca13d333fca4cd031a5b18a19f28fbcda361e | [] | no_license | yulingyi/ZZIA | https://github.com/yulingyi/ZZIA | 8247994ea0c213fa3344d532dbb1ac5707841c9f | a759df3a3e82977c6b1ab345cd617f7dbc8749b3 | refs/heads/master | 2021-01-14T09:20:09.756000 | 2015-06-15T07:39:04 | 2015-06-15T07:39:04 | 37,451,087 | 0 | 0 | null | true | 2015-06-15T07:49:50 | 2015-06-15T07:49:50 | 2015-03-30T13:43:20 | 2015-06-15T07:41:00 | 716 | 0 | 0 | 0 | null | null | null | package com.rdc.ruan.zzia.Main.AsyncTask;
import android.os.AsyncTask;
import com.rdc.ruan.zzia.Main.HttpUtils.HttpUtil;
import com.rdc.ruan.zzia.Main.Interface.CallbackListener;
import org.apache.http.impl.client.DefaultHttpClient;
/**
* Created by Ruan on 2015/3/13.
*/
public class ScoreTask extends AsyncTask {
CallbackListener callbackListener;
String url,userid;
public void setCallbackListener(CallbackListener callbackListener){
this.callbackListener=callbackListener;
}
public ScoreTask(String url, String userid) {
super();
this.url=url;
this.userid=userid;
}
@Override
protected Object doInBackground(Object[] params) {
DefaultHttpClient client =new DefaultHttpClient();
String string="";
try {
string= HttpUtil.getUrl(url, client, HttpUtil.GetCookieUrl(url) + "xs_main.aspx?xh=" + userid);
}catch (Exception e) {
e.printStackTrace();
}
return string;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected void onPostExecute(Object o) {
super.onPostExecute(o);
callbackListener.Return(o);
}
@Override
protected void onProgressUpdate(Object[] values) {
super.onProgressUpdate(values);
}
}
| UTF-8 | Java | 1,352 | java | ScoreTask.java | Java | [
{
"context": "impl.client.DefaultHttpClient;\n\n\n/**\n * Created by Ruan on 2015/3/13.\n */\npublic class ScoreTask extends ",
"end": 260,
"score": 0.9888818860054016,
"start": 256,
"tag": "NAME",
"value": "Ruan"
}
] | null | [] | package com.rdc.ruan.zzia.Main.AsyncTask;
import android.os.AsyncTask;
import com.rdc.ruan.zzia.Main.HttpUtils.HttpUtil;
import com.rdc.ruan.zzia.Main.Interface.CallbackListener;
import org.apache.http.impl.client.DefaultHttpClient;
/**
* Created by Ruan on 2015/3/13.
*/
public class ScoreTask extends AsyncTask {
CallbackListener callbackListener;
String url,userid;
public void setCallbackListener(CallbackListener callbackListener){
this.callbackListener=callbackListener;
}
public ScoreTask(String url, String userid) {
super();
this.url=url;
this.userid=userid;
}
@Override
protected Object doInBackground(Object[] params) {
DefaultHttpClient client =new DefaultHttpClient();
String string="";
try {
string= HttpUtil.getUrl(url, client, HttpUtil.GetCookieUrl(url) + "xs_main.aspx?xh=" + userid);
}catch (Exception e) {
e.printStackTrace();
}
return string;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected void onPostExecute(Object o) {
super.onPostExecute(o);
callbackListener.Return(o);
}
@Override
protected void onProgressUpdate(Object[] values) {
super.onProgressUpdate(values);
}
}
| 1,352 | 0.659763 | 0.654586 | 53 | 24.509434 | 22.721134 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45283 | false | false | 4 |
0d07130622e50382f04ece1aec2bdc8d8e05a244 | 16,973,710,796,691 | d5ee5761f40d24257b09e80bd1185eb64757af94 | /lm_shop_pc_web/src/main/java/com/lm/feign/MemberServiceFegin.java | f78f7c551c4841bc9e73ae37c75357d91efcb0f2 | [] | no_license | leomiaomiao/shop | https://github.com/leomiaomiao/shop | 7236ccb05df6b2ea6e09c08c357ab83f2a695d0a | c0f7094eb5681fd60f33a05661de1ffd23186c2e | refs/heads/master | 2021-04-03T01:55:07.993000 | 2018-03-30T11:13:53 | 2018-03-30T11:13:53 | 124,849,692 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lm.feign;
import com.lm.api.service.MemberService;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
@FeignClient("member")
@Component
public interface MemberServiceFegin extends MemberService{
}
| UTF-8 | Java | 269 | java | MemberServiceFegin.java | Java | [] | null | [] | package com.lm.feign;
import com.lm.api.service.MemberService;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
@FeignClient("member")
@Component
public interface MemberServiceFegin extends MemberService{
}
| 269 | 0.836431 | 0.836431 | 10 | 25.9 | 22.509775 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 4 |
d5b88f6c21077cc792d050bd01f4a73ee3ba0ec2 | 5,798,205,891,480 | 035e766f7c80574f840b18b8894b06315c23145e | /src/com/blinov/itymchuk/one/HelloFriend.java | ee85190cc1d2a2951e30d3f3711ed834c2b2b7ca | [] | no_license | ihor-tymchuk/Java_exercises | https://github.com/ihor-tymchuk/Java_exercises | 1a7cd1062621a778a30da67e61777c3a86cd7cb3 | d53388f3bb2aaa7844f3d00ee2a9ac7474ba3a29 | refs/heads/master | 2023-06-03T18:13:38.841000 | 2021-06-22T17:59:57 | 2021-06-22T17:59:57 | 372,766,945 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.blinov.itymchuk.one;
/**
* Welcome user.
* You have to input your name in command line.
* This program print welcome with your name.
**/
public class HelloFriend {
public static void main(String[] args) {
sayHi(args);
}
public static void sayHi(String[] name) {
if (name.length != 0) System.out.println("Hello," + name[0]);
else System.out.println("You didn't input your name :(");
}
}
| UTF-8 | Java | 445 | java | HelloFriend.java | Java | [] | null | [] | package com.blinov.itymchuk.one;
/**
* Welcome user.
* You have to input your name in command line.
* This program print welcome with your name.
**/
public class HelloFriend {
public static void main(String[] args) {
sayHi(args);
}
public static void sayHi(String[] name) {
if (name.length != 0) System.out.println("Hello," + name[0]);
else System.out.println("You didn't input your name :(");
}
}
| 445 | 0.629214 | 0.624719 | 18 | 23.722221 | 22.95359 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.277778 | false | false | 4 |
f0c11e81e1553bbbe058a6790dff108303c693c1 | 21,887,153,387,419 | feff37ae73db02d51e389c9dfd28d518ac817684 | /car-dch/src/car/dch/dao/CarDao.java | 5a652b30644a387844dd61c9ba5e4288e489433d | [] | no_license | DengCH2018/Mybatis-layui | https://github.com/DengCH2018/Mybatis-layui | 3715eea613abc0e80996f5a838d15d1d7d5cf46d | fb7bde5869fb54884561fa21b26650d5a187e815 | refs/heads/master | 2023-01-10T02:10:33.804000 | 2020-11-19T08:57:50 | 2020-11-19T08:57:50 | 311,944,658 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package car.dch.dao;
import java.util.List;
import car.dch.common.Page;
import car.dch.entity.Car;
public interface CarDao {
/**
* ๅพๅฐ่ขซ่ฏฅ็จๆท็งๅ็่ฝฆ่พไฟกๆฏ
* @param uID
* @param page
* @return
*/
public List<Car> listBorrowCar(int uID,Page page);
/**
* ๆดๆฐ่ฝฆ่พไฟกๆฏ
* @param car
* @return
*/
public boolean updateCar(Car car);
/**
* ๅพๅฐ่ฝฆ่พไฟกๆฏ
* @param cID
* @return
*/
public Car getCar(int cID);
/**
* ๅ ้ค่ฝฆ่พไฟกๆฏ
* @param car
* @return
*/
public boolean deleteCar(int cID);
/**
* ๆๅ
ฅ่ฝฆ่พไฟกๆฏ
* @return
*/
public boolean insertCar(Car car);
/**
* ๅฑ็คบๆฒกๆ่ขซ็งๅ็่ฝฆ่พไฟกๆฏ
* @return
*/
public List<Car> listCar(Page page);
}
| UTF-8 | Java | 750 | java | CarDao.java | Java | [] | null | [] | package car.dch.dao;
import java.util.List;
import car.dch.common.Page;
import car.dch.entity.Car;
public interface CarDao {
/**
* ๅพๅฐ่ขซ่ฏฅ็จๆท็งๅ็่ฝฆ่พไฟกๆฏ
* @param uID
* @param page
* @return
*/
public List<Car> listBorrowCar(int uID,Page page);
/**
* ๆดๆฐ่ฝฆ่พไฟกๆฏ
* @param car
* @return
*/
public boolean updateCar(Car car);
/**
* ๅพๅฐ่ฝฆ่พไฟกๆฏ
* @param cID
* @return
*/
public Car getCar(int cID);
/**
* ๅ ้ค่ฝฆ่พไฟกๆฏ
* @param car
* @return
*/
public boolean deleteCar(int cID);
/**
* ๆๅ
ฅ่ฝฆ่พไฟกๆฏ
* @return
*/
public boolean insertCar(Car car);
/**
* ๅฑ็คบๆฒกๆ่ขซ็งๅ็่ฝฆ่พไฟกๆฏ
* @return
*/
public List<Car> listCar(Page page);
}
| 750 | 0.608896 | 0.608896 | 48 | 12.583333 | 11.743497 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.041667 | false | false | 4 |
ed89c690643db4729dd4cb24db34389e8a974371 | 7,069,516,230,485 | eb6eda245fd75507dce6ec517c8a232d6b4a2a6b | /weblearnex-common/src/main/java/com/weblearnex/app/datatable/reposatory/ClientRepository.java | 1eba5b79f2eb1473e5c67d9273066d1ae8d95afa | [] | no_license | raina9/rocketC | https://github.com/raina9/rocketC | f4d25f50e5053a158d669d402d36a9a8cbf7b014 | 4519a8ce1e3390fbe7aaa4ed8bb796025aba4101 | refs/heads/master | 2023-06-12T04:33:40.386000 | 2021-07-03T18:18:19 | 2021-07-03T18:18:19 | 382,682,727 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.weblearnex.app.datatable.reposatory;
import com.weblearnex.app.entity.master.Country;
import com.weblearnex.app.entity.setup.Client;
import com.weblearnex.app.entity.setup.Status;
import org.springframework.data.jpa.datatables.repository.DataTablesRepository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ClientRepository extends DataTablesRepository<Client, Long> {
Client findById(String id);
Client findByClientCode(String clientCode);
Client findByClientName(String clientName);
List<Client> findByActive(Integer active);
boolean existsByClientCode(String clientCode);
List<Client> findAllByActiveAndClientCodeIn(Integer integer, List<String> clientCodes);
}
| UTF-8 | Java | 822 | java | ClientRepository.java | Java | [] | null | [] | package com.weblearnex.app.datatable.reposatory;
import com.weblearnex.app.entity.master.Country;
import com.weblearnex.app.entity.setup.Client;
import com.weblearnex.app.entity.setup.Status;
import org.springframework.data.jpa.datatables.repository.DataTablesRepository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ClientRepository extends DataTablesRepository<Client, Long> {
Client findById(String id);
Client findByClientCode(String clientCode);
Client findByClientName(String clientName);
List<Client> findByActive(Integer active);
boolean existsByClientCode(String clientCode);
List<Client> findAllByActiveAndClientCodeIn(Integer integer, List<String> clientCodes);
}
| 822 | 0.821168 | 0.821168 | 21 | 38.142857 | 27.269878 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.761905 | false | false | 4 |
3bbd693080ee0b40050dd846bd7d431edd33e4dd | 21,706,764,767,200 | c4a75bbd4bfaff2d9b1f92fdcc2fe48af79ff64f | /src/main/java/com/hengtong/led/vueMenu/entity/AdminMenu.java | 5fad950eb1559c352097bdc0d7206e37dc3873a4 | [] | no_license | chenpengfu0708/cpf | https://github.com/chenpengfu0708/cpf | 67588e8d4a01528804d48234aa929b9b2bbb027a | 41832b238448aaa5b86c2e784f51874997314426 | refs/heads/master | 2021-08-26T07:57:55.652000 | 2021-04-23T09:33:36 | 2021-04-23T09:33:36 | 188,398,557 | 1 | 0 | null | false | 2021-08-25T15:55:54 | 2019-05-24T09:59:17 | 2021-04-23T09:34:08 | 2021-08-25T15:55:51 | 9,390 | 1 | 0 | 4 | Java | false | false | package com.hengtong.led.vueMenu.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
* ็ฎก็ๅๅฐ่ๅ่กจ
* </p>
*
* @author Liang Wenxu
* @since 2018-12-14
*/
@Data
public class AdminMenu {
private String id;
// ๅๅปบๆถ้ด
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date dateCreated;
// ๅ ้คๆถ้ด
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date deleteDate;
// ้ป่พๅ ้คๆ ๅฟ๏ผ1ไธบๅทฒๅ ้ค๏ผ0ไธบๆชๅ ้ค
private Integer deleteFlag = 0;
// ๆๅๆดๆฐๆถ้ด
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date lastUpdated;
// ๆฐๆฎ็ๆฌๅท๏ผ็จไบไน่ง้๏ผinsertๅไธบ1๏ผupdateๅ่ชๅข
private Integer version;
// ่ๅไปฃ็
private String code;
// ๅพๆ URL๏ผๅฐ๏ผ
private String icon;
// ๅพๆ ๅพ็URL๏ผๅคง๏ผ
private String iconLarge;
// ่ๅๅ็งฐ
private String name;
// ็ฎๆ ๏ผ_blank็ญ๏ผ
private String target;
// ่ๅ้พๆฅ
private String url;
// ๆ้ID
private String permId;
// ไธ็บง่ๅID
private String parentId;
// ๆพ็คบ้กบๅบ๏ผ่ถๅฐ่ถ้ ๅ
private Integer showIdx;
}
| UTF-8 | Java | 1,362 | java | AdminMenu.java | Java | [
{
"context": "Date;\n\n/**\n * <p>\n * ็ฎก็ๅๅฐ่ๅ่กจ\n * </p>\n *\n * @author Liang Wenxu\n * @since 2018-12-14\n */\n@Data\npublic class Admin",
"end": 226,
"score": 0.9994847178459167,
"start": 215,
"tag": "NAME",
"value": "Liang Wenxu"
}
] | null | [] | package com.hengtong.led.vueMenu.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
* ็ฎก็ๅๅฐ่ๅ่กจ
* </p>
*
* @author <NAME>
* @since 2018-12-14
*/
@Data
public class AdminMenu {
private String id;
// ๅๅปบๆถ้ด
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date dateCreated;
// ๅ ้คๆถ้ด
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date deleteDate;
// ้ป่พๅ ้คๆ ๅฟ๏ผ1ไธบๅทฒๅ ้ค๏ผ0ไธบๆชๅ ้ค
private Integer deleteFlag = 0;
// ๆๅๆดๆฐๆถ้ด
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date lastUpdated;
// ๆฐๆฎ็ๆฌๅท๏ผ็จไบไน่ง้๏ผinsertๅไธบ1๏ผupdateๅ่ชๅข
private Integer version;
// ่ๅไปฃ็
private String code;
// ๅพๆ URL๏ผๅฐ๏ผ
private String icon;
// ๅพๆ ๅพ็URL๏ผๅคง๏ผ
private String iconLarge;
// ่ๅๅ็งฐ
private String name;
// ็ฎๆ ๏ผ_blank็ญ๏ผ
private String target;
// ่ๅ้พๆฅ
private String url;
// ๆ้ID
private String permId;
// ไธ็บง่ๅID
private String parentId;
// ๆพ็คบ้กบๅบ๏ผ่ถๅฐ่ถ้ ๅ
private Integer showIdx;
}
| 1,357 | 0.634251 | 0.621343 | 67 | 16.343283 | 16.801344 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.343284 | false | false | 4 |
40e1f15e9f73410999d26dfc96903f32f717c2b3 | 17,119,739,653,019 | 33c25aca1036663e4cca3049626f646c3dd0f8dc | /boogletest/src/boogletest/Computer.java | 427d0dd91b791bb135b35ea3bb4d527c2320ecf1 | [] | no_license | siwarelayechi/boogle | https://github.com/siwarelayechi/boogle | 4843e19d043215c064502223e3f157f4285a0c2c | dc0438afe2cd4354773cc3eff3790b22e749a051 | refs/heads/master | 2022-11-24T13:47:18.984000 | 2020-07-23T22:56:44 | 2020-07-23T22:56:44 | 282,073,307 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package boogletest;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
public class Computer extends Boogle {
public ArrayList<String> list_mot_pc;// Declaration d'une liste dynamique qui va contenir les mots touvรฉs par l'ordinateur
private int score;// le score de l'ordinateur
//constructeur Computer sert ร initialiser la liste list_mot_pc et le score
public Computer() {
list_mot_pc=new ArrayList<String>();
score=0;}
// getScore permet d'acceder au score
public int getScore() {
return score;}
// setScore permet de modifier le score
public void setScore(int score) {
this.score = score;
}
/*la fonction found permet de verifier si les mots du dictionnaire existe dans le plateau ou non
*si un mot du dictionnaire existe dans le plateau il sera ajouter dans la liste */
public ArrayList<String> found (char[][] plateau , String fichier )
{ try (BufferedReader buffer = new BufferedReader(new FileReader(fichier))) {
String line;
while (((line = buffer.readLine()) != null) )
{ /* parcour du fichier ligne par ligne avec buffer.readline()
*on fait un appel ร la fonction apprtient_ds_plateau pour checher le mot donnรฉ par le dictionnaire
dans le plateau */
if (appartient_ds_plateau(line.toUpperCase(),plateau) ==1)
{list_mot_pc.add(line.toUpperCase());}}// le mot est trouvรฉ est ajoutรฉ ร la liste
buffer.close();}//fermer le dictionnaire
catch (IOException e) {
e.printStackTrace();}
return list_mot_pc;}
/* cette fonction permet d'afficher les mots trouvรฉs par l'ordinateur ร conditions que les mots n'existe pas dans
* la liste de l'utilisateur et la taille du mot ne soit pas inferieur ร 3 aussi elle affiche les points de chaque mot
* et le score total qui est la somme des points */
public void affiche_resultat_pc (ArrayList<String> list_mot_j){
int s=0;
if (list_mot_pc.size()==0){System.out.println("la liste du mot est vide \n l'ordinateur n'a identifiรฉ aucun mot ");}
else {
System.out.println("\n\n\n~~~~~~~~~~~~~~~~~~~ Resultat de l'ordinateur ~~~~~~~~~~~~~~~");
System.out.println("------------------------------------------------");
System.out.println("|Mot Taille du Mot Point |");
System.out.println("------------------------------------------------");
for (int i=0;i<list_mot_pc.size();i++)
{if ((list_mot_pc.get(i).length()>3)&&(list_mot_j.contains(list_mot_pc.get(i)))==false)
{System.out.println("|"+list_mot_pc.get(i)+ " "+list_mot_pc.get(i).length()+" "+(list_mot_pc.get(i).length()-2));}
s+=(list_mot_pc.get(i).length()-2) ;
setScore(s);}
System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");}
System.out.println("************Score Total de l'ordinateur est: "+getScore()+"************");
}
}
| ISO-8859-1 | Java | 2,897 | java | Computer.java | Java | [] | null | [] | package boogletest;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
public class Computer extends Boogle {
public ArrayList<String> list_mot_pc;// Declaration d'une liste dynamique qui va contenir les mots touvรฉs par l'ordinateur
private int score;// le score de l'ordinateur
//constructeur Computer sert ร initialiser la liste list_mot_pc et le score
public Computer() {
list_mot_pc=new ArrayList<String>();
score=0;}
// getScore permet d'acceder au score
public int getScore() {
return score;}
// setScore permet de modifier le score
public void setScore(int score) {
this.score = score;
}
/*la fonction found permet de verifier si les mots du dictionnaire existe dans le plateau ou non
*si un mot du dictionnaire existe dans le plateau il sera ajouter dans la liste */
public ArrayList<String> found (char[][] plateau , String fichier )
{ try (BufferedReader buffer = new BufferedReader(new FileReader(fichier))) {
String line;
while (((line = buffer.readLine()) != null) )
{ /* parcour du fichier ligne par ligne avec buffer.readline()
*on fait un appel ร la fonction apprtient_ds_plateau pour checher le mot donnรฉ par le dictionnaire
dans le plateau */
if (appartient_ds_plateau(line.toUpperCase(),plateau) ==1)
{list_mot_pc.add(line.toUpperCase());}}// le mot est trouvรฉ est ajoutรฉ ร la liste
buffer.close();}//fermer le dictionnaire
catch (IOException e) {
e.printStackTrace();}
return list_mot_pc;}
/* cette fonction permet d'afficher les mots trouvรฉs par l'ordinateur ร conditions que les mots n'existe pas dans
* la liste de l'utilisateur et la taille du mot ne soit pas inferieur ร 3 aussi elle affiche les points de chaque mot
* et le score total qui est la somme des points */
public void affiche_resultat_pc (ArrayList<String> list_mot_j){
int s=0;
if (list_mot_pc.size()==0){System.out.println("la liste du mot est vide \n l'ordinateur n'a identifiรฉ aucun mot ");}
else {
System.out.println("\n\n\n~~~~~~~~~~~~~~~~~~~ Resultat de l'ordinateur ~~~~~~~~~~~~~~~");
System.out.println("------------------------------------------------");
System.out.println("|Mot Taille du Mot Point |");
System.out.println("------------------------------------------------");
for (int i=0;i<list_mot_pc.size();i++)
{if ((list_mot_pc.get(i).length()>3)&&(list_mot_j.contains(list_mot_pc.get(i)))==false)
{System.out.println("|"+list_mot_pc.get(i)+ " "+list_mot_pc.get(i).length()+" "+(list_mot_pc.get(i).length()-2));}
s+=(list_mot_pc.get(i).length()-2) ;
setScore(s);}
System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");}
System.out.println("************Score Total de l'ordinateur est: "+getScore()+"************");
}
}
| 2,897 | 0.635135 | 0.632017 | 76 | 36.973682 | 38.412228 | 146 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.394737 | false | false | 4 |
dd9150375886177168b9e47add6601a2091dd6c3 | 1,743,756,788,349 | fc086f9a6d2b1f806231f64ae66d5e581487c7c4 | /android/code/BonnieDraw/app/src/main/java/com/sctw/bonniedraw/activity/LoginActivity.java | 41461d990a6746dc30a78f622785c65cb6a11835 | [] | no_license | jimmyxiao/Bonnie | https://github.com/jimmyxiao/Bonnie | d1c4f232f7255b280163e4b555fbf0ab3f4a0eb3 | 862c416000d3019a3ab7a5a207deb41b51872b26 | refs/heads/master | 2022-03-31T19:50:47.972000 | 2020-03-05T10:21:24 | 2020-03-05T10:21:24 | 62,611,793 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sctw.bonniedraw.activity;
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.firebase.iid.FirebaseInstanceId;
import com.sctw.bonniedraw.R;
import com.sctw.bonniedraw.fragment.LoginFragment;
import com.sctw.bonniedraw.utility.ConnectJson;
import com.sctw.bonniedraw.utility.ForceUpdateChecker;
import com.sctw.bonniedraw.utility.FullScreenDialog;
import com.sctw.bonniedraw.utility.GlobalVariable;
import com.sctw.bonniedraw.utility.OkHttpUtil;
import com.sctw.bonniedraw.utility.PxDpConvert;
import com.sctw.bonniedraw.widget.ToastUtil;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class LoginActivity extends AppCompatActivity implements Animation.AnimationListener ,ForceUpdateChecker.OnUpdateNeededListener {
private static final int REQUEST_EXTERNAL_STORAGE = 0;
SharedPreferences prefs;
Boolean mbLoginCheck = false;
FragmentManager fragmentManager;
LinearLayout mLinearLayout;
FrameLayout mFrameLayout;
AlphaAnimation mAlphaAnimation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
prefs = getSharedPreferences(GlobalVariable.MEMBER_PREFS, MODE_PRIVATE);
ForceUpdateChecker.with(this).onUpdateNeeded(this).check();
updateFCM();
mLinearLayout = findViewById(R.id.frameLayout_login_frist);
mFrameLayout = findViewById(R.id.frameLayout_login);
mFrameLayout.setVisibility(View.INVISIBLE);
mAlphaAnimation = new AlphaAnimation(0, 1);
mAlphaAnimation.setDuration(2000);
mLinearLayout.setAnimation(mAlphaAnimation);
mAlphaAnimation.setAnimationListener(this);
if (prefs != null && !prefs.getString(GlobalVariable.USER_TOKEN_STR, "").isEmpty()) {
mbLoginCheck = true;
} else {
mbLoginCheck = false;
}
if (ActivityCompat.checkSelfPermission(LoginActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE},
REQUEST_EXTERNAL_STORAGE);
}
}else {
startAndCheck();
}
}
private void updateFCM() {
prefs.edit()
.putString(GlobalVariable.USER_FCM_TOKEN_STR, FirebaseInstanceId.getInstance().getToken())
.putString(GlobalVariable.USER_DEVICE_ID_STR, FirebaseInstanceId.getInstance().getId())
.apply();
}
void startAndCheck() {
mAlphaAnimation.start();
}
private void checkLoginInfo(SharedPreferences prefs) {
switch (prefs.getInt(GlobalVariable.USER_THIRD_PLATFORM_STR, 0)) {
case GlobalVariable.EMAIL_LOGIN:
loginEamil();
break;
case 0:
runOnUiThread(new Runnable() {
@Override
public void run() {
ToastUtil.createToastWindow(getApplicationContext(), getString(R.string.u01_01_login_data_error), PxDpConvert.getSystemHight(getApplicationContext()) / 3);
}
});
break;
default:
loginThird();
break;
}
}
private void loginEamil() {
OkHttpClient mOkHttpClient = OkHttpUtil.getInstance();
Request request = ConnectJson.loginJson(prefs, 1);
Call call = mOkHttpClient.newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
ToastUtil.createToastWindow(LoginActivity.this, getString(R.string.uc_connection_failed), PxDpConvert.getSystemHight(getApplicationContext()) / 3);
}
});
}
@Override
public void onResponse(Call call, Response response) throws IOException {
final String responseStr = response.body().string();
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
JSONObject responseJSON = new JSONObject(responseStr);
if (responseJSON.getInt("res") == 1) {
//Successful
prefs.edit()
.putInt(GlobalVariable.USER_THIRD_PLATFORM_STR, GlobalVariable.EMAIL_LOGIN)
.putString(GlobalVariable.USER_TOKEN_STR, responseJSON.getString("lk"))
.putString(GlobalVariable.USER_NAME_STR, responseJSON.getJSONObject("userInfo").getString("userName"))
.putString(GlobalVariable.USER_EMAIL_STR, responseJSON.getJSONObject("userInfo").getString("email"))
.putString(GlobalVariable.API_TOKEN, responseJSON.getString("lk"))
.putString(GlobalVariable.API_UID, responseJSON.getString("ui"))
.putString(GlobalVariable.USER_GROUP, responseJSON.getString("userGroup"))
.putString(GlobalVariable.USER_IMG_URL_STR, responseJSON.getJSONObject("userInfo").getString("profilePicture"))
.apply();
transferMainPage();
} else {
ToastUtil.createToastWindow(LoginActivity.this, getString(R.string.u01_01_login_fail), PxDpConvert.getSystemHight(getApplicationContext()) / 3);
}
} catch (JSONException e) {
e.printStackTrace();
} finally {
transferMainPage();
}
}
});
}
});
}
private void loginThird() {
OkHttpClient mOkHttpClient = OkHttpUtil.getInstance();
Request request = ConnectJson.loginJson(prefs, 3);
Call call = mOkHttpClient.newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
ToastUtil.createToastWindow(LoginActivity.this, getString(R.string.u01_01_login_fail), PxDpConvert.getSystemHight(getApplicationContext()) / 3);
}
});
}
@Override
public void onResponse(Call call, Response response) throws IOException {
final String responseStr = response.body().string();
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
JSONObject responseJSON = new JSONObject(responseStr);
if (responseJSON.getInt("res") == 1) {
//่ฆๅญTOKEN
prefs.edit()
.putString(GlobalVariable.API_TOKEN, responseJSON.getString("lk"))
.putString(GlobalVariable.API_UID, responseJSON.getString("ui"))
.putString(GlobalVariable.USER_GROUP, responseJSON.getString("userGroup"))
.putString(GlobalVariable.USER_NAME_STR, responseJSON.getJSONObject("userInfo").getString("userName"))
.putString(GlobalVariable.USER_IMG_URL_STR, responseJSON.getJSONObject("userInfo").getString("profilePicture"))
.apply();
transferMainPage();
} else {
runOnUiThread(new Runnable() {
@Override
public void run() {
ToastUtil.createToastWindow(LoginActivity.this, getString(R.string.u01_01_login_fail), PxDpConvert.getSystemHight(getApplicationContext()) / 3);
}
});
}
} catch (JSONException e) {
e.printStackTrace();
final FullScreenDialog dialog = new FullScreenDialog(LoginActivity.this, R.layout.dialog_base);
FrameLayout layout = dialog.findViewById(R.id.frameLayout_dialog_base);
Button btnOk = dialog.findViewById(R.id.btn_dialog_base_yes);
TextView tvTitle = dialog.findViewById(R.id.textView_dialog_base_title);
TextView tvMsg = dialog.findViewById(R.id.textView_dialog_base_msg);
tvTitle.setText(getString(R.string.u01_01_login_fail));
tvMsg.setText(getString(R.string.uc_connection_failed));
dialog.setCancelable(false);
btnOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
finish();
}
});
layout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
finish();
}
});
dialog.show();
} finally {
//้่ฆ้ๅ
//transferMainPage();
}
}
});
}
});
}
public void transferLoginPage() {
fragmentManager = getSupportFragmentManager();
FragmentTransaction ft = fragmentManager.beginTransaction();
LoginFragment loginFragment = new LoginFragment();
ft.add(R.id.frameLayout_login, loginFragment, "LoginFragment");
ft.commitAllowingStateLoss();
mLinearLayout.setVisibility(View.INVISIBLE);
mFrameLayout.setVisibility(View.VISIBLE);
}
public void transferMainPage() {
Intent it = new Intent();
it.setClass(this, MainActivity.class);
it.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(it);
finish();
}
@Override
public void onBackPressed() {
if (getFragmentManager().getBackStackEntryCount() == 0) {
super.onBackPressed();
} else {
getFragmentManager().popBackStack();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
FragmentManager fragment = getSupportFragmentManager();
if (fragment != null) {
fragment.findFragmentByTag("LoginFragment").onActivityResult(requestCode, resultCode, data);
} else Log.d("Twitter", "fragment is null");
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case REQUEST_EXTERNAL_STORAGE:
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startAndCheck();
} else {
ToastUtil.createToastIsCheck(this, "ๆ็ตๅญๅๆฌ้๏ผๅฐๆ่ชๅ้้็จๅผใ", false, PxDpConvert.getSystemHight(this) / 3);
//ไฝฟ็จ่
ๆ็ตๆฌ้๏ผ้้็จๅผ
finish();
}
break;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (mbLoginCheck) {
checkLoginInfo(prefs);
} else {
transferLoginPage();
}
}
@Override
public void onAnimationRepeat(Animation animation) {
}
//Firebase force update app
@Override
public void onUpdateNeeded(final String updateUrl) {
AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle("New version available")
.setMessage("Please, update app to new version to continue reposting.")
.setPositiveButton("Update",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
redirectStore(updateUrl);
}
}).setNegativeButton("No, thanks",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
}).create();
dialog.show();
}
private void redirectStore(String updateUrl) {
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(updateUrl));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}
| UTF-8 | Java | 15,273 | java | LoginActivity.java | Java | [] | null | [] | package com.sctw.bonniedraw.activity;
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.firebase.iid.FirebaseInstanceId;
import com.sctw.bonniedraw.R;
import com.sctw.bonniedraw.fragment.LoginFragment;
import com.sctw.bonniedraw.utility.ConnectJson;
import com.sctw.bonniedraw.utility.ForceUpdateChecker;
import com.sctw.bonniedraw.utility.FullScreenDialog;
import com.sctw.bonniedraw.utility.GlobalVariable;
import com.sctw.bonniedraw.utility.OkHttpUtil;
import com.sctw.bonniedraw.utility.PxDpConvert;
import com.sctw.bonniedraw.widget.ToastUtil;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class LoginActivity extends AppCompatActivity implements Animation.AnimationListener ,ForceUpdateChecker.OnUpdateNeededListener {
private static final int REQUEST_EXTERNAL_STORAGE = 0;
SharedPreferences prefs;
Boolean mbLoginCheck = false;
FragmentManager fragmentManager;
LinearLayout mLinearLayout;
FrameLayout mFrameLayout;
AlphaAnimation mAlphaAnimation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
prefs = getSharedPreferences(GlobalVariable.MEMBER_PREFS, MODE_PRIVATE);
ForceUpdateChecker.with(this).onUpdateNeeded(this).check();
updateFCM();
mLinearLayout = findViewById(R.id.frameLayout_login_frist);
mFrameLayout = findViewById(R.id.frameLayout_login);
mFrameLayout.setVisibility(View.INVISIBLE);
mAlphaAnimation = new AlphaAnimation(0, 1);
mAlphaAnimation.setDuration(2000);
mLinearLayout.setAnimation(mAlphaAnimation);
mAlphaAnimation.setAnimationListener(this);
if (prefs != null && !prefs.getString(GlobalVariable.USER_TOKEN_STR, "").isEmpty()) {
mbLoginCheck = true;
} else {
mbLoginCheck = false;
}
if (ActivityCompat.checkSelfPermission(LoginActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE},
REQUEST_EXTERNAL_STORAGE);
}
}else {
startAndCheck();
}
}
private void updateFCM() {
prefs.edit()
.putString(GlobalVariable.USER_FCM_TOKEN_STR, FirebaseInstanceId.getInstance().getToken())
.putString(GlobalVariable.USER_DEVICE_ID_STR, FirebaseInstanceId.getInstance().getId())
.apply();
}
void startAndCheck() {
mAlphaAnimation.start();
}
private void checkLoginInfo(SharedPreferences prefs) {
switch (prefs.getInt(GlobalVariable.USER_THIRD_PLATFORM_STR, 0)) {
case GlobalVariable.EMAIL_LOGIN:
loginEamil();
break;
case 0:
runOnUiThread(new Runnable() {
@Override
public void run() {
ToastUtil.createToastWindow(getApplicationContext(), getString(R.string.u01_01_login_data_error), PxDpConvert.getSystemHight(getApplicationContext()) / 3);
}
});
break;
default:
loginThird();
break;
}
}
private void loginEamil() {
OkHttpClient mOkHttpClient = OkHttpUtil.getInstance();
Request request = ConnectJson.loginJson(prefs, 1);
Call call = mOkHttpClient.newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
ToastUtil.createToastWindow(LoginActivity.this, getString(R.string.uc_connection_failed), PxDpConvert.getSystemHight(getApplicationContext()) / 3);
}
});
}
@Override
public void onResponse(Call call, Response response) throws IOException {
final String responseStr = response.body().string();
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
JSONObject responseJSON = new JSONObject(responseStr);
if (responseJSON.getInt("res") == 1) {
//Successful
prefs.edit()
.putInt(GlobalVariable.USER_THIRD_PLATFORM_STR, GlobalVariable.EMAIL_LOGIN)
.putString(GlobalVariable.USER_TOKEN_STR, responseJSON.getString("lk"))
.putString(GlobalVariable.USER_NAME_STR, responseJSON.getJSONObject("userInfo").getString("userName"))
.putString(GlobalVariable.USER_EMAIL_STR, responseJSON.getJSONObject("userInfo").getString("email"))
.putString(GlobalVariable.API_TOKEN, responseJSON.getString("lk"))
.putString(GlobalVariable.API_UID, responseJSON.getString("ui"))
.putString(GlobalVariable.USER_GROUP, responseJSON.getString("userGroup"))
.putString(GlobalVariable.USER_IMG_URL_STR, responseJSON.getJSONObject("userInfo").getString("profilePicture"))
.apply();
transferMainPage();
} else {
ToastUtil.createToastWindow(LoginActivity.this, getString(R.string.u01_01_login_fail), PxDpConvert.getSystemHight(getApplicationContext()) / 3);
}
} catch (JSONException e) {
e.printStackTrace();
} finally {
transferMainPage();
}
}
});
}
});
}
private void loginThird() {
OkHttpClient mOkHttpClient = OkHttpUtil.getInstance();
Request request = ConnectJson.loginJson(prefs, 3);
Call call = mOkHttpClient.newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
ToastUtil.createToastWindow(LoginActivity.this, getString(R.string.u01_01_login_fail), PxDpConvert.getSystemHight(getApplicationContext()) / 3);
}
});
}
@Override
public void onResponse(Call call, Response response) throws IOException {
final String responseStr = response.body().string();
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
JSONObject responseJSON = new JSONObject(responseStr);
if (responseJSON.getInt("res") == 1) {
//่ฆๅญTOKEN
prefs.edit()
.putString(GlobalVariable.API_TOKEN, responseJSON.getString("lk"))
.putString(GlobalVariable.API_UID, responseJSON.getString("ui"))
.putString(GlobalVariable.USER_GROUP, responseJSON.getString("userGroup"))
.putString(GlobalVariable.USER_NAME_STR, responseJSON.getJSONObject("userInfo").getString("userName"))
.putString(GlobalVariable.USER_IMG_URL_STR, responseJSON.getJSONObject("userInfo").getString("profilePicture"))
.apply();
transferMainPage();
} else {
runOnUiThread(new Runnable() {
@Override
public void run() {
ToastUtil.createToastWindow(LoginActivity.this, getString(R.string.u01_01_login_fail), PxDpConvert.getSystemHight(getApplicationContext()) / 3);
}
});
}
} catch (JSONException e) {
e.printStackTrace();
final FullScreenDialog dialog = new FullScreenDialog(LoginActivity.this, R.layout.dialog_base);
FrameLayout layout = dialog.findViewById(R.id.frameLayout_dialog_base);
Button btnOk = dialog.findViewById(R.id.btn_dialog_base_yes);
TextView tvTitle = dialog.findViewById(R.id.textView_dialog_base_title);
TextView tvMsg = dialog.findViewById(R.id.textView_dialog_base_msg);
tvTitle.setText(getString(R.string.u01_01_login_fail));
tvMsg.setText(getString(R.string.uc_connection_failed));
dialog.setCancelable(false);
btnOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
finish();
}
});
layout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
finish();
}
});
dialog.show();
} finally {
//้่ฆ้ๅ
//transferMainPage();
}
}
});
}
});
}
public void transferLoginPage() {
fragmentManager = getSupportFragmentManager();
FragmentTransaction ft = fragmentManager.beginTransaction();
LoginFragment loginFragment = new LoginFragment();
ft.add(R.id.frameLayout_login, loginFragment, "LoginFragment");
ft.commitAllowingStateLoss();
mLinearLayout.setVisibility(View.INVISIBLE);
mFrameLayout.setVisibility(View.VISIBLE);
}
public void transferMainPage() {
Intent it = new Intent();
it.setClass(this, MainActivity.class);
it.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(it);
finish();
}
@Override
public void onBackPressed() {
if (getFragmentManager().getBackStackEntryCount() == 0) {
super.onBackPressed();
} else {
getFragmentManager().popBackStack();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
FragmentManager fragment = getSupportFragmentManager();
if (fragment != null) {
fragment.findFragmentByTag("LoginFragment").onActivityResult(requestCode, resultCode, data);
} else Log.d("Twitter", "fragment is null");
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case REQUEST_EXTERNAL_STORAGE:
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startAndCheck();
} else {
ToastUtil.createToastIsCheck(this, "ๆ็ตๅญๅๆฌ้๏ผๅฐๆ่ชๅ้้็จๅผใ", false, PxDpConvert.getSystemHight(this) / 3);
//ไฝฟ็จ่
ๆ็ตๆฌ้๏ผ้้็จๅผ
finish();
}
break;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (mbLoginCheck) {
checkLoginInfo(prefs);
} else {
transferLoginPage();
}
}
@Override
public void onAnimationRepeat(Animation animation) {
}
//Firebase force update app
@Override
public void onUpdateNeeded(final String updateUrl) {
AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle("New version available")
.setMessage("Please, update app to new version to continue reposting.")
.setPositiveButton("Update",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
redirectStore(updateUrl);
}
}).setNegativeButton("No, thanks",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
}).create();
dialog.show();
}
private void redirectStore(String updateUrl) {
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(updateUrl));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}
| 15,273 | 0.554554 | 0.551134 | 351 | 42.319088 | 35.071934 | 184 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.609687 | false | false | 4 |
9e66c6747f5a3b26f051069750e78fc28f368795 | 14,705,968,065,876 | 9702a51962cda6e1922d671dbec8acf21d9e84ec | /src/main/com/topcoder/web/tc/controller/legacy/pacts/common/Links.java | 6990d18eabba7ab85706ce5073daed7a41cc33c6 | [] | no_license | topcoder-platform/tc-website | https://github.com/topcoder-platform/tc-website | ccf111d95a4d7e033d3cf2f6dcf19364babb8a08 | 15ab92adf0e60afb1777b3d548b5ba3c3f6c12f7 | refs/heads/dev | 2023-08-23T13:41:21.308000 | 2023-04-04T01:28:38 | 2023-04-04T01:28:38 | 83,655,110 | 3 | 19 | null | false | 2023-04-04T01:32:16 | 2017-03-02T08:43:01 | 2023-01-31T16:48:18 | 2023-04-04T01:32:15 | 504,085 | 2 | 14 | 19 | Java | false | false | package com.topcoder.web.tc.controller.legacy.pacts.common;
import java.util.List;
public class Links implements PactsConstants {
private static String createLink(String module, String param1, String value1) {
return INTERNAL_SERVLET_URL + "?module=" + module + "&" + param1 + "=" + value1;
}
private static String createLink(String module, String param1, String value1, String param2, String value2) {
return INTERNAL_SERVLET_URL + "?module=" + module + "&" + param1 + "=" + value1 + "&" + param2 + "=" + value2;
}
public static String addAffidavit(long userId) {
return createLink("AddAffidavit", USER_ID, userId + "");
}
public static String updateUserAccrual(long userId) {
return createLink("EditUserAccrualAmount", USER_ID, userId + "");
}
public static String updateUserPaymentMethod(long userId) {
return createLink("EditUserPaymentMethod", USER_ID, userId + "");
}
public static String addGlobalAD(long userId) {
return createLink("AddGlobalAD", USER_ID, userId + "");
}
public static String addAssignmentDocument(long userId) {
return createLink("AddAssignmentDocument", USER_ID, userId + "");
}
public static String addAffidavitForPayment(long userId, long paymentId) {
return createLink("AddAffidavit", USER_ID, userId + "", PAYMENT_ID, paymentId + "");
}
public static String updateAssignmentDocument(long assignmentDocumentId) {
return createLink("AddAssignmentDocument", ASSIGNMENT_DOCUMENT_ID, assignmentDocumentId + "");
}
public static String updateAffidavit(long affidavitId) {
return createLink("UpdateAffidavit", AFFIDAVIT_ID, affidavitId + "");
}
public static String viewAffidavit(long affidavitId) {
return PactsConstants.INTERNAL_SERVLET_URL + "?t=view&c=affidavit&" + AFFIDAVIT_ID + "=" + affidavitId;
}
public static String viewAssignmentDocument(long assignmentDocuumentId) {
return createLink("ViewAssignmentDocument", ASSIGNMENT_DOCUMENT_ID, assignmentDocuumentId + "");
}
public static String viewUser(long userId) {
return PactsConstants.INTERNAL_SERVLET_URL + "?t=view&c=user&" + USER_ID + "=" + userId;
}
public static String viewContract(long contractId) {
return PactsConstants.INTERNAL_SERVLET_URL + "?t=view&c=contract&" + CONTRACT_ID + "=" + contractId;
}
public static String addPayment(long userId) {
return createLink("AddPayment", USER_ID, userId + "");
}
public static String addContractPayment(long contractId) {
return createLink("AddPayment", CONTRACT_ID, contractId + "");
}
public static String updatePayment(long paymentId) {
return createLink("EditPayment", PAYMENT_ID, paymentId + "");
}
public static String updatePaymentStatus(long paymentId) {
return createLink("EditPaymentStatus", PAYMENT_ID, paymentId + "");
}
public static String viewPayment(long paymentId) {
return createLink("ViewPayment", PAYMENT_ID, paymentId + "");
}
public static String viewPayments(List paymentsId) {
StringBuffer sb = new StringBuffer(30);
for (int i = 0; i < paymentsId.size(); i++) {
sb.append("&payment_id=" + paymentsId.get(i));
}
return INTERNAL_SERVLET_URL + "?module=PaymentList" + sb.toString();
}
}
| UTF-8 | Java | 3,416 | java | Links.java | Java | [] | null | [] | package com.topcoder.web.tc.controller.legacy.pacts.common;
import java.util.List;
public class Links implements PactsConstants {
private static String createLink(String module, String param1, String value1) {
return INTERNAL_SERVLET_URL + "?module=" + module + "&" + param1 + "=" + value1;
}
private static String createLink(String module, String param1, String value1, String param2, String value2) {
return INTERNAL_SERVLET_URL + "?module=" + module + "&" + param1 + "=" + value1 + "&" + param2 + "=" + value2;
}
public static String addAffidavit(long userId) {
return createLink("AddAffidavit", USER_ID, userId + "");
}
public static String updateUserAccrual(long userId) {
return createLink("EditUserAccrualAmount", USER_ID, userId + "");
}
public static String updateUserPaymentMethod(long userId) {
return createLink("EditUserPaymentMethod", USER_ID, userId + "");
}
public static String addGlobalAD(long userId) {
return createLink("AddGlobalAD", USER_ID, userId + "");
}
public static String addAssignmentDocument(long userId) {
return createLink("AddAssignmentDocument", USER_ID, userId + "");
}
public static String addAffidavitForPayment(long userId, long paymentId) {
return createLink("AddAffidavit", USER_ID, userId + "", PAYMENT_ID, paymentId + "");
}
public static String updateAssignmentDocument(long assignmentDocumentId) {
return createLink("AddAssignmentDocument", ASSIGNMENT_DOCUMENT_ID, assignmentDocumentId + "");
}
public static String updateAffidavit(long affidavitId) {
return createLink("UpdateAffidavit", AFFIDAVIT_ID, affidavitId + "");
}
public static String viewAffidavit(long affidavitId) {
return PactsConstants.INTERNAL_SERVLET_URL + "?t=view&c=affidavit&" + AFFIDAVIT_ID + "=" + affidavitId;
}
public static String viewAssignmentDocument(long assignmentDocuumentId) {
return createLink("ViewAssignmentDocument", ASSIGNMENT_DOCUMENT_ID, assignmentDocuumentId + "");
}
public static String viewUser(long userId) {
return PactsConstants.INTERNAL_SERVLET_URL + "?t=view&c=user&" + USER_ID + "=" + userId;
}
public static String viewContract(long contractId) {
return PactsConstants.INTERNAL_SERVLET_URL + "?t=view&c=contract&" + CONTRACT_ID + "=" + contractId;
}
public static String addPayment(long userId) {
return createLink("AddPayment", USER_ID, userId + "");
}
public static String addContractPayment(long contractId) {
return createLink("AddPayment", CONTRACT_ID, contractId + "");
}
public static String updatePayment(long paymentId) {
return createLink("EditPayment", PAYMENT_ID, paymentId + "");
}
public static String updatePaymentStatus(long paymentId) {
return createLink("EditPaymentStatus", PAYMENT_ID, paymentId + "");
}
public static String viewPayment(long paymentId) {
return createLink("ViewPayment", PAYMENT_ID, paymentId + "");
}
public static String viewPayments(List paymentsId) {
StringBuffer sb = new StringBuffer(30);
for (int i = 0; i < paymentsId.size(); i++) {
sb.append("&payment_id=" + paymentsId.get(i));
}
return INTERNAL_SERVLET_URL + "?module=PaymentList" + sb.toString();
}
}
| 3,416 | 0.67096 | 0.666569 | 90 | 36.955555 | 36.644814 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.755556 | false | false | 4 |
4791317943a06d3b929b44c7a9f3985880dd9c57 | 20,237,885,933,331 | 38018fa8c6b2e104d621d364de0228f7cfc1db84 | /src/main/java/com/ck/niuke/Foo.java | 92d71ae797b26ce548e34cb41b1dea81f8df85a4 | [] | no_license | ck0729666/leetcode | https://github.com/ck0729666/leetcode | 3468b3600e98cf755ae2af3dc3be442567d053e6 | 69ab8a086b9725f11cc82423c39dd92ed7beb52f | refs/heads/master | 2021-07-08T00:52:59.063000 | 2019-08-13T16:39:26 | 2019-08-13T16:39:26 | 201,927,001 | 0 | 0 | null | false | 2020-10-13T15:18:47 | 2019-08-12T12:34:28 | 2019-08-13T16:39:54 | 2020-10-13T15:18:46 | 99 | 0 | 0 | 1 | Java | false | false | package com.ck.niuke;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class Foo {
private int number = 1;
private Lock lock = new ReentrantLock();
private Condition c1 = lock.newCondition();
private Condition c2 = lock.newCondition();
private Condition c3 = lock.newCondition();
public Foo() {
}
public void first(Runnable printFirst) throws InterruptedException {
lock.lock();
try {
while (number!=1) {
c1.await();
}
// printFirst.run() outputs "firvxst". Do not change or remove this line.
printFirst.run();
number = 2;
c2.signal();
}catch (Exception e){
e.printStackTrace();
}finally {
lock.unlock();
}
}
public void second(Runnable printSecond) throws InterruptedException {
lock.lock();
try {
while (number != 2) {
c2.await();
}
// printSecond.run() outputs "second". Do not change or remove this line.
printSecond.run();
number = 3;
c3.signal();
}catch (Exception e){
e.printStackTrace();
}finally {
lock.unlock();
}
}
public void third(Runnable printThird) throws InterruptedException {
lock.lock();
try {
while (number!=3){
c3.await();
}
// printThird.run() outputs "third". Do not change or remove this line.
printThird.run();
}catch (Exception e){
e.printStackTrace();
}finally {
lock.unlock();
}
}
} | UTF-8 | Java | 1,682 | java | Foo.java | Java | [] | null | [] | package com.ck.niuke;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class Foo {
private int number = 1;
private Lock lock = new ReentrantLock();
private Condition c1 = lock.newCondition();
private Condition c2 = lock.newCondition();
private Condition c3 = lock.newCondition();
public Foo() {
}
public void first(Runnable printFirst) throws InterruptedException {
lock.lock();
try {
while (number!=1) {
c1.await();
}
// printFirst.run() outputs "firvxst". Do not change or remove this line.
printFirst.run();
number = 2;
c2.signal();
}catch (Exception e){
e.printStackTrace();
}finally {
lock.unlock();
}
}
public void second(Runnable printSecond) throws InterruptedException {
lock.lock();
try {
while (number != 2) {
c2.await();
}
// printSecond.run() outputs "second". Do not change or remove this line.
printSecond.run();
number = 3;
c3.signal();
}catch (Exception e){
e.printStackTrace();
}finally {
lock.unlock();
}
}
public void third(Runnable printThird) throws InterruptedException {
lock.lock();
try {
while (number!=3){
c3.await();
}
// printThird.run() outputs "third". Do not change or remove this line.
printThird.run();
}catch (Exception e){
e.printStackTrace();
}finally {
lock.unlock();
}
}
} | 1,682 | 0.562426 | 0.554102 | 69 | 23.391304 | 21.278156 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.405797 | false | false | 4 |
56703a8950c5be1704af5ce0961078b197e4d4c0 | 12,429,635,406,831 | 0fe0e2c87563650390546a8f846d6af3f7a9c482 | /Src/iface.server/src/main/java/com/hanvon/iface/dsm/utils/UserRoleFieldConvert.java | cae51fc0e7905e47bd8982c17d705e915a1e5973 | [] | no_license | xuNan784328295/hanvon | https://github.com/xuNan784328295/hanvon | 48854d15ad198d7caaf906c04b5d4bfec0e003b6 | 574ea3914d6440e253e8624931e8713b21b472e6 | refs/heads/master | 2018-10-24T15:31:27.677000 | 2018-08-23T00:39:44 | 2018-08-23T00:39:44 | 145,489,062 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hanvon.iface.dsm.utils;
import java.util.HashMap;
import java.util.Map;
/**
* Created with IntelliJ IDEA.
* User: gguoling
* Date: 12-10-25
* Time: ไธๅ3:57
*/
public class UserRoleFieldConvert {
private static Map<String, String> _map = new HashMap<String, String>();
static {
_map.put("id", "id");
_map.put("userId", "userId");
_map.put("employId", "employId");
_map.put("employName", "employName");
_map.put("userName", "userName");
_map.put("branchName", "branchName");
}
public static String getFieldName(String propertyName) {
return _map.get(propertyName);
}
}
| UTF-8 | Java | 668 | java | UserRoleFieldConvert.java | Java | [
{
"context": ".Map;\n\n/**\n * Created with IntelliJ IDEA.\n * User: gguoling\n * Date: 12-10-25\n * Time: ไธๅ3:57\n */\npublic clas",
"end": 138,
"score": 0.9996612668037415,
"start": 130,
"tag": "USERNAME",
"value": "gguoling"
},
{
"context": "me\", \"employName\");\n _map.put(\"userName\", \"userName\");\n _map.put(\"branchName\", \"branchName\");\n",
"end": 499,
"score": 0.9994282126426697,
"start": 491,
"tag": "USERNAME",
"value": "userName"
}
] | null | [] | package com.hanvon.iface.dsm.utils;
import java.util.HashMap;
import java.util.Map;
/**
* Created with IntelliJ IDEA.
* User: gguoling
* Date: 12-10-25
* Time: ไธๅ3:57
*/
public class UserRoleFieldConvert {
private static Map<String, String> _map = new HashMap<String, String>();
static {
_map.put("id", "id");
_map.put("userId", "userId");
_map.put("employId", "employId");
_map.put("employName", "employName");
_map.put("userName", "userName");
_map.put("branchName", "branchName");
}
public static String getFieldName(String propertyName) {
return _map.get(propertyName);
}
}
| 668 | 0.612952 | 0.599398 | 28 | 22.714285 | 20.202293 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.678571 | false | false | 4 |
c1d9b8f329ef00e571543a7e5ecdf0d68a8dd141 | 14,680,198,231,823 | 0fc377dadc8f64f573167365c5493fc948b2a575 | /accounts/src/main/java/com/hc/accounts/Application.java | e93cd80c74ef6b71f2ebbeb5654ec20de6739d85 | [] | no_license | adelkov/sandbox | https://github.com/adelkov/sandbox | 793f7403d3da2b734101a693ad913d1d5b200923 | fa3e784780e4c100361dbaa1b97febdf5454e5af | refs/heads/master | 2020-04-19T09:53:13.709000 | 2019-02-11T08:22:27 | 2019-02-11T08:22:27 | 167,510,142 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hc.accounts;
import com.hc.accounts.api.AccountsEventBusClient;
import com.hc.accounts.core.AccountsService;
import com.hc.accounts.core.RestAPI;
import com.hc.accounts.core.data.UserDAODatabase;
import com.hc.accounts.core.data.models.DepositRequest;
import com.hc.accounts.core.data.models.UserModel;
import com.hc.accounts.core.data.models.WithdrawRequest;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.jdbc.JDBCClient;
import io.vertx.ext.sql.SQLClient;
public class Application extends AbstractVerticle {
private EventBus eventBus;
private AccountsEventBusClient accountsEventbusClient;
@Override
public void start() throws Exception {
super.start();
vertx.deployVerticle(new RestAPI());
this.eventBus = vertx.eventBus();
this.accountsEventbusClient = new AccountsEventBusClient(this.eventBus);
dbTest();
}
private void dbTest() {
JsonObject config = new JsonObject()
.put("url", "jdbc:postgresql://localhost:5432/accounts")
.put("driver_class", "org.postgresql.Driver")
.put("user", "kovacsadel");
SQLClient client = JDBCClient.createShared(vertx, config);
vertx.deployVerticle(new AccountsService(new UserDAODatabase(client)));
}
private void testGetUsers(UserDAODatabase userDAOdatabase) {
userDAOdatabase.getUsers()
.map(res2 -> {
System.out.println("TEST: Get users, new size: " + res2.size());
return res2;
})
.otherwise(error -> {
System.out.println(error.getMessage());
return null;
});
}
private void testGetUserWithId(UserDAODatabase userDAOdatabase) {
userDAOdatabase.getUserWithUserId("valami")
.map(res2 -> {
System.out.println("TEST: Get user with id: " + res2.getUserName());
return res2;
});
}
private void testAddUser(UserDAODatabase userDAOdatabase) {
UserModel user = new UserModel("Alma Fa", "Id131313", 0);
userDAOdatabase.addUser(user)
.map(res -> {
System.out.println("TEST: User added with id: " + res.getUserId());
return res;
})
.otherwise(error -> {
System.out.println(error.getMessage());
return null;
});
}
private void testWithDraw(UserDAODatabase userDAOdatabase) {
WithdrawRequest request = new WithdrawRequest("valami", 100);
userDAOdatabase.withdraw(request)
.map(res -> {
System.out.println("TEST: Withdraw. New balance: " + res.toString());
return res;
})
.otherwise(error -> {
System.out.println(error.getMessage());
return null;
});
}
private void testDeposit(UserDAODatabase userDAOdatabase) {
DepositRequest request = new DepositRequest("valami", 10);
userDAOdatabase.deposit(request)
.map(res -> {
System.out.println("TEST: Deposit. New balance: " + res.toString());
return res;
})
.otherwise(error -> {
System.out.println(error.getMessage());
return null;
});
}
}
| UTF-8 | Java | 3,622 | java | Application.java | Java | [
{
"context": "postgresql.Driver\")\n .put(\"user\", \"kovacsadel\");\n SQLClient client = JDBCClient.createSh",
"end": 1232,
"score": 0.9991146922111511,
"start": 1222,
"tag": "USERNAME",
"value": "kovacsadel"
},
{
"context": "ase) {\n userDAOdatabase.getUserWithUserId(\"valami\")\n .map(res2 -> {\n ",
"end": 1936,
"score": 0.9962055683135986,
"start": 1930,
"tag": "USERNAME",
"value": "valami"
},
{
"context": "tabase) {\n UserModel user = new UserModel(\"Alma Fa\", \"Id131313\", 0);\n userDAOdatabase.addUser",
"end": 2230,
"score": 0.9998412132263184,
"start": 2223,
"tag": "NAME",
"value": "Alma Fa"
},
{
"context": " UserModel user = new UserModel(\"Alma Fa\", \"Id131313\", 0);\n userDAOdatabase.addUser(user)\n ",
"end": 2242,
"score": 0.5918391346931458,
"start": 2236,
"tag": "USERNAME",
"value": "131313"
}
] | null | [] | package com.hc.accounts;
import com.hc.accounts.api.AccountsEventBusClient;
import com.hc.accounts.core.AccountsService;
import com.hc.accounts.core.RestAPI;
import com.hc.accounts.core.data.UserDAODatabase;
import com.hc.accounts.core.data.models.DepositRequest;
import com.hc.accounts.core.data.models.UserModel;
import com.hc.accounts.core.data.models.WithdrawRequest;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.jdbc.JDBCClient;
import io.vertx.ext.sql.SQLClient;
public class Application extends AbstractVerticle {
private EventBus eventBus;
private AccountsEventBusClient accountsEventbusClient;
@Override
public void start() throws Exception {
super.start();
vertx.deployVerticle(new RestAPI());
this.eventBus = vertx.eventBus();
this.accountsEventbusClient = new AccountsEventBusClient(this.eventBus);
dbTest();
}
private void dbTest() {
JsonObject config = new JsonObject()
.put("url", "jdbc:postgresql://localhost:5432/accounts")
.put("driver_class", "org.postgresql.Driver")
.put("user", "kovacsadel");
SQLClient client = JDBCClient.createShared(vertx, config);
vertx.deployVerticle(new AccountsService(new UserDAODatabase(client)));
}
private void testGetUsers(UserDAODatabase userDAOdatabase) {
userDAOdatabase.getUsers()
.map(res2 -> {
System.out.println("TEST: Get users, new size: " + res2.size());
return res2;
})
.otherwise(error -> {
System.out.println(error.getMessage());
return null;
});
}
private void testGetUserWithId(UserDAODatabase userDAOdatabase) {
userDAOdatabase.getUserWithUserId("valami")
.map(res2 -> {
System.out.println("TEST: Get user with id: " + res2.getUserName());
return res2;
});
}
private void testAddUser(UserDAODatabase userDAOdatabase) {
UserModel user = new UserModel("<NAME>", "Id131313", 0);
userDAOdatabase.addUser(user)
.map(res -> {
System.out.println("TEST: User added with id: " + res.getUserId());
return res;
})
.otherwise(error -> {
System.out.println(error.getMessage());
return null;
});
}
private void testWithDraw(UserDAODatabase userDAOdatabase) {
WithdrawRequest request = new WithdrawRequest("valami", 100);
userDAOdatabase.withdraw(request)
.map(res -> {
System.out.println("TEST: Withdraw. New balance: " + res.toString());
return res;
})
.otherwise(error -> {
System.out.println(error.getMessage());
return null;
});
}
private void testDeposit(UserDAODatabase userDAOdatabase) {
DepositRequest request = new DepositRequest("valami", 10);
userDAOdatabase.deposit(request)
.map(res -> {
System.out.println("TEST: Deposit. New balance: " + res.toString());
return res;
})
.otherwise(error -> {
System.out.println(error.getMessage());
return null;
});
}
}
| 3,621 | 0.575649 | 0.569575 | 102 | 34.509804 | 24.885126 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.568627 | false | false | 4 |
a296c8a667fb52bfc4deacef1063584e7d5ad347 | 1,460,288,889,515 | cccbbf3b0fea6a4bb8f2bc77be03b4e381e90b95 | /JavaConceptsProject/src/frameHandling/DragAndDropHandling.java | d257b767304a6ba6a702162ff53eeaa5066b6cf2 | [] | no_license | chandrikapp/AutomationProject | https://github.com/chandrikapp/AutomationProject | 18db206842cb85d0dae201b974e27532280f49b8 | 09447818131f4170fafc7ee091affa045c77c56b | refs/heads/master | 2021-01-21T11:23:37.661000 | 2017-04-27T07:19:22 | 2017-04-27T07:19:22 | 83,565,262 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package frameHandling;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class DragAndDropHandling {
public static void main(String[] args) {
String url = "http://jqueryui.com/droppable/";
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get(url);
driver.switchTo().frame(0);
WebElement sourcElement=driver.findElement(By.id("draggable"));
WebElement destinationElement=driver.findElement(By.id("droppable"));
Actions act=new Actions(driver);
act.dragAndDrop(sourcElement, destinationElement).build().perform();
}
}
| UTF-8 | Java | 770 | java | DragAndDropHandling.java | Java | [] | null | [] | package frameHandling;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class DragAndDropHandling {
public static void main(String[] args) {
String url = "http://jqueryui.com/droppable/";
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get(url);
driver.switchTo().frame(0);
WebElement sourcElement=driver.findElement(By.id("draggable"));
WebElement destinationElement=driver.findElement(By.id("droppable"));
Actions act=new Actions(driver);
act.dragAndDrop(sourcElement, destinationElement).build().perform();
}
}
| 770 | 0.738961 | 0.737662 | 25 | 28.799999 | 22.74379 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.6 | false | false | 4 |
5b4a9b649b798f22ca5a6ddc28946166476fa683 | 11,725,260,737,199 | ce86783419981c26e6e0dfbf41490b9217d15082 | /src/main/java/com/eduboss/eo/LocalTeacherExportEo.java | 1ba9ed3938b5a99c2beda14fbab3ae3e243afea6 | [] | no_license | moutainhigh/work-ms-msBoss | https://github.com/moutainhigh/work-ms-msBoss | 93e481933663501337ae74930e5aabbd0e7bb32d | 4916be9aa1cd5695b93f8d6fbe1f6eeb0010636f | refs/heads/main | 2023-01-24T04:12:51.702000 | 2020-11-20T07:56:28 | 2020-11-20T07:56:28 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.eduboss.eo;
import com.eduboss.excel.export.ExcelExportEo;
import com.eduboss.excel.export.anno.ExportedHeaderDefine;
import com.eduboss.excel.export.anno.ExportedSheetDefine;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by pengguojie on 2017/7/25 0025.
*/
@ExportedSheetDefine(sheetName = "ๆ กๅบ่ๅธ็ฎก็", defaultColumnWidth = 15)
@Getter
@Setter
@NoArgsConstructor
public class LocalTeacherExportEo implements ExcelExportEo {
//ๅๅทฅ็ผๅท๏ผๅงๅ๏ผ็ปๅฝ่ดฆๅท๏ผ็ถๆ๏ผ็จๆท็ฑปๅ๏ผๆงๅซ๏ผ ่็ณปๆนๅผ ๏ผๅฝๅฑ็ป็ปๆถๆ๏ผ่ไฝ๏ผ่ช่ต็ฑปๅ๏ผๆๅธ่ฏพ้
ฌๆ็บง
@ExportedHeaderDefine(headerName = "ๅๅทฅ็ผๅท", cellWidth = 10)
private String userId;
@ExportedHeaderDefine(headerName = "ๅงๅ", cellWidth = 15)
private String name;
@ExportedHeaderDefine(headerName = "็ปๅฝ่ดฆๅท", cellWidth = 15)
private String account;
@ExportedHeaderDefine(headerName = "็ถๆ", cellWidth = 10)
private String enableFlg;
@ExportedHeaderDefine(headerName = "็จๆท็ฑปๅ", cellWidth = 10)
private String workType;
@ExportedHeaderDefine(headerName = "ๆงๅซ", cellWidth = 10)
private String sex;
@ExportedHeaderDefine(headerName = "ไปปๆ็ง็ฎ", cellWidth = 60)
private String subjectsName;
@ExportedHeaderDefine(headerName = "ๆๅธ่ฏพ้
ฌๆ็บง", cellWidth = 15)
private String salaryStarName;
@ExportedHeaderDefine(headerName = "ไธป็ป็ปๆถๆ", cellWidth = 15)
private String majorName;
@ExportedHeaderDefine(headerName = "ๅฝๅฑ็ป็ปๆถๆ", cellWidth = 15)
private String organization;
@ExportedHeaderDefine(headerName = "่ไฝ", cellWidth = 15)
private String roleNames;
@ExportedHeaderDefine(headerName = "่ช่ต็ฑปๅ", cellWidth = 10)
private String salaryTypeName;
public String getEnableFlg() {
if ("0".equals(this.enableFlg)) {
return "ๆญฃๅธธ";
} else if ("1".equals(this.enableFlg)) {
return "็ฆ็จ";
}
return enableFlg;
}
public void setWorkType(String workType)
{
if ("FULL_TIME" .equals(workType)) {
this.workType = "ๅ
จ่";
} else if ("PART_TIME" .equals(workType)) {
this.workType = "ๅ
ผ่";
} else if ("DUMMY" .equals(workType)) {
this.workType = "่ๆ";
}
}
public void setSex(String sex) {
if ("0".equals(sex)) {
this.sex = "ๅฅณ";
} else if ("1".equals(sex)) {
this.sex = "็ท";
} else {
this.sex = sex;
}
}
public LocalTeacherExportEo(String userId, String name, String account, String enableFlg, String workType, String sex, String organization, String roleNames, String salaryTypeName, String salaryStarName, String subjectsName,String majorName) {
this.userId = userId;
this.name = name;
this.account = account;
this.enableFlg = enableFlg;
this.workType = workType;
if ("0".equals(sex)) {
this.sex = "ๅฅณ";
} else if ("1".equals(sex)) {
this.sex = "็ท";
}
this.organization = organization;
this.roleNames = roleNames;
this.salaryTypeName = salaryTypeName;
this.salaryStarName = salaryStarName;
this.subjectsName = subjectsName;
this.majorName = majorName;
}
}
| UTF-8 | Java | 3,448 | java | LocalTeacherExportEo.java | Java | [
{
"context": "tructor;\nimport lombok.Setter;\n\n\n/**\n * Created by pengguojie on 2017/7/25 0025.\n */\n@ExportedSheetDefine(sheet",
"end": 296,
"score": 0.9996588230133057,
"start": 286,
"tag": "USERNAME",
"value": "pengguojie"
},
{
"context": "\n this.userId = userId;\n this.name = name;\n this.account = account;\n this.ena",
"end": 2720,
"score": 0.9894859790802002,
"start": 2716,
"tag": "NAME",
"value": "name"
}
] | null | [] | package com.eduboss.eo;
import com.eduboss.excel.export.ExcelExportEo;
import com.eduboss.excel.export.anno.ExportedHeaderDefine;
import com.eduboss.excel.export.anno.ExportedSheetDefine;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by pengguojie on 2017/7/25 0025.
*/
@ExportedSheetDefine(sheetName = "ๆ กๅบ่ๅธ็ฎก็", defaultColumnWidth = 15)
@Getter
@Setter
@NoArgsConstructor
public class LocalTeacherExportEo implements ExcelExportEo {
//ๅๅทฅ็ผๅท๏ผๅงๅ๏ผ็ปๅฝ่ดฆๅท๏ผ็ถๆ๏ผ็จๆท็ฑปๅ๏ผๆงๅซ๏ผ ่็ณปๆนๅผ ๏ผๅฝๅฑ็ป็ปๆถๆ๏ผ่ไฝ๏ผ่ช่ต็ฑปๅ๏ผๆๅธ่ฏพ้
ฌๆ็บง
@ExportedHeaderDefine(headerName = "ๅๅทฅ็ผๅท", cellWidth = 10)
private String userId;
@ExportedHeaderDefine(headerName = "ๅงๅ", cellWidth = 15)
private String name;
@ExportedHeaderDefine(headerName = "็ปๅฝ่ดฆๅท", cellWidth = 15)
private String account;
@ExportedHeaderDefine(headerName = "็ถๆ", cellWidth = 10)
private String enableFlg;
@ExportedHeaderDefine(headerName = "็จๆท็ฑปๅ", cellWidth = 10)
private String workType;
@ExportedHeaderDefine(headerName = "ๆงๅซ", cellWidth = 10)
private String sex;
@ExportedHeaderDefine(headerName = "ไปปๆ็ง็ฎ", cellWidth = 60)
private String subjectsName;
@ExportedHeaderDefine(headerName = "ๆๅธ่ฏพ้
ฌๆ็บง", cellWidth = 15)
private String salaryStarName;
@ExportedHeaderDefine(headerName = "ไธป็ป็ปๆถๆ", cellWidth = 15)
private String majorName;
@ExportedHeaderDefine(headerName = "ๅฝๅฑ็ป็ปๆถๆ", cellWidth = 15)
private String organization;
@ExportedHeaderDefine(headerName = "่ไฝ", cellWidth = 15)
private String roleNames;
@ExportedHeaderDefine(headerName = "่ช่ต็ฑปๅ", cellWidth = 10)
private String salaryTypeName;
public String getEnableFlg() {
if ("0".equals(this.enableFlg)) {
return "ๆญฃๅธธ";
} else if ("1".equals(this.enableFlg)) {
return "็ฆ็จ";
}
return enableFlg;
}
public void setWorkType(String workType)
{
if ("FULL_TIME" .equals(workType)) {
this.workType = "ๅ
จ่";
} else if ("PART_TIME" .equals(workType)) {
this.workType = "ๅ
ผ่";
} else if ("DUMMY" .equals(workType)) {
this.workType = "่ๆ";
}
}
public void setSex(String sex) {
if ("0".equals(sex)) {
this.sex = "ๅฅณ";
} else if ("1".equals(sex)) {
this.sex = "็ท";
} else {
this.sex = sex;
}
}
public LocalTeacherExportEo(String userId, String name, String account, String enableFlg, String workType, String sex, String organization, String roleNames, String salaryTypeName, String salaryStarName, String subjectsName,String majorName) {
this.userId = userId;
this.name = name;
this.account = account;
this.enableFlg = enableFlg;
this.workType = workType;
if ("0".equals(sex)) {
this.sex = "ๅฅณ";
} else if ("1".equals(sex)) {
this.sex = "็ท";
}
this.organization = organization;
this.roleNames = roleNames;
this.salaryTypeName = salaryTypeName;
this.salaryStarName = salaryStarName;
this.subjectsName = subjectsName;
this.majorName = majorName;
}
}
| 3,448 | 0.64481 | 0.631448 | 98 | 31.836735 | 29.652304 | 247 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.663265 | false | false | 4 |
f6e9c9a4658b1193ae4bc17a3772c7fab9bc0a12 | 5,781,026,038,913 | 79795a013c3e5632cdaaa181ae47310c55993d4b | /src/com/company/Marker/Adder.java | c2d98887b321e0e37a6eeda93668ec125523f81e | [] | no_license | scottfabini/DesignPatterns | https://github.com/scottfabini/DesignPatterns | 6bbe1c232f37b10f5fe0b85bfc238fd3338a6dc4 | ea24f87b09695b15388fa5d5de09a389b7a38f56 | refs/heads/master | 2020-12-31T04:28:58.329000 | 2016-03-26T10:40:22 | 2016-03-26T10:40:22 | 51,873,330 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.company.Marker;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
/**
* @author Scott Fabini <sfabini@pdx.edu>
*
* Remotely accessible adder.
* The extension of UnicastRemoteObject and
* the implementation of RemoteAdder (which extends the Remote marker)
* make this class remote accessible.
*
* Run this program in a separate window in the IDE to instantiate the main()
*/
public class Adder extends UnicastRemoteObject implements RemoteAdderIF {
/**
* Default constructor
* @throws RemoteException
*/
public Adder() throws RemoteException {}
public int add(int x, int y) throws java.rmi.RemoteException {
return x + y;
}
/**
* Test program for the adder itself
* @param ignore
*/
public static void main(String [] ignore) {
try {
Adder adder = new Adder();
try {
java.rmi.registry.LocateRegistry.createRegistry(1099);
System.out.println("RMI registry ready.");
} catch (Exception e) {
System.out.println("Exception starting RMI registry:");
e.printStackTrace();
}
Naming.rebind("Adder", adder);
}
catch (Exception e) {
System.out.println("Adder error: " + e.getMessage());
e.printStackTrace();
}
}
}
| UTF-8 | Java | 1,424 | java | Adder.java | Java | [
{
"context": "va.rmi.server.UnicastRemoteObject;\n\n/**\n * @author Scott Fabini <sfabini@pdx.edu>\n *\n * Remotely accessible adder",
"end": 158,
"score": 0.9998832941055298,
"start": 146,
"tag": "NAME",
"value": "Scott Fabini"
},
{
"context": "nicastRemoteObject;\n\n/**\n * @author Scott Fabini <sfabini@pdx.edu>\n *\n * Remotely accessible adder.\n * The extensio",
"end": 175,
"score": 0.999933123588562,
"start": 160,
"tag": "EMAIL",
"value": "sfabini@pdx.edu"
}
] | null | [] | package com.company.Marker;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
/**
* @author <NAME> <<EMAIL>>
*
* Remotely accessible adder.
* The extension of UnicastRemoteObject and
* the implementation of RemoteAdder (which extends the Remote marker)
* make this class remote accessible.
*
* Run this program in a separate window in the IDE to instantiate the main()
*/
public class Adder extends UnicastRemoteObject implements RemoteAdderIF {
/**
* Default constructor
* @throws RemoteException
*/
public Adder() throws RemoteException {}
public int add(int x, int y) throws java.rmi.RemoteException {
return x + y;
}
/**
* Test program for the adder itself
* @param ignore
*/
public static void main(String [] ignore) {
try {
Adder adder = new Adder();
try {
java.rmi.registry.LocateRegistry.createRegistry(1099);
System.out.println("RMI registry ready.");
} catch (Exception e) {
System.out.println("Exception starting RMI registry:");
e.printStackTrace();
}
Naming.rebind("Adder", adder);
}
catch (Exception e) {
System.out.println("Adder error: " + e.getMessage());
e.printStackTrace();
}
}
}
| 1,410 | 0.613062 | 0.610253 | 49 | 28.061224 | 23.100851 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.306122 | false | false | 4 |
8511ef34ae117778d791308d88efad22e0c0e785 | 16,965,120,840,338 | a88ffbbb0cd4141e1140d1b148cf606597ed03c8 | /src/3_Enkapsulasi/Pertanyaan/Motor1841720144Rizqi.java | 9f7347bd50bbf5423fa00378db99e7848b9e2610 | [] | no_license | mahe62/laporan-praktikum-pbo-2019 | https://github.com/mahe62/laporan-praktikum-pbo-2019 | a67b84c8c99cd8dff88214ddba6febf2d0a76df2 | 410b545a48f68d173760fbc18945ac19bdb2455e | refs/heads/master | 2020-07-16T18:20:53.949000 | 2019-12-10T04:05:25 | 2019-12-10T04:05:25 | 205,841,076 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Pertanyaan3;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author ASUS
*/
public class Motor1841720144Rizqi {
private int mKecepatan = 0;
private boolean mKontakOn = false;
public void NyalakanMesinRizqi() {
mKontakOn = true;
}
public void MatikanMesinRizqi() {
mKontakOn = false;
mKecepatan = 0;
}
public void TambahKecepatanRizqi() {
if (mKontakOn == true) {
if (mKecepatan < 100) {
mKecepatan += 50;
if (mKecepatan > 100) {
mKecepatan = 100;
System.out.println("Kecepatan mencapai batas maksimal");
}
} else {
mKecepatan = 100;
System.out.println("Kecepatan mencapai batas maksimal");
}
} else {
System.out.println("Kecepatan tidak bisa bertambah karena mesin Off \n");
}
}
public void KurangiKecepatanRizqi() {
if (mKontakOn == true) {
mKecepatan -= 5;
} else {
System.out.println("Kecepatan tidak bisa berkurang karena mesin Off \n");
}
}
public void PrintStatusRizqi() {
if (mKontakOn == true) {
System.out.println("Kontak On");
} else {
System.out.println("Kontak Off");
}
System.out.println("Kecepatan " + mKecepatan + " \n");
}
}
| UTF-8 | Java | 1,575 | java | Motor1841720144Rizqi.java | Java | [
{
"context": " the template in the editor.\n */\n/**\n *\n * @author ASUS\n */\npublic class Motor1841720144Rizqi {\n\n priv",
"end": 229,
"score": 0.9433398246765137,
"start": 225,
"tag": "USERNAME",
"value": "ASUS"
}
] | null | [] | package Pertanyaan3;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author ASUS
*/
public class Motor1841720144Rizqi {
private int mKecepatan = 0;
private boolean mKontakOn = false;
public void NyalakanMesinRizqi() {
mKontakOn = true;
}
public void MatikanMesinRizqi() {
mKontakOn = false;
mKecepatan = 0;
}
public void TambahKecepatanRizqi() {
if (mKontakOn == true) {
if (mKecepatan < 100) {
mKecepatan += 50;
if (mKecepatan > 100) {
mKecepatan = 100;
System.out.println("Kecepatan mencapai batas maksimal");
}
} else {
mKecepatan = 100;
System.out.println("Kecepatan mencapai batas maksimal");
}
} else {
System.out.println("Kecepatan tidak bisa bertambah karena mesin Off \n");
}
}
public void KurangiKecepatanRizqi() {
if (mKontakOn == true) {
mKecepatan -= 5;
} else {
System.out.println("Kecepatan tidak bisa berkurang karena mesin Off \n");
}
}
public void PrintStatusRizqi() {
if (mKontakOn == true) {
System.out.println("Kontak On");
} else {
System.out.println("Kontak Off");
}
System.out.println("Kecepatan " + mKecepatan + " \n");
}
}
| 1,575 | 0.544762 | 0.526984 | 61 | 24.819672 | 23.012119 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.327869 | false | false | 4 |
2d8ea44a75234bac1a5dc03cfb9e8e638ba7ac0b | 33,251,636,810,723 | 7d53c777706ad8b950f5c7c483a8430657d5288b | /FactoryMode/src/cn/sx/xa/bqq/hqz/yjg/second/test/TestDemo.java | a8794185c532664859941431751b509b1de3782b | [] | no_license | endloops/ceshi | https://github.com/endloops/ceshi | 9d2181eadc793eafb7749b6908333a5778ee07be | 4618960b4817e114c9bbc9bd6f9c35ba834ec157 | refs/heads/master | 2021-05-01T04:08:58.141000 | 2019-04-24T02:18:52 | 2019-04-24T02:18:52 | 121,200,157 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.sx.xa.bqq.hqz.yjg.second.test;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import cn.sx.xa.bqq.hqz.yjg.second.BeiJingBiscuitStore;
import cn.sx.xa.bqq.hqz.yjg.second.BiscuitStore;
import cn.sx.xa.bqq.hqz.yjg.second.XiAnBiscuitStore;
import cn.sx.xa.bqq.hqz.yjg.second.biscuit.Biscuit;
import cn.sx.xa.bqq.hqz.yjg.second.observerable.Customer;
public class TestDemo {
public static void main(String[] args) throws FileNotFoundException {
//testFactoryAndDecorator();
testFactoryAndDecoratorAndObserver();
}
public static void testFactoryAndDecorator(){
BiscuitStore beijing = new BeiJingBiscuitStore();
Biscuit material = beijing.orderBiscuit("ๅคง้บฆ,็บข่ฑ");
//BiscuitStore xian = new XiAnBiscuitStore();
//material = xian.orderBiscuit("ๅคง้บฆ");
}
public static void testFactoryAndDecoratorAndObserver(){
Customer customer = new Customer("ๅผ ็ฎ่");
customer.orderBiscuit("่ฅฟๅฎ", "ๅคง้บฆ,็บข่ฑ");
}
}
| UTF-8 | Java | 1,067 | java | TestDemo.java | Java | [
{
"context": "dObserver(){\r\n\t\tCustomer customer = new Customer(\"ๅผ ็ฎ่\");\r\n\t\tcustomer.orderBiscuit(\"่ฅฟๅฎ\", \"ๅคง้บฆ,็บข่ฑ\");\r\n\t}\r\n",
"end": 984,
"score": 0.8959969282150269,
"start": 981,
"tag": "NAME",
"value": "ๅผ ็ฎ่"
}
] | null | [] | package cn.sx.xa.bqq.hqz.yjg.second.test;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import cn.sx.xa.bqq.hqz.yjg.second.BeiJingBiscuitStore;
import cn.sx.xa.bqq.hqz.yjg.second.BiscuitStore;
import cn.sx.xa.bqq.hqz.yjg.second.XiAnBiscuitStore;
import cn.sx.xa.bqq.hqz.yjg.second.biscuit.Biscuit;
import cn.sx.xa.bqq.hqz.yjg.second.observerable.Customer;
public class TestDemo {
public static void main(String[] args) throws FileNotFoundException {
//testFactoryAndDecorator();
testFactoryAndDecoratorAndObserver();
}
public static void testFactoryAndDecorator(){
BiscuitStore beijing = new BeiJingBiscuitStore();
Biscuit material = beijing.orderBiscuit("ๅคง้บฆ,็บข่ฑ");
//BiscuitStore xian = new XiAnBiscuitStore();
//material = xian.orderBiscuit("ๅคง้บฆ");
}
public static void testFactoryAndDecoratorAndObserver(){
Customer customer = new Customer("ๅผ ็ฎ่");
customer.orderBiscuit("่ฅฟๅฎ", "ๅคง้บฆ,็บข่ฑ");
}
}
| 1,067 | 0.753134 | 0.753134 | 30 | 32.566666 | 21.250385 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.466667 | false | false | 4 |
ddeae56b3a45a55aee9b1b913398f7f79d88658a | 8,229,157,356,367 | 450aafb350eff0a1f3ac8a605bc18dc0d062942b | /src/com/pbi/ppc/service/PPCDownloadService.java | 0085fbc77a757649c2bd2abfbe6d78c271ff71a4 | [] | no_license | changtun/PPCServer | https://github.com/changtun/PPCServer | 87ff7a330943ea89ca29915a2a8644dac5e5ffe4 | 0c75c1d86c6632d3ef4cd364d7e8b72b910c3899 | refs/heads/master | 2021-01-18T03:08:55.216000 | 2014-01-28T02:46:39 | 2014-01-28T02:46:39 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* File Name: PPCDownloadService.java
* Copyright: Beijing Jaeger Communication Electronic Technology Co., Ltd. Copyright YYYY-YYYY, All rights reserved
* Descriptions: <Descriptions>
* Changed By:
* Changed Time: 2014-1-17
* Changed Content: <Changed Content>
*/
package com.pbi.ppc.service;
import com.pbi.ppc.domain.MountInfoBean;
import com.pbi.ppc.utils.CommonUtils;
import com.pbi.ppc.utils.StorageUtils;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.util.Log;
/**
* <Functional overview> <Functional Details>
*
* @author
* @version [Version Number, 2014-1-17]
* @see [Relevant Class/Method]
* @since [Product/Module Version]
*/
public class PPCDownloadService extends Service
{
private static final String TAG = "PPCDownloadService";
public static final int DOWNLOAD_APK_FAILED = 202;
public static final int START_INSTALL_APK = 203;
private String apkPath;
private Handler mHandler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
switch (msg.what)
{
case DOWNLOAD_APK_FAILED:
Log.i(TAG, "--->>>download the apk failed.");
break;
case START_INSTALL_APK:
Log.i(TAG, "--->>>start install apk.");
break;
}
}
};
@Override
public int onStartCommand(Intent intent, int flags, int startId)
{
apkPath = intent.getStringExtra("apk_path");
Log.i(TAG, "--->>> ppc download service start." + apkPath);
new DownloadApkTask(mHandler).run();
return super.onStartCommand(intent, flags, startId);
}
/**
* Override Method
*
* @param intent
* @return
*/
@Override
public IBinder onBind(Intent intent)
{
// TODO Auto-generated method stub
return null;
}
class DownloadApkTask extends Thread
{
private Handler handler;
public DownloadApkTask(Handler handler)
{
super();
this.handler = handler;
}
@Override
public void run()
{
// check thea hdd;
StorageUtils util = new StorageUtils(PPCDownloadService.this);
int check = util.checkHDDSpace();
switch (check)
{
case 0:
// download the apk.
MountInfoBean mBean = util.getMobileHDDInfo();
Log.i(TAG, "--->>> apk path: " + apkPath);
Log.i(TAG, "--->>> storage path: " + mBean.getPath());
CommonUtils.downLoadFile(PPCDownloadService.this, mHandler, apkPath);
break;
case 1:
Log.i(TAG, "--->>> not enough space.");
handler.sendEmptyMessage(DOWNLOAD_APK_FAILED);
break;
case 2:
Log.i(TAG, "--->>> no devices.");
handler.sendEmptyMessage(DOWNLOAD_APK_FAILED);
break;
}
}
}
}
| UTF-8 | Java | 3,304 | java | PPCDownloadService.java | Java | [] | null | [] | /*
* File Name: PPCDownloadService.java
* Copyright: Beijing Jaeger Communication Electronic Technology Co., Ltd. Copyright YYYY-YYYY, All rights reserved
* Descriptions: <Descriptions>
* Changed By:
* Changed Time: 2014-1-17
* Changed Content: <Changed Content>
*/
package com.pbi.ppc.service;
import com.pbi.ppc.domain.MountInfoBean;
import com.pbi.ppc.utils.CommonUtils;
import com.pbi.ppc.utils.StorageUtils;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.util.Log;
/**
* <Functional overview> <Functional Details>
*
* @author
* @version [Version Number, 2014-1-17]
* @see [Relevant Class/Method]
* @since [Product/Module Version]
*/
public class PPCDownloadService extends Service
{
private static final String TAG = "PPCDownloadService";
public static final int DOWNLOAD_APK_FAILED = 202;
public static final int START_INSTALL_APK = 203;
private String apkPath;
private Handler mHandler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
switch (msg.what)
{
case DOWNLOAD_APK_FAILED:
Log.i(TAG, "--->>>download the apk failed.");
break;
case START_INSTALL_APK:
Log.i(TAG, "--->>>start install apk.");
break;
}
}
};
@Override
public int onStartCommand(Intent intent, int flags, int startId)
{
apkPath = intent.getStringExtra("apk_path");
Log.i(TAG, "--->>> ppc download service start." + apkPath);
new DownloadApkTask(mHandler).run();
return super.onStartCommand(intent, flags, startId);
}
/**
* Override Method
*
* @param intent
* @return
*/
@Override
public IBinder onBind(Intent intent)
{
// TODO Auto-generated method stub
return null;
}
class DownloadApkTask extends Thread
{
private Handler handler;
public DownloadApkTask(Handler handler)
{
super();
this.handler = handler;
}
@Override
public void run()
{
// check thea hdd;
StorageUtils util = new StorageUtils(PPCDownloadService.this);
int check = util.checkHDDSpace();
switch (check)
{
case 0:
// download the apk.
MountInfoBean mBean = util.getMobileHDDInfo();
Log.i(TAG, "--->>> apk path: " + apkPath);
Log.i(TAG, "--->>> storage path: " + mBean.getPath());
CommonUtils.downLoadFile(PPCDownloadService.this, mHandler, apkPath);
break;
case 1:
Log.i(TAG, "--->>> not enough space.");
handler.sendEmptyMessage(DOWNLOAD_APK_FAILED);
break;
case 2:
Log.i(TAG, "--->>> no devices.");
handler.sendEmptyMessage(DOWNLOAD_APK_FAILED);
break;
}
}
}
}
| 3,304 | 0.544492 | 0.53753 | 116 | 27.482759 | 22.429384 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.491379 | false | false | 4 |
0aa57f2deefaecba71ac1df27b699a0e229c8811 | 24,945,170,119,047 | a5f728e4fb194d758c9c899eb72d07c4d603a5b4 | /InvisibleBattlefieldsSDDLCore/src/lac/puc/ubi/invbat/concept/dao/BattleResultDAO.java | f9ad39efb62632b4f1464a8515b72fffb7ed8e67 | [] | no_license | stockrt/InvisibleBattlefields | https://github.com/stockrt/InvisibleBattlefields | 7ad64d4931366d8c260998b3b68092b84ed5ca45 | 02bd48afa849af1e4737048f4f17415499f62d54 | refs/heads/master | 2016-09-05T21:30:55.062000 | 2014-01-21T04:55:31 | 2014-01-21T04:55:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package lac.puc.ubi.invbat.concept.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import lac.puc.ubi.invbat.concept.model.BattleResultData;
public class BattleResultDAO extends BaseDAO {
public void apagar(Integer id) {
conectar();
try {
comando.executeUpdate("DELETE FROM BattleResult WHERE id = " + id
+ ";");
} catch (SQLException e) {
imprimeErro("Erro ao apagar BattleResults", e.getMessage());
} finally {
fechar();
}
}
private BattleResultData setBattleResult(ResultSet rs) throws SQLException {
BattleResultData temp = new BattleResultData();
// pega todos os atributos da BattleResult
temp.setId(rs.getInt("id"));
temp.setBattleId(rs.getInt("Battle_id"));
temp.setCharFromId(rs.getInt("Char_From"));
temp.setCharToId(rs.getInt("Char_To"));
temp.setDate(rs.getDate("date"));
temp.setExp_points(rs.getInt("exp_points"));
temp.setSten(rs.getDouble("sten"));
temp.setIntel(rs.getDouble("intel"));
temp.setAgili(rs.getDouble("agili"));
temp.setState(rs.getInt("state"));
return temp;
}
public Vector<BattleResultData> buscarTodos() {
conectar();
Vector<BattleResultData> resultados = new Vector<BattleResultData>();
ResultSet rs;
try {
rs = comando.executeQuery("SELECT * FROM BattleResult");
while (rs.next()) {
BattleResultData temp = setBattleResult(rs);
resultados.add(temp);
}
return resultados;
} catch (SQLException e) {
imprimeErro("Erro ao buscar BattleResults", e.getMessage());
return null;
}
}
public void atualizar(BattleResultData battleResult) {
conectar();
long mili = battleResult.getDate().getTime();
java.sql.Date dataSQL = new java.sql.Date(mili);
String com = "UPDATE BattleResult SET Battle_id = "
+ battleResult.getBattleId() + ", User_From = "
+ battleResult.getCharFromId() + ", User_To = "
+ battleResult.getCharToId() + ", date ='" + dataSQL.toString()
+ "', exp_points = " + battleResult.getExp_points()
+ ", sten = " + battleResult.getSten() + ", intel = "
+ battleResult.getIntel() + ", agili = "
+ battleResult.getAgili() + ", state = "
+ battleResult.getState() + " WHERE id = "
+ battleResult.getId() + ";";
System.out.println("Atualizada!");
try {
System.out.println("Sql:" + com);
comando.executeUpdate(com);
} catch (SQLException e) {
System.out.println("Sql:" + com);
e.printStackTrace();
} finally {
fechar();
}
}
public BattleResultData buscar(Integer id) {
conectar();
Vector<BattleResultData> resultados = new Vector<BattleResultData>();
ResultSet rs;
BattleResultData userBattle = null;
try {
rs = comando.executeQuery("SELECT * FROM BattleResult WHERE id = "
+ id + ";");
while (rs.next()) {
BattleResultData temp = setBattleResult(rs);
resultados.add(temp);
return temp;
}
return userBattle;
} catch (SQLException e) {
imprimeErro("Erro ao buscar BattleResult", e.getMessage());
return null;
}
}
public BattleResultData buscar(int battleId, int charId) {
conectar();
Vector<BattleResultData> resultados = new Vector<BattleResultData>();
ResultSet rs;
BattleResultData userBattle = null;
try {
rs = comando
.executeQuery("SELECT * FROM BattleResult WHERE Battle_id = "
+ battleId + " and Char_From = " + charId + ";");
while (rs.next()) {
BattleResultData temp = setBattleResult(rs);
resultados.add(temp);
return temp;
}
return userBattle;
} catch (SQLException e) {
imprimeErro("Erro ao buscar BattleResult", e.getMessage());
return null;
}
}
public void insere(BattleResultData battleResult) {
conectar();
long mili = battleResult.getDate().getTime();
java.sql.Date dataSQL = new java.sql.Date(mili);
String sql = "";
String charTo = (String) ((battleResult.getCharToId() == 0) ? "null"
: battleResult.getCharToId());
try {
sql = "INSERT INTO BattleResult VALUES (null" + " , "
+ battleResult.getBattleId() + " ,"
+ battleResult.getCharFromId() + " , "
+ battleResult.getClanId() + " , '" + dataSQL.toString()
+ "' , " + charTo + " , " + battleResult.getExp_points()
+ " , " + battleResult.getSten() + " , "
+ battleResult.getIntel() + " , " + battleResult.getAgili()
+ " , " + battleResult.getState() + ")";
comando.executeUpdate(sql);
System.out.println("Inserida!");
} catch (SQLException e) {
System.out.println("sql: " + sql);
imprimeErro("Erro ao inserir BattleResult", e.getMessage());
} finally {
fechar();
}
}
}
| UTF-8 | Java | 4,573 | java | BattleResultDAO.java | Java | [] | null | [] | package lac.puc.ubi.invbat.concept.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import lac.puc.ubi.invbat.concept.model.BattleResultData;
public class BattleResultDAO extends BaseDAO {
public void apagar(Integer id) {
conectar();
try {
comando.executeUpdate("DELETE FROM BattleResult WHERE id = " + id
+ ";");
} catch (SQLException e) {
imprimeErro("Erro ao apagar BattleResults", e.getMessage());
} finally {
fechar();
}
}
private BattleResultData setBattleResult(ResultSet rs) throws SQLException {
BattleResultData temp = new BattleResultData();
// pega todos os atributos da BattleResult
temp.setId(rs.getInt("id"));
temp.setBattleId(rs.getInt("Battle_id"));
temp.setCharFromId(rs.getInt("Char_From"));
temp.setCharToId(rs.getInt("Char_To"));
temp.setDate(rs.getDate("date"));
temp.setExp_points(rs.getInt("exp_points"));
temp.setSten(rs.getDouble("sten"));
temp.setIntel(rs.getDouble("intel"));
temp.setAgili(rs.getDouble("agili"));
temp.setState(rs.getInt("state"));
return temp;
}
public Vector<BattleResultData> buscarTodos() {
conectar();
Vector<BattleResultData> resultados = new Vector<BattleResultData>();
ResultSet rs;
try {
rs = comando.executeQuery("SELECT * FROM BattleResult");
while (rs.next()) {
BattleResultData temp = setBattleResult(rs);
resultados.add(temp);
}
return resultados;
} catch (SQLException e) {
imprimeErro("Erro ao buscar BattleResults", e.getMessage());
return null;
}
}
public void atualizar(BattleResultData battleResult) {
conectar();
long mili = battleResult.getDate().getTime();
java.sql.Date dataSQL = new java.sql.Date(mili);
String com = "UPDATE BattleResult SET Battle_id = "
+ battleResult.getBattleId() + ", User_From = "
+ battleResult.getCharFromId() + ", User_To = "
+ battleResult.getCharToId() + ", date ='" + dataSQL.toString()
+ "', exp_points = " + battleResult.getExp_points()
+ ", sten = " + battleResult.getSten() + ", intel = "
+ battleResult.getIntel() + ", agili = "
+ battleResult.getAgili() + ", state = "
+ battleResult.getState() + " WHERE id = "
+ battleResult.getId() + ";";
System.out.println("Atualizada!");
try {
System.out.println("Sql:" + com);
comando.executeUpdate(com);
} catch (SQLException e) {
System.out.println("Sql:" + com);
e.printStackTrace();
} finally {
fechar();
}
}
public BattleResultData buscar(Integer id) {
conectar();
Vector<BattleResultData> resultados = new Vector<BattleResultData>();
ResultSet rs;
BattleResultData userBattle = null;
try {
rs = comando.executeQuery("SELECT * FROM BattleResult WHERE id = "
+ id + ";");
while (rs.next()) {
BattleResultData temp = setBattleResult(rs);
resultados.add(temp);
return temp;
}
return userBattle;
} catch (SQLException e) {
imprimeErro("Erro ao buscar BattleResult", e.getMessage());
return null;
}
}
public BattleResultData buscar(int battleId, int charId) {
conectar();
Vector<BattleResultData> resultados = new Vector<BattleResultData>();
ResultSet rs;
BattleResultData userBattle = null;
try {
rs = comando
.executeQuery("SELECT * FROM BattleResult WHERE Battle_id = "
+ battleId + " and Char_From = " + charId + ";");
while (rs.next()) {
BattleResultData temp = setBattleResult(rs);
resultados.add(temp);
return temp;
}
return userBattle;
} catch (SQLException e) {
imprimeErro("Erro ao buscar BattleResult", e.getMessage());
return null;
}
}
public void insere(BattleResultData battleResult) {
conectar();
long mili = battleResult.getDate().getTime();
java.sql.Date dataSQL = new java.sql.Date(mili);
String sql = "";
String charTo = (String) ((battleResult.getCharToId() == 0) ? "null"
: battleResult.getCharToId());
try {
sql = "INSERT INTO BattleResult VALUES (null" + " , "
+ battleResult.getBattleId() + " ,"
+ battleResult.getCharFromId() + " , "
+ battleResult.getClanId() + " , '" + dataSQL.toString()
+ "' , " + charTo + " , " + battleResult.getExp_points()
+ " , " + battleResult.getSten() + " , "
+ battleResult.getIntel() + " , " + battleResult.getAgili()
+ " , " + battleResult.getState() + ")";
comando.executeUpdate(sql);
System.out.println("Inserida!");
} catch (SQLException e) {
System.out.println("sql: " + sql);
imprimeErro("Erro ao inserir BattleResult", e.getMessage());
} finally {
fechar();
}
}
}
| 4,573 | 0.657118 | 0.656899 | 149 | 29.691275 | 21.662729 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.033557 | false | false | 4 |
ef4f8b757beba7beeb77f28bf0607d974d1fa429 | 24,945,170,123,255 | 9479fcf282214abf6306cce40df03d27b8e57348 | /src/com/leetcode/easy/BuddyStrings.java | 7bf4a96c776408e750f491003beb7ba9c5def23c | [] | no_license | prash-mi/Misc | https://github.com/prash-mi/Misc | 374d48f1208860bc6c765cc625f17f164b63bf10 | 1d53ffa25a3cdb48bcb7c3b875ef0cb63a9be5cf | refs/heads/master | 2021-07-10T10:23:50.935000 | 2021-03-01T14:50:52 | 2021-03-01T14:50:52 | 233,028,571 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.leetcode.easy;
import java.util.HashSet;
import java.util.Set;
public class BuddyStrings {
//O(n) time and O(1) space as seem set will just have 26 entries in the worst case
public boolean buddyStrings(String A, String B) {
if (A==null||B==null||A.length()!=B.length()||A.length()<2){
return false;
}
int[] swap = new int[3];
int cnt=0;
for (int i = 0; i < A.length(); i++){
if (A.charAt(i)!=B.charAt(i)){
swap[cnt++] = i;
}
if (cnt == 3){
return false;
}
}
if(cnt == 0){//there is a case like aa and aa. OR abab and abab. so we have to see if any two chars are the same
Set<Character> seen = new HashSet();
for (int i = 0; i < A.length(); i++){
if (seen.contains(A.charAt(i))){
return true;
}else {
seen.add(A.charAt(i));
}
}
}
if (cnt == 2){//compare these chars
return (A.charAt(swap[0]) == B.charAt(swap[1]) && A.charAt(swap[1]) == B.charAt(swap[0]));
}
return false;
}
}
| UTF-8 | Java | 1,219 | java | BuddyStrings.java | Java | [] | null | [] | package com.leetcode.easy;
import java.util.HashSet;
import java.util.Set;
public class BuddyStrings {
//O(n) time and O(1) space as seem set will just have 26 entries in the worst case
public boolean buddyStrings(String A, String B) {
if (A==null||B==null||A.length()!=B.length()||A.length()<2){
return false;
}
int[] swap = new int[3];
int cnt=0;
for (int i = 0; i < A.length(); i++){
if (A.charAt(i)!=B.charAt(i)){
swap[cnt++] = i;
}
if (cnt == 3){
return false;
}
}
if(cnt == 0){//there is a case like aa and aa. OR abab and abab. so we have to see if any two chars are the same
Set<Character> seen = new HashSet();
for (int i = 0; i < A.length(); i++){
if (seen.contains(A.charAt(i))){
return true;
}else {
seen.add(A.charAt(i));
}
}
}
if (cnt == 2){//compare these chars
return (A.charAt(swap[0]) == B.charAt(swap[1]) && A.charAt(swap[1]) == B.charAt(swap[0]));
}
return false;
}
}
| 1,219 | 0.465956 | 0.453651 | 37 | 31.945946 | 26.837797 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.648649 | false | false | 4 |
ec1f4c1fb9d8274ca45bac487360d5984f1c4267 | 3,547,643,009,617 | dc71db23e7cc504ff462d470520dd9b52912f52b | /PageRepFIFA.java | 019b0f994320ad53bfde673aa9926fa51cf182a5 | [] | no_license | Sandoh0202/OperatingSystems | https://github.com/Sandoh0202/OperatingSystems | 5c4e6400bc59d0d2c85133166245f2925e4407f6 | d352c9b638f21e439991ff1e136200eefb5af18d | refs/heads/master | 2021-01-19T03:36:55.148000 | 2017-04-05T15:59:00 | 2017-04-05T15:59:00 | 87,329,169 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.*;
class PageRepFIFA
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
System.out.print("Enter Frame and Total no. of Pages: ");
int f=in.nextInt(),n=in.nextInt(),i,ptr=0,page,c=0,x,j,a=0;
int arr[][]=new int[f][n];
for(i=0;i<n;i++)
{
x=0;
System.out.print("\nEnter page value: ");
page=in.nextInt();
if(c==0)
{
arr[0][0]=page;
c++;a++;continue;
}
for(j=0;j<f;j++)
{
arr[j][i]=arr[j][i-1];
if(arr[j][i]==page)
x=1;
}
if(x==1)
continue;
if(c<3)
{
arr[c++][i]=page;
a++;
}
else
{
arr[ptr++][i]=page;
ptr%=f;a++;
}
}
for(i=0;i<f;i++)
{
for(j=0;j<n;j++)
{
if(arr[i][j]==0)
System.out.print(" ");
else
System.out.print(arr[i][j]+" ");
}
System.out.println();
}
System.out.println("Faults: "+a);
}
} | UTF-8 | Java | 890 | java | PageRepFIFA.java | Java | [] | null | [] | import java.util.*;
class PageRepFIFA
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
System.out.print("Enter Frame and Total no. of Pages: ");
int f=in.nextInt(),n=in.nextInt(),i,ptr=0,page,c=0,x,j,a=0;
int arr[][]=new int[f][n];
for(i=0;i<n;i++)
{
x=0;
System.out.print("\nEnter page value: ");
page=in.nextInt();
if(c==0)
{
arr[0][0]=page;
c++;a++;continue;
}
for(j=0;j<f;j++)
{
arr[j][i]=arr[j][i-1];
if(arr[j][i]==page)
x=1;
}
if(x==1)
continue;
if(c<3)
{
arr[c++][i]=page;
a++;
}
else
{
arr[ptr++][i]=page;
ptr%=f;a++;
}
}
for(i=0;i<f;i++)
{
for(j=0;j<n;j++)
{
if(arr[i][j]==0)
System.out.print(" ");
else
System.out.print(arr[i][j]+" ");
}
System.out.println();
}
System.out.println("Faults: "+a);
}
} | 890 | 0.486517 | 0.468539 | 53 | 15.81132 | 14.195477 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.54717 | false | false | 4 |
b484c96377e29096bdc510be90fe37803090c133 | 30,408,368,490,522 | 41ed11c8a2576be709863123327eda459a58279c | /gitspringboot/src/.apt_generated/com/gitspringboot/model/CertDetails_.java | fec597af3029aa51497534de9ba2590ee51bfb3e | [] | no_license | ahashrafalia/gitspringboot | https://github.com/ahashrafalia/gitspringboot | f3c3f74ede1149035368bee8fe7ade951bcda29d | f0eb5979dad527cf489bbd6db7e6b81c9e5c8385 | refs/heads/master | 2021-09-07T15:42:44.652000 | 2018-02-25T09:42:25 | 2018-02-25T09:42:25 | 108,966,963 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gitspringboot.model;
import java.util.Date;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(CertDetails.class)
public abstract class CertDetails_ {
public static volatile SingularAttribute<CertDetails, String> contactEmail;
public static volatile SingularAttribute<CertDetails, String> certName;
public static volatile SingularAttribute<CertDetails, String> contactName;
public static volatile SingularAttribute<CertDetails, Long> certId;
public static volatile SingularAttribute<CertDetails, Date> expDate;
public static volatile SingularAttribute<CertDetails, String> status;
}
| UTF-8 | Java | 809 | java | CertDetails_.java | Java | [] | null | [] | package com.gitspringboot.model;
import java.util.Date;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(CertDetails.class)
public abstract class CertDetails_ {
public static volatile SingularAttribute<CertDetails, String> contactEmail;
public static volatile SingularAttribute<CertDetails, String> certName;
public static volatile SingularAttribute<CertDetails, String> contactName;
public static volatile SingularAttribute<CertDetails, Long> certId;
public static volatile SingularAttribute<CertDetails, Date> expDate;
public static volatile SingularAttribute<CertDetails, String> status;
}
| 809 | 0.822002 | 0.822002 | 19 | 40.473682 | 28.988871 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.210526 | false | false | 4 |
26b8020797301e9f08348b13ccd416eeff1bd097 | 7,164,005,452,408 | 028c967526deb3ca62ed069a07bdc8ddf8f44d0b | /JAVA/tbk-backoffice-promociones-sorteador-services/src/test/java/cl/tbk/backoffice/promociones/sorteador/service/ServiceTest.java | d6cd0246da0fd5d8857e704faa863922287d4d51 | [] | no_license | r3ing/bkp-all | https://github.com/r3ing/bkp-all | 629fb5d44b3bcfe0b45f5fb505734465532707ce | 12383ab7578dffa1b220dc51b00e157034fc529d | refs/heads/master | 2020-06-23T14:28:45.206000 | 2019-07-24T21:21:06 | 2019-07-24T21:21:06 | 198,489,600 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cl.tbk.backoffice.promociones.sorteador.service;
public class ServiceTest {
}
| UTF-8 | Java | 87 | java | ServiceTest.java | Java | [] | null | [] | package cl.tbk.backoffice.promociones.sorteador.service;
public class ServiceTest {
}
| 87 | 0.816092 | 0.816092 | 4 | 20.75 | 22.86236 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 4 |
870c6464ae0b795deed98b654a10a2580dad4e6e | 15,324,443,316,231 | 1c9349330e43d9e39b1efd505fba36d94606a499 | /Backend/src/main/java/com/revature/data/GameStateDAOImpl.java | d5f57350e1d856dbc65524ef7530450d7ccc1e37 | [
"MIT"
] | permissive | welol5/CompetitiveConnect4 | https://github.com/welol5/CompetitiveConnect4 | f6026bd3bfdb5a806f9d18f6214e646571147e1b | 7d8dcf074d0974cef3400fdb032d1cbea4841a06 | refs/heads/master | 2023-03-07T02:11:09.071000 | 2021-01-08T23:05:45 | 2021-01-08T23:05:45 | 322,116,351 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.revature.data;
import com.revature.beans.GameState;
import com.revature.utils.HibernateUtil;
import org.hibernate.QueryException;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.query.Query;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
@Repository
public class GameStateDAOImpl implements GameStateDAO{
private HibernateUtil hu = HibernateUtil.getHibernateUtil();
@Override
public GameState add(GameState gameState) {
Session s = hu.getSession();
Transaction tx = null;
try {
tx = s.beginTransaction();
s.save(gameState);
tx.commit();
} catch (Exception e) {
if (tx != null)
tx.rollback();
} finally {
s.close();
}
return gameState;
}
public GameState getByLongId(Long id) {
Session s = hu.getSession();
GameState g = s.get(GameState.class, id);
s.close();
return g;
}
@Override
public List<GameState> getAll() {
Session s = hu.getSession();
String query = "";
query += "from GameState";
Query<GameState> g = s.createQuery(query, GameState.class);
List<GameState> gameStateList = new ArrayList<>();
gameStateList = g.getResultList();
s.close();
return gameStateList;
}
@Override
public void update(GameState gameState) {
Session s = hu.getSession();
Transaction tx = null;
try {
tx = s.beginTransaction();
s.update(gameState);
tx.commit();
} catch (Exception e) {
if (tx != null)
tx.rollback();
} finally {
s.close();
}
}
@Override
public void delete(GameState gameState) {
}
}
| UTF-8 | Java | 1,906 | java | GameStateDAOImpl.java | Java | [] | null | [] | package com.revature.data;
import com.revature.beans.GameState;
import com.revature.utils.HibernateUtil;
import org.hibernate.QueryException;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.query.Query;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
@Repository
public class GameStateDAOImpl implements GameStateDAO{
private HibernateUtil hu = HibernateUtil.getHibernateUtil();
@Override
public GameState add(GameState gameState) {
Session s = hu.getSession();
Transaction tx = null;
try {
tx = s.beginTransaction();
s.save(gameState);
tx.commit();
} catch (Exception e) {
if (tx != null)
tx.rollback();
} finally {
s.close();
}
return gameState;
}
public GameState getByLongId(Long id) {
Session s = hu.getSession();
GameState g = s.get(GameState.class, id);
s.close();
return g;
}
@Override
public List<GameState> getAll() {
Session s = hu.getSession();
String query = "";
query += "from GameState";
Query<GameState> g = s.createQuery(query, GameState.class);
List<GameState> gameStateList = new ArrayList<>();
gameStateList = g.getResultList();
s.close();
return gameStateList;
}
@Override
public void update(GameState gameState) {
Session s = hu.getSession();
Transaction tx = null;
try {
tx = s.beginTransaction();
s.update(gameState);
tx.commit();
} catch (Exception e) {
if (tx != null)
tx.rollback();
} finally {
s.close();
}
}
@Override
public void delete(GameState gameState) {
}
}
| 1,906 | 0.581847 | 0.581847 | 75 | 24.413334 | 16.646996 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533333 | false | false | 4 |
b25b6fce3fdb7d51fdde9b8e7b3263f8e9ba5435 | 38,268,158,628,875 | d232507e2d3ec51edcb9c0499a6088a40703fa58 | /GS/SortArrayWaveForm.java | 591af935a1e840bfe460fd5dc54819cc045b6597 | [] | no_license | v-coder4u/programming_prepration | https://github.com/v-coder4u/programming_prepration | 3eed1a65ec44c1add0cd0f0ad8b30d12ff5bbd32 | 2b670086150d3efe521c9d0e51f3543fa2274bbd | refs/heads/main | 2023-03-19T10:07:08.287000 | 2021-03-11T10:04:59 | 2021-03-11T10:04:59 | 336,648,985 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gs;
import java.util.Arrays;
public class SortArrayWaveForm {
void swap(int arr[], int a, int b) {
int temp = arr[a];
arr[a] = arr[b];
arr[b] = temp;
}
void sortInWave(int arr[], int n) {
for (int i = 0; i < n; i += 2) {
if (i > 0 && arr[i - 1] > arr[i])
swap(arr, i - 1, i);
if (i < n - 1 && arr[i] < arr[i + 1])
swap(arr, i, i + 1);
}
}
}
// void swap(int arr[], int a, int b) {
// int temp = arr[a];
// arr[a] = arr[b];
// arr[b] = temp;
// }
//
//void sortInWave(int arr[], int n) {
// Arrays.sort(arr);
//
// for (int i = 0; i < n - 1; i += 2)
// swap(arr, i, i + 1);
//} | UTF-8 | Java | 623 | java | SortArrayWaveForm.java | Java | [] | null | [] | package gs;
import java.util.Arrays;
public class SortArrayWaveForm {
void swap(int arr[], int a, int b) {
int temp = arr[a];
arr[a] = arr[b];
arr[b] = temp;
}
void sortInWave(int arr[], int n) {
for (int i = 0; i < n; i += 2) {
if (i > 0 && arr[i - 1] > arr[i])
swap(arr, i - 1, i);
if (i < n - 1 && arr[i] < arr[i + 1])
swap(arr, i, i + 1);
}
}
}
// void swap(int arr[], int a, int b) {
// int temp = arr[a];
// arr[a] = arr[b];
// arr[b] = temp;
// }
//
//void sortInWave(int arr[], int n) {
// Arrays.sort(arr);
//
// for (int i = 0; i < n - 1; i += 2)
// swap(arr, i, i + 1);
//} | 623 | 0.478331 | 0.459069 | 36 | 16.333334 | 14.395215 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.888889 | false | false | 4 |
f626a8d31368111b4132d4cf219c6316d3bafe0d | 36,146,444,808,293 | 99238679dcf9f479c3934c1e9b00fed1d3241d92 | /user/src/main/java/crazy/vo/NoticeVo.java | 2ac5f7750ff7e65338ef4174e2cefc2b9649305e | [] | no_license | qqhard/game | https://github.com/qqhard/game | 00b521cc5ae54b567c237ca3d3218b6da52325b2 | 654333133578e3b0aa03c97ae656e29b0c57ef4e | refs/heads/master | 2021-01-17T14:51:55.239000 | 2016-03-11T09:17:56 | 2016-03-11T09:17:56 | 53,654,578 | 3 | 0 | null | false | 2016-03-23T12:02:33 | 2016-03-11T09:12:42 | 2016-03-11T09:19:11 | 2016-03-23T12:02:33 | 2,523 | 0 | 0 | 0 | JavaScript | null | null | package crazy.vo;
import org.springframework.data.annotation.Id;
public class NoticeVo {
public String getNotice() {
return notice;
}
public void setNotice(String notice) {
this.notice = notice;
}
public String getId() {
return id;
}
@Id
private String id;
private String notice;
}
| UTF-8 | Java | 302 | java | NoticeVo.java | Java | [] | null | [] | package crazy.vo;
import org.springframework.data.annotation.Id;
public class NoticeVo {
public String getNotice() {
return notice;
}
public void setNotice(String notice) {
this.notice = notice;
}
public String getId() {
return id;
}
@Id
private String id;
private String notice;
}
| 302 | 0.708609 | 0.708609 | 18 | 15.777778 | 13.550546 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.166667 | false | false | 4 |
5a7314386da34d294bf433ff04c8c401853855a3 | 39,436,389,717,893 | a9866f6d22332fe143974080d56a7284f9eda7c0 | /wql-generator/src/main/java/com/wql/generator/task/EntityTask.java | c84c384073ea98140ec7715f377d48ab5699b654 | [
"Apache-2.0"
] | permissive | wangqiulin/wql-cloud | https://github.com/wangqiulin/wql-cloud | 2847c7eef4c86098596899676c3f0388a0259b16 | 801163ba308ed20c4d3c50ff9200c3ec59cfa813 | refs/heads/master | 2022-12-22T09:30:10.565000 | 2020-09-21T07:26:18 | 2020-09-21T07:26:18 | 133,511,928 | 4 | 0 | null | false | 2022-12-14T20:35:24 | 2018-05-15T12:19:05 | 2021-06-03T15:47:32 | 2022-12-14T20:35:21 | 1,695 | 2 | 1 | 9 | Java | false | false | package com.wql.generator.task;
import freemarker.template.TemplateException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.wql.generator.entity.ColumnInfo;
import com.wql.generator.task.base.AbstractTask;
import com.wql.generator.utils.*;
public class EntityTask extends AbstractTask {
/**
*
*/
private static final long serialVersionUID = 1L;
public EntityTask(String tableName, String className, List<ColumnInfo> infos) {
super(tableName, className, infos);
}
/**
* 1.ๅ่กจ็ๆ 2.ๅค่กจๆถ็ๆๅญ่กจๅฎไฝ
*/
public EntityTask(String className, List<ColumnInfo> infos) {
this(className, null, null, infos);
}
/**
* ไธๅฏนๅคๅ
ณ็ณป็ๆไธป่กจๅฎไฝ
*/
public EntityTask(String className, String parentClassName, String foreignKey, List<ColumnInfo> tableInfos) {
this(className, parentClassName, foreignKey, null, tableInfos);
}
/**
* ๅคๅฏนๅคๅ
ณ็ณป็ๆไธป่กจๅฎไฝ
*/
public EntityTask(String className, String parentClassName, String foreignKey, String parentForeignKey, List<ColumnInfo> tableInfos) {
super(className, parentClassName, foreignKey, parentForeignKey, tableInfos);
}
@Override
public void run() throws IOException, TemplateException {
// ็ๆEntityๅกซๅ
ๆฐๆฎ
System.out.println("Generating " + className + ".java");
Map<String, String> entityData = new HashMap<>();
entityData.put("BasePackageName", ConfigUtil.getConfiguration().getPackageName());
entityData.put("EntityPackageName", ConfigUtil.getConfiguration().getPath().getEntity());
entityData.put("Author", ConfigUtil.getConfiguration().getAuthor());
entityData.put("Date", new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
entityData.put("TableName", tableName);
entityData.put("ClassName", className);
if (!StringUtil.isBlank(parentForeignKey)) { // ๅคๅฏนๅค๏ผไธป่กจๅฎไฝ
entityData.put("Properties", GeneratorUtil.generateEntityProperties(parentClassName, tableInfos));
entityData.put("Methods", GeneratorUtil.generateEntityMethods(parentClassName, tableInfos));
} else if (!StringUtil.isBlank(foreignKey)) { // ๅคๅฏนไธ๏ผไธป่กจๅฎไฝ
entityData.put("Properties", GeneratorUtil.generateEntityProperties(parentClassName, tableInfos, foreignKey));
entityData.put("Methods", GeneratorUtil.generateEntityMethods(parentClassName, tableInfos, foreignKey));
} else { // ๅ่กจๅ
ณ็ณป
entityData.put("Properties", GeneratorUtil.generateEntityProperties(tableInfos));
//entityData.put("Methods", GeneratorUtil.generateEntityMethods(tableInfos));
}
//String sourcePath = FileUtil.getSourcePath();
String sourcePath = ConfigUtil.getConfiguration().getFilePathPrefix();
String filePath = sourcePath + StringUtil.package2Path(ConfigUtil.getConfiguration().getPackageName()) + StringUtil.package2Path(ConfigUtil.getConfiguration().getPath().getEntity());
String fileName = className + ".java";
// ็ๆEntityๆไปถ
FileUtil.generateToJava(FreemarketConfigUtils.TYPE_ENTITY, entityData, filePath + fileName);
}
}
| UTF-8 | Java | 3,370 | java | EntityTask.java | Java | [] | null | [] | package com.wql.generator.task;
import freemarker.template.TemplateException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.wql.generator.entity.ColumnInfo;
import com.wql.generator.task.base.AbstractTask;
import com.wql.generator.utils.*;
public class EntityTask extends AbstractTask {
/**
*
*/
private static final long serialVersionUID = 1L;
public EntityTask(String tableName, String className, List<ColumnInfo> infos) {
super(tableName, className, infos);
}
/**
* 1.ๅ่กจ็ๆ 2.ๅค่กจๆถ็ๆๅญ่กจๅฎไฝ
*/
public EntityTask(String className, List<ColumnInfo> infos) {
this(className, null, null, infos);
}
/**
* ไธๅฏนๅคๅ
ณ็ณป็ๆไธป่กจๅฎไฝ
*/
public EntityTask(String className, String parentClassName, String foreignKey, List<ColumnInfo> tableInfos) {
this(className, parentClassName, foreignKey, null, tableInfos);
}
/**
* ๅคๅฏนๅคๅ
ณ็ณป็ๆไธป่กจๅฎไฝ
*/
public EntityTask(String className, String parentClassName, String foreignKey, String parentForeignKey, List<ColumnInfo> tableInfos) {
super(className, parentClassName, foreignKey, parentForeignKey, tableInfos);
}
@Override
public void run() throws IOException, TemplateException {
// ็ๆEntityๅกซๅ
ๆฐๆฎ
System.out.println("Generating " + className + ".java");
Map<String, String> entityData = new HashMap<>();
entityData.put("BasePackageName", ConfigUtil.getConfiguration().getPackageName());
entityData.put("EntityPackageName", ConfigUtil.getConfiguration().getPath().getEntity());
entityData.put("Author", ConfigUtil.getConfiguration().getAuthor());
entityData.put("Date", new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
entityData.put("TableName", tableName);
entityData.put("ClassName", className);
if (!StringUtil.isBlank(parentForeignKey)) { // ๅคๅฏนๅค๏ผไธป่กจๅฎไฝ
entityData.put("Properties", GeneratorUtil.generateEntityProperties(parentClassName, tableInfos));
entityData.put("Methods", GeneratorUtil.generateEntityMethods(parentClassName, tableInfos));
} else if (!StringUtil.isBlank(foreignKey)) { // ๅคๅฏนไธ๏ผไธป่กจๅฎไฝ
entityData.put("Properties", GeneratorUtil.generateEntityProperties(parentClassName, tableInfos, foreignKey));
entityData.put("Methods", GeneratorUtil.generateEntityMethods(parentClassName, tableInfos, foreignKey));
} else { // ๅ่กจๅ
ณ็ณป
entityData.put("Properties", GeneratorUtil.generateEntityProperties(tableInfos));
//entityData.put("Methods", GeneratorUtil.generateEntityMethods(tableInfos));
}
//String sourcePath = FileUtil.getSourcePath();
String sourcePath = ConfigUtil.getConfiguration().getFilePathPrefix();
String filePath = sourcePath + StringUtil.package2Path(ConfigUtil.getConfiguration().getPackageName()) + StringUtil.package2Path(ConfigUtil.getConfiguration().getPath().getEntity());
String fileName = className + ".java";
// ็ๆEntityๆไปถ
FileUtil.generateToJava(FreemarketConfigUtils.TYPE_ENTITY, entityData, filePath + fileName);
}
}
| 3,370 | 0.708333 | 0.70679 | 76 | 41.63158 | 40.701042 | 190 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.171053 | false | false | 4 |
a67f2df07d64baf40cdc5b97274e2a31240ed095 | 2,430,951,559,278 | b5783da791a27e313d2fbca53adb467682e8f654 | /src/main/java/com/je/jsboot/services/shoppings/ShoppingService.java | 010d7d0d64aa325f99f19b0353e345aa7771979e | [] | no_license | masanchezr/jewelry | https://github.com/masanchezr/jewelry | d7fbceb83c7c99654d9ba8e42bcbab0c5f30ff31 | 39d95a0eb94a72f1b5f8a6a50e1b1e20ae42abfb | refs/heads/master | 2023-08-17T01:11:05.418000 | 2023-08-08T08:46:35 | 2023-08-08T08:46:35 | 99,904,774 | 0 | 0 | null | false | 2023-02-22T08:10:01 | 2017-08-10T09:17:00 | 2022-01-06T17:49:16 | 2023-02-22T08:10:00 | 61,359 | 0 | 0 | 1 | Java | false | false | package com.je.jsboot.services.shoppings;
import java.io.File;
import java.util.List;
import com.je.jsboot.dbaccess.entities.PlaceEntity;
import com.je.jsboot.dbaccess.entities.ShoppingEntity;
import com.je.jsboot.services.dailies.Daily;
/**
* The Interface ShoppingService.
*/
public interface ShoppingService {
/**
* Save.
*
* @param shopping the shopping
* @return Daily
*/
public Daily save(Shopping shopping);
/**
* Search shoppings.
*
* @param shopping the shopping
* @return the list
*/
public List<Shopping> searchShoppings(String sDateFrom, String sDateUntil, PlaceEntity place, Long numshop);
/**
* Find shop by pk.
*
* @param idshop the idshop
* @return the shopping
*/
public Shopping findShopByPK(Long idshop);
/**
* Update.
*
* @param shoppingForm the shopping form
*/
public void update(Shopping shoppingForm);
public List<Long> searchGramsNull(String sDateFrom, String sDateUntil, PlaceEntity place);
public List<QuarterMetal> searchGramsByMetal(String sDateFrom, String sDateUntil, PlaceEntity place);
public Shopping searchClient(String refactorNIF);
public File generateExcel(String datefrom, String dateuntil);
public Long getNextNumber(String user);
public void saveAdmin(Shopping shoppingForm);
public List<ShoppingEntity> getByNIF(String nif);
boolean isRepeatNumber(String num, String user, int year);
}
| UTF-8 | Java | 1,462 | java | ShoppingService.java | Java | [] | null | [] | package com.je.jsboot.services.shoppings;
import java.io.File;
import java.util.List;
import com.je.jsboot.dbaccess.entities.PlaceEntity;
import com.je.jsboot.dbaccess.entities.ShoppingEntity;
import com.je.jsboot.services.dailies.Daily;
/**
* The Interface ShoppingService.
*/
public interface ShoppingService {
/**
* Save.
*
* @param shopping the shopping
* @return Daily
*/
public Daily save(Shopping shopping);
/**
* Search shoppings.
*
* @param shopping the shopping
* @return the list
*/
public List<Shopping> searchShoppings(String sDateFrom, String sDateUntil, PlaceEntity place, Long numshop);
/**
* Find shop by pk.
*
* @param idshop the idshop
* @return the shopping
*/
public Shopping findShopByPK(Long idshop);
/**
* Update.
*
* @param shoppingForm the shopping form
*/
public void update(Shopping shoppingForm);
public List<Long> searchGramsNull(String sDateFrom, String sDateUntil, PlaceEntity place);
public List<QuarterMetal> searchGramsByMetal(String sDateFrom, String sDateUntil, PlaceEntity place);
public Shopping searchClient(String refactorNIF);
public File generateExcel(String datefrom, String dateuntil);
public Long getNextNumber(String user);
public void saveAdmin(Shopping shoppingForm);
public List<ShoppingEntity> getByNIF(String nif);
boolean isRepeatNumber(String num, String user, int year);
}
| 1,462 | 0.71409 | 0.71409 | 62 | 21.580645 | 26.070963 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.016129 | false | false | 4 |
d7f30d4cc8b79c5fbd05386b7eb540cf2a82865d | 34,505,767,313,726 | d99b19abb19c61759cbe5ad94abb6754e9ed484d | /MagicMirror/app/src/main/java/com/novoda/magicmirror/FaceRecognitionActivity.java | 0e3966f69ec8acf39e11bcd5b3b0d48c81af9785 | [
"Apache-2.0"
] | permissive | novoda/spikes | https://github.com/novoda/spikes | b44d6783e8cc0cab6103d26ae76eb81df282ec4e | b93bb2666cdce01f96fa9fefbb0900c38ee98bf5 | refs/heads/master | 2023-08-14T09:25:49.438000 | 2022-09-13T12:50:39 | 2022-09-13T12:50:39 | 13,300,550 | 579 | 161 | NOASSERTION | false | 2023-03-02T11:47:13 | 2013-10-03T14:31:43 | 2023-02-03T09:00:55 | 2023-03-02T11:47:13 | 145,466 | 546 | 132 | 64 | Java | false | false | package com.novoda.magicmirror;
import android.Manifest;
import android.app.Dialog;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.WindowManager;
import android.widget.Toast;
import com.novoda.magicmirror.facerecognition.FaceStatusView;
import com.novoda.magicmirror.facerecognition.LookingEyes;
import com.novoda.magicmirror.sfx.FacialExpressionEffects;
import com.novoda.magicmirror.sfx.SfxMappings;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.novoda.notils.caster.Views;
import com.novoda.notils.logger.simple.Log;
import com.novoda.magicmirror.facerecognition.CameraSourcePreview;
import com.novoda.magicmirror.facerecognition.FaceCameraSource;
import com.novoda.magicmirror.facerecognition.FaceDetectionUnavailableException;
import com.novoda.magicmirror.facerecognition.FaceExpression;
import com.novoda.magicmirror.facerecognition.FaceReactionSource;
import com.novoda.magicmirror.facerecognition.FaceTracker;
import com.novoda.magicmirror.facerecognition.KeyToFaceMappings;
import com.novoda.magicmirror.facerecognition.KeyboardFaceSource;
import com.novoda.magicmirror.sfx.GlowView;
import com.novoda.magicmirror.sfx.ParticlesLayout;
public class FaceRecognitionActivity extends AppCompatActivity {
private static final int CAMERA_PERMISSION_REQUEST = 0;
private final DeviceInformation deviceInformation = new DeviceInformation();
private FaceReactionSource faceSource;
private CameraSourcePreview preview;
private SystemUIHider systemUIHider;
private FaceStatusView faceStatus;
private LookingEyes lookingEyes;
private GlowView glowView;
private ParticlesLayout particlesView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_face_recognition);
lookingEyes = (LookingEyes) findViewById(R.id.looking_eyes);
faceStatus = (FaceStatusView) findViewById(R.id.status);
preview = (CameraSourcePreview) findViewById(R.id.preview);
glowView = Views.findById(this, R.id.glow_background);
particlesView = Views.findById(this, R.id.particles);
particlesView.initialise();
systemUIHider = new SystemUIHider(findViewById(android.R.id.content));
keepScreenOn();
boolean hasCamera = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);
if (!hasCamera) {
Toast.makeText(this, R.string.no_camera_available_error, Toast.LENGTH_SHORT).show();
finish();
return;
}
if (isUsingCamera()) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(
this,
new String[]{Manifest.permission.CAMERA},
CAMERA_PERMISSION_REQUEST
);
} else {
tryToCreateCameraSource();
}
displayErrorIfPlayServicesMissing();
} else {
createKeyboardSource();
}
}
private boolean isUsingCamera() {
return !deviceInformation.isEmulator();
}
private void keepScreenOn() {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
private void createKeyboardSource() {
KeyToFaceMappings mappings = KeyToFaceMappings.newInstance();
faceSource = new KeyboardFaceSource(faceListener, mappings);
}
private void tryToCreateCameraSource() {
try {
faceSource = FaceCameraSource.createFrom(this, faceListener, preview);
} catch (FaceDetectionUnavailableException e) {
Toast.makeText(this, R.string.face_detection_not_available_error, Toast.LENGTH_LONG).show();
}
}
private void displayErrorIfPlayServicesMissing() {
int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this);
if (code != ConnectionResult.SUCCESS) {
Dialog dlg = GoogleApiAvailability.getInstance().getErrorDialog(this, code, 101);
dlg.show();
}
}
@Override
protected void onResume() {
super.onResume();
systemUIHider.hideSystemUi();
if (faceSourceHasBeenDefined()) {
faceSource.start();
}
}
private boolean faceSourceHasBeenDefined() {
return faceSource != null;
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == CAMERA_PERMISSION_REQUEST) {
if (isPermissionGranted(grantResults)) {
tryToCreateCameraSource();
} else {
Log.e("User denied CAMERA permission");
finish();
}
}
}
private boolean isPermissionGranted(@NonNull int[] grantResults) {
return grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED;
}
@Override
protected void onPause() {
super.onPause();
preview.stop();
lookingEyes.hide();
systemUIHider.showSystemUi();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (faceSourceHasBeenDefined()) {
faceSource.release();
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (faceSource.onKeyDown(keyCode)) {
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (faceSource.onKeyUp(keyCode)) {
return true;
}
return super.onKeyUp(keyCode, event);
}
private final FaceTracker.FaceListener faceListener = new FaceTracker.FaceListener() {
private final SfxMappings mappings = SfxMappings.newInstance();
@Override
public void onNewFace(final FaceExpression expression) {
runOnUiThread(new Runnable() {
@Override
public void run() {
FacialExpressionEffects effects = mappings.forExpression(expression);
glowView.transitionToColor(effects.glowColorRes());
if (effects.hasParticle()) {
particlesView.startParticles(effects.getParticle());
} else {
particlesView.stopParticles();
}
if (expression.isMissing()) {
lookingEyes.show();
faceStatus.hide();
} else {
lookingEyes.hide();
faceStatus.setExpression(expression);
faceStatus.show();
}
}
});
}
};
}
| UTF-8 | Java | 7,239 | java | FaceRecognitionActivity.java | Java | [] | null | [] | package com.novoda.magicmirror;
import android.Manifest;
import android.app.Dialog;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.WindowManager;
import android.widget.Toast;
import com.novoda.magicmirror.facerecognition.FaceStatusView;
import com.novoda.magicmirror.facerecognition.LookingEyes;
import com.novoda.magicmirror.sfx.FacialExpressionEffects;
import com.novoda.magicmirror.sfx.SfxMappings;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.novoda.notils.caster.Views;
import com.novoda.notils.logger.simple.Log;
import com.novoda.magicmirror.facerecognition.CameraSourcePreview;
import com.novoda.magicmirror.facerecognition.FaceCameraSource;
import com.novoda.magicmirror.facerecognition.FaceDetectionUnavailableException;
import com.novoda.magicmirror.facerecognition.FaceExpression;
import com.novoda.magicmirror.facerecognition.FaceReactionSource;
import com.novoda.magicmirror.facerecognition.FaceTracker;
import com.novoda.magicmirror.facerecognition.KeyToFaceMappings;
import com.novoda.magicmirror.facerecognition.KeyboardFaceSource;
import com.novoda.magicmirror.sfx.GlowView;
import com.novoda.magicmirror.sfx.ParticlesLayout;
public class FaceRecognitionActivity extends AppCompatActivity {
private static final int CAMERA_PERMISSION_REQUEST = 0;
private final DeviceInformation deviceInformation = new DeviceInformation();
private FaceReactionSource faceSource;
private CameraSourcePreview preview;
private SystemUIHider systemUIHider;
private FaceStatusView faceStatus;
private LookingEyes lookingEyes;
private GlowView glowView;
private ParticlesLayout particlesView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_face_recognition);
lookingEyes = (LookingEyes) findViewById(R.id.looking_eyes);
faceStatus = (FaceStatusView) findViewById(R.id.status);
preview = (CameraSourcePreview) findViewById(R.id.preview);
glowView = Views.findById(this, R.id.glow_background);
particlesView = Views.findById(this, R.id.particles);
particlesView.initialise();
systemUIHider = new SystemUIHider(findViewById(android.R.id.content));
keepScreenOn();
boolean hasCamera = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);
if (!hasCamera) {
Toast.makeText(this, R.string.no_camera_available_error, Toast.LENGTH_SHORT).show();
finish();
return;
}
if (isUsingCamera()) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(
this,
new String[]{Manifest.permission.CAMERA},
CAMERA_PERMISSION_REQUEST
);
} else {
tryToCreateCameraSource();
}
displayErrorIfPlayServicesMissing();
} else {
createKeyboardSource();
}
}
private boolean isUsingCamera() {
return !deviceInformation.isEmulator();
}
private void keepScreenOn() {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
private void createKeyboardSource() {
KeyToFaceMappings mappings = KeyToFaceMappings.newInstance();
faceSource = new KeyboardFaceSource(faceListener, mappings);
}
private void tryToCreateCameraSource() {
try {
faceSource = FaceCameraSource.createFrom(this, faceListener, preview);
} catch (FaceDetectionUnavailableException e) {
Toast.makeText(this, R.string.face_detection_not_available_error, Toast.LENGTH_LONG).show();
}
}
private void displayErrorIfPlayServicesMissing() {
int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this);
if (code != ConnectionResult.SUCCESS) {
Dialog dlg = GoogleApiAvailability.getInstance().getErrorDialog(this, code, 101);
dlg.show();
}
}
@Override
protected void onResume() {
super.onResume();
systemUIHider.hideSystemUi();
if (faceSourceHasBeenDefined()) {
faceSource.start();
}
}
private boolean faceSourceHasBeenDefined() {
return faceSource != null;
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == CAMERA_PERMISSION_REQUEST) {
if (isPermissionGranted(grantResults)) {
tryToCreateCameraSource();
} else {
Log.e("User denied CAMERA permission");
finish();
}
}
}
private boolean isPermissionGranted(@NonNull int[] grantResults) {
return grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED;
}
@Override
protected void onPause() {
super.onPause();
preview.stop();
lookingEyes.hide();
systemUIHider.showSystemUi();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (faceSourceHasBeenDefined()) {
faceSource.release();
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (faceSource.onKeyDown(keyCode)) {
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (faceSource.onKeyUp(keyCode)) {
return true;
}
return super.onKeyUp(keyCode, event);
}
private final FaceTracker.FaceListener faceListener = new FaceTracker.FaceListener() {
private final SfxMappings mappings = SfxMappings.newInstance();
@Override
public void onNewFace(final FaceExpression expression) {
runOnUiThread(new Runnable() {
@Override
public void run() {
FacialExpressionEffects effects = mappings.forExpression(expression);
glowView.transitionToColor(effects.glowColorRes());
if (effects.hasParticle()) {
particlesView.startParticles(effects.getParticle());
} else {
particlesView.stopParticles();
}
if (expression.isMissing()) {
lookingEyes.show();
faceStatus.hide();
} else {
lookingEyes.hide();
faceStatus.setExpression(expression);
faceStatus.show();
}
}
});
}
};
}
| 7,239 | 0.652438 | 0.651333 | 207 | 33.971016 | 27.36882 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 4 |
b584930923460948aac52cfc34778dffc57e63c5 | 37,666,863,217,077 | 3ddb02e1671f4f43cb1161cc2ceaa5befa5db87c | /archive.CS340/settlers/java/src/client/map/RobbingState.java | 6a76c5b9f497beedf800d62b10321ca6467eedba | [
"MIT"
] | permissive | kjdevocht/Archive | https://github.com/kjdevocht/Archive | 931e9982ab89a517047465772cadd7b9441385c0 | f73072eb29dd41e2f40bb3abdb9cc7f32bde61cb | refs/heads/master | 2021-05-01T15:27:58.986000 | 2015-07-26T07:03:29 | 2015-07-26T07:03:29 | 22,653,484 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package client.map;
import client.data.RobPlayerInfo;
import client.model.ClientModel;
import client.model.IPlayer;
import serverProxy.ClientCommunicator;
import shared.definitions.CatanColor;
import shared.definitions.PieceType;
import shared.locations.EdgeLocation;
import shared.locations.HexLocation;
import shared.locations.VertexLocation;
import java.util.List;
public class RobbingState implements IState {
private HexLocation newRobberLocation;
@Override
public boolean canPlaceRoad(EdgeLocation edgeLoc) {
return false;
}
@Override
public boolean canPlaceSettlement(VertexLocation vertLoc) {
return false;
}
@Override
public boolean canPlaceCity(VertexLocation vertLoc) {
return false;
}
@Override
public boolean canPlaceRobber(HexLocation hexLoc) {
return ClientModel.getUpdatableModel().getCatanMap().canPlaceRobberAtLocation(hexLoc);
}
@Override
public void placeRoad(EdgeLocation edgeLoc) {
}
@Override
public void placeSettlement(VertexLocation vertLoc) {
}
@Override
public void placeCity(VertexLocation vertLoc) {
}
@Override
public void placeRobber(HexLocation hexLoc, IMapView view, IRobView robView) {
List<Integer> victims = ClientModel.getUpdatableModel().getCatanMap().getVictims(hexLoc);
List<IPlayer> players = ClientModel.getUpdatableModel().getPlayers();
RobPlayerInfo[] candidates = new RobPlayerInfo[victims.size()];
this.newRobberLocation = hexLoc;
// System.out.println("Victims length: " + victims.size());
for (int i = 0; i < victims.size(); i++) {
IPlayer player = players.get(victims.get(i));
RobPlayerInfo candidate = new RobPlayerInfo();
candidate.setNumCards(player.getResources().getTotalResourceCount());
candidate.setColor(player.getColor());
candidate.setId(player.getPlayerId());
candidate.setName(player.getName());
candidate.setPlayerIndex(player.getPlayerIndex());
candidates[i] = candidate;
}
robView.setPlayers(candidates);
robView.showModal();
}
@Override
public void startMove(PieceType pieceType, boolean isFree, boolean allowDisconnected, IMapView view, IRobView robView) {
CatanColor playerColor = ClientModel.getUpdatableModel().getLocalPlayer().getColor();
view.startDrop(pieceType,playerColor,false);
}
@Override
public void cancelMove() {
}
@Override
public void robPlayer(RobPlayerInfo victim) {
ClientModel success = null;
int playerIndex = ClientModel.getUpdatableModel().getLocalPlayer().getPlayerIndex();
try {
success = ClientCommunicator.getClientCommunicator().robPlayer(playerIndex, victim.getPlayerIndex(), this.newRobberLocation);
if(success == null){
throw new Exception();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
@Override
public void playSoldierCard(IMapView view) {
// TODO Auto-generated method stub
}
@Override
public void playRoadBuildingCard(IMapView view) {
// TODO Auto-generated method stub
}
}
| UTF-8 | Java | 3,191 | java | RobbingState.java | Java | [] | null | [] | package client.map;
import client.data.RobPlayerInfo;
import client.model.ClientModel;
import client.model.IPlayer;
import serverProxy.ClientCommunicator;
import shared.definitions.CatanColor;
import shared.definitions.PieceType;
import shared.locations.EdgeLocation;
import shared.locations.HexLocation;
import shared.locations.VertexLocation;
import java.util.List;
public class RobbingState implements IState {
private HexLocation newRobberLocation;
@Override
public boolean canPlaceRoad(EdgeLocation edgeLoc) {
return false;
}
@Override
public boolean canPlaceSettlement(VertexLocation vertLoc) {
return false;
}
@Override
public boolean canPlaceCity(VertexLocation vertLoc) {
return false;
}
@Override
public boolean canPlaceRobber(HexLocation hexLoc) {
return ClientModel.getUpdatableModel().getCatanMap().canPlaceRobberAtLocation(hexLoc);
}
@Override
public void placeRoad(EdgeLocation edgeLoc) {
}
@Override
public void placeSettlement(VertexLocation vertLoc) {
}
@Override
public void placeCity(VertexLocation vertLoc) {
}
@Override
public void placeRobber(HexLocation hexLoc, IMapView view, IRobView robView) {
List<Integer> victims = ClientModel.getUpdatableModel().getCatanMap().getVictims(hexLoc);
List<IPlayer> players = ClientModel.getUpdatableModel().getPlayers();
RobPlayerInfo[] candidates = new RobPlayerInfo[victims.size()];
this.newRobberLocation = hexLoc;
// System.out.println("Victims length: " + victims.size());
for (int i = 0; i < victims.size(); i++) {
IPlayer player = players.get(victims.get(i));
RobPlayerInfo candidate = new RobPlayerInfo();
candidate.setNumCards(player.getResources().getTotalResourceCount());
candidate.setColor(player.getColor());
candidate.setId(player.getPlayerId());
candidate.setName(player.getName());
candidate.setPlayerIndex(player.getPlayerIndex());
candidates[i] = candidate;
}
robView.setPlayers(candidates);
robView.showModal();
}
@Override
public void startMove(PieceType pieceType, boolean isFree, boolean allowDisconnected, IMapView view, IRobView robView) {
CatanColor playerColor = ClientModel.getUpdatableModel().getLocalPlayer().getColor();
view.startDrop(pieceType,playerColor,false);
}
@Override
public void cancelMove() {
}
@Override
public void robPlayer(RobPlayerInfo victim) {
ClientModel success = null;
int playerIndex = ClientModel.getUpdatableModel().getLocalPlayer().getPlayerIndex();
try {
success = ClientCommunicator.getClientCommunicator().robPlayer(playerIndex, victim.getPlayerIndex(), this.newRobberLocation);
if(success == null){
throw new Exception();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
@Override
public void playSoldierCard(IMapView view) {
// TODO Auto-generated method stub
}
@Override
public void playRoadBuildingCard(IMapView view) {
// TODO Auto-generated method stub
}
}
| 3,191 | 0.700407 | 0.700094 | 114 | 26.991228 | 28.69088 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.859649 | false | false | 4 |
366f0bc0d855950c56ab281416d096900d3768ed | 35,880,156,832,727 | 998f16e41b4ad789526bac3d81cccbdb55fa8ae6 | /junit/src/main/java/com/junit/app/ejemplos/models/Cuenta.java | c0fe66035bcce4aaeff53abc0e53131b57d637a5 | [] | no_license | amaterasu1906/java | https://github.com/amaterasu1906/java | 119d506644ea156011396bdba637e019b096d9c5 | 5af8df5675a58d7f6f0763e12da1975e428d7a51 | refs/heads/master | 2023-07-05T07:26:22.657000 | 2021-08-14T22:06:29 | 2021-08-14T22:06:29 | 341,421,012 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.junit.app.ejemplos.models;
import java.math.BigDecimal;
import com.junit.app.ejemplos.exceptions.DineroInsuficienteException;
public class Cuenta {
private String persona;
private BigDecimal saldo;
private Banco banco;
public Cuenta(String persona, BigDecimal saldo) {
this.persona = persona;
this.saldo = saldo;
}
public String getPersona() {
return persona;
}
public void setPersona(String persona) {
this.persona = persona;
}
public void debito(BigDecimal monto) {
BigDecimal nuevo = this.saldo.subtract(monto);
if( nuevo.compareTo(BigDecimal.ZERO) < 0)
throw new DineroInsuficienteException("Dinero insuficiente");
this.saldo = nuevo;
}
public void credito(BigDecimal monto) {
this.saldo = this.saldo.add(monto);
}
public BigDecimal getSaldo() {
return saldo;
}
public void setSaldo(BigDecimal saldo) {
this.saldo = saldo;
}
@Override
public boolean equals(Object obj) {
if( obj == null || !(obj instanceof Cuenta))
return false;
Cuenta c = (Cuenta) obj;
if( this.persona == null || this.saldo == null)
return false;
return this.persona.equals(c.getPersona()) && this.saldo.equals(c.getSaldo());
}
public Banco getBanco() {
return banco;
}
public void setBanco(Banco banco) {
this.banco = banco;
}
}
| UTF-8 | Java | 1,297 | java | Cuenta.java | Java | [] | null | [] | package com.junit.app.ejemplos.models;
import java.math.BigDecimal;
import com.junit.app.ejemplos.exceptions.DineroInsuficienteException;
public class Cuenta {
private String persona;
private BigDecimal saldo;
private Banco banco;
public Cuenta(String persona, BigDecimal saldo) {
this.persona = persona;
this.saldo = saldo;
}
public String getPersona() {
return persona;
}
public void setPersona(String persona) {
this.persona = persona;
}
public void debito(BigDecimal monto) {
BigDecimal nuevo = this.saldo.subtract(monto);
if( nuevo.compareTo(BigDecimal.ZERO) < 0)
throw new DineroInsuficienteException("Dinero insuficiente");
this.saldo = nuevo;
}
public void credito(BigDecimal monto) {
this.saldo = this.saldo.add(monto);
}
public BigDecimal getSaldo() {
return saldo;
}
public void setSaldo(BigDecimal saldo) {
this.saldo = saldo;
}
@Override
public boolean equals(Object obj) {
if( obj == null || !(obj instanceof Cuenta))
return false;
Cuenta c = (Cuenta) obj;
if( this.persona == null || this.saldo == null)
return false;
return this.persona.equals(c.getPersona()) && this.saldo.equals(c.getSaldo());
}
public Banco getBanco() {
return banco;
}
public void setBanco(Banco banco) {
this.banco = banco;
}
}
| 1,297 | 0.709329 | 0.708558 | 57 | 21.754387 | 19.570189 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.719298 | false | false | 4 |
6da2985c39e10aa546888c5bc32b160fa7ca830e | 39,247,411,164,339 | 58894b3aec130c92b0cdcbab2ab59fb2c9699d07 | /varsql-core/src/main/java/com/varsql/core/auth/Authority.java | ec1a0474418c43b15fd1d44e2be5ec1581bb9fc0 | [] | no_license | varsqlinfo/varsql | https://github.com/varsqlinfo/varsql | d5cc64bbb2fb4c2e58cd4d8910592cc3533d2a1d | d77b6307249282a1e1f626fb234901ec327e7dd7 | refs/heads/master | 2023-08-31T02:00:35.911000 | 2023-08-26T03:01:14 | 2023-08-26T03:01:14 | 231,028,654 | 9 | 4 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.varsql.core.auth;
import java.util.List;
import org.springframework.security.core.GrantedAuthority;
/**
* -----------------------------------------------------------------------------
* @fileName : VarsqlAuthority.java
* @desc : varsql authority
* @author : ytkim
*-----------------------------------------------------------------------------
DATE AUTHOR DESCRIPTION
*-----------------------------------------------------------------------------
*2020. 4. 24. ytkim ์ต์ด์์ฑ
*-----------------------------------------------------------------------------
*/
public class Authority implements GrantedAuthority {
private static final long serialVersionUID = 1L;
private String name;
private int priority;
private List<Privilege> privileges;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthority() {
return this.name;
}
public List<Privilege> getPrivileges() {
return privileges;
}
public void setPrivileges(List<Privilege> privileges) {
this.privileges = privileges;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Role [name=");
builder.append(name);
builder.append(", privileges=");
builder.append(privileges);
builder.append(", priority=");
//builder.append(priority);
builder.append("]");
return builder.toString();
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
}
| UTF-8 | Java | 1,554 | java | Authority.java | Java | [
{
"context": "ority.java\n* @desc\t\t: varsql authority\n* @author\t: ytkim\n*------------------------------------------------",
"end": 281,
"score": 0.9997391700744629,
"start": 276,
"tag": "USERNAME",
"value": "ytkim"
},
{
"context": "--------------------------------\n*2020. 4. 24. \t\t\tytkim\t\t\t์ต์ด์์ฑ\n\n*----------------------------------------",
"end": 492,
"score": 0.6402150392532349,
"start": 487,
"tag": "USERNAME",
"value": "ytkim"
}
] | null | [] | package com.varsql.core.auth;
import java.util.List;
import org.springframework.security.core.GrantedAuthority;
/**
* -----------------------------------------------------------------------------
* @fileName : VarsqlAuthority.java
* @desc : varsql authority
* @author : ytkim
*-----------------------------------------------------------------------------
DATE AUTHOR DESCRIPTION
*-----------------------------------------------------------------------------
*2020. 4. 24. ytkim ์ต์ด์์ฑ
*-----------------------------------------------------------------------------
*/
public class Authority implements GrantedAuthority {
private static final long serialVersionUID = 1L;
private String name;
private int priority;
private List<Privilege> privileges;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthority() {
return this.name;
}
public List<Privilege> getPrivileges() {
return privileges;
}
public void setPrivileges(List<Privilege> privileges) {
this.privileges = privileges;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Role [name=");
builder.append(name);
builder.append(", privileges=");
builder.append(privileges);
builder.append(", priority=");
//builder.append(priority);
builder.append("]");
return builder.toString();
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
}
| 1,554 | 0.564683 | 0.559508 | 67 | 22.074627 | 21.497181 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.41791 | false | false | 4 |
15be7c7f57ed01add78674a631805e5b8d400e5b | 738,734,422,527 | 5a413dbb40ee22b493e75d320bd53c841b409c75 | /app/src/main/java/com/cqupt/master_helper/dao/UserCommentDao.java | 38bef22d98939e1a10c3d37079b372f1fb57a339 | [
"Apache-2.0"
] | permissive | FurutariRin/MasterHelperAPP | https://github.com/FurutariRin/MasterHelperAPP | 382d57586160dd9c2d17e044802d2b62e3bcb763 | 70a807b33b2a19d3a30926e7b287e7b021f37657 | refs/heads/master | 2023-07-04T18:18:46.899000 | 2021-08-24T03:24:09 | 2021-08-24T03:24:09 | 399,296,536 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cqupt.master_helper.dao;
import com.cqupt.master_helper.entity.UserComment;
public class UserCommentDao {
/**
* ๅๅธ่ฏ่ฎบ
* @param uid ่ดฆๅท
* @param vid ่ง้ขๅท
* @param content ่ฏ่ฎบๅ
ๅฎน
* @return Code 0 ่ฏ่ฎบๆๅ<br>Code 1 ่ฏ่ฎบๅคฑ่ดฅ
*/
public int commentServer(String uid,String vid,String content){
UserComment userComment = new UserComment();
int retCode = 1;
String comment_id = null;
//่ทๅๆๅคง่ฏ่ฎบๅท๏ผๅนถ่ตๅผ
// int successAddCommentId = userComment.addCommentId(vid,comment_id);
// int successAddCommentAuthor = userComment.addCommentAuthor(vid,comment_id,uid);
// int successAddCommentContent = userComment.addCommentContent(vid,comment_id,content);
// int successAddCommentVisible = userComment.addCommentVisible(vid,comment_id);
// if(successAddCommentId != 0
// && successAddCommentAuthor != 0
// && successAddCommentContent != 0
// && successAddCommentVisible != 0){
// retCode = 1;
// }else{
// retCode = 0;
// }
return retCode;
}
}
| UTF-8 | Java | 1,191 | java | UserCommentDao.java | Java | [
{
"context": "mentDao {\n\n\n /**\n * ๅๅธ่ฏ่ฎบ\n * @param uid ่ดฆๅท\n * @param vid ่ง้ขๅท\n * @param content ่ฏ่ฎบๅ
ๅฎน\n",
"end": 162,
"score": 0.9896702766418457,
"start": 160,
"tag": "USERNAME",
"value": "่ดฆๅท"
}
] | null | [] | package com.cqupt.master_helper.dao;
import com.cqupt.master_helper.entity.UserComment;
public class UserCommentDao {
/**
* ๅๅธ่ฏ่ฎบ
* @param uid ่ดฆๅท
* @param vid ่ง้ขๅท
* @param content ่ฏ่ฎบๅ
ๅฎน
* @return Code 0 ่ฏ่ฎบๆๅ<br>Code 1 ่ฏ่ฎบๅคฑ่ดฅ
*/
public int commentServer(String uid,String vid,String content){
UserComment userComment = new UserComment();
int retCode = 1;
String comment_id = null;
//่ทๅๆๅคง่ฏ่ฎบๅท๏ผๅนถ่ตๅผ
// int successAddCommentId = userComment.addCommentId(vid,comment_id);
// int successAddCommentAuthor = userComment.addCommentAuthor(vid,comment_id,uid);
// int successAddCommentContent = userComment.addCommentContent(vid,comment_id,content);
// int successAddCommentVisible = userComment.addCommentVisible(vid,comment_id);
// if(successAddCommentId != 0
// && successAddCommentAuthor != 0
// && successAddCommentContent != 0
// && successAddCommentVisible != 0){
// retCode = 1;
// }else{
// retCode = 0;
// }
return retCode;
}
}
| 1,191 | 0.611358 | 0.603372 | 38 | 28.657894 | 27.070353 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.526316 | false | false | 4 |
e3ca2b2e2f05bcffffded9def3e8cb90538db039 | 10,685,878,693,484 | dd4c01b7835a5dc7091a87814d7805e491261199 | /julie/src/main/java/ardom/julie/ui/activities/edit/old_code/MaterialsEditActivity.java | f1244de01b5478ff423684f846b55a2abd8b8984 | [
"Apache-2.0"
] | permissive | tsadoklf/Ardom | https://github.com/tsadoklf/Ardom | 7fed4af9a4aac4b1b59a7872203220a349cb85c6 | ab0d87426f6e0607a26a19b25fe71470cde7ebec | refs/heads/master | 2017-10-07T18:26:12.037000 | 2017-05-24T10:05:03 | 2017-05-24T10:05:03 | 81,420,815 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ardom.julie.ui.activities.edit.old_code;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.StringRes;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import ardom.common.data.models.base.ReadOnlyObjectBase;
import ardom.common.data.models.business.Material;
import ardom.common.data.models.business.Plot;
import ardom.common.utils.DateTimeUtils;
import ardom.julie.R;
import ardom.julie.data.DataService;
import ardom.julie.ui.activities.base.EditActivityBase;
import ardom.common.ui.dialogs.DialogManager;
import ardom.julie.ui.recycler_view.list_items.editableListItem.EditableListItem;
import ardom.julie.ui.recycler_view.list_items.editableListItem.EditableRecyclerViewAdapter;
import ardom.julie.ui.recycler_view.view_models.plot_day_info.base.PlotViewModelBase;
public class MaterialsEditActivity extends EditActivityBase {
//
// startActivity
//
public static void startActivity(Context context, String dayString){
Intent intent = new Intent(context, MaterialsEditActivity.class);
intent.putExtra(EXTRA_DAY, dayString);
context.startActivity(intent);
}
private EditText mMaterialQuantity_EditText;
private Button mPickDateButton;
private TextView mDateTextView;
private Spinner mPlotSpinner;
private Spinner mMaterialSpinner;
private RecyclerView mRecyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_material);
mDateTextView = (TextView) findViewById(R.id.date_textView);
mMaterialQuantity_EditText = (EditText) findViewById(R.id.quantity_editText);
mMaterialQuantity_EditText = (EditText) findViewById(R.id.quantity_editText);
mPlotSpinner = (Spinner) findViewById(R.id.plot_spinner);
mMaterialSpinner = (Spinner) findViewById(R.id.material_spinner);
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
// mPlotViewModel = IntentHelper.getObjectFromCache(PlotMaterialsViewModel.class);
// if (mPlotViewModel == null){
// mPlotViewModel = new PlotMaterialsViewModel("", "");
// }
// setLabel(R.id.date_label_textView, R.string.date);
// setLabel(R.id.material_label_textView, R.string.label_material);
// setLabel(R.id.plot_label_textView, R.string.label_plot);
Intent intent = getIntent();
mDayString = intent.getStringExtra(EXTRA_DAY);
Date date = DateTimeUtils.convertDayToDate(mDayString);
//setTitle(getString(R.string.tab_materials) + " - " + DateTimeUtils.convertDayFormat(mDayString));
setTitle(getString(R.string.tab_materials));
// Use the current date
final Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
updateDate(calendar);
initPlotSpinner();
//initMaterialSpinner();
//initMaterialRecyclerView();
// findViewById(R.id.save_button).setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// saveData();
// }
// });
mPickDateButton = (Button) findViewById(R.id.pick_date_button);
mPickDateButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DialogManager.getInstanceFor(MaterialsEditActivity.this)
.showDatePickerDialog(myDateListener);
}
});
}
private void setLabel(@IdRes int resId, @StringRes int textResId){
TextView labelTextView;
labelTextView = (TextView) findViewById(resId);
labelTextView.setText(getString(textResId));
}
@Override
protected void saveData() {
String day = mDayString;
String plot = ((ReadOnlyObjectBase) mPlotSpinner.getSelectedItem()).getCode();
//String material = ((ReadOnlyObjectBase) mMaterialSpinner.getSelectedItem()).getCode();
//String quantity = mMaterialQuantity_EditText.getText().toString();
for (EditableListItem listItem : mListItems){
String material = listItem.getViewModel().getKey();
String quantity = listItem.getViewModel().getValue();
if (isValid(quantity)){
DataService.getInstance().putPlotMaterialsForDay(day, plot, material, quantity);
}
}
finish();
// } else {
// TextInputLayout textInputLayout = (TextInputLayout) findViewById(R.id.quantity_textInput);
//
// textInputLayout.setErrorEnabled(true);
// textInputLayout.setError("Quantity value invalid");
// }
}
@Override
protected void updateDate(Calendar calendar){
SimpleDateFormat dateFormat;
dateFormat = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault());
mDateTextView.setText(dateFormat.format(calendar.getTime()));
dateFormat = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());
mDayString = dateFormat.format(calendar.getTime());
}
private void initPlotSpinner(){
List<ReadOnlyObjectBase> items = new ArrayList<>();
for(Plot item: DataService.getInstance().getPlotList()){
items.add(item);
}
initSpinner(mPlotSpinner, items);
}
private void initMaterialSpinner(){
List<ReadOnlyObjectBase> items = new ArrayList<>();
for(Material item: DataService.getInstance().getMaterialList()){
items.add(item);
}
initSpinner(mMaterialSpinner, items);
}
// private void initMaterialRecyclerView(){
//
// // details = work, vehicels, materials or water
// Map<String, String> details = mPlotViewModel.getResourceItems();
//
// for(Material item: DataServiceBase.getInstance().getMaterialList()){
// String quantity = "";
// if (details.containsKey(item.getCode())){
// quantity = details.get(item.getCode());
// }
// EditableItemViewModel viewModel = new EditableItemViewModel(item, quantity);
//
// mListItems.add(new EditableListItem(viewModel));
// }
// //initSpinner(mMaterialSpinner, mListItems);
// initRecyclerView(mListItems);
// }
protected PlotViewModelBase mPlotViewModel;
protected List<EditableListItem> mListItems = new ArrayList<>();
protected EditableRecyclerViewAdapter mAdapter;
//
// initRecyclerView
//
public void initRecyclerView(List<EditableListItem> list){
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(layoutManager);
//mAdapter = new EditableRecyclerViewAdapter(new ArrayList<EditableListItem>());
mAdapter = new EditableRecyclerViewAdapter(list);
mRecyclerView.setAdapter(mAdapter);
}
}
| UTF-8 | Java | 7,560 | java | MaterialsEditActivity.java | Java | [] | null | [] | package ardom.julie.ui.activities.edit.old_code;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.StringRes;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import ardom.common.data.models.base.ReadOnlyObjectBase;
import ardom.common.data.models.business.Material;
import ardom.common.data.models.business.Plot;
import ardom.common.utils.DateTimeUtils;
import ardom.julie.R;
import ardom.julie.data.DataService;
import ardom.julie.ui.activities.base.EditActivityBase;
import ardom.common.ui.dialogs.DialogManager;
import ardom.julie.ui.recycler_view.list_items.editableListItem.EditableListItem;
import ardom.julie.ui.recycler_view.list_items.editableListItem.EditableRecyclerViewAdapter;
import ardom.julie.ui.recycler_view.view_models.plot_day_info.base.PlotViewModelBase;
public class MaterialsEditActivity extends EditActivityBase {
//
// startActivity
//
public static void startActivity(Context context, String dayString){
Intent intent = new Intent(context, MaterialsEditActivity.class);
intent.putExtra(EXTRA_DAY, dayString);
context.startActivity(intent);
}
private EditText mMaterialQuantity_EditText;
private Button mPickDateButton;
private TextView mDateTextView;
private Spinner mPlotSpinner;
private Spinner mMaterialSpinner;
private RecyclerView mRecyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_material);
mDateTextView = (TextView) findViewById(R.id.date_textView);
mMaterialQuantity_EditText = (EditText) findViewById(R.id.quantity_editText);
mMaterialQuantity_EditText = (EditText) findViewById(R.id.quantity_editText);
mPlotSpinner = (Spinner) findViewById(R.id.plot_spinner);
mMaterialSpinner = (Spinner) findViewById(R.id.material_spinner);
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
// mPlotViewModel = IntentHelper.getObjectFromCache(PlotMaterialsViewModel.class);
// if (mPlotViewModel == null){
// mPlotViewModel = new PlotMaterialsViewModel("", "");
// }
// setLabel(R.id.date_label_textView, R.string.date);
// setLabel(R.id.material_label_textView, R.string.label_material);
// setLabel(R.id.plot_label_textView, R.string.label_plot);
Intent intent = getIntent();
mDayString = intent.getStringExtra(EXTRA_DAY);
Date date = DateTimeUtils.convertDayToDate(mDayString);
//setTitle(getString(R.string.tab_materials) + " - " + DateTimeUtils.convertDayFormat(mDayString));
setTitle(getString(R.string.tab_materials));
// Use the current date
final Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
updateDate(calendar);
initPlotSpinner();
//initMaterialSpinner();
//initMaterialRecyclerView();
// findViewById(R.id.save_button).setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// saveData();
// }
// });
mPickDateButton = (Button) findViewById(R.id.pick_date_button);
mPickDateButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DialogManager.getInstanceFor(MaterialsEditActivity.this)
.showDatePickerDialog(myDateListener);
}
});
}
private void setLabel(@IdRes int resId, @StringRes int textResId){
TextView labelTextView;
labelTextView = (TextView) findViewById(resId);
labelTextView.setText(getString(textResId));
}
@Override
protected void saveData() {
String day = mDayString;
String plot = ((ReadOnlyObjectBase) mPlotSpinner.getSelectedItem()).getCode();
//String material = ((ReadOnlyObjectBase) mMaterialSpinner.getSelectedItem()).getCode();
//String quantity = mMaterialQuantity_EditText.getText().toString();
for (EditableListItem listItem : mListItems){
String material = listItem.getViewModel().getKey();
String quantity = listItem.getViewModel().getValue();
if (isValid(quantity)){
DataService.getInstance().putPlotMaterialsForDay(day, plot, material, quantity);
}
}
finish();
// } else {
// TextInputLayout textInputLayout = (TextInputLayout) findViewById(R.id.quantity_textInput);
//
// textInputLayout.setErrorEnabled(true);
// textInputLayout.setError("Quantity value invalid");
// }
}
@Override
protected void updateDate(Calendar calendar){
SimpleDateFormat dateFormat;
dateFormat = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault());
mDateTextView.setText(dateFormat.format(calendar.getTime()));
dateFormat = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());
mDayString = dateFormat.format(calendar.getTime());
}
private void initPlotSpinner(){
List<ReadOnlyObjectBase> items = new ArrayList<>();
for(Plot item: DataService.getInstance().getPlotList()){
items.add(item);
}
initSpinner(mPlotSpinner, items);
}
private void initMaterialSpinner(){
List<ReadOnlyObjectBase> items = new ArrayList<>();
for(Material item: DataService.getInstance().getMaterialList()){
items.add(item);
}
initSpinner(mMaterialSpinner, items);
}
// private void initMaterialRecyclerView(){
//
// // details = work, vehicels, materials or water
// Map<String, String> details = mPlotViewModel.getResourceItems();
//
// for(Material item: DataServiceBase.getInstance().getMaterialList()){
// String quantity = "";
// if (details.containsKey(item.getCode())){
// quantity = details.get(item.getCode());
// }
// EditableItemViewModel viewModel = new EditableItemViewModel(item, quantity);
//
// mListItems.add(new EditableListItem(viewModel));
// }
// //initSpinner(mMaterialSpinner, mListItems);
// initRecyclerView(mListItems);
// }
protected PlotViewModelBase mPlotViewModel;
protected List<EditableListItem> mListItems = new ArrayList<>();
protected EditableRecyclerViewAdapter mAdapter;
//
// initRecyclerView
//
public void initRecyclerView(List<EditableListItem> list){
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(layoutManager);
//mAdapter = new EditableRecyclerViewAdapter(new ArrayList<EditableListItem>());
mAdapter = new EditableRecyclerViewAdapter(list);
mRecyclerView.setAdapter(mAdapter);
}
}
| 7,560 | 0.680291 | 0.680026 | 219 | 33.52055 | 28.929031 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.589041 | false | false | 4 |
9a91682ac3cdf3ba983c92d65772f7293d933f8c | 31,988,916,470,700 | 1b4d2273d6ec8afa84b0ed1675a39bcd983c96a0 | /src/main/java/com/modbus/modbus4jimpl/TCP/masterAndSlave/master/locator/Modbus4jReadUtils.java | af37f3ef1707ac8a841b5445f60b4cf75390c74c | [] | no_license | laxiangxiang/modbus-mobus4j-impl | https://github.com/laxiangxiang/modbus-mobus4j-impl | f536d004e6e59a60fcce079160f3f162f175978f | 38b6d0cb8ebf965fa189f6ec3b6f4300e6735d72 | refs/heads/master | 2022-12-22T12:45:40.060000 | 2019-12-24T03:15:09 | 2019-12-24T03:15:09 | 229,197,360 | 0 | 0 | null | false | 2022-12-14T20:39:56 | 2019-12-20T05:37:52 | 2019-12-24T03:15:18 | 2022-12-14T20:39:53 | 78 | 0 | 0 | 1 | Java | false | false | package com.modbus.modbus4jimpl.TCP.masterAndSlave.master.locator;
import com.modbus.modbus4jimpl.TCP.masterAndSlave.master.TcpMaster;
import com.serotonin.modbus4j.BatchRead;
import com.serotonin.modbus4j.BatchResults;
import com.serotonin.modbus4j.ModbusMaster;
import com.serotonin.modbus4j.code.DataType;
import com.serotonin.modbus4j.exception.ErrorResponseException;
import com.serotonin.modbus4j.exception.ModbusInitException;
import com.serotonin.modbus4j.exception.ModbusTransportException;
import com.serotonin.modbus4j.locator.BaseLocator;
/**
* modbus่ฏปๅๅทฅๅ
ท็ฑป๏ผ้็จmodbus4jๅฎ็ฐ
*/
public class Modbus4jReadUtils {
//่ทๅmaster
private static ModbusMaster master = TcpMaster.getMaster();
/**
* ่ฏปๅ[01 Coil Status 0x]็ฑปๅ ๅผๅ
ณๆฐๆฎ
* @param slaveId
* @param offset
* @return
*/
public static boolean readCoilStatus(int slaveId,int offset) throws ModbusTransportException, ErrorResponseException {
BaseLocator<Boolean> baseLocator = BaseLocator.coilStatus(slaveId,offset);
boolean value = master.getValue(baseLocator);
return value;
}
/**
* ่ฏปๅ[02 Input Status 1x]็ฑปๅ ๅผๅ
ณๆฐๆฎ
* @param slaveId
* @param offset
* @return
* @throws ModbusInitException
* @throws ModbusTransportException
* @throws ErrorResponseException
*/
public static boolean readInputStatus(int slaveId,int offset) throws ModbusTransportException, ErrorResponseException {
BaseLocator<Boolean> baseLocator = BaseLocator.inputStatus(slaveId,offset);
boolean value = master.getValue(baseLocator);
return value;
}
/**
* ่ฏปๅ[03 Holding Register็ฑปๅ 2x]ๆจกๆ้ๆฐๆฎ
* @param slaveId
* @param offset
* @param dataType ๆฐๆฎ็ฑปๅ,ๆฅ่ชcom.serotonin.modbus4j.code.DataType
* @return
*/
public static Number readHoldingRegister(int slaveId,int offset,int dataType) throws ModbusTransportException, ErrorResponseException {
BaseLocator<Number> baseLocator = BaseLocator.holdingRegister(slaveId,offset,dataType);
Number value = master.getValue(baseLocator);
return value;
}
/**
* ่ฏปๅ[04 Input Registers 3x]็ฑปๅ ๆจกๆ้ๆฐๆฎ
* @param slaveId
* @param offset
* @param dataType
* @return
* @throws ModbusInitException
* @throws ModbusTransportException
* @throws ErrorResponseException
*/
public static Number readInputRegister(int slaveId,int offset,int dataType) throws ModbusTransportException, ErrorResponseException {
BaseLocator<Number> baseLocator = BaseLocator.inputRegister(slaveId,offset,dataType);
Number value = master.getValue(baseLocator);
return value;
}
/**
* ๆน้่ฏปๅไฝฟ็จๆนๆณ
* @throws ModbusInitException
* @throws ModbusTransportException
* @throws ErrorResponseException
*/
public static void batchRead() throws ModbusTransportException, ErrorResponseException {
BatchRead<Integer> batchRead = new BatchRead<>();
batchRead.addLocator(0,BaseLocator.holdingRegister(1,1, DataType.FOUR_BYTE_FLOAT));
batchRead.addLocator(1,BaseLocator.inputStatus(1,0));
batchRead.setContiguousRequests(false);
BatchResults<Integer> results = master.send(batchRead);
System.out.println(results.getValue(0));
System.out.println(results.getValue(1));
}
/**
* ๆต่ฏ
*
* @param args
*/
public static void main(String[] args) {
try {
// 01ๆต่ฏ
Boolean v011 = readCoilStatus(1, 0);
Boolean v012 = readCoilStatus(1, 1);
Boolean v013 = readCoilStatus(1, 6);
System.out.println("v011:" + v011);
System.out.println("v012:" + v012);
System.out.println("v013:" + v013);
// 02ๆต่ฏ
Boolean v021 = readInputStatus(2, 0);
Boolean v022 = readInputStatus(2, 1);
Boolean v023 = readInputStatus(2, 2);
System.out.println("v021:" + v021);
System.out.println("v022:" + v022);
System.out.println("v023:" + v023);
// 03ๆต่ฏ
Number v031 = readHoldingRegister(3, 1, DataType.FOUR_BYTE_FLOAT);// ๆณจๆ,float
Number v032 = readHoldingRegister(3, 3, DataType.FOUR_BYTE_FLOAT);// ๅไธ
System.out.println("v031:" + v031);
System.out.println("v032:" + v032);
// 04ๆต่ฏ
Number v041 = readInputRegister(4, 0, DataType.FOUR_BYTE_FLOAT);
Number v042 = readInputRegister(4, 2, DataType.FOUR_BYTE_FLOAT);
System.out.println("v041:" + v041);
System.out.println("v042:" + v042);
// ๆน้่ฏปๅ
batchRead();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 4,932 | java | Modbus4jReadUtils.java | Java | [] | null | [] | package com.modbus.modbus4jimpl.TCP.masterAndSlave.master.locator;
import com.modbus.modbus4jimpl.TCP.masterAndSlave.master.TcpMaster;
import com.serotonin.modbus4j.BatchRead;
import com.serotonin.modbus4j.BatchResults;
import com.serotonin.modbus4j.ModbusMaster;
import com.serotonin.modbus4j.code.DataType;
import com.serotonin.modbus4j.exception.ErrorResponseException;
import com.serotonin.modbus4j.exception.ModbusInitException;
import com.serotonin.modbus4j.exception.ModbusTransportException;
import com.serotonin.modbus4j.locator.BaseLocator;
/**
* modbus่ฏปๅๅทฅๅ
ท็ฑป๏ผ้็จmodbus4jๅฎ็ฐ
*/
public class Modbus4jReadUtils {
//่ทๅmaster
private static ModbusMaster master = TcpMaster.getMaster();
/**
* ่ฏปๅ[01 Coil Status 0x]็ฑปๅ ๅผๅ
ณๆฐๆฎ
* @param slaveId
* @param offset
* @return
*/
public static boolean readCoilStatus(int slaveId,int offset) throws ModbusTransportException, ErrorResponseException {
BaseLocator<Boolean> baseLocator = BaseLocator.coilStatus(slaveId,offset);
boolean value = master.getValue(baseLocator);
return value;
}
/**
* ่ฏปๅ[02 Input Status 1x]็ฑปๅ ๅผๅ
ณๆฐๆฎ
* @param slaveId
* @param offset
* @return
* @throws ModbusInitException
* @throws ModbusTransportException
* @throws ErrorResponseException
*/
public static boolean readInputStatus(int slaveId,int offset) throws ModbusTransportException, ErrorResponseException {
BaseLocator<Boolean> baseLocator = BaseLocator.inputStatus(slaveId,offset);
boolean value = master.getValue(baseLocator);
return value;
}
/**
* ่ฏปๅ[03 Holding Register็ฑปๅ 2x]ๆจกๆ้ๆฐๆฎ
* @param slaveId
* @param offset
* @param dataType ๆฐๆฎ็ฑปๅ,ๆฅ่ชcom.serotonin.modbus4j.code.DataType
* @return
*/
public static Number readHoldingRegister(int slaveId,int offset,int dataType) throws ModbusTransportException, ErrorResponseException {
BaseLocator<Number> baseLocator = BaseLocator.holdingRegister(slaveId,offset,dataType);
Number value = master.getValue(baseLocator);
return value;
}
/**
* ่ฏปๅ[04 Input Registers 3x]็ฑปๅ ๆจกๆ้ๆฐๆฎ
* @param slaveId
* @param offset
* @param dataType
* @return
* @throws ModbusInitException
* @throws ModbusTransportException
* @throws ErrorResponseException
*/
public static Number readInputRegister(int slaveId,int offset,int dataType) throws ModbusTransportException, ErrorResponseException {
BaseLocator<Number> baseLocator = BaseLocator.inputRegister(slaveId,offset,dataType);
Number value = master.getValue(baseLocator);
return value;
}
/**
* ๆน้่ฏปๅไฝฟ็จๆนๆณ
* @throws ModbusInitException
* @throws ModbusTransportException
* @throws ErrorResponseException
*/
public static void batchRead() throws ModbusTransportException, ErrorResponseException {
BatchRead<Integer> batchRead = new BatchRead<>();
batchRead.addLocator(0,BaseLocator.holdingRegister(1,1, DataType.FOUR_BYTE_FLOAT));
batchRead.addLocator(1,BaseLocator.inputStatus(1,0));
batchRead.setContiguousRequests(false);
BatchResults<Integer> results = master.send(batchRead);
System.out.println(results.getValue(0));
System.out.println(results.getValue(1));
}
/**
* ๆต่ฏ
*
* @param args
*/
public static void main(String[] args) {
try {
// 01ๆต่ฏ
Boolean v011 = readCoilStatus(1, 0);
Boolean v012 = readCoilStatus(1, 1);
Boolean v013 = readCoilStatus(1, 6);
System.out.println("v011:" + v011);
System.out.println("v012:" + v012);
System.out.println("v013:" + v013);
// 02ๆต่ฏ
Boolean v021 = readInputStatus(2, 0);
Boolean v022 = readInputStatus(2, 1);
Boolean v023 = readInputStatus(2, 2);
System.out.println("v021:" + v021);
System.out.println("v022:" + v022);
System.out.println("v023:" + v023);
// 03ๆต่ฏ
Number v031 = readHoldingRegister(3, 1, DataType.FOUR_BYTE_FLOAT);// ๆณจๆ,float
Number v032 = readHoldingRegister(3, 3, DataType.FOUR_BYTE_FLOAT);// ๅไธ
System.out.println("v031:" + v031);
System.out.println("v032:" + v032);
// 04ๆต่ฏ
Number v041 = readInputRegister(4, 0, DataType.FOUR_BYTE_FLOAT);
Number v042 = readInputRegister(4, 2, DataType.FOUR_BYTE_FLOAT);
System.out.println("v041:" + v041);
System.out.println("v042:" + v042);
// ๆน้่ฏปๅ
batchRead();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| 4,932 | 0.654941 | 0.623325 | 133 | 34.909775 | 29.820883 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.676692 | false | false | 4 |
2b1e9b742ef2614630da3681d2867f5b320a39f9 | 20,529,943,722,736 | b297b8b7355d05b93c8bc50b48d95ae769fd51fd | /app/src/main/java/com/ttrm/ttconnection/fragment/BaseFragment.java | 78b61cd412c1d4327047abd9b07a83a0de49b3c8 | [] | no_license | marufei/TTConnection | https://github.com/marufei/TTConnection | 6bf4f37606c4c969fb48190cf6ced9a0dfaf7079 | 1517372cc0ba189b587ee4e64738dbe2d345e859 | refs/heads/master | 2020-03-16T13:43:08.283000 | 2018-07-16T01:18:41 | 2018-07-16T01:18:41 | 132,697,754 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ttrm.ttconnection.fragment;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.support.v4.app.Fragment;
/**
* Created by Administrator on 2016-08-15.
*/
public abstract class BaseFragment extends Fragment {
/**
* Fragmentๅฝๅ็ถๆๆฏๅฆๅฏ่ง
*/
protected boolean isVisible;
public String TAG = "BaseFragment";
//setUserVisibleHint adapterไธญ็ๆฏไธชfragmentๅๆข็ๆถๅ้ฝไผ่ขซ่ฐ็จ๏ผๅฆๆๆฏๅๆขๅฐๅฝๅ้กต๏ผ้ฃไนisVisibleToUser==true๏ผๅฆๅไธบfalse
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
isVisible = true;
onVisible();
} else {
isVisible = false;
onInvisible();
}
}
@Override
public void onHiddenChanged(boolean hidden) {
if (!hidden) {
show();
} else {
hidden();
}
super.onHiddenChanged(hidden);
}
protected void show() {
}
protected void hidden() {
}
/**
* ๅฏ่ง
*/
protected void onVisible() {
lazyLoad();
}
/**
* ไธๅฏ่ง
*/
protected void onInvisible() {
}
/**
* ๅปถ่ฟๅ ่ฝฝ
* ๅญ็ฑปๅฟ
้กป้ๅๆญคๆนๆณ
*/
protected abstract void lazyLoad();
@Override
public void onResume() {
super.onResume();
}
public void onPause() {
super.onPause();
}
/**
* ๅซๆๆ ้ขใๅ
ๅฎนใไธคไธชๆ้ฎ็ๅฏน่ฏๆก
**/
public void showAlertDialog(String title, String message,
String positiveText,
DialogInterface.OnClickListener onClickListener,
String negativeText,
DialogInterface.OnClickListener onClickListener2) {
new AlertDialog.Builder(getActivity()).setTitle(title).setMessage(message)
.setPositiveButton(positiveText, onClickListener)
.setNegativeButton(negativeText, onClickListener2).setCancelable(false)
.show();
}
/**
* ๅซๆไธไธชๆ ้ขใๅ
ๅฎนใไธไธชๆ้ฎ็ๅฏน่ฏๆก
**/
public void showAlertDialog2(String title, String message,
String positiveText,
DialogInterface.OnClickListener onClickListener) {
new AlertDialog.Builder(getActivity()).setTitle(title).setMessage(message)
.setPositiveButton(positiveText, onClickListener).setCancelable(false)
.show();
}
}
| UTF-8 | Java | 2,705 | java | BaseFragment.java | Java | [
{
"context": "ndroid.support.v4.app.Fragment;\n\n/**\n * Created by Administrator on 2016-08-15.\n */\npublic abstract class BaseFrag",
"end": 185,
"score": 0.5017517805099487,
"start": 172,
"tag": "NAME",
"value": "Administrator"
}
] | null | [] | package com.ttrm.ttconnection.fragment;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.support.v4.app.Fragment;
/**
* Created by Administrator on 2016-08-15.
*/
public abstract class BaseFragment extends Fragment {
/**
* Fragmentๅฝๅ็ถๆๆฏๅฆๅฏ่ง
*/
protected boolean isVisible;
public String TAG = "BaseFragment";
//setUserVisibleHint adapterไธญ็ๆฏไธชfragmentๅๆข็ๆถๅ้ฝไผ่ขซ่ฐ็จ๏ผๅฆๆๆฏๅๆขๅฐๅฝๅ้กต๏ผ้ฃไนisVisibleToUser==true๏ผๅฆๅไธบfalse
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
isVisible = true;
onVisible();
} else {
isVisible = false;
onInvisible();
}
}
@Override
public void onHiddenChanged(boolean hidden) {
if (!hidden) {
show();
} else {
hidden();
}
super.onHiddenChanged(hidden);
}
protected void show() {
}
protected void hidden() {
}
/**
* ๅฏ่ง
*/
protected void onVisible() {
lazyLoad();
}
/**
* ไธๅฏ่ง
*/
protected void onInvisible() {
}
/**
* ๅปถ่ฟๅ ่ฝฝ
* ๅญ็ฑปๅฟ
้กป้ๅๆญคๆนๆณ
*/
protected abstract void lazyLoad();
@Override
public void onResume() {
super.onResume();
}
public void onPause() {
super.onPause();
}
/**
* ๅซๆๆ ้ขใๅ
ๅฎนใไธคไธชๆ้ฎ็ๅฏน่ฏๆก
**/
public void showAlertDialog(String title, String message,
String positiveText,
DialogInterface.OnClickListener onClickListener,
String negativeText,
DialogInterface.OnClickListener onClickListener2) {
new AlertDialog.Builder(getActivity()).setTitle(title).setMessage(message)
.setPositiveButton(positiveText, onClickListener)
.setNegativeButton(negativeText, onClickListener2).setCancelable(false)
.show();
}
/**
* ๅซๆไธไธชๆ ้ขใๅ
ๅฎนใไธไธชๆ้ฎ็ๅฏน่ฏๆก
**/
public void showAlertDialog2(String title, String message,
String positiveText,
DialogInterface.OnClickListener onClickListener) {
new AlertDialog.Builder(getActivity()).setTitle(title).setMessage(message)
.setPositiveButton(positiveText, onClickListener).setCancelable(false)
.show();
}
}
| 2,705 | 0.571938 | 0.567182 | 103 | 23.495146 | 24.738977 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.300971 | false | false | 4 |
d4c6242010c83897b8270c54310d5c4ead5dda6c | 11,785,390,297,240 | f0a1b1491c425c474c26d1cbffa3d46f27fb5ab8 | /src/main/java/com/oracleoaec/entity/DiningCar.java | 7b5e6ba5a6b0221fb2e554c75e7693e5b72dddb5 | [] | no_license | chenna123456/food | https://github.com/chenna123456/food | fa5b9a39b1b809a33db4a663708f904368550bb2 | 2b4a493c745c0882af0b2e7f140cc9ef70be9ddc | refs/heads/master | 2021-07-18T11:28:30.179000 | 2017-10-27T01:36:24 | 2017-10-27T01:36:24 | 107,923,762 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.oracleoaec.entity;
import java.math.BigDecimal;
/**
* ้ค่ฝฆๅฎไฝ็ฑป
* @author ้ๅจ
*
*/
public class DiningCar {
private Integer id;
private Integer vipid;
private String foodName;
private BigDecimal price;
private Integer number;
private BigDecimal subtotal;// ๅฏนๅบ้ฃ็ฉ็price*number
public DiningCar() {
}
public DiningCar(Integer id, Integer vipid, String foodName, BigDecimal price, Integer number, BigDecimal subtotal) {
super();
this.id = id;
this.vipid = vipid;
this.foodName = foodName;
this.price = price;
this.number = number;
this.subtotal = subtotal;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getVipid() {
return vipid;
}
public void setVipid(Integer vipid) {
this.vipid = vipid;
}
public String getFoodName() {
return foodName;
}
public void setFoodName(String foodName) {
this.foodName = foodName;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public BigDecimal getSubtotal() {
return subtotal;
}
public void setSubtotal(BigDecimal subtotal) {
this.subtotal = subtotal;
}
public String toString() {
return "DiningCar [id=" + id + ", vipid=" + vipid + ", foodName=" + foodName + ", price=" + price + ", number="
+ number + ", subtotal=" + subtotal + "]";
}
}
| UTF-8 | Java | 1,616 | java | DiningCar.java | Java | [
{
"context": "ava.math.BigDecimal;\r\n\r\n/**\r\n * ้ค่ฝฆๅฎไฝ็ฑป\r\n * @author ้ๅจ\r\n *\r\n */\r\npublic class DiningCar {\r\n\tprivate Inte",
"end": 94,
"score": 0.997054398059845,
"start": 92,
"tag": "NAME",
"value": "้ๅจ"
}
] | null | [] | package com.oracleoaec.entity;
import java.math.BigDecimal;
/**
* ้ค่ฝฆๅฎไฝ็ฑป
* @author ้ๅจ
*
*/
public class DiningCar {
private Integer id;
private Integer vipid;
private String foodName;
private BigDecimal price;
private Integer number;
private BigDecimal subtotal;// ๅฏนๅบ้ฃ็ฉ็price*number
public DiningCar() {
}
public DiningCar(Integer id, Integer vipid, String foodName, BigDecimal price, Integer number, BigDecimal subtotal) {
super();
this.id = id;
this.vipid = vipid;
this.foodName = foodName;
this.price = price;
this.number = number;
this.subtotal = subtotal;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getVipid() {
return vipid;
}
public void setVipid(Integer vipid) {
this.vipid = vipid;
}
public String getFoodName() {
return foodName;
}
public void setFoodName(String foodName) {
this.foodName = foodName;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public BigDecimal getSubtotal() {
return subtotal;
}
public void setSubtotal(BigDecimal subtotal) {
this.subtotal = subtotal;
}
public String toString() {
return "DiningCar [id=" + id + ", vipid=" + vipid + ", foodName=" + foodName + ", price=" + price + ", number="
+ number + ", subtotal=" + subtotal + "]";
}
}
| 1,616 | 0.642588 | 0.642588 | 84 | 16.952381 | 20.84004 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.404762 | false | false | 9 |
8eefb59af26c8bcd63af7812464b40106e91445b | 25,778,393,763,657 | 1ac64fbbabf79081226e5fd3b530ef8b92c19961 | /src/main/java/com/byoskill/spring/cqrs/api/EventThrower.java | 838f344364c85b6123d3e8170a08cff22f189f61 | [
"Apache-2.0"
] | permissive | Sokoobo/spring-cqrs-arch | https://github.com/Sokoobo/spring-cqrs-arch | 865a10b87a6202ae28321ce383ff3b2ca98f4c8b | 275c4f1451179ed3ad94a1cb344a3654ad8962e8 | refs/heads/master | 2020-04-25T07:38:25.207000 | 2018-10-07T14:25:09 | 2018-10-07T14:25:09 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) 2017 Sylvain Leroy - BYOSkill Company All Rights Reserved
* You may use, distribute and modify this code under the
* terms of the MIT license, which unfortunately won't be
* written for another century.
*
* You should have received a copy of the MIT license with
* this file. If not, please write to: sleroy at byoskill.com, or visit : www.byoskill.com
*
*/
package com.byoskill.spring.cqrs.api;
public interface EventThrower<C> {
/**
* Event on failure.
*
* @param failure
* the failure
* @return the event that should be thrown (null does not send event)
*/
Object eventOnFailure(Throwable failure);
/**
* Event on success.
*
* @param result
* the result
* @return the event that should be thrown (null does not send event)
*/
Object eventOnSuccess(C result);
}
| UTF-8 | Java | 893 | java | EventThrower.java | Java | [
{
"context": "/*\n * Copyright (C) 2017 Sylvain Leroy - BYOSkill Company All Rights Reserved\n * You may",
"end": 38,
"score": 0.9998782277107239,
"start": 25,
"tag": "NAME",
"value": "Sylvain Leroy"
}
] | null | [] | /*
* Copyright (C) 2017 <NAME> - BYOSkill Company All Rights Reserved
* You may use, distribute and modify this code under the
* terms of the MIT license, which unfortunately won't be
* written for another century.
*
* You should have received a copy of the MIT license with
* this file. If not, please write to: sleroy at byoskill.com, or visit : www.byoskill.com
*
*/
package com.byoskill.spring.cqrs.api;
public interface EventThrower<C> {
/**
* Event on failure.
*
* @param failure
* the failure
* @return the event that should be thrown (null does not send event)
*/
Object eventOnFailure(Throwable failure);
/**
* Event on success.
*
* @param result
* the result
* @return the event that should be thrown (null does not send event)
*/
Object eventOnSuccess(C result);
}
| 886 | 0.646137 | 0.641657 | 32 | 26.90625 | 26.007643 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.21875 | false | false | 9 |
b378559dbb332d7766802904df996d4bd936d685 | 7,851,200,220,595 | a736dd753f05c3bee1faf115cfc3d92376658d3d | /app/src/main/java/br/edu/fpu/aula_menus/OptionsMenuActivity.java | e95ca2156fa9068f6ef6023c795a07c4cddfaf8a | [] | no_license | edussm/exemplo-android-menus | https://github.com/edussm/exemplo-android-menus | 2588d86f4f68bfe02c695f40b23f0ba969cf3625 | 2811dc348f2768d60f8a7ab757ec84bf26d61d7c | refs/heads/master | 2021-01-10T12:31:31.145000 | 2015-11-25T22:15:22 | 2015-11-25T22:15:22 | 46,890,520 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.edu.fpu.aula_menus;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
public class OptionsMenuActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_options_menu);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_options_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_settings:
Toast.makeText(this, "Settings!",
Toast.LENGTH_SHORT).show();
Intent intent =
new Intent(this, PopupMenuActivity.class);
startActivity(intent);
return true;
case R.id.action_ctxmenu:
Intent intentCtxMenu =
new Intent(this, ContextMenuActivity.class);
startActivity(intentCtxMenu);
return true;
case R.id.action_ctxmenu2:
Intent intentCtxMenu2 =
new Intent(this, ContextMenu2Activity.class);
startActivity(intentCtxMenu2);
return true;
case R.id.open:
Toast.makeText(this, "Abrir Arquivo!",
Toast.LENGTH_LONG).show();
return true;
case R.id.create_new:
Toast.makeText(this, "Novo Arquivo!",
Toast.LENGTH_LONG).show();
return true;
}
return super.onOptionsItemSelected(item);
}
}
| UTF-8 | Java | 1,934 | java | OptionsMenuActivity.java | Java | [] | null | [] | package br.edu.fpu.aula_menus;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
public class OptionsMenuActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_options_menu);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_options_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_settings:
Toast.makeText(this, "Settings!",
Toast.LENGTH_SHORT).show();
Intent intent =
new Intent(this, PopupMenuActivity.class);
startActivity(intent);
return true;
case R.id.action_ctxmenu:
Intent intentCtxMenu =
new Intent(this, ContextMenuActivity.class);
startActivity(intentCtxMenu);
return true;
case R.id.action_ctxmenu2:
Intent intentCtxMenu2 =
new Intent(this, ContextMenu2Activity.class);
startActivity(intentCtxMenu2);
return true;
case R.id.open:
Toast.makeText(this, "Abrir Arquivo!",
Toast.LENGTH_LONG).show();
return true;
case R.id.create_new:
Toast.makeText(this, "Novo Arquivo!",
Toast.LENGTH_LONG).show();
return true;
}
return super.onOptionsItemSelected(item);
}
}
| 1,934 | 0.575491 | 0.573423 | 60 | 31.233334 | 21.141087 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.616667 | false | false | 9 |
5dc8bf0e95a64ff5b8f9f91f77a847668357f5b7 | 7,112,465,900,016 | 67d761c8691b6221351209734365b99d05634b1b | /lession4/example1.java | 6fa3661fcb98e9e9da3fb0437f73648686ae15f0 | [] | no_license | quyettv95/java-basic | https://github.com/quyettv95/java-basic | 6566943e63c0581ee16ba6d993998aa68d669792 | 4866d4c468d59097e6c81ddfd23a9cc4952c759f | refs/heads/master | 2023-07-05T09:36:12.888000 | 2021-08-16T11:39:46 | 2021-08-16T11:39:46 | 396,767,495 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package lession4;
public class example1 {
public static void main(String[] args) {
Point p = new Point(1, 1);
Point p2 = new Point(10, 1);
Point p3 = new Point(-11, 1);
Point p4 = new Point(1000, 1);
Point p5 = new Point(2000, 3000);
// p.getDistance(p2);
// System.out.println(p.isInParallelLineWithOX(p2, p3, p4, p5));
System.out.println(p.sum(1,2,3, 4, 5,6));
// System.out.println(p.getX());
// p.x = 15;
// System.out.println(p.getX());
// p.setX(100);
// System.out.println(p.getX());
// System.out.println(p.x);
// System.out.println(p2.x);
// System.out.println(p2.getDistanceFromO());
// p2.getDistance(p);
}
}
| UTF-8 | Java | 766 | java | example1.java | Java | [] | null | [] | package lession4;
public class example1 {
public static void main(String[] args) {
Point p = new Point(1, 1);
Point p2 = new Point(10, 1);
Point p3 = new Point(-11, 1);
Point p4 = new Point(1000, 1);
Point p5 = new Point(2000, 3000);
// p.getDistance(p2);
// System.out.println(p.isInParallelLineWithOX(p2, p3, p4, p5));
System.out.println(p.sum(1,2,3, 4, 5,6));
// System.out.println(p.getX());
// p.x = 15;
// System.out.println(p.getX());
// p.setX(100);
// System.out.println(p.getX());
// System.out.println(p.x);
// System.out.println(p2.x);
// System.out.println(p2.getDistanceFromO());
// p2.getDistance(p);
}
}
| 766 | 0.530026 | 0.469974 | 24 | 30.916666 | 17.214134 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.291667 | false | false | 9 |
550c5cfc61cd80ca2cdf30b67bfc5b5dfb438cc5 | 13,632,226,256,362 | b119a0339971ac2586efc5d53d38ab0ca0ec8f13 | /basicPages/src/main/java/org/pkb/springlogin/util/ServiceUtil.java | 8d394be3249b08e77222343b40d5daf69f3711cf | [] | no_license | vihang16/spring-mvc | https://github.com/vihang16/spring-mvc | c119e1e554353913a2cdbd9b816730895fd8e9b1 | 7578b32305cf2f0e376b2e0b358d609857fb395f | refs/heads/master | 2021-01-12T02:58:23.989000 | 2017-01-06T16:06:56 | 2017-01-06T16:06:56 | 78,141,262 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.pkb.springlogin.util;
import java.security.SecureRandom;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ServiceUtil {
private static final Logger logger =
LoggerFactory.getLogger(ServiceUtil.class);
private static final char[] CHARSET_AZ_09 = "ABCDEFGHIJKLMNOPQRSTUVWX0123456789".toCharArray();
public static java.sql.Date stringToDateConverter(String string){
SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy");
logger.debug("dob:"+string);
Date date=new Date();
java.sql.Date sqlDate=null;
try {
date=sdf.parse(string);
sqlDate=new java.sql.Date(date.getTime());
System.out.println("sql date:"+sqlDate);
} catch (ParseException e) {
logger.debug("exception in parsing date");
}
return sqlDate;
}
public static String getRandomString() {
Random random = new SecureRandom();
char[] result = new char[10];
for (int i = 0; i < result.length; i++) {
// picks a random index out of character set > random character
int randomCharIndex = random.nextInt(CHARSET_AZ_09.length);
result[i] = CHARSET_AZ_09[randomCharIndex];
}
return new String(result);
}
}
| UTF-8 | Java | 1,285 | java | ServiceUtil.java | Java | [] | null | [] | package org.pkb.springlogin.util;
import java.security.SecureRandom;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ServiceUtil {
private static final Logger logger =
LoggerFactory.getLogger(ServiceUtil.class);
private static final char[] CHARSET_AZ_09 = "ABCDEFGHIJKLMNOPQRSTUVWX0123456789".toCharArray();
public static java.sql.Date stringToDateConverter(String string){
SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy");
logger.debug("dob:"+string);
Date date=new Date();
java.sql.Date sqlDate=null;
try {
date=sdf.parse(string);
sqlDate=new java.sql.Date(date.getTime());
System.out.println("sql date:"+sqlDate);
} catch (ParseException e) {
logger.debug("exception in parsing date");
}
return sqlDate;
}
public static String getRandomString() {
Random random = new SecureRandom();
char[] result = new char[10];
for (int i = 0; i < result.length; i++) {
// picks a random index out of character set > random character
int randomCharIndex = random.nextInt(CHARSET_AZ_09.length);
result[i] = CHARSET_AZ_09[randomCharIndex];
}
return new String(result);
}
}
| 1,285 | 0.722957 | 0.706615 | 46 | 26.934782 | 22.626842 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.043478 | false | false | 9 |
5886dce56e9dc2a6f7a2e2604577842f0f1be378 | 326,417,517,011 | b4b4ce23b818466f800e9060c5a6d372a0a8ddfc | /Faimly_AndroidPM/FamilydayVerPm/src/com/ze/familydayverpm/AboutActivity.java | de052cab3f6dc81972da6756b0588b96233e442e | [] | no_license | FamilyLab/Family | https://github.com/FamilyLab/Family | 8fda6ce3b7fbb146d970ec0bc05361d996ab8153 | f07c9cfc088ebe670917afc725548daeddca5c43 | refs/heads/master | 2016-09-05T14:18:18.627000 | 2013-07-23T09:54:49 | 2013-07-23T09:54:49 | 10,458,127 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ze.familydayverpm;
import com.umeng.analytics.MobclickAgent;
import com.ze.commontool.PublicInfo;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
public class AboutActivity extends Activity {
private int flag;
private ImageView picImageView;
private View back;
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
MobclickAgent.onResume(this);
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
MobclickAgent.onPause(this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
picImageView = (ImageView)findViewById(R.id.about_infopic);
back = findViewById(R.id.about_back);
back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
AboutActivity.this.finish();
}
});
flag = getIntent().getIntExtra("infopic", 0);
switch (flag) {
case PublicInfo.INFOPIC_ABOUT:
picImageView.setImageResource(R.drawable.about_family);
break;
case PublicInfo.INFOPIC_VIP:
picImageView.setImageResource(R.drawable.vip_info);
break;
case PublicInfo.INFOPIC_COIN:
picImageView.setImageResource(R.drawable.coin_use);
break;
default:
break;
}
}
}
| UTF-8 | Java | 1,574 | java | AboutActivity.java | Java | [] | null | [] | package com.ze.familydayverpm;
import com.umeng.analytics.MobclickAgent;
import com.ze.commontool.PublicInfo;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
public class AboutActivity extends Activity {
private int flag;
private ImageView picImageView;
private View back;
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
MobclickAgent.onResume(this);
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
MobclickAgent.onPause(this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
picImageView = (ImageView)findViewById(R.id.about_infopic);
back = findViewById(R.id.about_back);
back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
AboutActivity.this.finish();
}
});
flag = getIntent().getIntExtra("infopic", 0);
switch (flag) {
case PublicInfo.INFOPIC_ABOUT:
picImageView.setImageResource(R.drawable.about_family);
break;
case PublicInfo.INFOPIC_VIP:
picImageView.setImageResource(R.drawable.vip_info);
break;
case PublicInfo.INFOPIC_COIN:
picImageView.setImageResource(R.drawable.coin_use);
break;
default:
break;
}
}
}
| 1,574 | 0.71474 | 0.714104 | 58 | 25.137932 | 16.955772 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.241379 | false | false | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.