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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7ddb89d8def5805cb03e1a6cb2e8907020e51777 | 7,937,099,619,054 | 613d589e45fffe0f0440b251a6a0ae90ca7d404f | /src/edu/washington/cse/concerto/interpreter/ai/StateUpdater.java | c4b7c9d75ce7925937457f6ccd5261a92540ba60 | [
"MIT"
]
| permissive | uwplse/concerto | https://github.com/uwplse/concerto | bac6eda9d99465c42b2fd6d2b6f703409220ad3a | a23d35eae9f6be8c0c1e8e0e4adac5aa3386c1df | refs/heads/master | 2021-09-24T16:29:37.771000 | 2018-10-10T18:17:40 | 2018-10-11T23:46:40 | 96,581,483 | 5 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.washington.cse.concerto.interpreter.ai;
public interface StateUpdater<AS> {
public static class IdentityUpdater {
public static <T> StateUpdater<T> v() {
return new StateUpdater<T>() {
@Override
public T updateState(final T state, final Object value) {
return state;
}
};
}
}
public AS updateState(AS state, Object value);
}
| UTF-8 | Java | 368 | java | StateUpdater.java | Java | []
| null | []
| package edu.washington.cse.concerto.interpreter.ai;
public interface StateUpdater<AS> {
public static class IdentityUpdater {
public static <T> StateUpdater<T> v() {
return new StateUpdater<T>() {
@Override
public T updateState(final T state, final Object value) {
return state;
}
};
}
}
public AS updateState(AS state, Object value);
}
| 368 | 0.692935 | 0.692935 | 15 | 23.533333 | 20.362928 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.4 | false | false | 15 |
5fa8e116cf5ad83d7f136430d2d65a046e2120e0 | 35,235,911,708,150 | 5622d518bac15a05590055a147628a728ca19b23 | /dragontool/src/main/java/dragon/ir/clustering/ClusteringEva.java | ac9e126c63efb39bed8608d438675a77d98fba11 | [
"BSD-2-Clause"
]
| permissive | JULIELab/jcore-dependencies | https://github.com/JULIELab/jcore-dependencies | e51349ccf6f26c7b7dab777a9e6baacd7068b853 | a303c6a067add1f4b05c4d2fe31c1d81ecaa7073 | refs/heads/master | 2023-03-19T20:26:55.083000 | 2023-03-09T20:32:13 | 2023-03-09T20:32:13 | 44,806,492 | 4 | 2 | BSD-2-Clause | false | 2022-11-16T19:48:08 | 2015-10-23T10:32:10 | 2022-04-12T19:32:20 | 2022-11-16T19:48:07 | 36,188 | 4 | 2 | 8 | Java | false | false | package dragon.ir.clustering;
/**
* <p>Class for evaluating clustering results </p>
* <p> </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: IST, Drexel University</p>
* @author Davis Zhou
* @version 1.0
*/
public class ClusteringEva {
private double entropyScore;
private double fScore;
private double purityScore;
private double nmiScore;
private double geoNmiScore;
private double miScore;
private DocClusterSet human, machine;
private double[][] matchMatrix;
private double[][] recallMatrix;
private double[][] precMatrix;
private double docSum;
private int clusterNum, classNum;
public ClusteringEva() {
}
public boolean evaluate(DocClusterSet machine, DocClusterSet human){
this.human=preprocessDocClusterSet(human);
this.machine=preprocessDocClusterSet(machine);
stat();
matchMatrix=this.compClassMatch();
compPrecRecall();
compEntropy();
compFScore();
compPurityScore();
compNMI();
return true;
}
public double[][] getMatchMatrix(){
return matchMatrix;
}
public double getMI(){
return miScore;
}
public double getEntropy(){
return entropyScore;
}
public double getFScore(){
return fScore;
}
public double getPurity(){
return purityScore;
}
public double getGeometryNMI(){
return geoNmiScore;
}
public double getNMI(){
return this.nmiScore;
}
private void stat(){
int docSum, i;
docSum = 0;
for (i = 0; i < machine.getClusterNum(); i++) {
docSum += machine.getDocCluster(i).getDocNum();
}
this.docSum = docSum;
this.clusterNum=machine.getClusterNum();
this.classNum =machine.getClusterNum();
}
private void compFScore(){
int i,j;
double max,sum;
max=0;
sum=0;
for (i = 0; i< recallMatrix.length; i++) {
max=0;
for (j = 0; j < recallMatrix[0].length; j++) {
if(max<compFScore(i,j))
max = compFScore(i, j);
}
sum+=(human.getDocCluster(i).getDocNum()/(double)docSum)*max;
}
this.fScore=sum;
}
private double compFScore(int i, int j){
// cluster i, class j
if (recallMatrix[i][j] == 0 && recallMatrix[i][j] == 0)
return 0;
return (2 * recallMatrix[i][j] * precMatrix[i][j]) / ( (precMatrix[i][j] + recallMatrix[i][j]));
}
private void compPurityScore(){
int i;
double sum;
sum=0;
for(i=0;i<machine.getClusterNum();i++){
sum+=compPurityScore(machine.getDocCluster(i).getClusterID())*(machine.getDocCluster(i).getDocNum()/(double)docSum);
}
this.purityScore=sum;
}
private double compPurityScore(int clusterID){
int i;
double max;
if(machine.getDocCluster(clusterID).getDocNum()==0)
return 0;
max = Double.MIN_VALUE;
for (i = 0; i <classNum; i++) {
if (max < matchMatrix[clusterID][i]) {
max = matchMatrix[clusterID][i];
}
}
return max/machine.getDocCluster(clusterID).getDocNum();
}
private void compEntropy(){
int i;
double sum;
sum=0;
for(i=0;i<clusterNum;i++){
sum+=machine.getDocCluster(i).getDocNum()*compEntropy(i)/docSum;
}
this.entropyScore=sum;
}
private double compEntropy(int clusterID){
double sum;
int j;
sum=0;
for(j=0;j<clusterNum;j++){
if(precMatrix[clusterID][j]==0)
sum+=-Math.log(1.0/docSum)*(1.0/docSum);
else
sum+=-Math.log(precMatrix[clusterID][j])*precMatrix[clusterID][j];
}
return sum;
}
private double[][] compClassMatch(){
DocCluster dc1,dc2;
double[][] match;
int i,j,k;
match = new double[clusterNum][classNum];
for(i=0;i<clusterNum;i++){
dc1=machine.getDocCluster(i);
for(j=0;j<classNum;j++){
dc2=human.getDocCluster(j);
for(k=0;k<dc2.getDocNum();k++)
if (dc1.containDoc(dc2.getDoc(k)))
match[i][j]++;
}
}
return match;
}
private void compPrecRecall(){
DocCluster dc1,dc2;
precMatrix=new double[matchMatrix.length][matchMatrix[0].length];
recallMatrix=new double[matchMatrix.length][matchMatrix[0].length];
for(int i=0;i<clusterNum;i++){
dc1=machine.getDocCluster(i);
for(int j=0;j<classNum;j++){
dc2=human.getDocCluster(j);
precMatrix[i][j]=matchMatrix[i][j]/dc1.getDocNum();
recallMatrix[i][j]=matchMatrix[i][j]/dc2.getDocNum();
}
}
}
private void compNMI(){
int i, j;
double sumJoint, sumX, sumY, xProb, yProb, jointProb;
sumJoint = 0;
sumX = 0;
sumY = 0;
for (i = 0; i < clusterNum; i++) {
for (j = 0; j <classNum; j++) {
if (matchMatrix[i][j] == 0)
jointProb = 1.0 / docSum;
else
jointProb = matchMatrix[i][j] / docSum;
xProb = machine.getDocCluster(i).getDocNum() / docSum;
yProb = human.getDocCluster(j).getDocNum() / docSum;
sumJoint += jointProb * Math.log(jointProb / (xProb * yProb));
}
}
for (i = 0; i < clusterNum; i++) {
xProb = machine.getDocCluster(i).getDocNum() / docSum;
sumX += xProb * Math.log(1 / xProb);
}
for (i = 0; i < clusterNum; i++) {
yProb = human.getDocCluster(i).getDocNum() / docSum;
sumY += yProb * Math.log(1 / yProb);
}
miScore = sumJoint;
nmiScore = 2.0 * sumJoint / (Math.log(clusterNum) + Math.log(classNum));
geoNmiScore = sumJoint / Math.sqrt(sumX * sumY);
}
private DocClusterSet preprocessDocClusterSet(DocClusterSet oldSet){
DocClusterSet newSet;
int i,count;
count=0;
for(i=0;i<oldSet.getClusterNum();i++)
if(oldSet.getDocCluster(i).getDocNum()>0)
count++;
newSet=new DocClusterSet(count);
count=0;
for(i=0;i<oldSet.getClusterNum();i++){
if (oldSet.getDocCluster(i).getDocNum() > 0) {
newSet.setDocCluster(oldSet.getDocCluster(i), count);
count++;
}
}
return newSet;
}
} | UTF-8 | Java | 7,015 | java | ClusteringEva.java | Java | [
{
"context": "<p>Company: IST, Drexel University</p>\r\n * @author Davis Zhou\r\n * @version 1.0\r\n */\r\n\r\npublic class ClusteringE",
"end": 208,
"score": 0.999832034111023,
"start": 198,
"tag": "NAME",
"value": "Davis Zhou"
}
]
| null | []
| package dragon.ir.clustering;
/**
* <p>Class for evaluating clustering results </p>
* <p> </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: IST, Drexel University</p>
* @author <NAME>
* @version 1.0
*/
public class ClusteringEva {
private double entropyScore;
private double fScore;
private double purityScore;
private double nmiScore;
private double geoNmiScore;
private double miScore;
private DocClusterSet human, machine;
private double[][] matchMatrix;
private double[][] recallMatrix;
private double[][] precMatrix;
private double docSum;
private int clusterNum, classNum;
public ClusteringEva() {
}
public boolean evaluate(DocClusterSet machine, DocClusterSet human){
this.human=preprocessDocClusterSet(human);
this.machine=preprocessDocClusterSet(machine);
stat();
matchMatrix=this.compClassMatch();
compPrecRecall();
compEntropy();
compFScore();
compPurityScore();
compNMI();
return true;
}
public double[][] getMatchMatrix(){
return matchMatrix;
}
public double getMI(){
return miScore;
}
public double getEntropy(){
return entropyScore;
}
public double getFScore(){
return fScore;
}
public double getPurity(){
return purityScore;
}
public double getGeometryNMI(){
return geoNmiScore;
}
public double getNMI(){
return this.nmiScore;
}
private void stat(){
int docSum, i;
docSum = 0;
for (i = 0; i < machine.getClusterNum(); i++) {
docSum += machine.getDocCluster(i).getDocNum();
}
this.docSum = docSum;
this.clusterNum=machine.getClusterNum();
this.classNum =machine.getClusterNum();
}
private void compFScore(){
int i,j;
double max,sum;
max=0;
sum=0;
for (i = 0; i< recallMatrix.length; i++) {
max=0;
for (j = 0; j < recallMatrix[0].length; j++) {
if(max<compFScore(i,j))
max = compFScore(i, j);
}
sum+=(human.getDocCluster(i).getDocNum()/(double)docSum)*max;
}
this.fScore=sum;
}
private double compFScore(int i, int j){
// cluster i, class j
if (recallMatrix[i][j] == 0 && recallMatrix[i][j] == 0)
return 0;
return (2 * recallMatrix[i][j] * precMatrix[i][j]) / ( (precMatrix[i][j] + recallMatrix[i][j]));
}
private void compPurityScore(){
int i;
double sum;
sum=0;
for(i=0;i<machine.getClusterNum();i++){
sum+=compPurityScore(machine.getDocCluster(i).getClusterID())*(machine.getDocCluster(i).getDocNum()/(double)docSum);
}
this.purityScore=sum;
}
private double compPurityScore(int clusterID){
int i;
double max;
if(machine.getDocCluster(clusterID).getDocNum()==0)
return 0;
max = Double.MIN_VALUE;
for (i = 0; i <classNum; i++) {
if (max < matchMatrix[clusterID][i]) {
max = matchMatrix[clusterID][i];
}
}
return max/machine.getDocCluster(clusterID).getDocNum();
}
private void compEntropy(){
int i;
double sum;
sum=0;
for(i=0;i<clusterNum;i++){
sum+=machine.getDocCluster(i).getDocNum()*compEntropy(i)/docSum;
}
this.entropyScore=sum;
}
private double compEntropy(int clusterID){
double sum;
int j;
sum=0;
for(j=0;j<clusterNum;j++){
if(precMatrix[clusterID][j]==0)
sum+=-Math.log(1.0/docSum)*(1.0/docSum);
else
sum+=-Math.log(precMatrix[clusterID][j])*precMatrix[clusterID][j];
}
return sum;
}
private double[][] compClassMatch(){
DocCluster dc1,dc2;
double[][] match;
int i,j,k;
match = new double[clusterNum][classNum];
for(i=0;i<clusterNum;i++){
dc1=machine.getDocCluster(i);
for(j=0;j<classNum;j++){
dc2=human.getDocCluster(j);
for(k=0;k<dc2.getDocNum();k++)
if (dc1.containDoc(dc2.getDoc(k)))
match[i][j]++;
}
}
return match;
}
private void compPrecRecall(){
DocCluster dc1,dc2;
precMatrix=new double[matchMatrix.length][matchMatrix[0].length];
recallMatrix=new double[matchMatrix.length][matchMatrix[0].length];
for(int i=0;i<clusterNum;i++){
dc1=machine.getDocCluster(i);
for(int j=0;j<classNum;j++){
dc2=human.getDocCluster(j);
precMatrix[i][j]=matchMatrix[i][j]/dc1.getDocNum();
recallMatrix[i][j]=matchMatrix[i][j]/dc2.getDocNum();
}
}
}
private void compNMI(){
int i, j;
double sumJoint, sumX, sumY, xProb, yProb, jointProb;
sumJoint = 0;
sumX = 0;
sumY = 0;
for (i = 0; i < clusterNum; i++) {
for (j = 0; j <classNum; j++) {
if (matchMatrix[i][j] == 0)
jointProb = 1.0 / docSum;
else
jointProb = matchMatrix[i][j] / docSum;
xProb = machine.getDocCluster(i).getDocNum() / docSum;
yProb = human.getDocCluster(j).getDocNum() / docSum;
sumJoint += jointProb * Math.log(jointProb / (xProb * yProb));
}
}
for (i = 0; i < clusterNum; i++) {
xProb = machine.getDocCluster(i).getDocNum() / docSum;
sumX += xProb * Math.log(1 / xProb);
}
for (i = 0; i < clusterNum; i++) {
yProb = human.getDocCluster(i).getDocNum() / docSum;
sumY += yProb * Math.log(1 / yProb);
}
miScore = sumJoint;
nmiScore = 2.0 * sumJoint / (Math.log(clusterNum) + Math.log(classNum));
geoNmiScore = sumJoint / Math.sqrt(sumX * sumY);
}
private DocClusterSet preprocessDocClusterSet(DocClusterSet oldSet){
DocClusterSet newSet;
int i,count;
count=0;
for(i=0;i<oldSet.getClusterNum();i++)
if(oldSet.getDocCluster(i).getDocNum()>0)
count++;
newSet=new DocClusterSet(count);
count=0;
for(i=0;i<oldSet.getClusterNum();i++){
if (oldSet.getDocCluster(i).getDocNum() > 0) {
newSet.setDocCluster(oldSet.getDocCluster(i), count);
count++;
}
}
return newSet;
}
} | 7,011 | 0.515182 | 0.504918 | 245 | 26.640816 | 22.48831 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.685714 | false | false | 15 |
dd826b80b828a4b252b3be7bedff87ac0e95e239 | 16,415,365,034,202 | 5bfa81ad2ae75ec97508dfd4b1f870e1b2bf8c4a | /src/main/java/com/yuanpeng/CustomerManageApplication.java | ae5e4f75ca87da4177e168ecf61a3c009b8bf5f6 | []
| no_license | 16678529224/customer-manage | https://github.com/16678529224/customer-manage | 74ca36c4ce2850dd389a45651df3598a4b694c50 | 87757de56990ab2859e9263d66fa053803ec391c | refs/heads/master | 2022-07-16T05:09:26.325000 | 2020-01-20T12:51:40 | 2020-01-20T12:51:42 | 197,167,210 | 0 | 0 | null | false | 2022-06-17T02:17:28 | 2019-07-16T09:51:36 | 2020-01-20T12:53:21 | 2022-06-17T02:17:26 | 2,914 | 0 | 0 | 2 | JavaScript | false | false | package com.yuanpeng;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* 日志使用:SpringBoot底层也是使用slf4j+logback的方式进行日志记录
*/
@SpringBootApplication
@EnableTransactionManagement
public class CustomerManageApplication {
public static void main(String[] args) {
SpringApplication.run(CustomerManageApplication.class, args);
}
}
| UTF-8 | Java | 535 | java | CustomerManageApplication.java | Java | []
| null | []
| package com.yuanpeng;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* 日志使用:SpringBoot底层也是使用slf4j+logback的方式进行日志记录
*/
@SpringBootApplication
@EnableTransactionManagement
public class CustomerManageApplication {
public static void main(String[] args) {
SpringApplication.run(CustomerManageApplication.class, args);
}
}
| 535 | 0.816901 | 0.814889 | 19 | 25.157894 | 26.505735 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.315789 | false | false | 15 |
caa39abfc3210713713d2a1a7f2a4c4a319fd075 | 25,726,854,145,877 | 90fdb9adb2fe0a857911d6d965d89fe7cfbbf644 | /random/CountChars.java | e8a006abc6883d0a7f342e74a92477f9d6e7c6f6 | []
| no_license | ajwilsonvt/coding-problems | https://github.com/ajwilsonvt/coding-problems | 844f716db4b79029003d772e17a85e3b2e7b6408 | d390c53fd06ee6c380043323ff3b74e0578843d3 | refs/heads/master | 2020-03-13T05:04:21.701000 | 2017-05-13T18:32:15 | 2017-05-13T18:32:15 | 130,975,288 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package codingproblems;
public class CountChars {
public static void main(String[] args) {
System.out.println(countCharsRec("this is a string", 'i', 0));
}
public static int countCharsRec(String word, char c, int n) {
if (word.length() == 0) {
return n;
}
else {
int count = n;
if (word.charAt(0) == c) {
count++;
}
return countCharsRec(word.substring(1), c, count);
}
}
}
| UTF-8 | Java | 412 | java | CountChars.java | Java | []
| null | []
| package codingproblems;
public class CountChars {
public static void main(String[] args) {
System.out.println(countCharsRec("this is a string", 'i', 0));
}
public static int countCharsRec(String word, char c, int n) {
if (word.length() == 0) {
return n;
}
else {
int count = n;
if (word.charAt(0) == c) {
count++;
}
return countCharsRec(word.substring(1), c, count);
}
}
}
| 412 | 0.616505 | 0.606796 | 22 | 17.727272 | 20.143084 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.136364 | false | false | 15 |
0357c3799ee9b83aeed028e91e3a6d3897bc52b7 | 15,590,731,348,140 | fe4b02080d821c0fd430fd23e8e90ed93257fa71 | /src/detalleCompraIngrediente/entity/NoExisteDetalleCompraIngrediente.java | d120ff17a592a7f0d37b434ec5f1c504bf45d724 | []
| no_license | CarlaBarrientos/ProyectoJava | https://github.com/CarlaBarrientos/ProyectoJava | c0b5eb158ec93810e1c4f958f6dc884a9f8a4dfb | a0c2fcfd947ccc995ba7e93b5835e25c20e89b01 | refs/heads/master | 2021-09-23T00:33:02.768000 | 2018-09-19T06:36:38 | 2018-09-19T06:36:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package detalleCompraIngrediente.entity;
public class NoExisteDetalleCompraIngrediente extends Exception {
private static final long serialVersionUID = 1L;
public NoExisteDetalleCompraIngrediente() {
super("No existe el detalle de compra de ingrediente!");
}
}
| UTF-8 | Java | 272 | java | NoExisteDetalleCompraIngrediente.java | Java | []
| null | []
| package detalleCompraIngrediente.entity;
public class NoExisteDetalleCompraIngrediente extends Exception {
private static final long serialVersionUID = 1L;
public NoExisteDetalleCompraIngrediente() {
super("No existe el detalle de compra de ingrediente!");
}
}
| 272 | 0.797794 | 0.794118 | 11 | 23.727272 | 25.835461 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.727273 | false | false | 15 |
c473375f259c45960cc58673a201df976df3bcc1 | 34,548,716,941,030 | c1eb9772ad67d08bb047e71c8b0a0ac47f7e9ace | /app/src/main/java/com/newsing/activity/weather/today/WeatherHourBody.java | dbaef2450356dc4807d1a89651f4bd17f83087b3 | []
| no_license | ndroidOrganization/Newsing | https://github.com/ndroidOrganization/Newsing | cd31b843e236fbf8770ba9e0b400320822b65ac1 | ec5ce4de02d3818dd866208cc6355d9ff4f7e494 | refs/heads/master | 2021-01-18T12:33:28.054000 | 2017-08-03T03:16:46 | 2017-08-03T03:16:46 | 68,696,406 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.newsing.activity.weather.today;
/**
* Created by Qzhu on 2017/8/2.
*/
public class WeatherHourBody {
// "weather_code": "07",
// "time": "201708021300",
// "wind_direction": "东南偏南",
// "wind_power": "5-6 清风 10.8~13.8m/s",
// "weather": "小雨",
// "temperature": "29"
private String weather_code;
private String time;
private String wind_direction;
private String wind_power;
private String weather;
private String temperature;
public String getWeather_code() {
return weather_code;
}
public void setWeather_code(String weather_code) {
this.weather_code = weather_code;
}
public String getTime() {
StringBuilder builder = new StringBuilder(time);
builder.delete(0,4);
builder.insert(6,':');
builder.insert(4,'\n');
builder.insert(4,'\n');
builder.insert(2,'/');
return builder.toString();
}
public void setTime(String time) {
this.time = time;
}
public String getWind_direction() {
return wind_direction;
}
public void setWind_direction(String wind_direction) {
this.wind_direction = wind_direction;
}
public String getWind_power() {
return (wind_power.replaceFirst(" ","\n"));
}
public void setWind_power(String wind_power) {
this.wind_power = wind_power;
}
public String getWeather() {
return weather;
}
public void setWeather(String weather) {
this.weather = weather;
}
public String getTemperature() {
return temperature+"℃";
}
public void setTemperature(String temperature) {
this.temperature = temperature;
}
}
| UTF-8 | Java | 1,783 | java | WeatherHourBody.java | Java | [
{
"context": "newsing.activity.weather.today;\n\n/**\n * Created by Qzhu on 2017/8/2.\n */\n\npublic class WeatherHourBody {\n",
"end": 67,
"score": 0.9978955388069153,
"start": 63,
"tag": "USERNAME",
"value": "Qzhu"
}
]
| null | []
| package com.newsing.activity.weather.today;
/**
* Created by Qzhu on 2017/8/2.
*/
public class WeatherHourBody {
// "weather_code": "07",
// "time": "201708021300",
// "wind_direction": "东南偏南",
// "wind_power": "5-6 清风 10.8~13.8m/s",
// "weather": "小雨",
// "temperature": "29"
private String weather_code;
private String time;
private String wind_direction;
private String wind_power;
private String weather;
private String temperature;
public String getWeather_code() {
return weather_code;
}
public void setWeather_code(String weather_code) {
this.weather_code = weather_code;
}
public String getTime() {
StringBuilder builder = new StringBuilder(time);
builder.delete(0,4);
builder.insert(6,':');
builder.insert(4,'\n');
builder.insert(4,'\n');
builder.insert(2,'/');
return builder.toString();
}
public void setTime(String time) {
this.time = time;
}
public String getWind_direction() {
return wind_direction;
}
public void setWind_direction(String wind_direction) {
this.wind_direction = wind_direction;
}
public String getWind_power() {
return (wind_power.replaceFirst(" ","\n"));
}
public void setWind_power(String wind_power) {
this.wind_power = wind_power;
}
public String getWeather() {
return weather;
}
public void setWeather(String weather) {
this.weather = weather;
}
public String getTemperature() {
return temperature+"℃";
}
public void setTemperature(String temperature) {
this.temperature = temperature;
}
}
| 1,783 | 0.587535 | 0.567139 | 74 | 22.851351 | 17.947884 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.486486 | false | false | 15 |
93918d3f0ce4972bbff503d785ee0920a798c07f | 2,052,994,378,402 | a773302268366f94ca6f54b22c659d162430aedc | /Week_11/redis/src/main/java/com/lh/redis/test/RedisCountTest.java | e4c1ba1b3583b110f76716166cf61504bff44c92 | []
| no_license | wuliendan/JAVA-000 | https://github.com/wuliendan/JAVA-000 | 33020c8aea8f93c3a15613233454ca5c1c43f9d5 | ec4dff8ce45799835031ae5110ca74d8751d26db | refs/heads/main | 2023-02-25T09:10:01.210000 | 2021-02-06T15:58:46 | 2021-02-06T15:58:46 | 303,402,971 | 0 | 0 | null | true | 2020-10-12T13:36:23 | 2020-10-12T13:36:23 | 2020-10-12T03:41:54 | 2020-10-12T08:13:10 | 2 | 0 | 0 | 0 | null | false | false | package com.lh.redis.test;
import com.lh.redis.config.RedisConnection;
import com.lh.redis.util.RedisConnectionUtil;
import com.lh.redis.util.RedisTool;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class RedisCountTest {
public static void main(String[] args) {
new Thread(new Runnable() {
public void run() {
RedisConnection redisConnection = RedisConnectionUtil.create();
try {
for (int i = 0; i < 100; i++) {
long num = RedisTool.setIncr("0", redisConnection);
log.info("num: " + num);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
}
| UTF-8 | Java | 782 | java | RedisCountTest.java | Java | []
| null | []
| package com.lh.redis.test;
import com.lh.redis.config.RedisConnection;
import com.lh.redis.util.RedisConnectionUtil;
import com.lh.redis.util.RedisTool;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class RedisCountTest {
public static void main(String[] args) {
new Thread(new Runnable() {
public void run() {
RedisConnection redisConnection = RedisConnectionUtil.create();
try {
for (int i = 0; i < 100; i++) {
long num = RedisTool.setIncr("0", redisConnection);
log.info("num: " + num);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
}
| 782 | 0.519182 | 0.508951 | 26 | 29.076923 | 21.030972 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 15 |
bd4637472a26039b6eafe5e903ff582bab612d14 | 30,958,124,339,655 | a58d971375ccca97fcde81f2719e325259c412f9 | /pset-1/twitter/ExtractTest.java | ec5c1d7d2c428966eef87de998872a07bb51d64a | []
| no_license | ennisthemennis/SoftwareConstructionClass | https://github.com/ennisthemennis/SoftwareConstructionClass | 39ee868ae36ad5e546657342d406bded8a0b31e0 | 5115b2208c640f615be1fc332ce6a3af7dff9b25 | refs/heads/master | 2015-08-12T00:34:39.591000 | 2014-06-09T02:03:48 | 2014-06-09T02:03:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package twitter;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.junit.BeforeClass;
import org.junit.Test;
/*Partition for getTimespan() input space is an empty list,
* a list with one tweet, a list with two tweets, a list with three
* or more tweets, a list with tweets in order by time, and list with
* tweets not in order by time. Test if multiple tweets have same
* timespan
*
* Partition for getMentionedUsers() input space is an empty list,
* a list with one tweet, a list with more than one tweet, a list
* containing a tweet with no mentions, a list containing a tweet
* with one mention, a list containing a tweet with more than one
* mention, a list containing a tweet with a mention that ends with
* a character (like .), a list containing a tweet with a mention that
* ends with a space, a tweet with an @ symbol that is preceded by an
* underscore or alphanumeric character, a tweet with an @ symbol that
* is followed by an invalid username character (so no mention),
* and a tweet with a one letter username mention. When testing for
* correct users should be case insensitive */
public class ExtractTest {
private static Date d1;
private static Date d2;
private static Date d3;
private static Tweet timeTestTweet1;
private static Tweet timeTestTweet2;
private static Tweet timeTestTweet3;
private static Tweet oneMentionTweet;
private static Tweet twoMentionsTweet;
private static Tweet endMentionWithCharacterTweet;
private static Tweet invalidAtTweet;
private static Tweet noMentionTweet;
private static Tweet oneLetterUserNameTweet;
private static Tweet invalidSecondTweet;
private static Tweet oneMentionTweetNewCase;
@BeforeClass
public static void setUpBeforeClass() {
Calendar calendar = Calendar.getInstance();
calendar.set(2014, 1, 14, 10, 00, 00);
d1 = calendar.getTime();
calendar.set(2014, 1, 14, 11, 00, 00);
d2 = calendar.getTime();
calendar.set(2014, 1, 14, 11, 30, 00);
d3 = calendar.getTime();
timeTestTweet1 = new Tweet(0, "alyssa", "is it reasonable to talk about rivest so much?", d1);
timeTestTweet2 = new Tweet(1, "bbitdiddle", "rivest talk in 30 minutes #hype", d2);
timeTestTweet3 = new Tweet(2, "anon", "testing...", d3);
oneMentionTweet = new Tweet(3, "anon", "@bbitdiddle", d3);
oneMentionTweetNewCase = new Tweet(10, "anon", "@BBitDiDDLe", d3);
twoMentionsTweet = new Tweet(4, "anon", "@bbitdiddle and @alyssa", d3);
endMentionWithCharacterTweet = new Tweet(5, "anon", "@bbitdiddle.s", d3);
invalidAtTweet = new Tweet(6, "anon", "mit@bbitdiddle", d3);
noMentionTweet = new Tweet(7, "anon", "I mention nothing", d3);
oneLetterUserNameTweet = new Tweet(8, "anon", "@a...", d3);
invalidSecondTweet = new Tweet(9, "anon", "@,@@abc", d2);
}
public static Set<String> convertLowerCase(Set<String> input)
{
Set<String> answer = new HashSet<String>();
for (String currentName : input)
{
String newName = currentName.toLowerCase();
//switch mentioned users to all lower case for check
answer.add(newName);
}
return answer;
}
@Test
public void testGetTimespanTwoTweetsSameTime()
{
//two d3's two d2's and a d1
Timespan timespan = Extract.getTimespan(Arrays.asList(timeTestTweet1, timeTestTweet2, timeTestTweet3, invalidSecondTweet, noMentionTweet));
assertEquals(d1, timespan.getStart());
assertEquals(d3, timespan.getEnd());
}
@Test
public void testGetTimespanTwoTweets() {
List<Tweet> modificationCheck = Arrays.asList(timeTestTweet1, timeTestTweet2);
Timespan timespan = Extract.getTimespan(modificationCheck);
//check that method doesn't modify tweets list
assertEquals(modificationCheck, Arrays.asList(timeTestTweet1, timeTestTweet2));
assertEquals(d1, timespan.getStart());
assertEquals(d2, timespan.getEnd());
}
@Test
public void testGetTimespanThreeTweetsInOrder() {
Timespan timespan = Extract.getTimespan(Arrays.asList(timeTestTweet1, timeTestTweet2, timeTestTweet3));
assertEquals(d1, timespan.getStart());
assertEquals(d3, timespan.getEnd());
}
@Test
public void testGetTimespanThreeTweetsNotInOrder() {
Timespan timespan = Extract.getTimespan(Arrays.asList(timeTestTweet2, timeTestTweet3, timeTestTweet1));
assertEquals(d1, timespan.getStart());
assertEquals(d3, timespan.getEnd());
}
@Test
public void testGetTimespanOneTweet() {
Timespan timespan = Extract.getTimespan(Arrays.asList(timeTestTweet1));
assertEquals(d1, timespan.getStart());
assertEquals(d1, timespan.getEnd());
}
@Test
public void testGetTimespanNoTweets() {
Timespan timespan = Extract.getTimespan(Collections.<Tweet>emptyList());
/*the spec wants a minimum Timespan that includes all timemstamps of tweets.
* since there are no tweets, which timestamp is actually used can be many,
* but the minimum interval is 0.*/
assertEquals(timespan.getEnd(), timespan.getStart());
}
@Test
public void testGetMentionedUsersCaseInsensitive()
{
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(oneMentionTweet, oneMentionTweetNewCase));
assertEquals(mentionedUsers.size(), 1);
}
@Test
public void testGetMentionedUsersNoMention() {
List<Tweet> modificationCheck = Arrays.asList(timeTestTweet1, timeTestTweet2);
Set<String> mentionedUsers = Extract.getMentionedUsers(modificationCheck);
//check that method doesn't modify tweets list
assertEquals(modificationCheck, Arrays.asList(timeTestTweet1, timeTestTweet2));
assertTrue(mentionedUsers.isEmpty());
}
@Test
public void testGetMentionedUsersOneMentionOneTweet() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(oneMentionTweet));
assertEquals(mentionedUsers.size(), 1);
mentionedUsers = convertLowerCase(mentionedUsers);
assertTrue(mentionedUsers.contains("bbitdiddle"));
}
@Test
public void testGetMentionedUsersTwoMentionsOneTweet() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(twoMentionsTweet));
assertEquals(mentionedUsers.size(), 2);
mentionedUsers = convertLowerCase(mentionedUsers);
assertTrue(mentionedUsers.contains("bbitdiddle"));
assertTrue(mentionedUsers.contains("alyssa"));
}
@Test
public void testGetMentionedUsersMoreThanOneTweet() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(noMentionTweet, oneMentionTweet, twoMentionsTweet));
assertEquals(mentionedUsers.size(), 2);
//also check that usernames won't be repeated if mentioned more than once
mentionedUsers = convertLowerCase(mentionedUsers);
assertTrue(mentionedUsers.contains("bbitdiddle"));
assertTrue(mentionedUsers.contains("alyssa"));
}
@Test
public void testGetMentionedUsersNoTweets() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Collections.<Tweet>emptyList());
assertTrue(mentionedUsers.isEmpty());
}
@Test
public void testGetMentionedUsersPeriodStop() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(endMentionWithCharacterTweet));
assertEquals(mentionedUsers.size(), 1);
mentionedUsers=convertLowerCase(mentionedUsers);
assertTrue(mentionedUsers.contains("bbitdiddle"));
}
@Test
public void testGetMentionedUsersWrongAt() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(invalidAtTweet));
assertTrue(mentionedUsers.isEmpty());
}
@Test
public void testGetMentionedUsersInvalidSecondCharacter() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(invalidSecondTweet));
assertEquals(mentionedUsers.size(), 1);
mentionedUsers = convertLowerCase(mentionedUsers);
assertTrue(mentionedUsers.contains("abc"));
}
@Test
public void testGetMentionedUsersOneLetterUserName() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(oneLetterUserNameTweet));
assertEquals(mentionedUsers.size(), 1);
mentionedUsers = convertLowerCase(mentionedUsers);
assertTrue(mentionedUsers.contains("a"));
}
}
| UTF-8 | Java | 8,986 | java | ExtractTest.java | Java | [
{
"context": ";\n \n timeTestTweet1 = new Tweet(0, \"alyssa\", \"is it reasonable to talk about rivest so much?",
"end": 2359,
"score": 0.9996140599250793,
"start": 2353,
"tag": "USERNAME",
"value": "alyssa"
},
{
"context": "ch?\", d1);\n timeTestTweet2 = new Tweet(1, \"bbitdiddle\", \"rivest talk in 30 minutes #hype\", d2);\n ",
"end": 2466,
"score": 0.9995433688163757,
"start": 2456,
"tag": "USERNAME",
"value": "bbitdiddle"
},
{
"context": "..\", d3);\n oneMentionTweet = new Tweet(3, \"anon\", \"@bbitdiddle\", d3);\n oneMentionTweetNewC",
"end": 2618,
"score": 0.5388786196708679,
"start": 2614,
"tag": "USERNAME",
"value": "anon"
},
{
"context": "3);\n oneMentionTweet = new Tweet(3, \"anon\", \"@bbitdiddle\", d3);\n oneMentionTweetNewCase = new Tweet",
"end": 2633,
"score": 0.999302089214325,
"start": 2621,
"tag": "USERNAME",
"value": "\"@bbitdiddle"
},
{
"context": " oneMentionTweetNewCase = new Tweet(10, \"anon\", \"@BBitDiDDLe\", d3);\n twoMentionsTweet = new Tweet(4, \"a",
"end": 2708,
"score": 0.9985969662666321,
"start": 2696,
"tag": "USERNAME",
"value": "\"@BBitDiDDLe"
},
{
"context": ");\n twoMentionsTweet = new Tweet(4, \"anon\", \"@bbitdiddle and @alyssa\", d3);\n endMentionWithCharacte",
"end": 2776,
"score": 0.9996353387832642,
"start": 2764,
"tag": "USERNAME",
"value": "\"@bbitdiddle"
},
{
"context": "tionsTweet = new Tweet(4, \"anon\", \"@bbitdiddle and @alyssa\", d3);\n endMentionWithCharacterTweet = new",
"end": 2788,
"score": 0.9579434394836426,
"start": 2781,
"tag": "USERNAME",
"value": "@alyssa"
},
{
"context": "ndMentionWithCharacterTweet = new Tweet(5, \"anon\", \"@bbitdiddle.s\", d3);\n invalidAtTweet = new Tweet(6, \"ano",
"end": 2870,
"score": 0.9993216395378113,
"start": 2856,
"tag": "USERNAME",
"value": "\"@bbitdiddle.s"
},
{
"context": ");\n invalidAtTweet = new Tweet(6, \"anon\", \"mit@bbitdiddle\", d3);\n noMentionTweet = new Tweet(7, \"ano",
"end": 2939,
"score": 0.9955675005912781,
"start": 2925,
"tag": "USERNAME",
"value": "mit@bbitdiddle"
},
{
"context": " invalidSecondTweet = new Tweet(9, \"anon\", \"@,@@abc\", d2);\n \n \n }\n public static Set<",
"end": 3145,
"score": 0.8155031800270081,
"start": 3142,
"tag": "USERNAME",
"value": "abc"
},
{
"context": "ers);\n assertTrue(mentionedUsers.contains(\"bbitdiddle\"));\n }\n \n @Test\n public void testGetM",
"end": 6603,
"score": 0.9987757205963135,
"start": 6593,
"tag": "USERNAME",
"value": "bbitdiddle"
},
{
"context": " \n assertTrue(mentionedUsers.contains(\"bbitdiddle\"));\n assertTrue(mentionedUsers.contains(\"a",
"end": 6964,
"score": 0.9992212057113647,
"start": 6954,
"tag": "USERNAME",
"value": "bbitdiddle"
},
{
"context": "e\"));\n assertTrue(mentionedUsers.contains(\"alyssa\"));\n }\n @Test\n public void testGetMentio",
"end": 7019,
"score": 0.9994970560073853,
"start": 7013,
"tag": "USERNAME",
"value": "alyssa"
},
{
"context": "ers);\n assertTrue(mentionedUsers.contains(\"bbitdiddle\"));\n assertTrue(mentionedUsers.contains(\"a",
"end": 7472,
"score": 0.9995899796485901,
"start": 7462,
"tag": "USERNAME",
"value": "bbitdiddle"
},
{
"context": "e\"));\n assertTrue(mentionedUsers.contains(\"alyssa\"));\n }\n @Test\n public void testGetMentio",
"end": 7527,
"score": 0.9995805025100708,
"start": 7521,
"tag": "USERNAME",
"value": "alyssa"
},
{
"context": "ers);\n assertTrue(mentionedUsers.contains(\"bbitdiddle\"));\n }\n @Test\n public void testGetMentio",
"end": 8085,
"score": 0.998970091342926,
"start": 8075,
"tag": "USERNAME",
"value": "bbitdiddle"
}
]
| null | []
| package twitter;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.junit.BeforeClass;
import org.junit.Test;
/*Partition for getTimespan() input space is an empty list,
* a list with one tweet, a list with two tweets, a list with three
* or more tweets, a list with tweets in order by time, and list with
* tweets not in order by time. Test if multiple tweets have same
* timespan
*
* Partition for getMentionedUsers() input space is an empty list,
* a list with one tweet, a list with more than one tweet, a list
* containing a tweet with no mentions, a list containing a tweet
* with one mention, a list containing a tweet with more than one
* mention, a list containing a tweet with a mention that ends with
* a character (like .), a list containing a tweet with a mention that
* ends with a space, a tweet with an @ symbol that is preceded by an
* underscore or alphanumeric character, a tweet with an @ symbol that
* is followed by an invalid username character (so no mention),
* and a tweet with a one letter username mention. When testing for
* correct users should be case insensitive */
public class ExtractTest {
private static Date d1;
private static Date d2;
private static Date d3;
private static Tweet timeTestTweet1;
private static Tweet timeTestTweet2;
private static Tweet timeTestTweet3;
private static Tweet oneMentionTweet;
private static Tweet twoMentionsTweet;
private static Tweet endMentionWithCharacterTweet;
private static Tweet invalidAtTweet;
private static Tweet noMentionTweet;
private static Tweet oneLetterUserNameTweet;
private static Tweet invalidSecondTweet;
private static Tweet oneMentionTweetNewCase;
@BeforeClass
public static void setUpBeforeClass() {
Calendar calendar = Calendar.getInstance();
calendar.set(2014, 1, 14, 10, 00, 00);
d1 = calendar.getTime();
calendar.set(2014, 1, 14, 11, 00, 00);
d2 = calendar.getTime();
calendar.set(2014, 1, 14, 11, 30, 00);
d3 = calendar.getTime();
timeTestTweet1 = new Tweet(0, "alyssa", "is it reasonable to talk about rivest so much?", d1);
timeTestTweet2 = new Tweet(1, "bbitdiddle", "rivest talk in 30 minutes #hype", d2);
timeTestTweet3 = new Tweet(2, "anon", "testing...", d3);
oneMentionTweet = new Tweet(3, "anon", "@bbitdiddle", d3);
oneMentionTweetNewCase = new Tweet(10, "anon", "@BBitDiDDLe", d3);
twoMentionsTweet = new Tweet(4, "anon", "@bbitdiddle and @alyssa", d3);
endMentionWithCharacterTweet = new Tweet(5, "anon", "@bbitdiddle.s", d3);
invalidAtTweet = new Tweet(6, "anon", "mit@bbitdiddle", d3);
noMentionTweet = new Tweet(7, "anon", "I mention nothing", d3);
oneLetterUserNameTweet = new Tweet(8, "anon", "@a...", d3);
invalidSecondTweet = new Tweet(9, "anon", "@,@@abc", d2);
}
public static Set<String> convertLowerCase(Set<String> input)
{
Set<String> answer = new HashSet<String>();
for (String currentName : input)
{
String newName = currentName.toLowerCase();
//switch mentioned users to all lower case for check
answer.add(newName);
}
return answer;
}
@Test
public void testGetTimespanTwoTweetsSameTime()
{
//two d3's two d2's and a d1
Timespan timespan = Extract.getTimespan(Arrays.asList(timeTestTweet1, timeTestTweet2, timeTestTweet3, invalidSecondTweet, noMentionTweet));
assertEquals(d1, timespan.getStart());
assertEquals(d3, timespan.getEnd());
}
@Test
public void testGetTimespanTwoTweets() {
List<Tweet> modificationCheck = Arrays.asList(timeTestTweet1, timeTestTweet2);
Timespan timespan = Extract.getTimespan(modificationCheck);
//check that method doesn't modify tweets list
assertEquals(modificationCheck, Arrays.asList(timeTestTweet1, timeTestTweet2));
assertEquals(d1, timespan.getStart());
assertEquals(d2, timespan.getEnd());
}
@Test
public void testGetTimespanThreeTweetsInOrder() {
Timespan timespan = Extract.getTimespan(Arrays.asList(timeTestTweet1, timeTestTweet2, timeTestTweet3));
assertEquals(d1, timespan.getStart());
assertEquals(d3, timespan.getEnd());
}
@Test
public void testGetTimespanThreeTweetsNotInOrder() {
Timespan timespan = Extract.getTimespan(Arrays.asList(timeTestTweet2, timeTestTweet3, timeTestTweet1));
assertEquals(d1, timespan.getStart());
assertEquals(d3, timespan.getEnd());
}
@Test
public void testGetTimespanOneTweet() {
Timespan timespan = Extract.getTimespan(Arrays.asList(timeTestTweet1));
assertEquals(d1, timespan.getStart());
assertEquals(d1, timespan.getEnd());
}
@Test
public void testGetTimespanNoTweets() {
Timespan timespan = Extract.getTimespan(Collections.<Tweet>emptyList());
/*the spec wants a minimum Timespan that includes all timemstamps of tweets.
* since there are no tweets, which timestamp is actually used can be many,
* but the minimum interval is 0.*/
assertEquals(timespan.getEnd(), timespan.getStart());
}
@Test
public void testGetMentionedUsersCaseInsensitive()
{
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(oneMentionTweet, oneMentionTweetNewCase));
assertEquals(mentionedUsers.size(), 1);
}
@Test
public void testGetMentionedUsersNoMention() {
List<Tweet> modificationCheck = Arrays.asList(timeTestTweet1, timeTestTweet2);
Set<String> mentionedUsers = Extract.getMentionedUsers(modificationCheck);
//check that method doesn't modify tweets list
assertEquals(modificationCheck, Arrays.asList(timeTestTweet1, timeTestTweet2));
assertTrue(mentionedUsers.isEmpty());
}
@Test
public void testGetMentionedUsersOneMentionOneTweet() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(oneMentionTweet));
assertEquals(mentionedUsers.size(), 1);
mentionedUsers = convertLowerCase(mentionedUsers);
assertTrue(mentionedUsers.contains("bbitdiddle"));
}
@Test
public void testGetMentionedUsersTwoMentionsOneTweet() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(twoMentionsTweet));
assertEquals(mentionedUsers.size(), 2);
mentionedUsers = convertLowerCase(mentionedUsers);
assertTrue(mentionedUsers.contains("bbitdiddle"));
assertTrue(mentionedUsers.contains("alyssa"));
}
@Test
public void testGetMentionedUsersMoreThanOneTweet() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(noMentionTweet, oneMentionTweet, twoMentionsTweet));
assertEquals(mentionedUsers.size(), 2);
//also check that usernames won't be repeated if mentioned more than once
mentionedUsers = convertLowerCase(mentionedUsers);
assertTrue(mentionedUsers.contains("bbitdiddle"));
assertTrue(mentionedUsers.contains("alyssa"));
}
@Test
public void testGetMentionedUsersNoTweets() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Collections.<Tweet>emptyList());
assertTrue(mentionedUsers.isEmpty());
}
@Test
public void testGetMentionedUsersPeriodStop() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(endMentionWithCharacterTweet));
assertEquals(mentionedUsers.size(), 1);
mentionedUsers=convertLowerCase(mentionedUsers);
assertTrue(mentionedUsers.contains("bbitdiddle"));
}
@Test
public void testGetMentionedUsersWrongAt() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(invalidAtTweet));
assertTrue(mentionedUsers.isEmpty());
}
@Test
public void testGetMentionedUsersInvalidSecondCharacter() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(invalidSecondTweet));
assertEquals(mentionedUsers.size(), 1);
mentionedUsers = convertLowerCase(mentionedUsers);
assertTrue(mentionedUsers.contains("abc"));
}
@Test
public void testGetMentionedUsersOneLetterUserName() {
Set<String> mentionedUsers = Extract.getMentionedUsers(Arrays.asList(oneLetterUserNameTweet));
assertEquals(mentionedUsers.size(), 1);
mentionedUsers = convertLowerCase(mentionedUsers);
assertTrue(mentionedUsers.contains("a"));
}
}
| 8,986 | 0.68629 | 0.673492 | 226 | 38.761063 | 30.642321 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.013274 | false | false | 15 |
fabf54d0f16df299addbe5e64eee2d3eec9e8f06 | 15,015,205,712,505 | c1fb6003ca6f6280b9b102019ee1289d2f9d9ee5 | /src/main/java/com/epam/lab/task/agency/entity/User.java | 8ce8c0bdf3d9fa0a6928704fc1fe0aa5b56ba891 | []
| no_license | NameIess/travel-agency | https://github.com/NameIess/travel-agency | e0631af46e8685da5e03106a57767d1d55d347c2 | 5dd960ec536589e1b0e5c77a2a8e3d3a1a651781 | refs/heads/master | 2020-03-19T02:04:28.524000 | 2018-05-31T14:47:31 | 2018-05-31T14:47:31 | 134,885,553 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.epam.lab.task.agency.entity;
import java.util.ArrayList;
import java.util.List;
/**
* User domain entity.
*/
public class User implements Identified<Long> {
private static final long serialVersionUID = 1L;
private Long id;
private String login;
private String password;
private List<Tour> tours;
private List<Review> reviews;
/**
* Default constructor.
*/
public User() {
// Instantiates user
}
public void addTour(Tour tour) {
if (this.tours == null) {
this.tours = new ArrayList<>();
}
this.tours.add(tour);
}
public void addReview(Review review) {
if (this.reviews == null) {
this.reviews = new ArrayList<>();
}
this.reviews.add(review);
}
@Override
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public List<Tour> getTours() {
return tours;
}
public void setTours(List<Tour> tours) {
this.tours = tours;
}
public List<Review> getReviews() {
return reviews;
}
public void setReviews(List<Review> reviews) {
this.reviews = reviews;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
if (id != null ? !id.equals(user.id) : user.id != null) {
return false;
}
if (login != null ? !login.equals(user.login) : user.login != null) {
return false;
}
return password != null ? password.equals(user.password) : user.password == null;
}
@Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (login != null ? login.hashCode() : 0);
result = 31 * result + (password != null ? password.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", login='" + login + '\'' +
", password='" + password + '\'' +
'}';
}
}
| UTF-8 | Java | 2,695 | java | User.java | Java | [
{
"context": "+ login + '\\'' +\r\n \", password='\" + password + '\\'' +\r\n '}';\r\n }\r\n}\r\n",
"end": 2652,
"score": 0.9849284291267395,
"start": 2644,
"tag": "PASSWORD",
"value": "password"
}
]
| null | []
| package com.epam.lab.task.agency.entity;
import java.util.ArrayList;
import java.util.List;
/**
* User domain entity.
*/
public class User implements Identified<Long> {
private static final long serialVersionUID = 1L;
private Long id;
private String login;
private String password;
private List<Tour> tours;
private List<Review> reviews;
/**
* Default constructor.
*/
public User() {
// Instantiates user
}
public void addTour(Tour tour) {
if (this.tours == null) {
this.tours = new ArrayList<>();
}
this.tours.add(tour);
}
public void addReview(Review review) {
if (this.reviews == null) {
this.reviews = new ArrayList<>();
}
this.reviews.add(review);
}
@Override
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public List<Tour> getTours() {
return tours;
}
public void setTours(List<Tour> tours) {
this.tours = tours;
}
public List<Review> getReviews() {
return reviews;
}
public void setReviews(List<Review> reviews) {
this.reviews = reviews;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
if (id != null ? !id.equals(user.id) : user.id != null) {
return false;
}
if (login != null ? !login.equals(user.login) : user.login != null) {
return false;
}
return password != null ? password.equals(user.password) : user.password == null;
}
@Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (login != null ? login.hashCode() : 0);
result = 31 * result + (password != null ? password.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", login='" + login + '\'' +
", password='" + <PASSWORD> + '\'' +
'}';
}
}
| 2,697 | 0.49833 | 0.495362 | 119 | 20.647058 | 19.341507 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.319328 | false | false | 15 |
f9f756610bf9a19532d6f28b8b0d17e5921ce6bb | 15,015,205,712,491 | 38eb3004a35646fb0e77c859363b1267d2f58138 | /task-api-core/src/main/java/com/sogou/bizwork/task/api/core/score/bo/ScoreDetail.java | a25f2112723727e64eb6c7c2fef08ed407fc2f7d | []
| no_license | bellmit/bizwork-task | https://github.com/bellmit/bizwork-task | e2d0f6b5b80c62c6d8eb95b07f49ab0968114bd6 | 4581ba198a52c0e0c9fe15d9027f88082dcae788 | refs/heads/master | 2021-12-23T09:46:28.732000 | 2017-11-10T12:12:29 | 2017-11-10T12:12:29 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sogou.bizwork.task.api.core.score.bo;
public class ScoreDetail {
private String dateTime;
private int score;
private String reason;
public String getDateTime() {
return dateTime;
}
public void setDateTime(String dateTime) {
this.dateTime = dateTime;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
}
| UTF-8 | Java | 500 | java | ScoreDetail.java | Java | []
| null | []
| package com.sogou.bizwork.task.api.core.score.bo;
public class ScoreDetail {
private String dateTime;
private int score;
private String reason;
public String getDateTime() {
return dateTime;
}
public void setDateTime(String dateTime) {
this.dateTime = dateTime;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
}
| 500 | 0.714 | 0.714 | 26 | 18.23077 | 14.232432 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.461538 | false | false | 15 |
2df0f8330a87896cbb131b72e433ec4079e6a0ba | 18,588,618,500,384 | fcc6c7a22161c77274efdd519d8ce71b3ac8829b | /ru.jnano.math/src/ru/jnano/math/calc/diff/constrain/ConstrainException.java | 75ed3950dc57c08a2620a275c56229987d9c6b1f | []
| no_license | vitalytravin/Jnano | https://github.com/vitalytravin/Jnano | 2d4e562ba9630a94357260316dbe808f736001ca | 53ef7aab388781a7d51b93604f7be87b4b6c65fd | refs/heads/master | 2018-12-29T12:32:03.739000 | 2014-10-03T10:25:51 | 2014-10-03T10:25:51 | 16,662,518 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.jnano.math.calc.diff.constrain;
public class ConstrainException extends RuntimeException{
private ConstraintError constrain;
public ConstrainException(ConstraintError constrain) {
super();
this.constrain = constrain;
}
public ConstraintError getConstrain() {
return constrain;
}
}
| UTF-8 | Java | 327 | java | ConstrainException.java | Java | []
| null | []
| package ru.jnano.math.calc.diff.constrain;
public class ConstrainException extends RuntimeException{
private ConstraintError constrain;
public ConstrainException(ConstraintError constrain) {
super();
this.constrain = constrain;
}
public ConstraintError getConstrain() {
return constrain;
}
}
| 327 | 0.737003 | 0.737003 | 17 | 17.235294 | 20.472448 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 15 |
b03f6cec24a00b53177dc045081c6ba7284d9cd2 | 32,899,449,556,479 | 91e6989895ea7f348b72a600f112232f88ca72bf | /app/src/main/java/com/example/mihir/haloworld/Question32Activity.java | c15b70a07625c8263f0d9392e58a8972085eefb4 | []
| no_license | Alaska47/HaloWorld | https://github.com/Alaska47/HaloWorld | 28f4e0011841882b3cfedfec6c3b2d871d472798 | 3af1db10087e5e8d33b2ccc7d040cc732e1619e7 | refs/heads/master | 2021-01-13T00:46:23.973000 | 2016-02-16T21:48:25 | 2016-02-16T21:48:25 | 51,220,766 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.mihir.haloworld;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class Question32Activity extends AppCompatActivity {
private String q2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_question32);
q2 = getIntent().getExtras().getString("Q2");
}
public void nextY(View view) {
Intent i = new Intent(Question32Activity.this, ConfirmActivity.class);
i.putExtra("Q3", q2+"1");
startActivity(i);
finish();
}
public void nextN(View view) {
Intent i = new Intent(Question32Activity.this, ConfirmActivity.class);
i.putExtra("Q3", q2+"0");
startActivity(i);
finish();
}
}
| UTF-8 | Java | 883 | java | Question32Activity.java | Java | []
| null | []
| package com.example.mihir.haloworld;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class Question32Activity extends AppCompatActivity {
private String q2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_question32);
q2 = getIntent().getExtras().getString("Q2");
}
public void nextY(View view) {
Intent i = new Intent(Question32Activity.this, ConfirmActivity.class);
i.putExtra("Q3", q2+"1");
startActivity(i);
finish();
}
public void nextN(View view) {
Intent i = new Intent(Question32Activity.this, ConfirmActivity.class);
i.putExtra("Q3", q2+"0");
startActivity(i);
finish();
}
}
| 883 | 0.671574 | 0.651189 | 30 | 28.433332 | 22.207632 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.7 | false | false | 15 |
319cf8a90428035c7210d758214668ef123bf177 | 403,726,960,729 | 3b015665af0d4ff87cdd94a736c3d3d12e486f67 | /src/Servicios/Serv_Parentesco.java | 0823a9afd9dcf8726a2c3ab46c6b6c244d5e49c2 | []
| no_license | efra1/prueba_1_software2 | https://github.com/efra1/prueba_1_software2 | aea0dbcde6242ea196a95a24926b87b2fef5fb43 | 1532481737fafa2d83680052a1f4c5e24de028c0 | refs/heads/master | 2020-03-28T23:29:43.572000 | 2018-09-19T12:59:04 | 2018-09-19T12:59:04 | 149,294,030 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Servicios;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import Modelos.Especialidad;
import Modelos.Parentesco;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.stereotype.Service;
import Utiles.encriptar;
import coneccion.DB;
import herramientas.fechas;
@Service
@SuppressWarnings("deprecation")
public class Serv_Parentesco extends DB {
fechas conv = new fechas();
private class to_Object implements ParameterizedRowMapper<Parentesco>{
@Override
public Parentesco mapRow(ResultSet rs, int rows) throws SQLException {
Parentesco us = new Parentesco();
us.setCodparentesco(rs.getString("codparentesco"));
us.setCodalumno(rs.getString("codalumno"));
us.setCodapoderado(rs.getString("codapoderado"));
us.setEstado(rs.getInt("estado"));
return us;
}
}
public void adicionar(Parentesco us){
String sql = "INSERT INTO parentesco(codparentesco,codalumno,codapoderado) VALUES(?,?,?);";
db.update(sql, new Object[]{us.getCodparentesco(), us.getCodalumno(),us.getCodapoderado()});
}
public String generar_Codigo(){
int num=db.queryForObject("select count (*) from parentesco ", Integer.class);
return "PRES0001-"+num;
}
public Parentesco obtener_por_codparentesco(String codparentesco){
String sql = "SELECT * FROM parentesco WHERE codparentesco=?";
return db.queryForObject(sql, new to_Object(),codparentesco);
}
public Parentesco obtener_por_codalumno(String codparentesco){
String sql = "SELECT * FROM parentesco WHERE codalumno=?";
return db.queryForObject(sql, new to_Object(),codparentesco);
}
public List<Parentesco> listar_estado( int estado){
String sql = "SELECT * FROM parentesco where estado=?;";
return db.query(sql, new to_Object(),estado);
}
public List<Parentesco> listar( ){
String sql = "SELECT * FROM parentesco ;";
return db.query(sql, new to_Object());
}
public List<Parentesco> listaractivos(){
String sql = "SELECT * FROM parentesco where estado=1;";
return db.query(sql, new to_Object());
}
public List<Parentesco> listainactivos(){
String sql = "SELECT * FROM parentesco where estado=0;";
return db.query(sql, new to_Object());
}
public void modificar(Parentesco us){
String sql = "UPDATE parentesco SET codalumno=?,codapoderado=? WHERE codparentesco=?;";
db.update(sql, new Object[]{us.getCodalumno(),us.getCodapoderado(),us.getCodparentesco()});
}
public void borrado_log(String codparentesco){
String sql = "UPDATE parentesco SET estado=0 WHERE codparentesco=?;";
db.update(sql, codparentesco);
}
public void activar(String codparentesco){
String sql = "UPDATE parentesco SET estado=1 WHERE codparentesco=?;";
db.update(sql, codparentesco);
}
public boolean existe_grado(String codparentesco){
String sql="SELECT count(*) FROM parentesco WHERE codparentesco=?";
if(db.queryForObject(sql, Integer.class,codparentesco)>0)return true;
return false;
}
} | UTF-8 | Java | 3,094 | java | Serv_Parentesco.java | Java | []
| null | []
| package Servicios;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import Modelos.Especialidad;
import Modelos.Parentesco;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.stereotype.Service;
import Utiles.encriptar;
import coneccion.DB;
import herramientas.fechas;
@Service
@SuppressWarnings("deprecation")
public class Serv_Parentesco extends DB {
fechas conv = new fechas();
private class to_Object implements ParameterizedRowMapper<Parentesco>{
@Override
public Parentesco mapRow(ResultSet rs, int rows) throws SQLException {
Parentesco us = new Parentesco();
us.setCodparentesco(rs.getString("codparentesco"));
us.setCodalumno(rs.getString("codalumno"));
us.setCodapoderado(rs.getString("codapoderado"));
us.setEstado(rs.getInt("estado"));
return us;
}
}
public void adicionar(Parentesco us){
String sql = "INSERT INTO parentesco(codparentesco,codalumno,codapoderado) VALUES(?,?,?);";
db.update(sql, new Object[]{us.getCodparentesco(), us.getCodalumno(),us.getCodapoderado()});
}
public String generar_Codigo(){
int num=db.queryForObject("select count (*) from parentesco ", Integer.class);
return "PRES0001-"+num;
}
public Parentesco obtener_por_codparentesco(String codparentesco){
String sql = "SELECT * FROM parentesco WHERE codparentesco=?";
return db.queryForObject(sql, new to_Object(),codparentesco);
}
public Parentesco obtener_por_codalumno(String codparentesco){
String sql = "SELECT * FROM parentesco WHERE codalumno=?";
return db.queryForObject(sql, new to_Object(),codparentesco);
}
public List<Parentesco> listar_estado( int estado){
String sql = "SELECT * FROM parentesco where estado=?;";
return db.query(sql, new to_Object(),estado);
}
public List<Parentesco> listar( ){
String sql = "SELECT * FROM parentesco ;";
return db.query(sql, new to_Object());
}
public List<Parentesco> listaractivos(){
String sql = "SELECT * FROM parentesco where estado=1;";
return db.query(sql, new to_Object());
}
public List<Parentesco> listainactivos(){
String sql = "SELECT * FROM parentesco where estado=0;";
return db.query(sql, new to_Object());
}
public void modificar(Parentesco us){
String sql = "UPDATE parentesco SET codalumno=?,codapoderado=? WHERE codparentesco=?;";
db.update(sql, new Object[]{us.getCodalumno(),us.getCodapoderado(),us.getCodparentesco()});
}
public void borrado_log(String codparentesco){
String sql = "UPDATE parentesco SET estado=0 WHERE codparentesco=?;";
db.update(sql, codparentesco);
}
public void activar(String codparentesco){
String sql = "UPDATE parentesco SET estado=1 WHERE codparentesco=?;";
db.update(sql, codparentesco);
}
public boolean existe_grado(String codparentesco){
String sql="SELECT count(*) FROM parentesco WHERE codparentesco=?";
if(db.queryForObject(sql, Integer.class,codparentesco)>0)return true;
return false;
}
} | 3,094 | 0.737233 | 0.734325 | 104 | 28.759615 | 27.613575 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.961538 | false | false | 15 |
1be6a8f860b769b75bbf50a043c6ca70d1aa9236 | 7,352,984,063,386 | 6ef1a6b9c4d3ef9ca63ac7da7def95481a1e4c48 | /app/src/main/java/com/example/andy/pomo_proj/PomodoroList.java | 8822ec681ae9cdba361f99a573f302dc7c621682 | []
| no_license | techdiary/pomo-proj | https://github.com/techdiary/pomo-proj | dd974b24db609a3521ab28989dfd5c2806ad7a08 | 3d091b502b673711f20b0139e3cb4112604c52e5 | refs/heads/master | 2021-01-19T02:52:15.909000 | 2016-06-18T03:41:38 | 2016-06-18T03:41:38 | 54,181,331 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.andy.pomo_proj;
/**
* Created by Andy on 3/18/2016.
*/
import android.app.Activity;
import android.content.CursorLoader;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.app.LoaderManager;
import android.content.Loader;
import android.widget.SimpleCursorAdapter;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
/**
* The Class PomodoroList. Shows list of all pomodoros from databases.
*/
public class PomodoroList extends Activity implements OnItemClickListener, LoaderManager.LoaderCallbacks<Cursor>
{
/** The Constant NO_FLAGS. */
private static final int NO_FLAGS = 0;
/** The pomodoro list. */
private ListView pomodoroListLV;
/** The adapter. */
private SimpleCursorAdapter adapter;
/** The projection. */
String[] projection = new String[] {
PomodoroTimerDBContract.PomodorosTable.COLUMN_NAME_START_DATE,
PomodoroTimerDBContract.PomodorosTable.COLUMN_NAME_STOP_DATE,
PomodoroTimerDBContract.PomodorosTable.COLUMN_NAME_START_HOUR,
PomodoroTimerDBContract.PomodorosTable.COLUMN_NAME_STOP_HOUR,
PomodoroTimerDBContract.COLUMN_ID
};
/* (non-Javadoc)
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pomodoro_list);
pomodoroListLV = (ListView) findViewById(R.id.pomodoroList);
pomodoroListLV.setOnItemClickListener(this);
getLoaderManager().initLoader(1, null, this);
}
/* (non-Javadoc)
* @see android.widget.AdapterView.OnItemClickListener#onItemClick(android.widget.AdapterView, android.view.View, int, long)
*/
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id)
{
Intent intent = new Intent(this, PomodoroDetails.class);
intent.putExtra("dbID", id);
startActivity(intent);
}
/* (non-Javadoc)
* @see android.app.LoaderManager.LoaderCallbacks#onCreateLoader(int, android.os.Bundle)
*/
@Override
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1)
{
CursorLoader cursorLoader = new CursorLoader(this, PomodoroContentProvider.CONTENT_URI_POMODOROS, projection, null, null, PomodoroTimerDBContract.PomodorosTable._ID + " ASC");
return cursorLoader;
}
/* (non-Javadoc)
* @see android.app.LoaderManager.LoaderCallbacks#onLoadFinished(android.content.Loader, java.lang.Object)
*/
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data)
{
if(adapter == null)
{
//TODO: rebuild listlayout.xml - it's ugly
adapter = new SimpleCursorAdapter(this, R.layout.pomodoro_list_layout, data, projection, new int[] { R.id.TextView1, R.id.TextView3, R.id.TextView2, R.id.TextView4}, NO_FLAGS);
}
else
{
adapter.swapCursor(data);
}
pomodoroListLV.setAdapter(adapter);
}
/* (non-Javadoc)
* @see android.app.LoaderManager.LoaderCallbacks#onLoaderReset(android.content.Loader)
*/
@Override
public void onLoaderReset(Loader<Cursor> loader)
{
if(adapter != null)
{
adapter.swapCursor(null);
}
}
/* (non-Javadoc)
* @see android.app.Activity#onResume()
*/
@Override
protected void onResume()
{
super.onResume();
getLoaderManager().restartLoader(1, null, this);
}
//TODO: if list is empty show any statement
}
| UTF-8 | Java | 3,821 | java | PomodoroList.java | Java | [
{
"context": "age com.example.andy.pomo_proj;\n\n/**\n * Created by Andy on 3/18/2016.\n */\nimport android.app.Activity;\nim",
"end": 59,
"score": 0.998717188835144,
"start": 55,
"tag": "NAME",
"value": "Andy"
}
]
| null | []
| package com.example.andy.pomo_proj;
/**
* Created by Andy on 3/18/2016.
*/
import android.app.Activity;
import android.content.CursorLoader;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.app.LoaderManager;
import android.content.Loader;
import android.widget.SimpleCursorAdapter;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
/**
* The Class PomodoroList. Shows list of all pomodoros from databases.
*/
public class PomodoroList extends Activity implements OnItemClickListener, LoaderManager.LoaderCallbacks<Cursor>
{
/** The Constant NO_FLAGS. */
private static final int NO_FLAGS = 0;
/** The pomodoro list. */
private ListView pomodoroListLV;
/** The adapter. */
private SimpleCursorAdapter adapter;
/** The projection. */
String[] projection = new String[] {
PomodoroTimerDBContract.PomodorosTable.COLUMN_NAME_START_DATE,
PomodoroTimerDBContract.PomodorosTable.COLUMN_NAME_STOP_DATE,
PomodoroTimerDBContract.PomodorosTable.COLUMN_NAME_START_HOUR,
PomodoroTimerDBContract.PomodorosTable.COLUMN_NAME_STOP_HOUR,
PomodoroTimerDBContract.COLUMN_ID
};
/* (non-Javadoc)
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pomodoro_list);
pomodoroListLV = (ListView) findViewById(R.id.pomodoroList);
pomodoroListLV.setOnItemClickListener(this);
getLoaderManager().initLoader(1, null, this);
}
/* (non-Javadoc)
* @see android.widget.AdapterView.OnItemClickListener#onItemClick(android.widget.AdapterView, android.view.View, int, long)
*/
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id)
{
Intent intent = new Intent(this, PomodoroDetails.class);
intent.putExtra("dbID", id);
startActivity(intent);
}
/* (non-Javadoc)
* @see android.app.LoaderManager.LoaderCallbacks#onCreateLoader(int, android.os.Bundle)
*/
@Override
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1)
{
CursorLoader cursorLoader = new CursorLoader(this, PomodoroContentProvider.CONTENT_URI_POMODOROS, projection, null, null, PomodoroTimerDBContract.PomodorosTable._ID + " ASC");
return cursorLoader;
}
/* (non-Javadoc)
* @see android.app.LoaderManager.LoaderCallbacks#onLoadFinished(android.content.Loader, java.lang.Object)
*/
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data)
{
if(adapter == null)
{
//TODO: rebuild listlayout.xml - it's ugly
adapter = new SimpleCursorAdapter(this, R.layout.pomodoro_list_layout, data, projection, new int[] { R.id.TextView1, R.id.TextView3, R.id.TextView2, R.id.TextView4}, NO_FLAGS);
}
else
{
adapter.swapCursor(data);
}
pomodoroListLV.setAdapter(adapter);
}
/* (non-Javadoc)
* @see android.app.LoaderManager.LoaderCallbacks#onLoaderReset(android.content.Loader)
*/
@Override
public void onLoaderReset(Loader<Cursor> loader)
{
if(adapter != null)
{
adapter.swapCursor(null);
}
}
/* (non-Javadoc)
* @see android.app.Activity#onResume()
*/
@Override
protected void onResume()
{
super.onResume();
getLoaderManager().restartLoader(1, null, this);
}
//TODO: if list is empty show any statement
}
| 3,821 | 0.672075 | 0.667888 | 126 | 29.325397 | 33.499783 | 188 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.531746 | false | false | 15 |
95357fb30c87653cae7c7b6eee488988c32b2534 | 369,367,230,477 | be425e3b1af03694d1771776b18ac1de5c2e954b | /app/src/main/java/com/example/geek/view/WeChatView.java | 5417e3bcace4441fd0fae4b42e372b639d9a97e2 | []
| no_license | wcxsz/-1 | https://github.com/wcxsz/-1 | 4c5539453dffa09edea8ef40fd8284ffb346dba3 | cd361220b8400c7c75d0d649343cec3c7b3479c4 | refs/heads/master | 2020-05-15T22:23:07.359000 | 2019-04-21T11:39:32 | 2019-04-21T11:39:32 | 182,525,709 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.geek.view;
import com.example.geek.base.BaseMvpView;
import com.example.geek.bean.WeChatBean;
public interface WeChatView extends BaseMvpView {
void setData(WeChatBean weChatBean);
void setShiBai(String string);
void initData(WeChatBean weChatBean);
void shuo(String string);
}
| UTF-8 | Java | 319 | java | WeChatView.java | Java | []
| null | []
| package com.example.geek.view;
import com.example.geek.base.BaseMvpView;
import com.example.geek.bean.WeChatBean;
public interface WeChatView extends BaseMvpView {
void setData(WeChatBean weChatBean);
void setShiBai(String string);
void initData(WeChatBean weChatBean);
void shuo(String string);
}
| 319 | 0.768025 | 0.768025 | 14 | 21.785715 | 19.302771 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 15 |
543a3831cdd369030779f613399b4b6bdfcb40cf | 25,829,933,379,478 | 2e92d982a5a4beea9b0637dd568b9dba2c9208c7 | /order/src/main/java/com/weichuang/ecommerce/RabbitMQConfig.java | 3af58cbcbe0ab19a36ff0bd1314d6530e2c004d3 | []
| no_license | 303084687/ecommerce | https://github.com/303084687/ecommerce | 2e17c7d7b8082832da8dc6bbdc221413ab380b0d | 714661441b2cf02b9a1e5ce694a820eb0bf74bb2 | refs/heads/master | 2020-03-11T23:52:14.818000 | 2018-04-20T08:38:54 | 2018-04-20T08:38:54 | 130,334,240 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //package com.zhidian.ecommerce;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.amqp.core.AmqpAdmin;
//import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
//import org.springframework.amqp.rabbit.connection.ConnectionFactory;
//import org.springframework.amqp.rabbit.core.RabbitAdmin;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.config.ConfigurableBeanFactory;
//import org.springframework.boot.autoconfigure.amqp.RabbitProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Scope;
//
////@EnableRabbit
//@Configuration
//@SuppressWarnings("SpringJavaAutowiringInspection")
//public class RabbitMQConfig {
// private static final Logger log = LoggerFactory.getLogger(RabbitMQConfig.class);
//
// public static final String EXCHANGE = "spring-boot-exchange";
// public static final String ROUTINGKEY1 = "spring-boot-routingKey1";
// public static final String QUEUE1 = "spring-boot-queue1";
// public static final String ROUTINGKEY2 = "spring-boot-routingKey2";
// public static final String QUEUE2 = "spring-boot-queue2";
//
// @Autowired
// private RabbitProperties rabbitProperties;
//
//// @Autowired
//// private ConnectionFactory connectionFactory;
//
//
// @Bean
// public ConnectionFactory connectionFactory() {
// CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
// connectionFactory.setAddresses(rabbitProperties.getAddresses());
// connectionFactory.setUsername(rabbitProperties.getUsername());
// connectionFactory.setPassword(rabbitProperties.getPassword());
// connectionFactory.setVirtualHost(rabbitProperties.getVirtualHost());
// connectionFactory.setRequestedHeartBeat(rabbitProperties.getRequestedHeartbeat());
//// connectionFactory.setChannelCacheSize(5);
//// connectionFactory.setPublisherConfirms(true);
//// connectionFactory.setPublisherReturns(true);
// connectionFactory.setPublisherConfirms(true); //必须要设置
//
// return connectionFactory;
// }
//
// @Bean
// public AmqpAdmin amqpAdmin(ConnectionFactory connectionFactory) {
// return new RabbitAdmin(connectionFactory);
// }
//
// @Bean
// @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
// //必须是prototype类型,否则无法使用回调函数
// public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
// RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
//// rabbitTemplate.setConfirmCallback((CorrelationData correlationData, boolean ack, String cause) ->{
//// log.info("回调id:" + correlationData + ", ack:" + ack + ", cause:" + cause);
//// if (ack) {
//// log.info("消息投递成功");
//// } else {
//// log.error("消息投递失败:" + cause);
//// }
//// });
//
// return rabbitTemplate;
// }
//
//// @Bean
//// public DirectExchange defaultExchange() {
//// return new DirectExchange(EXCHANGE);
//// }
////
//// @Bean
//// public Queue queue() {
//// return new Queue(QUEUE, true); //队列持久
//// }
////
//// @Bean
//// public Binding binding() {
//// return BindingBuilder.bind(queue()).to(defaultExchange()).with(ROUTINGKEY);
//// }
//
//}
| UTF-8 | Java | 3,629 | java | RabbitMQConfig.java | Java | []
| null | []
| //package com.zhidian.ecommerce;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.amqp.core.AmqpAdmin;
//import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
//import org.springframework.amqp.rabbit.connection.ConnectionFactory;
//import org.springframework.amqp.rabbit.core.RabbitAdmin;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.config.ConfigurableBeanFactory;
//import org.springframework.boot.autoconfigure.amqp.RabbitProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Scope;
//
////@EnableRabbit
//@Configuration
//@SuppressWarnings("SpringJavaAutowiringInspection")
//public class RabbitMQConfig {
// private static final Logger log = LoggerFactory.getLogger(RabbitMQConfig.class);
//
// public static final String EXCHANGE = "spring-boot-exchange";
// public static final String ROUTINGKEY1 = "spring-boot-routingKey1";
// public static final String QUEUE1 = "spring-boot-queue1";
// public static final String ROUTINGKEY2 = "spring-boot-routingKey2";
// public static final String QUEUE2 = "spring-boot-queue2";
//
// @Autowired
// private RabbitProperties rabbitProperties;
//
//// @Autowired
//// private ConnectionFactory connectionFactory;
//
//
// @Bean
// public ConnectionFactory connectionFactory() {
// CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
// connectionFactory.setAddresses(rabbitProperties.getAddresses());
// connectionFactory.setUsername(rabbitProperties.getUsername());
// connectionFactory.setPassword(rabbitProperties.getPassword());
// connectionFactory.setVirtualHost(rabbitProperties.getVirtualHost());
// connectionFactory.setRequestedHeartBeat(rabbitProperties.getRequestedHeartbeat());
//// connectionFactory.setChannelCacheSize(5);
//// connectionFactory.setPublisherConfirms(true);
//// connectionFactory.setPublisherReturns(true);
// connectionFactory.setPublisherConfirms(true); //必须要设置
//
// return connectionFactory;
// }
//
// @Bean
// public AmqpAdmin amqpAdmin(ConnectionFactory connectionFactory) {
// return new RabbitAdmin(connectionFactory);
// }
//
// @Bean
// @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
// //必须是prototype类型,否则无法使用回调函数
// public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
// RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
//// rabbitTemplate.setConfirmCallback((CorrelationData correlationData, boolean ack, String cause) ->{
//// log.info("回调id:" + correlationData + ", ack:" + ack + ", cause:" + cause);
//// if (ack) {
//// log.info("消息投递成功");
//// } else {
//// log.error("消息投递失败:" + cause);
//// }
//// });
//
// return rabbitTemplate;
// }
//
//// @Bean
//// public DirectExchange defaultExchange() {
//// return new DirectExchange(EXCHANGE);
//// }
////
//// @Bean
//// public Queue queue() {
//// return new Queue(QUEUE, true); //队列持久
//// }
////
//// @Bean
//// public Binding binding() {
//// return BindingBuilder.bind(queue()).to(defaultExchange()).with(ROUTINGKEY);
//// }
//
//}
| 3,629 | 0.695297 | 0.692199 | 89 | 38.898876 | 29.155548 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.595506 | false | false | 15 |
521158a21075d37128990351ea8b6b9f1ea4b390 | 19,155,554,207,302 | e3ac2d5fed18f008873541fe449470c3b42f2448 | /src/main/java/zw/co/rental/app/service/UsersService.java | 84882a1591f6a17d5e50566ca29b569636a56deb | []
| no_license | knkatekwe/rental-backend | https://github.com/knkatekwe/rental-backend | 63071fc182ebec5b3554b8f8736afbbb9e76f4e3 | adf87087a8300bfab05f982d8be64d8c6834e6a1 | refs/heads/main | 2023-03-30T01:34:01.184000 | 2021-03-31T16:40:55 | 2021-03-31T16:40:55 | 347,360,627 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package zw.co.rental.app.service;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.web.multipart.MultipartFile;
import zw.co.rental.app.dto.UsersDTO;
import zw.co.rental.app.entity.User;
public interface UsersService {
public List<User> getUsers();
public User getUser(Integer userId);
public User saveUser(User usersDTO);
// public int updateProfileImage(String profileImage , int userID);
public int store(MultipartFile file, int userID , HttpSession session);
public long getTotalUsers();
public UsersDTO searchUser(String email);
}
| UTF-8 | Java | 632 | java | UsersService.java | Java | []
| null | []
| package zw.co.rental.app.service;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.web.multipart.MultipartFile;
import zw.co.rental.app.dto.UsersDTO;
import zw.co.rental.app.entity.User;
public interface UsersService {
public List<User> getUsers();
public User getUser(Integer userId);
public User saveUser(User usersDTO);
// public int updateProfileImage(String profileImage , int userID);
public int store(MultipartFile file, int userID , HttpSession session);
public long getTotalUsers();
public UsersDTO searchUser(String email);
}
| 632 | 0.735759 | 0.735759 | 28 | 21.571428 | 22.890154 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.642857 | false | false | 15 |
e4fa30bbbd4aec7c29b795cb85acfc6878e45134 | 37,357,625,547,001 | 21d831294f38f8bee9ca69cc2b148a738592fe66 | /Inheritance/src/com/goutermoutlabs/Email.java | 13addf9d89a5afd8f925f2b2bf4de6361b458194 | []
| no_license | goutern/Java-Examples | https://github.com/goutern/Java-Examples | eb8e0c1a6c39cd4f2f4105fb36afdb30b8dfdd1e | 0a94236289419141cafef24e978e4f223097543f | refs/heads/master | 2022-01-27T01:53:01.144000 | 2019-07-31T01:40:57 | 2019-07-31T01:40:57 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.goutermoutlabs;
public class Email extends Document {
private String sender;
private String receiver;
private String title;
//Constuctors
public Email() {
}
;
public Email(String text, String s, String r, String t) {
this.setText(text);
this.sender = s;
this.receiver = r;
this.title = t;
}
public Email(Email e) {
this.setText(e.getText());
this.sender = e.sender;
this.receiver = e.receiver;
this.title = e.title;
}
public String getText() {
return super.toString();
}
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public String getReceiver() {
return receiver;
}
public void setReceiver(String receiver) {
this.receiver = receiver;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
return "com.goutermoutlabs.Email{" +
"sender='" + sender + '\'' +
", receiver='" + receiver + '\'' +
", title='" + title + '\'' +
", text='" + getText() + '\'' +
'}';
}
}
| UTF-8 | Java | 1,355 | java | Email.java | Java | []
| null | []
| package com.goutermoutlabs;
public class Email extends Document {
private String sender;
private String receiver;
private String title;
//Constuctors
public Email() {
}
;
public Email(String text, String s, String r, String t) {
this.setText(text);
this.sender = s;
this.receiver = r;
this.title = t;
}
public Email(Email e) {
this.setText(e.getText());
this.sender = e.sender;
this.receiver = e.receiver;
this.title = e.title;
}
public String getText() {
return super.toString();
}
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public String getReceiver() {
return receiver;
}
public void setReceiver(String receiver) {
this.receiver = receiver;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
return "com.goutermoutlabs.Email{" +
"sender='" + sender + '\'' +
", receiver='" + receiver + '\'' +
", title='" + title + '\'' +
", text='" + getText() + '\'' +
'}';
}
}
| 1,355 | 0.519557 | 0.519557 | 66 | 19.530304 | 16.321783 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.409091 | false | false | 15 |
76b63d6c89172d18f1854fe0c87f77456685a2c3 | 35,107,062,704,379 | ba84fb730376946807c97685d80c20c27467ded0 | /src/test/java/com/springframework/converters/NotesToCommandTest.java | 932c263587d2a20e3fbb54bc3a8f19a8a37fad2a | []
| no_license | dgizer/spring-recipe-mongo | https://github.com/dgizer/spring-recipe-mongo | 85c739544b871543674422c240ae776b1c7f9249 | b65a656c112c4164e4e7d07c58363a0a61f84cde | refs/heads/main | 2023-03-07T09:04:18.665000 | 2021-02-20T23:13:42 | 2021-02-20T23:13:42 | 340,516,067 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.springframework.converters;
import com.springframework.commands.NotesCommand;
import com.springframework.domain.Notes;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.jupiter.api.Assertions.*;
class NotesToCommandTest {
public static final String ID = "1L";
public static final String RECIPE_NOTES = "Notes";
NotesToCommand converter;
@BeforeEach
void setUp() {
converter = new NotesToCommand();
}
@Test
void testNullParam() {
assertNull(converter.convert(null));
}
@Test
void testEmptyParam() {
assertNotNull(converter.convert(new Notes()));
assertThat(converter.convert(new Notes()),instanceOf(NotesCommand.class));
}
@Test
void convert() {
//given
Notes notes = new Notes();
notes.setId(ID);
notes.setRecipeNotes(RECIPE_NOTES);
//when
NotesCommand command = converter.convert(notes);
//then
assertNotNull(command);
assertEquals(ID, command.getId());
assertEquals(RECIPE_NOTES,command.getRecipeNotes());
}
} | UTF-8 | Java | 1,256 | java | NotesToCommandTest.java | Java | []
| null | []
| package com.springframework.converters;
import com.springframework.commands.NotesCommand;
import com.springframework.domain.Notes;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.jupiter.api.Assertions.*;
class NotesToCommandTest {
public static final String ID = "1L";
public static final String RECIPE_NOTES = "Notes";
NotesToCommand converter;
@BeforeEach
void setUp() {
converter = new NotesToCommand();
}
@Test
void testNullParam() {
assertNull(converter.convert(null));
}
@Test
void testEmptyParam() {
assertNotNull(converter.convert(new Notes()));
assertThat(converter.convert(new Notes()),instanceOf(NotesCommand.class));
}
@Test
void convert() {
//given
Notes notes = new Notes();
notes.setId(ID);
notes.setRecipeNotes(RECIPE_NOTES);
//when
NotesCommand command = converter.convert(notes);
//then
assertNotNull(command);
assertEquals(ID, command.getId());
assertEquals(RECIPE_NOTES,command.getRecipeNotes());
}
} | 1,256 | 0.675955 | 0.675159 | 49 | 24.653061 | 20.966009 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.510204 | false | false | 15 |
94865214a9e5cf6c7eae4a1ec1221d5412fdcc47 | 37,142,877,185,882 | ed6f4e9265fe6992bc93cadc05a696a221b3cd45 | /src/main/java/software/DeveloperSoftware.java | 984c9e6855b3e446c19e60a0a77f6a4faeaaf1f3 | []
| no_license | mezeia77/training-solutions | https://github.com/mezeia77/training-solutions | 46b01f761ac9fae2d3b2224aa952e3c36034d9f8 | fdf99495f18ef1771e6a0d4188edd35642ce248e | refs/heads/master | 2023-06-24T15:03:05.043000 | 2021-06-25T18:14:00 | 2021-06-25T18:14:00 | 308,588,076 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package software;
public class DeveloperSoftware extends Software{
public DeveloperSoftware(String name, int price) {
super(name, price);
}
@Override
public double increasePrice() {
return super.increasePrice();
}
}
| UTF-8 | Java | 255 | java | DeveloperSoftware.java | Java | []
| null | []
| package software;
public class DeveloperSoftware extends Software{
public DeveloperSoftware(String name, int price) {
super(name, price);
}
@Override
public double increasePrice() {
return super.increasePrice();
}
}
| 255 | 0.666667 | 0.666667 | 13 | 18.615385 | 18.702276 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 15 |
7df3152b17f342eb10e18d057155f32b64e5f49e | 37,142,877,185,485 | b67cf468a65e66649bdea0a26e18deb05ab2778d | /Advanced Wars Simple SLG/src/Canvas/Menu/ActionMenu.java | 7127b4c3aed748541e3e335e4bc916b1358a4d28 | []
| no_license | lrscy/Design-Pattern-Homework | https://github.com/lrscy/Design-Pattern-Homework | 578ca4dfb964e18d4fbebba9630a15a0f5889314 | f2e8a9861fe221095e23623e90a7fc6844b32b83 | refs/heads/master | 2021-01-21T13:48:04.328000 | 2017-08-08T10:30:26 | 2017-08-08T10:30:26 | 54,373,467 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Canvas.Menu;
import Global.BaseDraw;
import Canvas.TextObject;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
/**
* Description: 动作菜单 在点击火力单元时出现在火力单元右侧
*/
public class ActionMenu extends BaseDraw {
private TextObject[] textObjects;
private Paint color = Color.BLACK;
private OnMenuItemClickListener onMenuItemClickListener;
public ActionMenu( String[] strs, int width, int height ) {
setWidth( width );
setHeight( height );
textObjects = new TextObject[strs.length];
for( int i = 0; i < textObjects.length; ++i ) {
textObjects[i] = new TextObject();
textObjects[i].setText( strs[i] );
textObjects[i].setColor( Color.WHITE );
textObjects[i].setFontSize( 16 );
}
}
public void onMousePressed( MouseEvent e ) {
if( onMenuItemClickListener != null ) {
for( int i = 0; i < textObjects.length; ++i ) {
if( textObjects[i].isIn( ( int )e.getX(), ( int )e.getY() ) ) {
onMenuItemClickListener.onMenuItemClick( i );
}
}
}
}
@Override
public void draw( GraphicsContext gc ) {
gc.save();
gc.setGlobalAlpha( 0.8f );
gc.setStroke( color );
gc.fillRect( position.getY() * 32 + 32, position.getX() * 32, width, height );
for( int i = 0; i < textObjects.length; ++i ) {
textObjects[i].setX( getY() * 32 + 32 + ( getWidth() - textObjects[i].getWidth() ) / 2 );
int spaceLine = 5;
textObjects[i].setY( getX() * 32 + spaceLine * ( i + 1 ) + textObjects[i].getHeight() * ( i + 1 ) );
textObjects[i].draw( gc );
}
gc.restore();
}
public TextObject[] getTextObjects() { return textObjects; }
public void setOnMenuItemClickListener( OnMenuItemClickListener onMenuItemClickListener ) {
this.onMenuItemClickListener = onMenuItemClickListener;
}
public interface OnMenuItemClickListener {
void onMenuItemClick( int index );
}
}
| UTF-8 | Java | 2,223 | java | ActionMenu.java | Java | []
| null | []
| package Canvas.Menu;
import Global.BaseDraw;
import Canvas.TextObject;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
/**
* Description: 动作菜单 在点击火力单元时出现在火力单元右侧
*/
public class ActionMenu extends BaseDraw {
private TextObject[] textObjects;
private Paint color = Color.BLACK;
private OnMenuItemClickListener onMenuItemClickListener;
public ActionMenu( String[] strs, int width, int height ) {
setWidth( width );
setHeight( height );
textObjects = new TextObject[strs.length];
for( int i = 0; i < textObjects.length; ++i ) {
textObjects[i] = new TextObject();
textObjects[i].setText( strs[i] );
textObjects[i].setColor( Color.WHITE );
textObjects[i].setFontSize( 16 );
}
}
public void onMousePressed( MouseEvent e ) {
if( onMenuItemClickListener != null ) {
for( int i = 0; i < textObjects.length; ++i ) {
if( textObjects[i].isIn( ( int )e.getX(), ( int )e.getY() ) ) {
onMenuItemClickListener.onMenuItemClick( i );
}
}
}
}
@Override
public void draw( GraphicsContext gc ) {
gc.save();
gc.setGlobalAlpha( 0.8f );
gc.setStroke( color );
gc.fillRect( position.getY() * 32 + 32, position.getX() * 32, width, height );
for( int i = 0; i < textObjects.length; ++i ) {
textObjects[i].setX( getY() * 32 + 32 + ( getWidth() - textObjects[i].getWidth() ) / 2 );
int spaceLine = 5;
textObjects[i].setY( getX() * 32 + spaceLine * ( i + 1 ) + textObjects[i].getHeight() * ( i + 1 ) );
textObjects[i].draw( gc );
}
gc.restore();
}
public TextObject[] getTextObjects() { return textObjects; }
public void setOnMenuItemClickListener( OnMenuItemClickListener onMenuItemClickListener ) {
this.onMenuItemClickListener = onMenuItemClickListener;
}
public interface OnMenuItemClickListener {
void onMenuItemClick( int index );
}
}
| 2,223 | 0.600642 | 0.590096 | 65 | 32.553844 | 27.197302 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.646154 | false | false | 15 |
caa251b5db3eb2cbf604f807b668b0b56dee6024 | 9,612,136,851,405 | 48ad15057ee5ea34981c4dfb147c6db636882b69 | /Bank_Management_System/src/MyPage.java | 5fae168671f1161f2a545ebbdbd86d9202df33ee | []
| no_license | vaibhav-karnwal/Bank-Management-System-By-Vaibhav-Karnwal | https://github.com/vaibhav-karnwal/Bank-Management-System-By-Vaibhav-Karnwal | bd88aae589335c7bb8166bb071690821f02f5a7c | 9c8b08f074640a97240bf6748383692982ecf914 | refs/heads/master | 2022-12-09T10:20:55.896000 | 2020-09-29T09:07:22 | 2020-09-29T09:07:22 | 299,557,997 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.sql.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
/*
* 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 Er Vaibhav Karnwal
*/
import java.util.*;
import net.proteanit.sql.DbUtils;
public class MyPage extends javax.swing.JFrame {
Connection conn;
ResultSet rs;
PreparedStatement pst;
/**
* Creates new form MyPage
*/
public MyPage() {
super("Karnwal Bank Home Page");
initComponents();
conn=javaconnect.ConnecrDb();
setLocation(280,80);
calendar();
Account();
Table1();
Table2();
}
public void Table1(){
try{
String sql="select Acc,Name,Dob,Acc_type,Gender,Mob from Account";
pst=conn.prepareStatement(sql);
rs=pst.executeQuery();
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}
public void Table2(){
try{
String sql="select Acc,Name,MICR_No,Balance from Balances";
pst=conn.prepareStatement(sql);
rs=pst.executeQuery();
jTable2.setModel(DbUtils.resultSetToTableModel(rs));
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}
public void calendar(){
Calendar cal=new GregorianCalendar();
int month=cal.get(Calendar.MONTH);
int year=cal.get(Calendar.YEAR);
int day=cal.get(Calendar.DAY_OF_MONTH);
jTextField2.setText(+day+"-"+(month+1)+"-"+year);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel2 = new javax.swing.JPanel();
jPanel12 = new javax.swing.JPanel();
jTextField13 = new javax.swing.JTextField();
jLabel16 = new javax.swing.JLabel();
jTextField15 = new javax.swing.JTextField();
jTextField17 = new javax.swing.JTextField();
jTextField18 = new javax.swing.JTextField();
jButton4 = new javax.swing.JButton();
jLabel17 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jTextField14 = new javax.swing.JTextField();
jTextField16 = new javax.swing.JTextField();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
jPanel13 = new javax.swing.JPanel();
jTextField30 = new javax.swing.JTextField();
jLabel28 = new javax.swing.JLabel();
jTextField29 = new javax.swing.JTextField();
jTextField28 = new javax.swing.JTextField();
jTextField31 = new javax.swing.JTextField();
jTextField27 = new javax.swing.JTextField();
jLabel30 = new javax.swing.JLabel();
jLabel27 = new javax.swing.JLabel();
jButton12 = new javax.swing.JButton();
jLabel29 = new javax.swing.JLabel();
jLabel25 = new javax.swing.JLabel();
jButton13 = new javax.swing.JButton();
jTextField32 = new javax.swing.JTextField();
jLabel26 = new javax.swing.JLabel();
jButton11 = new javax.swing.JButton();
jPanel6 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jPanel5 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
jTable2 = new javax.swing.JTable();
jPanel7 = new javax.swing.JPanel();
jPanel14 = new javax.swing.JPanel();
jTextField33 = new javax.swing.JTextField();
jTextField34 = new javax.swing.JTextField();
jLabel39 = new javax.swing.JLabel();
jButton14 = new javax.swing.JButton();
jLabel40 = new javax.swing.JLabel();
jButton15 = new javax.swing.JButton();
jPanel8 = new javax.swing.JPanel();
jPanel15 = new javax.swing.JPanel();
jTextField36 = new javax.swing.JTextField();
jLabel41 = new javax.swing.JLabel();
jLabel43 = new javax.swing.JLabel();
jLabel44 = new javax.swing.JLabel();
jLabel42 = new javax.swing.JLabel();
jLabel47 = new javax.swing.JLabel();
jTextField40 = new javax.swing.JTextField();
jTextField35 = new javax.swing.JTextField();
jTextField37 = new javax.swing.JTextField();
jLabel45 = new javax.swing.JLabel();
jLabel46 = new javax.swing.JLabel();
jLabel48 = new javax.swing.JLabel();
jTextField41 = new javax.swing.JTextField();
jTextField42 = new javax.swing.JTextField();
jTextField39 = new javax.swing.JTextField();
jButton16 = new javax.swing.JButton();
jTextField38 = new javax.swing.JTextField();
jPanel9 = new javax.swing.JPanel();
jLabel31 = new javax.swing.JLabel();
jPanel10 = new javax.swing.JPanel();
jLabel35 = new javax.swing.JLabel();
jLabel36 = new javax.swing.JLabel();
jLabel32 = new javax.swing.JLabel();
jLabel37 = new javax.swing.JLabel();
jLabel33 = new javax.swing.JLabel();
jLabel34 = new javax.swing.JLabel();
jLabel38 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jPanel16 = new javax.swing.JPanel();
jTextField8 = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jTextField6 = new javax.swing.JTextField();
jTextField9 = new javax.swing.JTextField();
jLabel12 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jTextField7 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jTextField5 = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
jTextField11 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jTextField10 = new javax.swing.JTextField();
jTextField12 = new javax.swing.JTextField();
jPanel3 = new javax.swing.JPanel();
jPanel11 = new javax.swing.JPanel();
jTextField21 = new javax.swing.JTextField();
jTextField25 = new javax.swing.JTextField();
jLabel19 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox<>();
jTextField24 = new javax.swing.JTextField();
jTextField20 = new javax.swing.JTextField();
jTextField22 = new javax.swing.JTextField();
jButton10 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jLabel20 = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
jTextField23 = new javax.swing.JTextField();
jLabel23 = new javax.swing.JLabel();
jLabel24 = new javax.swing.JLabel();
jTextField19 = new javax.swing.JTextField();
jButton9 = new javax.swing.JButton();
jTextField26 = new javax.swing.JTextField();
jLabel21 = new javax.swing.JLabel();
jButton7 = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Desktop\\kar.jpg")); // NOI18N
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel2.setText("User");
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel3.setText("Date");
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1ActionPerformed(evt);
}
});
jTextField2.setEditable(false);
jTabbedPane1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 3));
jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jTextField13.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel16.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel16.setText("Account No.");
jTextField15.setEditable(false);
jTextField15.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField15.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField15ActionPerformed(evt);
}
});
jTextField17.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField18.setEditable(false);
jTextField18.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton4.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\search.gif")); // NOI18N
jButton4.setText("Search");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jLabel17.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel17.setText("Available Balance");
jLabel18.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel18.setText("Deposit Amount");
jTextField14.setEditable(false);
jTextField14.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField16.setEditable(false);
jTextField16.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton5.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton5.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\ok.gif")); // NOI18N
jButton5.setText("Total");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jButton6.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton6.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\ok.gif")); // NOI18N
jButton6.setText("Deposit");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jLabel14.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel14.setText("User");
jLabel15.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel15.setText("Name");
javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
jPanel12.setLayout(jPanel12Layout);
jPanel12Layout.setHorizontalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel18)
.addComponent(jLabel15)
.addComponent(jLabel14)
.addComponent(jLabel16)
.addComponent(jLabel17))
.addGap(68, 127, Short.MAX_VALUE)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField14, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField15, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField16, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField13, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(45, 45, 45)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 263, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton6)
.addGap(165, 165, 165)))
.addContainerGap())
);
jPanel12Layout.setVerticalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4)
.addComponent(jLabel14))
.addGap(18, 18, 18)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel15))
.addGap(20, 20, 20)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel16)
.addComponent(jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(29, 29, 29)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel17)
.addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel18)
.addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton6)
.addContainerGap())
);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(53, 53, 53)
.addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(54, 54, 54))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(26, 26, 26)
.addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(37, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Deposit", jPanel2);
jPanel4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jTextField30.setEditable(false);
jLabel28.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel28.setText("Available Balance");
jTextField29.setEditable(false);
jTextField28.setEditable(false);
jLabel30.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel30.setText("Total");
jLabel27.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel27.setText("Account No.");
jButton12.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton12.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\ok.gif")); // NOI18N
jButton12.setText("Show");
jButton12.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton12ActionPerformed(evt);
}
});
jLabel29.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel29.setText("Amount");
jLabel25.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel25.setText("User");
jButton13.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton13.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\minus.gif")); // NOI18N
jButton13.setText("Withdrawl");
jButton13.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton13ActionPerformed(evt);
}
});
jLabel26.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel26.setText("Name");
jButton11.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton11.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\search.gif")); // NOI18N
jButton11.setText("Search");
jButton11.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton11ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
jPanel13.setLayout(jPanel13Layout);
jPanel13Layout.setHorizontalGroup(
jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel13Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel13Layout.createSequentialGroup()
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel28)
.addComponent(jLabel25, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel26, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel27, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel29, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel30, javax.swing.GroupLayout.Alignment.LEADING))
.addGap(38, 38, 38)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField28, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField29, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField30, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel13Layout.createSequentialGroup()
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField27, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField31)
.addComponent(jTextField32, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(30, 30, 30)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jButton12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton11)))))
.addGroup(jPanel13Layout.createSequentialGroup()
.addGap(148, 148, 148)
.addComponent(jButton13)))
.addContainerGap())
);
jPanel13Layout.setVerticalGroup(
jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel13Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel25)
.addComponent(jTextField27, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton11))
.addGap(18, 18, 18)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel26)
.addComponent(jTextField28, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel27)
.addComponent(jTextField29, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel28)
.addComponent(jTextField30, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel29)
.addComponent(jTextField31, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel30)
.addComponent(jTextField32, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton12))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton13)
.addContainerGap())
);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(98, 98, 98)
.addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(127, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(30, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Withdrawl", jPanel4);
jPanel6.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(jTable1);
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 608, Short.MAX_VALUE)
.addContainerGap())
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE)
.addContainerGap())
);
jTabbedPane1.addTab("Customer List", jPanel6);
jPanel5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jTable2.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane2.setViewportView(jTable2);
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 608, Short.MAX_VALUE)
.addContainerGap())
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE)
.addContainerGap())
);
jTabbedPane1.addTab("Transaction", jPanel5);
jPanel7.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jLabel39.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel39.setText("Enter Old Pin");
jButton14.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton14.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\grid_update.png")); // NOI18N
jButton14.setText("Change");
jButton14.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton14ActionPerformed(evt);
}
});
jLabel40.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel40.setText("Enter New Pin");
jButton15.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton15.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\Actions-edit-clear-icon.png")); // NOI18N
jButton15.setText("Clear");
jButton15.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton15ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
jPanel14.setLayout(jPanel14Layout);
jPanel14Layout.setHorizontalGroup(
jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel14Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel40, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel39, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(42, 42, 42)
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel14Layout.createSequentialGroup()
.addComponent(jButton14)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton15))
.addComponent(jTextField34)
.addComponent(jTextField33))
.addContainerGap())
);
jPanel14Layout.setVerticalGroup(
jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel14Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel39)
.addComponent(jTextField33, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(45, 45, 45)
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel40)
.addComponent(jTextField34, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(41, 41, 41)
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton14)
.addComponent(jButton15))
.addContainerGap())
);
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(149, 149, 149)
.addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(154, Short.MAX_VALUE))
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(64, 64, 64)
.addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(84, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Change Pin", jPanel7);
jPanel8.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jTextField36.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel41.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel41.setText("User");
jLabel43.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel43.setText("Account No.");
jLabel44.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel44.setText("MICR No.");
jLabel42.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel42.setText("Name");
jLabel47.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel47.setText("Mod Balance");
jTextField40.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField35.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField37.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel45.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel45.setText("Rate of Interest(%)");
jLabel46.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel46.setText("Available Balance");
jLabel48.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel48.setText("Nomination Registered");
jTextField41.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField42.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField39.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton16.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton16.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\search.gif")); // NOI18N
jButton16.setText("Search");
jButton16.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton16ActionPerformed(evt);
}
});
jTextField38.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
jPanel15.setLayout(jPanel15Layout);
jPanel15Layout.setHorizontalGroup(
jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel15Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel15Layout.createSequentialGroup()
.addGap(108, 108, 108)
.addComponent(jLabel41)
.addGap(49, 49, 49)
.addComponent(jTextField35, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton16))
.addGroup(jPanel15Layout.createSequentialGroup()
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel42)
.addComponent(jLabel43)
.addComponent(jLabel44)
.addComponent(jLabel48))
.addGap(49, 49, 49)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField37)
.addComponent(jTextField38)
.addComponent(jTextField36)
.addComponent(jTextField42, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE))
.addGap(38, 38, 38)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel46)
.addComponent(jLabel47)
.addComponent(jLabel45))
.addGap(26, 26, 26)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField39)
.addComponent(jTextField40)
.addComponent(jTextField41, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE))))
.addContainerGap())
);
jPanel15Layout.setVerticalGroup(
jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel15Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel41)
.addComponent(jTextField35, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton16))
.addGap(26, 26, 26)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel42)
.addComponent(jTextField36, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel45)
.addComponent(jTextField39, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(30, 30, 30)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel43)
.addComponent(jTextField37, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel46)
.addComponent(jTextField40, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(32, 32, 32)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel44)
.addComponent(jTextField38, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel47)
.addComponent(jTextField41, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(29, 29, 29)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel48)
.addComponent(jTextField42, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jPanel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(21, 21, 21))
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(48, Short.MAX_VALUE))
);
jTabbedPane1.addTab("View Balance", jPanel8);
jPanel9.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jLabel31.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\IMG_20200215_190546_740.jpg")); // NOI18N
jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2), "Vaibhav Karnwal", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 18), new java.awt.Color(0, 102, 102))); // NOI18N
jLabel35.setForeground(new java.awt.Color(153, 0, 0));
jLabel35.setText("- vaibhavkarnwal2812");
jLabel36.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel36.setText("Youtube");
jLabel32.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel32.setText("Linkedin");
jLabel37.setForeground(new java.awt.Color(153, 0, 0));
jLabel37.setText("- youtube.com/c/itsmevaibhavkarnwal");
jLabel33.setForeground(new java.awt.Color(153, 0, 0));
jLabel33.setText("- linkedin.com/in/vaibhav-karnwal");
jLabel34.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel34.setText("Instagram");
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
jPanel10.setLayout(jPanel10Layout);
jPanel10Layout.setHorizontalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel36, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel34, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel32, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel37, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel35, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel33, javax.swing.GroupLayout.Alignment.LEADING))
.addContainerGap())
);
jPanel10Layout.setVerticalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel32)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(13, 13, 13)
.addComponent(jLabel34)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel35)
.addGap(18, 18, 18)
.addComponent(jLabel36)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel37)
.addContainerGap())
);
jLabel38.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
jLabel38.setText("KARNWAL BANK V 1.0");
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(56, 56, 56)
.addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 137, Short.MAX_VALUE)
.addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(60, 60, 60))
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(196, 196, 196)
.addComponent(jLabel38)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addContainerGap(23, Short.MAX_VALUE)
.addComponent(jLabel38)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(jLabel31)
.addContainerGap(66, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(46, 46, 46))))
);
jTabbedPane1.addTab("About", jPanel9);
jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 153), 2));
jTextField8.setEditable(false);
jTextField8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel9.setText("Account No.");
jLabel13.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel13.setText("Sequrity Question");
jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel8.setText("Address");
jTextField6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField9.setEditable(false);
jTextField9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel12.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel12.setText("Mobile");
jTextField3.setEditable(false);
jTextField3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField4.setEditable(false);
jTextField4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel6.setText("Religion");
jTextField11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel4.setText("Name");
jButton2.setText("Edit");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("Save");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel5.setText("Date of Birth");
jLabel11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel11.setText("Caste");
jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel7.setText("Gender");
jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel10.setText("Account Type");
jTextField10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField12.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16);
jPanel16.setLayout(jPanel16Layout);
jPanel16Layout.setHorizontalGroup(
jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel16Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING))
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel8))
.addGap(22, 22, 22)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField4)
.addComponent(jTextField5)
.addComponent(jTextField6)
.addComponent(jTextField7)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(31, 31, 31)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel16Layout.createSequentialGroup()
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9)
.addComponent(jLabel10)
.addComponent(jLabel11)
.addComponent(jLabel12))
.addGap(31, 31, 31)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField8)
.addComponent(jTextField9)
.addComponent(jTextField10)
.addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel16Layout.createSequentialGroup()
.addComponent(jLabel13)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel16Layout.createSequentialGroup()
.addComponent(jButton2)
.addGap(18, 18, 18)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jPanel16Layout.setVerticalGroup(
jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel16Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel4)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9)
.addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(24, 24, 24)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel10)
.addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11)
.addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(22, 22, 22)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel12)
.addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(29, 29, 29)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel13)
.addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2)
.addComponent(jButton3))
.addContainerGap())
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(45, 45, 45)
.addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(51, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(26, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Profile", jPanel1);
jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jTextField21.setEditable(false);
jTextField25.setEditable(false);
jLabel19.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel19.setText("User");
jComboBox1.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
}
public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {
jComboBox1PopupMenuWillBecomeInvisible(evt);
}
public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {
}
});
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox1ActionPerformed(evt);
}
});
jTextField24.setEditable(false);
jTextField20.setEditable(false);
jTextField22.setEditable(false);
jTextField22.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField22ActionPerformed(evt);
}
});
jButton10.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton10.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\ok.gif")); // NOI18N
jButton10.setText("Transfer");
jButton10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton10ActionPerformed(evt);
}
});
jButton8.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton8.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\ok.gif")); // NOI18N
jButton8.setText("Total");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
jLabel20.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel20.setText("Name");
jLabel22.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel22.setText("Available Balance");
jLabel23.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel23.setText("Transfer Amount");
jLabel24.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel24.setText("Credit Account");
jButton9.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton9.setText("Show");
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
jTextField26.setEditable(false);
jLabel21.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel21.setText("Account No.");
jButton7.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton7.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\search.gif")); // NOI18N
jButton7.setText("Search");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
jPanel11.setLayout(jPanel11Layout);
jPanel11Layout.setHorizontalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel24)
.addComponent(jLabel23)
.addComponent(jLabel19)
.addComponent(jLabel20)
.addComponent(jLabel21)
.addComponent(jLabel22))
.addGap(56, 56, 56)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addComponent(jButton9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 117, Short.MAX_VALUE)
.addComponent(jButton10)
.addGap(18, 18, 18))
.addComponent(jTextField20, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField21, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField22, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel11Layout.createSequentialGroup()
.addComponent(jTextField23, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField24, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField19, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton7)
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel11Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField25, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField26, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap())
);
jPanel11Layout.setVerticalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton7)
.addComponent(jLabel19))
.addGap(19, 19, 19)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel20))
.addGap(17, 17, 17)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel21))
.addGap(15, 15, 15)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel22))
.addGap(18, 18, 18)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton8)
.addComponent(jLabel23))
.addGap(18, 18, 18)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField26, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel24))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton10)
.addComponent(jButton9))
.addContainerGap())
);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(55, 55, 55)
.addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(119, 119, 119))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(36, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Transfer", jPanel3);
jButton1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Er Vaibhav Karnwal\\Desktop\\Eye-2-icon-1.png")); // NOI18N
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 183, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField2))
.addGap(15, 15, 15))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(11, 11, 11)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jLabel1))
.addGap(18, 18, 18)
.addComponent(jTabbedPane1)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
String sql="select * from Account where Name=?";
try{
pst=conn.prepareStatement(sql);
pst.setString(1,jTextField1.getText());
rs=pst.executeQuery();
if(rs.next()){
String add1=rs.getString("Name");
jTextField3.setText(add1);
String add2=rs.getString("Acc");
jTextField8.setText(add2);
String add3=rs.getString("Dob");
jTextField4.setText(add3);
String add4=rs.getString("Acc_type");
jTextField9.setText(add4);
String add5=rs.getString("Religion");
jTextField5.setText(add5);
String add6=rs.getString("Caste");
jTextField10.setText(add6);
String add7=rs.getString("Gender");
jTextField6.setText(add7);
String add8=rs.getString("Mob");
jTextField11.setText(add8);
String add9=rs.getString("Address");
jTextField7.setText(add9);
String add10=rs.getString("Sec_Q");
jTextField12.setText(add10);
rs.close();
pst.close();
}
else{
JOptionPane.showMessageDialog(null, "Enter Correct Name");
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
jTextField5.setEditable(true);
jTextField6.setEditable(true);
jTextField7.setEditable(true);
jTextField10.setEditable(true);
jTextField11.setEditable(true);
jTextField12.setEditable(true);
}//GEN-LAST:event_jButton2ActionPerformed
private void jTextField15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField15ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField15ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
// TODO add your handling code here:
try{
String s1=jTextField16.getText();
String s2=jTextField17.getText();
int sum=Integer.parseInt(s1)+Integer.parseInt(s2);
String sum1=String.valueOf(sum);
jTextField18.setText(sum1);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
try{
String value1=jTextField5.getText();
String value2=jTextField6.getText();
String value3=jTextField7.getText();
String value4=jTextField10.getText();
String value5=jTextField11.getText();
String value6=jTextField12.getText();
String value7=jTextField1.getText();
String sql="update Account set Religion='"+value1+"',Gender='"+value2+"',Address='"+value3+"',Caste='"+value4+"',Mob='"+value5+"',Sec_Q='"+value6+"' where Name='"+value7+"'";
pst=conn.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(null, "Profile Updated");
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:
String sql="select * from Balances where Name=?";
try{
pst=conn.prepareStatement(sql);
pst.setString(1, jTextField13.getText());
rs=pst.executeQuery();
if(rs.next()){
String add1=rs.getString("Name");
jTextField14.setText(add1);
String add2=rs.getString("Acc");
jTextField15.setText(add2);
String add3=rs.getString("Balance");
jTextField16.setText(add3);
rs.close();
pst.close();
}else{
JOptionPane.showMessageDialog(null, "Enter Correct Name");
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
// TODO add your handling code here:
try{
String value1=jTextField13.getText();
String value2=jTextField18.getText();
String sql="update Balances set Balance='"+value2+"' where Name='"+value1+"'";
pst=conn.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(null, "Successfully Deposited");
jTextField13.setText("");
jTextField14.setText("");
jTextField15.setText("");
jTextField16.setText("");
jTextField17.setText("");
jTextField18.setText("");
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton6ActionPerformed
private void jTextField22ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField22ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField22ActionPerformed
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
// TODO add your handling code here:
try{
String s1=jTextField22.getText();
String s2=jTextField23.getText();
int sum=Integer.parseInt(s1)+Integer.parseInt(s2);
String sum1=String.valueOf(sum);
jTextField24.setText(sum1);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton8ActionPerformed
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
// TODO add your handling code here:
String sql="select * from Balances where Name=?";
try{
pst=conn.prepareStatement(sql);
pst.setString(1, jTextField19.getText());
rs=pst.executeQuery();
if(rs.next()){
String add1=rs.getString("Name");
jTextField20.setText(add1);
String add2=rs.getString("Acc");
jTextField21.setText(add2);
String add3=rs.getString("Balance");
jTextField22.setText(add3);
rs.close();
pst.close();
}else{
JOptionPane.showMessageDialog(null, "Enter Correct Name");
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}//GEN-LAST:event_jButton7ActionPerformed
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
// TODO add your handling code here:
try{
String s1=jTextField23.getText();
String s2=jTextField25.getText();
int sum=Integer.parseInt(s1)+Integer.parseInt(s2);
String sum1=String.valueOf(sum);
jTextField26.setText(sum1);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton9ActionPerformed
public void Account(){
try{
String sql="select * from Balances";
pst=conn.prepareStatement(sql);
rs=pst.executeQuery();
while(rs.next()){
String account=rs.getString("Acc");
jComboBox1.addItem(account);
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}
private void jComboBox1PopupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jComboBox1PopupMenuWillBecomeInvisible
// TODO add your handling code here:
try{
String s1=(String) jComboBox1.getSelectedItem();
String sql="select * from Balances where Acc=?";
pst=conn.prepareStatement(sql);
pst.setString(1,s1);
rs=pst.executeQuery();
if(rs.next()){
String add=rs.getString("Balance");
jTextField25.setText(add);
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jComboBox1PopupMenuWillBecomeInvisible
private void TransferC(){
try{
String value1=(String)jComboBox1.getSelectedItem();
String value2=jTextField26.getText();
String sql="update Balances set Balance='"+value2+"' where Acc='"+value1+"'";
pst=conn.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(null, "Successfully Transfered");
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}
private void TransferD(){
try{
String value1=jTextField19.getText();
String value2=jTextField24.getText();
String sql="update Balances set Balance='"+value2+"' where Name='"+value1+"'";
pst=conn.prepareStatement(sql);
pst.execute();
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
// TODO add your handling code here:
TransferD();
TransferC();
}//GEN-LAST:event_jButton10ActionPerformed
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBox1ActionPerformed
private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
// TODO add your handling code here:
String sql="select * from Balances where Name=?";
try{
pst=conn.prepareStatement(sql);
pst.setString(1, jTextField27.getText());
rs=pst.executeQuery();
if(rs.next()){
String add1=rs.getString("Name");
jTextField28.setText(add1);
String add2=rs.getString("Acc");
jTextField29.setText(add2);
String add3=rs.getString("Balance");
jTextField30.setText(add3);
rs.close();
pst.close();
}else{
JOptionPane.showMessageDialog(null, "Enter Correct Name");
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}//GEN-LAST:event_jButton11ActionPerformed
private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
// TODO add your handling code here:
try{
String s1=jTextField30.getText();
String s2=jTextField31.getText();
int sum=Integer.parseInt(s1)-Integer.parseInt(s2);
String sum1=String.valueOf(sum);
jTextField32.setText(sum1);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton12ActionPerformed
private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
// TODO add your handling code here:
try{
String s1=jTextField27.getText();
String s2=jTextField32.getText();
String sql="update Balances set Balance='"+s2+"' where Name='"+s1+"'";
pst=conn.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(null, "Successfully Withdrawled");
jTextField27.setText("");
jTextField28.setText("");
jTextField29.setText("");
jTextField30.setText("");
jTextField31.setText("");
jTextField32.setText("");
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton13ActionPerformed
private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
// TODO add your handling code here:
try{
String value1=jTextField1.getText();
String value2=jTextField34.getText();
String sql="update Account set Pin='"+value2+"' where Name='"+value1+"'";
pst=conn.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(null, "Pin Successfully Changed");
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton14ActionPerformed
private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed
// TODO add your handling code here:
jTextField33.setText("");
jTextField34.setText("");
}//GEN-LAST:event_jButton15ActionPerformed
private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton16ActionPerformed
// TODO add your handling code here:
String sql="select * from Balances where Name=?";
try{
pst=conn.prepareStatement(sql);
pst.setString(1, jTextField35.getText());
rs=pst.executeQuery();
if(rs.next()){
String add1=rs.getString("Name");
jTextField36.setText(add1);
String add2=rs.getString("Acc");
jTextField37.setText(add2);
String add3=rs.getString("MICR_No");
jTextField38.setText(add3);
String add4=rs.getString("Balance");
jTextField40.setText(add4);
jTextField39.setText("4 %");
jTextField41.setText("Rs 0.00");
jTextField42.setText("No");
rs.close();
pst.close();
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}//GEN-LAST:event_jButton16ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MyPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MyPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MyPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MyPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MyPage().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton10;
private javax.swing.JButton jButton11;
private javax.swing.JButton jButton12;
private javax.swing.JButton jButton13;
private javax.swing.JButton jButton14;
private javax.swing.JButton jButton15;
private javax.swing.JButton jButton16;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel25;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel27;
private javax.swing.JLabel jLabel28;
private javax.swing.JLabel jLabel29;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel30;
private javax.swing.JLabel jLabel31;
private javax.swing.JLabel jLabel32;
private javax.swing.JLabel jLabel33;
private javax.swing.JLabel jLabel34;
private javax.swing.JLabel jLabel35;
private javax.swing.JLabel jLabel36;
private javax.swing.JLabel jLabel37;
private javax.swing.JLabel jLabel38;
private javax.swing.JLabel jLabel39;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel40;
private javax.swing.JLabel jLabel41;
private javax.swing.JLabel jLabel42;
private javax.swing.JLabel jLabel43;
private javax.swing.JLabel jLabel44;
private javax.swing.JLabel jLabel45;
private javax.swing.JLabel jLabel46;
private javax.swing.JLabel jLabel47;
private javax.swing.JLabel jLabel48;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel13;
private javax.swing.JPanel jPanel14;
private javax.swing.JPanel jPanel15;
private javax.swing.JPanel jPanel16;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTable jTable2;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField10;
private javax.swing.JTextField jTextField11;
private javax.swing.JTextField jTextField12;
private javax.swing.JTextField jTextField13;
private javax.swing.JTextField jTextField14;
private javax.swing.JTextField jTextField15;
private javax.swing.JTextField jTextField16;
private javax.swing.JTextField jTextField17;
private javax.swing.JTextField jTextField18;
private javax.swing.JTextField jTextField19;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField20;
private javax.swing.JTextField jTextField21;
private javax.swing.JTextField jTextField22;
private javax.swing.JTextField jTextField23;
private javax.swing.JTextField jTextField24;
private javax.swing.JTextField jTextField25;
private javax.swing.JTextField jTextField26;
private javax.swing.JTextField jTextField27;
private javax.swing.JTextField jTextField28;
private javax.swing.JTextField jTextField29;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField30;
private javax.swing.JTextField jTextField31;
private javax.swing.JTextField jTextField32;
private javax.swing.JTextField jTextField33;
private javax.swing.JTextField jTextField34;
private javax.swing.JTextField jTextField35;
private javax.swing.JTextField jTextField36;
private javax.swing.JTextField jTextField37;
private javax.swing.JTextField jTextField38;
private javax.swing.JTextField jTextField39;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField40;
private javax.swing.JTextField jTextField41;
private javax.swing.JTextField jTextField42;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
private javax.swing.JTextField jTextField8;
private javax.swing.JTextField jTextField9;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 98,809 | java | MyPage.java | Java | [
{
"context": "the template in the editor.\n */\n\n/**\n *\n * @author Er Vaibhav Karnwal\n */\n\nimport java.util.*;\nimport net.proteanit.sql",
"end": 337,
"score": 0.9998732805252075,
"start": 319,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "el1.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Desktop\\\\kar.jpg\")); // NOI18N\n\n jLabel2.",
"end": 8747,
"score": 0.9998864531517029,
"start": 8729,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "on4.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Documents\\\\NetBeansProjects\\\\Bank_Management_Sys",
"end": 10363,
"score": 0.9998981952667236,
"start": 10345,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "on5.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Documents\\\\NetBeansProjects\\\\Bank_Management_Sys",
"end": 11331,
"score": 0.999896764755249,
"start": 11313,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "on6.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Documents\\\\NetBeansProjects\\\\Bank_Management_Sys",
"end": 11821,
"score": 0.9998815059661865,
"start": 11803,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "n12.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Documents\\\\NetBeansProjects\\\\Bank_Management_Sys",
"end": 19385,
"score": 0.9998979568481445,
"start": 19367,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "n13.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Documents\\\\NetBeansProjects\\\\Bank_Management_Sys",
"end": 20095,
"score": 0.9998984336853027,
"start": 20077,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "n11.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Documents\\\\NetBeansProjects\\\\Bank_Management_Sys",
"end": 20704,
"score": 0.9998798370361328,
"start": 20686,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "n14.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Documents\\\\NetBeansProjects\\\\Bank_Management_Sys",
"end": 31200,
"score": 0.9998684525489807,
"start": 31182,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "n15.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Documents\\\\NetBeansProjects\\\\Bank_Management_Sys",
"end": 31821,
"score": 0.99988853931427,
"start": 31803,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "n16.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Documents\\\\NetBeansProjects\\\\Bank_Management_Sys",
"end": 37454,
"score": 0.999875545501709,
"start": 37436,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "l31.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Documents\\\\NetBeansProjects\\\\Bank_Management_Sys",
"end": 44313,
"score": 0.9998955726623535,
"start": 44295,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "eLineBorder(new java.awt.Color(0, 102, 102), 2), \"Vaibhav Karnwal\", javax.swing.border.TitledBorder.DEFAULT_JUSTIFI",
"end": 44585,
"score": 0.999888002872467,
"start": 44570,
"tag": "NAME",
"value": "Vaibhav Karnwal"
},
{
"context": "awt.Color(153, 0, 0));\n jLabel35.setText(\"- vaibhavkarnwal2812\");\n\n jLabel36.setFont(new java.awt.Font(\"T",
"end": 44884,
"score": 0.9858525395393372,
"start": 44866,
"tag": "USERNAME",
"value": "vaibhavkarnwal2812"
},
{
"context": "0, 0));\n jLabel37.setText(\"- youtube.com/c/itsmevaibhavkarnwal\");\n\n jLabel33.setForeground(new java.awt.C",
"end": 45234,
"score": 0.9992733001708984,
"start": 45215,
"tag": "USERNAME",
"value": "itsmevaibhavkarnwal"
},
{
"context": " 0));\n jLabel33.setText(\"- linkedin.com/in/vaibhav-karnwal\");\n\n jLabel34.setFont(new java.awt.Font",
"end": 45358,
"score": 0.9973121285438538,
"start": 45346,
"tag": "USERNAME",
"value": "vaibhav-karn"
},
{
"context": "n10.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Documents\\\\NetBeansProjects\\\\Bank_Management_Sys",
"end": 61366,
"score": 0.9998961687088013,
"start": 61348,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "on8.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Documents\\\\NetBeansProjects\\\\Bank_Management_Sys",
"end": 61862,
"score": 0.9998940229415894,
"start": 61844,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "on7.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Documents\\\\NetBeansProjects\\\\Bank_Management_Sys",
"end": 63296,
"score": 0.9998152256011963,
"start": 63278,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
},
{
"context": "on1.setIcon(new javax.swing.ImageIcon(\"C:\\\\Users\\\\Er Vaibhav Karnwal\\\\Desktop\\\\Eye-2-icon-1.png\")); // NOI18N\n ",
"end": 71692,
"score": 0.9998909831047058,
"start": 71674,
"tag": "NAME",
"value": "Er Vaibhav Karnwal"
}
]
| null | []
|
import java.sql.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
/*
* 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 <NAME>
*/
import java.util.*;
import net.proteanit.sql.DbUtils;
public class MyPage extends javax.swing.JFrame {
Connection conn;
ResultSet rs;
PreparedStatement pst;
/**
* Creates new form MyPage
*/
public MyPage() {
super("Karnwal Bank Home Page");
initComponents();
conn=javaconnect.ConnecrDb();
setLocation(280,80);
calendar();
Account();
Table1();
Table2();
}
public void Table1(){
try{
String sql="select Acc,Name,Dob,Acc_type,Gender,Mob from Account";
pst=conn.prepareStatement(sql);
rs=pst.executeQuery();
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}
public void Table2(){
try{
String sql="select Acc,Name,MICR_No,Balance from Balances";
pst=conn.prepareStatement(sql);
rs=pst.executeQuery();
jTable2.setModel(DbUtils.resultSetToTableModel(rs));
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}
public void calendar(){
Calendar cal=new GregorianCalendar();
int month=cal.get(Calendar.MONTH);
int year=cal.get(Calendar.YEAR);
int day=cal.get(Calendar.DAY_OF_MONTH);
jTextField2.setText(+day+"-"+(month+1)+"-"+year);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel2 = new javax.swing.JPanel();
jPanel12 = new javax.swing.JPanel();
jTextField13 = new javax.swing.JTextField();
jLabel16 = new javax.swing.JLabel();
jTextField15 = new javax.swing.JTextField();
jTextField17 = new javax.swing.JTextField();
jTextField18 = new javax.swing.JTextField();
jButton4 = new javax.swing.JButton();
jLabel17 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jTextField14 = new javax.swing.JTextField();
jTextField16 = new javax.swing.JTextField();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
jPanel13 = new javax.swing.JPanel();
jTextField30 = new javax.swing.JTextField();
jLabel28 = new javax.swing.JLabel();
jTextField29 = new javax.swing.JTextField();
jTextField28 = new javax.swing.JTextField();
jTextField31 = new javax.swing.JTextField();
jTextField27 = new javax.swing.JTextField();
jLabel30 = new javax.swing.JLabel();
jLabel27 = new javax.swing.JLabel();
jButton12 = new javax.swing.JButton();
jLabel29 = new javax.swing.JLabel();
jLabel25 = new javax.swing.JLabel();
jButton13 = new javax.swing.JButton();
jTextField32 = new javax.swing.JTextField();
jLabel26 = new javax.swing.JLabel();
jButton11 = new javax.swing.JButton();
jPanel6 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jPanel5 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
jTable2 = new javax.swing.JTable();
jPanel7 = new javax.swing.JPanel();
jPanel14 = new javax.swing.JPanel();
jTextField33 = new javax.swing.JTextField();
jTextField34 = new javax.swing.JTextField();
jLabel39 = new javax.swing.JLabel();
jButton14 = new javax.swing.JButton();
jLabel40 = new javax.swing.JLabel();
jButton15 = new javax.swing.JButton();
jPanel8 = new javax.swing.JPanel();
jPanel15 = new javax.swing.JPanel();
jTextField36 = new javax.swing.JTextField();
jLabel41 = new javax.swing.JLabel();
jLabel43 = new javax.swing.JLabel();
jLabel44 = new javax.swing.JLabel();
jLabel42 = new javax.swing.JLabel();
jLabel47 = new javax.swing.JLabel();
jTextField40 = new javax.swing.JTextField();
jTextField35 = new javax.swing.JTextField();
jTextField37 = new javax.swing.JTextField();
jLabel45 = new javax.swing.JLabel();
jLabel46 = new javax.swing.JLabel();
jLabel48 = new javax.swing.JLabel();
jTextField41 = new javax.swing.JTextField();
jTextField42 = new javax.swing.JTextField();
jTextField39 = new javax.swing.JTextField();
jButton16 = new javax.swing.JButton();
jTextField38 = new javax.swing.JTextField();
jPanel9 = new javax.swing.JPanel();
jLabel31 = new javax.swing.JLabel();
jPanel10 = new javax.swing.JPanel();
jLabel35 = new javax.swing.JLabel();
jLabel36 = new javax.swing.JLabel();
jLabel32 = new javax.swing.JLabel();
jLabel37 = new javax.swing.JLabel();
jLabel33 = new javax.swing.JLabel();
jLabel34 = new javax.swing.JLabel();
jLabel38 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jPanel16 = new javax.swing.JPanel();
jTextField8 = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jTextField6 = new javax.swing.JTextField();
jTextField9 = new javax.swing.JTextField();
jLabel12 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jTextField7 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jTextField5 = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
jTextField11 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jTextField10 = new javax.swing.JTextField();
jTextField12 = new javax.swing.JTextField();
jPanel3 = new javax.swing.JPanel();
jPanel11 = new javax.swing.JPanel();
jTextField21 = new javax.swing.JTextField();
jTextField25 = new javax.swing.JTextField();
jLabel19 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox<>();
jTextField24 = new javax.swing.JTextField();
jTextField20 = new javax.swing.JTextField();
jTextField22 = new javax.swing.JTextField();
jButton10 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jLabel20 = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
jTextField23 = new javax.swing.JTextField();
jLabel23 = new javax.swing.JLabel();
jLabel24 = new javax.swing.JLabel();
jTextField19 = new javax.swing.JTextField();
jButton9 = new javax.swing.JButton();
jTextField26 = new javax.swing.JTextField();
jLabel21 = new javax.swing.JLabel();
jButton7 = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Desktop\\kar.jpg")); // NOI18N
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel2.setText("User");
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel3.setText("Date");
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1ActionPerformed(evt);
}
});
jTextField2.setEditable(false);
jTabbedPane1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 3));
jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jTextField13.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel16.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel16.setText("Account No.");
jTextField15.setEditable(false);
jTextField15.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField15.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField15ActionPerformed(evt);
}
});
jTextField17.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField18.setEditable(false);
jTextField18.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton4.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\search.gif")); // NOI18N
jButton4.setText("Search");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jLabel17.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel17.setText("Available Balance");
jLabel18.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel18.setText("Deposit Amount");
jTextField14.setEditable(false);
jTextField14.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField16.setEditable(false);
jTextField16.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton5.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton5.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\ok.gif")); // NOI18N
jButton5.setText("Total");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jButton6.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton6.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\ok.gif")); // NOI18N
jButton6.setText("Deposit");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jLabel14.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel14.setText("User");
jLabel15.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel15.setText("Name");
javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
jPanel12.setLayout(jPanel12Layout);
jPanel12Layout.setHorizontalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel18)
.addComponent(jLabel15)
.addComponent(jLabel14)
.addComponent(jLabel16)
.addComponent(jLabel17))
.addGap(68, 127, Short.MAX_VALUE)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField14, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField15, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField16, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField13, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(45, 45, 45)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 263, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton6)
.addGap(165, 165, 165)))
.addContainerGap())
);
jPanel12Layout.setVerticalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4)
.addComponent(jLabel14))
.addGap(18, 18, 18)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel15))
.addGap(20, 20, 20)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel16)
.addComponent(jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(29, 29, 29)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel17)
.addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel18)
.addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton6)
.addContainerGap())
);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(53, 53, 53)
.addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(54, 54, 54))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(26, 26, 26)
.addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(37, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Deposit", jPanel2);
jPanel4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jTextField30.setEditable(false);
jLabel28.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel28.setText("Available Balance");
jTextField29.setEditable(false);
jTextField28.setEditable(false);
jLabel30.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel30.setText("Total");
jLabel27.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel27.setText("Account No.");
jButton12.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton12.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\ok.gif")); // NOI18N
jButton12.setText("Show");
jButton12.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton12ActionPerformed(evt);
}
});
jLabel29.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel29.setText("Amount");
jLabel25.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel25.setText("User");
jButton13.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton13.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\minus.gif")); // NOI18N
jButton13.setText("Withdrawl");
jButton13.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton13ActionPerformed(evt);
}
});
jLabel26.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel26.setText("Name");
jButton11.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton11.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\search.gif")); // NOI18N
jButton11.setText("Search");
jButton11.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton11ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
jPanel13.setLayout(jPanel13Layout);
jPanel13Layout.setHorizontalGroup(
jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel13Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel13Layout.createSequentialGroup()
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel28)
.addComponent(jLabel25, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel26, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel27, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel29, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel30, javax.swing.GroupLayout.Alignment.LEADING))
.addGap(38, 38, 38)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField28, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField29, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField30, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel13Layout.createSequentialGroup()
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField27, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField31)
.addComponent(jTextField32, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(30, 30, 30)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jButton12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton11)))))
.addGroup(jPanel13Layout.createSequentialGroup()
.addGap(148, 148, 148)
.addComponent(jButton13)))
.addContainerGap())
);
jPanel13Layout.setVerticalGroup(
jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel13Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel25)
.addComponent(jTextField27, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton11))
.addGap(18, 18, 18)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel26)
.addComponent(jTextField28, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel27)
.addComponent(jTextField29, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel28)
.addComponent(jTextField30, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel29)
.addComponent(jTextField31, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel30)
.addComponent(jTextField32, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton12))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton13)
.addContainerGap())
);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(98, 98, 98)
.addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(127, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(30, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Withdrawl", jPanel4);
jPanel6.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(jTable1);
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 608, Short.MAX_VALUE)
.addContainerGap())
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE)
.addContainerGap())
);
jTabbedPane1.addTab("Customer List", jPanel6);
jPanel5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jTable2.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane2.setViewportView(jTable2);
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 608, Short.MAX_VALUE)
.addContainerGap())
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE)
.addContainerGap())
);
jTabbedPane1.addTab("Transaction", jPanel5);
jPanel7.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jLabel39.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel39.setText("Enter Old Pin");
jButton14.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton14.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\grid_update.png")); // NOI18N
jButton14.setText("Change");
jButton14.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton14ActionPerformed(evt);
}
});
jLabel40.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel40.setText("Enter New Pin");
jButton15.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton15.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\Actions-edit-clear-icon.png")); // NOI18N
jButton15.setText("Clear");
jButton15.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton15ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
jPanel14.setLayout(jPanel14Layout);
jPanel14Layout.setHorizontalGroup(
jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel14Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel40, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel39, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(42, 42, 42)
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel14Layout.createSequentialGroup()
.addComponent(jButton14)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton15))
.addComponent(jTextField34)
.addComponent(jTextField33))
.addContainerGap())
);
jPanel14Layout.setVerticalGroup(
jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel14Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel39)
.addComponent(jTextField33, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(45, 45, 45)
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel40)
.addComponent(jTextField34, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(41, 41, 41)
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton14)
.addComponent(jButton15))
.addContainerGap())
);
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(149, 149, 149)
.addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(154, Short.MAX_VALUE))
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(64, 64, 64)
.addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(84, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Change Pin", jPanel7);
jPanel8.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jTextField36.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel41.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel41.setText("User");
jLabel43.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel43.setText("Account No.");
jLabel44.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel44.setText("MICR No.");
jLabel42.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel42.setText("Name");
jLabel47.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel47.setText("Mod Balance");
jTextField40.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField35.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField37.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel45.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel45.setText("Rate of Interest(%)");
jLabel46.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel46.setText("Available Balance");
jLabel48.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel48.setText("Nomination Registered");
jTextField41.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField42.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField39.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton16.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton16.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\search.gif")); // NOI18N
jButton16.setText("Search");
jButton16.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton16ActionPerformed(evt);
}
});
jTextField38.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
jPanel15.setLayout(jPanel15Layout);
jPanel15Layout.setHorizontalGroup(
jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel15Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel15Layout.createSequentialGroup()
.addGap(108, 108, 108)
.addComponent(jLabel41)
.addGap(49, 49, 49)
.addComponent(jTextField35, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton16))
.addGroup(jPanel15Layout.createSequentialGroup()
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel42)
.addComponent(jLabel43)
.addComponent(jLabel44)
.addComponent(jLabel48))
.addGap(49, 49, 49)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField37)
.addComponent(jTextField38)
.addComponent(jTextField36)
.addComponent(jTextField42, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE))
.addGap(38, 38, 38)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel46)
.addComponent(jLabel47)
.addComponent(jLabel45))
.addGap(26, 26, 26)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField39)
.addComponent(jTextField40)
.addComponent(jTextField41, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE))))
.addContainerGap())
);
jPanel15Layout.setVerticalGroup(
jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel15Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel41)
.addComponent(jTextField35, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton16))
.addGap(26, 26, 26)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel42)
.addComponent(jTextField36, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel45)
.addComponent(jTextField39, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(30, 30, 30)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel43)
.addComponent(jTextField37, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel46)
.addComponent(jTextField40, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(32, 32, 32)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel44)
.addComponent(jTextField38, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel47)
.addComponent(jTextField41, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(29, 29, 29)
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel48)
.addComponent(jTextField42, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jPanel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(21, 21, 21))
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(48, Short.MAX_VALUE))
);
jTabbedPane1.addTab("View Balance", jPanel8);
jPanel9.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jLabel31.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\IMG_20200215_190546_740.jpg")); // NOI18N
jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2), "<NAME>", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 18), new java.awt.Color(0, 102, 102))); // NOI18N
jLabel35.setForeground(new java.awt.Color(153, 0, 0));
jLabel35.setText("- vaibhavkarnwal2812");
jLabel36.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel36.setText("Youtube");
jLabel32.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel32.setText("Linkedin");
jLabel37.setForeground(new java.awt.Color(153, 0, 0));
jLabel37.setText("- youtube.com/c/itsmevaibhavkarnwal");
jLabel33.setForeground(new java.awt.Color(153, 0, 0));
jLabel33.setText("- linkedin.com/in/vaibhav-karnwal");
jLabel34.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel34.setText("Instagram");
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
jPanel10.setLayout(jPanel10Layout);
jPanel10Layout.setHorizontalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel36, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel34, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel32, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel37, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel35, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel33, javax.swing.GroupLayout.Alignment.LEADING))
.addContainerGap())
);
jPanel10Layout.setVerticalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel32)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(13, 13, 13)
.addComponent(jLabel34)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel35)
.addGap(18, 18, 18)
.addComponent(jLabel36)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel37)
.addContainerGap())
);
jLabel38.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N
jLabel38.setText("KARNWAL BANK V 1.0");
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(56, 56, 56)
.addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 137, Short.MAX_VALUE)
.addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(60, 60, 60))
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(196, 196, 196)
.addComponent(jLabel38)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addContainerGap(23, Short.MAX_VALUE)
.addComponent(jLabel38)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(jLabel31)
.addContainerGap(66, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(46, 46, 46))))
);
jTabbedPane1.addTab("About", jPanel9);
jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 153), 2));
jTextField8.setEditable(false);
jTextField8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel9.setText("Account No.");
jLabel13.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel13.setText("Sequrity Question");
jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel8.setText("Address");
jTextField6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField9.setEditable(false);
jTextField9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel12.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel12.setText("Mobile");
jTextField3.setEditable(false);
jTextField3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField4.setEditable(false);
jTextField4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel6.setText("Religion");
jTextField11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel4.setText("Name");
jButton2.setText("Edit");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("Save");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel5.setText("Date of Birth");
jLabel11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel11.setText("Caste");
jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel7.setText("Gender");
jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel10.setText("Account Type");
jTextField10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTextField12.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16);
jPanel16.setLayout(jPanel16Layout);
jPanel16Layout.setHorizontalGroup(
jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel16Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING))
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel8))
.addGap(22, 22, 22)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField4)
.addComponent(jTextField5)
.addComponent(jTextField6)
.addComponent(jTextField7)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(31, 31, 31)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel16Layout.createSequentialGroup()
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9)
.addComponent(jLabel10)
.addComponent(jLabel11)
.addComponent(jLabel12))
.addGap(31, 31, 31)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField8)
.addComponent(jTextField9)
.addComponent(jTextField10)
.addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel16Layout.createSequentialGroup()
.addComponent(jLabel13)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel16Layout.createSequentialGroup()
.addComponent(jButton2)
.addGap(18, 18, 18)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jPanel16Layout.setVerticalGroup(
jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel16Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel4)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9)
.addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(24, 24, 24)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel10)
.addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11)
.addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(22, 22, 22)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel12)
.addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(29, 29, 29)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel13)
.addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2)
.addComponent(jButton3))
.addContainerGap())
);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(45, 45, 45)
.addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(51, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(26, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Profile", jPanel1);
jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
jTextField21.setEditable(false);
jTextField25.setEditable(false);
jLabel19.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel19.setText("User");
jComboBox1.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
}
public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {
jComboBox1PopupMenuWillBecomeInvisible(evt);
}
public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {
}
});
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox1ActionPerformed(evt);
}
});
jTextField24.setEditable(false);
jTextField20.setEditable(false);
jTextField22.setEditable(false);
jTextField22.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField22ActionPerformed(evt);
}
});
jButton10.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton10.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\ok.gif")); // NOI18N
jButton10.setText("Transfer");
jButton10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton10ActionPerformed(evt);
}
});
jButton8.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton8.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\ok.gif")); // NOI18N
jButton8.setText("Total");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
jLabel20.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel20.setText("Name");
jLabel22.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel22.setText("Available Balance");
jLabel23.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel23.setText("Transfer Amount");
jLabel24.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel24.setText("Credit Account");
jButton9.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton9.setText("Show");
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
jTextField26.setEditable(false);
jLabel21.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel21.setText("Account No.");
jButton7.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jButton7.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Documents\\NetBeansProjects\\Bank_Management_System\\Icon\\search.gif")); // NOI18N
jButton7.setText("Search");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
jPanel11.setLayout(jPanel11Layout);
jPanel11Layout.setHorizontalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel24)
.addComponent(jLabel23)
.addComponent(jLabel19)
.addComponent(jLabel20)
.addComponent(jLabel21)
.addComponent(jLabel22))
.addGap(56, 56, 56)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addComponent(jButton9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 117, Short.MAX_VALUE)
.addComponent(jButton10)
.addGap(18, 18, 18))
.addComponent(jTextField20, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField21, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField22, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel11Layout.createSequentialGroup()
.addComponent(jTextField23, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField24, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField19, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton7)
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel11Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField25, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField26, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap())
);
jPanel11Layout.setVerticalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton7)
.addComponent(jLabel19))
.addGap(19, 19, 19)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel20))
.addGap(17, 17, 17)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel21))
.addGap(15, 15, 15)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel22))
.addGap(18, 18, 18)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton8)
.addComponent(jLabel23))
.addGap(18, 18, 18)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField26, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel24))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton10)
.addComponent(jButton9))
.addContainerGap())
);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(55, 55, 55)
.addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(119, 119, 119))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(36, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Transfer", jPanel3);
jButton1.setIcon(new javax.swing.ImageIcon("C:\\Users\\<NAME>\\Desktop\\Eye-2-icon-1.png")); // NOI18N
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 183, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField2))
.addGap(15, 15, 15))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(11, 11, 11)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jLabel1))
.addGap(18, 18, 18)
.addComponent(jTabbedPane1)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
String sql="select * from Account where Name=?";
try{
pst=conn.prepareStatement(sql);
pst.setString(1,jTextField1.getText());
rs=pst.executeQuery();
if(rs.next()){
String add1=rs.getString("Name");
jTextField3.setText(add1);
String add2=rs.getString("Acc");
jTextField8.setText(add2);
String add3=rs.getString("Dob");
jTextField4.setText(add3);
String add4=rs.getString("Acc_type");
jTextField9.setText(add4);
String add5=rs.getString("Religion");
jTextField5.setText(add5);
String add6=rs.getString("Caste");
jTextField10.setText(add6);
String add7=rs.getString("Gender");
jTextField6.setText(add7);
String add8=rs.getString("Mob");
jTextField11.setText(add8);
String add9=rs.getString("Address");
jTextField7.setText(add9);
String add10=rs.getString("Sec_Q");
jTextField12.setText(add10);
rs.close();
pst.close();
}
else{
JOptionPane.showMessageDialog(null, "Enter Correct Name");
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
jTextField5.setEditable(true);
jTextField6.setEditable(true);
jTextField7.setEditable(true);
jTextField10.setEditable(true);
jTextField11.setEditable(true);
jTextField12.setEditable(true);
}//GEN-LAST:event_jButton2ActionPerformed
private void jTextField15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField15ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField15ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
// TODO add your handling code here:
try{
String s1=jTextField16.getText();
String s2=jTextField17.getText();
int sum=Integer.parseInt(s1)+Integer.parseInt(s2);
String sum1=String.valueOf(sum);
jTextField18.setText(sum1);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
try{
String value1=jTextField5.getText();
String value2=jTextField6.getText();
String value3=jTextField7.getText();
String value4=jTextField10.getText();
String value5=jTextField11.getText();
String value6=jTextField12.getText();
String value7=jTextField1.getText();
String sql="update Account set Religion='"+value1+"',Gender='"+value2+"',Address='"+value3+"',Caste='"+value4+"',Mob='"+value5+"',Sec_Q='"+value6+"' where Name='"+value7+"'";
pst=conn.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(null, "Profile Updated");
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:
String sql="select * from Balances where Name=?";
try{
pst=conn.prepareStatement(sql);
pst.setString(1, jTextField13.getText());
rs=pst.executeQuery();
if(rs.next()){
String add1=rs.getString("Name");
jTextField14.setText(add1);
String add2=rs.getString("Acc");
jTextField15.setText(add2);
String add3=rs.getString("Balance");
jTextField16.setText(add3);
rs.close();
pst.close();
}else{
JOptionPane.showMessageDialog(null, "Enter Correct Name");
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
// TODO add your handling code here:
try{
String value1=jTextField13.getText();
String value2=jTextField18.getText();
String sql="update Balances set Balance='"+value2+"' where Name='"+value1+"'";
pst=conn.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(null, "Successfully Deposited");
jTextField13.setText("");
jTextField14.setText("");
jTextField15.setText("");
jTextField16.setText("");
jTextField17.setText("");
jTextField18.setText("");
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton6ActionPerformed
private void jTextField22ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField22ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField22ActionPerformed
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
// TODO add your handling code here:
try{
String s1=jTextField22.getText();
String s2=jTextField23.getText();
int sum=Integer.parseInt(s1)+Integer.parseInt(s2);
String sum1=String.valueOf(sum);
jTextField24.setText(sum1);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton8ActionPerformed
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
// TODO add your handling code here:
String sql="select * from Balances where Name=?";
try{
pst=conn.prepareStatement(sql);
pst.setString(1, jTextField19.getText());
rs=pst.executeQuery();
if(rs.next()){
String add1=rs.getString("Name");
jTextField20.setText(add1);
String add2=rs.getString("Acc");
jTextField21.setText(add2);
String add3=rs.getString("Balance");
jTextField22.setText(add3);
rs.close();
pst.close();
}else{
JOptionPane.showMessageDialog(null, "Enter Correct Name");
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}//GEN-LAST:event_jButton7ActionPerformed
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
// TODO add your handling code here:
try{
String s1=jTextField23.getText();
String s2=jTextField25.getText();
int sum=Integer.parseInt(s1)+Integer.parseInt(s2);
String sum1=String.valueOf(sum);
jTextField26.setText(sum1);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton9ActionPerformed
public void Account(){
try{
String sql="select * from Balances";
pst=conn.prepareStatement(sql);
rs=pst.executeQuery();
while(rs.next()){
String account=rs.getString("Acc");
jComboBox1.addItem(account);
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}
private void jComboBox1PopupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jComboBox1PopupMenuWillBecomeInvisible
// TODO add your handling code here:
try{
String s1=(String) jComboBox1.getSelectedItem();
String sql="select * from Balances where Acc=?";
pst=conn.prepareStatement(sql);
pst.setString(1,s1);
rs=pst.executeQuery();
if(rs.next()){
String add=rs.getString("Balance");
jTextField25.setText(add);
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jComboBox1PopupMenuWillBecomeInvisible
private void TransferC(){
try{
String value1=(String)jComboBox1.getSelectedItem();
String value2=jTextField26.getText();
String sql="update Balances set Balance='"+value2+"' where Acc='"+value1+"'";
pst=conn.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(null, "Successfully Transfered");
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}
private void TransferD(){
try{
String value1=jTextField19.getText();
String value2=jTextField24.getText();
String sql="update Balances set Balance='"+value2+"' where Name='"+value1+"'";
pst=conn.prepareStatement(sql);
pst.execute();
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
// TODO add your handling code here:
TransferD();
TransferC();
}//GEN-LAST:event_jButton10ActionPerformed
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBox1ActionPerformed
private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
// TODO add your handling code here:
String sql="select * from Balances where Name=?";
try{
pst=conn.prepareStatement(sql);
pst.setString(1, jTextField27.getText());
rs=pst.executeQuery();
if(rs.next()){
String add1=rs.getString("Name");
jTextField28.setText(add1);
String add2=rs.getString("Acc");
jTextField29.setText(add2);
String add3=rs.getString("Balance");
jTextField30.setText(add3);
rs.close();
pst.close();
}else{
JOptionPane.showMessageDialog(null, "Enter Correct Name");
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}//GEN-LAST:event_jButton11ActionPerformed
private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
// TODO add your handling code here:
try{
String s1=jTextField30.getText();
String s2=jTextField31.getText();
int sum=Integer.parseInt(s1)-Integer.parseInt(s2);
String sum1=String.valueOf(sum);
jTextField32.setText(sum1);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton12ActionPerformed
private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
// TODO add your handling code here:
try{
String s1=jTextField27.getText();
String s2=jTextField32.getText();
String sql="update Balances set Balance='"+s2+"' where Name='"+s1+"'";
pst=conn.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(null, "Successfully Withdrawled");
jTextField27.setText("");
jTextField28.setText("");
jTextField29.setText("");
jTextField30.setText("");
jTextField31.setText("");
jTextField32.setText("");
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton13ActionPerformed
private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
// TODO add your handling code here:
try{
String value1=jTextField1.getText();
String value2=jTextField34.getText();
String sql="update Account set Pin='"+value2+"' where Name='"+value1+"'";
pst=conn.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(null, "Pin Successfully Changed");
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton14ActionPerformed
private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed
// TODO add your handling code here:
jTextField33.setText("");
jTextField34.setText("");
}//GEN-LAST:event_jButton15ActionPerformed
private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton16ActionPerformed
// TODO add your handling code here:
String sql="select * from Balances where Name=?";
try{
pst=conn.prepareStatement(sql);
pst.setString(1, jTextField35.getText());
rs=pst.executeQuery();
if(rs.next()){
String add1=rs.getString("Name");
jTextField36.setText(add1);
String add2=rs.getString("Acc");
jTextField37.setText(add2);
String add3=rs.getString("MICR_No");
jTextField38.setText(add3);
String add4=rs.getString("Balance");
jTextField40.setText(add4);
jTextField39.setText("4 %");
jTextField41.setText("Rs 0.00");
jTextField42.setText("No");
rs.close();
pst.close();
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}finally{
try{
rs.close();
pst.close();
}catch(Exception e){
}
}
}//GEN-LAST:event_jButton16ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MyPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MyPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MyPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MyPage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MyPage().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton10;
private javax.swing.JButton jButton11;
private javax.swing.JButton jButton12;
private javax.swing.JButton jButton13;
private javax.swing.JButton jButton14;
private javax.swing.JButton jButton15;
private javax.swing.JButton jButton16;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel25;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel27;
private javax.swing.JLabel jLabel28;
private javax.swing.JLabel jLabel29;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel30;
private javax.swing.JLabel jLabel31;
private javax.swing.JLabel jLabel32;
private javax.swing.JLabel jLabel33;
private javax.swing.JLabel jLabel34;
private javax.swing.JLabel jLabel35;
private javax.swing.JLabel jLabel36;
private javax.swing.JLabel jLabel37;
private javax.swing.JLabel jLabel38;
private javax.swing.JLabel jLabel39;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel40;
private javax.swing.JLabel jLabel41;
private javax.swing.JLabel jLabel42;
private javax.swing.JLabel jLabel43;
private javax.swing.JLabel jLabel44;
private javax.swing.JLabel jLabel45;
private javax.swing.JLabel jLabel46;
private javax.swing.JLabel jLabel47;
private javax.swing.JLabel jLabel48;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel13;
private javax.swing.JPanel jPanel14;
private javax.swing.JPanel jPanel15;
private javax.swing.JPanel jPanel16;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTable jTable2;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField10;
private javax.swing.JTextField jTextField11;
private javax.swing.JTextField jTextField12;
private javax.swing.JTextField jTextField13;
private javax.swing.JTextField jTextField14;
private javax.swing.JTextField jTextField15;
private javax.swing.JTextField jTextField16;
private javax.swing.JTextField jTextField17;
private javax.swing.JTextField jTextField18;
private javax.swing.JTextField jTextField19;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField20;
private javax.swing.JTextField jTextField21;
private javax.swing.JTextField jTextField22;
private javax.swing.JTextField jTextField23;
private javax.swing.JTextField jTextField24;
private javax.swing.JTextField jTextField25;
private javax.swing.JTextField jTextField26;
private javax.swing.JTextField jTextField27;
private javax.swing.JTextField jTextField28;
private javax.swing.JTextField jTextField29;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField30;
private javax.swing.JTextField jTextField31;
private javax.swing.JTextField jTextField32;
private javax.swing.JTextField jTextField33;
private javax.swing.JTextField jTextField34;
private javax.swing.JTextField jTextField35;
private javax.swing.JTextField jTextField36;
private javax.swing.JTextField jTextField37;
private javax.swing.JTextField jTextField38;
private javax.swing.JTextField jTextField39;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField40;
private javax.swing.JTextField jTextField41;
private javax.swing.JTextField jTextField42;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
private javax.swing.JTextField jTextField8;
private javax.swing.JTextField jTextField9;
// End of variables declaration//GEN-END:variables
}
| 98,608 | 0.633647 | 0.601808 | 1,885 | 51.418037 | 38.774097 | 356 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.858355 | false | false | 15 |
26cb5c7e3fbd5545a836d9c532178c6561578397 | 9,612,136,848,441 | 13c9775159174d056ba65a81d297f0a46998246c | /src/test/java/leetcode_0701_0750/leetcode_0738/Solution0738Test.java | 372be913ce8ea1d5230f141b2ab41bceb27c84d5 | []
| no_license | SunGuanJun/leetcode | https://github.com/SunGuanJun/leetcode | d53654ae6425d62bfb6d18df2b568adb22140f1a | 9c9a63775eabea6602b78efbbf36c2baa850ef46 | refs/heads/master | 2022-06-28T01:57:44.332000 | 2019-11-09T04:24:59 | 2019-11-09T04:24:59 | 147,917,714 | 0 | 0 | null | false | 2022-06-17T01:46:35 | 2018-09-08T08:55:42 | 2019-11-09T04:25:12 | 2022-06-17T01:46:26 | 522 | 0 | 0 | 2 | Java | false | false | package leetcode_0701_0750.leetcode_0738;
import org.junit.Test;
public class Solution0738Test {
Solution0738 solution0738 = new Solution0738();
@Test
public void test1(){
}
} | UTF-8 | Java | 183 | java | Solution0738Test.java | Java | []
| null | []
| package leetcode_0701_0750.leetcode_0738;
import org.junit.Test;
public class Solution0738Test {
Solution0738 solution0738 = new Solution0738();
@Test
public void test1(){
}
} | 183 | 0.754098 | 0.595628 | 12 | 14.333333 | 16.947632 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false | 15 |
c51d397919428f411819886f90ff62ef8784b982 | 8,589,998,301 | e9d1b2db15b3ae752d61ea120185093d57381f73 | /mytcuml-src/src/java/components/project_action/trunk/src/java/tests/com/topcoder/uml/actions/project/MockCodeGenerator.java | cd21437fe058ed067ea7df8e4d0b61a290db9caa | []
| no_license | kinfkong/mytcuml | https://github.com/kinfkong/mytcuml | 9c65804d511ad997e0c4ba3004e7b831bf590757 | 0786c55945510e0004ff886ff01f7d714d7853ab | refs/heads/master | 2020-06-04T21:34:05.260000 | 2014-10-21T02:31:16 | 2014-10-21T02:31:16 | 25,495,964 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) 2006 TopCoder Inc., All Rights Reserved.
*/
package com.topcoder.uml.actions.project;
import java.util.ArrayList;
import java.util.List;
import com.topcoder.uml.model.core.Classifier;
import com.topcoder.uml.model.modelmanagement.Package;
import com.topcoder.uml.stubclassgenerator.CodeGenerator;
import com.topcoder.uml.stubclassgenerator.GeneratorConfigurationException;
/**
* <p>
* This is a mock extension of CodeGenerator.
* </p>
*
* @author TCSDEVELOPER
* @version 1.0
*/
public class MockCodeGenerator extends CodeGenerator {
public MockCodeGenerator() throws GeneratorConfigurationException {
super();
// TODO Auto-generated constructor stub
}
/**
* <p>
* Represents the language.
* </p>
*/
private String language;
/**
* <p>
* Represents the location (path).
* </p>
*/
private String location;
/**
* <p>
* Represents a list of Classifier.
* </p>
*/
private final List<Classifier> classifiers = new ArrayList<Classifier>();
/**
* <p>
* Represents a list of Package.
* </p>
*/
private final List<Package> packages = new ArrayList<Package>();
/**
* <p>
* Mock Stub implementation. Just assigns the values to the class variables for testing.
* </p>
* @param language
* the language used to generate the code
* @param location
* the location (path) to store the generated code files
* @param packages
* the packages list.
* @throws IllegalArgumentException
* when the location equals exception, used for exception testing.
*/
public void generateCode(String language, List<Package> packages, String location) {
// for checking the exception testing.
if (location.equals("exception")) {
throw new IllegalArgumentException();
}
this.language = language;
this.packages.addAll(packages);
this.location = location;
}
/**
* <p>
* Mock Stub implementation. Just assigns the values to the class variables for testing.
* </p>
* @param language
* the language used to generate the code
* @param location
* the location (path) to store the generated code files
* @param classifiers
* the Classifiers list.
*/
public void generateCode(String language, String location, List<Classifier> classifiers) {
this.language = language;
this.location = location;
this.classifiers.addAll(classifiers);
}
/**
* <p>
* Mock Stub implementation. Returns the classifiers list.
* </p>
*
* @return the classifiers list.
*/
public List<Classifier> getclassifiers() {
return classifiers;
}
/**
* <p>
* Mock Stub implementation. Returns the location.
* </p>
*
* @return the location.
*/
public String getlocation() {
return location;
}
/**
* <p>
* Mock Stub implementation. Returns the packages list.
* </p>
*
* @return the packages list.
*/
public List<Package> getpackages() {
return packages;
}
/**
* <p>
* Mock Stub implementation. Returns the language.
* </p>
*
* @return the language.
*/
public String getlanguage() {
return language;
}
}
| UTF-8 | Java | 3,491 | java | MockCodeGenerator.java | Java | [
{
"context": " extension of CodeGenerator.\n * </p>\n *\n * @author TCSDEVELOPER\n * @version 1.0\n */\npublic class MockCodeGenerato",
"end": 488,
"score": 0.9994747042655945,
"start": 476,
"tag": "USERNAME",
"value": "TCSDEVELOPER"
}
]
| null | []
| /*
* Copyright (C) 2006 TopCoder Inc., All Rights Reserved.
*/
package com.topcoder.uml.actions.project;
import java.util.ArrayList;
import java.util.List;
import com.topcoder.uml.model.core.Classifier;
import com.topcoder.uml.model.modelmanagement.Package;
import com.topcoder.uml.stubclassgenerator.CodeGenerator;
import com.topcoder.uml.stubclassgenerator.GeneratorConfigurationException;
/**
* <p>
* This is a mock extension of CodeGenerator.
* </p>
*
* @author TCSDEVELOPER
* @version 1.0
*/
public class MockCodeGenerator extends CodeGenerator {
public MockCodeGenerator() throws GeneratorConfigurationException {
super();
// TODO Auto-generated constructor stub
}
/**
* <p>
* Represents the language.
* </p>
*/
private String language;
/**
* <p>
* Represents the location (path).
* </p>
*/
private String location;
/**
* <p>
* Represents a list of Classifier.
* </p>
*/
private final List<Classifier> classifiers = new ArrayList<Classifier>();
/**
* <p>
* Represents a list of Package.
* </p>
*/
private final List<Package> packages = new ArrayList<Package>();
/**
* <p>
* Mock Stub implementation. Just assigns the values to the class variables for testing.
* </p>
* @param language
* the language used to generate the code
* @param location
* the location (path) to store the generated code files
* @param packages
* the packages list.
* @throws IllegalArgumentException
* when the location equals exception, used for exception testing.
*/
public void generateCode(String language, List<Package> packages, String location) {
// for checking the exception testing.
if (location.equals("exception")) {
throw new IllegalArgumentException();
}
this.language = language;
this.packages.addAll(packages);
this.location = location;
}
/**
* <p>
* Mock Stub implementation. Just assigns the values to the class variables for testing.
* </p>
* @param language
* the language used to generate the code
* @param location
* the location (path) to store the generated code files
* @param classifiers
* the Classifiers list.
*/
public void generateCode(String language, String location, List<Classifier> classifiers) {
this.language = language;
this.location = location;
this.classifiers.addAll(classifiers);
}
/**
* <p>
* Mock Stub implementation. Returns the classifiers list.
* </p>
*
* @return the classifiers list.
*/
public List<Classifier> getclassifiers() {
return classifiers;
}
/**
* <p>
* Mock Stub implementation. Returns the location.
* </p>
*
* @return the location.
*/
public String getlocation() {
return location;
}
/**
* <p>
* Mock Stub implementation. Returns the packages list.
* </p>
*
* @return the packages list.
*/
public List<Package> getpackages() {
return packages;
}
/**
* <p>
* Mock Stub implementation. Returns the language.
* </p>
*
* @return the language.
*/
public String getlanguage() {
return language;
}
}
| 3,491 | 0.594672 | 0.592953 | 140 | 23.935715 | 23.501736 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.207143 | false | false | 15 |
c6397cff19b0c0c3fa9d8710f55b8d464a6376c1 | 6,682,969,167,250 | 49b75fd17df7899dcb4c958b5e76c0183cd570b8 | /src/main/java/com/xshi/xchat/controller/UserController.java | 42697be862744a92d5f1a2a7c4357aa100fe2abc | []
| no_license | shixs/xChat | https://github.com/shixs/xChat | 13ad305970acfca2880a9527ffb04feff0fbf307 | d4ba90bebfa23a69290beeda0e5c17603e8d2eed | refs/heads/master | 2021-01-01T05:03:12.175000 | 2016-05-05T15:13:36 | 2016-05-05T15:13:36 | 58,139,368 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xshi.xchat.controller;
import com.xshi.xchat.model.UMessage;
import com.xshi.xchat.model.User;
import com.xshi.xchat.representation.UserRepresentation;
import com.xshi.xchat.security.PasswordHash;
import com.xshi.xchat.services.UserService;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.LoggerContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.util.UriComponentsBuilder;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
/**
* Created by sheng on 4/12/2016.
*/
@RestController
@RequestMapping
public class UserController {
private static final Logger log = LoggerContext.getContext().getLogger(UserController.class.getName());
@Autowired
private UserService userService;
@Autowired
private PasswordHash passwordHash;
@MessageMapping("/chat")
@SendTo("/topic/messages")
public UMessage chat(UMessage message) throws Exception{
Date date = new Date();
return new UMessage(message,new Timestamp(date.getTime()));
}
@RequestMapping(value = "/user/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<User> getUser(@PathVariable("id") int id) {
log.info("Fetching User with id " + id);
User user = userService.findUser(id);
if (user == null) {
log.info("User with id " + id + "not found.");
return new ResponseEntity<User>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<User>(user, HttpStatus.OK);
}
@RequestMapping(value = "/user/{id}/password", method = RequestMethod.PUT)
public ResponseEntity<User> reSetPassword(@PathVariable("id") int id, @RequestParam(value = "password") String password) {
log.info("Resetting user password with user id " + id);
User user = userService.findUser(id);
try {
String hashedPassword = passwordHash.createHash(password);
String salt = passwordHash.getPasswordSalt();
user.setUser_password(hashedPassword);
user.setUser_password_salt(salt);
} catch (NoSuchAlgorithmException e) {
log.error("Failed resetting password: " + e.getMessage());
return new ResponseEntity<User>(HttpStatus.CONFLICT);
} catch (InvalidKeySpecException e) {
log.error("Failed resetting password: " + e.getMessage());
return new ResponseEntity<User>(HttpStatus.CONFLICT);
}
userService.updateUser(user);
return new ResponseEntity<User>(HttpStatus.OK);
}
@RequestMapping(value = "/login", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@CrossOrigin(origins = "http://localhost:8080")
public ResponseEntity<UserRepresentation> login(@RequestBody User user) {
log.info("User login with name " + user.getUser_name());
User currUser = userService.findUserByName(user.getUser_name());
if (currUser == null) {
return new ResponseEntity<UserRepresentation>(HttpStatus.NOT_FOUND);
}
try {
if (passwordHash.validatePassword(user.getUser_password(), currUser.getUser_password())) {
return new ResponseEntity<UserRepresentation>(new UserRepresentation(currUser), HttpStatus.OK);
} else {
return new ResponseEntity<UserRepresentation>(HttpStatus.CONFLICT);
}
} catch (NoSuchAlgorithmException e) {
log.error("Failed login with the user name = " + user.getUser_name() + "\n" + e.getMessage());
return new ResponseEntity<UserRepresentation>(HttpStatus.CONFLICT);
} catch (InvalidKeySpecException e) {
log.error("Failed login with the user name = " + user.getUser_name() + "\n" + e.getMessage());
return new ResponseEntity<UserRepresentation>(HttpStatus.CONFLICT);
}
}
@RequestMapping(value = "/user", method = RequestMethod.GET)
public ResponseEntity<List<User>> listAllUsers() {
log.info("Fetching All registered user...");
List<User> users = userService.findAllUser();
if (users.isEmpty()) {
return new ResponseEntity<List<User>>(HttpStatus.NO_CONTENT);
}
return new ResponseEntity<List<User>>(users, HttpStatus.OK);
}
@RequestMapping(value = "/user",method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Void> createUser(@RequestBody User user, UriComponentsBuilder uriComponentsBuilder) {
log.info("Creating User " + user.getUser_name());
if (userService.isUserExist(user)) {
log.info("A User with name " + user.getUser_name() + "already exist.");
return new ResponseEntity<Void>(HttpStatus.CONFLICT);
}
userService.addUser(user);
HttpHeaders headers = new HttpHeaders();
headers.setLocation(uriComponentsBuilder.path("/{id}").buildAndExpand(user.getUser_id()).toUri());
return new ResponseEntity<Void>(headers, HttpStatus.CREATED);
}
}
| UTF-8 | Java | 5,705 | java | UserController.java | Java | [
{
"context": "il.Date;\nimport java.util.List;\n\n/**\n * Created by sheng on 4/12/2016.\n */\n@RestController\n@RequestMapping",
"end": 1035,
"score": 0.9270569086074829,
"start": 1030,
"tag": "USERNAME",
"value": "sheng"
}
]
| null | []
| package com.xshi.xchat.controller;
import com.xshi.xchat.model.UMessage;
import com.xshi.xchat.model.User;
import com.xshi.xchat.representation.UserRepresentation;
import com.xshi.xchat.security.PasswordHash;
import com.xshi.xchat.services.UserService;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.LoggerContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.util.UriComponentsBuilder;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
/**
* Created by sheng on 4/12/2016.
*/
@RestController
@RequestMapping
public class UserController {
private static final Logger log = LoggerContext.getContext().getLogger(UserController.class.getName());
@Autowired
private UserService userService;
@Autowired
private PasswordHash passwordHash;
@MessageMapping("/chat")
@SendTo("/topic/messages")
public UMessage chat(UMessage message) throws Exception{
Date date = new Date();
return new UMessage(message,new Timestamp(date.getTime()));
}
@RequestMapping(value = "/user/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<User> getUser(@PathVariable("id") int id) {
log.info("Fetching User with id " + id);
User user = userService.findUser(id);
if (user == null) {
log.info("User with id " + id + "not found.");
return new ResponseEntity<User>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<User>(user, HttpStatus.OK);
}
@RequestMapping(value = "/user/{id}/password", method = RequestMethod.PUT)
public ResponseEntity<User> reSetPassword(@PathVariable("id") int id, @RequestParam(value = "password") String password) {
log.info("Resetting user password with user id " + id);
User user = userService.findUser(id);
try {
String hashedPassword = passwordHash.createHash(password);
String salt = passwordHash.getPasswordSalt();
user.setUser_password(hashedPassword);
user.setUser_password_salt(salt);
} catch (NoSuchAlgorithmException e) {
log.error("Failed resetting password: " + e.getMessage());
return new ResponseEntity<User>(HttpStatus.CONFLICT);
} catch (InvalidKeySpecException e) {
log.error("Failed resetting password: " + e.getMessage());
return new ResponseEntity<User>(HttpStatus.CONFLICT);
}
userService.updateUser(user);
return new ResponseEntity<User>(HttpStatus.OK);
}
@RequestMapping(value = "/login", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@CrossOrigin(origins = "http://localhost:8080")
public ResponseEntity<UserRepresentation> login(@RequestBody User user) {
log.info("User login with name " + user.getUser_name());
User currUser = userService.findUserByName(user.getUser_name());
if (currUser == null) {
return new ResponseEntity<UserRepresentation>(HttpStatus.NOT_FOUND);
}
try {
if (passwordHash.validatePassword(user.getUser_password(), currUser.getUser_password())) {
return new ResponseEntity<UserRepresentation>(new UserRepresentation(currUser), HttpStatus.OK);
} else {
return new ResponseEntity<UserRepresentation>(HttpStatus.CONFLICT);
}
} catch (NoSuchAlgorithmException e) {
log.error("Failed login with the user name = " + user.getUser_name() + "\n" + e.getMessage());
return new ResponseEntity<UserRepresentation>(HttpStatus.CONFLICT);
} catch (InvalidKeySpecException e) {
log.error("Failed login with the user name = " + user.getUser_name() + "\n" + e.getMessage());
return new ResponseEntity<UserRepresentation>(HttpStatus.CONFLICT);
}
}
@RequestMapping(value = "/user", method = RequestMethod.GET)
public ResponseEntity<List<User>> listAllUsers() {
log.info("Fetching All registered user...");
List<User> users = userService.findAllUser();
if (users.isEmpty()) {
return new ResponseEntity<List<User>>(HttpStatus.NO_CONTENT);
}
return new ResponseEntity<List<User>>(users, HttpStatus.OK);
}
@RequestMapping(value = "/user",method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Void> createUser(@RequestBody User user, UriComponentsBuilder uriComponentsBuilder) {
log.info("Creating User " + user.getUser_name());
if (userService.isUserExist(user)) {
log.info("A User with name " + user.getUser_name() + "already exist.");
return new ResponseEntity<Void>(HttpStatus.CONFLICT);
}
userService.addUser(user);
HttpHeaders headers = new HttpHeaders();
headers.setLocation(uriComponentsBuilder.path("/{id}").buildAndExpand(user.getUser_id()).toUri());
return new ResponseEntity<Void>(headers, HttpStatus.CREATED);
}
}
| 5,705 | 0.690798 | 0.688519 | 124 | 45.008064 | 33.687008 | 156 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.66129 | false | false | 15 |
affefa2cf1184a7d96d068f21f1eaf524974141e | 609,885,420,826 | bc24a9e0653af1f1f3b3b4cf07ff24098bd57361 | /business/src/test/java/com/softexpert/business/sortition/UserExperimentSortitionServiceTest.java | b8bda5036f38ce1e3d34d21d70300878c5edf331 | []
| no_license | pologood/abtest | https://github.com/pologood/abtest | bf3f7235f50f227c34584499aa90f34a16f33a2d | 0d79ea68151c0a2f622c027a96a89447b581313d | refs/heads/master | 2021-01-19T10:42:41.623000 | 2016-01-21T19:14:18 | 2016-01-21T19:14:18 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.softexpert.business.sortition;
import static com.softexpert.business.experiment.ExperimentTestBuilder.createExperiment;
import java.math.BigDecimal;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;
import com.softexpert.persistence.UserExperiment;
public class UserExperimentSortitionServiceTest {
@InjectMocks
private UserExperimentSortitionService service;
@Before
public void init() {
MockitoAnnotations.initMocks(this);
}
@Test
public void randomWithSingleVariation() {
UserExperiment experiment = service.sortition(createExperiment("DEFAULT_FRAME", new BigDecimal(100D), "NEW"));
MatcherAssert.assertThat(experiment.experiment.name, Matchers.equalTo("DEFAULT_FRAME"));
MatcherAssert.assertThat(experiment.variation.name, Matchers.equalTo("NEW"));
}
@Test
public void randomWithLowerCase() {
UserExperiment experiment = service.sortition(createExperiment("DEFAULT_FRAME", new BigDecimal(100D), "nEw"));
MatcherAssert.assertThat(experiment.experiment.name, Matchers.equalTo("DEFAULT_FRAME"));
MatcherAssert.assertThat(experiment.variation.name, Matchers.equalTo("NEW"));
}
@Test
public void randomWithVariation() {
UserExperiment experiment = service.sortition(createExperiment("DEFAULT_FRAME", new BigDecimal(100D), "NEW"));
MatcherAssert.assertThat(experiment.experiment.name, Matchers.equalTo("DEFAULT_FRAME"));
MatcherAssert.assertThat(experiment.variation.name,
Matchers.anyOf(Matchers.equalTo("NEW"), Matchers.equalTo("OLD")));
}
@Test
public void randomWithSomeUsersSimpleVariation() {
UserExperiment experiment = service.sortition(createExperiment("DASHBOARD", new BigDecimal(50D), "OLD"));
MatcherAssert.assertThat(experiment.variation.name,
Matchers.anyOf(Matchers.equalTo("OLD"), Matchers.nullValue()));
}
@Test
public void randomWithSomeUsersVariation() {
UserExperiment experiment = service.sortition(createExperiment("DASHBOARD", new BigDecimal(50D), "NEW", "OLD"));
MatcherAssert.assertThat(experiment.variation.name,
Matchers.anyOf(Matchers.equalTo("NEW"), Matchers.equalTo("OLD"), Matchers.nullValue()));
}
@Test
public void randomWithSomeUsersWithoutVariation() {
UserExperiment experiment = service.sortition(createExperiment("DASHBOARD", new BigDecimal(50D)));
MatcherAssert.assertThat(experiment.variation.name, Matchers.nullValue());
}
@Test
public void randomWithMinLimit() {
UserExperiment experiment = service
.sortition(createExperiment("DASHBOARD", new BigDecimal(0.00000000000001D), "OLD"));
MatcherAssert.assertThat(experiment.variation.name, Matchers.nullValue());
}
@Test
public void randomWithMaxLimit() {
UserExperiment experiment = service
.sortition(createExperiment("DASHBOARD", new BigDecimal(99.99999999999999D), "OLD"));
MatcherAssert.assertThat(experiment.variation.name, Matchers.equalTo("OLD"));
}
}
| UTF-8 | Java | 2,997 | java | UserExperimentSortitionServiceTest.java | Java | []
| null | []
| package com.softexpert.business.sortition;
import static com.softexpert.business.experiment.ExperimentTestBuilder.createExperiment;
import java.math.BigDecimal;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;
import com.softexpert.persistence.UserExperiment;
public class UserExperimentSortitionServiceTest {
@InjectMocks
private UserExperimentSortitionService service;
@Before
public void init() {
MockitoAnnotations.initMocks(this);
}
@Test
public void randomWithSingleVariation() {
UserExperiment experiment = service.sortition(createExperiment("DEFAULT_FRAME", new BigDecimal(100D), "NEW"));
MatcherAssert.assertThat(experiment.experiment.name, Matchers.equalTo("DEFAULT_FRAME"));
MatcherAssert.assertThat(experiment.variation.name, Matchers.equalTo("NEW"));
}
@Test
public void randomWithLowerCase() {
UserExperiment experiment = service.sortition(createExperiment("DEFAULT_FRAME", new BigDecimal(100D), "nEw"));
MatcherAssert.assertThat(experiment.experiment.name, Matchers.equalTo("DEFAULT_FRAME"));
MatcherAssert.assertThat(experiment.variation.name, Matchers.equalTo("NEW"));
}
@Test
public void randomWithVariation() {
UserExperiment experiment = service.sortition(createExperiment("DEFAULT_FRAME", new BigDecimal(100D), "NEW"));
MatcherAssert.assertThat(experiment.experiment.name, Matchers.equalTo("DEFAULT_FRAME"));
MatcherAssert.assertThat(experiment.variation.name,
Matchers.anyOf(Matchers.equalTo("NEW"), Matchers.equalTo("OLD")));
}
@Test
public void randomWithSomeUsersSimpleVariation() {
UserExperiment experiment = service.sortition(createExperiment("DASHBOARD", new BigDecimal(50D), "OLD"));
MatcherAssert.assertThat(experiment.variation.name,
Matchers.anyOf(Matchers.equalTo("OLD"), Matchers.nullValue()));
}
@Test
public void randomWithSomeUsersVariation() {
UserExperiment experiment = service.sortition(createExperiment("DASHBOARD", new BigDecimal(50D), "NEW", "OLD"));
MatcherAssert.assertThat(experiment.variation.name,
Matchers.anyOf(Matchers.equalTo("NEW"), Matchers.equalTo("OLD"), Matchers.nullValue()));
}
@Test
public void randomWithSomeUsersWithoutVariation() {
UserExperiment experiment = service.sortition(createExperiment("DASHBOARD", new BigDecimal(50D)));
MatcherAssert.assertThat(experiment.variation.name, Matchers.nullValue());
}
@Test
public void randomWithMinLimit() {
UserExperiment experiment = service
.sortition(createExperiment("DASHBOARD", new BigDecimal(0.00000000000001D), "OLD"));
MatcherAssert.assertThat(experiment.variation.name, Matchers.nullValue());
}
@Test
public void randomWithMaxLimit() {
UserExperiment experiment = service
.sortition(createExperiment("DASHBOARD", new BigDecimal(99.99999999999999D), "OLD"));
MatcherAssert.assertThat(experiment.variation.name, Matchers.equalTo("OLD"));
}
}
| 2,997 | 0.784117 | 0.768769 | 82 | 35.548782 | 36.135635 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.841463 | false | false | 15 |
417f15b5900d4e60a45f2165bd409b783f2eedca | 22,393,959,530,830 | 9d7af1d29563708c856c00326cb8265668f514e5 | /src/main/java/com/td/bbwp/wf/CaseStatus.java | 44790e968e792d3693892d0c85b16fd12b666b33 | []
| no_license | codeworxzw/springReact | https://github.com/codeworxzw/springReact | be4eae251a3c2d7bf44bfe7339bad1776f4c6be8 | 0a6b8a67e43d11761a628ecd6daa3af55ed84f6e | refs/heads/master | 2021-01-23T04:20:32.058000 | 2017-04-13T20:41:30 | 2017-04-13T20:41:30 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.td.bbwp.wf;
public enum CaseStatus {
ACTIVE,
COMPLETE,
ABORTED,
SUSPENDED
}
| UTF-8 | Java | 114 | java | CaseStatus.java | Java | []
| null | []
|
package com.td.bbwp.wf;
public enum CaseStatus {
ACTIVE,
COMPLETE,
ABORTED,
SUSPENDED
}
| 114 | 0.596491 | 0.596491 | 13 | 6.615385 | 8.241905 | 24 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.692308 | false | false | 15 |
3651069608580dc8d7c9a8c6cd7bb6eb589b8213 | 2,851,858,322,352 | 588f89741c0e5fdc194f17836d36722d8840d4ea | /sqlman-core/src/main/java/io/sqlman/core/SqlVersion.java | 9e191b36ff7f28a80dd85c2135ddb7b81bcc4e21 | [
"Apache-2.0"
]
| permissive | core-lib/sqlman | https://github.com/core-lib/sqlman | 4f0f2df89bbcfd1c32f90c0fd7dbaf7e870a755d | c0e18ad0802465196db278aedca3e1dc09aad8aa | refs/heads/master | 2022-12-28T18:09:54.629000 | 2019-12-25T07:50:44 | 2019-12-25T07:50:44 | 187,319,939 | 21 | 8 | Apache-2.0 | false | 2022-12-14T20:34:58 | 2019-05-18T05:51:46 | 2021-09-26T02:22:16 | 2022-12-14T20:34:58 | 2,869 | 17 | 5 | 5 | Java | false | false | package io.sqlman.core;
import java.sql.Timestamp;
/**
* 数据库版本
*
* @author Payne 646742615@qq.com
* 2019/5/18 13:48
*/
public class SqlVersion {
private Integer id;
private String name;
private String version;
private Integer ordinal;
private String description;
private Integer sqlQuantity;
private Boolean success;
private Integer rowEffected;
private Integer errorCode;
private String errorState;
private String errorMessage;
private Timestamp timeExecuted;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public Integer getOrdinal() {
return ordinal;
}
public void setOrdinal(Integer ordinal) {
this.ordinal = ordinal;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getSqlQuantity() {
return sqlQuantity;
}
public void setSqlQuantity(Integer sqlQuantity) {
this.sqlQuantity = sqlQuantity;
}
public Boolean getSuccess() {
return success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
public Integer getRowEffected() {
return rowEffected;
}
public void setRowEffected(Integer rowEffected) {
this.rowEffected = rowEffected;
}
public Integer getErrorCode() {
return errorCode;
}
public void setErrorCode(Integer errorCode) {
this.errorCode = errorCode;
}
public String getErrorState() {
return errorState;
}
public void setErrorState(String errorState) {
this.errorState = errorState;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public Timestamp getTimeExecuted() {
return timeExecuted;
}
public void setTimeExecuted(Timestamp timeExecuted) {
this.timeExecuted = timeExecuted;
}
@Override
public String toString() {
return "" + version + "#" + ordinal;
}
}
| UTF-8 | Java | 2,534 | java | SqlVersion.java | Java | [
{
"context": "rt java.sql.Timestamp;\n\n/**\n * 数据库版本\n *\n * @author Payne 646742615@qq.com\n * 2019/5/18 13:48\n */\npublic cl",
"end": 86,
"score": 0.9995114803314209,
"start": 81,
"tag": "NAME",
"value": "Payne"
},
{
"context": ".sql.Timestamp;\n\n/**\n * 数据库版本\n *\n * @author Payne 646742615@qq.com\n * 2019/5/18 13:48\n */\npublic class SqlVersion {\n",
"end": 103,
"score": 0.9998877644538879,
"start": 87,
"tag": "EMAIL",
"value": "646742615@qq.com"
}
]
| null | []
| package io.sqlman.core;
import java.sql.Timestamp;
/**
* 数据库版本
*
* @author Payne <EMAIL>
* 2019/5/18 13:48
*/
public class SqlVersion {
private Integer id;
private String name;
private String version;
private Integer ordinal;
private String description;
private Integer sqlQuantity;
private Boolean success;
private Integer rowEffected;
private Integer errorCode;
private String errorState;
private String errorMessage;
private Timestamp timeExecuted;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public Integer getOrdinal() {
return ordinal;
}
public void setOrdinal(Integer ordinal) {
this.ordinal = ordinal;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getSqlQuantity() {
return sqlQuantity;
}
public void setSqlQuantity(Integer sqlQuantity) {
this.sqlQuantity = sqlQuantity;
}
public Boolean getSuccess() {
return success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
public Integer getRowEffected() {
return rowEffected;
}
public void setRowEffected(Integer rowEffected) {
this.rowEffected = rowEffected;
}
public Integer getErrorCode() {
return errorCode;
}
public void setErrorCode(Integer errorCode) {
this.errorCode = errorCode;
}
public String getErrorState() {
return errorState;
}
public void setErrorState(String errorState) {
this.errorState = errorState;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public Timestamp getTimeExecuted() {
return timeExecuted;
}
public void setTimeExecuted(Timestamp timeExecuted) {
this.timeExecuted = timeExecuted;
}
@Override
public String toString() {
return "" + version + "#" + ordinal;
}
}
| 2,525 | 0.627179 | 0.619255 | 126 | 19.031746 | 16.888964 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.309524 | false | false | 15 |
2a4642fde3653c13ce35123d2990dd19d2d63e47 | 30,571,577,280,492 | 12773841e1a5767c20948303c375c8870e73f605 | /app/src/main/java/com/evacuator/uses/evacuator/Order/OrderDetailsActivity.java | b74555331500673735378429b8a803af0b6b5213 | []
| no_license | PapinPar/Evacuator | https://github.com/PapinPar/Evacuator | fbf934e8fc73c02638c862f3e227e3fb2fc9166c | 813872f272d30ca7ed4efb63cbdeb8c019d5a42a | refs/heads/master | 2021-01-09T09:33:24.330000 | 2016-01-14T10:29:37 | 2016-01-14T10:29:37 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.evacuator.uses.evacuator.Order;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Switch;
import android.widget.TextView;
import com.evacuator.uses.evacuator.R;
/**
* Created by root on 06.01.16.
*/
public class OrderDetailsActivity extends AppCompatActivity implements View.OnClickListener
{
String myAddres,AddresWhen,idBrand,idModel,car_type,time,tmp,gps_longitude,gps_latitude;
Double sum,tmpD,weight;
int count_wheels;
EditText coment;
TextView ALL_SUM;
Boolean blocked_wheels=false,blocked_steering_wheel=false,low_landing=false,need_manipul;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.details_order);
count_wheels=0;
myAddres = getIntent().getStringExtra("myAddres");
AddresWhen = getIntent().getStringExtra("AddresWhen");
idBrand = getIntent().getStringExtra("idBrand");
idModel = getIntent().getStringExtra("idModel");
car_type = getIntent().getStringExtra("car_type");
time = getIntent().getStringExtra("time");
sum = getIntent().getDoubleExtra("SUM", 0);
weight = getIntent().getDoubleExtra("weight", 0);
gps_latitude = getIntent().getStringExtra("gps_latitude");
gps_longitude = getIntent().getStringExtra("gps_longitude");
need_manipul = getIntent().getBooleanExtra("manipulator_required",false);
coment = (EditText)findViewById(R.id.coments);
ALL_SUM = (TextView)findViewById(R.id.all_cost);
int a = (int) Math.round(sum);
ALL_SUM.setText(String.valueOf(a));
Switch block_rule = (Switch) findViewById(R.id.check_3);
block_rule.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (isChecked)
{
blocked_steering_wheel = true;
ALL_SUM.setText(String.valueOf(sum + 500));
} else
{
blocked_steering_wheel = false;
tmp = ALL_SUM.getText().toString();
tmpD = Double.parseDouble(tmp);
ALL_SUM.setText(String.valueOf(tmpD - 500));
}
}
});
final Switch low_land = (Switch) findViewById(R.id.check_2);
low_land.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (isChecked)
{
low_landing = true;
} else
{
low_landing = false;
}
}
});
String[] data = {"0","1","2","3","4"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, data);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner spine;
spine = (Spinner) findViewById(R.id.spin_wheel);
spine.setAdapter(adapter);
spine.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
if(position==0)
blocked_wheels=false;
else
{
blocked_wheels=true;
count_wheels = position;
}
}
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
@Override
public void onClick(View v)
{
switch (v.getId())
{
case R.id.create_order:
Intent phone = new Intent(this,OrderInfoActivity.class);
phone.putExtra("idBrand",String.valueOf(idBrand));
phone.putExtra("idModel",String.valueOf(idModel));
phone.putExtra("time",time);
phone.putExtra("weight",weight);
phone.putExtra("blocked_wheels",blocked_wheels);
phone.putExtra("blocked_wheels_cnt",count_wheels);
phone.putExtra("blocked_steering_wheel",blocked_steering_wheel);
phone.putExtra("low_landing",low_landing);
phone.putExtra("car_type",String.valueOf(car_type));
phone.putExtra("gps_longitude",gps_longitude);
phone.putExtra("gps_latitude",gps_latitude);
phone.putExtra("address",myAddres);
phone.putExtra("manipulator_required",need_manipul);
phone.putExtra("destination_address",String.valueOf(AddresWhen));
phone.putExtra("comment",coment.getText().toString());
//phone.putExtra("SUM",String.valueOf(sum));
startActivity(phone);
}
}
} | UTF-8 | Java | 5,411 | java | OrderDetailsActivity.java | Java | [
{
"context": "om.evacuator.uses.evacuator.R;\n\n\n/**\n * Created by root on 06.01.16.\n */\npublic class OrderDetailsActivit",
"end": 476,
"score": 0.9970952272415161,
"start": 472,
"tag": "USERNAME",
"value": "root"
}
]
| null | []
| package com.evacuator.uses.evacuator.Order;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Switch;
import android.widget.TextView;
import com.evacuator.uses.evacuator.R;
/**
* Created by root on 06.01.16.
*/
public class OrderDetailsActivity extends AppCompatActivity implements View.OnClickListener
{
String myAddres,AddresWhen,idBrand,idModel,car_type,time,tmp,gps_longitude,gps_latitude;
Double sum,tmpD,weight;
int count_wheels;
EditText coment;
TextView ALL_SUM;
Boolean blocked_wheels=false,blocked_steering_wheel=false,low_landing=false,need_manipul;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.details_order);
count_wheels=0;
myAddres = getIntent().getStringExtra("myAddres");
AddresWhen = getIntent().getStringExtra("AddresWhen");
idBrand = getIntent().getStringExtra("idBrand");
idModel = getIntent().getStringExtra("idModel");
car_type = getIntent().getStringExtra("car_type");
time = getIntent().getStringExtra("time");
sum = getIntent().getDoubleExtra("SUM", 0);
weight = getIntent().getDoubleExtra("weight", 0);
gps_latitude = getIntent().getStringExtra("gps_latitude");
gps_longitude = getIntent().getStringExtra("gps_longitude");
need_manipul = getIntent().getBooleanExtra("manipulator_required",false);
coment = (EditText)findViewById(R.id.coments);
ALL_SUM = (TextView)findViewById(R.id.all_cost);
int a = (int) Math.round(sum);
ALL_SUM.setText(String.valueOf(a));
Switch block_rule = (Switch) findViewById(R.id.check_3);
block_rule.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (isChecked)
{
blocked_steering_wheel = true;
ALL_SUM.setText(String.valueOf(sum + 500));
} else
{
blocked_steering_wheel = false;
tmp = ALL_SUM.getText().toString();
tmpD = Double.parseDouble(tmp);
ALL_SUM.setText(String.valueOf(tmpD - 500));
}
}
});
final Switch low_land = (Switch) findViewById(R.id.check_2);
low_land.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (isChecked)
{
low_landing = true;
} else
{
low_landing = false;
}
}
});
String[] data = {"0","1","2","3","4"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, data);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner spine;
spine = (Spinner) findViewById(R.id.spin_wheel);
spine.setAdapter(adapter);
spine.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
if(position==0)
blocked_wheels=false;
else
{
blocked_wheels=true;
count_wheels = position;
}
}
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
@Override
public void onClick(View v)
{
switch (v.getId())
{
case R.id.create_order:
Intent phone = new Intent(this,OrderInfoActivity.class);
phone.putExtra("idBrand",String.valueOf(idBrand));
phone.putExtra("idModel",String.valueOf(idModel));
phone.putExtra("time",time);
phone.putExtra("weight",weight);
phone.putExtra("blocked_wheels",blocked_wheels);
phone.putExtra("blocked_wheels_cnt",count_wheels);
phone.putExtra("blocked_steering_wheel",blocked_steering_wheel);
phone.putExtra("low_landing",low_landing);
phone.putExtra("car_type",String.valueOf(car_type));
phone.putExtra("gps_longitude",gps_longitude);
phone.putExtra("gps_latitude",gps_latitude);
phone.putExtra("address",myAddres);
phone.putExtra("manipulator_required",need_manipul);
phone.putExtra("destination_address",String.valueOf(AddresWhen));
phone.putExtra("comment",coment.getText().toString());
//phone.putExtra("SUM",String.valueOf(sum));
startActivity(phone);
}
}
} | 5,411 | 0.590649 | 0.586213 | 133 | 39.69173 | 26.309374 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.909774 | false | false | 15 |
2c2e877ffa33d3cd25eee1bc23cc23b33b5f6e75 | 24,867,860,678,910 | b8a2af585195236cf67de7fba0cdd9b408f9c584 | /src/main/java/by/itClass/servlets/MainServlet.java | a0f68e66cc57b57920e280db38ec1d23358c434e | []
| no_license | ruslan547/Lesson40_WebApp01 | https://github.com/ruslan547/Lesson40_WebApp01 | 2c589df3e71afff2f07a25fae9b254bcfe22c8d5 | 1a48dd18432ed2f1da4f913d9de318d324804701 | refs/heads/main | 2023-04-16T20:20:38.355000 | 2021-04-29T17:50:17 | 2021-04-29T17:50:17 | 359,505,230 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package by.itClass.servlets;
import by.itClass.entity.User;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet(name = "MainServlet", urlPatterns = {"/main"})
public class MainServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String str = "Hello Java Web from IT Class!";
RequestDispatcher rd = request.getRequestDispatcher("/main.jsp");
User user = new User(1, "alex1993", "Alexander");
request.setAttribute("message", str);
request.setAttribute("us", user);
rd.forward(request, response);
}
}
| UTF-8 | Java | 897 | java | MainServlet.java | Java | [
{
"context": "er(\"/main.jsp\");\n User user = new User(1, \"alex1993\", \"Alexander\");\n\n request.setAttribute(\"me",
"end": 744,
"score": 0.9996472597122192,
"start": 736,
"tag": "USERNAME",
"value": "alex1993"
},
{
"context": "p\");\n User user = new User(1, \"alex1993\", \"Alexander\");\n\n request.setAttribute(\"message\", str);",
"end": 757,
"score": 0.9996989369392395,
"start": 748,
"tag": "NAME",
"value": "Alexander"
}
]
| null | []
| package by.itClass.servlets;
import by.itClass.entity.User;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet(name = "MainServlet", urlPatterns = {"/main"})
public class MainServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String str = "Hello Java Web from IT Class!";
RequestDispatcher rd = request.getRequestDispatcher("/main.jsp");
User user = new User(1, "alex1993", "Alexander");
request.setAttribute("message", str);
request.setAttribute("us", user);
rd.forward(request, response);
}
}
| 897 | 0.749164 | 0.74359 | 25 | 34.880001 | 27.626537 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.92 | false | false | 15 |
e3f6f52bbff52e917b1595d99c524d880898412d | 11,020,886,135,509 | 917ad7031dbdf555ea82e05d0d70f29c64a44a6f | /최규성/day36/java/di_test01/CalcMain5.java | ab59fe16f73fcfe17d77df77d73dd862eb2ebce9 | []
| no_license | qrtz7950/bit | https://github.com/qrtz7950/bit | 9bd001e224ed1cfd649a24768e594b6230e87529 | 42d2c8a62aa4f273d66497bb6538c3b84a2f44b7 | refs/heads/master | 2020-03-22T04:40:24.844000 | 2018-10-18T04:18:24 | 2018-10-18T04:18:24 | 139,512,969 | 1 | 2 | null | false | 2018-07-03T03:49:07 | 2018-07-03T01:32:48 | 2018-07-03T03:48:20 | 2018-07-03T03:48:18 | 0 | 0 | 1 | 0 | null | false | null | package di_test01;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
public class CalcMain5 {
public static void main(String[] args) {
// TODO Auto-generated method stub
// Calculator calculator = new Calculator();
// MyCalculator my = new MyCalculator(calculator);
ApplicationContext context =
new GenericXmlApplicationContext("di_test01_05.xml");
MyCalculator my = context.getBean("myCalculator", MyCalculator.class);
my.add();
my.sub();
my.mul();
my.div();
}
}
| UTF-8 | Java | 607 | java | CalcMain5.java | Java | []
| null | []
| package di_test01;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
public class CalcMain5 {
public static void main(String[] args) {
// TODO Auto-generated method stub
// Calculator calculator = new Calculator();
// MyCalculator my = new MyCalculator(calculator);
ApplicationContext context =
new GenericXmlApplicationContext("di_test01_05.xml");
MyCalculator my = context.getBean("myCalculator", MyCalculator.class);
my.add();
my.sub();
my.mul();
my.div();
}
}
| 607 | 0.700165 | 0.688633 | 25 | 22.280001 | 23.742823 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.8 | false | false | 15 |
b7621f497bc9b61f94a8ccc363911ab19df8e612 | 12,979,391,236,616 | a98f6db6f1c397e9bd5bdef859d7f3eca24dbc94 | /JOO_Aulas_ModuloII/src/aula_3_55_Enum_ValueEvalueOf/TesteEnum.java | f0c26d51bdf372fcf253ef3b91204b3476134329 | []
| no_license | rafaelcarvalhocaetano/Exercicios_Loiane | https://github.com/rafaelcarvalhocaetano/Exercicios_Loiane | 66aac4072a0f6f4f6591f8051db5d4bd02487f38 | ea84a5b9d14560e4b5e0f52594c4998be70f9ab0 | refs/heads/master | 2020-05-21T22:43:17.312000 | 2017-03-28T10:49:11 | 2017-03-28T10:49:11 | 63,433,192 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package aula_3_55_Enum_ValueEvalueOf;
import aula_2_54_EnumComoClass.DiaSemana;
public class TesteEnum {
public static void main(String[] args) {
DiaSemana[] dias = DiaSemana.values();
for(int i=0; i<dias.length;i++){
System.out.println(dias[i]);
}
System.out.println();
for(DiaSemana dia : DiaSemana.values()){
System.out.println(dia);
}
}
}
| UTF-8 | Java | 416 | java | TesteEnum.java | Java | []
| null | []
| package aula_3_55_Enum_ValueEvalueOf;
import aula_2_54_EnumComoClass.DiaSemana;
public class TesteEnum {
public static void main(String[] args) {
DiaSemana[] dias = DiaSemana.values();
for(int i=0; i<dias.length;i++){
System.out.println(dias[i]);
}
System.out.println();
for(DiaSemana dia : DiaSemana.values()){
System.out.println(dia);
}
}
}
| 416 | 0.600962 | 0.584135 | 26 | 14 | 16.415283 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.653846 | false | false | 15 |
aee15d640a48aeb66e900d6273f69155ddfbf2f3 | 12,979,391,236,459 | 5fd5e668c3b89d327705573e289d55745cba5f37 | /src/main/java/interview/E_ConversionFromOcta.java | 5eef16548e14c05fa243c35c7af2270ca636de99 | []
| no_license | sheetal0123/OceanWay | https://github.com/sheetal0123/OceanWay | df016fb8a027e7542e85deb7e1db5b38930ba1e8 | 746a61d0c1478bd497d6ea12bd863b932e03cfdb | refs/heads/master | 2022-12-21T11:41:28.481000 | 2022-07-26T11:39:02 | 2022-07-26T11:39:02 | 42,355,520 | 0 | 1 | null | false | 2022-12-14T20:41:15 | 2015-09-12T11:58:59 | 2022-01-11T16:51:25 | 2022-12-14T20:41:12 | 37,017 | 0 | 1 | 12 | Java | false | false | package interview;
import java.util.Scanner;
public class E_ConversionFromOcta {
public void octaToOthers() {
Scanner sc = new Scanner(System.in);
System.out.println("Enter Octa:");
String octa = sc.nextLine();
int dec = Integer.parseInt(octa, 8);
System.out.println("Decimal: " + dec);
System.out.println("Binary: " + Integer.toBinaryString(dec));
System.out.println("Hexa: " + Integer.toHexString(dec));
}
public static void main(String[] args) {
E_ConversionFromOcta obj = new E_ConversionFromOcta();
obj.octaToOthers();
}
}
//Enter Octa:12
//Decimal: 10
//Binary: 1010
//Hexa: a
| UTF-8 | Java | 611 | java | E_ConversionFromOcta.java | Java | []
| null | []
| package interview;
import java.util.Scanner;
public class E_ConversionFromOcta {
public void octaToOthers() {
Scanner sc = new Scanner(System.in);
System.out.println("Enter Octa:");
String octa = sc.nextLine();
int dec = Integer.parseInt(octa, 8);
System.out.println("Decimal: " + dec);
System.out.println("Binary: " + Integer.toBinaryString(dec));
System.out.println("Hexa: " + Integer.toHexString(dec));
}
public static void main(String[] args) {
E_ConversionFromOcta obj = new E_ConversionFromOcta();
obj.octaToOthers();
}
}
//Enter Octa:12
//Decimal: 10
//Binary: 1010
//Hexa: a
| 611 | 0.693944 | 0.679214 | 27 | 21.629629 | 19.567827 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.259259 | false | false | 15 |
744c54855a3238a589394808a39753ebef40bc0a | 26,001,732,063,905 | 924094bf9c7a056713b2471a87c6e4ab211b9032 | /src/day27/MethodsWithArgument.java | 873d930bb9818f184f927c95068a176db612fae2 | []
| no_license | SafarEkberli/AkbarClasses | https://github.com/SafarEkberli/AkbarClasses | 021a793735e371a1edb0caa6494cf9e181d2616c | 846925812ba426d81ba389ca46164bd2fa8eace4 | refs/heads/master | 2022-04-25T14:00:52.062000 | 2020-04-22T06:53:47 | 2020-04-22T06:53:47 | 257,817,282 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package day27;
public class MethodsWithArgument {
public static void main(String[] args) {
oddNumberOrEven(45);
sumOfNumbers(8,90);
removeDuplicates("aaaabbbbccccdddd");
}
public static void removeDuplicates(String word){
String unique = "";
for (int i = 0; i <word.length() ; i++) {
if (!unique.contains(""+word.charAt(i))){
unique += ""+word.charAt(i);
}
}
System.out.println(unique);
}
public static void sumOfNumbers(int a, int b){
int sum = a+b;
System.out.println(sum);
}
public static void oddNumberOrEven(int number){
if (number%2==0){
System.out.println(number+"Even number");
}else {
System.out.println("Odd number");
}
}
}
| UTF-8 | Java | 839 | java | MethodsWithArgument.java | Java | []
| null | []
| package day27;
public class MethodsWithArgument {
public static void main(String[] args) {
oddNumberOrEven(45);
sumOfNumbers(8,90);
removeDuplicates("aaaabbbbccccdddd");
}
public static void removeDuplicates(String word){
String unique = "";
for (int i = 0; i <word.length() ; i++) {
if (!unique.contains(""+word.charAt(i))){
unique += ""+word.charAt(i);
}
}
System.out.println(unique);
}
public static void sumOfNumbers(int a, int b){
int sum = a+b;
System.out.println(sum);
}
public static void oddNumberOrEven(int number){
if (number%2==0){
System.out.println(number+"Even number");
}else {
System.out.println("Odd number");
}
}
}
| 839 | 0.536353 | 0.524434 | 32 | 25.1875 | 18.740726 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.46875 | false | false | 15 |
cd22f30f6fe2a36c8170148e3ec611c1e464ee61 | 7,267,084,715,995 | 11e3d4a5fd26ca53e0d974527b53aee48d849a26 | /src/main/java/com/navercorp/pinpoint/web/vo/XTransactionEvent.java | a48661debf6822ce543652ba5ea964894f7b1f2e | []
| no_license | Aires1208/Kernel | https://github.com/Aires1208/Kernel | 24f56bf4b71400512c35a1259fadf031bc50b14c | 698155c4532fd2f683ee22335cb50891f1c39693 | refs/heads/master | 2021-01-18T07:56:33.415000 | 2017-07-27T06:39:22 | 2017-07-27T06:39:22 | 84,297,968 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.navercorp.pinpoint.web.vo;
import com.navercorp.pinpoint.web.report.usercase.HealthLevel;
/**
* Created by root on 16-8-29.
*/
public class XTransactionEvent extends XEvent {
private String traceName;
public XTransactionEvent(String eventName, String eventTime, HealthLevel level, String eventDetail, String traceName) {
super(eventName, eventTime, level, eventDetail);
this.traceName = traceName;
}
public String getTraceName() {
return traceName;
}
}
| UTF-8 | Java | 515 | java | XTransactionEvent.java | Java | [
{
"context": "eb.report.usercase.HealthLevel;\n\n/**\n * Created by root on 16-8-29.\n */\npublic class XTransactionEvent ex",
"end": 126,
"score": 0.9729058742523193,
"start": 122,
"tag": "USERNAME",
"value": "root"
}
]
| null | []
| package com.navercorp.pinpoint.web.vo;
import com.navercorp.pinpoint.web.report.usercase.HealthLevel;
/**
* Created by root on 16-8-29.
*/
public class XTransactionEvent extends XEvent {
private String traceName;
public XTransactionEvent(String eventName, String eventTime, HealthLevel level, String eventDetail, String traceName) {
super(eventName, eventTime, level, eventDetail);
this.traceName = traceName;
}
public String getTraceName() {
return traceName;
}
}
| 515 | 0.718447 | 0.708738 | 19 | 26.105263 | 30.461184 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.684211 | false | false | 15 |
c506a85eac4a57055172041811a036d7fb53ee0f | 5,557,687,727,079 | 037c82fa1ce2e22c00390182b6f1c35dce4a7216 | /src/com/study/P332/Solution.java | fa2a0d20610c586275b56b348cfc20b6d0bcbb76 | []
| no_license | loganabc/LeetCode | https://github.com/loganabc/LeetCode | d1e7fddc8ff491e9da755284558c2ea958d22223 | 9c21246886ea4e1c488155bec76b880a9f8ab9fb | refs/heads/master | 2023-01-30T17:31:21.739000 | 2020-12-12T13:36:08 | 2020-12-12T13:36:08 | 294,138,372 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.study.P332;
import java.util.List;
class Solution {
public List<String> findItinerary(List<List<String>> tickets) {
return null;
}
}
| UTF-8 | Java | 166 | java | Solution.java | Java | []
| null | []
| package com.study.P332;
import java.util.List;
class Solution {
public List<String> findItinerary(List<List<String>> tickets) {
return null;
}
}
| 166 | 0.662651 | 0.644578 | 12 | 12.833333 | 18.725353 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 15 |
fd4fd3bb31ac946056067c9975ab74772a1d20b4 | 2,894,808,023,422 | fbb811180522afc7dfc59238798ab6188297a62f | /src/Methods/VarargOverloadingDemo.java | 0419040cd59bc0bfc97453e929e062d2d90b9183 | []
| no_license | redballtoy/JavaStudy | https://github.com/redballtoy/JavaStudy | 0c3a979eec7f23ff155a7dc60c51badda4bd8fe5 | 2cf59e8be99b11f4a361606923e81cad5c3326b0 | refs/heads/master | 2020-03-20T18:50:41.128000 | 2018-11-19T18:40:12 | 2018-11-19T18:40:12 | 137,607,393 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Methods;
//Пример перегрузки метода с перенным количеством
//аргументов
public class VarargOverloadingDemo {
public static void main(String[] args) {
VarArgs3.vaTest3(1, 2, 3);
VarArgs3.vaTest3(true, false, false);
VarArgs3.vaTest3("Привет", 1, 2, 3);
}
}
class VarArgs3 {
static void vaTest3(int... v) {
System.out.println("\n\nvaTest3(int... v): " +
"\nКоличество аргументов" + v.length +
"\nСодержимое: ");
for (int x : v) {
System.out.print(x + " ");
}
}
static void vaTest3(boolean... v) {
System.out.println("\n\nvaTest3(boolean... v): " +
"\n\nКоличество аргументов" + v.length +
"\nСодержимое: ");
for (boolean x : v) {
System.out.print(x + " ");
}
}
static void vaTest3(String msg, int... v) {
System.out.println("\n\nvaTest3(String msg, int... v): " +
"\nКоличество аргументов" + v.length +
"\nСодержимое: ");
for (int x : v) {
System.out.print(x + " ");
}
System.out.println("\nmsg = " + msg);
}
} | UTF-8 | Java | 1,341 | java | VarargOverloadingDemo.java | Java | []
| null | []
| package Methods;
//Пример перегрузки метода с перенным количеством
//аргументов
public class VarargOverloadingDemo {
public static void main(String[] args) {
VarArgs3.vaTest3(1, 2, 3);
VarArgs3.vaTest3(true, false, false);
VarArgs3.vaTest3("Привет", 1, 2, 3);
}
}
class VarArgs3 {
static void vaTest3(int... v) {
System.out.println("\n\nvaTest3(int... v): " +
"\nКоличество аргументов" + v.length +
"\nСодержимое: ");
for (int x : v) {
System.out.print(x + " ");
}
}
static void vaTest3(boolean... v) {
System.out.println("\n\nvaTest3(boolean... v): " +
"\n\nКоличество аргументов" + v.length +
"\nСодержимое: ");
for (boolean x : v) {
System.out.print(x + " ");
}
}
static void vaTest3(String msg, int... v) {
System.out.println("\n\nvaTest3(String msg, int... v): " +
"\nКоличество аргументов" + v.length +
"\nСодержимое: ");
for (int x : v) {
System.out.print(x + " ");
}
System.out.println("\nmsg = " + msg);
}
} | 1,341 | 0.50461 | 0.488684 | 46 | 24.956522 | 20.629187 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.434783 | false | false | 15 |
bcd64e7f1e60ff9d678707b1f284c87f4d592353 | 10,453,950,444,232 | 6dbae30c806f661bcdcbc5f5f6a366ad702b1eea | /Corpus/eclipse.jdt.ui/2351.java | 6cf5e78d7b116e1f1b9e27f09af80c548b4efc14 | [
"MIT"
]
| permissive | SurfGitHub/BLIZZARD-Replication-Package-ESEC-FSE2018 | https://github.com/SurfGitHub/BLIZZARD-Replication-Package-ESEC-FSE2018 | d3fd21745dfddb2979e8ac262588cfdfe471899f | 0f8f4affd0ce1ecaa8ff8f487426f8edd6ad02c0 | refs/heads/master | 2020-03-31T15:52:01.005000 | 2018-10-01T23:38:50 | 2018-10-01T23:38:50 | 152,354,327 | 1 | 0 | MIT | true | 2018-10-10T02:57:02 | 2018-10-10T02:57:02 | 2018-10-01T23:38:52 | 2018-10-01T23:38:50 | 135,431 | 0 | 0 | 0 | null | false | null | /*******************************************************************************
* Copyright (c) 2000, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.ui.refactoring.nls.search;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.filebuffers.ITextFileBuffer;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.filebuffers.LocationKind;
import org.eclipse.jface.text.Position;
import org.eclipse.search.ui.text.Match;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.ISourceReference;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.ToolFactory;
import org.eclipse.jdt.core.compiler.IScanner;
import org.eclipse.jdt.core.compiler.ITerminalSymbols;
import org.eclipse.jdt.core.compiler.InvalidInputException;
import org.eclipse.jdt.core.search.SearchMatch;
import org.eclipse.jdt.core.search.SearchRequestor;
import org.eclipse.jdt.internal.corext.refactoring.nls.PropertyFileDocumentModel;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaUIStatus;
import org.eclipse.jdt.internal.ui.util.StringMatcher;
class NLSSearchResultRequestor extends SearchRequestor {
/*
* Matches are added to fResult. Element (group key) is IJavaElement or FileEntry.
*/
//$NON-NLS-1$
private static final StringMatcher fgGetClassNameMatcher = new StringMatcher("*.class.getName()*", false, false);
/**
* Object to indicate that no key has been found.
* @see #findKey(Position, IJavaElement)
* @since 3.6
*/
private static final String NO_KEY = new String();
private NLSSearchResult fResult;
private IFile fPropertiesFile;
private Properties fProperties;
private HashSet<String> fUsedPropertyNames;
public NLSSearchResultRequestor(IFile propertiesFile, NLSSearchResult result) {
fPropertiesFile = propertiesFile;
fResult = result;
}
/*
* @see org.eclipse.jdt.core.search.SearchRequestor#beginReporting()
*/
@Override
public void beginReporting() {
loadProperties();
fUsedPropertyNames = new HashSet(fProperties.size());
}
/*
* @see org.eclipse.jdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.jdt.core.search.SearchMatch)
*/
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
if (match.getAccuracy() == SearchMatch.A_INACCURATE)
return;
int offset = match.getOffset();
int length = match.getLength();
if (offset == -1 || length == -1)
return;
if (!(match.getElement() instanceof IJavaElement))
return;
IJavaElement javaElement = (IJavaElement) match.getElement();
// ignore matches in import declarations:
if (javaElement.getElementType() == IJavaElement.IMPORT_DECLARATION)
return;
if (javaElement.getElementType() == IJavaElement.CLASS_FILE)
//matches in import statements of class files
return;
if (javaElement.getElementType() == IJavaElement.TYPE)
//classes extending the accessor class and workaround for bug 61286
return;
// heuristic: ignore matches in resource bundle name field:
if (javaElement.getElementType() == IJavaElement.FIELD) {
IField field = (IField) javaElement;
String source = field.getSource();
if (source != null && fgGetClassNameMatcher.match(source))
return;
}
if (javaElement instanceof ISourceReference) {
String source = ((ISourceReference) javaElement).getSource();
if (source != null) {
if (//$NON-NLS-1$
source.indexOf("NLS.initializeMessages") != //$NON-NLS-1$
-1)
return;
}
}
// found reference to NLS Wrapper - now check if the key is there:
Position mutableKeyPosition = new Position(offset, length);
//TODO: What to do if argument string not found? Currently adds a match with type name.
String key = findKey(mutableKeyPosition, javaElement);
if (key == null || isKeyDefined(key))
return;
ICompilationUnit[] allCompilationUnits = JavaModelUtil.getAllCompilationUnits(new IJavaElement[] { javaElement });
Object element = javaElement;
if (allCompilationUnits != null && allCompilationUnits.length == 1)
element = allCompilationUnits[0];
fResult.addMatch(new Match(element, mutableKeyPosition.getOffset(), mutableKeyPosition.getLength()));
}
public void reportUnusedPropertyNames(IProgressMonitor pm) {
//Don't use endReporting() for long running operation.
//$NON-NLS-1$
pm.beginTask("", fProperties.size());
boolean hasUnused = false;
pm.setTaskName(NLSSearchMessages.NLSSearchResultRequestor_searching);
FileEntry groupElement = new FileEntry(fPropertiesFile, NLSSearchMessages.NLSSearchResultCollector_unusedKeys);
for (Enumeration<?> enumeration = fProperties.propertyNames(); enumeration.hasMoreElements(); ) {
String propertyName = (String) enumeration.nextElement();
if (!fUsedPropertyNames.contains(propertyName)) {
addMatch(groupElement, propertyName);
hasUnused = true;
}
pm.worked(1);
}
if (hasUnused)
fResult.addFileEntryGroup(groupElement);
pm.done();
}
private void addMatch(FileEntry groupElement, String propertyName) {
/*
* TODO (bug 63794): Should read in .properties file with our own reader and not
* with Properties.load(InputStream) . Then, we can remember start position and
* original version (not interpreting escape characters) for each property.
*
* The current workaround is to escape the key again before searching in the
* .properties file. However, this can fail if the key is escaped in a different
* manner than what PropertyFileDocumentModel.unwindEscapeChars(.) produces.
*/
String escapedPropertyName = PropertyFileDocumentModel.escape(propertyName, false);
int start = findPropertyNameStartPosition(escapedPropertyName);
int length;
if (// not found -> report at beginning
start == -1) {
start = 0;
length = 0;
} else {
length = escapedPropertyName.length();
}
fResult.addMatch(new Match(groupElement, start, length));
}
/**
* Checks if the key is defined in the property file
* and adds it to the list of used properties.
*
* @param key the key
* @return <code>true</code> if the key is defined, <code>false</code> otherwise
*/
private boolean isKeyDefined(String key) {
if (key == NO_KEY)
return false;
fUsedPropertyNames.add(key);
if (fProperties.getProperty(key) != null) {
return true;
}
return false;
}
public boolean hasPropertyKey(String key) {
return fProperties.containsKey(key);
}
public boolean isUsedPropertyKey(String key) {
return fUsedPropertyNames.contains(key);
}
/**
* Finds the key defined by the given match. The assumption is that the key is the only argument
* and it is a string literal i.e. quoted ("...") or a string constant i.e. 'static final
* String' defined in the same class.
*
* @param keyPositionResult reference parameter: will be filled with the position of the found
* key
* @param enclosingElement enclosing java element
* @return a string denoting the key, {@link #NO_KEY} if no key can be found and
* <code>null</code> otherwise
* @throws CoreException if a problem occurs while accessing the <code>enclosingElement</code>
*/
private String findKey(Position keyPositionResult, IJavaElement enclosingElement) throws CoreException {
ICompilationUnit unit = (ICompilationUnit) enclosingElement.getAncestor(IJavaElement.COMPILATION_UNIT);
if (unit == null)
return null;
String source = unit.getSource();
if (source == null)
return null;
IJavaProject javaProject = unit.getJavaProject();
IScanner scanner = null;
if (javaProject != null) {
String complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
String sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
scanner = ToolFactory.createScanner(false, false, false, sourceLevel, complianceLevel);
} else {
scanner = ToolFactory.createScanner(false, false, false, false);
}
scanner.setSource(source.toCharArray());
scanner.resetTo(keyPositionResult.getOffset() + keyPositionResult.getLength(), source.length());
try {
if (scanner.getNextToken() != ITerminalSymbols.TokenNameDOT)
return null;
if (scanner.getNextToken() != ITerminalSymbols.TokenNameIdentifier)
return null;
String src = new String(scanner.getCurrentTokenSource());
int tokenStart = scanner.getCurrentTokenStartPosition();
int tokenEnd = scanner.getCurrentTokenEndPosition();
if (scanner.getNextToken() == ITerminalSymbols.TokenNameLPAREN) {
// Old school
// next must be key string. Ignore methods which do not take a single String parameter (Bug 295040).
int nextToken = scanner.getNextToken();
if (nextToken != ITerminalSymbols.TokenNameStringLiteral && nextToken != ITerminalSymbols.TokenNameIdentifier)
return null;
tokenStart = scanner.getCurrentTokenStartPosition();
tokenEnd = scanner.getCurrentTokenEndPosition();
int token;
while ((token = scanner.getNextToken()) == ITerminalSymbols.TokenNameDOT) {
if ((nextToken = scanner.getNextToken()) != ITerminalSymbols.TokenNameIdentifier) {
return null;
}
tokenStart = scanner.getCurrentTokenStartPosition();
tokenEnd = scanner.getCurrentTokenEndPosition();
}
if (token != ITerminalSymbols.TokenNameRPAREN)
return null;
if (nextToken == ITerminalSymbols.TokenNameStringLiteral) {
keyPositionResult.setOffset(tokenStart + 1);
keyPositionResult.setLength(tokenEnd - tokenStart - 1);
return source.substring(tokenStart + 1, tokenEnd);
} else if (nextToken == ITerminalSymbols.TokenNameIdentifier) {
keyPositionResult.setOffset(tokenStart);
keyPositionResult.setLength(tokenEnd - tokenStart + 1);
IType parentClass = (IType) enclosingElement.getAncestor(IJavaElement.TYPE);
IField[] fields = parentClass.getFields();
String identifier = source.substring(tokenStart, tokenEnd + 1);
for (int i = 0; i < fields.length; i++) {
if (fields[i].getElementName().equals(identifier)) {
if (!//$NON-NLS-1$
Signature.getSignatureSimpleName(fields[i].getTypeSignature()).equals(//$NON-NLS-1$
"String"))
return null;
Object obj = fields[i].getConstant();
return obj instanceof String ? ((String) obj).substring(1, ((String) obj).length() - 1) : NO_KEY;
}
}
}
return NO_KEY;
} else {
IJavaElement[] keys = unit.codeSelect(tokenStart, tokenEnd - tokenStart + 1);
// an interface can't be a key
if (keys.length == 1 && keys[0].getElementType() == IJavaElement.TYPE && ((IType) keys[0]).isInterface())
return null;
keyPositionResult.setOffset(tokenStart);
keyPositionResult.setLength(tokenEnd - tokenStart + 1);
return src;
}
} catch (InvalidInputException e) {
throw new CoreException(JavaUIStatus.createError(IStatus.ERROR, e));
}
}
/**
* Finds the start position in the property file. We assume that
* the key is the first match on a line.
*
* @param propertyName the property name
* @return the start position of the property name in the file, -1 if not found
*/
private int findPropertyNameStartPosition(String propertyName) {
// Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=19319
InputStream stream = null;
LineReader lineReader = null;
String encoding;
try {
encoding = fPropertiesFile.getCharset();
} catch (CoreException e1) {
encoding = "ISO-8859-1";
}
try {
stream = createInputStream(fPropertiesFile);
lineReader = new LineReader(stream, encoding);
} catch (CoreException cex) {
JavaPlugin.log(cex);
return -1;
} catch (IOException e) {
if (stream != null) {
try {
stream.close();
} catch (IOException ce) {
JavaPlugin.log(ce);
}
}
return -1;
}
int start = 0;
try {
StringBuffer buf = new StringBuffer(80);
int eols = lineReader.readLine(buf);
int keyLength = propertyName.length();
while (eols > 0) {
String line = buf.toString();
int i = line.indexOf(propertyName);
int charPos = i + keyLength;
char terminatorChar = 0;
boolean hasNoValue = (charPos >= line.length());
if (i > -1 && !hasNoValue)
terminatorChar = line.charAt(charPos);
if (line.trim().startsWith(propertyName) && (hasNoValue || Character.isWhitespace(terminatorChar) || terminatorChar == '=')) {
start += line.indexOf(propertyName);
// found key
eols = -17;
} else {
start += line.length() + eols;
buf.setLength(0);
eols = lineReader.readLine(buf);
}
}
if (eols != -17)
//key not found in file. See bug 63794. This can happen if the key contains escaped characters.
start = -1;
} catch (IOException ex) {
JavaPlugin.log(ex);
return -1;
} finally {
try {
lineReader.close();
} catch (IOException ex) {
JavaPlugin.log(ex);
}
}
return start;
}
private void loadProperties() {
Set<Object> duplicateKeys = new HashSet();
fProperties = new Properties(duplicateKeys);
InputStream stream;
try {
stream = new BufferedInputStream(createInputStream(fPropertiesFile));
} catch (CoreException ex) {
fProperties = new Properties();
return;
}
try {
fProperties.load(stream);
} catch (IOException ex) {
fProperties = new Properties();
return;
} finally {
try {
stream.close();
} catch (IOException ex) {
}
reportDuplicateKeys(duplicateKeys);
}
}
private InputStream createInputStream(IFile propertiesFile) throws CoreException {
ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
if (manager != null) {
ITextFileBuffer buffer = manager.getTextFileBuffer(propertiesFile.getFullPath(), LocationKind.IFILE);
if (buffer != null) {
return new ByteArrayInputStream(buffer.getDocument().get().getBytes());
}
}
return propertiesFile.getContents();
}
private void reportDuplicateKeys(Set<Object> duplicateKeys) {
if (duplicateKeys.size() == 0)
return;
FileEntry groupElement = new FileEntry(fPropertiesFile, NLSSearchMessages.NLSSearchResultCollector_duplicateKeys);
Iterator<Object> iter = duplicateKeys.iterator();
while (iter.hasNext()) {
String propertyName = (String) iter.next();
addMatch(groupElement, propertyName);
}
fResult.addFileEntryGroup(groupElement);
}
}
| UTF-8 | Java | 17,978 | java | 2351.java | Java | []
| null | []
| /*******************************************************************************
* Copyright (c) 2000, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.ui.refactoring.nls.search;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.filebuffers.ITextFileBuffer;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.filebuffers.LocationKind;
import org.eclipse.jface.text.Position;
import org.eclipse.search.ui.text.Match;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.ISourceReference;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.ToolFactory;
import org.eclipse.jdt.core.compiler.IScanner;
import org.eclipse.jdt.core.compiler.ITerminalSymbols;
import org.eclipse.jdt.core.compiler.InvalidInputException;
import org.eclipse.jdt.core.search.SearchMatch;
import org.eclipse.jdt.core.search.SearchRequestor;
import org.eclipse.jdt.internal.corext.refactoring.nls.PropertyFileDocumentModel;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaUIStatus;
import org.eclipse.jdt.internal.ui.util.StringMatcher;
class NLSSearchResultRequestor extends SearchRequestor {
/*
* Matches are added to fResult. Element (group key) is IJavaElement or FileEntry.
*/
//$NON-NLS-1$
private static final StringMatcher fgGetClassNameMatcher = new StringMatcher("*.class.getName()*", false, false);
/**
* Object to indicate that no key has been found.
* @see #findKey(Position, IJavaElement)
* @since 3.6
*/
private static final String NO_KEY = new String();
private NLSSearchResult fResult;
private IFile fPropertiesFile;
private Properties fProperties;
private HashSet<String> fUsedPropertyNames;
public NLSSearchResultRequestor(IFile propertiesFile, NLSSearchResult result) {
fPropertiesFile = propertiesFile;
fResult = result;
}
/*
* @see org.eclipse.jdt.core.search.SearchRequestor#beginReporting()
*/
@Override
public void beginReporting() {
loadProperties();
fUsedPropertyNames = new HashSet(fProperties.size());
}
/*
* @see org.eclipse.jdt.core.search.SearchRequestor#acceptSearchMatch(org.eclipse.jdt.core.search.SearchMatch)
*/
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
if (match.getAccuracy() == SearchMatch.A_INACCURATE)
return;
int offset = match.getOffset();
int length = match.getLength();
if (offset == -1 || length == -1)
return;
if (!(match.getElement() instanceof IJavaElement))
return;
IJavaElement javaElement = (IJavaElement) match.getElement();
// ignore matches in import declarations:
if (javaElement.getElementType() == IJavaElement.IMPORT_DECLARATION)
return;
if (javaElement.getElementType() == IJavaElement.CLASS_FILE)
//matches in import statements of class files
return;
if (javaElement.getElementType() == IJavaElement.TYPE)
//classes extending the accessor class and workaround for bug 61286
return;
// heuristic: ignore matches in resource bundle name field:
if (javaElement.getElementType() == IJavaElement.FIELD) {
IField field = (IField) javaElement;
String source = field.getSource();
if (source != null && fgGetClassNameMatcher.match(source))
return;
}
if (javaElement instanceof ISourceReference) {
String source = ((ISourceReference) javaElement).getSource();
if (source != null) {
if (//$NON-NLS-1$
source.indexOf("NLS.initializeMessages") != //$NON-NLS-1$
-1)
return;
}
}
// found reference to NLS Wrapper - now check if the key is there:
Position mutableKeyPosition = new Position(offset, length);
//TODO: What to do if argument string not found? Currently adds a match with type name.
String key = findKey(mutableKeyPosition, javaElement);
if (key == null || isKeyDefined(key))
return;
ICompilationUnit[] allCompilationUnits = JavaModelUtil.getAllCompilationUnits(new IJavaElement[] { javaElement });
Object element = javaElement;
if (allCompilationUnits != null && allCompilationUnits.length == 1)
element = allCompilationUnits[0];
fResult.addMatch(new Match(element, mutableKeyPosition.getOffset(), mutableKeyPosition.getLength()));
}
public void reportUnusedPropertyNames(IProgressMonitor pm) {
//Don't use endReporting() for long running operation.
//$NON-NLS-1$
pm.beginTask("", fProperties.size());
boolean hasUnused = false;
pm.setTaskName(NLSSearchMessages.NLSSearchResultRequestor_searching);
FileEntry groupElement = new FileEntry(fPropertiesFile, NLSSearchMessages.NLSSearchResultCollector_unusedKeys);
for (Enumeration<?> enumeration = fProperties.propertyNames(); enumeration.hasMoreElements(); ) {
String propertyName = (String) enumeration.nextElement();
if (!fUsedPropertyNames.contains(propertyName)) {
addMatch(groupElement, propertyName);
hasUnused = true;
}
pm.worked(1);
}
if (hasUnused)
fResult.addFileEntryGroup(groupElement);
pm.done();
}
private void addMatch(FileEntry groupElement, String propertyName) {
/*
* TODO (bug 63794): Should read in .properties file with our own reader and not
* with Properties.load(InputStream) . Then, we can remember start position and
* original version (not interpreting escape characters) for each property.
*
* The current workaround is to escape the key again before searching in the
* .properties file. However, this can fail if the key is escaped in a different
* manner than what PropertyFileDocumentModel.unwindEscapeChars(.) produces.
*/
String escapedPropertyName = PropertyFileDocumentModel.escape(propertyName, false);
int start = findPropertyNameStartPosition(escapedPropertyName);
int length;
if (// not found -> report at beginning
start == -1) {
start = 0;
length = 0;
} else {
length = escapedPropertyName.length();
}
fResult.addMatch(new Match(groupElement, start, length));
}
/**
* Checks if the key is defined in the property file
* and adds it to the list of used properties.
*
* @param key the key
* @return <code>true</code> if the key is defined, <code>false</code> otherwise
*/
private boolean isKeyDefined(String key) {
if (key == NO_KEY)
return false;
fUsedPropertyNames.add(key);
if (fProperties.getProperty(key) != null) {
return true;
}
return false;
}
public boolean hasPropertyKey(String key) {
return fProperties.containsKey(key);
}
public boolean isUsedPropertyKey(String key) {
return fUsedPropertyNames.contains(key);
}
/**
* Finds the key defined by the given match. The assumption is that the key is the only argument
* and it is a string literal i.e. quoted ("...") or a string constant i.e. 'static final
* String' defined in the same class.
*
* @param keyPositionResult reference parameter: will be filled with the position of the found
* key
* @param enclosingElement enclosing java element
* @return a string denoting the key, {@link #NO_KEY} if no key can be found and
* <code>null</code> otherwise
* @throws CoreException if a problem occurs while accessing the <code>enclosingElement</code>
*/
private String findKey(Position keyPositionResult, IJavaElement enclosingElement) throws CoreException {
ICompilationUnit unit = (ICompilationUnit) enclosingElement.getAncestor(IJavaElement.COMPILATION_UNIT);
if (unit == null)
return null;
String source = unit.getSource();
if (source == null)
return null;
IJavaProject javaProject = unit.getJavaProject();
IScanner scanner = null;
if (javaProject != null) {
String complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
String sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
scanner = ToolFactory.createScanner(false, false, false, sourceLevel, complianceLevel);
} else {
scanner = ToolFactory.createScanner(false, false, false, false);
}
scanner.setSource(source.toCharArray());
scanner.resetTo(keyPositionResult.getOffset() + keyPositionResult.getLength(), source.length());
try {
if (scanner.getNextToken() != ITerminalSymbols.TokenNameDOT)
return null;
if (scanner.getNextToken() != ITerminalSymbols.TokenNameIdentifier)
return null;
String src = new String(scanner.getCurrentTokenSource());
int tokenStart = scanner.getCurrentTokenStartPosition();
int tokenEnd = scanner.getCurrentTokenEndPosition();
if (scanner.getNextToken() == ITerminalSymbols.TokenNameLPAREN) {
// Old school
// next must be key string. Ignore methods which do not take a single String parameter (Bug 295040).
int nextToken = scanner.getNextToken();
if (nextToken != ITerminalSymbols.TokenNameStringLiteral && nextToken != ITerminalSymbols.TokenNameIdentifier)
return null;
tokenStart = scanner.getCurrentTokenStartPosition();
tokenEnd = scanner.getCurrentTokenEndPosition();
int token;
while ((token = scanner.getNextToken()) == ITerminalSymbols.TokenNameDOT) {
if ((nextToken = scanner.getNextToken()) != ITerminalSymbols.TokenNameIdentifier) {
return null;
}
tokenStart = scanner.getCurrentTokenStartPosition();
tokenEnd = scanner.getCurrentTokenEndPosition();
}
if (token != ITerminalSymbols.TokenNameRPAREN)
return null;
if (nextToken == ITerminalSymbols.TokenNameStringLiteral) {
keyPositionResult.setOffset(tokenStart + 1);
keyPositionResult.setLength(tokenEnd - tokenStart - 1);
return source.substring(tokenStart + 1, tokenEnd);
} else if (nextToken == ITerminalSymbols.TokenNameIdentifier) {
keyPositionResult.setOffset(tokenStart);
keyPositionResult.setLength(tokenEnd - tokenStart + 1);
IType parentClass = (IType) enclosingElement.getAncestor(IJavaElement.TYPE);
IField[] fields = parentClass.getFields();
String identifier = source.substring(tokenStart, tokenEnd + 1);
for (int i = 0; i < fields.length; i++) {
if (fields[i].getElementName().equals(identifier)) {
if (!//$NON-NLS-1$
Signature.getSignatureSimpleName(fields[i].getTypeSignature()).equals(//$NON-NLS-1$
"String"))
return null;
Object obj = fields[i].getConstant();
return obj instanceof String ? ((String) obj).substring(1, ((String) obj).length() - 1) : NO_KEY;
}
}
}
return NO_KEY;
} else {
IJavaElement[] keys = unit.codeSelect(tokenStart, tokenEnd - tokenStart + 1);
// an interface can't be a key
if (keys.length == 1 && keys[0].getElementType() == IJavaElement.TYPE && ((IType) keys[0]).isInterface())
return null;
keyPositionResult.setOffset(tokenStart);
keyPositionResult.setLength(tokenEnd - tokenStart + 1);
return src;
}
} catch (InvalidInputException e) {
throw new CoreException(JavaUIStatus.createError(IStatus.ERROR, e));
}
}
/**
* Finds the start position in the property file. We assume that
* the key is the first match on a line.
*
* @param propertyName the property name
* @return the start position of the property name in the file, -1 if not found
*/
private int findPropertyNameStartPosition(String propertyName) {
// Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=19319
InputStream stream = null;
LineReader lineReader = null;
String encoding;
try {
encoding = fPropertiesFile.getCharset();
} catch (CoreException e1) {
encoding = "ISO-8859-1";
}
try {
stream = createInputStream(fPropertiesFile);
lineReader = new LineReader(stream, encoding);
} catch (CoreException cex) {
JavaPlugin.log(cex);
return -1;
} catch (IOException e) {
if (stream != null) {
try {
stream.close();
} catch (IOException ce) {
JavaPlugin.log(ce);
}
}
return -1;
}
int start = 0;
try {
StringBuffer buf = new StringBuffer(80);
int eols = lineReader.readLine(buf);
int keyLength = propertyName.length();
while (eols > 0) {
String line = buf.toString();
int i = line.indexOf(propertyName);
int charPos = i + keyLength;
char terminatorChar = 0;
boolean hasNoValue = (charPos >= line.length());
if (i > -1 && !hasNoValue)
terminatorChar = line.charAt(charPos);
if (line.trim().startsWith(propertyName) && (hasNoValue || Character.isWhitespace(terminatorChar) || terminatorChar == '=')) {
start += line.indexOf(propertyName);
// found key
eols = -17;
} else {
start += line.length() + eols;
buf.setLength(0);
eols = lineReader.readLine(buf);
}
}
if (eols != -17)
//key not found in file. See bug 63794. This can happen if the key contains escaped characters.
start = -1;
} catch (IOException ex) {
JavaPlugin.log(ex);
return -1;
} finally {
try {
lineReader.close();
} catch (IOException ex) {
JavaPlugin.log(ex);
}
}
return start;
}
private void loadProperties() {
Set<Object> duplicateKeys = new HashSet();
fProperties = new Properties(duplicateKeys);
InputStream stream;
try {
stream = new BufferedInputStream(createInputStream(fPropertiesFile));
} catch (CoreException ex) {
fProperties = new Properties();
return;
}
try {
fProperties.load(stream);
} catch (IOException ex) {
fProperties = new Properties();
return;
} finally {
try {
stream.close();
} catch (IOException ex) {
}
reportDuplicateKeys(duplicateKeys);
}
}
private InputStream createInputStream(IFile propertiesFile) throws CoreException {
ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
if (manager != null) {
ITextFileBuffer buffer = manager.getTextFileBuffer(propertiesFile.getFullPath(), LocationKind.IFILE);
if (buffer != null) {
return new ByteArrayInputStream(buffer.getDocument().get().getBytes());
}
}
return propertiesFile.getContents();
}
private void reportDuplicateKeys(Set<Object> duplicateKeys) {
if (duplicateKeys.size() == 0)
return;
FileEntry groupElement = new FileEntry(fPropertiesFile, NLSSearchMessages.NLSSearchResultCollector_duplicateKeys);
Iterator<Object> iter = duplicateKeys.iterator();
while (iter.hasNext()) {
String propertyName = (String) iter.next();
addMatch(groupElement, propertyName);
}
fResult.addFileEntryGroup(groupElement);
}
}
| 17,978 | 0.612693 | 0.607632 | 418 | 42.009571 | 29.564785 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.703349 | false | false | 15 |
0cdad0507f1a8480be6dc328e70561e253a421d3 | 6,030,134,144,901 | 588aadede8ee0577ce0f0b629fffa5680bac7c1c | /app/src/main/java/vanlandingham/friendimals/first_activity.java | 9091a545f2e767626c5888fe871f695683c539e1 | []
| no_license | NotJoHam/House_Of_Animals | https://github.com/NotJoHam/House_Of_Animals | fccb925c2d46665bec179cf0c760f3b504200b5d | f6c6330d4d5ed305190bca4e2858d677086b7a58 | refs/heads/master | 2021-09-19T05:58:01.143000 | 2018-07-24T03:13:01 | 2018-07-24T03:13:01 | 115,078,212 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package vanlandingham.friendimals;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.transition.Slide;
import android.util.Log;
import android.view.View;
import android.widget.ProgressBar;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import vanlandingham.friendimals.Model.User;
/**
* Created by Owner on 12/24/2017.
*/
public class first_activity extends AppCompatActivity {
private ProgressBar startup_progress;
private FirebaseAuth mAuth;
private FirebaseUser mUser;
private String username;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
overridePendingTransition(0,R.anim.slide_left);
setContentView(R.layout.activity_first);
startup_progress = findViewById(R.id.startup_progress);
showProgress(true);
mAuth = FirebaseAuth.getInstance();
mUser = mAuth.getCurrentUser();
Log.d("first_activity", "onCreate: " + mUser);
if (mUser == null) {
Intent intent = new Intent(getBaseContext(), LoginActivity.class);
startActivity(intent);
}
else {
String mUserId = FirebaseAuth.getInstance().getUid();
DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference();
DocumentReference docRef = FirebaseFirestore.getInstance().collection("users").document(mUserId);
docRef.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
User user = documentSnapshot.toObject(User.class);
username = user.getUsername();
Intent intent = new Intent(getBaseContext(),Home.class);
intent.putExtra("curr_user",user);
startActivity(intent);
showProgress(false);
}
});
}
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void showProgress(final boolean show) {
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
// for very easy animations. If available, use these APIs to fade-in
// the progress spinner.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
startup_progress.setVisibility(show ? View.VISIBLE : View.GONE);
startup_progress.animate().setDuration(shortAnimTime).alpha(
show ? 1 : 0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
startup_progress.setVisibility(show ? View.VISIBLE : View.GONE);
}
});
} else {
// The ViewPropertyAnimator APIs are not available, so simply show
// and hide the relevant UI components.
startup_progress.setVisibility(show ? View.VISIBLE : View.GONE);
}
}
private void setUpWindowAnimations() {
Slide slide = new Slide();
slide.setDuration(2000);
getWindow().setExitTransition(slide);
}
}
| UTF-8 | Java | 4,071 | java | first_activity.java | Java | [
{
"context": "User.class);\n\n username = user.getUsername();\n Intent intent = new Intent",
"end": 2482,
"score": 0.9179588556289673,
"start": 2471,
"tag": "USERNAME",
"value": "getUsername"
}
]
| null | []
| package vanlandingham.friendimals;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.transition.Slide;
import android.util.Log;
import android.view.View;
import android.widget.ProgressBar;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import vanlandingham.friendimals.Model.User;
/**
* Created by Owner on 12/24/2017.
*/
public class first_activity extends AppCompatActivity {
private ProgressBar startup_progress;
private FirebaseAuth mAuth;
private FirebaseUser mUser;
private String username;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
overridePendingTransition(0,R.anim.slide_left);
setContentView(R.layout.activity_first);
startup_progress = findViewById(R.id.startup_progress);
showProgress(true);
mAuth = FirebaseAuth.getInstance();
mUser = mAuth.getCurrentUser();
Log.d("first_activity", "onCreate: " + mUser);
if (mUser == null) {
Intent intent = new Intent(getBaseContext(), LoginActivity.class);
startActivity(intent);
}
else {
String mUserId = FirebaseAuth.getInstance().getUid();
DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference();
DocumentReference docRef = FirebaseFirestore.getInstance().collection("users").document(mUserId);
docRef.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
User user = documentSnapshot.toObject(User.class);
username = user.getUsername();
Intent intent = new Intent(getBaseContext(),Home.class);
intent.putExtra("curr_user",user);
startActivity(intent);
showProgress(false);
}
});
}
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void showProgress(final boolean show) {
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
// for very easy animations. If available, use these APIs to fade-in
// the progress spinner.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
startup_progress.setVisibility(show ? View.VISIBLE : View.GONE);
startup_progress.animate().setDuration(shortAnimTime).alpha(
show ? 1 : 0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
startup_progress.setVisibility(show ? View.VISIBLE : View.GONE);
}
});
} else {
// The ViewPropertyAnimator APIs are not available, so simply show
// and hide the relevant UI components.
startup_progress.setVisibility(show ? View.VISIBLE : View.GONE);
}
}
private void setUpWindowAnimations() {
Slide slide = new Slide();
slide.setDuration(2000);
getWindow().setExitTransition(slide);
}
}
| 4,071 | 0.673299 | 0.668632 | 123 | 32.097561 | 28.201199 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.520325 | false | false | 15 |
ade50280ff590b67c80d70a9680881068c89de16 | 4,449,586,183,264 | cef5170e7cfc03973a8f9af478b985aaf60a9e0e | /src/ststb/CatalogueItem.java | 6d6c90fd65e690b31f6cdbf8ad177c95d82d094b | []
| no_license | bigfoot150/STSTextbooks | https://github.com/bigfoot150/STSTextbooks | 0b21cb2296f731a74e275b05502b2abb6f2a265b | 6c0c8a7734ce7c8e6e27793a8093aa803c8593d2 | refs/heads/master | 2020-08-22T01:15:26.262000 | 2019-12-01T01:41:20 | 2019-12-01T01:41:20 | 216,288,518 | 0 | 0 | null | false | 2019-11-27T02:23:42 | 2019-10-20T00:47:16 | 2019-11-23T17:49:46 | 2019-11-27T02:23:42 | 22,770 | 0 | 0 | 0 | Java | false | false |
package ststb;
import org.hibernate.validator.constraints.Length;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Entity
public class CatalogueItem extends shared.PersistentBase implements Serializable {
public CatalogueItem() {
this(null, "", "", 0.00, "",
"", "", "", 0.00, 0);
}
private String title;
private String description;
private String itemid;
private double price;
private String isbn13;
private String isbn10;
private String userid;
private String author;
private double shipping_cost;
private int quantity;
public CatalogueItem(String itemid, String name, String description, double price, String isbn13, String isbn10,
String userid, String author, double shipping_cost, int quantity)
{
this.itemid = itemid;
this.title = name;
this.description = description;
this.price = price;
this.isbn13 = isbn13;
this.isbn10 = isbn10;
this.userid = userid;
this.author = author;
this.shipping_cost = shipping_cost;
this.quantity = quantity;
}
@Length(min=1,max=50)
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Lob
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@NotNull
@Length(min=1,max=10)
public String getItemid() {
return itemid;
}
public void setItemid(String itemid) {
this.itemid = itemid;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getIsbn13() {
return isbn13;
}
public void setIsbn13(String isbn13) {
this.isbn13 = isbn13;
}
public String getIsbn10() {
return isbn10;
}
public void setIsbn10(String isbn10) {
this.isbn10 = isbn10;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public double getShipping_cost() {
return shipping_cost;
}
public void setShipping_cost(double shipping_cost) {
this.shipping_cost = shipping_cost;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
}
| UTF-8 | Java | 2,796 | java | CatalogueItem.java | Java | []
| null | []
|
package ststb;
import org.hibernate.validator.constraints.Length;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Entity
public class CatalogueItem extends shared.PersistentBase implements Serializable {
public CatalogueItem() {
this(null, "", "", 0.00, "",
"", "", "", 0.00, 0);
}
private String title;
private String description;
private String itemid;
private double price;
private String isbn13;
private String isbn10;
private String userid;
private String author;
private double shipping_cost;
private int quantity;
public CatalogueItem(String itemid, String name, String description, double price, String isbn13, String isbn10,
String userid, String author, double shipping_cost, int quantity)
{
this.itemid = itemid;
this.title = name;
this.description = description;
this.price = price;
this.isbn13 = isbn13;
this.isbn10 = isbn10;
this.userid = userid;
this.author = author;
this.shipping_cost = shipping_cost;
this.quantity = quantity;
}
@Length(min=1,max=50)
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Lob
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@NotNull
@Length(min=1,max=10)
public String getItemid() {
return itemid;
}
public void setItemid(String itemid) {
this.itemid = itemid;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getIsbn13() {
return isbn13;
}
public void setIsbn13(String isbn13) {
this.isbn13 = isbn13;
}
public String getIsbn10() {
return isbn10;
}
public void setIsbn10(String isbn10) {
this.isbn10 = isbn10;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public double getShipping_cost() {
return shipping_cost;
}
public void setShipping_cost(double shipping_cost) {
this.shipping_cost = shipping_cost;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
}
| 2,796 | 0.611588 | 0.592632 | 128 | 20.835938 | 19.449766 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.523438 | false | false | 15 |
c29963a889b75d71f13786bff9ba4dd3917629d2 | 25,340,307,111,481 | 238adff3be9baa4cf54cc063c9cea277f8e289a2 | /packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMethod.java | ee3d19c746c8404ccfcf65987fa8f93d572e83a2 | [
"MIT",
"CC-BY-4.0",
"CC-BY-NC-SA-4.0",
"CC-BY-SA-4.0"
]
| permissive | facebook/react-native | https://github.com/facebook/react-native | e7c418db82563907b3564d81d505b3125b3a6cc7 | 041f459d8c674f6817e0ac1851be49c435d53089 | refs/heads/main | 2023-09-04T01:53:34.965000 | 2023-09-02T23:23:34 | 2023-09-02T23:23:34 | 29,028,775 | 131,047 | 32,710 | MIT | false | 2023-09-14T21:49:45 | 2015-01-09T18:10:16 | 2023-09-14T21:21:05 | 2023-09-14T21:49:44 | 862,133 | 111,867 | 23,791 | 1,668 | Java | false | false | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.bridge;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
/**
* Annotation which is used to mark methods that are exposed to React Native.
*
* <p>This applies to derived classes of {@link BaseJavaModule}, which will generate a list of
* exported methods by searching for those which are annotated with this annotation and adding a JS
* callback for each.
*/
@Retention(RUNTIME)
public @interface ReactMethod {
/**
* Whether the method can be called from JS synchronously **on the JS thread**, possibly returning
* a result.
*
* <p>WARNING: in the vast majority of cases, you should leave this to false which allows your
* native module methods to be called asynchronously: calling methods synchronously can have
* strong performance penalties and introduce threading-related bugs to your native modules.
*
* <p>In order to support remote debugging, both the method args and return type must be
* serializable to JSON: this means that we only support the same args as {@link ReactMethod}, and
* the hook can only be void or return JSON values (e.g. bool, number, String, {@link
* WritableMap}, or {@link WritableArray}). Calling these methods when running under the websocket
* executor is currently not supported.
*/
boolean isBlockingSynchronousMethod() default false;
}
| UTF-8 | Java | 1,591 | java | ReactMethod.java | Java | []
| null | []
| /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.bridge;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
/**
* Annotation which is used to mark methods that are exposed to React Native.
*
* <p>This applies to derived classes of {@link BaseJavaModule}, which will generate a list of
* exported methods by searching for those which are annotated with this annotation and adding a JS
* callback for each.
*/
@Retention(RUNTIME)
public @interface ReactMethod {
/**
* Whether the method can be called from JS synchronously **on the JS thread**, possibly returning
* a result.
*
* <p>WARNING: in the vast majority of cases, you should leave this to false which allows your
* native module methods to be called asynchronously: calling methods synchronously can have
* strong performance penalties and introduce threading-related bugs to your native modules.
*
* <p>In order to support remote debugging, both the method args and return type must be
* serializable to JSON: this means that we only support the same args as {@link ReactMethod}, and
* the hook can only be void or return JSON values (e.g. bool, number, String, {@link
* WritableMap}, or {@link WritableArray}). Calling these methods when running under the websocket
* executor is currently not supported.
*/
boolean isBlockingSynchronousMethod() default false;
}
| 1,591 | 0.746072 | 0.746072 | 38 | 40.86842 | 38.710239 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.368421 | false | false | 15 |
1bbc5e235043876e62a5d9e5fe89249a43b0f492 | 3,350,074,552,735 | 073e2e940722b81c0ad3269bdfe51639fdab88fe | /app/src/main/java/com/todolist/reminder/activities/CreateReminderActivity.java | 6f084d2f8760533db97d694928d4c0507f045eb4 | []
| no_license | lashket/todo | https://github.com/lashket/todo | fbe7b0d3e60c86096b0aa478096a8403cf56aaea | 6e21c0a19bbb335bef9ed23ff8a8cfb0c8900596 | refs/heads/master | 2019-07-13T02:41:17.955000 | 2017-05-31T11:43:27 | 2017-05-31T11:43:27 | 92,588,837 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.todolist.reminder.activities;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.DatePickerDialog;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.TimePicker;
import com.squareup.picasso.Picasso;
import com.todolist.reminder.CalendarUtils;
import com.todolist.reminder.R;
import com.todolist.reminder.models.Reminder;
import com.todolist.reminder.notifications.NotificationReceiver;
import com.todolist.reminder.notifications.NotificationService;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.realm.Realm;
public class CreateReminderActivity extends BaseActivity implements DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener, BaseActivity.PictureTakenListener {
private static final String ARG_ID = "id";
private static final String ARG_REMINDER = "reminder";
@BindView(R.id.add)
FloatingActionButton fab;
@BindView(R.id.title)
EditText editText;
@BindView(R.id.chose_date)
Button chooseDateButton;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.pick_image)
ImageView imageView;
private int groupId;
private int year, month, day, hour, minute;
private String image;
private long date;
private String name;
private Realm realm;
Calendar dateAndTime = Calendar.getInstance();
private Reminder reminder;
private boolean isForEdit = false;
/**
* Вызывается когда нажал + на экране со списком напоминаний
* @param context
* @param id
*/
public static void show(Activity context, int id) {
Intent intent = new Intent(context, CreateReminderActivity.class);
intent.putExtra(ARG_ID, id);
context.startActivityForResult(intent, 100);
}
/**
* Вызывается когда нажал редактировать на напоминалке
* @param context
* @param reminderId
*/
public static void showForEdit(Activity context, int reminderId) {
Intent intent = new Intent(context, CreateReminderActivity.class);
intent.putExtra(ARG_REMINDER, reminderId);
context.startActivityForResult(intent, 100);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_reminder);
ButterKnife.bind(this);
realm = Realm.getDefaultInstance();
if (getIntent().getIntExtra(ARG_REMINDER, -1) != -1) {
int reminderId = getIntent().getIntExtra(ARG_REMINDER, -1);
realm.executeTransaction(realm1 -> reminder = realm1.where(Reminder.class).equalTo("id", reminderId).findFirst());
isForEdit = true;
setUpData();
} else {
groupId = getIntent().getIntExtra(ARG_ID, -1);
}
dateAndTime = Calendar.getInstance();
setSupportActionBar(toolbar);
toolbar.setTitleTextColor(ContextCompat.getColor(this, R.color.white));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
private void setUpData() {
this.image = reminder.getPath();
this.date = reminder.getTimeInMillis();
chooseDateButton.setText(CalendarUtils.ConvertMilliSecondsToFormattedDate(reminder.getTimeInMillis()));
Picasso.with(this).load(reminder.getPath()).into(imageView);
editText.setText(reminder.getText());
}
/**
* Выбираем дату
* @param view
*/
@SuppressLint("WrongConstant")
@OnClick(R.id.chose_date)
public void showDatePickerDialog(View view) {
final Calendar c = Calendar.getInstance();
year = c.get(Calendar.YEAR);
month = c.get(Calendar.MONTH);
day = c.get(Calendar.DAY_OF_MONTH);
new DatePickerDialog(this, this, year, month, day).show();
}
/**
* Выбираем время
* @param datePicker
* @param year
* @param month
* @param day
*/
@SuppressLint("WrongConstant")
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int day) {
this.year = year;
this.month = month + 1;
this.day = day;
final Calendar c = Calendar.getInstance();
hour = c.get(Calendar.HOUR_OF_DAY);
minute = c.get(Calendar.MINUTE);
TimePickerDialog timePickerDialog = new TimePickerDialog(this, this, hour, minute, true);
timePickerDialog.show();
}
/**
* После того как выбали время преобразовываем его в время в миллисикудах и запоминаем в переменую date
* @param timePicker
* @param hour
* @param minute
*/
@SuppressLint("DefaultLocale")
@Override
public void onTimeSet(TimePicker timePicker, int hour, int minute) {
this.hour = hour;
this.minute = minute;
chooseDateButton.setText(String.format("%d - %d - %d\n%d:%d", day, month, year, hour, minute));
String mydate = String.format("%d - %d - %d %d:%d", day, month, year, hour, minute);
SimpleDateFormat sdf = new SimpleDateFormat("dd - M - yyyy HH:mm");
try {
Date date = sdf.parse(mydate);
this.date = date.getTime();
} catch (ParseException ignored) {
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
default:
return true;
}
}
/**
* Вызывается метод из BaseActivity для выбора фотк
* @param view
*/
@OnClick(R.id.pick_image)
public void pickImage(View view) {
pickSinglePhotoFromGallery();
}
/**
* Сохранение напоминалки
* @param view
*/
@OnClick(R.id.add)
public void saveReminder(View view) {
if (isForEdit) {
realm.executeTransaction(realm1 -> {
Reminder reminder = realm1.where(Reminder.class).equalTo("id", this.reminder.getId()).findFirst();
reminder.setPath(this.image);
reminder.setTimeInMillis(this.date);
reminder.setText(editText.getText().toString());
});
setResult(RESULT_OK);
finish();
return;
}
realm.executeTransaction(realm -> {
Number lastId = realm.where(Reminder.class).max("id");
int nextId;
if (lastId == null) {
nextId = 1;
} else {
nextId = lastId.intValue() + 1;
}
Reminder reminder = realm.createObject(Reminder.class);
reminder.setId(nextId);
reminder.setGroupId(groupId);
reminder.setTimeInMillis(date);
reminder.setText(editText.getText().toString());
reminder.setPath(image);
// Создание ноитификации, к alarmManger'y добавляется время, в окторое он дёрнет ресивер который отобразит нотификашку
Intent notificationIntent = new Intent(this, NotificationService.class);
notificationIntent.putExtra("id", nextId);
notificationIntent.putExtra("name", editText.getText().toString());
PendingIntent pendingIntent = PendingIntent.getService(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC, date, pendingIntent);
setResult(RESULT_OK);
finish();
});
}
/**
* Интерфейс который дёргается после выбора фотк(дёргается из OnActivityResult который находится в BaseActivity)
* @param pictures
*/
@Override
public void onPicturesTaken(ArrayList<String> pictures) {
this.image = "file://" + pictures.get(0);
Picasso.with(this).load(image).into(imageView);
}
private Notification getNotification(String content) {
Notification.Builder builder = new Notification.Builder(this);
builder.setContentTitle("Scheduled Notification");
builder.setContentText(content);
builder.setSmallIcon(R.drawable.ic_event_available_light_blue_200_24dp);
return builder.build();
}
}
| UTF-8 | Java | 9,514 | java | CreateReminderActivity.java | Java | []
| null | []
| package com.todolist.reminder.activities;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.DatePickerDialog;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.TimePicker;
import com.squareup.picasso.Picasso;
import com.todolist.reminder.CalendarUtils;
import com.todolist.reminder.R;
import com.todolist.reminder.models.Reminder;
import com.todolist.reminder.notifications.NotificationReceiver;
import com.todolist.reminder.notifications.NotificationService;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.realm.Realm;
public class CreateReminderActivity extends BaseActivity implements DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener, BaseActivity.PictureTakenListener {
private static final String ARG_ID = "id";
private static final String ARG_REMINDER = "reminder";
@BindView(R.id.add)
FloatingActionButton fab;
@BindView(R.id.title)
EditText editText;
@BindView(R.id.chose_date)
Button chooseDateButton;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.pick_image)
ImageView imageView;
private int groupId;
private int year, month, day, hour, minute;
private String image;
private long date;
private String name;
private Realm realm;
Calendar dateAndTime = Calendar.getInstance();
private Reminder reminder;
private boolean isForEdit = false;
/**
* Вызывается когда нажал + на экране со списком напоминаний
* @param context
* @param id
*/
public static void show(Activity context, int id) {
Intent intent = new Intent(context, CreateReminderActivity.class);
intent.putExtra(ARG_ID, id);
context.startActivityForResult(intent, 100);
}
/**
* Вызывается когда нажал редактировать на напоминалке
* @param context
* @param reminderId
*/
public static void showForEdit(Activity context, int reminderId) {
Intent intent = new Intent(context, CreateReminderActivity.class);
intent.putExtra(ARG_REMINDER, reminderId);
context.startActivityForResult(intent, 100);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_reminder);
ButterKnife.bind(this);
realm = Realm.getDefaultInstance();
if (getIntent().getIntExtra(ARG_REMINDER, -1) != -1) {
int reminderId = getIntent().getIntExtra(ARG_REMINDER, -1);
realm.executeTransaction(realm1 -> reminder = realm1.where(Reminder.class).equalTo("id", reminderId).findFirst());
isForEdit = true;
setUpData();
} else {
groupId = getIntent().getIntExtra(ARG_ID, -1);
}
dateAndTime = Calendar.getInstance();
setSupportActionBar(toolbar);
toolbar.setTitleTextColor(ContextCompat.getColor(this, R.color.white));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
private void setUpData() {
this.image = reminder.getPath();
this.date = reminder.getTimeInMillis();
chooseDateButton.setText(CalendarUtils.ConvertMilliSecondsToFormattedDate(reminder.getTimeInMillis()));
Picasso.with(this).load(reminder.getPath()).into(imageView);
editText.setText(reminder.getText());
}
/**
* Выбираем дату
* @param view
*/
@SuppressLint("WrongConstant")
@OnClick(R.id.chose_date)
public void showDatePickerDialog(View view) {
final Calendar c = Calendar.getInstance();
year = c.get(Calendar.YEAR);
month = c.get(Calendar.MONTH);
day = c.get(Calendar.DAY_OF_MONTH);
new DatePickerDialog(this, this, year, month, day).show();
}
/**
* Выбираем время
* @param datePicker
* @param year
* @param month
* @param day
*/
@SuppressLint("WrongConstant")
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int day) {
this.year = year;
this.month = month + 1;
this.day = day;
final Calendar c = Calendar.getInstance();
hour = c.get(Calendar.HOUR_OF_DAY);
minute = c.get(Calendar.MINUTE);
TimePickerDialog timePickerDialog = new TimePickerDialog(this, this, hour, minute, true);
timePickerDialog.show();
}
/**
* После того как выбали время преобразовываем его в время в миллисикудах и запоминаем в переменую date
* @param timePicker
* @param hour
* @param minute
*/
@SuppressLint("DefaultLocale")
@Override
public void onTimeSet(TimePicker timePicker, int hour, int minute) {
this.hour = hour;
this.minute = minute;
chooseDateButton.setText(String.format("%d - %d - %d\n%d:%d", day, month, year, hour, minute));
String mydate = String.format("%d - %d - %d %d:%d", day, month, year, hour, minute);
SimpleDateFormat sdf = new SimpleDateFormat("dd - M - yyyy HH:mm");
try {
Date date = sdf.parse(mydate);
this.date = date.getTime();
} catch (ParseException ignored) {
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
default:
return true;
}
}
/**
* Вызывается метод из BaseActivity для выбора фотк
* @param view
*/
@OnClick(R.id.pick_image)
public void pickImage(View view) {
pickSinglePhotoFromGallery();
}
/**
* Сохранение напоминалки
* @param view
*/
@OnClick(R.id.add)
public void saveReminder(View view) {
if (isForEdit) {
realm.executeTransaction(realm1 -> {
Reminder reminder = realm1.where(Reminder.class).equalTo("id", this.reminder.getId()).findFirst();
reminder.setPath(this.image);
reminder.setTimeInMillis(this.date);
reminder.setText(editText.getText().toString());
});
setResult(RESULT_OK);
finish();
return;
}
realm.executeTransaction(realm -> {
Number lastId = realm.where(Reminder.class).max("id");
int nextId;
if (lastId == null) {
nextId = 1;
} else {
nextId = lastId.intValue() + 1;
}
Reminder reminder = realm.createObject(Reminder.class);
reminder.setId(nextId);
reminder.setGroupId(groupId);
reminder.setTimeInMillis(date);
reminder.setText(editText.getText().toString());
reminder.setPath(image);
// Создание ноитификации, к alarmManger'y добавляется время, в окторое он дёрнет ресивер который отобразит нотификашку
Intent notificationIntent = new Intent(this, NotificationService.class);
notificationIntent.putExtra("id", nextId);
notificationIntent.putExtra("name", editText.getText().toString());
PendingIntent pendingIntent = PendingIntent.getService(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC, date, pendingIntent);
setResult(RESULT_OK);
finish();
});
}
/**
* Интерфейс который дёргается после выбора фотк(дёргается из OnActivityResult который находится в BaseActivity)
* @param pictures
*/
@Override
public void onPicturesTaken(ArrayList<String> pictures) {
this.image = "file://" + pictures.get(0);
Picasso.with(this).load(image).into(imageView);
}
private Notification getNotification(String content) {
Notification.Builder builder = new Notification.Builder(this);
builder.setContentTitle("Scheduled Notification");
builder.setContentText(content);
builder.setSmallIcon(R.drawable.ic_event_available_light_blue_200_24dp);
return builder.build();
}
}
| 9,514 | 0.657993 | 0.655138 | 279 | 31.645161 | 27.957333 | 175 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.681004 | false | false | 15 |
9eea0bed18d3cc21153314079c4fe5b434cd2876 | 10,677,288,720,751 | 3a8df767b5fb6c41534f2f84b50555479e3461a6 | /AppleQuestions/2.java | 61cd2c9f1f92bc0d5e8d9bab53d568a1b644616e | []
| no_license | HibaBarakat/Interview-Exercises | https://github.com/HibaBarakat/Interview-Exercises | 0599c163562dfbc710e66c6ce1bd216e9698fc7b | 66bdef223a6f6a084732991e44ef82dcc53f4e75 | refs/heads/master | 2020-09-13T20:03:02.053000 | 2019-11-28T14:48:16 | 2019-11-28T14:48:16 | 222,889,675 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// Write a function to check if array has duplicates or not
public static boolean isDublicate(int[] arr){
Set<Integer> set = new HashSet<>(Arrays.asList(arr));
if (set.size() < arr.length() ) return true;
return false;
}
// Write a function returns duplicates of an array.
public static List isDublicate(int[] arr){
Set<Integer> set = new HashSet<Integer>(arr.length);
for (int i : arr)
{
set.add(i);
}
List<Integer> duplicates = new ArrayList<Integer>();
int index = 0;
for (int i : arr)
{
if (set.contains(i)){
duplicates.add(i);
index++;
}
}
return duplicates;
} | UTF-8 | Java | 661 | java | 2.java | Java | []
| null | []
|
// Write a function to check if array has duplicates or not
public static boolean isDublicate(int[] arr){
Set<Integer> set = new HashSet<>(Arrays.asList(arr));
if (set.size() < arr.length() ) return true;
return false;
}
// Write a function returns duplicates of an array.
public static List isDublicate(int[] arr){
Set<Integer> set = new HashSet<Integer>(arr.length);
for (int i : arr)
{
set.add(i);
}
List<Integer> duplicates = new ArrayList<Integer>();
int index = 0;
for (int i : arr)
{
if (set.contains(i)){
duplicates.add(i);
index++;
}
}
return duplicates;
} | 661 | 0.599092 | 0.597579 | 32 | 19.65625 | 20.471947 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false | 15 |
291f7d172cda7f2dc78b75e3fdb23d00d68882a8 | 10,677,288,718,630 | 1561c02344959888c9655ced5f99aa8fbb67a3ab | /driveHere/src/main/java/com/yukti/driveherenew/ReportActivity.java | 6cd263ddc0b5a235398199ecb91cfdfc38cb77b8 | []
| no_license | DriveHerecom/Driveher | https://github.com/DriveHerecom/Driveher | 7e4b61a42a664338b0d8394ee16200865d97df1e | c77a9e36c332b77c804303477b9eedc9e330abcd | refs/heads/master | 2020-12-02T07:53:41.339000 | 2017-07-10T05:52:12 | 2017-07-10T05:52:12 | 96,740,870 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yukti.driveherenew;
import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.yukti.dataone.model.ReportDetail;
import com.yukti.dataone.model.ReportResult;
import com.yukti.driveherenew.MessageDialogFragment.MessageDialogListener;
import com.yukti.driveherenew.search.CarInventory;
import com.yukti.utils.AppSingleTon;
import com.yukti.utils.Common;
import com.yukti.utils.CommonUtils;
import com.yukti.utils.Constant;
import com.yukti.utils.Constants;
import com.yukti.utils.ParamsKey;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ReportActivity extends BaseActivity implements MessageDialogListener {
private static final String TAG = "CustomAdapter";
public static ArrayList<CarInventory> carList = null;
CustomAdapter adapter;
RecyclerView recyclerView;
ReportResult orm;
LinearLayout ll_reportprogress;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_report);
Log.e("OnCreate", "OnCreate");
Toolbar toolbar = (Toolbar) findViewById(R.id.activity_report_app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setItemAnimator(new DefaultItemAnimator());
LinearLayoutManager layoutManager = new LinearLayoutManager(ReportActivity.this);
recyclerView.setLayoutManager(layoutManager);
ll_reportprogress = (LinearLayout) findViewById(R.id.ll_progressReport);
if (savedInstanceState != null) {
orm = savedInstanceState.getParcelable("data");
setAdapter(orm.result);
} else
getReportDataUsingVolley();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Log.e("OnSaveInstanceState", "OnSaveInstanceState");
outState.putParcelable("data", orm);
}
void setAdapter(ArrayList<ReportDetail> reportdetail) {
if (adapter == null) {
adapter = new CustomAdapter(reportdetail);
recyclerView.setAdapter(adapter);
} else {
}
}
void getReportDataUsingVolley() {
ll_reportprogress.setVisibility(View.VISIBLE);
StringRequest stringRequest = new StringRequest(Request.Method.POST, AppSingleTon.APP_URL.URL_REPORT_MISSING_CAR,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
ll_reportprogress.setVisibility(View.GONE);
try {
orm = AppSingleTon.APP_JSON_PARSER.reportdata(response);
Log.e("Size", orm.status_code + " test");
if (orm.status_code.equals("1.")) {
for (int i = 0; i < orm.result.size(); i++) {
Log.e("Size", orm.result.get(i).stages.size() + " test");
}
setAdapter(orm.result);
} else if (orm.status_code.equals("2")) {
Toast.makeText(ReportActivity.this, "" + orm.msg, Toast.LENGTH_SHORT).show();
}
else if (orm.status_code.equals("4")) {
Toast.makeText(ReportActivity.this, "" + orm.msg, Toast.LENGTH_SHORT).show();
AppSingleTon.logOut(ReportActivity.this);
}
} catch (Exception e) {
e.printStackTrace();
CommonUtils.showAlertDialog(ReportActivity.this, Constant.ERR_TITLE, Constant.ERR_MESSAGE, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
if (Common.isNetworkConnected(getApplicationContext()))
getReportDataUsingVolley();
else
Toast.makeText(getApplicationContext(), Constant.ERR_INTERNET, Toast.LENGTH_LONG).show();
}
});
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
ll_reportprogress.setVisibility(View.GONE);
error.printStackTrace();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
HashMap<String, String> params = new HashMap<String, String>();
params.put(ParamsKey.KEY_type, "drivehere");
params.put(ParamsKey.KEY_userId, AppSingleTon.SHARED_PREFERENCE.getUserId());
params.put(ParamsKey.KEY_requestType, "1");
Log.e("Param", params.toString() + " ");
return params;
}
};
;
stringRequest.setTag(Constants.REQUEST_TAG);
stringRequest.setRetryPolicy(new DefaultRetryPolicy(
150000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
MyApplication.getInstance(getApplicationContext()).addToRequestQueue(stringRequest);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onDialogPositiveClick(MessageDialogFragment dialog) {
}
@Override
public void onDialogNegativeClick(MessageDialogFragment dialog) {
}
@Override
public void onDialogNeutralClick(MessageDialogFragment dialog) {
}
@Override
public void onBackPressed() {
super.onBackPressed();
cancleRequest();
ll_reportprogress.setVisibility(View.GONE);
}
void cancleRequest() {
if (MyApplication.getInstance(this.getApplicationContext()).getRequestQueue() != null) {
MyApplication.getInstance(this.getApplicationContext()).getRequestQueue().cancelAll(Constants.REQUEST_TAG);
}
}
void sendIntent(String s, String LotCode, String count) {
Intent i = new Intent(ReportActivity.this, MissingCarFullDetailActivity.class);
i.putExtra(MissingCarFullDetailActivity.EXTRA_KEY_STAGE, s);
if (LotCode.equalsIgnoreCase(""))
LotCode = "nolocation";
i.putExtra(MissingCarFullDetailActivity.EXTRA_KEY_LOTCODE, LotCode);
i.putExtra(MissingCarFullDetailActivity.EXTRA_COUNT, count);
startActivity(i);
}
public class CustomAdapter extends
RecyclerView.Adapter<CustomAdapter.ViewHolder> implements
OnClickListener {
public List<ReportDetail> items;
LayoutInflater inflater;
public CustomAdapter(ArrayList<ReportDetail> reportdetail) {
this.items = reportdetail;
inflater = LayoutInflater.from(ReportActivity.this);
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
// Create a new view.
View v = inflater.inflate(R.layout.row_reportdetail, viewGroup, false);
v.setOnClickListener(this);
return new ViewHolder(v);
}
@SuppressLint("NewApi")
@Override
public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
Log.e(TAG, "Element " + position + " set.");
final ReportDetail lotcode = items.get(position);
if (lotcode.lotcode.equalsIgnoreCase("")) {
viewHolder.txtlotcode.setText("No Location");
} else {
viewHolder.txtlotcode.setText(lotcode.lotcode);
}
viewHolder.search_row_parent.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.e("Clicked", "Clicked");
if (viewHolder.iv_plus.getVisibility() == View.VISIBLE) {
viewHolder.rl_mainStage.setVisibility(View.VISIBLE);
viewHolder.iv_minus.setVisibility(View.VISIBLE);
viewHolder.iv_plus.setVisibility(View.GONE);
viewHolder.search_row_parent.setBackgroundColor(getResources().getColor(R.color.accentColor));
viewHolder.txtlotcode.setTextColor(getResources().getColor(R.color.white));
viewHolder.txtmissingcar.setTextColor(getResources().getColor(R.color.white));
viewHolder.txt_totalCar.setTextColor(getResources().getColor(R.color.lightgray));
} else if (viewHolder.iv_plus.getVisibility() == View.GONE) {
viewHolder.rl_mainStage.setVisibility(View.GONE);
viewHolder.iv_minus.setVisibility(View.GONE);
viewHolder.iv_plus.setVisibility(View.VISIBLE);
viewHolder.search_row_parent.setBackgroundColor(getResources().getColor(R.color.white));
viewHolder.txtlotcode.setTextColor(getResources().getColor(R.color.black));
viewHolder.txtmissingcar.setTextColor(getResources().getColor(R.color.accentColor));
viewHolder.txt_totalCar.setTextColor(getResources().getColor(R.color.gray));
}
}
});
viewHolder.iv_plus.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
viewHolder.rl_mainStage.setVisibility(View.VISIBLE);
viewHolder.iv_minus.setVisibility(View.VISIBLE);
viewHolder.iv_plus.setVisibility(View.GONE);
viewHolder.search_row_parent.setBackgroundColor(getResources().getColor(R.color.accentColor));
viewHolder.txtlotcode.setTextColor(getResources().getColor(R.color.white));
viewHolder.txtmissingcar.setTextColor(getResources().getColor(R.color.white));
viewHolder.txt_totalCar.setTextColor(getResources().getColor(R.color.lightgray));
}
});
viewHolder.iv_minus.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
viewHolder.rl_mainStage.setVisibility(View.GONE);
viewHolder.iv_minus.setVisibility(View.GONE);
viewHolder.iv_plus.setVisibility(View.VISIBLE);
viewHolder.search_row_parent.setBackgroundColor(getResources().getColor(R.color.white));
viewHolder.txtlotcode.setTextColor(getResources().getColor(R.color.black));
viewHolder.txtmissingcar.setTextColor(getResources().getColor(R.color.accentColor));
viewHolder.txt_totalCar.setTextColor(getResources().getColor(R.color.gray));
}
});
if (items != null && items.get(position).stages != null) {
viewHolder.tv_all.setText("All" + " (" + items.get(position).total + ")");
for (int i = 0; i < items.get(position).stages.size(); i++) {
switch (items.get(position).stages.get(i).getStageName()) {
case "MC":
viewHolder.tv_mc.setText("MC" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "unknown":
viewHolder.tv_unknown.setText("Unknown" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "DONE":
viewHolder.tv_done.setText("Done" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "Ready":
viewHolder.tv_ready.setText("Ready" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "AUCTION":
viewHolder.tv_auction.setText("Auction" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "SOLD":
viewHolder.tv_sold.setText("Sold" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "PARTS":
viewHolder.tv_parts.setText("Parts" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "LOANER_OUT":
viewHolder.tv_loanerOut.setText("Loaner out" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "P/H-Customer":
viewHolder.tv_phCustomer.setText("P/H Customer" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "LOANER_SERVICE":
viewHolder.tv_loanerService.setText("Loaner ser" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "W/P-Customer":
viewHolder.tv_wpCustomer.setText("W/P Customer" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "JUNK":
viewHolder.tv_junk.setText("Junk" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "W/P-118":
viewHolder.tv_wp118.setText("W/P 118" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "LOANER_MISSING":
viewHolder.tv_loanerMissing.setText("Loaner Miss" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "W/P-CB":
viewHolder.tv_wpCB.setText("W/P CB" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "LOANER_IN":
viewHolder.tv_loanerIn.setText("Loaner In" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "Detailing":
viewHolder.tv_detailing.setText("Detailing" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "118":
viewHolder.tv_118.setText("118" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "MISSING":
viewHolder.tv_missing.setText("Missing" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "AVAILABLE":
viewHolder.tv_available.setText("Available" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "Hold Repo":
viewHolder.tv_holdRepo.setText("Hold Repo" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "P/H-118":
viewHolder.tv_ph118.setText("P/H 118" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "CB":
viewHolder.tv_cb.setText("CB" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "QC":
viewHolder.tv_qc.setText("QC" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "P/H-CB":
viewHolder.tv_phCB.setText("P/H CB" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "Hold PPA":
viewHolder.tv_holdPPA.setText("Hold PPA" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "40 Miles":
viewHolder.tv_40Miles.setText("40 Miles" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
}
}
}
viewHolder.tv_all.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
sendIntent("All", items.get(position).lotcode, items.get(position).stages.size() + "");
}
});
viewHolder.tv_mc.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("MC")) {
sendIntent("MC", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_wp118.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("W/P-118")) {
sendIntent("W/P-118", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_wpCB.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("W/P-CB",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("W/P-CB")) {
sendIntent("W/P-CB", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_wpCustomer.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("W/P-Customer",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("W/P-Customer")) {
sendIntent("W/P-Customer", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_ph118.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("P/H-118",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("P/H-118")) {
sendIntent("P/H-118", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_phCB.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("P/H-CB",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("P/H-CB")) {
sendIntent("P/H-CB", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_phCustomer.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("P/H-Customer",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("P/H-Customer")) {
sendIntent("P/H-Customer", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_118.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("118",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("118")) {
sendIntent("118", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_qc.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("QC",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("QC")) {
sendIntent("QC", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_cb.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("CB",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("CB")) {
sendIntent("CB", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_40Miles.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("40 Miles",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("40 Miles")) {
sendIntent("40 Miles", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_detailing.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("Detailing",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("Detailing")) {
sendIntent("Detailing", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_ready.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("Ready",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("Ready")) {
sendIntent("Ready", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_holdPPA.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("Hold PPA",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("Hold PPA")) {
sendIntent("Hold PPA", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_holdRepo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("Hold Repo",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("Hold Repo")) {
sendIntent("Hold Repo", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_unknown.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("UNKNOWN",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("unknown")) {
sendIntent("unknown", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_junk.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("JUNK",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("JUNK")) {
sendIntent("JUNK", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_auction.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("AUCTION",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("AUCTION")) {
sendIntent("AUCTION", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_done.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("DONE",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("DONE")) {
sendIntent("DONE", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_sold.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("SOLD",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("SOLD")) {
sendIntent("SOLD", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_parts.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("PARTS",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("PARTS")) {
sendIntent("PARTS", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_loanerOut.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("LOANER_OUT",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("LOANER_OUT")) {
sendIntent("LOANER_OUT", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_loanerService.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("LOANER_SERVICE",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("LOANER_SERVICE")) {
sendIntent("LOANER_SERVICE", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_loanerMissing.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("LOANER_MISSING",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("LOANER_MISSING")) {
sendIntent("LOANER_MISSING", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_loanerIn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("LOANER_IN",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("LOANER_IN")) {
sendIntent("LOANER_IN", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_missing.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("MISSING",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("MISSING")) {
sendIntent("MISSING", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_available.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("AVAILABLE",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("AVAILABLE")) {
sendIntent("AVAILABLE", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.txtmissingcar.setText(lotcode.total);
}
@Override
public int getItemCount() {
return items.size();
}
@Override
public void onClick(View v) {
/* int itemPosition = recyclerView.getChildAdapterPosition(v);
Intent intent = new Intent(ReportActivity.this, MissCarSearchActivity.class);
intent.putExtra("lotcode", "" + items.get(itemPosition).lotcode);
Log.e("selected_lotcode", "" + items.get(itemPosition).lotcode);
startActivity(intent);*/
}
public class ViewHolder extends RecyclerView.ViewHolder {
TextView txtlotcode, txtmissingcar, txt_totalCar;
LinearLayout search_row_parent, ll_view;
RelativeLayout rl_mainStage;
ImageView iv_plus, iv_minus;
TextView tv_all, tv_mc, tv_wp118, tv_wpCB, tv_wpCustomer, tv_ph118, tv_phCB, tv_phCustomer,
tv_118, tv_qc, tv_cb, tv_40Miles, tv_detailing, tv_ready, tv_holdPPA, tv_holdRepo, tv_unknown, tv_junk, tv_auction;
///////////////// 21 feb 2017
TextView tv_done, tv_sold, tv_parts, tv_loanerOut, tv_loanerService, tv_loanerMissing, tv_loanerIn, tv_missing, tv_available;
public ViewHolder(View v) {
super(v);
rl_mainStage = (RelativeLayout) v.findViewById(R.id.rl_mainStage);
search_row_parent = (LinearLayout) v.findViewById(R.id.search_row_parent);
ll_view = (LinearLayout) v.findViewById(R.id.ll_view);
iv_plus = (ImageView) v.findViewById(R.id.iv_plus);
iv_minus = (ImageView) v.findViewById(R.id.iv_minus);
txtlotcode = (TextView) v.findViewById(R.id.lotecode);
txt_totalCar = (TextView) v.findViewById(R.id.txt_totalCar);
txtmissingcar = (TextView) v.findViewById(R.id.totalmissingcar);
tv_all = (TextView) v.findViewById(R.id.tv_all);
tv_mc = (TextView) v.findViewById(R.id.tv_mc);
tv_wp118 = (TextView) v.findViewById(R.id.tv_wp118);
tv_wpCB = (TextView) v.findViewById(R.id.tv_wpCB);
tv_wpCustomer = (TextView) v.findViewById(R.id.tv_wpCustomer);
tv_ph118 = (TextView) v.findViewById(R.id.tv_ph118);
tv_phCB = (TextView) v.findViewById(R.id.tv_phCB);
tv_phCustomer = (TextView) v.findViewById(R.id.tv_phCustomer);
tv_118 = (TextView) v.findViewById(R.id.tv_118);
tv_qc = (TextView) v.findViewById(R.id.tv_qc);
tv_cb = (TextView) v.findViewById(R.id.tv_cb);
tv_40Miles = (TextView) v.findViewById(R.id.tv_40Miles);
tv_detailing = (TextView) v.findViewById(R.id.tv_detailing);
tv_ready = (TextView) v.findViewById(R.id.tv_ready);
tv_holdPPA = (TextView) v.findViewById(R.id.tv_holdPPA);
tv_holdRepo = (TextView) v.findViewById(R.id.tv_holdRepo);
tv_unknown = (TextView) v.findViewById(R.id.tv_unknown);
tv_junk = (TextView) v.findViewById(R.id.tv_junk);
tv_auction = (TextView) v.findViewById(R.id.tv_auction);
///////////////// 21 feb 2017
tv_done = (TextView) v.findViewById(R.id.tv_done);
tv_sold = (TextView) v.findViewById(R.id.tv_sold);
tv_parts = (TextView) v.findViewById(R.id.tv_parts);
tv_loanerOut = (TextView) v.findViewById(R.id.tv_loanerOut);
tv_loanerService = (TextView) v.findViewById(R.id.tv_loanerService);
tv_loanerMissing = (TextView) v.findViewById(R.id.tv_loanerMissing);
tv_loanerIn = (TextView) v.findViewById(R.id.tv_loanerIn);
tv_missing = (TextView) v.findViewById(R.id.tv_missing);
tv_available = (TextView) v.findViewById(R.id.tv_available);
}
}
}
} | UTF-8 | Java | 39,593 | java | ReportActivity.java | Java | [
{
"context": " params.put(ParamsKey.KEY_type, \"drivehere\");\n params.put(ParamsKey.KEY_userI",
"end": 6027,
"score": 0.6831808090209961,
"start": 6023,
"tag": "KEY",
"value": "here"
}
]
| null | []
| package com.yukti.driveherenew;
import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.yukti.dataone.model.ReportDetail;
import com.yukti.dataone.model.ReportResult;
import com.yukti.driveherenew.MessageDialogFragment.MessageDialogListener;
import com.yukti.driveherenew.search.CarInventory;
import com.yukti.utils.AppSingleTon;
import com.yukti.utils.Common;
import com.yukti.utils.CommonUtils;
import com.yukti.utils.Constant;
import com.yukti.utils.Constants;
import com.yukti.utils.ParamsKey;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ReportActivity extends BaseActivity implements MessageDialogListener {
private static final String TAG = "CustomAdapter";
public static ArrayList<CarInventory> carList = null;
CustomAdapter adapter;
RecyclerView recyclerView;
ReportResult orm;
LinearLayout ll_reportprogress;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_report);
Log.e("OnCreate", "OnCreate");
Toolbar toolbar = (Toolbar) findViewById(R.id.activity_report_app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setItemAnimator(new DefaultItemAnimator());
LinearLayoutManager layoutManager = new LinearLayoutManager(ReportActivity.this);
recyclerView.setLayoutManager(layoutManager);
ll_reportprogress = (LinearLayout) findViewById(R.id.ll_progressReport);
if (savedInstanceState != null) {
orm = savedInstanceState.getParcelable("data");
setAdapter(orm.result);
} else
getReportDataUsingVolley();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Log.e("OnSaveInstanceState", "OnSaveInstanceState");
outState.putParcelable("data", orm);
}
void setAdapter(ArrayList<ReportDetail> reportdetail) {
if (adapter == null) {
adapter = new CustomAdapter(reportdetail);
recyclerView.setAdapter(adapter);
} else {
}
}
void getReportDataUsingVolley() {
ll_reportprogress.setVisibility(View.VISIBLE);
StringRequest stringRequest = new StringRequest(Request.Method.POST, AppSingleTon.APP_URL.URL_REPORT_MISSING_CAR,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
ll_reportprogress.setVisibility(View.GONE);
try {
orm = AppSingleTon.APP_JSON_PARSER.reportdata(response);
Log.e("Size", orm.status_code + " test");
if (orm.status_code.equals("1.")) {
for (int i = 0; i < orm.result.size(); i++) {
Log.e("Size", orm.result.get(i).stages.size() + " test");
}
setAdapter(orm.result);
} else if (orm.status_code.equals("2")) {
Toast.makeText(ReportActivity.this, "" + orm.msg, Toast.LENGTH_SHORT).show();
}
else if (orm.status_code.equals("4")) {
Toast.makeText(ReportActivity.this, "" + orm.msg, Toast.LENGTH_SHORT).show();
AppSingleTon.logOut(ReportActivity.this);
}
} catch (Exception e) {
e.printStackTrace();
CommonUtils.showAlertDialog(ReportActivity.this, Constant.ERR_TITLE, Constant.ERR_MESSAGE, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
if (Common.isNetworkConnected(getApplicationContext()))
getReportDataUsingVolley();
else
Toast.makeText(getApplicationContext(), Constant.ERR_INTERNET, Toast.LENGTH_LONG).show();
}
});
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
ll_reportprogress.setVisibility(View.GONE);
error.printStackTrace();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
HashMap<String, String> params = new HashMap<String, String>();
params.put(ParamsKey.KEY_type, "drivehere");
params.put(ParamsKey.KEY_userId, AppSingleTon.SHARED_PREFERENCE.getUserId());
params.put(ParamsKey.KEY_requestType, "1");
Log.e("Param", params.toString() + " ");
return params;
}
};
;
stringRequest.setTag(Constants.REQUEST_TAG);
stringRequest.setRetryPolicy(new DefaultRetryPolicy(
150000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
MyApplication.getInstance(getApplicationContext()).addToRequestQueue(stringRequest);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onDialogPositiveClick(MessageDialogFragment dialog) {
}
@Override
public void onDialogNegativeClick(MessageDialogFragment dialog) {
}
@Override
public void onDialogNeutralClick(MessageDialogFragment dialog) {
}
@Override
public void onBackPressed() {
super.onBackPressed();
cancleRequest();
ll_reportprogress.setVisibility(View.GONE);
}
void cancleRequest() {
if (MyApplication.getInstance(this.getApplicationContext()).getRequestQueue() != null) {
MyApplication.getInstance(this.getApplicationContext()).getRequestQueue().cancelAll(Constants.REQUEST_TAG);
}
}
void sendIntent(String s, String LotCode, String count) {
Intent i = new Intent(ReportActivity.this, MissingCarFullDetailActivity.class);
i.putExtra(MissingCarFullDetailActivity.EXTRA_KEY_STAGE, s);
if (LotCode.equalsIgnoreCase(""))
LotCode = "nolocation";
i.putExtra(MissingCarFullDetailActivity.EXTRA_KEY_LOTCODE, LotCode);
i.putExtra(MissingCarFullDetailActivity.EXTRA_COUNT, count);
startActivity(i);
}
public class CustomAdapter extends
RecyclerView.Adapter<CustomAdapter.ViewHolder> implements
OnClickListener {
public List<ReportDetail> items;
LayoutInflater inflater;
public CustomAdapter(ArrayList<ReportDetail> reportdetail) {
this.items = reportdetail;
inflater = LayoutInflater.from(ReportActivity.this);
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
// Create a new view.
View v = inflater.inflate(R.layout.row_reportdetail, viewGroup, false);
v.setOnClickListener(this);
return new ViewHolder(v);
}
@SuppressLint("NewApi")
@Override
public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
Log.e(TAG, "Element " + position + " set.");
final ReportDetail lotcode = items.get(position);
if (lotcode.lotcode.equalsIgnoreCase("")) {
viewHolder.txtlotcode.setText("No Location");
} else {
viewHolder.txtlotcode.setText(lotcode.lotcode);
}
viewHolder.search_row_parent.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.e("Clicked", "Clicked");
if (viewHolder.iv_plus.getVisibility() == View.VISIBLE) {
viewHolder.rl_mainStage.setVisibility(View.VISIBLE);
viewHolder.iv_minus.setVisibility(View.VISIBLE);
viewHolder.iv_plus.setVisibility(View.GONE);
viewHolder.search_row_parent.setBackgroundColor(getResources().getColor(R.color.accentColor));
viewHolder.txtlotcode.setTextColor(getResources().getColor(R.color.white));
viewHolder.txtmissingcar.setTextColor(getResources().getColor(R.color.white));
viewHolder.txt_totalCar.setTextColor(getResources().getColor(R.color.lightgray));
} else if (viewHolder.iv_plus.getVisibility() == View.GONE) {
viewHolder.rl_mainStage.setVisibility(View.GONE);
viewHolder.iv_minus.setVisibility(View.GONE);
viewHolder.iv_plus.setVisibility(View.VISIBLE);
viewHolder.search_row_parent.setBackgroundColor(getResources().getColor(R.color.white));
viewHolder.txtlotcode.setTextColor(getResources().getColor(R.color.black));
viewHolder.txtmissingcar.setTextColor(getResources().getColor(R.color.accentColor));
viewHolder.txt_totalCar.setTextColor(getResources().getColor(R.color.gray));
}
}
});
viewHolder.iv_plus.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
viewHolder.rl_mainStage.setVisibility(View.VISIBLE);
viewHolder.iv_minus.setVisibility(View.VISIBLE);
viewHolder.iv_plus.setVisibility(View.GONE);
viewHolder.search_row_parent.setBackgroundColor(getResources().getColor(R.color.accentColor));
viewHolder.txtlotcode.setTextColor(getResources().getColor(R.color.white));
viewHolder.txtmissingcar.setTextColor(getResources().getColor(R.color.white));
viewHolder.txt_totalCar.setTextColor(getResources().getColor(R.color.lightgray));
}
});
viewHolder.iv_minus.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
viewHolder.rl_mainStage.setVisibility(View.GONE);
viewHolder.iv_minus.setVisibility(View.GONE);
viewHolder.iv_plus.setVisibility(View.VISIBLE);
viewHolder.search_row_parent.setBackgroundColor(getResources().getColor(R.color.white));
viewHolder.txtlotcode.setTextColor(getResources().getColor(R.color.black));
viewHolder.txtmissingcar.setTextColor(getResources().getColor(R.color.accentColor));
viewHolder.txt_totalCar.setTextColor(getResources().getColor(R.color.gray));
}
});
if (items != null && items.get(position).stages != null) {
viewHolder.tv_all.setText("All" + " (" + items.get(position).total + ")");
for (int i = 0; i < items.get(position).stages.size(); i++) {
switch (items.get(position).stages.get(i).getStageName()) {
case "MC":
viewHolder.tv_mc.setText("MC" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "unknown":
viewHolder.tv_unknown.setText("Unknown" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "DONE":
viewHolder.tv_done.setText("Done" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "Ready":
viewHolder.tv_ready.setText("Ready" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "AUCTION":
viewHolder.tv_auction.setText("Auction" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "SOLD":
viewHolder.tv_sold.setText("Sold" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "PARTS":
viewHolder.tv_parts.setText("Parts" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "LOANER_OUT":
viewHolder.tv_loanerOut.setText("Loaner out" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "P/H-Customer":
viewHolder.tv_phCustomer.setText("P/H Customer" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "LOANER_SERVICE":
viewHolder.tv_loanerService.setText("Loaner ser" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "W/P-Customer":
viewHolder.tv_wpCustomer.setText("W/P Customer" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "JUNK":
viewHolder.tv_junk.setText("Junk" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "W/P-118":
viewHolder.tv_wp118.setText("W/P 118" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "LOANER_MISSING":
viewHolder.tv_loanerMissing.setText("Loaner Miss" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "W/P-CB":
viewHolder.tv_wpCB.setText("W/P CB" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "LOANER_IN":
viewHolder.tv_loanerIn.setText("Loaner In" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "Detailing":
viewHolder.tv_detailing.setText("Detailing" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "118":
viewHolder.tv_118.setText("118" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "MISSING":
viewHolder.tv_missing.setText("Missing" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "AVAILABLE":
viewHolder.tv_available.setText("Available" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "Hold Repo":
viewHolder.tv_holdRepo.setText("Hold Repo" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "P/H-118":
viewHolder.tv_ph118.setText("P/H 118" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "CB":
viewHolder.tv_cb.setText("CB" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "QC":
viewHolder.tv_qc.setText("QC" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "P/H-CB":
viewHolder.tv_phCB.setText("P/H CB" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "Hold PPA":
viewHolder.tv_holdPPA.setText("Hold PPA" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
case "40 Miles":
viewHolder.tv_40Miles.setText("40 Miles" + " (" + items.get(position).stages.get(i).getTotal() + ")");
break;
}
}
}
viewHolder.tv_all.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
sendIntent("All", items.get(position).lotcode, items.get(position).stages.size() + "");
}
});
viewHolder.tv_mc.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("MC")) {
sendIntent("MC", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_wp118.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("W/P-118")) {
sendIntent("W/P-118", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_wpCB.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("W/P-CB",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("W/P-CB")) {
sendIntent("W/P-CB", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_wpCustomer.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("W/P-Customer",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("W/P-Customer")) {
sendIntent("W/P-Customer", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_ph118.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("P/H-118",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("P/H-118")) {
sendIntent("P/H-118", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_phCB.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("P/H-CB",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("P/H-CB")) {
sendIntent("P/H-CB", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_phCustomer.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("P/H-Customer",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("P/H-Customer")) {
sendIntent("P/H-Customer", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_118.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("118",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("118")) {
sendIntent("118", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_qc.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("QC",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("QC")) {
sendIntent("QC", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_cb.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("CB",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("CB")) {
sendIntent("CB", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_40Miles.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("40 Miles",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("40 Miles")) {
sendIntent("40 Miles", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_detailing.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("Detailing",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("Detailing")) {
sendIntent("Detailing", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_ready.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("Ready",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("Ready")) {
sendIntent("Ready", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_holdPPA.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("Hold PPA",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("Hold PPA")) {
sendIntent("Hold PPA", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_holdRepo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("Hold Repo",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("Hold Repo")) {
sendIntent("Hold Repo", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_unknown.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("UNKNOWN",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("unknown")) {
sendIntent("unknown", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_junk.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("JUNK",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("JUNK")) {
sendIntent("JUNK", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_auction.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("AUCTION",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("AUCTION")) {
sendIntent("AUCTION", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_done.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("DONE",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("DONE")) {
sendIntent("DONE", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_sold.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("SOLD",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("SOLD")) {
sendIntent("SOLD", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_parts.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("PARTS",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("PARTS")) {
sendIntent("PARTS", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_loanerOut.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("LOANER_OUT",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("LOANER_OUT")) {
sendIntent("LOANER_OUT", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_loanerService.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("LOANER_SERVICE",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("LOANER_SERVICE")) {
sendIntent("LOANER_SERVICE", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_loanerMissing.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("LOANER_MISSING",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("LOANER_MISSING")) {
sendIntent("LOANER_MISSING", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_loanerIn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("LOANER_IN",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("LOANER_IN")) {
sendIntent("LOANER_IN", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_missing.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("MISSING",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("MISSING")) {
sendIntent("MISSING", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.tv_available.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// sendIntent("AVAILABLE",items.get(position).lotcode);
for (int i = 0; i < items.get(position).stages.size(); i++) {
if (items.get(position).stages.get(i).getStageName().equalsIgnoreCase("AVAILABLE")) {
sendIntent("AVAILABLE", items.get(position).lotcode, items.get(position).stages.get(i).getTotal() + "");
}
}
}
});
viewHolder.txtmissingcar.setText(lotcode.total);
}
@Override
public int getItemCount() {
return items.size();
}
@Override
public void onClick(View v) {
/* int itemPosition = recyclerView.getChildAdapterPosition(v);
Intent intent = new Intent(ReportActivity.this, MissCarSearchActivity.class);
intent.putExtra("lotcode", "" + items.get(itemPosition).lotcode);
Log.e("selected_lotcode", "" + items.get(itemPosition).lotcode);
startActivity(intent);*/
}
public class ViewHolder extends RecyclerView.ViewHolder {
TextView txtlotcode, txtmissingcar, txt_totalCar;
LinearLayout search_row_parent, ll_view;
RelativeLayout rl_mainStage;
ImageView iv_plus, iv_minus;
TextView tv_all, tv_mc, tv_wp118, tv_wpCB, tv_wpCustomer, tv_ph118, tv_phCB, tv_phCustomer,
tv_118, tv_qc, tv_cb, tv_40Miles, tv_detailing, tv_ready, tv_holdPPA, tv_holdRepo, tv_unknown, tv_junk, tv_auction;
///////////////// 21 feb 2017
TextView tv_done, tv_sold, tv_parts, tv_loanerOut, tv_loanerService, tv_loanerMissing, tv_loanerIn, tv_missing, tv_available;
public ViewHolder(View v) {
super(v);
rl_mainStage = (RelativeLayout) v.findViewById(R.id.rl_mainStage);
search_row_parent = (LinearLayout) v.findViewById(R.id.search_row_parent);
ll_view = (LinearLayout) v.findViewById(R.id.ll_view);
iv_plus = (ImageView) v.findViewById(R.id.iv_plus);
iv_minus = (ImageView) v.findViewById(R.id.iv_minus);
txtlotcode = (TextView) v.findViewById(R.id.lotecode);
txt_totalCar = (TextView) v.findViewById(R.id.txt_totalCar);
txtmissingcar = (TextView) v.findViewById(R.id.totalmissingcar);
tv_all = (TextView) v.findViewById(R.id.tv_all);
tv_mc = (TextView) v.findViewById(R.id.tv_mc);
tv_wp118 = (TextView) v.findViewById(R.id.tv_wp118);
tv_wpCB = (TextView) v.findViewById(R.id.tv_wpCB);
tv_wpCustomer = (TextView) v.findViewById(R.id.tv_wpCustomer);
tv_ph118 = (TextView) v.findViewById(R.id.tv_ph118);
tv_phCB = (TextView) v.findViewById(R.id.tv_phCB);
tv_phCustomer = (TextView) v.findViewById(R.id.tv_phCustomer);
tv_118 = (TextView) v.findViewById(R.id.tv_118);
tv_qc = (TextView) v.findViewById(R.id.tv_qc);
tv_cb = (TextView) v.findViewById(R.id.tv_cb);
tv_40Miles = (TextView) v.findViewById(R.id.tv_40Miles);
tv_detailing = (TextView) v.findViewById(R.id.tv_detailing);
tv_ready = (TextView) v.findViewById(R.id.tv_ready);
tv_holdPPA = (TextView) v.findViewById(R.id.tv_holdPPA);
tv_holdRepo = (TextView) v.findViewById(R.id.tv_holdRepo);
tv_unknown = (TextView) v.findViewById(R.id.tv_unknown);
tv_junk = (TextView) v.findViewById(R.id.tv_junk);
tv_auction = (TextView) v.findViewById(R.id.tv_auction);
///////////////// 21 feb 2017
tv_done = (TextView) v.findViewById(R.id.tv_done);
tv_sold = (TextView) v.findViewById(R.id.tv_sold);
tv_parts = (TextView) v.findViewById(R.id.tv_parts);
tv_loanerOut = (TextView) v.findViewById(R.id.tv_loanerOut);
tv_loanerService = (TextView) v.findViewById(R.id.tv_loanerService);
tv_loanerMissing = (TextView) v.findViewById(R.id.tv_loanerMissing);
tv_loanerIn = (TextView) v.findViewById(R.id.tv_loanerIn);
tv_missing = (TextView) v.findViewById(R.id.tv_missing);
tv_available = (TextView) v.findViewById(R.id.tv_available);
}
}
}
} | 39,593 | 0.515394 | 0.511303 | 804 | 48.246269 | 37.680962 | 158 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.677861 | false | false | 15 |
eed644a964bbb197d7f7d4165e08e820e43f4238 | 22,462,679,023,319 | a69cbea20b2299848da5a265811e558450280c72 | /app/src/main/java/com/example/jlccustomer/Adapters/MyPlacesAdapter.java | a6a7d2a4e383d99462ea3be3c23543ee7be5bcc8 | []
| no_license | webdeveloper510/JlCAndroidCustomer | https://github.com/webdeveloper510/JlCAndroidCustomer | 537b0fd0507aa2bbf06bca7abce461d0e723fb50 | 72805110b6f0489bd62a733fc288a4256a59770b | refs/heads/master | 2020-08-28T02:47:51.404000 | 2019-10-25T15:44:48 | 2019-10-25T15:44:48 | 217,566,109 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.jlccustomer.Adapters;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.TextView;
import com.example.jlccustomer.Model.MyGooglePlaces;
import com.example.jlccustomer.R;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
public class MyPlacesAdapter extends BaseAdapter implements Filterable {
private LayoutInflater mInflater;
Context con;
private EnentHandler handler;
ArrayList<MyGooglePlaces> places = new ArrayList<MyGooglePlaces>();
public MyPlacesAdapter(Context context, EnentHandler handler) {
super();
this.handler = handler;
mInflater = LayoutInflater.from(context);
con = context;
}
// get total count of array
@Override
public int getCount() {
return places.size();
}
//get item id
@Override
public long getItemId(int position) {
return position;
}
// get Mygoogleplaces object at given position
@Override
public MyGooglePlaces getItem(int position) {
return places.get(position);
}
//Filter to filter the results
@Override
public Filter getFilter() {
Filter filter = new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults();
if (constraint != null) {
ArrayList<MyGooglePlaces> myGooglePlaces = getPredictions(constraint.toString());
if (places != null) {
results.values = myGooglePlaces;
results.count = myGooglePlaces.size();
// handler.handle(1);
} else {
// Toast.makeText(con,"No Result Found",Toast.LENGTH_LONG).show();
}
}
return results;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
if (results != null && results.count > 0) {
// The API returned at least one result, update the data.
places.clear();
places = (ArrayList<MyGooglePlaces>) results.values;
notifyDataSetChanged();
// notifyDataSetChanged();
// handler.handle(1);
Log.d("resultPlaces", results + "" + "Has changed 85");
} else {
// The API did not return any results, invalidate the data set.
notifyDataSetInvalidated();
// handler.handle(0);
Log.d("resultPlaces", "Has not not changed 90");
// Toast.makeText(con,"No Result Found",Toast.LENGTH_LONG).show();
}
}
};
return filter;
}
// method to get different places nearby search location
private ArrayList<MyGooglePlaces> getPredictions(String constraint) {
//pass your current latitude and longitude to find nearby and ranky=distance means places will be found in ascending order
// according to distance
double latitude = 30.7132;
double longitude = 76.6956;
String API_KEY = "AIzaSyBK_sjlSWkg1pHrNFuJeSyTNo8BZApjYpE";
String url = "https://maps.googleapis.com/maps/api/place/autocomplete/json?" + "&input=" + constraint + "&types=geocode" + "&key=" + API_KEY;
Log.d("urll", url);
return getPlaces(url);
}
private ArrayList<MyGooglePlaces> getPlaces(String constraint) {
//code for API level 23 as httpclient is depricated in API 23
StringBuffer sb = null;
URL url;
HttpURLConnection urlConnection = null;
try {
url = new URL(constraint);
urlConnection = (HttpURLConnection) url.openConnection();
InputStream in = urlConnection.getInputStream();
InputStreamReader isw = new InputStreamReader(in);
int data = isw.read();
sb = new StringBuffer("");
while (data != -1) {
sb.append((char) data);
//char current = (char) data;
data = isw.read();
// System.out.print(current);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
}
}
return parseGoogleParse(sb.toString());
}
// method to parse the json returned by googleplaces api
private static ArrayList parseGoogleParse(final String response) {
ArrayList<MyGooglePlaces> temp = new ArrayList();
try {
// make an jsonObject in order to parse the response
JSONObject jsonObject = new JSONObject(response);
Log.d("places", jsonObject.toString());
// make an jsonObject in order to parse the response
if (jsonObject.has("predictions")) {
Log.d("places", jsonObject.toString());
JSONArray jsonArray = jsonObject.getJSONArray("predictions");
for (int i = 0; i < jsonArray.length(); i++) {
MyGooglePlaces poi = new MyGooglePlaces();
if (jsonArray.getJSONObject(i).has("description")) {
poi.setName(jsonArray.getJSONObject(i).getString("description"));
}
//if(temp.size()<5)
temp.add(poi);
}
}
} catch (Exception e) {
e.printStackTrace();
return new ArrayList();
}
return temp;
}
// View method called for each row of the result
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// A ViewHolder keeps references to children views to avoid unnecessary calls
// to findViewById() on each row.
ViewHolder holder;
// When convertView is not null, we can reuse it directly, there is no need
// to reinflate it. We only inflate a new View when the convertView supplied
// by ListView is null.
if (convertView == null) {
convertView = mInflater.inflate(R.layout.autocomplete, null);
// Creates a ViewHolder and store references to the two children views
// we want to bind data to.
holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.myplaces);
holder.address = (TextView) convertView.findViewById(R.id.address);
// Bind the data efficiently with the holder.
convertView.setTag(holder);
} else {
// Get the ViewHolder back to get fast access to the TextView
// and the ImageView.
holder = (ViewHolder) convertView.getTag();
}
if (places != null && places.size() > position) {
// If weren't re-ordering this you could rely on what you set last time
holder.text.setText(places.get(position).getName());
holder.address.setText(places.get(position).getVicinity());
}
return convertView;
}
// viewholder class to hold adapter views
static class ViewHolder {
TextView text, address;
}
public interface EnentHandler {
void handle(int i);
}
} | UTF-8 | Java | 7,866 | java | MyPlacesAdapter.java | Java | [
{
"context": "le longitude = 76.6956;\n String API_KEY = \"AIzaSyBK_sjlSWkg1pHrNFuJeSyTNo8BZApjYpE\";\n\n String url = \"https://maps.googleapis.",
"end": 3709,
"score": 0.9997578263282776,
"start": 3670,
"tag": "KEY",
"value": "AIzaSyBK_sjlSWkg1pHrNFuJeSyTNo8BZApjYpE"
}
]
| null | []
| package com.example.jlccustomer.Adapters;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.TextView;
import com.example.jlccustomer.Model.MyGooglePlaces;
import com.example.jlccustomer.R;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
public class MyPlacesAdapter extends BaseAdapter implements Filterable {
private LayoutInflater mInflater;
Context con;
private EnentHandler handler;
ArrayList<MyGooglePlaces> places = new ArrayList<MyGooglePlaces>();
public MyPlacesAdapter(Context context, EnentHandler handler) {
super();
this.handler = handler;
mInflater = LayoutInflater.from(context);
con = context;
}
// get total count of array
@Override
public int getCount() {
return places.size();
}
//get item id
@Override
public long getItemId(int position) {
return position;
}
// get Mygoogleplaces object at given position
@Override
public MyGooglePlaces getItem(int position) {
return places.get(position);
}
//Filter to filter the results
@Override
public Filter getFilter() {
Filter filter = new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults();
if (constraint != null) {
ArrayList<MyGooglePlaces> myGooglePlaces = getPredictions(constraint.toString());
if (places != null) {
results.values = myGooglePlaces;
results.count = myGooglePlaces.size();
// handler.handle(1);
} else {
// Toast.makeText(con,"No Result Found",Toast.LENGTH_LONG).show();
}
}
return results;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
if (results != null && results.count > 0) {
// The API returned at least one result, update the data.
places.clear();
places = (ArrayList<MyGooglePlaces>) results.values;
notifyDataSetChanged();
// notifyDataSetChanged();
// handler.handle(1);
Log.d("resultPlaces", results + "" + "Has changed 85");
} else {
// The API did not return any results, invalidate the data set.
notifyDataSetInvalidated();
// handler.handle(0);
Log.d("resultPlaces", "Has not not changed 90");
// Toast.makeText(con,"No Result Found",Toast.LENGTH_LONG).show();
}
}
};
return filter;
}
// method to get different places nearby search location
private ArrayList<MyGooglePlaces> getPredictions(String constraint) {
//pass your current latitude and longitude to find nearby and ranky=distance means places will be found in ascending order
// according to distance
double latitude = 30.7132;
double longitude = 76.6956;
String API_KEY = "<KEY>";
String url = "https://maps.googleapis.com/maps/api/place/autocomplete/json?" + "&input=" + constraint + "&types=geocode" + "&key=" + API_KEY;
Log.d("urll", url);
return getPlaces(url);
}
private ArrayList<MyGooglePlaces> getPlaces(String constraint) {
//code for API level 23 as httpclient is depricated in API 23
StringBuffer sb = null;
URL url;
HttpURLConnection urlConnection = null;
try {
url = new URL(constraint);
urlConnection = (HttpURLConnection) url.openConnection();
InputStream in = urlConnection.getInputStream();
InputStreamReader isw = new InputStreamReader(in);
int data = isw.read();
sb = new StringBuffer("");
while (data != -1) {
sb.append((char) data);
//char current = (char) data;
data = isw.read();
// System.out.print(current);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
}
}
return parseGoogleParse(sb.toString());
}
// method to parse the json returned by googleplaces api
private static ArrayList parseGoogleParse(final String response) {
ArrayList<MyGooglePlaces> temp = new ArrayList();
try {
// make an jsonObject in order to parse the response
JSONObject jsonObject = new JSONObject(response);
Log.d("places", jsonObject.toString());
// make an jsonObject in order to parse the response
if (jsonObject.has("predictions")) {
Log.d("places", jsonObject.toString());
JSONArray jsonArray = jsonObject.getJSONArray("predictions");
for (int i = 0; i < jsonArray.length(); i++) {
MyGooglePlaces poi = new MyGooglePlaces();
if (jsonArray.getJSONObject(i).has("description")) {
poi.setName(jsonArray.getJSONObject(i).getString("description"));
}
//if(temp.size()<5)
temp.add(poi);
}
}
} catch (Exception e) {
e.printStackTrace();
return new ArrayList();
}
return temp;
}
// View method called for each row of the result
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// A ViewHolder keeps references to children views to avoid unnecessary calls
// to findViewById() on each row.
ViewHolder holder;
// When convertView is not null, we can reuse it directly, there is no need
// to reinflate it. We only inflate a new View when the convertView supplied
// by ListView is null.
if (convertView == null) {
convertView = mInflater.inflate(R.layout.autocomplete, null);
// Creates a ViewHolder and store references to the two children views
// we want to bind data to.
holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.myplaces);
holder.address = (TextView) convertView.findViewById(R.id.address);
// Bind the data efficiently with the holder.
convertView.setTag(holder);
} else {
// Get the ViewHolder back to get fast access to the TextView
// and the ImageView.
holder = (ViewHolder) convertView.getTag();
}
if (places != null && places.size() > position) {
// If weren't re-ordering this you could rely on what you set last time
holder.text.setText(places.get(position).getName());
holder.address.setText(places.get(position).getVicinity());
}
return convertView;
}
// viewholder class to hold adapter views
static class ViewHolder {
TextView text, address;
}
public interface EnentHandler {
void handle(int i);
}
} | 7,832 | 0.58505 | 0.581363 | 212 | 36.10849 | 27.04229 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.542453 | false | false | 15 |
8e87f584fe9fb6408bb1900cea4abd7a4d47428e | 24,300,924,984,799 | 60bdad5199da93e48155a39c69fb2b5895b35a2a | /src/main/java/es/juanlsanchez/datask/web/mapper/UserDetailsDTOMapper.java | b5065730caeabc622ad2e310b551667fb0e930e7 | []
| no_license | JuanLSanchez/datask | https://github.com/JuanLSanchez/datask | 54ba6309d6610132ef4f7ce586171d4092a6898b | aa40f4b223eb4af487f86ea7098ec3182f874878 | refs/heads/master | 2021-01-22T04:05:09.504000 | 2017-06-15T17:16:44 | 2017-06-15T17:16:44 | 92,428,773 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package es.juanlsanchez.datask.web.mapper;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import es.juanlsanchez.datask.domain.UserData;
import es.juanlsanchez.datask.web.dto.UserDetailsDTO;
@Mapper(componentModel = "spring", uses = AuthorityMapper.class)
public interface UserDetailsDTOMapper {
@Mappings({@Mapping(target = "login", source = "user.login"),
@Mapping(target = "creationMoment", source = "user.creationMoment"),
@Mapping(target = "activated", source = "user.activated"),
@Mapping(target = "authorities", source = "user.authorities"),
@Mapping(target = "companyId", source = "user.company.id")})
public UserDetailsDTO fromUserData(UserData userData);
}
| UTF-8 | Java | 743 | java | UserDetailsDTOMapper.java | Java | []
| null | []
| package es.juanlsanchez.datask.web.mapper;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import es.juanlsanchez.datask.domain.UserData;
import es.juanlsanchez.datask.web.dto.UserDetailsDTO;
@Mapper(componentModel = "spring", uses = AuthorityMapper.class)
public interface UserDetailsDTOMapper {
@Mappings({@Mapping(target = "login", source = "user.login"),
@Mapping(target = "creationMoment", source = "user.creationMoment"),
@Mapping(target = "activated", source = "user.activated"),
@Mapping(target = "authorities", source = "user.authorities"),
@Mapping(target = "companyId", source = "user.company.id")})
public UserDetailsDTO fromUserData(UserData userData);
}
| 743 | 0.738896 | 0.738896 | 20 | 36.150002 | 26.78857 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.85 | false | false | 15 |
cf03eff556b3762559fe66bee07770b2abaeef76 | 7,507,602,890,774 | 830b76d11d16107581f7142c8e99c922aae264ab | /src/test/java/de/galan/commons/io/streams/GzipAwareInputStreamTest.java | 471501e1ca83fa04fd44df8e5ab2ebd9c831be9f | [
"Apache-2.0"
]
| permissive | galan/commons | https://github.com/galan/commons | 3463fb9171bd93fe352f637368da5f85601f5309 | d5ea9c55d9abdc69faa314ff63676feca0acbba3 | refs/heads/master | 2023-07-20T14:06:40.977000 | 2023-07-07T17:09:44 | 2023-07-07T17:09:44 | 15,569,791 | 6 | 3 | Apache-2.0 | false | 2023-03-31T15:20:47 | 2014-01-01T20:39:39 | 2022-01-04T18:35:09 | 2023-03-31T15:20:43 | 476 | 5 | 3 | 1 | Java | false | false | package de.galan.commons.io.streams;
import static org.assertj.core.api.Assertions.*;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.stream.Stream;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
/**
* CUT GzipAwareInputStream
*/
public class GzipAwareInputStreamTest {
public static Stream<TestItem> input() throws IOException {
byte[] helloGz = GzipAwareInputStreamTest.class.getResourceAsStream("hello.gz").readAllBytes();
byte[] hGz = GzipAwareInputStreamTest.class.getResourceAsStream("h.gz").readAllBytes();
byte[] aum = GzipAwareInputStreamTest.class.getResourceAsStream("aum.png").readAllBytes();
return Stream.of(
new TestItem("hello".getBytes(), "hello".getBytes(), false, true),
new TestItem("h".getBytes(), "h".getBytes(), false, true),
new TestItem("".getBytes(), "".getBytes(), false, true),
new TestItem(new byte[0], new byte[0], false, true),
new TestItem(aum, aum, false, true),
new TestItem(helloGz, "hello\n".getBytes(), true, true),
new TestItem(hGz, "h".getBytes(), true, true),
new TestItem(helloGz, helloGz, true, false));
}
@ParameterizedTest
@MethodSource("input")
public void checkCompressed(TestItem item) throws Exception {
GzipAwareInputStream gais = new GzipAwareInputStream(new ByteArrayInputStream(item.input), item.decompress);
assertThat(gais.isCompressed()).isEqualTo(item.compressed);
assertThat(gais.readAllBytes()).isEqualTo(item.expected);
gais.close();
}
}
/** Mock */
class TestItem {
public TestItem(byte[] input, byte[] expected, boolean compressed, boolean decompress) {
this.input = input;
this.expected = expected;
this.compressed = compressed;
this.decompress = decompress;
}
byte[] input;
byte[] expected;
boolean compressed;
boolean decompress;
}
| UTF-8 | Java | 1,865 | java | GzipAwareInputStreamTest.java | Java | []
| null | []
| package de.galan.commons.io.streams;
import static org.assertj.core.api.Assertions.*;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.stream.Stream;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
/**
* CUT GzipAwareInputStream
*/
public class GzipAwareInputStreamTest {
public static Stream<TestItem> input() throws IOException {
byte[] helloGz = GzipAwareInputStreamTest.class.getResourceAsStream("hello.gz").readAllBytes();
byte[] hGz = GzipAwareInputStreamTest.class.getResourceAsStream("h.gz").readAllBytes();
byte[] aum = GzipAwareInputStreamTest.class.getResourceAsStream("aum.png").readAllBytes();
return Stream.of(
new TestItem("hello".getBytes(), "hello".getBytes(), false, true),
new TestItem("h".getBytes(), "h".getBytes(), false, true),
new TestItem("".getBytes(), "".getBytes(), false, true),
new TestItem(new byte[0], new byte[0], false, true),
new TestItem(aum, aum, false, true),
new TestItem(helloGz, "hello\n".getBytes(), true, true),
new TestItem(hGz, "h".getBytes(), true, true),
new TestItem(helloGz, helloGz, true, false));
}
@ParameterizedTest
@MethodSource("input")
public void checkCompressed(TestItem item) throws Exception {
GzipAwareInputStream gais = new GzipAwareInputStream(new ByteArrayInputStream(item.input), item.decompress);
assertThat(gais.isCompressed()).isEqualTo(item.compressed);
assertThat(gais.readAllBytes()).isEqualTo(item.expected);
gais.close();
}
}
/** Mock */
class TestItem {
public TestItem(byte[] input, byte[] expected, boolean compressed, boolean decompress) {
this.input = input;
this.expected = expected;
this.compressed = compressed;
this.decompress = decompress;
}
byte[] input;
byte[] expected;
boolean compressed;
boolean decompress;
}
| 1,865 | 0.737802 | 0.736729 | 61 | 29.573771 | 29.286297 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.934426 | false | false | 15 |
f42bdaa2a921cace811b2e1e27b740d49fcf0834 | 6,794,638,295,736 | 4dc592accc2d5a7578861c18d08ef097bf5a8c27 | /Java_Source/Exam01/src/main/AccountManage.java | 93b5db0ed9dae65dedcd44a244cfb61a7d4f9282 | []
| no_license | wookim789/PlayData | https://github.com/wookim789/PlayData | 008205273811e9aaa69d1f83e709522fbab74e9e | d0fd127e932cd3e029a92fb6c0cdcb3339d9f77f | refs/heads/master | 2021-07-24T18:49:38.058000 | 2018-09-27T04:10:01 | 2018-09-27T04:10:01 | 129,821,279 | 20 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package main;
import java.io.IOException;
import java.util.ArrayList;
import java.util.StringTokenizer;
import data.*;
public class AccountManage {
// 계좌 관리 클래스
private ArrayList<Credit> account;
// 계좌 정보 리스트
private int num;
// 입력 데이터 저장 버퍼
@SuppressWarnings("unchecked")
public AccountManage() {
this.num = 0;
try {
this.account = (ArrayList<Credit>) File_IO.read(Message.file);
// 계좌 리스트를 지정된 파일에서 읽어옴
} catch (ClassNotFoundException | IOException e) {
this.account = new ArrayList<Credit>();
// 파일이 없거나 읽기 실패한 경우 새로운 객체를 생성
}
}
public void deposit() {
// 입금 메서드
Credit credit = this.check();
if (credit != null) {
// 계좌 정보를 성공적으로 받아왔을 경우에만 입금
try {
System.out.print(Message.deposit);
// 입금 금액 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 금액을 대입
credit.setBalance(credit.getBalance() + num);
// 입금 완료 후 잔액을 보여준다.
System.out.println(credit.getName() + Message.complete + credit.getBalance());
// 갱신된 정보를 저장한다.
File_IO.save(Message.file, this.account);
} catch (IOException e) {
// IOException 발생시 에러메세지 출력 후 처음으로 돌아간다.
System.out.println(Message.error);
}
}
}
public void withdraw() {
// 출금 메서드
Credit credit = this.check();
if (credit != null) {
// 계좌 정보를 성공적으로 받아왔을 경우에만 출금
try {
System.out.print(Message.withdraw);
// 출금 금액 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 금액을 대입
if (credit.getBalance() < num) {
// 출금하려는 금액이 계좌의 잔액보다 적을 경우 출금 불가능
System.out.println(Message.balance_fault);
return;
}
credit.setBalance(credit.getBalance() - num);
// 출금 완료 후 잔액을 보여준다.
System.out.println(credit.getName() + Message.complete + credit.getBalance());
// 갱신된 정보를 저장한다.
File_IO.save(Message.file, this.account);
} catch (IOException e) {
// IOException 발생시 에러메세지 출력 후 처음으로 돌아간다.
System.out.println(Message.error);
}
}
}
public void transfer() {
// 이체, 송금 메서드
Credit credit = this.check();
if (credit != null) {
// 계좌 정보를 성공적으로 받아왔을 경우에만 이체
try {
System.out.print(Message.transfer_account);
// 계좌번호 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 계좌번호를 대입
for (Credit destination: this.account) {
// 리스트에서 일치하는 계좌번호를 탐색
if (destination.getAccount() == num) {
// 동일한 계좌번호를 가진 정보가 리스트에 있을 경우
System.out.print(Message.transfer_balance);
// 이체 금액 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 금액을 대입
if (credit.getBalance() < num) {
// 이체하려는 금액이 계좌의 잔액보다 적을 경우 출금 불가능
System.out.println(Message.balance_fault);
return;
}
credit.setBalance(credit.getBalance() - num);
destination.setBalance(destination.getBalance() + num);
// 이체 완료 후 잔액을 보여준다.
System.out.println(credit.getName() + Message.complete + credit.getBalance());
// 갱신된 정보를 저장한다.
File_IO.save(Message.file, this.account);
return;
}
}
// 계좌번호가 없으면 인증 실패 메세지 출력
System.out.println(Message.account_fault);
} catch (IOException e) {
// IOException 발생시 에러메세지 출력 후 처음으로 돌아간다.
System.out.println(Message.error);
}
}
}
public void lookup() {
// 계좌 조회 메서드
Credit credit = this.check();
if (credit != null) {
// 계좌 정보를 성공적으로 받아왔을 경우에만 조회
System.out.println(credit.getName() + Message.complete + credit.getBalance());
}
}
public void insert() {
// 계좌 등록 메서드
Credit credit;
StringTokenizer token;
try {
System.out.println(Message.insert);
// 계좌 등록 메세지 출력
token = new StringTokenizer(File_IO.keyRead());
// StringTokenizer 객체를 이용, 입력받은 문자열을 공백 기준으로 분리
if (token.countTokens() != 3) {
// 입력한 정보가 3개의 문자열로 나눠지지 않는 경우 작업을 취소한다.
System.out.println(Message.error);
return;
}
credit = new Credit(Integer.parseInt(token.nextToken()), Integer.parseInt(token.nextToken()), token.nextToken());
// 계좌 객체 생성
for (Credit compare: this.account) {
// 리스트에서 중복된 계좌번호를 탐색
if (credit.getAccount() == compare.getAccount()) {
// 동일한 계좌번호를 가진 정보가 리스트에 있을 경우
System.out.print(Message.overlap);
// 중복 계좌 존재 메세지 출력 후 종료
return;
}
}
this.account.add(credit);
// 갱신된 정보를 저장한다.
File_IO.save(Message.file, this.account);
} catch (IOException e) {
// IOException 발생시 에러메세지 출력 후 처음으로 돌아간다.
System.out.println(Message.error);
}
}
public void delete() {
// 계좌 삭제 메서드
try {
System.out.print(Message.accountcheck);
// 계좌번호 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 계좌번호를 대입
for (Credit credit: this.account) {
// 리스트에서 일치하는 계좌번호를 탐색
if (credit.getAccount() == num) {
// 동일한 계좌번호를 가진 정보가 리스트에 있을 경우 해당 계좌 삭제
this.account.remove(credit);
// 갱신된 정보를 저장한다.
File_IO.save(Message.file, this.account);
// 반복문의 매개변수로 account를 사용하고 있으므로 값이 변동될 때 반드시 반복문을 빠져나가게 해주어야 한다.
return;
}
}
// 계좌번호가 없을 경우 인증 실패 메세지 출력
System.out.println(Message.account_fault);
} catch (IOException e) {
// IOException 발생시 에러메세지 출력 후 처음으로 돌아간다.
System.out.println(Message.error);
}
}
public void readAll() {
// 전체 계좌 조회 메서드
for (Credit credit: this.account) {
System.out.println(credit.getAccount()
+ " │ " + credit.getPassword()
+ " │ " + credit.getName()
+ " │ " + credit.getBalance());
}
System.out.println();
}
public Credit check() {
// 계좌 인증 메서드
try {
System.out.print(Message.accountcheck);
// 계좌번호 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 계좌번호를 대입
for (Credit credit: this.account) {
// 리스트에서 일치하는 계좌번호를 탐색
if (credit.getAccount() == num) {
// 동일한 계좌번호를 가진 정보가 리스트에 있을 경우
System.out.print(Message.passcheck);
// 비밀번호 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 비밀번호를 대입
if (credit.getPassword() == num) {
// 해당 계좌 정보의 비밀번호 역시 일치할 경우 해당 계좌 정보를 출력
return credit;
}
}
}
// 계좌번호가 없거나 비밀번호를 틀릴 경우 인증 실패 메세지 출력
System.out.println(Message.account_fault);
} catch (IOException e) {
// IOException 발생시 에러메세지 출력 후 처음으로 돌아간다.
System.out.println(Message.error);
}
return null;
}
}
| UHC | Java | 8,368 | java | AccountManage.java | Java | []
| null | []
| package main;
import java.io.IOException;
import java.util.ArrayList;
import java.util.StringTokenizer;
import data.*;
public class AccountManage {
// 계좌 관리 클래스
private ArrayList<Credit> account;
// 계좌 정보 리스트
private int num;
// 입력 데이터 저장 버퍼
@SuppressWarnings("unchecked")
public AccountManage() {
this.num = 0;
try {
this.account = (ArrayList<Credit>) File_IO.read(Message.file);
// 계좌 리스트를 지정된 파일에서 읽어옴
} catch (ClassNotFoundException | IOException e) {
this.account = new ArrayList<Credit>();
// 파일이 없거나 읽기 실패한 경우 새로운 객체를 생성
}
}
public void deposit() {
// 입금 메서드
Credit credit = this.check();
if (credit != null) {
// 계좌 정보를 성공적으로 받아왔을 경우에만 입금
try {
System.out.print(Message.deposit);
// 입금 금액 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 금액을 대입
credit.setBalance(credit.getBalance() + num);
// 입금 완료 후 잔액을 보여준다.
System.out.println(credit.getName() + Message.complete + credit.getBalance());
// 갱신된 정보를 저장한다.
File_IO.save(Message.file, this.account);
} catch (IOException e) {
// IOException 발생시 에러메세지 출력 후 처음으로 돌아간다.
System.out.println(Message.error);
}
}
}
public void withdraw() {
// 출금 메서드
Credit credit = this.check();
if (credit != null) {
// 계좌 정보를 성공적으로 받아왔을 경우에만 출금
try {
System.out.print(Message.withdraw);
// 출금 금액 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 금액을 대입
if (credit.getBalance() < num) {
// 출금하려는 금액이 계좌의 잔액보다 적을 경우 출금 불가능
System.out.println(Message.balance_fault);
return;
}
credit.setBalance(credit.getBalance() - num);
// 출금 완료 후 잔액을 보여준다.
System.out.println(credit.getName() + Message.complete + credit.getBalance());
// 갱신된 정보를 저장한다.
File_IO.save(Message.file, this.account);
} catch (IOException e) {
// IOException 발생시 에러메세지 출력 후 처음으로 돌아간다.
System.out.println(Message.error);
}
}
}
public void transfer() {
// 이체, 송금 메서드
Credit credit = this.check();
if (credit != null) {
// 계좌 정보를 성공적으로 받아왔을 경우에만 이체
try {
System.out.print(Message.transfer_account);
// 계좌번호 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 계좌번호를 대입
for (Credit destination: this.account) {
// 리스트에서 일치하는 계좌번호를 탐색
if (destination.getAccount() == num) {
// 동일한 계좌번호를 가진 정보가 리스트에 있을 경우
System.out.print(Message.transfer_balance);
// 이체 금액 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 금액을 대입
if (credit.getBalance() < num) {
// 이체하려는 금액이 계좌의 잔액보다 적을 경우 출금 불가능
System.out.println(Message.balance_fault);
return;
}
credit.setBalance(credit.getBalance() - num);
destination.setBalance(destination.getBalance() + num);
// 이체 완료 후 잔액을 보여준다.
System.out.println(credit.getName() + Message.complete + credit.getBalance());
// 갱신된 정보를 저장한다.
File_IO.save(Message.file, this.account);
return;
}
}
// 계좌번호가 없으면 인증 실패 메세지 출력
System.out.println(Message.account_fault);
} catch (IOException e) {
// IOException 발생시 에러메세지 출력 후 처음으로 돌아간다.
System.out.println(Message.error);
}
}
}
public void lookup() {
// 계좌 조회 메서드
Credit credit = this.check();
if (credit != null) {
// 계좌 정보를 성공적으로 받아왔을 경우에만 조회
System.out.println(credit.getName() + Message.complete + credit.getBalance());
}
}
public void insert() {
// 계좌 등록 메서드
Credit credit;
StringTokenizer token;
try {
System.out.println(Message.insert);
// 계좌 등록 메세지 출력
token = new StringTokenizer(File_IO.keyRead());
// StringTokenizer 객체를 이용, 입력받은 문자열을 공백 기준으로 분리
if (token.countTokens() != 3) {
// 입력한 정보가 3개의 문자열로 나눠지지 않는 경우 작업을 취소한다.
System.out.println(Message.error);
return;
}
credit = new Credit(Integer.parseInt(token.nextToken()), Integer.parseInt(token.nextToken()), token.nextToken());
// 계좌 객체 생성
for (Credit compare: this.account) {
// 리스트에서 중복된 계좌번호를 탐색
if (credit.getAccount() == compare.getAccount()) {
// 동일한 계좌번호를 가진 정보가 리스트에 있을 경우
System.out.print(Message.overlap);
// 중복 계좌 존재 메세지 출력 후 종료
return;
}
}
this.account.add(credit);
// 갱신된 정보를 저장한다.
File_IO.save(Message.file, this.account);
} catch (IOException e) {
// IOException 발생시 에러메세지 출력 후 처음으로 돌아간다.
System.out.println(Message.error);
}
}
public void delete() {
// 계좌 삭제 메서드
try {
System.out.print(Message.accountcheck);
// 계좌번호 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 계좌번호를 대입
for (Credit credit: this.account) {
// 리스트에서 일치하는 계좌번호를 탐색
if (credit.getAccount() == num) {
// 동일한 계좌번호를 가진 정보가 리스트에 있을 경우 해당 계좌 삭제
this.account.remove(credit);
// 갱신된 정보를 저장한다.
File_IO.save(Message.file, this.account);
// 반복문의 매개변수로 account를 사용하고 있으므로 값이 변동될 때 반드시 반복문을 빠져나가게 해주어야 한다.
return;
}
}
// 계좌번호가 없을 경우 인증 실패 메세지 출력
System.out.println(Message.account_fault);
} catch (IOException e) {
// IOException 발생시 에러메세지 출력 후 처음으로 돌아간다.
System.out.println(Message.error);
}
}
public void readAll() {
// 전체 계좌 조회 메서드
for (Credit credit: this.account) {
System.out.println(credit.getAccount()
+ " │ " + credit.getPassword()
+ " │ " + credit.getName()
+ " │ " + credit.getBalance());
}
System.out.println();
}
public Credit check() {
// 계좌 인증 메서드
try {
System.out.print(Message.accountcheck);
// 계좌번호 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 계좌번호를 대입
for (Credit credit: this.account) {
// 리스트에서 일치하는 계좌번호를 탐색
if (credit.getAccount() == num) {
// 동일한 계좌번호를 가진 정보가 리스트에 있을 경우
System.out.print(Message.passcheck);
// 비밀번호 입력 메세지 출력
num = Integer.parseInt(File_IO.keyRead());
// 키보드 입력 함수를 사용하여 num에 비밀번호를 대입
if (credit.getPassword() == num) {
// 해당 계좌 정보의 비밀번호 역시 일치할 경우 해당 계좌 정보를 출력
return credit;
}
}
}
// 계좌번호가 없거나 비밀번호를 틀릴 경우 인증 실패 메세지 출력
System.out.println(Message.account_fault);
} catch (IOException e) {
// IOException 발생시 에러메세지 출력 후 처음으로 돌아간다.
System.out.println(Message.error);
}
return null;
}
}
| 8,368 | 0.620896 | 0.620423 | 250 | 24.344 | 19.251432 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.232 | false | false | 15 |
981769e164e4d4b3c16005abcce0689b18bd1834 | 27,857,157,936,504 | f27fd6dc2b24f2a0fbc3f5681696f41a07098a28 | /unif-common/common-util/src/main/java/com/myfutech/common/util/date/DateUtils.java | 7f1e4b005404d561abde7d5385c3fd440f4018b7 | []
| no_license | hanlin16/springbootcloud | https://github.com/hanlin16/springbootcloud | e0580c85fee90b340573561c42da8f03f94f6790 | 52bccc570639ef759825dd3e2112a1647a159f09 | refs/heads/master | 2022-12-17T05:29:20.978000 | 2019-07-04T01:25:20 | 2019-07-04T01:25:20 | 195,033,002 | 0 | 0 | null | false | 2022-12-16T00:47:28 | 2019-07-03T10:34:58 | 2019-07-04T01:26:00 | 2022-12-16T00:47:25 | 170 | 0 | 0 | 13 | Java | false | false | package com.myfutech.common.util.date;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateUtils {
public static final String DATETYPE1="yyyy-MM-dd";
public static final String DATETYPE2="yyyy-MM-dd HH:mm:ss";
public static final String DATETYPE3="yyyy-MM-dd HH:mm";
public static final String DATETYPE4="yyyy-MM-dd";
public static final String DATETYPE5="yyyy年MM月dd日";
public static final String DATETYPE6="yyyyMMdd";
/**
* 根据格式将Data转为String
* @param date
* @return
*/
public static String stringToData(Date date,String dataType){
SimpleDateFormat format = new SimpleDateFormat(dataType);
return format.format(date);
}
/**
* 截取字符串日期格式的年月日并返回
* @Description: TODO
* @param @param date
* @param @return
* @return String
* @author gzy
* @date 2018年2月1日
*/
public static String splitDate(String date){
String[] split = date.split(" ");
return split[0];
}
/**
* 获取当前系统时间
* <p>Title: currentDate</p>
* <p>Description: </p>
* @return
*/
public static String currentDate(){
Date date = new Date();
return stringToData(date,DATETYPE2);
}
/**
* 获取当前系统时间 X年X月X日;
* <p>Title: currentDate</p>
* <p>Description: </p>
* @return
*/
public static String currentDateYMD(){
Date date = new Date();
SimpleDateFormat simdf = new SimpleDateFormat(DATETYPE5);
return simdf.format(date);
}
/**
* 格式化时间年月日汉字
* <p>Title: currentDate</p>
* <p>Description: </p>
* @return
*/
public static String dateFormatCNYMD(String date){
SimpleDateFormat simdf = new SimpleDateFormat(DATETYPE5);
return (simdf.format(java.sql.Date.valueOf(date)));
}
}
| UTF-8 | Java | 1,798 | java | DateUtils.java | Java | [
{
"context": "@param @return \n\t * @return String \n\t * @author gzy\n\t * @date 2018年2月1日\n\t */\n\tpublic static String sp",
"end": 805,
"score": 0.9992600679397583,
"start": 802,
"tag": "USERNAME",
"value": "gzy"
}
]
| null | []
| package com.myfutech.common.util.date;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateUtils {
public static final String DATETYPE1="yyyy-MM-dd";
public static final String DATETYPE2="yyyy-MM-dd HH:mm:ss";
public static final String DATETYPE3="yyyy-MM-dd HH:mm";
public static final String DATETYPE4="yyyy-MM-dd";
public static final String DATETYPE5="yyyy年MM月dd日";
public static final String DATETYPE6="yyyyMMdd";
/**
* 根据格式将Data转为String
* @param date
* @return
*/
public static String stringToData(Date date,String dataType){
SimpleDateFormat format = new SimpleDateFormat(dataType);
return format.format(date);
}
/**
* 截取字符串日期格式的年月日并返回
* @Description: TODO
* @param @param date
* @param @return
* @return String
* @author gzy
* @date 2018年2月1日
*/
public static String splitDate(String date){
String[] split = date.split(" ");
return split[0];
}
/**
* 获取当前系统时间
* <p>Title: currentDate</p>
* <p>Description: </p>
* @return
*/
public static String currentDate(){
Date date = new Date();
return stringToData(date,DATETYPE2);
}
/**
* 获取当前系统时间 X年X月X日;
* <p>Title: currentDate</p>
* <p>Description: </p>
* @return
*/
public static String currentDateYMD(){
Date date = new Date();
SimpleDateFormat simdf = new SimpleDateFormat(DATETYPE5);
return simdf.format(date);
}
/**
* 格式化时间年月日汉字
* <p>Title: currentDate</p>
* <p>Description: </p>
* @return
*/
public static String dateFormatCNYMD(String date){
SimpleDateFormat simdf = new SimpleDateFormat(DATETYPE5);
return (simdf.format(java.sql.Date.valueOf(date)));
}
}
| 1,798 | 0.673603 | 0.66409 | 78 | 20.564102 | 19.003098 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.410256 | false | false | 15 |
7cb441d2a6b96cb7d68e98f5112daaca93826f54 | 26,645,977,118,151 | e036528266de86ff14e58110cb938b33ee6ac003 | /src/main/java/com/store/groceries/customer/entities/Transaction.java | 2a85dd535e7b9e3fe4b45073d12c983a482880b4 | []
| no_license | adumanasa/Customer-Reward-Calculator | https://github.com/adumanasa/Customer-Reward-Calculator | bcef8ef3cd9cc33ca2940d9c375d85b3ba71b9c0 | 72c5cb64583180af8f30240e5212dddfc519c31e | refs/heads/master | 2022-04-17T14:06:31.710000 | 2020-04-13T23:44:21 | 2020-04-13T23:44:21 | 255,455,044 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.store.groceries.customer.entities;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDate;
public class Transaction {
@JsonFormat(pattern = "MM/dd/yyyy")
private LocalDate date;
private int amount;
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
}
| UTF-8 | Java | 485 | java | Transaction.java | Java | []
| null | []
| package com.store.groceries.customer.entities;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDate;
public class Transaction {
@JsonFormat(pattern = "MM/dd/yyyy")
private LocalDate date;
private int amount;
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
}
| 485 | 0.698969 | 0.698969 | 27 | 16.962963 | 16.028866 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 15 |
2f70ddfc4702f88f6e1464a3eb667ac1147d0415 | 24,567,212,999,544 | 15cfde13e22b401555de3045818f79e0c53de3b7 | /Perimeter and area of a rectangle/Main.java | 9490ccacc10d0392e337aa53148a0fc5c38face0 | []
| no_license | bhuvaneswari14/Playground | https://github.com/bhuvaneswari14/Playground | 5a26fdfe040a794ec2220c22f9b2f95e16461d80 | 76b2809dbf3837646520ae3a2ed692bf42b39f79 | refs/heads/master | 2020-06-09T15:22:59.701000 | 2019-07-21T16:48:35 | 2019-07-21T16:48:35 | 193,459,166 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | #include<stdio.h>
int main()
{
int l=6,b=9,n,m;
n=6*5;
m=l*b;
printf("The perimeter of the rectangle is: %d cm\n",n);
printf("The area of the rectangle is: %d sq cm",m);
return 0;
} | UTF-8 | Java | 193 | java | Main.java | Java | []
| null | []
| #include<stdio.h>
int main()
{
int l=6,b=9,n,m;
n=6*5;
m=l*b;
printf("The perimeter of the rectangle is: %d cm\n",n);
printf("The area of the rectangle is: %d sq cm",m);
return 0;
} | 193 | 0.601036 | 0.57513 | 10 | 18.4 | 19.069347 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.1 | false | false | 15 |
156d4713328a5f8c38b6c9234e401c4550f4c6e3 | 1,340,029,830,051 | b3418633bf03a546a5254ea422e40de17489980c | /src/main/java/com/fhd/icm/web/controller/assess/AssessGuidelinesControl.java | fe7ee110a2db0f4e1c6e3a0e0e611b349a92ae0c | []
| no_license | vincent-dixin/Financial-Street-ERMIS | https://github.com/vincent-dixin/Financial-Street-ERMIS | d819fd319293e55578e3067c9a5de0cd33c56a93 | 87d6bc6a4ddc52abca2c341eb476c1ea283d70e7 | refs/heads/master | 2016-09-06T13:56:46.197000 | 2015-03-30T02:47:46 | 2015-03-30T02:47:46 | 33,099,786 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fhd.icm.web.controller.assess;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.fhd.icm.business.assess.AssessGuidelinesBO;
import com.fhd.icm.entity.assess.AssessGuidelines;
import com.fhd.icm.entity.assess.AssessGuidelinesProperty;
/**
* 评价标准模板control
* @author 邓广义
*
*/
@Controller
public class AssessGuidelinesControl {
@Autowired
private AssessGuidelinesBO assessGuidelinesBO;
/**
* 通过ID查询实体
* @param id
* @return
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/findAssessGuidelinesById.f")
public Map<String,Object> findAssessGuidelinesById(String id){
this.assessGuidelinesBO.findAssessGuidelinesById(id);
return null;
}
/**
* 获得评价标准模板列表
* @return
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/findAssessGuidelinesBySome.f")
public List<Map<String,Object>> findAssessGuidelinesBySome(){
List<AssessGuidelines> list = this.assessGuidelinesBO.findAssessGuidelinesBySome();
List<Map<String,Object>> listmap = new ArrayList<Map<String,Object>>();
for(AssessGuidelines ag : list){
Map<String,Object> map = new HashMap<String,Object>();
map.put("name", ag.getName());
map.put("comment", ag.getComment());
map.put("sort", ag.getSort());
map.put("dictype", ag.getType().getId());
map.put("id", ag.getId());
listmap.add(map);
}
return listmap;
}
/**
* 根据ID删除实体
* *逻辑删除*
* @param id
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/delAssessGuidelinesById.f")
public Map<String,Object> delAssessGuidelinesById(String id){
boolean b = this.assessGuidelinesBO.delAssessGuidelinesById(id);
Map<String,Object> map = new HashMap<String,Object>(0);
map.put("success", b);
return map;
}
/**
* 保存实体的方法
* @param modifyRecords
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/saveAssessGuidelines.f")
public Map<String,Object> saveAssessGuidelines(String modifyRecords){
boolean b = this.assessGuidelinesBO.saveAssessGuidelines(modifyRecords);
Map<String,Object> map = new HashMap<String,Object>(0);
map.put("success", b);
return map;
}
/**
* 通过评价标准模板ID查询该模板对应的评价标准项
* @param AssessGuidelinesId
* @return List<AssessGuidelinesProperty>
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/findAssessGuidelinesPropertiesByAGId.f")
public List<Map<String,Object>> findAssessGuidelinesPropertiesByAGId(String assessGuidelinesId){
List<AssessGuidelinesProperty> list = this.assessGuidelinesBO.findAssessGuidelinesPropertiesByAGId(assessGuidelinesId);
List<Map<String,Object>> listmap = new ArrayList<Map<String,Object>>();
for(AssessGuidelinesProperty agp : list){
Map<String,Object> map = new HashMap<String,Object>();
map.put("minValue", agp.getMinValue());
map.put("maxValue", agp.getMaxValue());
map.put("judgeValue", agp.getJudgeValue());
map.put("sort", agp.getSort());
map.put("content", agp.getContent());
map.put("dictype", agp.getDefectLevel().getId());
map.put("parentName", agp.getAssessGuidelines().getName());
map.put("parentId", agp.getAssessGuidelines().getId());
map.put("id", agp.getId());
listmap.add(map);
}
return listmap;
}
/**
* 评价标准项保存实体的方法
* @param modifyRecords
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/saveAssessGuidelinesProperty.f")
public Map<String,Object> saveAssessGuidelinesProperty(String modifyRecords){
boolean b = this.assessGuidelinesBO.saveAssessGuidelinesProperty(modifyRecords);
Map<String,Object> map = new HashMap<String,Object>(0);
map.put("success", b);
return map;
}
/**
* 根据ID删除实体(评价标准项删除)
* @return
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/delAssessGuidelinesPropertyById.f")
public Map<String,Object> delAssessGuidelinesPropertyById(String ids){
boolean b = this.assessGuidelinesBO.delAssessGuidelinesPropertyById(ids);
Map<String,Object> map = new HashMap<String,Object>(0);
map.put("success", b);
return map;
}
}
| UTF-8 | Java | 4,409 | java | AssessGuidelinesControl.java | Java | [
{
"context": "idelinesProperty;\n/**\n * 评价标准模板control\n * @author 邓广义\n *\n */\n@Controller\npublic class AssessGuidelinesC",
"end": 582,
"score": 0.9997202754020691,
"start": 579,
"tag": "NAME",
"value": "邓广义"
}
]
| null | []
| package com.fhd.icm.web.controller.assess;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.fhd.icm.business.assess.AssessGuidelinesBO;
import com.fhd.icm.entity.assess.AssessGuidelines;
import com.fhd.icm.entity.assess.AssessGuidelinesProperty;
/**
* 评价标准模板control
* @author 邓广义
*
*/
@Controller
public class AssessGuidelinesControl {
@Autowired
private AssessGuidelinesBO assessGuidelinesBO;
/**
* 通过ID查询实体
* @param id
* @return
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/findAssessGuidelinesById.f")
public Map<String,Object> findAssessGuidelinesById(String id){
this.assessGuidelinesBO.findAssessGuidelinesById(id);
return null;
}
/**
* 获得评价标准模板列表
* @return
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/findAssessGuidelinesBySome.f")
public List<Map<String,Object>> findAssessGuidelinesBySome(){
List<AssessGuidelines> list = this.assessGuidelinesBO.findAssessGuidelinesBySome();
List<Map<String,Object>> listmap = new ArrayList<Map<String,Object>>();
for(AssessGuidelines ag : list){
Map<String,Object> map = new HashMap<String,Object>();
map.put("name", ag.getName());
map.put("comment", ag.getComment());
map.put("sort", ag.getSort());
map.put("dictype", ag.getType().getId());
map.put("id", ag.getId());
listmap.add(map);
}
return listmap;
}
/**
* 根据ID删除实体
* *逻辑删除*
* @param id
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/delAssessGuidelinesById.f")
public Map<String,Object> delAssessGuidelinesById(String id){
boolean b = this.assessGuidelinesBO.delAssessGuidelinesById(id);
Map<String,Object> map = new HashMap<String,Object>(0);
map.put("success", b);
return map;
}
/**
* 保存实体的方法
* @param modifyRecords
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/saveAssessGuidelines.f")
public Map<String,Object> saveAssessGuidelines(String modifyRecords){
boolean b = this.assessGuidelinesBO.saveAssessGuidelines(modifyRecords);
Map<String,Object> map = new HashMap<String,Object>(0);
map.put("success", b);
return map;
}
/**
* 通过评价标准模板ID查询该模板对应的评价标准项
* @param AssessGuidelinesId
* @return List<AssessGuidelinesProperty>
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/findAssessGuidelinesPropertiesByAGId.f")
public List<Map<String,Object>> findAssessGuidelinesPropertiesByAGId(String assessGuidelinesId){
List<AssessGuidelinesProperty> list = this.assessGuidelinesBO.findAssessGuidelinesPropertiesByAGId(assessGuidelinesId);
List<Map<String,Object>> listmap = new ArrayList<Map<String,Object>>();
for(AssessGuidelinesProperty agp : list){
Map<String,Object> map = new HashMap<String,Object>();
map.put("minValue", agp.getMinValue());
map.put("maxValue", agp.getMaxValue());
map.put("judgeValue", agp.getJudgeValue());
map.put("sort", agp.getSort());
map.put("content", agp.getContent());
map.put("dictype", agp.getDefectLevel().getId());
map.put("parentName", agp.getAssessGuidelines().getName());
map.put("parentId", agp.getAssessGuidelines().getId());
map.put("id", agp.getId());
listmap.add(map);
}
return listmap;
}
/**
* 评价标准项保存实体的方法
* @param modifyRecords
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/saveAssessGuidelinesProperty.f")
public Map<String,Object> saveAssessGuidelinesProperty(String modifyRecords){
boolean b = this.assessGuidelinesBO.saveAssessGuidelinesProperty(modifyRecords);
Map<String,Object> map = new HashMap<String,Object>(0);
map.put("success", b);
return map;
}
/**
* 根据ID删除实体(评价标准项删除)
* @return
*/
@ResponseBody
@RequestMapping("/icm/assess/baseset/delAssessGuidelinesPropertyById.f")
public Map<String,Object> delAssessGuidelinesPropertyById(String ids){
boolean b = this.assessGuidelinesBO.delAssessGuidelinesPropertyById(ids);
Map<String,Object> map = new HashMap<String,Object>(0);
map.put("success", b);
return map;
}
}
| 4,409 | 0.739665 | 0.73872 | 131 | 31.312977 | 26.677343 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.152672 | false | false | 15 |
033693ac2128ad1b70e5c485e843f088a27e6204 | 33,243,046,875,157 | 0698a9d93a040201e1905ed26d073227cd8c3a47 | /src/main/java/com/safelogic/autodex/web/model/UserNotification.java | 82d01ba3ab4ab961aafcae38e3687bafe1076644 | []
| no_license | muggsieXIV/humble-AutoDEX-webapp | https://github.com/muggsieXIV/humble-AutoDEX-webapp | abd0e7b82340a01d89637ba3b8abd8729009cdf2 | 23cba5e631605bf309b94f7323110c90645211b3 | refs/heads/main | 2023-04-16T07:37:00.652000 | 2021-04-30T22:31:26 | 2021-04-30T22:31:26 | 363,273,679 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.safelogic.autodex.web.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@Entity
@Table(name = "UserNotifications")
@NamedQuery(name = "UserNotification.findAll", query = "SELECT u FROM UserNotification u")
public class UserNotification extends NaasEntity {
/**
*
*/
private static final long serialVersionUID = -3308229704143296433L;
@JoinColumn(name = "userId")
private Long userId;
@Column(name = "contactId")
private long contactId;
@Column(name = "type")
private String type;
@Column(name = "message")
private String message;
@Column(name = "readFlag")
private boolean read;
public long getContactId() {
return contactId;
}
public void setContactId(long contactId) {
this.contactId = contactId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public boolean isRead() {
return read;
}
public void setRead(boolean read) {
this.read = read;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
}
| UTF-8 | Java | 1,443 | java | UserNotification.java | Java | []
| null | []
| package com.safelogic.autodex.web.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@Entity
@Table(name = "UserNotifications")
@NamedQuery(name = "UserNotification.findAll", query = "SELECT u FROM UserNotification u")
public class UserNotification extends NaasEntity {
/**
*
*/
private static final long serialVersionUID = -3308229704143296433L;
@JoinColumn(name = "userId")
private Long userId;
@Column(name = "contactId")
private long contactId;
@Column(name = "type")
private String type;
@Column(name = "message")
private String message;
@Column(name = "readFlag")
private boolean read;
public long getContactId() {
return contactId;
}
public void setContactId(long contactId) {
this.contactId = contactId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public boolean isRead() {
return read;
}
public void setRead(boolean read) {
this.read = read;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
}
| 1,443 | 0.685378 | 0.672211 | 75 | 17.24 | 17.842152 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.053333 | false | false | 15 |
479e0dd714cf2473354e2659d183222650e998d1 | 31,825,707,712,524 | f46041747a60e41a695f2e1a5939806235be4885 | /src/ctascontablesypolizas/GUIPrincipal.java | e9173491dc2987ea971c6086c07b94307cd1c56b | []
| no_license | avargaz/AS-MigraContaqCoi | https://github.com/avargaz/AS-MigraContaqCoi | 880d3c49b25a19c50d166706e348204286ffcdb8 | 3b884a9244401a13eb312b7b0fdeafcf79085b84 | refs/heads/master | 2020-03-04T16:11:20.714000 | 2016-09-15T22:24:16 | 2016-09-15T22:24:16 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ctascontablesypolizas;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import ctascontablesypolizas.clases.CrearConexionFBoSQL;
import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.FileNotFoundException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import static javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
*
* @author Gabriel-Diaz
*/
public class GUIPrincipal extends javax.swing.JFrame {
public boolean banderaReportes = false;
private Connection conexionContpaqi;
private CrearConexionFBoSQL objConexion;
private String controladorCont;
private String RutaonombreBDCont;
private String servidorCont;
private String usuarioCont;
private String contraseniaCont;
private int puertoCont;
private String tipoCCont;
private String puertoCOI;
private String contraseniaCOI;
private String usuarioCOI;
private String tipoCCOI;
private String servidorCOI;
private String RutaonombreBDCOI;
private String controladorCOI;
private String noEmp;
private Connection conexionCOI;
private int opc1;
private int opc2;
private boolean banderaCOI;
private boolean banderaCont;
private int[] dxNiveles;
private boolean seguridadIntegrada;
/**
* Creates new form GUIPrincipal
*/
public GUIPrincipal() {
initComponents();
AsignarIconos();
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() {
@Override
public boolean dispatchKeyEvent(KeyEvent ke) {
if (ke.getID() == java.awt.event.KeyEvent.KEY_TYPED && ke.getKeyCode() == java.awt.event.KeyEvent.VK_F1) {
abrirAyuda();
}
return false;
}
});
jLabel1.setVisible(false);
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jToolBar1 = new javax.swing.JToolBar();
jbtnImportarCtaCuentas = new javax.swing.JButton();
jbtnImportarPoliza = new javax.swing.JButton();
jSeparator1 = new javax.swing.JToolBar.Separator();
jBtnSalir = new javax.swing.JButton();
jDPPrincipal1 = new javax.swing.JDesktopPane();
jLblLogo = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMIConfParams = new javax.swing.JMenuItem();
jMISalir = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
jMIReporte = new javax.swing.JMenuItem();
jMIPolizas = new javax.swing.JMenuItem();
jMIImportarSaldos = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("****ASCIENDE COMPUTACIÓN, S.A. DE C.V. *** Migrar catalogo de cuentas y pólizas de CONTPAQ i® a ASPEL® COI 6.0");
setMinimumSize(new java.awt.Dimension(744, 550));
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
formComponentResized(evt);
}
});
addHierarchyBoundsListener(new java.awt.event.HierarchyBoundsListener() {
public void ancestorMoved(java.awt.event.HierarchyEvent evt) {
}
public void ancestorResized(java.awt.event.HierarchyEvent evt) {
formAncestorResized(evt);
}
});
jToolBar1.setBackground(new java.awt.Color(178, 233, 187));
jToolBar1.setFloatable(false);
jToolBar1.setRollover(true);
jbtnImportarCtaCuentas.setBackground(new java.awt.Color(178, 233, 187));
jbtnImportarCtaCuentas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/ctascontcoi.png"))); // NOI18N
jbtnImportarCtaCuentas.setToolTipText("Exportar catalogo de ctas.");
jbtnImportarCtaCuentas.setFocusable(false);
jbtnImportarCtaCuentas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jbtnImportarCtaCuentas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jbtnImportarCtaCuentas.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnImportarCtaCuentasActionPerformed(evt);
}
});
jToolBar1.add(jbtnImportarCtaCuentas);
jbtnImportarPoliza.setBackground(new java.awt.Color(178, 233, 187));
jbtnImportarPoliza.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/polcontcoi.png"))); // NOI18N
jbtnImportarPoliza.setToolTipText("Exportar Pólizas");
jbtnImportarPoliza.setFocusable(false);
jbtnImportarPoliza.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jbtnImportarPoliza.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jbtnImportarPoliza.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnImportarPolizaActionPerformed(evt);
}
});
jToolBar1.add(jbtnImportarPoliza);
jToolBar1.add(jSeparator1);
jBtnSalir.setBackground(new java.awt.Color(178, 233, 187));
jBtnSalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/salir.png"))); // NOI18N
jBtnSalir.setToolTipText("Salir de la aplicación");
jBtnSalir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnSalirActionPerformed(evt);
}
});
jToolBar1.add(jBtnSalir);
jDPPrincipal1.setBackground(new java.awt.Color(205, 241, 236));
jDPPrincipal1.setDragMode(javax.swing.JDesktopPane.OUTLINE_DRAG_MODE);
jDPPrincipal1.addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
jDPPrincipal1ComponentResized(evt);
}
});
jLblLogo.setBackground(new java.awt.Color(77, 255, 209));
jLblLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/fondo.png"))); // NOI18N
jDPPrincipal1.add(jLblLogo);
jLblLogo.setBounds(100, 0, 550, 400);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/logodesk.png"))); // NOI18N
jLabel1.setText("j");
jDPPrincipal1.add(jLabel1);
jLabel1.setBounds(440, 270, 20, 20);
jMenu1.setText("Archivo");
jMIConfParams.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
jMIConfParams.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/miniconf.png"))); // NOI18N
jMIConfParams.setText("Configuracion de parametros");
jMIConfParams.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMIConfParamsActionPerformed(evt);
}
});
jMenu1.add(jMIConfParams);
jMISalir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.CTRL_MASK));
jMISalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/minisalir.png"))); // NOI18N
jMISalir.setText("Salir");
jMenu1.add(jMISalir);
jMenuBar1.add(jMenu1);
jMenu3.setText("Procesos");
jMenu3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu3ActionPerformed(evt);
}
});
jMIReporte.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK));
jMIReporte.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/minictascontcoi.png"))); // NOI18N
jMIReporte.setText("Exportar Cat. de Cuentas");
jMIReporte.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMIReporteActionPerformed(evt);
}
});
jMenu3.add(jMIReporte);
jMIPolizas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK));
jMIPolizas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/minipolcontcoi.png"))); // NOI18N
jMIPolizas.setText("Exportar Pólizas");
jMIPolizas.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMIPolizasActionPerformed(evt);
}
});
jMenu3.add(jMIPolizas);
jMIImportarSaldos.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.ALT_MASK));
jMIImportarSaldos.setText("Importar saldos iniciales");
jMIImportarSaldos.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMIImportarSaldosActionPerformed(evt);
}
});
jMenu3.add(jMIImportarSaldos);
jMenuBar1.add(jMenu3);
jMenu2.setText("Ayuda");
jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/buscar.png"))); // NOI18N
jMenuItem1.setText("Ayuda");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem1);
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jDPPrincipal1, javax.swing.GroupLayout.DEFAULT_SIZE, 724, Short.MAX_VALUE)
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jDPPrincipal1, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE))
);
jDPPrincipal1.getAccessibleContext().setAccessibleParent(jDPPrincipal1);
pack();
}// </editor-fold>//GEN-END:initComponents
private void AsignarIconos() {
ImageIcon icono2 = (ImageIcon) jLabel1.getIcon();
ImageIcon iconoFrame = new ImageIcon(icono2.getImage().getScaledInstance(45, 45, 20));
this.setIconImage(iconoFrame.getImage());
}
private void impcatctas() {
try {
jMIConfParams.setEnabled(false);
jMIReporte.setEnabled(false);
jbtnImportarCtaCuentas.setEnabled(false);
CatCtas ventana = new CatCtas();
jDPPrincipal1.add(ventana);
ventana.controlador = this.controladorCont;
ventana.servidor = this.servidorCont;
ventana.puerto = this.puertoCont;
ventana.seguridadIntegrada = this.seguridadIntegrada;
ventana.RutaonombreBDCont = this.RutaonombreBDCont;
ventana.usuario = this.usuarioCont;
ventana.contrasenia = this.contraseniaCont;
ventana.controladorCOI = this.controladorCOI;
ventana.servidorCOI = this.servidorCOI;
ventana.puertoCOI = this.puertoCOI;
ventana.RutaonombreBDCOI = this.RutaonombreBDCOI;
ventana.usuarioCOI = this.usuarioCOI;
ventana.contraseniaCOI = this.contraseniaCOI;
ventana.padre = this;
ventana.dxNiveles = dxNiveles;
ventana.nomEmpre = this.noEmp;
ventana.setVisible(true);
ventana.setSelected(true);
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void impPolizas() {
try {
jMIConfParams.setEnabled(false);
jMIPolizas.setEnabled(false);
jbtnImportarPoliza.setEnabled(false);
ListadoPolizas ventana = new ListadoPolizas();
ventana.padre = this;
ventana.noEmpre = noEmp;
ventana.dxNiveles = dxNiveles;
jDPPrincipal1.add(ventana);
ventana.setVisible(true);
ventana.setSelected(true);
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void jBtnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnSalirActionPerformed
// TODO add your handling code here:
cerrarSesion();
}//GEN-LAST:event_jBtnSalirActionPerformed
private void jbtnImportarCtaCuentasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnImportarCtaCuentasActionPerformed
// TODO add your handling code here:
if (banderaReportes == false) {
impcatctas();
banderaReportes = true;
}
}//GEN-LAST:event_jbtnImportarCtaCuentasActionPerformed
private void jMIReporteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIReporteActionPerformed
// TODO add your handling code here:
impcatctas();
}//GEN-LAST:event_jMIReporteActionPerformed
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
// TODO add your handling code here:
jLblLogo.setLocation(this.getWidth() / 2 - this.jLblLogo.getWidth() / 2, this.getHeight() / 2 - this.jLblLogo.getHeight() / 2 - 20);
leerConfiguracion();
}//GEN-LAST:event_formWindowOpened
public String getTagValue(String tag, Element elemento) {
NodeList lista = elemento.getElementsByTagName(tag).item(0).getChildNodes();
Node valor = (Node) lista.item(0);
return valor.getNodeValue();
}
public void leerConfiguracion() {
try {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = null;
try {
doc = dBuilder.parse(new File("ConfSistema.xml"));
doc.getDocumentElement().normalize();
} catch (FileNotFoundException e) {
JOptionPane.showMessageDialog(this, "No se pudo encontrar un archivo de configuración"
+ "\n " + e, "Error", JOptionPane.ERROR_MESSAGE);
jMIConfParams.setEnabled(false);
System.exit(0);
}
/*
* obtener el numero de la empresa
*/
NodeList NLEmpresa = doc.getElementsByTagName("Empresa");
Node NodeNLEmpresa = NLEmpresa.item(0);
Element elementoNodeNLEmpresa = (Element) NodeNLEmpresa;
// noEmp = getTagValue("NoEmp", elementoNodeNLEmpresa);
//obtener configuracion de conexion a COntpaq
NodeList NLRutaonombreBDCont = doc.getElementsByTagName("ConexionCONT");
Node NodeNLRutaonombreBDCont = NLRutaonombreBDCont.item(0);
Element elementoNodeNLRutaonombreBDCont = (Element) NodeNLRutaonombreBDCont;
controladorCont = getTagValue("controladorBD", elementoNodeNLRutaonombreBDCont);
RutaonombreBDCont = getTagValue("rutaonombreBD", elementoNodeNLRutaonombreBDCont);
servidorCont = getTagValue("ip", elementoNodeNLRutaonombreBDCont);
tipoCCont = getTagValue("tipoC", elementoNodeNLRutaonombreBDCont);
usuarioCont = getTagValue("usuario", elementoNodeNLRutaonombreBDCont);
contraseniaCont = getTagValue("contrasenia", elementoNodeNLRutaonombreBDCont);
puertoCont = Integer.parseInt(getTagValue("puerto", elementoNodeNLRutaonombreBDCont));
seguridadIntegrada = Boolean.parseBoolean(getTagValue("IntegratedSecurity", elementoNodeNLRutaonombreBDCont));
objConexion = new CrearConexionFBoSQL(controladorCont, servidorCont, puertoCont,
RutaonombreBDCont, usuarioCont, contraseniaCont,seguridadIntegrada);
conexionContpaqi = objConexion.getConexion();
if (conexionContpaqi == null) {
banderaCont = true;
}
//obtener configuracion de conexion a coi
NodeList NLRutaonombreBD = doc.getElementsByTagName("ConexionSAE");
Node NodeNLRutaonombreBD = NLRutaonombreBD.item(0);
Element elementoNodeNLRutaonombreBD = (Element) NodeNLRutaonombreBD;
controladorCOI = getTagValue("controladorBD", elementoNodeNLRutaonombreBD);
RutaonombreBDCOI = getTagValue("rutaonombreBD", elementoNodeNLRutaonombreBD);
servidorCOI = getTagValue("ip", elementoNodeNLRutaonombreBD);
tipoCCOI = getTagValue("tipoC", elementoNodeNLRutaonombreBD);
usuarioCOI = getTagValue("usuario", elementoNodeNLRutaonombreBD);
contraseniaCOI = getTagValue("contrasenia", elementoNodeNLRutaonombreBD);
puertoCOI = getTagValue("puerto", elementoNodeNLRutaonombreBD);
objConexion = new CrearConexionFBoSQL(controladorCOI, servidorCOI, Integer.parseInt(puertoCOI),
RutaonombreBDCOI, usuarioCOI, contraseniaCOI,false);
conexionCOI = objConexion.getConexion();
if (conexionCOI == null) {
banderaCOI = true;
} else {
getInfoEmpreCtas(conexionCOI, controladorCOI);
}
if (banderaCOI || banderaCont) {
int opc2 = JOptionPane.showConfirmDialog(this, "Ocurriern errores al realizar las conexiones\n\n"
+ "\nPara empezar a trabajar ¿Desea corregir las configuraciónes ahora?", "Error de conexión", JOptionPane.YES_NO_OPTION);
if (opc2 == JOptionPane.YES_OPTION) {
banderaCOI = false;
banderaCont = false;
nvaConfiguracion();
} else {
jMIPolizas.setEnabled(false);
jMIReporte.setEnabled(false);
jbtnImportarCtaCuentas.setEnabled(false);
jbtnImportarPoliza.setEnabled(false);
banderaCOI = false;
banderaCont = false;
}
}
if (conexionContpaqi != null) {
conexionContpaqi.close();
}
if (conexionCOI != null) {
conexionCOI.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void getInfoEmpreCtas(Connection con, String controlador) {
try {
String noEmpresa = "";
String paramSQL = "";
Statement stmt = con.createStatement();
if (controlador.equals("DevartSQLServer")) {
paramSQL = " top ";
ResultSet rs = stmt.executeQuery("SELECT * FROM INFORMATION_SCHEMA.TABLES");
while (rs.next()) {
String nombreTabla = rs.getString(3);
if (nombreTabla.startsWith("PARAMEMP")) {
noEmpresa = nombreTabla.substring(nombreTabla.length() - 2);
}
}
rs.close();
} else {
paramSQL = " first ";
DatabaseMetaData metaDatos;
String tipos[] = new String[]{"TABLE", "VIEW"};
ResultSet rsTablas;
metaDatos = con.getMetaData();
rsTablas = metaDatos.getTables(null, "ESQUEMA", "%", tipos);
while (rsTablas.next()) {
String nombreTabla = rsTablas.getString(rsTablas.findColumn("TABLE_NAME"));
if (nombreTabla.startsWith("PARAMEMP")) {
noEmpresa = nombreTabla.substring(nombreTabla.length() - 2);
}
}
rsTablas.close();
}
noEmp = noEmpresa;
dxNiveles = new int[9];
ResultSet rs = stmt.executeQuery("SELECT " + paramSQL + " 1 DIGCTA1,DIGCTA2,DIGCTA3,DIGCTA4,DIGCTA5,DIGCTA6,DIGCTA7,DIGCTA8,DIGCTA9 "
+ "from PARAMEMP" + noEmpresa);
if (rs.next()) {
dxNiveles[0] = rs.getInt(1);
dxNiveles[1] = rs.getInt(2);
dxNiveles[2] = rs.getInt(3);
dxNiveles[3] = rs.getInt(4);
dxNiveles[4] = rs.getInt(5);
dxNiveles[5] = rs.getInt(6);
dxNiveles[6] = rs.getInt(7);
dxNiveles[7] = rs.getInt(8);
dxNiveles[8] = rs.getInt(9);
}
rs.close();
con.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized
// TODO add your handling code here:
}//GEN-LAST:event_formComponentResized
private void formAncestorResized(java.awt.event.HierarchyEvent evt) {//GEN-FIRST:event_formAncestorResized
// TODO add your handling code here:
}//GEN-LAST:event_formAncestorResized
private void jDPPrincipal1ComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jDPPrincipal1ComponentResized
// TODO add your handling code here
jLblLogo.setLocation(this.getWidth() / 2 - this.jLblLogo.getWidth() / 2, this.getHeight() / 2 - this.jLblLogo.getHeight() / 2 - 20);
}//GEN-LAST:event_jDPPrincipal1ComponentResized
private void jMIConfParamsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIConfParamsActionPerformed
// TODO add your handling code here:
nvaConfiguracion();
}//GEN-LAST:event_jMIConfParamsActionPerformed
public void nvaConfiguracion() {
try {
jMIConfParams.setEnabled(false);
jMIReporte.setEnabled(false);
jbtnImportarCtaCuentas.setEnabled(false);
ConfParamsSistema ventana = new ConfParamsSistema();
jDPPrincipal1.add(ventana);
ventana.setVisible(true);
ventana.padre = this;
ventana.setSelected(true);
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
// TODO add your handling code here:
cerrarSesion();
}//GEN-LAST:event_formWindowClosing
private void jbtnImportarPolizaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnImportarPolizaActionPerformed
// TODO add your handling code here:
impPolizas();
}//GEN-LAST:event_jbtnImportarPolizaActionPerformed
private void jMIPolizasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIPolizasActionPerformed
// TODO add your handling code here:
impPolizas();
}//GEN-LAST:event_jMIPolizasActionPerformed
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
// TODO add your handling code here:
abrirAyuda();
}//GEN-LAST:event_jMenuItem1ActionPerformed
private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu3ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jMenu3ActionPerformed
private void jMIImportarSaldosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIImportarSaldosActionPerformed
// TODO add your handling code here:
getVentanaImportarSaldos();
}//GEN-LAST:event_jMIImportarSaldosActionPerformed
public void getVentanaImportarSaldos() {
try {
if (conexionContpaqi != null) {
conexionContpaqi.close();
frmImportarSaldosIniciales objPoliza = new frmImportarSaldosIniciales(this, true);
objPoliza.padre = this;
objPoliza.controlador = this.controladorCont;
objPoliza.servidor = this.servidorCont;
objPoliza.puerto = this.puertoCont;
objPoliza.seguridadIntegrada = this.seguridadIntegrada;
objPoliza.RutaonombreBDCont = this.RutaonombreBDCont;
objPoliza.usuario = this.usuarioCont;
objPoliza.contrasenia = this.contraseniaCont;
objPoliza.noEmpre = this.noEmp;
objPoliza.controladorCOI = this.controladorCOI;
objPoliza.servidorCOI = this.servidorCOI;
objPoliza.puertoCOI = this.puertoCOI;
objPoliza.RutaonombreBDCOI = this.RutaonombreBDCOI;
objPoliza.usuarioCOI = this.usuarioCOI;
objPoliza.contraseniaCOI = this.contraseniaCOI;
objPoliza.setVisible(true);
} else {
if (conexionContpaqi != null) {
conexionContpaqi.close();
}
JOptionPane.showMessageDialog(this, "Seleccione una base de datos para trabajar", "No ha seleccionado una base de datos", JOptionPane.WARNING_MESSAGE);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void abrirAyuda() {
String cadena;
File fichero = new File("ayuda/Migrar.chm");
cadena = fichero.getAbsolutePath();
try {
Runtime rt = Runtime.getRuntime();
String[] callAndArgs = {"C:/WINDOWS/hh.exe", cadena};
Process child = rt.exec(callAndArgs);
} catch (Exception eee) {
JOptionPane.showMessageDialog(this, eee);
}
}
public void cerrarSesion() {
try {
JInternalFrame[] allFrames = jDPPrincipal1.getAllFrames();
if (allFrames.length > 0) {
int opc = JOptionPane.showConfirmDialog(this, "¿Desea finalizar sesión?\n\n"
+ "Si Existen ventanas activas toda la informacion se perdera si continua", "Cerrar sesión", JOptionPane.YES_NO_OPTION);
if (opc == JOptionPane.YES_OPTION) {
for (int i = 0; i < allFrames.length; i++) {
JInternalFrame jInternalFrame = allFrames[i];
jInternalFrame.setClosed(true);
}
System.exit(0);
} else {
super.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
}
} else {
int opc = JOptionPane.showConfirmDialog(this, "¿Desea finalizar sesión?", "Cerrar sesión", JOptionPane.YES_NO_OPTION);
if (opc == JOptionPane.YES_OPTION) {
System.exit(0);
} else {
super.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(GUIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(GUIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(GUIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(GUIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new GUIPrincipal().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jBtnSalir;
public javax.swing.JDesktopPane jDPPrincipal1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLblLogo;
public javax.swing.JMenuItem jMIConfParams;
private javax.swing.JMenuItem jMIImportarSaldos;
public javax.swing.JMenuItem jMIPolizas;
public javax.swing.JMenuItem jMIReporte;
private javax.swing.JMenuItem jMISalir;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JToolBar.Separator jSeparator1;
private javax.swing.JToolBar jToolBar1;
protected javax.swing.JButton jbtnImportarCtaCuentas;
protected javax.swing.JButton jbtnImportarPoliza;
// End of variables declaration//GEN-END:variables
}
class FocusGrabber implements Runnable {
private JComponent component;
public FocusGrabber(JComponent component) {
this.component = component;
}
public void run() {
component.grabFocus();
}
}
| UTF-8 | Java | 32,305 | java | GUIPrincipal.java | Java | [
{
"context": "e;\nimport org.w3c.dom.NodeList;\n\n/**\n *\n * @author Gabriel-Diaz\n */\npublic class GUIPrincipal extends javax.swing",
"end": 921,
"score": 0.9998723268508911,
"start": 909,
"tag": "NAME",
"value": "Gabriel-Diaz"
}
]
| null | []
| package ctascontablesypolizas;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import ctascontablesypolizas.clases.CrearConexionFBoSQL;
import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.FileNotFoundException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import static javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
*
* @author Gabriel-Diaz
*/
public class GUIPrincipal extends javax.swing.JFrame {
public boolean banderaReportes = false;
private Connection conexionContpaqi;
private CrearConexionFBoSQL objConexion;
private String controladorCont;
private String RutaonombreBDCont;
private String servidorCont;
private String usuarioCont;
private String contraseniaCont;
private int puertoCont;
private String tipoCCont;
private String puertoCOI;
private String contraseniaCOI;
private String usuarioCOI;
private String tipoCCOI;
private String servidorCOI;
private String RutaonombreBDCOI;
private String controladorCOI;
private String noEmp;
private Connection conexionCOI;
private int opc1;
private int opc2;
private boolean banderaCOI;
private boolean banderaCont;
private int[] dxNiveles;
private boolean seguridadIntegrada;
/**
* Creates new form GUIPrincipal
*/
public GUIPrincipal() {
initComponents();
AsignarIconos();
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() {
@Override
public boolean dispatchKeyEvent(KeyEvent ke) {
if (ke.getID() == java.awt.event.KeyEvent.KEY_TYPED && ke.getKeyCode() == java.awt.event.KeyEvent.VK_F1) {
abrirAyuda();
}
return false;
}
});
jLabel1.setVisible(false);
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jToolBar1 = new javax.swing.JToolBar();
jbtnImportarCtaCuentas = new javax.swing.JButton();
jbtnImportarPoliza = new javax.swing.JButton();
jSeparator1 = new javax.swing.JToolBar.Separator();
jBtnSalir = new javax.swing.JButton();
jDPPrincipal1 = new javax.swing.JDesktopPane();
jLblLogo = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMIConfParams = new javax.swing.JMenuItem();
jMISalir = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
jMIReporte = new javax.swing.JMenuItem();
jMIPolizas = new javax.swing.JMenuItem();
jMIImportarSaldos = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("****ASCIENDE COMPUTACIÓN, S.A. DE C.V. *** Migrar catalogo de cuentas y pólizas de CONTPAQ i® a ASPEL® COI 6.0");
setMinimumSize(new java.awt.Dimension(744, 550));
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
formComponentResized(evt);
}
});
addHierarchyBoundsListener(new java.awt.event.HierarchyBoundsListener() {
public void ancestorMoved(java.awt.event.HierarchyEvent evt) {
}
public void ancestorResized(java.awt.event.HierarchyEvent evt) {
formAncestorResized(evt);
}
});
jToolBar1.setBackground(new java.awt.Color(178, 233, 187));
jToolBar1.setFloatable(false);
jToolBar1.setRollover(true);
jbtnImportarCtaCuentas.setBackground(new java.awt.Color(178, 233, 187));
jbtnImportarCtaCuentas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/ctascontcoi.png"))); // NOI18N
jbtnImportarCtaCuentas.setToolTipText("Exportar catalogo de ctas.");
jbtnImportarCtaCuentas.setFocusable(false);
jbtnImportarCtaCuentas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jbtnImportarCtaCuentas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jbtnImportarCtaCuentas.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnImportarCtaCuentasActionPerformed(evt);
}
});
jToolBar1.add(jbtnImportarCtaCuentas);
jbtnImportarPoliza.setBackground(new java.awt.Color(178, 233, 187));
jbtnImportarPoliza.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/polcontcoi.png"))); // NOI18N
jbtnImportarPoliza.setToolTipText("Exportar Pólizas");
jbtnImportarPoliza.setFocusable(false);
jbtnImportarPoliza.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jbtnImportarPoliza.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jbtnImportarPoliza.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnImportarPolizaActionPerformed(evt);
}
});
jToolBar1.add(jbtnImportarPoliza);
jToolBar1.add(jSeparator1);
jBtnSalir.setBackground(new java.awt.Color(178, 233, 187));
jBtnSalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/salir.png"))); // NOI18N
jBtnSalir.setToolTipText("Salir de la aplicación");
jBtnSalir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnSalirActionPerformed(evt);
}
});
jToolBar1.add(jBtnSalir);
jDPPrincipal1.setBackground(new java.awt.Color(205, 241, 236));
jDPPrincipal1.setDragMode(javax.swing.JDesktopPane.OUTLINE_DRAG_MODE);
jDPPrincipal1.addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
jDPPrincipal1ComponentResized(evt);
}
});
jLblLogo.setBackground(new java.awt.Color(77, 255, 209));
jLblLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/fondo.png"))); // NOI18N
jDPPrincipal1.add(jLblLogo);
jLblLogo.setBounds(100, 0, 550, 400);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/logodesk.png"))); // NOI18N
jLabel1.setText("j");
jDPPrincipal1.add(jLabel1);
jLabel1.setBounds(440, 270, 20, 20);
jMenu1.setText("Archivo");
jMIConfParams.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
jMIConfParams.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/miniconf.png"))); // NOI18N
jMIConfParams.setText("Configuracion de parametros");
jMIConfParams.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMIConfParamsActionPerformed(evt);
}
});
jMenu1.add(jMIConfParams);
jMISalir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.CTRL_MASK));
jMISalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/minisalir.png"))); // NOI18N
jMISalir.setText("Salir");
jMenu1.add(jMISalir);
jMenuBar1.add(jMenu1);
jMenu3.setText("Procesos");
jMenu3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu3ActionPerformed(evt);
}
});
jMIReporte.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK));
jMIReporte.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/minictascontcoi.png"))); // NOI18N
jMIReporte.setText("Exportar Cat. de Cuentas");
jMIReporte.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMIReporteActionPerformed(evt);
}
});
jMenu3.add(jMIReporte);
jMIPolizas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK));
jMIPolizas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/minipolcontcoi.png"))); // NOI18N
jMIPolizas.setText("Exportar Pólizas");
jMIPolizas.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMIPolizasActionPerformed(evt);
}
});
jMenu3.add(jMIPolizas);
jMIImportarSaldos.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.ALT_MASK));
jMIImportarSaldos.setText("Importar saldos iniciales");
jMIImportarSaldos.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMIImportarSaldosActionPerformed(evt);
}
});
jMenu3.add(jMIImportarSaldos);
jMenuBar1.add(jMenu3);
jMenu2.setText("Ayuda");
jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/buscar.png"))); // NOI18N
jMenuItem1.setText("Ayuda");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem1);
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jDPPrincipal1, javax.swing.GroupLayout.DEFAULT_SIZE, 724, Short.MAX_VALUE)
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jDPPrincipal1, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE))
);
jDPPrincipal1.getAccessibleContext().setAccessibleParent(jDPPrincipal1);
pack();
}// </editor-fold>//GEN-END:initComponents
private void AsignarIconos() {
ImageIcon icono2 = (ImageIcon) jLabel1.getIcon();
ImageIcon iconoFrame = new ImageIcon(icono2.getImage().getScaledInstance(45, 45, 20));
this.setIconImage(iconoFrame.getImage());
}
private void impcatctas() {
try {
jMIConfParams.setEnabled(false);
jMIReporte.setEnabled(false);
jbtnImportarCtaCuentas.setEnabled(false);
CatCtas ventana = new CatCtas();
jDPPrincipal1.add(ventana);
ventana.controlador = this.controladorCont;
ventana.servidor = this.servidorCont;
ventana.puerto = this.puertoCont;
ventana.seguridadIntegrada = this.seguridadIntegrada;
ventana.RutaonombreBDCont = this.RutaonombreBDCont;
ventana.usuario = this.usuarioCont;
ventana.contrasenia = this.contraseniaCont;
ventana.controladorCOI = this.controladorCOI;
ventana.servidorCOI = this.servidorCOI;
ventana.puertoCOI = this.puertoCOI;
ventana.RutaonombreBDCOI = this.RutaonombreBDCOI;
ventana.usuarioCOI = this.usuarioCOI;
ventana.contraseniaCOI = this.contraseniaCOI;
ventana.padre = this;
ventana.dxNiveles = dxNiveles;
ventana.nomEmpre = this.noEmp;
ventana.setVisible(true);
ventana.setSelected(true);
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void impPolizas() {
try {
jMIConfParams.setEnabled(false);
jMIPolizas.setEnabled(false);
jbtnImportarPoliza.setEnabled(false);
ListadoPolizas ventana = new ListadoPolizas();
ventana.padre = this;
ventana.noEmpre = noEmp;
ventana.dxNiveles = dxNiveles;
jDPPrincipal1.add(ventana);
ventana.setVisible(true);
ventana.setSelected(true);
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void jBtnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnSalirActionPerformed
// TODO add your handling code here:
cerrarSesion();
}//GEN-LAST:event_jBtnSalirActionPerformed
private void jbtnImportarCtaCuentasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnImportarCtaCuentasActionPerformed
// TODO add your handling code here:
if (banderaReportes == false) {
impcatctas();
banderaReportes = true;
}
}//GEN-LAST:event_jbtnImportarCtaCuentasActionPerformed
private void jMIReporteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIReporteActionPerformed
// TODO add your handling code here:
impcatctas();
}//GEN-LAST:event_jMIReporteActionPerformed
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
// TODO add your handling code here:
jLblLogo.setLocation(this.getWidth() / 2 - this.jLblLogo.getWidth() / 2, this.getHeight() / 2 - this.jLblLogo.getHeight() / 2 - 20);
leerConfiguracion();
}//GEN-LAST:event_formWindowOpened
public String getTagValue(String tag, Element elemento) {
NodeList lista = elemento.getElementsByTagName(tag).item(0).getChildNodes();
Node valor = (Node) lista.item(0);
return valor.getNodeValue();
}
public void leerConfiguracion() {
try {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = null;
try {
doc = dBuilder.parse(new File("ConfSistema.xml"));
doc.getDocumentElement().normalize();
} catch (FileNotFoundException e) {
JOptionPane.showMessageDialog(this, "No se pudo encontrar un archivo de configuración"
+ "\n " + e, "Error", JOptionPane.ERROR_MESSAGE);
jMIConfParams.setEnabled(false);
System.exit(0);
}
/*
* obtener el numero de la empresa
*/
NodeList NLEmpresa = doc.getElementsByTagName("Empresa");
Node NodeNLEmpresa = NLEmpresa.item(0);
Element elementoNodeNLEmpresa = (Element) NodeNLEmpresa;
// noEmp = getTagValue("NoEmp", elementoNodeNLEmpresa);
//obtener configuracion de conexion a COntpaq
NodeList NLRutaonombreBDCont = doc.getElementsByTagName("ConexionCONT");
Node NodeNLRutaonombreBDCont = NLRutaonombreBDCont.item(0);
Element elementoNodeNLRutaonombreBDCont = (Element) NodeNLRutaonombreBDCont;
controladorCont = getTagValue("controladorBD", elementoNodeNLRutaonombreBDCont);
RutaonombreBDCont = getTagValue("rutaonombreBD", elementoNodeNLRutaonombreBDCont);
servidorCont = getTagValue("ip", elementoNodeNLRutaonombreBDCont);
tipoCCont = getTagValue("tipoC", elementoNodeNLRutaonombreBDCont);
usuarioCont = getTagValue("usuario", elementoNodeNLRutaonombreBDCont);
contraseniaCont = getTagValue("contrasenia", elementoNodeNLRutaonombreBDCont);
puertoCont = Integer.parseInt(getTagValue("puerto", elementoNodeNLRutaonombreBDCont));
seguridadIntegrada = Boolean.parseBoolean(getTagValue("IntegratedSecurity", elementoNodeNLRutaonombreBDCont));
objConexion = new CrearConexionFBoSQL(controladorCont, servidorCont, puertoCont,
RutaonombreBDCont, usuarioCont, contraseniaCont,seguridadIntegrada);
conexionContpaqi = objConexion.getConexion();
if (conexionContpaqi == null) {
banderaCont = true;
}
//obtener configuracion de conexion a coi
NodeList NLRutaonombreBD = doc.getElementsByTagName("ConexionSAE");
Node NodeNLRutaonombreBD = NLRutaonombreBD.item(0);
Element elementoNodeNLRutaonombreBD = (Element) NodeNLRutaonombreBD;
controladorCOI = getTagValue("controladorBD", elementoNodeNLRutaonombreBD);
RutaonombreBDCOI = getTagValue("rutaonombreBD", elementoNodeNLRutaonombreBD);
servidorCOI = getTagValue("ip", elementoNodeNLRutaonombreBD);
tipoCCOI = getTagValue("tipoC", elementoNodeNLRutaonombreBD);
usuarioCOI = getTagValue("usuario", elementoNodeNLRutaonombreBD);
contraseniaCOI = getTagValue("contrasenia", elementoNodeNLRutaonombreBD);
puertoCOI = getTagValue("puerto", elementoNodeNLRutaonombreBD);
objConexion = new CrearConexionFBoSQL(controladorCOI, servidorCOI, Integer.parseInt(puertoCOI),
RutaonombreBDCOI, usuarioCOI, contraseniaCOI,false);
conexionCOI = objConexion.getConexion();
if (conexionCOI == null) {
banderaCOI = true;
} else {
getInfoEmpreCtas(conexionCOI, controladorCOI);
}
if (banderaCOI || banderaCont) {
int opc2 = JOptionPane.showConfirmDialog(this, "Ocurriern errores al realizar las conexiones\n\n"
+ "\nPara empezar a trabajar ¿Desea corregir las configuraciónes ahora?", "Error de conexión", JOptionPane.YES_NO_OPTION);
if (opc2 == JOptionPane.YES_OPTION) {
banderaCOI = false;
banderaCont = false;
nvaConfiguracion();
} else {
jMIPolizas.setEnabled(false);
jMIReporte.setEnabled(false);
jbtnImportarCtaCuentas.setEnabled(false);
jbtnImportarPoliza.setEnabled(false);
banderaCOI = false;
banderaCont = false;
}
}
if (conexionContpaqi != null) {
conexionContpaqi.close();
}
if (conexionCOI != null) {
conexionCOI.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void getInfoEmpreCtas(Connection con, String controlador) {
try {
String noEmpresa = "";
String paramSQL = "";
Statement stmt = con.createStatement();
if (controlador.equals("DevartSQLServer")) {
paramSQL = " top ";
ResultSet rs = stmt.executeQuery("SELECT * FROM INFORMATION_SCHEMA.TABLES");
while (rs.next()) {
String nombreTabla = rs.getString(3);
if (nombreTabla.startsWith("PARAMEMP")) {
noEmpresa = nombreTabla.substring(nombreTabla.length() - 2);
}
}
rs.close();
} else {
paramSQL = " first ";
DatabaseMetaData metaDatos;
String tipos[] = new String[]{"TABLE", "VIEW"};
ResultSet rsTablas;
metaDatos = con.getMetaData();
rsTablas = metaDatos.getTables(null, "ESQUEMA", "%", tipos);
while (rsTablas.next()) {
String nombreTabla = rsTablas.getString(rsTablas.findColumn("TABLE_NAME"));
if (nombreTabla.startsWith("PARAMEMP")) {
noEmpresa = nombreTabla.substring(nombreTabla.length() - 2);
}
}
rsTablas.close();
}
noEmp = noEmpresa;
dxNiveles = new int[9];
ResultSet rs = stmt.executeQuery("SELECT " + paramSQL + " 1 DIGCTA1,DIGCTA2,DIGCTA3,DIGCTA4,DIGCTA5,DIGCTA6,DIGCTA7,DIGCTA8,DIGCTA9 "
+ "from PARAMEMP" + noEmpresa);
if (rs.next()) {
dxNiveles[0] = rs.getInt(1);
dxNiveles[1] = rs.getInt(2);
dxNiveles[2] = rs.getInt(3);
dxNiveles[3] = rs.getInt(4);
dxNiveles[4] = rs.getInt(5);
dxNiveles[5] = rs.getInt(6);
dxNiveles[6] = rs.getInt(7);
dxNiveles[7] = rs.getInt(8);
dxNiveles[8] = rs.getInt(9);
}
rs.close();
con.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized
// TODO add your handling code here:
}//GEN-LAST:event_formComponentResized
private void formAncestorResized(java.awt.event.HierarchyEvent evt) {//GEN-FIRST:event_formAncestorResized
// TODO add your handling code here:
}//GEN-LAST:event_formAncestorResized
private void jDPPrincipal1ComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jDPPrincipal1ComponentResized
// TODO add your handling code here
jLblLogo.setLocation(this.getWidth() / 2 - this.jLblLogo.getWidth() / 2, this.getHeight() / 2 - this.jLblLogo.getHeight() / 2 - 20);
}//GEN-LAST:event_jDPPrincipal1ComponentResized
private void jMIConfParamsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIConfParamsActionPerformed
// TODO add your handling code here:
nvaConfiguracion();
}//GEN-LAST:event_jMIConfParamsActionPerformed
public void nvaConfiguracion() {
try {
jMIConfParams.setEnabled(false);
jMIReporte.setEnabled(false);
jbtnImportarCtaCuentas.setEnabled(false);
ConfParamsSistema ventana = new ConfParamsSistema();
jDPPrincipal1.add(ventana);
ventana.setVisible(true);
ventana.padre = this;
ventana.setSelected(true);
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
// TODO add your handling code here:
cerrarSesion();
}//GEN-LAST:event_formWindowClosing
private void jbtnImportarPolizaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnImportarPolizaActionPerformed
// TODO add your handling code here:
impPolizas();
}//GEN-LAST:event_jbtnImportarPolizaActionPerformed
private void jMIPolizasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIPolizasActionPerformed
// TODO add your handling code here:
impPolizas();
}//GEN-LAST:event_jMIPolizasActionPerformed
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
// TODO add your handling code here:
abrirAyuda();
}//GEN-LAST:event_jMenuItem1ActionPerformed
private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu3ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jMenu3ActionPerformed
private void jMIImportarSaldosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIImportarSaldosActionPerformed
// TODO add your handling code here:
getVentanaImportarSaldos();
}//GEN-LAST:event_jMIImportarSaldosActionPerformed
public void getVentanaImportarSaldos() {
try {
if (conexionContpaqi != null) {
conexionContpaqi.close();
frmImportarSaldosIniciales objPoliza = new frmImportarSaldosIniciales(this, true);
objPoliza.padre = this;
objPoliza.controlador = this.controladorCont;
objPoliza.servidor = this.servidorCont;
objPoliza.puerto = this.puertoCont;
objPoliza.seguridadIntegrada = this.seguridadIntegrada;
objPoliza.RutaonombreBDCont = this.RutaonombreBDCont;
objPoliza.usuario = this.usuarioCont;
objPoliza.contrasenia = this.contraseniaCont;
objPoliza.noEmpre = this.noEmp;
objPoliza.controladorCOI = this.controladorCOI;
objPoliza.servidorCOI = this.servidorCOI;
objPoliza.puertoCOI = this.puertoCOI;
objPoliza.RutaonombreBDCOI = this.RutaonombreBDCOI;
objPoliza.usuarioCOI = this.usuarioCOI;
objPoliza.contraseniaCOI = this.contraseniaCOI;
objPoliza.setVisible(true);
} else {
if (conexionContpaqi != null) {
conexionContpaqi.close();
}
JOptionPane.showMessageDialog(this, "Seleccione una base de datos para trabajar", "No ha seleccionado una base de datos", JOptionPane.WARNING_MESSAGE);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void abrirAyuda() {
String cadena;
File fichero = new File("ayuda/Migrar.chm");
cadena = fichero.getAbsolutePath();
try {
Runtime rt = Runtime.getRuntime();
String[] callAndArgs = {"C:/WINDOWS/hh.exe", cadena};
Process child = rt.exec(callAndArgs);
} catch (Exception eee) {
JOptionPane.showMessageDialog(this, eee);
}
}
public void cerrarSesion() {
try {
JInternalFrame[] allFrames = jDPPrincipal1.getAllFrames();
if (allFrames.length > 0) {
int opc = JOptionPane.showConfirmDialog(this, "¿Desea finalizar sesión?\n\n"
+ "Si Existen ventanas activas toda la informacion se perdera si continua", "Cerrar sesión", JOptionPane.YES_NO_OPTION);
if (opc == JOptionPane.YES_OPTION) {
for (int i = 0; i < allFrames.length; i++) {
JInternalFrame jInternalFrame = allFrames[i];
jInternalFrame.setClosed(true);
}
System.exit(0);
} else {
super.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
}
} else {
int opc = JOptionPane.showConfirmDialog(this, "¿Desea finalizar sesión?", "Cerrar sesión", JOptionPane.YES_NO_OPTION);
if (opc == JOptionPane.YES_OPTION) {
System.exit(0);
} else {
super.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(GUIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(GUIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(GUIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(GUIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new GUIPrincipal().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jBtnSalir;
public javax.swing.JDesktopPane jDPPrincipal1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLblLogo;
public javax.swing.JMenuItem jMIConfParams;
private javax.swing.JMenuItem jMIImportarSaldos;
public javax.swing.JMenuItem jMIPolizas;
public javax.swing.JMenuItem jMIReporte;
private javax.swing.JMenuItem jMISalir;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JToolBar.Separator jSeparator1;
private javax.swing.JToolBar jToolBar1;
protected javax.swing.JButton jbtnImportarCtaCuentas;
protected javax.swing.JButton jbtnImportarPoliza;
// End of variables declaration//GEN-END:variables
}
class FocusGrabber implements Runnable {
private JComponent component;
public FocusGrabber(JComponent component) {
this.component = component;
}
public void run() {
component.grabFocus();
}
}
| 32,305 | 0.639587 | 0.63138 | 716 | 44.094971 | 32.687824 | 167 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.703911 | false | false | 15 |
fcc8870b2958343c28d93c4865432012832fc3b6 | 21,431,886,849,559 | 53848e6f2a60def3ba33af07dcc0fc4e51fa839b | /src/main/java/com/hpeu/oa/service/RoleService.java | 37c6e5b2cdd3441d292523bca18405924d5551c6 | []
| no_license | GuoYinJia/oa | https://github.com/GuoYinJia/oa | f87c0cf2a970443be30ed926072dba8e4f64f323 | 7a4b676ec6c15117c543e001f0de158ee179ed18 | refs/heads/master | 2020-03-17T12:59:27.781000 | 2018-05-16T05:07:07 | 2018-05-16T05:07:07 | 133,612,533 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hpeu.oa.service;
import com.hpeu.oa.entity.Role;
/**
* @author :郭银嘉
* @create : 2018/05/15 21:35
* @description :
*/
public interface RoleService extends BaseService<Role> {
}
| UTF-8 | Java | 206 | java | RoleService.java | Java | [
{
"context": "\nimport com.hpeu.oa.entity.Role;\n\n/**\n * @author :郭银嘉\n * @create : 2018/05/15 21:35\n * @description :\n ",
"end": 82,
"score": 0.9998263120651245,
"start": 79,
"tag": "NAME",
"value": "郭银嘉"
}
]
| null | []
| package com.hpeu.oa.service;
import com.hpeu.oa.entity.Role;
/**
* @author :郭银嘉
* @create : 2018/05/15 21:35
* @description :
*/
public interface RoleService extends BaseService<Role> {
}
| 206 | 0.690722 | 0.628866 | 11 | 16.636364 | 17.084139 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | false | false | 15 |
356b76cfca3c97aec2916c0db5747fb79622fddc | 21,431,886,845,852 | f138557e41667f2199391892301763abcc6fc354 | /src/_2_typy_danych/ObslugaSzkolen.java | 9e16351054b508894159d01efce3b2d53f07da39 | []
| no_license | kamill84/podstawy | https://github.com/kamill84/podstawy | e8a677f2ae30a9634542dc4c0f405d7fc70a44ee | 20dd061c327b873fffeb374ecaf94eeb3da309ed | refs/heads/master | 2020-04-11T15:38:52.118000 | 2019-01-31T21:18:58 | 2019-01-31T21:18:58 | 161,898,291 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package _2_typy_danych;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.Month;
public class ObslugaSzkolen {
public static void main(String[] args) {
Adres adresszkoleniaJava = new Adres("Polna 5", "01-001", "Warszawa");
Szkolenie szkolenieJava = new Szkolenie("Szkolenie Java",
10, new BigDecimal("1000"),
LocalDate.of(2018, Month.DECEMBER, 15), adresszkoleniaJava);
szkolenieJava.wyswietl();
Szkolenie szkoleniePython = new Szkolenie(
"Szkolenie Python", 5, new BigDecimal("1300"),
LocalDate.of(2019, Month.FEBRUARY, 1), adresszkoleniaJava);
szkoleniePython.wyswietl();
// Adres Klient = new Adres("Polna","43-400","Kraków");
// Klient.wyswietl();
szkolenieJava.przychodBrutto();
System.out.println(szkolenieJava.przychodBrutto());
szkolenieJava.przychodNetto();
System.out.println(szkolenieJava.przychodNetto());
}
}
| UTF-8 | Java | 1,055 | java | ObslugaSzkolen.java | Java | []
| null | []
| package _2_typy_danych;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.Month;
public class ObslugaSzkolen {
public static void main(String[] args) {
Adres adresszkoleniaJava = new Adres("Polna 5", "01-001", "Warszawa");
Szkolenie szkolenieJava = new Szkolenie("Szkolenie Java",
10, new BigDecimal("1000"),
LocalDate.of(2018, Month.DECEMBER, 15), adresszkoleniaJava);
szkolenieJava.wyswietl();
Szkolenie szkoleniePython = new Szkolenie(
"Szkolenie Python", 5, new BigDecimal("1300"),
LocalDate.of(2019, Month.FEBRUARY, 1), adresszkoleniaJava);
szkoleniePython.wyswietl();
// Adres Klient = new Adres("Polna","43-400","Kraków");
// Klient.wyswietl();
szkolenieJava.przychodBrutto();
System.out.println(szkolenieJava.przychodBrutto());
szkolenieJava.przychodNetto();
System.out.println(szkolenieJava.przychodNetto());
}
}
| 1,055 | 0.616698 | 0.58444 | 42 | 24.095238 | 26.809566 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.738095 | false | false | 15 |
97616dc9880cf99582e024263ade014b0d2f3611 | 34,454,227,666,951 | 8d1a51419670f3a95fac6509c0ee0a75d1e88c89 | /RecordIndexer/test/server/TestFieldDAO.java | 45b4c8a1ef90a7db3cb15e347420bedbaccd8a21 | []
| no_license | YazanHalawa/CS-240 | https://github.com/YazanHalawa/CS-240 | f46daae662a74a33e026be5bf5953279d11817d3 | ed81a8404a1f4ac435b317d01c333d7c8032e332 | refs/heads/master | 2021-01-18T14:10:42.539000 | 2015-09-17T20:01:39 | 2015-09-17T20:01:39 | 42,497,738 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package server;
import static org.junit.Assert.*;
import server.database.*;
import shared.modelClasses.*;
import java.util.List;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* This class will test all the methods in fieldDAO
* @author Yazan Halawa
*
*/
public class TestFieldDAO {
/**
* This method will be called before all the Tests to set up the architecture base for testing
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
//Load database driver
Database.initialize();
}
/**
* this method will be called at the end after all the tests to clean up
* @throws java.lang.Exception
*/
@AfterClass
public static void tearDownAfterClass() throws Exception {
return;
}
private Database db;
private FieldDAO dbFields;
/**
* This method will be called before each test to set up the data base
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
//Create a new Database
db = new Database();
//Prepare Database for test case
db.startTransaction();
dbFields = db.getFieldsDAO();
}
/**
* This method will be called after each test to clean up any data left
* in the data base from the last test
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
//Roll back transaction so changes to database are undone
db.endTransaction(false);
db = null;
dbFields = null;
}
/**
* Test method for {@link server.database.FieldDAO#add(server.modelClasses.Field)}.
* @throws DatabaseException if the operation fails for any reason
*/
@Test
public void testAdd() throws DatabaseException {
//Add two fields to the data base
Field testField1 = new Field(-1, "test1", 1, 20, 1, 30, "html1", "data");
dbFields.add(testField1);
Field testField2 = new Field(-1, "test2", 2, 20, 2, 60, "html2", "data2");
dbFields.add(testField2);
//Check that the data base holds the two fields
List<Field> all = dbFields.getAllFields();
assertEquals(2, all.size());
//Check that the fields were added correctly
boolean foundFirst = false;
boolean foundSecond = false;
for (Field field : all) {
assertFalse(field.getId() == -1);
if (!foundFirst) {
foundFirst = areEqual(field, testField1, false);
}
if (!foundSecond) {
foundSecond = areEqual(field, testField2, false);
}
}
assertTrue(foundFirst && foundSecond);
}
/**
* Test method for {@link server.database.FieldDAO#getAllFieldsForProject(int)}.
* @throws DatabaseException if the operation fails for any reason
*/
@Test
public void testGetAllFieldsForProject() throws DatabaseException {
Field testField1 = new Field(-1, "test1", 1, 20, 1, 30, "html1", "data1");
dbFields.add(testField1);
Field testField2 = new Field(-1, "test2", 2, 20, 2, 60, "html2", "data2");
dbFields.add(testField2);
List<Field> all = dbFields.getAllFieldsForProject(1);
assertEquals(1, all.size());
}
/**
* Test method for {@link server.database.FieldDAO#getAllFields()}.
* @throws DatabaseException if the operation fails for any reason
*/
@Test
public void testGetAllFields() throws DatabaseException {
List<Field> all = dbFields.getAllFields();
assertEquals(0, all.size());
}
/**
* Test method for an invalid add
* @throws DatabaseException because of the invalid input
*/
@Test(expected=DatabaseException.class)
public void testInvalidAdd() throws DatabaseException {
Field invalidField = new Field (-1, null, -1, -1, -1, -1, null, null);
dbFields.add(invalidField);
}
/**
* Test method for an invalid GetAllFieldsForProject
* @throws DatabaseException because of the invalid input
*/
@Test(expected=DatabaseException.class)
public void testInvalidGetAllFieldsForProject() throws DatabaseException {
dbFields.getAllFieldsForProject(-1);
}
/**
* This method compares two fields and checks if they are equal
* @param a the first field
* @param b the second field
* @param compareIDs a flag to specify whether to compare IDs or not
* @return true if the two fields are equal, else false
*/
private boolean areEqual(Field a, Field b, boolean compareIDs){
if (compareIDs){
if (a.getId() != b.getId()){
return false;
}
}
return (SafeEquals(a.getTitle(), b.getTitle()) &&
SafeEquals(a.getProject_id(), b.getProject_id()) &&
SafeEquals(a.getWidth(), b.getWidth()) &&
SafeEquals(a.getColumnNum(), b.getColumnNum()) &&
SafeEquals(a.getFirstXCoord(), b.getFirstXCoord()));
}
/**
* This method is a safe equals that checks whether the two
* objects are null
* @param a the first object
* @param b the second object
* @return true if they are equal, else false
*/
private boolean SafeEquals(Object a, Object b) {
if (a == null || b == null) {
return (a == null && b == null);
}
else{
return a.equals(b);
}
}
}
| UTF-8 | Java | 4,996 | java | TestFieldDAO.java | Java | [
{
"context": "s will test all the methods in fieldDAO\n * @author Yazan Halawa\n *\n */\npublic class TestFieldDAO {\n\n\t/**\n\t * This",
"end": 343,
"score": 0.9998359680175781,
"start": 331,
"tag": "NAME",
"value": "Yazan Halawa"
}
]
| null | []
|
package server;
import static org.junit.Assert.*;
import server.database.*;
import shared.modelClasses.*;
import java.util.List;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* This class will test all the methods in fieldDAO
* @author <NAME>
*
*/
public class TestFieldDAO {
/**
* This method will be called before all the Tests to set up the architecture base for testing
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
//Load database driver
Database.initialize();
}
/**
* this method will be called at the end after all the tests to clean up
* @throws java.lang.Exception
*/
@AfterClass
public static void tearDownAfterClass() throws Exception {
return;
}
private Database db;
private FieldDAO dbFields;
/**
* This method will be called before each test to set up the data base
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
//Create a new Database
db = new Database();
//Prepare Database for test case
db.startTransaction();
dbFields = db.getFieldsDAO();
}
/**
* This method will be called after each test to clean up any data left
* in the data base from the last test
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
//Roll back transaction so changes to database are undone
db.endTransaction(false);
db = null;
dbFields = null;
}
/**
* Test method for {@link server.database.FieldDAO#add(server.modelClasses.Field)}.
* @throws DatabaseException if the operation fails for any reason
*/
@Test
public void testAdd() throws DatabaseException {
//Add two fields to the data base
Field testField1 = new Field(-1, "test1", 1, 20, 1, 30, "html1", "data");
dbFields.add(testField1);
Field testField2 = new Field(-1, "test2", 2, 20, 2, 60, "html2", "data2");
dbFields.add(testField2);
//Check that the data base holds the two fields
List<Field> all = dbFields.getAllFields();
assertEquals(2, all.size());
//Check that the fields were added correctly
boolean foundFirst = false;
boolean foundSecond = false;
for (Field field : all) {
assertFalse(field.getId() == -1);
if (!foundFirst) {
foundFirst = areEqual(field, testField1, false);
}
if (!foundSecond) {
foundSecond = areEqual(field, testField2, false);
}
}
assertTrue(foundFirst && foundSecond);
}
/**
* Test method for {@link server.database.FieldDAO#getAllFieldsForProject(int)}.
* @throws DatabaseException if the operation fails for any reason
*/
@Test
public void testGetAllFieldsForProject() throws DatabaseException {
Field testField1 = new Field(-1, "test1", 1, 20, 1, 30, "html1", "data1");
dbFields.add(testField1);
Field testField2 = new Field(-1, "test2", 2, 20, 2, 60, "html2", "data2");
dbFields.add(testField2);
List<Field> all = dbFields.getAllFieldsForProject(1);
assertEquals(1, all.size());
}
/**
* Test method for {@link server.database.FieldDAO#getAllFields()}.
* @throws DatabaseException if the operation fails for any reason
*/
@Test
public void testGetAllFields() throws DatabaseException {
List<Field> all = dbFields.getAllFields();
assertEquals(0, all.size());
}
/**
* Test method for an invalid add
* @throws DatabaseException because of the invalid input
*/
@Test(expected=DatabaseException.class)
public void testInvalidAdd() throws DatabaseException {
Field invalidField = new Field (-1, null, -1, -1, -1, -1, null, null);
dbFields.add(invalidField);
}
/**
* Test method for an invalid GetAllFieldsForProject
* @throws DatabaseException because of the invalid input
*/
@Test(expected=DatabaseException.class)
public void testInvalidGetAllFieldsForProject() throws DatabaseException {
dbFields.getAllFieldsForProject(-1);
}
/**
* This method compares two fields and checks if they are equal
* @param a the first field
* @param b the second field
* @param compareIDs a flag to specify whether to compare IDs or not
* @return true if the two fields are equal, else false
*/
private boolean areEqual(Field a, Field b, boolean compareIDs){
if (compareIDs){
if (a.getId() != b.getId()){
return false;
}
}
return (SafeEquals(a.getTitle(), b.getTitle()) &&
SafeEquals(a.getProject_id(), b.getProject_id()) &&
SafeEquals(a.getWidth(), b.getWidth()) &&
SafeEquals(a.getColumnNum(), b.getColumnNum()) &&
SafeEquals(a.getFirstXCoord(), b.getFirstXCoord()));
}
/**
* This method is a safe equals that checks whether the two
* objects are null
* @param a the first object
* @param b the second object
* @return true if they are equal, else false
*/
private boolean SafeEquals(Object a, Object b) {
if (a == null || b == null) {
return (a == null && b == null);
}
else{
return a.equals(b);
}
}
}
| 4,990 | 0.690753 | 0.678743 | 192 | 25.015625 | 24.286587 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.765625 | false | false | 15 |
df46dc78ff1122040096cb8f45dca02b2793165e | 32,289,564,135,460 | 604d58e9234655ee049ce2afacb1f913a1966225 | /code.samples/lec.6/lec2war/src/main/java/ru/malykh/da/lec6/controllers/RecipesController.java | 44eb121ae24e44a4358d402b9630c50e6591c2fa | []
| no_license | maxsad1/j2ee_course | https://github.com/maxsad1/j2ee_course | f8db53d05ae2053ee9043d1d21a05212e8137f7f | 34e6717d58564597115bdf47134c6b2a038c1c31 | refs/heads/master | 2021-01-12T03:54:24.661000 | 2015-12-06T19:31:02 | 2015-12-06T19:31:02 | 78,284,440 | 1 | 0 | null | true | 2017-01-07T14:45:58 | 2017-01-07T14:45:58 | 2016-03-25T22:02:18 | 2015-12-06T19:31:16 | 15,623 | 0 | 0 | 0 | null | null | null | package ru.malykh.da.lec6.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping( "/recipes" )
public class RecipesController
{
@RequestMapping( value = "", method = RequestMethod.GET )
public ModelAndView securities( )
throws Exception
{
ModelAndView mav = new ModelAndView( "recipes" );
return mav;
}
}
| UTF-8 | Java | 534 | java | RecipesController.java | Java | []
| null | []
| package ru.malykh.da.lec6.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping( "/recipes" )
public class RecipesController
{
@RequestMapping( value = "", method = RequestMethod.GET )
public ModelAndView securities( )
throws Exception
{
ModelAndView mav = new ModelAndView( "recipes" );
return mav;
}
}
| 534 | 0.786517 | 0.784644 | 20 | 25.700001 | 22.79715 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 15 |
ec3ab179bed84b7d3b86704e9e1a01d1058b0563 | 31,619,549,280,213 | a460d9e8c9b8466cf5ab1b6f41b6818bbf59044c | /poetry_web/src/main/java/com/poetry/game/OnlineUserOperator.java | 4f0be87c56a8be3502b1c65cdf6bf5b3bc95d474 | []
| no_license | 404008945/poetry_game | https://github.com/404008945/poetry_game | 1d5c5b5f06f4d9647d069a7a0eaa75a1f2bfa7cb | e232e32cc981a070d1192a767542b0ff1ab1bb3c | refs/heads/master | 2022-04-16T22:57:21.458000 | 2020-04-10T06:47:05 | 2020-04-10T06:47:05 | 255,616,813 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.poetry.game;
import com.poetry.entity.User;
import com.poetry.service.FriendService;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.socket.WebSocketSession;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
//需要做一个单例出来
@Controller
public class OnlineUserOperator {//更改集合
@Autowired
private FriendService friendService;
private Map<String, Player> onlineUsers = new Hashtable<>(); //存放在线用户 用户对象中需要封装 socket的session
@Autowired
private GameControll gameControll;
public List<User> getOnlineUsers() {
List<User> users = new ArrayList<>();
for (Map.Entry<String, Player> m : onlineUsers.entrySet()) {
users.add(m.getValue().getUser());
}
return users;
}
public void setOnlineUsers(Map<String, Player> onlineUsers) {
this.onlineUsers = onlineUsers;
}
//判断user是否在集合中
public int isExists(User u) {//不存在则进行添加 存在则进行刷新session操作
if (onlineUsers.containsKey(u.getAccount()))
return 1;//找到了
return -1;//不存在这个用户,,需要添加
}
public void add(Player player) {
onlineUsers.put(player.getUser().getAccount(), player);
// updateMyUsers(player.getUser().getAccount());//这个时候还没有报错
//通知他的所有所有好友刷新在线用户
}
public Player get(String acc) {
return onlineUsers.get(acc);
}
public void sendToUser(User user, String msg) {
onlineUsers.get(user.getAccount()).sendMessage(msg);
}
public void sendToUser(String acc, String msg) {
if( onlineUsers.get(acc)==null|| !onlineUsers.get(acc).getSession().isOpen())
return;
onlineUsers.get(acc).sendMessage(msg);
}
public int getOnlineCount() {
return onlineUsers.size();
}
public void start(String from,String to){
//p2直接进入游戏 p1收到通知
Player p1=onlineUsers.get(from);
Player p2=onlineUsers.get(to);
p1.setGameControll(gameControll);
p2.setGameControll(gameControll);
p1.getInvite().setP2(p2);//游戏已经开始
}
public void updateUsers() {//清除已经离线的用户
//需要标记 标记为更新好友
List<User> players = new ArrayList<>();
for (Map.Entry<String, Player> m : onlineUsers.entrySet()) {
if (!m.getValue().getSession().isOpen()) {
players.add(m.getValue().getUser());
}//
}
//导致刷新网页,状态无法保持
for (int i = 0; i < players.size(); i++) {//不在线的用户
onlineUsers.remove(players.get(i).getAccount());
updateMyUsers(players.get(i).getAccount());
}
//根据已经掉线用户去通知他自己的好友 //让他的好友进行好友列表刷新 目前就是全部更新
//每次更新时 向他的在线好友好友发送更新信息
}
public void removeUser(WebSocketSession session){
String acc="";
for (Map.Entry<String, Player> m : onlineUsers.entrySet()) {
if(m.getValue().getSession()==session)
{
acc=m.getKey();
}
}
//不能立即被清除 不然导致 数据丢失延时8秒处理 利用player进行计数
int c=onlineUsers.get(acc).getCount();
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if(onlineUsers.get(acc).getCount()==c) {
onlineUsers.remove(acc);//先remove在update
updateMyUsers(acc);//通知他的好友
}
}
public void updateAllUsers() {
for (Map.Entry<String, Player> m : onlineUsers.entrySet()) {
updateFriends(m.getKey());
}
}
public void sengMessage(String from ,String to,String content){
Player p1=onlineUsers.get(from);
Player p2=onlineUsers.get(to);
JSONObject json=new JSONObject();
json.put("op","message");
json.put("from_name",p1.getUser().getUsername());
json.put("content",content);
p2.sendMessage(json.toString());
}
public void invite(String from,String to){
Player p1=onlineUsers.get(from);
Player p2=onlineUsers.get(to);
JSONObject json=new JSONObject();
//p1 或者 p2
if((p1.getInvite()!=null&&!p1.getInvite().isFlag())||p1.isPlaying()||p2.isPlaying()||(p2.getInvite()!=null&&!p2.getInvite().isFlag())||p1.isGameing()||p2.isGameing())
{
//正在游戏的无法进行邀请
json.put("op","failure");
json.put("msg","对方当前正在游戏或者您刚刚邀请了别人,暂时不能进行邀请操作");
p1.sendMessage(json.toString());
return;
}
json.put("op","invite");
json.put("from_name",p1.getUser().getUsername());//被邀请
json.put("from_acc",p1.getUser().getAccount());
p2.sendMessage(json.toString());//发送消息问p2是否同意
p1.setInvite(new Invite(p1));//p1等待p2
//每次都新建Invite对象
}
// public List<User> getOnlineFriend(String acc){
//
// List<User>
//
//
// }
public void updateFriends(String acc) {
//生成JSON数据 需要知道每个好友的account 什么格式发送
//目前是所有在线用户 需要整合好友
List<User> users = friendService.getFriends(acc);
JSONObject json = new JSONObject();
json.put("op", "update");
String str = "";
for (int i = 0; i < users.size(); i++) {
if (onlineUsers.containsKey(users.get(i).getAccount())) {
User u = users.get(i);
if(onlineUsers.get(u.getAccount()).isGameing())
str += u.getUsername() + "|" + u.getAccount() + "|"+u.getImage()+"|正在游戏,";
else{
str+=u.getUsername() + "|" + u.getAccount() + "|"+u.getImage()+"|邀请,";
}
}
}
///System.out.println(users.size());
//好友中的在线好友显示
// for (Map.Entry<String, Player> m : onlineUsers.entrySet()) {
//
//
// }
if (!str.equals("")) {
str = str.substring(0, str.length() - 1);
}
//对str的所有在线好友发送这个消息
json.put("data", str);
sendToUser(acc, json.toString());
}
public void updateMyUsers(String acc){
List<User> users=friendService.getFriends(acc);
//上线需要通知我自己的好友
for(int i=0;i<users.size();i++)
{
updateFriends(users.get(i).getAccount());
}
if(onlineUsers.containsKey(acc))
{
updateFriends(acc);
}
}
//邀请好友 标记邀请成功和邀请失败,,成功则分配房间号,让房间跑起来,用户只需要进入游戏即可
}
| UTF-8 | Java | 7,291 | java | OnlineUserOperator.java | Java | []
| null | []
| package com.poetry.game;
import com.poetry.entity.User;
import com.poetry.service.FriendService;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.socket.WebSocketSession;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
//需要做一个单例出来
@Controller
public class OnlineUserOperator {//更改集合
@Autowired
private FriendService friendService;
private Map<String, Player> onlineUsers = new Hashtable<>(); //存放在线用户 用户对象中需要封装 socket的session
@Autowired
private GameControll gameControll;
public List<User> getOnlineUsers() {
List<User> users = new ArrayList<>();
for (Map.Entry<String, Player> m : onlineUsers.entrySet()) {
users.add(m.getValue().getUser());
}
return users;
}
public void setOnlineUsers(Map<String, Player> onlineUsers) {
this.onlineUsers = onlineUsers;
}
//判断user是否在集合中
public int isExists(User u) {//不存在则进行添加 存在则进行刷新session操作
if (onlineUsers.containsKey(u.getAccount()))
return 1;//找到了
return -1;//不存在这个用户,,需要添加
}
public void add(Player player) {
onlineUsers.put(player.getUser().getAccount(), player);
// updateMyUsers(player.getUser().getAccount());//这个时候还没有报错
//通知他的所有所有好友刷新在线用户
}
public Player get(String acc) {
return onlineUsers.get(acc);
}
public void sendToUser(User user, String msg) {
onlineUsers.get(user.getAccount()).sendMessage(msg);
}
public void sendToUser(String acc, String msg) {
if( onlineUsers.get(acc)==null|| !onlineUsers.get(acc).getSession().isOpen())
return;
onlineUsers.get(acc).sendMessage(msg);
}
public int getOnlineCount() {
return onlineUsers.size();
}
public void start(String from,String to){
//p2直接进入游戏 p1收到通知
Player p1=onlineUsers.get(from);
Player p2=onlineUsers.get(to);
p1.setGameControll(gameControll);
p2.setGameControll(gameControll);
p1.getInvite().setP2(p2);//游戏已经开始
}
public void updateUsers() {//清除已经离线的用户
//需要标记 标记为更新好友
List<User> players = new ArrayList<>();
for (Map.Entry<String, Player> m : onlineUsers.entrySet()) {
if (!m.getValue().getSession().isOpen()) {
players.add(m.getValue().getUser());
}//
}
//导致刷新网页,状态无法保持
for (int i = 0; i < players.size(); i++) {//不在线的用户
onlineUsers.remove(players.get(i).getAccount());
updateMyUsers(players.get(i).getAccount());
}
//根据已经掉线用户去通知他自己的好友 //让他的好友进行好友列表刷新 目前就是全部更新
//每次更新时 向他的在线好友好友发送更新信息
}
public void removeUser(WebSocketSession session){
String acc="";
for (Map.Entry<String, Player> m : onlineUsers.entrySet()) {
if(m.getValue().getSession()==session)
{
acc=m.getKey();
}
}
//不能立即被清除 不然导致 数据丢失延时8秒处理 利用player进行计数
int c=onlineUsers.get(acc).getCount();
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if(onlineUsers.get(acc).getCount()==c) {
onlineUsers.remove(acc);//先remove在update
updateMyUsers(acc);//通知他的好友
}
}
public void updateAllUsers() {
for (Map.Entry<String, Player> m : onlineUsers.entrySet()) {
updateFriends(m.getKey());
}
}
public void sengMessage(String from ,String to,String content){
Player p1=onlineUsers.get(from);
Player p2=onlineUsers.get(to);
JSONObject json=new JSONObject();
json.put("op","message");
json.put("from_name",p1.getUser().getUsername());
json.put("content",content);
p2.sendMessage(json.toString());
}
public void invite(String from,String to){
Player p1=onlineUsers.get(from);
Player p2=onlineUsers.get(to);
JSONObject json=new JSONObject();
//p1 或者 p2
if((p1.getInvite()!=null&&!p1.getInvite().isFlag())||p1.isPlaying()||p2.isPlaying()||(p2.getInvite()!=null&&!p2.getInvite().isFlag())||p1.isGameing()||p2.isGameing())
{
//正在游戏的无法进行邀请
json.put("op","failure");
json.put("msg","对方当前正在游戏或者您刚刚邀请了别人,暂时不能进行邀请操作");
p1.sendMessage(json.toString());
return;
}
json.put("op","invite");
json.put("from_name",p1.getUser().getUsername());//被邀请
json.put("from_acc",p1.getUser().getAccount());
p2.sendMessage(json.toString());//发送消息问p2是否同意
p1.setInvite(new Invite(p1));//p1等待p2
//每次都新建Invite对象
}
// public List<User> getOnlineFriend(String acc){
//
// List<User>
//
//
// }
public void updateFriends(String acc) {
//生成JSON数据 需要知道每个好友的account 什么格式发送
//目前是所有在线用户 需要整合好友
List<User> users = friendService.getFriends(acc);
JSONObject json = new JSONObject();
json.put("op", "update");
String str = "";
for (int i = 0; i < users.size(); i++) {
if (onlineUsers.containsKey(users.get(i).getAccount())) {
User u = users.get(i);
if(onlineUsers.get(u.getAccount()).isGameing())
str += u.getUsername() + "|" + u.getAccount() + "|"+u.getImage()+"|正在游戏,";
else{
str+=u.getUsername() + "|" + u.getAccount() + "|"+u.getImage()+"|邀请,";
}
}
}
///System.out.println(users.size());
//好友中的在线好友显示
// for (Map.Entry<String, Player> m : onlineUsers.entrySet()) {
//
//
// }
if (!str.equals("")) {
str = str.substring(0, str.length() - 1);
}
//对str的所有在线好友发送这个消息
json.put("data", str);
sendToUser(acc, json.toString());
}
public void updateMyUsers(String acc){
List<User> users=friendService.getFriends(acc);
//上线需要通知我自己的好友
for(int i=0;i<users.size();i++)
{
updateFriends(users.get(i).getAccount());
}
if(onlineUsers.containsKey(acc))
{
updateFriends(acc);
}
}
//邀请好友 标记邀请成功和邀请失败,,成功则分配房间号,让房间跑起来,用户只需要进入游戏即可
}
| 7,291 | 0.581276 | 0.573979 | 203 | 30.729065 | 24.42119 | 171 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.635468 | false | false | 15 |
89832c55ac2592ab44d6901e0f3c4ad3337a3354 | 10,041,633,606,533 | 8fc56758d41f46409f16f6c43a9eddc1db1a4a8e | /app/src/main/java/com/whut/umrhamster/graduationproject/model/bean/History.java | 1723725ac6260c8460e14d79a44ea151123d390e | []
| no_license | UMRhamster/GraduationProject | https://github.com/UMRhamster/GraduationProject | a5689515d216b5742ceadbdc528b26d742e5d61d | a2b8a4839077f4204f208cb6c0fb38de115f4f68 | refs/heads/master | 2020-05-16T03:05:31.770000 | 2019-05-31T15:16:36 | 2019-05-31T15:16:36 | 182,649,854 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.whut.umrhamster.graduationproject.model.bean;
import android.os.Parcel;
import android.os.Parcelable;
import java.sql.Timestamp;
import java.util.Date;
public class History implements Parcelable {
// private int id;
// private int contentId;
// private int studentId;
// private int type;
// private int watchedTime; //shipin
// private Date lastTime;
//
//
// private String title;
// private String brief; //shipin
// private String cover;
// private String path;
// private int owner; // /uploader
// private String nickname;
// private int totalTime; //shipin
// private String levelname;
// private int status; //live
private int id;
private int contentId;
private Student student;
private int type;
private int watchedTime;
private Date lastTime;
private Live live;
private Video video;
//时间标志位
private String tag;
public History(String tag){
this.tag = tag;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getContentId() {
return contentId;
}
public void setContentId(int contentId) {
this.contentId = contentId;
}
public Student getStudent() {
return student;
}
public void setStudent(Student student) {
this.student = student;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getWatchedTime() {
return watchedTime;
}
public void setWatchedTime(int watchedTime) {
this.watchedTime = watchedTime;
}
public Date getLastTime() {
return lastTime;
}
public void setLastTime(Date lastTime) {
this.lastTime = lastTime;
}
public Live getLive() {
return live;
}
public void setLive(Live live) {
this.live = live;
}
public Video getVideo() {
return video;
}
public void setVideo(Video video) {
this.video = video;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.id);
dest.writeInt(this.contentId);
dest.writeParcelable(this.student, flags);
dest.writeInt(this.type);
dest.writeInt(this.watchedTime);
dest.writeLong(this.lastTime != null ? this.lastTime.getTime() : -1);
dest.writeParcelable(this.live, flags);
dest.writeParcelable(this.video, flags);
dest.writeString(this.tag);
}
public History() {
}
protected History(Parcel in) {
this.id = in.readInt();
this.contentId = in.readInt();
this.student = in.readParcelable(Student.class.getClassLoader());
this.type = in.readInt();
this.watchedTime = in.readInt();
long tmpLastTime = in.readLong();
this.lastTime = tmpLastTime == -1 ? null : new Date(tmpLastTime);
this.live = in.readParcelable(Live.class.getClassLoader());
this.video = in.readParcelable(Video.class.getClassLoader());
this.tag = in.readString();
}
public static final Parcelable.Creator<History> CREATOR = new Parcelable.Creator<History>() {
@Override
public History createFromParcel(Parcel source) {
return new History(source);
}
@Override
public History[] newArray(int size) {
return new History[size];
}
};
}
| UTF-8 | Java | 3,726 | java | History.java | Java | []
| null | []
| package com.whut.umrhamster.graduationproject.model.bean;
import android.os.Parcel;
import android.os.Parcelable;
import java.sql.Timestamp;
import java.util.Date;
public class History implements Parcelable {
// private int id;
// private int contentId;
// private int studentId;
// private int type;
// private int watchedTime; //shipin
// private Date lastTime;
//
//
// private String title;
// private String brief; //shipin
// private String cover;
// private String path;
// private int owner; // /uploader
// private String nickname;
// private int totalTime; //shipin
// private String levelname;
// private int status; //live
private int id;
private int contentId;
private Student student;
private int type;
private int watchedTime;
private Date lastTime;
private Live live;
private Video video;
//时间标志位
private String tag;
public History(String tag){
this.tag = tag;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getContentId() {
return contentId;
}
public void setContentId(int contentId) {
this.contentId = contentId;
}
public Student getStudent() {
return student;
}
public void setStudent(Student student) {
this.student = student;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getWatchedTime() {
return watchedTime;
}
public void setWatchedTime(int watchedTime) {
this.watchedTime = watchedTime;
}
public Date getLastTime() {
return lastTime;
}
public void setLastTime(Date lastTime) {
this.lastTime = lastTime;
}
public Live getLive() {
return live;
}
public void setLive(Live live) {
this.live = live;
}
public Video getVideo() {
return video;
}
public void setVideo(Video video) {
this.video = video;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.id);
dest.writeInt(this.contentId);
dest.writeParcelable(this.student, flags);
dest.writeInt(this.type);
dest.writeInt(this.watchedTime);
dest.writeLong(this.lastTime != null ? this.lastTime.getTime() : -1);
dest.writeParcelable(this.live, flags);
dest.writeParcelable(this.video, flags);
dest.writeString(this.tag);
}
public History() {
}
protected History(Parcel in) {
this.id = in.readInt();
this.contentId = in.readInt();
this.student = in.readParcelable(Student.class.getClassLoader());
this.type = in.readInt();
this.watchedTime = in.readInt();
long tmpLastTime = in.readLong();
this.lastTime = tmpLastTime == -1 ? null : new Date(tmpLastTime);
this.live = in.readParcelable(Live.class.getClassLoader());
this.video = in.readParcelable(Video.class.getClassLoader());
this.tag = in.readString();
}
public static final Parcelable.Creator<History> CREATOR = new Parcelable.Creator<History>() {
@Override
public History createFromParcel(Parcel source) {
return new History(source);
}
@Override
public History[] newArray(int size) {
return new History[size];
}
};
}
| 3,726 | 0.605759 | 0.604952 | 160 | 22.225 | 18.85005 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.46875 | false | false | 15 |
07ad920be7fcaed947889f4590e0cc5489790d4c | 11,982,958,816,936 | f4f97396215ef7893c9bd5c36890f84e42906345 | /iotope-node/src/main/java/org/iotope/node/reader/ReaderChange.java | 1a41c0deb6aa84c03a7f511745aa91e45e93e1c5 | [
"Apache-2.0"
]
| permissive | alexvanboxel/iotope-node | https://github.com/alexvanboxel/iotope-node | e89bfdfbf33ce27439420f468b632e38d905e18d | 596ff4cec3cccfec8ed2949d42760f9cb8d56274 | refs/heads/master | 2022-12-01T19:02:59.132000 | 2014-06-15T11:36:33 | 2014-06-15T11:36:33 | 3,472,816 | 2 | 0 | null | false | 2022-11-24T02:56:53 | 2012-02-17T18:50:56 | 2014-06-15T11:36:40 | 2022-11-24T02:56:49 | 441 | 6 | 0 | 10 | Java | false | false | package org.iotope.node.reader;
import java.util.Map;
import org.eclipse.jetty.util.ajax.JSON;
import org.eclipse.jetty.util.ajax.JSON.Output;
import org.iotope.pipeline.model.Reader;
public class ReaderChange implements JSON.Convertible {
enum Event {
ADDED, REMOVED
};
@Override
public String toString() {
return "ReaderChange on "+reader+ " : " + event;
}
public ReaderChange(Event event,Reader reader) {
this.event = event;
this.reader = reader;
}
public Event getType() {
return event;
}
@Override
@SuppressWarnings("rawtypes")
public void fromJSON(Map map) {
}
@Override
public void toJSON(Output out) {
out.add("type", "ReaderChange");
out.add("event", event);
out.add("reader", reader);
}
private Event event;
private Reader reader;
}
| UTF-8 | Java | 913 | java | ReaderChange.java | Java | []
| null | []
| package org.iotope.node.reader;
import java.util.Map;
import org.eclipse.jetty.util.ajax.JSON;
import org.eclipse.jetty.util.ajax.JSON.Output;
import org.iotope.pipeline.model.Reader;
public class ReaderChange implements JSON.Convertible {
enum Event {
ADDED, REMOVED
};
@Override
public String toString() {
return "ReaderChange on "+reader+ " : " + event;
}
public ReaderChange(Event event,Reader reader) {
this.event = event;
this.reader = reader;
}
public Event getType() {
return event;
}
@Override
@SuppressWarnings("rawtypes")
public void fromJSON(Map map) {
}
@Override
public void toJSON(Output out) {
out.add("type", "ReaderChange");
out.add("event", event);
out.add("reader", reader);
}
private Event event;
private Reader reader;
}
| 913 | 0.610077 | 0.610077 | 43 | 20.232557 | 16.646582 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.465116 | false | false | 15 |
e4488b561dd3c8249d21047ef64f596f28ef6a95 | 2,190,433,382,231 | 1dbdd2c28a1c32ffd7ffcf0d0e01b28a966fb1ba | /payment-service/src/main/java/com/chong/pay/paymentservice/domain/Exchange.java | 126a545747e7c89abab4cd623d2e28f7015bfa8e | []
| no_license | JahyunBaek/sample-pay-system | https://github.com/JahyunBaek/sample-pay-system | 7f1a71023a29fdb358660608babf7cf9e0ca6e5a | 97a0ed4318ac20f72d2d84aede70c44fcab576dc | refs/heads/main | 2023-03-17T06:38:28.429000 | 2020-11-11T03:54:01 | 2020-11-11T03:54:01 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.chong.pay.paymentservice.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import java.time.LocalDateTime;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Exchange {
public enum EXCHANGE_TYPE{
PAYMENT, SEND
}
@Id
private String paymentId;
private EXCHANGE_TYPE exchangeType;
private String myId;
private String otherId;
private long money; // 음수이면 송금, 양수이면 받음
private LocalDateTime exchangeDate;
private boolean isComplete;
}
| UTF-8 | Java | 651 | java | Exchange.java | Java | []
| null | []
| package com.chong.pay.paymentservice.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import java.time.LocalDateTime;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Exchange {
public enum EXCHANGE_TYPE{
PAYMENT, SEND
}
@Id
private String paymentId;
private EXCHANGE_TYPE exchangeType;
private String myId;
private String otherId;
private long money; // 음수이면 송금, 양수이면 받음
private LocalDateTime exchangeDate;
private boolean isComplete;
}
| 651 | 0.754386 | 0.754386 | 27 | 22.222221 | 14.548345 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.592593 | false | false | 15 |
2fbd28fde08a0586ad4a67b35fd47d50530a8b06 | 35,184,372,098,756 | 6613506a6e21f8c84c31f2048945b2278252a868 | /dao/src/main/java/com/banger/mobile/dao/loan/ibatis/LnRejectCustomerDaoiBatis.java | 5561362ce0cd80b3c12564192eb78308d3c204e5 | []
| no_license | ephonsun/mircredit | https://github.com/ephonsun/mircredit | eda42e26c6a73dedea4595e20a5dcff15e5f2897 | fca00ad705fc571064000fb77388142765630702 | refs/heads/master | 2020-04-17T03:44:24.272000 | 2018-12-19T12:40:18 | 2018-12-19T12:40:18 | 166,198,506 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.banger.mobile.dao.loan.ibatis;
import com.banger.mobile.Page;
import com.banger.mobile.PageUtil;
import com.banger.mobile.dao.loan.LnRejectCustomerDao;
import com.banger.mobile.domain.model.loan.LnRejectCustomer;
import com.banger.mobile.ibatis.GenericDaoiBatis;
import com.banger.mobile.util.StringUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by BH-TCL on 14-12-3.
*/
public class LnRejectCustomerDaoiBatis extends GenericDaoiBatis implements LnRejectCustomerDao {
public LnRejectCustomerDaoiBatis(){
super(LnRejectCustomer.class);
}
public LnRejectCustomerDaoiBatis(Class persistentClass){
super(persistentClass);
}
@Override
public void addLnRejectCustomer(LnRejectCustomer lnRejectCustomer) {
this.getSqlMapClientTemplate().insert("insertLnRejectCustomer",lnRejectCustomer);
}
@Override
public void updateLnRejectCustomer(LnRejectCustomer lnRejectCustomer) {
this.getSqlMapClientTemplate().update("updateLnRejectCustomer",lnRejectCustomer);
}
@Override
public PageUtil<LnRejectCustomer> queryLnRejectCustomerPage(Map<String, Object> conds, Page curPage) {
Map<String, Object> fConds = new HashMap<String, Object>();
for (Map.Entry<String, Object> entry : conds.entrySet()) {
if (entry.getValue() instanceof String) {
fConds.put(entry.getKey(), StringUtil.ReplaceSQLEscapeChar(StringUtil
.ReplaceSQLChar(entry.getValue().toString())));
} else {
fConds.put(entry.getKey(), entry.getValue());
}
}
List<LnRejectCustomer> list = (List<LnRejectCustomer>) this.findQueryPage("queryLnRejectCustomerPage", "queryLnRejectCustomerCount",
fConds, curPage);
return new PageUtil<LnRejectCustomer>(list, curPage);
}
/**
* 根据ID集合获取记录集
* @param map
* @return
*/
@Override
public List<LnRejectCustomer> queryRejectCustomerByIds(Map<String, Object> map) {
return this.getSqlMapClientTemplate().queryForList("queryRejectCustomerByIds",map);
}
}
| UTF-8 | Java | 2,191 | java | LnRejectCustomerDaoiBatis.java | Java | [
{
"context": "til.List;\nimport java.util.Map;\n\n/**\n * Created by BH-TCL on 14-12-3.\n */\npublic class LnRejectCustomerDaoi",
"end": 415,
"score": 0.9996235966682434,
"start": 409,
"tag": "USERNAME",
"value": "BH-TCL"
}
]
| null | []
| package com.banger.mobile.dao.loan.ibatis;
import com.banger.mobile.Page;
import com.banger.mobile.PageUtil;
import com.banger.mobile.dao.loan.LnRejectCustomerDao;
import com.banger.mobile.domain.model.loan.LnRejectCustomer;
import com.banger.mobile.ibatis.GenericDaoiBatis;
import com.banger.mobile.util.StringUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by BH-TCL on 14-12-3.
*/
public class LnRejectCustomerDaoiBatis extends GenericDaoiBatis implements LnRejectCustomerDao {
public LnRejectCustomerDaoiBatis(){
super(LnRejectCustomer.class);
}
public LnRejectCustomerDaoiBatis(Class persistentClass){
super(persistentClass);
}
@Override
public void addLnRejectCustomer(LnRejectCustomer lnRejectCustomer) {
this.getSqlMapClientTemplate().insert("insertLnRejectCustomer",lnRejectCustomer);
}
@Override
public void updateLnRejectCustomer(LnRejectCustomer lnRejectCustomer) {
this.getSqlMapClientTemplate().update("updateLnRejectCustomer",lnRejectCustomer);
}
@Override
public PageUtil<LnRejectCustomer> queryLnRejectCustomerPage(Map<String, Object> conds, Page curPage) {
Map<String, Object> fConds = new HashMap<String, Object>();
for (Map.Entry<String, Object> entry : conds.entrySet()) {
if (entry.getValue() instanceof String) {
fConds.put(entry.getKey(), StringUtil.ReplaceSQLEscapeChar(StringUtil
.ReplaceSQLChar(entry.getValue().toString())));
} else {
fConds.put(entry.getKey(), entry.getValue());
}
}
List<LnRejectCustomer> list = (List<LnRejectCustomer>) this.findQueryPage("queryLnRejectCustomerPage", "queryLnRejectCustomerCount",
fConds, curPage);
return new PageUtil<LnRejectCustomer>(list, curPage);
}
/**
* 根据ID集合获取记录集
* @param map
* @return
*/
@Override
public List<LnRejectCustomer> queryRejectCustomerByIds(Map<String, Object> map) {
return this.getSqlMapClientTemplate().queryForList("queryRejectCustomerByIds",map);
}
}
| 2,191 | 0.701795 | 0.699494 | 61 | 34.622952 | 33.499775 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.57377 | false | false | 15 |
43da569c7f09a0e91eaa212bf970e61f8a80d341 | 18,451,179,546,413 | 721fa7168a249ca56ea44df4a746440c72f4983c | /src/pack_001/GameLevel.java | a165db8b2ded89e442c90e3496dfeb5f3cdf3d7e | []
| no_license | rockpell/LastWar | https://github.com/rockpell/LastWar | 10f4a80e19777a3868a9ec230787d8e4b7c53dad | 38a6afd6c8edf3ce1b1bcfffa36d2174de7ad334 | refs/heads/master | 2020-06-09T01:14:43.190000 | 2019-12-04T09:04:38 | 2019-12-04T09:04:38 | 38,497,579 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pack_001;
import java.awt.Point;
import java.util.ArrayList;
import java.util.Map;
final class GameLevel
{
private GameManager gameManager;
private DataManager dm;
private Map<String, ArrayList<String>> sequenceData;
private int nowSequence = 0;
private int patternIndex = 0, cumulativePartternIndex = 0;
private int mode_type = 0;
private boolean levelUp = true, refresh = false, patternChange = false;
private String patternName = null;
public GameLevel(int type)
{
gameManager = GameManager.getInstance();
dm = DataManager.getInstance();
mode_type = type;
if (type == 0)
{
sequenceData = dm.getScenario().getSequenceData();
}
else if (type == 1)
{
sequenceData = dm.getScenario().getSequenceData2();
}
patternName = sequenceData.get("1").get(0);
// patternParser(0);
}
public void init()
{
nowSequence = 0;
patternIndex = 1;
levelUp = true;
refresh = false;
patternChange = false;
patternName = sequenceData.get("1").get(0);
}
public void levelStart()
{
if (levelUp)
{
if (nowSequence != 0)
patternChange = true;
nowSequence += 1;
levelUp = false;
System.out.println("nowSequence : " + nowSequence);
if (nowSequence > sequenceData.size())
{
if (mode_type == 0)
{
dm.getPlayer().dead();
return;
}
else
{
nowSequence = 1;
}
}
}
if (refresh)
{
refresh = false;
patternChange = true;
}
if (patternChange)
{
ArrayList<String> tempList = sequenceData.get("" + nowSequence);
patternChange = false;
patternIndex += 1;
cumulativePartternIndex += 1;
if (tempList.size() <= patternIndex)
{
patternIndex = -1;
levelUp = true;
return;
}
patternName = tempList.get(patternIndex);
System.out.println("patternName : " + patternName);
gameManager.refreshLevelStartTime();
}
patternParse();
}
private void patternParse()
{
Map<String, ArrayList<Point>> patternMap = null;
int time = gameManager.getPlayTime();
int itime = gameManager.getLevelStartTime();
String timeText = "" + (time - itime);
patternMap = dm.getScenario().getPatternData().get(patternName).getMap();
if (patternMap.containsKey(timeText))
{
ArrayList<Point> tempList = patternMap.get(timeText);
if (tempList.size() == 0)
{
refresh = true;
}
for (int i = 0; i < tempList.size(); i++)
{
Point tempPoint = tempList.get(i);
if (tempPoint.x == 99 && tempPoint.y == 99)
{
new Enemy(3);
}
else if (tempPoint.x == 99 && tempPoint.y == 100)
{
new Enemy(4);
}
else if (tempPoint.x == 99 && tempPoint.y == 101)
{
new Enemy(5);
}
else if (tempPoint.x == 100 && tempPoint.y == 99)
{
new BossEnemy(0);
}
else
{
new Laser(tempPoint.x, tempPoint.y);
}
}
}
}
public int getMode()
{
return mode_type;
}
public int getCumulativePartternIndex()
{
return cumulativePartternIndex;
}
} | UTF-8 | Java | 2,980 | java | GameLevel.java | Java | []
| null | []
| package pack_001;
import java.awt.Point;
import java.util.ArrayList;
import java.util.Map;
final class GameLevel
{
private GameManager gameManager;
private DataManager dm;
private Map<String, ArrayList<String>> sequenceData;
private int nowSequence = 0;
private int patternIndex = 0, cumulativePartternIndex = 0;
private int mode_type = 0;
private boolean levelUp = true, refresh = false, patternChange = false;
private String patternName = null;
public GameLevel(int type)
{
gameManager = GameManager.getInstance();
dm = DataManager.getInstance();
mode_type = type;
if (type == 0)
{
sequenceData = dm.getScenario().getSequenceData();
}
else if (type == 1)
{
sequenceData = dm.getScenario().getSequenceData2();
}
patternName = sequenceData.get("1").get(0);
// patternParser(0);
}
public void init()
{
nowSequence = 0;
patternIndex = 1;
levelUp = true;
refresh = false;
patternChange = false;
patternName = sequenceData.get("1").get(0);
}
public void levelStart()
{
if (levelUp)
{
if (nowSequence != 0)
patternChange = true;
nowSequence += 1;
levelUp = false;
System.out.println("nowSequence : " + nowSequence);
if (nowSequence > sequenceData.size())
{
if (mode_type == 0)
{
dm.getPlayer().dead();
return;
}
else
{
nowSequence = 1;
}
}
}
if (refresh)
{
refresh = false;
patternChange = true;
}
if (patternChange)
{
ArrayList<String> tempList = sequenceData.get("" + nowSequence);
patternChange = false;
patternIndex += 1;
cumulativePartternIndex += 1;
if (tempList.size() <= patternIndex)
{
patternIndex = -1;
levelUp = true;
return;
}
patternName = tempList.get(patternIndex);
System.out.println("patternName : " + patternName);
gameManager.refreshLevelStartTime();
}
patternParse();
}
private void patternParse()
{
Map<String, ArrayList<Point>> patternMap = null;
int time = gameManager.getPlayTime();
int itime = gameManager.getLevelStartTime();
String timeText = "" + (time - itime);
patternMap = dm.getScenario().getPatternData().get(patternName).getMap();
if (patternMap.containsKey(timeText))
{
ArrayList<Point> tempList = patternMap.get(timeText);
if (tempList.size() == 0)
{
refresh = true;
}
for (int i = 0; i < tempList.size(); i++)
{
Point tempPoint = tempList.get(i);
if (tempPoint.x == 99 && tempPoint.y == 99)
{
new Enemy(3);
}
else if (tempPoint.x == 99 && tempPoint.y == 100)
{
new Enemy(4);
}
else if (tempPoint.x == 99 && tempPoint.y == 101)
{
new Enemy(5);
}
else if (tempPoint.x == 100 && tempPoint.y == 99)
{
new BossEnemy(0);
}
else
{
new Laser(tempPoint.x, tempPoint.y);
}
}
}
}
public int getMode()
{
return mode_type;
}
public int getCumulativePartternIndex()
{
return cumulativePartternIndex;
}
} | 2,980 | 0.626175 | 0.609732 | 159 | 17.748428 | 18.292854 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.515723 | false | false | 15 |
6dd0a99f2c5b4c1d3ca5a9b7ec1a2666f5aa913b | 33,097,018,002,081 | ce55e10448040cf27b4abccc9fb2b46e83ffb434 | /trunk/datareports/datareports-web/src/test/java/gov/nih/nci/ncicb/tcga/dcc/datareports/dao/CodeTablesReportDAOImplSlowTest.java | 84295c0bd9d4db93b2a5fcee75244726dffa8b18 | []
| no_license | NCIP/tcga-sandbox-v1 | https://github.com/NCIP/tcga-sandbox-v1 | 0518dee6ee9e31a48c6ebddd1c10d20dca33c898 | c8230c07199ddaf9d69564480ff9124782525cf5 | refs/heads/master | 2021-01-19T04:07:08.906000 | 2013-05-29T18:00:15 | 2013-05-29T18:00:15 | 87,348,860 | 1 | 7 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Software License, Version 1.0 Copyright 2011 SRA International, Inc.
* Copyright Notice. The software subject to this notice and license includes both human
* readable source code form and machine readable, binary, object code form (the "caBIG
* Software").
*
* Please refer to the complete License text for full details at the root of the project.
*/
package gov.nih.nci.ncicb.tcga.dcc.datareports.dao;
import gov.nih.nci.ncicb.tcga.dcc.common.bean.SampleType;
import gov.nih.nci.ncicb.tcga.dcc.common.bean.Tumor;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.BcrBatchCode;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.CenterCode;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.CodeReport;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.DataType;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.PlatformCode;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.Tissue;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.TissueSourceSite;
import gov.nih.nci.ncicb.tcga.dcc.datareports.dao.jdbc.CodeTablesReportDAOImpl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Test class for the code table report dao layer
*
* @author Dominique Berton Last updated by: $Author$
* @version $Rev$
*/
public class CodeTablesReportDAOImplSlowTest extends DatareportDBUnitConfig {
public void testGetTissueSourceSite() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<TissueSourceSite> allRows = impl.getTissueSourceSite();
assertNotNull(allRows);
assertEquals(3, allRows.size());
assertEquals("Glioblastoma multiforme (GBM)", allRows.get(0).getStudyName());
assertEquals("Cell Line Control", allRows.get(1).getStudyName());
assertEquals("07", allRows.get(1).getCode());
assertEquals("AA", allRows.get(2).getCode());
}
public void testGetCenterCode() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<CenterCode> allRows = impl.getCenterCode();
assertNotNull(allRows);
assertEquals(10, allRows.size());
assertEquals("BI", allRows.get(0).getShortName());
assertEquals("lbl.gov", allRows.get(2).getCenterName());
assertEquals("05", allRows.get(4).getCode());
}
public void testGetDataLevel() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<CodeReport> allRows = impl.getDataLevel();
assertNotNull(allRows);
assertEquals(4, allRows.size());
String[] testDataDefinitions = {"Raw data", "Normalized data", "Aggregated data", "Regions of Interest data"};
List<String> dataDefinitions = new ArrayList();
for (final CodeReport codeReport : allRows) {
dataDefinitions.add(codeReport.getDefinition());
}
assertTrue(dataDefinitions.containsAll(Arrays.asList(testDataDefinitions)));
}
public void testGetDataType() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<DataType> allRows = impl.getDataType();
assertNotNull(allRows);
assertEquals(14, allRows.size());
assertEquals("Expression-Genes", allRows.get(0).getDisplayName());
}
public void testGetDisease() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<Tumor> allRows = impl.getTumor();
assertNotNull(allRows);
assertEquals(8, allRows.size());
String[] testDiseaseNames = {"GBM", "LUAD", "BRDC", "BRLC", "OV", "KIRC", "LUSC", "KIRP"};
List<String> diseaseNames = new ArrayList();
for (final Tumor disease : allRows) {
diseaseNames.add(disease.getTumorName());
}
assertTrue(diseaseNames.containsAll(Arrays.asList(testDiseaseNames)));
}
public void testGetPlatformCode() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<PlatformCode> allRows = impl.getPlatformCode();
assertNotNull(allRows);
assertEquals(35, allRows.size());
assertEquals("HG-U133_Plus_2", allRows.get(1).getPlatformAlias());
assertEquals("IlluminaGG", allRows.get(21).getPlatformName());
}
public void testGetPortionAnalyte() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<CodeReport> allRows = impl.getPortionAnalyte();
assertNotNull(allRows);
assertEquals(5, allRows.size());
assertEquals("DNA", allRows.get(0).getDefinition());
}
public void testGetSampleType() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<SampleType> allRows = impl.getSampleType();
assertNotNull(allRows);
assertEquals(1, allRows.size());
assertEquals("solid tumor", allRows.get(0).getDefinition());
assertEquals("01", allRows.get(0).getSampleTypeCode());
assertEquals("TP", allRows.get(0).getShortLetterCode());
}
public void testGetTissue() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<Tissue> allRows = impl.getTissue();
assertNotNull(allRows);
assertEquals(1, allRows.size());
assertEquals("brain", allRows.get(0).getTissue());
}
public void testGetBcrBatchCode() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<BcrBatchCode> allRows = impl.getBcrBatchCode();
assertNotNull(allRows);
assertEquals(8, allRows.size());
assertEquals("1", allRows.get(0).getBcrBatch());
assertEquals("BCR", allRows.get(5).getBcr());
}
}//End of class
| UTF-8 | Java | 6,403 | java | CodeTablesReportDAOImplSlowTest.java | Java | [
{
"context": "or the code table report dao layer\r\n *\r\n * @author Dominique Berton Last updated by: $Author$\r\n * @version $Rev$\r\n */",
"end": 1246,
"score": 0.9998729228973389,
"start": 1230,
"tag": "NAME",
"value": "Dominique Berton"
}
]
| null | []
| /*
* Software License, Version 1.0 Copyright 2011 SRA International, Inc.
* Copyright Notice. The software subject to this notice and license includes both human
* readable source code form and machine readable, binary, object code form (the "caBIG
* Software").
*
* Please refer to the complete License text for full details at the root of the project.
*/
package gov.nih.nci.ncicb.tcga.dcc.datareports.dao;
import gov.nih.nci.ncicb.tcga.dcc.common.bean.SampleType;
import gov.nih.nci.ncicb.tcga.dcc.common.bean.Tumor;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.BcrBatchCode;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.CenterCode;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.CodeReport;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.DataType;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.PlatformCode;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.Tissue;
import gov.nih.nci.ncicb.tcga.dcc.datareports.bean.TissueSourceSite;
import gov.nih.nci.ncicb.tcga.dcc.datareports.dao.jdbc.CodeTablesReportDAOImpl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Test class for the code table report dao layer
*
* @author <NAME> Last updated by: $Author$
* @version $Rev$
*/
public class CodeTablesReportDAOImplSlowTest extends DatareportDBUnitConfig {
public void testGetTissueSourceSite() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<TissueSourceSite> allRows = impl.getTissueSourceSite();
assertNotNull(allRows);
assertEquals(3, allRows.size());
assertEquals("Glioblastoma multiforme (GBM)", allRows.get(0).getStudyName());
assertEquals("Cell Line Control", allRows.get(1).getStudyName());
assertEquals("07", allRows.get(1).getCode());
assertEquals("AA", allRows.get(2).getCode());
}
public void testGetCenterCode() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<CenterCode> allRows = impl.getCenterCode();
assertNotNull(allRows);
assertEquals(10, allRows.size());
assertEquals("BI", allRows.get(0).getShortName());
assertEquals("lbl.gov", allRows.get(2).getCenterName());
assertEquals("05", allRows.get(4).getCode());
}
public void testGetDataLevel() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<CodeReport> allRows = impl.getDataLevel();
assertNotNull(allRows);
assertEquals(4, allRows.size());
String[] testDataDefinitions = {"Raw data", "Normalized data", "Aggregated data", "Regions of Interest data"};
List<String> dataDefinitions = new ArrayList();
for (final CodeReport codeReport : allRows) {
dataDefinitions.add(codeReport.getDefinition());
}
assertTrue(dataDefinitions.containsAll(Arrays.asList(testDataDefinitions)));
}
public void testGetDataType() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<DataType> allRows = impl.getDataType();
assertNotNull(allRows);
assertEquals(14, allRows.size());
assertEquals("Expression-Genes", allRows.get(0).getDisplayName());
}
public void testGetDisease() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<Tumor> allRows = impl.getTumor();
assertNotNull(allRows);
assertEquals(8, allRows.size());
String[] testDiseaseNames = {"GBM", "LUAD", "BRDC", "BRLC", "OV", "KIRC", "LUSC", "KIRP"};
List<String> diseaseNames = new ArrayList();
for (final Tumor disease : allRows) {
diseaseNames.add(disease.getTumorName());
}
assertTrue(diseaseNames.containsAll(Arrays.asList(testDiseaseNames)));
}
public void testGetPlatformCode() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<PlatformCode> allRows = impl.getPlatformCode();
assertNotNull(allRows);
assertEquals(35, allRows.size());
assertEquals("HG-U133_Plus_2", allRows.get(1).getPlatformAlias());
assertEquals("IlluminaGG", allRows.get(21).getPlatformName());
}
public void testGetPortionAnalyte() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<CodeReport> allRows = impl.getPortionAnalyte();
assertNotNull(allRows);
assertEquals(5, allRows.size());
assertEquals("DNA", allRows.get(0).getDefinition());
}
public void testGetSampleType() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<SampleType> allRows = impl.getSampleType();
assertNotNull(allRows);
assertEquals(1, allRows.size());
assertEquals("solid tumor", allRows.get(0).getDefinition());
assertEquals("01", allRows.get(0).getSampleTypeCode());
assertEquals("TP", allRows.get(0).getShortLetterCode());
}
public void testGetTissue() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<Tissue> allRows = impl.getTissue();
assertNotNull(allRows);
assertEquals(1, allRows.size());
assertEquals("brain", allRows.get(0).getTissue());
}
public void testGetBcrBatchCode() throws Exception {
CodeTablesReportDAOImpl impl = new CodeTablesReportDAOImpl();
impl.setDataSource(getDataSource());
List<BcrBatchCode> allRows = impl.getBcrBatchCode();
assertNotNull(allRows);
assertEquals(8, allRows.size());
assertEquals("1", allRows.get(0).getBcrBatch());
assertEquals("BCR", allRows.get(5).getBcr());
}
}//End of class
| 6,393 | 0.675777 | 0.66828 | 143 | 42.776222 | 26.579191 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.909091 | false | false | 15 |
6b4f92262cc0eda069af9cd830499cc3141251d3 | 27,994,596,889,881 | bc55d7d928d3c6ba0dc72cdc969c3e69427d9f2d | /app/src/main/java/com/example/tryretrofitlogin/postresponse/addReqlelangtoadmin/Success.java | d1d841b87b2363918bc8dd4ce01938ac5e596a91 | []
| no_license | galangsur/TryRetrofitLogin | https://github.com/galangsur/TryRetrofitLogin | c4bce48190063428b5458acb4c977c276258cd62 | 62d0b87a05dabd04ebc973e0027c3c5711327380 | refs/heads/master | 2023-06-28T18:18:11.580000 | 2021-08-04T09:33:57 | 2021-08-04T09:33:57 | 256,243,465 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.tryretrofitlogin.postresponse.addReqlelangtoadmin;
import com.google.gson.annotations.SerializedName;
public class Success{
@SerializedName("sertifparent_token")
private String sertifparentToken;
@SerializedName("req_nominalperbid")
private String reqNominalperbid;
@SerializedName("harga")
private String harga;
@SerializedName("updated_at")
private String updatedAt;
@SerializedName("user_id")
private String userId;
@SerializedName("imgparent_token")
private String imgparentToken;
@SerializedName("hewan_id")
private String hewanId;
@SerializedName("created_at")
private String createdAt;
@SerializedName("comment")
private String comment;
@SerializedName("umur_hewan")
private String umur_hewan;
@SerializedName("jeniskelamin_hewan")
private String jeniskelamin_hewan;
@SerializedName("warna_hewan")
private String warna_hewan;
@SerializedName("img_lelang")
private String imgLelang;
@SerializedName("req_waktuperbid")
private String reqWaktuperbid;
@SerializedName("id")
private int id;
@SerializedName("pesertaonline_token")
private String pesertaonline_token;
public String getPesertaonline_token() {
return pesertaonline_token;
}
public void setPesertaonline_token(String pesertaonline_token) {
this.pesertaonline_token = pesertaonline_token;
}
public String getUmur_hewan() {
return umur_hewan;
}
public void setUmur_hewan(String umur_hewan) {
this.umur_hewan = umur_hewan;
}
public String getJeniskelamin_hewan() {
return jeniskelamin_hewan;
}
public void setJeniskelamin_hewan(String jeniskelamin_hewan) {
this.jeniskelamin_hewan = jeniskelamin_hewan;
}
public String getWarna_hewan() {
return warna_hewan;
}
public void setWarna_hewan(String warna_hewan) {
this.warna_hewan = warna_hewan;
}
public void setSertifparentToken(String sertifparentToken){
this.sertifparentToken = sertifparentToken;
}
public String getSertifparentToken(){
return sertifparentToken;
}
public void setReqNominalperbid(String reqNominalperbid){
this.reqNominalperbid = reqNominalperbid;
}
public String getReqNominalperbid(){
return reqNominalperbid;
}
public void setHarga(String harga){
this.harga = harga;
}
public String getHarga(){
return harga;
}
public void setUpdatedAt(String updatedAt){
this.updatedAt = updatedAt;
}
public String getUpdatedAt(){
return updatedAt;
}
public void setUserId(String userId){
this.userId = userId;
}
public String getUserId(){
return userId;
}
public void setImgparentToken(String imgparentToken){
this.imgparentToken = imgparentToken;
}
public String getImgparentToken(){
return imgparentToken;
}
public void setHewanId(String hewanId){
this.hewanId = hewanId;
}
public String getHewanId(){
return hewanId;
}
public void setCreatedAt(String createdAt){
this.createdAt = createdAt;
}
public String getCreatedAt(){
return createdAt;
}
public void setComment(String comment){
this.comment = comment;
}
public String getComment(){
return comment;
}
public void setImgLelang(String imgLelang){
this.imgLelang = imgLelang;
}
public String getImgLelang(){
return imgLelang;
}
public void setReqWaktuperbid(String reqWaktuperbid){
this.reqWaktuperbid = reqWaktuperbid;
}
public String getReqWaktuperbid(){
return reqWaktuperbid;
}
public void setId(int id){
this.id = id;
}
public int getId(){
return id;
}
@Override
public String toString(){
return
"Success{" +
"sertifparent_token = '" + sertifparentToken + '\'' +
",req_nominalperbid = '" + reqNominalperbid + '\'' +
",harga = '" + harga + '\'' +
",updated_at = '" + updatedAt + '\'' +
",user_id = '" + userId + '\'' +
",imgparent_token = '" + imgparentToken + '\'' +
",hewan_id = '" + hewanId + '\'' +
",created_at = '" + createdAt + '\'' +
",comment = '" + comment + '\'' +
",img_lelang = '" + imgLelang + '\'' +
",req_waktuperbid = '" + reqWaktuperbid + '\'' +
",id = '" + id + '\'' +
"}";
}
} | UTF-8 | Java | 4,064 | java | Success.java | Java | []
| null | []
| package com.example.tryretrofitlogin.postresponse.addReqlelangtoadmin;
import com.google.gson.annotations.SerializedName;
public class Success{
@SerializedName("sertifparent_token")
private String sertifparentToken;
@SerializedName("req_nominalperbid")
private String reqNominalperbid;
@SerializedName("harga")
private String harga;
@SerializedName("updated_at")
private String updatedAt;
@SerializedName("user_id")
private String userId;
@SerializedName("imgparent_token")
private String imgparentToken;
@SerializedName("hewan_id")
private String hewanId;
@SerializedName("created_at")
private String createdAt;
@SerializedName("comment")
private String comment;
@SerializedName("umur_hewan")
private String umur_hewan;
@SerializedName("jeniskelamin_hewan")
private String jeniskelamin_hewan;
@SerializedName("warna_hewan")
private String warna_hewan;
@SerializedName("img_lelang")
private String imgLelang;
@SerializedName("req_waktuperbid")
private String reqWaktuperbid;
@SerializedName("id")
private int id;
@SerializedName("pesertaonline_token")
private String pesertaonline_token;
public String getPesertaonline_token() {
return pesertaonline_token;
}
public void setPesertaonline_token(String pesertaonline_token) {
this.pesertaonline_token = pesertaonline_token;
}
public String getUmur_hewan() {
return umur_hewan;
}
public void setUmur_hewan(String umur_hewan) {
this.umur_hewan = umur_hewan;
}
public String getJeniskelamin_hewan() {
return jeniskelamin_hewan;
}
public void setJeniskelamin_hewan(String jeniskelamin_hewan) {
this.jeniskelamin_hewan = jeniskelamin_hewan;
}
public String getWarna_hewan() {
return warna_hewan;
}
public void setWarna_hewan(String warna_hewan) {
this.warna_hewan = warna_hewan;
}
public void setSertifparentToken(String sertifparentToken){
this.sertifparentToken = sertifparentToken;
}
public String getSertifparentToken(){
return sertifparentToken;
}
public void setReqNominalperbid(String reqNominalperbid){
this.reqNominalperbid = reqNominalperbid;
}
public String getReqNominalperbid(){
return reqNominalperbid;
}
public void setHarga(String harga){
this.harga = harga;
}
public String getHarga(){
return harga;
}
public void setUpdatedAt(String updatedAt){
this.updatedAt = updatedAt;
}
public String getUpdatedAt(){
return updatedAt;
}
public void setUserId(String userId){
this.userId = userId;
}
public String getUserId(){
return userId;
}
public void setImgparentToken(String imgparentToken){
this.imgparentToken = imgparentToken;
}
public String getImgparentToken(){
return imgparentToken;
}
public void setHewanId(String hewanId){
this.hewanId = hewanId;
}
public String getHewanId(){
return hewanId;
}
public void setCreatedAt(String createdAt){
this.createdAt = createdAt;
}
public String getCreatedAt(){
return createdAt;
}
public void setComment(String comment){
this.comment = comment;
}
public String getComment(){
return comment;
}
public void setImgLelang(String imgLelang){
this.imgLelang = imgLelang;
}
public String getImgLelang(){
return imgLelang;
}
public void setReqWaktuperbid(String reqWaktuperbid){
this.reqWaktuperbid = reqWaktuperbid;
}
public String getReqWaktuperbid(){
return reqWaktuperbid;
}
public void setId(int id){
this.id = id;
}
public int getId(){
return id;
}
@Override
public String toString(){
return
"Success{" +
"sertifparent_token = '" + sertifparentToken + '\'' +
",req_nominalperbid = '" + reqNominalperbid + '\'' +
",harga = '" + harga + '\'' +
",updated_at = '" + updatedAt + '\'' +
",user_id = '" + userId + '\'' +
",imgparent_token = '" + imgparentToken + '\'' +
",hewan_id = '" + hewanId + '\'' +
",created_at = '" + createdAt + '\'' +
",comment = '" + comment + '\'' +
",img_lelang = '" + imgLelang + '\'' +
",req_waktuperbid = '" + reqWaktuperbid + '\'' +
",id = '" + id + '\'' +
"}";
}
} | 4,064 | 0.707677 | 0.707677 | 201 | 19.223881 | 18.308432 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.343284 | false | false | 15 |
57bb81f374f83248d34430db69fb6cd2f8db4a55 | 24,927,990,239,531 | 174815bfc68d7b632dc67e6dce4caab16afdbba4 | /Intro To Programming/Chapter4/src/RomanNumerals.java | ac9d3ff86e24439dbaddacc8e7b0f770a0d9cca1 | []
| no_license | jester155/ClassWork | https://github.com/jester155/ClassWork | e81727ee938c0eca83597c7ebcd3fdf91a1e01fb | a2ba07eed0b45a46555c287374f03b1bb82a7a46 | refs/heads/master | 2016-08-04T15:00:40.222000 | 2013-03-23T00:51:52 | 2013-03-23T00:51:52 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
Mark Provenzano
COP1000
Chapter 4 Exercise 1
Roman Numerals
*/
import java.util.Scanner;
public class RomanNumerals {
public static Scanner scan = new Scanner( System.in );
public static void main( String[] args ) {
System.out.println( "Enter a number 1-10" );
int x = scan.nextInt();
convertNumber(x);
}
private static void convertNumber( int y ) { //converts a number 1-10 into a Roman numeral
if( y == 1 ) {
System.out.println( "The Roman Numeral is I" );
}
else if( y == 2 ) {
System.out.println( "The Roman Numeral is II" );
}
else if( y == 3 ) {
System.out.println( "The Roman Numeral is III" );
}
else if( y == 4 ) {
System.out.println( "The Roman Numeral is IV" );
}
else if( y == 5 ) {
System.out.println( "The Roman Numeral is V" );
}
else if( y == 6 ) {
System.out.println( "The Roman Numeral is VI" );
}
else if( y == 7 ) {
System.out.println( "The Roman Numeral is VII" );
}
else if( y == 8 ) {
System.out.println( "The Roman Numeral is VIII" );
}
else if( y == 9 ) {
System.out.println( "The Roman Numeral is IX" );
}
else if( y == 10 ) {
System.out.println( "The Roman Numeral is X" );
}
else {
System.out.println( "You have entered an invalid number" );
}
}
} | UTF-8 | Java | 1,283 | java | RomanNumerals.java | Java | [
{
"context": "/*\nMark Provenzano\nCOP1000\nChapter 4 Exercise 1\nRoman Numerals\n*/\n\ni",
"end": 18,
"score": 0.9998623132705688,
"start": 3,
"tag": "NAME",
"value": "Mark Provenzano"
}
]
| null | []
| /*
<NAME>
COP1000
Chapter 4 Exercise 1
Roman Numerals
*/
import java.util.Scanner;
public class RomanNumerals {
public static Scanner scan = new Scanner( System.in );
public static void main( String[] args ) {
System.out.println( "Enter a number 1-10" );
int x = scan.nextInt();
convertNumber(x);
}
private static void convertNumber( int y ) { //converts a number 1-10 into a Roman numeral
if( y == 1 ) {
System.out.println( "The Roman Numeral is I" );
}
else if( y == 2 ) {
System.out.println( "The Roman Numeral is II" );
}
else if( y == 3 ) {
System.out.println( "The Roman Numeral is III" );
}
else if( y == 4 ) {
System.out.println( "The Roman Numeral is IV" );
}
else if( y == 5 ) {
System.out.println( "The Roman Numeral is V" );
}
else if( y == 6 ) {
System.out.println( "The Roman Numeral is VI" );
}
else if( y == 7 ) {
System.out.println( "The Roman Numeral is VII" );
}
else if( y == 8 ) {
System.out.println( "The Roman Numeral is VIII" );
}
else if( y == 9 ) {
System.out.println( "The Roman Numeral is IX" );
}
else if( y == 10 ) {
System.out.println( "The Roman Numeral is X" );
}
else {
System.out.println( "You have entered an invalid number" );
}
}
} | 1,274 | 0.602494 | 0.584567 | 57 | 21.526316 | 21.648796 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.982456 | false | false | 15 |
86a91b8da18a61a3bdf9165daec055f7e7fcfe0a | 10,909,217,000,345 | b39e1ccef276e62964860a707b4918ad90e0f327 | /src/main/java/ru/x5javacourse/hw5/Computer/VideoCard/VideoCard.java | 6372d39bb363acdb12efe7fab2e75e5ffcac851a | []
| no_license | taranovakn/javacoursex5 | https://github.com/taranovakn/javacoursex5 | 3ec3d5df4b98807988e6c9fac33304e338f89a7d | c382a9da64096548039521187f8aec129ac5c6b6 | refs/heads/master | 2023-01-03T05:20:02.866000 | 2020-10-30T12:17:14 | 2020-10-30T12:17:14 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.x5javacourse.hw5.Computer.VideoCard;
import ru.x5javacourse.hw5.Computer.Component;
public class VideoCard implements Component {
private String videoCardManufacturer;
private String videoCardMemoryType;
private int videoCardVolumeMemory;
private VideoCardStrategy videoCardCooling; //добавить стратегию активное или пассивное охлаждение
public VideoCard(String videoCardManufacturer, String videoCardMemoryType,
int videoCardVolumeMemory, VideoCardStrategy videoCardCooling) {
this.videoCardManufacturer = videoCardManufacturer;
this.videoCardMemoryType = videoCardMemoryType;
this.videoCardVolumeMemory = videoCardVolumeMemory;
this.videoCardCooling = videoCardCooling;
}
@Override
public void start(){
videoCardCooling.startCooling();
System.out.println("Видеокарта запущена.");
}
@Override
public String getInfo(){
return "Параметры видеокарты: " + "производитель - " +
videoCardManufacturer + "; тип памяти - " +videoCardMemoryType + "; объем памяти - " +
videoCardVolumeMemory + ";";
}
}
| UTF-8 | Java | 1,283 | java | VideoCard.java | Java | []
| null | []
| package ru.x5javacourse.hw5.Computer.VideoCard;
import ru.x5javacourse.hw5.Computer.Component;
public class VideoCard implements Component {
private String videoCardManufacturer;
private String videoCardMemoryType;
private int videoCardVolumeMemory;
private VideoCardStrategy videoCardCooling; //добавить стратегию активное или пассивное охлаждение
public VideoCard(String videoCardManufacturer, String videoCardMemoryType,
int videoCardVolumeMemory, VideoCardStrategy videoCardCooling) {
this.videoCardManufacturer = videoCardManufacturer;
this.videoCardMemoryType = videoCardMemoryType;
this.videoCardVolumeMemory = videoCardVolumeMemory;
this.videoCardCooling = videoCardCooling;
}
@Override
public void start(){
videoCardCooling.startCooling();
System.out.println("Видеокарта запущена.");
}
@Override
public String getInfo(){
return "Параметры видеокарты: " + "производитель - " +
videoCardManufacturer + "; тип памяти - " +videoCardMemoryType + "; объем памяти - " +
videoCardVolumeMemory + ";";
}
}
| 1,283 | 0.710978 | 0.707547 | 30 | 37.866665 | 29.574463 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.633333 | false | false | 15 |
eeab85cee69320cc50bf5224c231f488a5a759aa | 13,503,377,234,594 | 39c95d4c98e20efccbef20be342b8db8f6b42883 | /bksdk/bkapiv2/src/main/java/com/tencent/bk/api/paas/model/CreateApp.java | 009dae1a97e72af2a89d1ad530eddd78d1a407a0 | []
| no_license | sunke1229/buleking-1 | https://github.com/sunke1229/buleking-1 | d715ca473e7b60cc7452827a8ead4ef5b006da92 | c4494b2e6ea2ba50ee86216b42893dd6c8ec6290 | refs/heads/master | 2020-04-22T21:11:20.431000 | 2019-02-14T09:43:25 | 2019-02-14T09:43:25 | 170,665,503 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tencent.bk.api.paas.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class CreateApp {
@JsonProperty("bk_light_app_code")
private String appCode;
}
| UTF-8 | Java | 284 | java | CreateApp.java | Java | []
| null | []
| package com.tencent.bk.api.paas.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class CreateApp {
@JsonProperty("bk_light_app_code")
private String appCode;
}
| 284 | 0.774648 | 0.774648 | 15 | 17.933332 | 15.851253 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 15 |
c9e0d5951bd6c70fbc7eb54b88a8779cf8716cdc | 15,427,522,587,892 | 262eb1c2bd71a2397f5fae3cc6fdedf65d847d34 | /ACM Qualifier/2016/BigTruck.java | 862488b15e8aafd3819a7ca0e54657f5de29bad5 | []
| no_license | quanchau/Competitive-Programming | https://github.com/quanchau/Competitive-Programming | 2b759dce264b5351e65c21ded0d950a2a5a8aebb | 2a13e8cbe9778595a83d6fc40e358e68a1c4eddc | refs/heads/master | 2021-05-16T12:55:56.936000 | 2017-10-13T03:24:26 | 2017-10-13T03:24:26 | 105,282,142 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.*;
public class BigTruck {
static int n;
static int[] items;
static ArrayList<ArrayList<Integer>> adj;
static int[][] vals;
static long[] dist;
static final int INF = 1000000007;
static int[] itemNums;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
n = in.nextInt();
items = new int[n+1];
dist = new long[n+1];
itemNums = new int[n+1];
adj = new ArrayList<ArrayList<Integer>>();
vals = new int[n+1][n+1];
adj.add(new ArrayList<Integer>());
for (int i = 1; i <= n; i++){
items[i] = in.nextInt();
dist[i] = INF;
adj.add(new ArrayList<Integer>());
itemNums[i] = -1;
}
int m = in.nextInt();
for (int i = 0; i < m ; i++) {
int u = in.nextInt();
int v = in.nextInt();
int val = in.nextInt();
vals[u][v] = val;
vals[v][u] = val;
adj.get(u).add(v);
adj.get(v).add(u);
}
PriorityQueue<Step> q = new PriorityQueue<Step>();
q.add(new Step(1, items[1]));
dist[1] = 0;
itemNums[1] = items[1];
while(!q.isEmpty()) {
Step s = q.remove();
ArrayList<Integer> temp = adj.get(s.pos);
for (int i : temp) {
long newDist = dist[s.pos] + vals[s.pos][i];
int newItems = itemNums[s.pos] + items[i];
if (newDist< dist[i] || (newDist == dist[i] && newItems > itemNums[i])) {
itemNums[i] = newItems;
dist[i] = newDist;
if (i == n) continue;
q.add(new Step(i, s.items + items[i]));
}
}
}
if (dist[n] >= INF) System.out.println("impossible");
else System.out.println(dist[n] + " " + itemNums[n]);
}
static class Step implements Comparable<Step> {
int pos;
int items;
public Step(int x, int it) {
pos = x;
items = it;
}
public int compareTo(Step s2) {
if (Long.compare(dist[pos], dist[s2.pos]) == 0) return -Integer.compare(itemNums[pos], itemNums[s2.pos]);
return Long.compare(dist[pos], dist[s2.pos]);
}
}
} | UTF-8 | Java | 2,481 | java | BigTruck.java | Java | []
| null | []
| import java.util.*;
public class BigTruck {
static int n;
static int[] items;
static ArrayList<ArrayList<Integer>> adj;
static int[][] vals;
static long[] dist;
static final int INF = 1000000007;
static int[] itemNums;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
n = in.nextInt();
items = new int[n+1];
dist = new long[n+1];
itemNums = new int[n+1];
adj = new ArrayList<ArrayList<Integer>>();
vals = new int[n+1][n+1];
adj.add(new ArrayList<Integer>());
for (int i = 1; i <= n; i++){
items[i] = in.nextInt();
dist[i] = INF;
adj.add(new ArrayList<Integer>());
itemNums[i] = -1;
}
int m = in.nextInt();
for (int i = 0; i < m ; i++) {
int u = in.nextInt();
int v = in.nextInt();
int val = in.nextInt();
vals[u][v] = val;
vals[v][u] = val;
adj.get(u).add(v);
adj.get(v).add(u);
}
PriorityQueue<Step> q = new PriorityQueue<Step>();
q.add(new Step(1, items[1]));
dist[1] = 0;
itemNums[1] = items[1];
while(!q.isEmpty()) {
Step s = q.remove();
ArrayList<Integer> temp = adj.get(s.pos);
for (int i : temp) {
long newDist = dist[s.pos] + vals[s.pos][i];
int newItems = itemNums[s.pos] + items[i];
if (newDist< dist[i] || (newDist == dist[i] && newItems > itemNums[i])) {
itemNums[i] = newItems;
dist[i] = newDist;
if (i == n) continue;
q.add(new Step(i, s.items + items[i]));
}
}
}
if (dist[n] >= INF) System.out.println("impossible");
else System.out.println(dist[n] + " " + itemNums[n]);
}
static class Step implements Comparable<Step> {
int pos;
int items;
public Step(int x, int it) {
pos = x;
items = it;
}
public int compareTo(Step s2) {
if (Long.compare(dist[pos], dist[s2.pos]) == 0) return -Integer.compare(itemNums[pos], itemNums[s2.pos]);
return Long.compare(dist[pos], dist[s2.pos]);
}
}
} | 2,481 | 0.446191 | 0.434502 | 74 | 31.554054 | 19.640789 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.837838 | false | false | 15 |
ec7a357a933c2f22e49b73598401fa489781505a | 16,587,163,705,249 | 1953a645cbc441404411d9be6d44ca8e9c6f227a | /Source/src/source/Signature.java | 55493c141d2c6796cae42cb482af87f4cedd0301 | []
| no_license | TrackyRaul/UserManagementSystemJavaSWING | https://github.com/TrackyRaul/UserManagementSystemJavaSWING | 134ace2c3ca92a82c0bd8d3e5a1cc06225ea5b25 | 00dc669fb80791aea747b76c2caaebbe04a65783 | refs/heads/master | 2020-05-15T02:31:20.913000 | 2019-05-15T06:15:25 | 2019-05-15T06:15:25 | 182,050,789 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package source;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
*
* @author Raul Farkas
*/
public class Signature implements Serializable{
private User user;
private LocalDateTime dateTime;
/**
*
* @param user
* @param dateTime
*/
public Signature(User user, LocalDateTime dateTime){
this.user = user;
this.dateTime = dateTime;
}
/**
* @return the user
*/
public User getUser() {
return user;
}
/**
* @return the dateTime
*/
public LocalDateTime getDateTime() {
return this.dateTime;
}
}
| UTF-8 | Java | 675 | java | Signature.java | Java | [
{
"context": "import java.time.LocalDateTime;\n\n/**\n *\n * @author Raul Farkas\n */\npublic class Signature implements Serializabl",
"end": 108,
"score": 0.9998623132705688,
"start": 97,
"tag": "NAME",
"value": "Raul Farkas"
}
]
| null | []
| package source;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
*
* @author <NAME>
*/
public class Signature implements Serializable{
private User user;
private LocalDateTime dateTime;
/**
*
* @param user
* @param dateTime
*/
public Signature(User user, LocalDateTime dateTime){
this.user = user;
this.dateTime = dateTime;
}
/**
* @return the user
*/
public User getUser() {
return user;
}
/**
* @return the dateTime
*/
public LocalDateTime getDateTime() {
return this.dateTime;
}
}
| 670 | 0.545185 | 0.545185 | 43 | 14.697675 | 13.853948 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.232558 | false | false | 15 |
1e15a45b77a757d68b27a4550a30bce16346f1a9 | 12,850,542,206,956 | 35cc67e5cb8d07f144b21e9ac2d85334dd7e6905 | /1DV507/src/cw222ng_assign3/CountWords/WordCount2Main.java | 3aee1be76855d01d147941d2f15b5fb612ad2e2e | []
| no_license | Destoffe/1DV507 | https://github.com/Destoffe/1DV507 | 9aff7094f9eb44ac1ce47724552c833a3cbdbb6a | b16e2c825b3bcce31c8aaa85a851ca2c34ee2004 | refs/heads/master | 2020-04-10T09:05:20.379000 | 2018-12-14T09:29:01 | 2018-12-14T09:29:01 | 160,925,814 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cw222ng_assign3.CountWords;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Iterator;
public class WordCount2Main {
public static void main(String[] args) {
Word myWord;
String filePath = "words.txt";
String text = readText(filePath);
String[] splittedWords = text.split(" ");
HashWordSet myHash = new HashWordSet();
TreeWordSet myTree = new TreeWordSet();
for(int i=0; i<splittedWords.length; i++){
myWord = new Word(splittedWords[i]);
myHash.add(myWord);
myTree.add(myWord);
}
Iterator itr = myTree.iterator();
while(itr.hasNext()){
System.out.print(itr.next().toString()+" ");
}
System.out.println("\n" +myHash.size());
System.out.println(myTree.size());
}
public static String readText(String n) {
String tempString;
StringBuilder sBuild = new StringBuilder();
try {
BufferedReader bReader = new BufferedReader(new FileReader(n));
while((tempString = bReader.readLine()) != null) {
sBuild.append(tempString);
if(!tempString.equals(" ")){
sBuild.append(" ");
}
}
bReader.close();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return sBuild.toString();
}
} | UTF-8 | Java | 1,290 | java | WordCount2Main.java | Java | []
| null | []
| package cw222ng_assign3.CountWords;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Iterator;
public class WordCount2Main {
public static void main(String[] args) {
Word myWord;
String filePath = "words.txt";
String text = readText(filePath);
String[] splittedWords = text.split(" ");
HashWordSet myHash = new HashWordSet();
TreeWordSet myTree = new TreeWordSet();
for(int i=0; i<splittedWords.length; i++){
myWord = new Word(splittedWords[i]);
myHash.add(myWord);
myTree.add(myWord);
}
Iterator itr = myTree.iterator();
while(itr.hasNext()){
System.out.print(itr.next().toString()+" ");
}
System.out.println("\n" +myHash.size());
System.out.println(myTree.size());
}
public static String readText(String n) {
String tempString;
StringBuilder sBuild = new StringBuilder();
try {
BufferedReader bReader = new BufferedReader(new FileReader(n));
while((tempString = bReader.readLine()) != null) {
sBuild.append(tempString);
if(!tempString.equals(" ")){
sBuild.append(" ");
}
}
bReader.close();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return sBuild.toString();
}
} | 1,290 | 0.660465 | 0.655814 | 61 | 20.163935 | 17.813404 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.245902 | false | false | 15 |
6c3c4036cba8a411657e999336ec0088508108e0 | 12,850,542,208,401 | 74b83f006d47ccc0b1a3800d57e5916c1faed0cb | /easy-android-service/src/main/java/by/easyandroid/service/datasource/IApplicationResultService.java | de4c77fb318d390de5676ab8999f6f4a8714fd75 | []
| no_license | cslisenka/easy-android | https://github.com/cslisenka/easy-android | c14077e58695c7a8cdf66e3907d0ff0477be793a | 13213165940f4b462ef56ece906756951d476915 | refs/heads/master | 2021-05-27T20:22:06.722000 | 2013-04-28T10:06:27 | 2013-04-28T10:06:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package by.easyandroid.service.datasource;
import java.io.File;
import by.easyandroid.service.exception.ApplicationServiceException;
/**
* Stores compiled applications.
* Returns link or path to stored application
*
* @author kslisenko
*/
public interface IApplicationResultService {
String uploadResultApk(String applicationInstanceObjId, File apkToUpload) throws ApplicationServiceException;
} | UTF-8 | Java | 406 | java | IApplicationResultService.java | Java | [
{
"context": " link or path to stored application\n * \n * @author kslisenko\n */\npublic interface IApplicationResultService {\n",
"end": 243,
"score": 0.9989465475082397,
"start": 234,
"tag": "USERNAME",
"value": "kslisenko"
}
]
| null | []
| package by.easyandroid.service.datasource;
import java.io.File;
import by.easyandroid.service.exception.ApplicationServiceException;
/**
* Stores compiled applications.
* Returns link or path to stored application
*
* @author kslisenko
*/
public interface IApplicationResultService {
String uploadResultApk(String applicationInstanceObjId, File apkToUpload) throws ApplicationServiceException;
} | 406 | 0.815271 | 0.815271 | 16 | 24.4375 | 30.358213 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false | 15 |
9fb8447d1dd2907c09527662d03b4faebd3de50a | 9,844,065,106,515 | 51c4af9bf042bee3fcb2c0904e5e7a93ee62d3b3 | /src/lt/kaunascoding/factory/Shape.java | e79e1899d1c15e50fc4e45704164f77132de53cc | []
| no_license | denas2011/ShapeFactory | https://github.com/denas2011/ShapeFactory | 263570349e835a107fd8a13a911a916924b42687 | 74cb31b3b01d250688974013c136add17f3e96fd | refs/heads/master | 2020-04-01T15:08:54.432000 | 2018-10-16T17:14:37 | 2018-10-16T17:14:37 | 153,323,761 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package lt.kaunascoding.factory;
public interface Shape {
float drow();
}
| UTF-8 | Java | 79 | java | Shape.java | Java | []
| null | []
| package lt.kaunascoding.factory;
public interface Shape {
float drow();
}
| 79 | 0.721519 | 0.721519 | 5 | 14.8 | 12.607934 | 32 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 15 |
886343f7b5f79abb3aba4f5806e8d6e4938011e2 | 12,807,592,522,427 | 4c9fd82678d784328e457f7865cf9d6f393a0e7a | /src/edu/pitt/highfrequency/O1CheckPowerof2_142.java | b3b45d8831d376dc83c01e07277a570ed7b3d0bd | []
| no_license | mayangithub/LintCode | https://github.com/mayangithub/LintCode | 54e6d2aeca5d247486d7c234e472d289882b044f | 9753bacf2a0a709a4a150d1bc3fd0bb6611b8028 | refs/heads/master | 2021-03-12T19:37:19.843000 | 2015-11-15T04:59:25 | 2015-11-15T04:59:25 | 37,742,115 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package edu.pitt.highfrequency;
/**
* O(1) Check Power of 2 #142 --- Accepted
* Using O(1) time to check whether an integer n is a power of 2.
* Example
* For n=4, return true;
* For n=5, return false;
* Challenge
* O(1) time
* @author yanma
* @category High Frequency
* @version 2015-07-21
* @class 9
*/
public class O1CheckPowerof2_142 {
/*
* delete the last '1'
* https://en.wikipedia.org/wiki/Power_of_two
* @param n: An integer
* @return: True or false
*/
public boolean checkPowerOf2(int n) {
// write your code here
if (n <= 0) {
return false;
}
int result = (n - 1) & n;
return result == 0;
}
/*
* @param n: An integer
* @return: True or false
*/
public boolean checkPowerOf22(int n) {
// write your code here
if (n <= 0) {
return false;
}
String binary = Integer.toBinaryString(n);
for (int i = binary.length() - 1; i >= 1; i--) {
if (binary.charAt(i) != '0') {
return false;
}
}
return true;
}
/**
* recursion
* @param n
* @return
*/
public boolean checkPowerOf21(int n) {
// write your code here
if (n <= 0) {
return false;
}
return n == 1 || (n % 2 == 0 && checkPowerOf21(n/2));
}
}
| UTF-8 | Java | 1,458 | java | O1CheckPowerof2_142.java | Java | [
{
"context": "return false;\n * Challenge\n * O(1) time\n * @author yanma\n * @category High Frequency\n * @version 2015-07-2",
"end": 262,
"score": 0.9950074553489685,
"start": 257,
"tag": "USERNAME",
"value": "yanma"
}
]
| null | []
| /**
*
*/
package edu.pitt.highfrequency;
/**
* O(1) Check Power of 2 #142 --- Accepted
* Using O(1) time to check whether an integer n is a power of 2.
* Example
* For n=4, return true;
* For n=5, return false;
* Challenge
* O(1) time
* @author yanma
* @category High Frequency
* @version 2015-07-21
* @class 9
*/
public class O1CheckPowerof2_142 {
/*
* delete the last '1'
* https://en.wikipedia.org/wiki/Power_of_two
* @param n: An integer
* @return: True or false
*/
public boolean checkPowerOf2(int n) {
// write your code here
if (n <= 0) {
return false;
}
int result = (n - 1) & n;
return result == 0;
}
/*
* @param n: An integer
* @return: True or false
*/
public boolean checkPowerOf22(int n) {
// write your code here
if (n <= 0) {
return false;
}
String binary = Integer.toBinaryString(n);
for (int i = binary.length() - 1; i >= 1; i--) {
if (binary.charAt(i) != '0') {
return false;
}
}
return true;
}
/**
* recursion
* @param n
* @return
*/
public boolean checkPowerOf21(int n) {
// write your code here
if (n <= 0) {
return false;
}
return n == 1 || (n % 2 == 0 && checkPowerOf21(n/2));
}
}
| 1,458 | 0.48011 | 0.449931 | 73 | 18.972603 | 15.710544 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.342466 | false | false | 15 |
34f4b1d796d1d607fe0e078f63248adcd3729c02 | 19,920,058,352,096 | eb69dcc21ea742b481e521b90abd43be2be4d517 | /JSP/BLOG/Blog/src/java/Admin/DbTransaction.java | 6d4ae70fbd9238527be4af9b1939cda3b22bb0eb | []
| no_license | murat-celik/JAVA-Project-Tutorial | https://github.com/murat-celik/JAVA-Project-Tutorial | 584472e21e800ee461b911806668206b1eb91877 | e89a516f0744a180d9036aefd0e6b7e4f7d6f2b6 | refs/heads/master | 2016-06-05T04:51:33.864000 | 2015-12-03T18:47:37 | 2015-12-03T18:47:37 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Admin;
import java.sql.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DbTransaction {
public DbTransaction() {
}
private static Statement st;
private static Connection conn;
public static void Connection() throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/blog" + "?useUnicode=true&characterEncoding=UTF-8", "root", "");
st = (Statement) conn.createStatement();
}
public int Login(String Email, String Password) throws SQLException {
try {
Connection();
st = (Statement) conn.createStatement();
String sql = "select Id from Admin where Email='" + Email + "' and Password='" + Password + "'";
ResultSet Rs = st.executeQuery(sql);
if (Rs.next()) {
return Integer.parseInt(Rs.getString("Id"));
} else {
return 0;
}
} catch (Exception ex) {
return 0;
} finally {
conn.close();
}
}
public String NewArticle(int CategoryId, String Title, String Content) throws SQLException {
try {
Connection();
PreparedStatement preStmt;
preStmt = conn.prepareStatement("INSERT INTO Article (CategoryId,Title,Content,Date,DisplayCount) VALUES (?,?,?,?,?)");
preStmt.setInt(1, CategoryId);
preStmt.setString(2, Title);
preStmt.setString(3, Content);
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
Date date = new Date();
preStmt.setString(4, dateFormat.format(date));
preStmt.setInt(5, 0);
preStmt.executeUpdate();
preStmt.close();
return "<script lang='JavaScript'>alert('Yazı Eklendi');</script>";
} catch (Exception e) {
return e.getMessage();
// return "<script lang='JavaScript'>alert('Yazı Eklenemedi..!! ');</script>";
} finally {
conn.close();
}
}
public String NewCategory(String Name ) throws SQLException {
try {
Connection();
PreparedStatement preStmt;
preStmt = conn.prepareStatement("INSERT INTO Category (Name) VALUES (?)");
preStmt.setString(1, Name);
preStmt.executeUpdate();
preStmt.close();
return "<script lang='JavaScript'>alert('Kategori Eklendi');</script>";
} catch (Exception e) {
return e.getMessage();
// return "<script lang='JavaScript'>alert('Yazı Eklenemedi..!! ');</script>";
} finally {
conn.close();
}
}
public String NewComment(int ArticleId, String NameSurname, String Email, String CommentText) throws SQLException {
try {
Connection();
PreparedStatement preStmt;
preStmt = conn.prepareStatement("INSERT INTO Comment (ArticleId,NameSurname,Email,CommentText,CommentDate) VALUES (?,?,?,?,?)");//'"+ArticleId+"','"+NameSurname+"','"+Email+"','"+CommentText+"','"+dateFormat.format(date)+"'
preStmt.setInt(1, ArticleId);
preStmt.setString(2, NameSurname);
preStmt.setString(3, Email);
preStmt.setString(4, CommentText);
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
Date date = new Date();
preStmt.setString(5, dateFormat.format(date));
preStmt.executeUpdate();
preStmt.close();
return "<script lang='JavaScript'>alert('Yorum Eklendi');</script>";
} catch (Exception e) {
// return e.getMessage();
return "<script lang='JavaScript'>alert('Yorum Eklenemedi..!! ');</script>";
} finally {
conn.close();
}
}
}
| UTF-8 | Java | 4,139 | java | DbTransaction.java | Java | [
{
"context": "dmin where Email='\" + Email + \"' and Password='\" + Password + \"'\";\r\n ResultSet Rs = st.executeQuer",
"end": 938,
"score": 0.9148597717285156,
"start": 930,
"tag": "PASSWORD",
"value": "Password"
}
]
| null | []
| package Admin;
import java.sql.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DbTransaction {
public DbTransaction() {
}
private static Statement st;
private static Connection conn;
public static void Connection() throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/blog" + "?useUnicode=true&characterEncoding=UTF-8", "root", "");
st = (Statement) conn.createStatement();
}
public int Login(String Email, String Password) throws SQLException {
try {
Connection();
st = (Statement) conn.createStatement();
String sql = "select Id from Admin where Email='" + Email + "' and Password='" + <PASSWORD> + "'";
ResultSet Rs = st.executeQuery(sql);
if (Rs.next()) {
return Integer.parseInt(Rs.getString("Id"));
} else {
return 0;
}
} catch (Exception ex) {
return 0;
} finally {
conn.close();
}
}
public String NewArticle(int CategoryId, String Title, String Content) throws SQLException {
try {
Connection();
PreparedStatement preStmt;
preStmt = conn.prepareStatement("INSERT INTO Article (CategoryId,Title,Content,Date,DisplayCount) VALUES (?,?,?,?,?)");
preStmt.setInt(1, CategoryId);
preStmt.setString(2, Title);
preStmt.setString(3, Content);
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
Date date = new Date();
preStmt.setString(4, dateFormat.format(date));
preStmt.setInt(5, 0);
preStmt.executeUpdate();
preStmt.close();
return "<script lang='JavaScript'>alert('Yazı Eklendi');</script>";
} catch (Exception e) {
return e.getMessage();
// return "<script lang='JavaScript'>alert('Yazı Eklenemedi..!! ');</script>";
} finally {
conn.close();
}
}
public String NewCategory(String Name ) throws SQLException {
try {
Connection();
PreparedStatement preStmt;
preStmt = conn.prepareStatement("INSERT INTO Category (Name) VALUES (?)");
preStmt.setString(1, Name);
preStmt.executeUpdate();
preStmt.close();
return "<script lang='JavaScript'>alert('Kategori Eklendi');</script>";
} catch (Exception e) {
return e.getMessage();
// return "<script lang='JavaScript'>alert('Yazı Eklenemedi..!! ');</script>";
} finally {
conn.close();
}
}
public String NewComment(int ArticleId, String NameSurname, String Email, String CommentText) throws SQLException {
try {
Connection();
PreparedStatement preStmt;
preStmt = conn.prepareStatement("INSERT INTO Comment (ArticleId,NameSurname,Email,CommentText,CommentDate) VALUES (?,?,?,?,?)");//'"+ArticleId+"','"+NameSurname+"','"+Email+"','"+CommentText+"','"+dateFormat.format(date)+"'
preStmt.setInt(1, ArticleId);
preStmt.setString(2, NameSurname);
preStmt.setString(3, Email);
preStmt.setString(4, CommentText);
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
Date date = new Date();
preStmt.setString(5, dateFormat.format(date));
preStmt.executeUpdate();
preStmt.close();
return "<script lang='JavaScript'>alert('Yorum Eklendi');</script>";
} catch (Exception e) {
// return e.getMessage();
return "<script lang='JavaScript'>alert('Yorum Eklenemedi..!! ');</script>";
} finally {
conn.close();
}
}
}
| 4,141 | 0.565039 | 0.560445 | 96 | 41.083332 | 36.62014 | 235 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.125 | false | false | 15 |
be7b39bda8f3d394ece229927140db99361a6074 | 19,920,058,354,583 | c6fb5083f2e0e787ba92ba61f2d0ccaefea0c0d4 | /modules/schema/src/main/java/org/apache/ignite/internal/schema/configuration/TableValidatorImpl.java | 9f4f7826bc93c44e41c5f5b18a2c7f79e215539d | [
"Apache-2.0",
"LicenseRef-scancode-gutenberg-2020",
"CC0-1.0",
"BSD-3-Clause"
]
| permissive | isabella232/ignite-4 | https://github.com/isabella232/ignite-4 | 3e14393e50c8b0dbe26acb8816a934a5935155dc | 35016535609b3299e741daa6940e091bdeeadccb | refs/heads/main | 2023-08-25T18:45:21.129000 | 2021-10-15T12:00:20 | 2021-10-15T12:00:20 | 418,089,118 | 0 | 0 | Apache-2.0 | true | 2021-10-17T10:27:44 | 2021-10-17T10:11:39 | 2021-10-17T10:11:42 | 2021-10-17T10:27:41 | 4,557 | 0 | 0 | 1 | null | false | false | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.internal.schema.configuration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.stream.Collectors;
import org.apache.ignite.configuration.NamedListView;
import org.apache.ignite.configuration.schemas.table.TableValidator;
import org.apache.ignite.configuration.schemas.table.TableView;
import org.apache.ignite.configuration.validation.ValidationContext;
import org.apache.ignite.configuration.validation.ValidationIssue;
import org.apache.ignite.configuration.validation.Validator;
import org.apache.ignite.internal.schema.definition.TableDefinitionImpl;
import org.apache.ignite.internal.schema.definition.builder.TableSchemaBuilderImpl;
import org.apache.ignite.schema.definition.ColumnDefinition;
/**
* Table schema configuration validator implementation.
*/
public class TableValidatorImpl implements Validator<TableValidator, NamedListView<TableView>> {
/** Static instance. */
public static final TableValidatorImpl INSTANCE = new TableValidatorImpl();
/** {@inheritDoc} */
@Override public void validate(TableValidator annotation, ValidationContext<NamedListView<TableView>> ctx) {
NamedListView<TableView> list = ctx.getNewValue();
for (String key : list.namedListKeys()) {
TableView view = list.get(key);
try {
TableDefinitionImpl tbl = SchemaConfigurationConverter.convert(view);
assert !tbl.keyColumns().isEmpty();
assert !tbl.affinityColumns().isEmpty();
Collection<ColumnDefinition> allColumns = new ArrayList<>(tbl.keyColumns());
allColumns.addAll(tbl.valueColumns());
TableSchemaBuilderImpl.validateIndices(tbl.indices(), allColumns, tbl.affinityColumns().stream().map(ColumnDefinition::name).collect(Collectors.toSet()));
}
catch (IllegalArgumentException e) {
ctx.addIssue(new ValidationIssue("Validator works success by key " + ctx.currentKey() + ". Found "
+ view.columns().size() + " columns"));
}
}
}
/** Private constructor. */
private TableValidatorImpl() {
}
}
| UTF-8 | Java | 3,021 | java | TableValidatorImpl.java | Java | []
| null | []
| /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.internal.schema.configuration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.stream.Collectors;
import org.apache.ignite.configuration.NamedListView;
import org.apache.ignite.configuration.schemas.table.TableValidator;
import org.apache.ignite.configuration.schemas.table.TableView;
import org.apache.ignite.configuration.validation.ValidationContext;
import org.apache.ignite.configuration.validation.ValidationIssue;
import org.apache.ignite.configuration.validation.Validator;
import org.apache.ignite.internal.schema.definition.TableDefinitionImpl;
import org.apache.ignite.internal.schema.definition.builder.TableSchemaBuilderImpl;
import org.apache.ignite.schema.definition.ColumnDefinition;
/**
* Table schema configuration validator implementation.
*/
public class TableValidatorImpl implements Validator<TableValidator, NamedListView<TableView>> {
/** Static instance. */
public static final TableValidatorImpl INSTANCE = new TableValidatorImpl();
/** {@inheritDoc} */
@Override public void validate(TableValidator annotation, ValidationContext<NamedListView<TableView>> ctx) {
NamedListView<TableView> list = ctx.getNewValue();
for (String key : list.namedListKeys()) {
TableView view = list.get(key);
try {
TableDefinitionImpl tbl = SchemaConfigurationConverter.convert(view);
assert !tbl.keyColumns().isEmpty();
assert !tbl.affinityColumns().isEmpty();
Collection<ColumnDefinition> allColumns = new ArrayList<>(tbl.keyColumns());
allColumns.addAll(tbl.valueColumns());
TableSchemaBuilderImpl.validateIndices(tbl.indices(), allColumns, tbl.affinityColumns().stream().map(ColumnDefinition::name).collect(Collectors.toSet()));
}
catch (IllegalArgumentException e) {
ctx.addIssue(new ValidationIssue("Validator works success by key " + ctx.currentKey() + ". Found "
+ view.columns().size() + " columns"));
}
}
}
/** Private constructor. */
private TableValidatorImpl() {
}
}
| 3,021 | 0.717974 | 0.71665 | 69 | 42.782608 | 35.398708 | 170 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.463768 | false | false | 15 |
f1c673496e756f26568c9193f0001d808a2d4897 | 12,300,786,389,067 | 2f6f597b2b46a51f717d5e9087f5884ea068e99f | /src/br/ufes/inf/ontoumlplugin/shapes/BaseShapeModelController.java | ee3d6acf2f68c9691344b94a4c141d895202002c | [
"MIT"
]
| permissive | mvp-sales/ontouml-vp-plugin | https://github.com/mvp-sales/ontouml-vp-plugin | 47bcf65d93f433ff353fa75c13a2551acab15845 | 20e3d93b735cad7695ca3c3d63d2a8bce222cce0 | refs/heads/master | 2021-01-21T20:25:56.769000 | 2017-12-30T02:26:51 | 2017-12-30T02:26:51 | 92,235,181 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.ufes.inf.ontoumlplugin.shapes;
import RefOntoUML.parser.OntoUMLParser;
import br.ufes.inf.ontoumlplugin.model.OntoUMLClassType;
import br.ufes.inf.ontoumlplugin.utils.CommonUtils;
import com.vp.plugin.ApplicationManager;
import com.vp.plugin.diagram.IClassDiagramUIModel;
import com.vp.plugin.diagram.IDiagramUIModel;
import com.vp.plugin.diagram.IShapeUIModel;
import com.vp.plugin.diagram.VPShapeModelCreationController;
import com.vp.plugin.model.IClass;
import com.vp.plugin.model.IModelElement;
import com.vp.plugin.model.IProject;
import com.vp.plugin.model.factory.IModelElementFactory;
public abstract class BaseShapeModelController implements VPShapeModelCreationController {
protected String classBaseName;
protected String stereotypeName;
@Override
public String getShapeType() {
return IClassDiagramUIModel.SHAPETYPE_CLASS;
}
@Override
public void shapeCreated(IShapeUIModel iShapeUIModel) {
IProject project = ApplicationManager.instance().getProjectManager().getProject();
IDiagramUIModel lDiagram = ApplicationManager.instance().getDiagramManager().getActiveDiagram();
if (!OntoUMLClassType.doesProjectHaveStereotype(project, stereotypeName)) {
CommonUtils.addOntoUMLStereotypes(project);
}
IClass classElement = (IClass) iShapeUIModel.getModelElement();
createModelElement(classElement, project, lDiagram);
}
private IClass createModelElement(IClass lClass, IProject project, IDiagramUIModel diagramModel) {
IModelElement[] lPeers;
IModelElement lOwner = diagramModel.getParentModel();
if (lOwner != null) {
// create Class in Owner
lPeers = lOwner.toChildArray(IModelElementFactory.MODEL_TYPE_CLASS);
}
else {
// create Class in Root
lPeers = ApplicationManager.instance().getProjectManager().getProject().toModelElementArray(IModelElementFactory.MODEL_TYPE_CLASS);
}
lClass.addStereotype(OntoUMLClassType.getStereotypeFromString(project, stereotypeName));
String lClassName = classBaseName;
int lIndex = 2;
boolean lLoop = true;
while (lLoop) {
lLoop = false;
int lCount = lPeers == null ? 0 : lPeers.length;
for (int i = 0; i < lCount; i++) {
String lName = lPeers[i].getNickname();
if (lClassName.equals(lName)) {
lClassName = classBaseName + lIndex;
lIndex++;
lLoop = true;
i = lCount;
}
}
}
lClass.setNickname(lClassName);
return lClass;
}
}
| UTF-8 | Java | 2,727 | java | BaseShapeModelController.java | Java | []
| null | []
| package br.ufes.inf.ontoumlplugin.shapes;
import RefOntoUML.parser.OntoUMLParser;
import br.ufes.inf.ontoumlplugin.model.OntoUMLClassType;
import br.ufes.inf.ontoumlplugin.utils.CommonUtils;
import com.vp.plugin.ApplicationManager;
import com.vp.plugin.diagram.IClassDiagramUIModel;
import com.vp.plugin.diagram.IDiagramUIModel;
import com.vp.plugin.diagram.IShapeUIModel;
import com.vp.plugin.diagram.VPShapeModelCreationController;
import com.vp.plugin.model.IClass;
import com.vp.plugin.model.IModelElement;
import com.vp.plugin.model.IProject;
import com.vp.plugin.model.factory.IModelElementFactory;
public abstract class BaseShapeModelController implements VPShapeModelCreationController {
protected String classBaseName;
protected String stereotypeName;
@Override
public String getShapeType() {
return IClassDiagramUIModel.SHAPETYPE_CLASS;
}
@Override
public void shapeCreated(IShapeUIModel iShapeUIModel) {
IProject project = ApplicationManager.instance().getProjectManager().getProject();
IDiagramUIModel lDiagram = ApplicationManager.instance().getDiagramManager().getActiveDiagram();
if (!OntoUMLClassType.doesProjectHaveStereotype(project, stereotypeName)) {
CommonUtils.addOntoUMLStereotypes(project);
}
IClass classElement = (IClass) iShapeUIModel.getModelElement();
createModelElement(classElement, project, lDiagram);
}
private IClass createModelElement(IClass lClass, IProject project, IDiagramUIModel diagramModel) {
IModelElement[] lPeers;
IModelElement lOwner = diagramModel.getParentModel();
if (lOwner != null) {
// create Class in Owner
lPeers = lOwner.toChildArray(IModelElementFactory.MODEL_TYPE_CLASS);
}
else {
// create Class in Root
lPeers = ApplicationManager.instance().getProjectManager().getProject().toModelElementArray(IModelElementFactory.MODEL_TYPE_CLASS);
}
lClass.addStereotype(OntoUMLClassType.getStereotypeFromString(project, stereotypeName));
String lClassName = classBaseName;
int lIndex = 2;
boolean lLoop = true;
while (lLoop) {
lLoop = false;
int lCount = lPeers == null ? 0 : lPeers.length;
for (int i = 0; i < lCount; i++) {
String lName = lPeers[i].getNickname();
if (lClassName.equals(lName)) {
lClassName = classBaseName + lIndex;
lIndex++;
lLoop = true;
i = lCount;
}
}
}
lClass.setNickname(lClassName);
return lClass;
}
}
| 2,727 | 0.676934 | 0.675834 | 70 | 37.957142 | 29.662115 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.657143 | false | false | 15 |
81f9523c0f5eb9b56ee5e2b2051dd01364f1c104 | 28,965,259,463,512 | 06e507907371161595c86844b943a7bf588d709a | /src/com/raj/spring/BeanLifeCycleDemoApp.java | f455aa15859199281258accddbed87e5fb242be9 | []
| no_license | rajdhandus/spring-demo-one | https://github.com/rajdhandus/spring-demo-one | d32e82640febcf9db70139f2b9b938cacba79910 | 52baf45536eb5c5cb022107fb2eae94bfd0c1401 | refs/heads/master | 2021-06-15T12:01:27.743000 | 2017-03-27T19:55:05 | 2017-03-27T19:55:05 | 84,503,020 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.raj.spring;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class BeanLifeCycleDemoApp {
public BeanLifeCycleDemoApp() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
// TODO Auto-generated method stub
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("beanLifeCycle-applicationContext.xml");
Coach theCoach = context.getBean("myCoach", Coach.class);
System.out.println(theCoach.getWorkoutInfo());
context.close();
}
}
| UTF-8 | Java | 559 | java | BeanLifeCycleDemoApp.java | Java | []
| null | []
| package com.raj.spring;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class BeanLifeCycleDemoApp {
public BeanLifeCycleDemoApp() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
// TODO Auto-generated method stub
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("beanLifeCycle-applicationContext.xml");
Coach theCoach = context.getBean("myCoach", Coach.class);
System.out.println(theCoach.getWorkoutInfo());
context.close();
}
}
| 559 | 0.77102 | 0.77102 | 23 | 23.304348 | 29.836416 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.26087 | false | false | 15 |
e09b5b0b31ac4cad06348e32a1c07c2905feb287 | 31,945,966,770,574 | 81588400f7391c5242fc633094b6d37202ddce0b | /poo2020/src/polimorfismodeudores/Hipotecario2.java | d88922f8f276b7041487653c1c750e6b90ce0120 | []
| no_license | dani117m/poo2020 | https://github.com/dani117m/poo2020 | de998666ea424d845424834a9ea95ac65c6939d4 | 83d41c05f0ba4f79e1f21c3b46e917c5b671cbf6 | refs/heads/master | 2020-12-31T08:23:07.720000 | 2020-03-20T03:55:07 | 2020-03-20T03:55:07 | 238,947,440 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package polimorfismodeudores;
public class Hipotecario2 extends Cliente2{
private double taza;
private double i;
private double j;
public double getTaza() {
return taza;
}
public void setTaza(double taza) {
this.taza = taza;
}
public double getI() {
return i;
}
public void setI(double i) {
this.i = i;
}
public double getJ() {
return j;
}
public void setJ(double j) {
this.j = j;
}
@Override
public void calcularinteres (){
i = 1 + 0.36/12;
j = plazo * 12;
totalinteres = capital * Math.pow(i, j);
}
}
| UTF-8 | Java | 695 | java | Hipotecario2.java | Java | []
| null | []
| package polimorfismodeudores;
public class Hipotecario2 extends Cliente2{
private double taza;
private double i;
private double j;
public double getTaza() {
return taza;
}
public void setTaza(double taza) {
this.taza = taza;
}
public double getI() {
return i;
}
public void setI(double i) {
this.i = i;
}
public double getJ() {
return j;
}
public void setJ(double j) {
this.j = j;
}
@Override
public void calcularinteres (){
i = 1 + 0.36/12;
j = plazo * 12;
totalinteres = capital * Math.pow(i, j);
}
}
| 695 | 0.509353 | 0.494964 | 39 | 15.820513 | 13.75215 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.358974 | false | false | 15 |
2550daafcfbdde622f7de464f6d0ac8a03452b85 | 1,529,008,402,380 | 2dfac5ed741eaed5d87274844fa7b392307a7e0e | /src/main/java/gui/controls/WaveformViewer.java | c712501d20d3180535340a27ef23079c24e10c77 | []
| no_license | mgorski98/DAW-Bachelor-Project | https://github.com/mgorski98/DAW-Bachelor-Project | 2f9b96cfa11355ba17cda3dac8a6150af3725642 | 7ea42c5b1fa87113b0eb2ef3e776ba88ea6cfb4c | refs/heads/master | 2023-03-10T13:53:29.788000 | 2021-02-20T22:32:01 | 2021-02-20T22:32:01 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gui.controls;
import effects.SoundEffect;
import gui.controllers.EffectWindowController;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.geometry.Insets;
import javafx.geometry.Point2D;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.shape.Line;
import javafx.scene.shape.Rectangle;
import javafx.stage.Modality;
import javafx.stage.Stage;
import org.javatuples.Pair;
import org.kordamp.bootstrapfx.BootstrapFX;
import org.reflections.Reflections;
import processing.ChannelSplit;
import processing.Processing;
import providers.SampleProvider;
import utils.SoundClip;
import utils.StringUtils;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
//TODO: zrobić tak żeby viewery nie mogły na siebie nachodzić i clampować ich pozycję z początkiem/końcem najbliższego viewera (ale może wyskoczyć poza/przed niego)
public class WaveformViewer extends javafx.scene.layout.Pane implements Initializable {
public class WaveformSelection {
private Rectangle selectionRect;
private ObjectProperty<Paint> selectionColor;
private ObjectProperty<Boolean> present;
WaveformSelection() {
this.selectionRect = new Rectangle();
this.selectionRect.setOpacity(0.25d);
this.selectionColor = new SimpleObjectProperty<>(Color.CYAN);
this.selectionRect.setFill(this.selectionColor.get());
this.selectionColor.addListener((observable, oldval, newval) -> {
this.selectionRect.setFill(newval);
});
this.present = new SimpleObjectProperty<>(false);
}
WaveformSelection(double x, double y, double width, double height, Paint p) {
this.selectionRect = new Rectangle(x, y, width, height);
this.selectionRect.setOpacity(0.25d);
this.selectionColor = new SimpleObjectProperty<>(p);
this.selectionRect.setFill(this.selectionColor.get());
this.selectionColor.addListener((observable, oldval, newval) -> {
this.selectionRect.setFill(newval);
});
this.present = new SimpleObjectProperty<>(false);
}
public Rectangle getSelectionRect() {
return this.selectionRect;
}
public void setPresent(boolean value) {
present.setValue(value);
}
public boolean isPresent() {
return present.getValue();
}
public void clear() {
this.selectionRect.setWidth(0d);
this.present.setValue(false);
}
}
//<editor-fold desc="static stuff">
private static List<WaveformViewer> viewers;
public static WaveformViewer getSelected() {
return viewers.stream().filter(v -> v.selection.isPresent()).findFirst().orElse(null);
}
public static void remove(WaveformViewer... items) {
for (var item: items) {
viewers.remove(item);
}
}
private static void ensureSingleSelection(WaveformViewer clicked) {
viewers.forEach(viewer -> {
if (viewer == clicked) {
return;
}
viewer.selection.clear();
});
}
static {
viewers = new ArrayList<>();
}
public static void clearSelections() {
viewers.forEach(v -> v.selection.clear());
}
//</editor-fold>
private ContextMenu audioEditContextMenu;
private int samplesPerPixel = 96;
private SampleProvider sampleProvider;
private SoundClip soundClip;
private Insets waveformPadding;
private WaveformSelection selection;
@Deprecated
public WaveformViewer(SampleProvider provider) {
super();
this.sampleProvider = provider;
FXMLLoader loader = new FXMLLoader(getClass().getResource("/gui/controls/WaveformViewer.fxml"));
loader.setRoot(this);
loader.setController(this);
try {
loader.load();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public WaveformViewer(SoundClip file) {
super();
this.soundClip = file;
FXMLLoader loader = new FXMLLoader(getClass().getResource("/gui/controls/WaveformViewer.fxml"));
loader.setRoot(this);
loader.setController(this);
try {
loader.load();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private boolean mouseDragging = false;
private Point2D mousePosition, startPosition;
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
viewers.add(this);
waveformPadding = new Insets(10, 0, 10, 0);
if (soundClip != null) {
setPrefWidth(soundClip.getSamples().length / samplesPerPixel);
setMinWidth(getPrefWidth());
selection = new WaveformSelection(getLayoutX(), getLayoutY(), 0, getPrefHeight(), Color.CYAN);
selection.selectionRect.widthProperty().addListener((observableValue, oldValue, newValue) -> {
double x = selection.selectionRect.getX();
double width = (double)newValue;
if (x + width > getPrefWidth()) {
selection.selectionRect.setWidth(getPrefWidth() - x);
}
});
selection.selectionRect.xProperty().addListener((observableValue, oldValue, newValue) -> {
double newVal = (double)newValue;
if (newVal < 0d) {
selection.selectionRect.setX(0d);
}
});
invalidate();
getChildren().add(selection.selectionRect);
}
setupContextMenu();
setupEvents();
}
public void invalidate() {
float[] fileBuffer = soundClip.getSamples();
float min = 0f, max = 0f;
float[] paintBuffer = new float[samplesPerPixel];
int offset = 0;
var children = getChildren();
for (double x = 0d; x < getPrefWidth(); x += 1d, offset += samplesPerPixel) {
for (int i = 0; i < (samplesPerPixel > fileBuffer.length - offset ? fileBuffer.length - offset : samplesPerPixel); ++i) {
paintBuffer[i] = fileBuffer[i + offset] * Short.MAX_VALUE;
if (paintBuffer[i] > max) max = paintBuffer[i];
if (paintBuffer[i] < min) min = paintBuffer[i];
}
float low, high;
low = (min - Short.MIN_VALUE) / (Short.MAX_VALUE * 2 - 1);
high = (max - Short.MIN_VALUE) / (Short.MAX_VALUE * 2 - 1);
Line l = new Line();
l.setStartX(x);
l.setStartY(waveformPadding.getBottom() + low * (getPrefHeight() - waveformPadding.getBottom()));
l.setEndX(x);
l.setEndY(high * (getPrefHeight() - waveformPadding.getTop()));
l.setStroke(Color.BLACK);
l.setStrokeWidth(2.5d);
children.add(l);
min = max = 0f;
}
}
private void setupEvents() {
addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
if (e.isSecondaryButtonDown()) {
if (selection.isPresent() && !audioEditContextMenu.isShowing()) {
audioEditContextMenu.show(this, e.getScreenX(), e.getScreenY());
} else {
audioEditContextMenu.hide();
ensureSingleSelection(this);
startPosition = new Point2D(e.getX(), e.getY());
mousePosition = new Point2D(-1, -1);
selection.setPresent(true);
mouseDragging = true;
}
} else if (e.isPrimaryButtonDown()) {
ensureSingleSelection(this);
selection.setPresent(true);
selection.selectionRect.setX(0d);
selection.selectionRect.setY(0d);
selection.selectionRect.setHeight(this.getPrefHeight());
selection.selectionRect.setWidth(this.getPrefWidth());
}
});
addEventHandler(MouseEvent.MOUSE_RELEASED, e -> {
if (mouseDragging && e.isSecondaryButtonDown() && !audioEditContextMenu.isShowing()) {
mouseDragging = false;
if (Double.compare(mousePosition.getX(), -1) == 0) {
double x1, x2;
x1 = mousePosition.getX();
x2 = mousePosition.getY();
if (x2 > x1) {
double temp = x1;
x1 = x2;
x2 = temp;
}
selection.selectionRect.setX(x2);
selection.selectionRect.setY(0d);
selection.selectionRect.setWidth(x1 - x2);
selection.selectionRect.setHeight(getPrefHeight());
}
}
});
addEventHandler(MouseEvent.MOUSE_DRAGGED, e -> {
if (e.isSecondaryButtonDown() && !audioEditContextMenu.isShowing()) {
if (mouseDragging) {
if (mousePosition.getX() != -1) {
double x1, x2;
x1 = mousePosition.getX();
x2 = startPosition.getX();
if (x2 > x1) {
double temp = x2;
x2 = x1;
x1 = temp;
}
selection.selectionRect.setX(x2);
selection.selectionRect.setY(0d);
selection.selectionRect.setWidth(x1 - x2);
selection.selectionRect.setHeight(getPrefHeight());
}
mousePosition = new Point2D(e.getX(), e.getY());
}
}
});
}
private AtomicBoolean successfulExit = new AtomicBoolean(true);
private void setupContextMenu() {
BiFunction<Class, List<MenuItem>, BiConsumer<String, String>> menuItemMapper = (klass, list) -> (fxmlFilePrefix, fxmlFileSuffix) -> {
var menuItemNameParts = Arrays.
stream(StringUtils.splitUppercase(klass.getSimpleName())).
map(String::toLowerCase).
toArray(String[]::new);
menuItemNameParts[0] = org.apache.maven.shared.utils.StringUtils.capitalise(menuItemNameParts[0]);
var item = new MenuItem(String.join(" ", menuItemNameParts));
item.setOnAction(e -> {
var windowName = klass.getSimpleName();
var filename = "/" + fxmlFilePrefix + windowName + fxmlFileSuffix;
FXMLLoader loader = new FXMLLoader(getClass().getResource(filename));
try {
Parent p = loader.load();
EffectWindowController controller = loader.getController();
controller.setAudioClip(
soundClip,
(int)(selection.getSelectionRect().getX() * samplesPerPixel),
(int)((selection.getSelectionRect().getX() + selection.getSelectionRect().getWidth()) * samplesPerPixel)
);
Scene s = new Scene(p);
var style = getClass().getClassLoader().getResource("styles/app-style.css").toExternalForm();
s.getStylesheets().addAll(style, BootstrapFX.bootstrapFXStylesheet());
Stage stage = new Stage();
stage.setScene(s);
stage.setTitle(windowName + " properties");
stage.initModality(Modality.APPLICATION_MODAL);
stage.setOnCloseRequest(event -> successfulExit.set(false));
stage.showAndWait();
if (successfulExit.get()) {
invalidate();
}
successfulExit.set(true);
} catch (IOException | IllegalStateException ex) {
try {
//todo: fix this because we have parameterless sound effect
Processing effect = (Processing)klass.getConstructor().newInstance();
var newBuffer = effect.apply(soundClip.getSamples());
soundClip = new SoundClip(newBuffer, soundClip.getAudioFormat());
} catch (InstantiationException | NoSuchMethodException | InvocationTargetException | IllegalAccessException exc) {
exc.printStackTrace();
}
} catch (NullPointerException ex) {
new Alert(Alert.AlertType.INFORMATION, "Not implemented yet. Sorry!").showAndWait();
}
});
list.add(item);
};
Reflections effectReflections = new Reflections("effects");
Set<Class<? extends SoundEffect>> effectSubtypes = effectReflections.getSubTypesOf(SoundEffect.class);
audioEditContextMenu = new ContextMenu();
var clearMenuItem = new MenuItem("Clear selection");
clearMenuItem.setOnAction(e -> this.selection.clear());
Menu effectsMenu = new Menu("Effects");
audioEditContextMenu.getItems().addAll(clearMenuItem, new SeparatorMenuItem(), effectsMenu);
effectSubtypes.forEach(type -> menuItemMapper.apply(type, effectsMenu.getItems()).accept("effects/", "EffectWindow.fxml"));
Reflections processingReflections = new Reflections("processing");
var processingSubtypes = processingReflections.getSubTypesOf(Processing.class);
Menu processingMenu = new Menu("Processing");
audioEditContextMenu.getItems().addAll(processingMenu);
processingSubtypes.forEach(type -> menuItemMapper.apply(type, processingMenu.getItems()).accept("processing/", "Window.fxml"));
MenuItem splitChannelsMenuItem = new MenuItem("Split channels");
splitChannelsMenuItem.setOnAction(e -> {
ChannelSplit splitter = new ChannelSplit(soundClip);
var channels = splitter.split();
VBox containersParent = (VBox)this.getParent().getParent();
for (SoundClip channel : channels) {
WaveformViewersContainer container = new WaveformViewersContainer();
WaveformViewer viewer = new WaveformViewer(channel);
container.addWaveForm(viewer);
containersParent.getChildren().add(container);
}
});
audioEditContextMenu.getItems().add(splitChannelsMenuItem);
}
public void clear() {
var children = getChildren();
children.clear();
children.add(selection.selectionRect);
}
public void setSelectionColor(Paint color) {
selection.selectionColor.setValue(color);
}
public SoundClip getSoundClip() {
return this.soundClip;
}
public Optional<Pair<Double, Double>> getSelectionBufferBounds() {
Pair<Double, Double> rv = null;
if (selection.isPresent()) {
rv = new Pair<>(selection.selectionRect.getX(), (selection.selectionRect.getX() + selection.selectionRect.getWidth()));
}
return Optional.ofNullable(rv);
}
public WaveformSelection getSelection() {
return this.selection;
}
public int getSamplesPerPixel() {
return this.samplesPerPixel;
}
public boolean isSelected() {
return this.selection.isPresent();
}
}
| UTF-8 | Java | 16,114 | java | WaveformViewer.java | Java | []
| null | []
| package gui.controls;
import effects.SoundEffect;
import gui.controllers.EffectWindowController;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.geometry.Insets;
import javafx.geometry.Point2D;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.shape.Line;
import javafx.scene.shape.Rectangle;
import javafx.stage.Modality;
import javafx.stage.Stage;
import org.javatuples.Pair;
import org.kordamp.bootstrapfx.BootstrapFX;
import org.reflections.Reflections;
import processing.ChannelSplit;
import processing.Processing;
import providers.SampleProvider;
import utils.SoundClip;
import utils.StringUtils;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
//TODO: zrobić tak żeby viewery nie mogły na siebie nachodzić i clampować ich pozycję z początkiem/końcem najbliższego viewera (ale może wyskoczyć poza/przed niego)
public class WaveformViewer extends javafx.scene.layout.Pane implements Initializable {
public class WaveformSelection {
private Rectangle selectionRect;
private ObjectProperty<Paint> selectionColor;
private ObjectProperty<Boolean> present;
WaveformSelection() {
this.selectionRect = new Rectangle();
this.selectionRect.setOpacity(0.25d);
this.selectionColor = new SimpleObjectProperty<>(Color.CYAN);
this.selectionRect.setFill(this.selectionColor.get());
this.selectionColor.addListener((observable, oldval, newval) -> {
this.selectionRect.setFill(newval);
});
this.present = new SimpleObjectProperty<>(false);
}
WaveformSelection(double x, double y, double width, double height, Paint p) {
this.selectionRect = new Rectangle(x, y, width, height);
this.selectionRect.setOpacity(0.25d);
this.selectionColor = new SimpleObjectProperty<>(p);
this.selectionRect.setFill(this.selectionColor.get());
this.selectionColor.addListener((observable, oldval, newval) -> {
this.selectionRect.setFill(newval);
});
this.present = new SimpleObjectProperty<>(false);
}
public Rectangle getSelectionRect() {
return this.selectionRect;
}
public void setPresent(boolean value) {
present.setValue(value);
}
public boolean isPresent() {
return present.getValue();
}
public void clear() {
this.selectionRect.setWidth(0d);
this.present.setValue(false);
}
}
//<editor-fold desc="static stuff">
private static List<WaveformViewer> viewers;
public static WaveformViewer getSelected() {
return viewers.stream().filter(v -> v.selection.isPresent()).findFirst().orElse(null);
}
public static void remove(WaveformViewer... items) {
for (var item: items) {
viewers.remove(item);
}
}
private static void ensureSingleSelection(WaveformViewer clicked) {
viewers.forEach(viewer -> {
if (viewer == clicked) {
return;
}
viewer.selection.clear();
});
}
static {
viewers = new ArrayList<>();
}
public static void clearSelections() {
viewers.forEach(v -> v.selection.clear());
}
//</editor-fold>
private ContextMenu audioEditContextMenu;
private int samplesPerPixel = 96;
private SampleProvider sampleProvider;
private SoundClip soundClip;
private Insets waveformPadding;
private WaveformSelection selection;
@Deprecated
public WaveformViewer(SampleProvider provider) {
super();
this.sampleProvider = provider;
FXMLLoader loader = new FXMLLoader(getClass().getResource("/gui/controls/WaveformViewer.fxml"));
loader.setRoot(this);
loader.setController(this);
try {
loader.load();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public WaveformViewer(SoundClip file) {
super();
this.soundClip = file;
FXMLLoader loader = new FXMLLoader(getClass().getResource("/gui/controls/WaveformViewer.fxml"));
loader.setRoot(this);
loader.setController(this);
try {
loader.load();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private boolean mouseDragging = false;
private Point2D mousePosition, startPosition;
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
viewers.add(this);
waveformPadding = new Insets(10, 0, 10, 0);
if (soundClip != null) {
setPrefWidth(soundClip.getSamples().length / samplesPerPixel);
setMinWidth(getPrefWidth());
selection = new WaveformSelection(getLayoutX(), getLayoutY(), 0, getPrefHeight(), Color.CYAN);
selection.selectionRect.widthProperty().addListener((observableValue, oldValue, newValue) -> {
double x = selection.selectionRect.getX();
double width = (double)newValue;
if (x + width > getPrefWidth()) {
selection.selectionRect.setWidth(getPrefWidth() - x);
}
});
selection.selectionRect.xProperty().addListener((observableValue, oldValue, newValue) -> {
double newVal = (double)newValue;
if (newVal < 0d) {
selection.selectionRect.setX(0d);
}
});
invalidate();
getChildren().add(selection.selectionRect);
}
setupContextMenu();
setupEvents();
}
public void invalidate() {
float[] fileBuffer = soundClip.getSamples();
float min = 0f, max = 0f;
float[] paintBuffer = new float[samplesPerPixel];
int offset = 0;
var children = getChildren();
for (double x = 0d; x < getPrefWidth(); x += 1d, offset += samplesPerPixel) {
for (int i = 0; i < (samplesPerPixel > fileBuffer.length - offset ? fileBuffer.length - offset : samplesPerPixel); ++i) {
paintBuffer[i] = fileBuffer[i + offset] * Short.MAX_VALUE;
if (paintBuffer[i] > max) max = paintBuffer[i];
if (paintBuffer[i] < min) min = paintBuffer[i];
}
float low, high;
low = (min - Short.MIN_VALUE) / (Short.MAX_VALUE * 2 - 1);
high = (max - Short.MIN_VALUE) / (Short.MAX_VALUE * 2 - 1);
Line l = new Line();
l.setStartX(x);
l.setStartY(waveformPadding.getBottom() + low * (getPrefHeight() - waveformPadding.getBottom()));
l.setEndX(x);
l.setEndY(high * (getPrefHeight() - waveformPadding.getTop()));
l.setStroke(Color.BLACK);
l.setStrokeWidth(2.5d);
children.add(l);
min = max = 0f;
}
}
private void setupEvents() {
addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
if (e.isSecondaryButtonDown()) {
if (selection.isPresent() && !audioEditContextMenu.isShowing()) {
audioEditContextMenu.show(this, e.getScreenX(), e.getScreenY());
} else {
audioEditContextMenu.hide();
ensureSingleSelection(this);
startPosition = new Point2D(e.getX(), e.getY());
mousePosition = new Point2D(-1, -1);
selection.setPresent(true);
mouseDragging = true;
}
} else if (e.isPrimaryButtonDown()) {
ensureSingleSelection(this);
selection.setPresent(true);
selection.selectionRect.setX(0d);
selection.selectionRect.setY(0d);
selection.selectionRect.setHeight(this.getPrefHeight());
selection.selectionRect.setWidth(this.getPrefWidth());
}
});
addEventHandler(MouseEvent.MOUSE_RELEASED, e -> {
if (mouseDragging && e.isSecondaryButtonDown() && !audioEditContextMenu.isShowing()) {
mouseDragging = false;
if (Double.compare(mousePosition.getX(), -1) == 0) {
double x1, x2;
x1 = mousePosition.getX();
x2 = mousePosition.getY();
if (x2 > x1) {
double temp = x1;
x1 = x2;
x2 = temp;
}
selection.selectionRect.setX(x2);
selection.selectionRect.setY(0d);
selection.selectionRect.setWidth(x1 - x2);
selection.selectionRect.setHeight(getPrefHeight());
}
}
});
addEventHandler(MouseEvent.MOUSE_DRAGGED, e -> {
if (e.isSecondaryButtonDown() && !audioEditContextMenu.isShowing()) {
if (mouseDragging) {
if (mousePosition.getX() != -1) {
double x1, x2;
x1 = mousePosition.getX();
x2 = startPosition.getX();
if (x2 > x1) {
double temp = x2;
x2 = x1;
x1 = temp;
}
selection.selectionRect.setX(x2);
selection.selectionRect.setY(0d);
selection.selectionRect.setWidth(x1 - x2);
selection.selectionRect.setHeight(getPrefHeight());
}
mousePosition = new Point2D(e.getX(), e.getY());
}
}
});
}
private AtomicBoolean successfulExit = new AtomicBoolean(true);
private void setupContextMenu() {
BiFunction<Class, List<MenuItem>, BiConsumer<String, String>> menuItemMapper = (klass, list) -> (fxmlFilePrefix, fxmlFileSuffix) -> {
var menuItemNameParts = Arrays.
stream(StringUtils.splitUppercase(klass.getSimpleName())).
map(String::toLowerCase).
toArray(String[]::new);
menuItemNameParts[0] = org.apache.maven.shared.utils.StringUtils.capitalise(menuItemNameParts[0]);
var item = new MenuItem(String.join(" ", menuItemNameParts));
item.setOnAction(e -> {
var windowName = klass.getSimpleName();
var filename = "/" + fxmlFilePrefix + windowName + fxmlFileSuffix;
FXMLLoader loader = new FXMLLoader(getClass().getResource(filename));
try {
Parent p = loader.load();
EffectWindowController controller = loader.getController();
controller.setAudioClip(
soundClip,
(int)(selection.getSelectionRect().getX() * samplesPerPixel),
(int)((selection.getSelectionRect().getX() + selection.getSelectionRect().getWidth()) * samplesPerPixel)
);
Scene s = new Scene(p);
var style = getClass().getClassLoader().getResource("styles/app-style.css").toExternalForm();
s.getStylesheets().addAll(style, BootstrapFX.bootstrapFXStylesheet());
Stage stage = new Stage();
stage.setScene(s);
stage.setTitle(windowName + " properties");
stage.initModality(Modality.APPLICATION_MODAL);
stage.setOnCloseRequest(event -> successfulExit.set(false));
stage.showAndWait();
if (successfulExit.get()) {
invalidate();
}
successfulExit.set(true);
} catch (IOException | IllegalStateException ex) {
try {
//todo: fix this because we have parameterless sound effect
Processing effect = (Processing)klass.getConstructor().newInstance();
var newBuffer = effect.apply(soundClip.getSamples());
soundClip = new SoundClip(newBuffer, soundClip.getAudioFormat());
} catch (InstantiationException | NoSuchMethodException | InvocationTargetException | IllegalAccessException exc) {
exc.printStackTrace();
}
} catch (NullPointerException ex) {
new Alert(Alert.AlertType.INFORMATION, "Not implemented yet. Sorry!").showAndWait();
}
});
list.add(item);
};
Reflections effectReflections = new Reflections("effects");
Set<Class<? extends SoundEffect>> effectSubtypes = effectReflections.getSubTypesOf(SoundEffect.class);
audioEditContextMenu = new ContextMenu();
var clearMenuItem = new MenuItem("Clear selection");
clearMenuItem.setOnAction(e -> this.selection.clear());
Menu effectsMenu = new Menu("Effects");
audioEditContextMenu.getItems().addAll(clearMenuItem, new SeparatorMenuItem(), effectsMenu);
effectSubtypes.forEach(type -> menuItemMapper.apply(type, effectsMenu.getItems()).accept("effects/", "EffectWindow.fxml"));
Reflections processingReflections = new Reflections("processing");
var processingSubtypes = processingReflections.getSubTypesOf(Processing.class);
Menu processingMenu = new Menu("Processing");
audioEditContextMenu.getItems().addAll(processingMenu);
processingSubtypes.forEach(type -> menuItemMapper.apply(type, processingMenu.getItems()).accept("processing/", "Window.fxml"));
MenuItem splitChannelsMenuItem = new MenuItem("Split channels");
splitChannelsMenuItem.setOnAction(e -> {
ChannelSplit splitter = new ChannelSplit(soundClip);
var channels = splitter.split();
VBox containersParent = (VBox)this.getParent().getParent();
for (SoundClip channel : channels) {
WaveformViewersContainer container = new WaveformViewersContainer();
WaveformViewer viewer = new WaveformViewer(channel);
container.addWaveForm(viewer);
containersParent.getChildren().add(container);
}
});
audioEditContextMenu.getItems().add(splitChannelsMenuItem);
}
public void clear() {
var children = getChildren();
children.clear();
children.add(selection.selectionRect);
}
public void setSelectionColor(Paint color) {
selection.selectionColor.setValue(color);
}
public SoundClip getSoundClip() {
return this.soundClip;
}
public Optional<Pair<Double, Double>> getSelectionBufferBounds() {
Pair<Double, Double> rv = null;
if (selection.isPresent()) {
rv = new Pair<>(selection.selectionRect.getX(), (selection.selectionRect.getX() + selection.selectionRect.getWidth()));
}
return Optional.ofNullable(rv);
}
public WaveformSelection getSelection() {
return this.selection;
}
public int getSamplesPerPixel() {
return this.samplesPerPixel;
}
public boolean isSelected() {
return this.selection.isPresent();
}
}
| 16,114 | 0.584984 | 0.580451 | 410 | 38.275608 | 30.175982 | 164 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.707317 | false | false | 15 |
f7bcd68cae9f2fa0700c037879f95942b2432d1d | 33,586,644,260,910 | c6bbe00ff69074a710fb0e01c7dce58047a87879 | /Java9/modules.com.hello/src/modules/com/hello/HelloWorld.java | d33d7cb8345c66e04a9bdf18e61ba6e9022977a7 | [
"MIT"
]
| permissive | tirthalpatel/Learning-Java | https://github.com/tirthalpatel/Learning-Java | e4abb78544bf56104312a13983472a5eed319996 | f0fc36fd8d04d4da87003f563eb112e794c8598f | refs/heads/master | 2020-12-23T14:46:12.749000 | 2019-05-05T11:00:16 | 2019-05-05T11:00:16 | 18,488,189 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package modules.com.hello;
public interface HelloWorld {
String sayHelloWorld();
}
| UTF-8 | Java | 89 | java | HelloWorld.java | Java | []
| null | []
| package modules.com.hello;
public interface HelloWorld {
String sayHelloWorld();
}
| 89 | 0.741573 | 0.741573 | 6 | 13.833333 | 13.532882 | 29 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 15 |
824b97fdf5a91745ae99e4a504bf6e20a4dd7561 | 16,535,624,134,080 | 99f07bdde609643d25b6e54d9941f3ef359854f9 | /app/src/main/java/com/v3/cookbook/baseview/abstracts/ViewFragment.java | 814a8476571ea31320a7678e3c85ff2c187dd546 | []
| no_license | nguyentrinhlt96/MainActivity | https://github.com/nguyentrinhlt96/MainActivity | b48f3d6af6323b3f9ffa92675edf00ff503aaf56 | a7151d0254aad27a0c289849383468ba93ae642c | refs/heads/master | 2022-12-27T01:46:05.104000 | 2020-09-24T06:50:55 | 2020-09-24T06:50:55 | 291,181,958 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.v3.cookbook.baseview.abstracts;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.v3.cookbook.baseview.BaseActivity;
import com.v3.cookbook.baseview.BaseFragment;
import com.v3.cookbook.baseview.interfaces.IPresenter;
import com.v3.cookbook.baseview.interfaces.PresentView;
public abstract class ViewFragment<P extends IPresenter> extends BaseFragment implements PresentView<P> {
protected boolean mIsInitialized = false;
protected P mPresenter;
private boolean mViewHidden;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
public void onDestroy() {
super.onDestroy();
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (!this.mIsInitialized) {
this.mRootView = super.onCreateView(inflater, container, savedInstanceState);
if (getArguments() != null) {
parseArgs(getArguments());
}
initLayout();
this.mIsInitialized = true;
}
return this.mRootView;
}
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (!this.mStartOnAnimationEnded && !this.mIsStarted) {
startPresent();
}
}
public void startPresent() {
P p = this.mPresenter;
if (p != null) {
p.start();
}
this.mIsStarted = true;
}
public void initLayout() {
}
public BaseActivity getBaseActivity() {
if (getActivity() instanceof BaseActivity) {
return (BaseActivity) getActivity();
}
return null;
}
public void onRequestError(String errorCode, String errorMessage) {
}
public void onNetworkError(boolean shouldShowPopup) {
}
public void onRequestSuccess() {
}
public Activity getViewContext() {
return getActivity();
}
public void setPresenter(P presenter) {
this.mPresenter = presenter;
}
public P getPresenter() {
return this.mPresenter;
}
public void parseArgs(Bundle args) {
}
public boolean needTranslationAnimation() {
return true;
}
public void onDisplay() {
super.onDisplay();
P p = this.mPresenter;
if (p != null) {
p.onFragmentDisplay();
}
}
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
this.mViewHidden = hidden;
}
public boolean isViewHidden() {
return this.mViewHidden;
}
public boolean isShowing() {
return isResumed() && this == BaseActivity.getTopFragment(getFragmentManager());
}
public void onDestroyView() {
super.onDestroyView();
}
public void onDetach() {
super.onDetach();
}
}
| UTF-8 | Java | 3,016 | java | ViewFragment.java | Java | []
| null | []
| package com.v3.cookbook.baseview.abstracts;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.v3.cookbook.baseview.BaseActivity;
import com.v3.cookbook.baseview.BaseFragment;
import com.v3.cookbook.baseview.interfaces.IPresenter;
import com.v3.cookbook.baseview.interfaces.PresentView;
public abstract class ViewFragment<P extends IPresenter> extends BaseFragment implements PresentView<P> {
protected boolean mIsInitialized = false;
protected P mPresenter;
private boolean mViewHidden;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
public void onDestroy() {
super.onDestroy();
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (!this.mIsInitialized) {
this.mRootView = super.onCreateView(inflater, container, savedInstanceState);
if (getArguments() != null) {
parseArgs(getArguments());
}
initLayout();
this.mIsInitialized = true;
}
return this.mRootView;
}
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (!this.mStartOnAnimationEnded && !this.mIsStarted) {
startPresent();
}
}
public void startPresent() {
P p = this.mPresenter;
if (p != null) {
p.start();
}
this.mIsStarted = true;
}
public void initLayout() {
}
public BaseActivity getBaseActivity() {
if (getActivity() instanceof BaseActivity) {
return (BaseActivity) getActivity();
}
return null;
}
public void onRequestError(String errorCode, String errorMessage) {
}
public void onNetworkError(boolean shouldShowPopup) {
}
public void onRequestSuccess() {
}
public Activity getViewContext() {
return getActivity();
}
public void setPresenter(P presenter) {
this.mPresenter = presenter;
}
public P getPresenter() {
return this.mPresenter;
}
public void parseArgs(Bundle args) {
}
public boolean needTranslationAnimation() {
return true;
}
public void onDisplay() {
super.onDisplay();
P p = this.mPresenter;
if (p != null) {
p.onFragmentDisplay();
}
}
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
this.mViewHidden = hidden;
}
public boolean isViewHidden() {
return this.mViewHidden;
}
public boolean isShowing() {
return isResumed() && this == BaseActivity.getTopFragment(getFragmentManager());
}
public void onDestroyView() {
super.onDestroyView();
}
public void onDetach() {
super.onDetach();
}
}
| 3,016 | 0.63561 | 0.633952 | 123 | 23.520325 | 22.849579 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.365854 | false | false | 15 |
57734a3c780dc291aad96e500df5570b7a59b2a4 | 31,748,398,295,544 | cadbf628c4b6d3a8e09c89dd301da023a11cf317 | /src/main/java/com/yucheng/cmis/rsc/op/bkacc/QueryBkaccDetailOp.java | abe7efdcbfae4350d7ef6593c78a042196578b10 | []
| no_license | zhizhongsan/cmis-main | https://github.com/zhizhongsan/cmis-main | dfaebf6c42734e9c214f5351253ccd6d18aa1b8a | dea5ca104b22df30d095d17fb4f54144a739f8ac | refs/heads/master | 2016-08-04T22:53:28.897000 | 2013-08-27T03:18:26 | 2013-08-27T03:18:26 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yucheng.cmis.rsc.op.bkacc;
import java.sql.Connection;
import java.util.HashMap;
import java.util.List;
import org.apache.log4j.Logger;
import com.ecc.emp.core.Context;
import com.ecc.emp.core.EMPException;
import com.ecc.emp.data.IndexedCollection;
import com.ecc.emp.data.KeyedCollection;
import com.ecc.emp.dbmodel.PageInfo;
import com.yucheng.cmis.operation.CMISOperation;
import com.yucheng.cmis.pub.CMISComponentFactory;
import com.yucheng.cmis.pub.ComponentHelper;
import com.yucheng.cmis.rsc.component.RSCCuscomComponent;
import com.yucheng.cmis.rsc.component.RscComponent;
import com.yucheng.cmis.rsc.domain.RscTaskInfo;
import com.yucheng.cmis.rsc.pub.KcolToHashMap;
import com.yucheng.cmis.pub.RscPubConstant;
import com.yucheng.cmis.util.TableModelUtil;
public class QueryBkaccDetailOp extends CMISOperation {
private static final Logger logger = Logger.getLogger(QueryBkaccDetailOp.class);
/**
* 组件ID
*/
private final static String componentID = RscPubConstant.RSCCOMPONENT;
/**
* 五级分类要素表模型ID
*/
private final static String modelID = RscPubConstant.RSCTASKINFO;
/**
* 贷款信息表模型ID
*/
private final static String modelID_1 = RscPubConstant.RSCACCP;
/**
* 担保合同信息表模型ID
*/
private final static String modelGuarContID = RscPubConstant.RSCGUARCONTR;
/**
* 担保品信息表模型ID
*/
private final static String modelGuarInfoID = RscPubConstant.RSCGUARINFO;
/**
* 组件对象
*/
private RscComponent rscComponent;
/**
* 设置分页大小
*/
private final int pageSize =10000;
/**
* 设置DOMAIN的路径
*/
private final String classPath="com.yucheng.cmis.rsc.domain.";
/**
* 定议表模型查询条件信息
*/
private final String five_cla_task_no_name = "five_cla_task_no";
private final String cla_date_name = "cla_date";
private final String model_no_value = RscPubConstant.RSCBKACC_MODEL;
/**
* 执行查询详细信息操作
*/
public String doExecute(Context context) throws EMPException {
Connection connection = null;
try{
connection = this.getConnection(context);
//获得“五级分类编号,分类日期"
String five_cla_task_no_value = null;
try {
five_cla_task_no_value = (String)context.getDataValue(five_cla_task_no_name);
} catch (Exception e)
{
logger.error(e.getMessage(), e);
}
if(five_cla_task_no_value == null || five_cla_task_no_value.length() == 0)
throw new EMPException("The value of pk["+five_cla_task_no_name+"] cannot be null!");
// 设置查询五级分类信息的条件
HashMap pkMap = new HashMap();
pkMap.put("five_cla_task_no",five_cla_task_no_value);
pkMap.put("model_no",model_no_value);
//设置查询贷款信息的条件
HashMap pkMap_1 = new HashMap();
pkMap_1.put("five_cla_task_no","'"+five_cla_task_no_value+"'");
RscTaskInfo rscTaskInfo = new RscTaskInfo();
// 构建业务处理类
rscComponent = (RscComponent) CMISComponentFactory
.getComponentFactoryInstance().getComponentInstance(
componentID, context,connection);
RSCCuscomComponent rscCusComComponent = (RSCCuscomComponent) CMISComponentFactory.getComponentFactoryInstance().getComponentInstance(
RscPubConstant.RSC_CUSCOM_COMPONENT_ID, context,connection);
//获取查询后所得rscTaskInfo对象
rscTaskInfo = (RscTaskInfo) rscComponent.queryRscTaskInfoDetail(modelID, pkMap);
KeyedCollection kColl = null;
ComponentHelper cHelper = new ComponentHelper();
kColl = cHelper.domain2kcol(rscTaskInfo, modelID);
/**
* 检查是否已经生成得分表数据
*/
if(!rscCusComComponent.checkGenScoreTable(rscTaskInfo)){
/**
* 生成得分表数据
*/
rscCusComComponent.genModGrpIndScore(rscTaskInfo);
}
//取客户信用等级评分
HashMap<String,String> khxydj = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_CUSTOMER_CREDIT_LEVEL_NO,"0");
KeyedCollection kcxydj=KcolToHashMap.hashmapToKcol(khxydj);
kcxydj.setName(RscPubConstant.RSC_CUSTOMER_CREDIT_LEVEL_NO);
this.putDataElement2Context(kcxydj, context);
//损失级因子
HashMap<String,String> ssjyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_LOSS_NO,"0");
KeyedCollection kcssjyz=KcolToHashMap.hashmapToKcol(ssjyz);
kcssjyz.setName(RscPubConstant.RSC_LOSS_NO);
this.putDataElement2Context(kcssjyz, context);
//低风险因子
HashMap<String,String> dfxyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_LOW_RISKS_NO,"0");
KeyedCollection kcdfxyz=KcolToHashMap.hashmapToKcol(dfxyz);
kcdfxyz.setName(RscPubConstant.RSC_LOW_RISKS_NO);
this.putDataElement2Context(kcdfxyz, context);
//客户状态因子
HashMap<String,String> khztyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_CUSTOMER_STATUS_NO,"0");
KeyedCollection kckhztyz=KcolToHashMap.hashmapToKcol(khztyz);
kckhztyz.setName(RscPubConstant.RSC_CUSTOMER_STATUS_NO);
this.putDataElement2Context(kckhztyz, context);
//债项用途因子
HashMap<String,String> zxytyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_BILL_USE_NO,"0");
KeyedCollection kczxyt=KcolToHashMap.hashmapToKcol(zxytyz);
kczxyt.setName(RscPubConstant.RSC_BILL_USE_NO);
this.putDataElement2Context(kczxyt, context);
//现金流因子
HashMap<String,String> xjlyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_CASH_NO,"0");
KeyedCollection kcxjl=KcolToHashMap.hashmapToKcol(xjlyz);
kcxjl.setName(RscPubConstant.RSC_CASH_NO);
this.putDataElement2Context(kcxjl, context);
//重大事件因子
HashMap<String,String> zdsjyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_BIG_POINT_NO,"0");
KeyedCollection kczdsj=KcolToHashMap.hashmapToKcol(zdsjyz);
kczdsj.setName(RscPubConstant.RSC_BIG_POINT_NO);
this.putDataElement2Context(kczdsj, context);
//逾期状态因子
HashMap<String,String> yqztyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_BEHIND_TIME_NO,"0");
KeyedCollection kcyqzt=KcolToHashMap.hashmapToKcol(yqztyz);
kcyqzt.setName(RscPubConstant.RSC_BEHIND_TIME_NO);
this.putDataElement2Context(kcyqzt, context);
//重组因子
HashMap<String,String> czyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_RECOMBINATION_NO,"0");
KeyedCollection kccz=KcolToHashMap.hashmapToKcol(czyz);
kccz.setName(RscPubConstant.RSC_RECOMBINATION_NO);
this.putDataElement2Context(kccz, context);
//合规因子
HashMap<String,String> hgyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_LAW_NO,"0");
KeyedCollection kchg=KcolToHashMap.hashmapToKcol(hgyz);
kchg.setName(RscPubConstant.RSC_LAW_NO);
this.putDataElement2Context(kchg, context);
//风险缓释措施
HashMap<String,String> fxhs = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_REMISSION_RISKS_NO,"0");
KeyedCollection kcfxhs=KcolToHashMap.hashmapToKcol(fxhs);
kcfxhs.setName(RscPubConstant.RSC_REMISSION_RISKS_NO);
this.putDataElement2Context(kcfxhs, context);
//综合调整
HashMap<String,String> zhjz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_ADJUST_NO,"0");
KeyedCollection kczhjz=KcolToHashMap.hashmapToKcol(zhjz);
kczhjz.setName(RscPubConstant.RSC_ADJUST_NO);
this.putDataElement2Context(kczhjz, context);
// 设置只在第一次查询贷款信息总记录数
PageInfo pageInfo = TableModelUtil.createPageInfo(context, "one",
String.valueOf(pageSize));
String conditionStr = "";
// 得到贷款信息结果
List result = rscComponent.query(modelID_1,
pkMap_1, pageInfo,classPath,conditionStr);
IndexedCollection iColl = cHelper.domain2icol(result, modelID_1);
/**
* 得到担保合同信息
*/
List guarcontList = rscComponent.query(modelGuarContID,
pkMap_1, pageInfo,classPath,conditionStr);
IndexedCollection GuarContiColl = cHelper.domain2icol(guarcontList, modelGuarContID);
GuarContiColl.setName("guar_cont_info");
/**
* 得到担保品信息
*/
List guarinfoList = rscComponent.query(modelGuarInfoID,
pkMap_1, pageInfo,classPath,conditionStr);
IndexedCollection GuarInfoiColl = cHelper.domain2icol(guarinfoList, modelGuarInfoID);
GuarInfoiColl.setName("guar_info");
//展现
this.putDataElement2Context(kColl, context);
iColl.setName("RscAccpList");
this.putDataElement2Context(iColl, context);
TableModelUtil.parsePageInfo(context, pageInfo);
}catch (EMPException ee) {
logger.error(ee.getMessage(), ee);
throw ee;
} catch(Exception e){
logger.error(e.getMessage(), e);
throw new EMPException(e);
} finally {
if (connection != null)
this.releaseConnection(context, connection);
}
return "0";
}
}
| UTF-8 | Java | 9,591 | java | QueryBkaccDetailOp.java | Java | []
| null | []
| package com.yucheng.cmis.rsc.op.bkacc;
import java.sql.Connection;
import java.util.HashMap;
import java.util.List;
import org.apache.log4j.Logger;
import com.ecc.emp.core.Context;
import com.ecc.emp.core.EMPException;
import com.ecc.emp.data.IndexedCollection;
import com.ecc.emp.data.KeyedCollection;
import com.ecc.emp.dbmodel.PageInfo;
import com.yucheng.cmis.operation.CMISOperation;
import com.yucheng.cmis.pub.CMISComponentFactory;
import com.yucheng.cmis.pub.ComponentHelper;
import com.yucheng.cmis.rsc.component.RSCCuscomComponent;
import com.yucheng.cmis.rsc.component.RscComponent;
import com.yucheng.cmis.rsc.domain.RscTaskInfo;
import com.yucheng.cmis.rsc.pub.KcolToHashMap;
import com.yucheng.cmis.pub.RscPubConstant;
import com.yucheng.cmis.util.TableModelUtil;
public class QueryBkaccDetailOp extends CMISOperation {
private static final Logger logger = Logger.getLogger(QueryBkaccDetailOp.class);
/**
* 组件ID
*/
private final static String componentID = RscPubConstant.RSCCOMPONENT;
/**
* 五级分类要素表模型ID
*/
private final static String modelID = RscPubConstant.RSCTASKINFO;
/**
* 贷款信息表模型ID
*/
private final static String modelID_1 = RscPubConstant.RSCACCP;
/**
* 担保合同信息表模型ID
*/
private final static String modelGuarContID = RscPubConstant.RSCGUARCONTR;
/**
* 担保品信息表模型ID
*/
private final static String modelGuarInfoID = RscPubConstant.RSCGUARINFO;
/**
* 组件对象
*/
private RscComponent rscComponent;
/**
* 设置分页大小
*/
private final int pageSize =10000;
/**
* 设置DOMAIN的路径
*/
private final String classPath="com.yucheng.cmis.rsc.domain.";
/**
* 定议表模型查询条件信息
*/
private final String five_cla_task_no_name = "five_cla_task_no";
private final String cla_date_name = "cla_date";
private final String model_no_value = RscPubConstant.RSCBKACC_MODEL;
/**
* 执行查询详细信息操作
*/
public String doExecute(Context context) throws EMPException {
Connection connection = null;
try{
connection = this.getConnection(context);
//获得“五级分类编号,分类日期"
String five_cla_task_no_value = null;
try {
five_cla_task_no_value = (String)context.getDataValue(five_cla_task_no_name);
} catch (Exception e)
{
logger.error(e.getMessage(), e);
}
if(five_cla_task_no_value == null || five_cla_task_no_value.length() == 0)
throw new EMPException("The value of pk["+five_cla_task_no_name+"] cannot be null!");
// 设置查询五级分类信息的条件
HashMap pkMap = new HashMap();
pkMap.put("five_cla_task_no",five_cla_task_no_value);
pkMap.put("model_no",model_no_value);
//设置查询贷款信息的条件
HashMap pkMap_1 = new HashMap();
pkMap_1.put("five_cla_task_no","'"+five_cla_task_no_value+"'");
RscTaskInfo rscTaskInfo = new RscTaskInfo();
// 构建业务处理类
rscComponent = (RscComponent) CMISComponentFactory
.getComponentFactoryInstance().getComponentInstance(
componentID, context,connection);
RSCCuscomComponent rscCusComComponent = (RSCCuscomComponent) CMISComponentFactory.getComponentFactoryInstance().getComponentInstance(
RscPubConstant.RSC_CUSCOM_COMPONENT_ID, context,connection);
//获取查询后所得rscTaskInfo对象
rscTaskInfo = (RscTaskInfo) rscComponent.queryRscTaskInfoDetail(modelID, pkMap);
KeyedCollection kColl = null;
ComponentHelper cHelper = new ComponentHelper();
kColl = cHelper.domain2kcol(rscTaskInfo, modelID);
/**
* 检查是否已经生成得分表数据
*/
if(!rscCusComComponent.checkGenScoreTable(rscTaskInfo)){
/**
* 生成得分表数据
*/
rscCusComComponent.genModGrpIndScore(rscTaskInfo);
}
//取客户信用等级评分
HashMap<String,String> khxydj = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_CUSTOMER_CREDIT_LEVEL_NO,"0");
KeyedCollection kcxydj=KcolToHashMap.hashmapToKcol(khxydj);
kcxydj.setName(RscPubConstant.RSC_CUSTOMER_CREDIT_LEVEL_NO);
this.putDataElement2Context(kcxydj, context);
//损失级因子
HashMap<String,String> ssjyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_LOSS_NO,"0");
KeyedCollection kcssjyz=KcolToHashMap.hashmapToKcol(ssjyz);
kcssjyz.setName(RscPubConstant.RSC_LOSS_NO);
this.putDataElement2Context(kcssjyz, context);
//低风险因子
HashMap<String,String> dfxyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_LOW_RISKS_NO,"0");
KeyedCollection kcdfxyz=KcolToHashMap.hashmapToKcol(dfxyz);
kcdfxyz.setName(RscPubConstant.RSC_LOW_RISKS_NO);
this.putDataElement2Context(kcdfxyz, context);
//客户状态因子
HashMap<String,String> khztyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_CUSTOMER_STATUS_NO,"0");
KeyedCollection kckhztyz=KcolToHashMap.hashmapToKcol(khztyz);
kckhztyz.setName(RscPubConstant.RSC_CUSTOMER_STATUS_NO);
this.putDataElement2Context(kckhztyz, context);
//债项用途因子
HashMap<String,String> zxytyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_BILL_USE_NO,"0");
KeyedCollection kczxyt=KcolToHashMap.hashmapToKcol(zxytyz);
kczxyt.setName(RscPubConstant.RSC_BILL_USE_NO);
this.putDataElement2Context(kczxyt, context);
//现金流因子
HashMap<String,String> xjlyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_CASH_NO,"0");
KeyedCollection kcxjl=KcolToHashMap.hashmapToKcol(xjlyz);
kcxjl.setName(RscPubConstant.RSC_CASH_NO);
this.putDataElement2Context(kcxjl, context);
//重大事件因子
HashMap<String,String> zdsjyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_BIG_POINT_NO,"0");
KeyedCollection kczdsj=KcolToHashMap.hashmapToKcol(zdsjyz);
kczdsj.setName(RscPubConstant.RSC_BIG_POINT_NO);
this.putDataElement2Context(kczdsj, context);
//逾期状态因子
HashMap<String,String> yqztyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_BEHIND_TIME_NO,"0");
KeyedCollection kcyqzt=KcolToHashMap.hashmapToKcol(yqztyz);
kcyqzt.setName(RscPubConstant.RSC_BEHIND_TIME_NO);
this.putDataElement2Context(kcyqzt, context);
//重组因子
HashMap<String,String> czyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_RECOMBINATION_NO,"0");
KeyedCollection kccz=KcolToHashMap.hashmapToKcol(czyz);
kccz.setName(RscPubConstant.RSC_RECOMBINATION_NO);
this.putDataElement2Context(kccz, context);
//合规因子
HashMap<String,String> hgyz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_LAW_NO,"0");
KeyedCollection kchg=KcolToHashMap.hashmapToKcol(hgyz);
kchg.setName(RscPubConstant.RSC_LAW_NO);
this.putDataElement2Context(kchg, context);
//风险缓释措施
HashMap<String,String> fxhs = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_REMISSION_RISKS_NO,"0");
KeyedCollection kcfxhs=KcolToHashMap.hashmapToKcol(fxhs);
kcfxhs.setName(RscPubConstant.RSC_REMISSION_RISKS_NO);
this.putDataElement2Context(kcfxhs, context);
//综合调整
HashMap<String,String> zhjz = rscCusComComponent.queryGrpIndexScoreList(five_cla_task_no_value,RscPubConstant.RSC_ADJUST_NO,"0");
KeyedCollection kczhjz=KcolToHashMap.hashmapToKcol(zhjz);
kczhjz.setName(RscPubConstant.RSC_ADJUST_NO);
this.putDataElement2Context(kczhjz, context);
// 设置只在第一次查询贷款信息总记录数
PageInfo pageInfo = TableModelUtil.createPageInfo(context, "one",
String.valueOf(pageSize));
String conditionStr = "";
// 得到贷款信息结果
List result = rscComponent.query(modelID_1,
pkMap_1, pageInfo,classPath,conditionStr);
IndexedCollection iColl = cHelper.domain2icol(result, modelID_1);
/**
* 得到担保合同信息
*/
List guarcontList = rscComponent.query(modelGuarContID,
pkMap_1, pageInfo,classPath,conditionStr);
IndexedCollection GuarContiColl = cHelper.domain2icol(guarcontList, modelGuarContID);
GuarContiColl.setName("guar_cont_info");
/**
* 得到担保品信息
*/
List guarinfoList = rscComponent.query(modelGuarInfoID,
pkMap_1, pageInfo,classPath,conditionStr);
IndexedCollection GuarInfoiColl = cHelper.domain2icol(guarinfoList, modelGuarInfoID);
GuarInfoiColl.setName("guar_info");
//展现
this.putDataElement2Context(kColl, context);
iColl.setName("RscAccpList");
this.putDataElement2Context(iColl, context);
TableModelUtil.parsePageInfo(context, pageInfo);
}catch (EMPException ee) {
logger.error(ee.getMessage(), ee);
throw ee;
} catch(Exception e){
logger.error(e.getMessage(), e);
throw new EMPException(e);
} finally {
if (connection != null)
this.releaseConnection(context, connection);
}
return "0";
}
}
| 9,591 | 0.717777 | 0.712713 | 237 | 36.333332 | 34.31221 | 150 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.675106 | false | false | 15 |
bcb6c82f09b7c06038d3564d40a1e886bb0abdc7 | 31,748,398,297,394 | c9791f5e07b43df9ab4463dd1504159e0495daba | /src/main/java/com/jack12324/eop/machine/particleExciter/GuiParticleExciter.java | b4c146f15f769673cc8cbac77a68dd36b00dc4c5 | [
"MIT"
]
| permissive | jack12324/EOP | https://github.com/jack12324/EOP | afb8ef538475209141c7e6d465018926409ad662 | 477bbe31e7d61e6de4e981a07da526a4bbe8ede8 | refs/heads/master | 2021-01-23T10:54:46.009000 | 2017-08-21T20:09:48 | 2017-08-21T20:09:48 | 93,094,066 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jack12324.eop.machine.particleExciter;
import com.jack12324.eop.ExtremeOreProcessing;
import com.jack12324.eop.util.GuiValues;
import com.jack12324.eop.util.gui.GuiBase;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.util.ResourceLocation;
public class GuiParticleExciter extends GuiBase {
private static final ResourceLocation BG_TEXTURE = new ResourceLocation(ExtremeOreProcessing.modID,
"textures/gui/particle_exciter.png");
public GuiParticleExciter(Container inventorySlotsIn, InventoryPlayer playerInv,
TileEntityParticleExciter tileEntity) {
super(inventorySlotsIn, playerInv, tileEntity, BG_TEXTURE, GuiValues.PARTICLEEXCITER);
}
}
| UTF-8 | Java | 787 | java | GuiParticleExciter.java | Java | [
{
"context": "package com.jack12324.eop.machine.particleExciter;\n\nimport com.jack1232",
"end": 21,
"score": 0.9939380288124084,
"start": 12,
"tag": "USERNAME",
"value": "jack12324"
},
{
"context": "ack12324.eop.machine.particleExciter;\n\nimport com.jack12324.eop.ExtremeOreProcessing;\nimport com.jack12324.eo",
"end": 72,
"score": 0.9937272071838379,
"start": 63,
"tag": "USERNAME",
"value": "jack12324"
},
{
"context": "om.jack12324.eop.ExtremeOreProcessing;\nimport com.jack12324.eop.util.GuiValues;\nimport com.jack12324.eop.util",
"end": 119,
"score": 0.9960989952087402,
"start": 110,
"tag": "USERNAME",
"value": "jack12324"
},
{
"context": "port com.jack12324.eop.util.GuiValues;\nimport com.jack12324.eop.util.gui.GuiBase;\nimport net.minecraft.entity",
"end": 160,
"score": 0.9821994304656982,
"start": 151,
"tag": "USERNAME",
"value": "jack12324"
}
]
| null | []
| package com.jack12324.eop.machine.particleExciter;
import com.jack12324.eop.ExtremeOreProcessing;
import com.jack12324.eop.util.GuiValues;
import com.jack12324.eop.util.gui.GuiBase;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.util.ResourceLocation;
public class GuiParticleExciter extends GuiBase {
private static final ResourceLocation BG_TEXTURE = new ResourceLocation(ExtremeOreProcessing.modID,
"textures/gui/particle_exciter.png");
public GuiParticleExciter(Container inventorySlotsIn, InventoryPlayer playerInv,
TileEntityParticleExciter tileEntity) {
super(inventorySlotsIn, playerInv, tileEntity, BG_TEXTURE, GuiValues.PARTICLEEXCITER);
}
}
| 787 | 0.778907 | 0.753494 | 20 | 38.349998 | 32.238602 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false | 15 |
bf3e36d78425e07b9a19b67c0d0a28d94a0cdad4 | 1,486,058,697,445 | e25191eb8ff133a8b3fa5872815aaabf504aaa0f | /utam-core/src/main/java/utam/core/selenium/factory/AppiumCapabilityProvider.java | 7da1b38fe989100796e1ce48399da7dd9cc06329 | [
"MIT",
"LicenseRef-scancode-generic-cla"
]
| permissive | rajukamal/utam-java | https://github.com/rajukamal/utam-java | 28d600a637199dee5bd6c163bdfa5ad5b31d285d | 7e1541eda994884e70a2bb29ee19e5bf6ba2de6b | refs/heads/main | 2023-07-13T06:09:02.093000 | 2021-08-03T02:39:01 | 2021-08-03T02:39:01 | 397,735,088 | 0 | 0 | MIT | true | 2021-08-18T21:06:59 | 2021-08-18T21:06:59 | 2021-08-17T17:30:24 | 2021-08-18T18:40:54 | 1,048 | 0 | 0 | 0 | null | false | false | /*
* Copyright (c) 2021, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root
* or https://opensource.org/licenses/MIT
*/
package utam.core.selenium.factory;
import org.openqa.selenium.remote.DesiredCapabilities;
/**
* The provider to set and get desired Appium capabilities besides default ones
*
* @author qren
* @since 230
*/
@SuppressWarnings("WeakerAccess")
public class AppiumCapabilityProvider {
private final DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
/**
* set up an Appium capability for creating a new session
*
* @param capabilityName the name of Appium capability that try to setup
* @param value the value of Appium capability configured by capabilityName
*/
public void setDesiredCapability(String capabilityName, Object value) {
desiredCapabilities.setCapability(capabilityName, value);
}
/**
* retrieve Appium capabilities that used by current active session
*
* @return DesiredCapabilities
*/
public DesiredCapabilities getDesiredCapabilities() {
return desiredCapabilities;
}
}
| UTF-8 | Java | 1,182 | java | AppiumCapabilityProvider.java | Java | [
{
"context": "um capabilities besides default ones\n *\n * @author qren\n * @since 230\n */\n@SuppressWarnings(\"WeakerAccess",
"end": 408,
"score": 0.9994099736213684,
"start": 404,
"tag": "USERNAME",
"value": "qren"
}
]
| null | []
| /*
* Copyright (c) 2021, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root
* or https://opensource.org/licenses/MIT
*/
package utam.core.selenium.factory;
import org.openqa.selenium.remote.DesiredCapabilities;
/**
* The provider to set and get desired Appium capabilities besides default ones
*
* @author qren
* @since 230
*/
@SuppressWarnings("WeakerAccess")
public class AppiumCapabilityProvider {
private final DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
/**
* set up an Appium capability for creating a new session
*
* @param capabilityName the name of Appium capability that try to setup
* @param value the value of Appium capability configured by capabilityName
*/
public void setDesiredCapability(String capabilityName, Object value) {
desiredCapabilities.setCapability(capabilityName, value);
}
/**
* retrieve Appium capabilities that used by current active session
*
* @return DesiredCapabilities
*/
public DesiredCapabilities getDesiredCapabilities() {
return desiredCapabilities;
}
}
| 1,182 | 0.741117 | 0.735195 | 41 | 27.829268 | 28.38662 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.243902 | false | false | 15 |
1f26b08e944b2867a2999b53c99dc55d51b7ee74 | 26,671,746,942,957 | 61951d1c8b6c37ad6066b4030ac52dac8c81afd8 | /Sesion-08/Ejemplo-01/PaquetesDiseñoClases/src/com/proyecto/_abstract/Medicina.java | a3807f8a5f5addeeb6a60bd85bae5a27a79db5cb | []
| no_license | beduExpert/B2-Java-standard-edition | https://github.com/beduExpert/B2-Java-standard-edition | f131a61979dbc88f9c54372483867e5beb480744 | 216388002834af12b19851d5c1b48cce233e2bed | refs/heads/master | 2020-08-14T07:49:52.785000 | 2019-12-10T16:44:36 | 2019-12-10T16:44:36 | 215,125,945 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.proyecto._abstract;
public class Medicina{
}
| UTF-8 | Java | 60 | java | Medicina.java | Java | []
| null | []
| package com.proyecto._abstract;
public class Medicina{
}
| 60 | 0.75 | 0.75 | 5 | 11 | 12.976903 | 31 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 15 |
2bb6f634bbd0f1d296dbc760930ef2152f426b54 | 5,540,507,823,437 | 62433dd4d0bbb284a489eac3b764924905ae1951 | /InterviewBit/Math/Excel1/Solution.java | 5439638287a5db4c00ca8a9a681b8c62441065af | []
| no_license | abhipad14/Data_Structures_-_Algorithms | https://github.com/abhipad14/Data_Structures_-_Algorithms | 8ebc208159807415d1033cc00ff50bc4d855ac69 | e2c51cf8f3025a1cd4931d604f0843697a25f0c1 | refs/heads/master | 2021-01-10T14:47:49.112000 | 2016-09-16T02:40:30 | 2016-09-16T02:40:30 | 49,291,683 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Math.Math_Excel1;
public class Solution {
public int titleToNumber(String a) {
int answer = 0;
int size = a.length();
int power;
for(int i=size-1; i>=0; i--){
char temp = a.charAt(i);
int value = temp-'A';
power = size-1-i;
answer += ++value*Math.pow(26, power);
}
return answer;
}
}
| UTF-8 | Java | 339 | java | Solution.java | Java | []
| null | []
| package Math.Math_Excel1;
public class Solution {
public int titleToNumber(String a) {
int answer = 0;
int size = a.length();
int power;
for(int i=size-1; i>=0; i--){
char temp = a.charAt(i);
int value = temp-'A';
power = size-1-i;
answer += ++value*Math.pow(26, power);
}
return answer;
}
}
| 339 | 0.569322 | 0.548673 | 17 | 17.941177 | 12.557962 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.352941 | false | false | 15 |
7bd912febc65bee475ab42bfe1093c316cf7fff0 | 31,293,131,735,444 | 0cedd8386a93ae17042d5b4fbc85f7cba35f4197 | /TestProject/src/com/wear/testproject/bean/FriendsComponment.java | 6734b0e1f84ed1660e7a20eea811344ecf917ab0 | []
| no_license | ljwshigood/Xiaogoududu | https://github.com/ljwshigood/Xiaogoududu | 2ae0c78e10af1f2cff7bc6d9aca673fe28980d43 | 0d36c5af93a738fdc1b6972880907e13205a5047 | refs/heads/master | 2021-01-10T08:11:49.696000 | 2016-04-03T06:37:10 | 2016-04-03T06:37:10 | 55,113,118 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wear.testproject.bean;
import java.io.Serializable;
import java.util.List;
public class FriendsComponment implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String info ;
private int state ;
private List<SerialNumber> SerialNumber ;
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
public List<SerialNumber> getData() {
return SerialNumber;
}
public void setData(List<SerialNumber> data) {
this.SerialNumber = data;
}
}
| UTF-8 | Java | 668 | java | FriendsComponment.java | Java | []
| null | []
| package com.wear.testproject.bean;
import java.io.Serializable;
import java.util.List;
public class FriendsComponment implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String info ;
private int state ;
private List<SerialNumber> SerialNumber ;
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
public List<SerialNumber> getData() {
return SerialNumber;
}
public void setData(List<SerialNumber> data) {
this.SerialNumber = data;
}
}
| 668 | 0.700599 | 0.699102 | 43 | 14.534883 | 16.314281 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.093023 | false | false | 15 |
65d1e9d8c4985f2f30244f99349cc2943f818002 | 7,249,904,838,812 | ed589ea2c8dededa36d3b6d24fc86472a22322b6 | /trunk/GoJava1/myhailo.chernenko/ProjectOfficeManagement/src/test/java/ua/com/goit/gojava/POM/AllTests.java | fac7c1c536e6c4a3b5cbe68e64f200bc5ce569f4 | []
| no_license | baygoit/GoJava | https://github.com/baygoit/GoJava | dcf884d271a4612051036e4fdc2c882c343ec870 | a0a07165092bcc60e109c84227b0024f4bca38ed | refs/heads/master | 2020-04-16T01:46:09.808000 | 2016-08-06T06:28:13 | 2016-08-06T06:28:13 | 42,005,479 | 8 | 27 | null | false | 2016-03-09T11:26:20 | 2015-09-06T14:28:53 | 2016-01-11T14:00:31 | 2016-03-09T11:26:19 | 246,886 | 6 | 19 | 1 | Java | null | null | package ua.com.goit.gojava.POM;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
//import ua.com.goit.gojava.POM.dataModel.*;
/*import ua.com.goit.gojava.POM.dataModel.cash.*;
import ua.com.goit.gojava.POM.dataModel.common.*;
import ua.com.goit.gojava.POM.dataModel.documents.*;
import ua.com.goit.gojava.POM.dataModel.profitcost.*;
import ua.com.goit.gojava.POM.persistence.fileDB.*;
import ua.com.goit.gojava.POM.persistence.postgresDB.ExchangeRateDAOTest;
*/
@RunWith(Suite.class)
@SuiteClasses({
//BankAccountTest.class,
//CashMovementEntryTest.class,
//DateConverterTest.class,
//FinancialStatementTest.class,
//MoneyTest.class,
//PaymentDocumentTest.class,
//CostItemTest.class,
//ProjectFinResultTransactionTest.class,
//ProjectStageTest.class,
//ProjectTest.class,
//ExchangeRateDAOTest.class,
//DataManagerTest.class,
//ProjectDAOTest.class,
//CostItemDAOTest.class
})
public class AllTests {
}
| UTF-8 | Java | 1,066 | java | AllTests.java | Java | []
| null | []
| package ua.com.goit.gojava.POM;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
//import ua.com.goit.gojava.POM.dataModel.*;
/*import ua.com.goit.gojava.POM.dataModel.cash.*;
import ua.com.goit.gojava.POM.dataModel.common.*;
import ua.com.goit.gojava.POM.dataModel.documents.*;
import ua.com.goit.gojava.POM.dataModel.profitcost.*;
import ua.com.goit.gojava.POM.persistence.fileDB.*;
import ua.com.goit.gojava.POM.persistence.postgresDB.ExchangeRateDAOTest;
*/
@RunWith(Suite.class)
@SuiteClasses({
//BankAccountTest.class,
//CashMovementEntryTest.class,
//DateConverterTest.class,
//FinancialStatementTest.class,
//MoneyTest.class,
//PaymentDocumentTest.class,
//CostItemTest.class,
//ProjectFinResultTransactionTest.class,
//ProjectStageTest.class,
//ProjectTest.class,
//ExchangeRateDAOTest.class,
//DataManagerTest.class,
//ProjectDAOTest.class,
//CostItemDAOTest.class
})
public class AllTests {
}
| 1,066 | 0.721388 | 0.721388 | 47 | 20.680851 | 19.323788 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.255319 | false | false | 15 |
ebb7dc571d36a205b1f5206888a154e316e99329 | 14,834,817,049,477 | d7f87df7be436f8d5e6d4613177a2ad945d2ee09 | /SimpleTodo/app/src/main/java/ca/aniche/simpletodo/model/TodoItem.java | 24aa89f7d6bac234d0af372291dbfb42eb7b1862 | []
| no_license | anichelabs/learningAndroid | https://github.com/anichelabs/learningAndroid | f52b6466bd2333dbbbf08ca39a2f10916eaa04d1 | f1e38c8739671fcd42db8058168bda83da676eff | refs/heads/master | 2021-01-16T21:23:29.609000 | 2017-04-06T17:42:05 | 2017-04-06T17:42:05 | 32,780,137 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ca.aniche.simpletodo.model;
import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
@Table(name = "TodoItems")
public class TodoItem extends Model {
@Column(name = "Body")
private String body;
@Column(name = "Priority")
private int priority;
@Column(name = "Completed", unique = true, onUniqueConflict = Column.ConflictAction.REPLACE)
private int completed;
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public boolean isCompleted(){
return completed > 0 ? true: false;
}
public void setCompleted(boolean isCompleted){
this.completed = isCompleted ? 1 : 0;
}
} | UTF-8 | Java | 927 | java | TodoItem.java | Java | []
| null | []
| package ca.aniche.simpletodo.model;
import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
@Table(name = "TodoItems")
public class TodoItem extends Model {
@Column(name = "Body")
private String body;
@Column(name = "Priority")
private int priority;
@Column(name = "Completed", unique = true, onUniqueConflict = Column.ConflictAction.REPLACE)
private int completed;
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public boolean isCompleted(){
return completed > 0 ? true: false;
}
public void setCompleted(boolean isCompleted){
this.completed = isCompleted ? 1 : 0;
}
} | 927 | 0.655879 | 0.652643 | 43 | 20.581396 | 20.252169 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.348837 | false | false | 15 |
0fab57c8c2e15f17619d2af93de81a4704c93d73 | 8,177,617,761,729 | 50f8908a21e991bacb9ba11024e061b05ca53040 | /Interview/src/patternPractice/Pattern8.java | 17355b6a393996eb40b0493962682b373a6b0dfe | []
| no_license | SKNarayan/JavaProgramming | https://github.com/SKNarayan/JavaProgramming | 5f50ec874605218732c117c51e942968401e24da | fd58cbac21cdf3e0b4aab640950b462ce93f1193 | refs/heads/main | 2023-07-11T11:31:56.580000 | 2021-08-07T19:01:01 | 2021-08-07T19:01:01 | 328,651,160 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package patternPractice;
public class Pattern8{
public static void main(String[] args) {
for(char c='E'; c>='A'; c--){
for(int i=1; i<=5; i++){
System.out.print(c+" ");
}
System.out.println();
}
}
}
| UTF-8 | Java | 279 | java | Pattern8.java | Java | []
| null | []
| package patternPractice;
public class Pattern8{
public static void main(String[] args) {
for(char c='E'; c>='A'; c--){
for(int i=1; i<=5; i++){
System.out.print(c+" ");
}
System.out.println();
}
}
}
| 279 | 0.448029 | 0.437276 | 15 | 17.6 | 16.288237 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false | 15 |
d3f77a70c414f1b08f19230703419883250c9674 | 3,109,556,344,961 | 5e6019c7a958541bb2f9ae280f83b32df824d2d4 | /Assignment1/src/Course.java | f2dbf0b3662e6a1015afddbdc3bcc70fa550889b | []
| no_license | sohamvg/COL106_Assignments | https://github.com/sohamvg/COL106_Assignments | 681db61245bd34a6331c65432b0fe247d8e9d76a | 4f92324e29d0ba205190855f6220bac0ba37ab57 | refs/heads/master | 2020-07-03T03:57:42.263000 | 2019-11-26T14:10:31 | 2019-11-26T14:10:31 | 201,776,523 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Iterator;
public class Course implements Entity_ {
String name;
String code;
List<Student> courseStudents;
public Course(String name, String code) {
this.name = name;
this.code = code;
courseStudents = new List<Student>();
}
@Override
public String name() {
return this.name;
}
public String code() {
return this.code;
}
public void addStudent(Student student) {
courseStudents.add(student);
}
@Override
public Iterator<Student_> studentList() {
return new studentItr(this);
}
class studentItr implements Iterator<Student_> {
Node<Student> curr;
public studentItr(Course course) {
curr = course.courseStudents.head();
}
@Override
public boolean hasNext() {
return curr != null;
}
@Override
public Student next() {
Student data = curr.value();
curr = (Node<Student>) curr.after();
return data;
}
}
}
| UTF-8 | Java | 903 | java | Course.java | Java | []
| null | []
| import java.util.Iterator;
public class Course implements Entity_ {
String name;
String code;
List<Student> courseStudents;
public Course(String name, String code) {
this.name = name;
this.code = code;
courseStudents = new List<Student>();
}
@Override
public String name() {
return this.name;
}
public String code() {
return this.code;
}
public void addStudent(Student student) {
courseStudents.add(student);
}
@Override
public Iterator<Student_> studentList() {
return new studentItr(this);
}
class studentItr implements Iterator<Student_> {
Node<Student> curr;
public studentItr(Course course) {
curr = course.courseStudents.head();
}
@Override
public boolean hasNext() {
return curr != null;
}
@Override
public Student next() {
Student data = curr.value();
curr = (Node<Student>) curr.after();
return data;
}
}
}
| 903 | 0.669989 | 0.669989 | 55 | 15.418181 | 14.994169 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.654545 | false | false | 15 |
7f23c755bbcdb271ce371a5166c030e7bce27b8f | 28,166,395,569,077 | 6ad2a622b294ac34a38cd5e888abe67550daad5c | /SoccerTeam.java | 77ae516d284c6b2571bd803a1ecefc04cf77d02e | []
| no_license | Vu808/SoccerTournament | https://github.com/Vu808/SoccerTournament | e265eed33b58ca4908ca13e6b2d7becd2191a249 | b979a796034d294e06b0e10facca8b4b9b61e385 | refs/heads/master | 2021-01-20T05:22:16.803000 | 2017-09-01T03:03:43 | 2017-09-01T03:03:43 | 101,439,709 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class SoccerTeam {
private int wins;
private int losses;
private int ties;
private int points;
private static int gamesplayed;
private static int goals;
public void played(SoccerTeam opponent, int myScore, int opponentScore) {
if (myScore > opponentScore) {
wins++;
} if (myScore < opponentScore) {
losses++;
} if (myScore == opponentScore) {
ties++;
}
gamesplayed++;
goals = myScore + opponentScore;
}
public int getWins() {
return wins;
}
public int getLosses() {
return losses;
}
public int getTies() {
return ties;
}
public int getPoints() {
return points;
}
public void setOpponentWins(int opponentWins) {
this.wins = opponentWins;
}
public void setOpponentLosses(int opponentLosses) {
this.losses = opponentLosses;
} public void setOpponentTies(int opponentTies) {
this.ties = opponentTies;
}
public int tournamentPoints() {
int points;
points = this.getWins() *3 + this.getTies();
this.points = points;
return points;
}
public void resetPoints() {
wins = 0;
losses = 0;
ties = 0;
points = 0;
}
public static int gamesplayed() {
return gamesplayed;
}
public static int goalsmade() {
return goals;
}
public static void startTournament() {
gamesplayed = 0;
goals = 0;
}
}
| UTF-8 | Java | 1,384 | java | SoccerTeam.java | Java | []
| null | []
|
public class SoccerTeam {
private int wins;
private int losses;
private int ties;
private int points;
private static int gamesplayed;
private static int goals;
public void played(SoccerTeam opponent, int myScore, int opponentScore) {
if (myScore > opponentScore) {
wins++;
} if (myScore < opponentScore) {
losses++;
} if (myScore == opponentScore) {
ties++;
}
gamesplayed++;
goals = myScore + opponentScore;
}
public int getWins() {
return wins;
}
public int getLosses() {
return losses;
}
public int getTies() {
return ties;
}
public int getPoints() {
return points;
}
public void setOpponentWins(int opponentWins) {
this.wins = opponentWins;
}
public void setOpponentLosses(int opponentLosses) {
this.losses = opponentLosses;
} public void setOpponentTies(int opponentTies) {
this.ties = opponentTies;
}
public int tournamentPoints() {
int points;
points = this.getWins() *3 + this.getTies();
this.points = points;
return points;
}
public void resetPoints() {
wins = 0;
losses = 0;
ties = 0;
points = 0;
}
public static int gamesplayed() {
return gamesplayed;
}
public static int goalsmade() {
return goals;
}
public static void startTournament() {
gamesplayed = 0;
goals = 0;
}
}
| 1,384 | 0.627168 | 0.62211 | 74 | 16.675676 | 15.371181 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.864865 | false | false | 15 |
ee693462fc6b25fec8d0133e82671adfa0a101f1 | 15,255,723,884,562 | 3a6b03115f89c52c0990048d653e2d66ff85feba | /org/apache/http/impl/client/RoutedRequest.java | fc8828ee136c3ffe6760fe1221cb197364d3ffe6 | []
| no_license | isabella232/android-sdk-sources-for-api-level-1 | https://github.com/isabella232/android-sdk-sources-for-api-level-1 | 9159e92080649343e6e2be0da2b933fa9d3fea04 | c77731af5068b85a350e768757d229cae00f8098 | refs/heads/master | 2023-03-18T05:07:06.633000 | 2015-06-13T13:35:17 | 2015-06-13T13:35:17 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: RoutedRequest.java
package org.apache.http.impl.client;
import org.apache.http.conn.routing.HttpRoute;
// Referenced classes of package org.apache.http.impl.client:
// RequestWrapper
public class RoutedRequest
{
protected final RequestWrapper request;
protected final HttpRoute route;
public RoutedRequest(RequestWrapper req, HttpRoute route)
{
throw new RuntimeException("Stub!");
}
public final RequestWrapper getRequest()
{
throw new RuntimeException("Stub!");
}
public final HttpRoute getRoute()
{
throw new RuntimeException("Stub!");
}
}
| UTF-8 | Java | 770 | java | RoutedRequest.java | Java | [
{
"context": "// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://kpdus.tripod.com/jad.ht",
"end": 62,
"score": 0.9996963143348694,
"start": 46,
"tag": "NAME",
"value": "Pavel Kouznetsov"
}
]
| null | []
| // Decompiled by Jad v1.5.8e2. Copyright 2001 <NAME>.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: RoutedRequest.java
package org.apache.http.impl.client;
import org.apache.http.conn.routing.HttpRoute;
// Referenced classes of package org.apache.http.impl.client:
// RequestWrapper
public class RoutedRequest
{
protected final RequestWrapper request;
protected final HttpRoute route;
public RoutedRequest(RequestWrapper req, HttpRoute route)
{
throw new RuntimeException("Stub!");
}
public final RequestWrapper getRequest()
{
throw new RuntimeException("Stub!");
}
public final HttpRoute getRoute()
{
throw new RuntimeException("Stub!");
}
}
| 760 | 0.754545 | 0.742857 | 33 | 22.333334 | 22.582733 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.848485 | false | false | 15 |
34846c8a5fbdd84c86cc15b14515b1a155645977 | 15,255,723,881,147 | ec94bfd9ba6ac21e6b30d3286426a843b7cfb3c9 | /src/main/java/com/obok/domain/keyword/KeywordLoggerImpl.java | 60954193e75d37350fb0d0a2ef1b0fa269135026 | []
| no_license | bisori-exam/obok | https://github.com/bisori-exam/obok | 5bd4db9f4dda403200402f3b2d30753306b37f3c | ad478b8a508a4277413f485429aabb2e0f4e2ca4 | refs/heads/master | 2020-06-22T11:20:13.247000 | 2019-07-24T13:20:51 | 2019-07-24T13:20:51 | 197,703,049 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.obok.domain.keyword;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor(onConstructor_ = { @Autowired })
public class KeywordLoggerImpl implements KeywordLogger {
private final KeywordLogService keywordLogService;
@Override
public void log(String keyword) {
keywordLogService.record(keyword, 1);
}
}
| UTF-8 | Java | 453 | java | KeywordLoggerImpl.java | Java | []
| null | []
| package com.obok.domain.keyword;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor(onConstructor_ = { @Autowired })
public class KeywordLoggerImpl implements KeywordLogger {
private final KeywordLogService keywordLogService;
@Override
public void log(String keyword) {
keywordLogService.record(keyword, 1);
}
}
| 453 | 0.821192 | 0.818985 | 16 | 27.3125 | 22.963881 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8125 | false | false | 15 |
33d7c4caf67bcdcc3df2a0ccdae84507d64f8e9c | 28,321,014,394,427 | 9bc388d7df36c4a3ea9f0abacda931d828940e38 | /src/main/java/com/example/controller/CardController.java | c9a31e4eba31ff65df6b6b5dfc60bac1c2cb6072 | []
| no_license | justsayr/cardManagement | https://github.com/justsayr/cardManagement | 3ac53c0c4f46826db461c09ee306743b39203e89 | 307a419f243474a049bd988edabb9aa45b6aa3cd | refs/heads/master | 2021-01-19T13:22:01.299000 | 2017-04-12T18:10:39 | 2017-04-12T18:10:39 | 88,082,221 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.example.config.BuissnessException;
import com.example.config.ErrorResponse;
import com.example.domain.Card;
import com.example.service.CardService;
@RestController
@RequestMapping("/card")
public class CardController {
@Autowired
private CardService service;
/*@GetMapping("/{id}")
public ResponseEntity<?> getCardDetails(@PathVariable String id) throws BuissnessException{
Card card = service.getCardDetails(id);
if(card == null){
throw new BuissnessException("User not found in the system");
}
return new ResponseEntity<Card>(card, HttpStatus.OK);
}*/
@GetMapping("/{id}")
public Card getCardDetails(@PathVariable String id) throws BuissnessException{
Card card = service.getCardDetails(id);
if(card == null){
throw new BuissnessException("User not found in the system");
}
return card;
}
@GetMapping()
public List<Card> getCardDetailsByStatus(@RequestParam boolean status){
return service.getCardDetailsByStatus(status);
}
@PostMapping
public ResponseEntity<?> saveCardDeatils(@RequestBody Card card){
service.saveCard(card);
return new ResponseEntity<String>("saved successfully", HttpStatus.CREATED);
}
@ExceptionHandler(BuissnessException.class)
private ResponseEntity<?> handleException(BuissnessException ex){
ErrorResponse error = new ErrorResponse();
error.setCode(100);
error.setMessage(ex.getMessage());
return new ResponseEntity<ErrorResponse>(error, HttpStatus.OK);
}
}
| UTF-8 | Java | 2,294 | java | CardController.java | Java | []
| null | []
| package com.example.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.example.config.BuissnessException;
import com.example.config.ErrorResponse;
import com.example.domain.Card;
import com.example.service.CardService;
@RestController
@RequestMapping("/card")
public class CardController {
@Autowired
private CardService service;
/*@GetMapping("/{id}")
public ResponseEntity<?> getCardDetails(@PathVariable String id) throws BuissnessException{
Card card = service.getCardDetails(id);
if(card == null){
throw new BuissnessException("User not found in the system");
}
return new ResponseEntity<Card>(card, HttpStatus.OK);
}*/
@GetMapping("/{id}")
public Card getCardDetails(@PathVariable String id) throws BuissnessException{
Card card = service.getCardDetails(id);
if(card == null){
throw new BuissnessException("User not found in the system");
}
return card;
}
@GetMapping()
public List<Card> getCardDetailsByStatus(@RequestParam boolean status){
return service.getCardDetailsByStatus(status);
}
@PostMapping
public ResponseEntity<?> saveCardDeatils(@RequestBody Card card){
service.saveCard(card);
return new ResponseEntity<String>("saved successfully", HttpStatus.CREATED);
}
@ExceptionHandler(BuissnessException.class)
private ResponseEntity<?> handleException(BuissnessException ex){
ErrorResponse error = new ErrorResponse();
error.setCode(100);
error.setMessage(ex.getMessage());
return new ResponseEntity<ErrorResponse>(error, HttpStatus.OK);
}
}
| 2,294 | 0.78422 | 0.782912 | 80 | 27.674999 | 26.101137 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.475 | false | false | 15 |
f3633f2dc52400ed2400852b6b2d96242243b21d | 25,503,515,873,654 | 9474673a1e8cd62c820f9ffb6acadbc58090f862 | /src/main/java/vdro/tau/fish/domain/Fish.java | 308cd71b7df9d7bb2d283b3ff42d02ea613241d7 | []
| no_license | vdro/TAU-FishApp | https://github.com/vdro/TAU-FishApp | 76aaee3ef7329f584a9db992cdfe22e2bb8978a4 | 8705a5cfcf89a99c2857fe0ecb43a35336bf980b | refs/heads/master | 2022-12-02T07:35:18.284000 | 2020-01-26T14:35:27 | 2020-01-26T14:35:27 | 213,134,977 | 0 | 0 | null | false | 2022-11-16T09:59:23 | 2019-10-06T08:43:21 | 2020-01-26T14:35:30 | 2022-11-16T09:59:20 | 9,050 | 0 | 0 | 3 | C++ | false | false | package vdro.tau.fish.domain;
public class Fish {
public Fish() {
}
public Fish(int Id,
String Label,
String Name,
String Description,
int CategoryId,
int Quantity,
float NetPrice,
float GrossPrice,
boolean FakeFish) {
if (Id <= 0)
throw new IllegalArgumentException("Id should be of positive value and not 0");
if (CategoryId < 0)
throw new IllegalArgumentException("CategoryId should be of positive value");
if (Quantity < 0)
throw new IllegalArgumentException("Quantity should be of positive value");
if (NetPrice < 0)
throw new IllegalArgumentException("NetPrice should be of positive value");
if (GrossPrice < 0)
throw new IllegalArgumentException("GrossPrice should be of positive value");
this.Id = Id;
this.Label = Label;
this.Name = Name;
this.Description = Description;
this.CategoryId = CategoryId;
this.Quantity = Quantity;
this.NetPrice = NetPrice;
this.GrossPrice = GrossPrice;
this.FakeFish = FakeFish;
this.saveTimeStamps = true;
}
private int Id;
private String Label;
private String Name;
private String Description;
private int CategoryId;
private int Quantity;
private float NetPrice;
private float GrossPrice;
private boolean FakeFish;
private boolean saveTimeStamps;
public String updateDate;
public int getId() {
return Id;
}
public void setId(int id) {
Id = id;
}
public String getLabel() {
return Label;
}
public void setLabel(String label) {
Label = label;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getDescription() {
return Description;
}
public void setDescription(String description) {
Description = description;
}
public int getCategoryId() {
return CategoryId;
}
public void setCategoryId(int categoryId) {
CategoryId = categoryId;
}
public int getQuantity() {
return Quantity;
}
public void setQuantity(int quantity) {
Quantity = quantity;
}
public float getNetPrice() {
return NetPrice;
}
public void setNetPrice(float netPrice) {
NetPrice = netPrice;
}
public float getGrossPrice() {
return GrossPrice;
}
public void setGrossPrice(float grossPrice) {
GrossPrice = grossPrice;
}
public boolean isFakeFish() {
return FakeFish;
}
public void setFakeFish(boolean fakeFish) {
FakeFish = fakeFish;
}
public String getUpdateDate() {
return updateDate;
}
public void setUpdateDate(String date) throws IllegalStateException {
if (true == this.saveTimeStamps)
this.updateDate = date;
else
throw new IllegalStateException("Cannot set time stamp. This fish has disabled time stamps.");
}
public boolean isSaveTimeStamps() {
return saveTimeStamps;
}
public void setSaveTimeStamps(boolean saveTimeStamps) {
this.saveTimeStamps = saveTimeStamps;
}
} | UTF-8 | Java | 3,414 | java | Fish.java | Java | []
| null | []
| package vdro.tau.fish.domain;
public class Fish {
public Fish() {
}
public Fish(int Id,
String Label,
String Name,
String Description,
int CategoryId,
int Quantity,
float NetPrice,
float GrossPrice,
boolean FakeFish) {
if (Id <= 0)
throw new IllegalArgumentException("Id should be of positive value and not 0");
if (CategoryId < 0)
throw new IllegalArgumentException("CategoryId should be of positive value");
if (Quantity < 0)
throw new IllegalArgumentException("Quantity should be of positive value");
if (NetPrice < 0)
throw new IllegalArgumentException("NetPrice should be of positive value");
if (GrossPrice < 0)
throw new IllegalArgumentException("GrossPrice should be of positive value");
this.Id = Id;
this.Label = Label;
this.Name = Name;
this.Description = Description;
this.CategoryId = CategoryId;
this.Quantity = Quantity;
this.NetPrice = NetPrice;
this.GrossPrice = GrossPrice;
this.FakeFish = FakeFish;
this.saveTimeStamps = true;
}
private int Id;
private String Label;
private String Name;
private String Description;
private int CategoryId;
private int Quantity;
private float NetPrice;
private float GrossPrice;
private boolean FakeFish;
private boolean saveTimeStamps;
public String updateDate;
public int getId() {
return Id;
}
public void setId(int id) {
Id = id;
}
public String getLabel() {
return Label;
}
public void setLabel(String label) {
Label = label;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getDescription() {
return Description;
}
public void setDescription(String description) {
Description = description;
}
public int getCategoryId() {
return CategoryId;
}
public void setCategoryId(int categoryId) {
CategoryId = categoryId;
}
public int getQuantity() {
return Quantity;
}
public void setQuantity(int quantity) {
Quantity = quantity;
}
public float getNetPrice() {
return NetPrice;
}
public void setNetPrice(float netPrice) {
NetPrice = netPrice;
}
public float getGrossPrice() {
return GrossPrice;
}
public void setGrossPrice(float grossPrice) {
GrossPrice = grossPrice;
}
public boolean isFakeFish() {
return FakeFish;
}
public void setFakeFish(boolean fakeFish) {
FakeFish = fakeFish;
}
public String getUpdateDate() {
return updateDate;
}
public void setUpdateDate(String date) throws IllegalStateException {
if (true == this.saveTimeStamps)
this.updateDate = date;
else
throw new IllegalStateException("Cannot set time stamp. This fish has disabled time stamps.");
}
public boolean isSaveTimeStamps() {
return saveTimeStamps;
}
public void setSaveTimeStamps(boolean saveTimeStamps) {
this.saveTimeStamps = saveTimeStamps;
}
} | 3,414 | 0.598125 | 0.596368 | 144 | 22.715279 | 21.217676 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.402778 | false | false | 15 |
58376666dacee99400075a02337a507d1eab34e8 | 28,827,820,511,061 | 8f2c2e357d5eb4d8a46ff43a900ada1df8c0a4bd | /49. Group Anagrams.java | 36f6fa40c741021016edb96f0941183108bb95a4 | []
| no_license | tiwarisahil91/leetcode | https://github.com/tiwarisahil91/leetcode | f0a653466a2c73fec0eae49fd0c6418480cce43b | cc1d2a2020087c2e911f4b67ae2577afc6af832d | refs/heads/master | 2023-03-27T04:02:55.995000 | 2021-03-25T00:20:33 | 2021-03-25T00:20:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | class Solution {
public List<List<String>> groupAnagrams(String[] strs) {
List<List<String>> groupedAnagrams = new ArrayList<>();
if(strs == null || strs.length < 1) return groupedAnagrams;
Map<String, List<String>> map = new HashMap<>();
for(String word : strs){
char[] characters = word.toCharArray();
Arrays.sort(characters);
String sortedString = new String(characters);
if(!map.containsKey(sortedString)) {
map.put(sortedString, new ArrayList<String>());
}
map.get(sortedString).add(word);
}
groupedAnagrams.addAll(map.values());
return groupedAnagrams;
}
} | UTF-8 | Java | 622 | java | 49. Group Anagrams.java | Java | []
| null | []
| class Solution {
public List<List<String>> groupAnagrams(String[] strs) {
List<List<String>> groupedAnagrams = new ArrayList<>();
if(strs == null || strs.length < 1) return groupedAnagrams;
Map<String, List<String>> map = new HashMap<>();
for(String word : strs){
char[] characters = word.toCharArray();
Arrays.sort(characters);
String sortedString = new String(characters);
if(!map.containsKey(sortedString)) {
map.put(sortedString, new ArrayList<String>());
}
map.get(sortedString).add(word);
}
groupedAnagrams.addAll(map.values());
return groupedAnagrams;
}
} | 622 | 0.665595 | 0.663987 | 18 | 33.611111 | 20.782309 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.5 | false | false | 15 |
48b883d97a2d726fc43f70372e8f79325b6d46d8 | 31,181,462,593,975 | 33ced4ea107265f9d51727ce8defcb331bd4dd35 | /src/CollisionInfo.java | 42b852d7868bd98b720209a7227bafbe4cb213c0 | []
| no_license | amiram-yss/ass3 | https://github.com/amiram-yss/ass3 | 5b528d27e51e95b87e0935af8f10a8c4d0b3d570 | 00410543987d6bf02b4428c3c9ab36a8ac30f27a | refs/heads/master | 2023-04-15T20:29:50.111000 | 2021-05-03T20:21:17 | 2021-05-03T20:21:17 | 362,926,211 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* @author Amiram Yassif
* 314985474
* ass3
*/
public class CollisionInfo {
/**
* Properties
*/
private Point _collisionPoint;
private Collidable _collisionObject;
/**
* Constructor
* @param collisionPoint The collision point.
* @param object The object collided.
*/
public CollisionInfo(Point collisionPoint, Collidable object){
_collisionPoint = collisionPoint;
_collisionObject = object;
}
/**
*
* @return the point at which the collision occurs.
*/
public Point collisionPoint() {
return this._collisionPoint;
}
/**
*
* @return the collidable object involved in the collision.
*/
public Collidable collisionObject(){
return this._collisionObject;
}
/**
* Overrides to string for printing methods.
* @return String format.
*/
public String toString(){
return String.format("Obj: " + this._collisionObject + "Point: "+this._collisionPoint);
}
}
| UTF-8 | Java | 1,048 | java | CollisionInfo.java | Java | [
{
"context": "/**\n * @author Amiram Yassif\n * 314985474\n * ass3\n */\npublic class CollisionIn",
"end": 28,
"score": 0.9998829364776611,
"start": 15,
"tag": "NAME",
"value": "Amiram Yassif"
}
]
| null | []
| /**
* @author <NAME>
* 314985474
* ass3
*/
public class CollisionInfo {
/**
* Properties
*/
private Point _collisionPoint;
private Collidable _collisionObject;
/**
* Constructor
* @param collisionPoint The collision point.
* @param object The object collided.
*/
public CollisionInfo(Point collisionPoint, Collidable object){
_collisionPoint = collisionPoint;
_collisionObject = object;
}
/**
*
* @return the point at which the collision occurs.
*/
public Point collisionPoint() {
return this._collisionPoint;
}
/**
*
* @return the collidable object involved in the collision.
*/
public Collidable collisionObject(){
return this._collisionObject;
}
/**
* Overrides to string for printing methods.
* @return String format.
*/
public String toString(){
return String.format("Obj: " + this._collisionObject + "Point: "+this._collisionPoint);
}
}
| 1,041 | 0.599237 | 0.589695 | 46 | 21.782608 | 21.835266 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | false | false | 15 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.