blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
35d1dae794e41119805ad70a43898cf862b7b249 | 6f649ef39ce23adb0b1cc6d3e55b7e6bdc0afc50 | /src/native/com/stmtnode/primitive/type/WrapTypeNativeNode.java | 0e1d733cb076bdc0a309478281b6d4a93ceadac7 | [] | no_license | bernardobreder/stmtnode-shell | d23042ffeb5e1df26486158bdc50dfd653c3f2a0 | 23102ada1723d352aee659a7cfdc43be4a3e38f1 | refs/heads/master | 2021-05-09T05:28:15.804390 | 2018-02-19T22:03:06 | 2018-02-19T22:03:06 | 119,310,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package com.stmtnode.primitive.type;
public abstract class WrapTypeNativeNode extends TypeNativeNode {
public final TypeNativeNode type;
public WrapTypeNativeNode(TypeNativeNode type) {
this.type = type;
}
}
| [
"bernardobreder@gmail.com"
] | bernardobreder@gmail.com |
37adaf63a9ef4b7af3dc1090586c0f55227e3f55 | e0abd18f5cf3bed9914998fa6e2313f8ff75c0a3 | /src/main/java/edu/amazon/util/database/DaoFactory.java | 00e8113309d8fb05d6d63e92948232011b1e990b | [] | no_license | NeedSomeCoffee/amazon-connector | 9a6cea91b69a679a2bdf0e158a4b99a31dce730a | d315d3b2d1de7017f66b343aac967927cfb7b8f3 | refs/heads/master | 2020-03-28T14:44:22.420207 | 2018-10-16T17:47:14 | 2018-10-16T17:47:14 | 148,517,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 308 | java | package edu.amazon.util.database;
import java.sql.Connection;
public class DaoFactory {
public static AccountDao getAccountDao(Connection connection) {
return new AccountDao(connection);
}
public static ProductDao getProductDao(Connection connection) {
return new ProductDao(connection);
}
}
| [
"ivan.bai.sergeevich@gmail.com"
] | ivan.bai.sergeevich@gmail.com |
013af58f84f8c1b7483a787facce164efd36a598 | fec3498e45b765e44eeba130cdbdec7e72750e58 | /src/ooplab6/compareSrting.java | 16b4765e2cc719a3180145e8622125bdc8f9f44b | [] | no_license | ornwadee99/oop_s359211110042 | 80e1f9a113f4637615041e9399b988fb7b397442 | fae2c20b750c0b3742d8c4fc367b6bf57f2a0cb5 | refs/heads/master | 2021-09-06T09:57:29.242199 | 2018-02-05T08:06:03 | 2018-02-05T08:06:03 | 111,380,477 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 632 | java | package ooplab6;
public class compareSrting {
public static void main(String[] args) {
//compare Sring
String m = "Hello";
String n = "Hello";
//type 1 (==)
if (m==n) System.out.println("yes.");
else System.out.println("no.");
//type 2 (equal())
if (m.equals(n)) System.out.println("yes.");
else System.out.println("no.");
//type 3 (compareTo())
if (m.compareTo(n)==0) System.out.println("yes.");
else if (m.compareTo(n)>= 1)
System.out.println("no. +");
else System.out.println("no. -");
}//main
}//class
| [
"ornwadee28493@gmail.com"
] | ornwadee28493@gmail.com |
e13c4bd7ab385f4b687fb1929f5b98b403dbd47f | 3fafe1adabed6f9ae4491ee23dc5d906925b76ee | /src/main/java/com/happy3w/seeworld/entity/Hero.java | 363f82536289da70ddf552d0aae831461758286d | [] | no_license | boroborome/SeeWorld | b04122834af19032b31e76a07c18270b348e0f32 | b2ad6a6ac0387de074fc7f8d068a2d80070f167d | refs/heads/master | 2021-01-20T02:08:02.987231 | 2017-06-30T08:10:04 | 2017-06-30T08:10:04 | 89,378,453 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 642 | java | package com.happy3w.seeworld.entity;
import com.fasterxml.jackson.annotation.JsonInclude;
import javax.persistence.Entity;
/**
* Created by ysgao on 09/05/2017.
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Hero {
private int id;
private String name;
public Hero() {
}
public Hero(int id, String name) {
this.id = id;
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"boroborome@sina.com"
] | boroborome@sina.com |
7bf2f3c8c2462c9932168475e812b7f40901a447 | 3adfc112f134505046b3ac6b06cbec3c35d85d26 | /restservice/src/main/java/com/diversesoft/productmenu/Product.java | e4c5b7e8ca24af37c189d206b15dcdf08fa1cbf9 | [] | no_license | itsjehad/JSONRESTFul | ccd113a1e3e388d7dc524ee14a5df407a084126f | 6fe49b2cb01ffe321921b2774985809f850ed589 | refs/heads/master | 2022-12-23T21:07:34.923926 | 2022-12-16T16:14:25 | 2022-12-16T16:14:25 | 27,792,756 | 0 | 0 | null | 2022-12-16T16:14:26 | 2014-12-09T23:32:06 | Java | UTF-8 | Java | false | false | 862 | java | package com.diversesoft.productmenu;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Product {
@Id
@GeneratedValue
private int id;
@Column(name = "name")
private String name;
@Column(name = "parent_id")
private int parent_id;
public Product(){
}
public Product(int id, String name, int parent_id){
this.id = id;
this.name = name;
this.parent_id = parent_id;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getParent_id() {
return parent_id;
}
public void setParent_id(int parent_id) {
this.parent_id = parent_id;
}
}
| [
"itsjehad@diversesoft.ca"
] | itsjehad@diversesoft.ca |
578894ac6896074e87fff3d1c956228f94a731d0 | 81f314020afba105a8e974998afc01745af470b2 | /exam/src/p03/GuGuDan.java | f6aa9e85db35bbec7cf7a061a277e13d87fc4a43 | [] | no_license | moon70717/test | 434b97828ee38c9f4a354cc1fd5e9adf07eb397e | 3c1a91763b88a56bfe456c21e87e53a157d445c1 | refs/heads/master | 2021-09-04T03:29:20.497520 | 2018-01-15T09:43:54 | 2018-01-15T09:43:54 | 111,525,972 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 389 | java | package p03;
public class GuGuDan {
public GuGuDan() {
System.out.println("GuGuDan ½ÇÇà");
}
public void printLoop(ObjectExam oe) {
for (int i = 1; i < oe.num1; i++) {
for (int j = 1; j < oe.num2; j++) {
// System.out.printf("%2d * %2d = %2d ||", j, i, (i * j));
System.out.print("[" + i + ", " + j + "]");
}
System.out.println("");
}
}
}
| [
"Administrator@DJA-PC"
] | Administrator@DJA-PC |
ce5db4c1305515acdc5e243b4b3026e2507dfb6f | e1075373a6561742b1a180a5cd6e9742ff2d6f9a | /src/game/enemies/Barricuda.java | a6baf878de8151020270b9fa5e54b13b92ac458b | [] | no_license | samueldibella/oceanographicXR31 | d3a879e41aacbfaed8951f3f44bd66fd564faff8 | a5c92c1a6235c46c91c3dff9c11afd1c62399c13 | refs/heads/master | 2021-01-22T21:07:09.772472 | 2014-05-29T15:48:31 | 2014-05-29T15:48:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package game.enemies;
import game.Animus;
import game.Game;
import game.enums.SpaceType;
import game.enums.Visibility;
public class Barricuda extends Animus{
int chance;
String aspect;
boolean isAlive;
boolean playerSighted;
int currentLevel;
float lethargy;
public Barricuda(int initX, int initY) {
//currentLevel = Game.hero.getCurrentLevel();
x = initX;
y = initY;
aspect = "B";
lethargy = 1;
isAlive = true;
type = SpaceType.BARRICUDA;
currentLevel = Game.hero.getCurrentLevel();
playerSighted = false;
}
@Override
public void move(int direction) {
if(Game.dungeon[currentLevel].getDesign()[y][x].getVisibility() == Visibility.INSIGHT) {
seek();
} else {
wander(type, lethargy);
}
}
}
| [
"samuel.dibella@gmail.com"
] | samuel.dibella@gmail.com |
ec4bb17242032cf43c4a648453fdba28963ed02e | 05bcae34dd8c17c708e7c31e2da17ba691ce1d98 | /app/src/main/java/rikkeisoft/nguyenducdung/com/appb/SubActivity.java | a5a974d7753f0505963bd7bd0e76e8c9b82df6ee | [] | no_license | nguyenducdung/AppB | a3d9db09cae1a809cc6af08f52582a90a31b1532 | 660609285f3b17907553e537a73ed8d996c3cdfb | refs/heads/master | 2020-04-02T16:54:13.574339 | 2018-11-05T16:04:30 | 2018-11-05T16:04:30 | 154,633,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package rikkeisoft.nguyenducdung.com.appb;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
public class SubActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sub);
}
}
| [
"nguyenducdung1803@gmail.com"
] | nguyenducdung1803@gmail.com |
450d1590ebff11356c008cb1e1841e9135924742 | 678a3d58c110afd1e9ce195d2f20b2531d45a2e0 | /sources/com/airbnb/android/lib/fragments/paymentinfo/payout/PayoutCurrencyFragment$$Icepick.java | d03c3eb2effc90a4befb209dd8940edcc4902af8 | [] | no_license | jasonnth/AirCode | d1c37fb9ba3d8087efcdd9fa2103fb85d13735d5 | d37db1baa493fca56f390c4205faf5c9bbe36604 | refs/heads/master | 2020-07-03T08:35:24.902940 | 2019-08-12T03:34:56 | 2019-08-12T03:34:56 | 201,842,970 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,121 | java | package com.airbnb.android.lib.fragments.paymentinfo.payout;
import android.os.Bundle;
import com.airbnb.android.core.models.PayoutInfoType;
import com.airbnb.android.lib.fragments.paymentinfo.payout.PayoutCurrencyFragment;
import icepick.Bundler;
import icepick.Injector.Helper;
import icepick.Injector.Object;
import java.util.HashMap;
import java.util.Map;
public class PayoutCurrencyFragment$$Icepick<T extends PayoutCurrencyFragment> extends Object<T> {
private static final Map<String, Bundler<?>> BUNDLERS = new HashMap();
/* renamed from: H */
private static final Helper f9579H = new Helper("com.airbnb.android.lib.fragments.paymentinfo.payout.PayoutCurrencyFragment$$Icepick.", BUNDLERS);
public void restore(T target, Bundle state) {
if (state != null) {
target.payoutInfoType = (PayoutInfoType) f9579H.getParcelable(state, "payoutInfoType");
super.restore(target, state);
}
}
public void save(T target, Bundle state) {
super.save(target, state);
f9579H.putParcelable(state, "payoutInfoType", target.payoutInfoType);
}
}
| [
"thanhhuu2apc@gmail.com"
] | thanhhuu2apc@gmail.com |
6fdad7f45d820c04b3949c54daf341863cd3c0cb | 5eca7741f0b9f6b629d9cd4b221a1e927254261c | /RoboTempo/src/robotempo/operacao/Operacao.java | a6856e6cbd7bb862a5bb16a6eb78193b59c83434 | [] | no_license | rafaelbtorres/botTempo | bfb8b27ecc634ddb14e6f0cb1bb0136f3b1d5100 | c6ac9beb7f303241fc9e7f466ff2d45f44e2d3f1 | refs/heads/master | 2020-06-08T22:21:35.412569 | 2019-07-05T22:50:28 | 2019-07-05T22:50:28 | 193,316,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,686 | java | package robotempo.operacao;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Operacao implements Runnable {
String saida = null;
InputStream in = null;
BufferedReader bin = null;
Socket client = null;
public Operacao(Socket client) {
this.client = client;
}
public void run() {
try {
//Cria um novo socket
in = client.getInputStream();
bin = new BufferedReader(new InputStreamReader(in));
//recupera o que esta em Stream
PrintWriter pout = new PrintWriter(client.getOutputStream(), true);
//Transforma o que esta em Stream para String
String line;
line = bin.readLine();
if (line.contains(", ")) {
try {
System.out.println("Recebendo dados da cidade");
Thread.sleep(6000);
//Separa a string da cidade e do estado
String[] textoSeparado = line.split(", ");
String cidade = textoSeparado[0];
String estado = textoSeparado[1];
//Inicia as funções normais do servidor do tempo
ManipuladorJson run = new ManipuladorJson();
String retornoBusca = run.buscaCidade(cidade, estado);
pout.println(toString());
//Retorna para o cliente o resultado da busca
System.out.println("Enviando resposta para o cliente...");
try {
Thread.sleep(6000);
} catch (InterruptedException ex) {
Logger.getLogger(Operacao.class.getName()).log(Level.SEVERE, null, ex);
}
bin = new BufferedReader(new InputStreamReader(in));
//Armazena em buffer o resultado
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
OutputStream outputStream = null;
try {
outputStream = client.getOutputStream();
} catch (IOException ex) {
Logger.getLogger(Operacao.class.getName()).log(Level.SEVERE, null, ex);
}
//Transforma a string em Bytes
outputStream.write(retornoBusca.getBytes());
//Envia a String para o servidor
PrintWriter envia = new PrintWriter(client.getOutputStream(), true);
try {
pout.println();
} catch (Exception e) {
System.out.println("ERRO de parâmetros");
//client.close();
return;
}
while ((line = bin.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
} catch (InterruptedException ex) {
Logger.getLogger(Operacao.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
try {
System.out.println("Buscando noticias na Web");
Thread.sleep(6000);
//Inicia as funções normais do servidor de noticias
ServidorNoticias executa = ServidorNoticias.getInstancia();
ManipuladorJsonNoticia json = new ManipuladorJsonNoticia(0);
ManipuladorJsonNoticia json2 = new ManipuladorJsonNoticia(2);
ManipuladorJsonNoticia json3 = new ManipuladorJsonNoticia(4);
Noticia selecionada = json.preenchendoDadosCidadeEscolhida();
Noticia selecionada2 = json2.preenchendoDadosCidadeEscolhida();
Noticia selecionada3 = json3.preenchendoDadosCidadeEscolhida();
pout.println(toString());
//Armazena em buffer o resultado
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
OutputStream outputStream = null;
try {
outputStream = client.getOutputStream();
} catch (IOException ex) {
Logger.getLogger(Operacao.class.getName()).log(Level.SEVERE, null, ex);
}
//Transforma a string em Bytes
System.out.println("Tratando dos dados recebidos");
String autor = selecionada.getAutor();
String titulo = selecionada.getTitulo();
String resumo = selecionada.getResumo().toString();
System.out.println(resumo);
outputStream.write(autor.getBytes());
PrintWriter envia = new PrintWriter(client.getOutputStream(), true);
outputStream.write(titulo.getBytes());
envia = new PrintWriter(client.getOutputStream(), true);
outputStream.write(resumo.getBytes());
envia = new PrintWriter(client.getOutputStream(), true);
//Envia a String para o servidor
System.out.println("Enviando dados para o cliente");
//PrintWriter envia = new PrintWriter(client.getOutputStream(), true);
try {
pout.println();
} catch (Exception e) {
System.out.println("ERRO de parâmetros");
//client.close();
return;
}
while ((line = bin.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
} catch (InterruptedException ex) {
Logger.getLogger(Operacao.class.getName()).log(Level.SEVERE, null, ex);
}
}
} catch (IOException x) {
}
}
}
| [
"rafaelbartorres@gmail.com"
] | rafaelbartorres@gmail.com |
b0020bb21f4fa0a64ee2e23a580ea827076d3e9f | b0b21a582e9fe835a890834319a4ca9621ed6bd5 | /knaps/src/com/knaps/dev/Enums/LineStatus.java | 6724450a5bce82a49c3b4033e14826c66516ffdb | [] | no_license | bamanuel/knapsSPmetro | e138c043c7069c5e837997e82b3efd2d535e813f | 673f99b744830a5802098ca4d38eb51438f02955 | refs/heads/master | 2021-01-17T23:24:04.833779 | 2011-12-04T23:21:33 | 2011-12-04T23:21:33 | 2,754,125 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 489 | java | package com.knaps.dev.Enums;
public enum LineStatus {
OPEN (1),
CLOSED (2),
STOPPED (3),
REDUCED_VELOCITY (4);
private final int index;
LineStatus(int index) {
this.index = index;
}
public int index() {
return index;
}
public static LineStatus fromString(int key) {
for (LineStatus b : LineStatus.values()) {
if (key == b.index) {
return b;
}
}
return null;
}
} | [
"niftynei@gmail.com"
] | niftynei@gmail.com |
b410916c83de0208cf7e6b6e9c1285cbe28e4ea0 | 380ac4dc4deebcbe6fc142c7e4ed0cd8bf6b218e | /jukebox/src/main/java/com/innoventes/jukebox/model/Album.java | 47799bab6c20a52297e38d7f3d59ce1afade95c0 | [] | no_license | SaikumarYerupalli/jukebox | 930952457064e5113d48eb14c3e55608908f0ed7 | 87eca79e54f45b9c59604c90cfd7b84ee568a2c1 | refs/heads/main | 2023-02-09T06:17:03.945213 | 2021-01-01T07:16:54 | 2021-01-01T07:16:54 | 325,727,658 | 0 | 0 | null | 2021-01-01T07:16:55 | 2020-12-31T06:04:43 | null | UTF-8 | Java | false | false | 3,862 | java | package com.innoventes.jukebox.model;
import java.util.Date;
import java.util.List;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
@Entity
@Table(name="MUSIC_ALBUM")
@Access(value=AccessType.FIELD)
@JsonIdentityInfo(
generator = ObjectIdGenerators.PropertyGenerator.class,
property = "albumId") // this is to solve infinte recursion
public class Album {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "albumIdSequence")
@SequenceGenerator(name = "albumIdSequence", sequenceName = "ALBUM_ID_SEQUENCE",allocationSize=1)
@Column(name = "ALBUM_ID")
private Long albumId;
@Column(name = "NAME",unique=true)
@Length(min=5)
@NotNull
@NotBlank(message="Name is mandatory")
private String name;
@Column(name = "MUSIC_TYPE")
private String type;
@Column(name = "PRICE")
@Min(100)
@Max(1000)
@NotNull
private int price;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "CREATION_DATE")
@NotNull
@Temporal(TemporalType.TIMESTAMP)
@JsonFormat(shape=JsonFormat.Shape.STRING,pattern="dd/MM/yyyy")
private Date creationDate;
@ManyToMany(fetch =FetchType.LAZY,cascade = CascadeType.ALL)
@JoinTable(name="album_musicians",joinColumns= { @JoinColumn(name = "album_id")},inverseJoinColumns = {@JoinColumn(name="musician_id")})
private List<Musician> musicians;
public Album() {
super();
}
public Album(String name, String type, int price, String description, List<Musician> musicians) {
this.name = name;
this.type = type;
this.price = price;
this.description = description;
this.musicians = musicians;
}
public Long getAlbumId() {
return albumId;
}
public void setAlbumId(Long albumId) {
this.albumId = albumId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getCreationDate() {
return creationDate;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public List<Musician> getMusicians() {
return musicians;
}
public void setMusicians(List<Musician> musicians) {
this.musicians = musicians;
}
@Override
public boolean equals(Object object)
{
if(this == object)
return true;
if(object == null || object.getClass()!=this.getClass())
return false;
Album album = (Album)object;
return (album.getAlbumId() == this.getAlbumId());
}
@Override
public String toString(){
return this.getName();
}
@Override
public int hashCode(){
return Integer.parseInt(this.getAlbumId().toString());
}
}
| [
"sai.yerupalli@gmail.com"
] | sai.yerupalli@gmail.com |
ba8eb7df8b719744548e05cee58af4697dafdeae | a8ea3c5fc8a7672dd8a3e68cb869850b76b0c039 | /CP-BPTC_Framework/src/BPTC/Testing/TestCases/SaturdayAndSundayBooking.java | a22dcb1e48925c2129d309ac787df344f261cca6 | [] | no_license | akhaleshyadav/CP_BPTC | 13c7415818d1200e78b2c186c5a898b2c928ba84 | 7c95871e324215adf533c2ca8e452e4bc29f4b30 | refs/heads/master | 2020-07-21T17:03:39.975656 | 2020-01-28T13:38:08 | 2020-01-28T13:38:08 | 206,926,873 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,096 | java | package BPTC.Testing.TestCases;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
import BPTC.Testing.Base.Base;
import BPTC.Testing.POM.Login;
import BPTC.Testing.POM.TripBooking;
import BPTC.utilities.Logs;
@Test
public class SaturdayAndSundayBooking extends Base {
public void SaturdayAndSundayBooking() throws InterruptedException
{
try {
WebElement lgb=driver.findElement(By.id("lnkLogin"));
lgb.click();
Thread.sleep(3000);
Login l=new Login(driver, pr);
l.Signin("testnk","Hbss2004");
Logs.Takelog("SaturdayAndSundayBooking", "User Logged in successfully");
Thread.sleep(3000);
TripBooking tp=new TripBooking(driver,pr);
tp.SingleTripBooking("02/01/2020"); //put the coming Saturday date
Logs.Takelog("SaturdayBooking", "Saturday trip booked");
tp.SingleTripBooking("02/02/2020");
Logs.Takelog("SundayBooking", "Sunday trip booked");
}
catch(Exception e) {
Logs.Takelog("SaturdayAndSundayBooking", e.getMessage());
Logs.takescreens();
}
}}
| [
"Akhalesh@QA-003"
] | Akhalesh@QA-003 |
3fcc98e225f84995b56d6375878ef91534727768 | 1b5c2cee7233c6e4e58f6a5a8d08f64c324bc745 | /src/main/java/apex/gl/VAOModel.java | 6f11eab64b28e2b360c57e7e7ffa309bffa8f3db | [] | no_license | PatrickYounan/ApexGL | 32ef2cc69cdbd3904e8cdf6c15a200e955c8ca90 | f3293279b0aeab98166bb819756f604fec94fc2f | refs/heads/master | 2023-06-19T21:50:52.219421 | 2021-07-15T02:16:30 | 2021-07-15T02:16:30 | 385,421,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,401 | java | package apex.gl;
import static org.lwjgl.opengl.GL11.GL_FLOAT;
import static org.lwjgl.opengl.GL15.*;
import static org.lwjgl.opengl.GL20.glEnableVertexAttribArray;
import static org.lwjgl.opengl.GL20.glVertexAttribPointer;
import static org.lwjgl.opengl.GL30.*;
/**
* @author Patrick Younan
* @date Created on 11/07/2021 using IntelliJ IDEA.
*/
public final class VAOModel implements Model {
private Texture texture;
private int vao, vbo, ebo;
private boolean binded;
private VAOModel(GameStore store, float[] vertices, int[] elements, VAOModelAttribute... attributes) {
vao = glGenVertexArrays();
vbo = glGenBuffers();
ebo = glGenBuffers();
bind();
glBufferData(GL_ARRAY_BUFFER, vertices, GL_STATIC_DRAW);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, elements, GL_STATIC_DRAW);
int pointer = 0;
for (VAOModelAttribute attribute : attributes) {
glVertexAttribPointer(attribute.getIndex(), attribute.getSize(), GL_FLOAT, false, attribute.getStride(), pointer);
glEnableVertexAttribArray(attribute.getIndex());
pointer += attribute.getSize() * Float.BYTES;
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
unbind();
store.addDisposable(this);
}
public void setTexture(Texture texture) {
this.texture = texture;
}
@Override
public void bind() {
if (binded)
return;
if (texture != null)
texture.bind();
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
binded = true;
}
@Override
public void unbind() {
if (!binded)
return;
if (texture != null)
texture.unbind();
glBindVertexArray(0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
binded = false;
}
@Override
public void dispose() {
unbind();
glDeleteVertexArrays(vao);
glDeleteBuffers(ebo);
glDeleteBuffers(vbo);
}
@Override
public boolean isBinded() {
return binded;
}
public static VAOModel create(GameStore store, float[] vertices, int[] elements, VAOModelAttribute... attributes) {
return new VAOModel(store, vertices, elements, attributes);
}
}
| [
"patrickyounan@hotmail.com"
] | patrickyounan@hotmail.com |
6da09b969619b6cd4ed2acfc374a66ef1eb3e564 | 82778cebb375169b39392c9c8122551c915e5def | /src/main/java/com/codeup/springproject/models/User.java | 58c0340b7a1e8299edce6c588561e25934b625ab | [] | no_license | ramonhubbell/spring-project | d33a494a838edd85b4eb55b4c9dec85380761fd0 | 56daa601bf8a5434816a84f004eefacceb93a86b | refs/heads/master | 2022-12-03T18:59:59.947137 | 2020-08-19T20:00:51 | 2020-08-19T20:00:51 | 274,141,760 | 0 | 0 | null | 2020-08-19T20:00:52 | 2020-06-22T13:16:40 | Java | UTF-8 | Java | false | false | 1,562 | java | package com.codeup.springproject.models;
import javax.persistence.*;
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(nullable = false, length = 50, unique = true)
private String username;
@Column(nullable = false, length = 100, unique = true)
private String email;
@Column(nullable = false)
private String password;
public User(){
}
public User(String username, String email, String password){
this.username = username;
this.email = email;
this.password = password;
}
public User(long id, String username, String email, String password){
this.id = id;
this.username = username;
this.email = email;
this.password = password;
}
public User(User copy){
id = copy.id;
username = copy.username;
email = copy.email;
password = copy.password;
}
public long getId(){
return this.id;
}
public void setId(long id){
this.id = id;
}
public String getUsername(){
return this.username;
}
public void setUsername(String username){
this.username = username;
}
public String getEmail(){
return this.email;
}
public void setEmail(String email){
this.email = email;
}
public String getPassword(){
return this.password;
}
public void setPassword(String password){
this.password = password;
}
}
| [
"Ramon.hubbell@gmail.com"
] | Ramon.hubbell@gmail.com |
63c81f02c86d4de99315f937a69805f694a1b3a9 | 9f004c3df4413eb826c229332d95130a1d5c8457 | /src/neha/assignment_15/Assignment15pg3.java | 45a7937b80ec851a69f6fab9846fbb4217c69f93 | [] | no_license | MayurSTechnoCredit/JAVATechnoJuly2021 | dd8575c800e8f0cac5bab8d5ea32b25f7131dd0d | 3a422553a0d09b6a99e528c73cc2b8efe260a07a | refs/heads/master | 2023-08-22T14:43:37.980748 | 2021-10-16T06:33:34 | 2021-10-16T06:33:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | package neha.assignment_15;
/*program 3 : return difference between sum of even number - sum of odd numbers. Difference has to be positive.
* print the answer in main method.
int[] arr = {12,2,13,9}
hint : 22 - 14 = 8
output : 8
int[] arr = {13,22,10,3}
hint : 32 - 16 = 16
output : 16*/
public class Assignment15pg3 {
int diffSumEvenAndSumOdd(int[] numArr) {
int evenSum, oddSum;
evenSum = 0;
oddSum = 0;
for (int index = 0; index < numArr.length; index++) {
if (numArr[index] % 2 == 0)
evenSum += numArr[index];
if (numArr[index] % 2 != 0)
oddSum += numArr[index];
}
return Math.abs(evenSum - oddSum);
}
public static void main(String[] args) {
Assignment15pg3 assignment15pg3 = new Assignment15pg3();
int[] arr = {13,22,10,3};
System.out.println("Difference between sum of even number - sum of odd numbers is "
+ assignment15pg3.diffSumEvenAndSumOdd(arr));
}
}
| [
"neha19.a.joshi@gmail.com"
] | neha19.a.joshi@gmail.com |
9cf34fbb37b69080e1381c8d109ee57cbc402b1e | fa93c9be2923e697fb8a2066f8fb65c7718cdec7 | /sources/com/avito/android/user_adverts/tab_screens/advert_list/linked_info_banner/LinkedInfoBannerBlueprint.java | 5960c30de177b05c2cbc624495968c350a4ee13e | [] | no_license | Auch-Auch/avito_source | b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b | 76fdcc5b7e036c57ecc193e790b0582481768cdc | refs/heads/master | 2023-05-06T01:32:43.014668 | 2021-05-25T10:19:22 | 2021-05-25T10:19:22 | 370,650,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,989 | java | package com.avito.android.user_adverts.tab_screens.advert_list.linked_info_banner;
import android.view.View;
import android.view.ViewGroup;
import com.avito.android.remote.auth.AuthSource;
import com.avito.android.user_adverts.R;
import com.avito.android.util.text.AttributedTextFormatter;
import com.avito.konveyor.blueprint.Item;
import com.avito.konveyor.blueprint.ItemBlueprint;
import com.avito.konveyor.blueprint.ItemPresenter;
import com.avito.konveyor.blueprint.ViewHolderBuilder;
import javax.inject.Inject;
import kotlin.Metadata;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Lambda;
import org.jetbrains.annotations.NotNull;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000:\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\b\u0018\u00002\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00030\u0001B\u0019\b\u0007\u0012\u0006\u0010\u000e\u001a\u00020\t\u0012\u0006\u0010\u0012\u001a\u00020\u000f¢\u0006\u0004\b\u001a\u0010\u001bJ\u0017\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0005\u001a\u00020\u0004H\u0016¢\u0006\u0004\b\u0007\u0010\bR\u001c\u0010\u000e\u001a\u00020\t8\u0016@\u0016X\u0004¢\u0006\f\n\u0004\b\n\u0010\u000b\u001a\u0004\b\f\u0010\rR\u0016\u0010\u0012\u001a\u00020\u000f8\u0002@\u0002X\u0004¢\u0006\u0006\n\u0004\b\u0010\u0010\u0011R\"\u0010\u0019\u001a\b\u0012\u0004\u0012\u00020\u00140\u00138\u0016@\u0016X\u0004¢\u0006\f\n\u0004\b\u0015\u0010\u0016\u001a\u0004\b\u0017\u0010\u0018¨\u0006\u001c"}, d2 = {"Lcom/avito/android/user_adverts/tab_screens/advert_list/linked_info_banner/LinkedInfoBannerBlueprint;", "Lcom/avito/konveyor/blueprint/ItemBlueprint;", "Lcom/avito/android/user_adverts/tab_screens/advert_list/linked_info_banner/LinkedInfoBannerItemView;", "Lcom/avito/android/user_adverts/tab_screens/advert_list/linked_info_banner/LinkedInfoBannerItem;", "Lcom/avito/konveyor/blueprint/Item;", "item", "", "isRelevantItem", "(Lcom/avito/konveyor/blueprint/Item;)Z", "Lcom/avito/android/user_adverts/tab_screens/advert_list/linked_info_banner/LinkedInfoBannerPresenter;", AuthSource.BOOKING_ORDER, "Lcom/avito/android/user_adverts/tab_screens/advert_list/linked_info_banner/LinkedInfoBannerPresenter;", "getPresenter", "()Lcom/avito/android/user_adverts/tab_screens/advert_list/linked_info_banner/LinkedInfoBannerPresenter;", "presenter", "Lcom/avito/android/util/text/AttributedTextFormatter;", "c", "Lcom/avito/android/util/text/AttributedTextFormatter;", "textFormatter", "Lcom/avito/konveyor/blueprint/ViewHolderBuilder$ViewHolderProvider;", "Lcom/avito/android/user_adverts/tab_screens/advert_list/linked_info_banner/LinkedInfoBannerItemViewImpl;", AuthSource.SEND_ABUSE, "Lcom/avito/konveyor/blueprint/ViewHolderBuilder$ViewHolderProvider;", "getViewHolderProvider", "()Lcom/avito/konveyor/blueprint/ViewHolderBuilder$ViewHolderProvider;", "viewHolderProvider", "<init>", "(Lcom/avito/android/user_adverts/tab_screens/advert_list/linked_info_banner/LinkedInfoBannerPresenter;Lcom/avito/android/util/text/AttributedTextFormatter;)V", "user-adverts_release"}, k = 1, mv = {1, 4, 2})
public final class LinkedInfoBannerBlueprint implements ItemBlueprint<LinkedInfoBannerItemView, LinkedInfoBannerItem> {
@NotNull
public final ViewHolderBuilder.ViewHolderProvider<LinkedInfoBannerItemViewImpl> a = new ViewHolderBuilder.ViewHolderProvider<>(R.layout.linked_info_banner, new a(this));
@NotNull
public final LinkedInfoBannerPresenter b;
public final AttributedTextFormatter c;
public static final class a extends Lambda implements Function2<ViewGroup, View, LinkedInfoBannerItemViewImpl> {
public final /* synthetic */ LinkedInfoBannerBlueprint a;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public a(LinkedInfoBannerBlueprint linkedInfoBannerBlueprint) {
super(2);
this.a = linkedInfoBannerBlueprint;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
@Override // kotlin.jvm.functions.Function2
public LinkedInfoBannerItemViewImpl invoke(ViewGroup viewGroup, View view) {
View view2 = view;
Intrinsics.checkNotNullParameter(viewGroup, "<anonymous parameter 0>");
Intrinsics.checkNotNullParameter(view2, "view");
return new LinkedInfoBannerItemViewImpl(view2, this.a.c);
}
}
@Inject
public LinkedInfoBannerBlueprint(@NotNull LinkedInfoBannerPresenter linkedInfoBannerPresenter, @NotNull AttributedTextFormatter attributedTextFormatter) {
Intrinsics.checkNotNullParameter(linkedInfoBannerPresenter, "presenter");
Intrinsics.checkNotNullParameter(attributedTextFormatter, "textFormatter");
this.b = linkedInfoBannerPresenter;
this.c = attributedTextFormatter;
}
@Override // com.avito.konveyor.blueprint.ItemBlueprint
@NotNull
public ViewHolderBuilder.ViewHolderProvider<LinkedInfoBannerItemViewImpl> getViewHolderProvider() {
return this.a;
}
@Override // com.avito.konveyor.blueprint.ItemBlueprint
public boolean isRelevantItem(@NotNull Item item) {
Intrinsics.checkNotNullParameter(item, "item");
return item instanceof LinkedInfoBannerItem;
}
/* Return type fixed from 'com.avito.android.user_adverts.tab_screens.advert_list.linked_info_banner.LinkedInfoBannerPresenter' to match base method */
@Override // com.avito.konveyor.blueprint.ItemBlueprint
@NotNull
public ItemPresenter<LinkedInfoBannerItemView, LinkedInfoBannerItem> getPresenter() {
return this.b;
}
}
| [
"auchhunter@gmail.com"
] | auchhunter@gmail.com |
19409404197ee7963fb6d11bca28d33a84dc851a | 13bba69203ce68eb548666240e5aa76da27e4364 | /app/src/main/java/com/example/memeshare/GetMethod.java | 7d25f0719f41aba8f0888129517cee8269d027a1 | [] | no_license | Manish8798/Meme-share | 17d08ec8b04b78b2e86b214a54c349afa13361ea | e566d4cd304cfd8f74e9dfaa669d08f05a2bd527 | refs/heads/master | 2023-04-26T02:05:34.588421 | 2021-05-31T16:05:42 | 2021-05-31T16:05:42 | 296,164,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 559 | java | package com.example.memeshare;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class GetMethod {
static final String BASE_URL = "https://meme-api.herokuapp.com/";
private static Retrofit retrofit = null;
public static Retrofit getRetrofit(){
if(retrofit == null){
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
}
| [
"mankum08071998@gmail.com"
] | mankum08071998@gmail.com |
25cbd50ae6da0d43c6baf7f3c119e4732a91b81e | 44bb18dc9afd8a5acfc564636295edf47859da87 | /src/main/java/com/dasinong/ploughHelper/dao/EntityHibernateDao.java | d86110910c0200b0789c371165e971c88ec7d08f | [] | no_license | Dasinong/PloughHelper | f5eac033929156a83cf0b80a637f545b99d680f9 | 347b25c2741b5bea51604cb2d6eea7267c9cbbcd | refs/heads/master | 2021-03-22T04:47:22.835913 | 2015-12-11T08:15:46 | 2015-12-11T08:15:46 | 36,164,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,149 | java | package com.dasinong.ploughHelper.dao;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
*
* @author xiahonggao
*
* Hibernate implementation of IEntityDao
*/
public class EntityHibernateDao<T> extends HibernateDaoSupport implements IEntityDao<T> {
protected Class<T> entityType;
public EntityHibernateDao() {
this.entityType = ((Class<T>) ((ParameterizedType) getClass().getGenericSuperclass())
.getActualTypeArguments()[0]);
}
@Override
public void save(T entity) {
this.getHibernateTemplate().save(entity);
}
@Override
public void update(T entity) {
this.getHibernateTemplate().update(entity);
}
@Override
public void delete(T entity) {
this.getHibernateTemplate().delete(entity);
}
@Override
public T findById(Long id) {
return this.getHibernateTemplate().get(this.entityType, id);
}
@Override
public List<T> findAll() {
return this.getHibernateTemplate().find("from " + this.entityType.getName());
}
}
| [
"xiahonggao@XiahongdeMacBook-Pro.local"
] | xiahonggao@XiahongdeMacBook-Pro.local |
7d65b0761a12780eb18feb5fc9949bf9510d5364 | 3190881fef8dc4a5856f4c50c801ce86d58b24ca | /jdk_test/src/main/java/concurrent/exchange/ProducerConsumerTest.java | b52391d012c51c4e269c460cb47d7902d1128063 | [] | no_license | jeven2016/TestGradle | 8954df1b81b9ca2e95e0a0b8bccb92414cb1e7fd | 28f2a2dc654c6ff5f58fa7b1b57dc76b393a51f4 | refs/heads/master | 2021-06-08T23:44:58.409561 | 2019-03-19T08:10:20 | 2019-03-19T08:10:20 | 154,330,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,566 | java | package concurrent.exchange;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.Exchanger;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* 允许2个并发任务间相互交换数据的同步应用。更具体的说,Exchanger 类允许在2个线程间定义同步点,
* 当2个线程到达这个点,他们相互交换数据类型,使用第一个线程的数据类型变成第二个的,然后第二个线程的数据类型变成第一个的。
*/
public class ProducerConsumerTest {
public static void main(String[] args) {
Exchanger<List<String>> exchanger = new Exchanger<>();
Producer producer = new Producer(exchanger);
Consumer consumer = new Consumer(exchanger);
producer.start();
consumer.start();
}
static class Producer extends Thread {
Exchanger<List<String>> exchanger;
public Producer(Exchanger<List<String>> exchanger) {
this.exchanger = exchanger;
}
public void run() {
List<String> list;
list = generateList();
int i = 0;
while (true) {
try {
if (i == 3) {
return;
}
List<String> list2 = this.exchanger.exchange(list);
i++;
TimeUnit.SECONDS.sleep(3);
/*System.out.println("===Produce : get data from consumer ===");
list2.forEach(val -> System.out.print(val + ","));
System.out.println("================== END ===================");*/
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private List<String> generateList() {
List<String> list = new ArrayList<>();
Random random = new Random();
for (int i = 0; i < 10; i++) {
list.add("val-" + random.nextInt(200));
}
return list;
}
}
static class Consumer extends Thread {
Exchanger<List<String>> exchanger;
public Consumer(Exchanger<List<String>> exchanger) {
this.exchanger = exchanger;
}
public void run() {
List<String> list = new ArrayList<>();
Random random = new Random();
while (true) {
try {
list = this.exchanger.exchange(list);
System.out.println("===Consumer : get data from consumer ===");
list.forEach(val -> System.out.print(val + ","));
System.out.println("\n================== END ===================");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
| [
"jujucom@126.com"
] | jujucom@126.com |
1d9b96f85fba0a12e7165603cd02305a65d78ea8 | 0584934e400a5a799ce5547b90372fc64d014a1a | /yymz/src/com/model/Message.java | b66437caf537421005db4aa65fcdc195ec0fe47a | [] | no_license | chenkingDu/hospitalappointment | 07d97de7af63395f9c4b477158794b027a9584d0 | 7eb5f76b163376b0d713208c73deb03c188a6060 | refs/heads/master | 2022-01-05T21:15:25.059706 | 2019-05-09T13:41:19 | 2019-05-09T13:41:19 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 1,597 | java | package com.model;
/**
* ÁôÑÔʵÌå·â×°Àà
*
*/
public class Message implements java.io.Serializable{
private int id;
private String name;
private String title;
private String content;
private String time;
private int nameId;
public Message() {
super();
}
public Message(int id, String name, String title, String content,
String time, int nameId) {
super();
this.id = id;
this.name = name;
this.title = title;
this.content = content;
this.time = time;
this.nameId = nameId;
}
public int getNameId() {
return nameId;
}
public void setNameId(int nameId) {
this.nameId = nameId;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {return name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
return "Message [id=" + id + ", name=" + name + ", title=" + title
+ ", content=" + content + ", time=" + time + ", nameId="
+ nameId + "]";
}
} | [
"you@example.com"
] | you@example.com |
220442b1394b76a2905a9db23a26d8feeaffb473 | 1f9e724404340cf3edb0e8760f7aeba2a9bfa6f1 | /src/test/java/com/mycompany/bugtracker/web/rest/TicketResourceIT.java | 3565be88796361b4c695658b141dd9973cf366a5 | [] | no_license | mehdizj2000/BugTrackerJHipster | 3a67c2dcde11ffb0959fde170642a5a8f6e84b80 | 9e5c9b74dced2ac427f6c698fde27343b61798a6 | refs/heads/main | 2023-02-26T12:02:11.033379 | 2021-01-31T09:31:04 | 2021-01-31T09:31:04 | 334,571,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,244 | java | package com.mycompany.bugtracker.web.rest;
import com.mycompany.bugtracker.BugTrackerJHipsterApp;
import com.mycompany.bugtracker.domain.Ticket;
import com.mycompany.bugtracker.repository.TicketRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.mockito.Mockito.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Integration tests for the {@link TicketResource} REST controller.
*/
@SpringBootTest(classes = BugTrackerJHipsterApp.class)
@ExtendWith(MockitoExtension.class)
@AutoConfigureMockMvc
@WithMockUser
public class TicketResourceIT {
private static final String DEFAULT_TITLE = "AAAAAAAAAA";
private static final String UPDATED_TITLE = "BBBBBBBBBB";
private static final String DEFAULT_DESCRIPTION = "AAAAAAAAAA";
private static final String UPDATED_DESCRIPTION = "BBBBBBBBBB";
private static final LocalDate DEFAULT_DUE_DATE = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_DUE_DATE = LocalDate.now(ZoneId.systemDefault());
private static final Boolean DEFAULT_DONE = false;
private static final Boolean UPDATED_DONE = true;
@Autowired
private TicketRepository ticketRepository;
@Mock
private TicketRepository ticketRepositoryMock;
@Autowired
private EntityManager em;
@Autowired
private MockMvc restTicketMockMvc;
private Ticket ticket;
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static Ticket createEntity(EntityManager em) {
Ticket ticket = new Ticket()
.title(DEFAULT_TITLE)
.description(DEFAULT_DESCRIPTION)
.dueDate(DEFAULT_DUE_DATE)
.done(DEFAULT_DONE);
return ticket;
}
/**
* Create an updated entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static Ticket createUpdatedEntity(EntityManager em) {
Ticket ticket = new Ticket()
.title(UPDATED_TITLE)
.description(UPDATED_DESCRIPTION)
.dueDate(UPDATED_DUE_DATE)
.done(UPDATED_DONE);
return ticket;
}
@BeforeEach
public void initTest() {
ticket = createEntity(em);
}
@Test
@Transactional
public void createTicket() throws Exception {
int databaseSizeBeforeCreate = ticketRepository.findAll().size();
// Create the Ticket
restTicketMockMvc.perform(post("/api/tickets")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(ticket)))
.andExpect(status().isCreated());
// Validate the Ticket in the database
List<Ticket> ticketList = ticketRepository.findAll();
assertThat(ticketList).hasSize(databaseSizeBeforeCreate + 1);
Ticket testTicket = ticketList.get(ticketList.size() - 1);
assertThat(testTicket.getTitle()).isEqualTo(DEFAULT_TITLE);
assertThat(testTicket.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
assertThat(testTicket.getDueDate()).isEqualTo(DEFAULT_DUE_DATE);
assertThat(testTicket.isDone()).isEqualTo(DEFAULT_DONE);
}
@Test
@Transactional
public void createTicketWithExistingId() throws Exception {
int databaseSizeBeforeCreate = ticketRepository.findAll().size();
// Create the Ticket with an existing ID
ticket.setId(1L);
// An entity with an existing ID cannot be created, so this API call must fail
restTicketMockMvc.perform(post("/api/tickets")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(ticket)))
.andExpect(status().isBadRequest());
// Validate the Ticket in the database
List<Ticket> ticketList = ticketRepository.findAll();
assertThat(ticketList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void checkTitleIsRequired() throws Exception {
int databaseSizeBeforeTest = ticketRepository.findAll().size();
// set the field null
ticket.setTitle(null);
// Create the Ticket, which fails.
restTicketMockMvc.perform(post("/api/tickets")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(ticket)))
.andExpect(status().isBadRequest());
List<Ticket> ticketList = ticketRepository.findAll();
assertThat(ticketList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void getAllTickets() throws Exception {
// Initialize the database
ticketRepository.saveAndFlush(ticket);
// Get all the ticketList
restTicketMockMvc.perform(get("/api/tickets?sort=id,desc"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(ticket.getId().intValue())))
.andExpect(jsonPath("$.[*].title").value(hasItem(DEFAULT_TITLE)))
.andExpect(jsonPath("$.[*].description").value(hasItem(DEFAULT_DESCRIPTION)))
.andExpect(jsonPath("$.[*].dueDate").value(hasItem(DEFAULT_DUE_DATE.toString())))
.andExpect(jsonPath("$.[*].done").value(hasItem(DEFAULT_DONE.booleanValue())));
}
@SuppressWarnings({"unchecked"})
public void getAllTicketsWithEagerRelationshipsIsEnabled() throws Exception {
when(ticketRepositoryMock.findAllWithEagerRelationships(any())).thenReturn(new PageImpl(new ArrayList<>()));
restTicketMockMvc.perform(get("/api/tickets?eagerload=true"))
.andExpect(status().isOk());
verify(ticketRepositoryMock, times(1)).findAllWithEagerRelationships(any());
}
@SuppressWarnings({"unchecked"})
public void getAllTicketsWithEagerRelationshipsIsNotEnabled() throws Exception {
when(ticketRepositoryMock.findAllWithEagerRelationships(any())).thenReturn(new PageImpl(new ArrayList<>()));
restTicketMockMvc.perform(get("/api/tickets?eagerload=true"))
.andExpect(status().isOk());
verify(ticketRepositoryMock, times(1)).findAllWithEagerRelationships(any());
}
@Test
@Transactional
public void getTicket() throws Exception {
// Initialize the database
ticketRepository.saveAndFlush(ticket);
// Get the ticket
restTicketMockMvc.perform(get("/api/tickets/{id}", ticket.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$.id").value(ticket.getId().intValue()))
.andExpect(jsonPath("$.title").value(DEFAULT_TITLE))
.andExpect(jsonPath("$.description").value(DEFAULT_DESCRIPTION))
.andExpect(jsonPath("$.dueDate").value(DEFAULT_DUE_DATE.toString()))
.andExpect(jsonPath("$.done").value(DEFAULT_DONE.booleanValue()));
}
@Test
@Transactional
public void getNonExistingTicket() throws Exception {
// Get the ticket
restTicketMockMvc.perform(get("/api/tickets/{id}", Long.MAX_VALUE))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateTicket() throws Exception {
// Initialize the database
ticketRepository.saveAndFlush(ticket);
int databaseSizeBeforeUpdate = ticketRepository.findAll().size();
// Update the ticket
Ticket updatedTicket = ticketRepository.findById(ticket.getId()).get();
// Disconnect from session so that the updates on updatedTicket are not directly saved in db
em.detach(updatedTicket);
updatedTicket
.title(UPDATED_TITLE)
.description(UPDATED_DESCRIPTION)
.dueDate(UPDATED_DUE_DATE)
.done(UPDATED_DONE);
restTicketMockMvc.perform(put("/api/tickets")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(updatedTicket)))
.andExpect(status().isOk());
// Validate the Ticket in the database
List<Ticket> ticketList = ticketRepository.findAll();
assertThat(ticketList).hasSize(databaseSizeBeforeUpdate);
Ticket testTicket = ticketList.get(ticketList.size() - 1);
assertThat(testTicket.getTitle()).isEqualTo(UPDATED_TITLE);
assertThat(testTicket.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
assertThat(testTicket.getDueDate()).isEqualTo(UPDATED_DUE_DATE);
assertThat(testTicket.isDone()).isEqualTo(UPDATED_DONE);
}
@Test
@Transactional
public void updateNonExistingTicket() throws Exception {
int databaseSizeBeforeUpdate = ticketRepository.findAll().size();
// If the entity doesn't have an ID, it will throw BadRequestAlertException
restTicketMockMvc.perform(put("/api/tickets")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(ticket)))
.andExpect(status().isBadRequest());
// Validate the Ticket in the database
List<Ticket> ticketList = ticketRepository.findAll();
assertThat(ticketList).hasSize(databaseSizeBeforeUpdate);
}
@Test
@Transactional
public void deleteTicket() throws Exception {
// Initialize the database
ticketRepository.saveAndFlush(ticket);
int databaseSizeBeforeDelete = ticketRepository.findAll().size();
// Delete the ticket
restTicketMockMvc.perform(delete("/api/tickets/{id}", ticket.getId())
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isNoContent());
// Validate the database contains one less item
List<Ticket> ticketList = ticketRepository.findAll();
assertThat(ticketList).hasSize(databaseSizeBeforeDelete - 1);
}
}
| [
"zareimeh@gmail.com"
] | zareimeh@gmail.com |
9b097ec395a962bfb687aadc95db30f8a518588d | 0889521f422166404e325d3716e0b6ddbdef8ff1 | /src/main/java/com/pinpinbox/android/Views/HeaderScroll/scrollable/ColorRandomizer.java | 92285a4ccd30be9662e95b7c01eef216afbec50d | [] | no_license | pinpinbox/app | 8efac19291b0d243ee305971cb43944878334adf | a32914264de932e73f762396a10143149f2ea670 | refs/heads/master | 2021-06-30T01:49:40.132026 | 2019-04-03T08:06:51 | 2019-04-03T08:06:51 | 115,250,997 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 590 | java | package com.pinpinbox.android.Views.HeaderScroll.scrollable;
import android.os.SystemClock;
import java.util.Random;
/**
* Created by vmage on 2016/8/17.
*/
public class ColorRandomizer {
private final Random mRandom;
private final int[] mColors;
private final int mMax;
public ColorRandomizer(int[] colors) {
this.mRandom = new Random(SystemClock.elapsedRealtime());
this.mColors = colors;
this.mMax = mColors.length - 1;
}
public int next() {
final int index = mRandom.nextInt(mMax);
return mColors[index];
}
}
| [
"k57764328@vmage.com.tw"
] | k57764328@vmage.com.tw |
6acdcf6f50b3359ce32a60e93975e6be8547d480 | 53ee23c223ae5ff00ffb1658b062ee0aee861511 | /src/main/java/test/util/DBCheckUtil.java | 8b046f1471b4dbb7574e9698bbebe22b5cd6629a | [] | no_license | lingmingyu/api_auto_7 | 1bb039fccb7ff43383f00bd0f887d878f106486e | 5b01f06c4675a54d8d4762b00a70d5fc9318e941 | refs/heads/master | 2022-12-05T18:20:42.041020 | 2020-08-21T09:57:33 | 2020-08-21T09:57:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,580 | java | package test.util;
import com.alibaba.fastjson.JSONObject;
import test.pojo.DBChecker;
import test.pojo.DBQueryResult;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class DBCheckUtil {
/*根据脚本执行查询并返回查询结果
* validateSql 需要执行得查询语句
* */
public static String doQuery(String validateSql) {
//将脚本字符串封装成对象
List<DBChecker> dbCheckers = JSONObject.parseArray(validateSql, DBChecker.class);
List<DBQueryResult> dbQueryResults =new ArrayList<>();
//循环遍历,取出sql脚本执行
for (DBChecker dbChecker:dbCheckers){
//拿到sql的编号
String no =dbChecker.getNo();
String sql =dbChecker.getSql();
//执行查询,获取到结果
Map<String,Object> columnLabelAndValues = JDBCUtil.query(sql);
DBQueryResult dbQueryResult =new DBQueryResult();
dbQueryResult.setNo(no);
dbQueryResult.setColumenLabelAndValues(columnLabelAndValues);
dbQueryResults.add(dbQueryResult);
}
return JSONObject.toJSONString(dbQueryResults);
}
public static void main(String[] args) {
String validateSql="[{\"no\":\"1\",\"sql\":\"select count(*) as totalNum from member where mobilephone='19975275300'\"}]";
List<DBChecker> dbCheckers = JSONObject.parseArray(validateSql, DBChecker.class);
for (DBChecker dbChecker:dbCheckers){
System.out.println(dbChecker);
}
}
}
| [
"553396965@qq.com"
] | 553396965@qq.com |
85632fad8203fc3db1368a8b4ac2edc026a0540e | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/test/java/org/gradle/test/performancenull_392/Testnull_39152.java | 8a9cd7972c96aa7a15ddf724a19c097f2ad3ed95 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 308 | java | package org.gradle.test.performancenull_392;
import static org.junit.Assert.*;
public class Testnull_39152 {
private final Productionnull_39152 production = new Productionnull_39152("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
fd4e8f468c515700ed1697b6c239dcea298177f9 | fb9a203a1bcca9e520f26596d193dcbb19f3923a | /de/schlichtherle/license/AbstractKeyStoreParam.java | ee1d020d85782d3694d6db8419ab58337cb34598 | [] | no_license | lukaszle/TrueLicense | daa307851db6e544a470eb901367cc3ed7d72566 | 68f670d02811eb7dc1b7d2fbd12ed8946d95e5db | refs/heads/master | 2021-01-13T05:37:45.842582 | 2017-06-09T16:15:28 | 2017-06-09T16:15:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,724 | java | /*
* Copyright (C) 2005-2015 Schlichtherle IT Services.
* All rights reserved. Use is subject to license terms.
*/
package de.schlichtherle.license;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
/**
* This is a convenience class implementing the
* {@link KeyStoreParam#getStream()} method.
*
* @author Christian Schlichtherle
* @version $Id$
*/
public abstract class AbstractKeyStoreParam implements KeyStoreParam {
private final Class clazz;
private final String resource;
/**
* Creates a new instance of AbstractKeyStoreParam which will look up
* the given resource using the class loader of the given class when
* calling {@link #getStream()}.
*
* @param clazz the class which refers to the class loader to use.
* @param resource the resource to look up.
*/
protected AbstractKeyStoreParam(final Class clazz, final String resource) {
if (null == clazz || null == resource)
throw new NullPointerException();
this.clazz = clazz;
this.resource = resource;
}
/**
* Looks up the resource provided to the constructor using the classloader
* provided to the constructor and returns it as an {@link InputStream}.
*/
public InputStream getStream() throws IOException {
final InputStream in = clazz.getResourceAsStream(resource);
if (null == in)
throw new FileNotFoundException(resource);
return in;
}
/**
* Returns {@code true} if and only if these key store parameters seem to
* address the same key store entry as the given object.
*
* @param object the object to compare.
* @return {@code true} if and only if these key store parameters seem to
* address the same key store entry as the given object.
*/
public final boolean equals(final Object object) {
if (!(object instanceof AbstractKeyStoreParam))
return false;
final AbstractKeyStoreParam that = (AbstractKeyStoreParam) object;
return this.clazz.equals(that.clazz)
&& this.resource.equals(that.resource)
&& this.getAlias().equals(that.getAlias());
}
/**
* Returns a hash code which is consistent with {@link #equals(Object)}.
*
* @return A hash code which is consistent with {@link #equals(Object)}.
*/
public final int hashCode() {
int c = 17;
c = 37 * c + this.clazz.hashCode();
c = 37 * c + this.resource.hashCode();
c = 37 * c + this.getAlias().hashCode();
return c;
}
}
| [
"ali@sparklinedata.com"
] | ali@sparklinedata.com |
0438367e2146af531ebc7536fbd41ea847b3c1fc | 07909c4bfbf05755ca7f10238e1294e151c6e378 | /src/main/java/br/pucminas/orderingmicroservice/api/config/SwaggerConfig.java | 468b3403362c93310ec55bab7d3092e2cf88dfd3 | [] | no_license | cgtamaral/ordering-microservice | d7a9f6e56ac66054e80391bc52236ea8c58d160e | c16e54df37d4443305f402097a4e8b761e6f7377 | refs/heads/master | 2020-04-17T06:16:03.183086 | 2019-01-20T15:07:00 | 2019-01-20T15:07:00 | 166,318,053 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,158 | java | package br.pucminas.orderingmicroservice.api.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).useDefaultResponseMessages(false).select()
.apis(RequestHandlerSelectors.basePackage("br.pucminas.orderingmicroservice.api.controllers"))
.paths(PathSelectors.any()).build()
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("Ordering MicroService API")
.description("Documentação da API de acesso aos recursos de gerenciamento de pedidos.").version("1.0")
.build();
}
}
| [
"cleber.amaral@accenture.com"
] | cleber.amaral@accenture.com |
61517b38d78c1d887c844534ce5bb4e7ebc9b135 | dd54b85239e6331bacd2b0253687041c76a238bb | /app/src/main/java/com/example/dfrie/nytexplore/activities/ArticleListActivity.java | fdc7861ef92f7570064713ff10f37bfdfea3fc51 | [
"Apache-2.0"
] | permissive | dfried2007/NYTimesExplorer | f5872c1b65056a5d7aae81a59c2242f98351b6fc | eda25edbc77c73b491f7964312fa09d340e5ac36 | refs/heads/master | 2021-01-22T22:19:59.332355 | 2017-03-20T03:29:01 | 2017-03-20T03:29:01 | 85,529,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,401 | java | package com.example.dfrie.nytexplore.activities;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.Toast;
import com.example.dfrie.nytexplore.R;
import com.example.dfrie.nytexplore.adapters.ArticleAdapter;
import com.example.dfrie.nytexplore.adapters.EndlessScrollListener;
import com.example.dfrie.nytexplore.models.Article;
import com.example.dfrie.nytexplore.net.ArticleClient;
import com.example.dfrie.nytexplore.net.ArticleClientHelper;
import com.loopj.android.http.JsonHttpResponseHandler;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Properties;
import cz.msebera.android.httpclient.Header;
public class ArticleListActivity extends AppCompatActivity {
public static final String EXTRA_ARTICLE = "com.example.dfrie.nytexplore.activities.ARTICLE";
public static final String API_KEY_FILE = "api_key.properties";
public static final String API_KEY_NAME = "nytimes_api_key";
public static String API_KEY;
private GridView gvArticles;
private ArticleAdapter articleAdapter;
private ArticleClient client;
// Instance of the progress action-view
private MenuItem miActionProgressItem;
// Fetch this data remotely initially...
private String currentQuery = "android";
private boolean didCurrentQuerySucceed = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_article_list);
try {
InputStream is = getBaseContext().getAssets().open(API_KEY_FILE);
Properties props = new Properties();
props.load(is);
API_KEY = props.getProperty(API_KEY_NAME);
} catch (FileNotFoundException e) {
Toast.makeText(this, API_KEY_FILE + getString(R.string.file_not_found), Toast.LENGTH_LONG);
} catch (IOException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG);
}
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
// Sets the Toolbar to act as the ActionBar for this Activity window.
// Make sure the toolbar exists in the activity and is not null
setSupportActionBar(toolbar);
// Display icon in the toolbar
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setLogo(R.mipmap.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);
// Enable up icon...
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// diable the default toolbar title...
getSupportActionBar().setDisplayShowTitleEnabled(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
gvArticles = (GridView) findViewById(R.id.gvArticles);
ArrayList<Article> aArticles = new ArrayList<>();
// initialize the adapter
articleAdapter = new ArticleAdapter(this, aArticles);
// attach the adapter to the ListView
gvArticles.setAdapter(articleAdapter);
gvArticles.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
Toast.makeText(ArticleListActivity.this, R.string.loading, Toast.LENGTH_SHORT).show();
Intent i = new Intent(getApplicationContext(), ArticleDetailActivity.class);
i.putExtra(EXTRA_ARTICLE, articleAdapter.getItem(position));
startActivity(i);
}
});
// Attach the Endless scroll listener to the AdapterView...
gvArticles.setOnScrollListener(new EndlessScrollListener() {
/**
* Triggered only when new data needs to be appended to the list
* Use loadNextDataFromApi(page); or loadNextDataFromApi(totalItemsCount);
*
* @param page
* @param totalItemsCount
* @return true ONLY if more data is actually being loaded; false otherwise.
*/
@Override
public boolean onLoadMore(int page, int totalItemsCount) {
fetchArticles(currentQuery, page);
// TODO: handle race condition here...
return didCurrentQuerySucceed;
//return true;
}
});
// Fetch this data remotely initially...
fetchArticles(currentQuery, 0);
}
// Executes an API call to the NYT search endpoint, parses the results,
// converts them into an array of article objects, filters them, and adds them to the adapter.
private void fetchArticles(String query, int pageOffset) {
// Clear items from the list adapter on initial page requests...
if (pageOffset==0) {
articleAdapter.clear();
}
client = new ArticleClient();
client.getArticles(this, query, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
try {
JSONArray docs;
if(response != null) {
didCurrentQuerySucceed = ArticleClientHelper.executeNYTQuery(
ArticleListActivity.this, response, articleAdapter);
}
} catch (JSONException e) {
// Invalid JSON format, show appropriate error.
e.printStackTrace();
didCurrentQuerySucceed = false;
}
}
@Override
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
super.onFailure(statusCode, headers, responseString, throwable);
didCurrentQuerySucceed = false;
}
});
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// Store instance of the menu item containing progress
miActionProgressItem = menu.findItem(R.id.miActionProgress);
// Extract the action-view from the menu item
////ProgressBar v = (ProgressBar) MenuItemCompat.getActionView(miActionProgressItem);
// Return to finish
return super.onPrepareOptionsMenu(menu);
}
public void showProgressBar() {
// Show progress item
miActionProgressItem.setVisible(true);
}
public void hideProgressBar() {
// Hide progress item
miActionProgressItem.setVisible(false);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_article_list, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
// perform query here
fetchArticles(query, 0);
currentQuery = query;
// workaround to avoid issues with some emulators and keyboard devices firing
// twice if a keyboard enter is used
// see https://code.google.com/p/android/issues/detail?id=24599
searchView.clearFocus();
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
return super.onCreateOptionsMenu(menu); }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
//Toast.makeText(this, "Settings was Selected...", Toast.LENGTH_LONG).show();
Intent i = new Intent(getApplicationContext(), SetupSearchActivity.class);
startActivity(i);
return true;
}
if (id == R.id.action_profile) {
Toast.makeText(this, "Profile was Selected...", Toast.LENGTH_LONG).show();
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"dfried2007@gmail.com"
] | dfried2007@gmail.com |
b53886978e6058ad9a593e8d9bd8fe5fdb6b11fb | 40bfeabb0d897c39692f996162338317ea44a8e3 | /PrimeiroCaelum/app/src/main/java/mario/com/br/primeirocaelum/FormularioHelp.java | c934e97bd6f0a914b1ee7039d81c151913c4a6e1 | [] | no_license | mariofelesdossantosjunior/aulacaelum | 8238f351a5efe09fa712a4a5194356368742f74d | f423700b73a53b06731e01031aca2f35dac13cd5 | refs/heads/master | 2020-04-09T14:39:58.595757 | 2015-07-23T04:23:50 | 2015-07-23T04:23:50 | 30,353,488 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,861 | java | package mario.com.br.primeirocaelum;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RatingBar;
import mario.com.br.primeirocaelum.model.Alunos;
/**
* Created by mario on 13/11/2014.
*/
public class FormularioHelp {
private EditText etNome;
private EditText etSite;
private EditText etEndereco;
private EditText etTelefone;
private RatingBar rtNota;
private Button btSalvar;
private ImageView imagem;
public FormularioHelp(Formulario formulario) {
etNome = (EditText) formulario.findViewById(R.id.etNome);
etSite = (EditText) formulario.findViewById(R.id.etSite);
etEndereco = (EditText) formulario.findViewById(R.id.etEndereco);
etTelefone = (EditText) formulario.findViewById(R.id.etTelefone);
rtNota = (RatingBar) formulario.findViewById(R.id.rtNota);
btSalvar = (Button) formulario.findViewById(R.id.btSalvar);
imagem = (ImageView) formulario.findViewById(R.id.imageView);
}
public Alunos buscaAlunoFormulario() {
Alunos aluno = new Alunos();
aluno.setNome(etNome.getText().toString());
aluno.setSite(etSite.getText().toString());
aluno.setEndereco(etEndereco.getText().toString());
aluno.setTelefone(etTelefone.getText().toString());
aluno.setNota(Double.valueOf(rtNota.getRating()));
return aluno;
}
/**
* Recupera Aluno no para o Formulario
* @param alSel
* Aluno que deseja passar para edição
*/
public void recuperaAlunoForm(Alunos alSel) {
etNome.setText(alSel.getNome());
etEndereco.setText(alSel.getEndereco());
etSite.setText(alSel.getSite());
etTelefone.setText(alSel.getTelefone());
rtNota.setRating(alSel.getNota().floatValue());
}
}
| [
"mario_feles@live.com"
] | mario_feles@live.com |
67a347cad3a35dff3341ca0fd27bc597db2bd211 | 9aa0ed500cea8a9862d86a2fc8586b3168936e82 | /implementacao/SCVM/src/br/ma/mateus/scvm/mb/UsuarioMB.java | 63cc711fd21b701fac6809d8ca3bbc59b8526106 | [] | no_license | s4ndrojr/test-ithappens-1304 | 2e097863aa50cff34b4eee334e036b8dc44a7f35 | 8bbabc41bae908b04c6cc227dc4650be84aa506f | refs/heads/master | 2022-11-20T03:29:10.592793 | 2020-07-20T19:36:15 | 2020-07-20T19:36:15 | 280,512,060 | 0 | 0 | null | 2020-07-17T19:48:36 | 2020-07-17T19:48:35 | null | UTF-8 | Java | false | false | 13,227 | java | package br.ma.mateus.scvm.mb;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
import br.ma.mateus.ejb.scvm.facade.UsuarioFacade;
import br.ma.mateus.ejb.scvm.model.TbUsuario;
import br.ma.mateus.scvm.util.ConstantesSistema;
import br.ma.mateus.scvm.util.MessageUtil;
import br.ma.mateus.scvm.util.UtilitariosSession;
/**
* @author Sandro Jr. Manter Cadastro de Usuários
*/
@Named("mUsuario")
@ViewScoped
public class UsuarioMB implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@EJB
private UsuarioFacade usuarioFacade;
private String descUsuarioFiltro;
private String loginUsuario, nomeUsuario, senhaUsuario, acaoUsuario, usuarioInsercao, usuarioAlteracao, registroExcluido,
usuarioExclusao;
private Date dataInsercao, dataAlteracao, dataExclusao;
private Integer id, idUsuarioFiltro;
private String loginUsuarioFiltro, nomeUsuarioFiltro;
private List<TbUsuario> listUsuario;
public UsuarioMB() {
}
/**
* @author Sandro Jr.
* @return String Método chamado após o construtor. Reponsável em inicializar
* váriaveis toda vez que a funcionalidade for chamada. Este metódo é
* executada apenas uma vez, assim como o construtor na chamada da
* funcionalidade.
*/
@PostConstruct
public void init() {
listUsuario = new ArrayList<>();
listarUsuario(null, null, null);
}
/**
* @author Sandro Jr.
* @return String Método responsável por inicializar as variáveis da
* funcionalidade toda vez que for necessário. Diferente do metódo init
* que é chamado apenas uma vez.
*/
public String inicializar() {
id = null;
loginUsuarioFiltro = "";
nomeUsuarioFiltro = "";
loginUsuario = "";
nomeUsuario = "";
senhaUsuario = "";
acaoUsuario = "";
usuarioInsercao = "";
usuarioAlteracao = "";
registroExcluido = "N";
usuarioExclusao = "";
dataInsercao = null;
dataAlteracao = null;
dataExclusao = null;
listarUsuario(null, null, null);
return null;
}
/**
* @author Sandro Jr.
* @return String Método chamado pelo usuário no menu do sistema. Responsável de
* redirecioná-lo para a tela de listagem e filtro
*/
public String manterUsuario() {
inicializar();
return ConstantesSistema.REDIRECT_MANTER_USUARIO;
}
/**
* @author Sandro Jr.
* @return List
* @param Long
* @param String Método responsável por listar os Usuários pelos parâmetros
* passados.
*/
private List<TbUsuario> listarUsuario(Integer id, String loginUsuario, String nomeUsuario) {
listUsuario = usuarioFacade.find(id, loginUsuario, nomeUsuario);
return listUsuario;
}
/**
* @author Sandro Jr.
* @return List Método chamado pelo usuário na ação de filtrar. Método
* responsável por filtrar os Usuários.
*/
public List<TbUsuario> filtrar() {
return listarUsuario(idUsuarioFiltro, loginUsuarioFiltro, nomeUsuarioFiltro);
}
/**
* Método chamado pelo usuário. Responsável por executar a acao escolhida pelo
* Usuário: 'inserir', 'editar', 'excluir'.
*
* @author Sandro Jr.
* @return String
*/
public String executarAcaoUsuario() {
// String usuarioAcao = loginMB.getUsuario();
if (!validarCampos()) {
return null;
}
TbUsuario tbUsuario = (TbUsuario) UtilitariosSession.getHttpSessionObject("usuarioLogado");
String usuarioAcao = tbUsuario.getLoginUsuario();
String acao = (acaoUsuario == null ? "" : acaoUsuario);
switch (acao) {
case ConstantesSistema.ACAO_INSERIR:
this.inserirUsuario(loginUsuario, nomeUsuario, senhaUsuario, usuarioAcao, new Date(), "", null,
ConstantesSistema.REGISTRO_NAO_EXCLUIDO, "", null);
break;
case ConstantesSistema.ACAO_EDITAR:
this.atualizarUsuario(id, loginUsuario, nomeUsuario, senhaUsuario, usuarioInsercao, dataInsercao, usuarioAcao, new Date(),
ConstantesSistema.REGISTRO_NAO_EXCLUIDO, usuarioExclusao, dataExclusao);
break;
case ConstantesSistema.ACAO_EXCLUIR:
this.excluirUsuario(id, loginUsuario, nomeUsuario, senhaUsuario, usuarioInsercao, dataInsercao, usuarioAlteracao,
dataAlteracao, ConstantesSistema.REGISTRO_EXCLUIDO, usuarioAcao, new Date());
break;
}
this.inicializar();
return null;
}
/**
* Método chamado pelo usuário na ação de editar um usuario.
*
* @author Sandro Jr.
* @return Long -> id do usuario salvo
* @param loginUsuario
* @param nomeUsuario
* @param usuarioInsercao
* @param dataInsercao
* @param usuarioAlteracao
* @param dataAlteracao
* @param registroExcluido
* @param usuarioExclusao
* @param dataExclusao
* @return
*/
private Integer inserirUsuario(String loginUsuario, String nomeUsuario, String senha, String usuarioInsercao, Date dataInsercao,
String usuarioAlteracao, Date dataAlteracao, String registroExcluido, String usuarioExclusao,
Date dataExclusao) {
Integer idUsuarioSalvo = null;
try {
idUsuarioSalvo = usuarioFacade.save(loginUsuario, nomeUsuario, senha, usuarioInsercao, dataInsercao,
usuarioAlteracao, dataAlteracao, registroExcluido, usuarioExclusao, dataExclusao);
if (idUsuarioSalvo != null)
MessageUtil.sucess("Inserção de Usuario",
"O usuario com identificação " + idUsuarioSalvo + " foi criado com sucesso no sistema!");
else
MessageUtil.error("Inserção de Usuario", "Não foi possível criar o usuario!");
} catch (Exception e) {
// TODO: handle exception
MessageUtil.error("Erro Inesperado", "Contate o Administrador do Sistema!");
}
return idUsuarioSalvo;
}
/**
* @param id
* @param loginUsuario
* @param nomeUsuario
* @param usuarioInsercao
* @param dataInsercao
* @param usuarioAlteracao
* @param dataAlteracao
* @param registroExcluido
* @param usuarioExclusao
* @param dataExclusao
* @return
*/
private boolean excluirUsuario(Integer id, String loginUsuario, String nomeUsuario, String senha, String usuarioInsercao,
Date dataInsercao, String usuarioAlteracao, Date dataAlteracao, String registroExcluido,
String usuarioExclusao, Date dataExclusao) {
try {
usuarioFacade.update(id, loginUsuario, nomeUsuario, senha, usuarioInsercao, dataInsercao, usuarioAlteracao,
dataAlteracao, registroExcluido, usuarioExclusao, dataExclusao);
MessageUtil.sucess("Exclusão de Usuário", "O usuario foi excluído com sucesso no sistema!");
MessageUtil.warn("Exclusão de Usuário",
"Não foi possível excluir o usuario, porque ele possui aplicações cadastradas. "
+ "Favor exclua primeiro as aplicações para poder excluir o usuario!");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
MessageUtil.error("Erro Inesperado", "Favor contate o Administrador do Sistema!");
}
return false;
}
/**
* @param id
* @param loginUsuario
* @param nomeUsuario
* @param usuarioInsercao
* @param dataInsercao
* @param usuarioAlteracao
* @param dataAlteracao
* @param registroExcluido
* @param usuarioExclusao
* @param dataExclusao
* @return
*/
private boolean atualizarUsuario(Integer id, String loginUsuario, String nomeUsuario, String senha, String usuarioInsercao,
Date dataInsercao, String usuarioAlteracao, Date dataAlteracao, String registroExcluido,
String usuarioExclusao, Date dataExclusao) {
try {
usuarioFacade.update(id, loginUsuario, nomeUsuario, senha, usuarioInsercao, dataInsercao, usuarioAlteracao,
dataAlteracao, registroExcluido, usuarioExclusao, dataExclusao);
MessageUtil.sucess("Edição de Usuário", "O usuario foi alterado com sucesso!");
return true;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MessageUtil.sucess("Edição de Usuário", "Não foi possível alterar o usuario!");
return false;
}
/**
* Validar os campos obrigatórios
*
* @return
*/
private boolean validarCampos() {
boolean validou = true;
if (loginUsuario == null || loginUsuario.equals("")) {
MessageUtil.error("Campo Login", ConstantesSistema.CAMPO_OBRIGATORIO);
validou = false;
}
if (nomeUsuario == null || nomeUsuario.equals("")) {
MessageUtil.error("Campo Nome", ConstantesSistema.CAMPO_OBRIGATORIO);
validou = false;
}
return validou;
}
/**********************************************
* GET E SET
************************************************************************/
/**
* @return the usuarioFacade
*/
public UsuarioFacade getUsuarioFacade() {
return usuarioFacade;
}
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @param usuarioFacade the usuarioFacade to set
*/
public void setUsuarioFacade(UsuarioFacade usuarioFacade) {
this.usuarioFacade = usuarioFacade;
}
/**
* @return the descUsuarioFiltro
*/
public String getDescUsuarioFiltro() {
return descUsuarioFiltro;
}
/**
* @param descUsuarioFiltro the descUsuarioFiltro to set
*/
public void setDescUsuarioFiltro(String descUsuarioFiltro) {
this.descUsuarioFiltro = descUsuarioFiltro;
}
/**
* @return the usuarioInsercao
*/
public String getUsuarioInsercao() {
return usuarioInsercao;
}
/**
* @param usuarioInsercao the usuarioInsercao to set
*/
public void setUsuarioInsercao(String usuarioInsercao) {
this.usuarioInsercao = usuarioInsercao;
}
/**
* @return the usuarioAlteracao
*/
public String getUsuarioAlteracao() {
return usuarioAlteracao;
}
/**
* @param usuarioAlteracao the usuarioAlteracao to set
*/
public void setUsuarioAlteracao(String usuarioAlteracao) {
this.usuarioAlteracao = usuarioAlteracao;
}
/**
* @return the registroExcluido
*/
public String getRegistroExcluido() {
return registroExcluido;
}
/**
* @param registroExcluido the registroExcluido to set
*/
public void setRegistroExcluido(String registroExcluido) {
this.registroExcluido = registroExcluido;
}
/**
* @return the usuarioExclusao
*/
public String getUsuarioExclusao() {
return usuarioExclusao;
}
/**
* @param usuarioExclusao the usuarioExclusao to set
*/
public void setUsuarioExclusao(String usuarioExclusao) {
this.usuarioExclusao = usuarioExclusao;
}
/**
* @return the dataInsercao
*/
public Date getDataInsercao() {
return dataInsercao;
}
/**
* @param dataInsercao the dataInsercao to set
*/
public void setDataInsercao(Date dataInsercao) {
this.dataInsercao = dataInsercao;
}
/**
* @return the dataAlteracao
*/
public Date getDataAlteracao() {
return dataAlteracao;
}
/**
* @param dataAlteracao the dataAlteracao to set
*/
public void setDataAlteracao(Date dataAlteracao) {
this.dataAlteracao = dataAlteracao;
}
/**
* @return the dataExclusao
*/
public Date getDataExclusao() {
return dataExclusao;
}
/**
* @param dataExclusao the dataExclusao to set
*/
public void setDataExclusao(Date dataExclusao) {
this.dataExclusao = dataExclusao;
}
public List<TbUsuario> getListUsuario() {
return listUsuario;
}
public void setListUsuario(List<TbUsuario> listUsuario) {
this.listUsuario = listUsuario;
}
/**
* @return the acaoUsuario
*/
public String getAcaoUsuario() {
return acaoUsuario;
}
/**
* @param acaoUsuario the acaoUsuario to set
*/
public void setAcaoUsuario(String acaoUsuario) {
this.acaoUsuario = acaoUsuario;
}
/**
* @return the loginUsuario
*/
public String getLoginUsuario() {
return loginUsuario;
}
/**
* @param loginUsuario the loginUsuario to set
*/
public void setLoginUsuario(String loginUsuario) {
this.loginUsuario = loginUsuario;
}
/**
* @return the nomeUsuario
*/
public String getNomeUsuario() {
return nomeUsuario;
}
/**
* @param nomeUsuario the nomeUsuario to set
*/
public void setNomeUsuario(String nomeUsuario) {
this.nomeUsuario = nomeUsuario;
}
/**
* @return the loginUsuarioFiltro
*/
public String getLoginUsuarioFiltro() {
return loginUsuarioFiltro;
}
/**
* @param loginUsuarioFiltro the loginUsuarioFiltro to set
*/
public void setLoginUsuarioFiltro(String loginUsuarioFiltro) {
this.loginUsuarioFiltro = loginUsuarioFiltro;
}
/**
* @return the nomeUsuarioFiltro
*/
public String getNomeUsuarioFiltro() {
return nomeUsuarioFiltro;
}
/**
* @param nomeUsuarioFiltro the nomeUsuarioFiltro to set
*/
public void setNomeUsuarioFiltro(String nomeUsuarioFiltro) {
this.nomeUsuarioFiltro = nomeUsuarioFiltro;
}
/**
* @return the idUsuarioFiltro
*/
public Integer getIdUsuarioFiltro() {
return idUsuarioFiltro;
}
/**
* @param idUsuarioFiltro the idUsuarioFiltro to set
*/
public void setIdUsuarioFiltro(Integer idUsuarioFiltro) {
this.idUsuarioFiltro = idUsuarioFiltro;
}
/**
* @return the senhaUsuario
*/
public String getSenhaUsuario() {
return senhaUsuario;
}
/**
* @param senha the senhaUsuario to set
*/
public void setSenhaUsuario(String senhaUsuario) {
this.senhaUsuario = senhaUsuario;
}
}
| [
"sandro.junior@came.ma.gov.br"
] | sandro.junior@came.ma.gov.br |
4826419c9f4ec7005f84e16de412b3bf9766ec72 | 4aa1c944d82c5cb064a8593907f1e46307de2bae | /forest-core/src/test/java/com/dtflys/test/interceptor/PostHeadInterceptor.java | 7c5460fdc696c82030b2080102a16a869e91cdf5 | [
"MIT"
] | permissive | leesonwei/forest | 9343d93ebf56f468b98059b48ce155d5b0b2b793 | 3c2cce8031d55b7ad500d8438b9bc3cc0000d3bf | refs/heads/master | 2023-04-12T21:57:32.941432 | 2021-04-22T08:31:18 | 2021-04-22T08:31:18 | 359,704,271 | 1 | 0 | MIT | 2021-04-22T01:34:30 | 2021-04-20T06:12:33 | Java | UTF-8 | Java | false | false | 789 | java | package com.dtflys.test.interceptor;
import com.dtflys.forest.exceptions.ForestRuntimeException;
import com.dtflys.forest.http.ForestRequest;
import com.dtflys.forest.http.ForestResponse;
import com.dtflys.forest.interceptor.Interceptor;
public class PostHeadInterceptor implements Interceptor {
@Override
public boolean beforeExecute(ForestRequest request) {
request.addHeader("accessToken", "11111111");
return true;
}
@Override
public void onSuccess(Object data, ForestRequest request, ForestResponse response) {
}
@Override
public void onError(ForestRuntimeException ex, ForestRequest request, ForestResponse response) {
}
@Override
public void afterExecute(ForestRequest request, ForestResponse response) {
}
}
| [
"jun.gong@thebeastshop.com"
] | jun.gong@thebeastshop.com |
69db4dd1d753ebe15c5d934cacf21fbdc33461e5 | 6e1a0504a61d1828803fcacabc8f8e5ef39ba83f | /kbproject-main/src/main/java/com/kabin/kbproject/main/KbprojectMainApplication.java | 3589f9114942d29e22837cf43c033f14dbbaf3bb | [] | no_license | CHKabin/kbproject-session-redis | d76a16ca233513711ceee241b7ef07c257ecc755 | 4a69a3495041f9103ef6c00d9ecb327665efba18 | refs/heads/master | 2022-11-24T15:10:16.928620 | 2019-07-04T00:58:56 | 2019-07-04T00:58:56 | 194,697,588 | 0 | 0 | null | 2022-11-16T12:39:20 | 2019-07-01T15:19:15 | Java | UTF-8 | Java | false | false | 527 | java | package com.kabin.kbproject.main;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = {"com.kabin.kbproject.db", "com.kabin.kbproject.main", "com.kabin.kbproject.common"})
@MapperScan("com.kabin.kbproject.db.dao")
public class KbprojectMainApplication {
public static void main(String[] args) {
SpringApplication.run(KbprojectMainApplication.class, args);
}
}
| [
"1456161025@qq.com"
] | 1456161025@qq.com |
5a535a36d7c503941c1c96be01c8d8061ce359d6 | 64a334b7de2987c82d18e32b2ecfbf9703ee49c5 | /spring-boot/restful-web-services/src/main/java/com/sampleprograms/spring/boot/rest/webservices/versioning/PersonService.java | d55a7fb430212c0f1b762cbb6ecc8b77f3e18c82 | [] | no_license | prashantsarode/tutorials | 01b868555038207de07b5cc1ae88b0a71126aedf | 43d7fdb83f141f175a5f32eef4a9e27b60202305 | refs/heads/master | 2020-03-15T05:19:08.329149 | 2019-02-17T05:36:18 | 2019-02-17T05:36:18 | 131,986,359 | 0 | 0 | null | 2018-05-12T20:12:15 | 2018-05-03T11:38:40 | Java | UTF-8 | Java | false | false | 850 | java | package com.sampleprograms.spring.boot.rest.webservices.versioning;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sampleprograms.spring.boot.rest.webservices.versioning.v1.Person;
import com.sampleprograms.spring.boot.rest.webservices.versioning.v2.Name;
import io.swagger.annotations.Api;
@RestController
@Api(description = "Demonstrates versioning schemes for REST API")
public class PersonService {
@GetMapping("/v1/person")
public Person getPersonV1() {
return new Person("Sanvi");
}
@GetMapping("/v2/person")
public com.sampleprograms.spring.boot.rest.webservices.versioning.v2.Person getPersonV2() {
return new com.sampleprograms.spring.boot.rest.webservices.versioning.v2.Person(new Name("Sanvi", "Sarode"));
}
} | [
"Prashant@DESKTOP-H7HHKQK"
] | Prashant@DESKTOP-H7HHKQK |
22551fb90f83722e2dc110873b69983d44aaa8fa | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /ice-20201109/src/main/java/com/aliyun/ice20201109/models/ListSmartJobsRequest.java | ad48744b9f75a9bcb25f6b843729e0bdf749807e | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 2,106 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.ice20201109.models;
import com.aliyun.tea.*;
public class ListSmartJobsRequest extends TeaModel {
@NameInMap("JobState")
public String jobState;
@NameInMap("JobType")
public String jobType;
@NameInMap("MaxResults")
public Long maxResults;
@NameInMap("NextToken")
public String nextToken;
@NameInMap("PageNo")
public Long pageNo;
@NameInMap("PageSize")
public Long pageSize;
@NameInMap("SortBy")
public String sortBy;
public static ListSmartJobsRequest build(java.util.Map<String, ?> map) throws Exception {
ListSmartJobsRequest self = new ListSmartJobsRequest();
return TeaModel.build(map, self);
}
public ListSmartJobsRequest setJobState(String jobState) {
this.jobState = jobState;
return this;
}
public String getJobState() {
return this.jobState;
}
public ListSmartJobsRequest setJobType(String jobType) {
this.jobType = jobType;
return this;
}
public String getJobType() {
return this.jobType;
}
public ListSmartJobsRequest setMaxResults(Long maxResults) {
this.maxResults = maxResults;
return this;
}
public Long getMaxResults() {
return this.maxResults;
}
public ListSmartJobsRequest setNextToken(String nextToken) {
this.nextToken = nextToken;
return this;
}
public String getNextToken() {
return this.nextToken;
}
public ListSmartJobsRequest setPageNo(Long pageNo) {
this.pageNo = pageNo;
return this;
}
public Long getPageNo() {
return this.pageNo;
}
public ListSmartJobsRequest setPageSize(Long pageSize) {
this.pageSize = pageSize;
return this;
}
public Long getPageSize() {
return this.pageSize;
}
public ListSmartJobsRequest setSortBy(String sortBy) {
this.sortBy = sortBy;
return this;
}
public String getSortBy() {
return this.sortBy;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
b9d872277febc0dabcdacfaa2c27279717facf34 | 7f714e0ae8f83a15cc18aee3f844f6a5d8799bb7 | /balloon/src/main/java/com/emilstrom/balloon/Game/Game.java | f0884372595fe6ca84b25f768e22e660b092899b | [] | no_license | DuckMonster/Balloon | 047ca3269b3541001c24662056223cfd1cfab2fd | 60532dd27bfe7517a1bb50ef31efd549e817513e | refs/heads/master | 2021-01-23T02:40:33.875382 | 2014-05-25T16:05:12 | 2014-05-25T16:05:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,179 | java | package com.emilstrom.balloon.Game;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.opengl.Matrix;
import android.os.SystemClock;
import android.util.Log;
import com.emilstrom.balloon.BalloonGame;
import com.emilstrom.balloon.Helper.Art;
import com.emilstrom.balloon.Helper.Camera;
import com.emilstrom.balloon.Helper.ShaderHelper;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
/**
* Created by Emil on 2014-05-25.
*/
public class Game implements GLSurfaceView.Renderer {
public static Game currentGame;
public static float updateTime;
private static long oldTime;
Map currentMap;
public Game() {
currentGame = this;
currentMap = new Map();
currentCamera = new Camera();
}
public void logic() {
//Calculate updatetime
if (updateTime == -1) {
oldTime = SystemClock.uptimeMillis();
Log.v(BalloonGame.TAG, "First time...");
}
long newTime = SystemClock.uptimeMillis();
updateTime = (newTime - oldTime) * 0.001f;
oldTime = newTime;
currentMap.logic();
}
public void draw() {
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
GLES20.glEnable(GLES20.GL_BLEND);
currentMap.draw();
}
//GL STUFF
float projection[] = new float[16];
public Camera currentCamera;
public float gameWidth, gameHeight;
public float[] getViewProjection() {
float ret[] = new float[16];
Matrix.multiplyMM(ret, 0, projection, 0, currentCamera.getView(), 0);
return ret;
}
public void onSurfaceCreated(GL10 unused, EGLConfig config) {
GLES20.glClearColor(
92f / 255f,
199f / 255f,
255f / 255f,
255f / 255f);
}
public void onDrawFrame(GL10 unused) {
logic();
draw();
}
public void onSurfaceChanged(GL10 unused, int width, int height) {
final int screenSize = 10;
float ratio = (float)width / (float)height;
gameHeight = screenSize*2;
gameWidth = gameHeight * ratio;
Matrix.orthoM(projection, 0, -ratio * screenSize, ratio * screenSize, -screenSize, screenSize, 1f, 10f);
ShaderHelper.loadShader();
Art.loadAssets();
updateTime = -1;
}
}
| [
"emil.strm@gmail.com"
] | emil.strm@gmail.com |
af2dba5986ffc01c789e854e1d236248c8639b0e | aa3ee5db59604dc5e97c9b8b264147906debc189 | /ViloApp/app/src/main/java/io/vilo/viloapp/model/VideoUrl.java | 4aa3c7a00e31ce8aea82dbdcd60c3d47962c9cf6 | [] | no_license | raghavendra-polanki/jackal | 62b5d30e6f3b3c4abb3cf67a23939af54b5af8ef | 07dd76308255c632250ee2438cb42799d4f58d7f | refs/heads/master | 2021-01-21T18:28:26.694488 | 2017-08-06T10:24:45 | 2017-08-06T10:24:45 | 92,049,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 351 | java | package io.vilo.viloapp.model;
import com.google.gson.annotations.SerializedName;
import lombok.Getter;
import lombok.Setter;
/**
* Created by raghavendra on 06/08/17.
*/
public class VideoUrl {
@Getter
@Setter
@SerializedName("url")
private String url;
@Getter @Setter
@SerializedName("src")
private String src;
} | [
"raghavendra@RaghavMac.local"
] | raghavendra@RaghavMac.local |
fe9b095aa222c4dc72f384d6ef9b90771be13808 | c9a89359bcb36f776a0a3c7c14fb8dd7383880bc | /src/com/hanphon/recruit/action/DeleteNoticeAction.java | f151d45034dd031f2f7dc6b430cffbc557db44c1 | [] | no_license | xitoujic/smsplatform | a3755d73a69623a899297e44b776bfe77b6c3856 | 58c833465cf3c569999cf3fc72af6a7604d4ebb2 | refs/heads/master | 2021-01-13T02:16:20.741793 | 2013-12-20T09:08:20 | 2013-12-20T09:08:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,321 | java | /**
*@time 2011-4-22
*@author soledad pisces
*@fileName DeleteNoticeAction.java
*@contract jiangguojian1990@qq.com
*/
package com.hanphon.recruit.action;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.ServletActionContext;
import com.hanphon.recruit.dao.NoticeDao;
import com.hanphon.recruit.dao.impl.NoticeDaoHibernateImpl;
import com.hanphon.recruit.domain.NoticeDomain;
/**
* @author soledad pisces
*
*/
public class DeleteNoticeAction {
private int id;
private String message;
public void delete() throws IOException{
NoticeDao dao = new NoticeDaoHibernateImpl();
NoticeDomain domain = dao.findById(id);
Boolean flag = dao.delete(domain);
if(flag == true){
message = "<msg>SUCCESS</msg>";
} else {
message = "<msg>ERROR</msg>";
}
sendMsg(message);
}
public void sendMsg(String content) throws IOException {
HttpServletResponse response = ServletActionContext.getResponse();
response.setCharacterEncoding("UTF-8");
response.setContentType("text/xml");
response.getWriter().println(content);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
| [
"1033761115@qq.com"
] | 1033761115@qq.com |
181f678231da11fdd6d224a5581085a92b8e2954 | bbfdb9a31a45950efaa2765280a25875f84b8a8e | /first_distributed_system/TPettry_JABX_Client/src/Client/MenuItem.java | f634f77a620dfba26ca3cf6da5d4b83e58279ebc | [] | no_license | travis-pettry/Pettry_Travis_CSC380 | 9e36b9a6fd362d912a6c5e83da9cdc6c46160fcc | 607a38919f4726a694e279057b2bf7ce2b45b198 | refs/heads/master | 2018-12-28T09:40:37.173533 | 2013-08-12T05:52:44 | 2013-08-12T05:52:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,137 | java |
package Client;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <simpleContent>
* <extension base="<http://www.w3.org/2001/XMLSchema>string">
* <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="price" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="description" type="{http://www.w3.org/2001/XMLSchema}string" />
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"value"
})
@XmlRootElement(name = "menuItem")
public class MenuItem {
@XmlValue
protected String value;
@XmlAttribute(name = "name")
protected String name;
@XmlAttribute(name = "price")
protected String price;
@XmlAttribute(name = "description")
protected String description;
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the price property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPrice() {
return price;
}
/**
* Sets the value of the price property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPrice(String value) {
this.price = value;
}
/**
* Gets the value of the description property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Sets the value of the description property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
}
| [
"tpettry@student.neumont.edu"
] | tpettry@student.neumont.edu |
b744291b2623400d2d319948b5e47028dbf58ca0 | 17baf4712e6f277c01f1cbeb53931818ad4adbee | /MyNewExamApp/app/src/main/java/com/example/mynewexamapp/Dao/ExamDBHelper.java | e009ffbc32818b1e04b63bf71f3e2b2653352165 | [] | no_license | gdzpf123/AndroidDemo | 84fe419640f707b7ca5c87e32fceb50480c20845 | 461dbe4d1dfad6fce8af21444ac8c05197824459 | refs/heads/master | 2022-09-17T15:04:36.431241 | 2020-06-04T15:15:08 | 2020-06-04T15:15:08 | 267,189,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,611 | java | package com.example.mynewexamapp.Dao;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.Nullable;
import com.example.mynewexamapp.Entity.DBBase;
import com.example.mynewexamapp.Entity.QuestionModel;
import com.example.mynewexamapp.Entity.RadioModel;
import com.example.mynewexamapp.Entity.ToggleModel;
import com.example.mynewexamapp.Entity.UserModel;
import com.example.mynewexamapp.MyApplication;
import java.util.ArrayList;
public class ExamDBHelper extends SQLiteOpenHelper {
private static ExamDBHelper dbHelper;
public static ExamDBHelper shareInstance(){
if (dbHelper == null){
dbHelper = new ExamDBHelper(MyApplication.getContext());
}
return dbHelper;
}
public ExamDBHelper(@Nullable Context context) {
super(context, "data.db3", null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
//需要进行初始化的时候,执行响应的操作
//如果数据库已经存在,则可以不需要执行响应的SQL语句
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
public static int getCount(DBBase dbModel){
String tableName = dbModel.getTableName();
String sql = "select count(*) from "+tableName;
Cursor cursor = ExamDBHelper.shareInstance().getReadableDatabase().rawQuery(sql, null);
if (cursor != null && cursor.moveToNext()) {
int count = cursor.getInt(0);
return count;
}
return 0; //无返回0
}
public static UserModel findUser(String userName , String userPwd)
{
SQLiteDatabase db = ExamDBHelper.shareInstance().getReadableDatabase();
Cursor cursor = db.query("user", new String[]{"id", "userName", "userPwd"}, "userName=? AND userPwd=?", new String[]{userName, userPwd}, null, null, null);
UserModel user = null;
if (cursor != null && cursor.moveToNext()) {
user = new UserModel();
int index = cursor.getColumnIndex("id");
int id = cursor.getInt(index);
user.setId(id);
index = cursor.getColumnIndex("userName");
userName = cursor.getString(index);
user.setName(userName);
index = cursor.getColumnIndex("userPwd");
userPwd = cursor.getString(index);
user.setUserPwd(userPwd);
}
return user;
}
public static ArrayList<QuestionModel> findAll(QuestionModel model){
String sql = "select * from " + model.getTableName();
SQLiteDatabase db = ExamDBHelper.shareInstance().getReadableDatabase();
Cursor cursor = db.rawQuery(sql,null);
ArrayList<QuestionModel> arr = new ArrayList<>();
while (cursor.moveToNext()){
if (model instanceof ToggleModel){
ToggleModel toggle = new ToggleModel();
toggle.setId(cursor.getInt(cursor.getColumnIndex("id")));
toggle.setAns(cursor.getString(cursor.getColumnIndex("ans")));
toggle.setTitle(cursor.getString(cursor.getColumnIndex("title")));
arr.add(toggle);
}else if (model instanceof RadioModel){
RadioModel radio = new RadioModel();
radio.setId(cursor.getInt(cursor.getColumnIndex("id")));
radio.setTitle(cursor.getString(cursor.getColumnIndex("title")));
radio.setAns(cursor.getString(cursor.getColumnIndex("ans")));
radio.setAnsA(cursor.getString(cursor.getColumnIndex("ansA")));
radio.setAnsB(cursor.getString(cursor.getColumnIndex("ansB")));
radio.setAnsC(cursor.getString(cursor.getColumnIndex("ansC")));
radio.setAnsD(cursor.getString(cursor.getColumnIndex("ansD")));
arr.add(radio);
}
}
return arr;
}
public static QuestionModel findQuestion(QuestionModel model){
int id = model.getId();
String tableName = model.getTableName();
String Sql = "select * from " + tableName + "where id = " + id;
SQLiteDatabase db = ExamDBHelper.shareInstance().getReadableDatabase();
Cursor cursor = db.rawQuery(Sql,null);
if (cursor != null && cursor.moveToNext()) {
if (model instanceof ToggleModel){
ToggleModel toggle = new ToggleModel();
toggle.setId(id);
toggle.setAns(cursor.getString(cursor.getColumnIndex("ans")));
toggle.setTitle(cursor.getString(cursor.getColumnIndex("title")));
return toggle;
}else if (model instanceof RadioModel){
RadioModel radio = new RadioModel();
radio.setId(id);
radio.setTitle(cursor.getString(cursor.getColumnIndex("title")));
radio.setAns(cursor.getString(cursor.getColumnIndex("ans")));
radio.setAnsA(cursor.getString(cursor.getColumnIndex("ansA")));
radio.setAnsB(cursor.getString(cursor.getColumnIndex("ansB")));
radio.setAnsC(cursor.getString(cursor.getColumnIndex("ansC")));
radio.setAnsD(cursor.getString(cursor.getColumnIndex("ansD")));
return radio;
}else{
return null;
}
// entity = new RadioEntity();
// int index = cursor.getColumnIndex("id");
// id = cursor.getInt(index);
// entity.setId(id);
//
// index = cursor.getColumnIndex("title");
// String title = cursor.getString(index);
// entity.setTitle(title);
//
//
// index = cursor.getColumnIndex("ansA");
// String ansA = cursor.getString(index);
// entity.setAnsA(ansA);
//
// index = cursor.getColumnIndex("ansB");
// String ansB = cursor.getString(index);
// entity.setAnsB(ansB);
//
// index = cursor.getColumnIndex("ansC");
// String ansC = cursor.getString(index);
// entity.setAnsC(ansC);
//
// index = cursor.getColumnIndex("ansD");
// String ansD = cursor.getString(index);
// entity.setAnsD(ansD);
//
// index = cursor.getColumnIndex("ans");
// String ans = cursor.getString(index);
// entity.setAns(ans);
}else{
return null;
}
}
}
| [
"asdas"
] | asdas |
d9570395165c04c591a3c8f941fe5eaa79f58b6e | 40cd4da5514eb920e6a6889e82590e48720c3d38 | /desktop/applis/apps/core/common/formathtml/src/test/java/code/formathtml/BeanCustLgNamesFailImpl.java | 5aef7414ae5fee520449bc59f04bd2ca312fb1eb | [] | no_license | Cardman/projects | 02704237e81868f8cb614abb37468cebb4ef4b31 | 23a9477dd736795c3af10bccccb3cdfa10c8123c | refs/heads/master | 2023-08-17T11:27:41.999350 | 2023-08-15T07:09:28 | 2023-08-15T07:09:28 | 34,724,613 | 4 | 0 | null | 2020-10-13T08:08:38 | 2015-04-28T10:39:03 | Java | UTF-8 | Java | false | false | 670 | java | package code.formathtml;
import code.expressionlanguage.analyze.errors.AnalysisMessages;
import code.expressionlanguage.options.KeyWords;
import code.formathtml.errors.RendAnalysisMessages;
import code.formathtml.errors.RendKeyWords;
import code.maths.montecarlo.DefaultGenerator;
import code.sml.Element;
public final class BeanCustLgNamesFailImpl extends TestedBeanCustLgNames {
public BeanCustLgNamesFailImpl() {
super(DefaultGenerator.oneElt());
}
@Override
public void buildAliases(Element _elt, String _lg, RendKeyWords _rkw, KeyWords _kw, RendAnalysisMessages _rMess, AnalysisMessages _mess) {
_rkw.setValueRadio("");
}
}
| [
"f.desrochettes@gmail.com"
] | f.desrochettes@gmail.com |
d18d591dd08f0abc42bb6e9bcc53f3436f7150dc | 9d0951b926dca24332919937d1d5ca32fdb92360 | /src/main/java/com/java24hours/Credits.java | 6d83fd3201a29afaee449ede6ec83c98b0ff9a21 | [] | no_license | C1ockWorc/Java_in_24 | 511d340e0b3401ef55a8c17eb556e4dc7b114c13 | f75cafc5a17d6a568208c62cab8a1b10d98774b0 | refs/heads/master | 2023-08-24T01:34:19.608077 | 2021-11-06T20:47:38 | 2021-11-06T20:47:38 | 425,316,165 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 843 | java |
package com.java24hours;
class Credits {
public static void main(String[] args) {
// Set up file information
String title = "Sharnado";
int year = 2013;
String director = "Anthony Perrante";
String role1 = "Fin";
String actor1 = "Ian Ziering";
String role2 = "April";
String actor2 = "Tara Reid";
String role3 = "George";
String actor3 = "John Heard";
String role4 = "Nova";
String actor4 = "Cassie Scerbo";
// Display information
System.out.println(title + " (" + year + ")" + "\n" +
"A " + director + " film.\n\n" +
role1 + "\t" + actor1 + "\n" +
role2 + "\t" + actor2 + "\n" +
role3 + "\t" + actor3 + "\n" +
role4 + "\t" + actor4);
}
} | [
"69871092+C106kW0rk@users.noreply.github.com"
] | 69871092+C106kW0rk@users.noreply.github.com |
f133bfd95afe41ef3fcd24d0685dbf863a6f5b9d | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/27/27_ffc724801a08d09cf5f5774167862e5820a2c020/ContextEditorFormPage/27_ffc724801a08d09cf5f5774167862e5820a2c020_ContextEditorFormPage_s.java | 4adb32e5f9fb878194179eaf3878a15e74e3a28d | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 16,117 | java | /*******************************************************************************
* Copyright (c) 2004, 2007 Mylyn project committers and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.mylyn.internal.context.ui.editors;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.context.core.AbstractContextListener;
import org.eclipse.mylyn.context.core.AbstractContextStructureBridge;
import org.eclipse.mylyn.context.core.ContextCore;
import org.eclipse.mylyn.context.core.IInteractionContext;
import org.eclipse.mylyn.context.core.IInteractionElement;
import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
import org.eclipse.mylyn.internal.context.ui.ContextUiPlugin;
import org.eclipse.mylyn.internal.context.ui.actions.ContextAttachAction;
import org.eclipse.mylyn.internal.context.ui.actions.ContextClearAction;
import org.eclipse.mylyn.internal.context.ui.actions.ContextCopyAction;
import org.eclipse.mylyn.internal.context.ui.actions.ContextRetrieveAction;
import org.eclipse.mylyn.internal.context.ui.views.ContextNodeOpenListener;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.provisional.commons.ui.DelayedRefreshJob;
import org.eclipse.mylyn.internal.tasks.ui.actions.TaskActivateAction;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Scale;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.navigator.CommonViewer;
import org.eclipse.ui.navigator.INavigatorContentExtension;
/**
*
* @author Mik Kersten
*/
public class ContextEditorFormPage extends FormPage {
private static final int SCALE_STEPS = 14;
public static final String ID_VIEWER = "org.eclipse.mylyn.context.ui.navigator.context";
private ScrolledForm form;
private FormToolkit toolkit;
private CommonViewer commonViewer;
private final ScalableInterestFilter interestFilter = new ScalableInterestFilter();
private Scale doiScale;
private ITask task;
private class ContextEditorDelayedRefreshJob extends DelayedRefreshJob {
public ContextEditorDelayedRefreshJob(StructuredViewer treeViewer, String name) {
super(treeViewer, name);
}
@Override
protected void refresh(Object[] items) {
if (commonViewer != null && !commonViewer.getTree().isDisposed()) {
commonViewer.refresh();
if (items != null) {
for (Object item : items) {
updateExpansionState(item);
}
} else {
updateExpansionState(null);
}
}
}
protected void updateExpansionState(Object item) {
if (commonViewer != null && !commonViewer.getTree().isDisposed()) {
try {
commonViewer.getTree().setRedraw(false);
if (/*!mouseDown && */item == null) {
commonViewer.expandAll();
} else if (item != null && item instanceof IInteractionElement) {
IInteractionElement node = (IInteractionElement) item;
AbstractContextStructureBridge structureBridge = ContextCorePlugin.getDefault()
.getStructureBridge(node.getContentType());
Object objectToRefresh = structureBridge.getObjectForHandle(node.getHandleIdentifier());
if (objectToRefresh != null) {
commonViewer.expandToLevel(objectToRefresh, AbstractTreeViewer.ALL_LEVELS);
}
}
} finally {
commonViewer.getTree().setRedraw(true);
}
}
}
}
private final AbstractContextListener CONTEXT_LISTENER = new AbstractContextListener() {
@Override
public void contextActivated(IInteractionContext context) {
refresh();
}
@Override
public void contextDeactivated(IInteractionContext context) {
refresh();
}
@Override
public void contextCleared(IInteractionContext context) {
refresh();
}
@Override
public void elementsDeleted(List<IInteractionElement> element) {
refresh(element);
}
@Override
public void interestChanged(List<IInteractionElement> elements) {
refresh(elements);
}
@Override
public void landmarkAdded(IInteractionElement element) {
refresh(Arrays.asList(new IInteractionElement[] { element }));
}
@Override
public void landmarkRemoved(IInteractionElement element) {
refresh(Arrays.asList(new IInteractionElement[] { element }));
}
};
public ContextEditorFormPage(FormEditor editor, String id, String title) {
super(editor, id, title);
}
@Override
protected void createFormContent(IManagedForm managedForm) {
super.createFormContent(managedForm);
ContextCore.getContextManager().addListener(CONTEXT_LISTENER);
task = ((TaskEditorInput) getEditorInput()).getTask();
form = managedForm.getForm();
toolkit = managedForm.getToolkit();
//form.setImage(TaskListImages.getImage(TaskListImages.TASK_ACTIVE_CENTERED));
//form.setText(LABEL);
//toolkit.decorateFormHeading(form.getForm());
form.getBody().setLayout(new GridLayout(2, false));
createActionsSection(form.getBody());
createDisplaySection(form.getBody());
form.reflow(true);
}
@Override
public void dispose() {
super.dispose();
// ContextUiPlugin.getViewerManager().removeManagedViewer(commonViewer,
// this);
ContextCore.getContextManager().removeListener(CONTEXT_LISTENER);
}
private void createActionsSection(Composite composite) {
Section section = toolkit.createSection(composite, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE);
section.setText("Actions");
section.setLayout(new GridLayout());
GridData sectionGridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
sectionGridData.widthHint = 80;
section.setLayoutData(sectionGridData);
Composite sectionClient = toolkit.createComposite(section);
section.setClient(sectionClient);
sectionClient.setLayout(new GridLayout(2, false));
sectionClient.setLayoutData(new GridData());
Label label = toolkit.createLabel(sectionClient, "");
label.setImage(CommonImages.getImage(CommonImages.FILTER));
doiScale = new Scale(sectionClient, SWT.FLAT);
GridData scaleGridData = new GridData(GridData.FILL_HORIZONTAL);
scaleGridData.heightHint = 36;
scaleGridData.widthHint = 80;
doiScale.setLayoutData(scaleGridData);
doiScale.setPageIncrement(1);
doiScale.setMinimum(0);
doiScale.setSelection(SCALE_STEPS / 2);
doiScale.setMaximum(SCALE_STEPS);
doiScale.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
setFilterThreshold();
}
public void widgetDefaultSelected(SelectionEvent e) {
// don't care about default selection
}
});
if (!task.equals(TasksUi.getTaskActivityManager().getActiveTask())) {
doiScale.setEnabled(false);
}
Label attachImage = toolkit.createLabel(sectionClient, "");
attachImage.setImage(CommonImages.getImage(TasksUiImages.CONTEXT_ATTACH));
attachImage.setEnabled(task != null);
Hyperlink attachHyperlink = toolkit.createHyperlink(sectionClient, "Attach context...", SWT.NONE);
attachHyperlink.setEnabled(task != null);
attachHyperlink.addMouseListener(new MouseListener() {
public void mouseUp(MouseEvent e) {
new ContextAttachAction().run(task);
}
public void mouseDoubleClick(MouseEvent e) {
// ignore
}
public void mouseDown(MouseEvent e) {
// ignore
}
});
Label retrieveImage = toolkit.createLabel(sectionClient, "");
retrieveImage.setImage(CommonImages.getImage(TasksUiImages.CONTEXT_RETRIEVE));
retrieveImage.setEnabled(task != null);
Hyperlink retrieveHyperlink = toolkit.createHyperlink(sectionClient, "Retrieve Context...", SWT.NONE);
retrieveHyperlink.setEnabled(task != null);
retrieveHyperlink.addMouseListener(new MouseListener() {
public void mouseUp(MouseEvent e) {
new ContextRetrieveAction().run(task);
}
public void mouseDoubleClick(MouseEvent e) {
// ignore
}
public void mouseDown(MouseEvent e) {
// ignore
}
});
Label copyImage = toolkit.createLabel(sectionClient, "");
copyImage.setImage(CommonImages.getImage(TasksUiImages.CONTEXT_COPY));
Hyperlink copyHyperlink = toolkit.createHyperlink(sectionClient, "Copy Context to...", SWT.NONE);
copyHyperlink.addMouseListener(new MouseListener() {
public void mouseUp(MouseEvent e) {
new ContextCopyAction().run(task);
}
public void mouseDoubleClick(MouseEvent e) {
// ignore
}
public void mouseDown(MouseEvent e) {
// ignore
}
});
Label clearImage = toolkit.createLabel(sectionClient, "");
clearImage.setImage(CommonImages.getImage(TasksUiImages.CONTEXT_CLEAR));
Hyperlink clearHyperlink = toolkit.createHyperlink(sectionClient, "Clear Context", SWT.NONE);
clearHyperlink.addMouseListener(new MouseListener() {
public void mouseUp(MouseEvent e) {
new ContextClearAction().run(task);
}
public void mouseDoubleClick(MouseEvent e) {
// ignore
}
public void mouseDown(MouseEvent e) {
// ignore
}
});
section.setExpanded(true);
}
private ContextEditorDelayedRefreshJob job;
/**
* Scales logarithmically to a reasonable interest threshold range (e.g. -10000..10000).
*/
protected void setFilterThreshold() {
double setting = doiScale.getSelection() - (SCALE_STEPS / 2);
double threshold = Math.signum(setting) * Math.pow(Math.exp(Math.abs(setting)), 1.5);
interestFilter.setThreshold(threshold);
refresh();
}
private void refresh() {
if (job == null) {
job = new ContextEditorDelayedRefreshJob(commonViewer, "refresh viewer");
}
job.refresh();
}
private void refresh(List<IInteractionElement> elements) {
if (job == null) {
job = new ContextEditorDelayedRefreshJob(commonViewer, "refresh viewer");
}
job.refresh(elements.toArray());
}
private void createDisplaySection(Composite composite) {
Section section = toolkit.createSection(composite, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE);
section.setText("Elements");
section.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite sectionClient = toolkit.createComposite(section);
section.setClient(sectionClient);
if (task.equals(TasksUi.getTaskActivityManager().getActiveTask())) {
sectionClient.setLayout(new Layout() {
@Override
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
return new Point(0, 0);
}
@Override
protected void layout(Composite composite, boolean flushCache) {
Rectangle clientArea = composite.getClientArea();
commonViewer.getControl()
.setBounds(clientArea.x, clientArea.y, clientArea.width, clientArea.height);
}
});
createViewer(sectionClient);
} else {
sectionClient.setLayout(new GridLayout());
Hyperlink retrieveHyperlink = toolkit.createHyperlink(sectionClient, "Activate task to edit context",
SWT.NONE);
retrieveHyperlink.addMouseListener(new MouseListener() {
public void mouseUp(MouseEvent e) {
new TaskActivateAction().run(task);
}
public void mouseDoubleClick(MouseEvent e) {
// ignore
}
public void mouseDown(MouseEvent e) {
// ignore
}
});
}
section.setExpanded(true);
}
private void createViewer(Composite aParent) {
commonViewer = createCommonViewer(aParent);
commonViewer.addFilter(interestFilter);
commonViewer.addOpenListener(new ContextNodeOpenListener(commonViewer));
try {
commonViewer.getControl().setRedraw(false);
forceFlatLayoutOfJavaContent(commonViewer);
commonViewer.setInput(getSite().getPage().getInput());
getSite().setSelectionProvider(commonViewer);
hookContextMenu();
commonViewer.expandAll();
} finally {
commonViewer.getControl().setRedraw(true);
}
}
public static void forceFlatLayoutOfJavaContent(CommonViewer commonViewer) {
INavigatorContentExtension javaContent = commonViewer.getNavigatorContentService().getContentExtensionById(
"org.eclipse.jdt.java.ui.javaContent");
if (javaContent != null) {
ITreeContentProvider treeContentProvider = javaContent.getContentProvider();
// TODO: find a sane way of doing this, perhaps via AbstractContextUiBridge, should be:
// if (javaContent.getContentProvider() != null) {
// JavaNavigatorContentProvider java =
// (JavaNavigatorContentProvider)javaContent.getContentProvider();
// java.setIsFlatLayout(true);
// }
try {
Class<?> clazz = treeContentProvider.getClass().getSuperclass();
Method method = clazz.getDeclaredMethod("setIsFlatLayout", new Class[] { boolean.class });
method.invoke(treeContentProvider, new Object[] { true });
} catch (Exception e) {
StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN,
"Could not set flat layout on Java content provider", e));
}
}
}
protected CommonViewer createCommonViewer(Composite parent) {
CommonViewer viewer = new CommonViewer(ID_VIEWER, parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
return viewer;
}
private void hookContextMenu() {
MenuManager menuManager = new MenuManager("#PopupMenu");
menuManager.setRemoveAllWhenShown(true);
menuManager.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
fillContextMenu(manager);
}
});
Menu menu = menuManager.createContextMenu(commonViewer.getControl());
commonViewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuManager, commonViewer);
}
protected void fillContextMenu(IMenuManager manager) {
//manager.add(removeFromContextAction);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
public ISelection getSelection() {
if (getSite() != null && getSite().getSelectionProvider() != null) {
return getSite().getSelectionProvider().getSelection();
} else {
return StructuredSelection.EMPTY;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
b6730cb91fd3feefa20d7c470b5a8767388f33d3 | f518cb3abb45710bf4da77d9e3ccdd8a9f23ddbe | /src/com/bridgelabz/string/MaxMinValue.java | 7982a5f6f934a416efadfd40796eee07f47fe5ba | [] | no_license | Meher-D/BridgeLabz-Projects-Section-B_- | 711f9ccba8d954315cb536cb6bd83579cc7e4cb0 | d7ace3a3464e2a028a873cb954a2bc63acce2cbb | refs/heads/master | 2022-02-22T22:36:46.570467 | 2019-08-21T09:56:56 | 2019-08-21T09:56:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 900 | java | package com.bridgelabz.string;
import java.util.Scanner;
import com.bridgelabz.utility.UtilityMath;
public class MaxMinValue {
public static void main(String[] args)
{
UtilityMath utilityMath = new UtilityMath();
Scanner scanner=new Scanner(System.in);
System.out.println("Enter Elements in array :");
int n=scanner.nextInt();
int[] a=new int[n];
System.out.println("Enter all the Elements for array:");
for(int i=0;i<n;i++)
{
a[i]=scanner.nextInt();
}
int result=utilityMath.getMax(a);
System.out.println("Max value is : "+result);
System.out.println("Enter Elements in array :");
int num=scanner.nextInt();
int[] arr=new int[num];
System.out.println("Enter all the Elements for array:");
for(int i=0;i<num;i++)
{
arr[i]=scanner.nextInt();
}
int result1=utilityMath.getMin(arr);
System.out.println("Min value is : "+result1);
}
}
| [
"dikshikameher22@gmail.com"
] | dikshikameher22@gmail.com |
fc688e715cd65631c5cf0699fa025415ba532a59 | 124302723ff4e19df3037394a1688109e949f0b7 | /api-tests/src/test/java/org/openmrs/module/htmlformentry/handler/DrugOrderTagHandlerTest.java | 9ee8b19b640dd7eb9f4a7d0c65909ac77fc8024f | [] | no_license | Palak-137/openmrs-module-htmlformentry | f03e5cd9795948000272e1661d579109080f74cc | 569d00ca86cc918d7e294c91e04e1e0e0725fa25 | refs/heads/master | 2023-01-31T20:32:16.786617 | 2020-12-14T21:52:13 | 2020-12-14T22:18:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,373 | java | package org.openmrs.module.htmlformentry.handler;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Before;
import org.junit.Test;
import org.openmrs.module.htmlformentry.BaseHtmlFormEntryTest;
public class DrugOrderTagHandlerTest extends BaseHtmlFormEntryTest {
private static final Log log = LogFactory.getLog(DrugOrderTagHandlerTest.class);
@Before
public void setupDatabase() throws Exception {
executeVersionedDataSet("org/openmrs/module/htmlformentry/data/RegressionTest-data-openmrs-2.1.xml");
}
@Test
public void shouldEnableDrugConfiguration() throws Exception {
/*
TODO:
Should be able to largely test that this parses XML correctly into schema
- Should handle all legacy options correctly and not require any body tags
- Should parse various XML configurations into appropriate DrugOrderWidgetConfig objects
- handle orderProperty, orderTemplate, various attributes, nested html in the template
- should populate the DrugOrderField object appropriately with any configured metadata options
- Should construct a DrugOrderWidget
- Should construct a DrugOrderSubmissionElement and add it to the Session
- Should render the html from the DrugOrderSubmissionElement
- for each orderProperty
- should require a name (BadFormDesignException)
- should take in attributes
- should take in options, each must have a value attribute specified (BadFormDesignException)
- value should be able to be an id, uuid, sometimes a mapping
- each option can have an optional label
- each label should be either rendered as is, or translated if it is a message code
- should get either all options, or the configured set of options, appropriate for the property
- urgency should default to ROUTINE
- enum should have a translated label
- order type should default to HtmlFormEntryUtil.drugOrderType()
- BadFormDesignException if any of doseUnits, route, durationUnits, quantityUnits are not among allowed concepts
- Should add all of the metadata to the schema and populate DrugOrderField correctly
*/
/*
TODO: Here, or in another test:
AttributeDescriptor stuff and MDS / substitutions / dependencies:
- DrugOrderTagHandler.createAttributeDescriptors. Support Substitution and Dependencies for drugOrder tag
*/
}
}
| [
"noreply@github.com"
] | Palak-137.noreply@github.com |
c15c52abdb01f94a469168753f7e058ed0beff71 | a3418358d121842106540b57e871cadc3c7c024c | /vietpage_trunk/tomcat.8080/work/Tomcat/localhost/_/org/apache/jsp/jsp/layout/RightSideAds_jsp.java | cc5c1659e606f7871f6037d5ec84c90b0d80d160 | [] | no_license | kientv80/vietpage_trunk | 7591b82d93dcd039682fd550a0e74ca7a863b9d3 | 4827bb88df18346da4a1127ba32392112a023da2 | refs/heads/master | 2021-01-19T18:33:12.405982 | 2017-04-15T17:54:17 | 2017-04-15T17:54:17 | 88,364,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,589 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.40
* Generated at: 2014-01-10 06:57:06 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.jsp.layout;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class RightSideAds_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
static {
_jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(4);
_jspx_dependants.put("/WEB-INF/custom-tags.tld", Long.valueOf(1389336987213L));
_jspx_dependants.put("/WEB-INF/struts-tags.tld", Long.valueOf(1385006053243L));
_jspx_dependants.put("/WEB-INF/tiles-jsp.tld", Long.valueOf(1385006054786L));
_jspx_dependants.put("/WEB-INF/c.tld", Long.valueOf(1385006053262L));
}
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("<!-- <a href=\"home\"><img alt=\"\" src=\"/images/vietpage/right_ads.png\"/></a> -->\r\n");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"kientv@vng.com.vn"
] | kientv@vng.com.vn |
ea62d73e8b4dce5cd628de23c6aca154a9af33ef | 52c3a67b8702099e8b2efd4e7adb804512fdbb14 | /product-service/src/main/java/cn/jerio/product/dao/GoodsDao.java | a6a07ffb4b1d57b82ed46f7a2ecbea3388ddd043 | [] | no_license | JerioHou/seckill-distributed | 54f441195aa11d7d5b6a6ca91875fca02fb039ee | ca044ab5209c42a2871ede9cecf7d0b73d90b7ac | refs/heads/master | 2022-06-28T12:25:09.973247 | 2019-06-17T14:42:44 | 2019-06-17T14:42:44 | 163,278,178 | 0 | 0 | null | 2022-06-17T02:06:03 | 2018-12-27T09:58:32 | Java | UTF-8 | Java | false | false | 935 | java | package cn.jerio.product.dao;
import cn.jerio.pojo.MiaoshaGoods;
import cn.jerio.vo.GoodsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface GoodsDao {
@Select("select g.*,mg.stock_count, mg.start_date, mg.end_date,mg.miaosha_price from miaosha_goods mg left join goods g on mg.goods_id = g.id")
public List<GoodsVo> listGoodsVo();
@Select("select g.*,mg.stock_count, mg.start_date, mg.end_date,mg.miaosha_price from miaosha_goods mg left join goods g on mg.goods_id = g.id where g.id = #{goodsId}")
public GoodsVo getGoodsVoByGoodsId(@Param("goodsId") long goodsId);
@Update("update miaosha_goods set stock_count = stock_count - 1 where goods_id = #{goodsId} and stock_count > 0")
public int reduceStock(MiaoshaGoods g);
}
| [
"houjie20@gmail.com"
] | houjie20@gmail.com |
107003367f78c0668b07ad6ebe2dcf02dca9e0c2 | 9070c973c589c5b05b6e9716d0f5f5c1abaad539 | /languages/Kajak/generator/source_gen/jetbrains/mps/samples/Kaja/generator/template/main/Template_reduce_CommandList.java | 1820fffa9b19e491afcb281c91af6ff1819fc970 | [] | no_license | Harmannz/traffic-simulation | 558ba32327c2650d74cfefb765d5a6a9a68a5aba | a08ee18976b4c04b21f922342c6504a9a012065b | refs/heads/master | 2021-09-10T17:34:11.457706 | 2018-03-30T05:21:07 | 2018-03-30T05:21:07 | 103,199,400 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,764 | java | package jetbrains.mps.samples.Kaja.generator.template.main;
/*Generated by MPS */
import jetbrains.mps.generator.runtime.Generated;
import jetbrains.mps.generator.runtime.TemplateDeclarationBase;
import org.jetbrains.mps.openapi.model.SNodeReference;
import jetbrains.mps.smodel.SNodePointer;
import java.util.Collection;
import org.jetbrains.mps.openapi.model.SNode;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.generator.runtime.TemplateContext;
import jetbrains.mps.generator.runtime.GenerationException;
import jetbrains.mps.generator.runtime.TemplateExecutionEnvironment;
import jetbrains.mps.generator.template.SourceSubstituteMacroNodesContext;
import jetbrains.mps.generator.runtime.NodeWeaveFacility;
import jetbrains.mps.generator.runtime.TemplateUtil;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
@Generated
public class Template_reduce_CommandList extends TemplateDeclarationBase {
public Template_reduce_CommandList() {
}
public SNodeReference getTemplateNode() {
return new SNodePointer("r:3ab3501c-2f4b-48e6-9b6c-e31ff8ef3185(jetbrains.mps.samples.Kaja.generator.template.main@generator)", "3308300503039928809");
}
protected Collection<SNode> applyPart0(@NotNull final TemplateContext context) throws GenerationException {
final TemplateExecutionEnvironment environment = context.getEnvironment();
Collection<SNode> tlist1 = null;
final Iterable<SNode> copyListInput1 = QueriesGenerated.sourceNodesQuery_3308300503039928825(new SourceSubstituteMacroNodesContext(context, copySrcListMacro_n3juy2_b0a0a2a4));
tlist1 = environment.copyNodes(copyListInput1, copySrcListMacro_n3juy2_b0a0a2a4, "tpl/r:3ab3501c-2f4b-48e6-9b6c-e31ff8ef3185/3308300503039928814", context);
return tlist1;
}
@Override
public Collection<SNode> apply(@NotNull TemplateExecutionEnvironment environment, @NotNull TemplateContext context) throws GenerationException {
return applyPart0(context);
}
@Override
public Collection<SNode> weave(@NotNull NodeWeaveFacility.WeaveContext weaveContext, @NotNull NodeWeaveFacility weaveSupport) throws GenerationException {
final TemplateContext templateContext = weaveSupport.getTemplateContext();
Collection<SNode> tlistpart0 = applyPart0(templateContext);
for (SNode nodeToWeave : TemplateUtil.asNotNull(tlistpart0)) {
weaveSupport.weaveNode(MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b200L, 0xf8cc6bf961L, "statement"), nodeToWeave);
}
return tlistpart0;
}
private static SNodePointer copySrcListMacro_n3juy2_b0a0a2a4 = new SNodePointer("r:3ab3501c-2f4b-48e6-9b6c-e31ff8ef3185(jetbrains.mps.samples.Kaja.generator.template.main@generator)", "3308300503039928822");
}
| [
"harman.singh@hotmail.co.nz"
] | harman.singh@hotmail.co.nz |
8deb97d2669a503a73f27a6418690f82e5ef1da9 | e68670870e42b0bdc0b36404e971e4dcaf0a1666 | /app/src/main/java/com/sharevideo/streamcode/gilbertopapa/youtube/model/Thumbnail.java | 5487b7d63ed78b448e804f045cbd71cdce20198e | [] | no_license | GilbertoPapa/Youtube | d2d09a5c08a99b79f4927c4a0c01c1640003adc9 | c5c019a2b444e8b0cb417f86eb7ad54708dab901 | refs/heads/master | 2020-04-04T20:05:49.760588 | 2019-06-29T18:41:22 | 2019-06-29T18:41:22 | 156,233,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | package com.sharevideo.streamcode.gilbertopapa.youtube.model;
/**
* Created by Gilbertopapa
*/
public class Thumbnail {
public String url;
}
| [
"Gilbertopapa013@hotmail.com"
] | Gilbertopapa013@hotmail.com |
dce3387c90f25dc329fd95d3a6f09d225c19d640 | 393b48ed17e0fce974fa628d14ec6daf67832c1d | /src/main/java/com/widera/projecteuler/problem009/Problem009.java | 144f5257a17652b2c7906f71ba68566a153dee41 | [] | no_license | hhwidera/Project-Euler | 744567bf339848bf3f355cecc40bceb4e2d69ae5 | ca094ab6a56742da2a563cffc525ac54d65bf76b | refs/heads/master | 2018-10-16T02:00:54.816280 | 2018-07-12T07:41:20 | 2018-07-12T07:41:20 | 117,290,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 778 | java | package com.widera.projecteuler.problem009;
public class Problem009 {
public static void main(String[] args) {
System.out.println("Product of Pythagorean triplet for which a + b + c = 1000: " + productOfTriplet(1000L));
}
public static long productOfTriplet(final long sumOfTriplet) {
for (long a = 0; a < sumOfTriplet/3; a++) {
for (long b = a + 1; b < sumOfTriplet/2; b++) {
for (long c = b + 1; c < sumOfTriplet; c++) {
if (a + b + c == sumOfTriplet && a * a + b * b == c * c) {
System.out.println("a: " + a + ", b: " + b + ", c: " + c);
return a * b * c;
}
}
}
}
return -1;
}
}
| [
"hans.widera@gmx.de"
] | hans.widera@gmx.de |
2325af83126139ad7f05e5aaf92231bc923a943b | 3bcaebf7d69eaab5e4086568440b2ca56219b50d | /src/main/java/com/tinyolo/cxml/parsing/demo/jaxb/cxml/SubscriptionChangeMessage.java | b34749a11a5db70dc9470b7050dcc01d484b4535 | [] | no_license | augustine-d-nguyen/cxml-parsing-demo | 2a419263b091b32e70fa84312b55d8217e691ac6 | 3cc169ee0392d88bbf0e03f0791a15287a8eba97 | refs/heads/master | 2023-01-18T19:07:27.094598 | 2020-11-20T14:52:52 | 2020-11-20T14:52:52 | 314,490,660 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,576 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2020.11.20 at 08:07:34 PM ICT
//
package com.tinyolo.cxml.parsing.demo.jaxb.cxml;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"subscription"
})
@XmlRootElement(name = "SubscriptionChangeMessage")
public class SubscriptionChangeMessage {
@XmlAttribute(name = "type", required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String type;
@XmlElement(name = "Subscription", required = true)
protected List<Subscription> subscription;
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setType(String value) {
this.type = value;
}
/**
* Gets the value of the subscription property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the subscription property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSubscription().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Subscription }
*
*
*/
public List<Subscription> getSubscription() {
if (subscription == null) {
subscription = new ArrayList<Subscription>();
}
return this.subscription;
}
}
| [
"augustine.d.nguyen@outlook.com"
] | augustine.d.nguyen@outlook.com |
1da645462f91c464571d384778088d4864e33305 | d6a9b2b496ac4b2adf832457ecf0d80952202554 | /JAVA_PRJ_1/src/it/max/oop/OOPMain.java | ac7410691b1a3007f1f3774a1e41441c03ba2f2b | [] | no_license | supermax1982/JAVA_EE_COURSE | b16650a3b2a327006092ec1ed59dd8e33d6924b7 | a255b4768b3e55c460e1bcc15f9bfc73ad2aaf2a | refs/heads/master | 2020-07-08T05:59:58.193417 | 2020-02-23T03:57:39 | 2020-02-23T03:57:39 | 203,586,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | package it.max.oop;
public class OOPMain {
public static void main(String[] args) {
// Esempio di polimorfiso stesso metodo con due implementazioni diverse
Smartphone sm=new Smartphone();
sm.setDescrizione("Google Pixel");
for (int i=0;i< sm.getStores().size();i++) {
System.out.println(sm.getStores().get(i));
}
System.out.println("---------------------------");
Libro libro=new Libro();
libro.setDescrizione("Harry potter");
for (int i=0;i< libro.getStores().size();i++) {
System.out.println(libro.getStores().get(i));
}
}
}
| [
"m.quaroni1982@gmail.com"
] | m.quaroni1982@gmail.com |
027cfc3825f421bc84ff68065ddbbdd9ec19ed09 | 67fca378b2e86e40b30f00c9d31a2d5cae0cfd28 | /conversion/DecimalToHexadecimal.java | 9277868494ce874436ee958759257676b2e91913 | [] | no_license | panditwalde/InterviewPreparation | 3768872162279edd0cf6b0340b83d9ff02f244b0 | c453de8cf7df1225f26fa67c43818d3bf9a42665 | refs/heads/master | 2021-05-26T11:46:11.002965 | 2020-04-08T15:06:42 | 2020-04-08T15:06:42 | 254,119,145 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 532 | java | package com.conversion;
public class DecimalToHexadecimal {
public static void main(String[] args) {
// TODO Auto-generated method stub
int num=23467;
String hex="";
while(num>0)
{
int rem= num%16;
hex=(process(rem))+hex;
num/=16;
}
System.out.println("Hexadecimal values is: "+hex);
}
private static String process(int num)
{
String tmp="";
if(num>=0 && num<=9)
{
tmp=tmp+num;
}
else
{
tmp=tmp+(char)(num+55);
}
return tmp;
}
}
| [
"pandit.r@techchefs.in"
] | pandit.r@techchefs.in |
56f5e1bb93d7a1e8e385d53e09db601c55a0fe59 | b962258c46b7601488f1ea556e32ceff276c129f | /OnlineJudge/src/leetcode/permutation/Permutations_46.java | 823c3dd2d1c32a2e917a0aaa18e2cbee899c7618 | [] | no_license | pyojungseon/OnlineJudge | fa1d8f1f32a89a6d761d77f0d0c179481f310af6 | f82e65d07c4af0b86930de6c895cedaf16c8f549 | refs/heads/master | 2022-05-01T01:00:26.322335 | 2022-04-06T23:59:04 | 2022-04-06T23:59:04 | 171,268,010 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 883 | java | package leetcode.permutation;
import java.util.ArrayList;
import java.util.List;
public class Permutations_46 {
public List<List<Integer>> permute(int[] nums) {
List<List<Integer>> ret = new ArrayList<>();
List<Integer> numList = new ArrayList<>();
if(nums.length==0)
return null;
traversal(nums, ret, numList);
return ret;
}
public void traversal(int[] nums, List<List<Integer>> ret, List<Integer> numList) {
for(int num : nums) {
if(numList.contains(num))
continue;
numList.add(num);
if(numList.size()==nums.length) {
ret.add(new ArrayList<Integer>(numList));
} else {
traversal(nums, ret, numList);
}
numList.remove(numList.size()-1);
}
}
}
| [
"suehig@naver.com"
] | suehig@naver.com |
ccc1be040923cbc4834c75b23cbce30967cd0fc0 | 885072f28b43da2bfcf1b8ca0f2f7dd8cc58b72d | /src/main/java/it/smartcommunitylab/resourcemanager/config/SwaggerConfiguration.java | efd35c966497ff9b56185b47974b6dc6b2afcfe6 | [] | no_license | scc-digitalhub/resourcemanager | 210988d8b1a9abf1fa63e2273e6cb53cc4c08503 | b0cc20fff947bf17b8fcc69e238d03c63addf3b6 | refs/heads/master | 2022-09-14T19:47:39.779465 | 2021-06-03T10:44:43 | 2021-06-03T10:44:43 | 184,770,599 | 1 | 0 | null | 2022-09-08T01:00:05 | 2019-05-03T14:35:55 | Java | UTF-8 | Java | false | false | 3,514 | java | package it.smartcommunitylab.resourcemanager.config;
import java.util.Arrays;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import io.swagger.annotations.Api;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.AuthorizationCodeGrantBuilder;
import springfox.documentation.builders.OAuthBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.GrantType;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.service.SecurityScheme;
import springfox.documentation.service.TokenEndpoint;
import springfox.documentation.service.TokenRequestEndpoint;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger.web.SecurityConfiguration;
import springfox.documentation.swagger.web.SecurityConfigurationBuilder;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
@Value("${spring.security.oauth2.resourceserver.client-id}")
private String CLIENT_ID;
// @Value("${security.oauth2.client.client-secret}")
// private String CLIENT_SECRET;
//
// @Value("${security.oauth2.client.access-token-uri}")
// private String TOKEN_URL;
//
// @Value("${security.oauth2.client.user-authorization-uri}")
// private String AUTH_URL;
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
.paths(PathSelectors.any())
.build()
.apiInfo(metadata())
// .securitySchemes(Arrays.asList(securityScheme()))
.securityContexts(Arrays.asList(securityContext()));
}
private ApiInfo metadata() {
return new ApiInfoBuilder()
.title("ResourceManager REST API")
.description("REST API for resource manager")
.version("1.0.0")
.license("")
.licenseUrl("")
.build();
}
// @Bean
// public SecurityConfiguration security() {
// return SecurityConfigurationBuilder.builder()
// .clientId(CLIENT_ID)
// .clientSecret(CLIENT_SECRET)
// .scopeSeparator(" ")
// .useBasicAuthenticationWithAccessCodeGrant(true)
// .build();
// }
//
// private SecurityScheme securityScheme() {
// GrantType grantType = new AuthorizationCodeGrantBuilder()
// .tokenEndpoint(new TokenEndpoint(TOKEN_URL, "oauthtoken"))
// .tokenRequestEndpoint(new TokenRequestEndpoint(AUTH_URL, CLIENT_ID, CLIENT_SECRET))
// .build();
//
// SecurityScheme oauth = new OAuthBuilder().name("spring_oauth")
// .grantTypes(Arrays.asList(grantType))
// .scopes(Arrays.asList(scopes()))
// .build();
// return oauth;
// }
private AuthorizationScope[] scopes() {
AuthorizationScope[] scopes = {
new AuthorizationScope("read", "read"),
new AuthorizationScope("write", "write") };
return scopes;
}
private SecurityContext securityContext() {
return SecurityContext.builder()
.securityReferences(Arrays.asList(new SecurityReference("spring_oauth", scopes())))
.forPaths(PathSelectors.any())
.build();
}
}
| [
"matteo.saloni@gmail.com"
] | matteo.saloni@gmail.com |
9476e4f4488ab117e0e28d07e3083c489378601a | 2877509fa847aec176aec3c7a4aaa8193d7b7569 | /daytodayhealth_rating/src/main/java/com/daytodayhealth/rating/exception/Constants.java | 9c73af34ed5dcbfa9f10d72071e03bef80b4bd09 | [] | no_license | rishabh9028/DayToDayHealth_Ratings | ff3352f9e50dbf26a4cf6aeea450178e90a03b69 | 7a2a024dbf157f69c0bef9c66eb6408a433c3aec | refs/heads/master | 2022-11-24T07:46:48.428539 | 2020-07-29T11:30:26 | 2020-07-29T11:31:14 | 283,400,396 | 0 | 0 | null | 2020-07-29T11:31:16 | 2020-07-29T04:45:47 | null | UTF-8 | Java | false | false | 756 | java | package com.daytodayhealth.rating.exception;
public class Constants {
private Constants() {
}
public static final String ENTER = "Enter in {}";
public static final String ENTER1 = "Enter in condition {}";
public static final String EXIT = "Exit from {}";
public static final String TDATA = "tData";
public static final String EXIT_METHOD = "Existing from {}";
public static final String MESSAGE = "Error";
public static final String DELETE = "delete";
public static final String CREATE = "create";
public static final String UPDATE = "update";
public static final String DATA_FOUND = "RecordFound";
public static final String STATUS = "status";
public static final String GET = "get";
}
| [
"31797064+rishabh9028@users.noreply.github.com"
] | 31797064+rishabh9028@users.noreply.github.com |
46f55b54afcc79721145568999d2bc418a32fc54 | e0c1c499673ccd710121deb4da39a6196ba7aa83 | /DiceGame/DiceBag.java | 0e3097612da196c0dbab34cf9054305dae887e60 | [] | no_license | juanjoneri/LMU-CMSI186-Spr16 | e56a416f40d258a7aa62ed7cfae46141a3e9abb6 | f00e9f2edfada5e371e70113e7370fdbbeac73c8 | refs/heads/master | 2021-01-10T22:57:39.034163 | 2016-10-29T05:41:06 | 2016-10-29T05:41:06 | 69,717,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,002 | java | import java.util.HashMap;
import java.util.Map;
public class DiceBag {
public static final int DEFAULT_NUMBER_OF_DICE = 2; //Implement me!
private Die[] dice;
// Constructs a DiceBag with the default number of Die objects, each
// with the default number of sides.
public DiceBag() {
this.dice = new Die[DEFAULT_NUMBER_OF_DICE];
for(int i=0; i<dice.length; i++){
this.dice[i] = new Die();
}
}
// Constructs a DiceBag with the given number of Die objects, each
// with the default number of sides.
public DiceBag(int numberOfDice) {
this.dice = new Die[numberOfDice];
for(int i=0; i<dice.length; i++){
this.dice[i] = new Die();
}
}
// Constructs a DiceBag with the given of Die objects, each
// with the given number of sides.
public DiceBag(int numberOfDice, long sidesPerDie) {
this.dice = new Die[numberOfDice];
for(int i=0; i<dice.length; i++){
this.dice[i] = new Die(sidesPerDie);
}
}
// Constructs a DiceBag containing one die of each number
// of sides within sidesPerDie array.
public DiceBag(long[] sidesPerDie) {
this.dice = new Die[sidesPerDie.length];
for (int i=0; i<sidesPerDie.length; i++){
this.dice[i] = new Die(sidesPerDie[i]);
}
}
// Roll every Die within the DiceBag and reorder the Dice within the
// bag randomly.
public void shakeBag() {
for(Die die: dice){
die.roll();
}
reorderDice();
}
// Reorder the Dice within the bag randomly.
public void reorderDice() {
Die[] tempBag = new Die[dice.length];
for (int i = dice.length -1 ; i >= 0; i--){
int index = ((int) randomValue(i + 1) -1);
Die tempDie = dice[index];
tempBag[dice.length - i - 1] = tempDie;
dice[index] = dice[i];
}
this.dice = tempBag;
}
public int getPosition(Die die){
for (int i=0; i<dice.length; i++){
if(new Die().exactMake(dice[i], die)){
return i;
}
}
return -1;
}
// Return the first non null Die chosen randomly from the DiceBag.
public Die getRandomDie() {
return dice[(int) randomValue(dice.length)-1];
}
private static long randomValue(long max){
return (long) Math.floor(Math.random()*max+1);
}
// Replace the Die at givenindex within the DiceBag with the provided Die.
public void setDie(int index, Die die) {
if(index<=(dice.length-1)){
dice[index] = die;
}
}
// Returns the Die at given index within the DiceBag.
public Die getDie(int index) {
if(index<=(dice.length-1)){
return dice[index];
}
throw new IndexOutOfBoundsException("There are not " + index + " in the bag");
}
public int getBagSize(){
return this.dice.length;
}
public Die[] getDies(){
return this.dice;
}
// Returns true if this DiceBag contains the equivalent Dice in the same
// order, regardless of face-up side.
public boolean orderedEquals(DiceBag diceBag) {
boolean sameSize = diceBag.getBagSize() == this.getBagSize();
boolean sameDice = true;
if (sameSize){
Die[] bag1 = this.dice;
Die[] bag2 = diceBag.getDies();
for (int i=0; i<bag1.length; i++){
//inneficient code#
sameDice = new Die().sameMake(bag1[i], bag2[i]);
if(!sameDice){
break;
}
}
}
return sameSize && sameDice;
}
public Die[] orderBySize(Die[] initialBag){
Die[] bag = initialBag;
for (int i=0; i<bag.length; i++){
int biggest = 0;
int index = 0;
//I repeat until -i because i now from there on they are in order
for(int j=0; j<bag.length-i; j++){
if(bag[j].getNumberOfSides() > biggest){
biggest = (int) bag[j].getNumberOfSides();
index = j;
}
}
Die replacedDie = bag[bag.length - i - 1];
Die toMoveDie = bag[index];
bag[bag.length - i - 1] = toMoveDie;
bag[index] = replacedDie;
}
return bag;
}
// Returns a string representation of the DiceBag.
@Override
public String toString() {
String bagString = "{";
for (int i = 0; i < dice.length; i++) {
bagString += dice[i].toString();
if (i != dice.length - 1) {
bagString += ", ";
}
}
bagString += "}";
return bagString;
}
// Returns true if this DiceBag is contains the same number of Dice in
// the same ratio of sides.
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
DiceBag other = (DiceBag)obj;
if ( this.dice.length != other.dice.length) {
return false;
} else {
return this.tally().equals(other.tally());
}
}
private Map<Long, Integer> tally() {
Map<Long, Integer> result = new HashMap<Long, Integer>();
for (Die die: dice) {
Integer value = result.get(die.getNumberOfSides());
if (value == null) {
result.put(die.getNumberOfSides(), 1);
} else {
result.put(die.getNumberOfSides(), value + 1);
}
}
return result;
}
} | [
"juanjo.neri@gmail.com"
] | juanjo.neri@gmail.com |
08a94baaa836cc910f9225eb783efeb03f10f70b | c2d8bc661649d01e100eca757218ef7790f4b2f9 | /src/test/java/automation/webtest/devtoolstest/DeviceDimensionTest.java | e49f4192afbc81b96c500f4957f7aa5f2ae495d8 | [] | no_license | satyar3/selenium-web-chrome-dev-tools | 3c46dc5f0d3be38f9670477cccdf4fc3aa67875f | d3b2e65d0accb62756bde565ce00f5c450ed1ae8 | refs/heads/master | 2023-03-31T11:11:11.132745 | 2021-04-04T17:07:23 | 2021-04-04T17:07:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,137 | java | package automation.webtest.devtoolstest;
import automation.base.BaseTest;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.v89.emulation.Emulation;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
public class DeviceDimensionTest extends BaseTest {
private WebDriver localWebDriver;
@BeforeClass
public void initialiseClass() {
localWebDriver = super.driver;
}
@Test
public void simulateDeviceDimensions(){
DevTools devTools = ((ChromeDriver)driver).getDevTools();
devTools.createSession();
Map deviceMetrics = new HashMap()
{{
put("width", 600);
put("height", 1000);
put("mobile", true);
put("deviceScaleFactor", 50);
}};
((ChromeDriver)driver).executeCdpCommand("Emulation.setDeviceMetricsOverride", deviceMetrics);
driver.get("https://www.zoomcar.com"); //set device first and then launch
}
}
| [
"deepak.attri@zoomcar.com"
] | deepak.attri@zoomcar.com |
413984c78847f0919be792bc59c57af6e1bac6a2 | 29d0c6cb1b2422c26a034b9a75565d2195d4b6cd | /src/leetcode/SubdomainVisitCount.java | 865fa7f4432454d9bcbd98744b89ac03c14d6290 | [] | no_license | asaranprasad/back-to-school | cb31bd220406e2e90f3add60121a4fa9a8ada7e7 | 4ca4cf6b9f4dcaf209e7020057b86e4ff4130bc0 | refs/heads/master | 2021-06-18T03:33:54.913211 | 2019-07-03T17:39:36 | 2019-07-03T17:39:36 | 107,063,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 984 | java | // https://leetcode.com/problems/subdomain-visit-count/submissions/
// * use map.merge(dom, count, (a, b) -> a + b) function, which is an awesome combination of putIfAbset() and getOrDefault()
// * use string.indexOf('.') and then substring(), which is much faster than .contains("//.") or .split("//.")
package leetcode;
public class SubdomainVisitCount {
public List<String> subdomainVisits(String[] cpdomains) {
HashMap<String, Integer> map = new HashMap<>();
for(String d : cpdomains){
String dom = d.split(" ")[1];
int count = Integer.parseInt(d.split(" ")[0]);
map.merge(dom, count, (a, b) -> a + b);
while(dom.indexOf('.') > 0){
dom = dom.substring(dom.indexOf('.') + 1);
map.merge(dom, count, (a, b) -> a + b);
}
}
return map.keySet().stream().map(k -> map.get(k) + " " + k).collect(Collectors.toList());
}
}
| [
"ambikapathy.s@husky.neu.edu"
] | ambikapathy.s@husky.neu.edu |
e9225e7e615ab709cafc87ff234e81a270535dae | 2ec6ea2d6ef36b41f57cf7cb72dad3bb70541a9c | /API/src/test/java/test/kitcheData/InitKithenCookieData2DB.java | 32759c1d148a58b4ccbec90ea2b23ffe247815ce | [] | no_license | 6638112/propertyERP-2 | b40dac0e6b96f51b351fcef03c9c530b9fc64938 | 8240b03f7c3ea195913bae467cac41e006c82c61 | refs/heads/master | 2023-07-08T17:07:20.127060 | 2018-03-19T07:13:05 | 2018-03-19T07:13:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,882 | java | /**
* Filename: InitKithenCookieData2DB.java
* @version: 1.0
* Create at: 2014年8月2日 上午2:25:42
* Description:
*
* Modification History:
* Date Author Version Description
* -----------------------------------------------------------------
* 2014年8月2日 shiyl 1.0 1.0 Version
*/
package test.kitcheData;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import com.cnfantasia.server.api.BaseTest;
import com.cnfantasia.server.api.kitchen.constant.KitchenDict;
import com.cnfantasia.server.common.utils.StringUtils;
import com.cnfantasia.server.domainbase.kitchenCookbook.dao.IKitchenCookbookBaseDao;
import com.cnfantasia.server.domainbase.kitchenCookbook.entity.KitchenCookbook;
import com.cnfantasia.server.domainbase.kitchenCookbookStep.dao.IKitchenCookbookStepBaseDao;
import com.cnfantasia.server.domainbase.kitchenCookbookStep.entity.KitchenCookbookStep;
import com.cnfantasia.server.domainbase.kitchenCookbookTypeHasTKitchenCookbook.dao.IKitchenCookbookTypeHasTKitchenCookbookBaseDao;
import com.cnfantasia.server.domainbase.kitchenCookbookTypeHasTKitchenCookbook.entity.KitchenCookbookTypeHasTKitchenCookbook;
import com.cnfantasia.server.domainbase.kitchenDetail.dao.IKitchenDetailBaseDao;
import com.cnfantasia.server.domainbase.kitchenDetail.entity.KitchenDetail;
/**
* Filename: InitKithenCookieData2DB.java
* @version: 1.0.0
* Create at: 2014年8月2日 上午2:25:42
* Description:
*
* Modification History:
* Date Author Version Description
* ------------------------------------------------------------------
* 2014年8月2日 shiyl 1.0 1.0 Version
*/
public class InitKithenCookieData2DB extends BaseTest{
private static final boolean copyPicData = false;
private static final boolean inert2DbBath = false;
/**
* 1.先run as java Application 校验数据
* @param args
* @throws IOException
* @throws BadHanyuPinyinOutputFormatCombination
*/
public static void main(String[] args) throws IOException, BadHanyuPinyinOutputFormatCombination {
InitKithenCookieData2DB initKithenCookieData2DB = new InitKithenCookieData2DB();
initKithenCookieData2DB.doKitchenCook2DB();
}
// @Test
public void doKitchenCook2DB() throws IOException, BadHanyuPinyinOutputFormatCombination{
String createTime = "2014-11-14 11:36:54";//TODO ..
List<KitchenCookbook> kitchenCookbookList = new ArrayList<KitchenCookbook>();
List<KitchenCookbookStep> kitchenCookbookStepList = new ArrayList<KitchenCookbookStep>();
// List<KitchenCookbookType> kitchenCookbookTypeList = new ArrayList<KitchenCookbookType>();
List<KitchenDetail> kitchenDetailList = new ArrayList<KitchenDetail>();
List<KitchenCookbookTypeHasTKitchenCookbook> kitchenCookbookTypeHasTKitchenCookbookList = new ArrayList<KitchenCookbookTypeHasTKitchenCookbook>();
// 停止服务
File fileDir = new File(InitKithenCookieData.srcDirPath);
File[] fileDirAll = fileDir.listFiles();
for (File signalFileDir : fileDirAll) {
if (signalFileDir.isDirectory()) {
System.out.println("Curr directory is :"+signalFileDir.getName());
//hengren菜谱信息
BigInteger cookBookId = InitKithenCookieData.getCookbook_Id();
String[] tmpNameArray = signalFileDir.getName().split("==");
Set<BigInteger> typeIdSet = new HashSet<BigInteger>();
for(int i=0;i<tmpNameArray.length-1;i++){
typeIdSet.add(InitKithenCookieData.typeName2Id(tmpNameArray[i]));
}
for(BigInteger tmpTypeId:typeIdSet){//菜品所属类别
BigInteger kitchenCookbookTypeHasTKitchenCookbookId = InitKithenCookieData.getKitchen_cookbook_type_has_t_kitchen_cookbook_Id();
KitchenCookbookTypeHasTKitchenCookbook kitchenCookbookTypeHasTKitchenCookbook =
new KitchenCookbookTypeHasTKitchenCookbook(kitchenCookbookTypeHasTKitchenCookbookId, tmpTypeId, cookBookId, null, null, null, null, null, null, 0);
kitchenCookbookTypeHasTKitchenCookbookList.add(kitchenCookbookTypeHasTKitchenCookbook);
}
String cookBookName = tmpNameArray[tmpNameArray.length-1];
String eatWeight = null;//后面获取
String cookTime = null;//后面获取
String desc = null;//后面获取
String cookBookPicUrl = null;//后面获取
String taste = null;//目前不包含口感
String cookTech = null;//工艺 后面获取
String tips = null;//小贴士 后面获取
// KitchenCookbook kitchenCookbook = new KitchenCookbook(cookBookId,cookBookName, cookBookPicUrl, desc, eatWeight, cookTime, null, taste, typeId, null, null, null, null, null, null, 0);
// KitchenCookbook kitchenCookbook = new KitchenCookbook(cookBookId,cookBookName, cookBookPicUrl, desc, eatWeight, cookTime, null, taste,null, null, null, null, null, null, 0);
// KitchenCookbook kitchenCookbook = new KitchenCookbook(cookBookId, cookBookName, cookBookPicUrl, desc, eatWeight, cookTime, null, taste, cookTech, tips, null, null, null, null, null, null, 0);
KitchenCookbook kitchenCookbook = new KitchenCookbook(cookBookId, cookBookName, cookBookPicUrl, desc, null, eatWeight, cookTime, null, taste, cookTech, tips, createTime, null, null, null, null, null, null, 0,null);
// 1.获取目录下的文件列表
File[] infoListFile = signalFileDir.listFiles();
// 2.获取 文本信息
List<String> txtFileNames = new ArrayList<String>();
txtFileNames.add("步骤.txt"); txtFileNames.add("做法.txt");
txtFileNames.add("参数.txt"); txtFileNames.add("辅料.txt");
txtFileNames.add("调料.txt"); txtFileNames.add("主料.txt");
txtFileNames.add("食材.txt");
txtFileNames.add("功能.txt"); txtFileNames.add("简介.txt");
txtFileNames.add("小贴士.txt");
for (File tmpFile : infoListFile) {
String fileName = tmpFile.getName();
if (!txtFileNames.contains(fileName)) {
continue;
}
System.out.println(tmpFile.getName() + ":");
BufferedReader buffRead = new BufferedReader(new InputStreamReader(new FileInputStream(tmpFile), "GBK"));
String line = buffRead.readLine();
StringBuffer tipsSbf = new StringBuffer();
int orderNum = 0;
while (line != null) {
System.out.println("当前行数据:"+line);
if(!StringUtils.isEmpty(line)){
line = line.trim();
if("小贴士.txt".equals(fileName)){
tipsSbf.append(line+"\r");
}else if("步骤.txt".equals(fileName)||"做法.txt".equals(fileName)){
BigInteger kitchenCookbookStepId = InitKithenCookieData.getStep_Id();
String kitchenCookbookStepPicUrl = null;//目前步骤都不包含图片
orderNum++;
KitchenCookbookStep kitchenCookbookStep = new KitchenCookbookStep(kitchenCookbookStepId, line, kitchenCookbookStepPicUrl, cookBookId, orderNum, null, null, null, null, null, null, 0);
kitchenCookbookStepList.add(kitchenCookbookStep);
}else if("功能.txt".equals(fileName)||"简介.txt".equals(fileName)){
kitchenCookbook.setDesc(line);//设置功能描述
}else{
int maoHaoIndex = line.indexOf(":");
if(maoHaoIndex==-1){
maoHaoIndex = line.indexOf(":");
}
if(maoHaoIndex==-1){
maoHaoIndex = line.length();
}
String lineKey = line.substring(0, maoHaoIndex);
String lineValue = null;
try {
lineValue = line.substring(maoHaoIndex+1);
} catch (Exception e) {
}
if("参数.txt".equals(fileName)){
if(line.startsWith("份量")){
kitchenCookbook.setEatWeight(lineValue);
}else if(line.startsWith("制作时间")||line.startsWith("用时")){
kitchenCookbook.setCookTime(lineValue);
}else if(line.startsWith("工艺")){
kitchenCookbook.setCookTech(lineValue);
}else if(line.startsWith("口味")){
kitchenCookbook.setTaste(lineValue);
}
} else if("辅料.txt".equals(fileName)||"调料.txt".equals(fileName)){
BigInteger kitchenDetailId = InitKithenCookieData.getDetail_Id();
Integer type = KitchenDict.KitchenDetail_Type.ASSIST;
KitchenDetail kitchenDetail = new KitchenDetail(kitchenDetailId, type, null, lineKey, lineValue,cookBookId,null, null, null, null, null, null, 0);
kitchenDetailList.add(kitchenDetail);
}else if("主料.txt".equals(fileName)||"食材.txt".equals(fileName)){
BigInteger kitchenDetailId = InitKithenCookieData.getDetail_Id();
Integer type = KitchenDict.KitchenDetail_Type.MAIN;
KitchenDetail kitchenDetail = new KitchenDetail(kitchenDetailId, type, null, lineKey, lineValue,cookBookId,null, null, null, null, null, null, 0);
kitchenDetailList.add(kitchenDetail);
}
}
}
line = buffRead.readLine();
}
kitchenCookbook.setTips(tipsSbf.toString());
buffRead.close();
}
// 3.定义图片名字,并拷贝图片到指定文件夹
boolean isExistPic = false;
for (File tmpFile : infoListFile) {
String srcFileName = tmpFile.getName();
if (srcFileName.endsWith(".jpg") || srcFileName.endsWith(".png") || srcFileName.endsWith(".jpeg")){
isExistPic = true;
int pointIndex = srcFileName.lastIndexOf('.');
// String picFileName = PinyinUtil.hanyuToPinyinSimple(srcFileName.substring(0, pointIndex))
// + srcFileName.substring(pointIndex);
cookBookPicUrl = InitKithenCookieData.getCookPicName(signalFileDir.getName().split("==")[1],cookBookId)+srcFileName.substring(pointIndex);
String goalAbsFilePath = InitKithenCookieData.outputPicDirPath + File.separator + cookBookPicUrl;
System.out.println("Copy form " + tmpFile.getAbsolutePath());
System.out.println("to " + goalAbsFilePath);
if(copyPicData){
InitKithenCookieData.copyFile(tmpFile, new File(goalAbsFilePath));//图片
}
kitchenCookbook.setPicUrl(cookBookPicUrl);//设置图片地址
}
}
if (!isExistPic) {
throw new RuntimeException();
}
// 组装新增对象
kitchenCookbookList.add(kitchenCookbook);
}
//输出数据
{
System.out.println("菜谱信息:");
for(KitchenCookbook kitchenCookbook:kitchenCookbookList){
System.out.println(kitchenCookbook);
}
System.out.println("菜谱步骤信息:");
for(KitchenCookbookStep kitchenCookbookStep:kitchenCookbookStepList){
System.out.println(kitchenCookbookStep);
}
System.out.println("菜谱参数信息:");
for(KitchenDetail kitchenDetail:kitchenDetailList){
System.out.println(kitchenDetail);
}
System.out.println("菜谱类别关系数据信息:");
for(KitchenCookbookTypeHasTKitchenCookbook kitchenCookbookTypeHasTKitchenCookbook:kitchenCookbookTypeHasTKitchenCookbookList){
System.out.println(kitchenCookbookTypeHasTKitchenCookbook);
}
}
//各个表数据的批量新增
}
System.out.println("t_kitchen_cookbook_startId="+InitKithenCookieData.t_kitchen_cookbook_startId);
System.out.println("t_kitchen_cookbook_step_startId="+InitKithenCookieData.t_kitchen_cookbook_step_startId);
// System.out.println("t_kitchen_cookbook_type_startId="+InitKithenCookieData.t_kitchen_cookbook_type_startId);
System.out.println("t_kitchen_detail_startId="+InitKithenCookieData.t_kitchen_detail_startId);
System.out.println("t_kitchen_cookbook_type_has_t_kitchen_cookbook_startId="+InitKithenCookieData.t_kitchen_cookbook_type_has_t_kitchen_cookbook_startId);
if(inert2DbBath){//新增到数据库
IKitchenCookbookBaseDao kitchenCookbookBaseDao = ctx.getBean("kitchenCookbookBaseDao", IKitchenCookbookBaseDao.class);
IKitchenCookbookStepBaseDao kitchenCookbookStepBaseDao = ctx.getBean("kitchenCookbookStepBaseDao", IKitchenCookbookStepBaseDao.class);
IKitchenDetailBaseDao kitchenDetailBaseDao = ctx.getBean("kitchenDetailBaseDao", IKitchenDetailBaseDao.class);
IKitchenCookbookTypeHasTKitchenCookbookBaseDao kitchenCookbookTypeHasTKitchenCookbookBaseDao = ctx.getBean("kitchenCookbookTypeHasTKitchenCookbookBaseDao", IKitchenCookbookTypeHasTKitchenCookbookBaseDao.class);
// kitchenCookbookBaseDao.insertKitchenCookbookBatch(kitchenCookbookList);
// kitchenCookbookStepBaseDao.insertKitchenCookbookStepBatch(kitchenCookbookStepList);
// kitchenDetailBaseDao.insertKitchenDetailBatch(kitchenDetailList);
kitchenCookbookTypeHasTKitchenCookbookBaseDao.insertKitchenCookbookTypeHasTKitchenCookbookBatch(kitchenCookbookTypeHasTKitchenCookbookList);
}
}
}
| [
"905373499@qq.com"
] | 905373499@qq.com |
fe205a4862a4c8d0e33135b556e58e5d231d6421 | 2b7bdecf211f8aea7948602953dba1297e75015a | /api/src/main/java/org/jboss/marshalling/ChainingClassExternalizerFactory.java | aaf97b8d7fc0447eaf731c3c9ddd0beb70e335a7 | [
"Apache-2.0"
] | permissive | jboss-remoting/jboss-marshalling | 0fa4846df3435a6ea2d4fffed826f94b6e3ffc4c | e62e127fac12dae958083c9626fe3606335f49d6 | refs/heads/main | 2023-08-31T21:52:29.492800 | 2023-08-16T16:58:02 | 2023-08-16T17:30:07 | 1,861,618 | 28 | 57 | Apache-2.0 | 2023-09-12T11:27:31 | 2011-06-07T19:27:42 | Java | UTF-8 | Java | false | false | 3,106 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2014 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* 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.jboss.marshalling;
import java.util.Collection;
import java.util.Iterator;
/**
* A class externalizer factory that tries each delegate externalizer factory in sequence, returning the first match.
*/
public class ChainingClassExternalizerFactory implements ClassExternalizerFactory {
private final ClassExternalizerFactory[] externalizerFactories;
/**
* Construct a new instance.
*
* @param factories a collection of factories to use
*/
public ChainingClassExternalizerFactory(final Collection<ClassExternalizerFactory> factories) {
externalizerFactories = factories.toArray(new ClassExternalizerFactory[factories.size()]);
}
/**
* Construct a new instance.
*
* @param factories a collection of factories to use
*/
public ChainingClassExternalizerFactory(final Iterable<ClassExternalizerFactory> factories) {
this(factories.iterator());
}
/**
* Construct a new instance.
*
* @param factories a sequence of factories to use
*/
public ChainingClassExternalizerFactory(final Iterator<ClassExternalizerFactory> factories) {
externalizerFactories = unroll(factories, 0);
}
/**
* Construct a new instance.
*
* @param factories an array of factories to use
*/
public ChainingClassExternalizerFactory(final ClassExternalizerFactory[] factories) {
externalizerFactories = factories.clone();
}
private static ClassExternalizerFactory[] unroll(final Iterator<ClassExternalizerFactory> iterator, final int i) {
if (iterator.hasNext()) {
final ClassExternalizerFactory factory = iterator.next();
final ClassExternalizerFactory[] array = unroll(iterator, i + 1);
array[i] = factory;
return array;
} else {
return new ClassExternalizerFactory[i];
}
}
/** {@inheritDoc} This implementation tries each nested externalizer factory in order until a match is found. */
public Externalizer getExternalizer(final Class<?> type) {
for (ClassExternalizerFactory externalizerFactory : externalizerFactories) {
final Externalizer externalizer = externalizerFactory.getExternalizer(type);
if (externalizer != null) {
return externalizer;
}
}
return null;
}
}
| [
"david.lloyd@redhat.com"
] | david.lloyd@redhat.com |
17d19cc59f72b2410f8fe2ad4f0b586d84974747 | 27ca6401aab2ac79aea20db2b4d6bbe6efe3dbb4 | /src/main/java/dk/dtu/ds/rmids/Access.java | 069c39b2af7a89dc6f91398273b5aae9fee30e73 | [] | no_license | SteenBartholdy/RmiDSPrintServerRoleBased | 04d1aa20290fddc2427e0ddbb18fe923998a8e20 | fc8838f1379f922cdb88e96f7f2464cb6555d470 | refs/heads/master | 2020-07-31T01:21:50.893505 | 2016-11-20T10:45:57 | 2016-11-20T10:45:57 | 73,611,705 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,275 | java | /*
* 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 dk.dtu.ds.rmids;
/**
*
* @author Anders, Steen & Christoffer
*/
public class Access {
private boolean print, queue, topQueue, start, stop, restart, status, readConfig, setConfig;
public Access(boolean print, boolean queue, boolean topQueue, boolean start, boolean stop, boolean restart, boolean status, boolean readConfig, boolean setConfig)
{
this.print = print;
this.queue = queue;
this.topQueue = topQueue;
this.start = start;
this.stop = stop;
this.restart = restart;
this.status = status;
this.readConfig = readConfig;
this.setConfig = setConfig;
}
public boolean isPrint() {
return print;
}
public void setPrint(boolean print) {
this.print = print;
}
public boolean isQueue() {
return queue;
}
public void setQueue(boolean queue) {
this.queue = queue;
}
public boolean isTopQueue() {
return topQueue;
}
public void setTopQueue(boolean topQueue) {
this.topQueue = topQueue;
}
public boolean isStart() {
return start;
}
public void setStart(boolean start) {
this.start = start;
}
public boolean isStop() {
return stop;
}
public void setStop(boolean stop) {
this.stop = stop;
}
public boolean isRestart() {
return restart;
}
public void setRestart(boolean restart) {
this.restart = restart;
}
public boolean isStatus() {
return status;
}
public void setStatus(boolean status) {
this.status = status;
}
public boolean isReadConfig() {
return readConfig;
}
public void setReadConfig(boolean readConfig) {
this.readConfig = readConfig;
}
public boolean isSetConfig() {
return setConfig;
}
public void setSetConfig(boolean setConfig) {
this.setConfig = setConfig;
}
}
| [
"steen@DESKTOP-AQBDF90"
] | steen@DESKTOP-AQBDF90 |
76565bc2dab485b014e8ec5464d6f74281327880 | 8fc6982a16a0703d85ce816d45734a2cb4af6c3f | /Minggu 06/SelectionSort.java | 3c391946f041b81071ec5c35da12900b4b8bec86 | [] | no_license | idanovita/E41200109_Ida-Novita-Sari_Gol.A | 2de929700fe5a8f00cb12e9887aa5531ad4cba69 | 22e5f03b169f5e24023417d97ce4e5d33411f49d | refs/heads/main | 2023-04-16T09:04:35.174867 | 2021-04-25T04:36:31 | 2021-04-25T04:36:31 | 347,633,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,746 | java | /*
* 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 TugasMinggu6Sorting;
import java.util.Scanner;
/**
*
* @author user
*/
public class SelectionSort {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
// Buat Objek Scanner
Scanner scan = new Scanner(System.in);
// Input jumlah Data
System.out.print("Masukkan jumlah Data : "); int jlh_data = scan.nextInt();
// Input nilai tiap Data
int[] data = new int[jlh_data]; // Array untuk nilai tiap Data
System.out.println();
for(int x = 0; x < jlh_data; x++)
{
System.out.print("Input nilai Data ke-"+(x+1)+" : ");
data[x] = scan.nextInt();
}
// Tampilkan Data Sebelum di sorting
System.out.println();
System.out.print("Data Sebelum di Sorting : ");
for(int x = 0; x < jlh_data; x++)
System.out.print(data[x]+" ");
// Proses Selection Sort
System.out.println("\n\nProses Selection Sort");
for(int x = 0; x < jlh_data-1; x++)
{
System.out.println("Iterasi ke-"+(x+1)+" : ");
for(int y = 0; y < jlh_data; y++)
System.out.print(data[y]+" ");
System.out.println(" Apakah Data "+data[x]+" sudah benar pada urutannya?");
boolean tukar = false;
int index = 0;
int min = data[x];
String pesan = " Tidak Ada Pertukaran";
for(int y = x+1; y < jlh_data; y++)
{
if(min > data[y])
{
tukar = true;
index = y;
min = data[y];
}
}
if(tukar == true)
{
// Pertukaran Data
pesan = " Data "+data[x]+" ditukar dengan Data "+data[index];
int temp = data[x];
data[x] = data[index];
data[index] = temp;
}
for(int y = 0; y < jlh_data; y++)
System.out.print(data[y]+" ");
System.out.println(pesan+"\n");
}
// Tampilkan Data Setelah di Sorting
System.out.print("Data Setelah di sorting : ");
for(int x = 0; x < jlh_data; x++)
System.out.print(data[x]+" ");
}
}
| [
"80628392+idanovita@users.noreply.github.com"
] | 80628392+idanovita@users.noreply.github.com |
2eb184bad3a501ec0d54eda26af41fed31f4e1bd | 529693c4461d3445a783092fe3efb4d0d43308a3 | /Assignments/ Project One/apache-jmeter-5.0/src/components/org/apache/jmeter/visualizers/LineGraph.java | 0da4e8cc3cdcd60a1d8e08201faefaa7ecf195bb | [
"Apache-2.0"
] | permissive | 4nthonyCastro/softwareValidation-QualityAssurance | 168a4da32d6d83313d0358423e8f37fa52f2abf8 | 448bc26e36eb33a019950923143cb89e4c8fd1b0 | refs/heads/master | 2023-01-03T21:17:15.178060 | 2020-11-04T18:51:15 | 2020-11-04T18:51:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,321 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.jmeter.visualizers;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LayoutManager;
import java.awt.Paint;
import java.awt.Shape;
import java.awt.Stroke;
import javax.swing.JPanel;
import org.jCharts.axisChart.AxisChart;
import org.jCharts.chartData.AxisChartDataSet;
import org.jCharts.chartData.DataSeries;
import org.jCharts.properties.AxisProperties;
import org.jCharts.properties.ChartProperties;
import org.jCharts.properties.DataAxisProperties;
import org.jCharts.properties.LegendProperties;
import org.jCharts.properties.LineChartProperties;
import org.jCharts.properties.PointChartProperties;
import org.jCharts.types.ChartType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* Axis graph is used by StatGraphVisualizer, which generates bar graphs
* from the statistical data.
*/
public class LineGraph extends JPanel {
private static final long serialVersionUID = 241L;
private static final Logger log = LoggerFactory.getLogger(LineGraph.class);
protected double[][] data = null;
protected String title;
protected String xAxisTitle;
protected String yAxisTitle;
protected String[] xAxisLabels;
protected String[] yAxisLabel;
protected int width;
protected int height;
private static final Shape[] SHAPE_ARRAY = {PointChartProperties.SHAPE_CIRCLE,
PointChartProperties.SHAPE_DIAMOND,PointChartProperties.SHAPE_SQUARE,
PointChartProperties.SHAPE_TRIANGLE};
/**
* 12 basic colors for line graphs. If we need more colors than this,
* we can add more. Though more than 12 lines per graph will look
* rather busy and be hard to read.
*/
private static final Paint[] PAINT_ARRAY = {Color.black,
Color.blue,Color.green,Color.magenta,Color.orange,
Color.red,Color.yellow,Color.darkGray,Color.gray,Color.lightGray,
Color.pink,Color.cyan};
protected int shape_counter = 0;
protected int paint_counter = -1;
/**
*
*/
public LineGraph() {
super();
}
/**
* @param layout The {@link LayoutManager} to be used
*/
public LineGraph(LayoutManager layout) {
super(layout);
}
/**
* @param layout The {@link LayoutManager} to be used
* @param isDoubleBuffered Flag whether double buffering should be used
*/
public LineGraph(LayoutManager layout, boolean isDoubleBuffered) {
super(layout, isDoubleBuffered);
}
public void setData(double[][] data) {
this.data = data;
}
public void setTitle(String title) {
this.title = title;
}
public void setXAxisTitle(String title) {
this.xAxisTitle = title;
}
public void setYAxisTitle(String title) {
this.yAxisTitle = title;
}
public void setXAxisLabels(String[] labels) {
this.xAxisLabels = labels;
}
public void setYAxisLabels(String[] label) {
this.yAxisLabel = label;
}
public void setWidth(int w) {
this.width = w;
}
public void setHeight(int h) {
this.height = h;
}
@Override
public void paintComponent(Graphics g) {
// reset the paint counter
this.paint_counter = -1;
if (data != null && this.title != null && this.xAxisLabels != null &&
this.xAxisTitle != null && this.yAxisLabel != null &&
this.yAxisTitle != null) {
drawSample(this.title,this.xAxisLabels,this.xAxisTitle,
this.yAxisTitle,this.data,this.width,this.height,g);
}
}
private void drawSample(String _title, String[] _xAxisLabels, String _xAxisTitle,
String _yAxisTitle, double[][] _data, int _width, int _height, Graphics g) {
try {
if (_width == 0) {
_width = 450;
}
if (_height == 0) {
_height = 250;
}
this.setPreferredSize(new Dimension(_width,_height));
DataSeries dataSeries = new DataSeries( _xAxisLabels, _xAxisTitle, _yAxisTitle, _title );
String[] legendLabels= yAxisLabel;
Paint[] paints = this.createPaint(_data.length);
Shape[] shapes = createShapes(_data.length);
Stroke[] lstrokes = createStrokes(_data.length);
LineChartProperties lineChartProperties= new LineChartProperties(lstrokes,shapes);
AxisChartDataSet axisChartDataSet= new AxisChartDataSet( _data,
legendLabels,
paints,
ChartType.LINE,
lineChartProperties );
dataSeries.addIAxisPlotDataSet( axisChartDataSet );
ChartProperties chartProperties = new ChartProperties();
AxisProperties axisProperties = new AxisProperties();
// show the grid lines, to turn it off, set it to zero
axisProperties.getYAxisProperties().setShowGridLines(1);
axisProperties.setXAxisLabelsAreVertical(true);
// set the Y Axis to round
DataAxisProperties daxp = (DataAxisProperties)axisProperties.getYAxisProperties();
daxp.setRoundToNearest(1);
LegendProperties legendProperties = new LegendProperties();
AxisChart axisChart = new AxisChart(
dataSeries, chartProperties, axisProperties,
legendProperties, _width, _height );
axisChart.setGraphics2D((Graphics2D) g);
axisChart.render();
} catch (Exception e) {
log.error("Error while rendering axis chart. {}", e.getMessage());
}
}
/**
* Since we only have 4 shapes, the method will start with the first shape
* and keep cycling through the shapes in order.
*
* @param count
* The number of shapes to be created
* @return the first n shapes
*/
public Shape[] createShapes(int count) {
Shape[] shapes = new Shape[count];
for (int idx=0; idx < count; idx++) {
shapes[idx] = nextShape();
}
return shapes;
}
/**
* Return the next shape
* @return the next shape
*/
public Shape nextShape() {
this.shape_counter++;
if (shape_counter >= (SHAPE_ARRAY.length - 1)) {
shape_counter = 0;
}
return SHAPE_ARRAY[shape_counter];
}
/**
* Create a given number of {@link Stroke}s
*
* @param count
* The number of strokes to be created
* @return the first <code>count</code> strokes
*/
public Stroke[] createStrokes(int count) {
Stroke[] str = new Stroke[count];
for (int idx=0; idx < count; idx++) {
str[idx] = nextStroke();
}
return str;
}
/**
* method always return a new BasicStroke with 1.0f weight
* @return a new BasicStroke with 1.0f weight
*/
public Stroke nextStroke() {
return new BasicStroke(1.0f);
}
/**
* return an array of Paint with different colors. The current
* implementation will cycle through 12 colors if a line graph has more than
* 12 entries
*
* @param count
* The number of {@link Paint}s to be created
* @return an array of Paint with different colors
*/
public Paint[] createPaint(int count) {
Paint[] pts = new Paint[count];
for (int idx=0; idx < count; idx++) {
pts[idx] = nextPaint();
}
return pts;
}
/**
* The method will return the next paint color in the PAINT_ARRAY.
* Rather than return a random color, we want it to always go through
* the same sequence. This way, the same charts will always use the
* same color and make it easier to compare side by side.
* @return the next paint color in the PAINT_ARRAY
*/
public Paint nextPaint() {
this.paint_counter++;
if (this.paint_counter == (PAINT_ARRAY.length - 1)) {
this.paint_counter = 0;
}
return PAINT_ARRAY[this.paint_counter];
}
}
| [
"anthony.castro.tech@gmail.com"
] | anthony.castro.tech@gmail.com |
b45c81e616c3e44d27e6c12c22f8f059055f3943 | b118a9cb23ae903bc5c7646b262012fb79cca2f2 | /src/com/estrongs/android/pop/app/FileContentProvider.java | 9f8bdcda4936d3a44749dc32cd02dcd5da2012f4 | [] | no_license | secpersu/com.estrongs.android.pop | 22186c2ea9616b1a7169c18f34687479ddfbb6f7 | 53f99eb4c5b099d7ed22d70486ebe179e58f47e0 | refs/heads/master | 2020-07-10T09:16:59.232715 | 2015-07-05T03:24:29 | 2015-07-05T03:24:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,759 | java | package com.estrongs.android.pop.app;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.database.MatrixCursor.RowBuilder;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import com.estrongs.android.util.bc;
import java.io.File;
import java.io.FileNotFoundException;
public class FileContentProvider
extends ContentProvider
{
public static Uri a(String paramString)
{
try
{
String str = Uri.fromFile(new File(paramString)).toString();
str = "content://com.estrongs.files" + str.substring("file://".length());
paramString = str;
}
catch (Exception localException)
{
for (;;)
{
if (paramString.startsWith("/")) {
paramString = "content://com.estrongs.files" + paramString;
} else {
paramString = "content://com.estrongs.files" + "/" + paramString;
}
}
}
return Uri.parse(paramString);
}
private String a(Uri paramUri)
{
if (!paramUri.toString().startsWith("content://com.estrongs.files")) {
return null;
}
return paramUri.getPath();
}
public int delete(Uri paramUri, String paramString, String[] paramArrayOfString)
{
return 0;
}
public String getType(Uri paramUri)
{
return bc.S(a(paramUri));
}
public Uri insert(Uri paramUri, ContentValues paramContentValues)
{
return null;
}
public boolean onCreate()
{
return true;
}
public ParcelFileDescriptor openFile(Uri paramUri, String paramString)
{
try
{
paramString = a(paramUri);
if (paramString != null)
{
paramUri = new File(paramString);
if (paramUri.exists()) {
return ParcelFileDescriptor.open(paramUri, 268435456);
}
}
}
catch (Exception paramString)
{
throw new FileNotFoundException("Failed to find uri: " + paramUri.toString());
}
throw new FileNotFoundException("No file found: " + paramString);
}
public Cursor query(Uri paramUri, String[] paramArrayOfString1, String paramString1, String[] paramArrayOfString2, String paramString2)
{
paramString1 = a(paramUri);
if (paramArrayOfString1 != null)
{
paramUri = paramArrayOfString1;
if (paramArrayOfString1.length != 0) {}
}
else
{
paramUri = new String[7];
paramUri[0] = "_data";
paramUri[1] = "mime_type";
paramUri[2] = "_display_name";
paramUri[3] = "_size";
paramUri[4] = "date_modified";
paramUri[5] = "album";
paramUri[6] = "artist";
}
paramArrayOfString2 = new MatrixCursor(paramUri);
if (paramString1 == null) {
return paramArrayOfString2;
}
File localFile = new File(paramString1);
if ((!localFile.exists()) || (localFile.isDirectory())) {
return paramArrayOfString2;
}
paramString2 = paramArrayOfString2.newRow();
int i = paramString1.lastIndexOf(File.separatorChar) + 1;
if (i >= paramString1.length()) {
throw new RuntimeException("No file name specified: ".concat(paramString1));
}
String str;
long l1;
long l2;
if (i > 0)
{
paramArrayOfString1 = paramString1.substring(i);
str = bc.S(paramString1);
l1 = localFile.length();
l2 = localFile.lastModified();
int j = paramUri.length;
i = 0;
label185:
if (i >= j) {
break label366;
}
localFile = paramUri[i];
if (!localFile.equals("_data")) {
break label229;
}
paramString2.add(paramString1);
}
for (;;)
{
i += 1;
break label185;
paramArrayOfString1 = paramString1;
break;
label229:
if (localFile.equals("mime_type")) {
paramString2.add(str);
} else if (localFile.equals("_display_name")) {
paramString2.add(paramArrayOfString1);
} else if (localFile.equals("_size"))
{
if (l1 >= 0L) {
paramString2.add(Long.valueOf(l1));
} else {
paramString2.add(null);
}
}
else if (localFile.equals("date_modified"))
{
if (l2 >= 0L) {
paramString2.add(Long.valueOf(l2));
} else {
paramString2.add(Long.valueOf(l2));
}
}
else {
paramString2.add(null);
}
}
label366:
return paramArrayOfString2;
}
public int update(Uri paramUri, ContentValues paramContentValues, String paramString, String[] paramArrayOfString)
{
return 0;
}
}
/* Location:
* Qualified Name: com.estrongs.android.pop.app.FileContentProvider
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
1819edc9bf77ce8165eabee3e3786f0a1ba59777 | 971da5b227f61165db2eb20d5f6f141d80ed329b | /src/com/domain/Parcel.java | 7e2e22ddd3848780c32efd27bd4a1ee6781beb91 | [] | no_license | RenJNing/Parcel-Management-System-j2ee | 37dcfd8887d716fb9ec207a17033b645ec8616b1 | d43acfcc31b8ecede39bcc8522ab6c3cda26bcd1 | refs/heads/master | 2020-03-19T06:43:03.548253 | 2018-06-09T15:56:37 | 2018-06-09T15:56:37 | 136,048,677 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,809 | java | package com.domain;
import java.io.Serializable;
import java.util.Date;
public class Parcel implements Serializable{
private Long parcel_id;
private String sendername;
private String receivename;
private String senderaddress;
private String receiveaddress;
private String senderphone;
private String receivephone;
private Integer status;
private String date;
private String useremail;
public Long getParcel_id() {
return parcel_id;
}
public void setParcel_id(Long parcel_id) {
this.parcel_id = parcel_id;
}
public String getSendername() {
return sendername;
}
public void setSendername(String sendername) {
this.sendername = sendername;
}
public String getReceivename() {
return receivename;
}
public void setReceivename(String receivename) {
this.receivename = receivename;
}
public String getSenderaddress() {
return senderaddress;
}
public void setSenderaddress(String senderaddress) {
this.senderaddress = senderaddress;
}
public String getReceiveaddress() {
return receiveaddress;
}
public void setReceiveaddress(String receiveaddress) {
this.receiveaddress = receiveaddress;
}
public String getSenderphone() {
return senderphone;
}
public void setSenderphone(String senderphone) {
this.senderphone = senderphone;
}
public String getReceivephone() {
return receivephone;
}
public void setReceivephone(String receivephone) {
this.receivephone = receivephone;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date.substring(0, 10);
}
public String getUseremail() {
return useremail;
}
public void setUseremail(String useremail) {
this.useremail = useremail;
}
}
| [
"835380624@qq.com"
] | 835380624@qq.com |
9eebcc55c8a5d3f99ca640027d54cc8925e40015 | 7cd1e7eab52b26dd04976e88aff169ef8233b77b | /backend/MarkdownDocs/MarkdownDocsWebApp/src/main/java/markdowndocs/auth/helpers/CredentialsValidator.java | ae8f38102e193c47810845ebae60629c950658f4 | [
"MIT"
] | permissive | Denchick/MarkdownDocs | b36d80d63d8853501cbeb5a565bfae56f3a0ac37 | 03119d05058e46dac61d93677899fd9ee73be61c | refs/heads/master | 2022-10-16T18:28:57.345996 | 2020-10-19T08:46:48 | 2020-10-19T08:46:48 | 213,653,237 | 1 | 0 | MIT | 2022-10-05T03:48:47 | 2019-10-08T13:44:11 | Java | UTF-8 | Java | false | false | 268 | java | package markdowndocs.auth.helpers;
import markdowndocs.auth.AuthCredentials;
public class CredentialsValidator implements IAuthValidator {
@Override
public boolean IsValidateCredentials(AuthCredentials credentials) {
return true;
}
}
| [
"karamov@skbkontur.ru"
] | karamov@skbkontur.ru |
08afaf92c9cff03629e6e961425f2002c7227d51 | 2e53b1e78ceb2014acb99dfbdd4e5af671da7971 | /app/src/main/java/com/zxing/decoding/CaptureActivityHandler.java | 5bcedf6c1db57edd8c46f17ac32af26f2b6f05cd | [] | no_license | hs5240leihuang/MrrckApplication | 7960cb2278a1a8098c5bc908b3c5d7b241869c5d | aef126d4876e3e45b0984c1b829c38aa326ba598 | refs/heads/master | 2021-01-12T02:47:13.236711 | 2017-01-05T11:13:11 | 2017-01-05T11:14:05 | 78,102,342 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,411 | java | /*
* Copyright (C) 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zxing.decoding;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.Result;
import com.meiku.dev.R;
import com.zxing.CaptureActivity;
import com.zxing.camera.CameraManager;
import com.zxing.view.ViewfinderResultPointCallback;
import java.util.Vector;
/**
* This class handles all the messaging which comprises the state machine for
* capture.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class CaptureActivityHandler extends Handler
{
private static final String TAG = CaptureActivityHandler.class
.getSimpleName();
private final CaptureActivity activity;
private final DecodeThread decodeThread;
private State state;
private enum State
{
PREVIEW, SUCCESS, DONE
}
public CaptureActivityHandler(CaptureActivity activity,
Vector<BarcodeFormat> decodeFormats, String characterSet)
{
this.activity = activity;
decodeThread = new DecodeThread(activity, decodeFormats, characterSet,
new ViewfinderResultPointCallback(activity.getViewfinderView()));
decodeThread.start();
state = State.SUCCESS;
// Start ourselves capturing previews and decoding.
CameraManager.get().startPreview();
restartPreviewAndDecode();
}
@Override
public void handleMessage(Message message)
{
switch (message.what)
{
case R.id.auto_focus:
Log.d(TAG, "auto_focus");
// Log.d(TAG, "Got auto-focus message");
// When one auto focus pass finishes, start another. This is the
// closest thing to
// continuous AF. It does seem to hunt a bit, but I'm not sure what
// else to do.
if (state == State.PREVIEW)
{
CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
}
break;
case R.id.restart_preview:
Log.d(TAG, "Got restart preview message");
restartPreviewAndDecode();
break;
case R.id.decode_succeeded:
Log.d(TAG, "Got decode succeeded message");
state = State.SUCCESS;
Bundle bundle = message.getData();
Bitmap barcode = bundle == null ? null : (Bitmap) bundle
.getParcelable(DecodeThread.BARCODE_BITMAP);
activity.handleDecode((Result) message.obj, barcode);
break;
case R.id.decode_failed:
Log.d(TAG, "decode_failed");
// We're decoding as fast as possible, so when one decode fails,
// start another.
state = State.PREVIEW;
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(),
R.id.decode);
break;
case R.id.return_scan_result:
Log.d(TAG, "Got return scan result message");
activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
activity.finish();
break;
case R.id.launch_product_query:
Log.d(TAG, "Got product query message");
String url = (String) message.obj;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
activity.startActivity(intent);
break;
}
}
public void quitSynchronously()
{
state = State.DONE;
CameraManager.get().stopPreview();
Message quit = Message.obtain(decodeThread.getHandler(), R.id.quit);
quit.sendToTarget();
try
{
decodeThread.join();
} catch (InterruptedException e)
{
// continue
}
// Be absolutely sure we don't send any queued up messages
removeMessages(R.id.decode_succeeded);
removeMessages(R.id.decode_failed);
}
private void restartPreviewAndDecode()
{
if (state == State.SUCCESS)
{
state = State.PREVIEW;
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(),
R.id.decode);
CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
activity.drawViewfinder();
}
}
}
| [
"837851174@qq.com"
] | 837851174@qq.com |
dfe1160a3ac5e98123c7d29e90437186a3a73a65 | 88210078530bd8a4e0ceb72471460dc122bfe343 | /108-Convert-Sorted-Array-To-Binary-Search-Tree.java | fda1875449f09eddfef81e5493dd93ff36d3622a | [] | no_license | rachitpandey-cloud/leetcode-solutions-explained | 920278e9bf62bd41baa2ed51498312a233744863 | b994324863afc58174c2d1780d25a4e61376e5b9 | refs/heads/main | 2023-06-05T23:15:18.179728 | 2021-05-13T21:38:31 | 2021-05-13T21:38:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 795 | java | /**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class Solution {
public TreeNode sortedArrayToBST(int[] nums) {
if(nums.length==0) {
return null;
}
TreeNode root = convert(nums,0,nums.length-1);
return root;
}
private TreeNode convert(int[] nums, int start, int end) {
if(start > end) {
return null;
}
int mid = (start + end)/2;
System.out.println(mid);
TreeNode tempRoot = new TreeNode(nums[mid]);
tempRoot.left = convert(nums,start,mid-1);
tempRoot.right = convert(nums,mid+1,end);
return tempRoot;
}
}
| [
"noreply@github.com"
] | rachitpandey-cloud.noreply@github.com |
2f2cdf9fa4237521b668bc4a55a4250d37e0eef3 | 2a926849c72857dbf0cdd1bc2726007f48460630 | /src/main/java/com/example/blog/user/validator/SignUpFormValidator.java | 922d481171adef11cbacb6cc3fcee53192ebdd77 | [] | no_license | JeonJoonHo/personal-blog-example | e775142d7996b2a43df590e13dc4b2ee1e65281d | 3d6fdb7617b8df3301a6ddf4ae713ad2c4ec2b7e | refs/heads/main | 2023-07-20T12:48:45.546991 | 2021-09-01T12:41:09 | 2021-09-01T12:41:09 | 393,261,025 | 0 | 0 | null | 2021-08-21T12:03:45 | 2021-08-06T05:24:59 | Java | UTF-8 | Java | false | false | 1,101 | java | package com.example.blog.user.validator;
import com.example.blog.user.UserRepository;
import com.example.blog.user.form.SignUpForm;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
@Component
@RequiredArgsConstructor
public class SignUpFormValidator implements Validator {
private final UserRepository userRepository;
@Override
public boolean supports(Class<?> clazz) {
return SignUpForm.class.isAssignableFrom(clazz);
}
@Override
public void validate(Object target, Errors errors) {
SignUpForm signUpForm = (SignUpForm)target;
if (userRepository.existsByUsername(signUpForm.getUsername())) {
errors.rejectValue("username", "exists-value", "이미 존재하는 계정입니다.");
}
if (!signUpForm.getPassword().equals(signUpForm.getPasswordConfirmation())) {
errors.rejectValue("password", "exists-value", "패스워드가 일치하지 않습니다.");
}
}
}
| [
"jeon.joonho@nbt.com"
] | jeon.joonho@nbt.com |
9ae4abd96da988ddad3a1bc6a176a77ecbd33769 | 67d6e34449943519a2a13df039c84981f0794402 | /src/main/java/nk/gk/wyl/elasticsearch/entity/result/Pager.java | 90d546b55c20885486e15fa50e4035ddec40ed15 | [] | no_license | zhangshuailing/es-rest-7-8 | 71a83324cebab0bca4841058e47d97d5a761ffff | 420ec19db525d7fc0b03c455c884d2be894370cf | refs/heads/main | 2023-02-20T06:57:36.375175 | 2021-01-25T05:49:08 | 2021-01-25T05:49:08 | 332,143,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 925 | java | package nk.gk.wyl.elasticsearch.entity.result;
public class Pager {
private int total;
private int start;
private int limit;
public Pager() {
}
public Pager(int total, int start, int limit) {
this.total = total;
this.start = start;
this.limit = limit;
}
public int getTotal() {
return this.total;
}
public void setTotal(int total) {
this.total = total;
}
public int getStart() {
return this.start;
}
public void setStart(int start) {
this.start = start;
}
public int getLimit() {
return this.limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
@Override
public String toString() {
return "Paper{" +
"total=" + total +
", start=" + start +
", limit=" + limit +
'}';
}
}
| [
"zhangshuailing@golaxy.cn"
] | zhangshuailing@golaxy.cn |
3b3eceb4b20b37acd5ffc2303e3c6fa9a779518c | d726518baaba9bd89135b850300b5367542c574e | /JDEV10G/Dhami3/MDMServiceTypes/src/com/gssamerica/mdm/services/RecordType.java | 3b3486149d601d5a6b8789c03ce6e709d80acf21 | [] | no_license | jsdelivrbot/MyEndeavours | e9f8a6b74afedbaa29c0cdb7c622a83f13b660e3 | a2afa3cb17866d015842c2ddb12cafa684d5cdba | refs/heads/master | 2020-04-10T11:52:59.254633 | 2018-12-08T17:52:47 | 2018-12-08T17:52:47 | 161,005,462 | 1 | 0 | null | 2018-12-09T04:52:08 | 2018-12-09T04:52:08 | null | UTF-8 | Java | false | false | 1,071 | java | // !DO NOT EDIT THIS FILE!
// This source file is generated by Oracle tools
// Contents may be subject to change
// For reporting problems, use the following
// Version = Oracle WebServices (10.1.3.3.0, build 070610.1800.23513)
package com.gssamerica.mdm.services;
public class RecordType implements java.io.Serializable {
protected com.gssamerica.mdm.services.DataElementType[] dataElement;
protected com.gssamerica.mdm.services.RecordIdentifierType recordIdentifier;
public RecordType() {
}
public com.gssamerica.mdm.services.DataElementType[] getDataElement() {
return dataElement;
}
public void setDataElement(com.gssamerica.mdm.services.DataElementType[] dataElement) {
this.dataElement = dataElement;
}
public com.gssamerica.mdm.services.RecordIdentifierType getRecordIdentifier() {
return recordIdentifier;
}
public void setRecordIdentifier(com.gssamerica.mdm.services.RecordIdentifierType recordIdentifier) {
this.recordIdentifier = recordIdentifier;
}
}
| [
"inderpal.dhami@emerson.com"
] | inderpal.dhami@emerson.com |
dd72a9ca37ab5fb9297a9c3ad693cfbe5290149e | 82266d85631e318da9a51778d34af5b317f92008 | /CleanCode/strategy/Add.java | d986bba7a465cba177223ec0854ff01a861382c5 | [] | no_license | Epiesteban/cleanCodeAndPatternDesigns | f0769bf84dcef75273739a2c332122960c5e6cf0 | 2ddd3880635545763b4dd78b6a26b39ffea80dfa | refs/heads/master | 2020-07-19T00:14:02.855953 | 2019-09-12T20:55:34 | 2019-09-12T21:04:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 143 | java | package strategy;
public class Add implements Strategy{
public Add() {
}
public int algorithm(int x, int y) {
return x+y;
}
}
| [
"raquelpi@MacBook-Pro-de-Raquel-3.local"
] | raquelpi@MacBook-Pro-de-Raquel-3.local |
51537d0bacabd24f027d208a4b35fa1e43d30738 | 27faeee33cc8d02f9b0c056d8ea270b56f77d25b | /app/src/androidTest/java/kr/co/tjoeun/uipractice_20200520/ExampleInstrumentedTest.java | f8967eab0cd51c175f3083488dc3b8cd98a12929 | [] | no_license | cho881020/UIPractice_20200520 | 51d804de61bc3d64b31474f028ed0f9861b1ca8c | cb13029b8afcaed0df34f82a7ea7aa000811ef9e | refs/heads/master | 2022-08-21T00:05:28.041604 | 2020-05-20T06:47:12 | 2020-05-20T06:47:12 | 265,442,829 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 780 | java | package kr.co.tjoeun.uipractice_20200520;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("kr.co.tjoeun.uipractice_20200520", appContext.getPackageName());
}
}
| [
"kj_cho@idealidea.co.kr"
] | kj_cho@idealidea.co.kr |
0e3467fad441aa858f412953733bc310fb68b89c | 59dd7f4d10a5cc5c9671b2312b774712b99ae292 | /src/main/java/edu/grcy/sda/generics/wildcards/Demo.java | bdd246429c81d5202decb78afd78a80d5432a003 | [] | no_license | Gaweth/OOP_AND_TESTS | 690defc0144dc9e6359872d9e8f0762b0555719a | d81dee5a6383c9e8b0043130c6b376c4ec940386 | refs/heads/master | 2023-03-05T10:42:07.039209 | 2021-02-19T12:38:04 | 2021-02-19T12:38:04 | 340,364,900 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,169 | java | package edu.grcy.sda.generics.wildcards;
import java.util.ArrayList;
import java.util.List;
public class Demo {
public static void main(String[] args) {
Image image1 = new Image("Obrazek 1");
Image image2 = new Image("Zdjęcie 1");
Memento memento1 = new Memento(new Note("Pamiątka z wakacji"));
Memento memento2 = new Memento(new Note("Pamiątka z ferii zimowych"));
Picture picture1 = new Picture(new Note("Fotka znad morza"), image1);
Picture picture2 = new Picture(new Note("Fotka z gór"), image2);
List<Memento> memories = new ArrayList<>();
memories.add(memento1);
memories.add(memento2);
memories.add(picture1);
memories.add(picture2);
MemoriesSaver<Memento> album = new MemoriesSaver<>();
album.printAllMemories(memories);
System.out.println("+++++++++++++++++++++++++++");
album.addAllMemories(memories);
album.printInternalMemories();
System.out.println("+++++++++++++++++++++++++++");
List<Picture> picturesOnly = new ArrayList<>();
picturesOnly.add(picture1);
picturesOnly.add(picture2);
/**
* Wywołanie printAllMemories dla picturesOnly nie zadziała bo
* JVM spodziewa się listy List<Memento>
* a dostaje List<Picture>
* i mimo że Picture jest klasą pochodną od Memento to nie umie tego obsłużyć
* bo List<Picture> nie jest klasą pochodną od List<Memento>
*
* czyli nawet jak klasa B rozszerza klasę A
* to Kolekcja(B) nie rozszerza Kolejcja(A)
*
* i do tego właśnie potrzebny jest operator wildcard czyli ? (pytajnik - typ nieokreślony)
*
*/
//album.printAllMemories(picturesOnly);
System.out.println("+++++++++++++++++++++++++++");
System.out.println("Drukujemy tylko obrazkowe pamiątki:");
album.printWildcardAllMemories(picturesOnly);
System.out.println("+++++++++++++++++++++++++++");
System.out.println("Drukujemy wszystkie pamiątki:");
album.printWildcardAllMemories(memories);
}
}
| [
"mcdon1@wp.pl"
] | mcdon1@wp.pl |
bdbc45b0a45325293faf9d1305f5c08e879bd18f | 37dd971baaa715de2aa0219a66b596d5befeb09b | /app/src/main/java/com/digis2/ltevisualizer/common/utils/Legend.java | 3ed1329c9d4ac873bf61b50792e0ac57afe19aa1 | [] | no_license | AmmarRabie/lte-metrics-visualizer | b1574a4b1f4c88a2032310eab4563889eaf79ef1 | 3fffc9bceb726453a73d09f22dbf63a9e8726274 | refs/heads/master | 2023-02-11T20:11:57.332426 | 2021-01-03T08:49:14 | 2021-01-03T08:49:14 | 325,972,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,760 | java | package com.digis2.ltevisualizer.common.utils;
import android.content.Context;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Util class that interprets the content of legend.json file
*/
public class Legend {
private static class MetricCalculator {
private static final String TAG = "MetricCalculator";
private static JSONObject legendRoot; // just read the file once
protected Context context;
protected String name;
protected int min;
protected int max;
public MetricCalculator(Context context, String name, int min, int max) {
this.context = context;
this.name = name;
this.min = min;
this.max = max;
if (legendRoot == null) { // just read the file once
String legendStr = IO.readFileFromAssets(context, "legend.json");
try {
legendRoot = new JSONObject(legendStr);
} catch (JSONException e) {
e.printStackTrace();
Log.e(TAG, "MetricCalculator: Can't parse legend.json file", e);
}
}
}
public int calcProgress(int value) {
if (value < min) {
Log.w(TAG, "calcProgress: value %i is less than min %i defined in constructor, " +
"set it as min in this calculation only");
return 0;
}
if (value > max) {
Log.w(TAG, "calcProgress: value %i is higher than max %i defined in constructor, " +
"set it as max in this calculation only");
return 100;
}
float percentage = (value * 1.0f - min) / (max - min); // always from 0.0 to 1.0
// return Math.min(Math.round(percentage), 100);
return Math.round(Math.abs(percentage * 100));
}
public String calcColor(int value) {
try {
JSONArray valuesArrJson = legendRoot.getJSONArray(name);
for (int i = 0; i < valuesArrJson.length(); i++) {
JSONObject current = valuesArrJson.getJSONObject(i);
String from = current.getString("From");
String to = current.getString("To");
boolean minValid = from.equals("Min") || value >= Float.parseFloat(from);
boolean maxValid = to.equals("Max") || value <= Float.parseFloat(to);
if (minValid && maxValid) return current.getString("Color");
}
} catch (JSONException e) {
e.printStackTrace();
Log.e(TAG, "calcColor: parsing error", e);
}
return null;
}
}
public static final class SINRCalculator extends MetricCalculator {
public SINRCalculator(Context context) {
super(context, "SINR", -1, 31);
}
}
public static final class RSRPCalculator extends MetricCalculator {
public RSRPCalculator(Context context) {
super(context, "RSRP", -111, -59);
}
}
public static final class RSRQCalculator extends MetricCalculator {
public RSRQCalculator(Context context) {
super(context, "RSRQ", -21, -2);
}
}
/**
* factory method, converts value to the correct color
*
* @param name name of the metric (e.g "SINR")
* @param value value of the KPI
* @return corresponding color of the value
*/
public static String calcColor(Context context, String name, int value) {
return getCalculator(context, name).calcColor(value);
}
/**
* factory method, converts value to the correct progress percentage
*
* @param name name of the metric (e.g "SINR")
* @param value value of the KPI
* @return corresponding progress percentage from 0 to 100
*/
public static int calcProgress(Context context, String name, int value) {
return getCalculator(context, name).calcProgress(value);
}
private static MetricCalculator getCalculator(Context context, String name){
MetricCalculator calc = null;
switch (name){
case "SINR":
calc = new SINRCalculator(context);
break;
case "RSRP":
calc = new RSRPCalculator(context);
break;
case "RSRQ":
calc = new RSRQCalculator(context);
break;
default:
throw new IllegalArgumentException("name should be one of SINR, RSRP, RSRQ");
}
return calc;
}
}
| [
"ammaralsayed55@gmail.com"
] | ammaralsayed55@gmail.com |
7dd8fcd49a3c01fa765c22d409d24e528f35d40f | 981bbbd5c52668ef63d562f06dff7df0a48a4acf | /src/main/java/SearchJob/pojo/Message.java | 10bc5dc0a6740eeb7f81a14e9486632570b9ae18 | [] | no_license | NewDayxjc/SearchJob | 8127ba24c7481f2f2a1e8626f3b0db0d18ae001f | a662ad930295619368dafbc8aa9a524e0a676d49 | refs/heads/master | 2022-12-22T20:15:05.597479 | 2019-07-07T10:02:58 | 2019-07-07T10:02:58 | 195,636,687 | 2 | 2 | null | 2022-12-16T12:13:00 | 2019-07-07T10:09:44 | JavaScript | UTF-8 | Java | false | false | 3,670 | java | package SearchJob.pojo;
import java.io.Serializable;
import java.util.Date;
public class Message implements Serializable {
private Integer mesaId;//简历ID
private Integer userId;//外键
private Integer empId;//外键
private String mesaName;//用户姓名
private String mesaSex;//用户性别
private Integer mesaAge;//用户年龄
private String eduName;//用户学历 外键
private String mesaPhone;//联系电话
private String mesaIntroduce;//个人介绍
private String mesaWant;//意向公司
private Date mesaDate;//编写时间
private Integer compId;//公司外键
private Integer mesaPower=1;//简历权限 0只对招聘开放 1对所有人开放
private User user;
private Employee employee;
private Company company;
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
public Integer getEmpId() {
return empId;
}
public void setEmpId(Integer empId) {
this.empId = empId;
}
public Employee getEmployee() {
return employee;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Integer getCompId() {
return compId;
}
public void setCompId(Integer compId) {
this.compId = compId;
}
public String getMesaName() {
return mesaName;
}
public void setMesaName(String mesaName) {
this.mesaName = mesaName;
}
public String getMesaSex() {
return mesaSex;
}
public void setMesaSex(String mesaSex) {
this.mesaSex = mesaSex;
}
public Integer getMesaAge() {
return mesaAge;
}
public void setMesaAge(Integer mesaAge) {
this.mesaAge = mesaAge;
}
public String getEduName() {
return eduName;
}
public void setEduName(String eduName) {
this.eduName = eduName;
}
public String getMesaPhone() {
return mesaPhone;
}
public void setMesaPhone(String mesaPhone) {
this.mesaPhone = mesaPhone;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getMesaIntroduce() {
return mesaIntroduce;
}
public void setMesaIntroduce(String mesaIntroduce) {
this.mesaIntroduce = mesaIntroduce;
}
public String getMesaWant() {
return mesaWant;
}
public void setMesaWant(String mesaWant) {
this.mesaWant = mesaWant;
}
public Date getMesaDate() {
return mesaDate;
}
public void setMesaDate(Date mesaDate) {
this.mesaDate = mesaDate;
}
public Integer getMesaId() {
return mesaId;
}
public void setMesaId(Integer mesaId) {
this.mesaId = mesaId;
}
public Integer getMesaPower() {
return mesaPower;
}
public void setMesaPower(Integer mesaPower) {
this.mesaPower = mesaPower;
}
@Override
public String toString() {
return "Message{" +
"mesaId=" + mesaId +
", mesaSex='" +
", eduName='" + eduName + '\'' +
", mesaIntroduce='" + mesaIntroduce + '\'' +
", mesaAge='" +
", mesaWant='" + mesaWant + '\'' +
", measDate=" + mesaDate +
", mesaPower=" + mesaPower +
'}';
}
}
| [
"2323948060@qq.com"
] | 2323948060@qq.com |
b0d093b28a3ba70d0a179bbac16a126a55391a57 | 7420fb34f73c5f013ee7f141c0c8160382ee2b93 | /Projeto_Filme/src/filme.java | e29d09f5554ae9e0d1a0760466561813518c6945 | [] | no_license | JoaoSobhie/ProjetoFIlme_Java | 641a79d8f4c4ebb9d4313e392f1003f9b3a4e725 | b1eba22e06bba5a783e4f59f4178139c893a8f45 | refs/heads/master | 2023-04-15T04:48:35.418322 | 2021-04-21T02:13:28 | 2021-04-21T02:13:28 | 359,988,692 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,886 | java | import java.awt.BorderLayout;
import java.awt.Checkbox;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.util.List;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
public class filme {
public static void main(String[] args) {
JFrame jframe = new JFrame("Filmes");
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jframe.setSize(700, 400);
jframe.setVisible(true);
JPanel cadastro = new JPanel(new BorderLayout(20, 0));
JPanel imagem = new JPanel(new GridLayout(1,1));
JPanel janela = new JPanel(new GridLayout(10,1));
JPanel referencias = new JPanel(new GridLayout(0,1));
referencias.setPreferredSize(new Dimension(180, 400));
JPanel button = new JPanel();
cadastro.add(imagem, BorderLayout.LINE_START);
cadastro.add(janela, BorderLayout.CENTER);
cadastro.add(referencias, BorderLayout.EAST);
cadastro.add(button, BorderLayout.SOUTH);
JTabbedPane abas = new JTabbedPane();
abas.add("Filmes", cadastro);
abas.add("Lista", new JPanel());
jframe.add(abas);
imagem.add(new imgConfig(new ImageIcon("src/imagens/CentralPark.jpg")));
//Declarando campos
JTextField text_titulo = new JTextField();
JTextField text_sinopse = new JTextField();
String[] genero = {"Comédia", "Ação", "Drama"};
JComboBox cb= new JComboBox(genero);
RadioGroup radio = new RadioGroup(List.of("Netflix", "Prime Video", "Disney+"));
Checkbox check = new Checkbox("Assistido");
StarRater star = new StarRater(5,3.5f);
filmeListener listener = new filmeListener(text_titulo, text_sinopse, cb, radio, check, star);
//label titulo
janela.add(new labelConfig("Titulo"));
//textfield titulo
text_titulo.setPreferredSize(new Dimension(200, 30));
janela.add(text_titulo);
text_titulo.addMouseListener(listener);
//label sinopse
janela.add(new labelConfig("Sinopse"));
//textfield sinopse
text_sinopse.setPreferredSize(new Dimension(200, 30));
janela.add(text_sinopse);
text_sinopse.addMouseListener(listener);
//label genero
janela.add(new labelConfig("Genero"));
//Combo Box Genero
janela.add(cb);
cb.addMouseListener(listener);
//label onde assistir
referencias.add(new labelConfig("Onde assistir"));
//Radio Group onde assistir
referencias.add(radio);
radio.addMouseListener(listener);
//checkbox assistido
referencias.add(check);
check.addMouseListener(listener);
//label genero
referencias.add(new labelConfig("Avaliações"));
//starrater assistido
referencias.add(star);
JButton btn_salvar = new JButton("Salvar");
button.add(btn_salvar);
btn_salvar.addActionListener(listener);
JButton btn_cancelar = new JButton("Cancelar");
button.add(btn_cancelar);
jframe.setVisible(true);
}
}
| [
"jvosobhie@gmail.com"
] | jvosobhie@gmail.com |
9bf261d72bedcf9c33f4de2b27a7b497ce332337 | 75e4113824fc848081da938800ec30c95c92f0d9 | /test/src/test/TestGitHub.java | 7655c0b839fa2051d8230d8a2538ae7d72a93f95 | [] | no_license | Houty-0/test | 123c94367ef21def3480782b0ef6caa10a5751e6 | 579d50e09a6d833869c1fbcd1d6691428a029218 | refs/heads/master | 2021-02-27T02:19:01.525484 | 2020-03-07T08:23:21 | 2020-03-07T08:23:21 | 245,569,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 127 | java | package test;
public class TestGitHub {
public static void main(String[] args) {
System.out.println("Hello GitHub");
}
}
| [
"tyhou001@outlook.com"
] | tyhou001@outlook.com |
32572c9fdc5a375f3a535f85494b2058a017751b | fa7489d41e415fa368c9149603c2ec5ede012f93 | /SecondFragment.java | b4135b6372b31563fd1e25cb0e49a75f6323bd17 | [] | no_license | nettabr/Basic_Calculator_AndroidApp | 35271995b897e94f0b721687205c38c437c28b28 | 2fb46e973ae022b4a7aaea19105f85abc6b41464 | refs/heads/master | 2022-12-05T21:10:51.259094 | 2020-08-13T14:11:48 | 2020-08-13T14:11:48 | 287,297,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,121 | java | package com.example.textview;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
public class SecondFragment extends Fragment {
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_second, container, false);
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.findViewById(R.id.button_second).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavHostFragment.findNavController(SecondFragment.this)
.navigate(R.id.action_SecondFragment_to_FirstFragment);
}
});
}
} | [
"noreply@github.com"
] | nettabr.noreply@github.com |
7c965ce1cf273b41e3836bec20f3628967ea21a7 | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipsejdt_cluster/25422/tar_1.java | 5e79af17dddc2054878d807f97fe393d3b0dfe46 | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,328 | java | /*******************************************************************************
* Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.jdt.core.eval;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.ICompletionRequestor;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
/**
* An evaluation context supports evaluating code snippets.
* <p>
* A code snippet is pretty much any valid piece of Java code that could be
* pasted into the body of a method and compiled. However, there are two
* areas where the rules are slightly more liberal.
* <p>
* First, a code snippet can return heterogeneous types. Inside the same code
* snippet an <code>int</code> could be returned on one line, and a
* <code>String</code> on the next, etc. For example, the following would be
* considered a valid code snippet:
* <pre>
* <code>
* char c = '3';
* switch (c) {
* case '1': return 1;
* case '2': return '2';
* case '3': return "3";
* default: return null;
* }
* </code>
* </pre>
* </p>
* <p>
* Second, if the last statement is only an expression, the <code>return</code>
* keyword is implied. For example, the following returns <code>false</code>:
* <pre>
* <code>
* int i = 1;
* i == 2
* </code>
* </pre>
* </p>
* <p>
* Global variables are an additional feature of evaluation contexts. Within an
* evaluation context, global variables maintain their value across evaluations.
* These variables are particularly useful for storing the result of an
* evaluation for use in subsequent evaluations.
* </p>
* <p>
* The evaluation context remembers the name of the package in which code
* snippets are run. The user can set this to any package, thereby gaining
* access to types that are normally only visible within that package.
* </p>
* <p>
* Finally, the evaluation context remembers a list of import declarations. The
* user can import any packages and types so that the code snippets may refer
* to types by their shorter simple names.
* </p>
* <p>
* Example of use:
* <pre>
* <code>
* IJavaProject project = getJavaProject();
* IEvaluationContext context = project.newEvaluationContext();
* String codeSnippet = "int i= 0; i++";
* ICodeSnippetRequestor requestor = ...;
* context.evaluateCodeSnippet(codeSnippet, requestor, progressMonitor);
* </code>
* </pre>
* </p>
* <p>
* This interface is not intended to be implemented by clients.
* <code>IJavaProject.newEvaluationContext</code> can be used to obtain an
* instance.
* </p>
*
* @see IJavaProject#newEvaluationContext
*/
public interface IEvaluationContext {
/**
* Returns the global variables declared in this evaluation context.
* The variables are maintained in the order they are created in.
*
* @return the list of global variables
*/
public IGlobalVariable[] allVariables();
/**
* Performs a code completion at the given position in the given code snippet,
* reporting results to the given completion requestor.
* <p>
* Note that code completion does not involve evaluation.
* <p>
*
* @param codeSnippet the code snippet to complete in
* @param position the character position in the code snippet to complete at,
* or -1 indicating the beginning of the snippet
* @param requestor the code completion requestor capable of accepting all
* possible types of completions
* @exception JavaModelException if code completion could not be performed. Reasons include:
* <ul>
* <li>The position specified is less than -1 or is greater than the snippet's
* length (INDEX_OUT_OF_BOUNDS)</li>
* </ul>
* @since 2.0
*/
public void codeComplete(
String codeSnippet,
int position,
ICompletionRequestor requestor)
throws JavaModelException;
/**
* Resolves and returns a collection of Java elements corresponding to the source
* code at the given positions in the given code snippet.
* <p>
* Note that code select does not involve evaluation, and problems are never
* reported.
* <p>
*
* @param codeSnippet the code snippet to resolve in
* @param offset the position in the code snippet of the first character
* of the code to resolve
* @param length the length of the selected code to resolve
* @return the (possibly empty) list of selection Java elements
* @exception JavaModelException if code resolve could not be performed.
* Reasons include:
* <ul>
* <li>The position specified is less than -1 or is greater than the snippet's
* length (INDEX_OUT_OF_BOUNDS)</li>
* </ul>
*/
public IJavaElement[] codeSelect(String codeSnippet, int offset, int length)
throws JavaModelException;
/**
* Deletes the given variable from this evaluation context. Does nothing if
* the given variable has already been deleted.
*
* @param variable the global variable
*/
public void deleteVariable(IGlobalVariable variable);
/**
* Evaluates the given code snippet in the context of a suspended thread.
* The code snippet is compiled along with this context's package declaration,
* imports, and global variables. The given requestor's
* <code>acceptProblem</code> method is called for each compilation problem that
* is detected. Then the resulting class files are handed to the given
* requestor's <code>acceptClassFiles</code> method to deploy and run.
* <p>
* The requestor is expected to:
* <ol>
* <li>send the class files to the target VM,
* <li>load them (starting with the code snippet class),
* <li>create a new instance of the code snippet class,
* <li>run the method <code>run()</code> of the code snippet,
* <li>retrieve the values of the local variables,
* <li>retrieve the returned value of the code snippet
* </ol>
* </p>
* <p>
* This method is long-running; progress and cancellation are provided
* by the given progress monitor.
* </p>
*
* @param codeSnippet the code snippet
* @param localVariableTypeNames the dot-separated fully qualified names of the types of the local variables.
* @param localVariableNames the names of the local variables as they are declared in the user's code.
* @param localVariableModifiers the modifiers of the local variables (default modifier or final modifier).
* @param declaringType the type in which the code snippet is evaluated.
* @param isStatic whether the code snippet is evaluated in a static member of the declaring type.
* @param isConstructorCall whether the code snippet is evaluated in a constructor of the declaring type.
* @param requestor the code snippet requestor
* @param progressMonitor a progress monitor
* @exception JavaModelException if a runtime problem occurred or if this
* context's project has no build state
*/
public void evaluateCodeSnippet(
String codeSnippet,
String[] localVariableTypeNames,
String[] localVariableNames,
int[] localVariableModifiers,
IType declaringType,
boolean isStatic,
boolean isConstructorCall,
ICodeSnippetRequestor requestor,
IProgressMonitor progressMonitor)
throws JavaModelException;
/**
* Evaluates the given code snippet. The code snippet is
* compiled along with this context's package declaration, imports, and
* global variables. The given requestor's <code>acceptProblem</code> method
* is called for each compilation problem that is detected. Then the resulting
* class files are handed to the given requestor's <code>acceptClassFiles</code>
* method to deploy and run. The requestor is also responsible for getting the
* result back.
* <p>
* This method is long-running; progress and cancellation are provided
* by the given progress monitor.
* </p>
*
* @param codeSnippet the code snippet
* @param requestor the code snippet requestor
* @param progressMonitor a progress monitor
* @exception JavaModelException if a runtime problem occurred or if this
* context's project has no build state
*/
public void evaluateCodeSnippet(
String codeSnippet,
ICodeSnippetRequestor requestor,
IProgressMonitor progressMonitor)
throws JavaModelException;
/**
* Evaluates the given global variable. During this operation,
* this context's package declaration, imports, and <it>all</it> its declared
* variables are verified. The given requestor's <code>acceptProblem</code>
* method will be called for each problem that is detected.
* <p>
* This method is long-running; progress and cancellation are provided
* by the given progress monitor.
* </p>
*
* @param variable the global variable
* @param requestor the code snippet requestor
* @param progressMonitor a progress monitor
* @exception JavaModelException if a runtime problem occurred or if this
* context's project has no build state
*/
public void evaluateVariable(
IGlobalVariable variable,
ICodeSnippetRequestor requestor,
IProgressMonitor progressMonitor)
throws JavaModelException;
/**
* Returns the import declarations for this evaluation context. Returns and empty
* list if there are no imports (the default if the imports have never been set).
* The syntax for the import corresponds to a fully qualified type name, or to
* an on-demand package name as defined by ImportDeclaration (JLS2 7.5). For
* example, <code>"java.util.Hashtable"</code> or <code>"java.util.*"</code>.
*
* @return the list of import names
*/
public String[] getImports();
/**
* Returns the name of the package in which code snippets are to be compiled and
* run. Returns an empty string for the default package (the default if the
* package name has never been set). For example, <code>"com.example.myapp"</code>.
*
* @return the dot-separated package name, or the empty string indicating the
* default package
*/
public String getPackageName();
/**
* Returns the Java project this evaluation context was created for.
*
* @return the Java project
*/
public IJavaProject getProject();
/**
* Creates a new global variable with the given name, type, and initializer.
* <p>
* The <code>typeName</code> and <code>initializer</code> are interpreted in
* the context of this context's package and import declarations.
* </p>
* <p>
* The syntax for a type name corresponds to Type in Field Declaration (JLS2 8.3).
* </p>
*
* @param typeName the type name
* @param name the name of the global variable
* @param initializer the initializer expression, or <code>null</code> if the
* variable is not initialized
*/
public IGlobalVariable newVariable(
String typeName,
String name,
String initializer);
/**
* Sets the import declarations for this evaluation context. An empty
* list indicates there are no imports. The syntax for the import corresponds to a
* fully qualified type name, or to an on-demand package name as defined by
* ImportDeclaration (JLS2 7.5). For example, <code>"java.util.Hashtable"</code>
* or <code>"java.util.*"</code>.
*
* @param imports the list of import names
*/
public void setImports(String[] imports);
/**
* Sets the dot-separated name of the package in which code snippets are
* to be compiled and run. For example, <code>"com.example.myapp"</code>.
*
* @param packageName the dot-separated package name, or the empty string
* indicating the default package
*/
public void setPackageName(String packageName);
/**
* Validates this evaluation context's import declarations. The given requestor's
* <code>acceptProblem</code> method is called for each problem that is detected.
*
* @param requestor the code snippet requestor
* @exception JavaModelException if this context's project has no build state
*/
public void validateImports(ICodeSnippetRequestor requestor)
throws JavaModelException;
/**
* Performs a code completion at the given position in the given code snippet,
* reporting results to the given completion requestor.
* <p>
* Note that code completion does not involve evaluation.
* <p>
*
* @param codeSnippet the code snippet to complete in
* @param position the character position in the code snippet to complete at,
* or -1 indicating the beginning of the snippet
* @param requestor the code completion requestor capable of accepting all
* possible types of completions
* @exception JavaModelException if code completion could not be performed. Reasons include:
* <ul>
* <li>The position specified is less than -1 or is greater than the snippet's
* length (INDEX_OUT_OF_BOUNDS)</li>
* </ul>
* @deprecated - use codeComplete(String, int, ICompletionRequestor) instead
*/
public void codeComplete(
String codeSnippet,
int position,
org.eclipse.jdt.core.ICodeCompletionRequestor requestor)
throws JavaModelException;
} | [
"375833274@qq.com"
] | 375833274@qq.com |
f0c9a93f897037c7943082728dfe9e37a3beb73a | 61c7028a66425d13f7db0c8ea876f94700cbac9b | /Patterns/Composite/src/ua/training/Main.java | f011f8c2b22ad2dbb70eef29d203ebfe06ed5138 | [] | no_license | fulgrim-ph/Projects | e79bba7ff32d88dde47c4e4078c1c54d5a83fdaa | 3db2179e80ff8b930c3f0397d0e8c9b1b36c1be7 | refs/heads/master | 2021-09-01T06:49:00.464742 | 2017-12-25T13:11:06 | 2017-12-25T13:11:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 933 | java | package ua.training;
public class Main {
public static void main(String[] args) {
Square square1 = new Square();
Square square2 = new Square();
Square square3 = new Square();
Triangle triangle1 = new Triangle();
Circle circle1 = new Circle();
Circle circle2 = new Circle();
Circle circle3 = new Circle();
Composite composite = new Composite();
Composite composite1 = new Composite();
Composite composite2 = new Composite();
composite1.addComponent(square1);
composite1.addComponent(square2);
composite1.addComponent(square3);
composite2.addComponent(triangle1);
composite2.addComponent(circle1);
composite2.addComponent(circle2);
composite2.addComponent(circle3);
composite.addComponent(composite1);
composite.addComponent(composite2);
composite.draw();
}
}
| [
"zshmakov@gmail.com"
] | zshmakov@gmail.com |
b1cec5ea6c24801b8916e43685d97e9b66d321cd | cf7dd85d6837632f1844d54a254bb087b43ef3e2 | /src/interfaz/VentanaPrincipal.java | 8ddb8fc5435a10b8db20edf963aa8be963bef8d8 | [] | no_license | diegocalero0/Proyecto-Puzzle | 3e61e7df2a1a5ad2272634d05d35c4cc0007959f | 1bc1b1ba4ded93336f6b5df8e0f96850ca22a5bf | refs/heads/master | 2021-01-19T21:05:19.676630 | 2017-03-11T03:19:07 | 2017-03-11T03:19:07 | 84,620,303 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 18,166 | java | package interfaz;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import logica.EscritorLector;
import logica.Juego;
import logica.Pareja;
import logica.Resolver;
/**
* Ventana principal de la aplicacion
* @author Diego Calero
*
*/
public class VentanaPrincipal extends Ventana implements ActionListener, Serializable{
private static final long serialVersionUID = 4L;
private JButton btn_deshacer, btn_rehacer, btn_jugar, btn_puntajes, btn_solucionar, btn_crear, btn_cargar;
private JPanel pnl_movimientos;
private JLabel lbl_movimientos;
private JList<Integer> lst_movimientos;
private DefaultListModel<Integer> lst_model;
private JScrollPane scroll;
private VentanaPuntajes ventana_puntajes;
private String puzzle;
private File puntajes;
private boolean guardadoPorPrimeraVez;
/**
* Constructor de la clase Ventana
* @param juego juego principal
*/
public VentanaPrincipal(Juego juego){
super("Ventana Principal",juego);
guardadoPorPrimeraVez = false;
init();
}
/**
* Inicializa todos los componentes de este JFrame
*/
private void init() {
this.setSize(80*4+208,80*4+230);
this.setLocationRelativeTo(null);
pnl_movimientos = new JPanel();
btn_deshacer = new JButton();
btn_rehacer = new JButton();
btn_jugar = new JButton();
btn_puntajes = new JButton();
btn_solucionar = new JButton();
btn_crear = new JButton();
btn_cargar = new JButton();
pnl_juego.setSize(80 * 4 + 2, 80 * 4 + 2);
pnl_juego.setLocation(0, 0);
pnl_juego.setBackground(new Color(0, 0, 0));
pnl_botones.setSize(80 * 4 + 2, this.getHeight() - 80 * 4);
pnl_botones.setLocation(0, 80 * 4 +2);
pnl_botones.setBackground(new Color(176,192,222));
pnl_botones.setLayout(null);
pnl_juego.setLayout(null);
pnl_movimientos.setLayout(null);
pnl_movimientos.setBounds(80 * 4 + 2, 0, this.getWidth() - pnl_juego.getWidth(), this.getHeight());
add(pnl_botones);
add(pnl_juego);
add(pnl_movimientos);
btn_deshacer.setBounds(80, 20, 40, 40);
pnl_botones.add(btn_deshacer);
btn_rehacer.setBounds(140, 20, 40, 40);
pnl_botones.add(btn_rehacer);
btn_guardar.setBounds(200, 20, 40, 40);
pnl_botones.add(btn_guardar);
btn_jugar.setBounds(80, 65, 160, 20);
pnl_botones.add(btn_jugar);
btn_puntajes.setBounds(80, 90, 160, 20);
pnl_botones.add(btn_puntajes);
btn_solucionar.setBounds(80, 115, 160, 20);
pnl_botones.add(btn_solucionar);
btn_crear.setBounds(80, 140, 160, 20);
pnl_botones.add(btn_crear);
btn_cargar.setBounds(80, 165, 160, 20);
pnl_botones.add(btn_cargar);
btn_crear.setIcon(new ImageIcon(getClass().getResource((PATH + "crear.png"))));
btn_deshacer.setIcon(new ImageIcon(Object.class.getResource(PATH + "deshacer.png")));
btn_rehacer.setIcon(new ImageIcon(Object.class.getResource(PATH + "rehacer.png")));
btn_guardar.setIcon(new ImageIcon(Object.class.getResource(PATH + "guardar.png")));
btn_jugar.setIcon(new ImageIcon(Object.class.getResource(PATH + "jugar.png")));
btn_puntajes.setIcon(new ImageIcon(Object.class.getResource(PATH + "puntajes.png")));
btn_solucionar.setIcon(new ImageIcon(Object.class.getResource(PATH + "solucionar.png")));
btn_cargar.setIcon(new ImageIcon(Object.class.getResource(PATH + "cargar.png")));
lbl_movimientos = new JLabel("Movimientos: "+juego.getPasos());
lst_movimientos = new JList<>();
Font fuente = new Font("Arial", Font.BOLD, 14);
scroll = new JScrollPane(lst_movimientos);
pnl_movimientos.add(lbl_movimientos);
pnl_movimientos.add(scroll);
lbl_movimientos.setBounds(45, 10, pnl_movimientos.getWidth(), 30);
lbl_movimientos.setFont(fuente);
lbl_movimientos.setForeground(new Color(19, 136, 149));
lst_movimientos.setBounds(10, 55, pnl_movimientos.getWidth() - 25, 450);
lst_model = new DefaultListModel<>();
lst_movimientos.setModel(lst_model);
scroll.setBounds(10, 55, pnl_movimientos.getWidth() - 25, 450);
btn_deshacer.addActionListener(this);
btn_guardar.addActionListener(this);
btn_puntajes.addActionListener(this);
btn_rehacer.addActionListener(this);
btn_jugar.addActionListener(this);
btn_solucionar.addActionListener(this);
btn_crear.addActionListener(this);
btn_cargar.addActionListener(this);
crearMatriz();
}
/**
* Verifica si el juego está resuelto
*/
public void verificar(){
if(juego.resuelto()){
juego.setJugando(false);
this.terminar();
}
}
/**
* Deshace el ultimo movimiento hecho
*/
public void deshacer(){
if(!juego.getMovimientos().isEmpty()){
Pareja<Integer, Integer> p = juego.getMovimientos().pop();
int i = (int) p.getI();
int j = (int) p.getJ();
int mov = juego.verificar(i, j);
int aux = juego.getMatriz()[i][j];
int ianterior;
int janterior;
if(mov != -1){
ianterior = i;
janterior = j;
switch(mov){
case Juego.ABAJO:
i++;
break;
case Juego.ARRIBA:
i--;
break;
case Juego.DERECHA:
j++;
break;
case Juego.IZQUIERDA:
j--;
break;
}
juego.getMatriz()[i][j] = aux;
juego.getMatriz()[ianterior][janterior] = 0;
Ficha f = matriz_lbl[i][j];
matriz_lbl[i][j] = matriz_lbl[ianterior][janterior];
matriz_lbl[ianterior][janterior] = f;
matriz_lbl[i][j].setLocation(j * 80 + 2, i * 80 + 2);
matriz_lbl[ianterior][janterior].setLocation(janterior * 80 + 2, ianterior * 80 + 2);
juego.getDeshechos().push(new Pareja<Integer, Integer>(i, j));
lst_model.removeElementAt(lst_model.size()-1);
}
}
}
/**
* Deshace el ultimo movimiento hecho
*/
public void rehacer(){
if(!juego.getDeshechos().isEmpty()){
Pareja<Integer, Integer> p = juego.getDeshechos().pop();
int i = (int) p.getI();
int j = (int) p.getJ();
int mov = juego.verificar(i, j);
int aux = juego.getMatriz()[i][j];
int ianterior;
int janterior;
if(mov != -1){
ianterior = i;
janterior = j;
switch(mov){
case Juego.ABAJO:
i++;
break;
case Juego.ARRIBA:
i--;
break;
case Juego.DERECHA:
j++;
break;
case Juego.IZQUIERDA:
j--;
break;
}
juego.getMatriz()[i][j] = aux;
juego.getMatriz()[ianterior][janterior] = 0;
Ficha f = matriz_lbl[i][j];
matriz_lbl[i][j] = matriz_lbl[ianterior][janterior];
matriz_lbl[ianterior][janterior] = f;
matriz_lbl[i][j].setLocation(j * 80 + 2, i * 80 + 2);
matriz_lbl[ianterior][janterior].setLocation(janterior * 80 + 2, ianterior * 80 + 2);
juego.getMovimientos().push(new Pareja<Integer, Integer>(i, j));
lst_model.addElement(juego.getMatriz()[i][j]);
}
}
}
/**
* Organiza lo necesario para empezar a jugar
*/
public void organizarJuego(){
for (int i = 0; i < matriz_lbl.length; i++) {
for (int j = 0; j < matriz_lbl.length; j++) {
if(juego.getMatriz()[i][j] != 0){
matriz_lbl[i][j].setId(juego.getMatriz()[i][j]);
matriz_lbl[i][j].setIcon(new ImageIcon(Object.class.getResource(PATH + juego.getMatriz()[i][j] + ".png")));
}else{
matriz_lbl[i][j].setIcon(null);
}
}
}
}
/**
* Devuelve solamente el nombre del archivo
* @param aux la ruta del archivo
* @return el nombre del puzzle
*/
public String nombreArchivo(String aux){
puzzle = "";
for (int i = aux.length()-5; i >= 0; i--) {
if(aux.charAt(i) == '\\')
break;
else
puzzle = aux.charAt(i) + puzzle;
}
return puzzle;
}
/**
* Termina el juego una ves está resuelto
*/
public void terminar(){
String nombre = JOptionPane.showInputDialog("Juego resuelto en "+juego.getPasos()+" pasos\nPorfavor ingrese su nombre");
if(nombre == null){
nombre = "Sin nombre";
}
if(juego.agregarJugador(nombre, juego.getPasos(), puzzle)){
JOptionPane.showMessageDialog(null, "Estas entre los mejores 5 del mapa que jugaste");
ventana_puntajes.actualizar();
File archivo;
if(guardadoPorPrimeraVez){
archivo = puntajes;
}else{
JOptionPane.showMessageDialog(null, "Seleccione donde guardará los puntajes");
archivo = guardar();
puntajes = archivo;
}
EscritorLector.serializarPuntajes(juego.getPuntajes(), archivo);
}else{
JOptionPane.showMessageDialog(null, "No has ingresado entre los mejores 5 del mapa que jugaste");
}
juego.setPasos(0);
}
/**
* Retorna un directorio donde guardar.
* @return el archivo o ruta donde se va a guardar
*/
public File guardar(){
chooser.setCurrentDirectory(new File("/"));
int a = chooser.showSaveDialog(null);
File archivo = null;
if(a == 0)
archivo = chooser.getSelectedFile();
return archivo;
}
/**
* Retorna un archivo para deserializar
* @return el archivo que se va a cargar
*/
public File cargar(){
JOptionPane.showMessageDialog(null, "Seleccione el archivo de puntajes.\nSi es primera ves, oprima cancelar en el siguiente diálogo.");
chooser.setCurrentDirectory(new File("/"));
int a = chooser.showOpenDialog(null);
File archivo = null;
if(a == 0)
archivo = chooser.getSelectedFile();
return archivo;
}
/**
* actionPerformed para los botones
* @param e el evento
*/
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == btn_puntajes){
ventana_puntajes.actualizar();
ventana_puntajes.setVisible(true);
ventana_puntajes.setLocation(this.getX() - 180, this.getY());
}
if(e.getSource() == btn_jugar){
if(juego.isJugando()){
int aux = JOptionPane.showConfirmDialog(null, "¿Desea guardar el juego actual? perderá todos los datos no guardados");
if(aux == JOptionPane.CANCEL_OPTION || aux == JOptionPane.CLOSED_OPTION){
return;
}else if(aux == JOptionPane.YES_OPTION){
File archivo = guardar();
if(archivo != null && archivo.exists()){
JOptionPane.showMessageDialog(null, "El nombre guardado ya existe, intente nuevamente.");
return;
}else if(archivo == null){
JOptionPane.showMessageDialog(null, "No se ha guardado");
return;
}
EscritorLector.serializar(juego,archivo);
}
}
chooser.setCurrentDirectory(new File("/"));
int a = chooser.showOpenDialog(this);
if(a == 0){
chooser.getCurrentDirectory();
File archivo = chooser.getSelectedFile();
String aux = archivo.getPath();
puzzle = nombreArchivo(aux);
EscritorLector.leer(archivo.getPath(), juego);
juego.setJugando(true);
juego.getDeshechos().clear();
juego.getMovimientos().clear();
juego.setPasos(0);
lbl_movimientos.setText("Movimientos: "+juego.getPasos());
lst_model.clear();
organizarJuego();
}
}
if(e.getSource() == btn_deshacer){
if(juego.isJugando())
deshacer();
}
if(e.getSource() == btn_rehacer){
if(juego.isJugando())
rehacer();
}
if(e.getSource() == btn_crear){
if(juego.isJugando()){
JOptionPane.showMessageDialog(null, "Debe terminar el juego que está en marcha");
}else{
juego.setVentanaC(null);
juego.inicializar();
VentanaCreacion v = new VentanaCreacion(this,juego);
juego.setVentanaC(v);
v.setVisible(true);
this.setVisible(false);
}
}
if(e.getSource() == btn_guardar){
if(juego.isJugando()){
File archivo = guardar();
if(archivo != null && archivo.exists()){
JOptionPane.showMessageDialog(null, "El nombre guardado ya existe, intente nuevamente.");
return;
}else if(archivo == null){
JOptionPane.showMessageDialog(null, "No se ha guardado");
return;
}
EscritorLector.serializar(juego,archivo);
}else{
JOptionPane.showMessageDialog(null, "Debe haber un juego iniciado para poder guardar.");
}
}
if(e.getSource() == btn_solucionar){
if(juego.isJugando()){
int i = 0, j = 0;
c:for (i = 0; i < juego.getMatriz().length; i++) {
for (j = 0; j < juego.getMatriz().length; j++) {
if(juego.getMatriz()[i][j] == 0){
break c;
}
}
}
Resolver r = new Resolver(juego.getMatriz().clone());
long ini = System.currentTimeMillis();
r.solucion(0, new ArrayList<>(), r.getOrden(), i, j);
ArrayList<Integer> solucion = r.getSolucion();
lbl_movimientos.setText("Movimientos: "+(juego.getPasos() + solucion.size()));
for (int k = solucion.size()-1; k >=0; k--) {
lst_model.addElement(solucion.get(k));
}
juego.inicializar();
this.organizarJuego();
juego.setJugando(false);
long fin = System.currentTimeMillis();
JOptionPane.showMessageDialog(null, "Juego solucionado en: "+(fin - ini)/1000+" segundos");
}else{
JOptionPane.showMessageDialog(null, "El juego actual ya se encuentra solucionado");
}
}
if(e.getSource() == btn_cargar){
if(juego.isJugando()){
int aux = JOptionPane.showConfirmDialog(null, "¿Desea guardar el juego actual? perderá todos los datos no guardados.");
if(aux == JOptionPane.CANCEL_OPTION || aux == JOptionPane.CLOSED_OPTION){
return;
}else if(aux == JOptionPane.YES_OPTION){
File archivo = guardar();
if(archivo.exists()){
JOptionPane.showMessageDialog(null, "El nombre guardado ya existe, intente nuevamente.");
return;
}
EscritorLector.serializar(juego,archivo);
}
}
chooser.setCurrentDirectory(new File("/"));
int a = chooser.showOpenDialog(this);
if(a == 0){
EscritorLector.deserializar(juego, chooser.getSelectedFile());
}
}
}
/**
* @return the btn_deshacer
*/
public JButton getBtn_deshacer() {
return btn_deshacer;
}
/**
* @param btn_deshacer the btn_deshacer to set
*/
public void setBtn_deshacer(JButton btn_deshacer) {
this.btn_deshacer = btn_deshacer;
}
/**
* @return the btn_rehacer
*/
public JButton getBtn_rehacer() {
return btn_rehacer;
}
/**
* @param btn_rehacer the btn_rehacer to set
*/
public void setBtn_rehacer(JButton btn_rehacer) {
this.btn_rehacer = btn_rehacer;
}
/**
* @return the btn_revolver
*/
public JButton getBtn_jugar() {
return btn_jugar;
}
/**
* @param btn_revolver the btn_revolver to set
*/
public void setBtn_revolver(JButton btn_revolver) {
this.btn_jugar = btn_revolver;
}
/**
* @return the btn_puntajes
*/
public JButton getBtn_puntajes() {
return btn_puntajes;
}
/**
* @param btn_puntajes the btn_puntajes to set
*/
public void setBtn_puntajes(JButton btn_puntajes) {
this.btn_puntajes = btn_puntajes;
}
/**
* @return the btn_solucionar
*/
public JButton getBtn_solucionar() {
return btn_solucionar;
}
/**
* @param btn_solucionar the btn_solucionar to set
*/
public void setBtn_solucionar(JButton btn_solucionar) {
this.btn_solucionar = btn_solucionar;
}
/**
* @return the btn_crear
*/
public JButton getBtn_crear() {
return btn_crear;
}
/**
* @param btn_crear the btn_crear to set
*/
public void setBtn_crear(JButton btn_crear) {
this.btn_crear = btn_crear;
}
/**
* @return the pnl_movimientos
*/
public JPanel getPnl_movimientos() {
return pnl_movimientos;
}
/**
* @param pnl_movimientos the pnl_movimientos to set
*/
public void setPnl_movimientos(JPanel pnl_movimientos) {
this.pnl_movimientos = pnl_movimientos;
}
/**
* @return the lbl_movimientos
*/
public JLabel getLbl_movimientos() {
return lbl_movimientos;
}
/**
* @param lbl_movimientos the lbl_movimientos to set
*/
public void setLbl_movimientos(JLabel lbl_movimientos) {
this.lbl_movimientos = lbl_movimientos;
}
/**
* @return the lst_movimientos
*/
public JList<Integer> getLst_movimientos() {
return lst_movimientos;
}
/**
* @param lst_movimientos the lst_movimientos to set
*/
public void setLst_movimientos(JList<Integer> lst_movimientos) {
this.lst_movimientos = lst_movimientos;
}
/**
* @param btn_jugar the btn_jugar to set
*/
public void setBtn_jugar(JButton btn_jugar) {
this.btn_jugar = btn_jugar;
}
/**
* @return the lst_model
*/
public DefaultListModel<Integer> getLst_model() {
return lst_model;
}
/**
* @param lst_model the lst_model to set
*/
public void setLst_model(DefaultListModel<Integer> lst_model) {
this.lst_model = lst_model;
}
/**
* @return the btn_cargar
*/
public JButton getBtn_cargar() {
return btn_cargar;
}
/**
* @param btn_cargar the btn_cargar to set
*/
public void setBtn_cargar(JButton btn_cargar) {
this.btn_cargar = btn_cargar;
}
/**
* @return the scroll
*/
public JScrollPane getScroll() {
return scroll;
}
/**
* @param scroll the scroll to set
*/
public void setScroll(JScrollPane scroll) {
this.scroll = scroll;
}
/**
* @return the ventana_puntajes
*/
public VentanaPuntajes getVentana_puntajes() {
return ventana_puntajes;
}
/**
* @param ventana_puntajes the ventana_puntajes to set
*/
public void setVentana_puntajes(VentanaPuntajes ventana_puntajes) {
this.ventana_puntajes = ventana_puntajes;
}
/**
* @return the serialversionuid
*/
public static long getSerialversionuid() {
return serialVersionUID;
}
/**
* @return the puzzle
*/
public String getPuzzle() {
return puzzle;
}
/**
* @param puzzle the puzzle to set
*/
public void setPuzzle(String puzzle) {
this.puzzle = puzzle;
}
/**
* @return the puntajes
*/
public File getPuntajes() {
return puntajes;
}
/**
* @param puntajes the puntajes to set
*/
public void setPuntajes(File puntajes) {
this.puntajes = puntajes;
}
/**
* @return the guardadoPorPrimeraVez
*/
public boolean isGuardadoPorPrimeraVez() {
return guardadoPorPrimeraVez;
}
/**
* @param guardadoPorPrimeraVez the guardadoPorPrimeraVez to set
*/
public void setGuardadoPorPrimeraVez(boolean guardadoPorPrimeraVez) {
this.guardadoPorPrimeraVez = guardadoPorPrimeraVez;
}
}
| [
"diegoacalero0@gmail.com"
] | diegoacalero0@gmail.com |
572ee5c968a2513154d98ff8de8720bea1b292f1 | b4be6ce60105b72d01e32754d07782d141b201b1 | /baymax-dsp/baymax-dsp-data/baymax-dsp-data-sys/src/main/java/com/info/baymax/dsp/data/sys/entity/security/RoleResourceRef.java | 1eac6d3aae76583118e7d8d6a8df327a9b76ba9a | [] | no_license | cgb-datav/woven-dsp | 62a56099987cc2e08019aceb6e914e538607ca28 | b0b2ebd6af3ac42b71d6d9eedc5c6dfa9bd4e316 | refs/heads/master | 2023-08-28T02:55:19.375074 | 2021-07-05T04:02:57 | 2021-07-05T04:02:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,931 | java | package com.info.baymax.dsp.data.sys.entity.security;
import com.info.baymax.common.persistence.mybatis.type.bool.BooleanVsIntegerTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.JdbcType;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.Comment;
import tk.mybatis.mapper.annotation.ColumnType;
import javax.persistence.*;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel
@Entity
@Table(name = "ref_role_resource", indexes = {@Index(columnList = "roleId")})
@Comment("角色资源目录关联信息表")
public class RoleResourceRef implements Serializable {
private static final long serialVersionUID = -4066909154102918575L;
@Id
@ApiModelProperty(value = "角色ID")
@Comment("角色ID")
@Column(length = 50, nullable = false)
@ColumnType(jdbcType = JdbcType.VARCHAR)
private String roleId;
@Id
@ApiModelProperty(value = "资源目录ID")
@Comment("资源目录ID")
@Column(length = 50, nullable = false)
@ColumnType(jdbcType = JdbcType.VARCHAR)
private String resourceId;
@ApiModelProperty("资源目录类型:schema_dir,dataset_dir,datasource_dir,standard_dir,flow_dir,fileset_dir")
@Comment("资源目录类型:schema_dir,dataset_dir,datasource_dir,standard_dir,flow_dir,fileset_dir")
@Column(length = 20)
@ColumnType(jdbcType = JdbcType.VARCHAR)
private String resType;
@ApiModelProperty(value = "是否是全选状态:false-否(半选中),true-是,默认0")
@Comment("是否是全选状态:false-否(半选中),true-是,默认0")
@Column(length = 2)
@ColumnType(jdbcType = JdbcType.BOOLEAN, typeHandler = BooleanVsIntegerTypeHandler.class)
@ColumnDefault("false")
protected Boolean halfSelect;
@ApiModelProperty("计数器")
@Comment("计数器")
@Column(length = 11)
@ColumnType(jdbcType = JdbcType.INTEGER)
@ColumnDefault("1")
private Integer counter;
public RoleResourceRef() {
}
public RoleResourceRef(String roleId) {
this.roleId = roleId;
}
public RoleResourceRef(String roleId, String resourceId) {
this.roleId = roleId;
this.resourceId = resourceId;
}
public RoleResourceRef(String roleId, String resourceId, String resType, Boolean halfSelect) {
this.roleId = roleId;
this.resourceId = resourceId;
this.resType = resType;
this.halfSelect = halfSelect;
}
public RoleResourceRef(String roleId, String resourceId, String resType, Boolean halfSelect, Integer counter) {
this.roleId = roleId;
this.resourceId = resourceId;
this.resType = resType;
this.halfSelect = halfSelect;
this.counter = counter;
}
}
| [
"760374564@qq.com"
] | 760374564@qq.com |
4b82ab014d334fce94e7e181d703d509d1f82587 | 9ced1a6709675f5fb58f4bb1c836dd8755511814 | /src/my/project/QrcodeGenerator.java | 015b14096a0418ce356e850112702cdf1d890a94 | [] | no_license | Ayshik/QRCODE-GENARETOR-java | f66050cd1e6ce4f3440f9fe48c3c23e5492e2a22 | 4c87bb8131bbcd7ccd2359202b946094f9fc6958 | refs/heads/main | 2023-08-22T12:37:50.726066 | 2021-09-19T18:47:25 | 2021-09-19T18:47:25 | 407,978,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 48,451 | java | /*
* $Id$
*
* Copyright 2013 Valentyn Kolesnikov
*
* 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 my.project;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.beans.XMLDecoder;
import java.beans.XMLEncoder;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Hashtable;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JFileChooser;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
/**
* QR code generator.
*
* @author javadev
* @version $Revision$ $Date$
*/
public class QrcodeGenerator extends javax.swing.JFrame {
private static final String ADDRESS_TEMPLATE =
"BEGIN:VCARD\n"
+ "VERSION:3.0\n"
+ "N:{LN};{FN};\n"
+ "FN:{FN} {LN}\n"
+ "TITLE:{TITLE}/{COMPANYNAME}\n"
+ "TEL;TYPE=WORK;VOICE:{PHONE}\n"
+ "EMAIL;TYPE=WORK:{EMAIL}\n"
+ "ADR;TYPE=INTL,POSTAL,WORK:;;{STREET};{CITY};{STATE};{ZIP};{COUNTRY}\n"
+ "URL;TYPE=WORK:{WEBSITE}\n"
+ "END:VCARD";
private BufferedImage image;
private JFileChooser chooser1 = new JFileChooser();
private class QRCodePanel extends javax.swing.JPanel {
@Override
protected void paintComponent(Graphics grphcs) {
super.paintComponent(grphcs);
if (image != null) {
grphcs.drawImage(image, 0, 0, null);
}
}
}
private class FilterPNG extends javax.swing.filechooser.FileFilter {
public String getDescription() {
return "PNG files";
}
public boolean accept(File file) {
if (file.isDirectory()) {
return true;
}
String name = file.getName();
name = name.toLowerCase();
return name.endsWith(".png");
}
}
private class TransferableImage implements Transferable {
private final java.awt.Image image;
public TransferableImage(java.awt.Image image) {
this.image = image;
}
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
if (flavor.equals( DataFlavor.imageFlavor) && image != null) {
return image;
} else {
throw new UnsupportedFlavorException(flavor);
}
}
public DataFlavor[] getTransferDataFlavors() {
DataFlavor[] flavors = new DataFlavor[1];
flavors[0] = DataFlavor.imageFlavor;
return flavors;
}
public boolean isDataFlavorSupported( DataFlavor flavor) {
DataFlavor[] flavors = getTransferDataFlavors();
for (int i = 0; i < flavors.length; i++) {
if (flavor.equals(flavors[i])) {
return true;
}
}
return false;
}
}
/** Creates new form */
public QrcodeGenerator() {
initComponents();
XMLDecoder d;
String x = null;
String y = null;
String height = null;
String width = null;
String index = null;
try {
d = new XMLDecoder(new BufferedInputStream(new FileInputStream("qrcode.xml")));
jTextField1.setText((String) d.readObject());
jTextField2.setText((String) d.readObject());
jTextField3.setText((String) d.readObject());
jTextField4.setText((String) d.readObject());
jTextField5.setText((String) d.readObject());
jTextField6.setText((String) d.readObject());
jTextField7.setText((String) d.readObject());
jTextField8.setText((String) d.readObject());
jTextField9.setText((String) d.readObject());
jTextField10.setText((String) d.readObject());
jTextField11.setText((String) d.readObject());
jTextField12.setText((String) d.readObject());
jTextField13.setText((String) d.readObject());
jTextField14.setText((String) d.readObject());
jTextField15.setText((String) d.readObject());
jTextArea1.setText((String) d.readObject());
jTextArea2.setText((String) d.readObject());
x = (String) d.readObject();
y = (String) d.readObject();
height = (String) d.readObject();
width = (String) d.readObject();
index = (String) d.readObject();
d.close();
} catch (Exception ex) {
ex.getMessage();
}
addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(WindowEvent winEvt) {
XMLEncoder e;
try {
e = new XMLEncoder(new BufferedOutputStream(new FileOutputStream("qrcode.xml")));
e.writeObject(jTextField1.getText());
e.writeObject(jTextField2.getText());
e.writeObject(jTextField3.getText());
e.writeObject(jTextField4.getText());
e.writeObject(jTextField5.getText());
e.writeObject(jTextField6.getText());
e.writeObject(jTextField7.getText());
e.writeObject(jTextField8.getText());
e.writeObject(jTextField9.getText());
e.writeObject(jTextField10.getText());
e.writeObject(jTextField11.getText());
e.writeObject(jTextField12.getText());
e.writeObject(jTextField13.getText());
e.writeObject(jTextField14.getText());
e.writeObject(jTextField15.getText());
e.writeObject(jTextArea1.getText());
e.writeObject(jTextArea2.getText());
e.writeObject("" + getLocation().x);
e.writeObject("" + getLocation().y);
e.writeObject("" + getSize().height);
e.writeObject("" + getSize().width);
e.writeObject("" + jTabbedPane6.getSelectedIndex());
e.close();
} catch (FileNotFoundException ex) {
Logger.getLogger(QrcodeGenerator.class.getName()).log(Level.SEVERE, null, ex);
}
System.exit(0);
}
});
chooser1.addChoosableFileFilter(new FilterPNG());
chooser1.setDialogTitle("Select PNG file");
chooser1.setCurrentDirectory(new File("."));
final java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
if (x == null) {
x = "" + ((screenSize.width - getWidth()) / 2);
}
if (y == null) {
y = "" + ((screenSize.height - getHeight()) / 2);
}
if (height == null) {
height = "" + getPreferredSize().height;
}
if (width == null) {
width = "" + getPreferredSize().width;
}
if (index == null) {
index = "" + jTabbedPane6.getSelectedIndex();
}
setLocation(Integer.valueOf(x), Integer.valueOf(y));
setSize(new Dimension(Integer.valueOf(width), Integer.valueOf(height)));
jTabbedPane6.setSelectedIndex(Integer.valueOf(index));
}
/** 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.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel3 = new QRCodePanel();
jTabbedPane6 = new javax.swing.JTabbedPane();
jPanel4 = new javax.swing.JPanel();
jTextField2 = new javax.swing.JTextField();
jPanel5 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jLabel1 = new javax.swing.JLabel();
jPanel6 = new javax.swing.JPanel();
jTextField1 = new javax.swing.JTextField();
jPanel7 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
jTextArea2 = new javax.swing.JTextArea();
jLabel4 = new javax.swing.JLabel();
jScrollPane3 = new javax.swing.JScrollPane();
jPanel8 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
jTextField5 = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jTextField6 = new javax.swing.JTextField();
jTextField7 = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
jTextField8 = new javax.swing.JTextField();
jSeparator1 = new javax.swing.JSeparator();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jTextField9 = new javax.swing.JTextField();
jTextField10 = new javax.swing.JTextField();
jSeparator2 = new javax.swing.JSeparator();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jTextField11 = new javax.swing.JTextField();
jLabel15 = new javax.swing.JLabel();
jTextField12 = new javax.swing.JTextField();
jLabel16 = new javax.swing.JLabel();
jTextField13 = new javax.swing.JTextField();
jLabel17 = new javax.swing.JLabel();
jTextField14 = new javax.swing.JTextField();
jLabel18 = new javax.swing.JLabel();
jTextField15 = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("QR code generator");
jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jPanel3.setPreferredSize(new java.awt.Dimension(212, 212));
org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 208, Short.MAX_VALUE)
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 208, Short.MAX_VALUE)
);
jTabbedPane6.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
jTabbedPane6StateChanged(evt);
}
});
jTextField2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField2.setText("http://");
jTextField2.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField2KeyReleased(evt);
}
});
org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.add(jTextField2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE)
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.add(jTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(490, Short.MAX_VALUE))
);
jTabbedPane6.addTab("URL", jPanel4);
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Monospaced", 0, 18)); // NOI18N
jTextArea1.setRows(5);
jTextArea1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextArea1KeyReleased(evt);
}
});
jScrollPane1.setViewportView(jTextArea1);
jLabel1.setText("160 characters");
org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel5Layout.createSequentialGroup()
.add(0, 452, Short.MAX_VALUE)
.add(jLabel1)))
.addContainerGap())
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 264, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel1)
.addContainerGap(234, Short.MAX_VALUE))
);
jTabbedPane6.addTab("Text", jPanel5);
jTextField1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField1KeyReleased(evt);
}
});
org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE)
.addContainerGap())
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(490, Short.MAX_VALUE))
);
jTabbedPane6.addTab("Phone Number", jPanel6);
jLabel2.setText("Number:");
jTextField3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField3.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
jTextField3KeyTyped(evt);
}
});
jLabel3.setText("Message:");
jTextArea2.setColumns(20);
jTextArea2.setFont(new java.awt.Font("Monospaced", 0, 18)); // NOI18N
jTextArea2.setRows(4);
jTextArea2.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
jTextArea2KeyTyped(evt);
}
});
jScrollPane2.setViewportView(jTextArea2);
jLabel4.setText("140 characters");
org.jdesktop.layout.GroupLayout jPanel7Layout = new org.jdesktop.layout.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE)
.add(jTextField3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE)
.add(jPanel7Layout.createSequentialGroup()
.add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel2)
.add(jLabel3))
.add(0, 478, Short.MAX_VALUE))
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel7Layout.createSequentialGroup()
.add(0, 452, Short.MAX_VALUE)
.add(jLabel4)))
.addContainerGap())
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.add(jLabel2)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 122, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel4)
.addContainerGap(302, Short.MAX_VALUE))
);
jTabbedPane6.addTab("SMS", jPanel7);
jScrollPane3.setBorder(null);
jScrollPane3.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jLabel5.setText("First Name");
jTextField4.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField4.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField4KeyReleased(evt);
}
});
jLabel6.setText("Family Name");
jTextField5.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField5.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField4KeyReleased(evt);
}
});
jLabel7.setText("Phone Number");
jLabel8.setText("Email");
jTextField6.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField6.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField4KeyReleased(evt);
}
});
jTextField7.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField7.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField4KeyReleased(evt);
}
});
jLabel9.setText("Website");
jTextField8.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField8.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField4KeyReleased(evt);
}
});
jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel10.setText("Add Organization");
jLabel11.setText("Company Name");
jLabel12.setText("Title within Company");
jTextField9.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField9.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField4KeyReleased(evt);
}
});
jTextField10.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField10.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField4KeyReleased(evt);
}
});
jLabel13.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel13.setText("Address");
jLabel14.setText("Street");
jTextField11.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField11.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField4KeyReleased(evt);
}
});
jLabel15.setText("City");
jTextField12.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField12.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField4KeyReleased(evt);
}
});
jLabel16.setText("State");
jTextField13.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField13.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField4KeyReleased(evt);
}
});
jLabel17.setText("Zip");
jTextField14.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField14.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField4KeyReleased(evt);
}
});
jLabel18.setText("Country");
jTextField15.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField15.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField4KeyReleased(evt);
}
});
org.jdesktop.layout.GroupLayout jPanel8Layout = new org.jdesktop.layout.GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel8Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel8Layout.createSequentialGroup()
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jTextField9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jLabel11))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel8Layout.createSequentialGroup()
.add(jLabel12)
.add(0, 195, Short.MAX_VALUE))
.add(jTextField10, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)))
.add(jPanel8Layout.createSequentialGroup()
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jTextField4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jLabel5)
.add(jLabel7))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jTextField5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
.add(jPanel8Layout.createSequentialGroup()
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel8)
.add(jLabel6))
.add(0, 234, Short.MAX_VALUE))))
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel8Layout.createSequentialGroup()
.add(jTextField6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField7, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE))
.add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE)
.add(jSeparator2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE)
.add(jPanel8Layout.createSequentialGroup()
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jTextField13, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jLabel16))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel8Layout.createSequentialGroup()
.add(jLabel17)
.add(0, 280, Short.MAX_VALUE))
.add(jTextField14, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)))
.add(jPanel8Layout.createSequentialGroup()
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel9)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jTextField8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(jLabel10)
.add(jLabel13)
.add(jTextField11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jLabel14)
.add(jTextField12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jLabel15)
.add(jTextField15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jLabel18))
.add(0, 300, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel8Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel5)
.add(jLabel6))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jTextField4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jTextField5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel7)
.add(jLabel8))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jTextField6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jTextField7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel9)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel10)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel12)
.add(jLabel11))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jTextField9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jTextField10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(jPanel8Layout.createSequentialGroup()
.add(jLabel13)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel14)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel15)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel16)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField13, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(jPanel8Layout.createSequentialGroup()
.add(jLabel17)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel18)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jScrollPane3.setViewportView(jPanel8);
jTabbedPane6.addTab("Contact", jScrollPane3);
jButton2.setText("Save to disk");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton1.setText("Copy");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.add(jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 124, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTabbedPane6)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jTabbedPane6)
.add(jPanel1Layout.createSequentialGroup()
.add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(11, 11, 11)
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton2)
.add(jButton1))
.add(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jTextArea1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextArea1KeyReleased
String text = jTextArea1.getText();
int length = text.length();
jLabel1.setText("" + length + " character" + (length <= 1 ? "" : "s"));
generateQrCode(text);
}//GEN-LAST:event_jTextArea1KeyReleased
private void jTextField2KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField2KeyReleased
generateQrCode(jTextField2.getText());
}//GEN-LAST:event_jTextField2KeyReleased
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
if (chooser1.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) {
return;
}
String fileName = chooser1.getSelectedFile().getPath().replaceFirst("(.*?)(\\.\\w{3,4})*$", "$1.png");
try {
ImageIO.write(image, "png", new File(fileName));
} catch (IOException ex) {
Logger.getLogger(QrcodeGenerator.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jTabbedPane6StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane6StateChanged
javax.swing.JTabbedPane jt = (javax.swing.JTabbedPane) evt.getSource();
switch(jt.getSelectedIndex()) {
case 0:
generateQrCode(jTextField2.getText());
break;
case 1:
String text = jTextArea1.getText();
int length = text.length();
jLabel1.setText("" + length + " character" + (length <= 1 ? "" : "s"));
generateQrCode(text);
break;
case 2:
generateQrCode("tel:" + jTextField1.getText());
break;
case 3:
String text2 = jTextArea2.getText();
int length2 = text2.length();
jLabel4.setText("" + length2 + " character" + (length2 <= 1 ? "" : "s"));
generateQrCode("sms:" + jTextField3.getText() + ":" + text2);
break;
case 4:
generateQrCode(ADDRESS_TEMPLATE.replace("{FN}", jTextField4.getText())
.replace("{LN}", jTextField5.getText())
.replace("{PHONE}", jTextField6.getText())
.replace("{EMAIL}", jTextField7.getText())
.replace("{WEBSITE}", jTextField8.getText())
.replace("{COMPANYNAME}", jTextField9.getText())
.replace("{TITLE}", jTextField10.getText())
.replace("{STREET}", jTextField11.getText())
.replace("{CITY}", jTextField12.getText())
.replace("{STATE}", jTextField13.getText())
.replace("{ZIP}", jTextField14.getText())
.replace("{COUNTRY}", jTextField15.getText())
);
break;
}
}//GEN-LAST:event_jTabbedPane6StateChanged
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
TransferableImage trans = new TransferableImage(image);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(trans, new ClipboardOwner() {
public void lostOwnership(Clipboard clpbrd, Transferable t) {
// Ignore
}
} );
}//GEN-LAST:event_jButton1ActionPerformed
private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyReleased
generateQrCode("tel:" + jTextField1.getText());
}//GEN-LAST:event_jTextField1KeyReleased
private void jTextField3KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField3KeyTyped
generateQrCode("sms:" + jTextField3.getText() + ":" + jTextArea2.getText());
}//GEN-LAST:event_jTextField3KeyTyped
private void jTextArea2KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextArea2KeyTyped
String text = jTextArea2.getText();
int length = text.length();
jLabel4.setText("" + length + " character" + (length <= 1 ? "" : "s"));
generateQrCode("sms:" + jTextField3.getText() + ":" + text);
}//GEN-LAST:event_jTextArea2KeyTyped
private void jTextField4KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField4KeyReleased
generateQrCode(ADDRESS_TEMPLATE.replace("{FN}", jTextField4.getText())
.replace("{LN}", jTextField5.getText())
.replace("{PHONE}", jTextField6.getText())
.replace("{EMAIL}", jTextField7.getText())
.replace("{WEBSITE}", jTextField8.getText())
.replace("{COMPANYNAME}", jTextField9.getText())
.replace("{TITLE}", jTextField10.getText())
.replace("{STREET}", jTextField11.getText())
.replace("{CITY}", jTextField12.getText())
.replace("{STATE}", jTextField13.getText())
.replace("{ZIP}", jTextField14.getText())
.replace("{COUNTRY}", jTextField15.getText())
);
}//GEN-LAST:event_jTextField4KeyReleased
private static void setLookAndFeel()
throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
{
javax.swing.UIManager.LookAndFeelInfo infos[] = UIManager.getInstalledLookAndFeels();
String firstFoundClass = null;
for (javax.swing.UIManager.LookAndFeelInfo info : infos) {
String foundClass = info.getClassName();
if ("Nimbus".equals(info.getName())) {
firstFoundClass = foundClass;
break;
}
if (null == firstFoundClass) {
firstFoundClass = foundClass;
}
}
if(null == firstFoundClass) {
throw new IllegalArgumentException("No suitable Swing looks and feels");
} else {
UIManager.setLookAndFeel(firstFoundClass);
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) throws Exception {
setLookAndFeel();
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new QrcodeGenerator().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JTabbedPane jTabbedPane6;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextArea jTextArea2;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField10;
private javax.swing.JTextField jTextField11;
private javax.swing.JTextField jTextField12;
private javax.swing.JTextField jTextField13;
private javax.swing.JTextField jTextField14;
private javax.swing.JTextField jTextField15;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
private javax.swing.JTextField jTextField8;
private javax.swing.JTextField jTextField9;
// End of variables declaration//GEN-END:variables
private void generateQrCode(String messsage) {
Logger.getLogger(QrcodeGenerator.class.getName()).log(Level.INFO, messsage);
if (messsage == null || messsage.isEmpty()) {
image = null;
return;
}
try {
Hashtable hintMap = new Hashtable();
hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
hintMap.put(EncodeHintType.CHARACTER_SET, "UTF-8");
QRCodeWriter qrCodeWriter = new QRCodeWriter();
BitMatrix byteMatrix = qrCodeWriter.encode(messsage,
BarcodeFormat.QR_CODE, jPanel3.getPreferredSize().width, jPanel3.getPreferredSize().height, hintMap);
int CrunchifyWidth = byteMatrix.getWidth();
image = new BufferedImage(CrunchifyWidth, CrunchifyWidth,
BufferedImage.TYPE_INT_RGB);
image.createGraphics();
Graphics2D graphics=(Graphics2D)image.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, CrunchifyWidth, CrunchifyWidth);
graphics.setColor(Color.BLACK);
for (int i = 0; i < CrunchifyWidth; i++) {
for (int j = 0; j < CrunchifyWidth; j++) {
if (byteMatrix.get(i, j)) {
graphics.fillRect(i, j, 1, 1);
}
}
}
jPanel3.repaint();
} catch (WriterException ex) {
Logger.getLogger(QrcodeGenerator.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
| [
"61822224+Ayshik@users.noreply.github.com"
] | 61822224+Ayshik@users.noreply.github.com |
dea3615bc2ac7390fd84eeb5ef69aded671b4bf2 | 1dd31ea30a7163bbcd248de76d527df2ff08eb67 | /lib/DevApp/src/main/java/dev/utils/common/comparator/sort/StringSort.java | d05e7eef463232e53cef231a965ae4f752870298 | [
"Apache-2.0"
] | permissive | fengjixuchui/DevUtils | f8589c748fd41852738bf4d140c5411412d99bfc | 6799617ee4854038a7cb4791140eca6155caa28b | refs/heads/master | 2023-03-21T19:48:10.303285 | 2022-12-06T07:34:11 | 2022-12-06T07:34:11 | 242,171,017 | 0 | 1 | Apache-2.0 | 2022-07-20T02:32:22 | 2020-02-21T15:30:43 | Java | UTF-8 | Java | false | false | 159 | java | package dev.utils.common.comparator.sort;
/**
* detail: String 排序值
* @author Ttt
*/
public interface StringSort {
String getStringSortValue();
} | [
"jtongttt@gmail.com"
] | jtongttt@gmail.com |
0ab61f46d575cac9aaa1381723fcb04f57337f71 | e39d720534ea06b55ac97312bd133cc54b43c026 | /src/Client/BotInput.java | 465020456689f338a2a1e331f193908e310b6896 | [] | no_license | AlexeyPertsukh/hw23-java-sockets-chat | 1645e1842faf7caf03a312b9f2d9d7ffc9bdc5ab | 7a9fd3ac9ff6c0e45fa027b28c6fa99f98e43bea | refs/heads/master | 2023-07-13T15:55:55.548568 | 2021-09-01T15:29:40 | 2021-09-01T15:29:40 | 398,839,268 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 93 | java | package Client;
@FunctionalInterface
public interface BotInput {
String inputLine();
}
| [
"85017966+AlexeyPertsukh@users.noreply.github.com"
] | 85017966+AlexeyPertsukh@users.noreply.github.com |
227d0f1a27d6b0f5bbe4653ad96a773e1a6cfec8 | 7dc01a867c2f392067688da050eb59437c83a269 | /src/test/java/unit_test/lesson1/e1/HogeTest.java | 698dbcd8c7e12987e79691567c19d6494ec2b21d | [] | no_license | mae0003/unit_test | f38c95eacfff643eb32eef625c9e200d623be6b8 | 5d8267d3b696f21dfee33f189403b33e84b89717 | refs/heads/master | 2021-01-01T16:54:22.894602 | 2017-11-29T10:08:04 | 2017-11-29T10:08:04 | 97,950,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | package unit_test.lesson1.e1;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import unit_test.lesson1.e1.Hoge;
public class HogeTest {
@Test
public void getHogeTest_hogeの場合() {
Hoge sut =new Hoge();
String actual = sut.getHuga("hoge");
String expected = "huga";
assertThat(actual, is(expected));
}
@Test
public void getHogeTest_hoge以外の場合() {
Hoge sut =new Hoge();
String actual = sut.getHuga("Hoge");
String expected = "";
assertThat(actual, is(expected));
}
@Test
public void getHogeTest_nullの場合() {
Hoge sut =new Hoge();
String actual = sut.getHuga(null);
String expected = "";
assertThat(actual, is(expected));
}
}
| [
"mae0003@gmail.com"
] | mae0003@gmail.com |
76644992f25de0fc8e01f207f3610cdde6b6bfe3 | 0206abea982677cb208446e1f2a7be72d9f8e6cb | /train_001/src/train_001/BitOpt.java | a047afb2937427afc4171b7795f5a625583ee18e | [] | no_license | owen-rpx/javase | 0916ee7bcfdfe38c462b581b2fce8a250a22d6a7 | 797a55c9a2cd77079490e0ee7400a171529611d6 | refs/heads/master | 2021-09-20T11:20:31.521965 | 2018-08-09T02:02:54 | 2018-08-09T02:02:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,651 | java | package train_001;
public class BitOpt {
private int a;
private int b;
public BitOpt() {
super();
}
public BitOpt(int a1, int b1) {
super();
this.a = a1;
this.b = b1;
}
protected void changeValueV1() {
System.out.println("------Change Value V1 run---");
StringBuilder sbr = new StringBuilder();
sbr.append("Before: a=" + this.a);
sbr.append(" b=" + this.b);
sbr.append("\n");
int temp;
temp = this.a;
this.a = this.b;
this.b = temp;
sbr.append("After: a=" + this.a);
sbr.append(" b=" + this.b);
System.out.println(sbr);
}
protected void changeValueV2() {
System.out.println("------Change Value V2 run---");
StringBuilder sbr = new StringBuilder();
sbr.append("Before: a=" + this.a);
sbr.append(" b=" + this.b);
sbr.append("\n");
this.a = this.a ^ this.b;
this.b = this.a ^ this.b;
this.a = this.a ^ this.b;
sbr.append("After: a=" + this.a);
sbr.append(" b=" + this.b);
System.out.println(sbr);
}
protected void optAll() {
System.out.println("------Opt All run---");
System.out.println("init: a = " + a + ", b = " + b);
System.out.println("a & b = " + (a & b));
System.out.println("a | b = " + (a | b));
System.out.println("a ^ b = " + (a ^ b));
System.out.println("a ^ b ^ b = " + (a ^ b ^ b));
System.out.println("a ^ b ^ b ^ b = " + (a ^ b ^ b ^ b));
System.out.println("~a = " + (~a));
System.out.println("~b = " + (~b));
}
public static void main(String[] args) {
// & ! ^ ~ >>,>>>,<<
BitOpt bo = new BitOpt(5, 10);
bo.optAll();
bo.changeValueV1();
bo.changeValueV2();
}
}
| [
"zhangxudong_sun@sina.com"
] | zhangxudong_sun@sina.com |
53a119be8cc5283ab35564f3804d5dda830767ae | e735303445f79c6f5b4f7d42a93233a2ac2521e1 | /umbra/src/org/umbra/Logger.java | 15d448fb522df75d4823a678696f4bd0da5989db | [] | no_license | jpeterka/umbra | b3a42fde54bed1c9166c1e7545e1da4d27459833 | 135a7a56e85f9b6f90545eeed493fd417e852d01 | refs/heads/master | 2020-12-24T17:17:33.145622 | 2012-10-15T19:35:11 | 2012-10-15T19:35:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | package org.umbra;
/**
* Simple logger to console
* @author Jiri Peterka
*
*/
public class Logger
{
/**
* Log to console
* @param log string to log
*/
public static void log(String log)
{
System.out.println(log);
}
} | [
"peterka.jiri@gmail.com"
] | peterka.jiri@gmail.com |
619872588fd116cd50742abce1383966b3bf80bb | 9536918c9fe774d6ad5cfc91c7faf3b741ea0975 | /src/GameState/CreditsState.java | 2701a6929c94a0f5a21080767f0602a9b6430811 | [] | no_license | avanbraeckel/Transient-Game | d4c01ab896e8ef14a714b378a01fe6a498a50ec5 | be68f62c60373fc1737dc87e54af13717ca2584c | refs/heads/master | 2021-01-05T07:25:30.141704 | 2020-02-19T19:23:39 | 2020-02-19T19:23:39 | 240,932,056 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,683 | java | /* Alec Godfey
* 12/2018
* A gamestate that displays teh credits for the game, with Austin Van Braeckel's name in a bigger font
* since he did the vast majority of the work.
*/
package GameState;
/**
*
* @author algod5628
*/
import Handlers.Keys;
import java.awt.*;
import TileMap.Background;
public class CreditsState extends GameState {
private Background bg;
private Background detail;
private String[] credits = {
"AUSTIN VAN BRAECKEL",
"ALEC GODFREY",
"SASHA SEUFERT",};
private Color titleColor;
private Font titleFont;
private Font font;
public CreditsState(GameStateManager gsm) {
this.gsm = gsm;
try {
bg = new Background("/Backgrounds/menubg1.png", 1);
bg.setVector(-5, 0);
detail = new Background("/Backgrounds/menuparticles2.png", 1);
detail.setVector(-1, 0);
titleColor = new Color(210,170,50);
titleFont = GameStateManager.harlow.deriveFont(Font.BOLD, 50);
font = GameStateManager.gillUltraBoldC.deriveFont(Font.PLAIN, 16);
} catch (Exception e) {
e.printStackTrace();
}
}
public void init() {
}
public void update() {
bg.update();
detail.update();
handleInput();
}
public void draw(Graphics2D g) {
bg.draw(g);
detail.draw(g);
//draw title
g.setFont(titleFont);
g.setColor(Color.WHITE);
g.drawString("Credits", 49, 80);
g.drawString("Credits", 49, 78);
g.setColor(titleColor);
g.drawString("Credits", 50, 80);
//draw
g.setColor(Color.WHITE);
for (int i = 0; i < credits.length; i++) {
if (i == 0){
g.setFont(GameStateManager.gillUltraBoldC.deriveFont(Font.BOLD, 17));
} else {
g.setFont(font);
}
g.drawString(credits[i], 50, 138 + i * 22);
}
//draw credits for sources
g.setFont(GameStateManager.centuryGothicBold.deriveFont(Font.BOLD, 10));
g.drawString("Sources: Mike S., Eric Matyas, Rvros", 10, 235);
g.setFont(GameStateManager.gillMTBold.deriveFont(Font.BOLD, 12));
g.drawString("BACK", 275, 20);
}
/**
* Detects user input (pressing backspace to go back to main menu)
*/
public void handleInput(){
if (Keys.isPressed(Keys.BACKSPACE)) {
//Go back to main menu
gsm.setState(GameStateManager.MENUSTATE);
}
}
}
| [
"noreply@github.com"
] | avanbraeckel.noreply@github.com |
fee8b3ad838834e664a887e501529e23c3fc47c8 | 404a189c16767191ffb172572d36eca7db5571fb | /dao/test/java/gov/georgia/dhr/dfcs/sacwis/dao/.svn/text-base/SpringDaoConfigurationTest.java.svn-base | 150758b8a581124b901a262a868896f8a598fc68 | [] | no_license | tayduivn/training | 648a8e9e91194156fb4ffb631749e6d4bf2d0590 | 95078fb2c7e21bf2bba31e2bbd5e404ac428da2f | refs/heads/master | 2021-06-13T16:20:41.293097 | 2017-05-08T21:37:59 | 2017-05-08T21:37:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,291 | /**
* Created on Mar 24, 2006 at 1:41:34 PM by Michael K. Werle
*/
package gov.georgia.dhr.dfcs.sacwis.dao;
import java.io.PrintWriter;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Savepoint;
import java.sql.Statement;
import java.util.Map;
import javax.sql.DataSource;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class SpringDaoConfigurationTest extends TestCase {
public SpringDaoConfigurationTest(String string) {
super(string);
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new SpringDaoConfigurationTest("testSpringDaoConfigration"));
return suite;
}
protected void setUp() throws Exception {
super.setUp();
}
protected void tearDown() throws Exception {
super.tearDown();
}
public void testSpringDaoConfigration() {
//noinspection ResultOfObjectAllocationIgnored
new ClassPathXmlApplicationContext(new String[] {"test-spring-dao-context.xml", "dao-context.xml"});
}
} | [
"lgeddam@gmail.com"
] | lgeddam@gmail.com | |
c556eaad399d73225fa15e7a1a99febdad719d09 | 61a41755c94a12b31d18f1c4ba790c8341ed4111 | /src/main/java/com/springboot/processor/MyProcessor.java | 286044373828cdcfbe9d659d4fa6f5df7f5dbade | [] | no_license | jithendra419/apacheCamelConsumer | 316492b6f3fdd8a356f3334a9e431fe5e6155caa | 8dfa3f928012803a3e044e5653e05ea0ded4a372 | refs/heads/master | 2020-07-24T22:48:15.431697 | 2019-09-12T14:59:30 | 2019-09-12T14:59:30 | 208,074,462 | 0 | 0 | null | 2019-10-30T05:30:59 | 2019-09-12T14:45:16 | Java | UTF-8 | Java | false | false | 285 | java | package com.springboot.processor;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
public class MyProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
System.out.println(exchange.getIn().getBody(String.class));
}
}
| [
"jithendraucan@gmail.com"
] | jithendraucan@gmail.com |
7dc860dd33c4654f14469f947b5af45f9ba58e6c | 9a34629ec4782406a3692fe7f85e7588838f5e49 | /app/src/main/java/com/example/amr/mazegame/Levels/LevelTwo.java | c9918b6e86c0fd4ff0e5c6d53659d480e202845a | [] | no_license | amremaish/MazeGame | a431a1214f8a3a91a262b2c56ee69e83a8e405b8 | 05dce9b162666eb26ff87d06f45bb2c5403d14c2 | refs/heads/master | 2020-11-23T22:15:50.386299 | 2019-12-13T13:33:51 | 2019-12-13T13:33:51 | 227,843,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,840 | java | package com.example.amr.mazegame.Levels;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.widget.TextView;
import com.example.amr.mazegame.Activities.ActivityLevel;
import com.example.amr.mazegame.Activities.LevelSelector;
import com.example.amr.mazegame.Managers.SoundManager;
import com.example.amr.mazegame.Managers.ref;
import com.example.amr.mazegame.MazeCreator.GameView;
import com.example.amr.mazegame.R;
import com.example.amr.mazegame.Util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
/**
* Created by Amr on 02/02/2018.
*/
public class LevelTwo {
private int NumbersXY[][] = {
{35, 4},
{28, 18},
{16, 23},
{2, 28}
};
// X , Y , ( slow = 0 , speed = 1) , Taken
private int SlowAndSpeedXY[][] = {
{12, 2, 1, 0},
{34, 10, 1, 0},
{21, 1, 0, 0},
{1, 12, 0, 0}
};
private Bitmap SpeedUpImg, SlowDownImg;
private int TILE_WIDTH;
private GameView game;
private ArrayList<Integer> OriginalNumbers;
private int Answer;
public LevelTwo(GameView game) {
this.game = game;
this.TILE_WIDTH = game.getTileWidth();
initializing();
initializeAssets();
}
private void initializeAssets() {
// text
TextView levelName = (TextView) ActivityLevel.ActivityLevel.findViewById(R.id.levelName);
levelName.setText("المرحلة 2 متوسط المستوى رقم"+" " +(GameView.levelCounter+1) );
// sound
SoundManager.stopAllBackground();
SoundManager.background2 = SoundManager.Loader(true, 60, R.raw.background2);
SoundManager.background2.start();
}
public void initializing() {
OriginalNumbers = new ArrayList<>();
SpeedUpImg = BitmapFactory.decodeResource(ActivityLevel.ActivityLevel.getResources(), R.drawable.speedup);
SlowDownImg = BitmapFactory.decodeResource(ActivityLevel.ActivityLevel.getResources(), R.drawable.slowdown);
// scale
SpeedUpImg = Bitmap.createScaledBitmap(SpeedUpImg, TILE_WIDTH * 3, TILE_WIDTH * 3, false);
SlowDownImg = Bitmap.createScaledBitmap(SlowDownImg, TILE_WIDTH * 3, TILE_WIDTH * 3, false);
generateQuestionAndAnswer();
}
private void generateQuestionAndAnswer() {
int n1 = new Random().nextInt(5) + 1;
int n2 = new Random().nextInt(5) + 1;
// set Question
TextView Question = (TextView) ActivityLevel.ActivityLevel.findViewById(R.id.Quesion);
int signR = new Random().nextInt(2);
char sign = ((signR == 0) ? '+' : '-');
// swap two number to insure n1 > n2
if (n2 > n1){
int temp = n1 ;
n1 = n2 ;
n2 = temp ;
}
Question.setText(n1 + " "+sign+" "+ n2 + " = ?");
if (sign == '-') {
OriginalNumbers.add(n1 - n2);
Answer = n1 - n2;
}
else {
OriginalNumbers.add(n1 + n2);
Answer = n1 + n2;
}
boolean freq[] = new boolean[11] ;
freq[Answer] = true ;
for (int i = 0; i < NumbersXY.length - 1; i++) {
int n = 0 ;
while (true) {
n = new Random().nextInt(10) + 1;
if (!freq[n]){
break;
}
}
freq[n]= true;
OriginalNumbers.add(n);
}
Collections.shuffle(OriginalNumbers);
}
public void Update(Canvas canvas) {
if (GameView.FINISH)
return;
// draw images
for (int i = 0; i < SlowAndSpeedXY.length; i++) {
if (SlowAndSpeedXY[i][3] == 1)
continue;
Bitmap bitmap = ((SlowAndSpeedXY[i][2] == 1) ? SpeedUpImg : SlowDownImg);
canvas.drawBitmap(bitmap, SlowAndSpeedXY[i][0] * TILE_WIDTH, SlowAndSpeedXY[i][1] * TILE_WIDTH, new Paint());
}
SlowAndSpeedCollision();
// ---------------------------------------------------------
// draw numbers
Paint pt = new Paint();
pt.setColor(Color.parseColor(ref.number_color));
pt.setFakeBoldText(true);
pt.setTextSize(TILE_WIDTH * 3);
for (int i = 0; i < NumbersXY.length; i++) {
canvas.drawText(OriginalNumbers.get(i) + "", NumbersXY[i][0] *
TILE_WIDTH, NumbersXY[i][1] * TILE_WIDTH, pt);
}
NumberCollision();
}
private void SlowAndSpeedCollision() {
for (int i = 0; i < SlowAndSpeedXY.length; i++) {
int NumX = SlowAndSpeedXY[i][0] * TILE_WIDTH;
int NumY = SlowAndSpeedXY[i][1] * TILE_WIDTH;
if (game.getLastPlayerX() > NumX - TILE_WIDTH * 2 && game.getLastPlayerX() < NumX + TILE_WIDTH * 2.5 &&
game.getLastPlayerY() > NumY - TILE_WIDTH * 2&& game.getLastPlayerY() < NumY + TILE_WIDTH * 2.5
&& SlowAndSpeedXY[i][3] == 0) {
if (SlowAndSpeedXY[i][2] == 1) {
SoundManager.speed_up.start();
game.setPlayerSpeed(0.2f);
} else {
SoundManager.slow_down.start();
game.setPlayerSpeed(0.1f);
}
SlowAndSpeedXY[i][3] = 1;
}
}
}
private void NumberCollision() {
int chosenNumber = -1;
for (int i = 0; i < NumbersXY.length; i++) {
int NumX = NumbersXY[i][0] * TILE_WIDTH;
int NumY = NumbersXY[i][1] * TILE_WIDTH;
if (game.getLastPlayerX() > NumX - TILE_WIDTH && game.getLastPlayerX() < NumX + TILE_WIDTH + TILE_WIDTH &&
game.getLastPlayerY() > NumY - TILE_WIDTH && game.getLastPlayerY() < NumY + TILE_WIDTH + TILE_WIDTH) {
chosenNumber = OriginalNumbers.get(i);
break;
}
}
if (chosenNumber == -1) {
return;
}
if (chosenNumber == Answer) {
Util.OpenDialog(ActivityLevel.ActivityLevel, "أحسنت أجابة صحيحة ", false);
SoundManager.win.start();
}
else {
Util.OpenDialog(ActivityLevel.ActivityLevel, "أخطأت.. الإجابة الصحيحة هى " + Answer, false);
SoundManager.loss.start();
}
if (GameView.levelCounter == 4){
LevelSelector.SELECTED_LEVEL = 3 ;
GameView.levelCounter = 0 ;
}
else {
LevelSelector.SELECTED_LEVEL = 2;
}
GameView.levelCounter++;
GameView.FINISH = true;
game.setWorkOnceForLvl(false);
}
}
| [
"you@example.com"
] | you@example.com |
b543e659618194627d7609c9ff714398820ab2d4 | 0f126f2b9cdaaf89b9afc927b31f198484796dbc | /src/main/java/com/utkuyavuz/songfinder/service/output/PreviewOutput.java | 64c2655dae02de29c5e618e0048f62ef911dd021 | [
"Unlicense"
] | permissive | tkyvz/Spotify-SongFinder | 1824c232651603087e7935e28f566b4b6ce7afc3 | 4dc9fba0e5a5e15f10c6d4becb24d52e217a7049 | refs/heads/master | 2020-03-11T05:32:54.533784 | 2018-04-16T21:26:01 | 2018-04-16T21:26:01 | 129,805,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,766 | java | package com.utkuyavuz.songfinder.service.output;
import com.utkuyavuz.songfinder.service.input.PreviewInput;
/**
* Output class for {@link com.utkuyavuz.songfinder.service.contract.IPreviewService#getSongPreview(PreviewInput)}
*
* @author Utku Yavuz
* @version 1.0
* @since 2018-04-16
*/
public class PreviewOutput {
/** Error Message */
private String errorMessage;
/** Raw Audio */
private byte[] rawAudio;
/** Http Status */
private int status;
/**
* Gets the error message for the <code>getSongPreview</code> method.
*
* @return The error message
*/
public String getErrorMessage() {
return errorMessage;
}
/**
* Sets the error message for the <code>getSongPreview</code> method.
*
* @param errorMessage The error message as {@link String}
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
/**
* Gets the raw audio for the <code>getSongPreview</code> method.
*
* @return The raw audio
*/
public byte[] getRawAudio() {
return rawAudio;
}
/**
* Sets the raw audio for the <code>getSongPreview</code> method.
*
* @param rawAudio The raw audio
*/
public void setRawAudio(byte[] rawAudio) {
this.rawAudio = rawAudio;
}
/**
* Gets the HttpStatus for the <code>getSongPreview</code> method.
*
* @return The HttpStatus
*/
public int getStatus() {
return status;
}
/**
* Sets the HttpStatus for the <code>getSongPreview</code> method.
*
* @param status The HttpStatus as {@link Integer}
*/
public void setStatus(int status) {
this.status = status;
}
}
| [
"utku.yavuz@yahoo.com.tr"
] | utku.yavuz@yahoo.com.tr |
23475cfffceb10a32771b9b8aaecb6ddf558ea96 | d522c81e19c3cef1a0fae76ebecc64a1bf7d15dd | /(D. Daniel Liang, 2015)/Chap07/examples/SearchArray.java | 07f856be6700cd7650542eaff5008f989b34d41f | [] | no_license | CurtisNewbie/Learning-Notes | df7195ca9687ad38e5d16cb48fb308075117bee2 | dcf60715138a018263f006aaa5ff5e9fab591b34 | refs/heads/master | 2023-01-30T20:46:47.003859 | 2021-08-04T08:50:20 | 2021-08-04T08:50:20 | 205,546,506 | 0 | 1 | null | 2023-01-07T13:18:39 | 2019-08-31T13:14:16 | Java | UTF-8 | Java | false | false | 1,236 | java | public class SearchArray {
public static void main(String[] args) {
int[] arr = { 1, 2, 3, 4, 5 };
// linear searching
linearSearch(arr, 4);
// Bineary searching (Sorted and only one match)
binarySearch(arr, 4);
}
public static void linearSearch(int[] arr, int n) {
int len = arr.length;
StringBuilder index = new StringBuilder("Found in: ");
for (int x = 0; x < len; x++) {
if (arr[x] == n) {
index.append(x + " ");
}
}
System.out.println(index.toString());
}
public static void binarySearch(int[] arr, int n) {
int min = 0;
int max = arr.length - 1;
String result = "Found in :";
boolean found = false;
while (max >= min && !found) {
int mid = min + (max - min) / 2;
int midValue = arr[mid];
if (midValue == n) {
found = true;
System.out.println(result + mid);
} else if (midValue > n) {
max = mid - 1;
} else {
min = mid + 1;
}
}
if (!found)
System.out.println("Not found");
}
} | [
"Zhuangyongj@gmail.com"
] | Zhuangyongj@gmail.com |
e55f53b93a9d986c0556d25af733e422a4322864 | de2aafaab6589095d2afedf7da2ca3433b8f291a | /TicTacToe.java | b7eda2a1fe70a82c4bc48c0b2d4b6e41b8cfb341 | [] | no_license | tripathi-abhishek/TicTacToe | 39d7dff90b68ca7e7e50e3454c73ebd9554d3b7a | f6e31b040d4c9baa67cdae359076a09ee046d676 | refs/heads/master | 2022-12-22T14:55:38.300955 | 2020-09-26T13:00:56 | 2020-09-26T13:00:56 | 298,810,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,765 | java | import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.Scanner;
public class TicTacToe {
//storing player positions
static ArrayList<Integer> playerPositions = new ArrayList<Integer>();
static ArrayList<Integer> cpuPositions = new ArrayList<Integer>();
//main method
public static void main(String[] args) {
//game board created
char [][] gameBoard = {{' ', '|', ' ', '|', ' '},
{'-', '+', '-', '+', '-'},
{' ', '|', ' ', '|', ' '},
{'-', '+', '-', '+', '-'},
{' ', '|', ' ', '|', ' '}};
printGameBoard(gameBoard); //print game board
//which player is playing function
while(true) { //game loop
Scanner scan = new Scanner(System.in);
System.out.println("Place it!😎");
int playerPos=scan.nextInt();
while(playerPositions.contains(playerPos) || cpuPositions.contains(playerPos)) {
System.out.println("Position Taken! Enter correct position!😡"); //no clashing check
playerPos = scan.nextInt();
}
placePiece(gameBoard, playerPos, "player");
String result = checkWinner();
if(result.length() >0) {
System.out.println(result);
break;
}
Random rand = new Random(); //Randomizer function
int cpuPos = rand.nextInt(9) + 1;
while(playerPositions.contains(cpuPos) || cpuPositions.contains(cpuPos)) {
cpuPos = rand.nextInt(9) + 1;
}
placePiece(gameBoard, cpuPos, "cpu");
printGameBoard(gameBoard);
result = checkWinner();
if(result.length() >0) {
System.out.println(result);
break;
}
}
}////////////main//////////
//GameBoard function
public static void printGameBoard(char[][] gameBoard) {
for(char[] row : gameBoard) {
for(char c : row) {
System.out.print(c);
}
System.out.println();
}
}
//piece placing function
public static void placePiece(char[][] gameBoard, int pos, String user) {
char symbol = ' ';
if(user.equals("player")) {
symbol = 'X';
playerPositions.add(pos);
}else if(user.equals("cpu")) {
symbol = 'O';
cpuPositions.add(pos);
}
switch(pos) {
case 1:
gameBoard[0][0] = symbol;
break;
case 2:
gameBoard[0][2] = symbol;
break;
case 3:
gameBoard[0][4] = symbol;
break;
case 4:
gameBoard[2][0] = symbol;
break;
case 5:
gameBoard[2][2] = symbol;
break;
case 6:
gameBoard[2][4] = symbol;
break;
case 7:
gameBoard[4][0] = symbol;
break;
case 8:
gameBoard[4][2] = symbol;
break;
case 9:
gameBoard[4][4] = symbol;
break;
default:
break;
}
}
// winner check function
public static String checkWinner() {
List topRow = Arrays.asList(1, 2, 3);
List midRow = Arrays.asList(4, 5, 6);
List botRow = Arrays.asList(7, 8, 9);
List leftCol = Arrays.asList(1, 4, 7);
List midCol = Arrays.asList(2, 5, 8);
List rightCol = Arrays.asList(3, 6, 9);
List cross1 = Arrays.asList(1, 5, 9);
List cross2 = Arrays.asList(7, 5, 3);
List<List> winning = new ArrayList<List>();
winning.add(topRow);
winning.add(midRow);
winning.add(botRow);
winning.add(leftCol);
winning.add(midCol);
winning.add(rightCol);
winning.add(cross1);
winning.add(cross2);
for(List l : winning) {
if(playerPositions.containsAll(l)) {
return "Congrats you won!😍";
}else if(playerPositions.containsAll(l)) {
return "CPU wins!😔";
}else if(playerPositions.size() + cpuPositions.size() == 9) {
return "Meow Meow!😵";
}
}
return "";
}
}
| [
"noreply@github.com"
] | tripathi-abhishek.noreply@github.com |
973f1eed791471fc03048b80ef12df297ea785b6 | e8f1814b801cda195948a79a3faa4d956f334395 | /app/src/main/java/com/example/notifyme/MainActivity.java | 0e85c5f95d770c032e064dc7b417d36f111db1d4 | [] | no_license | KeeksMcGee/NotifyMe | 2089bfe7b63ed394ba812050de066864f7028355 | 9dc64d453c9c9a9d036f2067cf3ae1cfacb5fc9e | refs/heads/master | 2021-03-12T16:01:34.965248 | 2020-03-11T17:16:10 | 2020-03-11T17:16:10 | 246,633,939 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,690 | java | package com.example.notifyme;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
private Button button_notify;
private Button button_cancel;
private Button button_update;
private static final String PRIMARY_CHANNEL_ID = "primary_notification_channel";
private NotificationManager mNotifyManager;
private static final int NOTIFICATION_ID = 0;
private static final String ACTION_DISMISS_NOTIFICATION = "com.example.android.notifyme.ACTION_DISMISS_NOTIFICATION";
private static final String ACTION_UPDATE_NOTIFICATION = "com.example.android.notifyme.ACTION_UPDATE_NOTIFICATION";
private NotificationReceiver mReceiver = new NotificationReceiver();
public class NotificationReceiver extends BroadcastReceiver{
public NotificationReceiver(){
}
@Override
public void onReceive(Context context, Intent intent) {
String intentAction = intent.getAction();
if (intentAction != null) {
switch (intentAction){
case ACTION_UPDATE_NOTIFICATION: updateNotification(); break;
case ACTION_DISMISS_NOTIFICATION: setNotificationButtonState(true, false, false);
default: break;
}
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button_notify = findViewById(R.id.notify);
button_notify.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendNotification();
}
});
createNotificationChannel();
getNotificationBuilder();
button_update = findViewById(R.id.update);
button_update.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
updateNotification();
}
});
button_cancel = findViewById(R.id.cancel);
button_cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cancelNotification();
}
});
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ACTION_UPDATE_NOTIFICATION);
intentFilter.addAction(ACTION_DISMISS_NOTIFICATION);
setNotificationButtonState(true,false,false);
registerReceiver(mReceiver, intentFilter);
}
@Override
protected void onDestroy(){
unregisterReceiver(mReceiver);
super.onDestroy();
}
public void sendNotification(){
Intent updateIntent = new Intent(ACTION_UPDATE_NOTIFICATION);
PendingIntent updatePendingIntent = PendingIntent.getBroadcast(this,NOTIFICATION_ID,
updateIntent, PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder notifyBuilder = getNotificationBuilder();
notifyBuilder.addAction(R.drawable.ic_update, "Update Notification", updatePendingIntent);
mNotifyManager.notify(NOTIFICATION_ID, notifyBuilder.build());
setNotificationButtonState(false,true,true);
}
public void createNotificationChannel(){
mNotifyManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
//Create a Notification Channel
NotificationChannel notificationChannel = new NotificationChannel(PRIMARY_CHANNEL_ID,
"Mascot Notification", NotificationManager.IMPORTANCE_HIGH);
notificationChannel.enableLights(true);
notificationChannel.setLightColor(Color.RED);
notificationChannel.enableVibration(true);
notificationChannel.setDescription("Notification from Mascot");
mNotifyManager.createNotificationChannel(notificationChannel);
}
}
private NotificationCompat.Builder getNotificationBuilder(){
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent notificationPendingIntent = PendingIntent.getActivity(this,
NOTIFICATION_ID, notificationIntent,PendingIntent.FLAG_UPDATE_CURRENT);
Intent dismissIntent = new Intent(ACTION_DISMISS_NOTIFICATION);
PendingIntent notificationDismissPendingIntent = PendingIntent.getBroadcast(this,NOTIFICATION_ID, dismissIntent,PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder notifyBuilder = new NotificationCompat
.Builder(this, PRIMARY_CHANNEL_ID)
.setContentTitle("You've been notified!")
.setContentText("This is your notification text.")
.setContentIntent(notificationPendingIntent)
.setAutoCancel(true)
.setDeleteIntent(notificationDismissPendingIntent)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setDefaults(NotificationCompat.DEFAULT_ALL)
.setSmallIcon(R.drawable.ic_android);
return notifyBuilder;
}
public void updateNotification(){
Bitmap androidImage = BitmapFactory.decodeResource(getResources(),R.drawable.mascot_1);
NotificationCompat.Builder notifyBuilder = getNotificationBuilder();
notifyBuilder.setStyle(new NotificationCompat.BigPictureStyle()
.bigPicture(androidImage)
.setBigContentTitle("Notification Updated!"));
mNotifyManager.notify(NOTIFICATION_ID, notifyBuilder.build());
setNotificationButtonState(false,true,true);
}
public void cancelNotification(){
mNotifyManager.cancel(NOTIFICATION_ID);
setNotificationButtonState(true,false,false);
}
void setNotificationButtonState(Boolean isNotifyEnabled, Boolean isUpdateEnabled,
Boolean isCancelEnabled){
button_notify.setEnabled(isNotifyEnabled);
button_update.setEnabled(isUpdateEnabled);
button_cancel.setEnabled(isCancelEnabled);
}
}
| [
"kiarra.gibbs@gmail.com"
] | kiarra.gibbs@gmail.com |
5d39df09482737f7b165a1f065fef1b53a6f9df4 | b2619bcbc0260339c590ad8de8856ca5ca5b53d2 | /e_10_01/src/e_10_01/Id_class.java | 9f6c5942136c291e626c338eb05d78e9af956330 | [] | no_license | ddt-hirasawa/meikai_java_2017_06_hirasawa | 83de34e8850d1dd7baa217391130d525d7b52f12 | cfad8fe08f2050851ec632f12ab9a0b86ad3122e | refs/heads/master | 2020-07-17T21:56:01.120167 | 2017-06-21T09:31:58 | 2017-06-21T09:31:58 | 94,326,381 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 739 | java | /* 演習10-1 List10-3 の連番クラスに最後に与えた識別番号を返却するメソッドを追加せよ
*
* 作成日 2017年6月20日
*
* 作成者 平澤敬介
*/
package e_10_01;
//連番クラス
public class Id_class {
static int counter = 0; //識別番号を数えるカウンター
private int id_number; //識別番号
//コンストラクタ
Id_class() {
id_number = ++counter; //重複しないように一度番号を与えたならば次の値に移る
}
//メソッド 識別番号を返却する
int get_id_number() {
return id_number;
}
//演習課題
//メソッド 最後に与えた識別番号を返却する
static int ged_MaxId() {
return counter;
}
}
| [
"ddt.jissyusei3@gmail.com"
] | ddt.jissyusei3@gmail.com |
03d3f9723e1d05ee40143841d59afbeaca5ba1ac | 50f22c4229d7c68364df29520a283870216bc417 | /MPChartLib/src/main/java/com/github/mikephil/charting/utils/MPPointD.java | 3df9048ddf0656b66f7f2c9bb73626415301ca61 | [] | no_license | adigunhammedolalekan/sweets-counter | fcb0e0f1eaf96158ced1c3322f05b263f91b6407 | bcb6efe3a4229a2386a489cada64a8db3fb2ae33 | refs/heads/master | 2020-03-30T08:00:51.588881 | 2018-09-18T13:49:02 | 2018-09-18T13:49:02 | 150,981,698 | 2 | 0 | null | 2018-12-31T23:02:14 | 2018-09-30T15:55:41 | Java | UTF-8 | Java | false | false | 1,132 | java |
package com.github.mikephil.charting.utils;
import java.util.List;
/**
* Point encapsulating two double values.
*
* @author Philipp Jahoda
*/
public class MPPointD extends ObjectPool.Poolable {
private static ObjectPool<MPPointD> pool;
static {
pool = ObjectPool.create(64, new MPPointD(0, 0));
pool.setReplenishPercentage(0.5f);
}
public double x;
public double y;
private MPPointD(double x, double y) {
this.x = x;
this.y = y;
}
public static MPPointD getInstance(double x, double y) {
MPPointD result = pool.get();
result.x = x;
result.y = y;
return result;
}
public static void recycleInstance(MPPointD instance) {
pool.recycle(instance);
}
public static void recycleInstances(List<MPPointD> instances) {
pool.recycle(instances);
}
protected ObjectPool.Poolable instantiate() {
return new MPPointD(0, 0);
}
/**
* returns a string representation of the object
*/
public String toString() {
return "MPPointD, x: " + x + ", y: " + y;
}
} | [
"deividas.strioga@gmail.com"
] | deividas.strioga@gmail.com |
09f5f7e369ad6a7427d2219688f1652526fbc008 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /IntroClassJava/dataset/smallest/846021256d8ee8e5398346b8c049a0489ee71209518b971ce1d11e81406bfea1bb78c99c339660ac2790d61d438ecae0ff7a35bfab07864f8e6f69ca2450013c/007/mutations/149/smallest_84602125_007.java | c9dd52f8db14e7ee2659db32dfe16a06db66e352 | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,268 | java | package introclassJava;
class IntObj {
public int value;
public IntObj () {
} public IntObj (int i) {
value = i;
}
}
class FloatObj {
public float value;
public FloatObj () {
} public FloatObj (float i) {
value = i;
}
}
class LongObj {
public long value;
public LongObj () {
} public LongObj (long i) {
value = i;
}
}
class DoubleObj {
public double value;
public DoubleObj () {
} public DoubleObj (double i) {
value = i;
}
}
class CharObj {
public char value;
public CharObj () {
} public CharObj (char i) {
value = i;
}
}
public class smallest_84602125_007 {
public java.util.Scanner scanner;
public String output = "";
public static void main (String[]args) throws Exception {
smallest_84602125_007 mainClass = new smallest_84602125_007 ();
String output;
if (args.length > 0) {
mainClass.scanner = new java.util.Scanner (args[0]);
} else {
mainClass.scanner = new java.util.Scanner (System.in);
}
mainClass.exec ();
System.out.println (mainClass.output);
}
public void exec () throws Exception {
IntObj a = new IntObj (), b = new IntObj (), c = new IntObj (), d =
new IntObj ();
output +=
(String.format ("Please enter 4 numbers separated by spaces > "));
a.value = scanner.nextInt ();
b.value = scanner.nextInt ();
c.value = scanner.nextInt ();
d.value = scanner.nextInt ();
if ((a.value < b.value) && (a.value < c.value) && (a.value < d.value)) {
output += (String.format ("%d is the smallest\n", a.value));
} else if ((b.value < a.value) && (b.value < c.value)
&& (b.value < d.value)) {
output += (String.format ("%d is the smallest\n", b.value));
} else if ((b.value) < (d.value)) {
output += (String.format ("%d is the smallest\n", c.value));
} else if ((d.value < b.value) && (d.value < c.value)
&& (d.value < a.value)) {
output += (String.format ("%d is the smallest\n", d.value));
}
if (true)
return;;
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.