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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e968211f796591c79e93deef07aae9e438d07edf | 1,537,598,336,047 | 53f155e3b14ac0a78ba905662e80a139a85b2d3a | /src/Hamming.java | 071f330f8b80e543ec927c29dc9ddc7fc66d246e | [] | no_license | sppiires/Guuuggle | https://github.com/sppiires/Guuuggle | 2916be3d8e15b88a55d03c848bcc253284ded69d | 2a3d1c6e36c2e32a0a28d2c8089029f276d52ee8 | refs/heads/master | 2018-01-07T12:01:28.629000 | 2015-02-07T20:45:21 | 2015-02-07T20:45:21 | 33,508,337 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Projecto de POO
// Desenvolvido por:
// Vitor Garcia Graveto - Aluno 1991034365
// Sergio Pinto Pires - Aluno 2013171534
import java.awt.Color;
import java.awt.Graphics;
import java.io.Serializable;
import java.util.ArrayList;
public class Hamming extends Agentes implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
public Hamming(int raio, String cor, String forma, Ponto pos) {
super(raio, cor, forma, pos);
super.setTipo("hamming");
}
public Ponto novaPosicao(int iteracao) {
Ponto novoPonto = null;
Percepcao per = this.getListaPer().get(iteracao-1);
if(per.getPercepcao().size() >0){
novoPonto= maiorHamming(per);
if (novoPonto!=null)
novoPonto = new Ponto(novoPonto);
System.out.println("Hamming: Posicao Objecto Hamming - "+ novoPonto);
}
if (novoPonto==null || this.jaVisitado(novoPonto)){ // se ja visitado ou se enexistente sorteia ponto extermo visao
do{
novoPonto= new Ponto(this.sortearPosicaoExtremoVisao());
} while (this.jaVisitado(novoPonto)); // impede a repeticao de posicao ja visitada
System.out.println("Hamming: Posicao Extremo Visao - "+ novoPonto);
}
return novoPonto;
}
/**
* Retorna o Ponto do objecto percepcionado com maior distancia de hamming em relaรงรฃo aos existentes na memoria do agente
* @param per ArrayList- Lista de percepcoes do agente.
* @return Ponto- Ponto com maior disntacia de hamming.
*/
private Ponto maiorHamming(Percepcao per){
int distancia = -1, dist, distParcial;
Objectos obj = null;
Ponto pos = null;
ArrayList<Objectos> memoria = this.getMemoria();
///percorrer a lista de percepcao
for (int i=0; i<per.getPercepcao().size(); i++){
obj = null;
if((distancia==-1)&&(!per.getPercepcao().get(i).getPosicao().coincidente(this.getPosicao()))){
distancia = 0;
obj = per.getPercepcao().get(i);
pos = obj.getPosicao(); // inicializa posicao a devolver
} else if(!per.getPercepcao().get(i).getPosicao().coincidente(this.getPosicao())){
obj = per.getPercepcao().get(i);
}
if (obj!=null){ // encontrado objecto na percepcao nao coincidente com posicao actual
//comparar com todos os da Memoria determinando a menor distancia de hamming
dist = 3;
for(Objectos objM:memoria){
distParcial = this.distanciaHamming(objM, obj);
if (distParcial<=dist){
dist =distParcial;
}
}
if (dist>distancia){ // se distancia de hamming for maior que anteriores actualiza posicao
pos = obj.getPosicao();
}
if (dist==3)
break; // distancia hamming maxima abortar pesquisa - optimizacao
}
}
return pos;
}
/**
* Recebendo dois objectos retorna a distancia de hamming entre os dois.
* @param a Objectos - Objecto a.
* @param b Objectos- Objecto b.
* @return int- distancia de hamming.
*/
private int distanciaHamming(Objectos a, Objectos b){
// calcula e retorna a distancia de hamming entre 2 objectos
// a distancia sera o nr de caracteristicas diferentes entre 2 objectos
int distancia=0;
if (a==null || b==null) // se um dos objectos for null distancia hamming e maxima
return 3;
if (a.getCor().equals(b.getCor()))
distancia++;
if (a.getForma().equals(b.getForma()))
distancia++;
if (a.getNome().equals(b.getNome()))
distancia++;
/*
//consideramos a pos x e y para evitar ao maximo repetir o mesmo objecto
if (a.getPosicao().getX()!= b.getPosicao().getX())
distancia++;
if (a.getPosicao().getY()!= b.getPosicao().getY())
distancia++;
*/
return distancia;
}
@Override
public void desenhar(Graphics g, int deltaX, int deltaY) {
// TODO Auto-generated method stub
Color c = g.getColor();
g.setColor(new Color(0,255,0)); // pinta cor verde
g.fillArc((this.getPosicao().getX()-1)*deltaX+deltaX/4, (this.getPosicao().getY()-1)*deltaY+deltaY/4, deltaX /2 , deltaY/2, 0, 360);
g.setColor(c);
}
} | UTF-8 | Java | 3,964 | java | Hamming.java | Java | [
{
"context": "// Projecto de POO\n//\t Desenvolvido por:\n// \t\tVitor Garcia Graveto - Aluno 1991034365\n// \t\tSergio Pinto Pires - Alun",
"end": 66,
"score": 0.9997367262840271,
"start": 46,
"tag": "NAME",
"value": "Vitor Garcia Graveto"
},
{
"context": "// \t\tVitor Garcia Gravet... | null | [] | // Projecto de POO
// Desenvolvido por:
// <NAME> - Aluno 1991034365
// <NAME> - Aluno 2013171534
import java.awt.Color;
import java.awt.Graphics;
import java.io.Serializable;
import java.util.ArrayList;
public class Hamming extends Agentes implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
public Hamming(int raio, String cor, String forma, Ponto pos) {
super(raio, cor, forma, pos);
super.setTipo("hamming");
}
public Ponto novaPosicao(int iteracao) {
Ponto novoPonto = null;
Percepcao per = this.getListaPer().get(iteracao-1);
if(per.getPercepcao().size() >0){
novoPonto= maiorHamming(per);
if (novoPonto!=null)
novoPonto = new Ponto(novoPonto);
System.out.println("Hamming: Posicao Objecto Hamming - "+ novoPonto);
}
if (novoPonto==null || this.jaVisitado(novoPonto)){ // se ja visitado ou se enexistente sorteia ponto extermo visao
do{
novoPonto= new Ponto(this.sortearPosicaoExtremoVisao());
} while (this.jaVisitado(novoPonto)); // impede a repeticao de posicao ja visitada
System.out.println("Hamming: Posicao Extremo Visao - "+ novoPonto);
}
return novoPonto;
}
/**
* Retorna o Ponto do objecto percepcionado com maior distancia de hamming em relaรงรฃo aos existentes na memoria do agente
* @param per ArrayList- Lista de percepcoes do agente.
* @return Ponto- Ponto com maior disntacia de hamming.
*/
private Ponto maiorHamming(Percepcao per){
int distancia = -1, dist, distParcial;
Objectos obj = null;
Ponto pos = null;
ArrayList<Objectos> memoria = this.getMemoria();
///percorrer a lista de percepcao
for (int i=0; i<per.getPercepcao().size(); i++){
obj = null;
if((distancia==-1)&&(!per.getPercepcao().get(i).getPosicao().coincidente(this.getPosicao()))){
distancia = 0;
obj = per.getPercepcao().get(i);
pos = obj.getPosicao(); // inicializa posicao a devolver
} else if(!per.getPercepcao().get(i).getPosicao().coincidente(this.getPosicao())){
obj = per.getPercepcao().get(i);
}
if (obj!=null){ // encontrado objecto na percepcao nao coincidente com posicao actual
//comparar com todos os da Memoria determinando a menor distancia de hamming
dist = 3;
for(Objectos objM:memoria){
distParcial = this.distanciaHamming(objM, obj);
if (distParcial<=dist){
dist =distParcial;
}
}
if (dist>distancia){ // se distancia de hamming for maior que anteriores actualiza posicao
pos = obj.getPosicao();
}
if (dist==3)
break; // distancia hamming maxima abortar pesquisa - optimizacao
}
}
return pos;
}
/**
* Recebendo dois objectos retorna a distancia de hamming entre os dois.
* @param a Objectos - Objecto a.
* @param b Objectos- Objecto b.
* @return int- distancia de hamming.
*/
private int distanciaHamming(Objectos a, Objectos b){
// calcula e retorna a distancia de hamming entre 2 objectos
// a distancia sera o nr de caracteristicas diferentes entre 2 objectos
int distancia=0;
if (a==null || b==null) // se um dos objectos for null distancia hamming e maxima
return 3;
if (a.getCor().equals(b.getCor()))
distancia++;
if (a.getForma().equals(b.getForma()))
distancia++;
if (a.getNome().equals(b.getNome()))
distancia++;
/*
//consideramos a pos x e y para evitar ao maximo repetir o mesmo objecto
if (a.getPosicao().getX()!= b.getPosicao().getX())
distancia++;
if (a.getPosicao().getY()!= b.getPosicao().getY())
distancia++;
*/
return distancia;
}
@Override
public void desenhar(Graphics g, int deltaX, int deltaY) {
// TODO Auto-generated method stub
Color c = g.getColor();
g.setColor(new Color(0,255,0)); // pinta cor verde
g.fillArc((this.getPosicao().getX()-1)*deltaX+deltaX/4, (this.getPosicao().getY()-1)*deltaY+deltaY/4, deltaX /2 , deltaY/2, 0, 360);
g.setColor(c);
}
} | 3,938 | 0.675416 | 0.663301 | 123 | 31.219513 | 29.84827 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.98374 | false | false | 13 |
122da48b00c807ba5ac44ca827e61bc921941e7b | 30,090,540,907,131 | 0366f0f1aeb9128284e5875bdf98f78e9faac641 | /src/main/java/com/fulinlin/constant/GitCommitConstants.java | d20e31037cfc61a38ce4a25c3b644aa18d8d0656 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | MagicLean/git-commit-message-helper | https://github.com/MagicLean/git-commit-message-helper | 792bc4b997ac7a47a356a3197c2fa38a86331955 | e0f69aabd6dab56b774ec5c4570f8899a0401268 | refs/heads/master | 2023-06-11T00:05:04.426000 | 2021-07-06T02:44:46 | 2021-07-06T02:44:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fulinlin.constant;
/**
* @program: git-commit-message-helper
* @author: fulin
* @create: 2019-12-08 11:37
**/
public class GitCommitConstants {
public static final String DEFAULT_TEMPLATE = "#if($author)[${author}]#end #if($card)#${card}#end #if($type)${type}#end: #if($subject)${subject}#end\n" +
"#if($body)${newline}${newline}${body}#end\n";
}
| UTF-8 | Java | 380 | java | GitCommitConstants.java | Java | [
{
"context": " * @program: git-commit-message-helper\n * @author: fulin\n * @create: 2019-12-08 11:37\n **/\npublic class Gi",
"end": 92,
"score": 0.9983782768249512,
"start": 87,
"tag": "USERNAME",
"value": "fulin"
}
] | null | [] | package com.fulinlin.constant;
/**
* @program: git-commit-message-helper
* @author: fulin
* @create: 2019-12-08 11:37
**/
public class GitCommitConstants {
public static final String DEFAULT_TEMPLATE = "#if($author)[${author}]#end #if($card)#${card}#end #if($type)${type}#end: #if($subject)${subject}#end\n" +
"#if($body)${newline}${newline}${body}#end\n";
}
| 380 | 0.636842 | 0.605263 | 11 | 33.545456 | 42.817505 | 157 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | false | false | 13 |
cf0e356a006e7e09c61c8e31440c4eefd4b0453e | 20,615,843,072,052 | 0d3bdc40752f589efbc5aa880205577e9352a39c | /src/algorithms/SCConcreteGraphComputer.java | 48557b11ce522ab352b04b393da1f7c5532b620c | [] | no_license | stratosphr/stratestx | https://github.com/stratosphr/stratestx | 7385c33c6c87a38377bb51695a6d41ee7c6683c2 | ed57642cb018acb6dcba04bb9557e89bed8e1742 | refs/heads/master | 2021-09-24T10:36:59.791000 | 2018-10-08T07:49:33 | 2018-10-08T07:50:27 | 110,984,237 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package algorithms;
import langs.eventb.Event;
import langs.eventb.substitutions.Skip;
import langs.formal.graphs.AGraph;
import langs.formal.graphs.CTS;
import langs.formal.graphs.ConcreteState;
import langs.formal.graphs.ConcreteTransition;
import utilities.tuples.Tuple;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
/**
* Created by gvoiron on 19/12/17.
* Time : 13:39
*/
public final class SCConcreteGraphComputer extends AComputer<AGraph<ConcreteState, ConcreteTransition>> {
private final AGraph<ConcreteState, ConcreteTransition> graph;
private final AGraph<ConcreteState, ConcreteTransition> scgraph;
private final ConcreteState initialState;
private final String initialTransitionLabel;
private final String finalTransitionLabel;
private final LinkedHashMap<ConcreteState, ArrayList<ConcreteTransition>> adjacency;
public SCConcreteGraphComputer(AGraph<ConcreteState, ConcreteTransition> graph, ConcreteState initialState, String initialTransitionLabel, String finalTransitionLabel) {
this.graph = graph;
this.scgraph = graph.cloned();
this.initialState = initialState;
this.initialTransitionLabel = initialTransitionLabel;
this.finalTransitionLabel = finalTransitionLabel;
this.adjacency = new LinkedHashMap<>();
graph.getStates().forEach(state -> adjacency.put(state, new ArrayList<>()));
graph.getTransitions().forEach(transition -> adjacency.get(transition.getSource()).add(transition));
}
@Override
AGraph<ConcreteState, ConcreteTransition> run() {
scgraph.getInitialStates().clear();
scgraph.getInitialStates().add(initialState);
scgraph.getStates().add(initialState);
LinkedHashSet<ConcreteState> sources = new LinkedHashSet<>(graph.getInitialStates());
LinkedHashSet<ConcreteState> sinks = new LinkedHashSet<>();
ArrayList<LinkedHashSet<ConcreteState>> components = new SCComponentsComputer<>(graph).compute().getResult();
for (LinkedHashSet<ConcreteState> component : components) {
Tuple<LinkedHashSet<ConcreteState>, ArrayList<ConcreteTransition>> rchblPart = new RchblPartComputer<>(new CTS(
new LinkedHashSet<>(Collections.singleton(component.iterator().next())),
graph.getStates(),
new ArrayList<>(graph.getTransitions())
)).compute().getResult();
if (component.size() == rchblPart.getLeft().size()) {
sinks.add(component.iterator().next());
}
}
for (ConcreteState source : sources) {
scgraph.getTransitions().add(new ConcreteTransition(initialState, new Event(initialTransitionLabel, new Skip()), source));
}
for (ConcreteState sink : sinks) {
scgraph.getTransitions().add(new ConcreteTransition(sink, new Event(finalTransitionLabel, new Skip()), initialState));
}
return scgraph;
}
}
| UTF-8 | Java | 3,055 | java | SCConcreteGraphComputer.java | Java | [
{
"context": "import java.util.LinkedHashSet;\n\n/**\n * Created by gvoiron on 19/12/17.\n * Time : 13:39\n */\npublic final cla",
"end": 424,
"score": 0.9996793270111084,
"start": 417,
"tag": "USERNAME",
"value": "gvoiron"
}
] | null | [] | package algorithms;
import langs.eventb.Event;
import langs.eventb.substitutions.Skip;
import langs.formal.graphs.AGraph;
import langs.formal.graphs.CTS;
import langs.formal.graphs.ConcreteState;
import langs.formal.graphs.ConcreteTransition;
import utilities.tuples.Tuple;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
/**
* Created by gvoiron on 19/12/17.
* Time : 13:39
*/
public final class SCConcreteGraphComputer extends AComputer<AGraph<ConcreteState, ConcreteTransition>> {
private final AGraph<ConcreteState, ConcreteTransition> graph;
private final AGraph<ConcreteState, ConcreteTransition> scgraph;
private final ConcreteState initialState;
private final String initialTransitionLabel;
private final String finalTransitionLabel;
private final LinkedHashMap<ConcreteState, ArrayList<ConcreteTransition>> adjacency;
public SCConcreteGraphComputer(AGraph<ConcreteState, ConcreteTransition> graph, ConcreteState initialState, String initialTransitionLabel, String finalTransitionLabel) {
this.graph = graph;
this.scgraph = graph.cloned();
this.initialState = initialState;
this.initialTransitionLabel = initialTransitionLabel;
this.finalTransitionLabel = finalTransitionLabel;
this.adjacency = new LinkedHashMap<>();
graph.getStates().forEach(state -> adjacency.put(state, new ArrayList<>()));
graph.getTransitions().forEach(transition -> adjacency.get(transition.getSource()).add(transition));
}
@Override
AGraph<ConcreteState, ConcreteTransition> run() {
scgraph.getInitialStates().clear();
scgraph.getInitialStates().add(initialState);
scgraph.getStates().add(initialState);
LinkedHashSet<ConcreteState> sources = new LinkedHashSet<>(graph.getInitialStates());
LinkedHashSet<ConcreteState> sinks = new LinkedHashSet<>();
ArrayList<LinkedHashSet<ConcreteState>> components = new SCComponentsComputer<>(graph).compute().getResult();
for (LinkedHashSet<ConcreteState> component : components) {
Tuple<LinkedHashSet<ConcreteState>, ArrayList<ConcreteTransition>> rchblPart = new RchblPartComputer<>(new CTS(
new LinkedHashSet<>(Collections.singleton(component.iterator().next())),
graph.getStates(),
new ArrayList<>(graph.getTransitions())
)).compute().getResult();
if (component.size() == rchblPart.getLeft().size()) {
sinks.add(component.iterator().next());
}
}
for (ConcreteState source : sources) {
scgraph.getTransitions().add(new ConcreteTransition(initialState, new Event(initialTransitionLabel, new Skip()), source));
}
for (ConcreteState sink : sinks) {
scgraph.getTransitions().add(new ConcreteTransition(sink, new Event(finalTransitionLabel, new Skip()), initialState));
}
return scgraph;
}
}
| 3,055 | 0.70802 | 0.704746 | 67 | 44.597015 | 37.61869 | 173 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.835821 | false | false | 13 |
c16aa788360fc6692544c7d5d373ebb5853438f1 | 13,365,938,236,699 | 414eef02f9f795aef545b45d4991f974fb98787b | /Architectural-pattern/hexa/restaurant-service/src/main/java/com/manhpd/restaurantservice/adapter/Request.java | 04b0b0caa5565e5f3b2797d63481da4c8bc50707 | [] | no_license | DucManhPhan/Design-Pattern | https://github.com/DucManhPhan/Design-Pattern | 16c2252b5e9946a7f4f1bc565da23779bfc67a58 | 59143088e1321e9fe5d3f93b85d472452d5c16a6 | refs/heads/master | 2023-07-19T20:57:07.370000 | 2022-12-11T14:50:36 | 2022-12-11T14:50:36 | 142,884,065 | 1 | 1 | null | false | 2023-07-07T21:53:02 | 2018-07-30T14:06:02 | 2022-01-09T03:50:30 | 2023-07-07T21:52:58 | 54,930 | 0 | 1 | 11 | Java | false | false | package com.manhpd.restaurantservice.adapter;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public class Request {
public String orderId;
public String customerId;
public String productId;
}
| UTF-8 | Java | 217 | java | Request.java | Java | [] | null | [] | package com.manhpd.restaurantservice.adapter;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public class Request {
public String orderId;
public String customerId;
public String productId;
}
| 217 | 0.774194 | 0.774194 | 14 | 14.5 | 15.393644 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 13 |
d2c155a91384d3305a023d19194814702a3b30e3 | 18,202,071,465,648 | df10ef63526ed3c74ff78d5c24be6c43705c8aca | /hive-core/src/main/java/de/konni/hive/core/Action.java | 2a2d6da5f56a3ecd4bb8e43272c1416434efe4e1 | [] | no_license | konnika/Test | https://github.com/konnika/Test | afad12c008fd81e65a1bee26ae57cbfe0727d6ea | 3fbce839a3da4b3722e8c12a88537c6fdca562ef | refs/heads/master | 2016-09-05T17:22:20.895000 | 2015-10-18T23:24:02 | 2015-10-18T23:24:02 | 16,511,421 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.konni.hive.core;
import de.konni.hive.core.enums.ActionType;
/**
* An action contains every info needed to execute and undo a put or move.
*/
public class Action {
protected final Piece piece;
protected final Coordinate origin;
protected final Coordinate target;
protected final ActionType actionType;
public Action(final Piece piece, final Coordinate target, final ActionType actionType) {
this.piece = piece;
if (piece.getPos() != null) {
this.origin = piece.getPos().copy();
} else {
this.origin = null;
}
this.target = target;
this.actionType = actionType;
}
public Piece getPiece() {
return piece;
}
public Coordinate getOrigin() {
return origin;
}
public Coordinate getTarget() {
return target;
}
public void execute(final Board board) {
if (ActionType.PUT == actionType) {
board.put(piece, target);
} else {
board.move(piece, target);
}
}
public void undo(final Board board) {
if (ActionType.PUT == actionType) {
piece.setPos(origin);
board.remove(piece);
piece.setInStash(true);
} else {
board.move(piece, origin); // calculates the border as well
}
}
@Override
public String toString() {
if (ActionType.PUT == actionType) {
return "put " + piece.toString() + " on " + target.toString();
} else {
return "move " + piece.toString() + " from " + origin.toString() + " to " + target.toString();
}
}
public ActionType getActionType() {
return actionType;
}
}
| UTF-8 | Java | 1,742 | java | Action.java | Java | [] | null | [] | package de.konni.hive.core;
import de.konni.hive.core.enums.ActionType;
/**
* An action contains every info needed to execute and undo a put or move.
*/
public class Action {
protected final Piece piece;
protected final Coordinate origin;
protected final Coordinate target;
protected final ActionType actionType;
public Action(final Piece piece, final Coordinate target, final ActionType actionType) {
this.piece = piece;
if (piece.getPos() != null) {
this.origin = piece.getPos().copy();
} else {
this.origin = null;
}
this.target = target;
this.actionType = actionType;
}
public Piece getPiece() {
return piece;
}
public Coordinate getOrigin() {
return origin;
}
public Coordinate getTarget() {
return target;
}
public void execute(final Board board) {
if (ActionType.PUT == actionType) {
board.put(piece, target);
} else {
board.move(piece, target);
}
}
public void undo(final Board board) {
if (ActionType.PUT == actionType) {
piece.setPos(origin);
board.remove(piece);
piece.setInStash(true);
} else {
board.move(piece, origin); // calculates the border as well
}
}
@Override
public String toString() {
if (ActionType.PUT == actionType) {
return "put " + piece.toString() + " on " + target.toString();
} else {
return "move " + piece.toString() + " from " + origin.toString() + " to " + target.toString();
}
}
public ActionType getActionType() {
return actionType;
}
}
| 1,742 | 0.570034 | 0.570034 | 67 | 25 | 22.834249 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.41791 | false | false | 13 |
b5cfcabd6eff02ee1e43f922601a8201fc4e0842 | 19,318,762,905,800 | a8a5665efe21cd9c7468dd83f1e080389f8b2194 | /webclient/src/main/java/org/fourgeeks/gha/webclient/client/institution/GWTInstitutionService.java | 9f392a7732ac4ae98b1037681d06593564cad271 | [] | no_license | idbcgroup/GMH | https://github.com/idbcgroup/GMH | 7d330f62c2ceb58f62cdf7685a7def59735ae790 | 9e678b862eac4f37de4326a84f1395699cffc3f6 | refs/heads/master | 2016-09-06T21:21:43.048000 | 2014-09-04T11:18:05 | 2014-09-04T12:29:39 | 24,333,372 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package org.fourgeeks.gha.webclient.client.institution;
import java.util.List;
import org.fourgeeks.gha.domain.exceptions.GHAEJBException;
import org.fourgeeks.gha.domain.mix.Institution;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
/**
* @author emiliot
*
*/
@RemoteServiceRelativePath("institution")
public interface GWTInstitutionService extends RemoteService{
/**
* @param Id
* @throws GHAEJBException
*/
public void delete(long Id) throws GHAEJBException;
/**
* @param institution
* @return the list of institutions
* @throws GHAEJBException
*/
public List<Institution> find(Institution institution) throws GHAEJBException;
/**
* @param Id
* @return the institution
* @throws GHAEJBException
*/
public Institution find(long Id) throws GHAEJBException;
/**
* @return the list of institutions
* @throws GHAEJBException
*/
public List<Institution> getAll() throws GHAEJBException;
/**
* @param institution
* @return the saved institution
* @throws GHAEJBException
*/
public Institution save(Institution institution) throws GHAEJBException;
/**
* @param institution
* @return the updated institution
* @throws GHAEJBException
*/
public Institution update(Institution institution) throws GHAEJBException;
}
| UTF-8 | Java | 1,361 | java | GWTInstitutionService.java | Java | [
{
"context": "ent.rpc.RemoteServiceRelativePath;\n\n/**\n * @author emiliot\n *\n */\n@RemoteServiceRelativePath(\"institution\")\n",
"end": 344,
"score": 0.9994409680366516,
"start": 337,
"tag": "USERNAME",
"value": "emiliot"
}
] | null | [] | /**
*
*/
package org.fourgeeks.gha.webclient.client.institution;
import java.util.List;
import org.fourgeeks.gha.domain.exceptions.GHAEJBException;
import org.fourgeeks.gha.domain.mix.Institution;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
/**
* @author emiliot
*
*/
@RemoteServiceRelativePath("institution")
public interface GWTInstitutionService extends RemoteService{
/**
* @param Id
* @throws GHAEJBException
*/
public void delete(long Id) throws GHAEJBException;
/**
* @param institution
* @return the list of institutions
* @throws GHAEJBException
*/
public List<Institution> find(Institution institution) throws GHAEJBException;
/**
* @param Id
* @return the institution
* @throws GHAEJBException
*/
public Institution find(long Id) throws GHAEJBException;
/**
* @return the list of institutions
* @throws GHAEJBException
*/
public List<Institution> getAll() throws GHAEJBException;
/**
* @param institution
* @return the saved institution
* @throws GHAEJBException
*/
public Institution save(Institution institution) throws GHAEJBException;
/**
* @param institution
* @return the updated institution
* @throws GHAEJBException
*/
public Institution update(Institution institution) throws GHAEJBException;
}
| 1,361 | 0.745775 | 0.745775 | 59 | 22.067797 | 23.158163 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.79661 | false | false | 13 |
cfef5defff1ff107884d9aae1cdaf4276ae93b17 | 3,092,376,518,913 | 763b3a5a3145d224edee1c576761a6578ed362d4 | /thequest/Spirits.java | 0dd0d0ea49535aa29e7d7c0ddc71ca303cc09f2f | [] | no_license | astreich4/TheQuest | https://github.com/astreich4/TheQuest | 87eb676e36fa00fd42bb18d247f2df7474287ec8 | dc060d4b4c4b5799f4dff6c4e77d09d490fcf6d3 | refs/heads/master | 2022-08-28T13:36:36.551000 | 2020-05-26T22:45:21 | 2020-05-26T22:45:21 | 267,166,406 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package thequest;
/**
*
* @author adamstreich
*/
public class Spirits extends Monster{
public Spirits(String Name, int HP, int level, int defense, int dodgeChance, int damage) {
super(Name, HP, level, defense, (int) (dodgeChance * 1.04), damage);
}
}
| UTF-8 | Java | 466 | java | Spirits.java | Java | [
{
"context": "e editor.\n */\npackage thequest;\n\n/**\n *\n * @author adamstreich\n */\npublic class Spirits extends Monster{\n \n ",
"end": 233,
"score": 0.996911883354187,
"start": 222,
"tag": "USERNAME",
"value": "adamstreich"
}
] | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package thequest;
/**
*
* @author adamstreich
*/
public class Spirits extends Monster{
public Spirits(String Name, int HP, int level, int defense, int dodgeChance, int damage) {
super(Name, HP, level, defense, (int) (dodgeChance * 1.04), damage);
}
}
| 466 | 0.678112 | 0.671674 | 18 | 24.888889 | 30.466537 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false | 13 |
2003506b1a6f6fbc3c8da64798a44fed7f48133d | 7,060,926,250,926 | 96652c1c0392f6a5f02d03dc85becf5111855cda | /src/jdbc/DBInsert.java | b75cf7954125b3e3fcc975b8723c5d1e8cc4189f | [] | no_license | sujan5658/javahub | https://github.com/sujan5658/javahub | af4cda09a52556a35a3d3671db44bd05096da887 | 3fd72ad0058f093f09691c91ecd27481d95cd770 | refs/heads/master | 2020-06-19T19:52:43.207000 | 2019-07-17T14:42:15 | 2019-07-17T14:42:15 | 196,849,652 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package jdbc;
import java.sql.Connection;
//import com.mysql.jdbc.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Scanner;
public class DBInsert {
String url = "jdbc:mysql://localhost/java";
String user = "sujan";
String pass = "Difficult@5658";
int id=0;
String name="";
String address="";
public DBInsert(){
try{
Class.forName("com.mysql.jdbc.Driver"); //load Driver
//Class.forName("org.gjt.mm.mysql.Driver"); //This can be also used
Connection con = (Connection) DriverManager.getConnection(url,user,pass);
System.out.println("Connected");
//Insert update delete or select
System.out.print("Enter id :");
id = new Scanner(System.in).nextInt();
System.out.print("Enter Name : ");
name = new Scanner(System.in).nextLine();
System.out.print("Enter Address : ");
address = new Scanner(System.in).nextLine();
String sql = "INSERT INTO tbl_person(id,name,address) VALUES(?,?,?)";
PreparedStatement pst = con.prepareStatement(sql);
pst.setInt(1,id);
pst.setString(2,name);
pst.setString(3,address);
pst.executeUpdate();
con.close();
System.out.println("Database Closed");
}
catch(Exception er){
System.out.println(er);
}
}
public static void main(String[] args){
new DBInsert();
}
}
| UTF-8 | Java | 1,605 | java | DBInsert.java | Java | [
{
"context": "\"jdbc:mysql://localhost/java\";\n String user = \"sujan\";\n String pass = \"Difficult@5658\";\n int id=",
"end": 322,
"score": 0.9997169375419617,
"start": 317,
"tag": "USERNAME",
"value": "sujan"
},
{
"context": "a\";\n String user = \"sujan\";\n Strin... | null | [] |
package jdbc;
import java.sql.Connection;
//import com.mysql.jdbc.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Scanner;
public class DBInsert {
String url = "jdbc:mysql://localhost/java";
String user = "sujan";
String pass = "<PASSWORD>";
int id=0;
String name="";
String address="";
public DBInsert(){
try{
Class.forName("com.mysql.jdbc.Driver"); //load Driver
//Class.forName("org.gjt.mm.mysql.Driver"); //This can be also used
Connection con = (Connection) DriverManager.getConnection(url,user,pass);
System.out.println("Connected");
//Insert update delete or select
System.out.print("Enter id :");
id = new Scanner(System.in).nextInt();
System.out.print("Enter Name : ");
name = new Scanner(System.in).nextLine();
System.out.print("Enter Address : ");
address = new Scanner(System.in).nextLine();
String sql = "INSERT INTO tbl_person(id,name,address) VALUES(?,?,?)";
PreparedStatement pst = con.prepareStatement(sql);
pst.setInt(1,id);
pst.setString(2,name);
pst.setString(3,address);
pst.executeUpdate();
con.close();
System.out.println("Database Closed");
}
catch(Exception er){
System.out.println(er);
}
}
public static void main(String[] args){
new DBInsert();
}
}
| 1,601 | 0.587539 | 0.582555 | 46 | 33.869564 | 20.217953 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.934783 | false | false | 13 |
7c17dc13dbd39ddea514b8a53ce2640a4eecdb05 | 5,377,299,118,704 | 3f5b7a89cecfdfa7e811f78e8993db2a3ae45c21 | /main/java/mod/nethertweaks/modules/MooFluidsEtc.java | 7c43cc75752563c138e088d28e8559c4f0f94c11 | [] | no_license | BarelyAlive/Nether-Tweaks | https://github.com/BarelyAlive/Nether-Tweaks | fbc10dd6102a07b030e5d80eb5af4cc4869fe228 | cce046e4cc5313b8e834b28368a44ca11f408812 | refs/heads/master | 2020-12-24T08:09:46.561000 | 2020-01-03T12:23:13 | 2020-01-03T12:23:13 | 57,054,703 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package mod.nethertweaks.modules;
import java.util.HashSet;
import java.util.Set;
import mod.nethertweaks.config.Config;
import mod.sfhcore.modules.ISFHCoreModule;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
public class MooFluidsEtc implements ISFHCoreModule {
private static final Set<Fluid> fluidSet = new HashSet<>();
private static boolean loaded = false;
public MooFluidsEtc(){
loaded = true;
}
public static boolean isLoaded()
{
return loaded;
}
@Override
public String getMODID() {
return "minimoofluidcow";
}
@Override
public void postInitServer(final FMLPostInitializationEvent event){
for(final String s : Config.fluidList)
if(FluidRegistry.isFluidRegistered(s))
fluidSet.add(FluidRegistry.getFluid(s));
}
public static boolean fluidIsAllowed(final Fluid fluid){
return fluidSet.contains(fluid) != Config.fluidListIsBlackList;
}
} | UTF-8 | Java | 997 | java | MooFluidsEtc.java | Java | [] | null | [] | package mod.nethertweaks.modules;
import java.util.HashSet;
import java.util.Set;
import mod.nethertweaks.config.Config;
import mod.sfhcore.modules.ISFHCoreModule;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
public class MooFluidsEtc implements ISFHCoreModule {
private static final Set<Fluid> fluidSet = new HashSet<>();
private static boolean loaded = false;
public MooFluidsEtc(){
loaded = true;
}
public static boolean isLoaded()
{
return loaded;
}
@Override
public String getMODID() {
return "minimoofluidcow";
}
@Override
public void postInitServer(final FMLPostInitializationEvent event){
for(final String s : Config.fluidList)
if(FluidRegistry.isFluidRegistered(s))
fluidSet.add(FluidRegistry.getFluid(s));
}
public static boolean fluidIsAllowed(final Fluid fluid){
return fluidSet.contains(fluid) != Config.fluidListIsBlackList;
}
} | 997 | 0.781344 | 0.781344 | 41 | 23.341463 | 22.476665 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.146341 | false | false | 13 |
8b4ff7b05bf88f3f9fc4a94746e0fcb4428476b1 | 26,654,567,062,492 | 892721aedbb84c21833c4e876bbb9efcefa4cbdf | /src/main/java/com/corindiano/leetcode/random/heaps/ComputeMedianStreamingData.java | ee65aa69efead72f5f4ee98ee6e3db2e959e4d7a | [] | no_license | rudradixit/leetcode | https://github.com/rudradixit/leetcode | 731d2f2b2623de313a51ded924acc727d7a53ad2 | 614ac97ca5598d23e5f3ccf86210e0f8bfe7411c | refs/heads/master | 2020-03-27T11:48:35.150000 | 2018-10-31T15:11:04 | 2018-10-31T15:11:04 | 146,508,540 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.corindiano.leetcode.random.heaps;
import java.util.Collections;
import java.util.Iterator;
import java.util.PriorityQueue;
class ComputeMedianStreamingData {
static double compute(Iterator<Integer> it) {
PriorityQueue<Integer> min = new PriorityQueue<>();
PriorityQueue<Integer> max = new PriorityQueue<>(Collections.reverseOrder());
while (it.hasNext()) {
int v = it.next();
min.offer(v);
max.offer(min.poll());
if (max.size() > min.size()) {
min.offer(max.poll());
}
}
if (min.size() > max.size()) return min.poll();
return ((double) (min.poll() + max.poll()) / 2);
}
} | UTF-8 | Java | 721 | java | ComputeMedianStreamingData.java | Java | [] | null | [] | package com.corindiano.leetcode.random.heaps;
import java.util.Collections;
import java.util.Iterator;
import java.util.PriorityQueue;
class ComputeMedianStreamingData {
static double compute(Iterator<Integer> it) {
PriorityQueue<Integer> min = new PriorityQueue<>();
PriorityQueue<Integer> max = new PriorityQueue<>(Collections.reverseOrder());
while (it.hasNext()) {
int v = it.next();
min.offer(v);
max.offer(min.poll());
if (max.size() > min.size()) {
min.offer(max.poll());
}
}
if (min.size() > max.size()) return min.poll();
return ((double) (min.poll() + max.poll()) / 2);
}
} | 721 | 0.576976 | 0.575589 | 26 | 26.76923 | 22.668697 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false | 13 |
cb8c58ba1f01a80ccd8022d0a4da360bae8d6ce0 | 20,486,994,013,819 | 9735b209b6b914d277165be81baa46e34970f781 | /crawler/src/main/java/com/hosmerlake/rss/crawler/config/CrawlerConfiguration.java | 471ac904a72b2572ee55a469b39749b9b436e4a9 | [] | no_license | dexwest/rss-server | https://github.com/dexwest/rss-server | b736786f0605d7ad40d2481423336def2b0ef39c | 7130722cab6aff284b6f3691419a31be9a6682d7 | refs/heads/master | 2021-01-13T01:44:51.081000 | 2013-10-30T06:35:05 | 2013-10-30T06:35:05 | 32,842,908 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hosmerlake.rss.crawler.config;
import java.util.List;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.hosmerlake.rss.common.interceptor.MetricLoggerInterceptor;
@Configuration
@EnableWebMvc
@PropertySource({"classpath:/crawler.properties","classpath:/env-config.properties"} )
@ComponentScan( basePackages = {"com.hosmerlake.rss.crawler","com.hosmerlake.rss.common"} )
@ImportResource( { "classpath*:/application-context.xml","classpath*:/http-client-context.xml" } )
public class CrawlerConfiguration extends WebMvcConfigurerAdapter implements EnvironmentAware {
private Environment environment;
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
converters.add(xmlMessageConverter());
super.configureMessageConverters(converters);
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new MetricLoggerInterceptor());
}
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
}
@Bean
public HttpMessageConverter<Object> xmlMessageConverter() {
return new MappingJacksonHttpMessageConverter();
}
} | UTF-8 | Java | 1,929 | java | CrawlerConfiguration.java | Java | [] | null | [] | package com.hosmerlake.rss.crawler.config;
import java.util.List;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.hosmerlake.rss.common.interceptor.MetricLoggerInterceptor;
@Configuration
@EnableWebMvc
@PropertySource({"classpath:/crawler.properties","classpath:/env-config.properties"} )
@ComponentScan( basePackages = {"com.hosmerlake.rss.crawler","com.hosmerlake.rss.common"} )
@ImportResource( { "classpath*:/application-context.xml","classpath*:/http-client-context.xml" } )
public class CrawlerConfiguration extends WebMvcConfigurerAdapter implements EnvironmentAware {
private Environment environment;
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
converters.add(xmlMessageConverter());
super.configureMessageConverters(converters);
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new MetricLoggerInterceptor());
}
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
}
@Bean
public HttpMessageConverter<Object> xmlMessageConverter() {
return new MappingJacksonHttpMessageConverter();
}
} | 1,929 | 0.825817 | 0.825817 | 51 | 36.843136 | 32.435986 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 13 |
e148f18222a0e4762e12c66dd554fd7604aba213 | 33,483,565,064,716 | 104928b13942375011ca6582c446d509b8b19bad | /src/main/java/com/garowing/gameexp/game/rts/skill/handler/effecthandler/DefaultEffectHandler.java | cf7c721ca8af8825b2e37a515779096be01602a6 | [
"MIT"
] | permissive | cool112/game | https://github.com/cool112/game | b1d7a2a3de0da5ae0e59a02e76010c1affc57254 | 61071efa6498825f9cbcc7722420c6cd399bb3ab | refs/heads/master | 2021-06-18T12:54:45.047000 | 2021-01-27T09:46:39 | 2021-01-27T09:46:39 | 152,873,406 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.garowing.gameexp.game.rts.skill.handler.effecthandler;
import java.util.List;
import com.yeto.war.fightcore.GameObject;
import com.yeto.war.fightcore.SendPacketUtil;
import com.garowing.gameexp.game.rts.skill.entity.EffectEntity;
import com.garowing.gameexp.game.rts.skill.entity.SkillEntity;
import com.garowing.gameexp.game.rts.skill.handler.SkillEffectHandler;
import com.garowing.gameexp.game.rts.skill.manager.SkillManager;
import com.yeto.war.network.gs.sendable.fight.GC_END_SKILL;
/**
* ้ป่ฎคๆๆๅ่ฐๅค็
* @author seg
*
*/
public class DefaultEffectHandler implements SkillEffectHandler
{
@Override
public void onStartSuc(EffectEntity effect, long currTime)
{
effect.setState(SkillManager.ACTIVATE);
}
@Override
public void onStartFail(EffectEntity effect, long currTime)
{
effect.setState(SkillManager.END);
effect.setEndTime(currTime);
}
@Override
public void onActivateSuc(EffectEntity effect, long currTime)
{
}
@Override
public void onActivateFail(EffectEntity effect, long currTime)
{
SkillEntity skill = effect.getSkill();
if(skill != null && !skill.getModel().isPassive())
{
GameObject caster = skill.getCaster();
skill.interrupt(caster, false);
SendPacketUtil.sendWarPacket(skill.getWar(), (sender)->{
sender.sendPacket(new GC_END_SKILL(sender.getId(), 0, skill.getObjectId(), skill.getModelId(), caster.getObjectId()));
});
}
}
}
| UTF-8 | Java | 1,427 | java | DefaultEffectHandler.java | Java | [
{
"context": "le.fight.GC_END_SKILL;\n\n/**\n * ้ป่ฎคๆๆๅ่ฐๅค็\n * @author seg\n *\n */\npublic class DefaultEffectHandler implemen",
"end": 534,
"score": 0.9929903745651245,
"start": 531,
"tag": "USERNAME",
"value": "seg"
}
] | null | [] | package com.garowing.gameexp.game.rts.skill.handler.effecthandler;
import java.util.List;
import com.yeto.war.fightcore.GameObject;
import com.yeto.war.fightcore.SendPacketUtil;
import com.garowing.gameexp.game.rts.skill.entity.EffectEntity;
import com.garowing.gameexp.game.rts.skill.entity.SkillEntity;
import com.garowing.gameexp.game.rts.skill.handler.SkillEffectHandler;
import com.garowing.gameexp.game.rts.skill.manager.SkillManager;
import com.yeto.war.network.gs.sendable.fight.GC_END_SKILL;
/**
* ้ป่ฎคๆๆๅ่ฐๅค็
* @author seg
*
*/
public class DefaultEffectHandler implements SkillEffectHandler
{
@Override
public void onStartSuc(EffectEntity effect, long currTime)
{
effect.setState(SkillManager.ACTIVATE);
}
@Override
public void onStartFail(EffectEntity effect, long currTime)
{
effect.setState(SkillManager.END);
effect.setEndTime(currTime);
}
@Override
public void onActivateSuc(EffectEntity effect, long currTime)
{
}
@Override
public void onActivateFail(EffectEntity effect, long currTime)
{
SkillEntity skill = effect.getSkill();
if(skill != null && !skill.getModel().isPassive())
{
GameObject caster = skill.getCaster();
skill.interrupt(caster, false);
SendPacketUtil.sendWarPacket(skill.getWar(), (sender)->{
sender.sendPacket(new GC_END_SKILL(sender.getId(), 0, skill.getObjectId(), skill.getModelId(), caster.getObjectId()));
});
}
}
}
| 1,427 | 0.761162 | 0.760454 | 54 | 25.129629 | 28.482643 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.351852 | false | false | 13 |
f6cce86aa6dce227258b4a775ff63acf9a99630b | 10,368,051,113,825 | 07a043349ff522275a81dc1e7a85479305e6d8d4 | /Controlador/VerificarClientesRese.java | a92c8c52cf1e80f238f2fec22f11ad44e1b087a1 | [] | no_license | Celio21/SRentaHProyectoF | https://github.com/Celio21/SRentaHProyectoF | 18bf58032e14dde90416d9bdaba0848077d7fa8c | c8eabc3e280e3ba41f1aa9cd803a12e3bb018b13 | refs/heads/master | 2022-04-20T16:30:30.876000 | 2020-04-17T16:57:29 | 2020-04-17T16:57:29 | 254,626,380 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Controlador;
import Modelo.Clientes;
import Modelo.ClientesDB;
import Vista.ReservaV;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
/**
*
* @author USUARIO
*/
public class VerificarClientesRese implements ActionListener{
ReservaV cl;
Clientes c;
ClientesDB lb;
public VerificarClientesRese( ReservaV cl) {
this.cl = cl;
}
@Override
public void actionPerformed(ActionEvent e) {
c = lb.buscarCliente(cl.verificarC());
if (c.getNumeroDoc() == null) {
cl.inhabilitar();
JOptionPane.showConfirmDialog(cl, "El cliente no esta registrado no puedes seguir");
} else {
JOptionPane.showConfirmDialog(cl, "El cliente esta registrado ");
cl.habilitar();
}
}
}
| UTF-8 | Java | 1,095 | java | VerificarClientesRese.java | Java | [
{
"context": "rt javax.swing.JOptionPane;\r\n\r\n/**\r\n *\r\n * @author USUARIO\r\n */\r\npublic class VerificarClientesRese implements",
"end": 427,
"score": 0.9748685359954834,
"start": 420,
"tag": "USERNAME",
"value": "USUARIO"
}
] | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Controlador;
import Modelo.Clientes;
import Modelo.ClientesDB;
import Vista.ReservaV;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
/**
*
* @author USUARIO
*/
public class VerificarClientesRese implements ActionListener{
ReservaV cl;
Clientes c;
ClientesDB lb;
public VerificarClientesRese( ReservaV cl) {
this.cl = cl;
}
@Override
public void actionPerformed(ActionEvent e) {
c = lb.buscarCliente(cl.verificarC());
if (c.getNumeroDoc() == null) {
cl.inhabilitar();
JOptionPane.showConfirmDialog(cl, "El cliente no esta registrado no puedes seguir");
} else {
JOptionPane.showConfirmDialog(cl, "El cliente esta registrado ");
cl.habilitar();
}
}
}
| 1,095 | 0.63105 | 0.63105 | 47 | 21.297873 | 23.62645 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.446809 | false | false | 13 |
2cb319f3924453950972df2960bba66ddb5dfa85 | 16,346,645,563,435 | ae2497903fbdffae78e5da3708befc5313382bf0 | /6350062/src/main/java/randy/oberon0/ast/selector/DotSelector.java | 435f0856b085761f2084113a3914964fb40c150d | [] | no_license | tvdstorm/sea-of-oberon0 | https://github.com/tvdstorm/sea-of-oberon0 | 88cdf8ace2f039050d1a6879bd90962bd1326f42 | 1ad75a7aeb7367af5a9854b38584561a7df5f5d1 | refs/heads/master | 2021-01-10T18:38:25.532000 | 2011-03-06T22:07:55 | 2011-03-06T22:07:55 | 33,249,217 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package randy.oberon0.ast.selector;
import randy.oberon0.exception.*;
import randy.oberon0.exception.RuntimeException;
import randy.oberon0.interpreter.runtime.environment.*;
import randy.oberon0.interpreter.typecheck.environment.*;
import randy.oberon0.value.*;
public class DotSelector extends Selector
{
private final Selector selector;
private final String recordMemberName;
public DotSelector(Selector _selector, String _recordMemberName)
{
assert(_selector != null);
assert(_recordMemberName != null);
assert(_recordMemberName.length() > 0);
selector = _selector;
recordMemberName = _recordMemberName;
}
@Override
public Reference evaluate(RuntimeEnvironment environment) throws RuntimeException
{
assert(environment != null);
// Evaluate the selector and convert it to a record
final Record record = (Record)selector.evaluate(environment).getValue();
// Evaluate the member and return it
return record.getMemberValue(recordMemberName);
}
@Override
public TypeCheckReference typeCheck(TypeCheckEnvironment environment) throws TypeCheckException
{
assert(environment != null);
// Evaluate the selector and convert it to a record
final ITypeCheckType type = selector.typeCheck(environment).getValue();
if (!(type instanceof TypeCheckRecordType))
{
throw new TypeMismatchException(type.toString(), "RECORD");
}
final TypeCheckRecordType record = (TypeCheckRecordType)type;
// Evaluate the member and return it
return new TypeCheckReference(record.getMemberType(recordMemberName, environment));
}
}
| UTF-8 | Java | 1,604 | java | DotSelector.java | Java | [] | null | [] | package randy.oberon0.ast.selector;
import randy.oberon0.exception.*;
import randy.oberon0.exception.RuntimeException;
import randy.oberon0.interpreter.runtime.environment.*;
import randy.oberon0.interpreter.typecheck.environment.*;
import randy.oberon0.value.*;
public class DotSelector extends Selector
{
private final Selector selector;
private final String recordMemberName;
public DotSelector(Selector _selector, String _recordMemberName)
{
assert(_selector != null);
assert(_recordMemberName != null);
assert(_recordMemberName.length() > 0);
selector = _selector;
recordMemberName = _recordMemberName;
}
@Override
public Reference evaluate(RuntimeEnvironment environment) throws RuntimeException
{
assert(environment != null);
// Evaluate the selector and convert it to a record
final Record record = (Record)selector.evaluate(environment).getValue();
// Evaluate the member and return it
return record.getMemberValue(recordMemberName);
}
@Override
public TypeCheckReference typeCheck(TypeCheckEnvironment environment) throws TypeCheckException
{
assert(environment != null);
// Evaluate the selector and convert it to a record
final ITypeCheckType type = selector.typeCheck(environment).getValue();
if (!(type instanceof TypeCheckRecordType))
{
throw new TypeMismatchException(type.toString(), "RECORD");
}
final TypeCheckRecordType record = (TypeCheckRecordType)type;
// Evaluate the member and return it
return new TypeCheckReference(record.getMemberType(recordMemberName, environment));
}
}
| 1,604 | 0.758728 | 0.754364 | 45 | 33.644444 | 26.617584 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.755556 | false | false | 13 |
268256ff0e1dbd1253d307c7bfb1a7515cc50d04 | 3,246,995,342,744 | 00927c4299d6a579aec5b9ec4d24c56b5e854a85 | /build/tmp/expandedArchives/forge-1.16.1-32.0.63_mapped_snapshot_20200707-1.16.1-sources.jar_8d0cc9b90400e5fca82470166432cd30/net/minecraft/util/ColorHelper.java | c6818fdd0502a5307ba56692215777b292b4c911 | [] | no_license | NguyenVux/Future-Combat | https://github.com/NguyenVux/Future-Combat | 99a5bdbefe7c8e588cce070a06321a13f4f4891b | c25fa63494a48a5aa4391014ee117e7c8b4f5079 | refs/heads/master | 2022-12-02T09:03:32.402000 | 2020-07-30T14:34:23 | 2020-07-30T14:34:23 | 278,262,671 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.minecraft.util;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class ColorHelper {
public static class PackedColor {
@OnlyIn(Dist.CLIENT)
public static int getAlpha(int packedColorIn) {
return packedColorIn >>> 24;
}
public static int getRed(int packedColorIn) {
return packedColorIn >> 16 & 255;
}
public static int getGreen(int packedColorIn) {
return packedColorIn >> 8 & 255;
}
public static int getBlue(int packedColorIn) {
return packedColorIn & 255;
}
@OnlyIn(Dist.CLIENT)
public static int packColor(int alphaIn, int redIn, int greenIn, int blueIn) {
return alphaIn << 24 | redIn << 16 | greenIn << 8 | blueIn;
}
@OnlyIn(Dist.CLIENT)
public static int blendColors(int packedColourOne, int packedColorTwo) {
return packColor(getAlpha(packedColourOne) * getAlpha(packedColorTwo) / 255, getRed(packedColourOne) * getRed(packedColorTwo) / 255, getGreen(packedColourOne) * getGreen(packedColorTwo) / 255, getBlue(packedColourOne) * getBlue(packedColorTwo) / 255);
}
}
} | UTF-8 | Java | 1,197 | java | ColorHelper.java | Java | [] | null | [] | package net.minecraft.util;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class ColorHelper {
public static class PackedColor {
@OnlyIn(Dist.CLIENT)
public static int getAlpha(int packedColorIn) {
return packedColorIn >>> 24;
}
public static int getRed(int packedColorIn) {
return packedColorIn >> 16 & 255;
}
public static int getGreen(int packedColorIn) {
return packedColorIn >> 8 & 255;
}
public static int getBlue(int packedColorIn) {
return packedColorIn & 255;
}
@OnlyIn(Dist.CLIENT)
public static int packColor(int alphaIn, int redIn, int greenIn, int blueIn) {
return alphaIn << 24 | redIn << 16 | greenIn << 8 | blueIn;
}
@OnlyIn(Dist.CLIENT)
public static int blendColors(int packedColourOne, int packedColorTwo) {
return packColor(getAlpha(packedColourOne) * getAlpha(packedColorTwo) / 255, getRed(packedColourOne) * getRed(packedColorTwo) / 255, getGreen(packedColourOne) * getGreen(packedColorTwo) / 255, getBlue(packedColourOne) * getBlue(packedColorTwo) / 255);
}
}
} | 1,197 | 0.672515 | 0.646617 | 35 | 33.228573 | 45.735943 | 260 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.542857 | false | false | 13 |
51e3d5e664a81474df7d62bf2d44f89f8d59e6fa | 11,287,174,075,211 | aab22dd87f94fac0d7a67fde8391f5c7696783ab | /yoonsung0711/src/main/java/yoonsung0711/implOfADT/QueueSample.java | 9ad9245393ac16ee7c3e1a0401d791daa7573078 | [] | no_license | bulkwang-study/algol | https://github.com/bulkwang-study/algol | c1db58b84169e8f14b1575e5b3fb94658d6c8133 | 8b51173066719004e1ddfba1aa19f228fa3e182a | refs/heads/master | 2020-05-27T15:20:52.962000 | 2019-07-01T05:22:47 | 2019-07-01T05:22:47 | 188,679,290 | 0 | 2 | null | false | 2019-06-04T01:00:42 | 2019-05-26T12:20:16 | 2019-06-02T10:55:58 | 2019-06-04T01:00:41 | 26 | 0 | 2 | 0 | Java | false | false | package yoonsung0711.implOfADT;
public class QueueSample {
Node first;
Node last;
void add(Node newNode){
if (this.last != null){
this.last.next = newNode;
}
this.last = newNode;
if (this.first == null){
this.first = last;
}
}
Node pop(){
Node tmp = this.first;
this.first = this.first.next;
return tmp;
}
public static void main(String[] args) {
QueueSample q = new QueueSample();
q.add(new Node(1));
q.add(new Node(4));
q.add(new Node(3));
q.add(new Node(8));
System.out.println(q.pop());
System.out.println(q.pop());
System.out.println(q.pop());
System.out.println(q.pop());
}
}
class Node{
int number;
Node next;
Node(int number){
this.number = number;
}
public String toString(){
return "" + this.number;
}
} | UTF-8 | Java | 796 | java | QueueSample.java | Java | [] | null | [] | package yoonsung0711.implOfADT;
public class QueueSample {
Node first;
Node last;
void add(Node newNode){
if (this.last != null){
this.last.next = newNode;
}
this.last = newNode;
if (this.first == null){
this.first = last;
}
}
Node pop(){
Node tmp = this.first;
this.first = this.first.next;
return tmp;
}
public static void main(String[] args) {
QueueSample q = new QueueSample();
q.add(new Node(1));
q.add(new Node(4));
q.add(new Node(3));
q.add(new Node(8));
System.out.println(q.pop());
System.out.println(q.pop());
System.out.println(q.pop());
System.out.println(q.pop());
}
}
class Node{
int number;
Node next;
Node(int number){
this.number = number;
}
public String toString(){
return "" + this.number;
}
} | 796 | 0.615578 | 0.605528 | 51 | 14.627451 | 12.066744 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.823529 | false | false | 13 |
1c037eed8a55464d4a086056b08bfaae2fe12721 | 27,865,747,873,024 | 360f9f4715d7c0057a8490f6f1ba43e16aa0c935 | /src/main/java/br/com/javaparaweb/financeiro/webservice/FinanceiroWS.java | cfa4a240a1aadee6979920c5dd4682b78fee500a | [
"Apache-2.0"
] | permissive | fabioindaiatuba/Livro_JavaParaWeb | https://github.com/fabioindaiatuba/Livro_JavaParaWeb | 5e3d2e0ca0f10bbbb0059072815c0b83291ff29f | a5c3aa2fbd0c0878fac89eac28551cedf8b1467c | refs/heads/master | 2021-01-20T18:28:15.462000 | 2016-08-05T13:16:59 | 2016-08-05T13:16:59 | 64,953,815 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.javaparaweb.financeiro.webservice;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import br.com.javaparaweb.financeiro.conta.Conta;
import br.com.javaparaweb.financeiro.conta.ContaRN;
import br.com.javaparaweb.financeiro.lancamento.Lancamento;
import br.com.javaparaweb.financeiro.lancamento.LancamentoRN;
@WebService
public class FinanceiroWS {
@WebMethod
public float saldo(@WebParam(name="conta") int conta, @WebParam(name="dataSaldo") Date data){
LancamentoRN lancamentoRN = new LancamentoRN();
ContaRN contaRN = new ContaRN();
Conta contaPesquisado = contaRN.carregar(new Integer(conta));
Float saldo = lancamentoRN.saldo(contaPesquisado, data);
return saldo.floatValue();
}
@WebMethod
public List<LancamentoItem> extrato(@WebParam(name="conta") int conta, @WebParam(name="de") Date de,
@WebParam(name="ate") Date ate){
LancamentoRN lancamentoRN = new LancamentoRN();
ContaRN contaRN = new ContaRN();
List<LancamentoItem> retorno = new ArrayList<>();
LancamentoItem lancamentoItem = null;
Conta contaPesquisado = contaRN.carregar(new Integer(conta));
List<Lancamento> listaLancamentos = lancamentoRN.listar(contaPesquisado, de, ate);
for(Lancamento lancamento:listaLancamentos){
lancamentoItem = new LancamentoItem();
lancamentoItem.setData(lancamento.getData());
lancamentoItem.setDescricao(lancamento.getDescricao());
lancamentoItem.setValor(lancamento.getValor().floatValue());
retorno.add(lancamentoItem);
}
return retorno;
}
}
| UTF-8 | Java | 1,641 | java | FinanceiroWS.java | Java | [] | null | [] | package br.com.javaparaweb.financeiro.webservice;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import br.com.javaparaweb.financeiro.conta.Conta;
import br.com.javaparaweb.financeiro.conta.ContaRN;
import br.com.javaparaweb.financeiro.lancamento.Lancamento;
import br.com.javaparaweb.financeiro.lancamento.LancamentoRN;
@WebService
public class FinanceiroWS {
@WebMethod
public float saldo(@WebParam(name="conta") int conta, @WebParam(name="dataSaldo") Date data){
LancamentoRN lancamentoRN = new LancamentoRN();
ContaRN contaRN = new ContaRN();
Conta contaPesquisado = contaRN.carregar(new Integer(conta));
Float saldo = lancamentoRN.saldo(contaPesquisado, data);
return saldo.floatValue();
}
@WebMethod
public List<LancamentoItem> extrato(@WebParam(name="conta") int conta, @WebParam(name="de") Date de,
@WebParam(name="ate") Date ate){
LancamentoRN lancamentoRN = new LancamentoRN();
ContaRN contaRN = new ContaRN();
List<LancamentoItem> retorno = new ArrayList<>();
LancamentoItem lancamentoItem = null;
Conta contaPesquisado = contaRN.carregar(new Integer(conta));
List<Lancamento> listaLancamentos = lancamentoRN.listar(contaPesquisado, de, ate);
for(Lancamento lancamento:listaLancamentos){
lancamentoItem = new LancamentoItem();
lancamentoItem.setData(lancamento.getData());
lancamentoItem.setDescricao(lancamento.getDescricao());
lancamentoItem.setValor(lancamento.getValor().floatValue());
retorno.add(lancamentoItem);
}
return retorno;
}
}
| 1,641 | 0.764778 | 0.764778 | 52 | 30.557692 | 26.528225 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.903846 | false | false | 13 |
ffb3cdc0b450e463fdaa7989d79ec9f2e89f2729 | 33,509,334,885,423 | b23467f03817d7fa4a52450d699c0db0333d14de | /app/src/main/java/com/chichio/xsds/ui/fragment/mainpage/MineFragment.java | de47a3e119d1fe5287a2f63c75f11a7933b71d6e | [] | no_license | AngelBo/xinshuidashi | https://github.com/AngelBo/xinshuidashi | 0d828c14e0fb714fb29f0ad0b9bd91e8759b8d3a | a05edc1fb38cae38441cd875472b367ad9aec022 | refs/heads/master | 2017-04-20T15:07:42.561000 | 2016-10-22T12:29:46 | 2016-10-22T12:29:47 | 68,602,357 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.chichio.xsds.ui.fragment.mainpage;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.chichio.xsds.R;
import com.chichio.xsds.base.LazyFragment;
import com.chichio.xsds.event.UserInfoEvent;
import com.chichio.xsds.greendao.DBManager;
import com.chichio.xsds.model.request.GetUserInfoReq;
import com.chichio.xsds.model.response.UserInfo;
import com.chichio.xsds.model.response.UserRes;
import com.chichio.xsds.mvp.mainpage.mine.MineFragmentPresenter;
import com.chichio.xsds.mvp.mainpage.mine.MineFragmentView;
import com.chichio.xsds.netapi.ApiCallback;
import com.chichio.xsds.netapi.SubscriberCallBack;
import com.chichio.xsds.ui.activity.ChongZhiActivity;
import com.chichio.xsds.ui.activity.CouperActivity;
import com.chichio.xsds.ui.activity.FanKuiActivity;
import com.chichio.xsds.ui.activity.GouMaiFangAnJiLuActivity;
import com.chichio.xsds.ui.activity.HaveFocusActivity;
import com.chichio.xsds.ui.activity.HelpCenterActivity;
import com.chichio.xsds.ui.activity.JiaoYiJiLuActivity;
import com.chichio.xsds.ui.activity.LoginActivity;
import com.chichio.xsds.ui.activity.PersonalInfoActivity;
import com.chichio.xsds.ui.activity.PingTaiXieYiActivity;
import com.chichio.xsds.ui.activity.ShenHeResultActivity;
import com.chichio.xsds.ui.activity.ShouYiTiXianActivity;
import com.chichio.xsds.utils.CommonUtil;
import com.chichio.xsds.view.CircleImageView;
import com.chichio.xsds.view.RefreshLayout;
import com.squareup.picasso.Picasso;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by Administrator on 2016/9/18.
*/
public class MineFragment extends LazyFragment<MineFragmentPresenter> implements MineFragmentView, View.OnClickListener, SwipeRefreshLayout.OnRefreshListener {
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.swipe)
RefreshLayout swipe;
@BindView(R.id.rl_header)
RelativeLayout rl_header; //ๅคด้จๅธๅฑ ๆช็ปๅฝ็นๅป ็ปๅฝ็นๅป ่งฆๅไธๅ็ไบไปถ
@BindView(R.id.header)
CircleImageView header; //ๅคดๅ
@BindView(R.id.tv_pleaselogin)
TextView tv_pleaselogin;//็นๅป็ปๅฝๆ็คบ ๅจๅทฒ็ปๅฝ็ๆถๅ้่ฆๆถๅคฑๆ
@BindView(R.id.rl_info)
RelativeLayout rl_info;//ๅทฒ็ปๅฝ็ๆถๅๆพ็คบ็ๆถๆฏ
@BindView(R.id.tv_name)
TextView tv_name; //ๆต็งฐ
@BindView(R.id.tv_des)
TextView tv_des; //ๆ่ฟฐ
@BindView(R.id.tv_money)
TextView tv_money; //้ฑๅธ
@BindView(R.id.img_level)
ImageView img_level; //้ฑๅธ
@BindView(R.id.rl_chongzhi)
RelativeLayout rl_chongzhi; //ๅ
ๅผ
@BindView(R.id.rl_tiyanquan)
RelativeLayout rl_tiyanquan; //ไฝ้ชๅธ
@BindView(R.id.rl_jiaoyijilu)
RelativeLayout rl_jiaoyijilu; //ไบคๆ่ฎฐๅฝ
@BindView(R.id.rl_yiguanzhu)
RelativeLayout rl_yiguanzhu; //ๅทฒๅ
ณๆณจ
@BindView(R.id.rl_goumaifangan)
RelativeLayout rl_goumaifangan;//่ดญไนฐๆนๆก่ฎฐๅฝ
@BindView(R.id.rl_yaoqinghaoyou)
RelativeLayout rl_yaoqinghaoyou; //้่ฏทๅฅฝๅ
@BindView(R.id.rl_shenqingxsh)
RelativeLayout rl_shenqingxsh; //็ณ่ฏทๅฟๆฐดๅธ
@BindView(R.id.rl_fabutuijian)
RelativeLayout rl_fabutuijian; //ๅๅธๆจ่
@BindView(R.id.rl_tuijianliebiao)
RelativeLayout rl_tuijianliebiao;//ๆจ่ๅ่กจ
@BindView(R.id.rl_shouyitixian)
RelativeLayout rl_shouyitixian; //ๆถ็ๆ็ฐ
@BindView(R.id.rl_bangzhuzhongxin)
RelativeLayout rl_bangzhuzhongxin; //ๅธฎๅฉไธญๅฟ
@Override
protected void onCreateViewLazy(Bundle savedInstanceState) {
super.onCreateViewLazy(savedInstanceState);
setContentView(R.layout.fragment_mine);
ButterKnife.bind(this, getContentView());
EventBus.getDefault().register(this);
initView();
}
private void initView() {
onRefresh();//่ฎพ็ฝฎ็จๆทไฟกๆฏ
CommonUtil.setSwipeColor(swipe);
toolbar.setNavigationIcon(R.drawable.mine_seeting);
toolbar.inflateMenu(R.menu.mine_menu);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), PersonalInfoActivity.class));
}else {
startActivity(new Intent(getActivity(), LoginActivity.class));
}
}
});
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if (item.getItemId() == R.id.fankui) {
startActivity(new Intent(getActivity(), FanKuiActivity.class));
}
return true;
}
});
swipe.setOnRefreshListener(this);
rl_header.setOnClickListener(this);
rl_chongzhi.setOnClickListener(this);
rl_tiyanquan.setOnClickListener(this);
rl_jiaoyijilu.setOnClickListener(this);
rl_yiguanzhu.setOnClickListener(this);
rl_shenqingxsh.setOnClickListener(this);
rl_bangzhuzhongxin.setOnClickListener(this);
rl_goumaifangan.setOnClickListener(this);
rl_shouyitixian.setOnClickListener(this);
rl_yaoqinghaoyou.setOnClickListener(this);
}
@Override
protected MineFragmentPresenter createPresenter() {
return null;
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.rl_header:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), PersonalInfoActivity.class));
}else {
startActivity(new Intent(getActivity(), LoginActivity.class));
}
break;
case R.id.rl_chongzhi:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), ChongZhiActivity.class));
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_tiyanquan:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), CouperActivity.class));
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_jiaoyijilu:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), JiaoYiJiLuActivity.class));
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_yiguanzhu:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), HaveFocusActivity.class));
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_shenqingxsh:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
int userStatus = DBManager.getInstance(getApplicationContext()).queryUserList().get(0).getUserStatus();
if(userStatus==0) {
startActivity(new Intent(getActivity(), PingTaiXieYiActivity.class));
}else if(userStatus == 1) {
//ๅฎกๆ ธไธญ
Intent intent = new Intent(getActivity(), ShenHeResultActivity.class);
intent.putExtra("userStates",1);
startActivity(intent);
}else if(userStatus ==2) {
//ๅฎกๆ ธๆๅ
Intent intent = new Intent(getActivity(), ShenHeResultActivity.class);
intent.putExtra("userStates",2);
startActivity(intent);
}else if(userStatus ==3) {
//ๅฎกๆ ธๅคฑ่ดฅ
Intent intent = new Intent(getActivity(), ShenHeResultActivity.class);
intent.putExtra("userStates",3);
startActivity(intent);
}
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_bangzhuzhongxin:
startActivity(new Intent(getActivity(), HelpCenterActivity.class));
break;
case R.id.rl_goumaifangan:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), GouMaiFangAnJiLuActivity.class));
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_shouyitixian:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), ShouYiTiXianActivity.class));
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_yaoqinghaoyou:
// startActivity(new Intent(getActivity(), ShouYiTiXianActivity.class));
break;
}
}
public void getUserInfoAndSet() {
List<UserInfo> list_user = DBManager.getInstance(getActivity()).queryUserList();
if (list_user.size() > 0) {
UserInfo userInfo = list_user.get(0);
rl_info.setVisibility(View.VISIBLE);
tv_pleaselogin.setVisibility(View.GONE);
tv_name.setText(userInfo.getNickName());
tv_money.setText(userInfo.getTotalCoin() + "");
int gradle = userInfo.getUserGrade();
if (gradle == 1) {
img_level.setImageResource(R.drawable.mine_shaoxia);
} else if (gradle == 2) {
img_level.setImageResource(R.drawable.mine_daxia);
} else if (gradle == 3) {
img_level.setImageResource(R.drawable.mine_dashi);
} else if (gradle == 4) {
img_level.setImageResource(R.drawable.mine_zongshi);
}else {
img_level.setVisibility(View.GONE);
}
if (!TextUtils.isEmpty(userInfo.getHeadImageUrl())) {
Picasso.with(getActivity()).load(userInfo.getHeadImageUrl()).placeholder(R.mipmap.ic_launcher)
.error(R.mipmap.ic_launcher).into(header);
}else {
Picasso.with(getActivity()).load(R.drawable.default_header).into(header);
}
if (userInfo.getBrief() != null) {
tv_des.setText(userInfo.getBrief());
}
}
}
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (hidden) {
//้่
Log.i("hidden", "hidden");
} else {
//ๆพ็คบ
Log.i("hidden", "!hidden");
getUserInfoAndSet();
}
}
@Subscribe
public void event(UserInfoEvent userInfoEvent) {
switch (userInfoEvent.eventType) {
case UserInfoEvent.UPDATE_USERINFO:
getUserInfoAndSet();
break;
}
}
@Override
protected void onDestroyViewLazy() {
super.onDestroyViewLazy();
EventBus.getDefault().unregister(this);
}
@Override
public void onRefresh() {
List<UserInfo> list_user = DBManager.getInstance(getActivity()).queryUserList();
if(list_user.size()>0) {
GetUserInfoReq getUserInfoReq = new GetUserInfoReq();
getUserInfoReq.actType = "122";
getUserInfoReq.from = "2";
getUserInfoReq.userId = list_user.get(0).getUserId()+"";
addSubscription(apiService.getUserInfo(getUserInfoReq),new SubscriberCallBack<>(new ApiCallback<UserRes>() {
@Override
public void onSuccess(UserRes userRes) {
if("0000".equals(userRes.error)) {
DBManager.getInstance(getActivity()).updateUser(userRes.value.get(0));
UserInfo userInfo = userRes.value.get(0);
rl_info.setVisibility(View.VISIBLE);
tv_pleaselogin.setVisibility(View.GONE);
tv_name.setText(userInfo.getNickName());
tv_money.setText(userInfo.getTotalCoin() + "");
int gradle = userInfo.getUserGrade();
if (gradle == 1) {
img_level.setImageResource(R.drawable.mine_shaoxia);
} else if (gradle == 2) {
img_level.setImageResource(R.drawable.mine_daxia);
} else if (gradle == 3) {
img_level.setImageResource(R.drawable.mine_dashi);
} else if (gradle == 4) {
img_level.setImageResource(R.drawable.mine_zongshi);
}else {
img_level.setVisibility(View.GONE);
}
if (!TextUtils.isEmpty(userInfo.getHeadImageUrl())) {
Picasso.with(getActivity()).load(userInfo.getHeadImageUrl()).placeholder(R.mipmap.ic_launcher)
.error(R.mipmap.ic_launcher).into(header);
}else {
Picasso.with(getActivity()).load(R.drawable.default_header).into(header);
}
if (userInfo.getBrief() != null) {
tv_des.setText(userInfo.getBrief());
}
}
}
@Override
public void onFailure(int code, String msg) {
CommonUtil.toast(getActivity(),msg);
}
@Override
public void onCompleted() {
swipe.setRefreshing(false);
}
}));
}else {
swipe.setRefreshing(false);
return;
}
}
}
| UTF-8 | Java | 15,281 | java | MineFragment.java | Java | [
{
"context": "import butterknife.ButterKnife;\n\n/**\n * Created by Administrator on 2016/9/18.\n */\npublic class MineFragment exten",
"end": 1987,
"score": 0.9279583096504211,
"start": 1974,
"tag": "USERNAME",
"value": "Administrator"
}
] | null | [] | package com.chichio.xsds.ui.fragment.mainpage;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.chichio.xsds.R;
import com.chichio.xsds.base.LazyFragment;
import com.chichio.xsds.event.UserInfoEvent;
import com.chichio.xsds.greendao.DBManager;
import com.chichio.xsds.model.request.GetUserInfoReq;
import com.chichio.xsds.model.response.UserInfo;
import com.chichio.xsds.model.response.UserRes;
import com.chichio.xsds.mvp.mainpage.mine.MineFragmentPresenter;
import com.chichio.xsds.mvp.mainpage.mine.MineFragmentView;
import com.chichio.xsds.netapi.ApiCallback;
import com.chichio.xsds.netapi.SubscriberCallBack;
import com.chichio.xsds.ui.activity.ChongZhiActivity;
import com.chichio.xsds.ui.activity.CouperActivity;
import com.chichio.xsds.ui.activity.FanKuiActivity;
import com.chichio.xsds.ui.activity.GouMaiFangAnJiLuActivity;
import com.chichio.xsds.ui.activity.HaveFocusActivity;
import com.chichio.xsds.ui.activity.HelpCenterActivity;
import com.chichio.xsds.ui.activity.JiaoYiJiLuActivity;
import com.chichio.xsds.ui.activity.LoginActivity;
import com.chichio.xsds.ui.activity.PersonalInfoActivity;
import com.chichio.xsds.ui.activity.PingTaiXieYiActivity;
import com.chichio.xsds.ui.activity.ShenHeResultActivity;
import com.chichio.xsds.ui.activity.ShouYiTiXianActivity;
import com.chichio.xsds.utils.CommonUtil;
import com.chichio.xsds.view.CircleImageView;
import com.chichio.xsds.view.RefreshLayout;
import com.squareup.picasso.Picasso;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by Administrator on 2016/9/18.
*/
public class MineFragment extends LazyFragment<MineFragmentPresenter> implements MineFragmentView, View.OnClickListener, SwipeRefreshLayout.OnRefreshListener {
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.swipe)
RefreshLayout swipe;
@BindView(R.id.rl_header)
RelativeLayout rl_header; //ๅคด้จๅธๅฑ ๆช็ปๅฝ็นๅป ็ปๅฝ็นๅป ่งฆๅไธๅ็ไบไปถ
@BindView(R.id.header)
CircleImageView header; //ๅคดๅ
@BindView(R.id.tv_pleaselogin)
TextView tv_pleaselogin;//็นๅป็ปๅฝๆ็คบ ๅจๅทฒ็ปๅฝ็ๆถๅ้่ฆๆถๅคฑๆ
@BindView(R.id.rl_info)
RelativeLayout rl_info;//ๅทฒ็ปๅฝ็ๆถๅๆพ็คบ็ๆถๆฏ
@BindView(R.id.tv_name)
TextView tv_name; //ๆต็งฐ
@BindView(R.id.tv_des)
TextView tv_des; //ๆ่ฟฐ
@BindView(R.id.tv_money)
TextView tv_money; //้ฑๅธ
@BindView(R.id.img_level)
ImageView img_level; //้ฑๅธ
@BindView(R.id.rl_chongzhi)
RelativeLayout rl_chongzhi; //ๅ
ๅผ
@BindView(R.id.rl_tiyanquan)
RelativeLayout rl_tiyanquan; //ไฝ้ชๅธ
@BindView(R.id.rl_jiaoyijilu)
RelativeLayout rl_jiaoyijilu; //ไบคๆ่ฎฐๅฝ
@BindView(R.id.rl_yiguanzhu)
RelativeLayout rl_yiguanzhu; //ๅทฒๅ
ณๆณจ
@BindView(R.id.rl_goumaifangan)
RelativeLayout rl_goumaifangan;//่ดญไนฐๆนๆก่ฎฐๅฝ
@BindView(R.id.rl_yaoqinghaoyou)
RelativeLayout rl_yaoqinghaoyou; //้่ฏทๅฅฝๅ
@BindView(R.id.rl_shenqingxsh)
RelativeLayout rl_shenqingxsh; //็ณ่ฏทๅฟๆฐดๅธ
@BindView(R.id.rl_fabutuijian)
RelativeLayout rl_fabutuijian; //ๅๅธๆจ่
@BindView(R.id.rl_tuijianliebiao)
RelativeLayout rl_tuijianliebiao;//ๆจ่ๅ่กจ
@BindView(R.id.rl_shouyitixian)
RelativeLayout rl_shouyitixian; //ๆถ็ๆ็ฐ
@BindView(R.id.rl_bangzhuzhongxin)
RelativeLayout rl_bangzhuzhongxin; //ๅธฎๅฉไธญๅฟ
@Override
protected void onCreateViewLazy(Bundle savedInstanceState) {
super.onCreateViewLazy(savedInstanceState);
setContentView(R.layout.fragment_mine);
ButterKnife.bind(this, getContentView());
EventBus.getDefault().register(this);
initView();
}
private void initView() {
onRefresh();//่ฎพ็ฝฎ็จๆทไฟกๆฏ
CommonUtil.setSwipeColor(swipe);
toolbar.setNavigationIcon(R.drawable.mine_seeting);
toolbar.inflateMenu(R.menu.mine_menu);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), PersonalInfoActivity.class));
}else {
startActivity(new Intent(getActivity(), LoginActivity.class));
}
}
});
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if (item.getItemId() == R.id.fankui) {
startActivity(new Intent(getActivity(), FanKuiActivity.class));
}
return true;
}
});
swipe.setOnRefreshListener(this);
rl_header.setOnClickListener(this);
rl_chongzhi.setOnClickListener(this);
rl_tiyanquan.setOnClickListener(this);
rl_jiaoyijilu.setOnClickListener(this);
rl_yiguanzhu.setOnClickListener(this);
rl_shenqingxsh.setOnClickListener(this);
rl_bangzhuzhongxin.setOnClickListener(this);
rl_goumaifangan.setOnClickListener(this);
rl_shouyitixian.setOnClickListener(this);
rl_yaoqinghaoyou.setOnClickListener(this);
}
@Override
protected MineFragmentPresenter createPresenter() {
return null;
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.rl_header:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), PersonalInfoActivity.class));
}else {
startActivity(new Intent(getActivity(), LoginActivity.class));
}
break;
case R.id.rl_chongzhi:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), ChongZhiActivity.class));
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_tiyanquan:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), CouperActivity.class));
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_jiaoyijilu:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), JiaoYiJiLuActivity.class));
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_yiguanzhu:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), HaveFocusActivity.class));
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_shenqingxsh:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
int userStatus = DBManager.getInstance(getApplicationContext()).queryUserList().get(0).getUserStatus();
if(userStatus==0) {
startActivity(new Intent(getActivity(), PingTaiXieYiActivity.class));
}else if(userStatus == 1) {
//ๅฎกๆ ธไธญ
Intent intent = new Intent(getActivity(), ShenHeResultActivity.class);
intent.putExtra("userStates",1);
startActivity(intent);
}else if(userStatus ==2) {
//ๅฎกๆ ธๆๅ
Intent intent = new Intent(getActivity(), ShenHeResultActivity.class);
intent.putExtra("userStates",2);
startActivity(intent);
}else if(userStatus ==3) {
//ๅฎกๆ ธๅคฑ่ดฅ
Intent intent = new Intent(getActivity(), ShenHeResultActivity.class);
intent.putExtra("userStates",3);
startActivity(intent);
}
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_bangzhuzhongxin:
startActivity(new Intent(getActivity(), HelpCenterActivity.class));
break;
case R.id.rl_goumaifangan:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), GouMaiFangAnJiLuActivity.class));
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_shouyitixian:
if(DBManager.getInstance(getActivity()).queryUserList().size()>0) {
startActivity(new Intent(getActivity(), ShouYiTiXianActivity.class));
}else {
startActivity(new Intent(getActivity(),LoginActivity.class));
}
break;
case R.id.rl_yaoqinghaoyou:
// startActivity(new Intent(getActivity(), ShouYiTiXianActivity.class));
break;
}
}
public void getUserInfoAndSet() {
List<UserInfo> list_user = DBManager.getInstance(getActivity()).queryUserList();
if (list_user.size() > 0) {
UserInfo userInfo = list_user.get(0);
rl_info.setVisibility(View.VISIBLE);
tv_pleaselogin.setVisibility(View.GONE);
tv_name.setText(userInfo.getNickName());
tv_money.setText(userInfo.getTotalCoin() + "");
int gradle = userInfo.getUserGrade();
if (gradle == 1) {
img_level.setImageResource(R.drawable.mine_shaoxia);
} else if (gradle == 2) {
img_level.setImageResource(R.drawable.mine_daxia);
} else if (gradle == 3) {
img_level.setImageResource(R.drawable.mine_dashi);
} else if (gradle == 4) {
img_level.setImageResource(R.drawable.mine_zongshi);
}else {
img_level.setVisibility(View.GONE);
}
if (!TextUtils.isEmpty(userInfo.getHeadImageUrl())) {
Picasso.with(getActivity()).load(userInfo.getHeadImageUrl()).placeholder(R.mipmap.ic_launcher)
.error(R.mipmap.ic_launcher).into(header);
}else {
Picasso.with(getActivity()).load(R.drawable.default_header).into(header);
}
if (userInfo.getBrief() != null) {
tv_des.setText(userInfo.getBrief());
}
}
}
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (hidden) {
//้่
Log.i("hidden", "hidden");
} else {
//ๆพ็คบ
Log.i("hidden", "!hidden");
getUserInfoAndSet();
}
}
@Subscribe
public void event(UserInfoEvent userInfoEvent) {
switch (userInfoEvent.eventType) {
case UserInfoEvent.UPDATE_USERINFO:
getUserInfoAndSet();
break;
}
}
@Override
protected void onDestroyViewLazy() {
super.onDestroyViewLazy();
EventBus.getDefault().unregister(this);
}
@Override
public void onRefresh() {
List<UserInfo> list_user = DBManager.getInstance(getActivity()).queryUserList();
if(list_user.size()>0) {
GetUserInfoReq getUserInfoReq = new GetUserInfoReq();
getUserInfoReq.actType = "122";
getUserInfoReq.from = "2";
getUserInfoReq.userId = list_user.get(0).getUserId()+"";
addSubscription(apiService.getUserInfo(getUserInfoReq),new SubscriberCallBack<>(new ApiCallback<UserRes>() {
@Override
public void onSuccess(UserRes userRes) {
if("0000".equals(userRes.error)) {
DBManager.getInstance(getActivity()).updateUser(userRes.value.get(0));
UserInfo userInfo = userRes.value.get(0);
rl_info.setVisibility(View.VISIBLE);
tv_pleaselogin.setVisibility(View.GONE);
tv_name.setText(userInfo.getNickName());
tv_money.setText(userInfo.getTotalCoin() + "");
int gradle = userInfo.getUserGrade();
if (gradle == 1) {
img_level.setImageResource(R.drawable.mine_shaoxia);
} else if (gradle == 2) {
img_level.setImageResource(R.drawable.mine_daxia);
} else if (gradle == 3) {
img_level.setImageResource(R.drawable.mine_dashi);
} else if (gradle == 4) {
img_level.setImageResource(R.drawable.mine_zongshi);
}else {
img_level.setVisibility(View.GONE);
}
if (!TextUtils.isEmpty(userInfo.getHeadImageUrl())) {
Picasso.with(getActivity()).load(userInfo.getHeadImageUrl()).placeholder(R.mipmap.ic_launcher)
.error(R.mipmap.ic_launcher).into(header);
}else {
Picasso.with(getActivity()).load(R.drawable.default_header).into(header);
}
if (userInfo.getBrief() != null) {
tv_des.setText(userInfo.getBrief());
}
}
}
@Override
public void onFailure(int code, String msg) {
CommonUtil.toast(getActivity(),msg);
}
@Override
public void onCompleted() {
swipe.setRefreshing(false);
}
}));
}else {
swipe.setRefreshing(false);
return;
}
}
}
| 15,281 | 0.580246 | 0.577054 | 369 | 39.745258 | 27.211111 | 159 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.577236 | false | false | 13 |
a50822340626bb94dbcbe62d02950e8e1763f754 | 27,951,647,182,672 | bf2e73df6f4c09aa6c8a6d8e63b7d703c027da03 | /springboot-04/src/main/java/cn/bdqn/service/CommodityService.java | 09235cac8414fd3559b1d0959b2383f02c9953dd | [] | no_license | yinze0807/springboot | https://github.com/yinze0807/springboot | ee3f63dc224d8875d02e750131e26cafb6822ff0 | 78f957727489096b640ff6e514510a2faf48f91f | refs/heads/master | 2022-12-12T15:45:00.098000 | 2020-09-08T03:39:05 | 2020-09-08T03:39:05 | 293,693,793 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.bdqn.service;
import cn.bdqn.entity.Commodity;
import cn.bdqn.mapper.CommodityMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class CommodityService {
@Autowired
CommodityMapper commodityMapper;
//ๅ็ปๆฅ่ฏข
public void selectGroup(){
QueryWrapper<Commodity> queryWrapper = new QueryWrapper<>();
queryWrapper.select("nid","count(0)","avg(money)","sum(number)");
//ๅ็ป
queryWrapper.groupBy("type");
//ๆกไปถ
queryWrapper.having("avg(money)>{0}",10);
List<Map<String, Object>> maps = commodityMapper.selectMaps(queryWrapper);
maps.forEach(System.out::println);
}
//ๆจก็ณๆฅ่ฏข
public void selectLambda(){
LambdaQueryWrapper<Commodity> user = new LambdaQueryWrapper<>();
user.like(Commodity::getName,"%ๅฐ%");
List<Commodity> commodities1 = commodityMapper.selectList(user);
//ๅ้กต๏ผ้้
็ฝฎ็ฑป
Page<Commodity> commodityPage = commodityMapper.selectPage(new Page<Commodity>(1, 3), user);
List<Commodity> commodities = commodityPage.getRecords();
commodities.forEach(System.out::println);
System.out.println("ๆปๆกๆฐ๏ผ"+commodityPage.getTotal());
System.out.println("ๆป้กตๆฐ๏ผ"+commodityPage.getPages());
}
public void selectUpdate(){
Commodity commodity = new Commodity();
commodity.setName("ๅฐ็บข่ถ");
commodity.setCid(8);
commodity.setVersion(2);
int i = commodityMapper.updateById(commodity);
System.out.println(i);
}
public void delete(){
int i = commodityMapper.deleteById(10);
System.out.println(i);
}
}
| UTF-8 | Java | 2,029 | java | CommodityService.java | Java | [] | null | [] | package cn.bdqn.service;
import cn.bdqn.entity.Commodity;
import cn.bdqn.mapper.CommodityMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class CommodityService {
@Autowired
CommodityMapper commodityMapper;
//ๅ็ปๆฅ่ฏข
public void selectGroup(){
QueryWrapper<Commodity> queryWrapper = new QueryWrapper<>();
queryWrapper.select("nid","count(0)","avg(money)","sum(number)");
//ๅ็ป
queryWrapper.groupBy("type");
//ๆกไปถ
queryWrapper.having("avg(money)>{0}",10);
List<Map<String, Object>> maps = commodityMapper.selectMaps(queryWrapper);
maps.forEach(System.out::println);
}
//ๆจก็ณๆฅ่ฏข
public void selectLambda(){
LambdaQueryWrapper<Commodity> user = new LambdaQueryWrapper<>();
user.like(Commodity::getName,"%ๅฐ%");
List<Commodity> commodities1 = commodityMapper.selectList(user);
//ๅ้กต๏ผ้้
็ฝฎ็ฑป
Page<Commodity> commodityPage = commodityMapper.selectPage(new Page<Commodity>(1, 3), user);
List<Commodity> commodities = commodityPage.getRecords();
commodities.forEach(System.out::println);
System.out.println("ๆปๆกๆฐ๏ผ"+commodityPage.getTotal());
System.out.println("ๆป้กตๆฐ๏ผ"+commodityPage.getPages());
}
public void selectUpdate(){
Commodity commodity = new Commodity();
commodity.setName("ๅฐ็บข่ถ");
commodity.setCid(8);
commodity.setVersion(2);
int i = commodityMapper.updateById(commodity);
System.out.println(i);
}
public void delete(){
int i = commodityMapper.deleteById(10);
System.out.println(i);
}
}
| 2,029 | 0.685816 | 0.680224 | 55 | 34.763638 | 25.138138 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.745455 | false | false | 13 |
dfe044441779e77a08b068625a25acc47ab71f7e | 26,362,509,299,866 | c9c66117a16dbb8bf9acea2443ed369238b456cf | /src/main/java/com/arun/jpa/CustomerJpaImpl.java | edde7d4177d23782a603453e04541c3e996f33f4 | [] | no_license | arun786/springaws | https://github.com/arun786/springaws | ceca3954656194f7ece3a6da5ffca92c55909467 | 456ecb6fc3e6c884b8871cb83e9f090f8af340fb | refs/heads/master | 2020-04-27T16:11:08.469000 | 2019-04-14T07:26:34 | 2019-04-14T07:26:34 | 174,475,129 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.arun.jpa;
import com.arun.model.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import javax.transaction.Transactional;
import java.util.List;
import java.util.Map;
@Repository
@Transactional
public class CustomerJpaImpl implements CustomerJpa {
@Qualifier("awsEntityManagerFactory")
@Autowired
EntityManager awsEntityManager;
@Override
public Customer findById(Long id) {
return awsEntityManager.find(Customer.class, id);
}
@Override
public Customer save(Customer customer) {
Map<String, Object> properties = awsEntityManager.getProperties();
/**
* Insert
*/
if (customer.getId() == null) {
awsEntityManager.persist(customer);
} else {
/*
update
*/
customer = awsEntityManager.merge(customer);
}
return customer;
}
@Override
public void deleteById(Long id) {
Customer customer = awsEntityManager.find(Customer.class, id);
awsEntityManager.remove(customer);
}
@Override
public List<Customer> getAllCustomers() {
TypedQuery<Customer> list_all_customers = awsEntityManager.createNamedQuery("List_All_Customers", Customer.class);
return list_all_customers.getResultList();
}
}
| UTF-8 | Java | 1,538 | java | CustomerJpaImpl.java | Java | [] | null | [] | package com.arun.jpa;
import com.arun.model.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import javax.transaction.Transactional;
import java.util.List;
import java.util.Map;
@Repository
@Transactional
public class CustomerJpaImpl implements CustomerJpa {
@Qualifier("awsEntityManagerFactory")
@Autowired
EntityManager awsEntityManager;
@Override
public Customer findById(Long id) {
return awsEntityManager.find(Customer.class, id);
}
@Override
public Customer save(Customer customer) {
Map<String, Object> properties = awsEntityManager.getProperties();
/**
* Insert
*/
if (customer.getId() == null) {
awsEntityManager.persist(customer);
} else {
/*
update
*/
customer = awsEntityManager.merge(customer);
}
return customer;
}
@Override
public void deleteById(Long id) {
Customer customer = awsEntityManager.find(Customer.class, id);
awsEntityManager.remove(customer);
}
@Override
public List<Customer> getAllCustomers() {
TypedQuery<Customer> list_all_customers = awsEntityManager.createNamedQuery("List_All_Customers", Customer.class);
return list_all_customers.getResultList();
}
}
| 1,538 | 0.682705 | 0.682705 | 57 | 25.982456 | 24.440039 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false | 13 |
25713d3f3ddc4fcf743a650837ed9c9bb1266d32 | 9,079,560,917,566 | da94274fbbc25da6bc425d85c8a7f9c14ee9280b | /U4L2/CollegeApp.java | 0c248f03d0599463107ac3b855b28362d4f7c9d7 | [] | no_license | aaroexxt/APCS | https://github.com/aaroexxt/APCS | 188ad5b921279ce8a113d8e3909fa73b701e4a73 | b64195f1ca7de44f5a00a1001c84afe25c64c38a | refs/heads/master | 2020-07-07T01:12:41.885000 | 2020-05-06T12:08:54 | 2020-05-06T12:08:54 | 203,196,744 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class CollegeApp {
public static void main(String[] args) {
String[] colleges = {"Cal","other UCs", "Cornell", "CalPoly", "GIT", "UIUC", "CMU"};
int zeroLen = colleges[0].length();
int shortestLength = zeroLen;
int shortestLengthIndex = 0;
int longestLength = zeroLen;
int longestLengthIndex = 0;
for (int i=1; i<colleges.length; i++) {
int len = colleges[i].length();
System.out.println("Index: "+i+", Length: "+len);
if (len < shortestLength) {
shortestLength = len;
shortestLengthIndex = i;
} else if (len > longestLength) {
longestLength = len;
longestLengthIndex = i;
}
}
System.out.println("\nShortestLenUniv: "+colleges[shortestLengthIndex]+"\nLongestLenUniv: "+colleges[longestLengthIndex]+"\n");
colleges[(int)(Math.random()*(colleges.length+1))] = null;
System.out.println("All Schools: ");
for (String c : colleges) {
System.out.println(c);
}
}
} | UTF-8 | Java | 1,161 | java | CollegeApp.java | Java | [] | null | [] | public class CollegeApp {
public static void main(String[] args) {
String[] colleges = {"Cal","other UCs", "Cornell", "CalPoly", "GIT", "UIUC", "CMU"};
int zeroLen = colleges[0].length();
int shortestLength = zeroLen;
int shortestLengthIndex = 0;
int longestLength = zeroLen;
int longestLengthIndex = 0;
for (int i=1; i<colleges.length; i++) {
int len = colleges[i].length();
System.out.println("Index: "+i+", Length: "+len);
if (len < shortestLength) {
shortestLength = len;
shortestLengthIndex = i;
} else if (len > longestLength) {
longestLength = len;
longestLengthIndex = i;
}
}
System.out.println("\nShortestLenUniv: "+colleges[shortestLengthIndex]+"\nLongestLenUniv: "+colleges[longestLengthIndex]+"\n");
colleges[(int)(Math.random()*(colleges.length+1))] = null;
System.out.println("All Schools: ");
for (String c : colleges) {
System.out.println(c);
}
}
} | 1,161 | 0.523686 | 0.51938 | 32 | 35.3125 | 26.764526 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.78125 | false | false | 13 |
8d390bb31d181784bcb2ca6dd61ca8de66b6a7cb | 6,279,242,221,933 | ebe9ff40e6fbd903276a01b7a1424845044966ae | /src/main/java/net/duckling/cos/workflow/web/directive/DepartmentDirective.java | 97ba94890bc269d4b4d5ddfb71bb15496a8155f1 | [
"Apache-2.0"
] | permissive | duckling-falcon/cos | https://github.com/duckling-falcon/cos | dec58630e3b33b7582e2c5991b2cad2d74d9eec2 | 4506a703c86711b397764f4fea5c46af62e44d9e | refs/heads/master | 2016-06-11T02:01:45.138000 | 2016-05-17T09:01:00 | 2016-05-17T09:01:00 | 58,144,531 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (c) 2008-2016 Computer Network Information Center (CNIC), Chinese Academy of Sciences.
*
* This file is part of Duckling project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package net.duckling.cos.workflow.web.directive;
import java.io.IOException;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import freemarker.core.Environment;
import freemarker.template.ObjectWrapper;
import freemarker.template.TemplateDirectiveBody;
import freemarker.template.TemplateDirectiveModel;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;
import net.duckling.cos.workflow.entity.Department;
import net.duckling.cos.workflow.service.DepartmentService;
import net.duckling.cos.workflow.util.DirectiveUtil;
public class DepartmentDirective implements TemplateDirectiveModel{
@Autowired
private DepartmentService service;
private static final String DEPARTMENT_ID_PARAMETER_NAME = "id";
@Override
public void execute(Environment env, Map params, TemplateModel[] loopVars,
TemplateDirectiveBody body) throws TemplateException, IOException {
Integer id = DirectiveUtil.getIntegerParameter(DEPARTMENT_ID_PARAMETER_NAME, params);
Department dept = service.getDepartmentById(id);
if (body != null && dept != null) {
if (loopVars.length > 0) {
loopVars[0] = ObjectWrapper.BEANS_WRAPPER.wrap(dept);
}
body.render(env.getOut());
}
}
}
| UTF-8 | Java | 2,000 | java | DepartmentDirective.java | Java | [] | null | [] | /*
* Copyright (c) 2008-2016 Computer Network Information Center (CNIC), Chinese Academy of Sciences.
*
* This file is part of Duckling project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package net.duckling.cos.workflow.web.directive;
import java.io.IOException;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import freemarker.core.Environment;
import freemarker.template.ObjectWrapper;
import freemarker.template.TemplateDirectiveBody;
import freemarker.template.TemplateDirectiveModel;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;
import net.duckling.cos.workflow.entity.Department;
import net.duckling.cos.workflow.service.DepartmentService;
import net.duckling.cos.workflow.util.DirectiveUtil;
public class DepartmentDirective implements TemplateDirectiveModel{
@Autowired
private DepartmentService service;
private static final String DEPARTMENT_ID_PARAMETER_NAME = "id";
@Override
public void execute(Environment env, Map params, TemplateModel[] loopVars,
TemplateDirectiveBody body) throws TemplateException, IOException {
Integer id = DirectiveUtil.getIntegerParameter(DEPARTMENT_ID_PARAMETER_NAME, params);
Department dept = service.getDepartmentById(id);
if (body != null && dept != null) {
if (loopVars.length > 0) {
loopVars[0] = ObjectWrapper.BEANS_WRAPPER.wrap(dept);
}
body.render(env.getOut());
}
}
}
| 2,000 | 0.764 | 0.757 | 54 | 35.370369 | 28.116356 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.148148 | false | false | 13 |
a6a47f1dcb5e64dc7ab01d565359340d047ffade | 1,305,670,106,323 | 7087874a3cadefa7568f359e05725d9fa4e843bb | /src/main/java/com/searchmetrics/exchange/controller/InternalAdminController.java | 09b11d39241a79e809e42c5a8b35ec5f56d8ad8b | [] | no_license | tdhraik/generate-exchange-rate | https://github.com/tdhraik/generate-exchange-rate | 5a72c302605f3d436ab454f4aeb672ae777cc2c4 | 19da45c6ae90bb5b1309a5ff2ef86a1c2601535d | refs/heads/master | 2022-05-24T08:40:22.115000 | 2020-02-23T23:13:58 | 2020-02-23T23:13:58 | 242,291,837 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.searchmetrics.exchange.controller;
import com.searchmetrics.exchange.config.SchedulerConfig;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping
public class InternalAdminController {
private SchedulerConfig schedulerConfig;
public InternalAdminController(SchedulerConfig schedulerConfig) {
this.schedulerConfig = schedulerConfig;
}
@GetMapping("/refresh")
public void schedulerConfigRefresh() {
schedulerConfig.cancelLatestExchangeJob();
schedulerConfig.cancelHistoricExchangeJob();
schedulerConfig.reactivateSchedulerConfig();
}
}
| UTF-8 | Java | 771 | java | InternalAdminController.java | Java | [] | null | [] | package com.searchmetrics.exchange.controller;
import com.searchmetrics.exchange.config.SchedulerConfig;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping
public class InternalAdminController {
private SchedulerConfig schedulerConfig;
public InternalAdminController(SchedulerConfig schedulerConfig) {
this.schedulerConfig = schedulerConfig;
}
@GetMapping("/refresh")
public void schedulerConfigRefresh() {
schedulerConfig.cancelLatestExchangeJob();
schedulerConfig.cancelHistoricExchangeJob();
schedulerConfig.reactivateSchedulerConfig();
}
}
| 771 | 0.793774 | 0.793774 | 24 | 31.125 | 24.510733 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false | 13 |
11acdf0ed2cfdb3e93a2dfaf5a32013a4ca3b969 | 26,860,725,486,657 | 8341c575e2082851de6b5e47bca94384eed06c30 | /java/tree/tree-api/src/com/fevzi/algorithms/tree/Tree.java | 2e574e481a3f7f91f0a4704839c60c2c4fac5795 | [] | no_license | fanifieiev/algorithms | https://github.com/fanifieiev/algorithms | c08f0c19eb3f317110a8b6c5642f584a1b886ad6 | 2ed835a78e16a142dd7d63726e3152a50958f4f3 | refs/heads/master | 2021-01-20T19:19:59.975000 | 2019-04-16T01:14:29 | 2019-04-16T01:14:29 | 61,277,351 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fevzi.algorithms.tree;
import java.util.Collection;
public interface Tree<E extends Comparable<E>> {
Node<E> insert(E e);
boolean remove(E e);
Node<E> find(E e);
Node<E> findMin();
Node<E> findMax();
boolean isEmpty();
int depth();
Collection<E> list();
}
| UTF-8 | Java | 289 | java | Tree.java | Java | [] | null | [] | package com.fevzi.algorithms.tree;
import java.util.Collection;
public interface Tree<E extends Comparable<E>> {
Node<E> insert(E e);
boolean remove(E e);
Node<E> find(E e);
Node<E> findMin();
Node<E> findMax();
boolean isEmpty();
int depth();
Collection<E> list();
}
| 289 | 0.6609 | 0.6609 | 22 | 12.136364 | 13.461377 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.954545 | false | false | 13 |
ec7afcca16ffef10b10dfb9aea629c4bef25fee6 | 23,854,248,403,852 | be500a159ab5d1028dc4d1a194e3630c2e1b44eb | /src/main/java/com/silanis/lottery/business/service/mapping/DrawServiceMapper.java | cd3589edd296efd7a08d8602d5d40b4715511efa | [] | no_license | nsdcrew/SilanisLottery | https://github.com/nsdcrew/SilanisLottery | 68e5001aa5d88d2bc1f9b6458e3001d4f32082a9 | b4b35e837582c7d8c4dad26320c150a0800f9e82 | refs/heads/master | 2016-09-08T02:00:20.465000 | 2015-04-22T14:18:04 | 2015-04-22T14:18:04 | 34,388,662 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Created on 9 avr. 2015 ( Time 11:50:32 )
* Generated by Telosys Tools Generator ( version 2.1.1 )
*/
package com.silanis.lottery.business.service.mapping;
import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies;
import org.springframework.stereotype.Component;
import com.silanis.lottery.bean.Draw;
import com.silanis.lottery.bean.jpa.DrawEntity;
/**
* Mapping between entity beans and display beans.
*/
@Component
public class DrawServiceMapper extends AbstractServiceMapper {
/**
* ModelMapper : bean to bean mapping library.
*/
private ModelMapper modelMapper;
/**
* Constructor.
*/
public DrawServiceMapper() {
modelMapper = new ModelMapper();
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
}
/**
* Mapping from 'DrawEntity' to 'Draw'
* @param drawEntity
*/
public Draw mapDrawEntityToDraw(DrawEntity drawEntity) {
if(drawEntity == null) {
return null;
}
//--- Generic mapping
Draw draw = map(drawEntity, Draw.class);
return draw;
}
/**
* Mapping from 'Draw' to 'DrawEntity'
* @param draw
* @param drawEntity
*/
public void mapDrawToDrawEntity(Draw draw, DrawEntity drawEntity) {
if(draw == null) {
return;
}
//--- Generic mapping
map(draw, drawEntity);
}
/**
* {@inheritDoc}
*/
@Override
protected ModelMapper getModelMapper() {
return modelMapper;
}
protected void setModelMapper(ModelMapper modelMapper) {
this.modelMapper = modelMapper;
}
} | UTF-8 | Java | 1,516 | java | DrawServiceMapper.java | Java | [] | null | [] | /*
* Created on 9 avr. 2015 ( Time 11:50:32 )
* Generated by Telosys Tools Generator ( version 2.1.1 )
*/
package com.silanis.lottery.business.service.mapping;
import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies;
import org.springframework.stereotype.Component;
import com.silanis.lottery.bean.Draw;
import com.silanis.lottery.bean.jpa.DrawEntity;
/**
* Mapping between entity beans and display beans.
*/
@Component
public class DrawServiceMapper extends AbstractServiceMapper {
/**
* ModelMapper : bean to bean mapping library.
*/
private ModelMapper modelMapper;
/**
* Constructor.
*/
public DrawServiceMapper() {
modelMapper = new ModelMapper();
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
}
/**
* Mapping from 'DrawEntity' to 'Draw'
* @param drawEntity
*/
public Draw mapDrawEntityToDraw(DrawEntity drawEntity) {
if(drawEntity == null) {
return null;
}
//--- Generic mapping
Draw draw = map(drawEntity, Draw.class);
return draw;
}
/**
* Mapping from 'Draw' to 'DrawEntity'
* @param draw
* @param drawEntity
*/
public void mapDrawToDrawEntity(Draw draw, DrawEntity drawEntity) {
if(draw == null) {
return;
}
//--- Generic mapping
map(draw, drawEntity);
}
/**
* {@inheritDoc}
*/
@Override
protected ModelMapper getModelMapper() {
return modelMapper;
}
protected void setModelMapper(ModelMapper modelMapper) {
this.modelMapper = modelMapper;
}
} | 1,516 | 0.709763 | 0.700528 | 74 | 19.5 | 20.883364 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.135135 | false | false | 13 |
e628bad5e50cc2fcaff7a1ff80ff394e99a62fa9 | 19,121,194,428,538 | 049187de9b19e84863ffcfe2a2a12710d7afc049 | /src/test/java/com/runninglive/integrationtesting/HealthcheckIntegrationTest.java | cd34d0e1ee8f07546df8c0b9008ebe322b445496 | [] | no_license | alarive/runninglive | https://github.com/alarive/runninglive | 81462a64abcb13cfb4533f9a3d785b5f91e433f9 | 51d902092a7a9a848f8ea4ec0597534911f5bb8b | refs/heads/master | 2020-04-22T03:52:17.612000 | 2015-09-07T21:04:28 | 2015-09-07T21:34:55 | 39,581,176 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.runninglive.integrationtesting;
import org.apache.http.HttpStatus;
import org.junit.Test;
import static com.jayway.restassured.RestAssured.given;
import static org.hamcrest.Matchers.is;
/**
* User: alarive
*/
public class HealthcheckIntegrationTest extends CommonIntegrationTestWithFixtures {
/*
User Story #1 : En tant que dรฉveloppeur, je voudrais avoir un healthcheck afin de m'assurer que le service fonctionne.
*/
@Test
public void testDeveloperCanGetHealthcheck() {
given().auth().basic(developerAurelien.getUsername(), developerAurelien.getPassword()).
when().
get("/management/health").
then().
statusCode(HttpStatus.SC_OK)
.body("status", is("UP"));
}
}
| UTF-8 | Java | 799 | java | HealthcheckIntegrationTest.java | Java | [
{
"context": "ort static org.hamcrest.Matchers.is;\n\n/**\n * User: alarive\n */\npublic class HealthcheckIntegrationTest exten",
"end": 221,
"score": 0.9995829463005066,
"start": 214,
"tag": "USERNAME",
"value": "alarive"
}
] | null | [] | package com.runninglive.integrationtesting;
import org.apache.http.HttpStatus;
import org.junit.Test;
import static com.jayway.restassured.RestAssured.given;
import static org.hamcrest.Matchers.is;
/**
* User: alarive
*/
public class HealthcheckIntegrationTest extends CommonIntegrationTestWithFixtures {
/*
User Story #1 : En tant que dรฉveloppeur, je voudrais avoir un healthcheck afin de m'assurer que le service fonctionne.
*/
@Test
public void testDeveloperCanGetHealthcheck() {
given().auth().basic(developerAurelien.getUsername(), developerAurelien.getPassword()).
when().
get("/management/health").
then().
statusCode(HttpStatus.SC_OK)
.body("status", is("UP"));
}
}
| 799 | 0.661654 | 0.660401 | 27 | 28.555555 | 31.796032 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 13 |
8ab28bcf3c07359d18dff7e091a8e12e5a1c0a71 | 20,744,692,060,661 | c0f60109eeba3d735cbd6321cf3790dc91090b42 | /src/consultation/ConsultationSales.java | 1db7ccfde1dc9b5c009e7815c2d24e413b7415f6 | [] | no_license | Manafov96/StoreSystem | https://github.com/Manafov96/StoreSystem | 6eb0291fec0e2fe84dfe5cc111c744b194e9c319 | 7e642b3ccdbfde39f5060adfa94b83ba11bff90a | refs/heads/master | 2021-06-29T19:07:02.338000 | 2020-11-27T12:23:13 | 2020-11-27T12:23:13 | 194,088,120 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package consultation;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import static Tools.getConnection.getConnection;
import Tools.DropDown;
import static Tools.ExcelExporter.ExcelExport;
import static Tools.GetSQL.getSQL;
import static Tools.setValuesComboBox.setValuesComboBox;
import javax.swing.JSpinner;
import sale.SALE;
/**
*
* @author Viko
*/
public class ConsultationSales extends javax.swing.JFrame {
public int Type = 1; // for type of report
/**
* Creates new form ConsultationSales
*/
public ConsultationSales() {
initComponents();
Date date = new Date();
jdFromDate.setDate(date);
jdToDate.setDate(date);
DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
centerRenderer.setHorizontalAlignment(JLabel.CENTER);
jTable1.getColumnModel().getColumn(0).setCellRenderer(centerRenderer);
jTable1.getColumnModel().getColumn(1).setCellRenderer(centerRenderer);
jTable1.getColumnModel().getColumn(2).setCellRenderer(centerRenderer);
TableColumn dealValue = jTable1.getColumnModel().getColumn(8);
TableColumn ValueVat = jTable1.getColumnModel().getColumn(9);
dealValue.setCellRenderer(new DecimalFormatRenderer());
ValueVat.setCellRenderer(new DecimalFormatRenderer());
// set comboBox Channels
setValuesComboBox("select NC.ID, NC.NAME CHANNELS from N_CHANNELS NC", jcbChannels, false, 0, true);
// set comboBox Payments
setValuesComboBox("select NPM.ID, NPM.NAME_ENG from N_PAYMENT_METHODS NPM", jcbPayment, false, 0, true);
// set comboBox DealType
setValuesComboBox("select DT.ID, DT.NAME DEAL_TYPE from N_DEAL_TYPES DT", jcbDealType, false, 0, true);
jTable1.getTableHeader().setFont(new Font("Tahoma", Font.BOLD, 12));
}
SALE sale = new SALE();
public ArrayList<ConsultationDeals> getSales() throws SQLException {
ArrayList<ConsultationDeals> salesList = new ArrayList<>();
Connection con = getConnection();
java.sql.Date sqldateFrom = new java.sql.Date(jdFromDate.getDate().getTime());
java.sql.Date sqldateTo = new java.sql.Date(jdToDate.getDate().getTime());
String sql = getSQL(6);
PreparedStatement ps = con.prepareStatement(sql);
ps.setInt(1, Type);
ps.setDate(2, sqldateFrom);
ps.setDate(3, sqldateTo);
ps.setInt(4, ((DropDown) jcbChannels.getSelectedItem()).getId());
ps.setInt(5, ((DropDown) jcbChannels.getSelectedItem()).getId());
ps.setInt(6, ((DropDown) jcbPayment.getSelectedItem()).getId());
ps.setInt(7, ((DropDown) jcbPayment.getSelectedItem()).getId());
ps.setInt(8, ((DropDown) jcbDealType.getSelectedItem()).getId());
ps.setInt(9, ((DropDown) jcbDealType.getSelectedItem()).getId());
ResultSet rs = ps.executeQuery();
try {
ConsultationDeals sales;
while (rs.next()) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
String saleDate = dateFormat.format(rs.getDate("DEAL_DATE"));
sales = new ConsultationDeals(rs.getInt("DEAL_NUMBER"), rs.getString("INVOICE_NUMBER"), saleDate,
rs.getString("CLIENT"), rs.getDouble("DEAL_VALUE"), rs.getString("CHANNEL"),
rs.getString("COUNTRY"), rs.getString("PAYMENTS"), rs.getString("DEAL_TYPE"), rs.getDouble("VALUE_VAT"));
salesList.add(sales);
}
} catch (SQLException ex) {
Logger.getLogger(ConsultationSales.class.getName()).log(Level.SEVERE, null, ex);
}
return salesList;
}
public void Show_Sales_In_JTable() throws SQLException {
ArrayList<ConsultationDeals> list = getSales();
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
// clear jtable content
model.setRowCount(0);
Object[] row = new Object[10];
for (int i = 0; i < list.size(); i++) {
row[0] = list.get(i).getDealNumber();
row[1] = list.get(i).getInvoiceNumber();
row[2] = list.get(i).getDealDate();
row[3] = list.get(i).getClientName();
row[4] = list.get(i).getCountry();
row[5] = list.get(i).getChannel();
row[6] = list.get(i).getPayment();
row[7] = list.get(i).getType();
row[8] = list.get(i).getDealValue();
row[9] = list.get(i).getValueVat();
model.addRow(row);
}
}
private void showMaster() {
sale.jtxtSaleNumber.setBackground(Color.white);
try {
Connection con = getConnection();
int row = jTable1.getSelectedRow();
int correctModel = jTable1.convertRowIndexToModel(row);
PreparedStatement ps = con.prepareStatement("select\n"
+ " D.ID, D.DEAL_NUMBER, D.DEAL_DATE, D.OPERATION_ID, O.NAME OPERATION,\n"
+ " D.DEAL_TYPE_ID, DT.NAME DEAL_TYPE, D.CREDIT_DEAL_NUMBER, D.CREDIT_DEAL_DATE,\n"
+ " D.CHANNEL_ID, C.NAME CHANNEL, D.STATUS_ID, S.NAME STATUS, D.CLIENT_ID, CC.NAME CLIENT,\n"
+ " D.LANG_ID LANG_ID, L.SHORT_NAME LANG, D.DEAL_VALUE,\n"
+ " D.TRANSPORT_COSTS, D.CHANNEL_COSTS, D.BANK_COSTS, D.OTHER_COSTS, I.INVOICE_NUMBER, I.PAYMENT_ID, I.PAYMENT_TEXT,\n"
+ " CN.ID CREDIT_ID, CN.CR_NOTE_NUMBER, CN.CR_NOTE_DATE, CN.CR_NOTE_TEXT,\n"
+ " case\n"
+ " when L.ID = 1 then P.NAME_GERM\n"
+ " when L.ID = 2 then P.NAME_ENG\n"
+ " when L.ID = 3 then P.NAME_BUL\n"
+ " end PAYMENT,\n"
+ " iif(DT.ACCRUING_VAT = 1, (select MC.VAT_PERCENTAGE from MY_COMPANY MC), 0) VAT_PCT\n"
+ " from\n"
+ " DEALS D\n"
+ " join N_OPERATIONS O on O.ID = D.OPERATION_ID\n"
+ " join N_DEAL_TYPES DT on DT.ID = D.DEAL_TYPE_ID\n"
+ " join N_CHANNELS C on C.ID = D.CHANNEL_ID\n"
+ " join N_STATUSES S on S.ID = D.STATUS_ID\n"
+ " join CLIENTS CC on CC.ID = D.CLIENT_ID\n"
+ " join N_LANGS L on L.ID = D.LANG_ID\n"
+ " left join INVOICES I on I.DEAL_ID = D.ID\n"
+ " left join N_PAYMENT_METHODS P on P.ID = I.PAYMENT_ID\n"
+ " left join CREDIT_NOTES CN on CN.ID = I.CREDIT_NOTE_ID\n"
+ " where\n"
+ " (D.OPERATION_ID = ? or D.OPERATION_ID = 6) and D.DEAL_NUMBER = " + jTable1.getModel().getValueAt(correctModel, 0));
ps.setInt(1, Type);
ResultSet rs = ps.executeQuery();
Vector<DropDown> dealType = new Vector<>();
Vector<DropDown> channel = new Vector<>();
Vector<DropDown> status = new Vector<>();
Vector<DropDown> client = new Vector<>();
Vector<DropDown> lang = new Vector<>();
Vector<DropDown> payment = new Vector<>();
sale.isActive = 0;
sale.checkInvoiceNumber = 0;
sale.isSave = 1;
while (rs.next()) {
sale.VatPCT = rs.getDouble("VAT_PCT");
sale.saleID = rs.getInt("ID");
dealType.addElement(new DropDown(rs.getInt("DEAL_TYPE_ID"), rs.getString("DEAL_TYPE")));
client.addElement(new DropDown(rs.getInt("CLIENT_ID"), rs.getString("CLIENT")));
channel.addElement(new DropDown(rs.getInt("CHANNEL_ID"), rs.getString("CHANNEL")));
status.addElement(new DropDown(rs.getInt("STATUS_ID"), rs.getString("STATUS")));
lang.addElement(new DropDown(rs.getInt("LANG_ID"), rs.getString("LANG")));
payment.addElement(new DropDown(rs.getInt("PAYMENT_ID"), rs.getString("PAYMENT")));
jDealType.setModel(new DefaultComboBoxModel(dealType));
jClient.setModel(new DefaultComboBoxModel(client));
jChannel.setModel(new DefaultComboBoxModel(channel));
jStatus.setModel(new DefaultComboBoxModel(status));
jLang.setModel(new DefaultComboBoxModel(lang));
jPayment.setModel(new DefaultComboBoxModel(payment));
sale.jcbChannel.setSelectedIndex(0);
sale.jtxtSaleNumber.setText(rs.getString("DEAL_NUMBER"));
sale.jDateSale.setDate(rs.getDate("DEAL_DATE"));
sale.jcbDealType.getModel().setSelectedItem(jDealType.getModel().getSelectedItem());
sale.jcbClient.setSelectedIndex(0);
sale.jcbClient.getModel().setSelectedItem(jClient.getModel().getSelectedItem());
sale.jtxtSaleNumber.setText(rs.getString("DEAL_NUMBER"));
sale.jcbChannel.getModel().setSelectedItem(jChannel.getModel().getSelectedItem());
sale.jcbStatuses.getModel().setSelectedItem(jStatus.getModel().getSelectedItem());
sale.jcbLang.getModel().setSelectedItem(jLang.getModel().getSelectedItem());
sale.jtxtTransportCosts.setText(rs.getString("TRANSPORT_COSTS"));
sale.jtxtOtherCosts.setText(rs.getString("OTHER_COSTS"));
sale.jtxtChannelCosts.setText(rs.getString("CHANNEL_COSTS"));
sale.jtxtBankCosts.setText(rs.getString("BANK_COSTS"));
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
String saleDate = dateFormat.format(rs.getDate("DEAL_DATE"));
sale.jtxtInvoiceNumber.setText(rs.getString("INVOICE_NUMBER") + "/" + saleDate);
sale.jtxtInvoiceNumberDialog.setText(rs.getString("INVOICE_NUMBER"));
sale.jcbPayment.getModel().setSelectedItem(jPayment.getModel().getSelectedItem());
sale.jtaPaymentText.setText(rs.getString("PAYMENT_TEXT"));
sale.jxtCredit.setText(rs.getString("CREDIT_DEAL_NUMBER"));
sale.jdtchCredit.setDate(rs.getDate("CREDIT_DEAL_DATE"));
sale.jlbVatValue.setText("ะะะก (" + sale.VatPCT + "%): ");
if (((DropDown) sale.jcbStatuses.getSelectedItem()).getId() == 4) {
sale.jchbReversal.setSelected(true);
sale.jpCreditNote.setVisible(true);
sale.jCreditNoteDate.setDate(rs.getDate("CR_NOTE_DATE"));
sale.jtxtCreditNoteNumber.setText(rs.getString("CR_NOTE_NUMBER"));
sale.jTextArea1.setText(rs.getString("CR_NOTE_TEXT"));
sale.creditID = rs.getInt("CREDIT_ID");
} else {
sale.jchbReversal.setSelected(false);
Date date = new Date();
sale.jCreditNoteDate.setDate(date);
sale.jtxtCreditNoteNumber.setText("");
sale.jTextArea1.setText("");
sale.creditID = 0;
}
dealType.clear();
client.clear();
channel.clear();
status.clear();
lang.clear();
payment.clear();
}
} catch (SQLException ex) {
Logger.getLogger(ConsultationSales.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void showDetails() {
try {
Connection con = getConnection();
int row = jTable1.getSelectedRow();
int correctModel = jTable1.convertRowIndexToModel(row);
PreparedStatement ps = con.prepareStatement("select\n"
+ " AG.ID ARTICLE_GROUP_ID,\n"
+ " case\n"
+ " when D.LANG_ID = 1 then AG.NAME_DE\n"
+ " when D.LANG_ID = 2 then AG.NAME_EN\n"
+ " when D.LANG_ID = 3 then AG.NAME_BG\n"
+ " end ARTICLE_GROUP,\n"
+ " DD.ARTICLE_ID,\n"
+ " case\n"
+ " when D.LANG_ID = 1 then A.CODE || ' | '|| A.NAME_DE\n"
+ " when D.LANG_ID = 2 then A.CODE || ' | '|| A.NAME_EN\n"
+ " when D.LANG_ID = 3 then A.CODE || ' | '|| A.NAME_BG\n"
+ " end ARTICLE,\n"
+ " DD.QUANTITY, DD.PRICE, DD.LOT_ID, L.NUMBER LOT_NUMBER, DD.DVY_PRICE_WITH_VAT\n"
+ "from\n"
+ " DEAL_DETAILS DD\n"
+ " join DEALS D on D.ID = DD.DEAL_ID\n"
+ " join ARTICLES A on A.ID = DD.ARTICLE_ID\n"
+ " join ARTICLE_GROUPS AG on AG.ID = A.ARTICLE_GROUPS_ID\n"
+ " join LOTS L on L.ID = DD.LOT_ID\n"
+ "where\n"
+ " (D.OPERATION_ID = ? or D.OPERATION_ID = 6) and D.DEAL_NUMBER = " + jTable1.getModel().getValueAt(correctModel, 0) + " order by A.ID desc");
ps.setInt(1, Type);
ResultSet rs = ps.executeQuery();
Vector<DropDown> article = new Vector<>();
Vector<DropDown> articleGroup = new Vector<>();
Vector<DropDown> lot = new Vector<>();
while (rs.next()) {
article.addElement(new DropDown(rs.getInt("ARTICLE_ID"), rs.getString("ARTICLE")));
articleGroup.addElement(new DropDown(rs.getInt("ARTICLE_GROUP_ID"), rs.getString("ARTICLE_GROUP")));
lot.addElement(new DropDown(rs.getInt("LOT_ID"), rs.getString("LOT_NUMBER")));
jArticle.setModel(new DefaultComboBoxModel(article));
jGroup.setModel(new DefaultComboBoxModel(articleGroup));
jLot.setModel(new DefaultComboBoxModel(lot));
sale.jcbArticleGroups.getModel().setSelectedItem(jGroup.getModel().getSelectedItem());
sale.jcbArticle.getModel().setSelectedItem(jArticle.getModel().getSelectedItem());
sale.jcbLots.getModel().setSelectedItem(jLot.getModel().getSelectedItem());
sale.jtxtPrice.setText(rs.getString("DVY_PRICE_WITH_VAT"));
int qty = rs.getInt("QUANTITY");
if ((Double) jTable1.getValueAt(correctModel, 8) < 0) {
qty *= -1;
}
sale.jtxtQty.setValue(qty);
sale.jbtnAdd.doClick();
article.clear();
articleGroup.clear();
lot.clear();
}
} catch (SQLException ex) {
Logger.getLogger(ConsultationSales.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void showSum() {
int rows = jTable1.getRowCount();
double sumTotal = 0;
String Total = null;
double sumVat = 0;
String Vat = null;
for (int row = 0; row < rows; row++) {
sumTotal += (Double) jTable1.getValueAt(row, 8);
sumVat += (Double) jTable1.getValueAt(row, 9);
}
NumberFormat nf = new DecimalFormat("#,##0.00");
Total = nf.format(sumTotal);
Vat = nf.format(sumVat);
jtxtTotal.setText(Total);
jtxtTotalVat.setText(Vat);
}
/**
* 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() {
jDealType = new javax.swing.JComboBox<>();
jClient = new javax.swing.JComboBox<>();
jChannel = new javax.swing.JComboBox<>();
jStatus = new javax.swing.JComboBox<>();
jLang = new javax.swing.JComboBox<>();
jPayment = new javax.swing.JComboBox<>();
jArticle = new javax.swing.JComboBox<>();
jGroup = new javax.swing.JComboBox<>();
jLot = new javax.swing.JComboBox<>();
jPopupMenu1 = new javax.swing.JPopupMenu();
jmiDelete = new javax.swing.JMenuItem();
jlbConsultation = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jSeparator1 = new javax.swing.JSeparator();
jdFromDate = new com.toedter.calendar.JDateChooser();
jdToDate = new com.toedter.calendar.JDateChooser();
jButton1 = new javax.swing.JButton();
jlbFromDate = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jbtnExport = new javax.swing.JButton();
jcbChannels = new javax.swing.JComboBox<>();
jcbPayment = new javax.swing.JComboBox<>();
jcbDealType = new javax.swing.JComboBox<>();
jLabel1 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jSeparator2 = new javax.swing.JSeparator();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jtxtTotal = new javax.swing.JTextField();
jtxtTotalVat = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jbtnClose = new javax.swing.JButton();
jmiDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sale/delete16.png"))); // NOI18N
jmiDelete.setText("ะะทััะธะน!");
jmiDelete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jmiDeleteActionPerformed(evt);
}
});
jPopupMenu1.add(jmiDelete);
setTitle("ะัะพะดะฐะถะฑะธ");
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
onExit(evt);
}
});
jlbConsultation.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jlbConsultation.setText("ะัะพะดะฐะถะฑะธ");
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/consultation/run24 (2).png"))); // NOI18N
jButton1.setText("ะะทะฟัะปะฝะธ");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jlbFromDate.setText("ะั ะดะฐัะฐ:");
jLabel2.setText("ะะพ ะดะฐัะฐ:");
jbtnExport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/consultation/excel24.png"))); // NOI18N
jbtnExport.setText("ะะบัะฟะพัั");
jbtnExport.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnExportActionPerformed(evt);
}
});
jLabel1.setText("ะะฐะฝะฐะป:");
jLabel3.setText("ะะปะฐัะฐะฝะต:");
jLabel4.setText("ะะะก ะบะฐัะตะณะพัะธั:");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jlbFromDate)
.addComponent(jdFromDate, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jdToDate, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGap(38, 38, 38)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jcbChannels, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jcbPayment, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jcbDealType, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(55, 55, 55)
.addComponent(jButton1)
.addGap(18, 18, 18)
.addComponent(jbtnExport)
.addGap(32, 32, 32))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jbtnExport))
.addGap(23, 23, 23))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jlbFromDate)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jdToDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jdFromDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jcbChannels, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jcbDealType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jcbPayment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(28, 28, 28))))
);
jTable1.setAutoCreateRowSorter(true);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"ะกะดะตะปะบะฐ โ", "ะคะฐะบัััะฐ โ", "ะะฐัะฐ ะฝะฐ ัะฐะบัััะฐ", "ะัะฟัะฒะฐั", "ะััะถะฐะฒะฐ", "ะะฐะฝะฐะป", "ะะปะฐัะฐะฝะต", "ะะะก ะบะฐัะตะณะพัะธั", "ะกัะพะนะฝะพัั (โฌ)", "ะะฐัะธัะปะตะฝะพ ะะะก (โฌ) "
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false, false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jTable1.setComponentPopupMenu(jPopupMenu1);
jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTable1MouseClicked(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jTable1MouseReleased(evt);
}
});
jScrollPane1.setViewportView(jTable1);
if (jTable1.getColumnModel().getColumnCount() > 0) {
jTable1.getColumnModel().getColumn(0).setPreferredWidth(60);
jTable1.getColumnModel().getColumn(1).setPreferredWidth(60);
jTable1.getColumnModel().getColumn(2).setPreferredWidth(90);
jTable1.getColumnModel().getColumn(3).setPreferredWidth(150);
jTable1.getColumnModel().getColumn(4).setPreferredWidth(50);
jTable1.getColumnModel().getColumn(5).setPreferredWidth(50);
jTable1.getColumnModel().getColumn(7).setPreferredWidth(100);
jTable1.getColumnModel().getColumn(9).setPreferredWidth(120);
}
jtxtTotal.setEditable(false);
jtxtTotal.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jtxtTotal.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jtxtTotalVat.setEditable(false);
jtxtTotalVat.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jtxtTotalVat.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jtxtTotalVat.setToolTipText("");
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel5.setText("ะะฑัะพ:");
jbtnClose.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sale/Delete32.png"))); // NOI18N
jbtnClose.setText("ะะทั
ะพะด");
jbtnClose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnCloseActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator2)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(33, 33, 33)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1075, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 24, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jbtnClose, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jlbConsultation, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(344, 344, 344))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jtxtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(66, 66, 66)
.addComponent(jtxtTotalVat, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(69, 69, 69))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jlbConsultation, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 284, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtxtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtxtTotalVat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
.addComponent(jbtnClose)
.addGap(21, 21, 21))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
Show_Sales_In_JTable();
showSum();
if (jTable1.getRowCount() == 0) {
JOptionPane.showMessageDialog(this, "ะัะผะฐ ะดะฐะฝะฝะธ ะฟะพ ะทะฐะดะฐะดะตะฝะธัะต ะบัะธัะตัะธะธ!");
}
} catch (SQLException ex) {
Logger.getLogger(ConsultationSales.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton1ActionPerformed
private void onExit(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_onExit
setVisible(false);
}//GEN-LAST:event_onExit
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
if (evt.getClickCount() == 2) {
sale.isCreditNote = 0;
sale.jlbSale.setText("ะัะพะดะฐะถะฑะฐ");
sale.setTitle("ะัะพะดะฐะถะฑะฐ");
sale.jlbInvoiceNumbers.setText("ะะพะผะตั ะธ ะดะฐัะฐ ะฝะฐ ัะฐะบัััะฐ:");
sale.jxtCredit.setVisible(false);
sale.jdtchCredit.setVisible(false);
sale.jlbCredit.setVisible(false);
sale.jlbCreditDate.setVisible(false);
sale.jbntInvoice.setText("ะคะฐะบัััะฐ");
int row = jTable1.getSelectedRow();
int correctModel = jTable1.convertRowIndexToModel(row);
if ((Double) jTable1.getValueAt(correctModel, 8) < 0) {
sale.jlbSale.setText("ะกัะพัะฝะธัะฐะฝะฐ ะฟัะพะดะฐะถะฑะฐ");
sale.setTitle("ะกัะพัะฝะธัะฐะฝะฐ ะฟัะพะดะฐะถะฑะฐ");
sale.jlbInvoiceNumbers.setText("ะะพะผะตั ะธ ะดะฐัะฐ ะฝะฐ ะะ:");
sale.isCreditNote = 1;
JSpinner.NumberEditor editor = new JSpinner.NumberEditor(sale.jtxtQty, "-#");
sale.jtxtQty.setEditor(editor);
sale.jxtCredit.setVisible(true);
sale.jdtchCredit.setVisible(true);
sale.jlbCredit.setVisible(true);
sale.jlbCreditDate.setVisible(true);
sale.jbntInvoice.setText("ะะ");
sale.jxtCredit.setBackground(Color.CYAN);
}
sale.checkQuantity = 0; // This is flag for check for availability quantity and sale quantity!!!!!
showMaster();
showDetails();
sale.jcbArticleGroups.setSelectedIndex(-1);
sale.jcbArticle.setSelectedIndex(-1);
sale.jcbLots.setSelectedIndex(-1);
sale.setVisible(true);
sale.jbtnClear.setEnabled(false);
sale.jtxtInvoiceNumberDialog.setEditable(false);
if (((DropDown) sale.jcbStatuses.getSelectedItem()).getId() == 4) {
sale.jlbCreditNote.setVisible(true);
sale.jpCreditNote.setVisible(true);
} else {
sale.jlbCreditNote.setVisible(false);
}
sale.jbtnNewClient.setEnabled(false);
if (((DropDown) sale.jcbStatuses.getSelectedItem()).getId() == 5) {
sale.jbtnSave.setEnabled(true);
} else {
sale.jbtnSave.setEnabled(false);
}
sale.isSave = 1;
sale.checkQuantity = 1; // This is flag for check for availability quantity and sale quantity!!!!!
}
}//GEN-LAST:event_jTable1MouseClicked
private void jbtnExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnExportActionPerformed
String Date = new SimpleDateFormat("dd.MM.yyyy HH.mm.ss").format(Calendar.getInstance().getTime());
File directory = new File(".");
String absolutePath = directory.getAbsolutePath().substring(0, directory.getAbsolutePath().length() - 1);
String fileName = absolutePath + "Reports\\Sales " + Date;
if (ExcelExport(jTable1, fileName)) {
JOptionPane.showMessageDialog(this, "ะฃัะฟะตัะฝะพ ะตะบัะฟะพััะธัะฐะฝะต!");
} else {
JOptionPane.showMessageDialog(this, "ะัะทะฝะธะบะฝะฐ ะณัะตัะบะฐ!");
}
}//GEN-LAST:event_jbtnExportActionPerformed
private void jTable1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseReleased
if (evt.isPopupTrigger()) {
jPopupMenu1.show(this, evt.getX(), evt.getY());
}
}//GEN-LAST:event_jTable1MouseReleased
private void jmiDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiDeleteActionPerformed
int dialogButton = JOptionPane.showConfirmDialog(null, "ะกะธะณััะฝะธ ะปะธ ััะต, ัะต ะธัะบะฐัะต ะดะฐ ะธะทััะธะตัะต ะฟัะพะดะฐะถะฑะฐัะฐ!", "ะกะฟัะฐะฒะบะธ", JOptionPane.YES_NO_OPTION);
if (dialogButton == JOptionPane.YES_OPTION) {
try {
Connection con = getConnection();
PreparedStatement ps = con.prepareStatement("delete from DEALS D\n"
+ "where (D.DEAL_NUMBER = ? and D.OPERATION_ID = 1)");
ps.setString(1, jTable1.getModel().getValueAt(jTable1.getSelectedRow(), 0).toString());
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "ะฃัะฟะตัะฝะพ ะธะทััะธั
ัะต ะฟัะพะดะฐะถะฑะฐัะฐ!");
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "ะะต ะผะพะถะต ะดะฐ ะธะทััะธะตัะต ัะฐะทะธ ะฟัะพะดะฐะถะฑะฐ!");
}
if (dialogButton == JOptionPane.NO_OPTION) {
remove(dialogButton);
}
}
}//GEN-LAST:event_jmiDeleteActionPerformed
private void jbtnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnCloseActionPerformed
setVisible(false);
}//GEN-LAST:event_jbtnCloseActionPerformed
/**
* @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(ConsultationSales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ConsultationSales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ConsultationSales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ConsultationSales.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 ConsultationSales().setVisible(true);
}
});
}
static class DecimalFormatRenderer extends DefaultTableCellRenderer {
public DecimalFormatRenderer() {
super();
setHorizontalAlignment(JLabel.RIGHT);
}
private static final DecimalFormat formatter = new DecimalFormat("#,##0.00");
@Override
public Component getTableCellRendererComponent(
JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
// First format the cell value as required
value = formatter.format((Number) value);
// And pass it on to parent class
return super.getTableCellRendererComponent(
table, value, isSelected, hasFocus, row, column);
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JComboBox<String> jArticle;
public javax.swing.JButton jButton1;
private javax.swing.JComboBox<String> jChannel;
private javax.swing.JComboBox<String> jClient;
private javax.swing.JComboBox<String> jDealType;
private javax.swing.JComboBox<String> jGroup;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JComboBox<String> jLang;
private javax.swing.JComboBox<String> jLot;
private javax.swing.JPanel jPanel1;
private javax.swing.JComboBox<String> jPayment;
private javax.swing.JPopupMenu jPopupMenu1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JComboBox<String> jStatus;
private javax.swing.JTable jTable1;
private javax.swing.JButton jbtnClose;
private javax.swing.JButton jbtnExport;
private javax.swing.JComboBox<String> jcbChannels;
private javax.swing.JComboBox<String> jcbDealType;
private javax.swing.JComboBox<String> jcbPayment;
public com.toedter.calendar.JDateChooser jdFromDate;
public com.toedter.calendar.JDateChooser jdToDate;
public javax.swing.JLabel jlbConsultation;
private javax.swing.JLabel jlbFromDate;
private javax.swing.JMenuItem jmiDelete;
private javax.swing.JTextField jtxtTotal;
private javax.swing.JTextField jtxtTotalVat;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 42,883 | java | ConsultationSales.java | Java | [
{
"context": "ing.JSpinner;\nimport sale.SALE;\n\n/**\n *\n * @author Viko\n */\npublic class ConsultationSales extends javax.",
"end": 1228,
"score": 0.9969257116317749,
"start": 1224,
"tag": "NAME",
"value": "Viko"
}
] | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package consultation;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import static Tools.getConnection.getConnection;
import Tools.DropDown;
import static Tools.ExcelExporter.ExcelExport;
import static Tools.GetSQL.getSQL;
import static Tools.setValuesComboBox.setValuesComboBox;
import javax.swing.JSpinner;
import sale.SALE;
/**
*
* @author Viko
*/
public class ConsultationSales extends javax.swing.JFrame {
public int Type = 1; // for type of report
/**
* Creates new form ConsultationSales
*/
public ConsultationSales() {
initComponents();
Date date = new Date();
jdFromDate.setDate(date);
jdToDate.setDate(date);
DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
centerRenderer.setHorizontalAlignment(JLabel.CENTER);
jTable1.getColumnModel().getColumn(0).setCellRenderer(centerRenderer);
jTable1.getColumnModel().getColumn(1).setCellRenderer(centerRenderer);
jTable1.getColumnModel().getColumn(2).setCellRenderer(centerRenderer);
TableColumn dealValue = jTable1.getColumnModel().getColumn(8);
TableColumn ValueVat = jTable1.getColumnModel().getColumn(9);
dealValue.setCellRenderer(new DecimalFormatRenderer());
ValueVat.setCellRenderer(new DecimalFormatRenderer());
// set comboBox Channels
setValuesComboBox("select NC.ID, NC.NAME CHANNELS from N_CHANNELS NC", jcbChannels, false, 0, true);
// set comboBox Payments
setValuesComboBox("select NPM.ID, NPM.NAME_ENG from N_PAYMENT_METHODS NPM", jcbPayment, false, 0, true);
// set comboBox DealType
setValuesComboBox("select DT.ID, DT.NAME DEAL_TYPE from N_DEAL_TYPES DT", jcbDealType, false, 0, true);
jTable1.getTableHeader().setFont(new Font("Tahoma", Font.BOLD, 12));
}
SALE sale = new SALE();
public ArrayList<ConsultationDeals> getSales() throws SQLException {
ArrayList<ConsultationDeals> salesList = new ArrayList<>();
Connection con = getConnection();
java.sql.Date sqldateFrom = new java.sql.Date(jdFromDate.getDate().getTime());
java.sql.Date sqldateTo = new java.sql.Date(jdToDate.getDate().getTime());
String sql = getSQL(6);
PreparedStatement ps = con.prepareStatement(sql);
ps.setInt(1, Type);
ps.setDate(2, sqldateFrom);
ps.setDate(3, sqldateTo);
ps.setInt(4, ((DropDown) jcbChannels.getSelectedItem()).getId());
ps.setInt(5, ((DropDown) jcbChannels.getSelectedItem()).getId());
ps.setInt(6, ((DropDown) jcbPayment.getSelectedItem()).getId());
ps.setInt(7, ((DropDown) jcbPayment.getSelectedItem()).getId());
ps.setInt(8, ((DropDown) jcbDealType.getSelectedItem()).getId());
ps.setInt(9, ((DropDown) jcbDealType.getSelectedItem()).getId());
ResultSet rs = ps.executeQuery();
try {
ConsultationDeals sales;
while (rs.next()) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
String saleDate = dateFormat.format(rs.getDate("DEAL_DATE"));
sales = new ConsultationDeals(rs.getInt("DEAL_NUMBER"), rs.getString("INVOICE_NUMBER"), saleDate,
rs.getString("CLIENT"), rs.getDouble("DEAL_VALUE"), rs.getString("CHANNEL"),
rs.getString("COUNTRY"), rs.getString("PAYMENTS"), rs.getString("DEAL_TYPE"), rs.getDouble("VALUE_VAT"));
salesList.add(sales);
}
} catch (SQLException ex) {
Logger.getLogger(ConsultationSales.class.getName()).log(Level.SEVERE, null, ex);
}
return salesList;
}
public void Show_Sales_In_JTable() throws SQLException {
ArrayList<ConsultationDeals> list = getSales();
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
// clear jtable content
model.setRowCount(0);
Object[] row = new Object[10];
for (int i = 0; i < list.size(); i++) {
row[0] = list.get(i).getDealNumber();
row[1] = list.get(i).getInvoiceNumber();
row[2] = list.get(i).getDealDate();
row[3] = list.get(i).getClientName();
row[4] = list.get(i).getCountry();
row[5] = list.get(i).getChannel();
row[6] = list.get(i).getPayment();
row[7] = list.get(i).getType();
row[8] = list.get(i).getDealValue();
row[9] = list.get(i).getValueVat();
model.addRow(row);
}
}
private void showMaster() {
sale.jtxtSaleNumber.setBackground(Color.white);
try {
Connection con = getConnection();
int row = jTable1.getSelectedRow();
int correctModel = jTable1.convertRowIndexToModel(row);
PreparedStatement ps = con.prepareStatement("select\n"
+ " D.ID, D.DEAL_NUMBER, D.DEAL_DATE, D.OPERATION_ID, O.NAME OPERATION,\n"
+ " D.DEAL_TYPE_ID, DT.NAME DEAL_TYPE, D.CREDIT_DEAL_NUMBER, D.CREDIT_DEAL_DATE,\n"
+ " D.CHANNEL_ID, C.NAME CHANNEL, D.STATUS_ID, S.NAME STATUS, D.CLIENT_ID, CC.NAME CLIENT,\n"
+ " D.LANG_ID LANG_ID, L.SHORT_NAME LANG, D.DEAL_VALUE,\n"
+ " D.TRANSPORT_COSTS, D.CHANNEL_COSTS, D.BANK_COSTS, D.OTHER_COSTS, I.INVOICE_NUMBER, I.PAYMENT_ID, I.PAYMENT_TEXT,\n"
+ " CN.ID CREDIT_ID, CN.CR_NOTE_NUMBER, CN.CR_NOTE_DATE, CN.CR_NOTE_TEXT,\n"
+ " case\n"
+ " when L.ID = 1 then P.NAME_GERM\n"
+ " when L.ID = 2 then P.NAME_ENG\n"
+ " when L.ID = 3 then P.NAME_BUL\n"
+ " end PAYMENT,\n"
+ " iif(DT.ACCRUING_VAT = 1, (select MC.VAT_PERCENTAGE from MY_COMPANY MC), 0) VAT_PCT\n"
+ " from\n"
+ " DEALS D\n"
+ " join N_OPERATIONS O on O.ID = D.OPERATION_ID\n"
+ " join N_DEAL_TYPES DT on DT.ID = D.DEAL_TYPE_ID\n"
+ " join N_CHANNELS C on C.ID = D.CHANNEL_ID\n"
+ " join N_STATUSES S on S.ID = D.STATUS_ID\n"
+ " join CLIENTS CC on CC.ID = D.CLIENT_ID\n"
+ " join N_LANGS L on L.ID = D.LANG_ID\n"
+ " left join INVOICES I on I.DEAL_ID = D.ID\n"
+ " left join N_PAYMENT_METHODS P on P.ID = I.PAYMENT_ID\n"
+ " left join CREDIT_NOTES CN on CN.ID = I.CREDIT_NOTE_ID\n"
+ " where\n"
+ " (D.OPERATION_ID = ? or D.OPERATION_ID = 6) and D.DEAL_NUMBER = " + jTable1.getModel().getValueAt(correctModel, 0));
ps.setInt(1, Type);
ResultSet rs = ps.executeQuery();
Vector<DropDown> dealType = new Vector<>();
Vector<DropDown> channel = new Vector<>();
Vector<DropDown> status = new Vector<>();
Vector<DropDown> client = new Vector<>();
Vector<DropDown> lang = new Vector<>();
Vector<DropDown> payment = new Vector<>();
sale.isActive = 0;
sale.checkInvoiceNumber = 0;
sale.isSave = 1;
while (rs.next()) {
sale.VatPCT = rs.getDouble("VAT_PCT");
sale.saleID = rs.getInt("ID");
dealType.addElement(new DropDown(rs.getInt("DEAL_TYPE_ID"), rs.getString("DEAL_TYPE")));
client.addElement(new DropDown(rs.getInt("CLIENT_ID"), rs.getString("CLIENT")));
channel.addElement(new DropDown(rs.getInt("CHANNEL_ID"), rs.getString("CHANNEL")));
status.addElement(new DropDown(rs.getInt("STATUS_ID"), rs.getString("STATUS")));
lang.addElement(new DropDown(rs.getInt("LANG_ID"), rs.getString("LANG")));
payment.addElement(new DropDown(rs.getInt("PAYMENT_ID"), rs.getString("PAYMENT")));
jDealType.setModel(new DefaultComboBoxModel(dealType));
jClient.setModel(new DefaultComboBoxModel(client));
jChannel.setModel(new DefaultComboBoxModel(channel));
jStatus.setModel(new DefaultComboBoxModel(status));
jLang.setModel(new DefaultComboBoxModel(lang));
jPayment.setModel(new DefaultComboBoxModel(payment));
sale.jcbChannel.setSelectedIndex(0);
sale.jtxtSaleNumber.setText(rs.getString("DEAL_NUMBER"));
sale.jDateSale.setDate(rs.getDate("DEAL_DATE"));
sale.jcbDealType.getModel().setSelectedItem(jDealType.getModel().getSelectedItem());
sale.jcbClient.setSelectedIndex(0);
sale.jcbClient.getModel().setSelectedItem(jClient.getModel().getSelectedItem());
sale.jtxtSaleNumber.setText(rs.getString("DEAL_NUMBER"));
sale.jcbChannel.getModel().setSelectedItem(jChannel.getModel().getSelectedItem());
sale.jcbStatuses.getModel().setSelectedItem(jStatus.getModel().getSelectedItem());
sale.jcbLang.getModel().setSelectedItem(jLang.getModel().getSelectedItem());
sale.jtxtTransportCosts.setText(rs.getString("TRANSPORT_COSTS"));
sale.jtxtOtherCosts.setText(rs.getString("OTHER_COSTS"));
sale.jtxtChannelCosts.setText(rs.getString("CHANNEL_COSTS"));
sale.jtxtBankCosts.setText(rs.getString("BANK_COSTS"));
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
String saleDate = dateFormat.format(rs.getDate("DEAL_DATE"));
sale.jtxtInvoiceNumber.setText(rs.getString("INVOICE_NUMBER") + "/" + saleDate);
sale.jtxtInvoiceNumberDialog.setText(rs.getString("INVOICE_NUMBER"));
sale.jcbPayment.getModel().setSelectedItem(jPayment.getModel().getSelectedItem());
sale.jtaPaymentText.setText(rs.getString("PAYMENT_TEXT"));
sale.jxtCredit.setText(rs.getString("CREDIT_DEAL_NUMBER"));
sale.jdtchCredit.setDate(rs.getDate("CREDIT_DEAL_DATE"));
sale.jlbVatValue.setText("ะะะก (" + sale.VatPCT + "%): ");
if (((DropDown) sale.jcbStatuses.getSelectedItem()).getId() == 4) {
sale.jchbReversal.setSelected(true);
sale.jpCreditNote.setVisible(true);
sale.jCreditNoteDate.setDate(rs.getDate("CR_NOTE_DATE"));
sale.jtxtCreditNoteNumber.setText(rs.getString("CR_NOTE_NUMBER"));
sale.jTextArea1.setText(rs.getString("CR_NOTE_TEXT"));
sale.creditID = rs.getInt("CREDIT_ID");
} else {
sale.jchbReversal.setSelected(false);
Date date = new Date();
sale.jCreditNoteDate.setDate(date);
sale.jtxtCreditNoteNumber.setText("");
sale.jTextArea1.setText("");
sale.creditID = 0;
}
dealType.clear();
client.clear();
channel.clear();
status.clear();
lang.clear();
payment.clear();
}
} catch (SQLException ex) {
Logger.getLogger(ConsultationSales.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void showDetails() {
try {
Connection con = getConnection();
int row = jTable1.getSelectedRow();
int correctModel = jTable1.convertRowIndexToModel(row);
PreparedStatement ps = con.prepareStatement("select\n"
+ " AG.ID ARTICLE_GROUP_ID,\n"
+ " case\n"
+ " when D.LANG_ID = 1 then AG.NAME_DE\n"
+ " when D.LANG_ID = 2 then AG.NAME_EN\n"
+ " when D.LANG_ID = 3 then AG.NAME_BG\n"
+ " end ARTICLE_GROUP,\n"
+ " DD.ARTICLE_ID,\n"
+ " case\n"
+ " when D.LANG_ID = 1 then A.CODE || ' | '|| A.NAME_DE\n"
+ " when D.LANG_ID = 2 then A.CODE || ' | '|| A.NAME_EN\n"
+ " when D.LANG_ID = 3 then A.CODE || ' | '|| A.NAME_BG\n"
+ " end ARTICLE,\n"
+ " DD.QUANTITY, DD.PRICE, DD.LOT_ID, L.NUMBER LOT_NUMBER, DD.DVY_PRICE_WITH_VAT\n"
+ "from\n"
+ " DEAL_DETAILS DD\n"
+ " join DEALS D on D.ID = DD.DEAL_ID\n"
+ " join ARTICLES A on A.ID = DD.ARTICLE_ID\n"
+ " join ARTICLE_GROUPS AG on AG.ID = A.ARTICLE_GROUPS_ID\n"
+ " join LOTS L on L.ID = DD.LOT_ID\n"
+ "where\n"
+ " (D.OPERATION_ID = ? or D.OPERATION_ID = 6) and D.DEAL_NUMBER = " + jTable1.getModel().getValueAt(correctModel, 0) + " order by A.ID desc");
ps.setInt(1, Type);
ResultSet rs = ps.executeQuery();
Vector<DropDown> article = new Vector<>();
Vector<DropDown> articleGroup = new Vector<>();
Vector<DropDown> lot = new Vector<>();
while (rs.next()) {
article.addElement(new DropDown(rs.getInt("ARTICLE_ID"), rs.getString("ARTICLE")));
articleGroup.addElement(new DropDown(rs.getInt("ARTICLE_GROUP_ID"), rs.getString("ARTICLE_GROUP")));
lot.addElement(new DropDown(rs.getInt("LOT_ID"), rs.getString("LOT_NUMBER")));
jArticle.setModel(new DefaultComboBoxModel(article));
jGroup.setModel(new DefaultComboBoxModel(articleGroup));
jLot.setModel(new DefaultComboBoxModel(lot));
sale.jcbArticleGroups.getModel().setSelectedItem(jGroup.getModel().getSelectedItem());
sale.jcbArticle.getModel().setSelectedItem(jArticle.getModel().getSelectedItem());
sale.jcbLots.getModel().setSelectedItem(jLot.getModel().getSelectedItem());
sale.jtxtPrice.setText(rs.getString("DVY_PRICE_WITH_VAT"));
int qty = rs.getInt("QUANTITY");
if ((Double) jTable1.getValueAt(correctModel, 8) < 0) {
qty *= -1;
}
sale.jtxtQty.setValue(qty);
sale.jbtnAdd.doClick();
article.clear();
articleGroup.clear();
lot.clear();
}
} catch (SQLException ex) {
Logger.getLogger(ConsultationSales.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void showSum() {
int rows = jTable1.getRowCount();
double sumTotal = 0;
String Total = null;
double sumVat = 0;
String Vat = null;
for (int row = 0; row < rows; row++) {
sumTotal += (Double) jTable1.getValueAt(row, 8);
sumVat += (Double) jTable1.getValueAt(row, 9);
}
NumberFormat nf = new DecimalFormat("#,##0.00");
Total = nf.format(sumTotal);
Vat = nf.format(sumVat);
jtxtTotal.setText(Total);
jtxtTotalVat.setText(Vat);
}
/**
* 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() {
jDealType = new javax.swing.JComboBox<>();
jClient = new javax.swing.JComboBox<>();
jChannel = new javax.swing.JComboBox<>();
jStatus = new javax.swing.JComboBox<>();
jLang = new javax.swing.JComboBox<>();
jPayment = new javax.swing.JComboBox<>();
jArticle = new javax.swing.JComboBox<>();
jGroup = new javax.swing.JComboBox<>();
jLot = new javax.swing.JComboBox<>();
jPopupMenu1 = new javax.swing.JPopupMenu();
jmiDelete = new javax.swing.JMenuItem();
jlbConsultation = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jSeparator1 = new javax.swing.JSeparator();
jdFromDate = new com.toedter.calendar.JDateChooser();
jdToDate = new com.toedter.calendar.JDateChooser();
jButton1 = new javax.swing.JButton();
jlbFromDate = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jbtnExport = new javax.swing.JButton();
jcbChannels = new javax.swing.JComboBox<>();
jcbPayment = new javax.swing.JComboBox<>();
jcbDealType = new javax.swing.JComboBox<>();
jLabel1 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jSeparator2 = new javax.swing.JSeparator();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jtxtTotal = new javax.swing.JTextField();
jtxtTotalVat = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jbtnClose = new javax.swing.JButton();
jmiDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sale/delete16.png"))); // NOI18N
jmiDelete.setText("ะะทััะธะน!");
jmiDelete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jmiDeleteActionPerformed(evt);
}
});
jPopupMenu1.add(jmiDelete);
setTitle("ะัะพะดะฐะถะฑะธ");
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
onExit(evt);
}
});
jlbConsultation.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jlbConsultation.setText("ะัะพะดะฐะถะฑะธ");
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/consultation/run24 (2).png"))); // NOI18N
jButton1.setText("ะะทะฟัะปะฝะธ");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jlbFromDate.setText("ะั ะดะฐัะฐ:");
jLabel2.setText("ะะพ ะดะฐัะฐ:");
jbtnExport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/consultation/excel24.png"))); // NOI18N
jbtnExport.setText("ะะบัะฟะพัั");
jbtnExport.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnExportActionPerformed(evt);
}
});
jLabel1.setText("ะะฐะฝะฐะป:");
jLabel3.setText("ะะปะฐัะฐะฝะต:");
jLabel4.setText("ะะะก ะบะฐัะตะณะพัะธั:");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jlbFromDate)
.addComponent(jdFromDate, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jdToDate, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGap(38, 38, 38)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jcbChannels, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jcbPayment, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jcbDealType, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(55, 55, 55)
.addComponent(jButton1)
.addGap(18, 18, 18)
.addComponent(jbtnExport)
.addGap(32, 32, 32))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jbtnExport))
.addGap(23, 23, 23))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jlbFromDate)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jdToDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jdFromDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jcbChannels, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jcbDealType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jcbPayment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(28, 28, 28))))
);
jTable1.setAutoCreateRowSorter(true);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"ะกะดะตะปะบะฐ โ", "ะคะฐะบัััะฐ โ", "ะะฐัะฐ ะฝะฐ ัะฐะบัััะฐ", "ะัะฟัะฒะฐั", "ะััะถะฐะฒะฐ", "ะะฐะฝะฐะป", "ะะปะฐัะฐะฝะต", "ะะะก ะบะฐัะตะณะพัะธั", "ะกัะพะนะฝะพัั (โฌ)", "ะะฐัะธัะปะตะฝะพ ะะะก (โฌ) "
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false, false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jTable1.setComponentPopupMenu(jPopupMenu1);
jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTable1MouseClicked(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jTable1MouseReleased(evt);
}
});
jScrollPane1.setViewportView(jTable1);
if (jTable1.getColumnModel().getColumnCount() > 0) {
jTable1.getColumnModel().getColumn(0).setPreferredWidth(60);
jTable1.getColumnModel().getColumn(1).setPreferredWidth(60);
jTable1.getColumnModel().getColumn(2).setPreferredWidth(90);
jTable1.getColumnModel().getColumn(3).setPreferredWidth(150);
jTable1.getColumnModel().getColumn(4).setPreferredWidth(50);
jTable1.getColumnModel().getColumn(5).setPreferredWidth(50);
jTable1.getColumnModel().getColumn(7).setPreferredWidth(100);
jTable1.getColumnModel().getColumn(9).setPreferredWidth(120);
}
jtxtTotal.setEditable(false);
jtxtTotal.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jtxtTotal.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jtxtTotalVat.setEditable(false);
jtxtTotalVat.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jtxtTotalVat.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jtxtTotalVat.setToolTipText("");
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel5.setText("ะะฑัะพ:");
jbtnClose.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sale/Delete32.png"))); // NOI18N
jbtnClose.setText("ะะทั
ะพะด");
jbtnClose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnCloseActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator2)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(33, 33, 33)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1075, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 24, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jbtnClose, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jlbConsultation, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(344, 344, 344))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jtxtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(66, 66, 66)
.addComponent(jtxtTotalVat, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(69, 69, 69))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jlbConsultation, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 284, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtxtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtxtTotalVat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
.addComponent(jbtnClose)
.addGap(21, 21, 21))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
Show_Sales_In_JTable();
showSum();
if (jTable1.getRowCount() == 0) {
JOptionPane.showMessageDialog(this, "ะัะผะฐ ะดะฐะฝะฝะธ ะฟะพ ะทะฐะดะฐะดะตะฝะธัะต ะบัะธัะตัะธะธ!");
}
} catch (SQLException ex) {
Logger.getLogger(ConsultationSales.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton1ActionPerformed
private void onExit(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_onExit
setVisible(false);
}//GEN-LAST:event_onExit
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
if (evt.getClickCount() == 2) {
sale.isCreditNote = 0;
sale.jlbSale.setText("ะัะพะดะฐะถะฑะฐ");
sale.setTitle("ะัะพะดะฐะถะฑะฐ");
sale.jlbInvoiceNumbers.setText("ะะพะผะตั ะธ ะดะฐัะฐ ะฝะฐ ัะฐะบัััะฐ:");
sale.jxtCredit.setVisible(false);
sale.jdtchCredit.setVisible(false);
sale.jlbCredit.setVisible(false);
sale.jlbCreditDate.setVisible(false);
sale.jbntInvoice.setText("ะคะฐะบัััะฐ");
int row = jTable1.getSelectedRow();
int correctModel = jTable1.convertRowIndexToModel(row);
if ((Double) jTable1.getValueAt(correctModel, 8) < 0) {
sale.jlbSale.setText("ะกัะพัะฝะธัะฐะฝะฐ ะฟัะพะดะฐะถะฑะฐ");
sale.setTitle("ะกัะพัะฝะธัะฐะฝะฐ ะฟัะพะดะฐะถะฑะฐ");
sale.jlbInvoiceNumbers.setText("ะะพะผะตั ะธ ะดะฐัะฐ ะฝะฐ ะะ:");
sale.isCreditNote = 1;
JSpinner.NumberEditor editor = new JSpinner.NumberEditor(sale.jtxtQty, "-#");
sale.jtxtQty.setEditor(editor);
sale.jxtCredit.setVisible(true);
sale.jdtchCredit.setVisible(true);
sale.jlbCredit.setVisible(true);
sale.jlbCreditDate.setVisible(true);
sale.jbntInvoice.setText("ะะ");
sale.jxtCredit.setBackground(Color.CYAN);
}
sale.checkQuantity = 0; // This is flag for check for availability quantity and sale quantity!!!!!
showMaster();
showDetails();
sale.jcbArticleGroups.setSelectedIndex(-1);
sale.jcbArticle.setSelectedIndex(-1);
sale.jcbLots.setSelectedIndex(-1);
sale.setVisible(true);
sale.jbtnClear.setEnabled(false);
sale.jtxtInvoiceNumberDialog.setEditable(false);
if (((DropDown) sale.jcbStatuses.getSelectedItem()).getId() == 4) {
sale.jlbCreditNote.setVisible(true);
sale.jpCreditNote.setVisible(true);
} else {
sale.jlbCreditNote.setVisible(false);
}
sale.jbtnNewClient.setEnabled(false);
if (((DropDown) sale.jcbStatuses.getSelectedItem()).getId() == 5) {
sale.jbtnSave.setEnabled(true);
} else {
sale.jbtnSave.setEnabled(false);
}
sale.isSave = 1;
sale.checkQuantity = 1; // This is flag for check for availability quantity and sale quantity!!!!!
}
}//GEN-LAST:event_jTable1MouseClicked
private void jbtnExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnExportActionPerformed
String Date = new SimpleDateFormat("dd.MM.yyyy HH.mm.ss").format(Calendar.getInstance().getTime());
File directory = new File(".");
String absolutePath = directory.getAbsolutePath().substring(0, directory.getAbsolutePath().length() - 1);
String fileName = absolutePath + "Reports\\Sales " + Date;
if (ExcelExport(jTable1, fileName)) {
JOptionPane.showMessageDialog(this, "ะฃัะฟะตัะฝะพ ะตะบัะฟะพััะธัะฐะฝะต!");
} else {
JOptionPane.showMessageDialog(this, "ะัะทะฝะธะบะฝะฐ ะณัะตัะบะฐ!");
}
}//GEN-LAST:event_jbtnExportActionPerformed
private void jTable1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseReleased
if (evt.isPopupTrigger()) {
jPopupMenu1.show(this, evt.getX(), evt.getY());
}
}//GEN-LAST:event_jTable1MouseReleased
private void jmiDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiDeleteActionPerformed
int dialogButton = JOptionPane.showConfirmDialog(null, "ะกะธะณััะฝะธ ะปะธ ััะต, ัะต ะธัะบะฐัะต ะดะฐ ะธะทััะธะตัะต ะฟัะพะดะฐะถะฑะฐัะฐ!", "ะกะฟัะฐะฒะบะธ", JOptionPane.YES_NO_OPTION);
if (dialogButton == JOptionPane.YES_OPTION) {
try {
Connection con = getConnection();
PreparedStatement ps = con.prepareStatement("delete from DEALS D\n"
+ "where (D.DEAL_NUMBER = ? and D.OPERATION_ID = 1)");
ps.setString(1, jTable1.getModel().getValueAt(jTable1.getSelectedRow(), 0).toString());
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "ะฃัะฟะตัะฝะพ ะธะทััะธั
ัะต ะฟัะพะดะฐะถะฑะฐัะฐ!");
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "ะะต ะผะพะถะต ะดะฐ ะธะทััะธะตัะต ัะฐะทะธ ะฟัะพะดะฐะถะฑะฐ!");
}
if (dialogButton == JOptionPane.NO_OPTION) {
remove(dialogButton);
}
}
}//GEN-LAST:event_jmiDeleteActionPerformed
private void jbtnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnCloseActionPerformed
setVisible(false);
}//GEN-LAST:event_jbtnCloseActionPerformed
/**
* @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(ConsultationSales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ConsultationSales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ConsultationSales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ConsultationSales.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 ConsultationSales().setVisible(true);
}
});
}
static class DecimalFormatRenderer extends DefaultTableCellRenderer {
public DecimalFormatRenderer() {
super();
setHorizontalAlignment(JLabel.RIGHT);
}
private static final DecimalFormat formatter = new DecimalFormat("#,##0.00");
@Override
public Component getTableCellRendererComponent(
JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
// First format the cell value as required
value = formatter.format((Number) value);
// And pass it on to parent class
return super.getTableCellRendererComponent(
table, value, isSelected, hasFocus, row, column);
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JComboBox<String> jArticle;
public javax.swing.JButton jButton1;
private javax.swing.JComboBox<String> jChannel;
private javax.swing.JComboBox<String> jClient;
private javax.swing.JComboBox<String> jDealType;
private javax.swing.JComboBox<String> jGroup;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JComboBox<String> jLang;
private javax.swing.JComboBox<String> jLot;
private javax.swing.JPanel jPanel1;
private javax.swing.JComboBox<String> jPayment;
private javax.swing.JPopupMenu jPopupMenu1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JComboBox<String> jStatus;
private javax.swing.JTable jTable1;
private javax.swing.JButton jbtnClose;
private javax.swing.JButton jbtnExport;
private javax.swing.JComboBox<String> jcbChannels;
private javax.swing.JComboBox<String> jcbDealType;
private javax.swing.JComboBox<String> jcbPayment;
public com.toedter.calendar.JDateChooser jdFromDate;
public com.toedter.calendar.JDateChooser jdToDate;
public javax.swing.JLabel jlbConsultation;
private javax.swing.JLabel jlbFromDate;
private javax.swing.JMenuItem jmiDelete;
private javax.swing.JTextField jtxtTotal;
private javax.swing.JTextField jtxtTotalVat;
// End of variables declaration//GEN-END:variables
}
| 42,883 | 0.612918 | 0.602883 | 811 | 51.344021 | 35.439411 | 182 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.868064 | false | false | 13 |
a4ba5b9f4a8fcf9c3673b6a38897335f0f4cd300 | 51,539,639,403 | e3c7df95830a787313de8025c3732f631d7559e9 | /app/src/main/java/com/reo/lingo/Helpers/ImageHelper.java | b5b24152a847d254155aa57ce5b13d638a32f68d | [] | no_license | arist0cles/Reolingo | https://github.com/arist0cles/Reolingo | 75b2f7ada01a10dc35ce90a58b158806ee18eae0 | 0a0b8f17d00200c395d6262ea5f702fbe933e4a2 | refs/heads/master | 2021-05-08T21:36:06.143000 | 2018-07-20T01:29:58 | 2018-07-20T01:29:58 | 119,645,601 | 0 | 1 | null | false | 2018-02-20T08:56:22 | 2018-01-31T06:35:24 | 2018-01-31T06:36:51 | 2018-02-20T08:54:19 | 7,751 | 0 | 1 | 0 | Java | false | null | package com.reo.lingo.Helpers;
import com.reo.lingo.R;
/**
* Created by patrick on 9/06/18.
*/
public class ImageHelper {
public static int findImageIdByWord(String word) {
switch (word)
{
case "Kotiro":
return R.mipmap.girl;
case "Ngeru":
return R.mipmap.cat;
case "Tama":
return R.mipmap.boy;
case "Kuri":
return R.mipmap.dog;
case "Inu":
return R.drawable.coffee;
case "Kai":
return R.drawable.bread;
case "Wa te moenga":
return R.drawable.bedroom;
case "Wa te parakลซihi":
return R.drawable.bread;
case "Wai maori":
return R.drawable.water;
case "Perฤti":
return R.drawable.plate;
case "Tohi":
return R.drawable.toast;
case "He pereti mawhero":
return R.drawable.plate;
case "He kapu whero":
return R.drawable.cup;
case "Kameta":
return R.drawable.scarf;
case "Hatete":
return R.drawable.heater;
case "Pลซrere horoi kฤkahu":
return R.drawable.washing_machine;
default:
return R.drawable.question_mark;
}
}
}
| UTF-8 | Java | 1,427 | java | ImageHelper.java | Java | [
{
"context": "lpers;\n\nimport com.reo.lingo.R;\n\n/**\n * Created by patrick on 9/06/18.\n */\n\npublic class ImageHelper {\n ",
"end": 78,
"score": 0.5453729033470154,
"start": 75,
"tag": "USERNAME",
"value": "pat"
},
{
"context": "s;\n\nimport com.reo.lingo.R;\n\n/**\n * Created b... | null | [] | package com.reo.lingo.Helpers;
import com.reo.lingo.R;
/**
* Created by patrick on 9/06/18.
*/
public class ImageHelper {
public static int findImageIdByWord(String word) {
switch (word)
{
case "Kotiro":
return R.mipmap.girl;
case "Ngeru":
return R.mipmap.cat;
case "Tama":
return R.mipmap.boy;
case "Kuri":
return R.mipmap.dog;
case "Inu":
return R.drawable.coffee;
case "Kai":
return R.drawable.bread;
case "Wa te moenga":
return R.drawable.bedroom;
case "Wa te parakลซihi":
return R.drawable.bread;
case "Wai maori":
return R.drawable.water;
case "Perฤti":
return R.drawable.plate;
case "Tohi":
return R.drawable.toast;
case "He pereti mawhero":
return R.drawable.plate;
case "He kapu whero":
return R.drawable.cup;
case "Kameta":
return R.drawable.scarf;
case "Hatete":
return R.drawable.heater;
case "Pลซrere horoi kฤkahu":
return R.drawable.washing_machine;
default:
return R.drawable.question_mark;
}
}
}
| 1,427 | 0.47435 | 0.470836 | 49 | 28.040817 | 14.029065 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.387755 | false | false | 13 |
71b214a486a7eafbbd09650f16be0b54fd4cc25f | 21,182,778,714,960 | cfa0761d9f011c1b1f980e7271d8bc23c128e428 | /Automation-Testing-With-Cucumber-and-Java/src/test/java/Pages/GoogleSearchPage.java | 7884cdc1fc2e628475e1d56c0d9de34e58974dab | [] | no_license | fmah123/Automation-Testing-With-Cucumber-and-Java | https://github.com/fmah123/Automation-Testing-With-Cucumber-and-Java | d4722b955386312ababc5e45ef237e33bc492366 | e9b8ced13cab4cb3e0306a960ca29816706a00ba | refs/heads/main | 2023-09-05T03:03:14.792000 | 2021-11-25T09:36:39 | 2021-11-25T09:36:39 | 431,781,692 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Pages;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import java.util.List;
/**
* <h1>Google Search Page Object Class</h1>
* This class contains methods relating to scenario involving google search for TruNarrative web link.
*
* @author Mohammed Fidaa Ul Mahboob
* @version 1.0
* @since 2019-08-27*/
public class GoogleSearchPage extends BasePage{
public GoogleSearchPage(WebDriver driver){
super(driver);
}
private static final By SEARCH_BOX = By.cssSelector("input.gLFyf");
private static final By GOOGLE_SEARCH_BUTTON = By.cssSelector("input.gNO89b:nth-child(1)");
/**
* This method navigates to google home page.
* */
public void GoToGoogleHomePage(){
driver.navigate().to("http://www.google.com");
}
/**
* This method is used to enter text into search box and click search button. This has been used to do a google search for "TruNarrative".
* @param input A search string to be used by the google search engine.
* */
public void ClickAndTypeInToSearchBox(String input){
FindAndType(input, SEARCH_BOX);
WaitAndClick(GOOGLE_SEARCH_BUTTON);
}
/**
* This method is used to identify if TruNarrative is the first search result on google search page.
* @param searchName The value of the search result name. */
public void VerifyTruNarrativeWebsiteAsFirstSearchResult(String searchName) {
try{
List<WebElement> searchElement = driver.findElements(By.cssSelector("h3"));
int count = 0; //checks the search rank number
for(WebElement element: searchElement){
if(element.getText().trim().equals(searchName) && count == 0){
return;
}
count++;
}
Assert.fail();
} catch (AssertionError e){
System.out.println("TruNarrative is not the first search result." +
"\nAssertionError: " + e.getMessage());
}
}
/**
* This method verifies if TruNarrative web search result has the correct page link.
* */
public void VerifyTruNarrativeWebsiteLink(String link){
try{
List<WebElement> searchElement = driver.findElements(By.cssSelector("cite"));
for(WebElement element: searchElement){
if(element.getText().trim().equals(link)){
return;
}
}
Assert.fail();
} catch (AssertionError e){
System.out.println("TruNarrative link is not associated with the TruNarrative search result in" +
"\nAssertionError: " + e.getMessage());
}
}
}
| UTF-8 | Java | 2,889 | java | GoogleSearchPage.java | Java | [
{
"context": " search for TruNarrative web link.\r\n *\r\n * @author Mohammed Fidaa Ul Mahboob\r\n * @version 1.0\r\n * @since 2019-08-27*/\r\n\r\npubli",
"end": 377,
"score": 0.9998674392700195,
"start": 352,
"tag": "NAME",
"value": "Mohammed Fidaa Ul Mahboob"
}
] | null | [] | package Pages;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import java.util.List;
/**
* <h1>Google Search Page Object Class</h1>
* This class contains methods relating to scenario involving google search for TruNarrative web link.
*
* @author <NAME>
* @version 1.0
* @since 2019-08-27*/
public class GoogleSearchPage extends BasePage{
public GoogleSearchPage(WebDriver driver){
super(driver);
}
private static final By SEARCH_BOX = By.cssSelector("input.gLFyf");
private static final By GOOGLE_SEARCH_BUTTON = By.cssSelector("input.gNO89b:nth-child(1)");
/**
* This method navigates to google home page.
* */
public void GoToGoogleHomePage(){
driver.navigate().to("http://www.google.com");
}
/**
* This method is used to enter text into search box and click search button. This has been used to do a google search for "TruNarrative".
* @param input A search string to be used by the google search engine.
* */
public void ClickAndTypeInToSearchBox(String input){
FindAndType(input, SEARCH_BOX);
WaitAndClick(GOOGLE_SEARCH_BUTTON);
}
/**
* This method is used to identify if TruNarrative is the first search result on google search page.
* @param searchName The value of the search result name. */
public void VerifyTruNarrativeWebsiteAsFirstSearchResult(String searchName) {
try{
List<WebElement> searchElement = driver.findElements(By.cssSelector("h3"));
int count = 0; //checks the search rank number
for(WebElement element: searchElement){
if(element.getText().trim().equals(searchName) && count == 0){
return;
}
count++;
}
Assert.fail();
} catch (AssertionError e){
System.out.println("TruNarrative is not the first search result." +
"\nAssertionError: " + e.getMessage());
}
}
/**
* This method verifies if TruNarrative web search result has the correct page link.
* */
public void VerifyTruNarrativeWebsiteLink(String link){
try{
List<WebElement> searchElement = driver.findElements(By.cssSelector("cite"));
for(WebElement element: searchElement){
if(element.getText().trim().equals(link)){
return;
}
}
Assert.fail();
} catch (AssertionError e){
System.out.println("TruNarrative link is not associated with the TruNarrative search result in" +
"\nAssertionError: " + e.getMessage());
}
}
}
| 2,870 | 0.6054 | 0.599169 | 84 | 32.392857 | 32.36842 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.27381 | false | false | 13 |
7286c9e17a0ceaefab455cc1b56457b215a15fb1 | 9,371,618,691,650 | da6a6e7f36f558546796f6addb51065858af4e7c | /scshop/.svn/pristine/72/7286c9e17a0ceaefab455cc1b56457b215a15fb1.svn-base | dbd9c27b13ef541720b6a0d5037549467d82e3e1 | [] | no_license | 357724264/scshop_2 | https://github.com/357724264/scshop_2 | 61044aad902bd7ad3a167c8268827984549bc8d0 | b4d4c3baa5329a8801da6c07357f13fa7ed1718e | refs/heads/master | 2021-01-13T00:37:34.038000 | 2016-04-05T11:07:55 | 2016-04-05T11:07:55 | 55,570,715 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wudianyi.wb.scshop.dao;
import com.wudianyi.wb.scshop.entity.Kuaidi;
public interface KuaidiDao extends BaseDao<Kuaidi,String>{
}
| UTF-8 | Java | 152 | 7286c9e17a0ceaefab455cc1b56457b215a15fb1.svn-base | Java | [] | null | [] | package com.wudianyi.wb.scshop.dao;
import com.wudianyi.wb.scshop.entity.Kuaidi;
public interface KuaidiDao extends BaseDao<Kuaidi,String>{
}
| 152 | 0.763158 | 0.763158 | 7 | 19.714285 | 23.315931 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 13 | |
b2d8999f059078fc10c21f550fd8c0fb7b3072f3 | 13,176,959,710,515 | d53f21e0f6955b065b4cc65ec3ce27a0f176b4e5 | /wellpt-web/src/main/java/com/wellsoft/pt/ldx/support/DqbViewDataSource.java | 7e50f67df1483aa221faacb2ec2d410b7c755ecb | [] | no_license | silentjesse/code_java_wellpt | https://github.com/silentjesse/code_java_wellpt | 500d12530dcc62ecf9074adf3539c3fb4a7e2b15 | cdad2c22621e6d8206f56387ecd126bd575c32f4 | refs/heads/master | 2020-02-06T05:37:05.083000 | 2014-10-31T04:12:38 | 2014-10-31T04:12:38 | 20,854,597 | 2 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wellsoft.pt.ldx.support;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.wellsoft.pt.basicdata.datasource.entity.DataSourceColumn;
import com.wellsoft.pt.basicdata.datasource.provider.AbstractDataSourceProvider;
import com.wellsoft.pt.basicdata.dyview.provider.ViewColumnType;
import com.wellsoft.pt.basicdata.view.support.CondSelectAskInfoNew;
import com.wellsoft.pt.basicdata.view.support.DyViewQueryInfoNew;
import com.wellsoft.pt.common.enums.ModuleID;
import com.wellsoft.pt.core.support.PagingInfo;
import com.wellsoft.pt.core.support.QueryItem;
import com.wellsoft.pt.ldx.service.DqbsService;
@Component
public class DqbViewDataSource extends AbstractDataSourceProvider {
@Autowired
private DqbsService dqbsService;
@Override
public Set<DataSourceColumn> getAllDataSourceColumns() {
Set<DataSourceColumn> viewColumns = new HashSet<DataSourceColumn>();
viewColumns
.add(generateCol("question_id", "question_id", "ไธป้ฎ", ViewColumnType.STRING));
viewColumns.add(generateCol("level_1", "level_1", "้ข็บง1", ViewColumnType.STRING));
viewColumns.add(generateCol("level_2", "level_2", "้ข็บง2",
ViewColumnType.STRING));
viewColumns.add(generateCol("level_3", "level_3", "้ข็บง3",
ViewColumnType.STRING));
viewColumns.add(generateCol("question_text", "question_text", "้ข็ฎๅ
ๅฎน",
ViewColumnType.STRING));
viewColumns.add(generateCol("question_type", "question_type", "้ข็ฎ็ฑปๅ",
ViewColumnType.STRING));
viewColumns.add(generateCol("operation_seq", "operation_seq", "ๅทฅๅบ",
ViewColumnType.STRING));
viewColumns.add(generateCol("is_key", "is_key", "ๆฏๅฆๅ
ณ้ฎๅทฅๅบ",
ViewColumnType.STRING));
return viewColumns;
}
private DataSourceColumn generateCol(String attributeName,
String columnAlias, String columnName, ViewColumnType viewcolumntype) {
DataSourceColumn column = new DataSourceColumn();
column.setFieldName(attributeName);
column.setColumnAliase(columnAlias);
column.setColumnName(columnName);
column.setColumnDataType(viewcolumntype == null ? ViewColumnType.STRING
.name() : viewcolumntype.name());
return column;
}
@Override
public String getModuleId() {
return ModuleID.WORKFLOW.getValue();
}
@Override
public String getModuleName() {
return "้ฆไปถๅทกๆฃ้ขๅบ็ปดๆค";
}
@Override
public List<QueryItem> query(Set<DataSourceColumn> dataSourceColumn,
String whereHql, Map<String, Object> queryParams, String orderBy,
PagingInfo pagingInfo) {
//
String querySql = " droid_question_bank where " + whereHql;
List<QueryItem> list = dqbsService.queryForItemBySql(dataSourceColumn, querySql, queryParams, orderBy, pagingInfo, false);
return list;
}
@Override
public String getWhereSql(DyViewQueryInfoNew dyviewqueryinfonew) {
List<CondSelectAskInfoNew> whereSqlList = dyviewqueryinfonew
.getCondSelectList();
for (CondSelectAskInfoNew object : whereSqlList) {
System.out.println("======" + object.getSearchField());
}
return "";
}
}
| UTF-8 | Java | 3,188 | java | DqbViewDataSource.java | Java | [] | null | [] | package com.wellsoft.pt.ldx.support;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.wellsoft.pt.basicdata.datasource.entity.DataSourceColumn;
import com.wellsoft.pt.basicdata.datasource.provider.AbstractDataSourceProvider;
import com.wellsoft.pt.basicdata.dyview.provider.ViewColumnType;
import com.wellsoft.pt.basicdata.view.support.CondSelectAskInfoNew;
import com.wellsoft.pt.basicdata.view.support.DyViewQueryInfoNew;
import com.wellsoft.pt.common.enums.ModuleID;
import com.wellsoft.pt.core.support.PagingInfo;
import com.wellsoft.pt.core.support.QueryItem;
import com.wellsoft.pt.ldx.service.DqbsService;
@Component
public class DqbViewDataSource extends AbstractDataSourceProvider {
@Autowired
private DqbsService dqbsService;
@Override
public Set<DataSourceColumn> getAllDataSourceColumns() {
Set<DataSourceColumn> viewColumns = new HashSet<DataSourceColumn>();
viewColumns
.add(generateCol("question_id", "question_id", "ไธป้ฎ", ViewColumnType.STRING));
viewColumns.add(generateCol("level_1", "level_1", "้ข็บง1", ViewColumnType.STRING));
viewColumns.add(generateCol("level_2", "level_2", "้ข็บง2",
ViewColumnType.STRING));
viewColumns.add(generateCol("level_3", "level_3", "้ข็บง3",
ViewColumnType.STRING));
viewColumns.add(generateCol("question_text", "question_text", "้ข็ฎๅ
ๅฎน",
ViewColumnType.STRING));
viewColumns.add(generateCol("question_type", "question_type", "้ข็ฎ็ฑปๅ",
ViewColumnType.STRING));
viewColumns.add(generateCol("operation_seq", "operation_seq", "ๅทฅๅบ",
ViewColumnType.STRING));
viewColumns.add(generateCol("is_key", "is_key", "ๆฏๅฆๅ
ณ้ฎๅทฅๅบ",
ViewColumnType.STRING));
return viewColumns;
}
private DataSourceColumn generateCol(String attributeName,
String columnAlias, String columnName, ViewColumnType viewcolumntype) {
DataSourceColumn column = new DataSourceColumn();
column.setFieldName(attributeName);
column.setColumnAliase(columnAlias);
column.setColumnName(columnName);
column.setColumnDataType(viewcolumntype == null ? ViewColumnType.STRING
.name() : viewcolumntype.name());
return column;
}
@Override
public String getModuleId() {
return ModuleID.WORKFLOW.getValue();
}
@Override
public String getModuleName() {
return "้ฆไปถๅทกๆฃ้ขๅบ็ปดๆค";
}
@Override
public List<QueryItem> query(Set<DataSourceColumn> dataSourceColumn,
String whereHql, Map<String, Object> queryParams, String orderBy,
PagingInfo pagingInfo) {
//
String querySql = " droid_question_bank where " + whereHql;
List<QueryItem> list = dqbsService.queryForItemBySql(dataSourceColumn, querySql, queryParams, orderBy, pagingInfo, false);
return list;
}
@Override
public String getWhereSql(DyViewQueryInfoNew dyviewqueryinfonew) {
List<CondSelectAskInfoNew> whereSqlList = dyviewqueryinfonew
.getCondSelectList();
for (CondSelectAskInfoNew object : whereSqlList) {
System.out.println("======" + object.getSearchField());
}
return "";
}
}
| 3,188 | 0.765365 | 0.762484 | 89 | 34.101124 | 27.712831 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.41573 | false | false | 13 |
c722e0eb4b123a41859b8a78cd1d50d756eb7bbf | 15,590,731,286,031 | 3f8d8caed16dd3359844e54d1fadb988c98a7cd0 | /src/design_pattern/p08ๆจกๆฟๆนๆณ/p2ๆจกๆฟไธ้ฉๅญๅฝๆฐ/Caffee.java | 4ec3d45cfe427892f94544baa31257febbecf3fb | [] | no_license | Justxyx/JavaSourceLearn | https://github.com/Justxyx/JavaSourceLearn | 0613ded993394d0f6ac985566d10a84ee062f9ef | 8c483b6fdae4aabc9faf5d69a46e7a6abfc3a20e | refs/heads/master | 2023-08-06T20:41:41.507000 | 2021-10-05T14:03:42 | 2021-10-05T14:03:42 | 404,720,005 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package design_pattern.p08ๆจกๆฟๆนๆณ.p2ๆจกๆฟไธ้ฉๅญๅฝๆฐ;
/**
* @author xm
* @date 2021/9/15 12:14
* @description:
*/
public class Caffee extends CaffeeBeverage {
boolean b;
public Caffee() {
}
public Caffee(boolean b) {
this.b = b;
}
@Override
boolean hock() {
return b;
}
@Override
void method4() {
System.out.println("้ๅๆนๆณ4");
}
@Override
void method3() {
System.out.println("้ๅๆนๆณ3");
}
}
| UTF-8 | Java | 514 | java | Caffee.java | Java | [
{
"context": " design_pattern.p08ๆจกๆฟๆนๆณ.p2ๆจกๆฟไธ้ฉๅญๅฝๆฐ;\n\n/**\n * @author xm\n * @date 2021/9/15 12:14\n * @description:\n */\npub",
"end": 60,
"score": 0.999501645565033,
"start": 58,
"tag": "USERNAME",
"value": "xm"
}
] | null | [] | package design_pattern.p08ๆจกๆฟๆนๆณ.p2ๆจกๆฟไธ้ฉๅญๅฝๆฐ;
/**
* @author xm
* @date 2021/9/15 12:14
* @description:
*/
public class Caffee extends CaffeeBeverage {
boolean b;
public Caffee() {
}
public Caffee(boolean b) {
this.b = b;
}
@Override
boolean hock() {
return b;
}
@Override
void method4() {
System.out.println("้ๅๆนๆณ4");
}
@Override
void method3() {
System.out.println("้ๅๆนๆณ3");
}
}
| 514 | 0.546219 | 0.508403 | 33 | 13.393939 | 12.706332 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | false | false | 13 |
b85509f76a61118d7935a5a11caa547b92cfb6a6 | 27,118,423,511,584 | ba73f5e9ef9baed8ae24f789d936795bb2a2e01c | /src/main/java/de/xPlayer890/System/Shop/Leggings.java | 927cbc22bc85ccbf78d1df839c99b65a357c1b2a | [] | no_license | xPlayer890/System | https://github.com/xPlayer890/System | 732394ba9504ee64603f69a4376d45f6abf94f39 | ec54e0e27a6fce6fa7840a34123b95b568ce3bd7 | refs/heads/master | 2016-08-08T20:46:37.929000 | 2016-03-09T19:17:07 | 2016-03-09T19:17:07 | 51,760,658 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.xPlayer890.System.Shop;
import de.xPlayer890.System.API.CreateAPI;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
public class Leggings implements Listener {
public static String nameInv = "ยง8Hose";
@EventHandler
public void onLeggings(InventoryClickEvent e) {
final Player p = (Player) e.getWhoClicked();
if (e.getInventory().getName().contains(nameInv)) {
e.setCancelled(true);
if (e.getCurrentItem().getType() == Material.LEATHER_LEGGINGS) {
p.getInventory().setLeggings((e.getCurrentItem()));
p.sendMessage("ยง7[ยง6Shopยง7] ยง3Du hast dir eine " + e.getCurrentItem().getItemMeta().getDisplayName() + " ยง3angezogen");
} else if (e.getCurrentItem().getType() == Material.GOLD_LEGGINGS) {
p.getInventory().setLeggings((e.getCurrentItem()));
p.sendMessage("ยง7[ยง6Shopยง7] ยง3Du hast dir einen " + e.getCurrentItem().getItemMeta().getDisplayName() + " ยง3angezogen");
} else if (e.getCurrentItem().getType() == Material.CHAINMAIL_LEGGINGS) {
p.getInventory().setLeggings((e.getCurrentItem()));
p.sendMessage("ยง7[ยง6Shopยง7] ยง3Du hast dir eine " + e.getCurrentItem().getItemMeta().getDisplayName() + " ยง3angezogen");
} else if (e.getCurrentItem().getType() == Material.IRON_LEGGINGS) {
p.getInventory().setLeggings((e.getCurrentItem()));
p.sendMessage("ยง7[ยง6Shopยง7] ยง3Du hast dir einen " + e.getCurrentItem().getItemMeta().getDisplayName() + " ยง3angezogen");
} else if (e.getCurrentItem().getType() == Material.DIAMOND_LEGGINGS) {
p.getInventory().setLeggings((e.getCurrentItem()));
p.sendMessage("ยง7[ยง6Shopยง7] ยง3Du hast dir einen " + e.getCurrentItem().getItemMeta().getDisplayName() + " ยง3angezogen");
} else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Zurรผck")) {
MainMenu.openMenu(p);
} else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Entfernen")) {
p.getInventory().setLeggings(null);
p.sendMessage("ยง7[ยง6Shopยง7] ยงcDeine Hose wurde entfernt");
}
}
}
public static void openLeggings(Player p) {
Inventory inv = Bukkit.createInventory(null, 4 * 9, nameInv);
setItemInv(inv);
p.openInventory(inv);
}
public static void setItemInv(Inventory inv) {
inv.setItem(2, CreateAPI.createItemLore(Material.LEATHER_LEGGINGS, "ยงbLederhose", 1, 0, "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(3, CreateAPI.createItemLore(Material.GOLD_LEGGINGS, "ยงbGoldbeinschutz", 1, 0, "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(4, CreateAPI.createItemLore(Material.CHAINMAIL_LEGGINGS, "ยงbKettenhose", 1, 0, "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(5, CreateAPI.createItemLore(Material.IRON_LEGGINGS, "ยงbEisenbeinschutz", 1, 0, "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(6, CreateAPI.createItemLore(Material.DIAMOND_LEGGINGS, "ยงbDiamantbeinschutz", 1, 0, "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(10, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.RED, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(11, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.BLUE, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(12, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.AQUA, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(13, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.LIME, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(14, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.FUCHSIA, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(15, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.TEAL, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(16, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.ORANGE, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(19, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.PURPLE, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(20, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.BLACK, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(21, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.YELLOW, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(22, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.WHITE, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(23, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.OLIVE, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(24, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.SILVER, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(25, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.MAROON, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(31, CreateAPI.createItemLore(Material.BARRIER, "ยงcEntfernen", 1, 0, "ยง8Klicke um deine Hose auszuziehen"));
inv.setItem(35, CreateAPI.createItemLore(Material.SLIME_BALL, "ยง3Zurรผck", 1, 0, "ยงb<<<"));
}
}
| UTF-8 | Java | 5,763 | java | Leggings.java | Java | [] | null | [] | package de.xPlayer890.System.Shop;
import de.xPlayer890.System.API.CreateAPI;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
public class Leggings implements Listener {
public static String nameInv = "ยง8Hose";
@EventHandler
public void onLeggings(InventoryClickEvent e) {
final Player p = (Player) e.getWhoClicked();
if (e.getInventory().getName().contains(nameInv)) {
e.setCancelled(true);
if (e.getCurrentItem().getType() == Material.LEATHER_LEGGINGS) {
p.getInventory().setLeggings((e.getCurrentItem()));
p.sendMessage("ยง7[ยง6Shopยง7] ยง3Du hast dir eine " + e.getCurrentItem().getItemMeta().getDisplayName() + " ยง3angezogen");
} else if (e.getCurrentItem().getType() == Material.GOLD_LEGGINGS) {
p.getInventory().setLeggings((e.getCurrentItem()));
p.sendMessage("ยง7[ยง6Shopยง7] ยง3Du hast dir einen " + e.getCurrentItem().getItemMeta().getDisplayName() + " ยง3angezogen");
} else if (e.getCurrentItem().getType() == Material.CHAINMAIL_LEGGINGS) {
p.getInventory().setLeggings((e.getCurrentItem()));
p.sendMessage("ยง7[ยง6Shopยง7] ยง3Du hast dir eine " + e.getCurrentItem().getItemMeta().getDisplayName() + " ยง3angezogen");
} else if (e.getCurrentItem().getType() == Material.IRON_LEGGINGS) {
p.getInventory().setLeggings((e.getCurrentItem()));
p.sendMessage("ยง7[ยง6Shopยง7] ยง3Du hast dir einen " + e.getCurrentItem().getItemMeta().getDisplayName() + " ยง3angezogen");
} else if (e.getCurrentItem().getType() == Material.DIAMOND_LEGGINGS) {
p.getInventory().setLeggings((e.getCurrentItem()));
p.sendMessage("ยง7[ยง6Shopยง7] ยง3Du hast dir einen " + e.getCurrentItem().getItemMeta().getDisplayName() + " ยง3angezogen");
} else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Zurรผck")) {
MainMenu.openMenu(p);
} else if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Entfernen")) {
p.getInventory().setLeggings(null);
p.sendMessage("ยง7[ยง6Shopยง7] ยงcDeine Hose wurde entfernt");
}
}
}
public static void openLeggings(Player p) {
Inventory inv = Bukkit.createInventory(null, 4 * 9, nameInv);
setItemInv(inv);
p.openInventory(inv);
}
public static void setItemInv(Inventory inv) {
inv.setItem(2, CreateAPI.createItemLore(Material.LEATHER_LEGGINGS, "ยงbLederhose", 1, 0, "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(3, CreateAPI.createItemLore(Material.GOLD_LEGGINGS, "ยงbGoldbeinschutz", 1, 0, "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(4, CreateAPI.createItemLore(Material.CHAINMAIL_LEGGINGS, "ยงbKettenhose", 1, 0, "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(5, CreateAPI.createItemLore(Material.IRON_LEGGINGS, "ยงbEisenbeinschutz", 1, 0, "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(6, CreateAPI.createItemLore(Material.DIAMOND_LEGGINGS, "ยงbDiamantbeinschutz", 1, 0, "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(10, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.RED, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(11, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.BLUE, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(12, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.AQUA, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(13, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.LIME, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(14, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.FUCHSIA, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(15, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.TEAL, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(16, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.ORANGE, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(19, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.PURPLE, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(20, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.BLACK, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(21, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.YELLOW, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(22, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.WHITE, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(23, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.OLIVE, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(24, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.SILVER, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(25, CreateAPI.createLeatherItem(Material.LEATHER_LEGGINGS, Color.MAROON, "ยงbLederhose", "ยง8Klicke fรผr eine neue Hose"));
inv.setItem(31, CreateAPI.createItemLore(Material.BARRIER, "ยงcEntfernen", 1, 0, "ยง8Klicke um deine Hose auszuziehen"));
inv.setItem(35, CreateAPI.createItemLore(Material.SLIME_BALL, "ยง3Zurรผck", 1, 0, "ยงb<<<"));
}
}
| 5,763 | 0.668078 | 0.648854 | 86 | 64.930229 | 53.621368 | 141 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.662791 | false | false | 13 |
ff0bef174664d4450df2308ff0257177196dee56 | 27,118,423,512,887 | 35c34f9bcbdf16d94665b00623b43f54d7b0a3ad | /kisoonlineapp-gui/src/main/java/org/kisoonlineapp/uc/rest/StartEndDateValidation.java | e83c227aac93d92836c6816dc7fc18a833987b36 | [
"Apache-2.0"
] | permissive | bernhardhuber/kisoonlineapp | https://github.com/bernhardhuber/kisoonlineapp | 574d362f98c2a49f8608ef4300c6388b443bb8ea | 53711b1fa9072bb13d4a9a437b6d2ba6332dc8ac | refs/heads/master | 2019-06-23T10:27:26.191000 | 2019-06-02T20:36:49 | 2019-06-02T20:36:49 | 44,066,922 | 0 | 1 | Apache-2.0 | false | 2019-06-02T20:36:50 | 2015-10-11T19:47:05 | 2018-09-04T20:42:57 | 2019-06-02T20:36:50 | 15,007 | 0 | 0 | 3 | Java | false | false | /*
* Copyright 2016 berni.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kisoonlineapp.uc.rest;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.lang3.StringUtils;
import org.kisoonlineapp.uc.rest.StartEndDateValidation.Response.Valid.ValidBuilder;
/**
*
* @author berni
*/
class StartEndDateValidation {
private static final Logger logger = Logger.getLogger(StartEndDateValidation.class.getName());
public Response validate(Request req) {
Response response = new Response();
try {
response.startDateTimeValid = new ValidBuilder().
dateTime(req.startDateTime).
valid(validateQueryParam(req.startDateTime)).
convertedDateTime(convertYYYY_MM_DD(req.startDateTime)).
build();
} catch (DateTimeParseException dtpex) {
logger.log(Level.WARNING, "Cannot parse " + "'" + req.startDateTime + "'" + ", " + "'" + req.endDateTime + "'", dtpex);
}
try {
response.endDateTimeValid = new ValidBuilder().
dateTime(req.endDateTime).
valid(validateQueryParam(req.endDateTime)).
convertedDateTime(convertYYYY_MM_DD(req.endDateTime)).
build();
} catch (DateTimeParseException dtpex) {
logger.log(Level.WARNING, "Cannot parse " + "'" + req.startDateTime + "'" + ", " + "'" + req.endDateTime + "'", dtpex);
}
return response;
}
protected boolean validateQueryParam(String dateTime) {
boolean valid = true;
valid = valid && StringUtils.isNotBlank(dateTime);
if (!valid) {
logger.log(Level.WARNING, "Cannot parse ''{0}''", dateTime);
}
return valid;
}
protected boolean validateQueryParams(String startDateTime, String endDateTime) {
boolean valid = true;
valid = valid && validateQueryParam(startDateTime);
valid = valid && validateQueryParam(endDateTime);
return valid;
}
/**
* Convert date of format "yyyy-MM-dd"
*
* @param dateAsString
* @return parsed date as calendar
*
* @throws DateTimeParseException
*/
protected LocalDate convertYYYY_MM_DD(String dateAsString) throws DateTimeParseException {
if (StringUtils.isBlank(dateAsString)) {
throw new DateTimeParseException("Empty date", "", 0);
}
final String pattern = "yyyy-MM-dd";
final LocalDate dateAsCal = LocalDate.parse(dateAsString, DateTimeFormatter.ofPattern(pattern));
return dateAsCal;
}
static class Request {
private String startDateTime;
private String endDateTime;
public Request(String startDateTime, String endDateTime) {
this.startDateTime = startDateTime;
this.endDateTime = endDateTime;
}
}
static class Response {
static class Valid {
private String dateTime;
private boolean valid;
private LocalDate convertedDateTime;
public String getDateTime() {
return dateTime;
}
public boolean isValid() {
return valid;
}
public LocalDate getConvertedDateTime() {
return convertedDateTime;
}
static class ValidBuilder {
Valid valid = new Valid();
ValidBuilder dateTime(String v) {
this.valid.dateTime = v;
return this;
}
ValidBuilder valid(boolean v) {
this.valid.valid = v;
return this;
}
ValidBuilder convertedDateTime(LocalDate v) {
this.valid.convertedDateTime = v;
return this;
}
Valid build() {
return this.valid;
}
}
}
private Valid startDateTimeValid;
private Valid endDateTimeValid;
public boolean isValid() {
boolean rc = true;
rc = rc && startDateTimeValid != null;
rc = rc && startDateTimeValid.isValid();
rc = rc && endDateTimeValid != null;
rc = rc && endDateTimeValid.isValid();
return rc;
}
public Valid getStartDateTimeValid() {
return startDateTimeValid;
}
public Valid getEndDateTimeValid() {
return endDateTimeValid;
}
}
}
| UTF-8 | Java | 5,302 | java | StartEndDateValidation.java | Java | [
{
"context": "/*\n * Copyright 2016 berni.\n *\n * Licensed under the Apache License, Version",
"end": 26,
"score": 0.9522960186004639,
"start": 21,
"tag": "NAME",
"value": "berni"
},
{
"context": "on.Response.Valid.ValidBuilder;\n\n/**\n *\n * @author berni\n */\nclass StartEndDateV... | null | [] | /*
* Copyright 2016 berni.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kisoonlineapp.uc.rest;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.lang3.StringUtils;
import org.kisoonlineapp.uc.rest.StartEndDateValidation.Response.Valid.ValidBuilder;
/**
*
* @author berni
*/
class StartEndDateValidation {
private static final Logger logger = Logger.getLogger(StartEndDateValidation.class.getName());
public Response validate(Request req) {
Response response = new Response();
try {
response.startDateTimeValid = new ValidBuilder().
dateTime(req.startDateTime).
valid(validateQueryParam(req.startDateTime)).
convertedDateTime(convertYYYY_MM_DD(req.startDateTime)).
build();
} catch (DateTimeParseException dtpex) {
logger.log(Level.WARNING, "Cannot parse " + "'" + req.startDateTime + "'" + ", " + "'" + req.endDateTime + "'", dtpex);
}
try {
response.endDateTimeValid = new ValidBuilder().
dateTime(req.endDateTime).
valid(validateQueryParam(req.endDateTime)).
convertedDateTime(convertYYYY_MM_DD(req.endDateTime)).
build();
} catch (DateTimeParseException dtpex) {
logger.log(Level.WARNING, "Cannot parse " + "'" + req.startDateTime + "'" + ", " + "'" + req.endDateTime + "'", dtpex);
}
return response;
}
protected boolean validateQueryParam(String dateTime) {
boolean valid = true;
valid = valid && StringUtils.isNotBlank(dateTime);
if (!valid) {
logger.log(Level.WARNING, "Cannot parse ''{0}''", dateTime);
}
return valid;
}
protected boolean validateQueryParams(String startDateTime, String endDateTime) {
boolean valid = true;
valid = valid && validateQueryParam(startDateTime);
valid = valid && validateQueryParam(endDateTime);
return valid;
}
/**
* Convert date of format "yyyy-MM-dd"
*
* @param dateAsString
* @return parsed date as calendar
*
* @throws DateTimeParseException
*/
protected LocalDate convertYYYY_MM_DD(String dateAsString) throws DateTimeParseException {
if (StringUtils.isBlank(dateAsString)) {
throw new DateTimeParseException("Empty date", "", 0);
}
final String pattern = "yyyy-MM-dd";
final LocalDate dateAsCal = LocalDate.parse(dateAsString, DateTimeFormatter.ofPattern(pattern));
return dateAsCal;
}
static class Request {
private String startDateTime;
private String endDateTime;
public Request(String startDateTime, String endDateTime) {
this.startDateTime = startDateTime;
this.endDateTime = endDateTime;
}
}
static class Response {
static class Valid {
private String dateTime;
private boolean valid;
private LocalDate convertedDateTime;
public String getDateTime() {
return dateTime;
}
public boolean isValid() {
return valid;
}
public LocalDate getConvertedDateTime() {
return convertedDateTime;
}
static class ValidBuilder {
Valid valid = new Valid();
ValidBuilder dateTime(String v) {
this.valid.dateTime = v;
return this;
}
ValidBuilder valid(boolean v) {
this.valid.valid = v;
return this;
}
ValidBuilder convertedDateTime(LocalDate v) {
this.valid.convertedDateTime = v;
return this;
}
Valid build() {
return this.valid;
}
}
}
private Valid startDateTimeValid;
private Valid endDateTimeValid;
public boolean isValid() {
boolean rc = true;
rc = rc && startDateTimeValid != null;
rc = rc && startDateTimeValid.isValid();
rc = rc && endDateTimeValid != null;
rc = rc && endDateTimeValid.isValid();
return rc;
}
public Valid getStartDateTimeValid() {
return startDateTimeValid;
}
public Valid getEndDateTimeValid() {
return endDateTimeValid;
}
}
}
| 5,302 | 0.586571 | 0.584496 | 166 | 30.939758 | 26.79995 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.439759 | false | false | 13 |
090e8d7bab798a62e94ac72cb85bf6e88da398eb | 28,235,115,037,552 | dde64380c7f4fdc71fb63272782419aaa520750d | /inventory-service/src/integrationTest/java/br/com/maccommerce/inventoryservice/mock/InventoryMock.java | cb7481b0eedb7ac14c502677afd5b8c2f255914e | [
"MIT"
] | permissive | wellingtoncosta/maccommerce | https://github.com/wellingtoncosta/maccommerce | 6ac76ce126887097972d8f5557c74893700e54ad | f25c2157e5ffe362e405a145e4889b4e9166897d | refs/heads/master | 2021-05-18T22:25:36.489000 | 2020-04-04T19:43:54 | 2020-04-04T19:44:16 | 251,454,379 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.maccommerce.inventoryservice.mock;
import br.com.maccommerce.inventoryservice.domain.entity.Inventory;
import br.com.maccommerce.inventoryservice.domain.entity.Product;
import io.azam.ulidj.ULID;
public final class InventoryMock {
public static Inventory getOne(Product product) {
Inventory inventory = new Inventory();
inventory.setId(ULID.random());
inventory.setProduct(product);
inventory.setAmount(100L);
inventory.setDescription("Test");
return inventory;
}
public static Inventory getOne() {
Product product = new Product();
product.setId(ULID.random());
Inventory inventory = new Inventory();
inventory.setId(ULID.random());
inventory.setProduct(product);
inventory.setAmount(100L);
inventory.setDescription("Test");
return inventory;
}
}
| UTF-8 | Java | 896 | java | InventoryMock.java | Java | [] | null | [] | package br.com.maccommerce.inventoryservice.mock;
import br.com.maccommerce.inventoryservice.domain.entity.Inventory;
import br.com.maccommerce.inventoryservice.domain.entity.Product;
import io.azam.ulidj.ULID;
public final class InventoryMock {
public static Inventory getOne(Product product) {
Inventory inventory = new Inventory();
inventory.setId(ULID.random());
inventory.setProduct(product);
inventory.setAmount(100L);
inventory.setDescription("Test");
return inventory;
}
public static Inventory getOne() {
Product product = new Product();
product.setId(ULID.random());
Inventory inventory = new Inventory();
inventory.setId(ULID.random());
inventory.setProduct(product);
inventory.setAmount(100L);
inventory.setDescription("Test");
return inventory;
}
}
| 896 | 0.68192 | 0.675223 | 30 | 28.866667 | 20.254602 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 13 |
b4b0cf3679196f83caa235d0c81709259afabac1 | 4,114,578,710,994 | ecdfb2b906899fcc7c760920a4eac782b916648f | /src/com/esolutions/trainings/java/nivelacion/ex3/Main.java | 88456c1c7a25c308eb94f046158498fba8c4bebc | [] | no_license | mentores-esolutions/esolutions-java-introduction | https://github.com/mentores-esolutions/esolutions-java-introduction | 69da183289b7d108367fd5e318e15a5e2381519d | cd877ae6e31584b32b38f3581b3bbf72bb1b4a9b | refs/heads/master | 2020-05-01T17:32:34.835000 | 2019-03-26T12:08:53 | 2019-03-26T12:08:53 | 177,602,448 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.esolutions.trainings.java.nivelacion.ex3;
import com.esolutions.trainings.java.nivelacion.Console;
public class Main {
public static void main(String[] args) {
Console.printHeader(3);
MonthFromDate mfd = new MonthFromDate();
System.out.println("1) " + mfd.monthFrom("01012010"));
System.out.println("2) " + mfd.monthFrom("22102018"));
System.out.println("3) " + mfd.monthFrom("31112019"));
Console.printFooter();
}
}
| UTF-8 | Java | 491 | java | Main.java | Java | [] | null | [] | package com.esolutions.trainings.java.nivelacion.ex3;
import com.esolutions.trainings.java.nivelacion.Console;
public class Main {
public static void main(String[] args) {
Console.printHeader(3);
MonthFromDate mfd = new MonthFromDate();
System.out.println("1) " + mfd.monthFrom("01012010"));
System.out.println("2) " + mfd.monthFrom("22102018"));
System.out.println("3) " + mfd.monthFrom("31112019"));
Console.printFooter();
}
}
| 491 | 0.651731 | 0.592668 | 18 | 26.277779 | 25.315357 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 13 |
3f13ae2699d45c3538b051ec4691ec33760b8933 | 1,494,648,629,450 | 16cb7ac9c3c85b17f63c3d8d7b18aa44b875f259 | /pmbImgFilter/FilterPmb.java | 22c7920b57ae2a00042373c8e0cd2250cc48ef20 | [] | no_license | Althal/IO | https://github.com/Althal/IO | fb9927efe40cf179631b429258fcb2a265fe4d7e | d6e2af1dbd68514ce1427aaf161644d6c3a7d8ee | refs/heads/master | 2020-09-05T07:46:37.067000 | 2020-02-28T10:25:28 | 2020-02-28T10:25:28 | 220,030,760 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pmbImgFilter;
import java.math.BigDecimal;
public class FilterPmb extends FileContent{
private BigDecimal[][] filter;
public FilterPmb(String path) throws Exception{
super(path);
setFilter();
}
private void setFilter() throws Exception{
String[] sizes = lines.get(0).split(" ");
int size = sizes.length;
if(lines.size() != size || size % 2 != 1) throw new Exception("Bลฤdne argumenty filtra");
BigDecimal[][] ret = new BigDecimal[size][size];
for(int i=0; i<size; i++){
String[] values = lines.get(i).split(" ");
for(int j=0; j<size; j++){
ret[i][j] = new BigDecimal(values[j]);
}
}
filter = ret;
}
public BigDecimal[][] getFilter(){
return filter;
}
}
| UTF-8 | Java | 939 | java | FilterPmb.java | Java | [] | null | [] |
package pmbImgFilter;
import java.math.BigDecimal;
public class FilterPmb extends FileContent{
private BigDecimal[][] filter;
public FilterPmb(String path) throws Exception{
super(path);
setFilter();
}
private void setFilter() throws Exception{
String[] sizes = lines.get(0).split(" ");
int size = sizes.length;
if(lines.size() != size || size % 2 != 1) throw new Exception("Bลฤdne argumenty filtra");
BigDecimal[][] ret = new BigDecimal[size][size];
for(int i=0; i<size; i++){
String[] values = lines.get(i).split(" ");
for(int j=0; j<size; j++){
ret[i][j] = new BigDecimal(values[j]);
}
}
filter = ret;
}
public BigDecimal[][] getFilter(){
return filter;
}
}
| 939 | 0.488794 | 0.483458 | 37 | 23.270269 | 22.437479 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.513514 | false | false | 13 |
d3f9c7047dcc020719f47f04ddbf70603a9010b4 | 19,885,698,644,896 | c017f291cf21ed605d81723d536507df2f97c9e3 | /src/algorithm/math/PrimeMumberization.java | 9297bb9e4c64d664cfd21a8e9020fcd0d5bbd1c8 | [] | no_license | tengtong/LeetCode200 | https://github.com/tengtong/LeetCode200 | 2972629a759725d933c46f290c501a34db228397 | 545ef7cf658175795e59901906f75f2186d1976f | refs/heads/master | 2023-06-10T18:56:10.999000 | 2021-07-03T13:01:47 | 2021-07-03T13:01:47 | 382,607,993 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package algorithm.math;
/**
* ็ด ๆฐๅ่งฃ
* ๆฏไธไธชๆฐ้ฝๅฏไปฅๅ่งฃๆ็ด ๆฐ็ไน็งฏ๏ผไพๅฆ 84 = 22 * 31 * 50 * 71 * 110 * 130 * 170 * โฆ
*/
//TODO
public class PrimeMumberization {
}
| UTF-8 | Java | 197 | java | PrimeMumberization.java | Java | [] | null | [] | package algorithm.math;
/**
* ็ด ๆฐๅ่งฃ
* ๆฏไธไธชๆฐ้ฝๅฏไปฅๅ่งฃๆ็ด ๆฐ็ไน็งฏ๏ผไพๅฆ 84 = 22 * 31 * 50 * 71 * 110 * 130 * 170 * โฆ
*/
//TODO
public class PrimeMumberization {
}
| 197 | 0.615894 | 0.490066 | 9 | 15.777778 | 20.649336 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | false | false | 13 |
77ba3aeb8dd51a3229708b4654fec71eb282708a | 14,972,256,059,957 | 0edd2078498f13d1a48126d4d0c8932d39bb6d01 | /SistemaESERV/src/peoples/ClientesController.java | a8a56b7b3b235d222576777cd150b99dd14abb54 | [] | no_license | BrandowBuenos/ESERV | https://github.com/BrandowBuenos/ESERV | 922b4ed6da52f0452af99f1c0426c8dda0156c29 | 1422d050405e3795239cc601742794dec7a37020 | refs/heads/master | 2020-08-29T22:11:43.994000 | 2019-12-13T23:02:37 | 2019-12-13T23:02:37 | 218,186,815 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package peoples;
import java.util.ArrayList;
/**
* Classe ClientesController que gerencia a lista de Clientes
*
* @author Brandow Buenos
* @author Willian Clemente
*/
public class ClientesController {
static ArrayList<Pessoa> listaDeClientes;
/**
* Construtor da classe que instancia um novo ArrayList
*/
public ClientesController() {
listaDeClientes = new ArrayList<Pessoa>();
}
/**
* Adiciona o cliente na lista de clientes
*
* @param c
*/
public void add(Pessoa p) {
listaDeClientes.add(p);
}
/**
* Adiciona o cliente na lista de clientes
*
* @param CPF
* @return
*/
public Pessoa get(long CPF) {
for (int i = 0; i < listaDeClientes.size(); i++) {
if (listaDeClientes.get(i).getCpf() == CPF) {
return listaDeClientes.get(i);
}
}
return null;
}
/**
* Retorna as informaรงoes completas do cliente
*
* @param CPF
* @return
*/
public String getInfo(long CPF) {
Pessoa pessoa = get(CPF);
if (pessoa != null) {
return pessoa.toString();
}
return null;
}
/**
* Retorna as informaรงoes completas de todos os cliente
*
* @param CPF
* @return
*/
public String getInfo() {
String info = "";
for (int i = 0; i < listaDeClientes.size(); i++) {
info += listaDeClientes.get(i).toString();
}
return info;
}
/**
* Altera o cliente com o cpf informado
*
* @param CPF
* @param clienteEditado
* @return
*/
public boolean set(long CPF, Pessoa clienteEditado) {
for (int i = 0; i < listaDeClientes.size(); i++) {
if (listaDeClientes.get(i).getCpf() == CPF) {
listaDeClientes.set(i, clienteEditado);
return true;
}
}
return false;
}
/**
* Remove o cliente conforme o cpf informado
*
* @param CPF
* @return
*/
public boolean remove(long CPF) {
Pessoa p = get(CPF);
if (p != null) {
listaDeClientes.remove(p);
return true;
}
return false;
}
/**
* Verifica se cliente jรก existe
*
* @param CPF
* @return
*/
public boolean existe(long CPF) {
Pessoa pessoa = get(CPF);
return pessoa != null;
}
/**
* Retorna a Lista De Clientes
*
* @return
*/
public static ArrayList<Pessoa> getListaDeClientes() {
return listaDeClientes;
}
} | UTF-8 | Java | 2,222 | java | ClientesController.java | Java | [
{
"context": "er que gerencia a lista de Clientes\n * \n * @author Brandow Buenos\n * @author Willian Clemente\n */\npublic class Clie",
"end": 142,
"score": 0.9998677968978882,
"start": 128,
"tag": "NAME",
"value": "Brandow Buenos"
},
{
"context": " Clientes\n * \n * @author Brandow... | null | [] | package peoples;
import java.util.ArrayList;
/**
* Classe ClientesController que gerencia a lista de Clientes
*
* @author <NAME>
* @author <NAME>
*/
public class ClientesController {
static ArrayList<Pessoa> listaDeClientes;
/**
* Construtor da classe que instancia um novo ArrayList
*/
public ClientesController() {
listaDeClientes = new ArrayList<Pessoa>();
}
/**
* Adiciona o cliente na lista de clientes
*
* @param c
*/
public void add(Pessoa p) {
listaDeClientes.add(p);
}
/**
* Adiciona o cliente na lista de clientes
*
* @param CPF
* @return
*/
public Pessoa get(long CPF) {
for (int i = 0; i < listaDeClientes.size(); i++) {
if (listaDeClientes.get(i).getCpf() == CPF) {
return listaDeClientes.get(i);
}
}
return null;
}
/**
* Retorna as informaรงoes completas do cliente
*
* @param CPF
* @return
*/
public String getInfo(long CPF) {
Pessoa pessoa = get(CPF);
if (pessoa != null) {
return pessoa.toString();
}
return null;
}
/**
* Retorna as informaรงoes completas de todos os cliente
*
* @param CPF
* @return
*/
public String getInfo() {
String info = "";
for (int i = 0; i < listaDeClientes.size(); i++) {
info += listaDeClientes.get(i).toString();
}
return info;
}
/**
* Altera o cliente com o cpf informado
*
* @param CPF
* @param clienteEditado
* @return
*/
public boolean set(long CPF, Pessoa clienteEditado) {
for (int i = 0; i < listaDeClientes.size(); i++) {
if (listaDeClientes.get(i).getCpf() == CPF) {
listaDeClientes.set(i, clienteEditado);
return true;
}
}
return false;
}
/**
* Remove o cliente conforme o cpf informado
*
* @param CPF
* @return
*/
public boolean remove(long CPF) {
Pessoa p = get(CPF);
if (p != null) {
listaDeClientes.remove(p);
return true;
}
return false;
}
/**
* Verifica se cliente jรก existe
*
* @param CPF
* @return
*/
public boolean existe(long CPF) {
Pessoa pessoa = get(CPF);
return pessoa != null;
}
/**
* Retorna a Lista De Clientes
*
* @return
*/
public static ArrayList<Pessoa> getListaDeClientes() {
return listaDeClientes;
}
} | 2,204 | 0.623254 | 0.621902 | 129 | 16.209303 | 16.867783 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.410853 | false | false | 13 |
25449d7d323c9427b639a6b69c30862ca9bdb877 | 833,223,670,070 | b462fb79aac6a3f80cd043e3929ebee4c8834814 | /w_ex/src/ch13/TreadEx2.java | 8f6a059a8393ea5e26efcd0316392d2242fd2175 | [] | no_license | Joker2289/high_java | https://github.com/Joker2289/high_java | 16ba0852fd18c8acb3d4a395e025c2c622e6faea | 28865dc71f192947f6ca1dedabceae8fd7caf9f2 | refs/heads/master | 2020-05-21T03:59:31.347000 | 2019-05-13T15:52:44 | 2019-05-13T15:52:44 | 185,783,881 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ch13;
public class TreadEx2 {
/*
์๋ก ์์ฑํ ์ฐ๋ ๋์์ ๊ณ ์๋ก ์์ธ๋ฅผ ๋ฐ์์ํค๊ณ printStackTrace()๋ฅผ ์ด์ฉํ์ฌ ์์๊ฐ ๋ฐ์ํ ๋น์์ ํธ์ถ์คํ์ ์ถ๋ ฅํ๋ ์์
ํธ์ถ์คํ์ ์ฒซ๋ฒ์งธ ๋ฉ์๋๊ฐ main๋ฉ์๋๊ฐ ์๋๋ผ run๋ฉ์๋์ธ ๊ฒ์ ํ์ธํ์
ํ ์ฐ๋ ๋๊ฐ ์์ธ๊ฐ ๋ฐ์ํด์ ์ข
๋ฃ ๋์ด๋ ๋ค๋ฅธ ์ฐ๋ ๋์ ์คํ์๋ ์ํฅ์ ๋ฏธ์น์ง ์๋๋ค
*/
public static void main(String[] args) {
ThreadEx2_1 t1 = new ThreadEx2_1();
t1.start();
}
}
class ThreadEx2_1 extends Thread {
public void run() {
throwException();
}
public void throwException() {
try {
throw new Exception();
} catch(Exception e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 756 | java | TreadEx2.java | Java | [] | null | [] | package ch13;
public class TreadEx2 {
/*
์๋ก ์์ฑํ ์ฐ๋ ๋์์ ๊ณ ์๋ก ์์ธ๋ฅผ ๋ฐ์์ํค๊ณ printStackTrace()๋ฅผ ์ด์ฉํ์ฌ ์์๊ฐ ๋ฐ์ํ ๋น์์ ํธ์ถ์คํ์ ์ถ๋ ฅํ๋ ์์
ํธ์ถ์คํ์ ์ฒซ๋ฒ์งธ ๋ฉ์๋๊ฐ main๋ฉ์๋๊ฐ ์๋๋ผ run๋ฉ์๋์ธ ๊ฒ์ ํ์ธํ์
ํ ์ฐ๋ ๋๊ฐ ์์ธ๊ฐ ๋ฐ์ํด์ ์ข
๋ฃ ๋์ด๋ ๋ค๋ฅธ ์ฐ๋ ๋์ ์คํ์๋ ์ํฅ์ ๋ฏธ์น์ง ์๋๋ค
*/
public static void main(String[] args) {
ThreadEx2_1 t1 = new ThreadEx2_1();
t1.start();
}
}
class ThreadEx2_1 extends Thread {
public void run() {
throwException();
}
public void throwException() {
try {
throw new Exception();
} catch(Exception e) {
e.printStackTrace();
}
}
}
| 756 | 0.664794 | 0.644195 | 29 | 17.413794 | 19.193241 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.344828 | false | false | 13 |
6cd98b1bfd394174a5687ac5afcd43fb80cbd8f6 | 6,631,429,512,294 | cbd72a9bec046f02198507672dd795e732adaf90 | /src/main/java/br/com/dafiti/hanger/service/JobNotificationService.java | bfa9bdcabebaea1b1b7bb678a65459e198cef696 | [
"MIT"
] | permissive | dafiti-group/hanger | https://github.com/dafiti-group/hanger | e6a834a0db9e8b8a260f888342ef3e1e65df6de7 | b3ccc8e1302d50426fe84e0f4a8a9a7a28065e59 | refs/heads/master | 2021-08-16T23:21:09.018000 | 2021-08-11T21:21:13 | 2021-08-11T21:21:13 | 194,300,106 | 8 | 2 | MIT | false | 2021-09-15T17:32:09 | 2019-06-28T16:00:25 | 2021-09-01T16:19:39 | 2021-09-15T17:32:09 | 15,622 | 6 | 3 | 0 | JavaScript | false | false | /*
* Copyright (c) 2018 Dafiti Group
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package br.com.dafiti.hanger.service;
import br.com.dafiti.hanger.model.Job;
import br.com.dafiti.hanger.model.JobBuild;
import br.com.dafiti.hanger.model.JobStatus;
import br.com.dafiti.hanger.option.Flow;
import br.com.dafiti.hanger.option.Phase;
import br.com.dafiti.hanger.option.Status;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
* @author Valdiney V GOMES
*/
@Service
public class JobNotificationService {
private final JobService jobService;
private final JobBuildStatusService jobBuildStatusService;
private final SlackService slackService;
private final Multimap<Job, Job> warning;
@Autowired
public JobNotificationService(
JobService jobService,
JobBuildStatusService jobBuildStatusService,
SlackService slackService) {
this.jobService = jobService;
this.jobBuildStatusService = jobBuildStatusService;
this.slackService = slackService;
this.warning = Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
}
/**
* Identify if a job has notification.
*
* @param job Job
* @return Identify if a job has warning
*/
public boolean isNotified(Job job) {
return warning.containsKey(job);
}
/**
* Get job notification.
*
* @param job Job
* @return Job warning list
*/
public List<Job> getNotice(Job job) {
return (List<Job>) warning.get(job);
}
/**
* Notify.
*
* @param job Job
* @param slack Identity if send message to slack.
*/
public void notify(Job job, boolean slack) {
this.notify(job, slack, false);
}
/**
* Notify.
*
* @param job Job
* @param slack Identity if send message to slack.
* @param setup Identify if is a setup.
*/
public void notify(Job job, boolean slack, boolean setup) {
Set<Job> pendencies = new HashSet();
StringBuilder message = new StringBuilder();
if (job.isEnabled()) {
JobStatus jobStatus = job.getStatus();
if (jobStatus != null) {
JobBuild jobBuild = jobStatus.getBuild();
if (jobBuild != null) {
if ((jobStatus.getFlow().equals(Flow.NORMAL) || jobStatus.getFlow().equals(Flow.APPROVED))
&& jobBuild.getPhase().equals(Phase.FINALIZED)
&& jobBuild.getStatus().equals(Status.SUCCESS)
&& !setup) {
//Remove a warnig in case of success.
if (!warning.isEmpty()
&& warning.containsValue(job)) {
jobService.getPropagation(job, false).stream().forEach((child) -> {
warning.remove(child, job);
});
}
if (slack) {
//Identifies if job notification is enabled.
if (job.isNotify()) {
if (job.getParent().isEmpty()) {
message
.append(":star-struck: The job *")
.append(job.getDisplayName())
.append("* finished *successfully*");
} else {
job.getParent().stream().forEach((parent) -> {
if (!jobBuildStatusService.isBuilt(parent.getParent())) {
pendencies.add(parent.getParent());
}
});
if (pendencies.isEmpty()) {
message
.append(":star-struck: The job *")
.append(job.getDisplayName())
.append("* and its dependencies has finished *successfully*");
} else {
message
.append(":worried: The job *")
.append(job.getDisplayName())
.append("* has finished *successfully*, but the following dependencies was not finished yet: ");
pendencies.stream().forEach((parent) -> {
message
.append("\n *")
.append(parent.getDisplayName())
.append("* ");
});
}
if (warning.containsKey(job)) {
message
.append("\n(")
.append(warning.get(job).size())
.append(" warning(s) in the job flow!)");
}
}
slackService.send(message.toString(), job.getChannel());
}
}
} else if (jobStatus.getFlow().equals(Flow.ERROR)
|| (jobBuild.getPhase().equals(Phase.FINALIZED) && (jobBuild.getStatus().equals(Status.FAILURE) || jobBuild.getStatus().equals(Status.ABORTED)))) {
//Put a warnig in case of error.
jobService.getPropagation(job, false).stream().forEach((child) -> {
warning.remove(child, job);
warning.put(child, job);
});
if (slack) {
//Identifies if job notification is enabled.
if (job.isNotify()) {
message
.append(":fire: Something wrong happened to the job *")
.append(job.getDisplayName())
.append("*");
slackService.send(message.toString(), job.getChannel());
}
}
}
}
}
}
}
}
| UTF-8 | Java | 8,178 | java | JobNotificationService.java | Java | [
{
"context": "ngframework.stereotype.Service;\n\n/**\n *\n * @author Valdiney V GOMES\n */\n@Service\npublic class JobNotificationService ",
"end": 1776,
"score": 0.9998665452003479,
"start": 1760,
"tag": "NAME",
"value": "Valdiney V GOMES"
}
] | null | [] | /*
* Copyright (c) 2018 Dafiti Group
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package br.com.dafiti.hanger.service;
import br.com.dafiti.hanger.model.Job;
import br.com.dafiti.hanger.model.JobBuild;
import br.com.dafiti.hanger.model.JobStatus;
import br.com.dafiti.hanger.option.Flow;
import br.com.dafiti.hanger.option.Phase;
import br.com.dafiti.hanger.option.Status;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
* @author <NAME>
*/
@Service
public class JobNotificationService {
private final JobService jobService;
private final JobBuildStatusService jobBuildStatusService;
private final SlackService slackService;
private final Multimap<Job, Job> warning;
@Autowired
public JobNotificationService(
JobService jobService,
JobBuildStatusService jobBuildStatusService,
SlackService slackService) {
this.jobService = jobService;
this.jobBuildStatusService = jobBuildStatusService;
this.slackService = slackService;
this.warning = Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
}
/**
* Identify if a job has notification.
*
* @param job Job
* @return Identify if a job has warning
*/
public boolean isNotified(Job job) {
return warning.containsKey(job);
}
/**
* Get job notification.
*
* @param job Job
* @return Job warning list
*/
public List<Job> getNotice(Job job) {
return (List<Job>) warning.get(job);
}
/**
* Notify.
*
* @param job Job
* @param slack Identity if send message to slack.
*/
public void notify(Job job, boolean slack) {
this.notify(job, slack, false);
}
/**
* Notify.
*
* @param job Job
* @param slack Identity if send message to slack.
* @param setup Identify if is a setup.
*/
public void notify(Job job, boolean slack, boolean setup) {
Set<Job> pendencies = new HashSet();
StringBuilder message = new StringBuilder();
if (job.isEnabled()) {
JobStatus jobStatus = job.getStatus();
if (jobStatus != null) {
JobBuild jobBuild = jobStatus.getBuild();
if (jobBuild != null) {
if ((jobStatus.getFlow().equals(Flow.NORMAL) || jobStatus.getFlow().equals(Flow.APPROVED))
&& jobBuild.getPhase().equals(Phase.FINALIZED)
&& jobBuild.getStatus().equals(Status.SUCCESS)
&& !setup) {
//Remove a warnig in case of success.
if (!warning.isEmpty()
&& warning.containsValue(job)) {
jobService.getPropagation(job, false).stream().forEach((child) -> {
warning.remove(child, job);
});
}
if (slack) {
//Identifies if job notification is enabled.
if (job.isNotify()) {
if (job.getParent().isEmpty()) {
message
.append(":star-struck: The job *")
.append(job.getDisplayName())
.append("* finished *successfully*");
} else {
job.getParent().stream().forEach((parent) -> {
if (!jobBuildStatusService.isBuilt(parent.getParent())) {
pendencies.add(parent.getParent());
}
});
if (pendencies.isEmpty()) {
message
.append(":star-struck: The job *")
.append(job.getDisplayName())
.append("* and its dependencies has finished *successfully*");
} else {
message
.append(":worried: The job *")
.append(job.getDisplayName())
.append("* has finished *successfully*, but the following dependencies was not finished yet: ");
pendencies.stream().forEach((parent) -> {
message
.append("\n *")
.append(parent.getDisplayName())
.append("* ");
});
}
if (warning.containsKey(job)) {
message
.append("\n(")
.append(warning.get(job).size())
.append(" warning(s) in the job flow!)");
}
}
slackService.send(message.toString(), job.getChannel());
}
}
} else if (jobStatus.getFlow().equals(Flow.ERROR)
|| (jobBuild.getPhase().equals(Phase.FINALIZED) && (jobBuild.getStatus().equals(Status.FAILURE) || jobBuild.getStatus().equals(Status.ABORTED)))) {
//Put a warnig in case of error.
jobService.getPropagation(job, false).stream().forEach((child) -> {
warning.remove(child, job);
warning.put(child, job);
});
if (slack) {
//Identifies if job notification is enabled.
if (job.isNotify()) {
message
.append(":fire: Something wrong happened to the job *")
.append(job.getDisplayName())
.append("*");
slackService.send(message.toString(), job.getChannel());
}
}
}
}
}
}
}
}
| 8,168 | 0.480191 | 0.479702 | 196 | 40.724491 | 30.601213 | 175 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.459184 | false | false | 13 |
5ac0800e3aaed631381336d63444969ddea81f71 | 6,451,040,947,616 | a9ca10d73f1e4586bc091815788b144ee84115da | /OOPS_LAB/p14bitsid.java | f2261829403dfe5ef30b2336b41537778f289ed3 | [] | no_license | f2015041/Academic | https://github.com/f2015041/Academic | 3c818cd152db22c252e744532e3660506d3cc528 | a7768719ba5445b744f57551156765556abdde17 | refs/heads/master | 2021-01-12T15:43:51.506000 | 2016-12-02T14:41:04 | 2016-12-02T14:41:04 | 71,870,422 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
import java.lang.Math;
public class p14bitsid {
public static void main(String[]args) {
Scanner in = new Scanner(System.in);
String year, discipline, type, campus; // To get random 3 digit number use
// import java.util.Random
System.out.println("Please Enter Year"); // Random num=new Random()
//int num1=num.nextInt(999);
year = in.nextLine();
System.out.
println("Enter A1-chem , A3=EEE , A7=CS ,A4-Mech");
discipline = in.nextLine();
System.out.println("Enter PS/TS");
type = in.nextLine();
System.out.
print("Enter P:PilANI ,H:Hydabad ,G:Goa , U:Dubai");
campus = in.nextLine();
int n = (int) Math.round(Math.random() * 1000);
String Rollno =
year + discipline + type + campus +
Integer.toString(n);
System.out.println(Rollno);
System.out.println("f" + Rollno +
"@dubai.bits-pilani.ac.in");
}}
| UTF-8 | Java | 909 | java | p14bitsid.java | Java | [] | null | [] | import java.util.Scanner;
import java.lang.Math;
public class p14bitsid {
public static void main(String[]args) {
Scanner in = new Scanner(System.in);
String year, discipline, type, campus; // To get random 3 digit number use
// import java.util.Random
System.out.println("Please Enter Year"); // Random num=new Random()
//int num1=num.nextInt(999);
year = in.nextLine();
System.out.
println("Enter A1-chem , A3=EEE , A7=CS ,A4-Mech");
discipline = in.nextLine();
System.out.println("Enter PS/TS");
type = in.nextLine();
System.out.
print("Enter P:PilANI ,H:Hydabad ,G:Goa , U:Dubai");
campus = in.nextLine();
int n = (int) Math.round(Math.random() * 1000);
String Rollno =
year + discipline + type + campus +
Integer.toString(n);
System.out.println(Rollno);
System.out.println("f" + Rollno +
"@dubai.bits-pilani.ac.in");
}}
| 909 | 0.640264 | 0.623762 | 33 | 26.545454 | 20.359035 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.212121 | false | false | 13 |
d245919b08e68ce143d739700c24b9e0f5882757 | 20,315,195,323,908 | 4262c7e6a3aac4845a339e3ce2506c224b3ab591 | /src/main/java/com/mark/repository/OwnerRepository.java | 9be8985eb1de737a826c4906dc776474824a6acc | [] | no_license | kerse277/mark | https://github.com/kerse277/mark | c04854aa3224d2716b535c39bee4d19be7ebb905 | 3b984c6c164d53607630e4e3c3c14484bbf31f50 | refs/heads/master | 2021-01-22T05:58:00.260000 | 2017-07-03T11:42:22 | 2017-07-03T11:42:22 | 92,511,850 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mark.repository;
import com.mark.model.relationship.OwnerRelationship;
import org.springframework.data.neo4j.repository.GraphRepository;
/**
* Created by kerse on 29.03.2017.
*/
public interface OwnerRepository extends GraphRepository<OwnerRelationship> {
}
| UTF-8 | Java | 274 | java | OwnerRepository.java | Java | [
{
"context": "o4j.repository.GraphRepository;\n\n/**\n * Created by kerse on 29.03.2017.\n */\npublic interface OwnerReposito",
"end": 174,
"score": 0.9996013045310974,
"start": 169,
"tag": "USERNAME",
"value": "kerse"
}
] | null | [] | package com.mark.repository;
import com.mark.model.relationship.OwnerRelationship;
import org.springframework.data.neo4j.repository.GraphRepository;
/**
* Created by kerse on 29.03.2017.
*/
public interface OwnerRepository extends GraphRepository<OwnerRelationship> {
}
| 274 | 0.810219 | 0.777372 | 10 | 26.4 | 28.200001 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false | 13 |
b8023e6b56d47905a13c4b7fc9783dfe481a9b33 | 12,154,757,472,215 | 881d539ed1c02cae32df2e9862634238f66228da | /example/src/ch02/ex05/controller/MemberServlet.java | 868dadd5b412f2c69a1fd4282c7b88cdd373d6a1 | [] | no_license | mingburnu/example | https://github.com/mingburnu/example | bbf3aef3926d1ae9347a0113d182af1325293ce1 | 290ee9cb348f63941bc83ffc3de593c52e05c2c6 | refs/heads/master | 2021-01-10T06:42:39.316000 | 2017-01-12T06:22:38 | 2017-01-12T06:22:38 | 48,158,161 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | ๏ปฟpackage ch02.ex05.controller;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/*
* 1. ๆฌServlet่ฎๅ็่ฆฝๅจ้ไพ็่ณๆ๏ผ็ถๅพ็ข็ๆๅญๆง่ณๆ็ๅๆ
* 2. ้ๅธธServletไธๆ็ข็ๆๅญๆง็ๅๆ๏ผไฝๅฆๆ่ฆ็ข็
* ๆๅญๆง็ๅๆ๏ผๅฟ
้ ็ทจๅฏซไธๅๅ
ฉ่ก๏ผ
*
// ่จญๅฎๅๆ่ณๆ็ๆ ผๅผ็บtext/html๏ผๅๆไนๆๅญ่ณๆ็็ทจ็ขผ็บUTF-8(charset=UTF-8)
response.setContentType("text/html; charset=UTF-8");
// ็ฑresponse็ฉไปถๅๅบWriter็ฉไปถ๏ผๆญค่ก่ๅไธ่ก็้ ๅบไธ่ฝ้กๅ
PrintWriter out = response.getWriter();
*/
public class MemberServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// ่จญๅฎๅๆ่ณๆ็ๆ ผๅผ็บtext/html๏ผๅๆไนๆๅญ่ณๆ็็ทจ็ขผ็บUTF-8(charset=UTF-8)
response.setContentType("text/html; charset=UTF-8");
// ็ฑresponse็ฉไปถๅๅบWriter็ฉไปถ๏ผๆญค่ก่ๅไธ่ก็้ ๅบไธ่ฝ้กๅ
PrintWriter out = response.getWriter();
// ่ชชๆ็่ฆฝๅจ้ไพ็ๆๅญ่ณๆ็็ทจ็ขผ็บUTF-8
request.setCharacterEncoding("UTF-8");
// ่ฎๅไฝฟ็จ่
ๅจ<input type="text" name="userId">ๆฌไฝไธญ่ผธๅ
ฅ็่ณๆ
String id = request.getParameter("userId");
if ( id == null || id.trim().length() == 0){
id = "ๆช่ผธๅ
ฅ";
}
// ่ฎๅไฝฟ็จ่
ๅจ<input type="text" name="pswd">ๆฌไฝไธญ่ผธๅ
ฅ็่ณๆ
String pswd = request.getParameter("pswd");
if ( pswd == null || pswd.trim().length() == 0){
pswd = "ๆช่ผธๅ
ฅ";
}
// ่ฎๅไฝฟ็จ่
ๅจ<input type="radio" name="gender">ๆฌไฝไธญๆ้ธ็ๆงๅฅ่ณๆ
String gender = request.getParameter("gender");
if ( gender == null ){
gender = "ๆชๆ้ธๆงๅฅ";
}
// ่ฎๅไฝฟ็จ่
ๅจ<input type="checkbox" name="hobby">ๆฌไฝไธญ่ผธๅ
ฅ็ๅคๅผ่ณๆ
String[] hobby = request.getParameterValues("hobby");
// ๆบๅ็ข็ๅๆ
out.print("<HTML><HEAD><TITLE>็ฑServletไพ็ข็ๅๆๅพ็ดฏไบบ</TITLE></HEAD><BODY>");
out.print("<H1>็ฑServletไพ็ข็ๅๆๅพ็ดฏไบบ</H1>");
out.print("ๆจ็userId็บ" + id +"<BR>");
out.print("ๆจ็ๅฏ็ขผ็บ" + pswd +"<BR>");
out.print("ๆจ็ๆงๅฅ็บ" + gender +"<BR>");
if (hobby == null) {
out.print("ๆจๆชๆ้ธๅๅฅฝ<BR>");
} else {
out.print("ๆจ็ๅๅฅฝ็บ๏ผ");
for(String h : hobby){
out.print("<li>"+h+"</li>");
}
}
out.print("<BR><HR>");
out.print("ๆจ็IP็บ" + request.getRemoteHost() +"<BR><BR><BR>");
RequestDispatcher rd = request.getRequestDispatcher("/commons/segmentch02.jsp");
rd.include(request, response);
out.print("</BODY></HTML>");
out.close();
}
}
| UTF-8 | Java | 3,001 | java | MemberServlet.java | Java | [] | null | [] | ๏ปฟpackage ch02.ex05.controller;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/*
* 1. ๆฌServlet่ฎๅ็่ฆฝๅจ้ไพ็่ณๆ๏ผ็ถๅพ็ข็ๆๅญๆง่ณๆ็ๅๆ
* 2. ้ๅธธServletไธๆ็ข็ๆๅญๆง็ๅๆ๏ผไฝๅฆๆ่ฆ็ข็
* ๆๅญๆง็ๅๆ๏ผๅฟ
้ ็ทจๅฏซไธๅๅ
ฉ่ก๏ผ
*
// ่จญๅฎๅๆ่ณๆ็ๆ ผๅผ็บtext/html๏ผๅๆไนๆๅญ่ณๆ็็ทจ็ขผ็บUTF-8(charset=UTF-8)
response.setContentType("text/html; charset=UTF-8");
// ็ฑresponse็ฉไปถๅๅบWriter็ฉไปถ๏ผๆญค่ก่ๅไธ่ก็้ ๅบไธ่ฝ้กๅ
PrintWriter out = response.getWriter();
*/
public class MemberServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// ่จญๅฎๅๆ่ณๆ็ๆ ผๅผ็บtext/html๏ผๅๆไนๆๅญ่ณๆ็็ทจ็ขผ็บUTF-8(charset=UTF-8)
response.setContentType("text/html; charset=UTF-8");
// ็ฑresponse็ฉไปถๅๅบWriter็ฉไปถ๏ผๆญค่ก่ๅไธ่ก็้ ๅบไธ่ฝ้กๅ
PrintWriter out = response.getWriter();
// ่ชชๆ็่ฆฝๅจ้ไพ็ๆๅญ่ณๆ็็ทจ็ขผ็บUTF-8
request.setCharacterEncoding("UTF-8");
// ่ฎๅไฝฟ็จ่
ๅจ<input type="text" name="userId">ๆฌไฝไธญ่ผธๅ
ฅ็่ณๆ
String id = request.getParameter("userId");
if ( id == null || id.trim().length() == 0){
id = "ๆช่ผธๅ
ฅ";
}
// ่ฎๅไฝฟ็จ่
ๅจ<input type="text" name="pswd">ๆฌไฝไธญ่ผธๅ
ฅ็่ณๆ
String pswd = request.getParameter("pswd");
if ( pswd == null || pswd.trim().length() == 0){
pswd = "ๆช่ผธๅ
ฅ";
}
// ่ฎๅไฝฟ็จ่
ๅจ<input type="radio" name="gender">ๆฌไฝไธญๆ้ธ็ๆงๅฅ่ณๆ
String gender = request.getParameter("gender");
if ( gender == null ){
gender = "ๆชๆ้ธๆงๅฅ";
}
// ่ฎๅไฝฟ็จ่
ๅจ<input type="checkbox" name="hobby">ๆฌไฝไธญ่ผธๅ
ฅ็ๅคๅผ่ณๆ
String[] hobby = request.getParameterValues("hobby");
// ๆบๅ็ข็ๅๆ
out.print("<HTML><HEAD><TITLE>็ฑServletไพ็ข็ๅๆๅพ็ดฏไบบ</TITLE></HEAD><BODY>");
out.print("<H1>็ฑServletไพ็ข็ๅๆๅพ็ดฏไบบ</H1>");
out.print("ๆจ็userId็บ" + id +"<BR>");
out.print("ๆจ็ๅฏ็ขผ็บ" + pswd +"<BR>");
out.print("ๆจ็ๆงๅฅ็บ" + gender +"<BR>");
if (hobby == null) {
out.print("ๆจๆชๆ้ธๅๅฅฝ<BR>");
} else {
out.print("ๆจ็ๅๅฅฝ็บ๏ผ");
for(String h : hobby){
out.print("<li>"+h+"</li>");
}
}
out.print("<BR><HR>");
out.print("ๆจ็IP็บ" + request.getRemoteHost() +"<BR><BR><BR>");
RequestDispatcher rd = request.getRequestDispatcher("/commons/segmentch02.jsp");
rd.include(request, response);
out.print("</BODY></HTML>");
out.close();
}
}
| 3,001 | 0.647059 | 0.63842 | 69 | 34.231884 | 22.992844 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.608696 | false | false | 13 |
7652f8a690435e77940d1cdcc190caf71b8ed3aa | 3,616,362,463,760 | 08bda2f4377be3dda02117dace89955481765fd1 | /Practice2/src/practice2/Practice2.java | 9de263b1d47a7760f6cc67f650ec72e019c5a2da | [] | no_license | fruitbraker/PracticeJava | https://github.com/fruitbraker/PracticeJava | 861d2a3ccaf245421d4e76d1f00a70ba33dbdf86 | 57d0ae8311c11e2d9ac0ff844cfeafcc1b092bb9 | refs/heads/master | 2021-01-02T23:13:45.120000 | 2012-10-14T23:48:18 | 2012-10-14T23:48:18 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package practice2;
/**
*
* @author Eric
*/
public class Practice2 {
public int height, width, length;
public static int boxCar(int h, int w, int l){
return h * w * l;
}
}
| UTF-8 | Java | 215 | java | Practice2.java | Java | [
{
"context": "package practice2;\r\n\r\n/**\r\n *\r\n * @author Eric\r\n */\r\npublic class Practice2 {\r\n \r\n public ",
"end": 46,
"score": 0.9995951056480408,
"start": 42,
"tag": "NAME",
"value": "Eric"
}
] | null | [] | package practice2;
/**
*
* @author Eric
*/
public class Practice2 {
public int height, width, length;
public static int boxCar(int h, int w, int l){
return h * w * l;
}
}
| 215 | 0.530233 | 0.52093 | 14 | 13.357142 | 15.083611 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
b9d29fcd33dd1390736ab886ca18c72418c74b15 | 17,179,869,245,325 | 09380c62806729b0e2c226e895360b1e94ad61c7 | /lab3/controller/CourseIsFullException.java | f0bf885ca61dbf884ca7d5b3aee0f834150fbddb | [] | no_license | Razvanp27/Student_app | https://github.com/Razvanp27/Student_app | 8428a9f9e9f90a8c418bcb0ded0e21be8fc363c1 | eae997ac3ed2a166b19e2883377e15e502d5959c | refs/heads/master | 2022-11-03T22:56:48.582000 | 2020-06-17T00:50:10 | 2020-06-17T00:50:10 | 272,842,128 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package lab3.controller;
public class CourseIsFullException extends Exception {
public CourseIsFullException(String message){
super(message);
}
}
| UTF-8 | Java | 163 | java | CourseIsFullException.java | Java | [] | null | [] | package lab3.controller;
public class CourseIsFullException extends Exception {
public CourseIsFullException(String message){
super(message);
}
}
| 163 | 0.742331 | 0.736196 | 7 | 22.285715 | 20.603149 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 13 |
0ce9e1a29cd2564527c8f5631fee34b5c3564001 | 3,401,614,159,303 | 32f38cd53372ba374c6dab6cc27af78f0a1b0190 | /app/src/main/java/com/ali/user/mobile/ui/widget/emotion/OnParseEmotionListener.java | 3f87dbb6bb1aae13386bb7e468219365670e482f | [] | no_license | shuixi2013/AmapCode | https://github.com/shuixi2013/AmapCode | 9ea7aefb42e0413f348f238f0721c93245f4eac6 | 1a3a8d4dddfcc5439df8df570000cca12b15186a | refs/heads/master | 2023-06-06T23:08:57.391000 | 2019-08-29T04:36:02 | 2019-08-29T04:36:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ali.user.mobile.ui.widget.emotion;
public interface OnParseEmotionListener {
boolean a();
}
| UTF-8 | Java | 109 | java | OnParseEmotionListener.java | Java | [] | null | [] | package com.ali.user.mobile.ui.widget.emotion;
public interface OnParseEmotionListener {
boolean a();
}
| 109 | 0.761468 | 0.761468 | 5 | 20.799999 | 19.446337 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 13 |
04410070ed6b77fc17acd808acd027d9d353113a | 1,632,087,583,985 | 3ff15d6887a3de8f7637a912eac8071a2dc3a853 | /ellysnumberguessing-java/EllysNumberGuessing.java | f8ad759fe8bb2c037b733e31ab2f49d82adc8991 | [] | no_license | monjury/TopCoder | https://github.com/monjury/TopCoder | 7a23284b5d3638f3efa233b1236992268ae91e73 | 88678875a7eb18cabea6f4cbe7d5a9a7dbe1431a | refs/heads/master | 2021-01-09T08:16:00.235000 | 2015-04-01T09:12:07 | 2015-04-01T09:12:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // SRM 606 DIV 2 - 500 points
public class EllysNumberGuessing {
public int getNumber(int[] guesses, int[] answers) {
int upper = guesses[0] + answers[0];
int lower = guesses[0] - answers[0];
boolean isUpper = true;
boolean isLower = true;
int currentUpper = 0;
int currentLower = 0;
if(lower < 1) {
isLower = false;
}
if(upper > 999999999) {
isUpper = false;
}
for(int i = 1; i < guesses.length; i++) {
currentUpper = guesses[i] + answers[i];
currentLower = guesses[i] - answers[i];
if ((currentUpper == upper && currentLower != lower)
|| (currentLower == upper && currentUpper != lower)) {
isLower = false;
}
else if((currentUpper != upper && currentLower == lower)
|| (currentLower != upper && currentUpper == lower)) {
isUpper = false;
}
}
if(!isUpper && isLower) {
return lower;
}
if(!isLower && isUpper) {
return upper;
}
if(!isLower && !isUpper) {
return -2;
}
return -1;
}
} | UTF-8 | Java | 997 | java | EllysNumberGuessing.java | Java | [] | null | [] | // SRM 606 DIV 2 - 500 points
public class EllysNumberGuessing {
public int getNumber(int[] guesses, int[] answers) {
int upper = guesses[0] + answers[0];
int lower = guesses[0] - answers[0];
boolean isUpper = true;
boolean isLower = true;
int currentUpper = 0;
int currentLower = 0;
if(lower < 1) {
isLower = false;
}
if(upper > 999999999) {
isUpper = false;
}
for(int i = 1; i < guesses.length; i++) {
currentUpper = guesses[i] + answers[i];
currentLower = guesses[i] - answers[i];
if ((currentUpper == upper && currentLower != lower)
|| (currentLower == upper && currentUpper != lower)) {
isLower = false;
}
else if((currentUpper != upper && currentLower == lower)
|| (currentLower != upper && currentUpper == lower)) {
isUpper = false;
}
}
if(!isUpper && isLower) {
return lower;
}
if(!isLower && isUpper) {
return upper;
}
if(!isLower && !isUpper) {
return -2;
}
return -1;
}
} | 997 | 0.583751 | 0.557673 | 47 | 20.234043 | 18.019154 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.765957 | false | false | 13 |
854b137428d1d83b1bf0f86b8349dbef64286744 | 13,649,406,078,292 | cae7af6089b3d10c919c8f4e92c4039786d8afa6 | /app/src/main/java/ui/activities/registerActivity.java | e5b89ed42ec85fcd7f4fb3b318f301b8d1318898 | [] | no_license | ZengShuaiQi/ClassCircle | https://github.com/ZengShuaiQi/ClassCircle | e7c84707294d948fdbdb09c8e8b7a8fecb5e38ef | c902cdb6cf3d9e0aee6f5a4844f5021ec3a5cc0b | refs/heads/master | 2021-05-15T19:17:17.739000 | 2017-10-20T13:14:56 | 2017-10-20T13:14:56 | 107,679,907 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ui.activities;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.example.myqq.R;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import presenter.impl.registerPresenterImpl;
import view.registerView;
/**
* Created by ๆๆฏๅฐไธ้ผ on 2016/12/29.
*/
public class registerActivity extends BaseActivity implements registerView {
@BindView(R.id.user_name)
EditText mUserName;
@BindView(R.id.password)
EditText mPassword;
@BindView(R.id.confirm_password)
EditText mConfirmPassword;
@BindView(R.id.register)
Button mRegister;
private registerPresenterImpl registerPresenter;
@Override
protected int getLayouResID() {
return R.layout.activity_register;
}
@Override
protected void init() {
super.init();
registerPresenter = new registerPresenterImpl(this);
mConfirmPassword.setOnEditorActionListener(myOnEditorActionListener);
}
private TextView.OnEditorActionListener myOnEditorActionListener = new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
register();
return true;
}
return false;
}
};
private void register() {
String name = mUserName.getText().toString().trim();
String password = mPassword.getText().toString().trim();
String confirmPassword = mConfirmPassword.getText().toString().trim();
hideKeyboard();
registerPresenter.register(name,password,confirmPassword);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
ButterKnife.bind(this);
}
@OnClick(R.id.register)
public void onClick() {
register();
}
@Override
public void onRegisterSuccess() {
Toast.makeText(this, "ๆณจๅๆๅ", Toast.LENGTH_SHORT).show();
goTo(LoginActivity.class);
}
@Override
public void onRegisterFailed() {
Toast.makeText(this, "ๆณจๅๅคฑ่ดฅ", Toast.LENGTH_SHORT).show();
goTo(LoginActivity.class);
}
@Override
public void onUserNameError() {
mUserName.setError(getString(R.string.user_name_error));
}
@Override
public void onConfirmPasswordError() {
mConfirmPassword.setError(getString(R.string.confirm_password_error));
}
@Override
public void onPasswordError() {
mPassword.setError(getString(R.string.password_error));
}
@Override
public void onStartRegister() {
showProgressDialog(getString(R.string.onRegistering));
}
@Override
public void onUserNameExist() {
Toast.makeText(this, getString(R.string.username_exist), Toast.LENGTH_SHORT).show();
}
}
| UTF-8 | Java | 3,158 | java | registerActivity.java | Java | [
{
"context": "l;\nimport view.registerView;\n\n/**\n * Created by ๆๆฏๅฐไธ้ผ on 2016/12/29.\n */\n\npublic class registerActivity",
"end": 460,
"score": 0.9994044303894043,
"start": 457,
"tag": "USERNAME",
"value": "ๅฐไธ้ผ"
}
] | null | [] | package ui.activities;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.example.myqq.R;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import presenter.impl.registerPresenterImpl;
import view.registerView;
/**
* Created by ๆๆฏๅฐไธ้ผ on 2016/12/29.
*/
public class registerActivity extends BaseActivity implements registerView {
@BindView(R.id.user_name)
EditText mUserName;
@BindView(R.id.password)
EditText mPassword;
@BindView(R.id.confirm_password)
EditText mConfirmPassword;
@BindView(R.id.register)
Button mRegister;
private registerPresenterImpl registerPresenter;
@Override
protected int getLayouResID() {
return R.layout.activity_register;
}
@Override
protected void init() {
super.init();
registerPresenter = new registerPresenterImpl(this);
mConfirmPassword.setOnEditorActionListener(myOnEditorActionListener);
}
private TextView.OnEditorActionListener myOnEditorActionListener = new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
register();
return true;
}
return false;
}
};
private void register() {
String name = mUserName.getText().toString().trim();
String password = mPassword.getText().toString().trim();
String confirmPassword = mConfirmPassword.getText().toString().trim();
hideKeyboard();
registerPresenter.register(name,password,confirmPassword);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
ButterKnife.bind(this);
}
@OnClick(R.id.register)
public void onClick() {
register();
}
@Override
public void onRegisterSuccess() {
Toast.makeText(this, "ๆณจๅๆๅ", Toast.LENGTH_SHORT).show();
goTo(LoginActivity.class);
}
@Override
public void onRegisterFailed() {
Toast.makeText(this, "ๆณจๅๅคฑ่ดฅ", Toast.LENGTH_SHORT).show();
goTo(LoginActivity.class);
}
@Override
public void onUserNameError() {
mUserName.setError(getString(R.string.user_name_error));
}
@Override
public void onConfirmPasswordError() {
mConfirmPassword.setError(getString(R.string.confirm_password_error));
}
@Override
public void onPasswordError() {
mPassword.setError(getString(R.string.password_error));
}
@Override
public void onStartRegister() {
showProgressDialog(getString(R.string.onRegistering));
}
@Override
public void onUserNameExist() {
Toast.makeText(this, getString(R.string.username_exist), Toast.LENGTH_SHORT).show();
}
}
| 3,158 | 0.675926 | 0.673372 | 117 | 25.76923 | 24.0343 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false | 13 |
10f249840dfc969f082bad0920a3bb823b718a7c | 5,884,105,246,460 | d2a4c45ff9e7cb661e02817d52bf694e29f7051d | /classFileCreator/src/frameSizeCalc/logic/ParameterSizeCalc.java | 564f8f6b3d7a77a374621f7ff2131a1e0d55ea15 | [] | no_license | Amjad-Afzaal/PUCIT-Projects | https://github.com/Amjad-Afzaal/PUCIT-Projects | c11cb34ba07f04174b66f8a69796b7c465227a65 | 523041079db4e9db822d17d2555e585d03db1050 | refs/heads/master | 2020-04-17T09:51:42.882000 | 2013-02-21T07:45:26 | 2013-02-21T07:45:26 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright 2012 Faisal Aslam.
* All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3
* only, as published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 3 for more details (a copy is
* included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
* version 3 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Faisal Aslam (faisal.aslam AT gmail.com)
* if you need additional information or have any questions.
*/
package frameSizeCalc.logic;
/**
*
*
* @author Faisal Aslam
*/
public class ParameterSizeCalc {
public static void main(String args[]) {
String methodDesc = "ISCLJava/Lang/Object;B[[[DI[LJava/String;F";
int result = ParameterSizeCalc.getParameterSize(methodDesc, false);
}
/*
* B byte signed byte
C char Unicode character
D double double-precision floating-point value
F float single-precision floating-point value
I int integer
J long long integer
L<classname>; reference an instance of class <classname>
S short signed short
Z boolean true or false
[ reference one array dimension
*/
public static int getParameterSize(String methodDesc, boolean isStatic) {
int size = 0;
if (!isStatic) {
size++; //extra variable for this pointer
}
methodDesc = methodDesc.substring(1, methodDesc.indexOf(")"));
for (int charIndex = 0; charIndex < methodDesc.length(); charIndex++) {
char c = methodDesc.charAt(charIndex);
if (c == 'B' || c == 'C' || c == 'F' || c == 'I' || c == 'S'
|| c == 'Z' || c == 'L' || c == '[') {
size++;
if (c == 'L') {
charIndex = skipReference(methodDesc, charIndex);
} else if (c == '[') {
charIndex = skipArray(methodDesc, charIndex);
}
} else if (c == 'D' || c == 'J') {
size++;
} else {
throw new UnsupportedOperationException();
}
}
return size;
}
private static int skipReference(String methodDesc, int currentIndex) {
String reference = methodDesc.substring(currentIndex);
reference = reference.substring(0, reference.indexOf(";"));
return currentIndex + reference.length();
}
private static int skipArray(String methodDesc, int currentIndex) {
int nextIndex = currentIndex;
String toSkip = methodDesc.substring(currentIndex);
int toSkipSize = 1;
while (toSkip.charAt(toSkipSize) == '[') {
toSkipSize++;
}
if (toSkip.charAt(toSkipSize) == 'L') {
toSkipSize = skipReference(toSkip, toSkipSize);
}
return nextIndex + toSkipSize;
}
}
| UTF-8 | Java | 3,371 | java | ParameterSizeCalc.java | Java | [
{
"context": "/*\n * Copyright 2012 Faisal Aslam.\n * All Rights Reserved.\n * DO NOT ALTER OR REMOV",
"end": 33,
"score": 0.9998910427093506,
"start": 21,
"tag": "NAME",
"value": "Faisal Aslam"
},
{
"context": "Boston, MA\n * 02110-1301 USA\n * \n * Please contact Faisal Aslam (fais... | null | [] | /*
* Copyright 2012 <NAME>.
* All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3
* only, as published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 3 for more details (a copy is
* included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
* version 3 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact <NAME> (<EMAIL>)
* if you need additional information or have any questions.
*/
package frameSizeCalc.logic;
/**
*
*
* @author <NAME>
*/
public class ParameterSizeCalc {
public static void main(String args[]) {
String methodDesc = "ISCLJava/Lang/Object;B[[[DI[LJava/String;F";
int result = ParameterSizeCalc.getParameterSize(methodDesc, false);
}
/*
* B byte signed byte
C char Unicode character
D double double-precision floating-point value
F float single-precision floating-point value
I int integer
J long long integer
L<classname>; reference an instance of class <classname>
S short signed short
Z boolean true or false
[ reference one array dimension
*/
public static int getParameterSize(String methodDesc, boolean isStatic) {
int size = 0;
if (!isStatic) {
size++; //extra variable for this pointer
}
methodDesc = methodDesc.substring(1, methodDesc.indexOf(")"));
for (int charIndex = 0; charIndex < methodDesc.length(); charIndex++) {
char c = methodDesc.charAt(charIndex);
if (c == 'B' || c == 'C' || c == 'F' || c == 'I' || c == 'S'
|| c == 'Z' || c == 'L' || c == '[') {
size++;
if (c == 'L') {
charIndex = skipReference(methodDesc, charIndex);
} else if (c == '[') {
charIndex = skipArray(methodDesc, charIndex);
}
} else if (c == 'D' || c == 'J') {
size++;
} else {
throw new UnsupportedOperationException();
}
}
return size;
}
private static int skipReference(String methodDesc, int currentIndex) {
String reference = methodDesc.substring(currentIndex);
reference = reference.substring(0, reference.indexOf(";"));
return currentIndex + reference.length();
}
private static int skipArray(String methodDesc, int currentIndex) {
int nextIndex = currentIndex;
String toSkip = methodDesc.substring(currentIndex);
int toSkipSize = 1;
while (toSkip.charAt(toSkipSize) == '[') {
toSkipSize++;
}
if (toSkip.charAt(toSkipSize) == 'L') {
toSkipSize = skipReference(toSkip, toSkipSize);
}
return nextIndex + toSkipSize;
}
}
| 3,335 | 0.609611 | 0.602789 | 93 | 35.247311 | 25.630817 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.903226 | false | false | 13 |
1cdc0730c12586779a699379afc97baded477976 | 29,738,353,569,046 | 97537b32122ded34b89e81934e2f32e0abcb9421 | /src/java/m10r/dao/ServicioDao.java | 7ee2a3f52246795ad8df4046993daa151b7ef5bd | [] | no_license | csrsto/m10r-FULL-m10r | https://github.com/csrsto/m10r-FULL-m10r | 1fec4512034c1ecfc75a8c421180280c4e84d64f | 51648e06993e7f79e532d35a826dc181870335fb | refs/heads/master | 2020-05-19T16:30:37.893000 | 2019-06-21T02:44:56 | 2019-06-21T02:44:56 | 185,110,854 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package m10r.dao;
import java.util.List;
import m10r.model.Servicio;
import org.hibernate.Session;
/**
*
* @author CSR
*/
public interface ServicioDao {
public List<Servicio> mostrarServicios();
public void ingresarServicio(Servicio servicio);
public void actualizarServicio(Servicio servicio);
public void eliminarServicio(Servicio servicio);
public Servicio obtenerServicioPorCodigoServicio(Session sessionServicioPorCodigoServicio, String codigoServicio) throws Exception;
} | UTF-8 | Java | 527 | java | ServicioDao.java | Java | [
{
"context": ";\nimport org.hibernate.Session;\n\n/**\n *\n * @author CSR\n */\npublic interface ServicioDao {\n \n publi",
"end": 123,
"score": 0.9512919783592224,
"start": 120,
"tag": "USERNAME",
"value": "CSR"
}
] | null | [] |
package m10r.dao;
import java.util.List;
import m10r.model.Servicio;
import org.hibernate.Session;
/**
*
* @author CSR
*/
public interface ServicioDao {
public List<Servicio> mostrarServicios();
public void ingresarServicio(Servicio servicio);
public void actualizarServicio(Servicio servicio);
public void eliminarServicio(Servicio servicio);
public Servicio obtenerServicioPorCodigoServicio(Session sessionServicioPorCodigoServicio, String codigoServicio) throws Exception;
} | 527 | 0.753321 | 0.745731 | 20 | 25.35 | 31.196594 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
b771bfa7a3e53517e8d787b8148f51797e164568 | 30,992,484,017,557 | 1d833a6fea07f6b268599dc546de86ee294c282f | /curs Ro/Curs6-Factory/src/ro/ase/acs/cts/Test.java | 1acbfbe82308eb47b813055991c704c3ed394bf7 | [
"MIT"
] | permissive | catalinboja/cts-2021 | https://github.com/catalinboja/cts-2021 | 6ca0b23c71c7a7c57f99fe8249ac6000fef3f099 | db6035437867ed0b8b257cb5c25c55808228845a | refs/heads/main | 2023-05-11T12:20:46.981000 | 2021-06-03T12:41:27 | 2021-06-03T12:41:27 | 341,457,183 | 22 | 10 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ro.ase.acs.cts;
import ro.ase.acs.cts.documente.DocumentGeneric;
public class Test {
public static void main(String[] args) {
DocumentGeneric d1 = new DocumentGeneric("Test.txt",1);
System.out.println("A fost creat un document");
DocumentGeneric d2 = new DocumentGeneric("Test2.txt",1);
DocumentGeneric d3 = new DocumentGeneric("Test.pdf",4);
}
}
| UTF-8 | Java | 378 | java | Test.java | Java | [] | null | [] | package ro.ase.acs.cts;
import ro.ase.acs.cts.documente.DocumentGeneric;
public class Test {
public static void main(String[] args) {
DocumentGeneric d1 = new DocumentGeneric("Test.txt",1);
System.out.println("A fost creat un document");
DocumentGeneric d2 = new DocumentGeneric("Test2.txt",1);
DocumentGeneric d3 = new DocumentGeneric("Test.pdf",4);
}
}
| 378 | 0.714286 | 0.695767 | 16 | 22.625 | 23.671911 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.625 | false | false | 13 |
c637325609067fd786acf477da112e9e92d0f81d | 17,325,898,082,318 | 2c1370ba26ed063000907d4d60857ccfc831c2f1 | /src/test/java/com/airwallex/operation/SubtractionProcessorTest.java | 5c4d2dfc094e8b9919734b462e60ab456453339c | [] | no_license | wellshang/RPNCalculator | https://github.com/wellshang/RPNCalculator | 8203099e907bd712639c9640aa4e4af1104e53a0 | 34977928c71ee39b848d6310cd6983e84d3ac026 | refs/heads/master | 2020-08-13T06:25:55.195000 | 2019-10-14T01:56:58 | 2019-10-14T01:56:58 | 214,924,741 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.airwallex.operation;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Stack;
import org.junit.Test;
public class SubtractionProcessorTest {
Processor subtractionProcessor = new SubtractionProcessor();
Stack<Stack<Double>> history = new Stack<>();
@Test
public void test() {
Stack<Double> parameters = new Stack<>();
history.clear();
parameters.push(23.0);
parameters.push(3.0);
assertFalse(subtractionProcessor.accept("%", parameters));
assertTrue(subtractionProcessor.accept("-", parameters));
assertTrue(subtractionProcessor.process(0, parameters, history));
assertEquals(1, parameters.size(), 0.0);
assertEquals(20.0, parameters.pop(), 0.0);
assertEquals(1, history.size(), 0.0);
}
} | UTF-8 | Java | 914 | java | SubtractionProcessorTest.java | Java | [] | null | [] | package com.airwallex.operation;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Stack;
import org.junit.Test;
public class SubtractionProcessorTest {
Processor subtractionProcessor = new SubtractionProcessor();
Stack<Stack<Double>> history = new Stack<>();
@Test
public void test() {
Stack<Double> parameters = new Stack<>();
history.clear();
parameters.push(23.0);
parameters.push(3.0);
assertFalse(subtractionProcessor.accept("%", parameters));
assertTrue(subtractionProcessor.accept("-", parameters));
assertTrue(subtractionProcessor.process(0, parameters, history));
assertEquals(1, parameters.size(), 0.0);
assertEquals(20.0, parameters.pop(), 0.0);
assertEquals(1, history.size(), 0.0);
}
} | 914 | 0.677243 | 0.658643 | 31 | 28.516129 | 23.140345 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.903226 | false | false | 13 |
61e01f5a9921110aee4504fd70df47ceb0a5ff1a | 12,567,074,317,537 | 49eef0472702d2e137a82cbd976d8486626c8b96 | /src/main/java/socket/MySocket.java | ac8eec0e23731d8608b25917139a5918cfea66e5 | [] | no_license | KybaS/AcademiaJava | https://github.com/KybaS/AcademiaJava | a3ae6ee81ba24631196d7968f875afb5ea231162 | 49783a4cd2de45192e6ef70cc2c837bdcc984e92 | refs/heads/master | 2021-07-07T10:02:00.184000 | 2019-02-09T09:52:05 | 2019-02-09T09:52:05 | 138,509,627 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package socket;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
public class MySocket {
public static void main(String[] args) throws Exception{
try (Socket socket = new Socket("localhost", 7777)){
OutputStream outputStream = socket.getOutputStream();
outputStream.write(10);
outputStream.flush();
InputStream inputStream = socket.getInputStream();
int response = inputStream.read();
System.out.println(response);
}
}
}
| UTF-8 | Java | 556 | java | MySocket.java | Java | [] | null | [] | package socket;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
public class MySocket {
public static void main(String[] args) throws Exception{
try (Socket socket = new Socket("localhost", 7777)){
OutputStream outputStream = socket.getOutputStream();
outputStream.write(10);
outputStream.flush();
InputStream inputStream = socket.getInputStream();
int response = inputStream.read();
System.out.println(response);
}
}
}
| 556 | 0.634892 | 0.624101 | 23 | 23.173914 | 22.776136 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.478261 | false | false | 13 |
90e6b1bd817164cb28f0b43169b59dc01806e3ec | 24,721,831,760,183 | 723aff755bcd24772f4de53fb76f641a2af0b3a8 | /src/GameLogic/SpriteManager.java | ad2809134bb67ee3531b8f8ab1c4deca57b20840 | [] | no_license | hold-n/Bomberman | https://github.com/hold-n/Bomberman | f4453dec7a70b710d1b668c1a4b0e2dba90d4aa5 | 0a21692e4e600a91e0375efc73209634be0999da | refs/heads/master | 2021-05-29T04:14:10.982000 | 2015-07-09T19:02:55 | 2015-07-09T19:15:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package GameLogic;
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.image.Image;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.io.File;
import static GameLogic.Config.*;
/**
* Created by Max on 07.06.2015.
*/
public class SpriteManager {
private static final Image backgroundTile =
new Image(SpriteManager.class.getResource(BACKGROUND_TILE_URL).toExternalForm(),
TILE_GRAPHIC_SIZE, TILE_GRAPHIC_SIZE, true, true);
private static final Image solidTile =
new Image(SpriteManager.class.getResource(SOLID_TILE_URL).toExternalForm(),
TILE_GRAPHIC_SIZE, TILE_GRAPHIC_SIZE, true, true);
private static final Image explodableTile =
new Image(SpriteManager.class.getResource(EXPLODABLE_TILE_URL).toExternalForm(),
TILE_GRAPHIC_SIZE, TILE_GRAPHIC_SIZE, true, true);
private static final Image portalTile =
new Image(SpriteManager.class.getResource(PORTAL_TILE_URL).toExternalForm(),
TILE_GRAPHIC_SIZE, TILE_GRAPHIC_SIZE, true, true);
private static final Image bonusBomb =
new Image(SpriteManager.class.getResource(BONUS_BOMB).toExternalForm(),
(new GameValue(BONUS_SIZE).getGraphic()),
(new GameValue(BONUS_SIZE).getGraphic()), true, true);
private static final Image bonuseExplosion =
new Image(SpriteManager.class.getResource(BONUS_EXPLOSION).toExternalForm(),
(new GameValue(BONUS_SIZE).getGraphic()),
(new GameValue(BONUS_SIZE).getGraphic()), true, true);
private static final Image bonusSpeed =
new Image(SpriteManager.class.getResource(BONUS_SPEED).toExternalForm(),
(new GameValue(BONUS_SIZE).getGraphic()),
(new GameValue(BONUS_SIZE).getGraphic()), true, true);
private static final Image bonusKick =
new Image(SpriteManager.class.getResource(BONUS_KICK).toExternalForm(),
(new GameValue(BONUS_SIZE).getGraphic()),
(new GameValue(BONUS_SIZE).getGraphic()), true, true);
private static final Image bonusDebuff =
new Image(SpriteManager.class.getResource(BONUS_DEBUFF).toExternalForm(),
(new GameValue(BONUS_SIZE).getGraphic()),
(new GameValue(BONUS_SIZE).getGraphic()), true, true);
private static final Image[] playerFront = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerBack = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerSideRight = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerSideLeft = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerFrontInv = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerBackInv = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerSideRightInv = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerSideLeftInv = new Image[PLAYER_FRAMES_NUM];
private static final Image[] bomb = new Image[BOMB_FRAMES];
private static final Image[] explosion = new Image[EXPLOSION_FRAMES];
public static Image getFlippedImage(Image image) {
BufferedImage bufferedImage= SwingFXUtils.fromFXImage(image, null);
AffineTransform tx = AffineTransform.getScaleInstance(-1, 1);
tx.translate(-bufferedImage.getWidth(null), 0);;
AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
BufferedImage newImage =
new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), bufferedImage.getType());
op.filter(bufferedImage, newImage);
return SwingFXUtils.toFXImage(newImage, null);
}
public static Image inverseImage(Image image) {
BufferedImage newImage = SwingFXUtils.fromFXImage(image, null);
for (int x = 0; x < newImage.getWidth(); x++) {
for (int y = 0; y < newImage.getHeight(); y++) {
int rgba = newImage.getRGB(x, y);
Color col = new Color(rgba, true);
if (col.getAlpha() != 0) {
col = new Color(255 - col.getRed(),
255 - col.getGreen(),
255 - col.getBlue());
newImage.setRGB(x, y, col.getRGB());
}
}
}
return SwingFXUtils.toFXImage(newImage, null);
}
static {
GameValue playerHeight = new GameValue(PLAYER_HEIGHT);
GameValue playerWidth = new GameValue(PLAYER_WIDTH);
GameValue bombSize = new GameValue(BOMB_SIZE);
GameValue explosionSize = new GameValue(EXPLOSION_UNIT_SIZE);
BufferedImage buff;
for (int i = 0; i < PLAYER_FRAMES_NUM; i++) {
String url = PLAYER_FRONT_START + (new Integer(i)).toString() + PLAYER_FRONT_END;
playerFront[i] =
new Image(SpriteManager.class.getResource(url).toExternalForm(),
playerWidth.getGraphic(), playerHeight.getGraphic(), true, true);
playerFrontInv[i] = inverseImage(playerFront[i]);
}
for (int i = 0; i < PLAYER_FRAMES_NUM; i++) {
String url = PLAYER_BACK_START + (new Integer(i)).toString() + PLAYER_BACK_END;
playerBack[i] =
new Image(SpriteManager.class.getResource(url).toExternalForm(),
playerWidth.getGraphic(), playerHeight.getGraphic(), true, true);
playerBackInv[i] =
inverseImage(playerBack[i]);
}
for (int i = 0; i < PLAYER_FRAMES_NUM; i++) {
String url = PLAYER_SIDE_START + (new Integer(i)).toString() + PLAYER_SIDE_END;
playerSideRight[i] =
new Image(SpriteManager.class.getResource(url).toExternalForm(),
playerWidth.getGraphic(), playerHeight.getGraphic(), true, true);
playerSideLeft[i] = getFlippedImage(playerSideRight[i]);
playerSideRightInv[i] = inverseImage(playerSideRight[i]);
playerSideLeftInv[i] = inverseImage(playerSideLeft[i]);
}
for (int i = 0; i < BOMB_FRAMES; i++) {
String url = BOMB_START + (new Integer(i)).toString() + BOMB_END;
bomb[i] =
new Image(SpriteManager.class.getResource(url).toExternalForm(),
bombSize.getGraphic(), bombSize.getGraphic(), true, true);
}
for (int i = 0; i < EXPLOSION_FRAMES; i++) {
String url = EXPLOSION_START + (new Integer(i)).toString() + EXPLOSION_END;
explosion[i] =
new Image(SpriteManager.class.getResource(url).toExternalForm(),
explosionSize.getGraphic(), explosionSize.getGraphic(), true, true);
}
}
public static Image getBackgroundTile() {
return backgroundTile;
}
public static Image getSolidTile() {
return solidTile;
}
public static Image getExplodableTile() {
return explodableTile;
}
public static Image getPortalTile() {
return portalTile;
}
public static Image getBonusBomb() {
return bonusBomb;
}
public static Image getBonuseExplosion() {
return bonuseExplosion;
}
public static Image getBonusSpeed() {
return bonusSpeed;
}
public static Image getBonusKick() {
return bonusKick;
}
public static Image getBonusDebuff() {
return bonusDebuff;
}
public static Image getBomb(int frame) {
return bomb[frame % BOMB_FRAMES];
}
public static Image getExplosion(int frame) {
return explosion[frame % EXPLOSION_FRAMES];
}
public static Image getPlayerFront(int frame, boolean inversed) {
if (inversed)
return playerFrontInv[frame % PLAYER_FRAMES_NUM];
return playerFront[frame % PLAYER_FRAMES_NUM];
}
public static Image getPlayerBack(int frame, boolean inversed) {
if (inversed)
return playerBackInv[frame % PLAYER_FRAMES_NUM];
return playerBack[frame % PLAYER_FRAMES_NUM];
}
public static Image getPlayerRight(int frame, boolean inversed) {
if (inversed)
return playerSideRightInv[frame % PLAYER_FRAMES_NUM];
return playerSideRight[frame % PLAYER_FRAMES_NUM];
}
public static Image getPlayerLeft(int frame, boolean inversed) {
if (inversed)
return playerSideLeftInv[frame % PLAYER_FRAMES_NUM];
return playerSideLeft[frame % PLAYER_FRAMES_NUM];
}
}
| UTF-8 | Java | 9,010 | java | SpriteManager.java | Java | [
{
"context": "t static GameLogic.Config.*;\r\n\r\n/**\r\n * Created by Max on 07.06.2015.\r\n */\r\n\r\npublic class SpriteManager",
"end": 321,
"score": 0.9885884523391724,
"start": 318,
"tag": "NAME",
"value": "Max"
}
] | null | [] | package GameLogic;
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.image.Image;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.io.File;
import static GameLogic.Config.*;
/**
* Created by Max on 07.06.2015.
*/
public class SpriteManager {
private static final Image backgroundTile =
new Image(SpriteManager.class.getResource(BACKGROUND_TILE_URL).toExternalForm(),
TILE_GRAPHIC_SIZE, TILE_GRAPHIC_SIZE, true, true);
private static final Image solidTile =
new Image(SpriteManager.class.getResource(SOLID_TILE_URL).toExternalForm(),
TILE_GRAPHIC_SIZE, TILE_GRAPHIC_SIZE, true, true);
private static final Image explodableTile =
new Image(SpriteManager.class.getResource(EXPLODABLE_TILE_URL).toExternalForm(),
TILE_GRAPHIC_SIZE, TILE_GRAPHIC_SIZE, true, true);
private static final Image portalTile =
new Image(SpriteManager.class.getResource(PORTAL_TILE_URL).toExternalForm(),
TILE_GRAPHIC_SIZE, TILE_GRAPHIC_SIZE, true, true);
private static final Image bonusBomb =
new Image(SpriteManager.class.getResource(BONUS_BOMB).toExternalForm(),
(new GameValue(BONUS_SIZE).getGraphic()),
(new GameValue(BONUS_SIZE).getGraphic()), true, true);
private static final Image bonuseExplosion =
new Image(SpriteManager.class.getResource(BONUS_EXPLOSION).toExternalForm(),
(new GameValue(BONUS_SIZE).getGraphic()),
(new GameValue(BONUS_SIZE).getGraphic()), true, true);
private static final Image bonusSpeed =
new Image(SpriteManager.class.getResource(BONUS_SPEED).toExternalForm(),
(new GameValue(BONUS_SIZE).getGraphic()),
(new GameValue(BONUS_SIZE).getGraphic()), true, true);
private static final Image bonusKick =
new Image(SpriteManager.class.getResource(BONUS_KICK).toExternalForm(),
(new GameValue(BONUS_SIZE).getGraphic()),
(new GameValue(BONUS_SIZE).getGraphic()), true, true);
private static final Image bonusDebuff =
new Image(SpriteManager.class.getResource(BONUS_DEBUFF).toExternalForm(),
(new GameValue(BONUS_SIZE).getGraphic()),
(new GameValue(BONUS_SIZE).getGraphic()), true, true);
private static final Image[] playerFront = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerBack = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerSideRight = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerSideLeft = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerFrontInv = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerBackInv = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerSideRightInv = new Image[PLAYER_FRAMES_NUM];
private static final Image[] playerSideLeftInv = new Image[PLAYER_FRAMES_NUM];
private static final Image[] bomb = new Image[BOMB_FRAMES];
private static final Image[] explosion = new Image[EXPLOSION_FRAMES];
public static Image getFlippedImage(Image image) {
BufferedImage bufferedImage= SwingFXUtils.fromFXImage(image, null);
AffineTransform tx = AffineTransform.getScaleInstance(-1, 1);
tx.translate(-bufferedImage.getWidth(null), 0);;
AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
BufferedImage newImage =
new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), bufferedImage.getType());
op.filter(bufferedImage, newImage);
return SwingFXUtils.toFXImage(newImage, null);
}
public static Image inverseImage(Image image) {
BufferedImage newImage = SwingFXUtils.fromFXImage(image, null);
for (int x = 0; x < newImage.getWidth(); x++) {
for (int y = 0; y < newImage.getHeight(); y++) {
int rgba = newImage.getRGB(x, y);
Color col = new Color(rgba, true);
if (col.getAlpha() != 0) {
col = new Color(255 - col.getRed(),
255 - col.getGreen(),
255 - col.getBlue());
newImage.setRGB(x, y, col.getRGB());
}
}
}
return SwingFXUtils.toFXImage(newImage, null);
}
static {
GameValue playerHeight = new GameValue(PLAYER_HEIGHT);
GameValue playerWidth = new GameValue(PLAYER_WIDTH);
GameValue bombSize = new GameValue(BOMB_SIZE);
GameValue explosionSize = new GameValue(EXPLOSION_UNIT_SIZE);
BufferedImage buff;
for (int i = 0; i < PLAYER_FRAMES_NUM; i++) {
String url = PLAYER_FRONT_START + (new Integer(i)).toString() + PLAYER_FRONT_END;
playerFront[i] =
new Image(SpriteManager.class.getResource(url).toExternalForm(),
playerWidth.getGraphic(), playerHeight.getGraphic(), true, true);
playerFrontInv[i] = inverseImage(playerFront[i]);
}
for (int i = 0; i < PLAYER_FRAMES_NUM; i++) {
String url = PLAYER_BACK_START + (new Integer(i)).toString() + PLAYER_BACK_END;
playerBack[i] =
new Image(SpriteManager.class.getResource(url).toExternalForm(),
playerWidth.getGraphic(), playerHeight.getGraphic(), true, true);
playerBackInv[i] =
inverseImage(playerBack[i]);
}
for (int i = 0; i < PLAYER_FRAMES_NUM; i++) {
String url = PLAYER_SIDE_START + (new Integer(i)).toString() + PLAYER_SIDE_END;
playerSideRight[i] =
new Image(SpriteManager.class.getResource(url).toExternalForm(),
playerWidth.getGraphic(), playerHeight.getGraphic(), true, true);
playerSideLeft[i] = getFlippedImage(playerSideRight[i]);
playerSideRightInv[i] = inverseImage(playerSideRight[i]);
playerSideLeftInv[i] = inverseImage(playerSideLeft[i]);
}
for (int i = 0; i < BOMB_FRAMES; i++) {
String url = BOMB_START + (new Integer(i)).toString() + BOMB_END;
bomb[i] =
new Image(SpriteManager.class.getResource(url).toExternalForm(),
bombSize.getGraphic(), bombSize.getGraphic(), true, true);
}
for (int i = 0; i < EXPLOSION_FRAMES; i++) {
String url = EXPLOSION_START + (new Integer(i)).toString() + EXPLOSION_END;
explosion[i] =
new Image(SpriteManager.class.getResource(url).toExternalForm(),
explosionSize.getGraphic(), explosionSize.getGraphic(), true, true);
}
}
public static Image getBackgroundTile() {
return backgroundTile;
}
public static Image getSolidTile() {
return solidTile;
}
public static Image getExplodableTile() {
return explodableTile;
}
public static Image getPortalTile() {
return portalTile;
}
public static Image getBonusBomb() {
return bonusBomb;
}
public static Image getBonuseExplosion() {
return bonuseExplosion;
}
public static Image getBonusSpeed() {
return bonusSpeed;
}
public static Image getBonusKick() {
return bonusKick;
}
public static Image getBonusDebuff() {
return bonusDebuff;
}
public static Image getBomb(int frame) {
return bomb[frame % BOMB_FRAMES];
}
public static Image getExplosion(int frame) {
return explosion[frame % EXPLOSION_FRAMES];
}
public static Image getPlayerFront(int frame, boolean inversed) {
if (inversed)
return playerFrontInv[frame % PLAYER_FRAMES_NUM];
return playerFront[frame % PLAYER_FRAMES_NUM];
}
public static Image getPlayerBack(int frame, boolean inversed) {
if (inversed)
return playerBackInv[frame % PLAYER_FRAMES_NUM];
return playerBack[frame % PLAYER_FRAMES_NUM];
}
public static Image getPlayerRight(int frame, boolean inversed) {
if (inversed)
return playerSideRightInv[frame % PLAYER_FRAMES_NUM];
return playerSideRight[frame % PLAYER_FRAMES_NUM];
}
public static Image getPlayerLeft(int frame, boolean inversed) {
if (inversed)
return playerSideLeftInv[frame % PLAYER_FRAMES_NUM];
return playerSideLeft[frame % PLAYER_FRAMES_NUM];
}
}
| 9,010 | 0.610988 | 0.60788 | 190 | 45.421051 | 29.037392 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.9 | false | false | 13 |
20556fe2017fc3564895baa3dbbd87c4495426c6 | 26,199,300,509,752 | b571a87c684ba3927ecb99d1d6545a5f3c95bee4 | /src/main/java/com/mart/controllers/UserController.java | 778cae644be7eeb28edebc5002edfad2d368d64b | [] | no_license | vajirastuff/BMAPI | https://github.com/vajirastuff/BMAPI | 395136f57ef08a2c1887a9411fe40b4b409e9682 | 9f24260d4e59137dabfbf896ee1af0d6eaf3f021 | refs/heads/master | 2021-01-23T05:03:44.977000 | 2017-04-09T15:16:11 | 2017-04-09T15:16:11 | 86,270,618 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mart.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.mart.db.model.User;
import com.mart.service.UserService;
import com.mart.uri.UserURIConstants;
//@Controller annotation, so that Spring framework will treat it as a Controller class to handle client requests
@Controller
public class UserController {
private UserService userService;
// @Autowired and @Qualifier annotations for injecting UserService
@Autowired(required = true)
@Qualifier(value = "userService")
public void setUserService(UserService us) {
this.userService = us;
}
@RequestMapping(value = "/users", method = RequestMethod.GET)
public String listusers(Model model) {
model.addAttribute("user", new User());
model.addAttribute("listusers", this.userService.listUsers());
return "users";
}
@RequestMapping(value = UserURIConstants.GET_ALL_USER, method = RequestMethod.GET)
public @ResponseBody List<User> getAllUsers(){
List<User> list = userService.listUsers();
return list;
}
// For add and update user both
@RequestMapping(value = "/user/add", method = RequestMethod.POST)
public String addUser(@ModelAttribute("user") User u) {
if (u.getId() == 0) {
// new user, add it
this.userService.addUser(u);
} else {
// existing user, call update
this.userService.updateUser(u);
}
return "redirect:/users";
}
@RequestMapping("/remove/{id}")
public String removeUser(@PathVariable("id") int id) {
this.userService.removeUser(id);
return "redirect:/users";
}
@RequestMapping("/edit/{id}")
public String editUser(@PathVariable("id") int id, Model model) {
model.addAttribute("user", this.userService.getUserById(id));
model.addAttribute("listusers", this.userService.listUsers());
return "users";
}
}
| UTF-8 | Java | 2,353 | java | UserController.java | Java | [] | null | [] | package com.mart.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.mart.db.model.User;
import com.mart.service.UserService;
import com.mart.uri.UserURIConstants;
//@Controller annotation, so that Spring framework will treat it as a Controller class to handle client requests
@Controller
public class UserController {
private UserService userService;
// @Autowired and @Qualifier annotations for injecting UserService
@Autowired(required = true)
@Qualifier(value = "userService")
public void setUserService(UserService us) {
this.userService = us;
}
@RequestMapping(value = "/users", method = RequestMethod.GET)
public String listusers(Model model) {
model.addAttribute("user", new User());
model.addAttribute("listusers", this.userService.listUsers());
return "users";
}
@RequestMapping(value = UserURIConstants.GET_ALL_USER, method = RequestMethod.GET)
public @ResponseBody List<User> getAllUsers(){
List<User> list = userService.listUsers();
return list;
}
// For add and update user both
@RequestMapping(value = "/user/add", method = RequestMethod.POST)
public String addUser(@ModelAttribute("user") User u) {
if (u.getId() == 0) {
// new user, add it
this.userService.addUser(u);
} else {
// existing user, call update
this.userService.updateUser(u);
}
return "redirect:/users";
}
@RequestMapping("/remove/{id}")
public String removeUser(@PathVariable("id") int id) {
this.userService.removeUser(id);
return "redirect:/users";
}
@RequestMapping("/edit/{id}")
public String editUser(@PathVariable("id") int id, Model model) {
model.addAttribute("user", this.userService.getUserById(id));
model.addAttribute("listusers", this.userService.listUsers());
return "users";
}
}
| 2,353 | 0.733107 | 0.732682 | 75 | 29.373333 | 25.701763 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.44 | false | false | 13 |
83acec2ff782724329b287c431700a0f518b42d8 | 4,999,341,981,927 | 7a6404e4f3bdaa6eb75ef11ac7a8c56c50be734e | /exciselawweb/src/com/excise/law/domain/TsLawGood.java | 1638cd8b3b5719b68738d72c51aa3ff57209211d | [] | no_license | imakedev/exciselaw-web | https://github.com/imakedev/exciselaw-web | afe57857835f662ee730e6a1a6eaad16a49c44e2 | e3622e5e2a68864d8d260e37733a0b3426e1d74a | refs/heads/master | 2016-09-05T13:20:32.972000 | 2012-01-22T15:32:01 | 2012-01-22T15:32:01 | 39,023,435 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.excise.law.domain;
import java.io.Serializable;
import javax.persistence.*;
/**
* The persistent class for the TS_LAW_GOOD database table.
*
*/
@Entity
@Table(name="TS_LAW_GOOD")
public class TsLawGood implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@SequenceGenerator(name="LAW_GOOD_SEQ", sequenceName="LAW_GOOD_SEQ" ,allocationSize=1)
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="LAW_GOOD_SEQ")
@Column(name="LAW_GOOD_ID")
private long lawGoodId;
@Column(name="DUTY_GOODS_ID")
private String dutyGoodsId;
@Column(name="LAW_ID")
private java.math.BigDecimal lawId;
public TsLawGood() {
}
public long getLawGoodId() {
return this.lawGoodId;
}
public void setLawGoodId(long lawGoodId) {
this.lawGoodId = lawGoodId;
}
public String getDutyGoodsId() {
return this.dutyGoodsId;
}
public void setDutyGoodsId(String dutyGoodsId) {
this.dutyGoodsId = dutyGoodsId;
}
public java.math.BigDecimal getLawId() {
return this.lawId;
}
public void setLawId(java.math.BigDecimal lawId) {
this.lawId = lawId;
}
} | UTF-8 | Java | 1,114 | java | TsLawGood.java | Java | [] | null | [] | package com.excise.law.domain;
import java.io.Serializable;
import javax.persistence.*;
/**
* The persistent class for the TS_LAW_GOOD database table.
*
*/
@Entity
@Table(name="TS_LAW_GOOD")
public class TsLawGood implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@SequenceGenerator(name="LAW_GOOD_SEQ", sequenceName="LAW_GOOD_SEQ" ,allocationSize=1)
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="LAW_GOOD_SEQ")
@Column(name="LAW_GOOD_ID")
private long lawGoodId;
@Column(name="DUTY_GOODS_ID")
private String dutyGoodsId;
@Column(name="LAW_ID")
private java.math.BigDecimal lawId;
public TsLawGood() {
}
public long getLawGoodId() {
return this.lawGoodId;
}
public void setLawGoodId(long lawGoodId) {
this.lawGoodId = lawGoodId;
}
public String getDutyGoodsId() {
return this.dutyGoodsId;
}
public void setDutyGoodsId(String dutyGoodsId) {
this.dutyGoodsId = dutyGoodsId;
}
public java.math.BigDecimal getLawId() {
return this.lawId;
}
public void setLawId(java.math.BigDecimal lawId) {
this.lawId = lawId;
}
} | 1,114 | 0.7307 | 0.728905 | 55 | 19.272728 | 21.003424 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.909091 | false | false | 13 |
0e98d2f7ed02814fb433af84646eea6b7272084d | 39,582,418,623,439 | e2c94c279530c78ba2db2e3c39e1def2b5f64f0c | /src/SudokuSolver/SudokuSolverTest.java | e061eb24a3c8b513b025dd0e9114514fdcbe0d0e | [] | no_license | xinrui11/leetcode | https://github.com/xinrui11/leetcode | 68119e061b3f3bbd98751f56c8aadb6a9bdd6c05 | ec1d0a13c688040ffc3560efa1d83b5316958b1a | refs/heads/master | 2021-01-20T17:09:47.649000 | 2019-07-12T05:05:09 | 2019-07-12T05:05:09 | 95,736,506 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package SudokuSolver;
import junit.framework.TestCase;
import org.junit.Test;
public class SudokuSolverTest extends TestCase {
@Test
public void testsolveSudoku() throws Exception {
String[] testStr = new String[]{
"..9748...","7........",".2.1.9...","..7...24.",".64.1.59.",".98...3..","...8.3.2.","........6","...2759.."
};
char[][] test = StringToChar(testStr);
SudokuSolver s = new SudokuSolver();
s.solveSudoku(test);
}
private char[][] StringToChar(String[] testStr){
char[][] test = new char[testStr.length][testStr.length];
for(int i = 0;i < 9;i++){
test[i] = testStr[i].toCharArray();
}
return test;
}
} | UTF-8 | Java | 736 | java | SudokuSolverTest.java | Java | [
{
"context": " \"..9748...\",\"7........\",\".2.1.9...\",\"..7...24.\",\".64.1.59.\",\".98...3..\",\"...8.3.2.\",\"........6\",\"...2759..\"",
"end": 306,
"score": 0.9841724634170532,
"start": 299,
"tag": "IP_ADDRESS",
"value": "64.1.59"
}
] | null | [] | package SudokuSolver;
import junit.framework.TestCase;
import org.junit.Test;
public class SudokuSolverTest extends TestCase {
@Test
public void testsolveSudoku() throws Exception {
String[] testStr = new String[]{
"..9748...","7........",".2.1.9...","..7...24.",".64.1.59.",".98...3..","...8.3.2.","........6","...2759.."
};
char[][] test = StringToChar(testStr);
SudokuSolver s = new SudokuSolver();
s.solveSudoku(test);
}
private char[][] StringToChar(String[] testStr){
char[][] test = new char[testStr.length][testStr.length];
for(int i = 0;i < 9;i++){
test[i] = testStr[i].toCharArray();
}
return test;
}
} | 736 | 0.533967 | 0.494565 | 25 | 28.48 | 27.701437 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false | 13 |
5777815cc2b9c219ce2baf4e1edd60cf8c7d289a | 30,185,030,161,049 | 821dab55d9d1e1126d4709cd7f4b67d0debda9e3 | /cz-service/src/main/java/com/cz/service/service/OrderService.java | 7bcb1a2ea3292ec8f958362781ce9beebdc080db | [
"MIT"
] | permissive | jomalonejia/CzAdmin-Server | https://github.com/jomalonejia/CzAdmin-Server | 3c5e9a19f2f42623fe1d2f0ea88b34eedbba985b | 7fedf53e63024e418fcfd6b47fc2826d8efd4f4c | refs/heads/master | 2021-01-21T16:53:50.311000 | 2018-01-02T08:48:14 | 2018-01-02T08:48:14 | 95,410,768 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cz.service.service;
import com.cz.api.service.IOrderService;
import com.cz.common.base.BaseServiceImpl;
import com.cz.enums.OrderStatus;
import com.cz.mapper.OrderMapper;
import com.cz.mapper.OrderTrackMapper;
import com.cz.model.order.Order;
import com.cz.model.order.OrderTrack;
import com.cz.service.annotation.CzRedisCache;
import com.cz.service.annotation.CzRedisEvict;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Created by jomalone_jia on 2017/11/23.
*/
@Service
@CacheConfig(cacheNames = "order_cache")
public class OrderService extends BaseServiceImpl<OrderMapper, Order> implements IOrderService {
@Autowired
private OrderMapper orderMapper;
@Autowired
private OrderTrackMapper orderTrackMapper;
@Override
@CzRedisCache(type = PageInfo.class)
public PageInfo<Order> listOrders(int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
return new PageInfo<>(orderMapper.listOrders());
}
@Override
@CzRedisEvict
@Transactional
public void updateStatus(String orderId,String trackInformation) {
Order order = orderMapper.selectById(orderId);
OrderStatus nestStatus = order.getStatus().next();
order.setStatus(nestStatus);
orderMapper.updateById(order);
orderTrackMapper.insert(new OrderTrack(order.getId(),trackInformation,nestStatus));
}
}
| UTF-8 | Java | 1,662 | java | OrderService.java | Java | [
{
"context": "tion.annotation.Transactional;\n\n\n/**\n * Created by jomalone_jia on 2017/11/23.\n */\n@Service\n@CacheConfig(cacheNam",
"end": 732,
"score": 0.9993162751197815,
"start": 720,
"tag": "USERNAME",
"value": "jomalone_jia"
}
] | null | [] | package com.cz.service.service;
import com.cz.api.service.IOrderService;
import com.cz.common.base.BaseServiceImpl;
import com.cz.enums.OrderStatus;
import com.cz.mapper.OrderMapper;
import com.cz.mapper.OrderTrackMapper;
import com.cz.model.order.Order;
import com.cz.model.order.OrderTrack;
import com.cz.service.annotation.CzRedisCache;
import com.cz.service.annotation.CzRedisEvict;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Created by jomalone_jia on 2017/11/23.
*/
@Service
@CacheConfig(cacheNames = "order_cache")
public class OrderService extends BaseServiceImpl<OrderMapper, Order> implements IOrderService {
@Autowired
private OrderMapper orderMapper;
@Autowired
private OrderTrackMapper orderTrackMapper;
@Override
@CzRedisCache(type = PageInfo.class)
public PageInfo<Order> listOrders(int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
return new PageInfo<>(orderMapper.listOrders());
}
@Override
@CzRedisEvict
@Transactional
public void updateStatus(String orderId,String trackInformation) {
Order order = orderMapper.selectById(orderId);
OrderStatus nestStatus = order.getStatus().next();
order.setStatus(nestStatus);
orderMapper.updateById(order);
orderTrackMapper.insert(new OrderTrack(order.getId(),trackInformation,nestStatus));
}
}
| 1,662 | 0.768953 | 0.76414 | 49 | 32.918365 | 24.171021 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.632653 | false | false | 13 |
6406573787fb974243f4b15e20ed5238fedf31ee | 39,281,770,920,194 | 48a69a9dbe6b2482355fc9efb2e83d09a3bdddfe | /com.test.xu/src/com/test/xu/dialog/ChangeProsDialog.java | beaca383b3e2b3234edb0b9ff6fec5b7094f8f27 | [] | no_license | NotaProgammer/test.xu | https://github.com/NotaProgammer/test.xu | 603986c75a10c096cb69971af1ab548e2adea439 | 9dbe50216793283561eec5be3a80c479bcbed444 | refs/heads/master | 2020-06-17T00:28:21.794000 | 2016-11-29T06:29:31 | 2016-11-29T06:29:31 | 75,055,737 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.test.xu.dialog;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.HashSet;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import com.teamcenter.rac.aif.AIFDesktop;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.aif.InterfaceAIFOperationListener;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.common.lov.LOVUIComponent;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.stylesheet.PropertyLOVDisplayer;
import com.teamcenter.rac.ui.common.RACUIUtil;
import com.teamcenter.rac.util.ButtonLayout;
import com.teamcenter.rac.util.FilterDocument;
import com.teamcenter.rac.util.HorizontalLayout;
import com.teamcenter.rac.util.PropertyLayout;
import com.teamcenter.rac.util.Separator;
import com.teamcenter.rac.util.iTextField;
import com.teamcenter.rac.util.combobox.iComboBox;
import com.teamcenter.soaictstubs.int64_s;
import com.test.xu.dialog.ChangeProsOp;
public class ChangeProsDialog extends AbstractAIFDialog implements
InterfaceAIFOperationListener {
private static final long serialVersionUID = 1L;
private ArrayList<InterfaceAIFComponent> selectedComponents;
protected TCSession session = RACUIUtil.getTCSession();
private JButton startBtn;
private JButton cancelBtn;
private ArrayList<LOVUIComponent> lovuiComponents;
public ChangeProsDialog(ArrayList<InterfaceAIFComponent> list) {
super(AIFDesktop.getActiveDesktop());
this.selectedComponents = list;
lovuiComponents = new ArrayList<LOVUIComponent>();
// ๆ นๆฎ่ทๅพ้ถ็ปไปถ้ฟๅบฆ ๅๅงๅiTextField
for (int i = 0; i < list.size(); i++) {
lovuiComponents.add(new LOVUIComponent(session,"K3_myLOV"));
}
this.setTitle("ไฟฎๆนๅฑๆง");
// TODO ่ชๅจ็ๆ็ๆ้ ๅฝๆฐๅญๆ น
}
public void run() {
// ่ทๅพๅฎนๅจ
Container dlgPanel = getContentPane();
dlgPanel.setBackground(Color.white);
JPanel basicInfoPanel = new JPanel(
new PropertyLayout(5, 5, 5, 15, 5, 5));
basicInfoPanel.setBackground(Color.white);
// ๅพช็ฏๅคๆญๆฏ็ๆฌ่ฟๆฏ้ถ็ปไปถ ๏ผ่ทๅพๅฑๆง1ๆทปๅ ๅฐ็้ข
for (int i = 0; i < selectedComponents.size(); i++) {
TCComponent tcComponent = (TCComponent) selectedComponents.get(i);
try {
String id = tcComponent.getProperty("current_id");
JLabel idLabel = new JLabel(id + "๏ผ");
basicInfoPanel.add(i + 1 + ".1.left.top", idLabel);
idLabel.setBorder(new EmptyBorder(2, 20, 0, 0));
String attr = tcComponent.getProperty("k3_StringAttr1");
lovuiComponents.get(i).setSelectedValue(attr);
} catch (TCException e1) {
e1.printStackTrace();
}
basicInfoPanel.add(i + 1 + ".2.left.top", lovuiComponents.get(i));
}
// ๆทปๅ Button
JPanel attrLayOut = new JPanel(new HorizontalLayout(10, 1, 1, 1, 0));
attrLayOut.add("unbound.nobind.center.center", basicInfoPanel);
attrLayOut.setBackground(Color.white);
dlgPanel.add(BorderLayout.CENTER, attrLayOut);
dlgPanel.add(BorderLayout.NORTH, basicInfoPanel);
JPanel btnPanel = new JPanel(new ButtonLayout(ButtonLayout.HORIZONTAL,
ButtonLayout.CENTER, 7));
startBtn = new JButton("็กฎๅฎ");
startBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ChangeProsOp op = new ChangeProsOp(ChangeProsDialog.this);
op.addOperationListener(ChangeProsDialog.this);
session.queueOperation(op);
ChangeProsDialog.this.dispose();
}
});
btnPanel.add(startBtn);
cancelBtn = new JButton("ๅๆถ");
cancelBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ChangeProsDialog.this.dispose();
}
});
btnPanel.add(cancelBtn);
JPanel btnOutter = new JPanel(new BorderLayout());
btnOutter.setBorder(new EmptyBorder(5, 10, 5, 10));
btnOutter.add(BorderLayout.NORTH, new Separator());
btnOutter.add(BorderLayout.CENTER, btnPanel);
dlgPanel.add(BorderLayout.SOUTH, btnOutter);
setPreferredSize(new Dimension(350, 200));
super.run();
}
@Override
public void endOperation() {
// TODO ่ชๅจ็ๆ็ๆนๆณๅญๆ น
}
@Override
public void startOperation(String arg0) {
// TODO ่ชๅจ็ๆ็ๆนๆณๅญๆ น
}
public ArrayList<InterfaceAIFComponent>getSelectedComponents() {
return selectedComponents;
}
public void setSelectedComponents(ArrayList<InterfaceAIFComponent>selectedComponents) {
this.selectedComponents = selectedComponents;
}
public TCSession getSession() {
return session;
}
public void setSession(TCSession session) {
this.session = session;
}
public JButton getStartBtn() {
return startBtn;
}
public void setStartBtn(JButton startBtn) {
this.startBtn = startBtn;
}
public JButton getCancelBtn() {
return cancelBtn;
}
public void setCancelBtn(JButton cancelBtn) {
this.cancelBtn = cancelBtn;
}
public ArrayList<LOVUIComponent> getLovuiComponents() {
return lovuiComponents;
}
public void setLovuiComponents(ArrayList<LOVUIComponent> lovuiComponents) {
this.lovuiComponents = lovuiComponents;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
} | GB18030 | Java | 5,599 | java | ChangeProsDialog.java | Java | [] | null | [] | package com.test.xu.dialog;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.HashSet;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import com.teamcenter.rac.aif.AIFDesktop;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.aif.InterfaceAIFOperationListener;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.common.lov.LOVUIComponent;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.stylesheet.PropertyLOVDisplayer;
import com.teamcenter.rac.ui.common.RACUIUtil;
import com.teamcenter.rac.util.ButtonLayout;
import com.teamcenter.rac.util.FilterDocument;
import com.teamcenter.rac.util.HorizontalLayout;
import com.teamcenter.rac.util.PropertyLayout;
import com.teamcenter.rac.util.Separator;
import com.teamcenter.rac.util.iTextField;
import com.teamcenter.rac.util.combobox.iComboBox;
import com.teamcenter.soaictstubs.int64_s;
import com.test.xu.dialog.ChangeProsOp;
public class ChangeProsDialog extends AbstractAIFDialog implements
InterfaceAIFOperationListener {
private static final long serialVersionUID = 1L;
private ArrayList<InterfaceAIFComponent> selectedComponents;
protected TCSession session = RACUIUtil.getTCSession();
private JButton startBtn;
private JButton cancelBtn;
private ArrayList<LOVUIComponent> lovuiComponents;
public ChangeProsDialog(ArrayList<InterfaceAIFComponent> list) {
super(AIFDesktop.getActiveDesktop());
this.selectedComponents = list;
lovuiComponents = new ArrayList<LOVUIComponent>();
// ๆ นๆฎ่ทๅพ้ถ็ปไปถ้ฟๅบฆ ๅๅงๅiTextField
for (int i = 0; i < list.size(); i++) {
lovuiComponents.add(new LOVUIComponent(session,"K3_myLOV"));
}
this.setTitle("ไฟฎๆนๅฑๆง");
// TODO ่ชๅจ็ๆ็ๆ้ ๅฝๆฐๅญๆ น
}
public void run() {
// ่ทๅพๅฎนๅจ
Container dlgPanel = getContentPane();
dlgPanel.setBackground(Color.white);
JPanel basicInfoPanel = new JPanel(
new PropertyLayout(5, 5, 5, 15, 5, 5));
basicInfoPanel.setBackground(Color.white);
// ๅพช็ฏๅคๆญๆฏ็ๆฌ่ฟๆฏ้ถ็ปไปถ ๏ผ่ทๅพๅฑๆง1ๆทปๅ ๅฐ็้ข
for (int i = 0; i < selectedComponents.size(); i++) {
TCComponent tcComponent = (TCComponent) selectedComponents.get(i);
try {
String id = tcComponent.getProperty("current_id");
JLabel idLabel = new JLabel(id + "๏ผ");
basicInfoPanel.add(i + 1 + ".1.left.top", idLabel);
idLabel.setBorder(new EmptyBorder(2, 20, 0, 0));
String attr = tcComponent.getProperty("k3_StringAttr1");
lovuiComponents.get(i).setSelectedValue(attr);
} catch (TCException e1) {
e1.printStackTrace();
}
basicInfoPanel.add(i + 1 + ".2.left.top", lovuiComponents.get(i));
}
// ๆทปๅ Button
JPanel attrLayOut = new JPanel(new HorizontalLayout(10, 1, 1, 1, 0));
attrLayOut.add("unbound.nobind.center.center", basicInfoPanel);
attrLayOut.setBackground(Color.white);
dlgPanel.add(BorderLayout.CENTER, attrLayOut);
dlgPanel.add(BorderLayout.NORTH, basicInfoPanel);
JPanel btnPanel = new JPanel(new ButtonLayout(ButtonLayout.HORIZONTAL,
ButtonLayout.CENTER, 7));
startBtn = new JButton("็กฎๅฎ");
startBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ChangeProsOp op = new ChangeProsOp(ChangeProsDialog.this);
op.addOperationListener(ChangeProsDialog.this);
session.queueOperation(op);
ChangeProsDialog.this.dispose();
}
});
btnPanel.add(startBtn);
cancelBtn = new JButton("ๅๆถ");
cancelBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ChangeProsDialog.this.dispose();
}
});
btnPanel.add(cancelBtn);
JPanel btnOutter = new JPanel(new BorderLayout());
btnOutter.setBorder(new EmptyBorder(5, 10, 5, 10));
btnOutter.add(BorderLayout.NORTH, new Separator());
btnOutter.add(BorderLayout.CENTER, btnPanel);
dlgPanel.add(BorderLayout.SOUTH, btnOutter);
setPreferredSize(new Dimension(350, 200));
super.run();
}
@Override
public void endOperation() {
// TODO ่ชๅจ็ๆ็ๆนๆณๅญๆ น
}
@Override
public void startOperation(String arg0) {
// TODO ่ชๅจ็ๆ็ๆนๆณๅญๆ น
}
public ArrayList<InterfaceAIFComponent>getSelectedComponents() {
return selectedComponents;
}
public void setSelectedComponents(ArrayList<InterfaceAIFComponent>selectedComponents) {
this.selectedComponents = selectedComponents;
}
public TCSession getSession() {
return session;
}
public void setSession(TCSession session) {
this.session = session;
}
public JButton getStartBtn() {
return startBtn;
}
public void setStartBtn(JButton startBtn) {
this.startBtn = startBtn;
}
public JButton getCancelBtn() {
return cancelBtn;
}
public void setCancelBtn(JButton cancelBtn) {
this.cancelBtn = cancelBtn;
}
public ArrayList<LOVUIComponent> getLovuiComponents() {
return lovuiComponents;
}
public void setLovuiComponents(ArrayList<LOVUIComponent> lovuiComponents) {
this.lovuiComponents = lovuiComponents;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
} | 5,599 | 0.763182 | 0.754547 | 184 | 28.586956 | 22.148537 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.951087 | false | false | 13 |
65ff4e7be1cc04372483836e03575db9e3ac7165 | 35,974,646,118,959 | cdb88f73b30c183150c95116bf8c6eea27e8c362 | /R82KOM5211811816/main/java/com/example/cse226ca1/P2AsyncTaskDisplayData.java | 982339945ea3068fc8e057e6708fdf602eed2771 | [] | no_license | NehaArora9/Home-Budget-Management-System-App | https://github.com/NehaArora9/Home-Budget-Management-System-App | ffb0bf9b24dd1571667667783eb82afcc2efe56c | fba35a9a46ca558f6f106484758335e3cc0e565d | refs/heads/main | 2023-08-27T08:42:57.053000 | 2021-10-25T05:53:33 | 2021-10-25T05:53:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.cse226ca1;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class P2AsyncTaskDisplayData extends AppCompatActivity {
URL ImageUrl = null;
InputStream is = null;
Bitmap bmImg = null;
ImageView imageView = null;
ProgressDialog p;
TextView tv,tv1;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_p2_async_task_display_data);
Button button = findViewById(R.id.btnid);
tv = findViewById(R.id.tvid);
tv1 = findViewById(R.id.tv1id);
imageView = findViewById(R.id.ivid);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
P2AsyncTask asyncTask = new P2AsyncTask();
asyncTask.execute("https://image.shutterstock.com/z/stock-vector-editable-colorful-text-of-happy-navratri-vector-with-holy-footprint-of-goddess-durga-laxmi-for-1028086372.jpg");
}
});
}
private class P2AsyncTask extends AsyncTask<String, String, Bitmap> {
@Override
protected void onPreExecute() {
super.onPreExecute();
p = new ProgressDialog(P2AsyncTaskDisplayData.this);
p.setMessage("Please Wait... It is downloading");
p.setCancelable(false);
p.show();
}
protected Bitmap doInBackground(String... strings) {
try {
ImageUrl = new URL(strings[0]);
HttpURLConnection conn = (HttpURLConnection) ImageUrl.openConnection();
conn.setDoInput(true);
conn.connect();
is = conn.getInputStream();
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.RGB_565;
bmImg = BitmapFactory.decodeStream(is, null, options);
} catch (IOException e) {
e.printStackTrace();
}
return bmImg;
}
@Override
protected void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
if (imageView != null) {
p.hide();
imageView.setImageBitmap(bitmap);
tv.setText("Title: Navratri 2017: 3 ways to wear purple on Navami");
tv1.setText("Category: Life & Style");
} else {
p.show();
}
}
}
} | UTF-8 | Java | 3,025 | java | P2AsyncTaskDisplayData.java | Java | [] | null | [] | package com.example.cse226ca1;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class P2AsyncTaskDisplayData extends AppCompatActivity {
URL ImageUrl = null;
InputStream is = null;
Bitmap bmImg = null;
ImageView imageView = null;
ProgressDialog p;
TextView tv,tv1;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_p2_async_task_display_data);
Button button = findViewById(R.id.btnid);
tv = findViewById(R.id.tvid);
tv1 = findViewById(R.id.tv1id);
imageView = findViewById(R.id.ivid);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
P2AsyncTask asyncTask = new P2AsyncTask();
asyncTask.execute("https://image.shutterstock.com/z/stock-vector-editable-colorful-text-of-happy-navratri-vector-with-holy-footprint-of-goddess-durga-laxmi-for-1028086372.jpg");
}
});
}
private class P2AsyncTask extends AsyncTask<String, String, Bitmap> {
@Override
protected void onPreExecute() {
super.onPreExecute();
p = new ProgressDialog(P2AsyncTaskDisplayData.this);
p.setMessage("Please Wait... It is downloading");
p.setCancelable(false);
p.show();
}
protected Bitmap doInBackground(String... strings) {
try {
ImageUrl = new URL(strings[0]);
HttpURLConnection conn = (HttpURLConnection) ImageUrl.openConnection();
conn.setDoInput(true);
conn.connect();
is = conn.getInputStream();
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.RGB_565;
bmImg = BitmapFactory.decodeStream(is, null, options);
} catch (IOException e) {
e.printStackTrace();
}
return bmImg;
}
@Override
protected void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
if (imageView != null) {
p.hide();
imageView.setImageBitmap(bitmap);
tv.setText("Title: Navratri 2017: 3 ways to wear purple on Navami");
tv1.setText("Category: Life & Style");
} else {
p.show();
}
}
}
} | 3,025 | 0.598678 | 0.587769 | 90 | 31.633333 | 28.012478 | 193 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.622222 | false | false | 13 |
1ecae691003b57e92378fc311b753006f61ad277 | 39,582,418,634,225 | 24b57ae6287989d320dfd5754b4342e6cd9ccbe8 | /src/main/java/com/dawei/utils/DbPoolConnection.java | a4d46fb27b978395c869996cb1123e91529502d0 | [] | no_license | aiyemz/articletodb | https://github.com/aiyemz/articletodb | 1eef4f513b3e75df1587f038a88fdcaeccd3f866 | 840fd86aec32ea67201ec2f11d64583278a82ed4 | refs/heads/master | 2021-06-20T23:11:19.449000 | 2019-11-19T07:56:40 | 2019-11-19T07:56:40 | 222,640,222 | 0 | 0 | null | false | 2020-10-13T17:34:12 | 2019-11-19T07:56:17 | 2019-11-19T07:57:02 | 2020-10-13T17:34:11 | 28 | 0 | 0 | 1 | Java | false | false | package com.dawei.utils;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidDataSourceFactory;
import com.alibaba.druid.pool.DruidPooledConnection;
import java.io.*;
import java.sql.SQLException;
import java.util.Properties;
public class DbPoolConnection {
private static DbPoolConnection databasePool = null;
private static DruidDataSource dds = null;
static {
Properties properties = PropertiesUtil.loadPropertyFile("db_server.properties");
try {
dds = (DruidDataSource) DruidDataSourceFactory.createDataSource(properties);
} catch (Exception e) {
e.printStackTrace();
}
}
private DbPoolConnection() {
}
public static synchronized DbPoolConnection getInstance() {
if (null == databasePool) {
databasePool = new DbPoolConnection();
}
return databasePool;
}
public DruidDataSource getDataSource() throws SQLException {
return dds;
}
public DruidPooledConnection getConnection() throws SQLException {
return dds.getConnection();
}
public void close() throws SQLException {
getConnection().close();
}
}
| UTF-8 | Java | 1,218 | java | DbPoolConnection.java | Java | [] | null | [] | package com.dawei.utils;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidDataSourceFactory;
import com.alibaba.druid.pool.DruidPooledConnection;
import java.io.*;
import java.sql.SQLException;
import java.util.Properties;
public class DbPoolConnection {
private static DbPoolConnection databasePool = null;
private static DruidDataSource dds = null;
static {
Properties properties = PropertiesUtil.loadPropertyFile("db_server.properties");
try {
dds = (DruidDataSource) DruidDataSourceFactory.createDataSource(properties);
} catch (Exception e) {
e.printStackTrace();
}
}
private DbPoolConnection() {
}
public static synchronized DbPoolConnection getInstance() {
if (null == databasePool) {
databasePool = new DbPoolConnection();
}
return databasePool;
}
public DruidDataSource getDataSource() throws SQLException {
return dds;
}
public DruidPooledConnection getConnection() throws SQLException {
return dds.getConnection();
}
public void close() throws SQLException {
getConnection().close();
}
}
| 1,218 | 0.679803 | 0.679803 | 50 | 23.360001 | 24.608746 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.34 | false | false | 13 |
763e5fdea0343bb02f66eef6ddb281397f8923ba | 10,282,151,769,916 | bf3862831537a0bc600427db331b1527942c9abc | /src/main/java/com/jpmorgan/exercise/stocks/SellIndicator.java | 2d5310488c0d9c8604b98ca5be6a2673f04b6ea5 | [] | no_license | balazsalmadi/super-simple-stocks | https://github.com/balazsalmadi/super-simple-stocks | 4437eb5ef559f49fcc54b1feeb9ad57802e3c014 | 01890587162324a6b2b81a07287b6176222281c0 | refs/heads/master | 2015-09-25T12:17:36.635000 | 2015-08-06T21:10:20 | 2015-08-06T21:10:20 | 40,326,803 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jpmorgan.exercise.stocks;
import java.util.Arrays;
public enum SellIndicator {
BUY,
SELL;
public static boolean contains(String symbol) {
return Arrays.asList(values())
.stream()
.anyMatch(sellIndicator -> sellIndicator.name().equals(symbol));
}
}
| UTF-8 | Java | 319 | java | SellIndicator.java | Java | [] | null | [] | package com.jpmorgan.exercise.stocks;
import java.util.Arrays;
public enum SellIndicator {
BUY,
SELL;
public static boolean contains(String symbol) {
return Arrays.asList(values())
.stream()
.anyMatch(sellIndicator -> sellIndicator.name().equals(symbol));
}
}
| 319 | 0.630094 | 0.630094 | 14 | 21.785715 | 22.788401 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 13 |
1d62cc6ec22601e273283f7cb783ca0b0a751596 | 21,732,534,532,403 | f78105402857bd069606d01c8c31dd2b431abe75 | /Hibernate/examples/hello-hibernate/src/main/java/com/revature/models/TestMapping.java | 5d95cf472af16538c6e6e4ff98bf364aa937b4d8 | [] | no_license | jmknighten9/1901-jan22-java | https://github.com/jmknighten9/1901-jan22-java | 0b8924ff82091735539b8613a279550bb7a7cb5a | 2050c2184fd2336c0b2d982dd66719e13450ae55 | refs/heads/master | 2020-04-29T19:29:24.915000 | 2019-03-15T15:59:43 | 2019-03-15T15:59:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.revature.models;
public class TestMapping {
/*
* As we know, for most configuration details, we
* can handle it in multiple ways.
* We have seen configuring classes as entities with
* annotations, but we must also explore
* configuring classes as entities with XML
* We do this via a hibernate mapping file
* The mapping files must be named
* ClassName.hbm.xml
*/
private int id;
private String data;
public TestMapping() { }
public TestMapping(String data) {
this.data = data;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
@Override
public String toString() {
return "TestMapping [id=" + id + ", data=" + data + "]";
}
}
| UTF-8 | Java | 826 | java | TestMapping.java | Java | [] | null | [] | package com.revature.models;
public class TestMapping {
/*
* As we know, for most configuration details, we
* can handle it in multiple ways.
* We have seen configuring classes as entities with
* annotations, but we must also explore
* configuring classes as entities with XML
* We do this via a hibernate mapping file
* The mapping files must be named
* ClassName.hbm.xml
*/
private int id;
private String data;
public TestMapping() { }
public TestMapping(String data) {
this.data = data;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
@Override
public String toString() {
return "TestMapping [id=" + id + ", data=" + data + "]";
}
}
| 826 | 0.664649 | 0.664649 | 42 | 18.666666 | 16.882883 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false | 13 |
d926edbb3c38265d62c7c0254760cf021bc23f9d | 21,732,534,535,864 | 4be72dee04ebb3f70d6e342aeb01467e7e8b3129 | /bin/ext-platform-backoffice/platformbackoffice/testsrc/de/hybris/platform/platformbackoffice/labelproviders/TaxDiscountValueRendererTest.java | ba586d7565316b82026e17da40e268ca9d856dcd | [] | no_license | lun130220/hybris | https://github.com/lun130220/hybris | da00774767ba6246d04cdcbc49d87f0f4b0b1b26 | 03c074ea76779f96f2db7efcdaa0b0538d1ce917 | refs/heads/master | 2021-05-14T01:48:42.351000 | 2018-01-07T07:21:53 | 2018-01-07T07:21:53 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.hybris.platform.platformbackoffice.labelproviders;/*
* [y] hybris Platform
*
* Copyright (c) 2000-2015 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*/
import static org.fest.assertions.Assertions.assertThat;
import de.hybris.bootstrap.annotations.IntegrationTest;
import de.hybris.platform.core.model.c2l.CurrencyModel;
import de.hybris.platform.servicelayer.ServicelayerTransactionalBaseTest;
import de.hybris.platform.servicelayer.model.ModelService;
import javax.annotation.Resource;
import org.junit.Before;
import org.junit.Test;
@IntegrationTest
public class TaxDiscountValueRendererTest extends ServicelayerTransactionalBaseTest
{
@Resource
TaxDiscountValueRenderer taxDiscountValueRenderer;
@Resource
ModelService modelService;
@Before
public void before()
{
final CurrencyModel currency = modelService.create(CurrencyModel.class);
currency.setSymbol("zล");
currency.setDigits(4);
currency.setIsocode("PLN");
modelService.save(currency);
}
@Test
public void absoluteTaxShouldRespectLanguageDigits()
{
final String renderedValue = taxDiscountValueRenderer.render("Disc-001", true, "PLN", 10.40, 0.0);
assertThat(renderedValue).isEqualTo("Disc-001 : 10.4000 PLN");
}
@Test
public void absoluteTaxShouldNotShowAppliedValue()
{
final String renderedValue = taxDiscountValueRenderer.render("Disc-001", true, "PLN", 10.40, 21.0);
assertThat(renderedValue).isEqualTo("Disc-001 : 10.4000 PLN");
}
@Test(expected = IllegalArgumentException.class)
public void absoluteTaxShouldNotShowAppliedValue2()
{
final String renderedValue = taxDiscountValueRenderer.render("Disc-001", true, null, 10.40, 21.0);
assertThat(renderedValue).isEqualTo("Disc-001 : 10.4000 PLN");
}
@Test
public void invalidLanguageShouldFallbackToDefault()
{
final String renderedValue = taxDiscountValueRenderer.render("Disc-001", true, "noneSuch", 10.40, 21.0);
assertThat(renderedValue).isEqualTo("Disc-001 : 10.40");
}
@Test
public void relativeTaxShouldShowAppliedValueWith2Digits()
{
final String renderedValue = taxDiscountValueRenderer.render("Disc-001", false, null, 10.40, 23.12012312);
assertThat(renderedValue).isEqualTo("Disc-001 : 10.40% = 23.12");
}
}
| UTF-8 | Java | 2,487 | java | TaxDiscountValueRendererTest.java | Java | [] | null | [] | package de.hybris.platform.platformbackoffice.labelproviders;/*
* [y] hybris Platform
*
* Copyright (c) 2000-2015 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*/
import static org.fest.assertions.Assertions.assertThat;
import de.hybris.bootstrap.annotations.IntegrationTest;
import de.hybris.platform.core.model.c2l.CurrencyModel;
import de.hybris.platform.servicelayer.ServicelayerTransactionalBaseTest;
import de.hybris.platform.servicelayer.model.ModelService;
import javax.annotation.Resource;
import org.junit.Before;
import org.junit.Test;
@IntegrationTest
public class TaxDiscountValueRendererTest extends ServicelayerTransactionalBaseTest
{
@Resource
TaxDiscountValueRenderer taxDiscountValueRenderer;
@Resource
ModelService modelService;
@Before
public void before()
{
final CurrencyModel currency = modelService.create(CurrencyModel.class);
currency.setSymbol("zล");
currency.setDigits(4);
currency.setIsocode("PLN");
modelService.save(currency);
}
@Test
public void absoluteTaxShouldRespectLanguageDigits()
{
final String renderedValue = taxDiscountValueRenderer.render("Disc-001", true, "PLN", 10.40, 0.0);
assertThat(renderedValue).isEqualTo("Disc-001 : 10.4000 PLN");
}
@Test
public void absoluteTaxShouldNotShowAppliedValue()
{
final String renderedValue = taxDiscountValueRenderer.render("Disc-001", true, "PLN", 10.40, 21.0);
assertThat(renderedValue).isEqualTo("Disc-001 : 10.4000 PLN");
}
@Test(expected = IllegalArgumentException.class)
public void absoluteTaxShouldNotShowAppliedValue2()
{
final String renderedValue = taxDiscountValueRenderer.render("Disc-001", true, null, 10.40, 21.0);
assertThat(renderedValue).isEqualTo("Disc-001 : 10.4000 PLN");
}
@Test
public void invalidLanguageShouldFallbackToDefault()
{
final String renderedValue = taxDiscountValueRenderer.render("Disc-001", true, "noneSuch", 10.40, 21.0);
assertThat(renderedValue).isEqualTo("Disc-001 : 10.40");
}
@Test
public void relativeTaxShouldShowAppliedValueWith2Digits()
{
final String renderedValue = taxDiscountValueRenderer.render("Disc-001", false, null, 10.40, 23.12012312);
assertThat(renderedValue).isEqualTo("Disc-001 : 10.40% = 23.12");
}
}
| 2,487 | 0.77675 | 0.731295 | 81 | 29.691359 | 32.077698 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.283951 | false | false | 13 |
4fd59f2c9e823fb261ca6a88859f38421946aa3c | 11,081,015,639,312 | 4c23b058690463d01b2f375708d664c0fba514c5 | /fundamentals/src/string_concept/Sort_String.java | d8df9edc4056360dcd90533b00bb5b01b0908f4d | [] | no_license | r4ramanmatrix/Java_Fundamentals | https://github.com/r4ramanmatrix/Java_Fundamentals | d9c484ad534e6899af7f1a18cd17d96a29f169b5 | 24afeea7e8cd11c108f2b60a5f863daf67fc31a6 | refs/heads/master | 2020-12-14T21:44:41.524000 | 2020-01-19T10:07:50 | 2020-01-19T10:07:50 | 234,877,748 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package string_concept;
public class Sort_String {
static String name = "firstname middlename lastname raman anurag";
public static String sortingMethod(String str) {
// SString[] naming=name.split(" ");
char temp = 0;
char[] ch = str.toCharArray();
for (int i = 0; i < ch.length; i++) {
for (int j = 0; j < ch.length - 1; j++) {
if (ch[j] > ch[j + 1]) {
temp = ch[j];
ch[j] = ch[j + 1];
ch[j + 1] = temp;
}
}
}
return new String(ch);
}
public static void main(String[] args) {
String[] naming = name.split(" ");
for (String name : naming) {
System.out.print(sortingMethod(name) + " ");
}
System.out.println("\n" + sortingMethod("manr"));
System.out.println(sortingMethod("Raman Kumar").trim());
}
}
| UTF-8 | Java | 765 | java | Sort_String.java | Java | [
{
"context": "tic String name = \"firstname middlename lastname raman anurag\";\n\n\tpublic static String sortingMethod(Str",
"end": 111,
"score": 0.5428255796432495,
"start": 107,
"tag": "NAME",
"value": "aman"
},
{
"context": "g name = \"firstname middlename lastname raman anurag\"... | null | [] | package string_concept;
public class Sort_String {
static String name = "firstname middlename lastname raman anurag";
public static String sortingMethod(String str) {
// SString[] naming=name.split(" ");
char temp = 0;
char[] ch = str.toCharArray();
for (int i = 0; i < ch.length; i++) {
for (int j = 0; j < ch.length - 1; j++) {
if (ch[j] > ch[j + 1]) {
temp = ch[j];
ch[j] = ch[j + 1];
ch[j + 1] = temp;
}
}
}
return new String(ch);
}
public static void main(String[] args) {
String[] naming = name.split(" ");
for (String name : naming) {
System.out.print(sortingMethod(name) + " ");
}
System.out.println("\n" + sortingMethod("manr"));
System.out.println(sortingMethod("<NAME>").trim());
}
}
| 760 | 0.586928 | 0.577778 | 33 | 22.181818 | 19.736835 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.30303 | false | false | 13 |
470196915888c6a3801cec49c7db0dc103f2ee37 | 26,749,056,334,997 | 1244f8ff474902daeb4468591fe0c2bd24a130b4 | /src/com/lex/zhbj/pages/contentpages/NewsCenterContentPage.java | f6517fc3f1e6d30c3115b8af116ad67a1045947c | [] | no_license | drugTang/WisdomBeijing | https://github.com/drugTang/WisdomBeijing | 4c7a338a1a194824a462820162532b2f3f1976dc | 9d5368a1332bb07d08e792e0ed0ecef982df72a6 | refs/heads/master | 2021-01-10T12:21:29.889000 | 2015-10-12T06:49:29 | 2015-10-12T06:49:29 | 43,931,290 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lex.zhbj.pages.contentpages;
import java.util.ArrayList;
import java.util.List;
import com.google.gson.Gson;
import com.lex.zhbj.R;
import com.lex.zhbj.activity.MainActivity;
import com.lex.zhbj.domain.NewsData;
import com.lex.zhbj.fragment.impl.LeftMenuFragment;
import com.lex.zhbj.global.HttpUrlCollector;
import com.lex.zhbj.pages.BaseMenuDetailPage;
import com.lex.zhbj.pages.BasePage;
import com.lex.zhbj.pages.menudetailpages.InteractDetailPage;
import com.lex.zhbj.pages.menudetailpages.NewsDetailPage;
import com.lex.zhbj.pages.menudetailpages.PhotoDetailPage;
import com.lex.zhbj.pages.menudetailpages.TopicDetailPage;
import com.lidroid.xutils.HttpUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.http.client.HttpRequest.HttpMethod;
import android.app.Activity;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.Toast;
public class NewsCenterContentPage extends BasePage {
/**
*
*/
private NewsData mNewsData;
/**
* ่ๅ่ฏฆๆ
้กต้ๅ
*/
private List<BaseMenuDetailPage> mPages;
public NewsCenterContentPage(Activity activity) {
super(activity);
}
/**
* ๅๅงๅ่งๅพ๏ผๅชๅ ่ฝฝไธๆฌก็ๆฐๆฎๅฏไปฅๆพๅฐ้้ข
*/
@Override
public void initView() {
//ไธบ่ๅๆ้ฎๆทปๅ ็นๅปไบไปถ
menuButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
slidingMenu.showMenu();
}
});
}
@Override
public void initData() {
System.out.println("ๅๅงๅๆฐ้ปๆฐๆฎ...");
titleText.setText(R.string.title_news);
// ่ฎพ็ฝฎSlidingMenuๅฏ็จ
setSlidingMenuEnabled(true);
TextView context = new TextView(mActivity);
context.setText("ๆฐ้ป");
context.setTextColor(Color.RED);
context.setGravity(Gravity.CENTER);
context.setTextSize(24);
flContent.addView(context);
getDataFromServer();
}
/**
* ไปๆๅกๅจ่ทๅๆฐๆฎ
*/
private void getDataFromServer() {
HttpUtils httpUtils = new HttpUtils();
httpUtils.send(HttpMethod.GET, HttpUrlCollector.CATEGORY_JSON_URL, new RequestCallBack<String>() {
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
String result = responseInfo.result;
System.out.println("่ฟๅๆฐๆฎ:" + result);
parseData(result);
}
@Override
public void onFailure(HttpException error, String msg) {
Toast.makeText(mActivity, "ไปๆๅกๅจ่ทๅๆฐๆฎๅคฑ่ดฅ", Toast.LENGTH_SHORT).show();
error.printStackTrace();
}
});
}
/**
* ่ฝฌๆขJsonๆฐๆฎ
*/
private void parseData(String data) {
Gson gson = new Gson();
mNewsData = gson.fromJson(data, NewsData.class);
System.out.println("่งฃๆ็ปๆ๏ผ" + mNewsData);
//ๅฐๆฐๆฎไผ ้็ปไพง่พนๆ
MainActivity mainActivity = (MainActivity)mActivity;
LeftMenuFragment leftMenuFragment = mainActivity.getLeftMenuFragment();
leftMenuFragment.setNewsData(mNewsData);
//ๆทปๅ ่ๅ่ฏฆๆ
้กต
mPages = new ArrayList<BaseMenuDetailPage>();
mPages.add(new NewsDetailPage(mActivity));
mPages.add(new TopicDetailPage(mActivity));
mPages.add(new PhotoDetailPage(mActivity));
mPages.add(new InteractDetailPage(mActivity));
//่ฎพ็ฝฎ้ป่ฎค่ๅ่ฏฆๆ
้กต
setCurrentMenuDetail(0);
}
/**
* ่ฎพ็ฝฎๅฝๅ็่ๅ่ฏฆๆ
้กต
*/
public void setCurrentMenuDetail(int position) {
BaseMenuDetailPage page = mPages.get(position);
flContent.removeAllViews();//ๆธ
้คไนๅ็้กต้ข
flContent.addView(page.mRootView);
}
}
| UTF-8 | Java | 3,689 | java | NewsCenterContentPage.java | Java | [] | null | [] | package com.lex.zhbj.pages.contentpages;
import java.util.ArrayList;
import java.util.List;
import com.google.gson.Gson;
import com.lex.zhbj.R;
import com.lex.zhbj.activity.MainActivity;
import com.lex.zhbj.domain.NewsData;
import com.lex.zhbj.fragment.impl.LeftMenuFragment;
import com.lex.zhbj.global.HttpUrlCollector;
import com.lex.zhbj.pages.BaseMenuDetailPage;
import com.lex.zhbj.pages.BasePage;
import com.lex.zhbj.pages.menudetailpages.InteractDetailPage;
import com.lex.zhbj.pages.menudetailpages.NewsDetailPage;
import com.lex.zhbj.pages.menudetailpages.PhotoDetailPage;
import com.lex.zhbj.pages.menudetailpages.TopicDetailPage;
import com.lidroid.xutils.HttpUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.http.client.HttpRequest.HttpMethod;
import android.app.Activity;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.Toast;
public class NewsCenterContentPage extends BasePage {
/**
*
*/
private NewsData mNewsData;
/**
* ่ๅ่ฏฆๆ
้กต้ๅ
*/
private List<BaseMenuDetailPage> mPages;
public NewsCenterContentPage(Activity activity) {
super(activity);
}
/**
* ๅๅงๅ่งๅพ๏ผๅชๅ ่ฝฝไธๆฌก็ๆฐๆฎๅฏไปฅๆพๅฐ้้ข
*/
@Override
public void initView() {
//ไธบ่ๅๆ้ฎๆทปๅ ็นๅปไบไปถ
menuButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
slidingMenu.showMenu();
}
});
}
@Override
public void initData() {
System.out.println("ๅๅงๅๆฐ้ปๆฐๆฎ...");
titleText.setText(R.string.title_news);
// ่ฎพ็ฝฎSlidingMenuๅฏ็จ
setSlidingMenuEnabled(true);
TextView context = new TextView(mActivity);
context.setText("ๆฐ้ป");
context.setTextColor(Color.RED);
context.setGravity(Gravity.CENTER);
context.setTextSize(24);
flContent.addView(context);
getDataFromServer();
}
/**
* ไปๆๅกๅจ่ทๅๆฐๆฎ
*/
private void getDataFromServer() {
HttpUtils httpUtils = new HttpUtils();
httpUtils.send(HttpMethod.GET, HttpUrlCollector.CATEGORY_JSON_URL, new RequestCallBack<String>() {
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
String result = responseInfo.result;
System.out.println("่ฟๅๆฐๆฎ:" + result);
parseData(result);
}
@Override
public void onFailure(HttpException error, String msg) {
Toast.makeText(mActivity, "ไปๆๅกๅจ่ทๅๆฐๆฎๅคฑ่ดฅ", Toast.LENGTH_SHORT).show();
error.printStackTrace();
}
});
}
/**
* ่ฝฌๆขJsonๆฐๆฎ
*/
private void parseData(String data) {
Gson gson = new Gson();
mNewsData = gson.fromJson(data, NewsData.class);
System.out.println("่งฃๆ็ปๆ๏ผ" + mNewsData);
//ๅฐๆฐๆฎไผ ้็ปไพง่พนๆ
MainActivity mainActivity = (MainActivity)mActivity;
LeftMenuFragment leftMenuFragment = mainActivity.getLeftMenuFragment();
leftMenuFragment.setNewsData(mNewsData);
//ๆทปๅ ่ๅ่ฏฆๆ
้กต
mPages = new ArrayList<BaseMenuDetailPage>();
mPages.add(new NewsDetailPage(mActivity));
mPages.add(new TopicDetailPage(mActivity));
mPages.add(new PhotoDetailPage(mActivity));
mPages.add(new InteractDetailPage(mActivity));
//่ฎพ็ฝฎ้ป่ฎค่ๅ่ฏฆๆ
้กต
setCurrentMenuDetail(0);
}
/**
* ่ฎพ็ฝฎๅฝๅ็่ๅ่ฏฆๆ
้กต
*/
public void setCurrentMenuDetail(int position) {
BaseMenuDetailPage page = mPages.get(position);
flContent.removeAllViews();//ๆธ
้คไนๅ็้กต้ข
flContent.addView(page.mRootView);
}
}
| 3,689 | 0.751235 | 0.750363 | 133 | 24.872181 | 20.961983 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.789474 | false | false | 13 |
a6cd9fa8f949beeede2e0962b76a4fbac21e5e62 | 24,343,874,651,101 | a2068da9d3387264aab619856e3268d35385c6c9 | /Demo/src/com/hanweb/controller/interest/OprInterestController.java | 2f261cefc974f982c8ae320f009051888c49d6d0 | [] | no_license | jin2clear/HanWebDemo | https://github.com/jin2clear/HanWebDemo | 5280cec09ab48d1e0acfb31d7aa183c77bc72100 | 427b1b193d65af5ebad7a0db6ff5d58d01fe5c1c | refs/heads/master | 2017-10-31T07:13:59.528000 | 2017-07-03T07:13:44 | 2017-07-03T07:13:44 | 95,430,693 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hanweb.controller.interest;
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 org.springframework.web.servlet.ModelAndView;
import com.hanweb.common.util.mvc.JsonResult;
import com.hanweb.common.validation.ValidationException;
import com.hanweb.common.validation.ValidationUtil;
import com.hanweb.entity.Interest;
import com.hanweb.exception.DemoException;
import com.hanweb.service.InterestService;
@Controller
@RequestMapping("manager/demo/interest")
public class OprInterestController {
@Autowired
private InterestService interestService;
@RequestMapping("add_show")
public ModelAndView showAdd()
{
ModelAndView mv = new ModelAndView("/demo/interest/interest_opr");
mv.addObject("url", "add_submit.do");
return mv;
}
@RequestMapping("add_submit")
@ResponseBody
public JsonResult submitAdd(InterestFormBean interestFormBean)
{
JsonResult jsonResult = JsonResult.getInstance();
try {
ValidationUtil.validation(interestFormBean);
interestService.add(interestFormBean);
jsonResult.setSuccess(true);
} catch (ValidationException e) {
jsonResult.setMessage(e.getMessage());
} catch (DemoException e) {
jsonResult.setMessage(e.getMessage());
}
return jsonResult;
}
@RequestMapping("modify_show")
public ModelAndView showModify(Integer iid)
{
ModelAndView mv = new ModelAndView("/demo/interest/interest_opr");
mv.addObject("url", "modify_submit.do");
Interest interest = interestService.getInterestById(iid);
mv.addObject("interest", interest);
return mv;
}
@RequestMapping("modify_submit")
@ResponseBody
public JsonResult submitModify(InterestFormBean interestFormBean)
{
JsonResult jsonResult = JsonResult.getInstance();
try {
ValidationUtil.validation(interestFormBean);
interestService.modify(interestFormBean);
jsonResult.setSuccess(true);
} catch (ValidationException e) {
jsonResult.setMessage(e.getMessage());
} catch (DemoException e) {
jsonResult.setMessage(e.getMessage());
}
return jsonResult;
}
@RequestMapping("remove")
@ResponseBody
public JsonResult remove(String ids)
{
JsonResult jsonResult = JsonResult.getInstance();
try {
interestService.delete(ids);
jsonResult.setSuccess(true);
} catch (DemoException e) {
jsonResult.setMessage(e.getMessage());
}
return jsonResult;
}
}
| UTF-8 | Java | 2,613 | java | OprInterestController.java | Java | [] | null | [] | package com.hanweb.controller.interest;
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 org.springframework.web.servlet.ModelAndView;
import com.hanweb.common.util.mvc.JsonResult;
import com.hanweb.common.validation.ValidationException;
import com.hanweb.common.validation.ValidationUtil;
import com.hanweb.entity.Interest;
import com.hanweb.exception.DemoException;
import com.hanweb.service.InterestService;
@Controller
@RequestMapping("manager/demo/interest")
public class OprInterestController {
@Autowired
private InterestService interestService;
@RequestMapping("add_show")
public ModelAndView showAdd()
{
ModelAndView mv = new ModelAndView("/demo/interest/interest_opr");
mv.addObject("url", "add_submit.do");
return mv;
}
@RequestMapping("add_submit")
@ResponseBody
public JsonResult submitAdd(InterestFormBean interestFormBean)
{
JsonResult jsonResult = JsonResult.getInstance();
try {
ValidationUtil.validation(interestFormBean);
interestService.add(interestFormBean);
jsonResult.setSuccess(true);
} catch (ValidationException e) {
jsonResult.setMessage(e.getMessage());
} catch (DemoException e) {
jsonResult.setMessage(e.getMessage());
}
return jsonResult;
}
@RequestMapping("modify_show")
public ModelAndView showModify(Integer iid)
{
ModelAndView mv = new ModelAndView("/demo/interest/interest_opr");
mv.addObject("url", "modify_submit.do");
Interest interest = interestService.getInterestById(iid);
mv.addObject("interest", interest);
return mv;
}
@RequestMapping("modify_submit")
@ResponseBody
public JsonResult submitModify(InterestFormBean interestFormBean)
{
JsonResult jsonResult = JsonResult.getInstance();
try {
ValidationUtil.validation(interestFormBean);
interestService.modify(interestFormBean);
jsonResult.setSuccess(true);
} catch (ValidationException e) {
jsonResult.setMessage(e.getMessage());
} catch (DemoException e) {
jsonResult.setMessage(e.getMessage());
}
return jsonResult;
}
@RequestMapping("remove")
@ResponseBody
public JsonResult remove(String ids)
{
JsonResult jsonResult = JsonResult.getInstance();
try {
interestService.delete(ids);
jsonResult.setSuccess(true);
} catch (DemoException e) {
jsonResult.setMessage(e.getMessage());
}
return jsonResult;
}
}
| 2,613 | 0.74359 | 0.74359 | 88 | 27.693182 | 20.64657 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.875 | false | false | 13 |
a4d27974bcfeb6123ec6d9c97adbaac24bb2e5eb | 1,838,246,024,639 | 5b9f2d88a2bf21cfd81ca3a3dbc286af6a2dcea3 | /src/org/sanyanse/ravi/algorithm/NCliqueBruteForce.java | e2785f4a39873ccae73d2b2b15b843e0bb27dd82 | [] | no_license | lipaskc/sanyanse | https://github.com/lipaskc/sanyanse | 1c009f0c19aee28aa9b384d1131ffe9f3500ad56 | b34dd67ddb04d84392f9496aa45fd9101a000b9e | refs/heads/master | 2021-01-15T15:26:37.547000 | 2011-05-11T20:00:35 | 2011-05-11T20:00:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.sanyanse.ravi.algorithm;
import org.sanyanse.common.Vertex;
import org.sanyanse.ravi.graph.UndirectedGraph;
import org.sanyanse.ravi.util.Combination;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
public class NCliqueBruteForce {
public static Collection<Vertex> getClique(UndirectedGraph graph, int cliqueSize) {
Collection<Vertex> clique = null;
if (graph != null) {
// Get vertices with degree >= clique size.
// Only these vertices can participate in an n-clique.
UndirectedGraph g = graph.clone();
Collection<Vertex> vertices = g.cloneVertices();
for (Iterator<Vertex> vIter = vertices.iterator(); vIter.hasNext(); ) {
Vertex v = vIter.next();
if (g.getDegree(v) < cliqueSize - 1) {
vIter.remove();
}
}
// Only vertices with degree >= clique size are present in our collection.
// Run a combination of "clique-size" over vertices
// and determine if they form a clique.
// If they do, return the first clique.
Vertex[] vertexArray = new Vertex[vertices.size()];
int index=0;
for (Iterator<Vertex> iter = vertices.iterator(); iter.hasNext(); ) {
vertexArray[index++] = iter.next();
}
Combination combination = new Combination(vertexArray, cliqueSize);
Iterator<Object[]> comboIter = combination.iterator();
while (comboIter.hasNext()) {
Object[] potentialCliqueArray = comboIter.next();
// Determine if all elements in this combination are connected to each other.
boolean isClique = true;
for (int i=0; i < cliqueSize - 1; i++) {
Vertex v = (Vertex) potentialCliqueArray[i];
for (int j=i+1; j < cliqueSize; j++) {
if (!g.hasEdge(v, (Vertex) potentialCliqueArray[j])) {
isClique = false;
break;
}
}
if (!isClique) {
break;
}
}
if (isClique) {
// Return this combination as a clique.
clique = new HashSet<Vertex>();
for (int i=0; i<cliqueSize; i++) {
clique.add((Vertex) potentialCliqueArray[i]);
}
}
}
}
return clique;
}
}
| UTF-8 | Java | 2,079 | java | NCliqueBruteForce.java | Java | [] | null | [] | package org.sanyanse.ravi.algorithm;
import org.sanyanse.common.Vertex;
import org.sanyanse.ravi.graph.UndirectedGraph;
import org.sanyanse.ravi.util.Combination;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
public class NCliqueBruteForce {
public static Collection<Vertex> getClique(UndirectedGraph graph, int cliqueSize) {
Collection<Vertex> clique = null;
if (graph != null) {
// Get vertices with degree >= clique size.
// Only these vertices can participate in an n-clique.
UndirectedGraph g = graph.clone();
Collection<Vertex> vertices = g.cloneVertices();
for (Iterator<Vertex> vIter = vertices.iterator(); vIter.hasNext(); ) {
Vertex v = vIter.next();
if (g.getDegree(v) < cliqueSize - 1) {
vIter.remove();
}
}
// Only vertices with degree >= clique size are present in our collection.
// Run a combination of "clique-size" over vertices
// and determine if they form a clique.
// If they do, return the first clique.
Vertex[] vertexArray = new Vertex[vertices.size()];
int index=0;
for (Iterator<Vertex> iter = vertices.iterator(); iter.hasNext(); ) {
vertexArray[index++] = iter.next();
}
Combination combination = new Combination(vertexArray, cliqueSize);
Iterator<Object[]> comboIter = combination.iterator();
while (comboIter.hasNext()) {
Object[] potentialCliqueArray = comboIter.next();
// Determine if all elements in this combination are connected to each other.
boolean isClique = true;
for (int i=0; i < cliqueSize - 1; i++) {
Vertex v = (Vertex) potentialCliqueArray[i];
for (int j=i+1; j < cliqueSize; j++) {
if (!g.hasEdge(v, (Vertex) potentialCliqueArray[j])) {
isClique = false;
break;
}
}
if (!isClique) {
break;
}
}
if (isClique) {
// Return this combination as a clique.
clique = new HashSet<Vertex>();
for (int i=0; i<cliqueSize; i++) {
clique.add((Vertex) potentialCliqueArray[i]);
}
}
}
}
return clique;
}
}
| 2,079 | 0.657047 | 0.654161 | 65 | 30.984615 | 23.068789 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.676923 | false | false | 13 |
f0a3729633256f773ea894cf59f1b7791ff25b8d | 4,801,773,460,338 | fe972d3080caf94cb4cb5013b31f28504adef68d | /SPRING-BOOT-DEMO/src/main/java/com/h2/springboot/pojo/Worker.java | 31c1b2d9c86d9d2b3283c764121ba954a29f8b1e | [] | no_license | huhao0514/SpringBoot | https://github.com/huhao0514/SpringBoot | 2a701cc1061268533eee18fe5d960bd87b8d0ebb | a0af374d7a6aa72ce27fe7d12d3f51a33dbd99da | refs/heads/master | 2022-12-20T04:50:43.545000 | 2020-09-25T07:41:40 | 2020-09-25T07:41:40 | 292,734,790 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.h2.springboot.pojo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
/**
* Created by: huhao
* Date: 2020/9/3
*/
@Slf4j
@Component(value = "worker")
public class Worker implements Person {
/**
* ๅฝๆ็ฑปๅๆณจๅ
ฅ(DI)beanๆถ,ๅน้
ๅฐไบๅคไธชbean,่งฃๅณๆนๆณ:
* 1:้
ๅ@Qualifierๆๅฎbean็ๅ็งฐ่ฟ่กๆณจๅ
ฅ(ๅปบ่ฎฎไฝฟ็จ)
* 2:ๅฐๆณจๅ
ฅ็ๅฑๆงๅ็งฐๆนไธบ่ฆๆณจๅ
ฅ็bean็name,่ฟๆ ทๆพ็ถไธๅ็ผ็ ่ฏญไนๅ็ตๆดปๆง,ไธๅปบ่ฎฎไฝฟ็จ
* 3:ๅจBean็java็ฑปไธญไฝฟ็จ@Primaryๆณจ่งฃ,ๅน้
ๅฐๅคไธชbeanๆถ,้ป่ฎค้ๅธฆ@Primaryๆณจ่งฃ็.
*/
@Autowired
@Qualifier(value = "cat")
private Animal animal;
@Override
public void work() {
log.info("ๅทฅไบบๅๅ
ป"+animal.getClass().getSimpleName());
animal.eat();
}
}
| UTF-8 | Java | 963 | java | Worker.java | Java | [
{
"context": "ramework.stereotype.Component;\n\n/**\n * Created by: huhao\n * Date: 2020/9/3\n */\n@Slf4j\n@Component(value = \"",
"end": 267,
"score": 0.9996435642242432,
"start": 262,
"tag": "USERNAME",
"value": "huhao"
}
] | null | [] | package com.h2.springboot.pojo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
/**
* Created by: huhao
* Date: 2020/9/3
*/
@Slf4j
@Component(value = "worker")
public class Worker implements Person {
/**
* ๅฝๆ็ฑปๅๆณจๅ
ฅ(DI)beanๆถ,ๅน้
ๅฐไบๅคไธชbean,่งฃๅณๆนๆณ:
* 1:้
ๅ@Qualifierๆๅฎbean็ๅ็งฐ่ฟ่กๆณจๅ
ฅ(ๅปบ่ฎฎไฝฟ็จ)
* 2:ๅฐๆณจๅ
ฅ็ๅฑๆงๅ็งฐๆนไธบ่ฆๆณจๅ
ฅ็bean็name,่ฟๆ ทๆพ็ถไธๅ็ผ็ ่ฏญไนๅ็ตๆดปๆง,ไธๅปบ่ฎฎไฝฟ็จ
* 3:ๅจBean็java็ฑปไธญไฝฟ็จ@Primaryๆณจ่งฃ,ๅน้
ๅฐๅคไธชbeanๆถ,้ป่ฎค้ๅธฆ@Primaryๆณจ่งฃ็.
*/
@Autowired
@Qualifier(value = "cat")
private Animal animal;
@Override
public void work() {
log.info("ๅทฅไบบๅๅ
ป"+animal.getClass().getSimpleName());
animal.eat();
}
}
| 963 | 0.704225 | 0.68758 | 30 | 25.033333 | 20.36743 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false | 13 |
a5acc52aa5564380ee2e0a2a5fb3846892c556fa | 13,683,765,826,998 | c8c6fccc012f0cf5f90e4cb6120b6f69f0cb9230 | /IsomorphicString/IsomorphicString.java | c7b18c45c968d5e7511a50673aed245ba1331bc9 | [] | no_license | NataliaPuchkova/Algorithms-in-Java | https://github.com/NataliaPuchkova/Algorithms-in-Java | 8b052685fcde1b18c7434e8058ed4cf3cf1c2871 | fb0a835dee62116391506aa96cc7b94936b99202 | refs/heads/master | 2022-03-28T11:57:14.259000 | 2019-12-18T00:30:20 | 2019-12-18T00:30:20 | 118,548,339 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.*;
class IsomorphicString{
/* DDgg ffkk true
* Fgfg gghh false
* fgh fgg false
* ffggh llmm false
*/
public static boolean isIsomorphic(String str1, String str2){
if (str1==null || str2 == null || str1.length()!=str2.length()) return false;
if (str1.length()==0 && str2.length()==0) return true;
HashMap<Character, Character> map = new HashMap<Character, Character>();
for(int i=0; i<str1.length(); i++){
char ch1 = str1.charAt(i);
char ch2 = str2.charAt(i);
if (map.containsKey(ch1)){
char ch3 = map.get(ch1);
if (ch3!=ch2) return false;
} else {
if (map.containsValue(ch2)) return false;
map.put(ch1, ch2);
}
}
return true;
}
public static void main(String...arg){
String str1="DDgg";
String str2 = "ffkk";
System.out.println(str1+" "+str2+" "+isIsomorphic(str1, str2));
str1="Fgfg";
str2 = "gghh";
System.out.println(str1+" "+str2+" "+isIsomorphic(str1, str2));
str1="fgh";
str2 = "fgg";
System.out.println(str1+" "+str2+" "+isIsomorphic(str1, str2));
str1="ffggh";
str2 = "llmm";
System.out.println(str1+" "+str2+" "+isIsomorphic(str1, str2));
}
}
| UTF-8 | Java | 1,644 | java | IsomorphicString.java | Java | [] | null | [] | import java.util.*;
class IsomorphicString{
/* DDgg ffkk true
* Fgfg gghh false
* fgh fgg false
* ffggh llmm false
*/
public static boolean isIsomorphic(String str1, String str2){
if (str1==null || str2 == null || str1.length()!=str2.length()) return false;
if (str1.length()==0 && str2.length()==0) return true;
HashMap<Character, Character> map = new HashMap<Character, Character>();
for(int i=0; i<str1.length(); i++){
char ch1 = str1.charAt(i);
char ch2 = str2.charAt(i);
if (map.containsKey(ch1)){
char ch3 = map.get(ch1);
if (ch3!=ch2) return false;
} else {
if (map.containsValue(ch2)) return false;
map.put(ch1, ch2);
}
}
return true;
}
public static void main(String...arg){
String str1="DDgg";
String str2 = "ffkk";
System.out.println(str1+" "+str2+" "+isIsomorphic(str1, str2));
str1="Fgfg";
str2 = "gghh";
System.out.println(str1+" "+str2+" "+isIsomorphic(str1, str2));
str1="fgh";
str2 = "fgg";
System.out.println(str1+" "+str2+" "+isIsomorphic(str1, str2));
str1="ffggh";
str2 = "llmm";
System.out.println(str1+" "+str2+" "+isIsomorphic(str1, str2));
}
}
| 1,644 | 0.439781 | 0.410584 | 42 | 38.142857 | 26.35795 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.880952 | false | false | 13 |
66b40a62a7f4f101216e0239ed8314460133ca5f | 4,947,802,345,483 | e30d3fab75a1194e91126465e59ca287c7ba1ed1 | /Exams/Unit 1/CominaLeonelaQ11/src/cominaleonelaq11/CominaLeonelaQ11.java | 75c7d1687262a3c8fe7d68b14023cef8d8dab4fd | [] | no_license | Leonela-Comina/ESPE202011-FP-GEO-3285 | https://github.com/Leonela-Comina/ESPE202011-FP-GEO-3285 | d4c75240e4221e17517f0c0fb78fdb19ebd34aee | 7b3814ca069e954a334a10545c60ae84cb0a9766 | refs/heads/main | 2023-04-02T20:45:57.362000 | 2021-04-02T01:51:08 | 2021-04-02T01:51:08 | 318,602,927 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cominaleonelaq11;
import java.util.Scanner;
public class CominaLeonelaQ11 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
boolean mainLoop = true;
int option;
do {
System.out.println(" ========= Calculator =======");
System.out.println("1. -> Multiplication Tables");
System.out.println("0. -> Exit");
System.out.println("Enter your menu option --> ");
option = input.nextInt();
switch (option) {
case 1:
int top=12;
int product;
int table;
System.out.println("Enter the table you table you want to "
+ "study -->");
table = input.nextInt();
for(int n = 1 ; n<= top ; n++){
product = table * n;
System.out.println(table + " * " + n + " = " + product);
product++;
}
break;
case 0:
System.out.println("Good Bye my friend");
System.exit(0);
break;
default:
System.out.println("Invalid option\n\n\n");
break;
}
}while (option != 0);
}
} | UTF-8 | Java | 1,441 | java | CominaLeonelaQ11.java | Java | [] | null | [] | package cominaleonelaq11;
import java.util.Scanner;
public class CominaLeonelaQ11 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
boolean mainLoop = true;
int option;
do {
System.out.println(" ========= Calculator =======");
System.out.println("1. -> Multiplication Tables");
System.out.println("0. -> Exit");
System.out.println("Enter your menu option --> ");
option = input.nextInt();
switch (option) {
case 1:
int top=12;
int product;
int table;
System.out.println("Enter the table you table you want to "
+ "study -->");
table = input.nextInt();
for(int n = 1 ; n<= top ; n++){
product = table * n;
System.out.println(table + " * " + n + " = " + product);
product++;
}
break;
case 0:
System.out.println("Good Bye my friend");
System.exit(0);
break;
default:
System.out.println("Invalid option\n\n\n");
break;
}
}while (option != 0);
}
} | 1,441 | 0.405274 | 0.396253 | 53 | 26.207546 | 20.113226 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.509434 | false | false | 13 |
f51d28ad5413eca1a588933e02a53555a0c551e5 | 17,712,445,151,971 | ea2e1333c3304c57aaae2c002fcb468e2355348b | /Google/714. Best Time to Buy and Sell Stock with Transaction Fee.java | 438bca4899697dd6f5b96a29e73297c79c0902d5 | [] | no_license | sophiemw898/Algorithm_Basic | https://github.com/sophiemw898/Algorithm_Basic | b434a478c6add34bda4ec48249dfe4b68939a93c | 403bf3c0835fbf9cc933b72a0162bf58cf5cc980 | refs/heads/master | 2021-01-20T03:25:35.764000 | 2019-11-30T00:27:37 | 2019-11-30T00:27:37 | 101,360,841 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //there are two stages for each day, holding stock in hand and just cash in hand
//cash[i] the cash in hand, if you are not holding the stock at the end of day(i)
//hold[i] the cash in hand, if you are holding the stock at the end of day(i)
//return cash[n - 1];
//cash[i] = Math.max(cash[i - 1], hold[i] + prices[i] - fee)
//hold[i] = Math.max(hold[i - 1], cash[i - 1] - prices[i])
class Solution {
public int maxProfit(int[] prices, int fee) {
// int n = prices.length;
// int[] cash = new int[n];
// int[] hold = new int[n];
// cash[0] = 0;
// hold[0] = -prices[0];
// for (int i = 1; i < n; i++) {
// cash[i] = Math.max(cash[i - 1], hold[i - 1] + prices[i] - fee);
// hold[i] = Math.max(hold[i - 1], cash[i - 1] - prices[i]);
// }
// return cash[n - 1];
int cash = 0;
int hold = -prices[0];
for (int i = 1; i < prices.length; i++) {
cash = Math.max(cash, hold + prices[i] - fee);
hold = Math.max(hold, cash - prices[i]);
}
return cash;
}
}
| UTF-8 | Java | 1,150 | java | 714. Best Time to Buy and Sell Stock with Transaction Fee.java | Java | [] | null | [] | //there are two stages for each day, holding stock in hand and just cash in hand
//cash[i] the cash in hand, if you are not holding the stock at the end of day(i)
//hold[i] the cash in hand, if you are holding the stock at the end of day(i)
//return cash[n - 1];
//cash[i] = Math.max(cash[i - 1], hold[i] + prices[i] - fee)
//hold[i] = Math.max(hold[i - 1], cash[i - 1] - prices[i])
class Solution {
public int maxProfit(int[] prices, int fee) {
// int n = prices.length;
// int[] cash = new int[n];
// int[] hold = new int[n];
// cash[0] = 0;
// hold[0] = -prices[0];
// for (int i = 1; i < n; i++) {
// cash[i] = Math.max(cash[i - 1], hold[i - 1] + prices[i] - fee);
// hold[i] = Math.max(hold[i - 1], cash[i - 1] - prices[i]);
// }
// return cash[n - 1];
int cash = 0;
int hold = -prices[0];
for (int i = 1; i < prices.length; i++) {
cash = Math.max(cash, hold + prices[i] - fee);
hold = Math.max(hold, cash - prices[i]);
}
return cash;
}
}
| 1,150 | 0.483478 | 0.468696 | 33 | 33.848484 | 25.096325 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.848485 | false | false | 13 |
4e89500997b0ff2feee6a5582086bc8c22f1c0ba | 18,141,941,878,620 | 96fb9ae0176ec02857eadb219b0a121cdba924e2 | /step(9)/baekjoon_10989.java | 54f87f1eac9b7b324f21d4f21710afdc2dd34751 | [] | no_license | beark93/BOJ | https://github.com/beark93/BOJ | 91387f14766ef366b5201c89eac0dd5de7c0059b | 2f7807c437f44c0e3427da316caaa17e40d4a16a | refs/heads/master | 2020-09-03T08:06:14.002000 | 2019-11-08T06:33:49 | 2019-11-08T06:33:49 | 219,422,682 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* baekjoon_10989
*/
import java.io.*;
public class baekjoon_10989 {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(br.readLine());
int[] array = new int[n];
for(int i=0;i<n;i++) array[i] = Integer.parseInt(br.readLine());
int[] count = countingSort(array, 10000);
for(int i=0;i<10000;i++) {
if(count[i] != 0) {
for(int j=0;j<count[i];j++) {
bw.write(Integer.toString(i+1));
bw.newLine();
}
}
}
bw.flush();
}
public static int[] countingSort(int[] array, int range) {
int[] count = new int[range];
for(int i=0;i<array.length;i++) {
count[array[i]-1]++;
}
return count;
}
} | UTF-8 | Java | 1,001 | java | baekjoon_10989.java | Java | [] | null | [] | /**
* baekjoon_10989
*/
import java.io.*;
public class baekjoon_10989 {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(br.readLine());
int[] array = new int[n];
for(int i=0;i<n;i++) array[i] = Integer.parseInt(br.readLine());
int[] count = countingSort(array, 10000);
for(int i=0;i<10000;i++) {
if(count[i] != 0) {
for(int j=0;j<count[i];j++) {
bw.write(Integer.toString(i+1));
bw.newLine();
}
}
}
bw.flush();
}
public static int[] countingSort(int[] array, int range) {
int[] count = new int[range];
for(int i=0;i<array.length;i++) {
count[array[i]-1]++;
}
return count;
}
} | 1,001 | 0.519481 | 0.492507 | 40 | 24.049999 | 24.380268 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.575 | false | false | 13 |
d391790e6da6e523ca9896680713a89bff6c4216 | 32,830,730,050,816 | 0368a48344a0af91aaafae6a447227302a64c62a | /java/src/MergeIntervals56/Solution.java | 762d0b535c7bac8d6e10591666be8154ba2b9ed5 | [] | no_license | MajexH/leetcode | https://github.com/MajexH/leetcode | dd2cbe85ca649922880cd8073cbc079ae89f7ad4 | 6a2860cb2e712280bc72a0a7fb2951d15d510c90 | refs/heads/master | 2023-08-28T19:46:32.712000 | 2023-08-10T06:57:24 | 2023-08-10T06:57:24 | 172,458,957 | 6 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package MergeIntervals56;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
public class Solution {
public int[][] merge(int[][] intervals) {
if (intervals.length == 0) return new int[0][];
Arrays.sort(intervals, Comparator.comparingInt((int[] o) -> o[0]));
List<int[]> list = new ArrayList<>();
list.add(intervals[0]);
for (int i = 1; i < intervals.length; i++) {
int[] pre = list.get(list.size() - 1);
int[] current = intervals[i];
if (pre[1] >= current[0]) {
list.remove(list.size() - 1);
list.add(new int[]{ pre[0], Math.max(pre[1], current[1])});
} else {
list.add(current);
}
}
int[][] res = new int[list.size()][2];
for (int i = 0; i < res.length; i++) {
res[i] = list.get(i);
}
return res;
}
public static void main(String[] args) {
int[][] intervals = new int[][]{ {1,3},{8,10},{2,6},{15,18}};
System.out.println(Arrays.deepToString(new Solution().merge(intervals)));
}
}
| UTF-8 | Java | 1,173 | java | Solution.java | Java | [] | null | [] | package MergeIntervals56;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
public class Solution {
public int[][] merge(int[][] intervals) {
if (intervals.length == 0) return new int[0][];
Arrays.sort(intervals, Comparator.comparingInt((int[] o) -> o[0]));
List<int[]> list = new ArrayList<>();
list.add(intervals[0]);
for (int i = 1; i < intervals.length; i++) {
int[] pre = list.get(list.size() - 1);
int[] current = intervals[i];
if (pre[1] >= current[0]) {
list.remove(list.size() - 1);
list.add(new int[]{ pre[0], Math.max(pre[1], current[1])});
} else {
list.add(current);
}
}
int[][] res = new int[list.size()][2];
for (int i = 0; i < res.length; i++) {
res[i] = list.get(i);
}
return res;
}
public static void main(String[] args) {
int[][] intervals = new int[][]{ {1,3},{8,10},{2,6},{15,18}};
System.out.println(Arrays.deepToString(new Solution().merge(intervals)));
}
}
| 1,173 | 0.514919 | 0.491901 | 37 | 30.702703 | 22.923922 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.891892 | false | false | 4 |
ad14476afdc7066ab1470c0337b33abd2feaff87 | 32,830,730,050,150 | 9ad1e1596d7ee297dbd8bffec2066266a04ffe21 | /src/main/java/dut/com/controller/GiangVienController.java | f6d5016abdcc777e084dd5a09ce856aba98f552c | [] | no_license | NgocQuyen007/DUTTrainningPro | https://github.com/NgocQuyen007/DUTTrainningPro | 99f50eea436c90a229eb96f603fd9b0cd1eba372 | 933cbeaab1d94ed30c69111579f378862eae1c4e | refs/heads/master | 2021-05-07T13:38:27.935000 | 2017-12-01T13:28:28 | 2017-12-01T13:28:28 | 109,591,701 | 0 | 0 | null | false | 2017-11-29T17:20:29 | 2017-11-05T15:31:46 | 2017-11-05T16:04:41 | 2017-11-29T17:20:28 | 8,068 | 0 | 0 | 0 | Java | false | null | package dut.com.controller;
import java.io.File;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import dut.com.dao.GiangVienDao;
import dut.com.dao.HocViDao;
import dut.com.dao.KhoaDao;
import dut.com.entity.GiangVien;
import dut.com.entity.HocVi;
import dut.com.entity.Khoa;
import dut.com.libs.LibString;
@Controller
@RequestMapping("giangvien")
public class GiangVienController {
@Autowired
GiangVienDao dao;
@Autowired
KhoaDao khoaDao;
@Autowired
HocViDao hocviDao;
@GetMapping
public String index(ModelMap map, HttpServletRequest request) {
String sidKhoa = request.getParameter("idKhoa");
if(sidKhoa != null){
// Tรฌm kiแบฟm theo khoa sแปญ dแปฅng Ajax
int idKhoa = Integer.parseInt(request.getParameter("idKhoa"));
map.addAttribute("khoas", khoaDao.getItems());
map.addAttribute("giangviens", dao.getItems(idKhoa));
return "admin.giangvien.index.search.khoa";
}
map.addAttribute("khoas", khoaDao.getItems());
map.addAttribute("giangviens", dao.getItems());
return "admin.giangvien.index";
}
@RequestMapping(path = "add", method = RequestMethod.GET)
public String add(ModelMap map) {
map.addAttribute("khoas", khoaDao.getItems());
map.addAttribute("hocvis", hocviDao.getItems());
return "admin.giangvien.add";
}
@RequestMapping(path = "add", method = RequestMethod.POST)
public String add(@Valid @ModelAttribute("giangvien") GiangVien giangvien,BindingResult bindingResult,@RequestParam(value="delete_picture",required=false) String key, @RequestParam("idHocVi") int idHocVi,@RequestParam("idKhoa") int idKhoa, @RequestParam("picture") CommonsMultipartFile commonsMultipartFile, HttpServletRequest request,ModelMap map) {
System.out.println("ADD POST: " + giangvien.toString());
if(bindingResult.hasErrors()){
map.addAttribute("giangvien", giangvien);
map.addAttribute("khoas", khoaDao.getItems());
map.addAttribute("hocvis", hocviDao.getItems());
return "admin.giangvien.add";
// return "redirect:/giangvien/add?msg=1";
}
Khoa khoa = new Khoa();
khoa.setId(idKhoa);
giangvien.setKhoa(khoa);
HocVi hocVi = new HocVi();
hocVi.setId(idHocVi);
giangvien.setHocVi(hocVi);
String urldir = request.getServletContext().getRealPath("files");
File dirfile = new File(urldir);
if (!dirfile.exists()) {
dirfile.mkdir();
}
String picture = "";
if(key != null){
giangvien.setAvatar("");
} else {
picture = commonsMultipartFile.getOriginalFilename();
giangvien.setAvatar(picture);
if (!giangvien.getAvatar().equals("")) {
picture = LibString.renameDFile(picture);
giangvien.setAvatar(picture);
}
}
try {
if (dao.add(giangvien) > 0) {
if (!giangvien.getAvatar().equals("")) {
try {
commonsMultipartFile.transferTo(new File(urldir + File.separator + picture));
} catch (IllegalStateException | IOException e) {}
}
return "redirect:/giangvien?msg=add";
}
} catch(DataIntegrityViolationException ex){
// Exception Unique
String [] arr = ex.getMessage().split("'");
if(arr[arr.length-1].equals("email_UNIQUE")){
return "redirect:/giangvien/add?msg=emailUnique";
} else {
return "redirect:/giangvien/add?msg=usernameUnique";
}
}
return "";
}
@RequestMapping(path = "edit/{id}", method = RequestMethod.GET)
public String edit(@PathVariable("id") int id, ModelMap map) {
map.addAttribute("khoas", khoaDao.getItems());
map.addAttribute("hocvis", hocviDao.getItems());
map.addAttribute("giangvien", dao.getItem(id));
return "admin.giangvien.edit";
}
@RequestMapping(path = "edit/{id}", method = RequestMethod.POST)
public String edit(@Valid @ModelAttribute GiangVien giangvien,BindingResult bindingResult,@PathVariable int id,@RequestParam(value="delete_picture",required=false) String key, @RequestParam("idHocVi") int idHocVi,@RequestParam("idKhoa") int idKhoa, @RequestParam("picture") CommonsMultipartFile commonsMultipartFile, HttpServletRequest request) {
if(bindingResult.hasErrors()){
return "redirect:/giangvien/edit/"+id+"?msg=2";
}
String picture = commonsMultipartFile.getOriginalFilename();
String old_picture = dao.getItem(id).getAvatar();
String urldir = request.getServletContext().getRealPath("files");
giangvien.setId(id);
Khoa khoa = new Khoa();
khoa.setId(idKhoa);
giangvien.setKhoa(khoa);
HocVi hocVi = new HocVi();
hocVi.setId(idHocVi);
giangvien.setHocVi(hocVi);
if(key != null){
giangvien.setAvatar("");
if(!old_picture.isEmpty()){
File file = new File(urldir+File.separator+old_picture);
file.delete();
}
} else {
// Chแปn แบฃnh mแปi
if(!picture.isEmpty()){
picture = LibString.renameDFile(picture);
giangvien.setAvatar(picture);
if(!old_picture.isEmpty()){
File file = new File(urldir+File.separator+old_picture);
file.delete();
}
} else {
// ฤแป แบฃnh cลฉ
giangvien.setAvatar(old_picture);
}
}
try {
if (dao.edit(giangvien) > 0) {
// Khรกc rแปng vร khรกc แบฃnh cลฉ
if (!giangvien.getAvatar().equals("") && !giangvien.getAvatar().equals(old_picture)) {
try {
commonsMultipartFile.transferTo(new File(urldir + File.separator + picture));
} catch (IllegalStateException | IOException e) {}
}
return "redirect:/giangvien?msg=edit";
}
} catch(DataIntegrityViolationException ex){
// Exception Unique
String [] arr = ex.getMessage().split("'");
if(arr[arr.length-1].equals("email_UNIQUE")){
return "redirect:/giangvien/edit?msg=emailUnique";
} else {
return "redirect:/giangvien/edit?msg=usernameUnique";
}
}
return "";
}
@RequestMapping(path="cpass/{id}", method=RequestMethod.POST)
public String cpass(@PathVariable int id, @RequestParam("old_password") String old_password,@RequestParam("password") String password, @RequestParam("repassword") String repassword){
GiangVien giangvien = dao.getItem(id);
System.out.println("ID: " + giangvien.getPassword());
System.out.println("CURRENT: " + LibString.md5(old_password));
if(!giangvien.getPassword().equals(LibString.md5(old_password))){
// Mแบญt khแบฉu cลฉ khรดng chรญnh xรกc : fail pass
return "redirect:/giangvien/edit/"+id+"?msg=fpass";
} else {
if(!password.equals(repassword)){
// Xรกc thแปฑc mแบญt khแบฉu khรดng ฤรบng : fail confirm pass
return "redirect:/giangvien/edit/"+id+"?msg=fcpass";
} else {
// ฤแปi mแบญt khแบฉu
giangvien.setPassword(password);
if(dao.updatePassword(giangvien) > 0){
return "redirect:/giangvien/edit/"+id+"?msg=pass";
}
}
}
return "";
}
@RequestMapping(path = "del/{id}", method = RequestMethod.GET)
public String del(@PathVariable("id") int id,HttpServletRequest request) {
String current_pic = dao.getItem(id).getAvatar();
if(!current_pic.equals("")){
String pathfile = request.getServletContext().getRealPath("files") + File.separator + current_pic;
File filedel = new File(pathfile);
if(filedel.exists()){
filedel.delete();
}
}
if(dao.del(id) > 0){
// Xoa anh ton tai
return "redirect:/giangvien?msg=del";
}
return "";
}
}
| UTF-8 | Java | 7,918 | java | GiangVienController.java | Java | [
{
"context": "e {\n\t\t\t\t// ฤแปi mแบญt khแบฉu\n\t\t\t\tgiangvien.setPassword(password);\n\t\t\t\tif(dao.updatePassword(giangvien) > 0){\n\t\t\t\t",
"end": 7203,
"score": 0.9355806708335876,
"start": 7195,
"tag": "PASSWORD",
"value": "password"
}
] | null | [] | package dut.com.controller;
import java.io.File;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import dut.com.dao.GiangVienDao;
import dut.com.dao.HocViDao;
import dut.com.dao.KhoaDao;
import dut.com.entity.GiangVien;
import dut.com.entity.HocVi;
import dut.com.entity.Khoa;
import dut.com.libs.LibString;
@Controller
@RequestMapping("giangvien")
public class GiangVienController {
@Autowired
GiangVienDao dao;
@Autowired
KhoaDao khoaDao;
@Autowired
HocViDao hocviDao;
@GetMapping
public String index(ModelMap map, HttpServletRequest request) {
String sidKhoa = request.getParameter("idKhoa");
if(sidKhoa != null){
// Tรฌm kiแบฟm theo khoa sแปญ dแปฅng Ajax
int idKhoa = Integer.parseInt(request.getParameter("idKhoa"));
map.addAttribute("khoas", khoaDao.getItems());
map.addAttribute("giangviens", dao.getItems(idKhoa));
return "admin.giangvien.index.search.khoa";
}
map.addAttribute("khoas", khoaDao.getItems());
map.addAttribute("giangviens", dao.getItems());
return "admin.giangvien.index";
}
@RequestMapping(path = "add", method = RequestMethod.GET)
public String add(ModelMap map) {
map.addAttribute("khoas", khoaDao.getItems());
map.addAttribute("hocvis", hocviDao.getItems());
return "admin.giangvien.add";
}
@RequestMapping(path = "add", method = RequestMethod.POST)
public String add(@Valid @ModelAttribute("giangvien") GiangVien giangvien,BindingResult bindingResult,@RequestParam(value="delete_picture",required=false) String key, @RequestParam("idHocVi") int idHocVi,@RequestParam("idKhoa") int idKhoa, @RequestParam("picture") CommonsMultipartFile commonsMultipartFile, HttpServletRequest request,ModelMap map) {
System.out.println("ADD POST: " + giangvien.toString());
if(bindingResult.hasErrors()){
map.addAttribute("giangvien", giangvien);
map.addAttribute("khoas", khoaDao.getItems());
map.addAttribute("hocvis", hocviDao.getItems());
return "admin.giangvien.add";
// return "redirect:/giangvien/add?msg=1";
}
Khoa khoa = new Khoa();
khoa.setId(idKhoa);
giangvien.setKhoa(khoa);
HocVi hocVi = new HocVi();
hocVi.setId(idHocVi);
giangvien.setHocVi(hocVi);
String urldir = request.getServletContext().getRealPath("files");
File dirfile = new File(urldir);
if (!dirfile.exists()) {
dirfile.mkdir();
}
String picture = "";
if(key != null){
giangvien.setAvatar("");
} else {
picture = commonsMultipartFile.getOriginalFilename();
giangvien.setAvatar(picture);
if (!giangvien.getAvatar().equals("")) {
picture = LibString.renameDFile(picture);
giangvien.setAvatar(picture);
}
}
try {
if (dao.add(giangvien) > 0) {
if (!giangvien.getAvatar().equals("")) {
try {
commonsMultipartFile.transferTo(new File(urldir + File.separator + picture));
} catch (IllegalStateException | IOException e) {}
}
return "redirect:/giangvien?msg=add";
}
} catch(DataIntegrityViolationException ex){
// Exception Unique
String [] arr = ex.getMessage().split("'");
if(arr[arr.length-1].equals("email_UNIQUE")){
return "redirect:/giangvien/add?msg=emailUnique";
} else {
return "redirect:/giangvien/add?msg=usernameUnique";
}
}
return "";
}
@RequestMapping(path = "edit/{id}", method = RequestMethod.GET)
public String edit(@PathVariable("id") int id, ModelMap map) {
map.addAttribute("khoas", khoaDao.getItems());
map.addAttribute("hocvis", hocviDao.getItems());
map.addAttribute("giangvien", dao.getItem(id));
return "admin.giangvien.edit";
}
@RequestMapping(path = "edit/{id}", method = RequestMethod.POST)
public String edit(@Valid @ModelAttribute GiangVien giangvien,BindingResult bindingResult,@PathVariable int id,@RequestParam(value="delete_picture",required=false) String key, @RequestParam("idHocVi") int idHocVi,@RequestParam("idKhoa") int idKhoa, @RequestParam("picture") CommonsMultipartFile commonsMultipartFile, HttpServletRequest request) {
if(bindingResult.hasErrors()){
return "redirect:/giangvien/edit/"+id+"?msg=2";
}
String picture = commonsMultipartFile.getOriginalFilename();
String old_picture = dao.getItem(id).getAvatar();
String urldir = request.getServletContext().getRealPath("files");
giangvien.setId(id);
Khoa khoa = new Khoa();
khoa.setId(idKhoa);
giangvien.setKhoa(khoa);
HocVi hocVi = new HocVi();
hocVi.setId(idHocVi);
giangvien.setHocVi(hocVi);
if(key != null){
giangvien.setAvatar("");
if(!old_picture.isEmpty()){
File file = new File(urldir+File.separator+old_picture);
file.delete();
}
} else {
// Chแปn แบฃnh mแปi
if(!picture.isEmpty()){
picture = LibString.renameDFile(picture);
giangvien.setAvatar(picture);
if(!old_picture.isEmpty()){
File file = new File(urldir+File.separator+old_picture);
file.delete();
}
} else {
// ฤแป แบฃnh cลฉ
giangvien.setAvatar(old_picture);
}
}
try {
if (dao.edit(giangvien) > 0) {
// Khรกc rแปng vร khรกc แบฃnh cลฉ
if (!giangvien.getAvatar().equals("") && !giangvien.getAvatar().equals(old_picture)) {
try {
commonsMultipartFile.transferTo(new File(urldir + File.separator + picture));
} catch (IllegalStateException | IOException e) {}
}
return "redirect:/giangvien?msg=edit";
}
} catch(DataIntegrityViolationException ex){
// Exception Unique
String [] arr = ex.getMessage().split("'");
if(arr[arr.length-1].equals("email_UNIQUE")){
return "redirect:/giangvien/edit?msg=emailUnique";
} else {
return "redirect:/giangvien/edit?msg=usernameUnique";
}
}
return "";
}
@RequestMapping(path="cpass/{id}", method=RequestMethod.POST)
public String cpass(@PathVariable int id, @RequestParam("old_password") String old_password,@RequestParam("password") String password, @RequestParam("repassword") String repassword){
GiangVien giangvien = dao.getItem(id);
System.out.println("ID: " + giangvien.getPassword());
System.out.println("CURRENT: " + LibString.md5(old_password));
if(!giangvien.getPassword().equals(LibString.md5(old_password))){
// Mแบญt khแบฉu cลฉ khรดng chรญnh xรกc : fail pass
return "redirect:/giangvien/edit/"+id+"?msg=fpass";
} else {
if(!password.equals(repassword)){
// Xรกc thแปฑc mแบญt khแบฉu khรดng ฤรบng : fail confirm pass
return "redirect:/giangvien/edit/"+id+"?msg=fcpass";
} else {
// ฤแปi mแบญt khแบฉu
giangvien.setPassword(<PASSWORD>);
if(dao.updatePassword(giangvien) > 0){
return "redirect:/giangvien/edit/"+id+"?msg=pass";
}
}
}
return "";
}
@RequestMapping(path = "del/{id}", method = RequestMethod.GET)
public String del(@PathVariable("id") int id,HttpServletRequest request) {
String current_pic = dao.getItem(id).getAvatar();
if(!current_pic.equals("")){
String pathfile = request.getServletContext().getRealPath("files") + File.separator + current_pic;
File filedel = new File(pathfile);
if(filedel.exists()){
filedel.delete();
}
}
if(dao.del(id) > 0){
// Xoa anh ton tai
return "redirect:/giangvien?msg=del";
}
return "";
}
}
| 7,920 | 0.709255 | 0.707984 | 237 | 32.189873 | 38.361069 | 352 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.721519 | false | false | 4 |
ee84249a706559d90c54f90141b91404e4b1a291 | 19,713,899,893,029 | 88bc13403750c24104e844c26bdd8b1e3c1e3324 | /presentation/src/main/java/jfuentesa/cleanarchitecture/navigator/Navigator.java | 194080ea25b3115a1c5985576803ee945bad4da4 | [] | no_license | jfuentesanaya/Clean-Reddit-example | https://github.com/jfuentesanaya/Clean-Reddit-example | 032acbfa3d5a0cdd2cfba9f12ac8171492ced2d1 | c1a46c412f344ef0d2413e56509b521a2f3a2f1f | refs/heads/master | 2021-01-12T10:42:21.565000 | 2016-11-02T14:34:24 | 2016-11-02T14:34:24 | 72,633,975 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package jfuentesa.cleanarchitecture.navigator;
import android.content.Context;
import jfuentesa.cleanarchitecture.model.PostModel;
import jfuentesa.cleanarchitecture.ui.activity.PostDetailsActivity;
import jfuentesa.cleanarchitecture.ui.activity.PostListActivity;
/**
* Created by jfuentesa on 21/10/2016.
*/
public class Navigator {
private static Navigator navigator;
private Navigator () {}
public static synchronized Navigator getInstance() {
if (navigator == null) {
navigator = new Navigator();
}
return navigator;
}
public void navigateToList(Context context){
if(context != null){
context.startActivity(PostListActivity.getCallingIntent(context));
}
}
public void navigateToPostDetails(Context context, PostModel postSelected){
if(context != null){
context.startActivity(PostDetailsActivity.getCallingIntent(context, postSelected));
}
}
}
| UTF-8 | Java | 984 | java | Navigator.java | Java | [
{
"context": "e.ui.activity.PostListActivity;\n\n/**\n * Created by jfuentesa on 21/10/2016.\n */\n\n\npublic class Navigator {\n ",
"end": 294,
"score": 0.9996716380119324,
"start": 285,
"tag": "USERNAME",
"value": "jfuentesa"
}
] | null | [] | package jfuentesa.cleanarchitecture.navigator;
import android.content.Context;
import jfuentesa.cleanarchitecture.model.PostModel;
import jfuentesa.cleanarchitecture.ui.activity.PostDetailsActivity;
import jfuentesa.cleanarchitecture.ui.activity.PostListActivity;
/**
* Created by jfuentesa on 21/10/2016.
*/
public class Navigator {
private static Navigator navigator;
private Navigator () {}
public static synchronized Navigator getInstance() {
if (navigator == null) {
navigator = new Navigator();
}
return navigator;
}
public void navigateToList(Context context){
if(context != null){
context.startActivity(PostListActivity.getCallingIntent(context));
}
}
public void navigateToPostDetails(Context context, PostModel postSelected){
if(context != null){
context.startActivity(PostDetailsActivity.getCallingIntent(context, postSelected));
}
}
}
| 984 | 0.698171 | 0.690041 | 39 | 24.23077 | 26.592327 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false | 4 |
5e4b4a721e3de6a1c678234a53c184a0a8c668e4 | 5,566,277,650,215 | 2c7b3d0a9f435618ac6d5e165333d97f0dffb1ce | /src/main/java/com/mrathena/design/pattern/creational/patterns/abstract_/factory/pattern/implement/AbstractProduct1.java | 5068de79dd9f0748b56249b633f25978841258f7 | [] | no_license | mrathena/design.pattern | https://github.com/mrathena/design.pattern | 0a068b32e670c8856638557be23d93a9bd679ca8 | a65520b5a130cab5b163e9d99665ce5bdcb017d9 | refs/heads/master | 2021-06-03T01:13:15.722000 | 2020-07-02T08:02:08 | 2020-07-02T08:02:08 | 223,210,637 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mrathena.design.pattern.creational.patterns.abstract_.factory.pattern.implement;
/**
* @author mrathena on 2020/4/10 16:01
*/
public abstract class AbstractProduct1 {
}
| UTF-8 | Java | 184 | java | AbstractProduct1.java | Java | [
{
"context": "stract_.factory.pattern.implement;\n\n/**\n * @author mrathena on 2020/4/10 16:01\n */\npublic abstract class Abst",
"end": 117,
"score": 0.9994301795959473,
"start": 109,
"tag": "USERNAME",
"value": "mrathena"
}
] | null | [] | package com.mrathena.design.pattern.creational.patterns.abstract_.factory.pattern.implement;
/**
* @author mrathena on 2020/4/10 16:01
*/
public abstract class AbstractProduct1 {
}
| 184 | 0.771739 | 0.706522 | 7 | 25.285715 | 31.738729 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | false | false | 4 |
11bbd8c6fd839d2166d5a1ee10d6cc1cd2dc1806 | 5,566,277,648,755 | abf7593bb102e79e6d51ba194e483b5203222df2 | /src/main/java/jianye/leetcode/NEW/WordLadder/WordLadder.java | 5b6466f2c5970f33ff2d9b319f5ec0d8bc98c00b | [] | no_license | jianyeyin/leetcode | https://github.com/jianyeyin/leetcode | 70a3c156e399420b8ba50577ade5a49716fc8d5a | 9a9494e6950f6d9d7775b323ccd76615e4324419 | refs/heads/master | 2018-03-10T10:04:43.412000 | 2017-09-14T15:47:10 | 2017-09-14T15:47:10 | 26,627,938 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
WordLadder
Total acceptance: 84356 | Total submission: 428118 | Difficulty: Medium
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:
Only one letter can be changed at a time
Each intermediate word must exist in the word list
For example,
Given:
beginWord = "hit"
endWord = "cog"
wordList = ["hot","dot","dog","lot","log"]
As one shortest transformation is "hit" -> "hot" -> "dot" -> "dog" -> "cog",
return its length 5.
Note:
Return 0 if there is no such transformation sequence.
All words have the same length.
All words contain only lowercase alphabetic characters.
Tags:
Company Tags: N/A
Similar questions:
*/
/*
analysis๏ผ
key words:
requirements:
clarification:
corner cases:
solution:
start with example:
regular method:
improved method:
time and space complexity:
test with examples:
follow up:
knowledge learned:
*/
package jianye.leetcode.WordLadder;
import java.util.*;
public class WordLadder {
public int ladderLength(String beginWord, String endWord, Set<String> wordList) {
}
} | UTF-8 | Java | 1,197 | java | WordLadder.java | Java | [] | null | [] | /*
WordLadder
Total acceptance: 84356 | Total submission: 428118 | Difficulty: Medium
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:
Only one letter can be changed at a time
Each intermediate word must exist in the word list
For example,
Given:
beginWord = "hit"
endWord = "cog"
wordList = ["hot","dot","dog","lot","log"]
As one shortest transformation is "hit" -> "hot" -> "dot" -> "dog" -> "cog",
return its length 5.
Note:
Return 0 if there is no such transformation sequence.
All words have the same length.
All words contain only lowercase alphabetic characters.
Tags:
Company Tags: N/A
Similar questions:
*/
/*
analysis๏ผ
key words:
requirements:
clarification:
corner cases:
solution:
start with example:
regular method:
improved method:
time and space complexity:
test with examples:
follow up:
knowledge learned:
*/
package jianye.leetcode.WordLadder;
import java.util.*;
public class WordLadder {
public int ladderLength(String beginWord, String endWord, Set<String> wordList) {
}
} | 1,197 | 0.704603 | 0.693724 | 66 | 17.121212 | 26.520155 | 160 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.227273 | false | false | 4 |
b69b795c772c7160db7180b4f1061d3e88ca1f1c | 7,945,689,500,953 | 2edc7c5c3e3fe213da2535d6990fda9e87bba00b | /Plumber/src/plumber/PanelSuperior.java | 22de4359e673ba74f1c4a64d938cb9e7c381adaa | [] | no_license | javibodas/Plumber | https://github.com/javibodas/Plumber | df848755aaa48acbb99303c521b4036f0efd7dbf | a4a5ec96c7880f0b7092a3677f834fb5311b78a5 | refs/heads/master | 2021-01-13T01:37:23.671000 | 2014-05-24T09:56:40 | 2014-05-24T09:56:40 | 19,460,473 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package plumber;
import javafx.geometry.Insets;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
/**
*
* @author javier
*/
public class PanelSuperior extends GridPane {
private BarraProgreso time;
private Label moves;
private Label level;
public PanelSuperior(Label moves,Label level,BarraProgreso time){
this.time = time;
this.moves = moves;
this.level = level;
}
public void colocarElementos(){
moves.setFont(Font.font("MOVES:", FontWeight.BOLD, 23));
level.setFont(Font.font("LEVEL:", FontWeight.BOLD, 23));
this.setPadding(new Insets(25,25,25,25));
this.setHgap(10);
this.setVgap(10);
this.add(moves, 0, 0);
this.add(level, 15, 0);
this.add(time, 30, 0);
}
public void setBarraProgreso(BarraProgreso time){
this.time = time;
}
public BarraProgreso getBarraProgreso(){
return this.time;
}
public void setLevel(Nivel level){
this.level = level;
}
public Label getLevel(){
return this.level;
}
public void setMoves(Label moves){
this.moves = moves;
}
public Label getMoves(){
return this.moves;
}
}
| UTF-8 | Java | 1,574 | java | PanelSuperior.java | Java | [
{
"context": "t javafx.scene.text.FontWeight;\n\n/**\n *\n * @author javier\n */\npublic class PanelSuperior extends GridPane {",
"end": 400,
"score": 0.8928925395011902,
"start": 394,
"tag": "USERNAME",
"value": "javier"
}
] | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package plumber;
import javafx.geometry.Insets;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
/**
*
* @author javier
*/
public class PanelSuperior extends GridPane {
private BarraProgreso time;
private Label moves;
private Label level;
public PanelSuperior(Label moves,Label level,BarraProgreso time){
this.time = time;
this.moves = moves;
this.level = level;
}
public void colocarElementos(){
moves.setFont(Font.font("MOVES:", FontWeight.BOLD, 23));
level.setFont(Font.font("LEVEL:", FontWeight.BOLD, 23));
this.setPadding(new Insets(25,25,25,25));
this.setHgap(10);
this.setVgap(10);
this.add(moves, 0, 0);
this.add(level, 15, 0);
this.add(time, 30, 0);
}
public void setBarraProgreso(BarraProgreso time){
this.time = time;
}
public BarraProgreso getBarraProgreso(){
return this.time;
}
public void setLevel(Nivel level){
this.level = level;
}
public Label getLevel(){
return this.level;
}
public void setMoves(Label moves){
this.moves = moves;
}
public Label getMoves(){
return this.moves;
}
}
| 1,574 | 0.611182 | 0.595934 | 70 | 21.485714 | 19.090569 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.628571 | false | false | 4 |
de5a14f5ebebd2e6ddc1e62cf98c5bb7b45564c8 | 8,744,553,469,825 | 64a8a38aa7ced411ea2e03a835976efefd1729d3 | /src/main/java/com/ahmetserdargeze/migrosassesment/solution1/data/entity/CourierNearestStores.java | b367c5dd3a85a4ad36380773cc23683d4c418652 | [] | no_license | ahmetserdargeze/location-service | https://github.com/ahmetserdargeze/location-service | bcb0d397a421de15e06fc3467c0d7367f8506c18 | 28ddae9f744503c05e0449470bb1a09ad95ef53b | refs/heads/master | 2022-11-30T23:21:43.879000 | 2020-08-11T23:56:39 | 2020-08-11T23:56:39 | 286,049,236 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ahmetserdargeze.migrosassesment.solution1.data.entity;
import javax.persistence.Column;
import java.util.Date;
import java.util.UUID;
public class CourierNearestStores {
@Column(name = "store_name")
private String storeName;
@Column(name = "courier_log_id")
private UUID courierLogId;
@Column(name = "distance")
private Double distance;
@Column(name = "activate_date")
private Date activateDate;
@Column(name = "is_notify")
private boolean isNotify;
public CourierNearestStores(String storeName, UUID courierLogId, Double distance, Date activateDate, boolean isNotify) {
this.storeName = storeName;
this.courierLogId = courierLogId;
this.distance = distance;
this.activateDate = activateDate;
this.isNotify = isNotify;
}
public CourierNearestStores() {
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public UUID getCourierLogId() {
return courierLogId;
}
public void setCourierLogId(UUID courierLogId) {
this.courierLogId = courierLogId;
}
public Double getDistance() {
return distance;
}
public void setDistance(Double distance) {
this.distance = distance;
}
public Date getActivateDate() {
return activateDate;
}
public void setActivateDate(Date activateDate) {
this.activateDate = activateDate;
}
public boolean isNotify() {
return isNotify;
}
public void setNotify(boolean notify) {
isNotify = notify;
}
}
| UTF-8 | Java | 1,677 | java | CourierNearestStores.java | Java | [
{
"context": "package com.ahmetserdargeze.migrosassesment.solution1.data.entity;\n\nimport ja",
"end": 27,
"score": 0.7570491433143616,
"start": 14,
"tag": "USERNAME",
"value": "metserdargeze"
}
] | null | [] | package com.ahmetserdargeze.migrosassesment.solution1.data.entity;
import javax.persistence.Column;
import java.util.Date;
import java.util.UUID;
public class CourierNearestStores {
@Column(name = "store_name")
private String storeName;
@Column(name = "courier_log_id")
private UUID courierLogId;
@Column(name = "distance")
private Double distance;
@Column(name = "activate_date")
private Date activateDate;
@Column(name = "is_notify")
private boolean isNotify;
public CourierNearestStores(String storeName, UUID courierLogId, Double distance, Date activateDate, boolean isNotify) {
this.storeName = storeName;
this.courierLogId = courierLogId;
this.distance = distance;
this.activateDate = activateDate;
this.isNotify = isNotify;
}
public CourierNearestStores() {
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public UUID getCourierLogId() {
return courierLogId;
}
public void setCourierLogId(UUID courierLogId) {
this.courierLogId = courierLogId;
}
public Double getDistance() {
return distance;
}
public void setDistance(Double distance) {
this.distance = distance;
}
public Date getActivateDate() {
return activateDate;
}
public void setActivateDate(Date activateDate) {
this.activateDate = activateDate;
}
public boolean isNotify() {
return isNotify;
}
public void setNotify(boolean notify) {
isNotify = notify;
}
}
| 1,677 | 0.658915 | 0.658318 | 73 | 21.972603 | 21.164051 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.383562 | false | false | 4 |
db70e71841f7551d06ba42d6e261e7962bd51204 | 23,502,061,115,182 | 32ab30eb6a4275b1681714b5108f827a79ece3a0 | /src/main/java/fff/aaa/hhh/controller/DeptController_consumer.java | 3968eb5e23ea2164486181e56e12705f5b68742c | [] | no_license | blickindieferne/dept | https://github.com/blickindieferne/dept | c3c3c80dbd95592e0f1cb96f315f37afc0dc2878 | bf087a8715708be35a357727fdf70f770165da57 | refs/heads/master | 2020-03-22T03:13:27.667000 | 2018-07-02T09:14:43 | 2018-07-02T09:14:43 | 139,419,896 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fff.aaa.hhh.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import com.fff.aaa.pojo.Dept;
import com.fff.aaa.service.DeptClientservice;
@RestController
public class DeptController_consumer {
@Autowired
private DeptClientservice deptservice;
@GetMapping("/consumer/dept/add") //pring boot ไผ่ชๅจๆ๏ผๅ้ข็ๅผไธไธๅฏนๅบๅฐ่ฃ
ๅฐdept้ ็ถๅไผ ้
public boolean add(Dept dept) {
return deptservice.add(dept);
}
@GetMapping("/consumer/dept/get/{id}")
public Dept get(@PathVariable("id") Long id) {
return deptservice.get(id);
}
@GetMapping("/consumer/dept/list")
public List<Dept> list() {
System.out.print("123456");
return deptservice.list();
}
}
| UTF-8 | Java | 973 | java | DeptController_consumer.java | Java | [] | null | [] | package fff.aaa.hhh.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import com.fff.aaa.pojo.Dept;
import com.fff.aaa.service.DeptClientservice;
@RestController
public class DeptController_consumer {
@Autowired
private DeptClientservice deptservice;
@GetMapping("/consumer/dept/add") //pring boot ไผ่ชๅจๆ๏ผๅ้ข็ๅผไธไธๅฏนๅบๅฐ่ฃ
ๅฐdept้ ็ถๅไผ ้
public boolean add(Dept dept) {
return deptservice.add(dept);
}
@GetMapping("/consumer/dept/get/{id}")
public Dept get(@PathVariable("id") Long id) {
return deptservice.get(id);
}
@GetMapping("/consumer/dept/list")
public List<Dept> list() {
System.out.print("123456");
return deptservice.list();
}
}
| 973 | 0.734694 | 0.728249 | 37 | 23.162163 | 22.363718 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.972973 | false | false | 4 |
b4592790cbdc093976f7290cd2b24787b1f28d7d | 24,318,104,891,523 | 78cb146adb0f60b2ea6a5eeefcb7e74c10e1d9d3 | /src/test/java/com/ezlo/automation/framework/model/ezlo/data/FWUC_TemplateData.java | bd9755864612fa8c0874c3d43367f4c4e5c536ca | [] | no_license | DmytroSych/framework_for_learning | https://github.com/DmytroSych/framework_for_learning | ab0d6a629fe7096b37dfc4df64446c41d64fb125 | 6c8d13aeafd0bd8593f896255975714d7f7922d8 | refs/heads/master | 2020-05-23T13:37:07.056000 | 2018-12-31T12:37:02 | 2018-12-31T12:37:02 | 186,781,521 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ezlo.automation.framework.model.ezlo.data;
import com.ezlo.automation.framework.model.ezlo.inner.StyleData;
import com.ezlo.automation.framework.model.ezlo.inner.TemplateData;
import com.google.gson.annotations.Expose;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Embedded;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Property;
import java.util.List;
import java.util.Objects;
@Entity(value = "FWUC_templates", noClassnameStored = true)
public class FWUC_TemplateData {
@Id
@Expose
@Property("_id")
private ObjectId id;
@Expose
private String name;
@Embedded
@Expose
private List<StyleData> styles;
@Embedded
@Expose
private List<TemplateData> templates;
public FWUC_TemplateData() {
}
public FWUC_TemplateData withId(ObjectId id) {
this.id = id;
return this;
}
public FWUC_TemplateData withName(String name) {
this.name = name;
return this;
}
public FWUC_TemplateData withStyles(List<StyleData> styles) {
this.styles = styles;
return this;
}
public FWUC_TemplateData withTemplates(List<TemplateData> templates) {
this.templates = templates;
return this;
}
public ObjectId getId() {
return id;
}
public String getName() {
return name;
}
public List<StyleData> getStyles() {
return styles;
}
public List<TemplateData> getTemplates() {
return templates;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof FWUC_TemplateData)) return false;
FWUC_TemplateData that = (FWUC_TemplateData) o;
return Objects.equals(id, that.id) &&
Objects.equals(name, that.name) &&
Objects.equals(styles, that.styles) &&
Objects.equals(templates, that.templates);
}
@Override
public int hashCode() {
return Objects.hash(id, name, styles, templates);
}
@Override
public String toString() {
return "FWUC_TemplateData{" +
"id=" + id +
", name='" + name + '\'' +
", styles=" + styles +
", templates=" + templates +
'}';
}
}
| UTF-8 | Java | 2,404 | java | FWUC_TemplateData.java | Java | [] | null | [] | package com.ezlo.automation.framework.model.ezlo.data;
import com.ezlo.automation.framework.model.ezlo.inner.StyleData;
import com.ezlo.automation.framework.model.ezlo.inner.TemplateData;
import com.google.gson.annotations.Expose;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Embedded;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Property;
import java.util.List;
import java.util.Objects;
@Entity(value = "FWUC_templates", noClassnameStored = true)
public class FWUC_TemplateData {
@Id
@Expose
@Property("_id")
private ObjectId id;
@Expose
private String name;
@Embedded
@Expose
private List<StyleData> styles;
@Embedded
@Expose
private List<TemplateData> templates;
public FWUC_TemplateData() {
}
public FWUC_TemplateData withId(ObjectId id) {
this.id = id;
return this;
}
public FWUC_TemplateData withName(String name) {
this.name = name;
return this;
}
public FWUC_TemplateData withStyles(List<StyleData> styles) {
this.styles = styles;
return this;
}
public FWUC_TemplateData withTemplates(List<TemplateData> templates) {
this.templates = templates;
return this;
}
public ObjectId getId() {
return id;
}
public String getName() {
return name;
}
public List<StyleData> getStyles() {
return styles;
}
public List<TemplateData> getTemplates() {
return templates;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof FWUC_TemplateData)) return false;
FWUC_TemplateData that = (FWUC_TemplateData) o;
return Objects.equals(id, that.id) &&
Objects.equals(name, that.name) &&
Objects.equals(styles, that.styles) &&
Objects.equals(templates, that.templates);
}
@Override
public int hashCode() {
return Objects.hash(id, name, styles, templates);
}
@Override
public String toString() {
return "FWUC_TemplateData{" +
"id=" + id +
", name='" + name + '\'' +
", styles=" + styles +
", templates=" + templates +
'}';
}
}
| 2,404 | 0.619384 | 0.619384 | 94 | 24.574469 | 20.156034 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.468085 | false | false | 4 |
e7c511ba4f33959d72643d36b67d9a4d9fe736e0 | 22,247,930,600,470 | 419301664e23e8b753852b8c15a9c00719c0d023 | /src/edu/wpi/bagcsp/CSP.java | fcfe87e37f2afbe3dfdcf1c3d19b0838719e8608 | [] | no_license | chickenbellyfinn/BagPackCSP | https://github.com/chickenbellyfinn/BagPackCSP | 26eedb51d153be6e995f77cbdc5313a4bf48c040 | 5c9dd2b7432f33c99e3234a12a2c91832aeffea1 | refs/heads/master | 2018-01-08T18:03:52.120000 | 2016-02-22T04:31:47 | 2016-02-22T04:31:47 | 52,183,626 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.wpi.bagcsp;
import edu.wpi.bagcsp.constraints.Constraint;
import edu.wpi.bagcsp.orderingheuristics.DefaultOrdering;
import edu.wpi.bagcsp.orderingheuristics.MRVAndDegreeHeuristic;
import edu.wpi.bagcsp.orderingheuristics.OrderingHeuristic;
import java.util.*;
import java.util.stream.IntStream;
/*
CS4341 - Artificial Intelligence - WPI - Project 5
Akshay Thejaswi
William Hartman
*/
/**
* Created by Akshay on 2/20/2016.
*/
public class CSP {
public final List<Item> items;
public final List<Bag> bags;
public final List<Constraint> constraints;
public static boolean enableMRV = false;
public static boolean enableDegrees = false;
public static boolean enableLCV = false;
public static boolean enableForwardCheck = false;
public CSP() {
items = new ArrayList<>();
bags = new ArrayList<>();
constraints = new ArrayList<>();
}
public List<Assignment> backtrack(){
OrderingHeuristic ordering = enableMRV ? new MRVAndDegreeHeuristic(this): new DefaultOrdering(this);
return backtrack(new Domain(this), new ArrayList<Assignment>(), ordering);
}
private List<Assignment> backtrack(Domain domain, List<Assignment> assignments, OrderingHeuristic heuristic){
List<Assignment> solution = null;
int result = checkConstraints(assignments);
if(assignments.size() == items.size() && result == Constraint.RESULT_PASS){ //check if solved
//System.out.println(assignments);
//return null;
return assignments;
} else if (result == Constraint.RESULT_IGNORE || result == Constraint.RESULT_PASS) { //check if "incomplete"
Domain subDomain = domain.copy();
assignments.forEach(a -> subDomain.remove(a.item));
if(enableForwardCheck) {
forwardCheck(subDomain, assignments);
}
Item nextItem = heuristic.getNextItem(subDomain); //get the next item to try assigning
//check that domain has possible values for every variable
if(!subDomain.solvable()){
// System.out.println("Not solvable");
return null;
}
if(enableLCV) {
orderLeastConstraining(nextItem, subDomain, assignments);
}
List<Bag> availableBags = subDomain.get(nextItem);
for(Bag bag:availableBags){
List<Assignment> nextList = new ArrayList<>(assignments);
nextList.add(new Assignment(nextItem, bag));
for(Constraint c:constraints){
nextList.addAll(c.getInferences(nextList));
}
solution = backtrack(subDomain, nextList, heuristic);
//a valid solution was found
if(solution != null){
return solution;
}
}
}
return null;
}
private void forwardCheck(Domain domain, List<Assignment> assignments){
Assignment proposed = new Assignment(null, null);
assignments.add(proposed);
for(Item item:domain.keySet()){
proposed.item = item;
List<Bag> dbags = new ArrayList<>(domain.get(item));
fwbag:for(Bag bag:dbags){
proposed.bag = bag;
for(Constraint constraint:constraints){
if(constraint.check(assignments) == Constraint.RESULT_FAIL){
domain.removeDomainValue(item, bag);
break fwbag;
}
}
}
}
assignments.remove(proposed);
// return domain;
}
private void orderLeastConstraining(Item item, Domain domain, List<Assignment> assignments){
//sort the item's bags in the domain by the possible values of the other items
List<Bag> values = domain.get(item);
final HashMap<Bag, Integer> neighborOptions = new HashMap<Bag, Integer>();
//forwardCheck each bag, and save the # of options available after
Assignment proposed = new Assignment(item, null);
assignments.add(proposed);
for(Bag b:values){
proposed.bag = b;
Domain constrainedDomain = domain.copy();
constrainedDomain.remove(item);
forwardCheck(constrainedDomain, assignments);
neighborOptions.put(b, constrainedDomain.totalValueCount());
}
assignments.remove(proposed);
Collections.sort(values, new Comparator<Bag>() {
@Override
public int compare(Bag a, Bag b) {
return neighborOptions.get(b) - neighborOptions.get(a);
}
});
}
public boolean isComplete(List<Assignment> assignments){
return assignments.size() == items.size();
}
/**
* Checks the assignments against the constraints
* @param assignments
* @return the lowest-value result (Constraint.RSEULT_PASS, Constraint.RESULT_IGNORE, Constraint.RESULT_FAIL)
*/
private int checkConstraints(List<Assignment> assignments){
int result = Constraint.RESULT_PASS;
for(Constraint c:constraints){
result = Math.min(result, c.check(assignments));
}
return result;
}
public Bag getBag(String name){
for(Bag bag:bags){
if(bag.name.equals(name)){
return bag;
}
}
return null;
}
public Item getItem(String name){
for(Item item:items){
if(item.name.equals(name)){
return item;
}
}
return null;
}
public void print(){
if(items.size() > 0) {
System.out.println("ITEMS");
items.stream().forEach(i -> System.out.printf("%s, %d\n", i.name, i.weight));
}
if(bags.size() > 0) {
System.out.println("\nBAGS");
bags.stream().forEach(b -> System.out.printf("%s, %d\n", b.name, b.limit));
}
if(constraints.size() > 0) {
System.out.println("\nCONSTRAINTS");
constraints.stream().forEach(c -> System.out.println(c.toString()));
}
}
}
| UTF-8 | Java | 6,265 | java | CSP.java | Java | [
{
"context": "S4341 - Artificial Intelligence - WPI - Project 5\nAkshay Thejaswi\nWilliam Hartman\n */\n\n/**\n * Created by Akshay on ",
"end": 379,
"score": 0.9998688697814941,
"start": 364,
"tag": "NAME",
"value": "Akshay Thejaswi"
},
{
"context": "al Intelligence - WPI - Project ... | null | [] | package edu.wpi.bagcsp;
import edu.wpi.bagcsp.constraints.Constraint;
import edu.wpi.bagcsp.orderingheuristics.DefaultOrdering;
import edu.wpi.bagcsp.orderingheuristics.MRVAndDegreeHeuristic;
import edu.wpi.bagcsp.orderingheuristics.OrderingHeuristic;
import java.util.*;
import java.util.stream.IntStream;
/*
CS4341 - Artificial Intelligence - WPI - Project 5
<NAME>
<NAME>
*/
/**
* Created by Akshay on 2/20/2016.
*/
public class CSP {
public final List<Item> items;
public final List<Bag> bags;
public final List<Constraint> constraints;
public static boolean enableMRV = false;
public static boolean enableDegrees = false;
public static boolean enableLCV = false;
public static boolean enableForwardCheck = false;
public CSP() {
items = new ArrayList<>();
bags = new ArrayList<>();
constraints = new ArrayList<>();
}
public List<Assignment> backtrack(){
OrderingHeuristic ordering = enableMRV ? new MRVAndDegreeHeuristic(this): new DefaultOrdering(this);
return backtrack(new Domain(this), new ArrayList<Assignment>(), ordering);
}
private List<Assignment> backtrack(Domain domain, List<Assignment> assignments, OrderingHeuristic heuristic){
List<Assignment> solution = null;
int result = checkConstraints(assignments);
if(assignments.size() == items.size() && result == Constraint.RESULT_PASS){ //check if solved
//System.out.println(assignments);
//return null;
return assignments;
} else if (result == Constraint.RESULT_IGNORE || result == Constraint.RESULT_PASS) { //check if "incomplete"
Domain subDomain = domain.copy();
assignments.forEach(a -> subDomain.remove(a.item));
if(enableForwardCheck) {
forwardCheck(subDomain, assignments);
}
Item nextItem = heuristic.getNextItem(subDomain); //get the next item to try assigning
//check that domain has possible values for every variable
if(!subDomain.solvable()){
// System.out.println("Not solvable");
return null;
}
if(enableLCV) {
orderLeastConstraining(nextItem, subDomain, assignments);
}
List<Bag> availableBags = subDomain.get(nextItem);
for(Bag bag:availableBags){
List<Assignment> nextList = new ArrayList<>(assignments);
nextList.add(new Assignment(nextItem, bag));
for(Constraint c:constraints){
nextList.addAll(c.getInferences(nextList));
}
solution = backtrack(subDomain, nextList, heuristic);
//a valid solution was found
if(solution != null){
return solution;
}
}
}
return null;
}
private void forwardCheck(Domain domain, List<Assignment> assignments){
Assignment proposed = new Assignment(null, null);
assignments.add(proposed);
for(Item item:domain.keySet()){
proposed.item = item;
List<Bag> dbags = new ArrayList<>(domain.get(item));
fwbag:for(Bag bag:dbags){
proposed.bag = bag;
for(Constraint constraint:constraints){
if(constraint.check(assignments) == Constraint.RESULT_FAIL){
domain.removeDomainValue(item, bag);
break fwbag;
}
}
}
}
assignments.remove(proposed);
// return domain;
}
private void orderLeastConstraining(Item item, Domain domain, List<Assignment> assignments){
//sort the item's bags in the domain by the possible values of the other items
List<Bag> values = domain.get(item);
final HashMap<Bag, Integer> neighborOptions = new HashMap<Bag, Integer>();
//forwardCheck each bag, and save the # of options available after
Assignment proposed = new Assignment(item, null);
assignments.add(proposed);
for(Bag b:values){
proposed.bag = b;
Domain constrainedDomain = domain.copy();
constrainedDomain.remove(item);
forwardCheck(constrainedDomain, assignments);
neighborOptions.put(b, constrainedDomain.totalValueCount());
}
assignments.remove(proposed);
Collections.sort(values, new Comparator<Bag>() {
@Override
public int compare(Bag a, Bag b) {
return neighborOptions.get(b) - neighborOptions.get(a);
}
});
}
public boolean isComplete(List<Assignment> assignments){
return assignments.size() == items.size();
}
/**
* Checks the assignments against the constraints
* @param assignments
* @return the lowest-value result (Constraint.RSEULT_PASS, Constraint.RESULT_IGNORE, Constraint.RESULT_FAIL)
*/
private int checkConstraints(List<Assignment> assignments){
int result = Constraint.RESULT_PASS;
for(Constraint c:constraints){
result = Math.min(result, c.check(assignments));
}
return result;
}
public Bag getBag(String name){
for(Bag bag:bags){
if(bag.name.equals(name)){
return bag;
}
}
return null;
}
public Item getItem(String name){
for(Item item:items){
if(item.name.equals(name)){
return item;
}
}
return null;
}
public void print(){
if(items.size() > 0) {
System.out.println("ITEMS");
items.stream().forEach(i -> System.out.printf("%s, %d\n", i.name, i.weight));
}
if(bags.size() > 0) {
System.out.println("\nBAGS");
bags.stream().forEach(b -> System.out.printf("%s, %d\n", b.name, b.limit));
}
if(constraints.size() > 0) {
System.out.println("\nCONSTRAINTS");
constraints.stream().forEach(c -> System.out.println(c.toString()));
}
}
}
| 6,247 | 0.587709 | 0.585315 | 194 | 31.293814 | 28.038656 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.551546 | false | false | 4 |
309d5e5526f671ec92eb10f995253dc42e322711 | 24,421,184,051,975 | ae0414a3e59791a0b8a09f510a8be7de2f2d5e13 | /app/src/main/java/com/example/phamn/learningtoeic/Model/QuestionPart2.java | 94eb88119a242980d56582afa013d9ad9d27aa52 | [] | no_license | phamnhatduy/AppToeic | https://github.com/phamnhatduy/AppToeic | eefb92a4e7b63e3c0311929653b64c5c1b89921f | e8fa783fa0299d3e337ff1bf205e5ca952107e09 | refs/heads/master | 2020-03-31T07:24:47.917000 | 2019-07-21T14:03:36 | 2019-07-21T14:03:36 | 152,020,942 | 0 | 1 | null | false | 2019-07-21T14:03:37 | 2018-10-08T05:02:14 | 2019-07-21T02:09:56 | 2019-07-21T14:03:37 | 9,945 | 0 | 1 | 0 | Java | false | false | package com.example.phamn.learningtoeic.Model;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
public class QuestionPart2 implements Serializable{
@SerializedName("number")
private int number;
@SerializedName("questionContent")
private String questionContent;
@SerializedName("answerA")
private String answerA;
@SerializedName("answerB")
private String answerB;
@SerializedName("answerC")
private String answerC;
@SerializedName("correctAnswer")
private String correctAnswer;
public QuestionPart2(int number, String questionContent, String answerA, String answerB, String answerC, String correctAnswer) {
this.number = number;
this.questionContent = questionContent;
this.answerA = answerA;
this.answerB = answerB;
this.answerC = answerC;
this.correctAnswer = correctAnswer;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public String getAnswerA() {
return answerA;
}
public void setAnswerA(String answerA) {
this.answerA = answerA;
}
public String getAnswerB() {
return answerB;
}
public void setAnswerB(String answerB) {
this.answerB = answerB;
}
public String getAnswerC() {
return answerC;
}
public void setAnswerC(String answerC) {
this.answerC = answerC;
}
public String getCorrectAnswer() {
return correctAnswer;
}
public void setCorrectAnswer(String correctAnswer) {
this.correctAnswer = correctAnswer;
}
public String getQuestionContent() {
return questionContent;
}
public void setQuestionContent(String questionContent) {
this.questionContent = questionContent;
}
} | UTF-8 | Java | 1,878 | java | QuestionPart2.java | Java | [] | null | [] | package com.example.phamn.learningtoeic.Model;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
public class QuestionPart2 implements Serializable{
@SerializedName("number")
private int number;
@SerializedName("questionContent")
private String questionContent;
@SerializedName("answerA")
private String answerA;
@SerializedName("answerB")
private String answerB;
@SerializedName("answerC")
private String answerC;
@SerializedName("correctAnswer")
private String correctAnswer;
public QuestionPart2(int number, String questionContent, String answerA, String answerB, String answerC, String correctAnswer) {
this.number = number;
this.questionContent = questionContent;
this.answerA = answerA;
this.answerB = answerB;
this.answerC = answerC;
this.correctAnswer = correctAnswer;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public String getAnswerA() {
return answerA;
}
public void setAnswerA(String answerA) {
this.answerA = answerA;
}
public String getAnswerB() {
return answerB;
}
public void setAnswerB(String answerB) {
this.answerB = answerB;
}
public String getAnswerC() {
return answerC;
}
public void setAnswerC(String answerC) {
this.answerC = answerC;
}
public String getCorrectAnswer() {
return correctAnswer;
}
public void setCorrectAnswer(String correctAnswer) {
this.correctAnswer = correctAnswer;
}
public String getQuestionContent() {
return questionContent;
}
public void setQuestionContent(String questionContent) {
this.questionContent = questionContent;
}
} | 1,878 | 0.666667 | 0.665602 | 77 | 23.402597 | 21.408979 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.415584 | false | false | 4 |
44d780be982b5c5c7e319b13ffb2133931080ed0 | 3,100,966,450,369 | f8abd7afa79432599a5a5f869b7b8c26cc720ccc | /src/nyat_proje/Kullanici.java | 5dd5893db9511e6afecaa77e8831d9014e5b4c98 | [] | no_license | Kayahan24/NYAT-Proje | https://github.com/Kayahan24/NYAT-Proje | 7253b1a99421c0458ce721c171e04fb95c8084ba | 19b242b26161e66754e268cec94a5d65d5a37136 | refs/heads/main | 2023-04-29T09:46:57.075000 | 2021-05-17T12:41:34 | 2021-05-17T12:41:34 | 368,180,357 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package nyat_proje;
public class Kullanici {
//fields
private final int id;
private final String kullaniciAdi;
private final String parola;
private final String ad;
private final String soyad;
private final String telefon;
private final String adres;
private boolean isLogin=false;
private static int hak=3;
//injection builder to constructor
private Kullanici(KullaniciBuilder builder) {
this.id=builder.id;
this.kullaniciAdi=builder.kullaniciAdi;
this.parola=builder.parola;
this.ad=builder.ad;
this.soyad=builder.soyad;
this.telefon=builder.telefon;
this.adres=builder.adres;
}
//getter methods
public int getId() {
return this.id;
}
public String getKullaniciAdi() {
return this.kullaniciAdi;
}
public String getParola() {
return this.parola;
}
public String getAd() {
return this.ad;
}
public String getSoyad() {
return this.soyad;
}
public String getTelefon() {
return this.telefon;
}
public String getAdres() {
return this.adres;
}
public boolean getIsLogin() {
return this.isLogin;
}
public int getHak() {
return this.hak;
}
public void setHak(int hak) {
this.hak=hak;
}
public void setIsLogin(boolean isLogin) {
this.isLogin=isLogin;
}
@Override
public String toString() {
return "Kullanici Adฤฑ: "+this.kullaniciAdi+"\nKullanฤฑcฤฑ Parolasฤฑ: "+this.parola+"\n";
}
//Builder inner class
public static class KullaniciBuilder
{
private int id;
private String kullaniciAdi;
private String parola;
private String ad;
private String soyad;
private String telefon;
private String adres;
public KullaniciBuilder id(int id) {
this.id = id;
return this;
}
public KullaniciBuilder kullaniciAdi(String kullaniciAdi) {
this.kullaniciAdi = kullaniciAdi;
return this;
}
public KullaniciBuilder parola(String parola) {
this.parola=parola;
return this;
}
public KullaniciBuilder ad(String ad) {
this.ad=ad;
return this;
}
public KullaniciBuilder soyad(String soyad) {
this.soyad=soyad;
return this;
}
public KullaniciBuilder telefon(String telefon) {
this.telefon=telefon;
return this;
}
public KullaniciBuilder adres(String adres) {
this.adres=adres;
return this;
}
//Return the finally constructed User object
public Kullanici build() {
Kullanici kullanici = new Kullanici(this);
return kullanici;
}
}
}
| ISO-8859-9 | Java | 2,852 | java | Kullanici.java | Java | [] | null | [] | package nyat_proje;
public class Kullanici {
//fields
private final int id;
private final String kullaniciAdi;
private final String parola;
private final String ad;
private final String soyad;
private final String telefon;
private final String adres;
private boolean isLogin=false;
private static int hak=3;
//injection builder to constructor
private Kullanici(KullaniciBuilder builder) {
this.id=builder.id;
this.kullaniciAdi=builder.kullaniciAdi;
this.parola=builder.parola;
this.ad=builder.ad;
this.soyad=builder.soyad;
this.telefon=builder.telefon;
this.adres=builder.adres;
}
//getter methods
public int getId() {
return this.id;
}
public String getKullaniciAdi() {
return this.kullaniciAdi;
}
public String getParola() {
return this.parola;
}
public String getAd() {
return this.ad;
}
public String getSoyad() {
return this.soyad;
}
public String getTelefon() {
return this.telefon;
}
public String getAdres() {
return this.adres;
}
public boolean getIsLogin() {
return this.isLogin;
}
public int getHak() {
return this.hak;
}
public void setHak(int hak) {
this.hak=hak;
}
public void setIsLogin(boolean isLogin) {
this.isLogin=isLogin;
}
@Override
public String toString() {
return "Kullanici Adฤฑ: "+this.kullaniciAdi+"\nKullanฤฑcฤฑ Parolasฤฑ: "+this.parola+"\n";
}
//Builder inner class
public static class KullaniciBuilder
{
private int id;
private String kullaniciAdi;
private String parola;
private String ad;
private String soyad;
private String telefon;
private String adres;
public KullaniciBuilder id(int id) {
this.id = id;
return this;
}
public KullaniciBuilder kullaniciAdi(String kullaniciAdi) {
this.kullaniciAdi = kullaniciAdi;
return this;
}
public KullaniciBuilder parola(String parola) {
this.parola=parola;
return this;
}
public KullaniciBuilder ad(String ad) {
this.ad=ad;
return this;
}
public KullaniciBuilder soyad(String soyad) {
this.soyad=soyad;
return this;
}
public KullaniciBuilder telefon(String telefon) {
this.telefon=telefon;
return this;
}
public KullaniciBuilder adres(String adres) {
this.adres=adres;
return this;
}
//Return the finally constructed User object
public Kullanici build() {
Kullanici kullanici = new Kullanici(this);
return kullanici;
}
}
}
| 2,852 | 0.60007 | 0.599719 | 110 | 24.890909 | 15.732621 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.754545 | false | false | 4 |
d7a58298f27609dd54018addb1293796013997c2 | 6,442,451,009,902 | caf962e0810e2afc480039dfc0d714cd8ed83637 | /se/backend/src/main/java/ro/stackoverflowpioneers/ConferenceManagementSystem/Controller/FileUploadController.java | fb50ad316d6d5fd5ffad3bef2582551104762152 | [] | no_license | razvanw0w/university | https://github.com/razvanw0w/university | 35e4afd1b9b774a074d5041e68a74acee1c5b172 | 78a40bdff2c69a2029712b39941bda365be21e4b | refs/heads/master | 2020-12-28T05:28:56.625000 | 2020-10-12T16:04:52 | 2020-10-12T16:04:52 | 238,196,889 | 0 | 8 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ro.stackoverflowpioneers.ConferenceManagementSystem.Controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import ro.stackoverflowpioneers.ConferenceManagementSystem.Repository.StorageRepository;
@CrossOrigin(origins = "*", allowedHeaders = "*")
@Controller
public class FileUploadController {
@Autowired
private final StorageRepository storageRepository;
@Autowired
public FileUploadController(StorageRepository storageRepository) {
this.storageRepository = storageRepository;
}
// @GetMapping("/files/{filename:.+}")
// @ResponseBody
// public ResponseEntity<Resource> serveFile(@PathVariable String filename) {
//
// Resource file = storageRepository.loadAsResource(filename);
// return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION,
// "attachment; filename=\"" + file.getFilename() + "\"").body(file);
// }
@PostMapping(value = "/upload",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity handleFileUpload(@RequestParam MultipartFile file,
// RedirectAttributes redirectAttributes,
@RequestParam String extraString) {
System.out.println("Got the file");
System.out.println("Got the string" + extraString);
storageRepository.store(file);
return ResponseEntity.ok().build();
// redirectAttributes.addFlashAttribute("message",
// "You successfully uploaded " + file.getOriginalFilename() + "!");
}
// @ExceptionHandler(StorageFileNotFoundException.class)
// public ResponseEntity<?> handleStorageFileNotFound(StorageFileNotFoundException exc) {
// return ResponseEntity.notFound().build();
// }
} | UTF-8 | Java | 2,198 | java | FileUploadController.java | Java | [] | null | [] | package ro.stackoverflowpioneers.ConferenceManagementSystem.Controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import ro.stackoverflowpioneers.ConferenceManagementSystem.Repository.StorageRepository;
@CrossOrigin(origins = "*", allowedHeaders = "*")
@Controller
public class FileUploadController {
@Autowired
private final StorageRepository storageRepository;
@Autowired
public FileUploadController(StorageRepository storageRepository) {
this.storageRepository = storageRepository;
}
// @GetMapping("/files/{filename:.+}")
// @ResponseBody
// public ResponseEntity<Resource> serveFile(@PathVariable String filename) {
//
// Resource file = storageRepository.loadAsResource(filename);
// return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION,
// "attachment; filename=\"" + file.getFilename() + "\"").body(file);
// }
@PostMapping(value = "/upload",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity handleFileUpload(@RequestParam MultipartFile file,
// RedirectAttributes redirectAttributes,
@RequestParam String extraString) {
System.out.println("Got the file");
System.out.println("Got the string" + extraString);
storageRepository.store(file);
return ResponseEntity.ok().build();
// redirectAttributes.addFlashAttribute("message",
// "You successfully uploaded " + file.getOriginalFilename() + "!");
}
// @ExceptionHandler(StorageFileNotFoundException.class)
// public ResponseEntity<?> handleStorageFileNotFound(StorageFileNotFoundException exc) {
// return ResponseEntity.notFound().build();
// }
} | 2,198 | 0.724295 | 0.724295 | 56 | 38.267857 | 30.551182 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 4 |
3504f2967575e29cb373dc0051013dc346e6d8db | 8,246,337,214,008 | f0b5b8f0a0b5991b3969e6d8e362742e5d6384e1 | /src/main/java/com/firerms/controller/InspectionImageController.java | ec66c4a10818c3ca8b1a2887071284dd6328f65a | [] | no_license | jfc5091/Inspection-Service | https://github.com/jfc5091/Inspection-Service | a7f9e6bfe3c27ae9abfacf9cdc16c9226b25a4b2 | afcaa49a87540c0bbe42ff4015f92a65c8db482b | refs/heads/master | 2023-04-18T11:44:17.860000 | 2021-05-03T17:37:14 | 2021-05-03T17:37:14 | 354,126,973 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.firerms.controller;
import com.amazonaws.AmazonServiceException;
import com.firerms.exception.EntityNotFoundException;
import com.firerms.exception.InspectionExceptionHandler;
import com.firerms.service.InspectionImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
@CrossOrigin
@RestController
@RequestMapping("/inspection/{id}/image")
public class InspectionImageController {
@Autowired
private InspectionImageService inspectionImageService;
@Autowired
private InspectionExceptionHandler inspectionExceptionHandler;
@PostMapping(value = "/add", consumes ={ MediaType.MULTIPART_FORM_DATA_VALUE })
public ResponseEntity<Object> addInspectionImage(@RequestPart(value = "image") MultipartFile image,
@RequestPart(value = "signatureType") String type,
@PathVariable("id") Long inspectionId) throws IOException {
try {
inspectionImageService.addInspectionImage(image, inspectionId, type);
return ResponseEntity.noContent().build();
}
catch (EntityNotFoundException e) {
return ResponseEntity.status(inspectionExceptionHandler.entityNotFoundException(e).getStatusCode())
.body(inspectionExceptionHandler.entityNotFoundException(e).getBody());
}
catch (AmazonServiceException e) {
return ResponseEntity.status(inspectionExceptionHandler.amazonServiceException(e).getStatusCode())
.body(inspectionExceptionHandler.amazonServiceException(e).getBody());
}
}
@DeleteMapping("/delete")
public ResponseEntity<Object> deleteInspectionImage(@RequestPart(value = "imageUrl") String imageUrl,
@RequestPart(value = "signatureType") String type,
@PathVariable("id") Long inspectionId) {
try {
inspectionImageService.deleteInspectionImage(imageUrl, inspectionId, type);
return ResponseEntity.noContent().build();
}
catch (EntityNotFoundException e) {
return ResponseEntity.status(inspectionExceptionHandler.entityNotFoundException(e).getStatusCode())
.body(inspectionExceptionHandler.entityNotFoundException(e).getBody());
}
catch (AmazonServiceException e) {
return ResponseEntity.status(inspectionExceptionHandler.amazonServiceException(e).getStatusCode())
.body(inspectionExceptionHandler.amazonServiceException(e).getBody());
}
}
}
| UTF-8 | Java | 2,911 | java | InspectionImageController.java | Java | [] | null | [] | package com.firerms.controller;
import com.amazonaws.AmazonServiceException;
import com.firerms.exception.EntityNotFoundException;
import com.firerms.exception.InspectionExceptionHandler;
import com.firerms.service.InspectionImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
@CrossOrigin
@RestController
@RequestMapping("/inspection/{id}/image")
public class InspectionImageController {
@Autowired
private InspectionImageService inspectionImageService;
@Autowired
private InspectionExceptionHandler inspectionExceptionHandler;
@PostMapping(value = "/add", consumes ={ MediaType.MULTIPART_FORM_DATA_VALUE })
public ResponseEntity<Object> addInspectionImage(@RequestPart(value = "image") MultipartFile image,
@RequestPart(value = "signatureType") String type,
@PathVariable("id") Long inspectionId) throws IOException {
try {
inspectionImageService.addInspectionImage(image, inspectionId, type);
return ResponseEntity.noContent().build();
}
catch (EntityNotFoundException e) {
return ResponseEntity.status(inspectionExceptionHandler.entityNotFoundException(e).getStatusCode())
.body(inspectionExceptionHandler.entityNotFoundException(e).getBody());
}
catch (AmazonServiceException e) {
return ResponseEntity.status(inspectionExceptionHandler.amazonServiceException(e).getStatusCode())
.body(inspectionExceptionHandler.amazonServiceException(e).getBody());
}
}
@DeleteMapping("/delete")
public ResponseEntity<Object> deleteInspectionImage(@RequestPart(value = "imageUrl") String imageUrl,
@RequestPart(value = "signatureType") String type,
@PathVariable("id") Long inspectionId) {
try {
inspectionImageService.deleteInspectionImage(imageUrl, inspectionId, type);
return ResponseEntity.noContent().build();
}
catch (EntityNotFoundException e) {
return ResponseEntity.status(inspectionExceptionHandler.entityNotFoundException(e).getStatusCode())
.body(inspectionExceptionHandler.entityNotFoundException(e).getBody());
}
catch (AmazonServiceException e) {
return ResponseEntity.status(inspectionExceptionHandler.amazonServiceException(e).getStatusCode())
.body(inspectionExceptionHandler.amazonServiceException(e).getBody());
}
}
}
| 2,911 | 0.683614 | 0.683614 | 61 | 46.72131 | 37.48798 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.491803 | false | false | 4 |
134921496df5e65083ba7fda4bba8751132cd255 | 12,283,606,471,451 | cdef3843e6f38f5645acb5bde26a86bf57baaec1 | /src/main/java/com/sample/repo/dao/PersonDAOImpl.java | df38a54975902330f2fd7ce2c0126c58e21a18a3 | [] | no_license | sophea/test-github-api-sample | https://github.com/sophea/test-github-api-sample | 2ffc75506f2273f1554a4801d532b89c15426f7b | e6564ff2d01d10f0ac48f3fc9e466cb1ca7d2d7b | refs/heads/master | 2020-04-13T04:16:27.680000 | 2016-12-09T06:40:51 | 2016-12-09T06:40:51 | 68,021,275 | 0 | 1 | null | false | 2016-11-30T06:54:36 | 2016-09-12T15:22:12 | 2016-09-12T15:48:00 | 2016-11-30T06:54:36 | 45 | 0 | 0 | 0 | Java | null | null | package com.sample.repo.dao;
import java.util.List;
import org.hibernate.LockMode;
import org.hibernate.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.stereotype.Repository;
import com.sample.repo.domain.Person;
@Repository
public class PersonDAOImpl implements PersonDAO {
private static final Logger logger = LoggerFactory.getLogger(PersonDAOImpl.class);
@Autowired
private LocalSessionFactoryBean sessionFactory;
@Override
public void create(Person p) {
Session session = this.sessionFactory.getObject().getCurrentSession();
session.persist(p);
logger.info("Person saved successfully, Person Details=" + p);
}
@Override
public void update(Person p) {
Session session = this.sessionFactory.getObject().getCurrentSession();
session.saveOrUpdate(p);
logger.info("Person updated successfully, Person Details=" + p);
}
@SuppressWarnings("unchecked")
@Override
public List<Person> listPersons() {
Session session = this.sessionFactory.getObject().getCurrentSession();
List<Person> personsList = session.createQuery("from Person").list();
for (Person p : personsList) {
logger.info("Person List::" + p);
}
return personsList;
}
@Override
public Person getPersonById(long id) {
Session session = this.sessionFactory.getObject().getCurrentSession();
Person p = (Person) session.get(Person.class, new Long(id));
logger.info("Person loaded successfully, Person details=" + p);
//check null first
if (p != null) {
//detach your first entity from session - session.evict(myEntity)
session.evict(p);
}
return p;
}
@Override
public void removePerson(long id) {
Session session = this.sessionFactory.getObject().getCurrentSession();
Person p = (Person) session.load(Person.class, new Long(id));
if (null != p) {
session.delete(p);
}
logger.info("Person deleted successfully, person details=" + p);
}
}
| UTF-8 | Java | 2,284 | java | PersonDAOImpl.java | Java | [] | null | [] | package com.sample.repo.dao;
import java.util.List;
import org.hibernate.LockMode;
import org.hibernate.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.stereotype.Repository;
import com.sample.repo.domain.Person;
@Repository
public class PersonDAOImpl implements PersonDAO {
private static final Logger logger = LoggerFactory.getLogger(PersonDAOImpl.class);
@Autowired
private LocalSessionFactoryBean sessionFactory;
@Override
public void create(Person p) {
Session session = this.sessionFactory.getObject().getCurrentSession();
session.persist(p);
logger.info("Person saved successfully, Person Details=" + p);
}
@Override
public void update(Person p) {
Session session = this.sessionFactory.getObject().getCurrentSession();
session.saveOrUpdate(p);
logger.info("Person updated successfully, Person Details=" + p);
}
@SuppressWarnings("unchecked")
@Override
public List<Person> listPersons() {
Session session = this.sessionFactory.getObject().getCurrentSession();
List<Person> personsList = session.createQuery("from Person").list();
for (Person p : personsList) {
logger.info("Person List::" + p);
}
return personsList;
}
@Override
public Person getPersonById(long id) {
Session session = this.sessionFactory.getObject().getCurrentSession();
Person p = (Person) session.get(Person.class, new Long(id));
logger.info("Person loaded successfully, Person details=" + p);
//check null first
if (p != null) {
//detach your first entity from session - session.evict(myEntity)
session.evict(p);
}
return p;
}
@Override
public void removePerson(long id) {
Session session = this.sessionFactory.getObject().getCurrentSession();
Person p = (Person) session.load(Person.class, new Long(id));
if (null != p) {
session.delete(p);
}
logger.info("Person deleted successfully, person details=" + p);
}
}
| 2,284 | 0.671191 | 0.669877 | 70 | 31.628571 | 26.852598 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.528571 | false | false | 4 |
7a4def2a5ddf82b39b9629020cd37b212b50677c | 18,640,158,071,709 | a3e6937d3d1906e34c11300b1f870e29fe513c8a | /MokeyAndroid/.svn/pristine/7a/7a4def2a5ddf82b39b9629020cd37b212b50677c.svn-base | 79544abe0d29e423723a924621785111eb84a24b | [] | no_license | flowsky37/ichujian_beta1 | https://github.com/flowsky37/ichujian_beta1 | 88f206e1ccf49836e248916a9369c0b4882a14ab | 3d78ca6e870fe512427844b9775473f19f77b7b4 | refs/heads/master | 2021-01-10T11:39:35.120000 | 2016-02-24T15:47:07 | 2016-02-24T15:47:07 | 52,451,430 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.net.mokeyandroid.wxapi;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import com.tencent.mm.sdk.openapi.BaseReq;
import com.tencent.mm.sdk.openapi.BaseResp;
import com.tencent.mm.sdk.openapi.ConstantsAPI;
import com.tencent.mm.sdk.openapi.IWXAPI;
import com.tencent.mm.sdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.sdk.openapi.WXAPIFactory;
public class WXEntryActivity extends Activity implements IWXAPIEventHandler{
/** Called when the activity is first created. */
private IWXAPI api;
public static final String APP_ID = "wx38b008f83184cfd3";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
api = WXAPIFactory.createWXAPI(WXEntryActivity.this, APP_ID, false);
api.registerApp(APP_ID);
api.handleIntent(getIntent(), this);
}
public void onReq(BaseReq req) {
// TODO Auto-generated method stub
switch (req.getType()) {
case ConstantsAPI.COMMAND_GETMESSAGE_FROM_WX:
//goToGetMsg();
break;
case ConstantsAPI.COMMAND_SHOWMESSAGE_FROM_WX:
//goToShowMsg((ShowMessageFromWX.Req) req);
break;
default:
break;
}
}
public void onResp(BaseResp resp) {
// TODO Auto-generated method stub
final AlertDialog.Builder build = new AlertDialog.Builder(WXEntryActivity.this);
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
build.setTitle("ๆ็คบ");
new AlertDialog.Builder(WXEntryActivity.this).setTitle("ๆ็คบ").setMessage("ๅไบซๆๅ")
.setPositiveButton("็กฎๅฎ", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
WXEntryActivity.this.finish();
}
}).create().show();
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
//result = R.string.errcode_cancel;
new AlertDialog.Builder(WXEntryActivity.this).setTitle("ๆ็คบ").setMessage("ๅไบซๅคฑ่ดฅ")
.setPositiveButton("็กฎๅฎ", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
WXEntryActivity.this.finish();
}
}).create().show();
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
//result = R.string.errcode_deny;
break;
default:
//result = R.string.errcode_unknown;
break;
}
}
}
| UTF-8 | Java | 2,412 | 7a4def2a5ddf82b39b9629020cd37b212b50677c.svn-base | Java | [] | null | [] | package com.net.mokeyandroid.wxapi;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import com.tencent.mm.sdk.openapi.BaseReq;
import com.tencent.mm.sdk.openapi.BaseResp;
import com.tencent.mm.sdk.openapi.ConstantsAPI;
import com.tencent.mm.sdk.openapi.IWXAPI;
import com.tencent.mm.sdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.sdk.openapi.WXAPIFactory;
public class WXEntryActivity extends Activity implements IWXAPIEventHandler{
/** Called when the activity is first created. */
private IWXAPI api;
public static final String APP_ID = "wx38b008f83184cfd3";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
api = WXAPIFactory.createWXAPI(WXEntryActivity.this, APP_ID, false);
api.registerApp(APP_ID);
api.handleIntent(getIntent(), this);
}
public void onReq(BaseReq req) {
// TODO Auto-generated method stub
switch (req.getType()) {
case ConstantsAPI.COMMAND_GETMESSAGE_FROM_WX:
//goToGetMsg();
break;
case ConstantsAPI.COMMAND_SHOWMESSAGE_FROM_WX:
//goToShowMsg((ShowMessageFromWX.Req) req);
break;
default:
break;
}
}
public void onResp(BaseResp resp) {
// TODO Auto-generated method stub
final AlertDialog.Builder build = new AlertDialog.Builder(WXEntryActivity.this);
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
build.setTitle("ๆ็คบ");
new AlertDialog.Builder(WXEntryActivity.this).setTitle("ๆ็คบ").setMessage("ๅไบซๆๅ")
.setPositiveButton("็กฎๅฎ", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
WXEntryActivity.this.finish();
}
}).create().show();
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
//result = R.string.errcode_cancel;
new AlertDialog.Builder(WXEntryActivity.this).setTitle("ๆ็คบ").setMessage("ๅไบซๅคฑ่ดฅ")
.setPositiveButton("็กฎๅฎ", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
WXEntryActivity.this.finish();
}
}).create().show();
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
//result = R.string.errcode_deny;
break;
default:
//result = R.string.errcode_unknown;
break;
}
}
}
| 2,412 | 0.72601 | 0.72138 | 73 | 31.547945 | 22.335573 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.479452 | false | false | 4 | |
cebf86dadf95ea767e3c980fe57843ca0480fcd2 | 4,449,586,131,896 | 1db9286885931342650de31be5997385e6973bf9 | /cloud-stream-rabbitmq-provider8801/src/main/java/com/atguigu/springcloud/service/impl/MessageProviderImpl.java | 3ad4078a1ebd4f3697e53db3e97ea95ab2ef02be | [] | no_license | wucong-github/cloud2020 | https://github.com/wucong-github/cloud2020 | 5046ba858a65e7805ca104e6e18c32442b75f722 | 2ddf7d02e3c3d7af121e0d9892a73219a6ed6369 | refs/heads/master | 2022-07-02T01:10:33.488000 | 2020-06-19T10:26:28 | 2020-06-19T10:26:28 | 251,162,032 | 0 | 0 | null | false | 2022-06-21T03:05:52 | 2020-03-30T00:17:18 | 2020-06-19T10:26:24 | 2022-06-21T03:05:52 | 351 | 0 | 0 | 1 | Java | false | false | package com.atguigu.springcloud.service.impl;
import com.atguigu.springcloud.service.MessageProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.UUID;
/**
* @EnableBinding ่กจๆ่ฟๆฏไธไธช็ปๅฎๅจ
* Source.class ๆถๆฏ็็ไบง่
* MessageChannel ๆถๆฏ้้ output
* <p>
* send ๆถๆฏๅ้ๆนๆณ
*/
@Component
@EnableBinding(Source.class)
public class MessageProviderImpl implements MessageProvider {
@Resource
private MessageChannel output;
static int i =0;
@Override
public String send() {
String serial = UUID.randomUUID().toString();
i++;
// ไฝฟ็จๆถๆฏ้้็send()ๆนๆณๅ้๏ผ build()ๆๅปบๆถๆฏ
output.send(MessageBuilder.withPayload(serial+"๏ผๆฐๅญ๏ผ"+i).build());
System.out.println("@EnableBinding .... MessageProviderImpl");
return serial;
}
}
| UTF-8 | Java | 1,223 | java | MessageProviderImpl.java | Java | [] | null | [] | package com.atguigu.springcloud.service.impl;
import com.atguigu.springcloud.service.MessageProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.UUID;
/**
* @EnableBinding ่กจๆ่ฟๆฏไธไธช็ปๅฎๅจ
* Source.class ๆถๆฏ็็ไบง่
* MessageChannel ๆถๆฏ้้ output
* <p>
* send ๆถๆฏๅ้ๆนๆณ
*/
@Component
@EnableBinding(Source.class)
public class MessageProviderImpl implements MessageProvider {
@Resource
private MessageChannel output;
static int i =0;
@Override
public String send() {
String serial = UUID.randomUUID().toString();
i++;
// ไฝฟ็จๆถๆฏ้้็send()ๆนๆณๅ้๏ผ build()ๆๅปบๆถๆฏ
output.send(MessageBuilder.withPayload(serial+"๏ผๆฐๅญ๏ผ"+i).build());
System.out.println("@EnableBinding .... MessageProviderImpl");
return serial;
}
}
| 1,223 | 0.74316 | 0.742277 | 39 | 28 | 23.320509 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.435897 | false | false | 4 |
e948bd6754ae7b1953c339e25b7e3d014dde518c | 28,793,460,761,293 | cae541ba3f6f12a0ae3e4e69168e36d20d2467ff | /src/main/java/component/RandomLoadBalancer.java | ebed537535861b76ea0502d7edb71d7afd02ea7b | [] | no_license | botumsu/loadbalancer | https://github.com/botumsu/loadbalancer | 60799797d118f432e44651ca9d1ba0dba3316595 | 68a1a8de86a1a62052cb963f72804ecb24e70cd8 | refs/heads/master | 2023-01-30T21:08:25.831000 | 2020-12-13T19:31:08 | 2020-12-13T19:31:08 | 321,143,380 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package component;
import java.util.List;
import java.util.Random;
public class RandomLoadBalancer extends LoadBalancer {
public RandomLoadBalancer(List<String> providers) {
super(providers);
}
@Override
String get() {
return providers.get(new Random().nextInt(providers.size()));
}
}
| UTF-8 | Java | 325 | java | RandomLoadBalancer.java | Java | [] | null | [] | package component;
import java.util.List;
import java.util.Random;
public class RandomLoadBalancer extends LoadBalancer {
public RandomLoadBalancer(List<String> providers) {
super(providers);
}
@Override
String get() {
return providers.get(new Random().nextInt(providers.size()));
}
}
| 325 | 0.686154 | 0.686154 | 16 | 19.3125 | 21.341621 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3125 | false | false | 4 |
36d2e98e1ccc8ff0333fbee424265d1433e863ee | 20,882,131,003,563 | 70fb1e4eecf9e1fb63feb53c9fb3c41d2a240e57 | /src/main/java/edu/usach/grupo2mingeso2s2017/repository/RecordRepository.java | b94bd61a90a90a21f6c36eaf51b70d5868dcea8e | [] | no_license | nicolasCallahan/Spring-AngularJS | https://github.com/nicolasCallahan/Spring-AngularJS | 9b673a43c529174bc24b8270fba97f074b15c608 | 9aa931239206560b021775590626799c0bc7fd96 | refs/heads/master | 2020-03-18T07:29:18.699000 | 2018-05-22T18:05:22 | 2018-05-22T18:05:22 | 134,455,622 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.usach.grupo2mingeso2s2017.repository;
import org.springframework.data.repository.PagingAndSortingRepository;
import edu.usach.grupo2mingeso2s2017.entities.Record;
public interface RecordRepository extends PagingAndSortingRepository<Record, Integer>{
}
| UTF-8 | Java | 268 | java | RecordRepository.java | Java | [] | null | [] | package edu.usach.grupo2mingeso2s2017.repository;
import org.springframework.data.repository.PagingAndSortingRepository;
import edu.usach.grupo2mingeso2s2017.entities.Record;
public interface RecordRepository extends PagingAndSortingRepository<Record, Integer>{
}
| 268 | 0.865672 | 0.820895 | 9 | 28.777779 | 33.422474 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 4 |
218539934e5b115288b4749dae525d05b5491d72 | 9,294,309,238,617 | e493d39413dbd8500d569bba3299d6b718a1f066 | /app/src/main/java/com/lab11/nolram/components/AdapterCardsCaderno.java | 15911825a52ce4177d1c235af1a637fe6cdeea39 | [
"Apache-2.0",
"CC-BY-4.0"
] | permissive | nolram/FlynNote | https://github.com/nolram/FlynNote | add6beb8125427afd633984afa74273964c25bf4 | 48131cde28682a2a533f59108a5c4206f08f3d43 | refs/heads/master | 2020-04-10T12:19:16.601000 | 2016-02-04T21:27:11 | 2016-02-04T21:27:11 | 41,175,375 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lab11.nolram.components;
import android.content.Context;
import android.graphics.Typeface;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.lab11.nolram.cadernocamera.R;
import com.lab11.nolram.database.model.Caderno;
import java.util.List;
/**
* Created by nolram on 24/08/15.
*/
public class AdapterCardsCaderno extends RecyclerView.Adapter<AdapterCardsCaderno.ViewHolder> {
private List<Caderno> mDataset;
private View layoutView;
private Context mContext;
public AdapterCardsCaderno(List<Caderno> myDataset, Context mContext) {
mDataset = myDataset;
this.mContext = mContext;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
layoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_caderno, parent, false);
// set the view's size, margins, paddings and layout parameters
ViewHolder vh = new ViewHolder(layoutView);
return vh;
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Caderno caderno = mDataset.get(position);
holder.mTitleView.setText(caderno.getTitulo());
String descricao = caderno.getDescricao();
if(descricao.length() > 100){
descricao = descricao.substring(0, 99)+"...";
}
holder.mTextView.setText(descricao);
holder.mDateView.setText(caderno.getUltimaModificacao());
holder.mCor.setBackgroundColor(mContext.getResources().getColor(mContext.getResources().getIdentifier(
caderno.getCorPrincipal(), "drawable", mContext.getPackageName())));
holder.mBadge.setImageResource(mContext.getResources().getIdentifier(caderno.getBadge(),
"drawable", mContext.getPackageName()));
}
@Override
public int getItemCount() {
return mDataset.size();
}
public void addItem(Caderno caderno) {
mDataset.add(caderno);
}
public void addItem(List<Caderno> caderno) {
mDataset.addAll(caderno);
}
public void updateAll(List<Caderno> caderno) {
mDataset = caderno;
}
public static class ViewHolder extends RecyclerView.ViewHolder {
// each data item is just a string in this case
public TextView mTitleView;
public TextView mTextView;
public TextView mDateView;
public ImageView mCor;
public ImageView mBadge;
public ViewHolder(View v) {
super(v);
Typeface typeTitle= Typeface.createFromAsset(v.getContext().getAssets(),
v.getContext().getString(R.string.type_title));
Typeface typeRest= Typeface.createFromAsset(v.getContext().getAssets(),
v.getContext().getString(R.string.type_rest));
mTextView = (TextView) v.findViewById(R.id.txt_descricao);
mTextView.setTypeface(typeRest);
mTitleView = (TextView) v.findViewById(R.id.txt_title);
mTitleView.setTypeface(typeTitle);
mDateView = (TextView) v.findViewById(R.id.txt_modificacao);
mDateView.setTypeface(typeRest);
mCor = (ImageView) v.findViewById(R.id.img_cor);
mBadge = (ImageView) v.findViewById(R.id.img_badge);
}
}
}
| UTF-8 | Java | 3,466 | java | AdapterCardsCaderno.java | Java | [
{
"context": "aderno;\n\nimport java.util.List;\n\n/**\n * Created by nolram on 24/08/15.\n */\npublic class AdapterCardsCaderno",
"end": 448,
"score": 0.9996611475944519,
"start": 442,
"tag": "USERNAME",
"value": "nolram"
}
] | null | [] | package com.lab11.nolram.components;
import android.content.Context;
import android.graphics.Typeface;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.lab11.nolram.cadernocamera.R;
import com.lab11.nolram.database.model.Caderno;
import java.util.List;
/**
* Created by nolram on 24/08/15.
*/
public class AdapterCardsCaderno extends RecyclerView.Adapter<AdapterCardsCaderno.ViewHolder> {
private List<Caderno> mDataset;
private View layoutView;
private Context mContext;
public AdapterCardsCaderno(List<Caderno> myDataset, Context mContext) {
mDataset = myDataset;
this.mContext = mContext;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
layoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_caderno, parent, false);
// set the view's size, margins, paddings and layout parameters
ViewHolder vh = new ViewHolder(layoutView);
return vh;
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Caderno caderno = mDataset.get(position);
holder.mTitleView.setText(caderno.getTitulo());
String descricao = caderno.getDescricao();
if(descricao.length() > 100){
descricao = descricao.substring(0, 99)+"...";
}
holder.mTextView.setText(descricao);
holder.mDateView.setText(caderno.getUltimaModificacao());
holder.mCor.setBackgroundColor(mContext.getResources().getColor(mContext.getResources().getIdentifier(
caderno.getCorPrincipal(), "drawable", mContext.getPackageName())));
holder.mBadge.setImageResource(mContext.getResources().getIdentifier(caderno.getBadge(),
"drawable", mContext.getPackageName()));
}
@Override
public int getItemCount() {
return mDataset.size();
}
public void addItem(Caderno caderno) {
mDataset.add(caderno);
}
public void addItem(List<Caderno> caderno) {
mDataset.addAll(caderno);
}
public void updateAll(List<Caderno> caderno) {
mDataset = caderno;
}
public static class ViewHolder extends RecyclerView.ViewHolder {
// each data item is just a string in this case
public TextView mTitleView;
public TextView mTextView;
public TextView mDateView;
public ImageView mCor;
public ImageView mBadge;
public ViewHolder(View v) {
super(v);
Typeface typeTitle= Typeface.createFromAsset(v.getContext().getAssets(),
v.getContext().getString(R.string.type_title));
Typeface typeRest= Typeface.createFromAsset(v.getContext().getAssets(),
v.getContext().getString(R.string.type_rest));
mTextView = (TextView) v.findViewById(R.id.txt_descricao);
mTextView.setTypeface(typeRest);
mTitleView = (TextView) v.findViewById(R.id.txt_title);
mTitleView.setTypeface(typeTitle);
mDateView = (TextView) v.findViewById(R.id.txt_modificacao);
mDateView.setTypeface(typeRest);
mCor = (ImageView) v.findViewById(R.id.img_cor);
mBadge = (ImageView) v.findViewById(R.id.img_badge);
}
}
}
| 3,466 | 0.671091 | 0.665609 | 102 | 32.980392 | 28.317175 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.607843 | false | false | 4 |
f9ecc11a23b5b8ae39199614043274f4e058cd96 | 4,518,305,609,331 | 3b5ec76e2f5ee10097a88ece7a91b911304dc373 | /lichkin-spring-boot-starter-web-api/src/main/java/com/lichkin/springframework/controllers/LKApiBusUpdateUsingStatusController.java | 9ef05a366378c14211561778c0cd2d50203d9e28 | [
"MIT"
] | permissive | LichKinContributor/lichkin-spring-boot | https://github.com/LichKinContributor/lichkin-spring-boot | 1038028ab131a8691a3d9cded088127daeac522a | 74efa78454e880c2100c7ca53cc7aca7bfefa781 | refs/heads/master | 2021-06-12T12:45:33.125000 | 2019-03-26T12:44:04 | 2019-03-26T12:44:04 | 128,630,758 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lichkin.springframework.controllers;
import com.lichkin.framework.beans.impl.LKRequestIDsBean;
import com.lichkin.framework.defines.entities.I_UsingStatus_ID;
import com.lichkin.framework.defines.enums.impl.LKOperTypeEnum;
import com.lichkin.framework.defines.enums.impl.LKUsingStatusEnum;
import com.lichkin.framework.defines.exceptions.LKException;
import com.lichkin.springframework.services.LKApiBusUpdateUsingStatusService;
public abstract class LKApiBusUpdateUsingStatusController<CI extends LKRequestIDsBean, E extends I_UsingStatus_ID> extends LKApiBusIUDController<CI, E> {
@Override
protected abstract LKApiBusUpdateUsingStatusService<CI, E> getService(CI cin, ApiKeyValues<CI> params);
@Deprecated
@Override
protected LKOperTypeEnum getOperType(CI cin, ApiKeyValues<CI> params) {
if (getUsingStatus().equals(LKUsingStatusEnum.DEPRECATED)) {
return LKOperTypeEnum.REMOVE;
}
return LKOperTypeEnum.EDIT;
}
/**
* ้ๅธธไฝฟ็จๆน็ถๆๆฅๅฃ้ฝไธบ้ป่พๅ ้ค
* @return ๅ ้ค็ถๆ
*/
protected LKUsingStatusEnum getUsingStatus() {
return LKUsingStatusEnum.DEPRECATED;
}
@Override
protected void beforeInvokeService(CI cin, ApiKeyValues<CI> params) throws LKException {
params.putObject("_usingStatus", getUsingStatus());
}
}
| UTF-8 | Java | 1,286 | java | LKApiBusUpdateUsingStatusController.java | Java | [] | null | [] | package com.lichkin.springframework.controllers;
import com.lichkin.framework.beans.impl.LKRequestIDsBean;
import com.lichkin.framework.defines.entities.I_UsingStatus_ID;
import com.lichkin.framework.defines.enums.impl.LKOperTypeEnum;
import com.lichkin.framework.defines.enums.impl.LKUsingStatusEnum;
import com.lichkin.framework.defines.exceptions.LKException;
import com.lichkin.springframework.services.LKApiBusUpdateUsingStatusService;
public abstract class LKApiBusUpdateUsingStatusController<CI extends LKRequestIDsBean, E extends I_UsingStatus_ID> extends LKApiBusIUDController<CI, E> {
@Override
protected abstract LKApiBusUpdateUsingStatusService<CI, E> getService(CI cin, ApiKeyValues<CI> params);
@Deprecated
@Override
protected LKOperTypeEnum getOperType(CI cin, ApiKeyValues<CI> params) {
if (getUsingStatus().equals(LKUsingStatusEnum.DEPRECATED)) {
return LKOperTypeEnum.REMOVE;
}
return LKOperTypeEnum.EDIT;
}
/**
* ้ๅธธไฝฟ็จๆน็ถๆๆฅๅฃ้ฝไธบ้ป่พๅ ้ค
* @return ๅ ้ค็ถๆ
*/
protected LKUsingStatusEnum getUsingStatus() {
return LKUsingStatusEnum.DEPRECATED;
}
@Override
protected void beforeInvokeService(CI cin, ApiKeyValues<CI> params) throws LKException {
params.putObject("_usingStatus", getUsingStatus());
}
}
| 1,286 | 0.806891 | 0.806891 | 40 | 30.200001 | 35.885372 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.175 | false | false | 4 |
e38ed0fc100586a4f395ce42fab482f54cb7a2cb | 22,136,261,457,120 | e94018c33a0961df4ded6522a847a4de2e1ed938 | /app/src/main/java/com/tl/androidnativedemo/vo/ContactVo.java | 9684813d0c9e849b0fd1c3c60ca86022293bc1d6 | [] | no_license | tianlin95310/AndroidNativedemo | https://github.com/tianlin95310/AndroidNativedemo | f33c98e5db9e31bfddd580c19985de17b2303bdf | ecbfd818f0b8ec1e0fa2fc406c7ede534c47fe43 | refs/heads/master | 2023-05-23T02:23:20.843000 | 2021-06-21T04:41:40 | 2021-06-21T04:41:40 | 370,621,943 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tl.androidnativedemo.vo;
/**
* Created by tianlin on 2017/3/15.
* Tel : 15071485692
* QQ : 953108373
* Function :
*/
public class ContactVo
{
private String name;
private String number;
private String email;
@Override
public String toString()
{
return "ContactVo{" +
"name='" + name + '\'' +
", number='" + number + '\'' +
", email='" + email + '\'' +
'}' + "\n";
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getNumber()
{
return number;
}
public void setNumber(String number)
{
this.number = number;
}
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
}
| UTF-8 | Java | 920 | java | ContactVo.java | Java | [
{
"context": "ge com.tl.androidnativedemo.vo;\n\n/**\n * Created by tianlin on 2017/3/15.\n * Tel : 15071485692\n * QQ : 953108",
"end": 63,
"score": 0.9993131756782532,
"start": 56,
"tag": "USERNAME",
"value": "tianlin"
}
] | null | [] | package com.tl.androidnativedemo.vo;
/**
* Created by tianlin on 2017/3/15.
* Tel : 15071485692
* QQ : 953108373
* Function :
*/
public class ContactVo
{
private String name;
private String number;
private String email;
@Override
public String toString()
{
return "ContactVo{" +
"name='" + name + '\'' +
", number='" + number + '\'' +
", email='" + email + '\'' +
'}' + "\n";
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getNumber()
{
return number;
}
public void setNumber(String number)
{
this.number = number;
}
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
}
| 920 | 0.498913 | 0.469565 | 55 | 15.727273 | 14.074418 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.236364 | false | false | 4 |
a8ee1f23331c8a9f2b3f97bb0def8602b52d6acb | 2,138,893,730,743 | 1a7083dfeef9b85c158b04d656fa7acf56247507 | /app/src/main/java/com/aprouxdev/mabibliotheque/ui/adapters/ViewHolders/MessageViewHolder.java | 16a6f91db92721f53e875624a46b060fc3f83712 | [] | no_license | nioto22/MaBibliotheque | https://github.com/nioto22/MaBibliotheque | d5809bb475987ba2f17f64364033a2dcf351cfcc | a6a27a8cfbb6668d662fefec64aeb5316872dd23 | refs/heads/master | 2021-01-06T13:58:43.707000 | 2020-03-05T19:45:50 | 2020-03-05T19:45:50 | 241,351,226 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.aprouxdev.mabibliotheque.ui.adapters.ViewHolders;
import android.graphics.drawable.GradientDrawable;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.aprouxdev.mabibliotheque.R;
import com.aprouxdev.mabibliotheque.models.Message;
import com.aprouxdev.mabibliotheque.tools.general.Tools;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.request.RequestOptions;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
public class MessageViewHolder extends RecyclerView.ViewHolder {
// UI vars
private RelativeLayout rootView;
private LinearLayout profileContainer;
private ImageView imageViewProfile;
private RelativeLayout messageContainer;
private CardView cardViewBookSent;
private ImageView bookSentImage;
private LinearLayout textMessageContainer;
private TextView textViewMessage;
private TextView textViewDate;
//FOR DATA
private final int colorCurrentUser;
private final int colorRemoteUser;
public MessageViewHolder(View itemView) {
super(itemView);
setupViews(itemView);
colorCurrentUser = ContextCompat.getColor(itemView.getContext(), R.color.colorAccent);
colorRemoteUser = ContextCompat.getColor(itemView.getContext(), R.color.background_orange);
}
public void updateWithMessage(Message message, String currentUserId, RequestManager glide){
// Check if current user is the sender
Boolean isCurrentUser = message.getUserSender().getUid().equals(currentUserId);
// Update message TextView
this.textViewMessage.setText(message.getMessage());
this.textViewMessage.setTextAlignment(isCurrentUser ? View.TEXT_ALIGNMENT_TEXT_END : View.TEXT_ALIGNMENT_TEXT_START);
// Update date TextView
if (message.getDateCreated() != null) this.textViewDate.setText(Tools.convertDateToHour(message.getDateCreated()));
// Update profile picture ImageView
if (message.getUserSender().getUrlPicture() != null)
glide.load(message.getUserSender().getUrlPicture())
.apply(RequestOptions.circleCropTransform())
.into(imageViewProfile);
// Update image sent ImageView
if (message.getBookImageLink() != null){
glide.load(message.getBookImageLink())
.placeholder(R.drawable.book_placeholder)
.into(bookSentImage);
this.bookSentImage.setVisibility(View.VISIBLE);
} else {
this.bookSentImage.setVisibility(View.GONE);
}
//Update Message Bubble Color Background
((GradientDrawable) textMessageContainer.getBackground()).setColor(isCurrentUser ? colorCurrentUser : colorRemoteUser);
// Update all views alignment depending is current user or not
this.updateDesignDependingUser(isCurrentUser);
}
private void updateDesignDependingUser(Boolean isSender){
// PROFILE CONTAINER
RelativeLayout.LayoutParams paramsLayoutHeader = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
paramsLayoutHeader.addRule(isSender ? RelativeLayout.ALIGN_PARENT_RIGHT : RelativeLayout.ALIGN_PARENT_LEFT);
this.profileContainer.setLayoutParams(paramsLayoutHeader);
// MESSAGE CONTAINER
RelativeLayout.LayoutParams paramsLayoutContent = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
paramsLayoutContent.addRule(isSender ? RelativeLayout.LEFT_OF : RelativeLayout.RIGHT_OF, R.id.activity_discussion_item_profile_container);
this.messageContainer.setLayoutParams(paramsLayoutContent);
// CARDVIEW IMAGE SEND
RelativeLayout.LayoutParams paramsImageView = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
paramsImageView.addRule(isSender ? RelativeLayout.ALIGN_LEFT : RelativeLayout.ALIGN_RIGHT, R.id.activity_discussion_item_message_container_text_message_container);
this.cardViewBookSent.setLayoutParams(paramsImageView);
this.rootView.requestLayout();
}
// -----------------------
// SETUP VIEWS
// -----------------------
private void setupViews(View v) {
rootView = v.findViewById(R.id.activity_discussion_item_root_view);
profileContainer = v.findViewById(R.id.activity_discussion_item_profile_container);
imageViewProfile = v.findViewById(R.id.activity_discussion_item_profile_container_profile_image);
messageContainer = v.findViewById(R.id.activity_discussion_item_message_container);
cardViewBookSent = v.findViewById(R.id.activity_discussion_item_message_container_book_sent_cardview);
bookSentImage = v.findViewById(R.id.activity_discussion_item_message_container_book_sent_cardview_image);
textMessageContainer = v.findViewById(R.id.activity_discussion_item_message_container_text_message_container);
textViewMessage = v.findViewById(R.id.activity_discussion_item_message_container_text_message_container_text_view);
textViewDate = v.findViewById(R.id.activity_discussion_item_message_container_text_view_date);
}
}
| UTF-8 | Java | 5,516 | java | MessageViewHolder.java | Java | [] | null | [] | package com.aprouxdev.mabibliotheque.ui.adapters.ViewHolders;
import android.graphics.drawable.GradientDrawable;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.aprouxdev.mabibliotheque.R;
import com.aprouxdev.mabibliotheque.models.Message;
import com.aprouxdev.mabibliotheque.tools.general.Tools;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.request.RequestOptions;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
public class MessageViewHolder extends RecyclerView.ViewHolder {
// UI vars
private RelativeLayout rootView;
private LinearLayout profileContainer;
private ImageView imageViewProfile;
private RelativeLayout messageContainer;
private CardView cardViewBookSent;
private ImageView bookSentImage;
private LinearLayout textMessageContainer;
private TextView textViewMessage;
private TextView textViewDate;
//FOR DATA
private final int colorCurrentUser;
private final int colorRemoteUser;
public MessageViewHolder(View itemView) {
super(itemView);
setupViews(itemView);
colorCurrentUser = ContextCompat.getColor(itemView.getContext(), R.color.colorAccent);
colorRemoteUser = ContextCompat.getColor(itemView.getContext(), R.color.background_orange);
}
public void updateWithMessage(Message message, String currentUserId, RequestManager glide){
// Check if current user is the sender
Boolean isCurrentUser = message.getUserSender().getUid().equals(currentUserId);
// Update message TextView
this.textViewMessage.setText(message.getMessage());
this.textViewMessage.setTextAlignment(isCurrentUser ? View.TEXT_ALIGNMENT_TEXT_END : View.TEXT_ALIGNMENT_TEXT_START);
// Update date TextView
if (message.getDateCreated() != null) this.textViewDate.setText(Tools.convertDateToHour(message.getDateCreated()));
// Update profile picture ImageView
if (message.getUserSender().getUrlPicture() != null)
glide.load(message.getUserSender().getUrlPicture())
.apply(RequestOptions.circleCropTransform())
.into(imageViewProfile);
// Update image sent ImageView
if (message.getBookImageLink() != null){
glide.load(message.getBookImageLink())
.placeholder(R.drawable.book_placeholder)
.into(bookSentImage);
this.bookSentImage.setVisibility(View.VISIBLE);
} else {
this.bookSentImage.setVisibility(View.GONE);
}
//Update Message Bubble Color Background
((GradientDrawable) textMessageContainer.getBackground()).setColor(isCurrentUser ? colorCurrentUser : colorRemoteUser);
// Update all views alignment depending is current user or not
this.updateDesignDependingUser(isCurrentUser);
}
private void updateDesignDependingUser(Boolean isSender){
// PROFILE CONTAINER
RelativeLayout.LayoutParams paramsLayoutHeader = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
paramsLayoutHeader.addRule(isSender ? RelativeLayout.ALIGN_PARENT_RIGHT : RelativeLayout.ALIGN_PARENT_LEFT);
this.profileContainer.setLayoutParams(paramsLayoutHeader);
// MESSAGE CONTAINER
RelativeLayout.LayoutParams paramsLayoutContent = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
paramsLayoutContent.addRule(isSender ? RelativeLayout.LEFT_OF : RelativeLayout.RIGHT_OF, R.id.activity_discussion_item_profile_container);
this.messageContainer.setLayoutParams(paramsLayoutContent);
// CARDVIEW IMAGE SEND
RelativeLayout.LayoutParams paramsImageView = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
paramsImageView.addRule(isSender ? RelativeLayout.ALIGN_LEFT : RelativeLayout.ALIGN_RIGHT, R.id.activity_discussion_item_message_container_text_message_container);
this.cardViewBookSent.setLayoutParams(paramsImageView);
this.rootView.requestLayout();
}
// -----------------------
// SETUP VIEWS
// -----------------------
private void setupViews(View v) {
rootView = v.findViewById(R.id.activity_discussion_item_root_view);
profileContainer = v.findViewById(R.id.activity_discussion_item_profile_container);
imageViewProfile = v.findViewById(R.id.activity_discussion_item_profile_container_profile_image);
messageContainer = v.findViewById(R.id.activity_discussion_item_message_container);
cardViewBookSent = v.findViewById(R.id.activity_discussion_item_message_container_book_sent_cardview);
bookSentImage = v.findViewById(R.id.activity_discussion_item_message_container_book_sent_cardview_image);
textMessageContainer = v.findViewById(R.id.activity_discussion_item_message_container_text_message_container);
textViewMessage = v.findViewById(R.id.activity_discussion_item_message_container_text_message_container_text_view);
textViewDate = v.findViewById(R.id.activity_discussion_item_message_container_text_view_date);
}
}
| 5,516 | 0.739666 | 0.739666 | 116 | 46.551723 | 42.634037 | 174 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.586207 | false | false | 4 |
dc2070d4c846a96d4a3b7622ce907d11470ef73e | 7,035,156,448,845 | 16dade835f3f7989cde418eca231b11737cf829a | /Android/Contents/RemoteBbs/app/src/main/java/com/example/kyung/remotebbs/Remote.java | 18f299c570a2e36c59dab7824e0893b39a7f9466 | [] | no_license | Lee-KyungSeok/Study | https://github.com/Lee-KyungSeok/Study | 8baa7576cdf4d01f603a1a2968f89eaefd596b6c | 31932b400ad1d2f5e5adc01d0996db93e01671d3 | refs/heads/master | 2021-01-23T05:04:21.466000 | 2018-05-10T11:10:26 | 2018-05-10T11:10:26 | 102,456,641 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.kyung.remotebbs;
import android.util.Log;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* Created by Kyung on 2017-10-27.
*/
public class Remote {
public static String sendPost(String address, String json){
String result = "";
try{
URL url = new URL(address); // url = naver.com?id=aaa&pw=12345
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
// header ์์ฑ -----------
con.setRequestProperty("Content-Type","application/json; charset=utf8");
con.setRequestProperty("Authorization","token=๋์ค์์๋ฒ๋ํ ๋์ธ๊ฑฐ์");
// post ๋ฐ์ดํฐ๋ฅผ ์ ์ก -----------
con.setDoOutput(true);
OutputStream os = con.getOutputStream();
os.write(json.getBytes());
os.flush();
os.close();
// -----------------------------
if(con.getResponseCode() == HttpURLConnection.HTTP_OK){
// ์ฌ๊ธฐ์ ๋ถํฐ๋ ํ์ผ์์ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ ธ์ค๋ ๊ฒ๊ณผ ๋์ผ
InputStreamReader isr = new InputStreamReader(con.getInputStream());
BufferedReader br = new BufferedReader(isr);
String temp = "";
while ((temp = br.readLine()) != null) {
result += temp;
}
br.close();
isr.close();
}else{
}
}catch(Exception e){
e.printStackTrace();
}
return result;
}
public static String getData(String string){ // naver.com?id=aaa&pw=1234
final StringBuilder result = new StringBuilder();
try {
URL url = new URL(string);
HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setRequestMethod("GET");
// header ์์ฑ -----------
//con.setRequestProperty("Content-Type","application/json; charset=utf8");
con.setRequestProperty("Authorization","token=๋์ค์์๋ฒ๋ํ ๋์ธ๊ฑฐ์");
// ํต์ ์ด ์ฑ๊ณต์ธ์ง ์ฒดํฌ
if (con.getResponseCode() == HttpURLConnection.HTTP_OK) {
// ์ฌ๊ธฐ์ ๋ถํฐ๋ ํ์ผ์์ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ ธ์ค๋ ๊ฒ๊ณผ ๋์ผ
InputStreamReader isr = new InputStreamReader(con.getInputStream());
BufferedReader br = new BufferedReader(isr);
String temp = "";
while ((temp = br.readLine()) != null) {
result.append(temp);
}
br.close();
isr.close();
} else {
Log.e("ServerError", con.getResponseCode()+"");
}
con.disconnect();
}catch(Exception e){
Log.e("Error", e.toString());
}
return result.toString();
}
} | UTF-8 | Java | 3,059 | java | Remote.java | Java | [
{
"context": "onnection;\nimport java.net.URL;\n\n/**\n * Created by Kyung on 2017-10-27.\n */\n\npublic class Remote {\n\n ",
"end": 234,
"score": 0.5870864987373352,
"start": 233,
"tag": "USERNAME",
"value": "K"
},
{
"context": "nection;\nimport java.net.URL;\n\n/**\n * Created by... | null | [] | package com.example.kyung.remotebbs;
import android.util.Log;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* Created by Kyung on 2017-10-27.
*/
public class Remote {
public static String sendPost(String address, String json){
String result = "";
try{
URL url = new URL(address); // url = naver.com?id=aaa&pw=12345
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
// header ์์ฑ -----------
con.setRequestProperty("Content-Type","application/json; charset=utf8");
con.setRequestProperty("Authorization","token=๋์ค์์๋ฒ๋ํ ๋์ธ๊ฑฐ์");
// post ๋ฐ์ดํฐ๋ฅผ ์ ์ก -----------
con.setDoOutput(true);
OutputStream os = con.getOutputStream();
os.write(json.getBytes());
os.flush();
os.close();
// -----------------------------
if(con.getResponseCode() == HttpURLConnection.HTTP_OK){
// ์ฌ๊ธฐ์ ๋ถํฐ๋ ํ์ผ์์ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ ธ์ค๋ ๊ฒ๊ณผ ๋์ผ
InputStreamReader isr = new InputStreamReader(con.getInputStream());
BufferedReader br = new BufferedReader(isr);
String temp = "";
while ((temp = br.readLine()) != null) {
result += temp;
}
br.close();
isr.close();
}else{
}
}catch(Exception e){
e.printStackTrace();
}
return result;
}
public static String getData(String string){ // naver.com?id=aaa&pw=1234
final StringBuilder result = new StringBuilder();
try {
URL url = new URL(string);
HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setRequestMethod("GET");
// header ์์ฑ -----------
//con.setRequestProperty("Content-Type","application/json; charset=utf8");
con.setRequestProperty("Authorization","token=๋์ค์์๋ฒ๋ํ ๋์ธ๊ฑฐ์");
// ํต์ ์ด ์ฑ๊ณต์ธ์ง ์ฒดํฌ
if (con.getResponseCode() == HttpURLConnection.HTTP_OK) {
// ์ฌ๊ธฐ์ ๋ถํฐ๋ ํ์ผ์์ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ ธ์ค๋ ๊ฒ๊ณผ ๋์ผ
InputStreamReader isr = new InputStreamReader(con.getInputStream());
BufferedReader br = new BufferedReader(isr);
String temp = "";
while ((temp = br.readLine()) != null) {
result.append(temp);
}
br.close();
isr.close();
} else {
Log.e("ServerError", con.getResponseCode()+"");
}
con.disconnect();
}catch(Exception e){
Log.e("Error", e.toString());
}
return result.toString();
}
} | 3,059 | 0.524403 | 0.517826 | 81 | 34.679012 | 23.841465 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62963 | false | false | 4 |
397d27fcce438f557236938c8d5f5bc0193aa2d2 | 23,854,248,381,979 | cc018dfdf1896e43f112d87de43e3203255b1197 | /src/main/java/cl/loslinux/webapp/service/DestinoService.java | 7005c0a5a83a63165c7034ae2a55bef216cdc17b | [] | no_license | leximar17/Destinos-Spring | https://github.com/leximar17/Destinos-Spring | a91e745ab6fc91ea5926b1ba011fdc46f72396ae | 85ded46745cc43e96a768e8f59b1ea05746b02d3 | refs/heads/master | 2023-01-12T17:39:08.586000 | 2020-11-23T19:08:51 | 2020-11-23T19:08:51 | 315,414,315 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cl.loslinux.webapp.service;
import java.util.List;
import cl.loslinux.webapp.model.Destino;
public interface DestinoService {
void save(Destino destino);
List<Destino> findAll();
}
| UTF-8 | Java | 216 | java | DestinoService.java | Java | [] | null | [] | package cl.loslinux.webapp.service;
import java.util.List;
import cl.loslinux.webapp.model.Destino;
public interface DestinoService {
void save(Destino destino);
List<Destino> findAll();
}
| 216 | 0.699074 | 0.699074 | 22 | 8.818182 | 13.66361 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.772727 | false | false | 4 |
ffe2511868db8f7d648cb7dd20eda37a32ee2d9b | 30,081,950,976,723 | 9e50d70914f86e51c5632fc0e05f1d07c5b52f77 | /src/test/java/org/msdg/magic/DocHanlder.java | 365227eda3e2d08aaeddc7a0795e55b79eed0492 | [] | no_license | dm4157/magic | https://github.com/dm4157/magic | cc33b2b05c3d3fba694a9c4172c7de3d9e3c00ac | 5a6d8c11537313edab45425498148e391672b953 | refs/heads/master | 2022-12-21T06:47:24.268000 | 2019-08-06T12:46:26 | 2019-08-06T12:46:26 | 99,197,347 | 0 | 0 | null | false | 2022-12-10T02:54:07 | 2017-08-03T06:14:30 | 2019-08-06T12:47:03 | 2022-12-10T02:54:06 | 29 | 0 | 0 | 5 | Java | false | false | package org.msdg.magic;
import java.io.*;
/**
* Created by msdg on 2018/11/21.
* Look, there is a moon.
*/
public class DocHanlder {
public static void main(String[] args) throws IOException {
String folder = "/Users/mw4157/Desktop/";
String file = "ddd";
String newFile = "doc-new.json";
String host = "wisdom";
FileInputStream fileInputStream = new FileInputStream(folder + file);
byte[] buff = new byte[1024*1024*10];
int len = fileInputStream.read(buff);
fileInputStream.close();
String content = new String(buff, 0, len);
content = content.replaceAll("yourhost", "{{host-" + host + "}}");
content = content.replaceAll("X-Login-UserId:", "X-Login-UserId: {{uc-me}} ");
content = content.replaceAll("X-Login-CompanyId:", "X-Login-CompanyId: 10001");
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(folder + newFile)));
bufferedWriter.write(content);
bufferedWriter.flush();
bufferedWriter.close();
}
}
| UTF-8 | Java | 1,097 | java | DocHanlder.java | Java | [
{
"context": ".msdg.magic;\n\nimport java.io.*;\n\n/**\n * Created by msdg on 2018/11/21.\n * Look, there is a moon.\n */\npubl",
"end": 66,
"score": 0.9996467232704163,
"start": 62,
"tag": "USERNAME",
"value": "msdg"
},
{
"context": "ows IOException {\n String folder = \"/Use... | null | [] | package org.msdg.magic;
import java.io.*;
/**
* Created by msdg on 2018/11/21.
* Look, there is a moon.
*/
public class DocHanlder {
public static void main(String[] args) throws IOException {
String folder = "/Users/mw4157/Desktop/";
String file = "ddd";
String newFile = "doc-new.json";
String host = "wisdom";
FileInputStream fileInputStream = new FileInputStream(folder + file);
byte[] buff = new byte[1024*1024*10];
int len = fileInputStream.read(buff);
fileInputStream.close();
String content = new String(buff, 0, len);
content = content.replaceAll("yourhost", "{{host-" + host + "}}");
content = content.replaceAll("X-Login-UserId:", "X-Login-UserId: {{uc-me}} ");
content = content.replaceAll("X-Login-CompanyId:", "X-Login-CompanyId: 10001");
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(folder + newFile)));
bufferedWriter.write(content);
bufferedWriter.flush();
bufferedWriter.close();
}
}
| 1,097 | 0.633546 | 0.608022 | 32 | 33.28125 | 30.572899 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.