blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
list | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
list | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
abbbb46ef937fc28edea5fabc0fcfbe55fa57ccf
| 15,633,680,997,478 |
a495da428ac50c496aa68a3fd8bfc8805cf1ea9c
|
/src/test/test.java
|
712392c1a2c8585e731928c1d9b78920daa2dbdc
|
[] |
no_license
|
shizhh/Leetcode
|
https://github.com/shizhh/Leetcode
|
e44620c20689bf828f4133231dd1805851164980
|
e9fb00114464ef16f92a021a209e86bc0811e2b0
|
refs/heads/master
| 2020-12-13T23:41:28.810000 | 2020-06-27T10:12:32 | 2020-06-27T10:12:32 | 46,402,314 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package test;
import java.util.HashMap;
import java.util.Hashtable;
public class test
{
public static void main(String[] args)
{
// DeadLock lock = new DeadLock();
// new Thread1(lock).start();
// new Thread2(lock).start();
int x = 5+~10;
System.out.println(x);
System.out.println(Integer.toBinaryString(10));
System.out.println(Integer.toBinaryString(~10));
System.out.println(~-17846);
System.out.println(-1%10);
}
}
class DeadLock
{
private final Object left = new Object();
private final Object right = new Object();
public void leftRight() throws Exception
{
synchronized(left)
{
Thread.sleep(2000);
synchronized(right)
{
System.out.println("left end");
}
}
}
public void rightLeft() throws Exception
{
synchronized(right)
{
Thread.sleep(2000);
synchronized(left)
{
System.out.println("right end");
}
}
}
}
|
UTF-8
|
Java
| 901 |
java
|
test.java
|
Java
|
[] | null |
[] |
package test;
import java.util.HashMap;
import java.util.Hashtable;
public class test
{
public static void main(String[] args)
{
// DeadLock lock = new DeadLock();
// new Thread1(lock).start();
// new Thread2(lock).start();
int x = 5+~10;
System.out.println(x);
System.out.println(Integer.toBinaryString(10));
System.out.println(Integer.toBinaryString(~10));
System.out.println(~-17846);
System.out.println(-1%10);
}
}
class DeadLock
{
private final Object left = new Object();
private final Object right = new Object();
public void leftRight() throws Exception
{
synchronized(left)
{
Thread.sleep(2000);
synchronized(right)
{
System.out.println("left end");
}
}
}
public void rightLeft() throws Exception
{
synchronized(right)
{
Thread.sleep(2000);
synchronized(left)
{
System.out.println("right end");
}
}
}
}
| 901 | 0.654828 | 0.627081 | 54 | 15.685185 | 15.553759 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.888889 | false | false |
13
|
2e44f584a3dbf9f9f97b6dcb936da767b509ccff
| 9,766,755,700,725 |
740a49309909cd475890f317f031793dca862c05
|
/src/main/java/com/chaouki/fatouraApp/entities/Facture.java
|
5756180be8549b6a521b7709036dee7febacc70f
|
[] |
no_license
|
chaoukibenfredj/FatouraApp_SpringBoot
|
https://github.com/chaoukibenfredj/FatouraApp_SpringBoot
|
6c98b5cd9856a339055c40f20551fd14ad9b184e
|
0744e1907f4bbc8abe0b5ffa60aa23132a8f53a1
|
refs/heads/master
| 2018-10-31T10:23:14.701000 | 2018-09-14T19:00:29 | 2018-09-14T19:00:29 | 141,359,391 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.chaouki.fatouraApp.entities;
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.ManyToOne;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
@Entity
@Table(name = "facture")
public class Facture {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ref_facture")
private int id;
// timestamp
@Column(name = "date_facture")
private long dateFacture;
@Column(name = "montant_tva_facture")
private float montantTVAFacture;
@Column(name = "montant_htva_facture")
private float montantHTVAFacture;
@Column(name = "montant_net_facture")
private float montantFacture;
@Column(name = "timbre_fiscale_facture")
private float timbreFiscaleFacture;
@Column(name = "etat_facture")
private String etatFacture;
@Column(name = "prods_json_facture")
private String prodsFacture;
@Column(name = "duplicata_facture")
private String duplicataFacture;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Client_id_client", nullable = false)
private Client client;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public long getDateFacture() {
return dateFacture;
}
public void setDateFacture(long dateFacture) {
this.dateFacture = dateFacture;
}
public float getMontantTVAFacture() {
return montantTVAFacture;
}
public void setMontantTVAFacture(float montantTVAFacture) {
this.montantTVAFacture = montantTVAFacture;
}
public float getMontantHTVAFacture() {
return montantHTVAFacture;
}
public void setMontantHTVAFacture(float montantHTVAFacture) {
this.montantHTVAFacture = montantHTVAFacture;
}
public float getMontantFacture() {
return montantFacture;
}
public void setMontantFacture(float montantFacture) {
this.montantFacture = montantFacture;
}
public float getTimbreFiscaleFacture() {
return timbreFiscaleFacture;
}
public void setTimbreFiscaleFacture(float timbreFiscaleFacture) {
this.timbreFiscaleFacture = timbreFiscaleFacture;
}
public String getEtatFacture() {
return etatFacture;
}
public void setEtatFacture(String etatFacture) {
this.etatFacture = etatFacture;
}
public String getProdsFacture() {
return prodsFacture;
}
public void setProdsFacture(String prodsFacture) {
this.prodsFacture = prodsFacture;
}
public String getDuplicataFacture() {
return duplicataFacture;
}
public void setDuplicataFacture(String duplicataFacture) {
this.duplicataFacture = duplicataFacture;
}
public Client getClient() {
return client;
}
public void setClient(Client client) {
this.client = client;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Chauffeur_id_chauffeur", nullable = true)
private Chauffeur chauffeur;
public Chauffeur getChauffeur() {
return chauffeur;
}
public void setChauffeur(Chauffeur chauffeur) {
this.chauffeur = chauffeur;
}
}
|
UTF-8
|
Java
| 3,334 |
java
|
Facture.java
|
Java
|
[] | null |
[] |
package com.chaouki.fatouraApp.entities;
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.ManyToOne;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
@Entity
@Table(name = "facture")
public class Facture {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ref_facture")
private int id;
// timestamp
@Column(name = "date_facture")
private long dateFacture;
@Column(name = "montant_tva_facture")
private float montantTVAFacture;
@Column(name = "montant_htva_facture")
private float montantHTVAFacture;
@Column(name = "montant_net_facture")
private float montantFacture;
@Column(name = "timbre_fiscale_facture")
private float timbreFiscaleFacture;
@Column(name = "etat_facture")
private String etatFacture;
@Column(name = "prods_json_facture")
private String prodsFacture;
@Column(name = "duplicata_facture")
private String duplicataFacture;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Client_id_client", nullable = false)
private Client client;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public long getDateFacture() {
return dateFacture;
}
public void setDateFacture(long dateFacture) {
this.dateFacture = dateFacture;
}
public float getMontantTVAFacture() {
return montantTVAFacture;
}
public void setMontantTVAFacture(float montantTVAFacture) {
this.montantTVAFacture = montantTVAFacture;
}
public float getMontantHTVAFacture() {
return montantHTVAFacture;
}
public void setMontantHTVAFacture(float montantHTVAFacture) {
this.montantHTVAFacture = montantHTVAFacture;
}
public float getMontantFacture() {
return montantFacture;
}
public void setMontantFacture(float montantFacture) {
this.montantFacture = montantFacture;
}
public float getTimbreFiscaleFacture() {
return timbreFiscaleFacture;
}
public void setTimbreFiscaleFacture(float timbreFiscaleFacture) {
this.timbreFiscaleFacture = timbreFiscaleFacture;
}
public String getEtatFacture() {
return etatFacture;
}
public void setEtatFacture(String etatFacture) {
this.etatFacture = etatFacture;
}
public String getProdsFacture() {
return prodsFacture;
}
public void setProdsFacture(String prodsFacture) {
this.prodsFacture = prodsFacture;
}
public String getDuplicataFacture() {
return duplicataFacture;
}
public void setDuplicataFacture(String duplicataFacture) {
this.duplicataFacture = duplicataFacture;
}
public Client getClient() {
return client;
}
public void setClient(Client client) {
this.client = client;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Chauffeur_id_chauffeur", nullable = true)
private Chauffeur chauffeur;
public Chauffeur getChauffeur() {
return chauffeur;
}
public void setChauffeur(Chauffeur chauffeur) {
this.chauffeur = chauffeur;
}
}
| 3,334 | 0.730954 | 0.730954 | 146 | 20.835617 | 19.471098 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.109589 | false | false |
13
|
4df3c8f608e5c044741593bdac2ce922f28f48d0
| 18,992,345,439,750 |
3ab65ed0b34bef34551877710d7e7e09608f9bee
|
/src/main/java/sn/galsencodeurs/sample/blockchain/model/PairKey.java
|
299640e552c82dd545f972a3634ba43f1a1de795
|
[] |
no_license
|
mandiaye/jblockchain
|
https://github.com/mandiaye/jblockchain
|
641cb24e0ed697758d7a57ca9cdcc0fc02218339
|
b2ccb3922511941b39fb8a19a8cb01195e5198e4
|
refs/heads/master
| 2023-05-15T10:10:23.547000 | 2019-10-12T18:15:40 | 2019-10-12T18:15:40 | 214,668,450 | 1 | 0 | null | false | 2023-05-07T00:23:04 | 2019-10-12T15:17:39 | 2019-10-12T18:15:53 | 2023-05-07T00:23:04 | 1,655 | 1 | 0 | 7 |
Java
| false | false |
package sn.galsencodeurs.sample.blockchain.model;
import lombok.Data;
@Data
public class PairKey {
private String privateKey;
private String publicKey;
}
|
UTF-8
|
Java
| 164 |
java
|
PairKey.java
|
Java
|
[] | null |
[] |
package sn.galsencodeurs.sample.blockchain.model;
import lombok.Data;
@Data
public class PairKey {
private String privateKey;
private String publicKey;
}
| 164 | 0.768293 | 0.768293 | 9 | 17.222221 | 16.136761 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false |
13
|
0e27403ac78578f740a104ea31311437711cb436
| 22,187,801,104,103 |
3b1c447852700d00683b94e59941d5b5231e0b63
|
/src/main/java/ampos/miniproject/restaurant/dto/request/MenuRequestDTO.java
|
8f9d999914afde44491ac5588d77edcb00b6a41f
|
[] |
no_license
|
duyngq/restaurant
|
https://github.com/duyngq/restaurant
|
899b9a0a3c77af236cf26125af381a8d1ac1da42
|
ed69fe3efa4178a6a1336b01c0efab0e6b11ce65
|
refs/heads/master
| 2022-01-24T04:27:23.594000 | 2019-08-28T08:24:25 | 2019-08-28T08:24:25 | 204,456,001 | 0 | 0 | null | false | 2022-01-21T23:29:34 | 2019-08-26T10:54:13 | 2019-08-28T08:24:39 | 2022-01-21T23:29:32 | 48 | 0 | 0 | 1 |
Java
| false | false |
package ampos.miniproject.restaurant.dto.request;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* DTO for request of a menu
*/
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class MenuRequestDTO implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull
private String name;
@NotNull
private String description;
private String imageUrl;
@NotNull
private BigDecimal price;
private List<String> details;
}
|
UTF-8
|
Java
| 686 |
java
|
MenuRequestDTO.java
|
Java
|
[] | null |
[] |
package ampos.miniproject.restaurant.dto.request;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* DTO for request of a menu
*/
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class MenuRequestDTO implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull
private String name;
@NotNull
private String description;
private String imageUrl;
@NotNull
private BigDecimal price;
private List<String> details;
}
| 686 | 0.766764 | 0.765306 | 36 | 18.055555 | 16.184603 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false |
13
|
eadec2fc7a79939c12cc812cfb2ec5922cc5dfc2
| 34,462,817,606,693 |
b4b6414adbe5cde69e13e80ef254a17533df5522
|
/src/CustomUtils/AudioController.java
|
2b7dc858ee2aedefd0016127cd41f17e1a406eaa
|
[] |
no_license
|
LeafyLen/Proj01
|
https://github.com/LeafyLen/Proj01
|
1b7c1aa4ff54d8ef072c5fe83b5abe41013263ba
|
ffecec8ee59847dbc59c4ffb71b8dddad87244f9
|
refs/heads/master
| 2021-01-22T08:13:48.114000 | 2017-03-12T02:41:07 | 2017-03-12T02:41:07 | 81,885,524 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package CustomUtils;
import org.newdawn.slick.openal.Audio;
import org.newdawn.slick.openal.AudioLoader;
import org.newdawn.slick.util.ResourceLoader;
import java.io.IOException;
import java.util.Random;
/**
* The Audio Controller is used for managing audio in the game and relies on the LWJGL and Slick-Util packages.
*
* It can be used by having individual objects each have their own soundcontroller or by creating a public soundcontroller in whichever class has main.
* The former use is recommended for sound effects as it allows similar object to have sound effects that are different but have the same names.
* The latter use is recommended for music as it allows global access.
*
* @author Pavel Braginskiy
* @version 1.0
* @since 2016-11-19
*
*
* */
public class AudioController {
private java.util.HashMap<String, org.newdawn.slick.openal.Audio> sounds=new java.util.HashMap<>();
/**
* This method adds audio to the ArrayList sounds, and gives them an alias for easier use, as well as initializing it to not playing.
* @param fileLocation The string to a location of the file.
* @param name The name of the sound, which will be reference by other methods in the SoundController class.
* @throws AudioControllerException Thrown if you try to add a sound with an already existing name.
* @throws IOException Thrown if the provided file path is invalid
*/
public void addSound(String fileLocation, String name) throws AudioControllerException, IOException
{
sounds.put(name,AudioLoader.getAudio("WAV",ResourceLoader.getResourceAsStream(fileLocation)));
}
/**
* Plays a sound effect. Once it starts playing the sound effect, it forgets about it.
* It won't show up as "playing", and it can't be stopped. You cannot loop soundeffects.
* A sound effect can be playing multiple times at the same time.
* Audio files must be .wav's
* @param name the name of the sound to be played, which was assigned by the addSound() method.
* @throws AudioControllerException if an invalid name is provided
*/
public void playSoundEffect(String name, double volume) throws AudioControllerException
{
Audio soundEffect;
soundEffect=sounds.get(name);
Random r=new Random();
soundEffect.playAsSoundEffect(r.nextFloat()/5+0.9f,(float)volume,false);
}
/**
* Plays music, and remembers about it. It will show up as playing and can be stopped.
* Only one instance of a sound can be playing as music at a time.
* @param name the name of the sound to be played, which was assigned by the addSound() method.
* @param loop true if the music should loop, false if it should only play once.
* @throws AudioControllerException if the music is already playing or if an invalid name is provided
*/
public void playMusic(String name, double volume, boolean loop) throws AudioControllerException
{
Audio soundEffect;
soundEffect=sounds.get(name);
if((sounds.get(name)).isPlaying())
{
throw new AudioControllerException("That music is already playing.");
}
soundEffect.playAsMusic(1,(float)volume,loop);
}
/**
* Stops a currently playing music sound. Cannot stop sound effects.
* @param name The name of the music to stop.
* @throws AudioControllerException if athe music is not currently playing as music or an invalid name is provided.
*/
public void stopSound(String name) throws AudioControllerException
{
Audio soundEffect;
soundEffect=sounds.get(name);
if(!(sounds.get(name)).isPlaying())
{
throw new AudioControllerException("That music is not currently playing, or you tried to stop a sound effect.");
}
soundEffect.stop();
}
/**
* Checks if a music sound is currently playing.
* @param name the name of the music being checked
* @return true if it is, false if it is not.
* @throws AudioControllerException if an invalid name is passed.
*/
public boolean isPlaying(String name) throws AudioControllerException
{
return (sounds.get(name)).isPlaying();
}
}
|
UTF-8
|
Java
| 3,972 |
java
|
AudioController.java
|
Java
|
[
{
"context": "or music as it allows global access.\n *\n * @author Pavel Braginskiy\n * @version 1.0\n * @since 2016-11-19\n *\n *\n * */\n",
"end": 724,
"score": 0.999865710735321,
"start": 708,
"tag": "NAME",
"value": "Pavel Braginskiy"
}
] | null |
[] |
package CustomUtils;
import org.newdawn.slick.openal.Audio;
import org.newdawn.slick.openal.AudioLoader;
import org.newdawn.slick.util.ResourceLoader;
import java.io.IOException;
import java.util.Random;
/**
* The Audio Controller is used for managing audio in the game and relies on the LWJGL and Slick-Util packages.
*
* It can be used by having individual objects each have their own soundcontroller or by creating a public soundcontroller in whichever class has main.
* The former use is recommended for sound effects as it allows similar object to have sound effects that are different but have the same names.
* The latter use is recommended for music as it allows global access.
*
* @author <NAME>
* @version 1.0
* @since 2016-11-19
*
*
* */
public class AudioController {
private java.util.HashMap<String, org.newdawn.slick.openal.Audio> sounds=new java.util.HashMap<>();
/**
* This method adds audio to the ArrayList sounds, and gives them an alias for easier use, as well as initializing it to not playing.
* @param fileLocation The string to a location of the file.
* @param name The name of the sound, which will be reference by other methods in the SoundController class.
* @throws AudioControllerException Thrown if you try to add a sound with an already existing name.
* @throws IOException Thrown if the provided file path is invalid
*/
public void addSound(String fileLocation, String name) throws AudioControllerException, IOException
{
sounds.put(name,AudioLoader.getAudio("WAV",ResourceLoader.getResourceAsStream(fileLocation)));
}
/**
* Plays a sound effect. Once it starts playing the sound effect, it forgets about it.
* It won't show up as "playing", and it can't be stopped. You cannot loop soundeffects.
* A sound effect can be playing multiple times at the same time.
* Audio files must be .wav's
* @param name the name of the sound to be played, which was assigned by the addSound() method.
* @throws AudioControllerException if an invalid name is provided
*/
public void playSoundEffect(String name, double volume) throws AudioControllerException
{
Audio soundEffect;
soundEffect=sounds.get(name);
Random r=new Random();
soundEffect.playAsSoundEffect(r.nextFloat()/5+0.9f,(float)volume,false);
}
/**
* Plays music, and remembers about it. It will show up as playing and can be stopped.
* Only one instance of a sound can be playing as music at a time.
* @param name the name of the sound to be played, which was assigned by the addSound() method.
* @param loop true if the music should loop, false if it should only play once.
* @throws AudioControllerException if the music is already playing or if an invalid name is provided
*/
public void playMusic(String name, double volume, boolean loop) throws AudioControllerException
{
Audio soundEffect;
soundEffect=sounds.get(name);
if((sounds.get(name)).isPlaying())
{
throw new AudioControllerException("That music is already playing.");
}
soundEffect.playAsMusic(1,(float)volume,loop);
}
/**
* Stops a currently playing music sound. Cannot stop sound effects.
* @param name The name of the music to stop.
* @throws AudioControllerException if athe music is not currently playing as music or an invalid name is provided.
*/
public void stopSound(String name) throws AudioControllerException
{
Audio soundEffect;
soundEffect=sounds.get(name);
if(!(sounds.get(name)).isPlaying())
{
throw new AudioControllerException("That music is not currently playing, or you tried to stop a sound effect.");
}
soundEffect.stop();
}
/**
* Checks if a music sound is currently playing.
* @param name the name of the music being checked
* @return true if it is, false if it is not.
* @throws AudioControllerException if an invalid name is passed.
*/
public boolean isPlaying(String name) throws AudioControllerException
{
return (sounds.get(name)).isPlaying();
}
}
| 3,962 | 0.749496 | 0.745972 | 98 | 39.530613 | 40.523415 | 151 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.377551 | false | false |
13
|
e2426fae965cd67472bf6a0fb0a49d74b1a8b077
| 36,721,970,384,258 |
a8b37bd399dd0bad27d3abd386ace85a6b70ef28
|
/airbyte-integrations/bases/base-typing-deduping/src/main/java/io/airbyte/integrations/base/destination/typing_deduping/ColumnId.java
|
5ad836b48fda5e26dbcf07112ed7d9867b530d23
|
[
"MIT",
"LicenseRef-scancode-free-unknown",
"Elastic-2.0"
] |
permissive
|
thomas-vl/airbyte
|
https://github.com/thomas-vl/airbyte
|
5da2ba9d189ba0b202feb952cadfb550c5050871
|
258a8eb683634a9f9b7821c9a92d1b70c5389a10
|
refs/heads/master
| 2023-09-01T17:49:23.761000 | 2023-08-25T13:13:11 | 2023-08-25T13:13:11 | 327,604,451 | 1 | 0 |
MIT
| true | 2021-01-07T12:24:20 | 2021-01-07T12:24:19 | 2021-01-07T11:26:27 | 2021-01-07T07:56:41 | 17,754 | 0 | 0 | 0 | null | false | false |
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/
package io.airbyte.integrations.base.destination.typing_deduping;
/**
* In general, callers should not directly instantiate this class. Use
* {@link SqlGenerator#buildColumnId(String)} instead.
*
* @param name the name of the column in the final table. Callers should prefer
* {@link #name(String)} when using the column in a query.
* @param originalName the name of the field in the raw JSON blob
* @param canonicalName the name of the field according to the destination. Used for deduping.
* Useful if a destination warehouse handles columns ignoring case, but preserves case in the
* table schema.
*/
public record ColumnId(String name, String originalName, String canonicalName) {
public String name(final String quote) {
return quote + name + quote;
}
}
|
UTF-8
|
Java
| 867 |
java
|
ColumnId.java
|
Java
|
[] | null |
[] |
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/
package io.airbyte.integrations.base.destination.typing_deduping;
/**
* In general, callers should not directly instantiate this class. Use
* {@link SqlGenerator#buildColumnId(String)} instead.
*
* @param name the name of the column in the final table. Callers should prefer
* {@link #name(String)} when using the column in a query.
* @param originalName the name of the field in the raw JSON blob
* @param canonicalName the name of the field according to the destination. Used for deduping.
* Useful if a destination warehouse handles columns ignoring case, but preserves case in the
* table schema.
*/
public record ColumnId(String name, String originalName, String canonicalName) {
public String name(final String quote) {
return quote + name + quote;
}
}
| 867 | 0.724337 | 0.719723 | 24 | 35.125 | 34.742279 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
13
|
1b9b61c2e0b69fbe0ba1a4937b10ec714e7538fc
| 24,893,630,460,580 |
149ee0396b68a88e601176e5b2b875351f6915b0
|
/moduleNotifications/src/main/java/debug/NotiMainActivity.java
|
5d9ab5acf0e8b185202152bfb9df92f1fab60495
|
[
"MIT"
] |
permissive
|
iMeiji/MultiComponentDemo
|
https://github.com/iMeiji/MultiComponentDemo
|
949b7c30e1019149dcd9f8d4bc34c25a186923ee
|
b35d910539606db19f9d65ee6d97e63788f1e52c
|
refs/heads/master
| 2020-03-18T16:48:22.052000 | 2018-05-31T16:29:26 | 2018-05-31T16:29:26 | 134,987,559 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package debug;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import com.alibaba.android.arouter.launcher.ARouter;
import com.meiji.commonbase.BaseActivity;
import com.meiji.commonbase.Constant;
import com.meiji.modulenotifications.R;
/**
* 此 Activity 用于模块单独调试,需要在 AndroidManifestDebug.xml 里声明
* 宿主 App 不需要此 Activity,因此不需要在 AndroidManifest.xml 里声明
*/
public class NotiMainActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.modulenotifications_activity_main);
Fragment fragment = (Fragment) ARouter.getInstance()
.build(Constant.Router.toNotiFragment)
.withString(Constant.EXTRA_KEY, "from NotiMainActivity")
.navigation();
if (fragment != null) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.module_noti_framelayout, fragment)
.commit();
}
}
}
|
UTF-8
|
Java
| 1,106 |
java
|
NotiMainActivity.java
|
Java
|
[] | null |
[] |
package debug;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import com.alibaba.android.arouter.launcher.ARouter;
import com.meiji.commonbase.BaseActivity;
import com.meiji.commonbase.Constant;
import com.meiji.modulenotifications.R;
/**
* 此 Activity 用于模块单独调试,需要在 AndroidManifestDebug.xml 里声明
* 宿主 App 不需要此 Activity,因此不需要在 AndroidManifest.xml 里声明
*/
public class NotiMainActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.modulenotifications_activity_main);
Fragment fragment = (Fragment) ARouter.getInstance()
.build(Constant.Router.toNotiFragment)
.withString(Constant.EXTRA_KEY, "from NotiMainActivity")
.navigation();
if (fragment != null) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.module_noti_framelayout, fragment)
.commit();
}
}
}
| 1,106 | 0.68714 | 0.68618 | 31 | 32.612904 | 23.76454 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.419355 | false | false |
13
|
1030675423961a1ab1443c825f3eeb2ed496ee62
| 26,027,501,858,688 |
a38138863a90e3a86ccd4e6ceee164633245e3e3
|
/se325-concert-service/src/main/java/se325/assignment01/concert/service/services/BookingResource.java
|
0f3d8c1626b137ed7e2de5b35be4c2717353d0d4
|
[] |
no_license
|
lhsunyc/SOFTENG325-ConcertBookingService
|
https://github.com/lhsunyc/SOFTENG325-ConcertBookingService
|
da864327e64f42b7de4e7f2e7871faacca56a165
|
e719159970bc90980326a5eb6dfc58ff350a8032
|
refs/heads/master
| 2023-01-22T10:04:54.655000 | 2020-12-09T11:45:06 | 2020-12-09T11:45:06 | 319,938,804 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package se325.assignment01.concert.service.services;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import se325.assignment01.concert.common.dto.BookingDTO;
import se325.assignment01.concert.common.dto.BookingRequestDTO;
import se325.assignment01.concert.service.domain.Booking;
import se325.assignment01.concert.service.domain.Concert;
import se325.assignment01.concert.service.domain.Seat;
import se325.assignment01.concert.service.domain.User;
import se325.assignment01.concert.service.mapper.BookingMapper;
import javax.persistence.EntityManager;
import javax.persistence.LockModeType;
import javax.persistence.NoResultException;
import javax.ws.rs.*;
import javax.ws.rs.core.*;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
/**
* This class contains all methods that related to Booking features/services (i.e. make o booking)
*/
@Path("/concert-service/bookings")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class BookingResource {
private static Logger LOGGER = LoggerFactory.getLogger(BookingResource.class);
/**
* This post method allows users to make a booking, while notify other subscribers about this.
* @param bookingRequestDTO
* @param cookie
* @return
*/
@POST
public Response attemptBooking(BookingRequestDTO bookingRequestDTO, @CookieParam("auth") Cookie cookie) {
// Check cookie
if (cookie == null) {
return Response.status(Response.Status.UNAUTHORIZED).build();
}
Booking booking;
EntityManager em = PersistenceManager.instance().createEntityManager();
try {
em.getTransaction().begin();
// User query and store the result to user
User user = em.createQuery("select u from User u where u.token = :token", User.class)
.setParameter("token", cookie.getValue())
.getSingleResult();
// Concert query by id
Concert concert = em.find(Concert.class, bookingRequestDTO.getConcertId());
// Check if the concert exits and the date is available
if (concert == null || !concert.getDates().contains(bookingRequestDTO.getDate())) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
// Seat query to find unbooked seats in a given date
List<Seat> seats =
em.createQuery("select s from Seat s where s.date = :date and s.isBooked = false and s.label in :seatLabel", Seat.class)
.setParameter("seatLabel", bookingRequestDTO.getSeatLabels())
.setParameter("date", bookingRequestDTO.getDate())
.getResultList();
// check if the seats are available and whether users have select any seats
if (seats.size() != bookingRequestDTO.getSeatLabels().size()) {
return Response.status(Response.Status.FORBIDDEN).build();
} else if (seats.isEmpty()) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
// set them to booked
for (Seat seat : seats) {
seat.setBooked(true);
}
booking = new Booking(bookingRequestDTO.getDate(), bookingRequestDTO.getConcertId() ,user, seats);
em.persist(booking);
em.getTransaction().commit();
// notify subscriber
SubscribeResource.checkSubscription(bookingRequestDTO.getConcertId(), bookingRequestDTO.getDate());
} catch (NoResultException e) {
LOGGER.error(e.getMessage());
return Response.status(Response.Status.UNAUTHORIZED).build();
} finally {
if (em != null && em.isOpen()) {
em.close();
}
}
return Response.created(URI.create("concert-service/bookings/" + booking.getId())).cookie(new NewCookie("auth", cookie.getValue())).build();
}
/**
* This get method will return bookings made by users filtered by its id.
* @param id
* @param cookie
* @return
*/
@GET
@Path("/{id}")
public Response retrieveBooking(@PathParam("id") Long id, @CookieParam("auth") Cookie cookie) {
// Check cookie
if (cookie == null) {
return Response.status(Response.Status.UNAUTHORIZED).build();
}
BookingDTO bookingDTO;
EntityManager em = PersistenceManager.instance().createEntityManager();
try {
em.getTransaction().begin();
// User query to check authentication
User user = em.createQuery("select u from User u where u.token = :token", User.class)
.setParameter("token", cookie.getValue())
.getSingleResult();
// Booking query by id
Booking booking = em.find(Booking.class, id);
// if booking not exit
if (booking == null) {
return Response.status(Response.Status.NOT_FOUND).build();
}
// if the booking id did not match
if (booking.getUser().getId() != user.getId()) {
return Response.status(Response.Status.FORBIDDEN).build();
}
bookingDTO = BookingMapper.toDTO(booking);// convert to DTO
} catch (NoResultException e) {
// if user not found
return Response.status(Response.Status.UNAUTHORIZED).build();
} finally {
if (em != null && em.isOpen()) {
em.close();
}
}
return Response.ok(bookingDTO).cookie(new NewCookie("auth", cookie.getValue())).build();
}
/**
* This get method will return all bookings
* @param cookie
* @return
*/
@GET
public Response retrieveAllBookingsForUser(@CookieParam("auth") Cookie cookie) {
// Check cookie
if (cookie == null) {
return Response.status(Response.Status.UNAUTHORIZED).build();
}
GenericEntity<List<BookingDTO>> entity;
EntityManager em = PersistenceManager.instance().createEntityManager();
try {
em.getTransaction().begin();
// User query to check authentication
User user = em.createQuery("select u from User u where u.token = :token", User.class)
.setParameter("token", cookie.getValue())
.getSingleResult();
// Booking query by user
List<Booking> bookings
= em.createQuery("select b from Booking b where b.user = :user", Booking.class)
.setParameter("user", user)
.getResultList();
List<BookingDTO> bookingDTOS = new ArrayList<>();
for (Booking booking : bookings) {
bookingDTOS.add(BookingMapper.toDTO(booking));// convert to DTO
}
entity = new GenericEntity<List<BookingDTO>>(bookingDTOS) {};
} catch (NoResultException e) {
// if user not found
return Response.status(Response.Status.UNAUTHORIZED).build();
} finally {
if (em != null && em.isOpen()) {
em.close();
}
}
return Response.ok(entity).cookie(new NewCookie("auth", cookie.getValue())).build();
}
}
|
UTF-8
|
Java
| 7,457 |
java
|
BookingResource.java
|
Java
|
[] | null |
[] |
package se325.assignment01.concert.service.services;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import se325.assignment01.concert.common.dto.BookingDTO;
import se325.assignment01.concert.common.dto.BookingRequestDTO;
import se325.assignment01.concert.service.domain.Booking;
import se325.assignment01.concert.service.domain.Concert;
import se325.assignment01.concert.service.domain.Seat;
import se325.assignment01.concert.service.domain.User;
import se325.assignment01.concert.service.mapper.BookingMapper;
import javax.persistence.EntityManager;
import javax.persistence.LockModeType;
import javax.persistence.NoResultException;
import javax.ws.rs.*;
import javax.ws.rs.core.*;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
/**
* This class contains all methods that related to Booking features/services (i.e. make o booking)
*/
@Path("/concert-service/bookings")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class BookingResource {
private static Logger LOGGER = LoggerFactory.getLogger(BookingResource.class);
/**
* This post method allows users to make a booking, while notify other subscribers about this.
* @param bookingRequestDTO
* @param cookie
* @return
*/
@POST
public Response attemptBooking(BookingRequestDTO bookingRequestDTO, @CookieParam("auth") Cookie cookie) {
// Check cookie
if (cookie == null) {
return Response.status(Response.Status.UNAUTHORIZED).build();
}
Booking booking;
EntityManager em = PersistenceManager.instance().createEntityManager();
try {
em.getTransaction().begin();
// User query and store the result to user
User user = em.createQuery("select u from User u where u.token = :token", User.class)
.setParameter("token", cookie.getValue())
.getSingleResult();
// Concert query by id
Concert concert = em.find(Concert.class, bookingRequestDTO.getConcertId());
// Check if the concert exits and the date is available
if (concert == null || !concert.getDates().contains(bookingRequestDTO.getDate())) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
// Seat query to find unbooked seats in a given date
List<Seat> seats =
em.createQuery("select s from Seat s where s.date = :date and s.isBooked = false and s.label in :seatLabel", Seat.class)
.setParameter("seatLabel", bookingRequestDTO.getSeatLabels())
.setParameter("date", bookingRequestDTO.getDate())
.getResultList();
// check if the seats are available and whether users have select any seats
if (seats.size() != bookingRequestDTO.getSeatLabels().size()) {
return Response.status(Response.Status.FORBIDDEN).build();
} else if (seats.isEmpty()) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
// set them to booked
for (Seat seat : seats) {
seat.setBooked(true);
}
booking = new Booking(bookingRequestDTO.getDate(), bookingRequestDTO.getConcertId() ,user, seats);
em.persist(booking);
em.getTransaction().commit();
// notify subscriber
SubscribeResource.checkSubscription(bookingRequestDTO.getConcertId(), bookingRequestDTO.getDate());
} catch (NoResultException e) {
LOGGER.error(e.getMessage());
return Response.status(Response.Status.UNAUTHORIZED).build();
} finally {
if (em != null && em.isOpen()) {
em.close();
}
}
return Response.created(URI.create("concert-service/bookings/" + booking.getId())).cookie(new NewCookie("auth", cookie.getValue())).build();
}
/**
* This get method will return bookings made by users filtered by its id.
* @param id
* @param cookie
* @return
*/
@GET
@Path("/{id}")
public Response retrieveBooking(@PathParam("id") Long id, @CookieParam("auth") Cookie cookie) {
// Check cookie
if (cookie == null) {
return Response.status(Response.Status.UNAUTHORIZED).build();
}
BookingDTO bookingDTO;
EntityManager em = PersistenceManager.instance().createEntityManager();
try {
em.getTransaction().begin();
// User query to check authentication
User user = em.createQuery("select u from User u where u.token = :token", User.class)
.setParameter("token", cookie.getValue())
.getSingleResult();
// Booking query by id
Booking booking = em.find(Booking.class, id);
// if booking not exit
if (booking == null) {
return Response.status(Response.Status.NOT_FOUND).build();
}
// if the booking id did not match
if (booking.getUser().getId() != user.getId()) {
return Response.status(Response.Status.FORBIDDEN).build();
}
bookingDTO = BookingMapper.toDTO(booking);// convert to DTO
} catch (NoResultException e) {
// if user not found
return Response.status(Response.Status.UNAUTHORIZED).build();
} finally {
if (em != null && em.isOpen()) {
em.close();
}
}
return Response.ok(bookingDTO).cookie(new NewCookie("auth", cookie.getValue())).build();
}
/**
* This get method will return all bookings
* @param cookie
* @return
*/
@GET
public Response retrieveAllBookingsForUser(@CookieParam("auth") Cookie cookie) {
// Check cookie
if (cookie == null) {
return Response.status(Response.Status.UNAUTHORIZED).build();
}
GenericEntity<List<BookingDTO>> entity;
EntityManager em = PersistenceManager.instance().createEntityManager();
try {
em.getTransaction().begin();
// User query to check authentication
User user = em.createQuery("select u from User u where u.token = :token", User.class)
.setParameter("token", cookie.getValue())
.getSingleResult();
// Booking query by user
List<Booking> bookings
= em.createQuery("select b from Booking b where b.user = :user", Booking.class)
.setParameter("user", user)
.getResultList();
List<BookingDTO> bookingDTOS = new ArrayList<>();
for (Booking booking : bookings) {
bookingDTOS.add(BookingMapper.toDTO(booking));// convert to DTO
}
entity = new GenericEntity<List<BookingDTO>>(bookingDTOS) {};
} catch (NoResultException e) {
// if user not found
return Response.status(Response.Status.UNAUTHORIZED).build();
} finally {
if (em != null && em.isOpen()) {
em.close();
}
}
return Response.ok(entity).cookie(new NewCookie("auth", cookie.getValue())).build();
}
}
| 7,457 | 0.600644 | 0.595011 | 202 | 35.91584 | 32.165073 | 148 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.430693 | false | false |
13
|
24ea821c43aacb25c4f6c5b2659244603571968f
| 35,253,091,583,033 |
10205601a9a78ddeb9ff39a21636ebbc33dbb0d4
|
/Backend-agent/src/main/java/com/ftn/agent/model/forDatabase/MessageForDatabase.java
|
1959b7788efde2b318836b329bed00a97e76c4c3
|
[] |
no_license
|
teodora12/BSEP-master
|
https://github.com/teodora12/BSEP-master
|
204e658a4b94a2de904101c4c91323a82d90c086
|
b92ed2614e6fb00d55fed56a1270868055c4e48c
|
refs/heads/master
| 2021-07-08T16:18:07.540000 | 2021-01-26T12:35:43 | 2021-01-26T12:35:43 | 243,832,166 | 0 | 0 | null | false | 2021-05-26T03:10:50 | 2020-02-28T18:47:56 | 2021-01-26T12:35:47 | 2021-05-26T03:10:49 | 15,636 | 0 | 0 | 39 |
Java
| false | false |
package com.ftn.agent.model.forDatabase;
import com.ftn.agent.dto.CreateMessageDTO;
import com.ftn.agent.model.Message;
import com.ftn.agent.model.User;
import javax.persistence.*;
import java.util.Date;
@Entity(name = "message")
@Table(name = "message")
public class MessageForDatabase {
@Id
@Column(name="id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private Date dateOfSending;
private String subject;
private String content;
@ManyToOne
private User user;
@ManyToOne
private AgentForDatabase agent;
public MessageForDatabase(){}
public MessageForDatabase(Message message){
this.dateOfSending = message.getDateOfSending();
this.content = message.getContent();
this.subject = message.getSubject();
// this.user = message.getUser();
}
public MessageForDatabase (CreateMessageDTO createMessageDTO){
this.content = createMessageDTO.getContent();
this.subject = createMessageDTO.getSubject();
Date today = new Date();
this.dateOfSending = today;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Date getDateOfSending() {
return dateOfSending;
}
public void setDateOfSending(Date dateOfSending) {
this.dateOfSending = dateOfSending;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public AgentForDatabase getAgent() {
return agent;
}
public void setAgent(AgentForDatabase agent) {
this.agent = agent;
}
}
|
UTF-8
|
Java
| 1,990 |
java
|
MessageForDatabase.java
|
Java
|
[] | null |
[] |
package com.ftn.agent.model.forDatabase;
import com.ftn.agent.dto.CreateMessageDTO;
import com.ftn.agent.model.Message;
import com.ftn.agent.model.User;
import javax.persistence.*;
import java.util.Date;
@Entity(name = "message")
@Table(name = "message")
public class MessageForDatabase {
@Id
@Column(name="id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private Date dateOfSending;
private String subject;
private String content;
@ManyToOne
private User user;
@ManyToOne
private AgentForDatabase agent;
public MessageForDatabase(){}
public MessageForDatabase(Message message){
this.dateOfSending = message.getDateOfSending();
this.content = message.getContent();
this.subject = message.getSubject();
// this.user = message.getUser();
}
public MessageForDatabase (CreateMessageDTO createMessageDTO){
this.content = createMessageDTO.getContent();
this.subject = createMessageDTO.getSubject();
Date today = new Date();
this.dateOfSending = today;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Date getDateOfSending() {
return dateOfSending;
}
public void setDateOfSending(Date dateOfSending) {
this.dateOfSending = dateOfSending;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public AgentForDatabase getAgent() {
return agent;
}
public void setAgent(AgentForDatabase agent) {
this.agent = agent;
}
}
| 1,990 | 0.638693 | 0.638693 | 98 | 19.306122 | 18.093525 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.326531 | false | false |
13
|
ab3752b241e615a4c835ddcb7ea297d0cd73afb6
| 36,713,380,470,746 |
d668ceae4e0811f821e4dcf1c970750d09e8e978
|
/ir/visitors/Visitor.java
|
f93137caac4691acd66390be270cf8b961f34196
|
[
"MIT"
] |
permissive
|
julianrocha/csc435-compiler-construction
|
https://github.com/julianrocha/csc435-compiler-construction
|
3573f0c5ae5a4f0ac42bd359feb32a29b3124037
|
7213ae82d2119d2b61cc45254fec01080b05dcaa
|
refs/heads/main
| 2023-07-02T10:42:28.960000 | 2021-08-04T22:31:23 | 2021-08-04T22:31:23 | 366,512,694 | 2 | 0 |
MIT
| false | 2021-08-04T22:31:24 | 2021-05-11T21:04:14 | 2021-08-04T22:22:32 | 2021-08-04T22:31:23 | 2,578 | 1 | 0 | 0 |
Java
| false | false |
package ir.visitors;
import ir.*;
import ir.irinstruction.*;
import ir.irinstruction.assignment.*;
public interface Visitor {
Object visit(IRProgram irProgram);
Object visit(IRFunction irFunction);
Object visit(Label label);
Object visit(TempVar tempVar);
Object visit(IRCallInstruction irCallInstruction);
Object visit(IRConditionalGotoInstruction irConditionalGotoInstruction);
Object visit(IRGotoInstruction irGotoInstruction);
Object visit(IRLabelInstruction irLabelInstruction);
Object visit(IRReturnInstruction irReturnInstruction);
Object visit(PrintIRInstruction printIRInstruction);
Object visit(PrintlnIRInstruction printlnIRInstruction);
Object visit(IRArrayAssign irArrayAssign);
Object visit(IRArrayInit irArrayInit);
Object visit(IRBinaryOp irBinaryOp);
Object visit(IRConstantAssign irConstantAssign);
Object visit(IRTempAssign irTempAssign);
Object visit(IRTempAssignArrayRef irTempAssignArrayRef);
Object visit(IRUnaryOp irUnaryOp);
}
|
UTF-8
|
Java
| 991 |
java
|
Visitor.java
|
Java
|
[] | null |
[] |
package ir.visitors;
import ir.*;
import ir.irinstruction.*;
import ir.irinstruction.assignment.*;
public interface Visitor {
Object visit(IRProgram irProgram);
Object visit(IRFunction irFunction);
Object visit(Label label);
Object visit(TempVar tempVar);
Object visit(IRCallInstruction irCallInstruction);
Object visit(IRConditionalGotoInstruction irConditionalGotoInstruction);
Object visit(IRGotoInstruction irGotoInstruction);
Object visit(IRLabelInstruction irLabelInstruction);
Object visit(IRReturnInstruction irReturnInstruction);
Object visit(PrintIRInstruction printIRInstruction);
Object visit(PrintlnIRInstruction printlnIRInstruction);
Object visit(IRArrayAssign irArrayAssign);
Object visit(IRArrayInit irArrayInit);
Object visit(IRBinaryOp irBinaryOp);
Object visit(IRConstantAssign irConstantAssign);
Object visit(IRTempAssign irTempAssign);
Object visit(IRTempAssignArrayRef irTempAssignArrayRef);
Object visit(IRUnaryOp irUnaryOp);
}
| 991 | 0.822402 | 0.822402 | 45 | 21.022223 | 22.794237 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.888889 | false | false |
13
|
e9bdd45bf17e4e34ac571679060fbd89ec3fd221
| 3,582,002,776,196 |
b9c101c77fb0a5ccd5103de854394e18cc3bc96a
|
/Assignmen4/src/UserInterface/Customer/viewbookinginformationJpanel.java
|
1cb13bef265cb89e7261c200c28b746280e4a98e
|
[] |
no_license
|
ShahNeel9/TeamProjects
|
https://github.com/ShahNeel9/TeamProjects
|
076cf3350ae82bb20a069a279476013478784c57
|
fc1ee0439372c2ef43673bd735c2a6f1e1c2fb42
|
refs/heads/master
| 2021-01-08T11:02:38.271000 | 2020-04-22T03:46:53 | 2020-04-22T03:46:53 | 242,009,244 | 0 | 0 | null | false | 2020-02-29T04:25:35 | 2020-02-20T23:05:25 | 2020-02-25T06:49:36 | 2020-02-29T04:25:34 | 2,049 | 0 | 0 | 0 |
Java
| false | false |
/*
* 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 UserInterface.Customer;
import Buisness.Flight;
import java.awt.CardLayout;
import java.awt.Component;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import javax.swing.JPanel;
/**
*
* @author patel
*/
public class viewbookinginformationJpanel extends javax.swing.JPanel {
private JPanel cardSequenceJPanel;
private Flight bookedFlight;
private String seatBooked;
/**
* Creates new form viewbookinginformationJpanel
*/
public viewbookinginformationJpanel(JPanel cardSequenceJPanel, Flight bookedFlight, String seatBooked) {
initComponents();
this.cardSequenceJPanel=cardSequenceJPanel;
this.bookedFlight=bookedFlight;
this.seatBooked=seatBooked;
populateTextFields();
enable();
}
private void populateTextFields(){
airlinerTextField.setText(bookedFlight.getAirline());
flightNumTextField.setText(bookedFlight.getFlightnumber());
destinationTextField.setText(bookedFlight.getDestination());
sourceTextField.setText(bookedFlight.getSource());
arrTimeTextField.setText(Double.toString(bookedFlight.getArrTime()));
depTimeTextField.setText(Double.toString(bookedFlight.getDepTime()));
durationTextField.setText(Integer.toString(bookedFlight.getDuration()));
todTextField.setText(bookedFlight.getTime());
txtPrice.setText(Double.toString(bookedFlight.getPrice()));
String strDate = "";
try {
DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
strDate = dateFormat.format(bookedFlight.getDate());
//System.out.println("Converted String: " + strDate);
} catch (Exception e) {
e.printStackTrace();
}
timeTextField.setText(strDate);
seatTextField.setText(seatBooked);
}
public void enable(){
airlinerTextField.setEnabled(false);
flightNumTextField.setEnabled(false);
destinationTextField.setEnabled(false);
sourceTextField.setEnabled(false);
arrTimeTextField.setEnabled(false);
depTimeTextField.setEnabled(false);
durationTextField.setEnabled(false);
todTextField.setEnabled(false);
timeTextField.setEnabled(false);
seatTextField.setEnabled(false);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
backBtn = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
airlinerTextField = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
flightNumTextField = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
sourceTextField = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
destinationTextField = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
depTimeTextField = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
arrTimeTextField = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
durationTextField = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
todTextField = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
seatTextField = new javax.swing.JTextField();
jLabel11 = new javax.swing.JLabel();
timeTextField = new javax.swing.JTextField();
jLabel12 = new javax.swing.JLabel();
txtPrice = new javax.swing.JTextField();
setBackground(new java.awt.Color(102, 102, 102));
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Booking Information");
backBtn.setText("Back");
backBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
backBtnActionPerformed(evt);
}
});
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("Airliner");
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setText("Flight Number");
jLabel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel4.setText("Source");
jLabel5.setForeground(new java.awt.Color(255, 255, 255));
jLabel5.setText("Destination");
destinationTextField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
destinationTextFieldActionPerformed(evt);
}
});
jLabel6.setForeground(new java.awt.Color(255, 255, 255));
jLabel6.setText("Departure Time");
jLabel7.setForeground(new java.awt.Color(255, 255, 255));
jLabel7.setText("Arrival Time");
jLabel8.setForeground(new java.awt.Color(255, 255, 255));
jLabel8.setText("Duration");
jLabel9.setForeground(new java.awt.Color(255, 255, 255));
jLabel9.setText("Operated Time Of Day");
jLabel10.setForeground(new java.awt.Color(255, 255, 255));
jLabel10.setText("Seat");
jLabel11.setForeground(new java.awt.Color(255, 255, 255));
jLabel11.setText("Date");
jLabel12.setForeground(new java.awt.Color(255, 255, 255));
jLabel12.setText("price");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(backBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(296, 296, 296)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(180, 180, 180)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel8)
.addComponent(jLabel9)
.addComponent(jLabel10)
.addComponent(jLabel11)
.addComponent(jLabel12))
.addGap(118, 118, 118)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(airlinerTextField)
.addComponent(flightNumTextField)
.addComponent(sourceTextField)
.addComponent(destinationTextField)
.addComponent(depTimeTextField)
.addComponent(arrTimeTextField)
.addComponent(durationTextField)
.addComponent(todTextField)
.addComponent(seatTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE)
.addComponent(timeTextField)
.addComponent(txtPrice))))
.addContainerGap(65, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(durationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(backBtn)
.addGap(3, 3, 3)
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(airlinerTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(flightNumTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(sourceTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(destinationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(depTimeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(arrTimeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(36, 36, 36)
.addComponent(jLabel8)))
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9)
.addComponent(todTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel11)
.addComponent(timeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(seatTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel12)
.addComponent(txtPrice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(77, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void destinationTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_destinationTextFieldActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_destinationTextFieldActionPerformed
private void backBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backBtnActionPerformed
// TODO add your handling code here:
cardSequenceJPanel.remove(this);
CardLayout layout= (CardLayout) cardSequenceJPanel.getLayout();
Component[] components = cardSequenceJPanel.getComponents();
for(Component component: components){
if(component instanceof CustomerinformationJpanel){
CustomerinformationJpanel panel= (CustomerinformationJpanel) component;
panel.populateTable();
}
}
layout.previous(cardSequenceJPanel);
}//GEN-LAST:event_backBtnActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField airlinerTextField;
private javax.swing.JTextField arrTimeTextField;
private javax.swing.JButton backBtn;
private javax.swing.JTextField depTimeTextField;
private javax.swing.JTextField destinationTextField;
private javax.swing.JTextField durationTextField;
private javax.swing.JTextField flightNumTextField;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
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.JTextField seatTextField;
private javax.swing.JTextField sourceTextField;
private javax.swing.JTextField timeTextField;
private javax.swing.JTextField todTextField;
private javax.swing.JTextField txtPrice;
// End of variables declaration//GEN-END:variables
}
|
UTF-8
|
Java
| 15,137 |
java
|
viewbookinginformationJpanel.java
|
Java
|
[
{
"context": "mat;\nimport javax.swing.JPanel;\n\n/**\n *\n * @author patel\n */\npublic class viewbookinginformationJpanel ext",
"end": 412,
"score": 0.9958133697509766,
"start": 407,
"tag": "USERNAME",
"value": "patel"
}
] | null |
[] |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package UserInterface.Customer;
import Buisness.Flight;
import java.awt.CardLayout;
import java.awt.Component;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import javax.swing.JPanel;
/**
*
* @author patel
*/
public class viewbookinginformationJpanel extends javax.swing.JPanel {
private JPanel cardSequenceJPanel;
private Flight bookedFlight;
private String seatBooked;
/**
* Creates new form viewbookinginformationJpanel
*/
public viewbookinginformationJpanel(JPanel cardSequenceJPanel, Flight bookedFlight, String seatBooked) {
initComponents();
this.cardSequenceJPanel=cardSequenceJPanel;
this.bookedFlight=bookedFlight;
this.seatBooked=seatBooked;
populateTextFields();
enable();
}
private void populateTextFields(){
airlinerTextField.setText(bookedFlight.getAirline());
flightNumTextField.setText(bookedFlight.getFlightnumber());
destinationTextField.setText(bookedFlight.getDestination());
sourceTextField.setText(bookedFlight.getSource());
arrTimeTextField.setText(Double.toString(bookedFlight.getArrTime()));
depTimeTextField.setText(Double.toString(bookedFlight.getDepTime()));
durationTextField.setText(Integer.toString(bookedFlight.getDuration()));
todTextField.setText(bookedFlight.getTime());
txtPrice.setText(Double.toString(bookedFlight.getPrice()));
String strDate = "";
try {
DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
strDate = dateFormat.format(bookedFlight.getDate());
//System.out.println("Converted String: " + strDate);
} catch (Exception e) {
e.printStackTrace();
}
timeTextField.setText(strDate);
seatTextField.setText(seatBooked);
}
public void enable(){
airlinerTextField.setEnabled(false);
flightNumTextField.setEnabled(false);
destinationTextField.setEnabled(false);
sourceTextField.setEnabled(false);
arrTimeTextField.setEnabled(false);
depTimeTextField.setEnabled(false);
durationTextField.setEnabled(false);
todTextField.setEnabled(false);
timeTextField.setEnabled(false);
seatTextField.setEnabled(false);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
backBtn = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
airlinerTextField = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
flightNumTextField = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
sourceTextField = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
destinationTextField = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
depTimeTextField = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
arrTimeTextField = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
durationTextField = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
todTextField = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
seatTextField = new javax.swing.JTextField();
jLabel11 = new javax.swing.JLabel();
timeTextField = new javax.swing.JTextField();
jLabel12 = new javax.swing.JLabel();
txtPrice = new javax.swing.JTextField();
setBackground(new java.awt.Color(102, 102, 102));
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Booking Information");
backBtn.setText("Back");
backBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
backBtnActionPerformed(evt);
}
});
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("Airliner");
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setText("Flight Number");
jLabel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel4.setText("Source");
jLabel5.setForeground(new java.awt.Color(255, 255, 255));
jLabel5.setText("Destination");
destinationTextField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
destinationTextFieldActionPerformed(evt);
}
});
jLabel6.setForeground(new java.awt.Color(255, 255, 255));
jLabel6.setText("Departure Time");
jLabel7.setForeground(new java.awt.Color(255, 255, 255));
jLabel7.setText("Arrival Time");
jLabel8.setForeground(new java.awt.Color(255, 255, 255));
jLabel8.setText("Duration");
jLabel9.setForeground(new java.awt.Color(255, 255, 255));
jLabel9.setText("Operated Time Of Day");
jLabel10.setForeground(new java.awt.Color(255, 255, 255));
jLabel10.setText("Seat");
jLabel11.setForeground(new java.awt.Color(255, 255, 255));
jLabel11.setText("Date");
jLabel12.setForeground(new java.awt.Color(255, 255, 255));
jLabel12.setText("price");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(backBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(296, 296, 296)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(180, 180, 180)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel8)
.addComponent(jLabel9)
.addComponent(jLabel10)
.addComponent(jLabel11)
.addComponent(jLabel12))
.addGap(118, 118, 118)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(airlinerTextField)
.addComponent(flightNumTextField)
.addComponent(sourceTextField)
.addComponent(destinationTextField)
.addComponent(depTimeTextField)
.addComponent(arrTimeTextField)
.addComponent(durationTextField)
.addComponent(todTextField)
.addComponent(seatTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE)
.addComponent(timeTextField)
.addComponent(txtPrice))))
.addContainerGap(65, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(durationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(backBtn)
.addGap(3, 3, 3)
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(airlinerTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(flightNumTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(sourceTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(destinationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(depTimeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(arrTimeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(36, 36, 36)
.addComponent(jLabel8)))
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9)
.addComponent(todTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel11)
.addComponent(timeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(seatTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel12)
.addComponent(txtPrice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(77, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void destinationTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_destinationTextFieldActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_destinationTextFieldActionPerformed
private void backBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backBtnActionPerformed
// TODO add your handling code here:
cardSequenceJPanel.remove(this);
CardLayout layout= (CardLayout) cardSequenceJPanel.getLayout();
Component[] components = cardSequenceJPanel.getComponents();
for(Component component: components){
if(component instanceof CustomerinformationJpanel){
CustomerinformationJpanel panel= (CustomerinformationJpanel) component;
panel.populateTable();
}
}
layout.previous(cardSequenceJPanel);
}//GEN-LAST:event_backBtnActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField airlinerTextField;
private javax.swing.JTextField arrTimeTextField;
private javax.swing.JButton backBtn;
private javax.swing.JTextField depTimeTextField;
private javax.swing.JTextField destinationTextField;
private javax.swing.JTextField durationTextField;
private javax.swing.JTextField flightNumTextField;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
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.JTextField seatTextField;
private javax.swing.JTextField sourceTextField;
private javax.swing.JTextField timeTextField;
private javax.swing.JTextField todTextField;
private javax.swing.JTextField txtPrice;
// End of variables declaration//GEN-END:variables
}
| 15,137 | 0.638105 | 0.616965 | 300 | 49.456665 | 35.638859 | 182 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.793333 | false | false |
13
|
93f8134a1eedcb2d4e0a4ecc3c79bfc21778cfad
| 13,460,427,562,028 |
8210b4e74c493ab05d1b0564ee586732188816ed
|
/src/main/java/com/efficio/fieldbook/web/label/printing/controller/GenerateLabelController.java
|
147548d2f8c1e1d6a43391b4858e3d6682717d8c
|
[] |
no_license
|
qatestuser2019/Fieldbook
|
https://github.com/qatestuser2019/Fieldbook
|
39647218961910010851893d6900d1421d079076
|
8accc889ab346b0afcb8f49d34c93cb1b9ef3e94
|
refs/heads/master
| 2022-01-11T13:25:26.890000 | 2019-07-18T08:49:44 | 2019-07-18T08:49:44 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*******************************************************************************
* Copyright (c) 2013, All Rights Reserved.
*
* Generation Challenge Programme (GCP)
*
*
* This software is licensed for use under the terms of the GNU General Public License (http://bit.ly/8Ztv8M) and the provisions of Part F
* of the Generation Challenge Programme Amended Consortium Agreement (http://bit.ly/KQX1nL)
*
*******************************************************************************/
package com.efficio.fieldbook.web.label.printing.controller;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.efficio.fieldbook.web.AbstractBaseFieldbookController;
import com.efficio.fieldbook.web.label.printing.bean.UserLabelPrinting;
import com.efficio.fieldbook.web.label.printing.form.LabelPrintingForm;
/**
* The Class GenerateLabelController.
*
* Code is not currently being use.
*/
@Controller
@RequestMapping({GenerateLabelController.URL})
public class GenerateLabelController extends AbstractBaseFieldbookController {
/** The Constant URL. */
public static final String URL = "/LabelPrinting/generateLabel";
/** The user label printing. */
@Resource
private UserLabelPrinting userLabelPrinting;
/**
* Show trial label details.
*
* @param form the form
* @param model the model
* @param session the session
* @param response the response
* @return the string
*/
@RequestMapping(method = RequestMethod.GET)
public String showTrialLabelDetails(@ModelAttribute("labelPrintingForm") LabelPrintingForm form, Model model, HttpSession session,
HttpServletResponse response) {
return super.show(model);
}
/*
* (non-Javadoc)
*
* @see com.efficio.fieldbook.web.AbstractBaseFieldbookController#getContentName()
*/
@Override
public String getContentName() {
return "LabelPrinting/generateLabel";
}
/**
* Gets the user label printing.
*
* @return the user label printing
*/
public UserLabelPrinting getUserLabelPrinting() {
return this.userLabelPrinting;
}
/**
* Sets the user label printing.
*
* @param userLabelPrinting the new user label printing
*/
public void setUserLabelPrinting(UserLabelPrinting userLabelPrinting) {
this.userLabelPrinting = userLabelPrinting;
}
}
|
UTF-8
|
Java
| 2,603 |
java
|
GenerateLabelController.java
|
Java
|
[] | null |
[] |
/*******************************************************************************
* Copyright (c) 2013, All Rights Reserved.
*
* Generation Challenge Programme (GCP)
*
*
* This software is licensed for use under the terms of the GNU General Public License (http://bit.ly/8Ztv8M) and the provisions of Part F
* of the Generation Challenge Programme Amended Consortium Agreement (http://bit.ly/KQX1nL)
*
*******************************************************************************/
package com.efficio.fieldbook.web.label.printing.controller;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.efficio.fieldbook.web.AbstractBaseFieldbookController;
import com.efficio.fieldbook.web.label.printing.bean.UserLabelPrinting;
import com.efficio.fieldbook.web.label.printing.form.LabelPrintingForm;
/**
* The Class GenerateLabelController.
*
* Code is not currently being use.
*/
@Controller
@RequestMapping({GenerateLabelController.URL})
public class GenerateLabelController extends AbstractBaseFieldbookController {
/** The Constant URL. */
public static final String URL = "/LabelPrinting/generateLabel";
/** The user label printing. */
@Resource
private UserLabelPrinting userLabelPrinting;
/**
* Show trial label details.
*
* @param form the form
* @param model the model
* @param session the session
* @param response the response
* @return the string
*/
@RequestMapping(method = RequestMethod.GET)
public String showTrialLabelDetails(@ModelAttribute("labelPrintingForm") LabelPrintingForm form, Model model, HttpSession session,
HttpServletResponse response) {
return super.show(model);
}
/*
* (non-Javadoc)
*
* @see com.efficio.fieldbook.web.AbstractBaseFieldbookController#getContentName()
*/
@Override
public String getContentName() {
return "LabelPrinting/generateLabel";
}
/**
* Gets the user label printing.
*
* @return the user label printing
*/
public UserLabelPrinting getUserLabelPrinting() {
return this.userLabelPrinting;
}
/**
* Sets the user label printing.
*
* @param userLabelPrinting the new user label printing
*/
public void setUserLabelPrinting(UserLabelPrinting userLabelPrinting) {
this.userLabelPrinting = userLabelPrinting;
}
}
| 2,603 | 0.723396 | 0.720707 | 87 | 28.91954 | 30.42013 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.827586 | false | false |
13
|
9d42b8d83415e24b2d3df074dba21c6ddc32c804
| 34,875,134,481,787 |
4520caf9f3d0b093b85fca5510346657c183291d
|
/test/com/ruixus/test/smarty4j/function/MathUnit.java
|
b5e7ed6854b3939711ef1c6b4c8c494b2ed0cc48
|
[] |
no_license
|
zacat/smarty4j
|
https://github.com/zacat/smarty4j
|
308c750c076ecfd914e5cd0bf343ff73486004d6
|
21159caba97a1958cdca8873822bf4a97045882c
|
refs/heads/master
| 2022-03-05T05:51:09.301000 | 2018-02-08T05:07:53 | 2018-02-08T05:07:53 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ruixus.test.smarty4j.function;
import org.junit.Assert;
import org.junit.Test;
import com.ruixus.smarty4j.Context;
import com.ruixus.test.smarty4j.BaseUnit;
public class MathUnit extends BaseUnit {
@Test
public void basic() throws Exception {
Assert.assertEquals("math", getString("{math equation=\"(x+(x+y * y))*x\" x='3' y=1}"), "21");
Assert.assertEquals("math", getException("{math equation=\"(x+(x+y * y))*x\" y=1}"),
"\"x\" not found");
}
@Test
public void advance() throws Exception {
Context ctx;
// 变量不使用不生成代码
ctx = getContext("{math equation=\"(x+(x+y * y))*x\" x='3' y=1 assign=test}");
Assert.assertNull(ctx.get("test"));
// 包含include时回写代码
ctx = getContext("{math equation=\"(x+(x+y * y))*x\" x='3' y=1 assign=test}{include file='empty.tpl'}");
// 包含eval时回写代码
ctx = getContext("{math equation=\"(x+(x+y * y))*x\" x='3' y=1 assign=test}{eval var='{\\$test}'}");
Assert.assertEquals(new String((byte[]) ctx.get("")), "21");
Assert.assertNotNull(ctx.get("test"));
}
}
|
UTF-8
|
Java
| 1,109 |
java
|
MathUnit.java
|
Java
|
[] | null |
[] |
package com.ruixus.test.smarty4j.function;
import org.junit.Assert;
import org.junit.Test;
import com.ruixus.smarty4j.Context;
import com.ruixus.test.smarty4j.BaseUnit;
public class MathUnit extends BaseUnit {
@Test
public void basic() throws Exception {
Assert.assertEquals("math", getString("{math equation=\"(x+(x+y * y))*x\" x='3' y=1}"), "21");
Assert.assertEquals("math", getException("{math equation=\"(x+(x+y * y))*x\" y=1}"),
"\"x\" not found");
}
@Test
public void advance() throws Exception {
Context ctx;
// 变量不使用不生成代码
ctx = getContext("{math equation=\"(x+(x+y * y))*x\" x='3' y=1 assign=test}");
Assert.assertNull(ctx.get("test"));
// 包含include时回写代码
ctx = getContext("{math equation=\"(x+(x+y * y))*x\" x='3' y=1 assign=test}{include file='empty.tpl'}");
// 包含eval时回写代码
ctx = getContext("{math equation=\"(x+(x+y * y))*x\" x='3' y=1 assign=test}{eval var='{\\$test}'}");
Assert.assertEquals(new String((byte[]) ctx.get("")), "21");
Assert.assertNotNull(ctx.get("test"));
}
}
| 1,109 | 0.622055 | 0.606975 | 31 | 32.225807 | 31.900763 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.645161 | false | false |
13
|
cd6eff759cc0c2aa9ce2e8cd847bb898b73be5ac
| 36,790,689,880,321 |
8d901d1febe3fcdb3ba1728ce35fc88d62bcfd49
|
/src/test/java/nl/rug/jbi/jsm/metrics/ckjm/NPMTest.java
|
c29ab68a86c7d8868533fcd536d50d136a90857d
|
[
"MIT"
] |
permissive
|
zengyang/Java-Source-Metrics
|
https://github.com/zengyang/Java-Source-Metrics
|
73fd1e270f54ee352df30e8ea23a4c074a8d790a
|
c8ff5820ba28a9b4f00bb692a8dd630b1485deef
|
refs/heads/master
| 2023-06-23T02:32:45.888000 | 2014-07-14T22:10:47 | 2014-07-14T22:10:47 | 21,577,554 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package nl.rug.jbi.jsm.metrics.ckjm;
import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.Uninterruptibles;
import nl.rug.jbi.jsm.core.calculator.MetricScope;
import nl.rug.jbi.jsm.metrics.TestFrontend;
import nl.rug.jbi.jsm.metrics.TestResults;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@RunWith(JUnit4.class)
public class NPMTest {
private TestFrontend testFrontend = null;
@Before
public void setUp() throws Exception {
testFrontend = new TestFrontend("nl.rug.jbi.jsm.metrics.ckjm.npm.", new NPM());
}
@Test
public void testAllPublic() throws ExecutionException {
final Set<String> targetClasses = ImmutableSet.of(
"AllPublic"
);
final TestResults results = Uninterruptibles.getUninterruptibly(this.testFrontend.executeTest(targetClasses));
assertTrue(results.hasResults(MetricScope.CLASS, "nl.rug.jbi.jsm.metrics.ckjm.npm.AllPublic", NPM.class));
final double result = results.getDoubleResult(
MetricScope.CLASS,
"nl.rug.jbi.jsm.metrics.ckjm.npm.AllPublic",
NPM.class
);
//3 methods + constructor
assertEquals(4.0, result, 0.001);
}
@Test
public void testNotAllPublic() throws ExecutionException {
final Set<String> targetClasses = ImmutableSet.of(
"NotAllPublic"
);
final TestResults results = Uninterruptibles.getUninterruptibly(this.testFrontend.executeTest(targetClasses));
assertTrue(results.hasResults(MetricScope.CLASS, "nl.rug.jbi.jsm.metrics.ckjm.npm.NotAllPublic", NPM.class));
final double result = results.getDoubleResult(
MetricScope.CLASS,
"nl.rug.jbi.jsm.metrics.ckjm.npm.NotAllPublic",
NPM.class
);
//2 methods public, 2 methods + constructor private
assertEquals(2.0, result, 0.001);
}
@Test
public void testNoMethods() throws ExecutionException {
final Set<String> targetClasses = ImmutableSet.of(
"NoMethods"
);
final TestResults results = Uninterruptibles.getUninterruptibly(this.testFrontend.executeTest(targetClasses));
assertTrue(results.hasResults(MetricScope.CLASS, "nl.rug.jbi.jsm.metrics.ckjm.npm.NoMethods", NPM.class));
final double result = results.getDoubleResult(
MetricScope.CLASS,
"nl.rug.jbi.jsm.metrics.ckjm.npm.NoMethods",
NPM.class
);
//empty class, but implicit public constructor
assertEquals(1.0, result, 0.001);
}
}
|
UTF-8
|
Java
| 2,890 |
java
|
NPMTest.java
|
Java
|
[] | null |
[] |
package nl.rug.jbi.jsm.metrics.ckjm;
import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.Uninterruptibles;
import nl.rug.jbi.jsm.core.calculator.MetricScope;
import nl.rug.jbi.jsm.metrics.TestFrontend;
import nl.rug.jbi.jsm.metrics.TestResults;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@RunWith(JUnit4.class)
public class NPMTest {
private TestFrontend testFrontend = null;
@Before
public void setUp() throws Exception {
testFrontend = new TestFrontend("nl.rug.jbi.jsm.metrics.ckjm.npm.", new NPM());
}
@Test
public void testAllPublic() throws ExecutionException {
final Set<String> targetClasses = ImmutableSet.of(
"AllPublic"
);
final TestResults results = Uninterruptibles.getUninterruptibly(this.testFrontend.executeTest(targetClasses));
assertTrue(results.hasResults(MetricScope.CLASS, "nl.rug.jbi.jsm.metrics.ckjm.npm.AllPublic", NPM.class));
final double result = results.getDoubleResult(
MetricScope.CLASS,
"nl.rug.jbi.jsm.metrics.ckjm.npm.AllPublic",
NPM.class
);
//3 methods + constructor
assertEquals(4.0, result, 0.001);
}
@Test
public void testNotAllPublic() throws ExecutionException {
final Set<String> targetClasses = ImmutableSet.of(
"NotAllPublic"
);
final TestResults results = Uninterruptibles.getUninterruptibly(this.testFrontend.executeTest(targetClasses));
assertTrue(results.hasResults(MetricScope.CLASS, "nl.rug.jbi.jsm.metrics.ckjm.npm.NotAllPublic", NPM.class));
final double result = results.getDoubleResult(
MetricScope.CLASS,
"nl.rug.jbi.jsm.metrics.ckjm.npm.NotAllPublic",
NPM.class
);
//2 methods public, 2 methods + constructor private
assertEquals(2.0, result, 0.001);
}
@Test
public void testNoMethods() throws ExecutionException {
final Set<String> targetClasses = ImmutableSet.of(
"NoMethods"
);
final TestResults results = Uninterruptibles.getUninterruptibly(this.testFrontend.executeTest(targetClasses));
assertTrue(results.hasResults(MetricScope.CLASS, "nl.rug.jbi.jsm.metrics.ckjm.npm.NoMethods", NPM.class));
final double result = results.getDoubleResult(
MetricScope.CLASS,
"nl.rug.jbi.jsm.metrics.ckjm.npm.NoMethods",
NPM.class
);
//empty class, but implicit public constructor
assertEquals(1.0, result, 0.001);
}
}
| 2,890 | 0.672664 | 0.664706 | 87 | 32.229885 | 31.779305 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.597701 | false | false |
13
|
c52fabb98c0ed567a31fc96d4fb12625477a9aca
| 2,430,951,550,450 |
cf6469862fb46a41131e55941153b68673b19aec
|
/Exercise11_01/src/MyDateTest.java
|
3dfe72ce95f90d18a7d83cff188d633d80b9f9aa
|
[] |
no_license
|
BenediktBlana/SDJ
|
https://github.com/BenediktBlana/SDJ
|
56390867ca9588d0f4ea3bbc3450bb68bdd6e581
|
ca27b56a9511140edf46c3ad88bbf55d228b7b86
|
refs/heads/master
| 2021-10-24T20:58:51.571000 | 2019-03-28T20:40:47 | 2019-03-28T20:40:47 | 103,534,240 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Scanner;
public class MyDateTest
{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int day;
int month;
int year;
System.out.println("enter day :");
day=in.nextInt();
System.out.println("enter month :");
month=in.nextInt();
System.out.println("enter year :");
year=in.nextInt();
MyDate box = new MyDate(day,month,year);
box.setYear(year);
box.setMonth(month);
box.setDay(day);
box.numberOfDaysInMonth();
System.out.println("date is "
+ "" + box.toString());
System.out.println(box.isLeapYear());
System.out.println("number of days in month :" + box.numberOfDaysInMonth());
box.setYear(year);
}
}
|
UTF-8
|
Java
| 821 |
java
|
MyDateTest.java
|
Java
|
[] | null |
[] |
import java.util.Scanner;
public class MyDateTest
{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int day;
int month;
int year;
System.out.println("enter day :");
day=in.nextInt();
System.out.println("enter month :");
month=in.nextInt();
System.out.println("enter year :");
year=in.nextInt();
MyDate box = new MyDate(day,month,year);
box.setYear(year);
box.setMonth(month);
box.setDay(day);
box.numberOfDaysInMonth();
System.out.println("date is "
+ "" + box.toString());
System.out.println(box.isLeapYear());
System.out.println("number of days in month :" + box.numberOfDaysInMonth());
box.setYear(year);
}
}
| 821 | 0.56151 | 0.56151 | 30 | 25.299999 | 17.855251 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.733333 | false | false |
13
|
4aca3de525b81555ece0a9ce2625c62a3d570f47
| 1,932,735,340,724 |
c5fc686a5b45410efdd6689dea9bb4f6bc8567fc
|
/core/src/main/java/com/hcl/ecomm/core/services/impl/ProductServiceImpl.java
|
b268e5824f4e06135cea47d00d06980630dfc55d
|
[] |
no_license
|
ShubhamGarg-AEM/HCL-ecommerce
|
https://github.com/ShubhamGarg-AEM/HCL-ecommerce
|
e74d0f5ffa2d4b41bbecbf603d0e00885653aae5
|
a360c826bd966a3b97b6ab85f9fe16fb6b8d7e16
|
refs/heads/master
| 2022-11-24T23:21:20.378000 | 2020-04-16T07:45:25 | 2020-04-16T07:45:25 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hcl.ecomm.core.services.impl;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.metatype.annotations.Designate;
import com.hcl.ecomm.core.config.ProductServiceConfig;
import com.hcl.ecomm.core.services.ProductService;
@Component(
immediate=true,
enabled=true,
service=ProductService.class
)
@Designate(ocd=ProductServiceConfig.class)
public class ProductServiceImpl implements ProductService{
private ProductServiceConfig config;
@Activate
protected void activate(ProductServiceConfig config){
this.config=config;
}
@Override
public String getDomainName() {
return config.productService_domainName();
}
@Override
public String getServicePath() {
// TODO Auto-generated method stub
return config.productService_servicePath();
}
@Override
public String getSearchCriteriaField() {
// TODO Auto-generated method stub
return config.productService_searchCriteriaField();
}
@Override
public String getSearchCriteriaValue() {
// TODO Auto-generated method stub
return config.productService_searchCriteriaValue();
}
}
|
UTF-8
|
Java
| 1,160 |
java
|
ProductServiceImpl.java
|
Java
|
[] | null |
[] |
package com.hcl.ecomm.core.services.impl;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.metatype.annotations.Designate;
import com.hcl.ecomm.core.config.ProductServiceConfig;
import com.hcl.ecomm.core.services.ProductService;
@Component(
immediate=true,
enabled=true,
service=ProductService.class
)
@Designate(ocd=ProductServiceConfig.class)
public class ProductServiceImpl implements ProductService{
private ProductServiceConfig config;
@Activate
protected void activate(ProductServiceConfig config){
this.config=config;
}
@Override
public String getDomainName() {
return config.productService_domainName();
}
@Override
public String getServicePath() {
// TODO Auto-generated method stub
return config.productService_servicePath();
}
@Override
public String getSearchCriteriaField() {
// TODO Auto-generated method stub
return config.productService_searchCriteriaField();
}
@Override
public String getSearchCriteriaValue() {
// TODO Auto-generated method stub
return config.productService_searchCriteriaValue();
}
}
| 1,160 | 0.790517 | 0.790517 | 48 | 23.166666 | 21.107201 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.166667 | false | false |
13
|
d35077cfdaa0aa40b201744c1d50ccfeb3d0c06b
| 4,389,456,631,929 |
5f7e336c73eda59d73ff5d7df9c620d042a5f56a
|
/PrasetiaDataCenter/src/java/models/PrStatus.java
|
8a2c1d37ff144bd3749d4c3f23f01e991b237c87
|
[] |
no_license
|
junifar/MyJSF
|
https://github.com/junifar/MyJSF
|
465de757b478b52ac9527f19daa51390df143344
|
0d5f3cc2063d8ac6e25658deb87834e3d41baec9
|
refs/heads/master
| 2020-02-26T17:44:47.457000 | 2014-04-14T23:49:42 | 2014-04-14T23:49:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package models;
// Generated Mar 27, 2014 2:07:59 PM by Hibernate Tools 3.6.0
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* PrStatus generated by hbm2java
*/
@Entity
@Table(name="PR_STATUS"
,schema="dbo"
,catalog="PRST001_prod"
)
public class PrStatus implements java.io.Serializable {
private int projectId;
private Integer me;
private Integer civil;
private Integer gdl;
public PrStatus() {
}
public PrStatus(int projectId) {
this.projectId = projectId;
}
public PrStatus(int projectId, Integer me, Integer civil, Integer gdl) {
this.projectId = projectId;
this.me = me;
this.civil = civil;
this.gdl = gdl;
}
@Id
@Column(name="PROJECT_ID", unique=true, nullable=false)
public int getProjectId() {
return this.projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
@Column(name="ME")
public Integer getMe() {
return this.me;
}
public void setMe(Integer me) {
this.me = me;
}
@Column(name="CIVIL")
public Integer getCivil() {
return this.civil;
}
public void setCivil(Integer civil) {
this.civil = civil;
}
@Column(name="GDL")
public Integer getGdl() {
return this.gdl;
}
public void setGdl(Integer gdl) {
this.gdl = gdl;
}
}
|
UTF-8
|
Java
| 1,551 |
java
|
PrStatus.java
|
Java
|
[] | null |
[] |
package models;
// Generated Mar 27, 2014 2:07:59 PM by Hibernate Tools 3.6.0
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* PrStatus generated by hbm2java
*/
@Entity
@Table(name="PR_STATUS"
,schema="dbo"
,catalog="PRST001_prod"
)
public class PrStatus implements java.io.Serializable {
private int projectId;
private Integer me;
private Integer civil;
private Integer gdl;
public PrStatus() {
}
public PrStatus(int projectId) {
this.projectId = projectId;
}
public PrStatus(int projectId, Integer me, Integer civil, Integer gdl) {
this.projectId = projectId;
this.me = me;
this.civil = civil;
this.gdl = gdl;
}
@Id
@Column(name="PROJECT_ID", unique=true, nullable=false)
public int getProjectId() {
return this.projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
@Column(name="ME")
public Integer getMe() {
return this.me;
}
public void setMe(Integer me) {
this.me = me;
}
@Column(name="CIVIL")
public Integer getCivil() {
return this.civil;
}
public void setCivil(Integer civil) {
this.civil = civil;
}
@Column(name="GDL")
public Integer getGdl() {
return this.gdl;
}
public void setGdl(Integer gdl) {
this.gdl = gdl;
}
}
| 1,551 | 0.594455 | 0.58285 | 85 | 17.17647 | 16.722073 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.364706 | false | false |
13
|
1edcd92d1a2b00f42ad0b3395d46879a5f1e5544
| 11,768,210,434,254 |
5a22c8c760c5bc25c418648f0c577fda2ac4de9e
|
/src/main/java/com/opthema/twitter/controller/LikedTweetController.java
|
42e660db2aaccf2bab25b51b4a5e4681273b645c
|
[] |
no_license
|
Yasinmemic/TwitterApp
|
https://github.com/Yasinmemic/TwitterApp
|
9369843d0b9a2118a7eb87e882e47a8667ca2c97
|
764a02f4915c691eb59652747fa28e731b9369e5
|
refs/heads/master
| 2021-11-08T13:26:54.571000 | 2019-12-16T07:43:45 | 2019-12-16T07:43:45 | 223,633,693 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.opthema.twitter.controller;
import com.opthema.twitter.entity.LikedTweet;
import com.opthema.twitter.entity.Tweet;
import com.opthema.twitter.entity.Users;
import com.opthema.twitter.service.IFollowingService;
import com.opthema.twitter.service.ILikedTweetService;
import com.opthema.twitter.service.ITweetService;
import com.opthema.twitter.service.IUserService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class LikedTweetController {
ILikedTweetService likedTweetService;
ITweetService tweetService;
IUserService userService;
IFollowingService followingService;
public LikedTweetController(ILikedTweetService likedTweetService, ITweetService tweetService, IUserService userService, IFollowingService followingService) {
this.likedTweetService = likedTweetService;
this.tweetService = tweetService;
this.userService = userService;
this.followingService = followingService;
}
@RequestMapping(method = RequestMethod.POST, value = "/users/{followerId}/liked/{followedId}/tweets/{tweetId}")
public void likeTweet(@PathVariable("followerId") Long followerId, @PathVariable("followedId") Long followedId, @PathVariable("tweetId") Long tweetId){
Users follower = userService.getUser(followerId);
Tweet tweet = tweetService.getTweet(tweetId);
LikedTweet likedTweet = likedTweetService.getLikedTweet(followerId,tweetId);
if(likedTweet == null){
tweet.setLikedCount(tweet.getLikedCount()+1);
likedTweetService.likeTweet(follower,tweet);
}
else{
tweet.setLikedCount(tweet.getLikedCount()-1);
likedTweetService.unLike(tweet,followerId,tweetId);
}
}
}
|
UTF-8
|
Java
| 1,960 |
java
|
LikedTweetController.java
|
Java
|
[] | null |
[] |
package com.opthema.twitter.controller;
import com.opthema.twitter.entity.LikedTweet;
import com.opthema.twitter.entity.Tweet;
import com.opthema.twitter.entity.Users;
import com.opthema.twitter.service.IFollowingService;
import com.opthema.twitter.service.ILikedTweetService;
import com.opthema.twitter.service.ITweetService;
import com.opthema.twitter.service.IUserService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class LikedTweetController {
ILikedTweetService likedTweetService;
ITweetService tweetService;
IUserService userService;
IFollowingService followingService;
public LikedTweetController(ILikedTweetService likedTweetService, ITweetService tweetService, IUserService userService, IFollowingService followingService) {
this.likedTweetService = likedTweetService;
this.tweetService = tweetService;
this.userService = userService;
this.followingService = followingService;
}
@RequestMapping(method = RequestMethod.POST, value = "/users/{followerId}/liked/{followedId}/tweets/{tweetId}")
public void likeTweet(@PathVariable("followerId") Long followerId, @PathVariable("followedId") Long followedId, @PathVariable("tweetId") Long tweetId){
Users follower = userService.getUser(followerId);
Tweet tweet = tweetService.getTweet(tweetId);
LikedTweet likedTweet = likedTweetService.getLikedTweet(followerId,tweetId);
if(likedTweet == null){
tweet.setLikedCount(tweet.getLikedCount()+1);
likedTweetService.likeTweet(follower,tweet);
}
else{
tweet.setLikedCount(tweet.getLikedCount()-1);
likedTweetService.unLike(tweet,followerId,tweetId);
}
}
}
| 1,960 | 0.764286 | 0.763265 | 46 | 41.608696 | 35.641621 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.804348 | false | false |
13
|
fd648660abc937ae3baa437c10e424819864215c
| 29,231,547,472,834 |
3e3f6e6ed54987d90097cbe73a3471beae52dc52
|
/finev-core/src/test/java/ro/ddanciu/test/finev/operators/TriangulationCrossoverTest.java
|
570349a6e535281539c6c12db6b2347d90dc0184
|
[] |
no_license
|
ddanciu/jevo
|
https://github.com/ddanciu/jevo
|
2673febf0441fbe8b62b05598e1ecb0fa995e573
|
e40a1e9ac34c5e3dde584fe01e3193d80acf3aa4
|
refs/heads/master
| 2020-05-20T03:30:36.207000 | 2011-06-13T18:56:03 | 2011-06-13T18:56:03 | 1,055,264 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ro.ddanciu.test.finev.operators;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
import java.util.HashSet;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import ro.ddanciu.finev.operators.TriangulationCrossover;
import ro.ddanciu.finite.elements.api.Point;
import ro.ddanciu.finite.elements.api.Triangle;
import ro.ddanciu.jevo.core.Individual;
public class TriangulationCrossoverTest {
private TriangulationCrossover operator;
@Before
public void init() {
operator = new TriangulationCrossover();
}
@Test
public void disjunct() {
Triangle t1 = new Triangle(new Point(1, 0), new Point(0, 0), new Point(0, 1));
Triangle t2 = new Triangle(new Point(2, 0), new Point(0, 2), new Point(2, 2));
Set<Triangle> origin1 = new HashSet<Triangle>();
origin1.add(t1);
Set<Triangle> origin2 = new HashSet<Triangle>();
origin2.add(t2);
Set<Set<Triangle>> actual = run(origin1, origin2);
assertNull("Disjunct crossover failed!!", actual);
}
@Test
public void simple() {
Triangle t11 = new Triangle(new Point(1, 0), new Point(0, 0), new Point(0, 1));
Triangle t12 = new Triangle(new Point(1, 0), new Point(0, 1), new Point(1, 1));
Triangle t13 = new Triangle(new Point(0, 1), new Point(0, 2), new Point(1, 1));
Triangle t21 = new Triangle(new Point(0, 0), new Point(0, 1), new Point(1, 1));
Triangle t22 = new Triangle(new Point(0, 0), new Point(1, 1), new Point(1, 0));
Triangle t23 = new Triangle(new Point(1, 0), new Point(1, 1), new Point(2, 0));
Set<Triangle> origin1 = new HashSet<Triangle>();
origin1.add(t11);
origin1.add(t12);
origin1.add(t13);
Set<Triangle> origin2 = new HashSet<Triangle>();
origin2.add(t21);
origin2.add(t22);
origin2.add(t23);
Set<Triangle> expected1 = new HashSet<Triangle>();
expected1.add(t21);
expected1.add(t22);
expected1.add(t13);
Set<Triangle> expected2 = new HashSet<Triangle>();
expected2.add(t11);
expected2.add(t12);
expected2.add(t23);
Set<Set<Triangle>> actual = run(origin1, origin2);
assertEquals("Wrong number!", 2, actual.size());
assertTrue("Bad mapping on crossover!", actual.contains(expected1));
assertTrue("Bad mapping on crossover!", actual.contains(expected2));
}
@Test
public void one() {
Set<Triangle> origin1 = new HashSet<Triangle>();
origin1.add(new Triangle(new Point(1, 0), new Point(0, 4), new Point(2, 6)));
origin1.add(new Triangle(new Point(1, 0), new Point(2, 6), new Point(3, 3)));
origin1.add(new Triangle(new Point(1, 0), new Point(3, 3), new Point(4, 1)));
origin1.add(new Triangle(new Point(4, 1), new Point(3, 3), new Point(2, 6)));
origin1.add(new Triangle(new Point(4, 1), new Point(2, 6), new Point(6, 2)));
origin1.add(new Triangle(new Point(6, 2), new Point(2, 6), new Point(5, 5)));
Set<Triangle> origin2 = new HashSet<Triangle>();
origin2.add(new Triangle(new Point(1, 0), new Point(0, 4), new Point(3, 3)));
origin2.add(new Triangle(new Point(0, 4), new Point(2, 6), new Point(3, 3)));
origin2.add(new Triangle(new Point(1, 0), new Point(3, 3), new Point(4, 1)));
origin2.add(new Triangle(new Point(3, 3), new Point(2, 6), new Point(5, 5)));
origin2.add(new Triangle(new Point(4, 1), new Point(3, 3), new Point(5, 5)));
origin2.add(new Triangle(new Point(4, 1), new Point(5, 5), new Point(6, 2)));
Set<Triangle> expected11 = new HashSet<Triangle>();
expected11.add(new Triangle(new Point(1, 0), new Point(0, 4), new Point(2, 6)));
expected11.add(new Triangle(new Point(1, 0), new Point(2, 6), new Point(3, 3)));
expected11.add(new Triangle(new Point(1, 0), new Point(3, 3), new Point(4, 1)));
expected11.add(new Triangle(new Point(3, 3), new Point(2, 6), new Point(5, 5)));
expected11.add(new Triangle(new Point(4, 1), new Point(3, 3), new Point(5, 5)));
expected11.add(new Triangle(new Point(4, 1), new Point(5, 5), new Point(6, 2)));
Set<Triangle> expected12 = new HashSet<Triangle>();
expected12.add(new Triangle(new Point(1, 0), new Point(0, 4), new Point(3, 3)));
expected12.add(new Triangle(new Point(0, 4), new Point(2, 6), new Point(3, 3)));
expected12.add(new Triangle(new Point(1, 0), new Point(3, 3), new Point(4, 1)));
expected12.add(new Triangle(new Point(4, 1), new Point(3, 3), new Point(2, 6)));
expected12.add(new Triangle(new Point(4, 1), new Point(2, 6), new Point(6, 2)));
expected12.add(new Triangle(new Point(6, 2), new Point(2, 6), new Point(5, 5)));
Set<Set<Triangle>> expected1 = new HashSet<Set<Triangle>>();
expected1.add(expected11);
expected1.add(expected12);
Set<Set<Triangle>> actual = run(origin1, origin2);
assertEquals("Crossover failed!", expected1, actual);
Set<Triangle> expected21 = new HashSet<Triangle>();
expected21.add(new Triangle(new Point(1, 0), new Point(0, 4), new Point(3, 3)));
expected21.add(new Triangle(new Point(0, 4), new Point(2, 6), new Point(3, 3)));
expected21.add(new Triangle(new Point(1, 0), new Point(3, 3), new Point(4, 1)));
expected21.add(new Triangle(new Point(4, 1), new Point(3, 3), new Point(2, 6)));
expected21.add(new Triangle(new Point(4, 1), new Point(2, 6), new Point(6, 2)));
expected21.add(new Triangle(new Point(6, 2), new Point(2, 6), new Point(5, 5)));
Set<Triangle> expected22 = new HashSet<Triangle>();
expected22.add(new Triangle(new Point(1, 0), new Point(0, 4), new Point(2, 6)));
expected22.add(new Triangle(new Point(1, 0), new Point(2, 6), new Point(3, 3)));
expected22.add(new Triangle(new Point(1, 0), new Point(3, 3), new Point(4, 1)));
expected22.add(new Triangle(new Point(3, 3), new Point(2, 6), new Point(5, 5)));
expected22.add(new Triangle(new Point(4, 1), new Point(3, 3), new Point(5, 5)));
expected22.add(new Triangle(new Point(4, 1), new Point(5, 5), new Point(6, 2)));
Set<Set<Triangle>> expected2 = new HashSet<Set<Triangle>>();
expected2.add(expected21);
expected2.add(expected22);
actual = run(origin1, origin2);
assertEquals("Crossover failed!", expected2, actual);
}
@Test
public void two() {
Set<Triangle> origin1 = new HashSet<Triangle>();
origin1.add(new Triangle(new Point(0, 2), new Point(1, 5), new Point(3, 6)));
origin1.add(new Triangle(new Point(2, 0), new Point(3, 6), new Point(4, 4)));
origin1.add(new Triangle(new Point(2, 0), new Point(0, 2), new Point(3, 6)));
Set<Triangle> origin2 = new HashSet<Triangle>();
origin2.add(new Triangle(new Point(4, 4), new Point(0, 2), new Point(1, 5)));
origin2.add(new Triangle(new Point(3, 6), new Point(4, 4), new Point(1, 5)));
origin2.add(new Triangle(new Point(4, 4), new Point(2, 0), new Point(0, 2)));
Set<Set<Triangle>> expected = new HashSet<Set<Triangle>>();
expected.add(origin1);
expected.add(origin2);
Set<Set<Triangle>> actual = run(origin1, origin2);
assertNull("Crossover failed!", actual);
}
@Test
public void three() {
Set<Triangle> origin1 = new HashSet<Triangle>();
origin1.add(new Triangle(new Point(0, 2), new Point(1, 5), new Point(3, 6)));
origin1.add(new Triangle(new Point(2, 0), new Point(0, 2), new Point(4, 4)));
origin1.add(new Triangle(new Point(0, 2), new Point(3, 6), new Point(4, 4)));
Set<Triangle> origin2 = new HashSet<Triangle>();
origin2.add(new Triangle(new Point(4, 4), new Point(0, 2), new Point(1, 5)));
origin2.add(new Triangle(new Point(3, 6), new Point(4, 4), new Point(1, 5)));
origin2.add(new Triangle(new Point(4, 4), new Point(2, 0), new Point(0, 2)));
Set<Triangle> expected1 = new HashSet<Triangle>();
expected1.add(new Triangle(new Point(0, 2), new Point(1, 5), new Point(3, 6)));
expected1.add(new Triangle(new Point(2, 0), new Point(0, 2), new Point(4, 4)));
expected1.add(new Triangle(new Point(0, 2), new Point(3, 6), new Point(4, 4)));
Set<Triangle> expected2 = new HashSet<Triangle>();
expected2.add(new Triangle(new Point(4, 4), new Point(0, 2), new Point(1, 5)));
expected2.add(new Triangle(new Point(3, 6), new Point(4, 4), new Point(1, 5)));
expected2.add(new Triangle(new Point(4, 4), new Point(2, 0), new Point(0, 2)));
Set<Set<Triangle>> expected = new HashSet<Set<Triangle>>();
expected.add(expected1);
expected.add(expected2);
Set<Set<Triangle>> actual = run(origin1, origin2);
assertEquals("Crossover failed!", expected, actual);
}
private Set<Set<Triangle>> run(Set<Triangle> origin1, Set<Triangle> origin2) {
Set<Individual<Set<Triangle>>> result = operator.operate(Individual.Factory.newInstance(origin1), Individual.Factory.newInstance(origin2));
if (result != null) {
Set<Set<Triangle>> actual = new HashSet<Set<Triangle>>();
for (Individual<Set<Triangle>> x : result) {
actual.add(x.getData());
}
return actual;
}
return null;
}
}
|
UTF-8
|
Java
| 8,879 |
java
|
TriangulationCrossoverTest.java
|
Java
|
[] | null |
[] |
package ro.ddanciu.test.finev.operators;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
import java.util.HashSet;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import ro.ddanciu.finev.operators.TriangulationCrossover;
import ro.ddanciu.finite.elements.api.Point;
import ro.ddanciu.finite.elements.api.Triangle;
import ro.ddanciu.jevo.core.Individual;
public class TriangulationCrossoverTest {
private TriangulationCrossover operator;
@Before
public void init() {
operator = new TriangulationCrossover();
}
@Test
public void disjunct() {
Triangle t1 = new Triangle(new Point(1, 0), new Point(0, 0), new Point(0, 1));
Triangle t2 = new Triangle(new Point(2, 0), new Point(0, 2), new Point(2, 2));
Set<Triangle> origin1 = new HashSet<Triangle>();
origin1.add(t1);
Set<Triangle> origin2 = new HashSet<Triangle>();
origin2.add(t2);
Set<Set<Triangle>> actual = run(origin1, origin2);
assertNull("Disjunct crossover failed!!", actual);
}
@Test
public void simple() {
Triangle t11 = new Triangle(new Point(1, 0), new Point(0, 0), new Point(0, 1));
Triangle t12 = new Triangle(new Point(1, 0), new Point(0, 1), new Point(1, 1));
Triangle t13 = new Triangle(new Point(0, 1), new Point(0, 2), new Point(1, 1));
Triangle t21 = new Triangle(new Point(0, 0), new Point(0, 1), new Point(1, 1));
Triangle t22 = new Triangle(new Point(0, 0), new Point(1, 1), new Point(1, 0));
Triangle t23 = new Triangle(new Point(1, 0), new Point(1, 1), new Point(2, 0));
Set<Triangle> origin1 = new HashSet<Triangle>();
origin1.add(t11);
origin1.add(t12);
origin1.add(t13);
Set<Triangle> origin2 = new HashSet<Triangle>();
origin2.add(t21);
origin2.add(t22);
origin2.add(t23);
Set<Triangle> expected1 = new HashSet<Triangle>();
expected1.add(t21);
expected1.add(t22);
expected1.add(t13);
Set<Triangle> expected2 = new HashSet<Triangle>();
expected2.add(t11);
expected2.add(t12);
expected2.add(t23);
Set<Set<Triangle>> actual = run(origin1, origin2);
assertEquals("Wrong number!", 2, actual.size());
assertTrue("Bad mapping on crossover!", actual.contains(expected1));
assertTrue("Bad mapping on crossover!", actual.contains(expected2));
}
@Test
public void one() {
Set<Triangle> origin1 = new HashSet<Triangle>();
origin1.add(new Triangle(new Point(1, 0), new Point(0, 4), new Point(2, 6)));
origin1.add(new Triangle(new Point(1, 0), new Point(2, 6), new Point(3, 3)));
origin1.add(new Triangle(new Point(1, 0), new Point(3, 3), new Point(4, 1)));
origin1.add(new Triangle(new Point(4, 1), new Point(3, 3), new Point(2, 6)));
origin1.add(new Triangle(new Point(4, 1), new Point(2, 6), new Point(6, 2)));
origin1.add(new Triangle(new Point(6, 2), new Point(2, 6), new Point(5, 5)));
Set<Triangle> origin2 = new HashSet<Triangle>();
origin2.add(new Triangle(new Point(1, 0), new Point(0, 4), new Point(3, 3)));
origin2.add(new Triangle(new Point(0, 4), new Point(2, 6), new Point(3, 3)));
origin2.add(new Triangle(new Point(1, 0), new Point(3, 3), new Point(4, 1)));
origin2.add(new Triangle(new Point(3, 3), new Point(2, 6), new Point(5, 5)));
origin2.add(new Triangle(new Point(4, 1), new Point(3, 3), new Point(5, 5)));
origin2.add(new Triangle(new Point(4, 1), new Point(5, 5), new Point(6, 2)));
Set<Triangle> expected11 = new HashSet<Triangle>();
expected11.add(new Triangle(new Point(1, 0), new Point(0, 4), new Point(2, 6)));
expected11.add(new Triangle(new Point(1, 0), new Point(2, 6), new Point(3, 3)));
expected11.add(new Triangle(new Point(1, 0), new Point(3, 3), new Point(4, 1)));
expected11.add(new Triangle(new Point(3, 3), new Point(2, 6), new Point(5, 5)));
expected11.add(new Triangle(new Point(4, 1), new Point(3, 3), new Point(5, 5)));
expected11.add(new Triangle(new Point(4, 1), new Point(5, 5), new Point(6, 2)));
Set<Triangle> expected12 = new HashSet<Triangle>();
expected12.add(new Triangle(new Point(1, 0), new Point(0, 4), new Point(3, 3)));
expected12.add(new Triangle(new Point(0, 4), new Point(2, 6), new Point(3, 3)));
expected12.add(new Triangle(new Point(1, 0), new Point(3, 3), new Point(4, 1)));
expected12.add(new Triangle(new Point(4, 1), new Point(3, 3), new Point(2, 6)));
expected12.add(new Triangle(new Point(4, 1), new Point(2, 6), new Point(6, 2)));
expected12.add(new Triangle(new Point(6, 2), new Point(2, 6), new Point(5, 5)));
Set<Set<Triangle>> expected1 = new HashSet<Set<Triangle>>();
expected1.add(expected11);
expected1.add(expected12);
Set<Set<Triangle>> actual = run(origin1, origin2);
assertEquals("Crossover failed!", expected1, actual);
Set<Triangle> expected21 = new HashSet<Triangle>();
expected21.add(new Triangle(new Point(1, 0), new Point(0, 4), new Point(3, 3)));
expected21.add(new Triangle(new Point(0, 4), new Point(2, 6), new Point(3, 3)));
expected21.add(new Triangle(new Point(1, 0), new Point(3, 3), new Point(4, 1)));
expected21.add(new Triangle(new Point(4, 1), new Point(3, 3), new Point(2, 6)));
expected21.add(new Triangle(new Point(4, 1), new Point(2, 6), new Point(6, 2)));
expected21.add(new Triangle(new Point(6, 2), new Point(2, 6), new Point(5, 5)));
Set<Triangle> expected22 = new HashSet<Triangle>();
expected22.add(new Triangle(new Point(1, 0), new Point(0, 4), new Point(2, 6)));
expected22.add(new Triangle(new Point(1, 0), new Point(2, 6), new Point(3, 3)));
expected22.add(new Triangle(new Point(1, 0), new Point(3, 3), new Point(4, 1)));
expected22.add(new Triangle(new Point(3, 3), new Point(2, 6), new Point(5, 5)));
expected22.add(new Triangle(new Point(4, 1), new Point(3, 3), new Point(5, 5)));
expected22.add(new Triangle(new Point(4, 1), new Point(5, 5), new Point(6, 2)));
Set<Set<Triangle>> expected2 = new HashSet<Set<Triangle>>();
expected2.add(expected21);
expected2.add(expected22);
actual = run(origin1, origin2);
assertEquals("Crossover failed!", expected2, actual);
}
@Test
public void two() {
Set<Triangle> origin1 = new HashSet<Triangle>();
origin1.add(new Triangle(new Point(0, 2), new Point(1, 5), new Point(3, 6)));
origin1.add(new Triangle(new Point(2, 0), new Point(3, 6), new Point(4, 4)));
origin1.add(new Triangle(new Point(2, 0), new Point(0, 2), new Point(3, 6)));
Set<Triangle> origin2 = new HashSet<Triangle>();
origin2.add(new Triangle(new Point(4, 4), new Point(0, 2), new Point(1, 5)));
origin2.add(new Triangle(new Point(3, 6), new Point(4, 4), new Point(1, 5)));
origin2.add(new Triangle(new Point(4, 4), new Point(2, 0), new Point(0, 2)));
Set<Set<Triangle>> expected = new HashSet<Set<Triangle>>();
expected.add(origin1);
expected.add(origin2);
Set<Set<Triangle>> actual = run(origin1, origin2);
assertNull("Crossover failed!", actual);
}
@Test
public void three() {
Set<Triangle> origin1 = new HashSet<Triangle>();
origin1.add(new Triangle(new Point(0, 2), new Point(1, 5), new Point(3, 6)));
origin1.add(new Triangle(new Point(2, 0), new Point(0, 2), new Point(4, 4)));
origin1.add(new Triangle(new Point(0, 2), new Point(3, 6), new Point(4, 4)));
Set<Triangle> origin2 = new HashSet<Triangle>();
origin2.add(new Triangle(new Point(4, 4), new Point(0, 2), new Point(1, 5)));
origin2.add(new Triangle(new Point(3, 6), new Point(4, 4), new Point(1, 5)));
origin2.add(new Triangle(new Point(4, 4), new Point(2, 0), new Point(0, 2)));
Set<Triangle> expected1 = new HashSet<Triangle>();
expected1.add(new Triangle(new Point(0, 2), new Point(1, 5), new Point(3, 6)));
expected1.add(new Triangle(new Point(2, 0), new Point(0, 2), new Point(4, 4)));
expected1.add(new Triangle(new Point(0, 2), new Point(3, 6), new Point(4, 4)));
Set<Triangle> expected2 = new HashSet<Triangle>();
expected2.add(new Triangle(new Point(4, 4), new Point(0, 2), new Point(1, 5)));
expected2.add(new Triangle(new Point(3, 6), new Point(4, 4), new Point(1, 5)));
expected2.add(new Triangle(new Point(4, 4), new Point(2, 0), new Point(0, 2)));
Set<Set<Triangle>> expected = new HashSet<Set<Triangle>>();
expected.add(expected1);
expected.add(expected2);
Set<Set<Triangle>> actual = run(origin1, origin2);
assertEquals("Crossover failed!", expected, actual);
}
private Set<Set<Triangle>> run(Set<Triangle> origin1, Set<Triangle> origin2) {
Set<Individual<Set<Triangle>>> result = operator.operate(Individual.Factory.newInstance(origin1), Individual.Factory.newInstance(origin2));
if (result != null) {
Set<Set<Triangle>> actual = new HashSet<Set<Triangle>>();
for (Individual<Set<Triangle>> x : result) {
actual.add(x.getData());
}
return actual;
}
return null;
}
}
| 8,879 | 0.666066 | 0.602433 | 224 | 38.638393 | 32.994026 | 141 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.705357 | false | false |
13
|
53412119509a5bc3e6ae26c2c36b06c13a8b62ee
| 5,866,925,375,249 |
294cb4094b5ae472f466b1c0f81b26bd56365821
|
/src/main/java/com/citybank/webapp/cbtags/MaskTagHandler.java
|
f2f9de8d6dd074fb528b783de3fdfbd11eb86cbe
|
[] |
no_license
|
saifalam/reserveWeb
|
https://github.com/saifalam/reserveWeb
|
163a61b7de4ec402a4d45afb935b8a7e3d4f5a0c
|
f86052cc6e6094e15ac750560a081e7a9aeb3c73
|
refs/heads/master
| 2020-05-19T11:53:13.265000 | 2015-07-09T19:35:55 | 2015-07-09T19:35:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.citybank.webapp.cbtags;
import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import java.io.IOException;
/**
* Created by Mizan on 8/29/2014.
*/
public class MaskTagHandler extends TagSupport {
private String input;
@Override
public int doStartTag() throws JspException {
//return super.doStartTag();
try {
input = (String) ExpressionEvaluatorManager.evaluate(
"map", // attribute name
input, // expression
String.class, // expected type
this, // this tag handler
pageContext); // the page context
if(input == null || input.isEmpty() || input.length()<4) {
return SKIP_BODY;
}
//Get the writer object for output.
JspWriter out = pageContext.getOut();
//Perform substr operation on string.
//input = input.subSequence(0,2)+input.substring(3,input.length()-3).replaceAll("(?s).", "*") +input.substring(input.length()-3);
out.println(input);
} catch (Exception e){
//e.printStackTrace();
}
return SKIP_BODY;
}
public String getInput() {
return input;
}
public void setInput(String input) {
this.input = input;
}
}
|
UTF-8
|
Java
| 1,548 |
java
|
MaskTagHandler.java
|
Java
|
[
{
"context": "rt;\nimport java.io.IOException;\n\n/**\n * Created by Mizan on 8/29/2014.\n */\npublic class MaskTagHandler",
"end": 281,
"score": 0.7355338335037231,
"start": 280,
"tag": "NAME",
"value": "M"
},
{
"context": ";\nimport java.io.IOException;\n\n/**\n * Created by Mizan on 8/29/2014.\n */\npublic class MaskTagHandler ext",
"end": 285,
"score": 0.5375944375991821,
"start": 281,
"tag": "USERNAME",
"value": "izan"
}
] | null |
[] |
package com.citybank.webapp.cbtags;
import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import java.io.IOException;
/**
* Created by Mizan on 8/29/2014.
*/
public class MaskTagHandler extends TagSupport {
private String input;
@Override
public int doStartTag() throws JspException {
//return super.doStartTag();
try {
input = (String) ExpressionEvaluatorManager.evaluate(
"map", // attribute name
input, // expression
String.class, // expected type
this, // this tag handler
pageContext); // the page context
if(input == null || input.isEmpty() || input.length()<4) {
return SKIP_BODY;
}
//Get the writer object for output.
JspWriter out = pageContext.getOut();
//Perform substr operation on string.
//input = input.subSequence(0,2)+input.substring(3,input.length()-3).replaceAll("(?s).", "*") +input.substring(input.length()-3);
out.println(input);
} catch (Exception e){
//e.printStackTrace();
}
return SKIP_BODY;
}
public String getInput() {
return input;
}
public void setInput(String input) {
this.input = input;
}
}
| 1,548 | 0.562016 | 0.553618 | 57 | 26.157894 | 27.223434 | 141 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.491228 | false | false |
13
|
47be717060c314576cda078fda2a0e166523d85b
| 22,162,031,300,805 |
9ebc674a8b115764d37cf796b23a65c793ca70c8
|
/src/main/java/com/ruyicai/jclq/sevice/UserService.java
|
a13e712cfe1c6fefb2bb144530cb0493232f0ead
|
[] |
no_license
|
omusico/jclq-web
|
https://github.com/omusico/jclq-web
|
8107768b24dae5cb170c300c37b25711f4c4a097
|
416a0e2bcb2395f86199713e3de3c619070befc0
|
refs/heads/master
| 2021-01-18T06:13:13.186000 | 2013-04-19T08:18:47 | 2013-04-19T08:18:47 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ruyicai.jclq.sevice;
import org.springframework.stereotype.Component;
@Component
public class UserService {
public boolean bindTuserinfo(String name,String pass) {
if("aa".equals(name)&&"aa".equals(pass)){
return true;
}
else{
return false;
}
}
}
|
UTF-8
|
Java
| 289 |
java
|
UserService.java
|
Java
|
[] | null |
[] |
package com.ruyicai.jclq.sevice;
import org.springframework.stereotype.Component;
@Component
public class UserService {
public boolean bindTuserinfo(String name,String pass) {
if("aa".equals(name)&&"aa".equals(pass)){
return true;
}
else{
return false;
}
}
}
| 289 | 0.685121 | 0.685121 | 21 | 12.761905 | 17.383366 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.238095 | false | false |
13
|
419de880e710f16b0bdf1ccb09f5e5971fda9950
| 27,058,294,017,485 |
d2250fc1c54876681ec5db5b38d8f93bd179968c
|
/app/src/main/java/com/cyl/musiclake/musicApi/PlaylistInfo.java
|
e683090974f9880e43c377044feb424ecfa5e3d4
|
[
"Apache-2.0"
] |
permissive
|
chubang122/MusicLake
|
https://github.com/chubang122/MusicLake
|
6b6299f30fe8144d148764780b89b30f2b87fe84
|
d2bad6292518f5bddb298358ef17f184464c99b8
|
refs/heads/master
| 2020-03-25T21:02:53.711000 | 2018-05-17T18:18:54 | 2018-05-17T18:18:54 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cyl.musiclake.musicApi;
import com.google.gson.annotations.SerializedName;
/**
* Created by master on 2018/4/5.
*/
public class PlaylistInfo {
@SerializedName("name")
String name;
public PlaylistInfo(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
|
UTF-8
|
Java
| 410 |
java
|
PlaylistInfo.java
|
Java
|
[
{
"context": "son.annotations.SerializedName;\n\n/**\n * Created by master on 2018/4/5.\n */\n\npublic class PlaylistInfo {\n\n ",
"end": 113,
"score": 0.9958786964416504,
"start": 107,
"tag": "USERNAME",
"value": "master"
}
] | null |
[] |
package com.cyl.musiclake.musicApi;
import com.google.gson.annotations.SerializedName;
/**
* Created by master on 2018/4/5.
*/
public class PlaylistInfo {
@SerializedName("name")
String name;
public PlaylistInfo(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| 410 | 0.62439 | 0.609756 | 25 | 15.4 | 15.584608 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.24 | false | false |
13
|
d1382e0234e84b7545aa1def20a0d234a4bcf36f
| 23,081,154,304,222 |
779fd00a67956f4b4a52d3be86f407461b9ef364
|
/Day13/Day13/src/cn/tedu/collection/ListDemo.java
|
b50a95ff72e2b16e5ce331119601512aee938176
|
[] |
no_license
|
DGHxj/JavaBasic
|
https://github.com/DGHxj/JavaBasic
|
33eaffabc6beb681be9306aaacfac39bb6e5e5a4
|
e6d69e21479dd62c83e9609b249fd159c42d75f9
|
refs/heads/master
| 2020-04-01T09:49:00.450000 | 2018-10-15T09:58:39 | 2018-10-15T09:58:39 | 153,090,824 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.tedu.collection;
import java.util.ArrayList;
import java.util.List;
public class ListDemo {
public static void main(String[] args) {
List<String> list = new ArrayList<String>();
// 保证元素的存入顺序
list.add("bdd");
list.add("abd");
list.add("egd");
list.add("eds");
list.add("abd");
list.add(null);
// 截取子列表
System.out.println(list.subList(1, 3));
// 获取指定的元素在列表中第一次出现的位置
// System.out.println(list.indexOf("abd"));
// List<String> list2 = new ArrayList<String>();
// list2.add(new String("bdd"));
// list2.add("abd");
// list2.add("egd");
// list2.add("eds");
// 比较两个列表的时候是逐位比较是否一致
// System.out.println(list.equals(list2));
// for(int i = 0; i < list.size(); i++)
// System.out.println(list.get(i));
// 获取指定下标上的元素
// System.out.println(list.get(1));
// 向列表的指定的下标插入指定的元素
// list.add(1,"fec");
// list.add(4, "fec");
// list.add(6, "fec");
// 移除指定下标上的元素
// list.remove(0);
// list.remove(5);
// 替换指定位置上的元素
// list.remove(2);
// list.add(2, "abc");
// list.set(2, "abc");
System.out.println(list);
}
}
|
GB18030
|
Java
| 1,286 |
java
|
ListDemo.java
|
Java
|
[] | null |
[] |
package cn.tedu.collection;
import java.util.ArrayList;
import java.util.List;
public class ListDemo {
public static void main(String[] args) {
List<String> list = new ArrayList<String>();
// 保证元素的存入顺序
list.add("bdd");
list.add("abd");
list.add("egd");
list.add("eds");
list.add("abd");
list.add(null);
// 截取子列表
System.out.println(list.subList(1, 3));
// 获取指定的元素在列表中第一次出现的位置
// System.out.println(list.indexOf("abd"));
// List<String> list2 = new ArrayList<String>();
// list2.add(new String("bdd"));
// list2.add("abd");
// list2.add("egd");
// list2.add("eds");
// 比较两个列表的时候是逐位比较是否一致
// System.out.println(list.equals(list2));
// for(int i = 0; i < list.size(); i++)
// System.out.println(list.get(i));
// 获取指定下标上的元素
// System.out.println(list.get(1));
// 向列表的指定的下标插入指定的元素
// list.add(1,"fec");
// list.add(4, "fec");
// list.add(6, "fec");
// 移除指定下标上的元素
// list.remove(0);
// list.remove(5);
// 替换指定位置上的元素
// list.remove(2);
// list.add(2, "abc");
// list.set(2, "abc");
System.out.println(list);
}
}
| 1,286 | 0.597985 | 0.581502 | 58 | 17.827587 | 14.501056 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.87931 | false | false |
13
|
bc9f76f49670a7c53604cdf8985bddca8f7d40af
| 22,325,240,060,075 |
6bb5207a95d6ea8ef25bb4d243155230ed18251b
|
/ParseScheduleBot/src/main/java/bot/commands/ReloadLinkCommand.java
|
44243fb916787e06d5438d36163602c49c8be2f5
|
[] |
no_license
|
vladrus13/ParseScheduleBot
|
https://github.com/vladrus13/ParseScheduleBot
|
77d5f7345a8cd6e9bd4cdabfaa12c448c87e754a
|
745bbaf9fa706961c1edc4b0428251d27c024964
|
refs/heads/main
| 2023-03-06T23:36:24.625000 | 2021-02-24T14:55:52 | 2021-02-24T14:55:52 | 341,926,776 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package bot.commands;
import bean.User;
import bot.ParseScheduleBot;
import holder.MainTableHolder;
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
import org.telegram.telegrambots.meta.api.objects.Update;
import utils.Writer;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
public class ReloadLinkCommand extends Command {
private final Logger logger = Logger.getLogger(ReloadLinkCommand.class.getName());
@Override
public void run(SendMessage sendMessage, Update update, ParseScheduleBot parseScheduleBot) {
User user;
try {
user = parseScheduleBot.getUserService().findOrCreate(update.getMessage().getChatId());
} catch (Exception e) {
sendMessage.setText("Can't create you!");
Writer.printStackTrace(logger, e);
return;
}
MainTableHolder.reload(user.getGroup());
sendMessage.setText("Successful reload!");
}
final ArrayList<String> command = new ArrayList<>(List.of("/reloadLink"));
@Override
public ArrayList<String> getCommand() {
return command;
}
@Override
public String getHelp() {
return "/reloadLink - если вы староста, и изменили табличку со ссылками";
}
}
|
UTF-8
|
Java
| 1,330 |
java
|
ReloadLinkCommand.java
|
Java
|
[] | null |
[] |
package bot.commands;
import bean.User;
import bot.ParseScheduleBot;
import holder.MainTableHolder;
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
import org.telegram.telegrambots.meta.api.objects.Update;
import utils.Writer;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
public class ReloadLinkCommand extends Command {
private final Logger logger = Logger.getLogger(ReloadLinkCommand.class.getName());
@Override
public void run(SendMessage sendMessage, Update update, ParseScheduleBot parseScheduleBot) {
User user;
try {
user = parseScheduleBot.getUserService().findOrCreate(update.getMessage().getChatId());
} catch (Exception e) {
sendMessage.setText("Can't create you!");
Writer.printStackTrace(logger, e);
return;
}
MainTableHolder.reload(user.getGroup());
sendMessage.setText("Successful reload!");
}
final ArrayList<String> command = new ArrayList<>(List.of("/reloadLink"));
@Override
public ArrayList<String> getCommand() {
return command;
}
@Override
public String getHelp() {
return "/reloadLink - если вы староста, и изменили табличку со ссылками";
}
}
| 1,330 | 0.692785 | 0.692785 | 43 | 28.976744 | 27.90056 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.581395 | false | false |
13
|
9dd307710a2a58225a5ed2f3ddd1bc2ba7eebcf8
| 3,032,246,965,637 |
397871dbec46f5a227c4540368b2b5add6737a35
|
/app/src/main/java/com/fernanda/listauamazc/MainActivity.java
|
0d9c6523ac19670da98099fa162c989d672740d5
|
[] |
no_license
|
Fili21PM/ListaUAMAZC
|
https://github.com/Fili21PM/ListaUAMAZC
|
c65f0c87d089a835bfbdb8b05e91a5b33826d7f0
|
ef2effba279a4c6b6af5eebb14576b0e1af78416
|
refs/heads/master
| 2021-01-19T09:54:31.941000 | 2015-09-10T22:57:27 | 2015-09-10T22:57:27 | 42,275,044 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.fernanda.listauamazc;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
//Declaro mi lista
ListView lv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Relleno mi arreglo
Octocats octocats_datos[]= new Octocats[]{
new Octocats(R.mipmap.ic_bouncer,"Bouncer"),
new Octocats(R.mipmap.ic_dodger, "Dodger"),
new Octocats(R.mipmap.ic_female, "Female"),
new Octocats(R.mipmap.ic_filmtocat, "Filmtocat"),
new Octocats(R.mipmap.ic_gracehoper, "GraceHoperCat"),
new Octocats(R.mipmap.ic_ninja, "NinjaCat"),
new Octocats(R.mipmap.ic_pusheen,"PusheenCat"),
new Octocats(R.mipmap.ic_rainbow, "RainbowCat")
};
//Al adaptador le paso el contenido del arreglo lleno
OctocatsAdapter adapter = new OctocatsAdapter(this,R.layout.listview_item_row,octocats_datos);
//Me traigo mi lista y la enlazo con su vista, ademas le asigno su adaptador lleno
lv = (ListView) findViewById(R.id.lv);
lv.setAdapter(adapter);
//Escucho los eventos en los items (elementos de la lista)
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?>arg0, View arg1, int arg2, long arg3) {
TextView v = (TextView)arg1.findViewById(R.id.tv);
Toast.makeText(getApplicationContext(),v.getText(),Toast.LENGTH_SHORT).show();
switch (v.getText().toString()){
case "Bouncer":
Intent i=new Intent(getApplicationContext(),activity1.class);
startActivity(i);
break;
case "Dodger":
Intent o=new Intent(getApplicationContext(),activity2.class);
startActivity(o);
break;
case "Female":
Intent h=new Intent(getApplicationContext(),activity3.class);
startActivity(h);
break;
case "Filmtocat":
Intent j=new Intent(getApplicationContext(),activity4.class);
startActivity(j);
break;
case "GraceHoperCat":
Intent k=new Intent(getApplicationContext(),activity5.class);
startActivity(k);
break;
case "NinjaCat":
Intent l=new Intent(getApplicationContext(),activity6.class);
startActivity(l);
break;
case "PusheenCat":
Intent m = new Intent(getApplicationContext(),activity7.class);
startActivity(m);
break;
case "RainbowCat":
Intent n =new Intent(getApplicationContext(),activity8.class);
startActivity(n);
break;
}
}
});
}
@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_main, menu);
return true;
}
@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) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
|
UTF-8
|
Java
| 4,342 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.fernanda.listauamazc;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
//Declaro mi lista
ListView lv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Relleno mi arreglo
Octocats octocats_datos[]= new Octocats[]{
new Octocats(R.mipmap.ic_bouncer,"Bouncer"),
new Octocats(R.mipmap.ic_dodger, "Dodger"),
new Octocats(R.mipmap.ic_female, "Female"),
new Octocats(R.mipmap.ic_filmtocat, "Filmtocat"),
new Octocats(R.mipmap.ic_gracehoper, "GraceHoperCat"),
new Octocats(R.mipmap.ic_ninja, "NinjaCat"),
new Octocats(R.mipmap.ic_pusheen,"PusheenCat"),
new Octocats(R.mipmap.ic_rainbow, "RainbowCat")
};
//Al adaptador le paso el contenido del arreglo lleno
OctocatsAdapter adapter = new OctocatsAdapter(this,R.layout.listview_item_row,octocats_datos);
//Me traigo mi lista y la enlazo con su vista, ademas le asigno su adaptador lleno
lv = (ListView) findViewById(R.id.lv);
lv.setAdapter(adapter);
//Escucho los eventos en los items (elementos de la lista)
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?>arg0, View arg1, int arg2, long arg3) {
TextView v = (TextView)arg1.findViewById(R.id.tv);
Toast.makeText(getApplicationContext(),v.getText(),Toast.LENGTH_SHORT).show();
switch (v.getText().toString()){
case "Bouncer":
Intent i=new Intent(getApplicationContext(),activity1.class);
startActivity(i);
break;
case "Dodger":
Intent o=new Intent(getApplicationContext(),activity2.class);
startActivity(o);
break;
case "Female":
Intent h=new Intent(getApplicationContext(),activity3.class);
startActivity(h);
break;
case "Filmtocat":
Intent j=new Intent(getApplicationContext(),activity4.class);
startActivity(j);
break;
case "GraceHoperCat":
Intent k=new Intent(getApplicationContext(),activity5.class);
startActivity(k);
break;
case "NinjaCat":
Intent l=new Intent(getApplicationContext(),activity6.class);
startActivity(l);
break;
case "PusheenCat":
Intent m = new Intent(getApplicationContext(),activity7.class);
startActivity(m);
break;
case "RainbowCat":
Intent n =new Intent(getApplicationContext(),activity8.class);
startActivity(n);
break;
}
}
});
}
@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_main, menu);
return true;
}
@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) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| 4,342 | 0.56748 | 0.564256 | 117 | 36.111111 | 27.269085 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.717949 | false | false |
13
|
b90229b24e615e475f151d0a3d19532622877e2f
| 12,128,987,708,719 |
24c72114f9c1536fccb97dcda4434394c198755f
|
/src/C14_2/Main.java
|
c45f3f48d100a60a4e1dd7731c0153b325ec4b99
|
[] |
no_license
|
narshaKim/data-structure
|
https://github.com/narshaKim/data-structure
|
7f9b2b9167160dea9e8c55543b9b7b2d113fc39d
|
85cbff067c480a0080cd3e485d8af0b1616c184f
|
refs/heads/master
| 2020-04-23T06:10:41.680000 | 2019-03-27T11:14:38 | 2019-03-27T11:14:38 | 170,965,003 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package C14_2;
import C14_2.DataStructure.AdjaventListGraph;
import C14_2.DataStructure.AdjaventListGraphImpl;
public class Main {
public static void main(String[] args) {
AdjaventListGraph graph = new AdjaventListGraphImpl();
graph.init(5);
graph.addEdge(0,1);
graph.addEdge(0,3);
graph.addEdge(1,2);
graph.addEdge(2,3);
graph.addEdge(3,4);
graph.addEdge(4,0);
graph.showGraphEdgeInfo();
}
}
|
UTF-8
|
Java
| 478 |
java
|
Main.java
|
Java
|
[] | null |
[] |
package C14_2;
import C14_2.DataStructure.AdjaventListGraph;
import C14_2.DataStructure.AdjaventListGraphImpl;
public class Main {
public static void main(String[] args) {
AdjaventListGraph graph = new AdjaventListGraphImpl();
graph.init(5);
graph.addEdge(0,1);
graph.addEdge(0,3);
graph.addEdge(1,2);
graph.addEdge(2,3);
graph.addEdge(3,4);
graph.addEdge(4,0);
graph.showGraphEdgeInfo();
}
}
| 478 | 0.631799 | 0.585774 | 21 | 21.761906 | 18.071037 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.857143 | false | false |
13
|
2927f4c56d84b7857c60298e470040430b55b93d
| 1,314,260,042,557 |
705239f4939634b29b5c632fb44b8245626da05b
|
/core/src/com/ntk/darkmoor/engine/gui/campwindows/DropNPCWindow.java
|
b159e265a7dcab0e62a279aa28a08b30e4f5802a
|
[] |
no_license
|
avatar21/darkmoor
|
https://github.com/avatar21/darkmoor
|
060f698d29877e8bf970de12b5245b48ccd286b4
|
79fcbc008a8cd9c52099d6a28e25da96ff4a4734
|
refs/heads/master
| 2021-05-27T12:40:25.999000 | 2015-01-22T23:41:18 | 2015-01-22T23:41:18 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ntk.darkmoor.engine.gui.campwindows;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Buttons;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.Event;
import com.badlogic.gdx.scenes.scene2d.EventListener;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.ntk.darkmoor.GameScreen;
import com.ntk.darkmoor.GameScreenBase;
import com.ntk.darkmoor.engine.CampDialog;
import com.ntk.darkmoor.engine.Hero;
import com.ntk.darkmoor.engine.gui.BaseWindow;
import com.ntk.darkmoor.engine.gui.GUI;
import com.ntk.darkmoor.engine.gui.MessageBox;
import com.ntk.darkmoor.engine.gui.MessageBox.DialogResult;
import com.ntk.darkmoor.engine.gui.MessageBox.MessageBoxButtons;
import com.ntk.darkmoor.engine.gui.ScreenButton;
import com.ntk.darkmoor.resource.Resources;
import com.ntk.darkmoor.resource.TextureSet;
public class DropNPCWindow extends BaseWindow {
private static final String WINDOW_TITLE = "Drop Character";
private TextureSet textureSetInterface;
private Color rectangleColor;
private String message;
private Hero hero;
private Skin skin;
public DropNPCWindow(CampDialog camp, GameScreenBase parent) {
super(camp, WINDOW_TITLE, parent);
if (GameScreen.getTeam().getHeroCount() <= 4) {
setClosing(true);
return;
}
textureSetInterface = Resources.loadSharedTextureSetAsset("Interface");
// Adds buttons
ScreenButton button;
button = new ScreenButton("Exit", new Rectangle(256, 244, 80, 28));
button.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
return exitSelected(event);
}
});
// getButtons().add(button);
rectangleColor = Color.WHITE;
message = "Select a character<br />from your party<br />who would like to<br />drop.";
this.skin = skin;
}
@Override
public void draw(Batch batch, float parentAlpha) {
super.draw(batch, parentAlpha);
// Display message
if (hero == null) {
GUI.getMenuFont().setColor(rectangleColor);
GUI.getMenuFont().draw(batch, message, 26, 58);
}
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 2; x++) {
Hero hero = GameScreen.getTeam().getHeroes()[y * 2 + x];
if (hero == null)
continue;
// TODO: ntk: col not used?? what does it represent?
// float col = (float) Math.sin(1.0f);
GUI.drawRectangle(new Rectangle(366 + x * 144, 2 + y * 104, 130, 104), Color.WHITE);
GUI.drawRectangle(new Rectangle(367 + x * 144, 4 + y * 104, 128, 101), Color.WHITE);
}
}
}
@Override
public void update(float delta) {
super.update(delta);
// int col = (int) (Math.Sin(time.ElapsedGameTime.Milliseconds) * 255.0f);
// RectangleColor = Color.FromArgb(255, col, col, col);
// Select a new hero
if (Gdx.input.isButtonPressed(Buttons.LEFT) && hero == null) {
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 2; x++) {
if (updateHero(y, x))
break;
}
}
}
}
/**
*
* @param y
* @param x
* @return if update was handled or should continue
*/
private boolean updateHero(int y, int x) {
Hero hero = GameScreen.getTeam().getHeroes()[y * 2 + x];
if (hero == null)
return true;
if (new Rectangle(368 + x * 144, 4 + y * 104, 126, 100).contains(Gdx.input.getX(), Gdx.input.getY())) {
this.hero = hero;
setMessageBox(new MessageBox("Are you sure you<br />wish to DROP<br />" + hero.getName() + " ?", skin,
MessageBoxButtons.YesNo));
getMessageBox().addListener(new EventListener() {
@Override
public boolean handle(Event event) {
return dropAnswer(event);
}
});
return true;
}
return false;
}
protected boolean exitSelected(Event event) {
setClosing(true);
return true;
}
protected boolean dropAnswer(Event event) {
if (((MessageBox) event.getTarget()).getDialogResult() == DialogResult.Yes) {
GameScreen.getTeam().dropHero(hero);
getCamp().exit();
}
hero = null;
return true;
}
public TextureSet getTextureSetInterface() {
return textureSetInterface;
}
public void setTextureSetInterface(TextureSet textureSetInterface) {
this.textureSetInterface = textureSetInterface;
}
public Color getRectangleColor() {
return rectangleColor;
}
public void setRectangleColor(Color rectangleColor) {
this.rectangleColor = rectangleColor;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Hero getHero() {
return hero;
}
public Skin getSkin() {
return skin;
}
public void setSkin(Skin skin) {
this.skin = skin;
}
}
|
UTF-8
|
Java
| 4,653 |
java
|
DropNPCWindow.java
|
Java
|
[] | null |
[] |
package com.ntk.darkmoor.engine.gui.campwindows;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Buttons;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.Event;
import com.badlogic.gdx.scenes.scene2d.EventListener;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.ntk.darkmoor.GameScreen;
import com.ntk.darkmoor.GameScreenBase;
import com.ntk.darkmoor.engine.CampDialog;
import com.ntk.darkmoor.engine.Hero;
import com.ntk.darkmoor.engine.gui.BaseWindow;
import com.ntk.darkmoor.engine.gui.GUI;
import com.ntk.darkmoor.engine.gui.MessageBox;
import com.ntk.darkmoor.engine.gui.MessageBox.DialogResult;
import com.ntk.darkmoor.engine.gui.MessageBox.MessageBoxButtons;
import com.ntk.darkmoor.engine.gui.ScreenButton;
import com.ntk.darkmoor.resource.Resources;
import com.ntk.darkmoor.resource.TextureSet;
public class DropNPCWindow extends BaseWindow {
private static final String WINDOW_TITLE = "Drop Character";
private TextureSet textureSetInterface;
private Color rectangleColor;
private String message;
private Hero hero;
private Skin skin;
public DropNPCWindow(CampDialog camp, GameScreenBase parent) {
super(camp, WINDOW_TITLE, parent);
if (GameScreen.getTeam().getHeroCount() <= 4) {
setClosing(true);
return;
}
textureSetInterface = Resources.loadSharedTextureSetAsset("Interface");
// Adds buttons
ScreenButton button;
button = new ScreenButton("Exit", new Rectangle(256, 244, 80, 28));
button.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
return exitSelected(event);
}
});
// getButtons().add(button);
rectangleColor = Color.WHITE;
message = "Select a character<br />from your party<br />who would like to<br />drop.";
this.skin = skin;
}
@Override
public void draw(Batch batch, float parentAlpha) {
super.draw(batch, parentAlpha);
// Display message
if (hero == null) {
GUI.getMenuFont().setColor(rectangleColor);
GUI.getMenuFont().draw(batch, message, 26, 58);
}
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 2; x++) {
Hero hero = GameScreen.getTeam().getHeroes()[y * 2 + x];
if (hero == null)
continue;
// TODO: ntk: col not used?? what does it represent?
// float col = (float) Math.sin(1.0f);
GUI.drawRectangle(new Rectangle(366 + x * 144, 2 + y * 104, 130, 104), Color.WHITE);
GUI.drawRectangle(new Rectangle(367 + x * 144, 4 + y * 104, 128, 101), Color.WHITE);
}
}
}
@Override
public void update(float delta) {
super.update(delta);
// int col = (int) (Math.Sin(time.ElapsedGameTime.Milliseconds) * 255.0f);
// RectangleColor = Color.FromArgb(255, col, col, col);
// Select a new hero
if (Gdx.input.isButtonPressed(Buttons.LEFT) && hero == null) {
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 2; x++) {
if (updateHero(y, x))
break;
}
}
}
}
/**
*
* @param y
* @param x
* @return if update was handled or should continue
*/
private boolean updateHero(int y, int x) {
Hero hero = GameScreen.getTeam().getHeroes()[y * 2 + x];
if (hero == null)
return true;
if (new Rectangle(368 + x * 144, 4 + y * 104, 126, 100).contains(Gdx.input.getX(), Gdx.input.getY())) {
this.hero = hero;
setMessageBox(new MessageBox("Are you sure you<br />wish to DROP<br />" + hero.getName() + " ?", skin,
MessageBoxButtons.YesNo));
getMessageBox().addListener(new EventListener() {
@Override
public boolean handle(Event event) {
return dropAnswer(event);
}
});
return true;
}
return false;
}
protected boolean exitSelected(Event event) {
setClosing(true);
return true;
}
protected boolean dropAnswer(Event event) {
if (((MessageBox) event.getTarget()).getDialogResult() == DialogResult.Yes) {
GameScreen.getTeam().dropHero(hero);
getCamp().exit();
}
hero = null;
return true;
}
public TextureSet getTextureSetInterface() {
return textureSetInterface;
}
public void setTextureSetInterface(TextureSet textureSetInterface) {
this.textureSetInterface = textureSetInterface;
}
public Color getRectangleColor() {
return rectangleColor;
}
public void setRectangleColor(Color rectangleColor) {
this.rectangleColor = rectangleColor;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Hero getHero() {
return hero;
}
public Skin getSkin() {
return skin;
}
public void setSkin(Skin skin) {
this.skin = skin;
}
}
| 4,653 | 0.692886 | 0.674404 | 187 | 23.882353 | 23.856457 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.02139 | false | false |
13
|
67dba48efda1ed7d52410b721edd40e877bd8631
| 25,091,199,003,765 |
4e53da16d2ef08b343a6dbb7d0c4a52452afd8a2
|
/lesson-3/src/test/java/com/workfusion/lab/lesson3/Lesson3Test.java
|
db51ef6f1893f7432e2d6c2abf79f470505c6da9
|
[] |
no_license
|
WFAutomationAcademy/ml_sdk_lessons
|
https://github.com/WFAutomationAcademy/ml_sdk_lessons
|
74dd2b9dc1064c50f7aa508d606f3c6ced97b775
|
43d3eacf2d56b81da0b6aa43ffc05baeb2de3921
|
refs/heads/master
| 2022-03-12T19:16:04.335000 | 2020-12-04T10:52:49 | 2020-12-04T10:52:49 | 142,571,932 | 0 | 3 | null | false | 2020-12-04T10:52:50 | 2018-07-27T12:02:41 | 2020-12-04T10:52:30 | 2020-12-04T10:52:50 | 277 | 0 | 2 | 0 |
HTML
| false | false |
/*
* Copyright (C) WorkFusion 2018. All rights reserved.
*/
package com.workfusion.lab.lesson3;
import java.util.List;
import org.junit.Test;
import com.workfusion.lab.lesson3.fe.Assignment1KeywordFE;
import com.workfusion.lab.lesson3.fe.Assignment2NerFE;
import com.workfusion.lab.lesson3.fe.Assignment3TableFE;
import com.workfusion.lab.lesson3.fe.Assignment4FirstInSentenceFE;
import com.workfusion.lab.lesson3.fe.Assignment5FirstInSentenceFE;
import com.workfusion.lab.model.TestTokenFeatures;
import com.workfusion.lab.utils.BaseLessonTest;
import com.workfusion.vds.sdk.api.nlp.annotation.OnDocumentComplete;
import com.workfusion.vds.sdk.api.nlp.annotation.OnDocumentStart;
import com.workfusion.vds.sdk.api.nlp.fe.Feature;
import com.workfusion.vds.sdk.api.nlp.fe.FeatureExtractor;
import com.workfusion.vds.sdk.api.nlp.model.Cell;
import com.workfusion.vds.sdk.api.nlp.model.Content;
import com.workfusion.vds.sdk.api.nlp.model.Document;
import com.workfusion.vds.sdk.api.nlp.model.Element;
import com.workfusion.vds.sdk.api.nlp.model.IeDocument;
import com.workfusion.vds.sdk.api.nlp.model.NamedEntity;
import com.workfusion.vds.sdk.api.nlp.model.Sentence;
import com.workfusion.vds.sdk.api.nlp.model.Table;
import com.workfusion.vds.sdk.api.nlp.model.Token;
import com.workfusion.vds.sdk.nlp.component.annotator.EntityBoundaryAnnotator;
import com.workfusion.vds.sdk.nlp.component.annotator.ner.AhoCorasickDictionaryNerAnnotator;
import com.workfusion.vds.sdk.nlp.component.annotator.tokenizer.MatcherTokenAnnotator;
import com.workfusion.vds.sdk.nlp.component.annotator.tokenizer.SplitterTokenAnnotator;
import com.workfusion.vds.sdk.nlp.component.dictionary.CsvDictionaryKeywordProvider;
public class Lesson3Test extends BaseLessonTest {
/**
* <p><b>Assignment 1</b></p>
* <p>
* Provide a custom implementation of {@link FeatureExtractor} that adds a {@link Feature} with name="stateFeature" for Tokens,
* whose text equals to the following worlds: Missouri, Nevada, Alaska, Hawaii, Texas, Maryland, Vermont, Kentucky,
* Massachusetts, Pennsylvania, Virginia. As a template, use {@link Assignment1KeywordFE}
* </p>
* <p>Tips:</p>
* <ul>
* <li>Use {@link Element#getText()} method to get Token text.</li>
* <li>Use {@code new Feature(FEATURE_NAME, 1.0)} to create a {@link Feature} for tokens that contain required word.
* Consider that generic type T in feature extractor is a Token.</li>
* </ul>
*/
@Test
public void assignment1() throws Exception {
// Creates ML-SDK Document to process
IeDocument document = getDocument("documents/lesson_3_assignment_1.txt");
// Process annotators
processAnnotators(document,
new MatcherTokenAnnotator("\\w+") // Add OTTB annotator that provides word based Token
);
// Process FEs
List<TestTokenFeatures> providedElementFeatures = processFeatures(document,
new Assignment1KeywordFE() //Assignment FE to check
);
// Checks the provided Features with the assignment 1 pattern
checkElementFeatures(providedElementFeatures, "lesson_3_assignment_1_check.json");
}
/**
* <p><b>Assignment 2</b></p>
* <p>
* You are provided with a pre-made Document containing a set of {@link NamedEntity} elements with NER_TYPE = "state". Each of those
* elements represents a state of the USA (Missouri, Nevada, New Mexico, etc.) and covers one or two Tokens. Your task is to create
* a Feature Extractor that searches for the mentioned Named Entity element and returns a feature with FEATURE_NAME = "stateFeature".
* As a template, use {@link Assignment2NerFE}
* </p>
* <p>Tips:</p>
* <ul>
* <li>Consider using {@link Document#findCovering(Class searchType, Element focusElement)} to search for a covering element.</li>
* </ul>
*/
@Test
public void assignment2() throws Exception {
// Creates ML-SDK Document to process
IeDocument document = getDocument("documents/lesson_3_assignment_2.txt");
// Process annotators
processAnnotators(document,
new MatcherTokenAnnotator("\\w+"), // OTTB annotator that provides word based Token
new EntityBoundaryAnnotator(), // OOTB annotator to provide EntityBoundary elements
new AhoCorasickDictionaryNerAnnotator(Assignment2NerFE.NER_TYPE,
new CsvDictionaryKeywordProvider(
getConfigurationContext().getResource("classpath:dictionary/states.csv"))
.setCsvColumnsToCollect(0)) //OOTB annotator that provides "state" NamedEntity
);
// Process FEs list
List<TestTokenFeatures> providedElementFeatures = processFeatures(document,
new Assignment2NerFE() //Assignment FE to check
);
// Checks the provided Features with the assignment 2 pattern
checkElementFeatures(providedElementFeatures, "lesson_3_assignment_2_check.json");
}
/**
* <p><b>Assignment 3</b></p>
* <p>
* Create a Feature Extractor that generates features for {@link Token} elements located inside {@link Table} elements. For every
* Token that is covered by a {@link Cell} you need to provide two Features:
* <ol>
* <li>Index of the Row where the Token is located ({@code name="rowIndex", value=<row index>})</li>
* <li>Index of the Column where the Token is located ({@code name="columnIndex", value=<column index>})</li>
* </ol>
* </p>
* <p>Tips:</p>
* <ul>
* <li>Consider using {@link Document#findCovering(Class searchClass, Element focusElement)} to search for a covering element.</li>
* <li>Use {@link Cell#getRowIndex()} to get an index of a row and {@link Cell#getColumnIndex()} to get an index of a column.</li>
* </ul>
*/
@Test
public void assignment3() throws Exception {
// Creates ML-SDK Document to process
IeDocument document = getDocument("documents/lesson_3_assignment_3.html");
// Process annotators
processAnnotators(document,
new MatcherTokenAnnotator("\\w+") // OTTB annotator that provides word based Tokens
);
// Process FEs list
List<TestTokenFeatures> providedElementFeatures = processFeatures(document,
new Assignment3TableFE() //Assignment FE to check
);
// Checks the provided Features with the assignment 2 pattern
checkElementFeatures(providedElementFeatures, "lesson_3_assignment_3_check.json");
}
/**
* <p><b>Assignment 4</b></p>
* <p>
* Create a Feature Extractor that produces a feature with FEATURE_NAME = "firstInSentenceFeature" if a Token is the first Token in
* a {@link Sentence}. As a template, use {@link Assignment4FirstInSentenceFE}.
* </p>
* <p>Tips:</p>
* <ul>
* <li>Use {@link Document#findCovering(Class searchClass, Element focusElement)} to search for covering elements
* and {@link Document#findCovered(Class searchClass, Element focusElement)} for covered elements.</li>
* <li></li>
* </ul>
*/
@Test
public void assignment4() throws Exception {
// Creates ML-SDK Document to process
IeDocument document = getDocument("documents/lesson_3_assignment_4.txt");
// Process annotators
processAnnotators(document,
new MatcherTokenAnnotator("\\w+"), //OTTB annotator that provides word based Tokens
new SplitterTokenAnnotator(Sentence.class, Content.class, "\\n") // OTTB annotator that provides new line based Sentence
);
// Process FEs
List<TestTokenFeatures> providedElementFeatures = processFeatures(document,
new Assignment4FirstInSentenceFE() //Assignment FE to check
);
// Checks the provided Features with the assignments pattern
checkElementFeatures(providedElementFeatures, "lesson_3_assignment_4_check.json");
}
/**
* <p><b>Assignment 5</b></p>
* <p>
* Improve the {@link Assignment4FirstInSentenceFE} Feature Extractor by reducing the time of the execute() method work.
* Requirements to this Feature Extractor remain the same as in Assignment 4, however, the following additional restrictions
* are added:
* <ul>
* <li>In a method annotated with {@link OnDocumentStart}, you need to cache all the Tokens that are first in their Sentences.</li>
* <li>In a method annotated with {@link OnDocumentComplete}, you need to release all the resources allocated by the Feature Extractor.</li>
* <li>Do not call any Document methods in the extract() method.</li>
* <li>Use the prepared cache to produce features.</li>
* </ul>
* </p>
* <p>Note:</p>
* <p>
* You are still allowed to use Document methods in <b>other methods</b> of your Feature Extractor.
* </p>
*/
@Test
public void assignment5() throws Exception {
// Creates ML-SDK Document to process
IeDocument document = getDocument("documents/lesson_3_assignment_5.txt");
// Process annotators
processAnnotators(document,
new MatcherTokenAnnotator("\\w+"), // OTTB annotator that provides word based Tokens
new SplitterTokenAnnotator(Sentence.class, Content.class, "\\n") // OTTB annotator that provides new line based Sentence
);
// Process FEs list
List<TestTokenFeatures> providedElementFeatures = processFeatures(document, getNotAccessibleDocument(),
new Assignment5FirstInSentenceFE()
);
// Checks the provided Features with the assignment 2 pattern
checkElementFeatures(providedElementFeatures, "lesson_3_assignment_5_check.json");
}
}
|
UTF-8
|
Java
| 10,096 |
java
|
Lesson3Test.java
|
Java
|
[] | null |
[] |
/*
* Copyright (C) WorkFusion 2018. All rights reserved.
*/
package com.workfusion.lab.lesson3;
import java.util.List;
import org.junit.Test;
import com.workfusion.lab.lesson3.fe.Assignment1KeywordFE;
import com.workfusion.lab.lesson3.fe.Assignment2NerFE;
import com.workfusion.lab.lesson3.fe.Assignment3TableFE;
import com.workfusion.lab.lesson3.fe.Assignment4FirstInSentenceFE;
import com.workfusion.lab.lesson3.fe.Assignment5FirstInSentenceFE;
import com.workfusion.lab.model.TestTokenFeatures;
import com.workfusion.lab.utils.BaseLessonTest;
import com.workfusion.vds.sdk.api.nlp.annotation.OnDocumentComplete;
import com.workfusion.vds.sdk.api.nlp.annotation.OnDocumentStart;
import com.workfusion.vds.sdk.api.nlp.fe.Feature;
import com.workfusion.vds.sdk.api.nlp.fe.FeatureExtractor;
import com.workfusion.vds.sdk.api.nlp.model.Cell;
import com.workfusion.vds.sdk.api.nlp.model.Content;
import com.workfusion.vds.sdk.api.nlp.model.Document;
import com.workfusion.vds.sdk.api.nlp.model.Element;
import com.workfusion.vds.sdk.api.nlp.model.IeDocument;
import com.workfusion.vds.sdk.api.nlp.model.NamedEntity;
import com.workfusion.vds.sdk.api.nlp.model.Sentence;
import com.workfusion.vds.sdk.api.nlp.model.Table;
import com.workfusion.vds.sdk.api.nlp.model.Token;
import com.workfusion.vds.sdk.nlp.component.annotator.EntityBoundaryAnnotator;
import com.workfusion.vds.sdk.nlp.component.annotator.ner.AhoCorasickDictionaryNerAnnotator;
import com.workfusion.vds.sdk.nlp.component.annotator.tokenizer.MatcherTokenAnnotator;
import com.workfusion.vds.sdk.nlp.component.annotator.tokenizer.SplitterTokenAnnotator;
import com.workfusion.vds.sdk.nlp.component.dictionary.CsvDictionaryKeywordProvider;
public class Lesson3Test extends BaseLessonTest {
/**
* <p><b>Assignment 1</b></p>
* <p>
* Provide a custom implementation of {@link FeatureExtractor} that adds a {@link Feature} with name="stateFeature" for Tokens,
* whose text equals to the following worlds: Missouri, Nevada, Alaska, Hawaii, Texas, Maryland, Vermont, Kentucky,
* Massachusetts, Pennsylvania, Virginia. As a template, use {@link Assignment1KeywordFE}
* </p>
* <p>Tips:</p>
* <ul>
* <li>Use {@link Element#getText()} method to get Token text.</li>
* <li>Use {@code new Feature(FEATURE_NAME, 1.0)} to create a {@link Feature} for tokens that contain required word.
* Consider that generic type T in feature extractor is a Token.</li>
* </ul>
*/
@Test
public void assignment1() throws Exception {
// Creates ML-SDK Document to process
IeDocument document = getDocument("documents/lesson_3_assignment_1.txt");
// Process annotators
processAnnotators(document,
new MatcherTokenAnnotator("\\w+") // Add OTTB annotator that provides word based Token
);
// Process FEs
List<TestTokenFeatures> providedElementFeatures = processFeatures(document,
new Assignment1KeywordFE() //Assignment FE to check
);
// Checks the provided Features with the assignment 1 pattern
checkElementFeatures(providedElementFeatures, "lesson_3_assignment_1_check.json");
}
/**
* <p><b>Assignment 2</b></p>
* <p>
* You are provided with a pre-made Document containing a set of {@link NamedEntity} elements with NER_TYPE = "state". Each of those
* elements represents a state of the USA (Missouri, Nevada, New Mexico, etc.) and covers one or two Tokens. Your task is to create
* a Feature Extractor that searches for the mentioned Named Entity element and returns a feature with FEATURE_NAME = "stateFeature".
* As a template, use {@link Assignment2NerFE}
* </p>
* <p>Tips:</p>
* <ul>
* <li>Consider using {@link Document#findCovering(Class searchType, Element focusElement)} to search for a covering element.</li>
* </ul>
*/
@Test
public void assignment2() throws Exception {
// Creates ML-SDK Document to process
IeDocument document = getDocument("documents/lesson_3_assignment_2.txt");
// Process annotators
processAnnotators(document,
new MatcherTokenAnnotator("\\w+"), // OTTB annotator that provides word based Token
new EntityBoundaryAnnotator(), // OOTB annotator to provide EntityBoundary elements
new AhoCorasickDictionaryNerAnnotator(Assignment2NerFE.NER_TYPE,
new CsvDictionaryKeywordProvider(
getConfigurationContext().getResource("classpath:dictionary/states.csv"))
.setCsvColumnsToCollect(0)) //OOTB annotator that provides "state" NamedEntity
);
// Process FEs list
List<TestTokenFeatures> providedElementFeatures = processFeatures(document,
new Assignment2NerFE() //Assignment FE to check
);
// Checks the provided Features with the assignment 2 pattern
checkElementFeatures(providedElementFeatures, "lesson_3_assignment_2_check.json");
}
/**
* <p><b>Assignment 3</b></p>
* <p>
* Create a Feature Extractor that generates features for {@link Token} elements located inside {@link Table} elements. For every
* Token that is covered by a {@link Cell} you need to provide two Features:
* <ol>
* <li>Index of the Row where the Token is located ({@code name="rowIndex", value=<row index>})</li>
* <li>Index of the Column where the Token is located ({@code name="columnIndex", value=<column index>})</li>
* </ol>
* </p>
* <p>Tips:</p>
* <ul>
* <li>Consider using {@link Document#findCovering(Class searchClass, Element focusElement)} to search for a covering element.</li>
* <li>Use {@link Cell#getRowIndex()} to get an index of a row and {@link Cell#getColumnIndex()} to get an index of a column.</li>
* </ul>
*/
@Test
public void assignment3() throws Exception {
// Creates ML-SDK Document to process
IeDocument document = getDocument("documents/lesson_3_assignment_3.html");
// Process annotators
processAnnotators(document,
new MatcherTokenAnnotator("\\w+") // OTTB annotator that provides word based Tokens
);
// Process FEs list
List<TestTokenFeatures> providedElementFeatures = processFeatures(document,
new Assignment3TableFE() //Assignment FE to check
);
// Checks the provided Features with the assignment 2 pattern
checkElementFeatures(providedElementFeatures, "lesson_3_assignment_3_check.json");
}
/**
* <p><b>Assignment 4</b></p>
* <p>
* Create a Feature Extractor that produces a feature with FEATURE_NAME = "firstInSentenceFeature" if a Token is the first Token in
* a {@link Sentence}. As a template, use {@link Assignment4FirstInSentenceFE}.
* </p>
* <p>Tips:</p>
* <ul>
* <li>Use {@link Document#findCovering(Class searchClass, Element focusElement)} to search for covering elements
* and {@link Document#findCovered(Class searchClass, Element focusElement)} for covered elements.</li>
* <li></li>
* </ul>
*/
@Test
public void assignment4() throws Exception {
// Creates ML-SDK Document to process
IeDocument document = getDocument("documents/lesson_3_assignment_4.txt");
// Process annotators
processAnnotators(document,
new MatcherTokenAnnotator("\\w+"), //OTTB annotator that provides word based Tokens
new SplitterTokenAnnotator(Sentence.class, Content.class, "\\n") // OTTB annotator that provides new line based Sentence
);
// Process FEs
List<TestTokenFeatures> providedElementFeatures = processFeatures(document,
new Assignment4FirstInSentenceFE() //Assignment FE to check
);
// Checks the provided Features with the assignments pattern
checkElementFeatures(providedElementFeatures, "lesson_3_assignment_4_check.json");
}
/**
* <p><b>Assignment 5</b></p>
* <p>
* Improve the {@link Assignment4FirstInSentenceFE} Feature Extractor by reducing the time of the execute() method work.
* Requirements to this Feature Extractor remain the same as in Assignment 4, however, the following additional restrictions
* are added:
* <ul>
* <li>In a method annotated with {@link OnDocumentStart}, you need to cache all the Tokens that are first in their Sentences.</li>
* <li>In a method annotated with {@link OnDocumentComplete}, you need to release all the resources allocated by the Feature Extractor.</li>
* <li>Do not call any Document methods in the extract() method.</li>
* <li>Use the prepared cache to produce features.</li>
* </ul>
* </p>
* <p>Note:</p>
* <p>
* You are still allowed to use Document methods in <b>other methods</b> of your Feature Extractor.
* </p>
*/
@Test
public void assignment5() throws Exception {
// Creates ML-SDK Document to process
IeDocument document = getDocument("documents/lesson_3_assignment_5.txt");
// Process annotators
processAnnotators(document,
new MatcherTokenAnnotator("\\w+"), // OTTB annotator that provides word based Tokens
new SplitterTokenAnnotator(Sentence.class, Content.class, "\\n") // OTTB annotator that provides new line based Sentence
);
// Process FEs list
List<TestTokenFeatures> providedElementFeatures = processFeatures(document, getNotAccessibleDocument(),
new Assignment5FirstInSentenceFE()
);
// Checks the provided Features with the assignment 2 pattern
checkElementFeatures(providedElementFeatures, "lesson_3_assignment_5_check.json");
}
}
| 10,096 | 0.672445 | 0.666105 | 217 | 45.529953 | 42.264366 | 152 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.465438 | false | false |
13
|
1b4cefe99b60017da8bea5c9943c35e7b0d828ac
| 7,825,430,442,728 |
731eaa0eeef92df9cc4cd4f925f7cd505fc3df1e
|
/app/src/main/java/com/odoo/work/orm/sync/OSyncUtils.java
|
29943bb0cb7b26d663a82b7283990d6ad140517d
|
[
"Apache-2.0"
] |
permissive
|
Yellllllow/odoo-work
|
https://github.com/Yellllllow/odoo-work
|
a20a79dbcaaac4bbdba7a40342fdca2d54d99926
|
02b2e0903c03480e9ed28943e52c33fe4353037c
|
refs/heads/master
| 2021-01-22T06:11:40.152000 | 2017-04-18T06:46:27 | 2017-04-18T06:46:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.odoo.work.orm.sync;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AppCompatActivity;
import com.odoo.work.R;
import com.odoo.work.orm.OModel;
public class OSyncUtils {
private Context context;
private OModel model;
private OSyncUtils(Context context, OModel model) {
this.context = context;
this.model = model;
}
public static OSyncUtils get(Context context, OModel model) {
return new OSyncUtils(context, model);
}
public static void onSyncFinishListener(AppCompatActivity activity, final OnSyncFinishListener callback) {
LocalBroadcastManager manager = LocalBroadcastManager.getInstance(activity);
manager.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getExtras().containsKey(SyncAdapter.KEY_SYNC_MODEL) && callback != null) {
callback.onSyncFinish(intent.getExtras().getString(SyncAdapter.KEY_SYNC_MODEL));
}
}
}, new IntentFilter(SyncAdapter.ACTION_SYNC_FINISH));
}
public void sync(Bundle data) {
AccountManager manager = (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
Account[] accounts = manager.getAccountsByType(context.getString(R.string.auth_type));
if (accounts.length > 0) {
Bundle settings = new Bundle();
settings.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
settings.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
settings.putString(SyncAdapter.KEY_SYNC_MODEL, model.getModelName());
if (data != null)
settings.putAll(data);
ContentResolver.requestSync(accounts[0], model.getAuthority(), settings);
}
}
public interface OnSyncFinishListener {
void onSyncFinish(String model);
}
}
|
UTF-8
|
Java
| 2,267 |
java
|
OSyncUtils.java
|
Java
|
[] | null |
[] |
package com.odoo.work.orm.sync;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AppCompatActivity;
import com.odoo.work.R;
import com.odoo.work.orm.OModel;
public class OSyncUtils {
private Context context;
private OModel model;
private OSyncUtils(Context context, OModel model) {
this.context = context;
this.model = model;
}
public static OSyncUtils get(Context context, OModel model) {
return new OSyncUtils(context, model);
}
public static void onSyncFinishListener(AppCompatActivity activity, final OnSyncFinishListener callback) {
LocalBroadcastManager manager = LocalBroadcastManager.getInstance(activity);
manager.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getExtras().containsKey(SyncAdapter.KEY_SYNC_MODEL) && callback != null) {
callback.onSyncFinish(intent.getExtras().getString(SyncAdapter.KEY_SYNC_MODEL));
}
}
}, new IntentFilter(SyncAdapter.ACTION_SYNC_FINISH));
}
public void sync(Bundle data) {
AccountManager manager = (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
Account[] accounts = manager.getAccountsByType(context.getString(R.string.auth_type));
if (accounts.length > 0) {
Bundle settings = new Bundle();
settings.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
settings.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
settings.putString(SyncAdapter.KEY_SYNC_MODEL, model.getModelName());
if (data != null)
settings.putAll(data);
ContentResolver.requestSync(accounts[0], model.getAuthority(), settings);
}
}
public interface OnSyncFinishListener {
void onSyncFinish(String model);
}
}
| 2,267 | 0.695192 | 0.693427 | 62 | 35.564518 | 30.633432 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.66129 | false | false |
13
|
e509162d0a03d85a3e9c11a252dc4f4d50f75cbc
| 7,825,430,446,400 |
23a71198b01b28f0c9729f02809ef3532b13be2a
|
/chapter01_ioc/src/com/micah/spring/dao/UserDaoImpl.java
|
0d07ff81457af160e69ed3f816f215a6a15e9f99
|
[] |
no_license
|
guagua777/spring_source_code
|
https://github.com/guagua777/spring_source_code
|
def1a8a9b6bf552ad970fa746abfaf27e4013c8e
|
946ecada1719ea235044e31dc90778178ab04d19
|
refs/heads/master
| 2023-03-26T08:41:32.996000 | 2021-03-27T05:30:41 | 2021-03-27T05:30:41 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.micah.spring.dao;
/**
* @Author m.kong
* @Date 2021/2/23 下午8:46
* @Version 1.0
*/
public class UserDaoImpl implements UserDao {
@Override
public void update() {
}
}
|
UTF-8
|
Java
| 199 |
java
|
UserDaoImpl.java
|
Java
|
[
{
"context": "package com.micah.spring.dao;\n\n/**\n * @Author m.kong\n * @Date 2021/2/23 下午8:46\n * @Version 1.0\n */\npub",
"end": 52,
"score": 0.7686798572540283,
"start": 46,
"tag": "USERNAME",
"value": "m.kong"
}
] | null |
[] |
package com.micah.spring.dao;
/**
* @Author m.kong
* @Date 2021/2/23 下午8:46
* @Version 1.0
*/
public class UserDaoImpl implements UserDao {
@Override
public void update() {
}
}
| 199 | 0.630769 | 0.569231 | 13 | 14 | 13.433598 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.076923 | false | false |
13
|
5c2bc8a6e41334f54f4563d8b82fac2692941ca2
| 22,806,276,359,902 |
2f6a770791ea758335f1f338ae0658d780943680
|
/src/main/java/cphbusiness/ufo/letterfrequencies/Main.java
|
631f07f96c7666f5974a9be64ffdd7e6a1aec462
|
[] |
no_license
|
lovrobiljeskovic/letterfrequencies
|
https://github.com/lovrobiljeskovic/letterfrequencies
|
0cab24123c752f700f1bdc1becadcd9afa3d5ebc
|
285285a6bed62185bdb5149fafe1725f6f3e13fd
|
refs/heads/master
| 2020-09-07T12:34:24.116000 | 2020-03-04T08:10:00 | 2020-03-04T08:10:00 | 220,782,310 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cphbusiness.ufo.letterfrequencies;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import static java.util.stream.Collectors.toMap;
/**
* Frequency analysis Inspired by
* https://en.wikipedia.org/wiki/Frequency_analysis
*
* @author kasper
*/
public class Main {
public static void main(String[] args) throws FileNotFoundException, IOException, URISyntaxException {
Path path = Paths.get(Main.class.getClassLoader().getResource("FoundationSeries.txt").toURI());
//String content = new String(Files.readAllBytes(path));
//Reader reader = new StringReader(content);
Map<Character, Long> freq;
for (int i = 0; i < 10_000; i++) {
long startTime = System.nanoTime();
freq = new HashMap<>();
Reader reader = new FileReader(path.toString());
tallyChars(reader, freq);
long timeElapsed = System.nanoTime() - startTime;
System.out.print(timeElapsed / 1000000 + ",");
}
}
private static void tallyChars(Reader reader, Map<Character, Long> freq) throws IOException {
int b;
long counter = 0;
Character lastChar = null;
char[] buffer = new char[4096];
while ((b = reader.read(buffer, 0, buffer.length)) != -1) {
Arrays.sort(buffer, 0, b);
for (int i = 0; i < b; i++) {
if (lastChar == null || lastChar != buffer[i]) {
if (lastChar != null) {
try {
freq.put(lastChar, freq.get(lastChar) + counter);
} catch (NullPointerException np) {
freq.put(lastChar, counter);
};
}
counter = 0;
lastChar = buffer[i];
}
counter++;
}
if (lastChar != null) {
try {
freq.put(lastChar, freq.get(lastChar) + counter);
} catch (NullPointerException np) {
freq.put(lastChar, counter);
};
}
counter = 0;
lastChar = null;
}
}
private static void print_tally(Map<Character, Long> freq) {
int dist = 'a' - 'A';
Map<Character, Long> upperAndlower = new LinkedHashMap();
for (Character c = 'A'; c <= 'Z'; c++) {
upperAndlower.put(c, freq.getOrDefault(c, 0L) + freq.getOrDefault(c + dist, 0L));
}
Map<Character, Long> sorted = upperAndlower
.entrySet()
.stream()
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
.collect(
toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2,
LinkedHashMap::new));
for (Character c : sorted.keySet()) {
System.out.println("" + c + ": " + sorted.get(c));;
}
}
}
|
UTF-8
|
Java
| 3,401 |
java
|
Main.java
|
Java
|
[
{
"context": "ikipedia.org/wiki/Frequency_analysis\n *\n * @author kasper\n */\npublic class Main {\n\n public static void m",
"end": 603,
"score": 0.911583423614502,
"start": 597,
"tag": "USERNAME",
"value": "kasper"
}
] | null |
[] |
package cphbusiness.ufo.letterfrequencies;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import static java.util.stream.Collectors.toMap;
/**
* Frequency analysis Inspired by
* https://en.wikipedia.org/wiki/Frequency_analysis
*
* @author kasper
*/
public class Main {
public static void main(String[] args) throws FileNotFoundException, IOException, URISyntaxException {
Path path = Paths.get(Main.class.getClassLoader().getResource("FoundationSeries.txt").toURI());
//String content = new String(Files.readAllBytes(path));
//Reader reader = new StringReader(content);
Map<Character, Long> freq;
for (int i = 0; i < 10_000; i++) {
long startTime = System.nanoTime();
freq = new HashMap<>();
Reader reader = new FileReader(path.toString());
tallyChars(reader, freq);
long timeElapsed = System.nanoTime() - startTime;
System.out.print(timeElapsed / 1000000 + ",");
}
}
private static void tallyChars(Reader reader, Map<Character, Long> freq) throws IOException {
int b;
long counter = 0;
Character lastChar = null;
char[] buffer = new char[4096];
while ((b = reader.read(buffer, 0, buffer.length)) != -1) {
Arrays.sort(buffer, 0, b);
for (int i = 0; i < b; i++) {
if (lastChar == null || lastChar != buffer[i]) {
if (lastChar != null) {
try {
freq.put(lastChar, freq.get(lastChar) + counter);
} catch (NullPointerException np) {
freq.put(lastChar, counter);
};
}
counter = 0;
lastChar = buffer[i];
}
counter++;
}
if (lastChar != null) {
try {
freq.put(lastChar, freq.get(lastChar) + counter);
} catch (NullPointerException np) {
freq.put(lastChar, counter);
};
}
counter = 0;
lastChar = null;
}
}
private static void print_tally(Map<Character, Long> freq) {
int dist = 'a' - 'A';
Map<Character, Long> upperAndlower = new LinkedHashMap();
for (Character c = 'A'; c <= 'Z'; c++) {
upperAndlower.put(c, freq.getOrDefault(c, 0L) + freq.getOrDefault(c + dist, 0L));
}
Map<Character, Long> sorted = upperAndlower
.entrySet()
.stream()
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
.collect(
toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2,
LinkedHashMap::new));
for (Character c : sorted.keySet()) {
System.out.println("" + c + ": " + sorted.get(c));;
}
}
}
| 3,401 | 0.534549 | 0.526022 | 97 | 34.061855 | 24.766462 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.835052 | false | false |
13
|
0bfa68acfbcadbb205c20dd83e9ae4e48538728c
| 4,114,578,726,758 |
0214aadd5265a9a280c73e7e5a0950104e9c5ecb
|
/server-test/tiaotiaogift/app/tiaotiaogift-biz-common/src/main/java/com/tiaotiaogift/biz/common/gateway/fetch/FetchResponse.java
|
ff4effcdac702df259f589861fc17224c0f82bbd
|
[] |
no_license
|
foodoon-guda/guda
|
https://github.com/foodoon-guda/guda
|
d78d7375895cc7e0edfa2496d3f2df986cceaf30
|
df7fd7eaa50b0d610b050d588455aeb120b85aed
|
refs/heads/master
| 2016-09-05T12:25:23.620000 | 2014-07-28T05:14:00 | 2014-07-28T05:14:00 | 21,302,564 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* zoneland.net Inc.
* Copyright (c) 2002-2013 All Rights Reserved.
*/
package com.tiaotiaogift.biz.common.gateway.fetch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import com.tiaotiaogift.biz.common.gateway.SmsService;
/**
*
* @author gang
* @version $Id: FetchResponse.java, v 0.1 2013-5-7 下午12:12:56 gang Exp $
*/
public class FetchResponse implements InitializingBean {
private Logger logger = LoggerFactory.getLogger(FetchResponse.class);
@Autowired
private ThreadPoolTaskExecutor taskExecutor;
@Autowired
private SmsService smsService;
public void fetch() {
}
class FetchThread implements Runnable {
/**
* @see java.lang.Runnable#run()
*/
public void run() {
while (true) {
try {
smsService.recvSms();
} catch (Exception e) {
logger.error("", e);
}
try {
smsService.recv106Sms();
} catch (Exception e) {
logger.error("", e);
}
try {
Thread.sleep(20 * 1000);
} catch (InterruptedException e) {
logger.error("", e);
}
}
}
}
/**
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
*/
public void afterPropertiesSet() throws Exception {
taskExecutor.execute(new FetchThread());
}
}
|
UTF-8
|
Java
| 1,776 |
java
|
FetchResponse.java
|
Java
|
[
{
"context": "biz.common.gateway.SmsService;\n\n/**\n * \n * @author gang\n * @version $Id: FetchResponse.java, v 0.1 2013-5",
"end": 461,
"score": 0.9994945526123047,
"start": 457,
"tag": "USERNAME",
"value": "gang"
}
] | null |
[] |
/**
* zoneland.net Inc.
* Copyright (c) 2002-2013 All Rights Reserved.
*/
package com.tiaotiaogift.biz.common.gateway.fetch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import com.tiaotiaogift.biz.common.gateway.SmsService;
/**
*
* @author gang
* @version $Id: FetchResponse.java, v 0.1 2013-5-7 下午12:12:56 gang Exp $
*/
public class FetchResponse implements InitializingBean {
private Logger logger = LoggerFactory.getLogger(FetchResponse.class);
@Autowired
private ThreadPoolTaskExecutor taskExecutor;
@Autowired
private SmsService smsService;
public void fetch() {
}
class FetchThread implements Runnable {
/**
* @see java.lang.Runnable#run()
*/
public void run() {
while (true) {
try {
smsService.recvSms();
} catch (Exception e) {
logger.error("", e);
}
try {
smsService.recv106Sms();
} catch (Exception e) {
logger.error("", e);
}
try {
Thread.sleep(20 * 1000);
} catch (InterruptedException e) {
logger.error("", e);
}
}
}
}
/**
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
*/
public void afterPropertiesSet() throws Exception {
taskExecutor.execute(new FetchThread());
}
}
| 1,776 | 0.567156 | 0.548533 | 70 | 24.314285 | 23.459719 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false |
13
|
692d88a055e68c86053e909ef1024ef5fd8d436f
| 26,336,739,466,380 |
f7435c248e01562e1843670bc3df588787f1a4f5
|
/src/main/java/com/plantexchange/plantexchange/controller/UserRestController.java
|
e1df3b8e6bbdb9270354f84b7205594417fa2a73
|
[] |
no_license
|
Kamila-Piatkiewicz/PlantExchange
|
https://github.com/Kamila-Piatkiewicz/PlantExchange
|
d280b84aec525bd0caca4abc23acd686f6191be2
|
81b7ecc811daeb05014a2f89c1566c1a303e2998
|
refs/heads/master
| 2022-11-02T16:24:49.251000 | 2020-06-14T13:18:55 | 2020-06-14T13:18:55 | 254,851,162 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.plantexchange.plantexchange.controller;
import com.plantexchange.plantexchange.model.PlantOffer;
import com.plantexchange.plantexchange.model.User;
import com.plantexchange.plantexchange.repository.PlantOfferRepository;
import com.plantexchange.plantexchange.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/users")
public class UserRestController {
@Autowired
PlantOfferRepository plantOfferRepository;
@Autowired
UserRepository userRepository;
@GetMapping(value = "", produces = "application/json")
public List<User> getAllUsers() {
return userRepository.findAll();
}
@GetMapping(value = "/{email}", produces = "application/json")
public User getUser(@PathVariable String email) {
return userRepository.findByEmail(email).orElse(null);
}
@GetMapping(value = "/{email}/plant-offers", produces = "application/json")
public List<PlantOffer> getUserOffers(@PathVariable String email) {
return plantOfferRepository.findAllByAuthor(email);
}
}
|
UTF-8
|
Java
| 1,380 |
java
|
UserRestController.java
|
Java
|
[] | null |
[] |
package com.plantexchange.plantexchange.controller;
import com.plantexchange.plantexchange.model.PlantOffer;
import com.plantexchange.plantexchange.model.User;
import com.plantexchange.plantexchange.repository.PlantOfferRepository;
import com.plantexchange.plantexchange.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/users")
public class UserRestController {
@Autowired
PlantOfferRepository plantOfferRepository;
@Autowired
UserRepository userRepository;
@GetMapping(value = "", produces = "application/json")
public List<User> getAllUsers() {
return userRepository.findAll();
}
@GetMapping(value = "/{email}", produces = "application/json")
public User getUser(@PathVariable String email) {
return userRepository.findByEmail(email).orElse(null);
}
@GetMapping(value = "/{email}/plant-offers", produces = "application/json")
public List<PlantOffer> getUserOffers(@PathVariable String email) {
return plantOfferRepository.findAllByAuthor(email);
}
}
| 1,380 | 0.778261 | 0.778261 | 39 | 34.384617 | 26.86969 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.487179 | false | false |
13
|
48f6ea4abdbb09d95a27ae3577e8fa5775529ccd
| 25,443,386,331,718 |
46347de649fefb62ec9a12bac6084d28f9eefe4c
|
/ccyui/src/main/java/com/example/ccy/ccyui/util/ViewAdapterUtil.java
|
412d82de498d143ad301f2ba0d0406bef34826fa
|
[] |
no_license
|
P79N6A/android
|
https://github.com/P79N6A/android
|
1075e6730c5ffb17d0e10afbe7f0c9cb3a49b014
|
61c382cf35e9d49dd36668f12003210af77f7bd2
|
refs/heads/master
| 2020-07-10T23:17:23.685000 | 2019-08-26T03:57:04 | 2019-08-26T03:57:13 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.ccy.ccyui.util;
import android.app.Activity;
import android.util.DisplayMetrics;
/**
* Created by Administrator on 2017/3/15.
*/
public class ViewAdapterUtil {
public final static DisplayMetrics getDisplayMetrics(Activity activity) {
DisplayMetrics metrics = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
return metrics;
}
public final static int getRunAreaBallXY(Activity activity) {
int wh = getDisplayMetrics(activity).widthPixels;
if(wh < 500){
wh = 10;
}else if (wh < 1000) {
wh = 15;
} else if (wh <2000) {
wh =20;
} else {
wh = 25;
}
return wh ;
}
}
|
UTF-8
|
Java
| 771 |
java
|
ViewAdapterUtil.java
|
Java
|
[
{
"context": "rt android.util.DisplayMetrics;\n\n/**\n * Created by Administrator on 2017/3/15.\n */\n\npublic class ViewAdapterUtil {",
"end": 134,
"score": 0.8559643030166626,
"start": 121,
"tag": "NAME",
"value": "Administrator"
}
] | null |
[] |
package com.example.ccy.ccyui.util;
import android.app.Activity;
import android.util.DisplayMetrics;
/**
* Created by Administrator on 2017/3/15.
*/
public class ViewAdapterUtil {
public final static DisplayMetrics getDisplayMetrics(Activity activity) {
DisplayMetrics metrics = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
return metrics;
}
public final static int getRunAreaBallXY(Activity activity) {
int wh = getDisplayMetrics(activity).widthPixels;
if(wh < 500){
wh = 10;
}else if (wh < 1000) {
wh = 15;
} else if (wh <2000) {
wh =20;
} else {
wh = 25;
}
return wh ;
}
}
| 771 | 0.60441 | 0.570687 | 29 | 25.586206 | 21.989836 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.413793 | false | false |
13
|
998dd9c40ba162252b019ee52051eea2b5dc604f
| 8,924,942,090,455 |
15fe67739e1e033b22f56b1107f6c7b97b51bd9e
|
/app/src/main/java/com/shadiinvitationproject/network/Retrofit/ResponseModels/Registered.java
|
8317ded4ce5055e9ac30b6943b8c83f2e05ec2cf
|
[] |
no_license
|
akshaypujari2507/ShadiInvitationProject
|
https://github.com/akshaypujari2507/ShadiInvitationProject
|
e54f95538529ea748326f30c0bf47c0c7c2d7f01
|
18b38f4db9e83aacfa47ffa837de14996c8786b4
|
refs/heads/master
| 2022-11-29T09:16:43.593000 | 2020-08-08T12:04:58 | 2020-08-08T12:04:58 | 255,987,572 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.shadiinvitationproject.network.Retrofit.ResponseModels;
import com.google.gson.annotations.SerializedName;
public class Registered {
@SerializedName("age")
private Long mAge;
@SerializedName("date")
private String mDate;
public Long getAge() {
return mAge;
}
public void setAge(Long age) {
mAge = age;
}
public String getDate() {
return mDate;
}
public void setDate(String date) {
mDate = date;
}
}
|
UTF-8
|
Java
| 500 |
java
|
Registered.java
|
Java
|
[] | null |
[] |
package com.shadiinvitationproject.network.Retrofit.ResponseModels;
import com.google.gson.annotations.SerializedName;
public class Registered {
@SerializedName("age")
private Long mAge;
@SerializedName("date")
private String mDate;
public Long getAge() {
return mAge;
}
public void setAge(Long age) {
mAge = age;
}
public String getDate() {
return mDate;
}
public void setDate(String date) {
mDate = date;
}
}
| 500 | 0.632 | 0.632 | 28 | 16.821428 | 16.97278 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false |
13
|
04e1d031ada56df64a5f3990b1985fe644aa6ffa
| 23,931,557,821,168 |
7eaa85b5522fd4c3076bf1721ac50446d4733d76
|
/app/src/main/java/com/example/sti_agent/adapter/RealmHelper.java
|
9cb9e5ef4a65bba83825bab03c9df20fa33d31f0
|
[] |
no_license
|
alumichael/STI_Agent
|
https://github.com/alumichael/STI_Agent
|
8cb6aad9b885878205061209ed52f0300570c6ff
|
5f453fd648a4aee6dae5138b923d550778ccac4d
|
refs/heads/master
| 2020-06-02T12:47:41.540000 | 2019-10-24T13:07:37 | 2019-10-24T13:07:37 | 191,158,271 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.sti_agent.adapter;
import com.example.sti_agent.Model.Vehicle.VehiclePolicy;
import io.realm.Realm;
public class RealmHelper {
Realm realm;
public RealmHelper(Realm realm) {
this.realm = realm;
}
public void save_motor_insurance(final VehiclePolicy monthly){
realm.executeTransaction(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
VehiclePolicy vehiclePolicy=realm.copyToRealm(monthly);
}
});
}
/* public ArrayList<String> retrieve(){
ArrayList<String> records=new ArrayList<>();
RealmResults<Monthly> monthly = realm.where(Monthly.class).findAll();
String income=" ";
for(Monthly month: monthly){
//records.add(month.getId());
records.add(String.valueOf(month.getTotal_income()));
records.add(String.valueOf(month.getSaving_goal()));
records.add(String.valueOf(month.getBalance()));
records.add(String.valueOf(month.getDate()));
income+=String.valueOf(month.getTotal_income());
}
Log.v("Database", income);
return records;
}*/
}
|
UTF-8
|
Java
| 1,228 |
java
|
RealmHelper.java
|
Java
|
[] | null |
[] |
package com.example.sti_agent.adapter;
import com.example.sti_agent.Model.Vehicle.VehiclePolicy;
import io.realm.Realm;
public class RealmHelper {
Realm realm;
public RealmHelper(Realm realm) {
this.realm = realm;
}
public void save_motor_insurance(final VehiclePolicy monthly){
realm.executeTransaction(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
VehiclePolicy vehiclePolicy=realm.copyToRealm(monthly);
}
});
}
/* public ArrayList<String> retrieve(){
ArrayList<String> records=new ArrayList<>();
RealmResults<Monthly> monthly = realm.where(Monthly.class).findAll();
String income=" ";
for(Monthly month: monthly){
//records.add(month.getId());
records.add(String.valueOf(month.getTotal_income()));
records.add(String.valueOf(month.getSaving_goal()));
records.add(String.valueOf(month.getBalance()));
records.add(String.valueOf(month.getDate()));
income+=String.valueOf(month.getTotal_income());
}
Log.v("Database", income);
return records;
}*/
}
| 1,228 | 0.609121 | 0.609121 | 52 | 22.596153 | 24.828844 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.365385 | false | false |
13
|
586a1cef7338265d9785d34f60ab0c3c09b2da17
| 8,546,984,981,846 |
c6d0f30f0a1476b573986f4c412740ed01e66989
|
/bottle-command/src/main/java/com/teorange/magic/bottle/command/service/TipOffService.java
|
a78df0b5269ccfe71682841991e44e22b8865f98
|
[
"Apache-2.0"
] |
permissive
|
kellen0903/magic-bottle
|
https://github.com/kellen0903/magic-bottle
|
0bc31ca634c703fe7d5fab9197d97a77d0c41a59
|
4128e11bf4d27495c3d66a4b2c25c1f4f264335b
|
refs/heads/master
| 2022-11-09T10:11:21.041000 | 2020-03-10T22:40:24 | 2020-03-10T22:40:24 | 246,284,006 | 34 | 12 |
Apache-2.0
| false | 2022-10-12T20:37:32 | 2020-03-10T11:34:13 | 2022-10-06T01:13:03 | 2022-10-12T20:37:30 | 7,704 | 27 | 6 | 10 |
Java
| false | false |
package com.teorange.magic.bottle.command.service;
import static com.teorange.magic.bottle.api.constant.GlobalConstant.POST_TIPOFF_SHIELD_COUNT;
import static com.teorange.magic.bottle.api.constant.GlobalConstant.USER_TIPOFF_CONFIG;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.teorange.framework.axon.util.IdWorker;
import cn.teorange.framework.mybatisplus.utils.PageUtils;
import cn.teorange.framework.mybatisplus.utils.Query;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.teorange.magic.bottle.api.constant.GlobalConstant;
import com.teorange.magic.bottle.api.domain.MagicUserEntity;
import com.teorange.magic.bottle.api.domain.PostEntity;
import com.teorange.magic.bottle.api.domain.PostReplyEntity;
import com.teorange.magic.bottle.api.domain.TipOffLogEntity;
import com.teorange.magic.bottle.api.dto.PushMessageDTO;
import com.teorange.magic.bottle.api.event.UserStatusUpdatedEvent;
import com.teorange.magic.bottle.api.mapper.TipOffLogMapper;
import com.teorange.magic.bottle.api.plugins.redis.SysConfigRedis;
import com.teorange.magic.bottle.api.service.MagicUserService;
import com.teorange.magic.bottle.api.service.MessagePushService;
import com.teorange.magic.bottle.api.service.PostReplyService;
import com.teorange.magic.bottle.api.service.PostService;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.axonframework.eventhandling.scheduling.quartz.QuartzEventScheduler;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
/**
* Created by kellen on 2018/6/3.
*/
@Service
@AllArgsConstructor
@Slf4j
public class TipOffService extends ServiceImpl<TipOffLogMapper, TipOffLogEntity> {
private SysConfigRedis sysConfigRedis;
private PostService postService;
private MagicUserService magicUserService;
private MessagePushService messagePushService;
private QuartzEventScheduler quartzEventScheduler;
private PostReplyService postReplyService;
public PageUtils queryPage(Map<String, Object> params) {
Page<TipOffLogEntity> page = this.selectPage(
new Query<TipOffLogEntity>(params).getPage(),
new EntityWrapper<>()
);
return new PageUtils(page);
}
/**
* 处理被举报后的禁言、屏蔽操作 同一帖子如果被x个不同IP举报, 则对其他人自动屏蔽不显示 X天内触发Y次举报后,自动发送系统警告,
* 然后再触发Z次举报给禁言N天(X/Y/Z/N可以系统配置,初始值X=1,Y=3,Z=5,N=7
*/
public synchronized void postTipOff(TipOffLogEntity tipOffLogEntity) {
log.info("开始处理被举报后的操作:{}", tipOffLogEntity);
Integer itemType = tipOffLogEntity.getItemType();
Long toUserId = tipOffLogEntity.getToUserId();
//如果是帖子被举报,先处理
Long itemId = tipOffLogEntity.getItemId();
//查询该魔瓶被不同ip举报的次数
Integer tipCount = this.baseMapper.queryTipOffCount(itemId);
log.info("查询被不同ip举报的次数是:{}", tipCount);
String shiledCount = sysConfigRedis.get(POST_TIPOFF_SHIELD_COUNT);
log.info("系统配置的同一帖子如果被不同IP举报屏蔽的数量是:{}", shiledCount);
Integer sysShieldCount = 5;
if (StrUtil.isNotEmpty(shiledCount)) {
sysShieldCount = Integer.valueOf(shiledCount);
}
//查询管理员列表,如果是管理员举报,直接屏蔽
List<String> adminList = sysConfigRedis
.getConfigObject(GlobalConstant.ADMIN_USER_LIST, List.class);
boolean isAdminFlag = adminList.stream()
.anyMatch(e -> e.equals(tipOffLogEntity.getUserId().toString()));
log.info("查询到的管理员id列表:{},当前用户是否是管理员:{}", adminList, isAdminFlag);
if ((tipCount >= sysShieldCount) || isAdminFlag) {
if (1 == itemType) {
//更新帖子的状态为已屏蔽
log.info("该贴子满足被屏蔽的条件,更新状态为已屏蔽,被举报数量:{},帖子id:{}", tipCount, itemId);
postService
.updateById(new PostEntity().setId(itemId).setShieldStatus(1));
} else if (2 == itemType) {
postReplyService.updateById(new PostReplyEntity().setId(itemId).setShieldStatus(1));
}
}
this.doShut(toUserId, tipOffLogEntity.getUserId(), itemType, isAdminFlag);
}
/**
* 真正禁言操作方法
*/
public void doShut(Long toUid, Long fromUid, int itemType, boolean isAdminFlag) {
//处理用户是否需要被禁言或者禁言提醒的操作
String config = sysConfigRedis.get(USER_TIPOFF_CONFIG);
if (null == config) {
return;
}
Map<String, Object> configMap = JSONUtil.toBean(config, Map.class);
//X天
Integer day = MapUtil.getInt(configMap, "x");
//y次
Integer count = MapUtil.getInt(configMap, "y");
//再被举报Z次
Integer againCount = MapUtil.getInt(configMap, "z");
//禁言n天
Integer banDay = MapUtil.getInt(configMap, "n");
//查询用户X天内被举报的次数
Date nowDateStart = DateUtil.beginOfDay(new Date());
Date startTime = DateUtil.offsetDay(nowDateStart, -day);
Date endTime = DateUtil.endOfDay(new Date());
List<TipOffLogEntity> logList = this.selectList(
new EntityWrapper<TipOffLogEntity>().eq("to_user_id", toUid)
.le("create_time", endTime)
.ge("create_time", startTime));
int dayCount = 0;
if (!CollectionUtils.isEmpty(logList)) {
Map<Long, List<TipOffLogEntity>> longListMap = logList.stream()
.collect(Collectors.groupingBy(TipOffLogEntity::getItemId));
//A发了一个帖子,被三个人举报,在用户禁言参数统计时应该算作一条,而不应该算作三条。评论同理。
//会话举报是一个会话算一次。
dayCount = longListMap.size();
}
log.info("查询到x天内被举报的次数:{}", dayCount);
//禁言
MagicUserEntity magicUserEntity = magicUserService.selectById(toUid);
PushMessageDTO pushMessageDTO = new PushMessageDTO().setCreateTime(new Date())
.setMsgId(
IdWorker.getId())
.setToUid(toUid)
.setJpushId(magicUserEntity.getJpushId())
.setToNickName(magicUserEntity.getNickName()).setFromUid(fromUid)
.setFromSex(1).setToSex(magicUserEntity.getSex());
//如果是管理员的会话举报则直接禁言
if ((dayCount == (count + againCount)) || (3 == itemType && isAdminFlag)) {
magicUserService
.updateById(new MagicUserEntity().setId(toUid).setStatus(2));
String content = "警告:您的帐号暂时被封禁" + banDay + "天,封禁原因:您的帐号收到多条合理举报,如若再次发现,将永久封禁。";
pushMessageDTO.setContent(content).setMsgType(10);
messagePushService.pushIM(pushMessageDTO);
//发布禁言解除延迟事件
Instant unBanTime = Instant.now().plus(banDay, ChronoUnit.DAYS);
//发布定时事件
quartzEventScheduler.schedule(unBanTime, new UserStatusUpdatedEvent(toUid, 1));
//提醒
} else if (dayCount == count) {
String content = "警告:您的帐号收到多条合理举报,举报内容为恶意骚扰或不良内容,给用户带来不良影响。如若再次发现将会封禁处理";
pushMessageDTO.setContent(content).setMsgType(8);
messagePushService.pushIM(pushMessageDTO);
}
}
public static void main(String[] args) {
// String array = "[1012870289281667073, 1012878480845500418, 1012939887452581890, 1012939847141126145, 1017376287602204674, 1012956668326014977, 1012901580446285826]";
// List<Long> list = JSONUtil.toBean(array, List.class);
List<Long> list = Lists
.newArrayList(1012870289281667073L, 1012878480845500418L, 1012901580446285826L);
System.out.println(list.contains(1012901580446285826L));
}
}
|
UTF-8
|
Java
| 8,287 |
java
|
TipOffService.java
|
Java
|
[
{
"context": "framework.util.CollectionUtils;\n\n/**\n * Created by kellen on 2018/6/3.\n */\n@Service\n@AllArgsConstructor\n@Sl",
"end": 1972,
"score": 0.9996685981750488,
"start": 1966,
"tag": "USERNAME",
"value": "kellen"
}
] | null |
[] |
package com.teorange.magic.bottle.command.service;
import static com.teorange.magic.bottle.api.constant.GlobalConstant.POST_TIPOFF_SHIELD_COUNT;
import static com.teorange.magic.bottle.api.constant.GlobalConstant.USER_TIPOFF_CONFIG;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.teorange.framework.axon.util.IdWorker;
import cn.teorange.framework.mybatisplus.utils.PageUtils;
import cn.teorange.framework.mybatisplus.utils.Query;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.teorange.magic.bottle.api.constant.GlobalConstant;
import com.teorange.magic.bottle.api.domain.MagicUserEntity;
import com.teorange.magic.bottle.api.domain.PostEntity;
import com.teorange.magic.bottle.api.domain.PostReplyEntity;
import com.teorange.magic.bottle.api.domain.TipOffLogEntity;
import com.teorange.magic.bottle.api.dto.PushMessageDTO;
import com.teorange.magic.bottle.api.event.UserStatusUpdatedEvent;
import com.teorange.magic.bottle.api.mapper.TipOffLogMapper;
import com.teorange.magic.bottle.api.plugins.redis.SysConfigRedis;
import com.teorange.magic.bottle.api.service.MagicUserService;
import com.teorange.magic.bottle.api.service.MessagePushService;
import com.teorange.magic.bottle.api.service.PostReplyService;
import com.teorange.magic.bottle.api.service.PostService;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.axonframework.eventhandling.scheduling.quartz.QuartzEventScheduler;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
/**
* Created by kellen on 2018/6/3.
*/
@Service
@AllArgsConstructor
@Slf4j
public class TipOffService extends ServiceImpl<TipOffLogMapper, TipOffLogEntity> {
private SysConfigRedis sysConfigRedis;
private PostService postService;
private MagicUserService magicUserService;
private MessagePushService messagePushService;
private QuartzEventScheduler quartzEventScheduler;
private PostReplyService postReplyService;
public PageUtils queryPage(Map<String, Object> params) {
Page<TipOffLogEntity> page = this.selectPage(
new Query<TipOffLogEntity>(params).getPage(),
new EntityWrapper<>()
);
return new PageUtils(page);
}
/**
* 处理被举报后的禁言、屏蔽操作 同一帖子如果被x个不同IP举报, 则对其他人自动屏蔽不显示 X天内触发Y次举报后,自动发送系统警告,
* 然后再触发Z次举报给禁言N天(X/Y/Z/N可以系统配置,初始值X=1,Y=3,Z=5,N=7
*/
public synchronized void postTipOff(TipOffLogEntity tipOffLogEntity) {
log.info("开始处理被举报后的操作:{}", tipOffLogEntity);
Integer itemType = tipOffLogEntity.getItemType();
Long toUserId = tipOffLogEntity.getToUserId();
//如果是帖子被举报,先处理
Long itemId = tipOffLogEntity.getItemId();
//查询该魔瓶被不同ip举报的次数
Integer tipCount = this.baseMapper.queryTipOffCount(itemId);
log.info("查询被不同ip举报的次数是:{}", tipCount);
String shiledCount = sysConfigRedis.get(POST_TIPOFF_SHIELD_COUNT);
log.info("系统配置的同一帖子如果被不同IP举报屏蔽的数量是:{}", shiledCount);
Integer sysShieldCount = 5;
if (StrUtil.isNotEmpty(shiledCount)) {
sysShieldCount = Integer.valueOf(shiledCount);
}
//查询管理员列表,如果是管理员举报,直接屏蔽
List<String> adminList = sysConfigRedis
.getConfigObject(GlobalConstant.ADMIN_USER_LIST, List.class);
boolean isAdminFlag = adminList.stream()
.anyMatch(e -> e.equals(tipOffLogEntity.getUserId().toString()));
log.info("查询到的管理员id列表:{},当前用户是否是管理员:{}", adminList, isAdminFlag);
if ((tipCount >= sysShieldCount) || isAdminFlag) {
if (1 == itemType) {
//更新帖子的状态为已屏蔽
log.info("该贴子满足被屏蔽的条件,更新状态为已屏蔽,被举报数量:{},帖子id:{}", tipCount, itemId);
postService
.updateById(new PostEntity().setId(itemId).setShieldStatus(1));
} else if (2 == itemType) {
postReplyService.updateById(new PostReplyEntity().setId(itemId).setShieldStatus(1));
}
}
this.doShut(toUserId, tipOffLogEntity.getUserId(), itemType, isAdminFlag);
}
/**
* 真正禁言操作方法
*/
public void doShut(Long toUid, Long fromUid, int itemType, boolean isAdminFlag) {
//处理用户是否需要被禁言或者禁言提醒的操作
String config = sysConfigRedis.get(USER_TIPOFF_CONFIG);
if (null == config) {
return;
}
Map<String, Object> configMap = JSONUtil.toBean(config, Map.class);
//X天
Integer day = MapUtil.getInt(configMap, "x");
//y次
Integer count = MapUtil.getInt(configMap, "y");
//再被举报Z次
Integer againCount = MapUtil.getInt(configMap, "z");
//禁言n天
Integer banDay = MapUtil.getInt(configMap, "n");
//查询用户X天内被举报的次数
Date nowDateStart = DateUtil.beginOfDay(new Date());
Date startTime = DateUtil.offsetDay(nowDateStart, -day);
Date endTime = DateUtil.endOfDay(new Date());
List<TipOffLogEntity> logList = this.selectList(
new EntityWrapper<TipOffLogEntity>().eq("to_user_id", toUid)
.le("create_time", endTime)
.ge("create_time", startTime));
int dayCount = 0;
if (!CollectionUtils.isEmpty(logList)) {
Map<Long, List<TipOffLogEntity>> longListMap = logList.stream()
.collect(Collectors.groupingBy(TipOffLogEntity::getItemId));
//A发了一个帖子,被三个人举报,在用户禁言参数统计时应该算作一条,而不应该算作三条。评论同理。
//会话举报是一个会话算一次。
dayCount = longListMap.size();
}
log.info("查询到x天内被举报的次数:{}", dayCount);
//禁言
MagicUserEntity magicUserEntity = magicUserService.selectById(toUid);
PushMessageDTO pushMessageDTO = new PushMessageDTO().setCreateTime(new Date())
.setMsgId(
IdWorker.getId())
.setToUid(toUid)
.setJpushId(magicUserEntity.getJpushId())
.setToNickName(magicUserEntity.getNickName()).setFromUid(fromUid)
.setFromSex(1).setToSex(magicUserEntity.getSex());
//如果是管理员的会话举报则直接禁言
if ((dayCount == (count + againCount)) || (3 == itemType && isAdminFlag)) {
magicUserService
.updateById(new MagicUserEntity().setId(toUid).setStatus(2));
String content = "警告:您的帐号暂时被封禁" + banDay + "天,封禁原因:您的帐号收到多条合理举报,如若再次发现,将永久封禁。";
pushMessageDTO.setContent(content).setMsgType(10);
messagePushService.pushIM(pushMessageDTO);
//发布禁言解除延迟事件
Instant unBanTime = Instant.now().plus(banDay, ChronoUnit.DAYS);
//发布定时事件
quartzEventScheduler.schedule(unBanTime, new UserStatusUpdatedEvent(toUid, 1));
//提醒
} else if (dayCount == count) {
String content = "警告:您的帐号收到多条合理举报,举报内容为恶意骚扰或不良内容,给用户带来不良影响。如若再次发现将会封禁处理";
pushMessageDTO.setContent(content).setMsgType(8);
messagePushService.pushIM(pushMessageDTO);
}
}
public static void main(String[] args) {
// String array = "[1012870289281667073, 1012878480845500418, 1012939887452581890, 1012939847141126145, 1017376287602204674, 1012956668326014977, 1012901580446285826]";
// List<Long> list = JSONUtil.toBean(array, List.class);
List<Long> list = Lists
.newArrayList(1012870289281667073L, 1012878480845500418L, 1012901580446285826L);
System.out.println(list.contains(1012901580446285826L));
}
}
| 8,287 | 0.734471 | 0.702389 | 184 | 38.809784 | 27.888983 | 172 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.777174 | false | false |
13
|
1296552d838b7947818def1f6c7c6c80ce001dff
| 24,309,514,957,026 |
682e71cb92565df384fc08a7401b1f4e47bb1750
|
/class_7.0_project_demo/src/main/java/com/config/handlingMapping.java
|
10bb72996f1196cb852a5b72590e007108aaba09
|
[] |
no_license
|
luringdeveloper/spring-notes
|
https://github.com/luringdeveloper/spring-notes
|
ce6c0a84738104429c3cb7698a94655a9578705b
|
ba5eaaa2ea5f0492b989ead38b17a42a7dbec5f5
|
refs/heads/master
| 2023-07-07T04:45:12.202000 | 2021-08-10T13:35:44 | 2021-08-10T13:35:44 | 388,722,965 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.config;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.http.CacheControl;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate5.HibernateTransactionManager;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.model.SignUp;
import com.repo.UserDao;
@Configuration
@EnableWebMvc
@EnableTransactionManagement
@ComponentScan(basePackages = "com")
@PropertySource(value = "classpath:/application.properties")
public class handlingMapping implements WebMvcConfigurer {
@Autowired
private Environment environment;
// @Bean
// public InternalResourceViewResolver internalResourceViewResolver() {
// return new InternalResourceViewResolver("/WEB-INF/views/",".jsp");
// }
@Bean
public DataSource datasource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(environment.getRequiredProperty("jdbc.class"));
dataSource.setUrl(environment.getRequiredProperty("jdbc.url"));
dataSource.setUsername(environment.getRequiredProperty("jdbc.user"));
dataSource.setPassword(environment.getRequiredProperty("jdbc.pass"));
System.out.println("datasource: " + dataSource);
return dataSource;
}
@Bean
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean localSessionFactoryBean = new LocalSessionFactoryBean();
localSessionFactoryBean.setDataSource(datasource());
localSessionFactoryBean.setAnnotatedClasses(SignUp.class);
localSessionFactoryBean.setHibernateProperties(hibernateProperties());
System.out.println("localSessionFactoryBean: " + localSessionFactoryBean);
return localSessionFactoryBean;
}
private Properties hibernateProperties() {
Properties properties = new Properties();
properties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql"));
properties.put("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql"));
properties.put("hibernate.hbm2ddl.auto", environment.getRequiredProperty("hibernate.hbm2ddl.auto"));
System.out.println("properties: " + properties);
return properties;
}
@Bean
public HibernateTransactionManager getHibernateTransactionManager() {
HibernateTransactionManager hibernateTransactionManager = new HibernateTransactionManager();
hibernateTransactionManager.setSessionFactory(sessionFactory().getObject());
System.out.println("hibernateTransactionManager :" + hibernateTransactionManager);
return hibernateTransactionManager;
}
@Bean
public CommonsMultipartResolver multipartResolver() {
CommonsMultipartResolver commonsmultipartresolver = new CommonsMultipartResolver();
commonsmultipartresolver.setMaxUploadSize(10*1024*1024);
return commonsmultipartresolver;
}
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
WebMvcConfigurer.super.configureViewResolvers(registry);
registry.jsp("/WEB-INF/views/", ".jsp");
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// TODO Auto-generated method stub
WebMvcConfigurer.super.addResourceHandlers(registry);
registry.addResourceHandler("/static/**").addResourceLocations("/WEB-INF/static/")
.setCacheControl(CacheControl.maxAge(2, TimeUnit.HOURS).cachePublic());
}
}
|
UTF-8
|
Java
| 4,291 |
java
|
handlingMapping.java
|
Java
|
[] | null |
[] |
package com.config;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.http.CacheControl;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate5.HibernateTransactionManager;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.model.SignUp;
import com.repo.UserDao;
@Configuration
@EnableWebMvc
@EnableTransactionManagement
@ComponentScan(basePackages = "com")
@PropertySource(value = "classpath:/application.properties")
public class handlingMapping implements WebMvcConfigurer {
@Autowired
private Environment environment;
// @Bean
// public InternalResourceViewResolver internalResourceViewResolver() {
// return new InternalResourceViewResolver("/WEB-INF/views/",".jsp");
// }
@Bean
public DataSource datasource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(environment.getRequiredProperty("jdbc.class"));
dataSource.setUrl(environment.getRequiredProperty("jdbc.url"));
dataSource.setUsername(environment.getRequiredProperty("jdbc.user"));
dataSource.setPassword(environment.getRequiredProperty("jdbc.pass"));
System.out.println("datasource: " + dataSource);
return dataSource;
}
@Bean
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean localSessionFactoryBean = new LocalSessionFactoryBean();
localSessionFactoryBean.setDataSource(datasource());
localSessionFactoryBean.setAnnotatedClasses(SignUp.class);
localSessionFactoryBean.setHibernateProperties(hibernateProperties());
System.out.println("localSessionFactoryBean: " + localSessionFactoryBean);
return localSessionFactoryBean;
}
private Properties hibernateProperties() {
Properties properties = new Properties();
properties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql"));
properties.put("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql"));
properties.put("hibernate.hbm2ddl.auto", environment.getRequiredProperty("hibernate.hbm2ddl.auto"));
System.out.println("properties: " + properties);
return properties;
}
@Bean
public HibernateTransactionManager getHibernateTransactionManager() {
HibernateTransactionManager hibernateTransactionManager = new HibernateTransactionManager();
hibernateTransactionManager.setSessionFactory(sessionFactory().getObject());
System.out.println("hibernateTransactionManager :" + hibernateTransactionManager);
return hibernateTransactionManager;
}
@Bean
public CommonsMultipartResolver multipartResolver() {
CommonsMultipartResolver commonsmultipartresolver = new CommonsMultipartResolver();
commonsmultipartresolver.setMaxUploadSize(10*1024*1024);
return commonsmultipartresolver;
}
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
WebMvcConfigurer.super.configureViewResolvers(registry);
registry.jsp("/WEB-INF/views/", ".jsp");
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// TODO Auto-generated method stub
WebMvcConfigurer.super.addResourceHandlers(registry);
registry.addResourceHandler("/static/**").addResourceLocations("/WEB-INF/static/")
.setCacheControl(CacheControl.maxAge(2, TimeUnit.HOURS).cachePublic());
}
}
| 4,291 | 0.805873 | 0.802377 | 103 | 39.660194 | 31.203234 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.485437 | false | false |
13
|
2592d265a629c04a643df466e7bacb831d96dcaa
| 33,260,226,792,705 |
42503fc6a7fa17c7c721be0c086256b45ff3c72c
|
/stockStorage/src/main/java/stock/storage/DataTarget.java
|
60f74a559cec226d680fa336479f77520e361af4
|
[
"Apache-2.0"
] |
permissive
|
zydzjy/stock
|
https://github.com/zydzjy/stock
|
d052fca8edc1163755f1b45801bc79f3629b531b
|
e2e335acf500d377eb098c4a431962973e57233b
|
refs/heads/master
| 2020-04-07T06:39:08.409000 | 2019-04-13T08:58:37 | 2019-04-13T08:58:37 | 158,145,046 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package stock.storage;
public interface DataTarget<T> {
public void open() throws Exception;
public int sink(T[] data) throws Exception;
public void close() throws Exception;
}
|
UTF-8
|
Java
| 183 |
java
|
DataTarget.java
|
Java
|
[] | null |
[] |
package stock.storage;
public interface DataTarget<T> {
public void open() throws Exception;
public int sink(T[] data) throws Exception;
public void close() throws Exception;
}
| 183 | 0.748634 | 0.748634 | 8 | 21.875 | 17.431562 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
13
|
30b2c63876b264b8a598332fd18eebd7e12a1da2
| 28,552,942,646,221 |
a2dff5b82452c42d802b29ad3cbb590ea247aaf8
|
/guns-admin/src/main/java/com/stylefeng/guns/modular/crm/controller/CrmCustomerrabinController.java
|
8af27acb51d99ef83996e0b21ea5d99c411d0d8d
|
[] |
no_license
|
847944670/guns-crm
|
https://github.com/847944670/guns-crm
|
3bb4c37d27234d05e5f0fe55402b05028a7eae99
|
71a00705b3d17ecc316906e8f7211aac9b802102
|
refs/heads/master
| 2022-10-21T10:10:42.085000 | 2019-07-11T08:11:34 | 2019-07-11T08:11:34 | 196,348,535 | 0 | 0 | null | false | 2022-10-12T20:28:59 | 2019-07-11T08:04:16 | 2019-07-11T08:18:43 | 2022-10-12T20:28:56 | 4,482 | 0 | 0 | 6 |
JavaScript
| false | false |
package com.stylefeng.guns.modular.crm.controller;
import com.stylefeng.guns.core.base.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestParam;
import com.stylefeng.guns.modular.system.model.CrmCustomerrabin;
import com.stylefeng.guns.modular.crm.service.ICrmCustomerrabinService;
/**
* 客户回收管理控制器
*
* @author fengshuonan
* @Date 2018-09-30 09:27:08
*/
@Controller
@RequestMapping("/crmCustomerrabin")
public class CrmCustomerrabinController extends BaseController {
private String PREFIX = "/crm/crmCustomerrabin/";
@Autowired
private ICrmCustomerrabinService crmCustomerrabinService;
/**
* 跳转到客户回收管理首页
*/
@RequestMapping("")
public String index() {
return PREFIX + "crmCustomerrabin.html";
}
/**
* 跳转到添加客户回收管理
*/
@RequestMapping("/crmCustomerrabin_add")
public String crmCustomerrabinAdd() {
return PREFIX + "crmCustomerrabin_add.html";
}
/**
* 跳转到修改客户回收管理
*/
@RequestMapping("/crmCustomerrabin_update/{crmCustomerrabinId}")
public String crmCustomerrabinUpdate(@PathVariable Integer crmCustomerrabinId, Model model) {
CrmCustomerrabin crmCustomerrabin = crmCustomerrabinService.selectById(crmCustomerrabinId);
model.addAttribute("item",crmCustomerrabin);
LogObjectHolder.me().set(crmCustomerrabin);
return PREFIX + "crmCustomerrabin_edit.html";
}
/**
* 获取客户回收管理列表
*/
@RequestMapping(value = "/list")
@ResponseBody
public Object list(String condition) {
return crmCustomerrabinService.selectList(null);
}
/**
* 新增客户回收管理
*/
@RequestMapping(value = "/add")
@ResponseBody
public Object add(CrmCustomerrabin crmCustomerrabin) {
crmCustomerrabinService.insert(crmCustomerrabin);
return SUCCESS_TIP;
}
/**
* 删除客户回收管理
*/
@RequestMapping(value = "/delete")
@ResponseBody
public Object delete(@RequestParam Integer crmCustomerrabinId) {
crmCustomerrabinService.deleteById(crmCustomerrabinId);
return SUCCESS_TIP;
}
/**
* 修改客户回收管理
*/
@RequestMapping(value = "/update")
@ResponseBody
public Object update(CrmCustomerrabin crmCustomerrabin) {
crmCustomerrabinService.updateById(crmCustomerrabin);
return SUCCESS_TIP;
}
/**
* 客户回收管理详情
*/
@RequestMapping(value = "/detail/{crmCustomerrabinId}")
@ResponseBody
public Object detail(@PathVariable("crmCustomerrabinId") Integer crmCustomerrabinId) {
return crmCustomerrabinService.selectById(crmCustomerrabinId);
}
}
|
UTF-8
|
Java
| 3,205 |
java
|
CrmCustomerrabinController.java
|
Java
|
[
{
"context": "tomerrabinService;\n\n/**\n * 客户回收管理控制器\n *\n * @author fengshuonan\n * @Date 2018-09-30 09:27:08\n */\n@Controller\n@Req",
"end": 743,
"score": 0.9903823733329773,
"start": 732,
"tag": "USERNAME",
"value": "fengshuonan"
}
] | null |
[] |
package com.stylefeng.guns.modular.crm.controller;
import com.stylefeng.guns.core.base.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestParam;
import com.stylefeng.guns.modular.system.model.CrmCustomerrabin;
import com.stylefeng.guns.modular.crm.service.ICrmCustomerrabinService;
/**
* 客户回收管理控制器
*
* @author fengshuonan
* @Date 2018-09-30 09:27:08
*/
@Controller
@RequestMapping("/crmCustomerrabin")
public class CrmCustomerrabinController extends BaseController {
private String PREFIX = "/crm/crmCustomerrabin/";
@Autowired
private ICrmCustomerrabinService crmCustomerrabinService;
/**
* 跳转到客户回收管理首页
*/
@RequestMapping("")
public String index() {
return PREFIX + "crmCustomerrabin.html";
}
/**
* 跳转到添加客户回收管理
*/
@RequestMapping("/crmCustomerrabin_add")
public String crmCustomerrabinAdd() {
return PREFIX + "crmCustomerrabin_add.html";
}
/**
* 跳转到修改客户回收管理
*/
@RequestMapping("/crmCustomerrabin_update/{crmCustomerrabinId}")
public String crmCustomerrabinUpdate(@PathVariable Integer crmCustomerrabinId, Model model) {
CrmCustomerrabin crmCustomerrabin = crmCustomerrabinService.selectById(crmCustomerrabinId);
model.addAttribute("item",crmCustomerrabin);
LogObjectHolder.me().set(crmCustomerrabin);
return PREFIX + "crmCustomerrabin_edit.html";
}
/**
* 获取客户回收管理列表
*/
@RequestMapping(value = "/list")
@ResponseBody
public Object list(String condition) {
return crmCustomerrabinService.selectList(null);
}
/**
* 新增客户回收管理
*/
@RequestMapping(value = "/add")
@ResponseBody
public Object add(CrmCustomerrabin crmCustomerrabin) {
crmCustomerrabinService.insert(crmCustomerrabin);
return SUCCESS_TIP;
}
/**
* 删除客户回收管理
*/
@RequestMapping(value = "/delete")
@ResponseBody
public Object delete(@RequestParam Integer crmCustomerrabinId) {
crmCustomerrabinService.deleteById(crmCustomerrabinId);
return SUCCESS_TIP;
}
/**
* 修改客户回收管理
*/
@RequestMapping(value = "/update")
@ResponseBody
public Object update(CrmCustomerrabin crmCustomerrabin) {
crmCustomerrabinService.updateById(crmCustomerrabin);
return SUCCESS_TIP;
}
/**
* 客户回收管理详情
*/
@RequestMapping(value = "/detail/{crmCustomerrabinId}")
@ResponseBody
public Object detail(@PathVariable("crmCustomerrabinId") Integer crmCustomerrabinId) {
return crmCustomerrabinService.selectById(crmCustomerrabinId);
}
}
| 3,205 | 0.71057 | 0.70596 | 104 | 28.201923 | 25.808235 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.288462 | false | false |
13
|
02ad730f7f51c158e6326e5d4b90680bfc340f9e
| 18,932,215,850,228 |
a59b43113a88049ff1245f45176ea037a7566efe
|
/HobbyHubWebApp/src/edu/ycp/cs320/hobbyhub/server/DerbyDatabase.java
|
81c8752fd5e95345df3ac1962b1459a2b566b082
|
[] |
no_license
|
Mfioravan/HobbyHub
|
https://github.com/Mfioravan/HobbyHub
|
7649d598af9f3920cc0bf0a5c9c528bd5c04c89a
|
b3c7dd6ae65ae740cc4835b7c8dff92f1f64f0f2
|
refs/heads/master
| 2020-05-20T03:00:35.122000 | 2014-05-13T19:23:52 | 2014-05-13T19:23:52 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package edu.ycp.cs320.hobbyhub.server;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.apache.bcel.generic.FREM;
import org.apache.tools.ant.taskdefs.SQLExec.Transaction;
import com.google.gwt.i18n.client.Messages.Select;
import edu.ycp.cs320.hobbyhub.server.persist.IDatabase;
import edu.ycp.cs320.hobbyhub.shared.Hobby;
import edu.ycp.cs320.hobbyhub.shared.Message;
import edu.ycp.cs320.hobbyhub.shared.User;
public class DerbyDatabase implements IDatabase {
private interface Transaction<ResultType> {
public ResultType execute(Connection conn) throws SQLException;
}
private static final int MAX_ATTEMPTS = 10;
@Override
public User getUser(int userID) {
org.apache.bcel.generic.Select USERID;
FREM USERS;
return null;
}
@Override
public User login(String username, String password) {
// TODO Auto-generated method stub
return null;
}
@Override
public void addAccount(User user) {
// TODO Auto-generated method stub
}
@Override
public boolean checkExistence(String username) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean verifyAccount(String usr, String password) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean createAccount(String username, String password, int userID,
String firstname, String lastname, String email) {
// TODO Auto-generated method stub
return false;
}
@Override
public int getUserID(String username) {
// TODO Auto-generated method stub
return 0;
}
@Override
public User getUser(String username) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean addMessage(int userID, Message mes) {
return false;
// TODO Auto-generated method stub
}
@Override
public ArrayList<Message> getMessages(User user) {
// TODO Auto-generated method stub
return null;
}
@Override
public ArrayList<Hobby> getHobbies(User user) {
// TODO Auto-generated method stub
return null;
}
public<ResultType> ResultType executeTransaction(Transaction<ResultType> txn) {
try {
return doExecuteTransaction(txn);
} catch (SQLException e) {
throw new PersistenceException("Transaction failed", e);
}
}
public<ResultType> ResultType doExecuteTransaction(Transaction<ResultType> txn) throws SQLException {
Connection conn = connect();
try {
int numAttempts = 0;
boolean success = false;
ResultType result = null;
while (!success && numAttempts < MAX_ATTEMPTS) {
try {
result = txn.execute(conn);
conn.commit();
success = true;
} catch (SQLException e) {
if (e.getSQLState() != null && e.getSQLState().equals("41000")) {
// Deadlock: retry (unless max retry count has been reached)
numAttempts++;
} else {
// Some other kind of SQLException
throw e;
}
}
}
if (!success) {
throw new SQLException("Transaction failed (too many retries)");
}
// Success!
return result;
} finally {
DBUtil.closeQuietly(conn);
}
}
private Connection connect() throws SQLException {
Connection conn = DriverManager.getConnection("jdbc:derby:users.db;create=true");
// Set autocommit to false to allow multiple the execution of
// multiple queries/statements as part of the same transaction.
conn.setAutoCommit(false);
return conn;
}
public void createTables() {
executeTransaction(new Transaction<Boolean>() {
@Override
public Boolean execute(Connection conn) throws SQLException {
PreparedStatement stmt1 = null;
try {
stmt1 = conn.prepareStatement(
"create table users (" +
" id integer primary key," +
" user_id integer," +
" first name(20)," +
" last name(20)" +
")");
stmt1.executeUpdate();
return true;
} finally {
DBUtil.closeQuietly(stmt1);
}
}
});
}
public void loadInitialData() {
executeTransaction(new Transaction<Boolean>() {
@Override
public Boolean execute(Connection conn) throws SQLException {
List<User> userList;
try {
userList = InitialData.getUsers();
} catch (IOException e) {
throw new SQLException("Couldn't read initial data", e);
}
PreparedStatement insertUser = null;
try {
insertUser = conn.prepareStatement("insert into users values (?, ?, ?, ?)");
for (User user : userList) {
insertUser.setInt(1, user.getuserID());
insertUser.setString(2, user.getFirstName());
insertUser.setString(3, user.getLastName());
insertUser.setString(4, user.getUserName());
insertUser.setString(5, user.getLocationState());
insertUser.setString(6, user.getLocationCity());
insertUser.addBatch();
}
insertUser.executeBatch();
return true;
} finally {
DBUtil.closeQuietly(insertUser);
}
}
});
}
@Override
public User getIDUser(int userID) {
throw new UnsupportedOperationException("TODO - implement");
}
@Override
public Hobby getHobby(String hobbyName) {
throw new UnsupportedOperationException("TODO - implement");
}
@Override
public boolean editAccount(int userID, String firstname,
String lastname, String email, String city, String state) {
throw new UnsupportedOperationException("TODO - implement");
}
@Override
public boolean addHobby(int userID, Hobby hobby) {
throw new UnsupportedOperationException("TODO - implement");
}
@Override
public boolean removeHobby(String hobbyName, int userID) {
throw new UnsupportedOperationException("TODO - implement");
}
// The main method creates the database tables and loads the initial data.
public static void main(String[] args) throws IOException {
System.out.println("Creating tables...");
DerbyDatabase db = new DerbyDatabase();
db.createTables();
System.out.println("Loading initial data...");
db.loadInitialData();
System.out.println("Success!");
}
}
|
UTF-8
|
Java
| 6,153 |
java
|
DerbyDatabase.java
|
Java
|
[] | null |
[] |
package edu.ycp.cs320.hobbyhub.server;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.apache.bcel.generic.FREM;
import org.apache.tools.ant.taskdefs.SQLExec.Transaction;
import com.google.gwt.i18n.client.Messages.Select;
import edu.ycp.cs320.hobbyhub.server.persist.IDatabase;
import edu.ycp.cs320.hobbyhub.shared.Hobby;
import edu.ycp.cs320.hobbyhub.shared.Message;
import edu.ycp.cs320.hobbyhub.shared.User;
public class DerbyDatabase implements IDatabase {
private interface Transaction<ResultType> {
public ResultType execute(Connection conn) throws SQLException;
}
private static final int MAX_ATTEMPTS = 10;
@Override
public User getUser(int userID) {
org.apache.bcel.generic.Select USERID;
FREM USERS;
return null;
}
@Override
public User login(String username, String password) {
// TODO Auto-generated method stub
return null;
}
@Override
public void addAccount(User user) {
// TODO Auto-generated method stub
}
@Override
public boolean checkExistence(String username) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean verifyAccount(String usr, String password) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean createAccount(String username, String password, int userID,
String firstname, String lastname, String email) {
// TODO Auto-generated method stub
return false;
}
@Override
public int getUserID(String username) {
// TODO Auto-generated method stub
return 0;
}
@Override
public User getUser(String username) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean addMessage(int userID, Message mes) {
return false;
// TODO Auto-generated method stub
}
@Override
public ArrayList<Message> getMessages(User user) {
// TODO Auto-generated method stub
return null;
}
@Override
public ArrayList<Hobby> getHobbies(User user) {
// TODO Auto-generated method stub
return null;
}
public<ResultType> ResultType executeTransaction(Transaction<ResultType> txn) {
try {
return doExecuteTransaction(txn);
} catch (SQLException e) {
throw new PersistenceException("Transaction failed", e);
}
}
public<ResultType> ResultType doExecuteTransaction(Transaction<ResultType> txn) throws SQLException {
Connection conn = connect();
try {
int numAttempts = 0;
boolean success = false;
ResultType result = null;
while (!success && numAttempts < MAX_ATTEMPTS) {
try {
result = txn.execute(conn);
conn.commit();
success = true;
} catch (SQLException e) {
if (e.getSQLState() != null && e.getSQLState().equals("41000")) {
// Deadlock: retry (unless max retry count has been reached)
numAttempts++;
} else {
// Some other kind of SQLException
throw e;
}
}
}
if (!success) {
throw new SQLException("Transaction failed (too many retries)");
}
// Success!
return result;
} finally {
DBUtil.closeQuietly(conn);
}
}
private Connection connect() throws SQLException {
Connection conn = DriverManager.getConnection("jdbc:derby:users.db;create=true");
// Set autocommit to false to allow multiple the execution of
// multiple queries/statements as part of the same transaction.
conn.setAutoCommit(false);
return conn;
}
public void createTables() {
executeTransaction(new Transaction<Boolean>() {
@Override
public Boolean execute(Connection conn) throws SQLException {
PreparedStatement stmt1 = null;
try {
stmt1 = conn.prepareStatement(
"create table users (" +
" id integer primary key," +
" user_id integer," +
" first name(20)," +
" last name(20)" +
")");
stmt1.executeUpdate();
return true;
} finally {
DBUtil.closeQuietly(stmt1);
}
}
});
}
public void loadInitialData() {
executeTransaction(new Transaction<Boolean>() {
@Override
public Boolean execute(Connection conn) throws SQLException {
List<User> userList;
try {
userList = InitialData.getUsers();
} catch (IOException e) {
throw new SQLException("Couldn't read initial data", e);
}
PreparedStatement insertUser = null;
try {
insertUser = conn.prepareStatement("insert into users values (?, ?, ?, ?)");
for (User user : userList) {
insertUser.setInt(1, user.getuserID());
insertUser.setString(2, user.getFirstName());
insertUser.setString(3, user.getLastName());
insertUser.setString(4, user.getUserName());
insertUser.setString(5, user.getLocationState());
insertUser.setString(6, user.getLocationCity());
insertUser.addBatch();
}
insertUser.executeBatch();
return true;
} finally {
DBUtil.closeQuietly(insertUser);
}
}
});
}
@Override
public User getIDUser(int userID) {
throw new UnsupportedOperationException("TODO - implement");
}
@Override
public Hobby getHobby(String hobbyName) {
throw new UnsupportedOperationException("TODO - implement");
}
@Override
public boolean editAccount(int userID, String firstname,
String lastname, String email, String city, String state) {
throw new UnsupportedOperationException("TODO - implement");
}
@Override
public boolean addHobby(int userID, Hobby hobby) {
throw new UnsupportedOperationException("TODO - implement");
}
@Override
public boolean removeHobby(String hobbyName, int userID) {
throw new UnsupportedOperationException("TODO - implement");
}
// The main method creates the database tables and loads the initial data.
public static void main(String[] args) throws IOException {
System.out.println("Creating tables...");
DerbyDatabase db = new DerbyDatabase();
db.createTables();
System.out.println("Loading initial data...");
db.loadInitialData();
System.out.println("Success!");
}
}
| 6,153 | 0.69137 | 0.684869 | 255 | 23.129412 | 22.35092 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.623529 | false | false |
13
|
008c4857192c47610af320db0e04f884c3a4bff3
| 12,635,793,799,047 |
f33f8af7eefc9a9452c3868c654b2eb6e34692d1
|
/Project2/test/edu/ncsu/csc216/androtech/model/repair_center/TechDroidTest.java
|
443972817529304e9ea2a43428b8829a9c7c6ca3
|
[] |
no_license
|
zacharyjones123/CSC316_Projects
|
https://github.com/zacharyjones123/CSC316_Projects
|
479b6f09deeaf92740aa0e8eae2801ba85cbb605
|
1a5f7ad945ecdf7dd21a67123e14c83cf8a579c6
|
refs/heads/master
| 2018-01-12T01:06:07.073000 | 2017-04-18T18:06:38 | 2017-04-18T18:06:38 | 55,608,186 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package edu.ncsu.csc216.androtech.model.repair_center;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import edu.ncsu.csc216.androtech.model.devices.BadDeviceInformationException;
import edu.ncsu.csc216.androtech.model.devices.ComDevice;
import edu.ncsu.csc216.androtech.model.devices.Device;
import edu.ncsu.csc216.androtech.model.devices.VRDevice;
/**
* The test class for TechDroid
*
* @author Zachary R. Jones
*
*/
public class TechDroidTest {
/** Com Droid 1 */
private TechDroid comDroid1;
/** VR Droid 1 */
private TechDroid vrDroid1;
/** ExpertDroid 1 */
private TechDroid expertDroid1;
/** Other Droid 4 */
private TechDroid otherDroid4;
/** Other Droid 5 */
private TechDroid otherDroid5;
/** Other Droid 6 */
private TechDroid otherDroid6;
/** Other Droid 7 */
private TechDroid otherDroid7;
/** Other Droid 8 */
private TechDroid otherDroid8;
/** Other Droid 9 */
private TechDroid otherDroid9;
/** Other Droid 10 */
private TechDroid otherDroid10;
/** other Droid11 */
private TechDroid otherDroid11;
/** Device 1 -- ComDevice */
private Device device1;
/** Device 2 -- VRDevice */
private Device device2;
/** Device 3 -- ComDevice */
private Device device3;
/** Device 4 -- VRDevice */
private Device device4;
/**
* The setup class for TechDroidTest
*
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
comDroid1 = new ComDroid();
vrDroid1 = new VRDroid();
expertDroid1 = new ExpertDroid();
otherDroid4 = new ComDroid();
otherDroid5 = new ComDroid();
otherDroid6 = new ComDroid();
otherDroid7 = new ComDroid();
otherDroid8 = new ComDroid();
otherDroid9 = new ComDroid();
otherDroid10 = new ComDroid();
otherDroid11 = new ComDroid();
device1 = new ComDevice("0000001", "Man 1", 0);
device2 = new VRDevice("0000002", "Man 2", 0);
device3 = new ComDevice("0000003", "Man 3", 0);
device4 = new VRDevice("0000004", "Man 4", 0);
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#startDroidNumberingAt01()}
* .
*/
@Test
public void testStartDroidNumberingAt01() {
// Need a way to see what the Starting Number in TechDroid actually is
TechDroid.startDroidNumberingAt01();
comDroid1 = new ComDroid();
assertEquals(comDroid1.getDroidID().equals("01C"), true);
TechDroid.startDroidNumberingAt01();
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.getDroidID().equals("01V"), true);
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#TechDroid(java.lang.String)}
* .
*/
@Test
public void testTechDroid() { // Done
// test for ComDroids
TechDroid.startDroidNumberingAt01();
comDroid1 = new ComDroid();
assertEquals(comDroid1.getDroidID().equals("01C"), true);
// test for VRDroids
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.getDroidID().equals("02V"), true);
// test for ExpertDroids
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.getDroidID().equals("03E"), true);
otherDroid4 = new ComDroid();
assertEquals(otherDroid4.getDroidID().equals("04C"), true);
otherDroid5 = new ComDroid();
assertEquals(otherDroid5.getDroidID().equals("05C"), true);
otherDroid6 = new ComDroid();
assertEquals(otherDroid6.getDroidID().equals("06C"), true);
otherDroid7 = new ComDroid();
assertEquals(otherDroid7.getDroidID().equals("07C"), true);
otherDroid8 = new ComDroid();
assertEquals(otherDroid8.getDroidID().equals("08C"), true);
// test along the boundaries of the ZERO_BOUND
otherDroid9 = new ComDroid();
assertEquals(otherDroid9.getDroidID().equals("09C"), true);
otherDroid10 = new ComDroid();
assertEquals(otherDroid10.getDroidID().equals("10C"), true);
otherDroid11 = new ComDroid();
assertEquals(otherDroid11.getDroidID().equals("11C"), true);
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#getDroidID()}
* .
*/
@Test
public void testGetDroidID() { // DONE
TechDroid.startDroidNumberingAt01();
// test for ComDroids
comDroid1 = new ComDroid();
assertEquals(comDroid1.getDroidID(), "01C");
// test for VRDroids
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.getDroidID(), "02V");
// test for ExpertDroids
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.getDroidID(), "03E");
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#isAssigned()}
* .
*/
@Test
public void testIsAssigned() { // DONE
TechDroid.startDroidNumberingAt01();
// test for ComDroids
comDroid1 = new ComDroid();
assertEquals(comDroid1.isAssigned(), false);
// test for VRDroids
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.isAssigned(), false);
// test for ExpertDroids
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.isAssigned(), false);
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#release()}
* .
*/
@Test
public void testRelease() {
try {
TechDroid.startDroidNumberingAt01();
// a) ComDroid
comDroid1 = new ComDroid();
assertEquals(comDroid1.isAssigned(), false);
comDroid1.assign(device1);
assertEquals(comDroid1.isAssigned(), true);
assertEquals(comDroid1.release(), device1);
assertEquals(comDroid1.isAssigned(), false);
// b) VRDroid
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.isAssigned(), false);
vrDroid1.assign(device2);
assertEquals(vrDroid1.isAssigned(), true);
assertEquals(vrDroid1.release(), device2);
assertEquals(vrDroid1.isAssigned(), false);
// c) ExpertDroid
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.isAssigned(), false);
expertDroid1.assign(device1);
assertEquals(expertDroid1.isAssigned(), true);
assertEquals(expertDroid1.release(), device1);
assertEquals(expertDroid1.isAssigned(), false);
} catch (DroidDeviceMismatchException e) {
fail("The way the test is set up, this should not be thrown");
} catch (DroidBusyException e) {
fail("The way the test is set up, this hould not be thrown");
}
// Tests for trying to set up Droid that already has a device
// a) ComDroid
comDroid1 = new ComDroid();
assertEquals(comDroid1.isAssigned(), false);
assertEquals(comDroid1.release(), null);
// b) VRDroid
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.isAssigned(), false);
assertEquals(vrDroid1.release(), null);
// c) ExpertDroid
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.isAssigned(), false);
assertEquals(expertDroid1.release(), null);
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#assign(edu.ncsu.csc216.androtech.model.devices.Device)}
* .
* @throws DroidBusyException
* @throws BadDeviceInformationException
*/
@Test
public void testAssign() throws DroidBusyException, BadDeviceInformationException { // Need to figure out how to show it throwing the
// exceptions
// test for ComDroids (Not Assigned)
try {
TechDroid.startDroidNumberingAt01();
comDroid1 = new ComDroid();
assertEquals(comDroid1.isAssigned(), false);
comDroid1.assign(device1);
assertEquals(comDroid1.isAssigned(), true);
} catch (DroidDeviceMismatchException e) {
fail("Empty Droid, should not have reached here");
} catch (DroidBusyException e) {
fail("Empty Droid, should not have reached here");
}
// test for ComDroids (Assigned)
boolean thrown = false;
try {
comDroid1 = new ComDroid();
assertEquals(comDroid1.isAssigned(), false);
comDroid1.assign(device1);
assertEquals(comDroid1.isAssigned(), true);
comDroid1.assign(device3);
fail("Should not have gotten past here, assigning same device twice");
} catch (DroidDeviceMismatchException e) {
thrown = true;
} catch (DroidBusyException e) {
thrown = true;
}
assertTrue(thrown);
// test for VRDroids (Not Assigned).
try {
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.isAssigned(), false);
vrDroid1.assign(device2);
assertEquals(vrDroid1.isAssigned(), true);
} catch (DroidDeviceMismatchException e) {
fail("Empty Droid, should not have reached here");
} catch (DroidBusyException e) {
fail("Empty Droid, should not have reached here");
}
// test for VRDRoids (Assigned)
boolean thrown2 = false;
try {
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.isAssigned(), false);
vrDroid1.assign(device2);
assertEquals(vrDroid1.isAssigned(), true);
vrDroid1.assign(device4);
fail("Should not have gotten past here, assigning same device twice");
} catch (DroidDeviceMismatchException e) {
thrown2 = true;
} catch (DroidBusyException e) {
thrown2 = true;
}
assertTrue(thrown2);
// test for ExpertDroids (Not Assigned)
try {
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.isAssigned(), false);
expertDroid1.assign(device1);
assertEquals(expertDroid1.isAssigned(), true);
} catch (DroidDeviceMismatchException e) {
fail("Empty Droid, should not have reached here");
} catch (DroidBusyException e) {
fail("Empty Droid, should not have reached here");
}
// test for ExpertDroids (Assigned)
boolean thrown3 = false;
try {
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.isAssigned(), false);
expertDroid1.assign(device1);
assertEquals(expertDroid1.isAssigned(), true);
expertDroid1.assign(device1);
fail("Should not have gotten past here, assigning same device twice");
} catch (DroidDeviceMismatchException e) {
thrown3 = true;
} catch (DroidBusyException e) {
thrown3 = true;
}
assertTrue(thrown3);
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#toString()}
* .
* @throws DroidBusyException
* @throws BadDeviceInformationException
*/
@Test
public void testToString() throws DroidBusyException, BadDeviceInformationException { // Done
try {
TechDroid.startDroidNumberingAt01();
// test for ComDroids (Not Assigned).
comDroid1 = new ComDroid();
assertEquals(comDroid1.toString(), "01C: UNASSIGNED");
// test for ComDroids (Assigned).
comDroid1.assign(device1);
assertEquals(comDroid1.toString(), "01C: 0000001 Man 1");
// test for VRDroids (Not Assigned).
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.toString(), "02V: UNASSIGNED");
// test for VRDroids (Assigned).
vrDroid1.assign(device2);
assertEquals(vrDroid1.toString(), "02V: 0000002 Man 2");
// test for ExpertDroids (Not Assigned).
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.toString(), "03E: UNASSIGNED");
// test for ExpertDroids (Assigned).
expertDroid1.assign(device1);
assertEquals(expertDroid1.toString(), "03E: 0000001 Man 1");
} catch (DroidDeviceMismatchException e) {
throw new BadDeviceInformationException();
} catch (DroidBusyException e) {
throw new DroidBusyException();
}
}
}
|
UTF-8
|
Java
| 11,411 |
java
|
TechDroidTest.java
|
Java
|
[
{
"context": "\r\n * The test class for TechDroid\r\n * \r\n * @author Zachary R. Jones\r\n *\r\n */\r\npublic class TechDroidTest {\r\n\t/** Com ",
"end": 471,
"score": 0.9998813271522522,
"start": 455,
"tag": "NAME",
"value": "Zachary R. Jones"
}
] | null |
[] |
package edu.ncsu.csc216.androtech.model.repair_center;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import edu.ncsu.csc216.androtech.model.devices.BadDeviceInformationException;
import edu.ncsu.csc216.androtech.model.devices.ComDevice;
import edu.ncsu.csc216.androtech.model.devices.Device;
import edu.ncsu.csc216.androtech.model.devices.VRDevice;
/**
* The test class for TechDroid
*
* @author <NAME>
*
*/
public class TechDroidTest {
/** Com Droid 1 */
private TechDroid comDroid1;
/** VR Droid 1 */
private TechDroid vrDroid1;
/** ExpertDroid 1 */
private TechDroid expertDroid1;
/** Other Droid 4 */
private TechDroid otherDroid4;
/** Other Droid 5 */
private TechDroid otherDroid5;
/** Other Droid 6 */
private TechDroid otherDroid6;
/** Other Droid 7 */
private TechDroid otherDroid7;
/** Other Droid 8 */
private TechDroid otherDroid8;
/** Other Droid 9 */
private TechDroid otherDroid9;
/** Other Droid 10 */
private TechDroid otherDroid10;
/** other Droid11 */
private TechDroid otherDroid11;
/** Device 1 -- ComDevice */
private Device device1;
/** Device 2 -- VRDevice */
private Device device2;
/** Device 3 -- ComDevice */
private Device device3;
/** Device 4 -- VRDevice */
private Device device4;
/**
* The setup class for TechDroidTest
*
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
comDroid1 = new ComDroid();
vrDroid1 = new VRDroid();
expertDroid1 = new ExpertDroid();
otherDroid4 = new ComDroid();
otherDroid5 = new ComDroid();
otherDroid6 = new ComDroid();
otherDroid7 = new ComDroid();
otherDroid8 = new ComDroid();
otherDroid9 = new ComDroid();
otherDroid10 = new ComDroid();
otherDroid11 = new ComDroid();
device1 = new ComDevice("0000001", "Man 1", 0);
device2 = new VRDevice("0000002", "Man 2", 0);
device3 = new ComDevice("0000003", "Man 3", 0);
device4 = new VRDevice("0000004", "Man 4", 0);
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#startDroidNumberingAt01()}
* .
*/
@Test
public void testStartDroidNumberingAt01() {
// Need a way to see what the Starting Number in TechDroid actually is
TechDroid.startDroidNumberingAt01();
comDroid1 = new ComDroid();
assertEquals(comDroid1.getDroidID().equals("01C"), true);
TechDroid.startDroidNumberingAt01();
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.getDroidID().equals("01V"), true);
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#TechDroid(java.lang.String)}
* .
*/
@Test
public void testTechDroid() { // Done
// test for ComDroids
TechDroid.startDroidNumberingAt01();
comDroid1 = new ComDroid();
assertEquals(comDroid1.getDroidID().equals("01C"), true);
// test for VRDroids
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.getDroidID().equals("02V"), true);
// test for ExpertDroids
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.getDroidID().equals("03E"), true);
otherDroid4 = new ComDroid();
assertEquals(otherDroid4.getDroidID().equals("04C"), true);
otherDroid5 = new ComDroid();
assertEquals(otherDroid5.getDroidID().equals("05C"), true);
otherDroid6 = new ComDroid();
assertEquals(otherDroid6.getDroidID().equals("06C"), true);
otherDroid7 = new ComDroid();
assertEquals(otherDroid7.getDroidID().equals("07C"), true);
otherDroid8 = new ComDroid();
assertEquals(otherDroid8.getDroidID().equals("08C"), true);
// test along the boundaries of the ZERO_BOUND
otherDroid9 = new ComDroid();
assertEquals(otherDroid9.getDroidID().equals("09C"), true);
otherDroid10 = new ComDroid();
assertEquals(otherDroid10.getDroidID().equals("10C"), true);
otherDroid11 = new ComDroid();
assertEquals(otherDroid11.getDroidID().equals("11C"), true);
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#getDroidID()}
* .
*/
@Test
public void testGetDroidID() { // DONE
TechDroid.startDroidNumberingAt01();
// test for ComDroids
comDroid1 = new ComDroid();
assertEquals(comDroid1.getDroidID(), "01C");
// test for VRDroids
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.getDroidID(), "02V");
// test for ExpertDroids
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.getDroidID(), "03E");
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#isAssigned()}
* .
*/
@Test
public void testIsAssigned() { // DONE
TechDroid.startDroidNumberingAt01();
// test for ComDroids
comDroid1 = new ComDroid();
assertEquals(comDroid1.isAssigned(), false);
// test for VRDroids
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.isAssigned(), false);
// test for ExpertDroids
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.isAssigned(), false);
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#release()}
* .
*/
@Test
public void testRelease() {
try {
TechDroid.startDroidNumberingAt01();
// a) ComDroid
comDroid1 = new ComDroid();
assertEquals(comDroid1.isAssigned(), false);
comDroid1.assign(device1);
assertEquals(comDroid1.isAssigned(), true);
assertEquals(comDroid1.release(), device1);
assertEquals(comDroid1.isAssigned(), false);
// b) VRDroid
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.isAssigned(), false);
vrDroid1.assign(device2);
assertEquals(vrDroid1.isAssigned(), true);
assertEquals(vrDroid1.release(), device2);
assertEquals(vrDroid1.isAssigned(), false);
// c) ExpertDroid
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.isAssigned(), false);
expertDroid1.assign(device1);
assertEquals(expertDroid1.isAssigned(), true);
assertEquals(expertDroid1.release(), device1);
assertEquals(expertDroid1.isAssigned(), false);
} catch (DroidDeviceMismatchException e) {
fail("The way the test is set up, this should not be thrown");
} catch (DroidBusyException e) {
fail("The way the test is set up, this hould not be thrown");
}
// Tests for trying to set up Droid that already has a device
// a) ComDroid
comDroid1 = new ComDroid();
assertEquals(comDroid1.isAssigned(), false);
assertEquals(comDroid1.release(), null);
// b) VRDroid
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.isAssigned(), false);
assertEquals(vrDroid1.release(), null);
// c) ExpertDroid
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.isAssigned(), false);
assertEquals(expertDroid1.release(), null);
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#assign(edu.ncsu.csc216.androtech.model.devices.Device)}
* .
* @throws DroidBusyException
* @throws BadDeviceInformationException
*/
@Test
public void testAssign() throws DroidBusyException, BadDeviceInformationException { // Need to figure out how to show it throwing the
// exceptions
// test for ComDroids (Not Assigned)
try {
TechDroid.startDroidNumberingAt01();
comDroid1 = new ComDroid();
assertEquals(comDroid1.isAssigned(), false);
comDroid1.assign(device1);
assertEquals(comDroid1.isAssigned(), true);
} catch (DroidDeviceMismatchException e) {
fail("Empty Droid, should not have reached here");
} catch (DroidBusyException e) {
fail("Empty Droid, should not have reached here");
}
// test for ComDroids (Assigned)
boolean thrown = false;
try {
comDroid1 = new ComDroid();
assertEquals(comDroid1.isAssigned(), false);
comDroid1.assign(device1);
assertEquals(comDroid1.isAssigned(), true);
comDroid1.assign(device3);
fail("Should not have gotten past here, assigning same device twice");
} catch (DroidDeviceMismatchException e) {
thrown = true;
} catch (DroidBusyException e) {
thrown = true;
}
assertTrue(thrown);
// test for VRDroids (Not Assigned).
try {
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.isAssigned(), false);
vrDroid1.assign(device2);
assertEquals(vrDroid1.isAssigned(), true);
} catch (DroidDeviceMismatchException e) {
fail("Empty Droid, should not have reached here");
} catch (DroidBusyException e) {
fail("Empty Droid, should not have reached here");
}
// test for VRDRoids (Assigned)
boolean thrown2 = false;
try {
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.isAssigned(), false);
vrDroid1.assign(device2);
assertEquals(vrDroid1.isAssigned(), true);
vrDroid1.assign(device4);
fail("Should not have gotten past here, assigning same device twice");
} catch (DroidDeviceMismatchException e) {
thrown2 = true;
} catch (DroidBusyException e) {
thrown2 = true;
}
assertTrue(thrown2);
// test for ExpertDroids (Not Assigned)
try {
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.isAssigned(), false);
expertDroid1.assign(device1);
assertEquals(expertDroid1.isAssigned(), true);
} catch (DroidDeviceMismatchException e) {
fail("Empty Droid, should not have reached here");
} catch (DroidBusyException e) {
fail("Empty Droid, should not have reached here");
}
// test for ExpertDroids (Assigned)
boolean thrown3 = false;
try {
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.isAssigned(), false);
expertDroid1.assign(device1);
assertEquals(expertDroid1.isAssigned(), true);
expertDroid1.assign(device1);
fail("Should not have gotten past here, assigning same device twice");
} catch (DroidDeviceMismatchException e) {
thrown3 = true;
} catch (DroidBusyException e) {
thrown3 = true;
}
assertTrue(thrown3);
}
/**
* Test method for
* {@link edu.ncsu.csc216.androtech.model.repair_center.TechDroid#toString()}
* .
* @throws DroidBusyException
* @throws BadDeviceInformationException
*/
@Test
public void testToString() throws DroidBusyException, BadDeviceInformationException { // Done
try {
TechDroid.startDroidNumberingAt01();
// test for ComDroids (Not Assigned).
comDroid1 = new ComDroid();
assertEquals(comDroid1.toString(), "01C: UNASSIGNED");
// test for ComDroids (Assigned).
comDroid1.assign(device1);
assertEquals(comDroid1.toString(), "01C: 0000001 Man 1");
// test for VRDroids (Not Assigned).
vrDroid1 = new VRDroid();
assertEquals(vrDroid1.toString(), "02V: UNASSIGNED");
// test for VRDroids (Assigned).
vrDroid1.assign(device2);
assertEquals(vrDroid1.toString(), "02V: 0000002 Man 2");
// test for ExpertDroids (Not Assigned).
expertDroid1 = new ExpertDroid();
assertEquals(expertDroid1.toString(), "03E: UNASSIGNED");
// test for ExpertDroids (Assigned).
expertDroid1.assign(device1);
assertEquals(expertDroid1.toString(), "03E: 0000001 Man 1");
} catch (DroidDeviceMismatchException e) {
throw new BadDeviceInformationException();
} catch (DroidBusyException e) {
throw new DroidBusyException();
}
}
}
| 11,401 | 0.68285 | 0.652353 | 371 | 28.762804 | 21.781017 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.3531 | false | false |
13
|
4efa7d35d235a4939569cf0bd4cc8e6750602042
| 23,699,629,554,891 |
bbfe04867de69ae03bd029b8f081845611c6e8b3
|
/command/src/com/github/command/Client.java
|
c7f201024d0b7e65b89bab717ec163add41bbc0a
|
[] |
no_license
|
JazzKittens/design_patterns
|
https://github.com/JazzKittens/design_patterns
|
8256421deac85b8b3751366de54dd5c62faba78c
|
0e9f221d970939d77477d348cd7414f588483b89
|
refs/heads/master
| 2016-08-12T20:24:52.624000 | 2016-02-12T23:56:22 | 2016-02-12T23:56:22 | 50,986,486 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.github.command;
/*
The client makes the initial request.
Command objects are passed a receiver object and optional prameter.
Each command object has an interface.
Invoker does the actual invocation.
*/
public class Client {
public static void main(String[] args) {
Receiver receiver = new Receiver();
ConcreteCommandOne cmd1 = new ConcreteCommandOne(receiver);
ConcreteCommandTwo cmd2 = new ConcreteCommandTwo(receiver, "Command two with a parameter!");
Invoker invoker = new Invoker();
invoker.execute(cmd1);
invoker.execute(cmd2);
}
}
|
UTF-8
|
Java
| 622 |
java
|
Client.java
|
Java
|
[] | null |
[] |
package com.github.command;
/*
The client makes the initial request.
Command objects are passed a receiver object and optional prameter.
Each command object has an interface.
Invoker does the actual invocation.
*/
public class Client {
public static void main(String[] args) {
Receiver receiver = new Receiver();
ConcreteCommandOne cmd1 = new ConcreteCommandOne(receiver);
ConcreteCommandTwo cmd2 = new ConcreteCommandTwo(receiver, "Command two with a parameter!");
Invoker invoker = new Invoker();
invoker.execute(cmd1);
invoker.execute(cmd2);
}
}
| 622 | 0.694534 | 0.688103 | 20 | 30.1 | 26.733686 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45 | false | false |
13
|
f27cd8b91cc2823537fe3765960e0ae01a296101
| 23,115,514,001,148 |
5263c1b2a10b2d64bc6082b1c3fb7f02b28dd12a
|
/src/main/java/FlyWeight/WhiteChess.java
|
7826fd54f7115c402e1b08c24fbd5c99599a22f5
|
[] |
no_license
|
fxkcsdn/dm
|
https://github.com/fxkcsdn/dm
|
5127f081f3629a783104295e0c94f896ac9a1f41
|
7ad8a95110d87498bb2cec02c0bf35441c9705fa
|
refs/heads/develop
| 2023-02-21T17:22:59.164000 | 2021-01-21T12:09:02 | 2021-01-21T12:09:02 | 331,193,810 | 0 | 2 | null | false | 2021-01-20T05:14:16 | 2021-01-20T04:37:51 | 2021-01-20T05:10:59 | 2021-01-20T05:12:33 | 0 | 0 | 0 | 0 |
Java
| false | false |
package FlyWeight;
import java.awt.*;
public class WhiteChess implements Chess {
public void draw(Point point) {
System.out.println("白棋落子在,x="+point.x+",y="+point.y);
}
}
|
UTF-8
|
Java
| 201 |
java
|
WhiteChess.java
|
Java
|
[] | null |
[] |
package FlyWeight;
import java.awt.*;
public class WhiteChess implements Chess {
public void draw(Point point) {
System.out.println("白棋落子在,x="+point.x+",y="+point.y);
}
}
| 201 | 0.656085 | 0.656085 | 9 | 20 | 20.504742 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false |
13
|
d626a8e001b655c9c5eae01698be843d4e1c832b
| 14,654,428,432,242 |
868755a2bd272e282f20684ce4f4a6f7a1fbdc01
|
/picker/src/main/java/me/chanchangxing/picker/PickView.java
|
be018b70af4a7f91c6012b9ea7bfc491779b81cb
|
[] |
no_license
|
chanchangxing/cityseletor
|
https://github.com/chanchangxing/cityseletor
|
d6810edfee1b42123ee5ac101f4160004e13a942
|
ee80e815f848970b0bee0789d05da222ba52ee02
|
refs/heads/master
| 2021-09-07T11:26:07.045000 | 2018-02-22T08:43:57 | 2018-02-22T08:43:57 | 115,787,272 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package me.chanchangxing.picker;
import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import me.chanchangxing.picker.WheelView.OnWheelChangedListener;
import me.chanchangxing.picker.WheelView.WheelView;
import me.chanchangxing.picker.WheelView.adapters.ArrayWheelAdapter;
/**
*
* Created by apple on 16/4/25.
*/
public class PickView extends LinearLayout implements OnWheelChangedListener, View.OnClickListener {
private Context mContext;
private View view = null;
private RelativeLayout mRelativeLayout;
private LinearLayout mLinearLayout;
private PopupWindow mPopWindow;
private WheelView[] wheelViews;
private Object[] mDatas;
private int mCount = -1;
private int mMaxColumn = 3;
private TextView cancelTextView;
private TextView sureTextView;
private TextView selectedTextView;
private List<Item> mItems;
private int [] selectedIndexs;
private OnSelectListener onSelectListener = null;
private OnStateChangeListener onStateChangeListener = null;
public boolean isShow = false;
public PickView(Context context) {
this(context, null, 0);
System.out.println("---UIPickerView(Context context) -----");
}
public PickView(Context context, View view) {
this(context, null, 0);
System.out.println("---UIPickerView(Context context) -----");
this.view = view;
}
public PickView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
System.out.println("---UIPickerView(Context context, AttributeSet attrs) -----");
}
public PickView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
System.out.println("---UIPickerView(Context context, AttributeSet attrs, int defStyleAttr) -----");
this.mContext = context;
setOrientation(HORIZONTAL);//设置基布局方向为垂直方向
setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}
private void setPickerViewColumns(int columns){
if (columns <= 0){
throw new IllegalArgumentException("columns - 参数不匹配, columns不能小于1");
}
if (columns > mMaxColumn){
throw new IllegalArgumentException("columns - 参数不匹配, columns不能大于3");
}
mCount = columns;
wheelViews = new WheelView[mCount];
mDatas = new Object[mCount];
selectedIndexs = new int[mCount];
mRelativeLayout = new RelativeLayout(mContext);
mRelativeLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
mRelativeLayout.setBackgroundColor(Color.parseColor("#4f000000"));
LinearLayout linearLayout = new LinearLayout(mContext);
linearLayout.setOrientation(VERTICAL);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
linearLayout.setLayoutParams(layoutParams);
mRelativeLayout.addView(linearLayout);
LayoutParams layoutParams0 = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dip2px(mContext, 45));
LinearLayout linearLayout1 = new LinearLayout(mContext);
linearLayout1.setOrientation(HORIZONTAL);
linearLayout1.setLayoutParams(layoutParams0);
linearLayout1.setBackgroundColor(Color.WHITE);
linearLayout.addView(linearLayout1);
LayoutParams layoutParams1 = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
cancelTextView = new TextView(mContext);
cancelTextView.setText("取消");
cancelTextView.setTextColor(Color.parseColor("#00abdd"));
cancelTextView.setTextSize(18);
cancelTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
cancelTextView.setPadding(dip2px(mContext, 16), 0, 0, 0);
cancelTextView.setLayoutParams(layoutParams1);
cancelTextView.setOnClickListener(this);
linearLayout1.addView(cancelTextView);
selectedTextView = new TextView(mContext);
selectedTextView.setText("暂无");
selectedTextView.setTextColor(Color.parseColor("#d0d0d0"));
selectedTextView.setTextSize(16);
selectedTextView.setSingleLine(true);
selectedTextView.setGravity(Gravity.CENTER);
selectedTextView.setPadding(dip2px(mContext, 5), 0, dip2px(mContext, 5), 0);
selectedTextView.setLayoutParams(new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1));
selectedTextView.setOnClickListener(this);
selectedTextView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
//Toast.makeText(mContext, "textView", Toast.LENGTH_SHORT).show();
return true;
}
});
linearLayout1.addView(selectedTextView);
LayoutParams layoutParams2 = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
sureTextView = new TextView(mContext);
sureTextView.setText("确定");
sureTextView.setTextColor(Color.parseColor("#00abdd"));
sureTextView.setTextSize(18);
sureTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
sureTextView.setPadding(0, 0, dip2px(mContext, 16), 0);
sureTextView.setLayoutParams(layoutParams2);
sureTextView.setOnClickListener(this);
linearLayout1.addView(sureTextView);
mLinearLayout = new LinearLayout(mContext);
mLinearLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
mLinearLayout.setBackgroundColor(Color.WHITE);
linearLayout.addView(mLinearLayout);
//初始化
for (int index=0; index<mCount; index++){
wheelViews[index] = new WheelView(mContext);
wheelViews[index].setLayoutParams(new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1));
//ArrayWheelAdapter adapter = new ArrayWheelAdapter<String>(mContext, items);
//wheelViews[index].setViewAdapter(adapter);
wheelViews[index].setVisibleItems(7);
//wheelViews[index].setWheelBackground(Resources.getSystem().getColor(Color.WHITE));
mLinearLayout.addView(wheelViews[index], index);
wheelViews[index].setTag(index);
wheelViews[index].addChangingListener(this);
}
}
private void setPickerViewDatasAtIndex(int index, List<String> lists){
if (index < 0 || index > mCount - 1){
throw new IllegalArgumentException("index - 参数不匹配, index不能大于" + String.valueOf(mCount - 1) + "或不能小于0");
}
String[] items;
if (lists.size() == 0 || lists == null){
//return;
//throw new IllegalArgumentException("lists - 参数不匹配, lists不能为null或空");
items = new String[0];
mDatas[index] = items;
} else {
items = (String[])lists.toArray(new String[lists.size()]);
mDatas[index] = items;
}
// wheelViews[index] = new WheelView(mContext);
// wheelViews[index].setLayoutParams(new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1));
ArrayWheelAdapter adapter = new ArrayWheelAdapter<String>(mContext, items);
wheelViews[index].setViewAdapter(adapter);
wheelViews[index].setCurrentItem(0);
// wheelViews[index].setVisibleItems(7);
//wheelViews[index].setWheelBackground(Resources.getSystem().getColor(Color.WHITE));
// mLinearLayout.addView(wheelViews[index], index);
// wheelViews[index].setTag(index);
// wheelViews[index].addChangingListener(this);
}
private void setPickerViewDatasAtIndex(int index, String[] items){
if (index < 0 || index > mCount - 1){
throw new IllegalArgumentException("index - 参数不匹配, index不能大于" + String.valueOf(mCount - 1) + "或不能小于0");
}
if (items.length == 0 || items == null){
throw new IllegalArgumentException("items - 参数不匹配, items不能为null或空");
}
mDatas[index] = items;
// wheelViews[index] = new WheelView(mContext);
// wheelViews[index].setLayoutParams(new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1));
ArrayWheelAdapter adapter = new ArrayWheelAdapter<String>(mContext, items);
wheelViews[index].setViewAdapter(adapter);
// wheelViews[index].setVisibleItems(7);
//wheelViews[index].setWheelBackground(Color.WHITE);
// mLinearLayout.addView(wheelViews[index], index);
// wheelViews[index].setTag(index);
// wheelViews[index].addChangingListener(this);
}
public void show() {
int num = 0;
for (int i=0; i<mCount; i++){
if (wheelViews[i] == null){
num ++;
}
}
if (num == mCount){
throw new IllegalArgumentException("UIPickerView 无数据填充,无法显示");
}
mPopWindow = new PopupWindow(mRelativeLayout);
mPopWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
mPopWindow.setHeight(ViewGroup.LayoutParams.MATCH_PARENT);
mPopWindow.setAnimationStyle(R.style.contextMenuAnim);//设置动画所对应的style
mPopWindow.setFocusable(false);
mPopWindow.setOutsideTouchable(false);
mPopWindow.showAtLocation(mRelativeLayout, Gravity.BOTTOM, 0, 0);
mPopWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);//http://blog.csdn.net/u013277740/article/details/50427523
// popView添加OnTouchListener监听判断获取触屏位置如果在选择框外面则销毁弹出框
mRelativeLayout.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
dismiss();
return false;
}
});
isShow = true;
if (onStateChangeListener != null){
onStateChangeListener.OnStateChange(this, isShow);
}
}
public void dismiss(){
if (mPopWindow != null && mPopWindow.isShowing()) {
mPopWindow.dismiss();
mPopWindow = null;
isShow = false;
if (onStateChangeListener != null){
onStateChangeListener.OnStateChange(this, isShow);
}
}
}
/**
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
*/
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
/**
* 根据手机的分辨率从 px(像素) 的单位 转成为 dp
*/
public static int px2dip(Context context, float pxValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}
@Override
public void onChanged(WheelView wheel, int oldValue, int newValue) {
int index = (int) wheel.getTag();
if (mCount == 1){
int pCurrent = wheelViews[index].getCurrentItem();
selectedIndexs[0] = pCurrent;
setSelectedTextView();
}
else if (mCount == 2){
if (index == 0) {
int pCurrent = wheelViews[index].getCurrentItem();
selectedIndexs[0] = pCurrent;
selectedIndexs[1] = 0;
setPickerViewDatasAtIndex2(1, mItems.get(selectedIndexs[0]).items);
} else if (index == 1) {
int pCurrent = wheelViews[index].getCurrentItem();
selectedIndexs[1] = pCurrent;
}
setSelectedTextView();
}
else if (mCount == 3) {
if (index == 0) {
int pCurrent = wheelViews[index].getCurrentItem();
selectedIndexs[0] = pCurrent;
selectedIndexs[1] = 0;
selectedIndexs[2] = 0;
setPickerViewDatasAtIndex2(1, mItems.get(selectedIndexs[0]).items);
setPickerViewDatasAtIndex2(2, mItems.get(selectedIndexs[0]).items.get(selectedIndexs[1]).items);
} else if (index == 1) {
int pCurrent = wheelViews[index].getCurrentItem();
selectedIndexs[1] = pCurrent;
selectedIndexs[2] = 0;
setPickerViewDatasAtIndex2(2, mItems.get(selectedIndexs[0]).items.get(selectedIndexs[1]).items);
} else if (index == 2) {
int pCurrent = wheelViews[index].getCurrentItem();
selectedIndexs[2] = pCurrent;
}
setSelectedTextView();
}
}
@Override
public void onClick(View v) {
TextView textView = (TextView) v;
if (textView == cancelTextView){
//取消
//Toast.makeText(mContext, "取消", Toast.LENGTH_SHORT).show();
dismiss();
}
else if (textView == sureTextView){
//确定
//Toast.makeText(mContext, "确定", Toast.LENGTH_SHORT).show();
if (onSelectListener != null){
if (view != null){
onSelectListener.OnSelectItemClick(view, selectedIndexs, selectedTextView.getText().toString());
} else {
onSelectListener.OnSelectItemClick(this, selectedIndexs, selectedTextView.getText().toString());
}
}
dismiss();
}
else if (textView == selectedTextView){
Toast.makeText(mContext, "selectedTextView", Toast.LENGTH_SHORT).show();
}
}
public enum Style {
SINGLE, DOUBLE, THREE
}
public void setPickerView(List<Item> items, Style style){
this.mItems = items;
if (style == Style.SINGLE)
{
mCount = 1;
setPickerViewColumns(1);//1级
selectedIndexs[0] = 0;
setPickerViewDatasAtIndex2(0, items);
setSelectedTextView();
}
else if (style == Style.DOUBLE)
{
mCount = 2;
setPickerViewColumns(2);
selectedIndexs[0] = 0;
selectedIndexs[1] = 0;
setPickerViewDatasAtIndex2(0, items);
setPickerViewDatasAtIndex2(1, items.get(selectedIndexs[0]).items);
setSelectedTextView();
}
else if (style == Style.THREE)
{
mCount = 3;
setPickerViewColumns(3);
selectedIndexs[0] = 0;
selectedIndexs[1] = 0;
selectedIndexs[2] = 0;
setPickerViewDatasAtIndex2(0, items);
setPickerViewDatasAtIndex2(1, items.get(selectedIndexs[0]).items);
setPickerViewDatasAtIndex2(2, items.get(selectedIndexs[0]).items.get(selectedIndexs[1]).items);
setSelectedTextView();
}
}
private void setPickerViewDatasAtIndex2(int index, List<Item> lists){
List<String> list = new ArrayList<>();
for (int i=0; i<lists.size(); i++){
list.add(lists.get(i).name);
}
setPickerViewDatasAtIndex(index, list);
}
private void setSelectedTextView(){
String value1 = "";
String value2 = "";
String value3 = "";
if (mCount == 1){
if (mItems.size() > 0){
value1 = mItems.get(selectedIndexs[0]).name;
}
selectedTextView.setText(value1);
}
else if (mCount == 2){
if (mItems.size() > 0){
value1 = mItems.get(selectedIndexs[0]).name;
if (mItems.get(selectedIndexs[0]).items.size() > 0){
value2 = mItems.get(selectedIndexs[0]).items.get(selectedIndexs[1]).name;
}
}
selectedTextView.setText(value1 + "-" + value2);
}
else if (mCount == 3){
if (mItems.size() > 0){
value1 = mItems.get(selectedIndexs[0]).name;
if (mItems.get(selectedIndexs[0]).items.size() > 0){
value2 = mItems.get(selectedIndexs[0]).items.get(selectedIndexs[1]).name;
if (mItems.get(selectedIndexs[0]).items.get(selectedIndexs[1]).items.size() > 0){
value3 = mItems.get(selectedIndexs[0]).items.get(selectedIndexs[1]).items.get(selectedIndexs[2]).name;
}
}
}
selectedTextView.setText(value1 + "-" + value2 + "-" + value3);
}
}
public void setShowSelectedTextView(boolean show){
selectedTextView.setVisibility(show ? VISIBLE : INVISIBLE);
}
public void setOnSelectListener(OnSelectListener onSelectListener) {
this.onSelectListener = onSelectListener;
}
public interface OnSelectListener {
void OnSelectItemClick(View view, int[] selectedIndexs, String selectedText);
}
public void setOnStateChangeListener(OnStateChangeListener onStateChangeListener){
this.onStateChangeListener = onStateChangeListener;
}
public interface OnStateChangeListener {
void OnStateChange(View view, boolean state);
}
}
|
UTF-8
|
Java
| 18,112 |
java
|
PickView.java
|
Java
|
[
{
"context": ".adapters.ArrayWheelAdapter;\n\n/**\n *\n * Created by apple on 16/4/25.\n */\npublic class PickView extends Lin",
"end": 721,
"score": 0.9985526204109192,
"start": 716,
"tag": "USERNAME",
"value": "apple"
},
{
"context": ".SOFT_INPUT_ADJUST_RESIZE);//http://blog.csdn.net/u013277740/article/details/50427523\n\n // popView添加OnT",
"end": 10168,
"score": 0.9995223879814148,
"start": 10158,
"tag": "USERNAME",
"value": "u013277740"
}
] | null |
[] |
package me.chanchangxing.picker;
import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import me.chanchangxing.picker.WheelView.OnWheelChangedListener;
import me.chanchangxing.picker.WheelView.WheelView;
import me.chanchangxing.picker.WheelView.adapters.ArrayWheelAdapter;
/**
*
* Created by apple on 16/4/25.
*/
public class PickView extends LinearLayout implements OnWheelChangedListener, View.OnClickListener {
private Context mContext;
private View view = null;
private RelativeLayout mRelativeLayout;
private LinearLayout mLinearLayout;
private PopupWindow mPopWindow;
private WheelView[] wheelViews;
private Object[] mDatas;
private int mCount = -1;
private int mMaxColumn = 3;
private TextView cancelTextView;
private TextView sureTextView;
private TextView selectedTextView;
private List<Item> mItems;
private int [] selectedIndexs;
private OnSelectListener onSelectListener = null;
private OnStateChangeListener onStateChangeListener = null;
public boolean isShow = false;
public PickView(Context context) {
this(context, null, 0);
System.out.println("---UIPickerView(Context context) -----");
}
public PickView(Context context, View view) {
this(context, null, 0);
System.out.println("---UIPickerView(Context context) -----");
this.view = view;
}
public PickView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
System.out.println("---UIPickerView(Context context, AttributeSet attrs) -----");
}
public PickView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
System.out.println("---UIPickerView(Context context, AttributeSet attrs, int defStyleAttr) -----");
this.mContext = context;
setOrientation(HORIZONTAL);//设置基布局方向为垂直方向
setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}
private void setPickerViewColumns(int columns){
if (columns <= 0){
throw new IllegalArgumentException("columns - 参数不匹配, columns不能小于1");
}
if (columns > mMaxColumn){
throw new IllegalArgumentException("columns - 参数不匹配, columns不能大于3");
}
mCount = columns;
wheelViews = new WheelView[mCount];
mDatas = new Object[mCount];
selectedIndexs = new int[mCount];
mRelativeLayout = new RelativeLayout(mContext);
mRelativeLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
mRelativeLayout.setBackgroundColor(Color.parseColor("#4f000000"));
LinearLayout linearLayout = new LinearLayout(mContext);
linearLayout.setOrientation(VERTICAL);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
linearLayout.setLayoutParams(layoutParams);
mRelativeLayout.addView(linearLayout);
LayoutParams layoutParams0 = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dip2px(mContext, 45));
LinearLayout linearLayout1 = new LinearLayout(mContext);
linearLayout1.setOrientation(HORIZONTAL);
linearLayout1.setLayoutParams(layoutParams0);
linearLayout1.setBackgroundColor(Color.WHITE);
linearLayout.addView(linearLayout1);
LayoutParams layoutParams1 = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
cancelTextView = new TextView(mContext);
cancelTextView.setText("取消");
cancelTextView.setTextColor(Color.parseColor("#00abdd"));
cancelTextView.setTextSize(18);
cancelTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
cancelTextView.setPadding(dip2px(mContext, 16), 0, 0, 0);
cancelTextView.setLayoutParams(layoutParams1);
cancelTextView.setOnClickListener(this);
linearLayout1.addView(cancelTextView);
selectedTextView = new TextView(mContext);
selectedTextView.setText("暂无");
selectedTextView.setTextColor(Color.parseColor("#d0d0d0"));
selectedTextView.setTextSize(16);
selectedTextView.setSingleLine(true);
selectedTextView.setGravity(Gravity.CENTER);
selectedTextView.setPadding(dip2px(mContext, 5), 0, dip2px(mContext, 5), 0);
selectedTextView.setLayoutParams(new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1));
selectedTextView.setOnClickListener(this);
selectedTextView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
//Toast.makeText(mContext, "textView", Toast.LENGTH_SHORT).show();
return true;
}
});
linearLayout1.addView(selectedTextView);
LayoutParams layoutParams2 = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
sureTextView = new TextView(mContext);
sureTextView.setText("确定");
sureTextView.setTextColor(Color.parseColor("#00abdd"));
sureTextView.setTextSize(18);
sureTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
sureTextView.setPadding(0, 0, dip2px(mContext, 16), 0);
sureTextView.setLayoutParams(layoutParams2);
sureTextView.setOnClickListener(this);
linearLayout1.addView(sureTextView);
mLinearLayout = new LinearLayout(mContext);
mLinearLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
mLinearLayout.setBackgroundColor(Color.WHITE);
linearLayout.addView(mLinearLayout);
//初始化
for (int index=0; index<mCount; index++){
wheelViews[index] = new WheelView(mContext);
wheelViews[index].setLayoutParams(new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1));
//ArrayWheelAdapter adapter = new ArrayWheelAdapter<String>(mContext, items);
//wheelViews[index].setViewAdapter(adapter);
wheelViews[index].setVisibleItems(7);
//wheelViews[index].setWheelBackground(Resources.getSystem().getColor(Color.WHITE));
mLinearLayout.addView(wheelViews[index], index);
wheelViews[index].setTag(index);
wheelViews[index].addChangingListener(this);
}
}
private void setPickerViewDatasAtIndex(int index, List<String> lists){
if (index < 0 || index > mCount - 1){
throw new IllegalArgumentException("index - 参数不匹配, index不能大于" + String.valueOf(mCount - 1) + "或不能小于0");
}
String[] items;
if (lists.size() == 0 || lists == null){
//return;
//throw new IllegalArgumentException("lists - 参数不匹配, lists不能为null或空");
items = new String[0];
mDatas[index] = items;
} else {
items = (String[])lists.toArray(new String[lists.size()]);
mDatas[index] = items;
}
// wheelViews[index] = new WheelView(mContext);
// wheelViews[index].setLayoutParams(new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1));
ArrayWheelAdapter adapter = new ArrayWheelAdapter<String>(mContext, items);
wheelViews[index].setViewAdapter(adapter);
wheelViews[index].setCurrentItem(0);
// wheelViews[index].setVisibleItems(7);
//wheelViews[index].setWheelBackground(Resources.getSystem().getColor(Color.WHITE));
// mLinearLayout.addView(wheelViews[index], index);
// wheelViews[index].setTag(index);
// wheelViews[index].addChangingListener(this);
}
private void setPickerViewDatasAtIndex(int index, String[] items){
if (index < 0 || index > mCount - 1){
throw new IllegalArgumentException("index - 参数不匹配, index不能大于" + String.valueOf(mCount - 1) + "或不能小于0");
}
if (items.length == 0 || items == null){
throw new IllegalArgumentException("items - 参数不匹配, items不能为null或空");
}
mDatas[index] = items;
// wheelViews[index] = new WheelView(mContext);
// wheelViews[index].setLayoutParams(new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1));
ArrayWheelAdapter adapter = new ArrayWheelAdapter<String>(mContext, items);
wheelViews[index].setViewAdapter(adapter);
// wheelViews[index].setVisibleItems(7);
//wheelViews[index].setWheelBackground(Color.WHITE);
// mLinearLayout.addView(wheelViews[index], index);
// wheelViews[index].setTag(index);
// wheelViews[index].addChangingListener(this);
}
public void show() {
int num = 0;
for (int i=0; i<mCount; i++){
if (wheelViews[i] == null){
num ++;
}
}
if (num == mCount){
throw new IllegalArgumentException("UIPickerView 无数据填充,无法显示");
}
mPopWindow = new PopupWindow(mRelativeLayout);
mPopWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
mPopWindow.setHeight(ViewGroup.LayoutParams.MATCH_PARENT);
mPopWindow.setAnimationStyle(R.style.contextMenuAnim);//设置动画所对应的style
mPopWindow.setFocusable(false);
mPopWindow.setOutsideTouchable(false);
mPopWindow.showAtLocation(mRelativeLayout, Gravity.BOTTOM, 0, 0);
mPopWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);//http://blog.csdn.net/u013277740/article/details/50427523
// popView添加OnTouchListener监听判断获取触屏位置如果在选择框外面则销毁弹出框
mRelativeLayout.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
dismiss();
return false;
}
});
isShow = true;
if (onStateChangeListener != null){
onStateChangeListener.OnStateChange(this, isShow);
}
}
public void dismiss(){
if (mPopWindow != null && mPopWindow.isShowing()) {
mPopWindow.dismiss();
mPopWindow = null;
isShow = false;
if (onStateChangeListener != null){
onStateChangeListener.OnStateChange(this, isShow);
}
}
}
/**
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
*/
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
/**
* 根据手机的分辨率从 px(像素) 的单位 转成为 dp
*/
public static int px2dip(Context context, float pxValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}
@Override
public void onChanged(WheelView wheel, int oldValue, int newValue) {
int index = (int) wheel.getTag();
if (mCount == 1){
int pCurrent = wheelViews[index].getCurrentItem();
selectedIndexs[0] = pCurrent;
setSelectedTextView();
}
else if (mCount == 2){
if (index == 0) {
int pCurrent = wheelViews[index].getCurrentItem();
selectedIndexs[0] = pCurrent;
selectedIndexs[1] = 0;
setPickerViewDatasAtIndex2(1, mItems.get(selectedIndexs[0]).items);
} else if (index == 1) {
int pCurrent = wheelViews[index].getCurrentItem();
selectedIndexs[1] = pCurrent;
}
setSelectedTextView();
}
else if (mCount == 3) {
if (index == 0) {
int pCurrent = wheelViews[index].getCurrentItem();
selectedIndexs[0] = pCurrent;
selectedIndexs[1] = 0;
selectedIndexs[2] = 0;
setPickerViewDatasAtIndex2(1, mItems.get(selectedIndexs[0]).items);
setPickerViewDatasAtIndex2(2, mItems.get(selectedIndexs[0]).items.get(selectedIndexs[1]).items);
} else if (index == 1) {
int pCurrent = wheelViews[index].getCurrentItem();
selectedIndexs[1] = pCurrent;
selectedIndexs[2] = 0;
setPickerViewDatasAtIndex2(2, mItems.get(selectedIndexs[0]).items.get(selectedIndexs[1]).items);
} else if (index == 2) {
int pCurrent = wheelViews[index].getCurrentItem();
selectedIndexs[2] = pCurrent;
}
setSelectedTextView();
}
}
@Override
public void onClick(View v) {
TextView textView = (TextView) v;
if (textView == cancelTextView){
//取消
//Toast.makeText(mContext, "取消", Toast.LENGTH_SHORT).show();
dismiss();
}
else if (textView == sureTextView){
//确定
//Toast.makeText(mContext, "确定", Toast.LENGTH_SHORT).show();
if (onSelectListener != null){
if (view != null){
onSelectListener.OnSelectItemClick(view, selectedIndexs, selectedTextView.getText().toString());
} else {
onSelectListener.OnSelectItemClick(this, selectedIndexs, selectedTextView.getText().toString());
}
}
dismiss();
}
else if (textView == selectedTextView){
Toast.makeText(mContext, "selectedTextView", Toast.LENGTH_SHORT).show();
}
}
public enum Style {
SINGLE, DOUBLE, THREE
}
public void setPickerView(List<Item> items, Style style){
this.mItems = items;
if (style == Style.SINGLE)
{
mCount = 1;
setPickerViewColumns(1);//1级
selectedIndexs[0] = 0;
setPickerViewDatasAtIndex2(0, items);
setSelectedTextView();
}
else if (style == Style.DOUBLE)
{
mCount = 2;
setPickerViewColumns(2);
selectedIndexs[0] = 0;
selectedIndexs[1] = 0;
setPickerViewDatasAtIndex2(0, items);
setPickerViewDatasAtIndex2(1, items.get(selectedIndexs[0]).items);
setSelectedTextView();
}
else if (style == Style.THREE)
{
mCount = 3;
setPickerViewColumns(3);
selectedIndexs[0] = 0;
selectedIndexs[1] = 0;
selectedIndexs[2] = 0;
setPickerViewDatasAtIndex2(0, items);
setPickerViewDatasAtIndex2(1, items.get(selectedIndexs[0]).items);
setPickerViewDatasAtIndex2(2, items.get(selectedIndexs[0]).items.get(selectedIndexs[1]).items);
setSelectedTextView();
}
}
private void setPickerViewDatasAtIndex2(int index, List<Item> lists){
List<String> list = new ArrayList<>();
for (int i=0; i<lists.size(); i++){
list.add(lists.get(i).name);
}
setPickerViewDatasAtIndex(index, list);
}
private void setSelectedTextView(){
String value1 = "";
String value2 = "";
String value3 = "";
if (mCount == 1){
if (mItems.size() > 0){
value1 = mItems.get(selectedIndexs[0]).name;
}
selectedTextView.setText(value1);
}
else if (mCount == 2){
if (mItems.size() > 0){
value1 = mItems.get(selectedIndexs[0]).name;
if (mItems.get(selectedIndexs[0]).items.size() > 0){
value2 = mItems.get(selectedIndexs[0]).items.get(selectedIndexs[1]).name;
}
}
selectedTextView.setText(value1 + "-" + value2);
}
else if (mCount == 3){
if (mItems.size() > 0){
value1 = mItems.get(selectedIndexs[0]).name;
if (mItems.get(selectedIndexs[0]).items.size() > 0){
value2 = mItems.get(selectedIndexs[0]).items.get(selectedIndexs[1]).name;
if (mItems.get(selectedIndexs[0]).items.get(selectedIndexs[1]).items.size() > 0){
value3 = mItems.get(selectedIndexs[0]).items.get(selectedIndexs[1]).items.get(selectedIndexs[2]).name;
}
}
}
selectedTextView.setText(value1 + "-" + value2 + "-" + value3);
}
}
public void setShowSelectedTextView(boolean show){
selectedTextView.setVisibility(show ? VISIBLE : INVISIBLE);
}
public void setOnSelectListener(OnSelectListener onSelectListener) {
this.onSelectListener = onSelectListener;
}
public interface OnSelectListener {
void OnSelectItemClick(View view, int[] selectedIndexs, String selectedText);
}
public void setOnStateChangeListener(OnStateChangeListener onStateChangeListener){
this.onStateChangeListener = onStateChangeListener;
}
public interface OnStateChangeListener {
void OnStateChange(View view, boolean state);
}
}
| 18,112 | 0.626548 | 0.613601 | 490 | 35.253059 | 31.012461 | 157 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.732653 | false | false |
13
|
37610febf0d6338ebf3650b35e93f294a5508703
| 12,378,095,762,115 |
5f447b34e3e1051442acce11f6134e2c2e457b8d
|
/ser.java
|
7aaa0e845e066358fb89304b1f6c8de262c7d04a
|
[] |
no_license
|
PoojaShreeSS/Networks-in-Java
|
https://github.com/PoojaShreeSS/Networks-in-Java
|
e1c8f7ac76b3f49b90e9deae17de9e1f5fa53dfb
|
b8a440ff3a53e6a2580dee8df0c6f83ee9db6af8
|
refs/heads/master
| 2021-09-03T23:05:05.944000 | 2018-01-12T18:22:00 | 2018-01-12T18:22:00 | 117,273,488 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.net.*;
import java.io.*;
class ser
{
public static void main(String ar[])throws IOException
{
ServerSocket sc = new ServerSocket(1);
Socket s = sc.accept();
BufferedReader br1,br2;
String s1,s2;
PrintStream ps;
while(true)
{
br1 = new BufferedReader(new InputStreamReader(s.getInputStream()));
s1 = br1.readLine();
System.out.println("Client : "+s1);
System.out.print("Server : ");
br2 = new BufferedReader(new InputStreamReader(System.in));
s2 = br2.readLine();
ps = new PrintStream(s.getOutputStream());
ps.println(s2);
if(s1.equals("bye"))
break;
}
}
}
|
UTF-8
|
Java
| 618 |
java
|
ser.java
|
Java
|
[] | null |
[] |
import java.net.*;
import java.io.*;
class ser
{
public static void main(String ar[])throws IOException
{
ServerSocket sc = new ServerSocket(1);
Socket s = sc.accept();
BufferedReader br1,br2;
String s1,s2;
PrintStream ps;
while(true)
{
br1 = new BufferedReader(new InputStreamReader(s.getInputStream()));
s1 = br1.readLine();
System.out.println("Client : "+s1);
System.out.print("Server : ");
br2 = new BufferedReader(new InputStreamReader(System.in));
s2 = br2.readLine();
ps = new PrintStream(s.getOutputStream());
ps.println(s2);
if(s1.equals("bye"))
break;
}
}
}
| 618 | 0.661812 | 0.639159 | 26 | 22.807692 | 18.898554 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.615385 | false | false |
13
|
c13068fa346b3916b6ae78f32810195580021ee4
| 17,111,149,729,725 |
0b4c5e1332165160b7a9aa8251325f984f3371e6
|
/src/test/java/by/testtask/tests/LetterTest.java
|
37906a8e5dc2da00e8689590e8faead64d855c1f
|
[] |
no_license
|
Pashkar80/AutomationTask--gmail-check-the-sent-email
|
https://github.com/Pashkar80/AutomationTask--gmail-check-the-sent-email
|
6b51b1099fe5ea451e29334fdaa2476ec191f1f3
|
b7c58ef82b13987c8b552a82f5abe72106fba469
|
refs/heads/master
| 2022-04-21T02:14:51.303000 | 2020-04-25T21:18:22 | 2020-04-25T21:18:22 | 161,155,901 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package by.testtask.tests;
import org.openqa.selenium.WebDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import by.testtask.driver.MyDriver;
import by.testtask.entity.Letter;
import by.testtask.entity.User;
import by.testtask.pages.LetterPage;
import by.testtask.pages.MainPage;
import by.testtask.steps.CommonSteps;
import javax.xml.bind.SchemaOutputResolver;
import java.util.concurrent.TimeUnit;
public class LetterTest {
private WebDriver driver;
Letter letter = new Letter();
User user = new User();
@BeforeTest
public void inite() throws InterruptedException {
driver = MyDriver.initeWebDriver();
new CommonSteps(driver).autorizeUser(user.getEmail(), user.getPassword());
}
@Test
public void completeForm() {
CommonSteps steps= new CommonSteps(driver);
String text=steps.completeForm();
Assert.assertEquals(text,letter.getContent());
}
@AfterTest
public void stopDriver() {
driver.close();
}
}
|
UTF-8
|
Java
| 1,039 |
java
|
LetterTest.java
|
Java
|
[] | null |
[] |
package by.testtask.tests;
import org.openqa.selenium.WebDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import by.testtask.driver.MyDriver;
import by.testtask.entity.Letter;
import by.testtask.entity.User;
import by.testtask.pages.LetterPage;
import by.testtask.pages.MainPage;
import by.testtask.steps.CommonSteps;
import javax.xml.bind.SchemaOutputResolver;
import java.util.concurrent.TimeUnit;
public class LetterTest {
private WebDriver driver;
Letter letter = new Letter();
User user = new User();
@BeforeTest
public void inite() throws InterruptedException {
driver = MyDriver.initeWebDriver();
new CommonSteps(driver).autorizeUser(user.getEmail(), user.getPassword());
}
@Test
public void completeForm() {
CommonSteps steps= new CommonSteps(driver);
String text=steps.completeForm();
Assert.assertEquals(text,letter.getContent());
}
@AfterTest
public void stopDriver() {
driver.close();
}
}
| 1,039 | 0.775746 | 0.775746 | 43 | 23.16279 | 18.444046 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.139535 | false | false |
13
|
07c75ac6e14628fb316d23055a35844a137266ab
| 300,647,754,734 |
d5c6333459524d0e8ebb751f05e9c34006cb8e95
|
/src/main/java/gxj/study/leetcode/medium/no334/No334.java
|
b1695709eb13966cdf558379ed9ad46453a25dfa
|
[] |
no_license
|
shineguo1/springDemo
|
https://github.com/shineguo1/springDemo
|
2cafca5b3f10da40946d5ab94b88eb4cfe49b2d3
|
97dbeafa911308ef3a111cc967a519166aa14de9
|
refs/heads/master1
| 2023-06-21T16:15:26.076000 | 2023-06-01T05:45:40 | 2023-06-01T05:45:40 | 221,106,307 | 3 | 0 | null | false | 2023-06-14T22:32:53 | 2019-11-12T01:48:40 | 2022-12-22T15:07:44 | 2023-06-14T22:32:53 | 2,363 | 2 | 0 | 6 |
Java
| false | false |
package gxj.study.leetcode.medium.no334;
/**
* @author xinjie_guo
* @version 1.0.0 createTime: 2022/1/12 9:37
* @description
*/
public class No334 {
/**
* 从左往右遍历,先找到第一个连续的递增二元组(a,b),然后依次读取后续数字
* 1. 如果读到数字 c < b,则将二元组修正为(a,c),因为(a,c)严格优于(a,b)
* 2. 如果读到数字 c < a,则另外缓存二元组(c,?)。 因为假设读到数字d,c < a < d <b, 则二元组(c,d)将严格优于(a,d);若找到数字d,d > b,则找到三元组(a,b,d),缓存c弃用。
* 什么叫严格优于:以(1.)为例子,截至到c为止,仅存在递增二元组,不存在递增三元组,且最小的递增二元组是(a,c), 即将c之前的数字序列看作黑盒,输出的最佳解是(a,c),所以(a,c)严格优于(a,b)
*/
public boolean increasingTriplet(int[] nums) {
Integer[] ans = new Integer[2];
Integer cache = null;
for (int num : nums) {
if(ans[1] != null && ans[1] < num){
//找到三元组,快速返回
return true;
}
//初始化
if (ans[0] == null) {
ans[0] = num;
}else if (cache != null && cache < num) {
//如果已缓存可能更优情况,检查规则2,如果满足,替换最优解。
ans[0] = cache;
ans[1] = num;
cache = null;
} else if (num > ans[0]) {
//num大于a, 检查规则1
if (ans[1] == null || ans[1] > num) {
ans[1] = num;
}
} else if (num < ans[0]) {
if (ans[1] == null) {
//未找到二元组,将最小数字替换成num
ans[0] = num;
} else {
cache = num;
}
}
}
return false;
}
}
|
UTF-8
|
Java
| 1,997 |
java
|
No334.java
|
Java
|
[
{
"context": "e gxj.study.leetcode.medium.no334;\n\n/**\n * @author xinjie_guo\n * @version 1.0.0 createTime: 2022/1/12 9:37\n * ",
"end": 67,
"score": 0.9992268681526184,
"start": 57,
"tag": "USERNAME",
"value": "xinjie_guo"
}
] | null |
[] |
package gxj.study.leetcode.medium.no334;
/**
* @author xinjie_guo
* @version 1.0.0 createTime: 2022/1/12 9:37
* @description
*/
public class No334 {
/**
* 从左往右遍历,先找到第一个连续的递增二元组(a,b),然后依次读取后续数字
* 1. 如果读到数字 c < b,则将二元组修正为(a,c),因为(a,c)严格优于(a,b)
* 2. 如果读到数字 c < a,则另外缓存二元组(c,?)。 因为假设读到数字d,c < a < d <b, 则二元组(c,d)将严格优于(a,d);若找到数字d,d > b,则找到三元组(a,b,d),缓存c弃用。
* 什么叫严格优于:以(1.)为例子,截至到c为止,仅存在递增二元组,不存在递增三元组,且最小的递增二元组是(a,c), 即将c之前的数字序列看作黑盒,输出的最佳解是(a,c),所以(a,c)严格优于(a,b)
*/
public boolean increasingTriplet(int[] nums) {
Integer[] ans = new Integer[2];
Integer cache = null;
for (int num : nums) {
if(ans[1] != null && ans[1] < num){
//找到三元组,快速返回
return true;
}
//初始化
if (ans[0] == null) {
ans[0] = num;
}else if (cache != null && cache < num) {
//如果已缓存可能更优情况,检查规则2,如果满足,替换最优解。
ans[0] = cache;
ans[1] = num;
cache = null;
} else if (num > ans[0]) {
//num大于a, 检查规则1
if (ans[1] == null || ans[1] > num) {
ans[1] = num;
}
} else if (num < ans[0]) {
if (ans[1] == null) {
//未找到二元组,将最小数字替换成num
ans[0] = num;
} else {
cache = num;
}
}
}
return false;
}
}
| 1,997 | 0.428666 | 0.403451 | 50 | 29.139999 | 23.11191 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
13
|
42eb4240d56ee145f874625b92bbb694bf1f0ce3
| 3,058,016,744,066 |
8779e56fb20f06c8f3363ea45914b324c16e4f1a
|
/src/main/java/com/wiley/driver/factory/DriverFactory.java
|
fd300b84fbae70534a6d7666a327b8d9e992aec5
|
[
"MIT"
] |
permissive
|
estuold/teasy-simple
|
https://github.com/estuold/teasy-simple
|
06a88141432f830a5ffcc37d4afc2879ed283d3f
|
113f2c6da33b45b7c8e6d51303ca3f93381532de
|
refs/heads/master
| 2020-03-10T13:30:48.098000 | 2018-07-27T12:57:46 | 2018-07-27T12:57:46 | 129,401,902 | 2 | 1 |
MIT
| false | 2018-07-26T14:22:20 | 2018-04-13T12:52:04 | 2018-07-26T07:10:42 | 2018-07-26T14:22:19 | 203 | 1 | 1 | 2 |
Java
| false | null |
package com.wiley.driver.factory;
import org.openqa.selenium.WebDriver;
/**
* Abstract factory to provide instance of WebDriver
*/
public interface DriverFactory {
String FIREFOX = "firefox";
String GECKO = "gecko";
String CHROME = "chrome";
String SAFARI = "safari";
String SAFARI_TECHNOLOGY_PREVIEW = "safariTechnologyPreview";
String IE = "ie";
String EDGE = "edge";
String IE11 = "ie11";
String IE10 = "ie10";
String NATIVE_APP = "native_app";
String EMPTY = "";
String IOS = "ios";
String ANDROID = "android";
String WINDOWS = "windows";
String LINUX = "linux";
String MAC = "mac";
/* version of IE Driver that works */
String STABLE_IE_DRIVER_VERSION = "3.4.0";
WebDriver get();
}
|
UTF-8
|
Java
| 772 |
java
|
DriverFactory.java
|
Java
|
[] | null |
[] |
package com.wiley.driver.factory;
import org.openqa.selenium.WebDriver;
/**
* Abstract factory to provide instance of WebDriver
*/
public interface DriverFactory {
String FIREFOX = "firefox";
String GECKO = "gecko";
String CHROME = "chrome";
String SAFARI = "safari";
String SAFARI_TECHNOLOGY_PREVIEW = "safariTechnologyPreview";
String IE = "ie";
String EDGE = "edge";
String IE11 = "ie11";
String IE10 = "ie10";
String NATIVE_APP = "native_app";
String EMPTY = "";
String IOS = "ios";
String ANDROID = "android";
String WINDOWS = "windows";
String LINUX = "linux";
String MAC = "mac";
/* version of IE Driver that works */
String STABLE_IE_DRIVER_VERSION = "3.4.0";
WebDriver get();
}
| 772 | 0.634715 | 0.620466 | 33 | 22.39394 | 16.812584 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.606061 | false | false |
13
|
b1c13c33e0f6f12500d89ae7708bc6bce7b1873f
| 3,058,016,746,148 |
c13da44fd0627df92d8c17b8cc248bb05ce5e8af
|
/src/main/java/table/networkTable/Shape.java
|
c79edfc93d59b6eb646eb5d11bf6e3d6dd25ce01
|
[
"Apache-2.0"
] |
permissive
|
AdamStuart/appFX
|
https://github.com/AdamStuart/appFX
|
a411929b3f2249205b0a7a862bc594b24f63ecf4
|
3e87cea537cb777ccaad312a31a1be916482e24e
|
refs/heads/master2
| 2021-01-24T06:47:20.363000 | 2017-05-16T18:27:31 | 2017-05-16T18:27:31 | 43,520,600 | 2 | 2 | null | false | 2016-06-07T21:49:58 | 2015-10-01T20:55:19 | 2016-02-11T13:06:35 | 2016-06-07T21:49:58 | 28,683 | 1 | 0 | 3 |
Java
| null | null |
package table.networkTable;
public enum Shape
{
DIAMOND,
ELLIPSE,
HEXAGON,
OCTAGON,
PARALLELOGRAM,
RECTANGLE,
ROUNDRECTANGLE,
TRIANGLE,
V
};
|
UTF-8
|
Java
| 151 |
java
|
Shape.java
|
Java
|
[] | null |
[] |
package table.networkTable;
public enum Shape
{
DIAMOND,
ELLIPSE,
HEXAGON,
OCTAGON,
PARALLELOGRAM,
RECTANGLE,
ROUNDRECTANGLE,
TRIANGLE,
V
};
| 151 | 0.741722 | 0.741722 | 14 | 9.785714 | 7.133208 | 27 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.357143 | false | false |
13
|
dd1793a923a08a644d095d9beee65a7b98096dfb
| 22,565,758,235,207 |
3d4349c88a96505992277c56311e73243130c290
|
/Preparation/processed-dataset/data-class_4_263/28.java
|
c348b9b5b72674fa71fbd18208c7429028d175d7
|
[] |
no_license
|
D-a-r-e-k/Code-Smells-Detection
|
https://github.com/D-a-r-e-k/Code-Smells-Detection
|
5270233badf3fb8c2d6034ac4d780e9ce7a8276e
|
079a02e5037d909114613aedceba1d5dea81c65d
|
refs/heads/master
| 2020-05-20T00:03:08.191000 | 2019-05-15T11:51:51 | 2019-05-15T11:51:51 | 185,272,690 | 7 | 4 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Inserts a string into the buffer.
* @param offset The offset
* @param seg The segment
* @since jEdit 4.0pre1
*/
public void insert(int offset, Segment seg) {
if (seg.count == 0)
return;
if (isReadOnly())
throw new RuntimeException("buffer read-only");
try {
writeLock();
if (offset < 0 || offset > contentMgr.getLength())
throw new ArrayIndexOutOfBoundsException(offset);
contentMgr.insert(offset, seg);
integerArray.clear();
for (int i = 0; i < seg.count; i++) {
if (seg.array[seg.offset + i] == '\n')
integerArray.add(i + 1);
}
if (!undoInProgress) {
undoMgr.contentInserted(offset, seg.count, seg.toString(), !dirty);
}
contentInserted(offset, seg.count, integerArray);
} finally {
writeUnlock();
}
}
|
UTF-8
|
Java
| 888 |
java
|
28.java
|
Java
|
[] | null |
[] |
/**
* Inserts a string into the buffer.
* @param offset The offset
* @param seg The segment
* @since jEdit 4.0pre1
*/
public void insert(int offset, Segment seg) {
if (seg.count == 0)
return;
if (isReadOnly())
throw new RuntimeException("buffer read-only");
try {
writeLock();
if (offset < 0 || offset > contentMgr.getLength())
throw new ArrayIndexOutOfBoundsException(offset);
contentMgr.insert(offset, seg);
integerArray.clear();
for (int i = 0; i < seg.count; i++) {
if (seg.array[seg.offset + i] == '\n')
integerArray.add(i + 1);
}
if (!undoInProgress) {
undoMgr.contentInserted(offset, seg.count, seg.toString(), !dirty);
}
contentInserted(offset, seg.count, integerArray);
} finally {
writeUnlock();
}
}
| 888 | 0.560811 | 0.552928 | 29 | 29.620689 | 19.974836 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.896552 | false | false |
13
|
43f37633de692d6967e2026b94c20d27b3dc1e0e
| 34,926,674,064,719 |
9f1b3963ae10776f38025e215246173bdb09bc27
|
/Web0119/src/net/tis/mvc/TestController.java
|
a11cbfc6645b6c066131477bc8ca412f0c8a0649
|
[] |
no_license
|
KwonJoonHo/apple
|
https://github.com/KwonJoonHo/apple
|
9b3123dc87d62a74f11ce84f9fe1f52d0e631368
|
7e41f759d3c3584c86b71fde8eb43f87e8e4fbf8
|
refs/heads/master
| 2023-03-29T14:03:52.682000 | 2021-04-06T00:57:26 | 2021-04-06T00:57:26 | 354,688,838 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.tis.mvc;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletContext; //application원형
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.oreilly.servlet.MultipartRequest ;
import com.oreilly.servlet.multipart.DefaultFileRenamePolicy;
import net.tis.test.TestSQL;
@WebServlet("/test1234.do")
public class TestController extends HttpServlet {
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doUser(request, response); //반드시호출
}//end
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doUser(request, response); //반드시호출
}//end
public void doUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<img src=images/bar.gif><p>");
out.println("<img src=images/bar.gif><p>");
//TestController서블릿문서
out.println("<h2>");
out.println("<a href='index.jsp'>[index]</a>");
out.println("<a href='testWrite.jsp'>[test등록]</a>");
out.println("<a href='login.jsp'>[로그인]</a>");
out.println("</h2>");
}//end
}//TestController class END
|
UHC
|
Java
| 1,580 |
java
|
TestController.java
|
Java
|
[] | null |
[] |
package net.tis.mvc;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletContext; //application원형
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.oreilly.servlet.MultipartRequest ;
import com.oreilly.servlet.multipart.DefaultFileRenamePolicy;
import net.tis.test.TestSQL;
@WebServlet("/test1234.do")
public class TestController extends HttpServlet {
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doUser(request, response); //반드시호출
}//end
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doUser(request, response); //반드시호출
}//end
public void doUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<img src=images/bar.gif><p>");
out.println("<img src=images/bar.gif><p>");
//TestController서블릿문서
out.println("<h2>");
out.println("<a href='index.jsp'>[index]</a>");
out.println("<a href='testWrite.jsp'>[test등록]</a>");
out.println("<a href='login.jsp'>[로그인]</a>");
out.println("</h2>");
}//end
}//TestController class END
| 1,580 | 0.755859 | 0.750651 | 46 | 32.304348 | 29.401915 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.456522 | false | false |
13
|
e5a35c14e3cdc9cdb8744ca1908de6cdc1e9f203
| 8,272,107,060,973 |
58c4e50fc202b1aae68d7e914b5f8f29873e41bc
|
/src/main/java/gunstar/state/MarketHistory.java
|
19e0135400875855399e70b64e543e7c4eb0972e
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
jhalliday/gunstar
|
https://github.com/jhalliday/gunstar
|
36ab29ee6d29d256b65f67472f02cb2328558a25
|
f9135c9917c338cb559b985a63ba6a7c2363cf99
|
refs/heads/master
| 2021-01-10T09:05:34.611000 | 2015-12-22T11:01:27 | 2015-12-22T11:01:27 | 47,827,148 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package gunstar.state;
import gunstar.api.DetailedDate;
import gunstar.api.trading.Quote;
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
import org.apache.commons.math3.stat.descriptive.SynchronizedDescriptiveStatistics;
import java.util.Date;
public class MarketHistory {
public final String venue;
public final String stock;
public final int windowSampleSize;
public final int windowIntervalMillis;
public volatile Quote latestQuote;
public final DescriptiveStatistics bidStats;
public final DescriptiveStatistics askStats;
public final DescriptiveStatistics bidSizeStats;
public final DescriptiveStatistics askSizeStats;
public final DescriptiveStatistics bidDepthStats;
public final DescriptiveStatistics askDepthStats;
public final DescriptiveStatistics lastStats;
public final DescriptiveStatistics lastSizeStats;
public MarketHistory(String venue, String stock, int windowSampleSize, int windowIntervalMillis) {
this.venue = venue;
this.stock = stock;
this.windowSampleSize = windowSampleSize;
this.windowIntervalMillis = windowIntervalMillis;
bidStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
askStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
bidSizeStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
askSizeStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
bidDepthStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
askDepthStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
lastStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
lastSizeStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
}
public void apply(Quote quote) {
if(quote == null || quote.quoteTime == null ||
(latestQuote != null && quote.quoteTime.before(latestQuote.quoteTime))) {
return;
}
// 20 secs is known to work ok
long latestQuoteBucket = 0;
if(latestQuote != null) {
latestQuoteBucket = latestQuote.quoteTime.date.getTime()/windowIntervalMillis;
}
long quoteBucket = quote.quoteTime.date.getTime()/windowIntervalMillis;
synchronized (this) {
latestQuote = quote;
notifyAll();
}
if(quoteBucket == latestQuoteBucket) {
return;
}
bidStats.addValue(quote.bid);
askStats.addValue(quote.ask);
bidSizeStats.addValue(quote.bidSize);
askSizeStats.addValue(quote.askSize);
bidDepthStats.addValue(quote.bidDepth);
askDepthStats.addValue(quote.askDepth);
lastStats.addValue(quote.last);
lastSizeStats.addValue(quote.lastSize);
}
public synchronized Quote getQuoteAfter(DetailedDate date) {
try {
while (latestQuote == null || latestQuote.quoteTime == null) {
wait();
}
while(!latestQuote.quoteTime.after(date)) {
wait();
}
return latestQuote;
} catch(InterruptedException e) {
return null;
}
}
}
|
UTF-8
|
Java
| 3,261 |
java
|
MarketHistory.java
|
Java
|
[] | null |
[] |
package gunstar.state;
import gunstar.api.DetailedDate;
import gunstar.api.trading.Quote;
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
import org.apache.commons.math3.stat.descriptive.SynchronizedDescriptiveStatistics;
import java.util.Date;
public class MarketHistory {
public final String venue;
public final String stock;
public final int windowSampleSize;
public final int windowIntervalMillis;
public volatile Quote latestQuote;
public final DescriptiveStatistics bidStats;
public final DescriptiveStatistics askStats;
public final DescriptiveStatistics bidSizeStats;
public final DescriptiveStatistics askSizeStats;
public final DescriptiveStatistics bidDepthStats;
public final DescriptiveStatistics askDepthStats;
public final DescriptiveStatistics lastStats;
public final DescriptiveStatistics lastSizeStats;
public MarketHistory(String venue, String stock, int windowSampleSize, int windowIntervalMillis) {
this.venue = venue;
this.stock = stock;
this.windowSampleSize = windowSampleSize;
this.windowIntervalMillis = windowIntervalMillis;
bidStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
askStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
bidSizeStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
askSizeStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
bidDepthStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
askDepthStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
lastStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
lastSizeStats = new SynchronizedDescriptiveStatistics(windowSampleSize);
}
public void apply(Quote quote) {
if(quote == null || quote.quoteTime == null ||
(latestQuote != null && quote.quoteTime.before(latestQuote.quoteTime))) {
return;
}
// 20 secs is known to work ok
long latestQuoteBucket = 0;
if(latestQuote != null) {
latestQuoteBucket = latestQuote.quoteTime.date.getTime()/windowIntervalMillis;
}
long quoteBucket = quote.quoteTime.date.getTime()/windowIntervalMillis;
synchronized (this) {
latestQuote = quote;
notifyAll();
}
if(quoteBucket == latestQuoteBucket) {
return;
}
bidStats.addValue(quote.bid);
askStats.addValue(quote.ask);
bidSizeStats.addValue(quote.bidSize);
askSizeStats.addValue(quote.askSize);
bidDepthStats.addValue(quote.bidDepth);
askDepthStats.addValue(quote.askDepth);
lastStats.addValue(quote.last);
lastSizeStats.addValue(quote.lastSize);
}
public synchronized Quote getQuoteAfter(DetailedDate date) {
try {
while (latestQuote == null || latestQuote.quoteTime == null) {
wait();
}
while(!latestQuote.quoteTime.after(date)) {
wait();
}
return latestQuote;
} catch(InterruptedException e) {
return null;
}
}
}
| 3,261 | 0.688746 | 0.687213 | 96 | 32.96875 | 27.62715 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.614583 | false | false |
13
|
d824260b7a3eaf59d1547e7ea04173eec5527859
| 31,413,390,864,501 |
21c52b579c795aa77d19d5ac361e2f8068c84b11
|
/src/main/java/kded/online/demo/DyBillDemoPlugin05.java
|
bbb47a75bbfd4ba176542020f5e87c6e31f5a428
|
[] |
no_license
|
liang0feng/cosmic
|
https://github.com/liang0feng/cosmic
|
960dd1971035642a8ae7920fd8ff8fb3081bd9a4
|
7b8f22b235b63fa97ba5bdb2a25b443171563e8a
|
refs/heads/master
| 2023-04-26T12:37:16.918000 | 2021-05-26T11:13:09 | 2021-05-26T11:13:09 | 370,547,923 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package kded.online.demo;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.FormShowParameter;
import kd.bos.form.control.Control;
import kd.bos.form.control.EntryGrid;
import kd.bos.form.field.BasedataEdit;
import kd.bos.form.field.events.BeforeF7SelectEvent;
import kd.bos.form.field.events.BeforeF7SelectListener;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.list.IListView;
import kd.bos.list.ListShowParameter;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import java.util.Date;
import java.util.EventObject;
/**
* 【其它界面交互常用事件】——办公物品领用单据
* 需求 :
* 1、根据物品分类过滤物品可选范围
* 2、先选择物品后,若物品对应分类为空,则自动带出物品分类基础资料
*
* @author rd_feng_liang
* @date 2021/4/15
*/
public class DyBillDemoPlugin05 extends AbstractFormPlugin implements BeforeF7SelectListener {
/**
*
* @param e
*/
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
//添加f7Selecte事件监听
BasedataEdit supplies = this.getControl("kded_supplies");
supplies.addBeforeF7SelectListener(this);
}
/**
* 1、根据物品分类过滤物品可选范围
* @param beforeF7SelectEvent
*/
@Override
public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
int row = beforeF7SelectEvent.getRow();
DynamicObject suppliestype = (DynamicObject) this.getModel().getValue("kded_suppliestype", row);
//物品分类为空处理
if (suppliestype == null ) {
return;
}
//根据物品分类,添加物品过滤器
QFilter qfilter = new QFilter("group", QCP.equals, suppliestype.getPkValue());
ListShowParameter showParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
showParameter.getListFilterParameter().setFilter(qfilter);
}
/**
* 值更新事件:
* 2、先选择物品后,若物品对应分类为空,则自动带出物品分类基础资料
* @param e
*/
@Override
public void propertyChanged(PropertyChangedArgs e) {
ChangeData[] changeSet = e.getChangeSet();
String name = e.getProperty().getName();
if ("kded_supplies".equals(name)) {
Object newValue = changeSet[0].getNewValue();
//新值为空:return;
if (newValue == null) {
return;
}
//物品分类不为空:return;
int rowIndex = changeSet[0].getRowIndex();
if (this.getModel().getValue("kded_suppliestype") != null) {
return;
}
//物品分类为空:自动带出物品分类
DynamicObject newValueDyObj = (DynamicObject) newValue;
DynamicObject supplies = BusinessDataServiceHelper.loadSingle(newValueDyObj.getPkValue(),
"kded_supplies");
this.getModel().setValue("kded_suppliestype", supplies.getDynamicObject("group"),
rowIndex);
}
}
}
|
UTF-8
|
Java
| 3,361 |
java
|
DyBillDemoPlugin05.java
|
Java
|
[
{
"context": " 2、先选择物品后,若物品对应分类为空,则自动带出物品分类基础资料\n *\n * @author rd_feng_liang\n * @date 2021/4/15\n */\npublic class DyBillDemoPlu",
"end": 860,
"score": 0.9989114999771118,
"start": 847,
"tag": "USERNAME",
"value": "rd_feng_liang"
}
] | null |
[] |
package kded.online.demo;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.FormShowParameter;
import kd.bos.form.control.Control;
import kd.bos.form.control.EntryGrid;
import kd.bos.form.field.BasedataEdit;
import kd.bos.form.field.events.BeforeF7SelectEvent;
import kd.bos.form.field.events.BeforeF7SelectListener;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.list.IListView;
import kd.bos.list.ListShowParameter;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import java.util.Date;
import java.util.EventObject;
/**
* 【其它界面交互常用事件】——办公物品领用单据
* 需求 :
* 1、根据物品分类过滤物品可选范围
* 2、先选择物品后,若物品对应分类为空,则自动带出物品分类基础资料
*
* @author rd_feng_liang
* @date 2021/4/15
*/
public class DyBillDemoPlugin05 extends AbstractFormPlugin implements BeforeF7SelectListener {
/**
*
* @param e
*/
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
//添加f7Selecte事件监听
BasedataEdit supplies = this.getControl("kded_supplies");
supplies.addBeforeF7SelectListener(this);
}
/**
* 1、根据物品分类过滤物品可选范围
* @param beforeF7SelectEvent
*/
@Override
public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
int row = beforeF7SelectEvent.getRow();
DynamicObject suppliestype = (DynamicObject) this.getModel().getValue("kded_suppliestype", row);
//物品分类为空处理
if (suppliestype == null ) {
return;
}
//根据物品分类,添加物品过滤器
QFilter qfilter = new QFilter("group", QCP.equals, suppliestype.getPkValue());
ListShowParameter showParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
showParameter.getListFilterParameter().setFilter(qfilter);
}
/**
* 值更新事件:
* 2、先选择物品后,若物品对应分类为空,则自动带出物品分类基础资料
* @param e
*/
@Override
public void propertyChanged(PropertyChangedArgs e) {
ChangeData[] changeSet = e.getChangeSet();
String name = e.getProperty().getName();
if ("kded_supplies".equals(name)) {
Object newValue = changeSet[0].getNewValue();
//新值为空:return;
if (newValue == null) {
return;
}
//物品分类不为空:return;
int rowIndex = changeSet[0].getRowIndex();
if (this.getModel().getValue("kded_suppliestype") != null) {
return;
}
//物品分类为空:自动带出物品分类
DynamicObject newValueDyObj = (DynamicObject) newValue;
DynamicObject supplies = BusinessDataServiceHelper.loadSingle(newValueDyObj.getPkValue(),
"kded_supplies");
this.getModel().setValue("kded_suppliestype", supplies.getDynamicObject("group"),
rowIndex);
}
}
}
| 3,361 | 0.658009 | 0.649351 | 96 | 30.28125 | 26.148495 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.458333 | false | false |
13
|
c31748634df495daf834668807f313eced385d55
| 6,528,350,323,719 |
7d9f8ee706ffa40603eb58a46cd15afadd5d7364
|
/Arrays/src/sum/FourEqualNum.java
|
e5bddc7da021cf2febe85961b4a1723218da60e3
|
[] |
no_license
|
tanvijaywant/javacode
|
https://github.com/tanvijaywant/javacode
|
133fdd1fc95ec24b652e380f985456a45284d90e
|
45984871064ad163628fd3172d1bd403bfaeeff6
|
refs/heads/master
| 2021-05-10T00:30:43.713000 | 2018-01-24T23:56:01 | 2018-01-24T23:56:01 | 118,837,356 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package sum;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
* FB:
* https://www.careercup.com/question?id=5652354158297088
*
*/
public class FourEqualNum {
private static class Pair {
int x;
int y;
Pair(int x, int y) {
this.x = x;
this.y = y;
}
}
public static void fourSum(int[] arr) {
Map<Integer, List<Pair>> map = new HashMap<>();
for (int i = 0; i < arr.length - 1; i++) {
for (int j = i + 1; j < arr.length; j++) {
int sum = arr[i] + arr[j];
if (!map.containsKey(sum)) {
map.put(sum, new ArrayList<Pair>());
}
map.get(sum).add(new Pair(arr[i], arr[j]));
}
}
for (Entry<Integer, List<Pair>> entry : map.entrySet()) {
for (Pair p : entry.getValue()) {
System.out.print(p.x + ":" + p.y + ", ");
}
System.out.println();
}
}
public static void main(String[] args) {
int[] arr = {3, 4, 7, 1, 2, 9, 8};
fourSum(arr);
}
}
|
UTF-8
|
Java
| 1,275 |
java
|
FourEqualNum.java
|
Java
|
[] | null |
[] |
package sum;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
* FB:
* https://www.careercup.com/question?id=5652354158297088
*
*/
public class FourEqualNum {
private static class Pair {
int x;
int y;
Pair(int x, int y) {
this.x = x;
this.y = y;
}
}
public static void fourSum(int[] arr) {
Map<Integer, List<Pair>> map = new HashMap<>();
for (int i = 0; i < arr.length - 1; i++) {
for (int j = i + 1; j < arr.length; j++) {
int sum = arr[i] + arr[j];
if (!map.containsKey(sum)) {
map.put(sum, new ArrayList<Pair>());
}
map.get(sum).add(new Pair(arr[i], arr[j]));
}
}
for (Entry<Integer, List<Pair>> entry : map.entrySet()) {
for (Pair p : entry.getValue()) {
System.out.print(p.x + ":" + p.y + ", ");
}
System.out.println();
}
}
public static void main(String[] args) {
int[] arr = {3, 4, 7, 1, 2, 9, 8};
fourSum(arr);
}
}
| 1,275 | 0.44549 | 0.425098 | 54 | 22.611111 | 19.059767 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62963 | false | false |
13
|
caee396aea4fdc2b067337aee551d433e2259336
| 1,958,505,111,976 |
8e2e7c9cc31c9280149a721b4b0353c43302e507
|
/src/com/zetcode/MainMenu.java
|
c28c7af99e3cd2d36c7cf908d791e08980be1689
|
[] |
no_license
|
ckdghks34/java_snake_game
|
https://github.com/ckdghks34/java_snake_game
|
744ae3a08a417469a17c728eacdc3b79220c7ecc
|
3eff1ad88af15c6e6c904db3772b72d6a51e9d06
|
refs/heads/master
| 2023-06-03T08:30:34.546000 | 2021-06-19T03:03:44 | 2021-06-19T03:03:44 | 378,310,416 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zetcode;
import javax.swing.*;
import java.awt.*;
public class MainMenu extends JPanel
{
//--------------------------------------------------------------------------------------------//
//
//--------------------------------------------------------------------------------------------//
Data data = new Data();
JButton btnGameStart = new JButton(new ImageIcon("res/Image/btnGameStart.png"));
JButton btnGameRule = new JButton(new ImageIcon("res/Image/btnGameRule.png"));
JButton btnExit = new JButton(new ImageIcon("res/Image/btnExit.png"));
ImageIcon imiBackGround = new ImageIcon("res/Image/MainBackGround.png");
Image BackGround = imiBackGround.getImage();
Font btnfont = new Font("맑은 고딕", Font.ITALIC,20);
//--------------------------------------------------------------------------------------------//
//
//--------------------------------------------------------------------------------------------//
public MainMenu()
{
setPreferredSize(new Dimension(data.getBoardWidth(), data.getBoardHeight()));
setLayout(null);
//add(Box.createVerticalStrut(2));
// 버튼 사이즈, 위치 조정
btnGameStart.setLocation(400,280);
btnGameStart.setSize(270,80);
btnGameRule.setLocation(400,410);
btnGameRule.setSize(270,80);
btnExit.setLocation(400,540);
btnExit.setSize(270,80);
//버튼 틀제거
btnGameStart.setBorderPainted(false);
btnGameStart.setContentAreaFilled(false);
btnGameStart.setFocusPainted(true);
btnGameRule.setBorderPainted(false);
btnGameRule.setContentAreaFilled(false);
btnGameRule.setFocusPainted(true);
btnExit.setBorderPainted(false);
btnExit.setContentAreaFilled(false);
btnExit.setFocusPainted(true);
add(btnGameStart);
add(btnGameRule);
add(btnExit);
setFocusable(true);
setVisible(true);
//BtnMainMenu();
}
public void paintComponent(Graphics g){
super.paintComponent(g);
g.drawImage(BackGround,0,0,getWidth(),getHeight(),this);
}
// public void BtnMainMenu()
// {
// btnGameStart = new JButton("GameStart");
// btnGameRule = new JButton("GameRule");
// btnGameStart.setSize(300,300);
// btnGameStart.setFont(btnfont);
// btnGameRule.setSize(300,300);
// btnGameRule.setFont(btnfont);
//// temp.addActionListener(listener -> asdf(Context));
// }
// protected void asdf(ActionEvent e)
// {
// temp = (JButton) e.getSource();
//
// if(temp.getText().equals("GameStart"))
// {
// System.out.println("GameStart!");
// setVisible(false);
// }
// }
}
|
UTF-8
|
Java
| 2,849 |
java
|
MainMenu.java
|
Java
|
[] | null |
[] |
package com.zetcode;
import javax.swing.*;
import java.awt.*;
public class MainMenu extends JPanel
{
//--------------------------------------------------------------------------------------------//
//
//--------------------------------------------------------------------------------------------//
Data data = new Data();
JButton btnGameStart = new JButton(new ImageIcon("res/Image/btnGameStart.png"));
JButton btnGameRule = new JButton(new ImageIcon("res/Image/btnGameRule.png"));
JButton btnExit = new JButton(new ImageIcon("res/Image/btnExit.png"));
ImageIcon imiBackGround = new ImageIcon("res/Image/MainBackGround.png");
Image BackGround = imiBackGround.getImage();
Font btnfont = new Font("맑은 고딕", Font.ITALIC,20);
//--------------------------------------------------------------------------------------------//
//
//--------------------------------------------------------------------------------------------//
public MainMenu()
{
setPreferredSize(new Dimension(data.getBoardWidth(), data.getBoardHeight()));
setLayout(null);
//add(Box.createVerticalStrut(2));
// 버튼 사이즈, 위치 조정
btnGameStart.setLocation(400,280);
btnGameStart.setSize(270,80);
btnGameRule.setLocation(400,410);
btnGameRule.setSize(270,80);
btnExit.setLocation(400,540);
btnExit.setSize(270,80);
//버튼 틀제거
btnGameStart.setBorderPainted(false);
btnGameStart.setContentAreaFilled(false);
btnGameStart.setFocusPainted(true);
btnGameRule.setBorderPainted(false);
btnGameRule.setContentAreaFilled(false);
btnGameRule.setFocusPainted(true);
btnExit.setBorderPainted(false);
btnExit.setContentAreaFilled(false);
btnExit.setFocusPainted(true);
add(btnGameStart);
add(btnGameRule);
add(btnExit);
setFocusable(true);
setVisible(true);
//BtnMainMenu();
}
public void paintComponent(Graphics g){
super.paintComponent(g);
g.drawImage(BackGround,0,0,getWidth(),getHeight(),this);
}
// public void BtnMainMenu()
// {
// btnGameStart = new JButton("GameStart");
// btnGameRule = new JButton("GameRule");
// btnGameStart.setSize(300,300);
// btnGameStart.setFont(btnfont);
// btnGameRule.setSize(300,300);
// btnGameRule.setFont(btnfont);
//// temp.addActionListener(listener -> asdf(Context));
// }
// protected void asdf(ActionEvent e)
// {
// temp = (JButton) e.getSource();
//
// if(temp.getText().equals("GameStart"))
// {
// System.out.println("GameStart!");
// setVisible(false);
// }
// }
}
| 2,849 | 0.525773 | 0.507999 | 91 | 29.912088 | 27.059418 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.692308 | false | false |
13
|
1f3840c9282e6ba9c3fcbf63993465f7f9db7cb5
| 14,113,262,543,718 |
bf21e022499fa3d04f8c72c5c1a18b3aea3a2ea2
|
/components/apimgt/org.wso2.carbon.apimgt.common.gateway/src/main/java/org/wso2/carbon/apimgt/common/gateway/dto/ExtensionResponseDTO.java
|
445ff5d3e43da58871f0651a8f04cfacb8624f8b
|
[
"Apache-2.0"
] |
permissive
|
wso2/carbon-apimgt
|
https://github.com/wso2/carbon-apimgt
|
4681a2f6570d20584036c77fd1a9401837223ec7
|
97763b10d68e6d07a65f8e4e1766408eb4808d5c
|
refs/heads/master
| 2023-09-03T15:02:29.757000 | 2023-08-22T01:51:00 | 2023-08-22T01:51:00 | 17,201,744 | 169 | 922 |
Apache-2.0
| false | 2023-09-14T20:04:48 | 2014-02-26T06:46:48 | 2023-08-28T10:25:37 | 2023-09-14T18:14:23 | 616,424 | 159 | 596 | 69 |
Java
| false | false |
/*
* Copyright (c) 2021 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.wso2.carbon.apimgt.common.gateway.dto;
import java.io.InputStream;
import java.util.Map;
/**
* Representation of Extension Response Information received after processing the Request/Response.
*/
public class ExtensionResponseDTO {
// Response Status type. Should be a value of ExtensionResponseStatus enum.
String responseStatus;
// HTTP status code to set
int statusCode;
// Payload to set
InputStream payload;
// Transport headers to set
Map<String, String> headers;
// customProperty map to set
Map<String, Object> customProperty;
public int getStatusCode() {
return statusCode;
}
public void setStatusCode(int statusCode) {
this.statusCode = statusCode;
}
public InputStream getPayload() {
return payload;
}
public void setPayload(InputStream payload) {
this.payload = payload;
}
public Map<String, String> getHeaders() {
return headers;
}
public void setHeaders(Map<String, String> headers) {
this.headers = headers;
}
public String getResponseStatus() {
return responseStatus;
}
public void setResponseStatus(String responseStatus) {
this.responseStatus = responseStatus;
}
public Map<String, Object> getCustomProperty() {
return customProperty;
}
public void setCustomProperty(Map<String, Object> customProperty) {
this.customProperty = customProperty;
}
}
|
UTF-8
|
Java
| 2,174 |
java
|
ExtensionResponseDTO.java
|
Java
|
[] | null |
[] |
/*
* Copyright (c) 2021 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.wso2.carbon.apimgt.common.gateway.dto;
import java.io.InputStream;
import java.util.Map;
/**
* Representation of Extension Response Information received after processing the Request/Response.
*/
public class ExtensionResponseDTO {
// Response Status type. Should be a value of ExtensionResponseStatus enum.
String responseStatus;
// HTTP status code to set
int statusCode;
// Payload to set
InputStream payload;
// Transport headers to set
Map<String, String> headers;
// customProperty map to set
Map<String, Object> customProperty;
public int getStatusCode() {
return statusCode;
}
public void setStatusCode(int statusCode) {
this.statusCode = statusCode;
}
public InputStream getPayload() {
return payload;
}
public void setPayload(InputStream payload) {
this.payload = payload;
}
public Map<String, String> getHeaders() {
return headers;
}
public void setHeaders(Map<String, String> headers) {
this.headers = headers;
}
public String getResponseStatus() {
return responseStatus;
}
public void setResponseStatus(String responseStatus) {
this.responseStatus = responseStatus;
}
public Map<String, Object> getCustomProperty() {
return customProperty;
}
public void setCustomProperty(Map<String, Object> customProperty) {
this.customProperty = customProperty;
}
}
| 2,174 | 0.687672 | 0.682153 | 88 | 23.693182 | 24.334953 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.329545 | false | false |
13
|
fcba72f98ad92bc66ecddffd90454122ac8ec5ed
| 2,877,628,148,851 |
e57edef9953435a4e88a5785ba1c5ec3a95dd3d8
|
/src/main/java/com/litesite/dal/BlcCodeTypesRecord.java
|
d0a2654473a3307d5d0c8337773370516754668d
|
[] |
no_license
|
huherto/lite-site
|
https://github.com/huherto/lite-site
|
925ff361febeec4a2feb5624cecf420c7d03a15d
|
b4e05cde879b7ad11e392cd97cbfffedafc63413
|
refs/heads/master
| 2016-09-05T14:42:13.948000 | 2014-04-25T11:23:39 | 2014-04-25T11:23:39 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.litesite.dal;
/**
* BlcCodeTypesRecord –
*
*/
public class BlcCodeTypesRecord extends BaseBlcCodeTypesRecord {
}
|
UTF-8
|
Java
| 132 |
java
|
BlcCodeTypesRecord.java
|
Java
|
[] | null |
[] |
package com.litesite.dal;
/**
* BlcCodeTypesRecord –
*
*/
public class BlcCodeTypesRecord extends BaseBlcCodeTypesRecord {
}
| 132 | 0.746154 | 0.746154 | 9 | 13.444445 | 20.127985 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | false | false |
13
|
ce7f9146f02e2ff686f6bb9d969d5d0d83635fc2
| 1,623,497,667,695 |
91612912babeb637871bad0e0c0fa618ed78c7b2
|
/src/main/java/ua/pp/gritsenko/company/service/speciality/Service.java
|
32ca725c2a772ddca61a471d4e00bd3e98bb24d7
|
[] |
no_license
|
AlexeySouth/Company
|
https://github.com/AlexeySouth/Company
|
e5bd2781cfef4daad1f45394add198f472176300
|
a9654c500b0f69bfd25da287c2091f20ab2340df
|
refs/heads/master
| 2016-09-07T20:26:07.073000 | 2015-08-13T18:00:43 | 2015-08-13T18:00:43 | 40,674,744 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ua.pp.gritsenko.company.service.speciality;
import ua.pp.gritsenko.company.dto.BaseDto;
import ua.pp.gritsenko.company.integration.transactionManager.TransactionException;
import java.util.List;
/**
* Created by alex on 11/16/14.
*/
public interface Service <T extends BaseDto> {
public T selectById(int id) throws TransactionException;
public List<T> selectAll() throws TransactionException;
}
|
UTF-8
|
Java
| 416 |
java
|
Service.java
|
Java
|
[
{
"context": "eption;\n\nimport java.util.List;\n\n/**\n * Created by alex on 11/16/14.\n */\npublic interface Service <T exte",
"end": 228,
"score": 0.9957581162452698,
"start": 224,
"tag": "USERNAME",
"value": "alex"
}
] | null |
[] |
package ua.pp.gritsenko.company.service.speciality;
import ua.pp.gritsenko.company.dto.BaseDto;
import ua.pp.gritsenko.company.integration.transactionManager.TransactionException;
import java.util.List;
/**
* Created by alex on 11/16/14.
*/
public interface Service <T extends BaseDto> {
public T selectById(int id) throws TransactionException;
public List<T> selectAll() throws TransactionException;
}
| 416 | 0.78125 | 0.766827 | 14 | 28.714285 | 27.329807 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
13
|
231987dd3ea5ffa244160ba674b4ac1c752fbdf3
| 1,623,497,664,437 |
ec64c16075060993d5739c4c0b2515f5a5ce10c3
|
/example/gui/src/pattern/state/Test.java
|
61197c5b9c208024c44f26b1fc3bc05e4b4a12a9
|
[
"MIT"
] |
permissive
|
f0829/pasket
|
https://github.com/f0829/pasket
|
2d93fc9b51e8ff57cc9fe9304a2183ce5bb0448d
|
37ba5b5f503a485c1057caaa6b57061898f05955
|
refs/heads/master
| 2021-06-07T16:43:20.429000 | 2016-09-15T05:47:22 | 2016-09-15T05:47:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pattern.state;
public class Test {
final static String tag = Test.class.getPackage().getName();
public static void main(String[] args) {
System.out.println(tag + ": scenario 0");
Test.scenario0();
System.out.println(tag + ": scenario 1");
Test.scenario1();
System.out.println(tag + ": scenario 2");
Test.scenario2();
}
// correct usage
private static void scenario0() {
Player p = new Player();
p.prepare();
// p.reset();
// p.prepare();
p.start();
// p.reset();
// p.prepare();
// p.start();
p.pause();
// p.reset();
// p.prepare();
// p.start();
// p.pause();
p.start();
p.stop();
p.release();
}
// error 1: start w/o preparation
private static void scenario1() {
Player p = new Player();
p.start();
}
// error 2: stop w/o starting
private static void scenario2() {
Player p = new Player();
p.prepare();
p.stop();
}
}
|
UTF-8
|
Java
| 970 |
java
|
Test.java
|
Java
|
[] | null |
[] |
package pattern.state;
public class Test {
final static String tag = Test.class.getPackage().getName();
public static void main(String[] args) {
System.out.println(tag + ": scenario 0");
Test.scenario0();
System.out.println(tag + ": scenario 1");
Test.scenario1();
System.out.println(tag + ": scenario 2");
Test.scenario2();
}
// correct usage
private static void scenario0() {
Player p = new Player();
p.prepare();
// p.reset();
// p.prepare();
p.start();
// p.reset();
// p.prepare();
// p.start();
p.pause();
// p.reset();
// p.prepare();
// p.start();
// p.pause();
p.start();
p.stop();
p.release();
}
// error 1: start w/o preparation
private static void scenario1() {
Player p = new Player();
p.start();
}
// error 2: stop w/o starting
private static void scenario2() {
Player p = new Player();
p.prepare();
p.stop();
}
}
| 970 | 0.549485 | 0.538144 | 52 | 17.653847 | 14.495204 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.557692 | false | false |
13
|
cef812612ce1c34fe9408faf165911760a91e90e
| 23,648,089,941,130 |
1645a0b8b4743925137e47c240e1f9e322cf0e19
|
/src/fileOperations/CurrentDate.java
|
5af03ccfa97b3ad3c16f713560286f2945cde591
|
[] |
no_license
|
jgtz/FileClasses
|
https://github.com/jgtz/FileClasses
|
0eec57a23f160f60ad22f7c149a522856fb63df6
|
af4b647e81b7c410771f32fe3fd96cf1f66f12d8
|
refs/heads/master
| 2021-06-26T19:54:34.176000 | 2016-11-04T18:10:10 | 2016-11-04T18:10:10 | 30,666,719 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fileOperations;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class CurrentDate {
public static String getDateTime() {
DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss_SSS");
Date date = new Date();
return dateFormat.format(date);
}
}
|
UTF-8
|
Java
| 446 |
java
|
CurrentDate.java
|
Java
|
[] | null |
[] |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fileOperations;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class CurrentDate {
public static String getDateTime() {
DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss_SSS");
Date date = new Date();
return dateFormat.format(date);
}
}
| 446 | 0.695067 | 0.695067 | 20 | 21.299999 | 21.658947 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45 | false | false |
13
|
1934eca92dfe44fd21ec23abe4a5ac67800dc6ce
| 4,337,916,983,373 |
d33ae08316f370f4e448fb34012bf14a64b0f453
|
/ncboproxy-servlet/src/main/java/io/github/agroportal/ncboproxy/handlers/omtdsharemeta/utils/OMTDLicenceMapperImpl.java
|
7505a08387f201473ff12a640e4d760b79aafa93
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
agroportal/ncboproxy
|
https://github.com/agroportal/ncboproxy
|
45b071a7f6ce72c3812a41507527c3cda9662ca9
|
26418879a9249c140ddef5453efcf9122c5be0fc
|
refs/heads/master
| 2021-05-04T12:57:40.672000 | 2020-04-08T10:03:47 | 2020-04-08T10:03:47 | 120,303,693 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package io.github.agroportal.ncboproxy.handlers.omtdsharemeta.utils;
import eu.openminted.registry.domain.LicenceEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
class OMTDLicenceMapperImpl implements OMTDLicenceMapper {
private static final Logger logger = LoggerFactory.getLogger(OMTDLicenceMapperImpl.class);
private static final Pattern PUNCTUATION_PATTERN = Pattern.compile("\\p{Punct}");
private static final Pattern HTTP_COLON_PATTERN = Pattern.compile("http:");
private final List<LicenceEnum> acoronyms;
private final List<String> descriptions;
private final List<String> urls;
OMTDLicenceMapperImpl() {
acoronyms = new ArrayList<>();
descriptions = new ArrayList<>();
urls = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(OMTDLicenceMapper.class.getResourceAsStream("/omtdshareschema/license_URI-Name_Mapping.csv")))) {
reader
.lines()
.forEach(line -> {
final String[] fields = line.split(",");
acoronyms.add(LicenceEnum.fromValue(fields[0]));
urls.add(fields[1]);
descriptions.add(PUNCTUATION_PATTERN
.matcher(fields[2]
.toLowerCase()
.trim())
.replaceAll(""));
});
} catch (final IOException e) {
logger.error("Cannot read license mapping for OMTDShare metadata output generation: classpath:/omtdshareschema/license_URI-Name_Mapping.csv");
}
}
@Override
public Optional<LicenceEnum> findLicense(final String descriptor) {
final Matcher urlMatcher = HTTPS_URL_PATTERN.matcher(descriptor);
int index = -1;
if (urlMatcher.matches()) {
index = urls.indexOf(HTTP_COLON_PATTERN
.matcher(descriptor)
.replaceAll("https:"));
}
if (index < 0) {
index = descriptions.indexOf(PUNCTUATION_PATTERN
.matcher(descriptor
.toLowerCase()
.trim())
.replaceAll(""));
}
return (index < 0) ? Optional.empty() : Optional.of(acoronyms.get(index));
}
}
|
UTF-8
|
Java
| 2,673 |
java
|
OMTDLicenceMapperImpl.java
|
Java
|
[
{
"context": "package io.github.agroportal.ncboproxy.handlers.omtdsharemeta.utils;\n\nimport e",
"end": 28,
"score": 0.5979171395301819,
"start": 18,
"tag": "USERNAME",
"value": "agroportal"
}
] | null |
[] |
package io.github.agroportal.ncboproxy.handlers.omtdsharemeta.utils;
import eu.openminted.registry.domain.LicenceEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
class OMTDLicenceMapperImpl implements OMTDLicenceMapper {
private static final Logger logger = LoggerFactory.getLogger(OMTDLicenceMapperImpl.class);
private static final Pattern PUNCTUATION_PATTERN = Pattern.compile("\\p{Punct}");
private static final Pattern HTTP_COLON_PATTERN = Pattern.compile("http:");
private final List<LicenceEnum> acoronyms;
private final List<String> descriptions;
private final List<String> urls;
OMTDLicenceMapperImpl() {
acoronyms = new ArrayList<>();
descriptions = new ArrayList<>();
urls = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(OMTDLicenceMapper.class.getResourceAsStream("/omtdshareschema/license_URI-Name_Mapping.csv")))) {
reader
.lines()
.forEach(line -> {
final String[] fields = line.split(",");
acoronyms.add(LicenceEnum.fromValue(fields[0]));
urls.add(fields[1]);
descriptions.add(PUNCTUATION_PATTERN
.matcher(fields[2]
.toLowerCase()
.trim())
.replaceAll(""));
});
} catch (final IOException e) {
logger.error("Cannot read license mapping for OMTDShare metadata output generation: classpath:/omtdshareschema/license_URI-Name_Mapping.csv");
}
}
@Override
public Optional<LicenceEnum> findLicense(final String descriptor) {
final Matcher urlMatcher = HTTPS_URL_PATTERN.matcher(descriptor);
int index = -1;
if (urlMatcher.matches()) {
index = urls.indexOf(HTTP_COLON_PATTERN
.matcher(descriptor)
.replaceAll("https:"));
}
if (index < 0) {
index = descriptions.indexOf(PUNCTUATION_PATTERN
.matcher(descriptor
.toLowerCase()
.trim())
.replaceAll(""));
}
return (index < 0) ? Optional.empty() : Optional.of(acoronyms.get(index));
}
}
| 2,673 | 0.592218 | 0.589226 | 68 | 38.308823 | 32.251884 | 175 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.485294 | false | false |
13
|
6df7da59a20ed30ab4e3ee2f65f2b15ed2f69934
| 790,274,008,312 |
2762b8b8d41e28d927a51aed5fabb8350035b0a9
|
/src/main/java/mk/finki/ukim/mk/lab/model/exceptions/UserAlreadyExistsException.java
|
d0f95f474f1e82406d91edfccd9b63bb3a1108a9
|
[] |
no_license
|
EdvinLekovic/wp-lab
|
https://github.com/EdvinLekovic/wp-lab
|
7291acb097bd544a6053afe8769da9f1fb260772
|
8d249672dd902f84043b7f72a3ce9fc4850f420b
|
refs/heads/master
| 2023-02-08T23:45:04.834000 | 2020-12-26T15:22:44 | 2020-12-26T15:22:44 | 313,672,233 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package mk.finki.ukim.mk.lab.model.exceptions;
public class UserAlreadyExistsException extends RuntimeException{
public UserAlreadyExistsException(String username){
super(String.format("User with username %s already exist in the system",username));
}
}
|
UTF-8
|
Java
| 270 |
java
|
UserAlreadyExistsException.java
|
Java
|
[] | null |
[] |
package mk.finki.ukim.mk.lab.model.exceptions;
public class UserAlreadyExistsException extends RuntimeException{
public UserAlreadyExistsException(String username){
super(String.format("User with username %s already exist in the system",username));
}
}
| 270 | 0.774074 | 0.774074 | 7 | 37.57143 | 33.363182 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
13
|
e206a90427190ce50c6685c0e7b957f33a8e9205
| 987,842,548,359 |
fd92da7e937ddf920565a3ccd3bf96e24c50693c
|
/src/main/java/com/niit/dao/CartItemsDAOImpl.java
|
ff69f473e117c571c8668a5915190cea8803f896
|
[] |
no_license
|
sairaghavendran/cartcheckout
|
https://github.com/sairaghavendran/cartcheckout
|
b75ee4d2e122e1aeacdb2bec51be2428ebd74e9b
|
4ef202c9d04ca59ce888c1f87cefbae65aca0880
|
refs/heads/master
| 2018-01-05T10:26:18.831000 | 2016-09-29T06:20:00 | 2016-09-29T06:20:00 | 69,536,783 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.niit.dao;
import java.util.List;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.niit.model.CartItems;
@Repository
public class CartItemsDAOImpl implements CartItemsDAO {
@Autowired
private SessionFactory sessionFactory;
@Override
public void add(CartItems cartItems) {
sessionFactory.getCurrentSession().save(cartItems);
System.out.println("add");
}
@Override
public List getAllProduct() {
return sessionFactory.getCurrentSession().createQuery("from CartItems").list();
}
@Override
public void update(CartItems cartItems) {
sessionFactory.getCurrentSession().update(cartItems);
}
@Override
public CartItems getProductById(int productid) {
System.out.println((CartItems)sessionFactory.getCurrentSession().get(CartItems.class, productid));
return (CartItems)sessionFactory.getCurrentSession().get(CartItems.class, productid);
}
@Override
public void delete(int productid) {
System.out.println("to Delete");
sessionFactory.getCurrentSession().delete(getProductById(productid));
}
}
|
UTF-8
|
Java
| 1,167 |
java
|
CartItemsDAOImpl.java
|
Java
|
[] | null |
[] |
package com.niit.dao;
import java.util.List;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.niit.model.CartItems;
@Repository
public class CartItemsDAOImpl implements CartItemsDAO {
@Autowired
private SessionFactory sessionFactory;
@Override
public void add(CartItems cartItems) {
sessionFactory.getCurrentSession().save(cartItems);
System.out.println("add");
}
@Override
public List getAllProduct() {
return sessionFactory.getCurrentSession().createQuery("from CartItems").list();
}
@Override
public void update(CartItems cartItems) {
sessionFactory.getCurrentSession().update(cartItems);
}
@Override
public CartItems getProductById(int productid) {
System.out.println((CartItems)sessionFactory.getCurrentSession().get(CartItems.class, productid));
return (CartItems)sessionFactory.getCurrentSession().get(CartItems.class, productid);
}
@Override
public void delete(int productid) {
System.out.println("to Delete");
sessionFactory.getCurrentSession().delete(getProductById(productid));
}
}
| 1,167 | 0.775493 | 0.775493 | 51 | 21.882353 | 26.283258 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.215686 | false | false |
13
|
5714483d8caca5b90ab37a185380110fc149e92b
| 39,307,540,730,931 |
b7cbd18a6dc400b5749ef942aea4031f50de4c59
|
/src/main/java/com/zezenk/hctest/model/TbUserGroup.java
|
bc5a9e0f5342324fe82e5fcac8681f482c1a0c04
|
[] |
no_license
|
zenkobert/hctest
|
https://github.com/zenkobert/hctest
|
6ad320df140acfac3de7793e8e94cc3acfec9d2f
|
75a7789d64a6a906a58abe4faf4889ee5ace04c9
|
refs/heads/master
| 2021-07-19T09:56:19.060000 | 2019-11-15T02:49:46 | 2019-11-15T02:49:46 | 220,782,941 | 0 | 0 | null | false | 2020-10-13T17:21:07 | 2019-11-10T11:53:55 | 2019-11-15T02:50:12 | 2020-10-13T17:21:05 | 62 | 0 | 0 | 1 |
Java
| false | false |
package com.zezenk.hctest.model;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
@Setter
@Getter
@Entity
@Table(name = "tb_user_group")
public class TbUserGroup implements Serializable {
public TbUserGroup() {}
public TbUserGroup(Long id, String name) {
this.id = id;
this.name = name;
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "userGroup")
private Set<TbModuleOrder> modules = new HashSet<>();
public TbUserGroup addModule(TbModuleOrder module){
module.setUserGroup(this);
this.modules.add(module);
return this;
}
}
|
UTF-8
|
Java
| 813 |
java
|
TbUserGroup.java
|
Java
|
[] | null |
[] |
package com.zezenk.hctest.model;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
@Setter
@Getter
@Entity
@Table(name = "tb_user_group")
public class TbUserGroup implements Serializable {
public TbUserGroup() {}
public TbUserGroup(Long id, String name) {
this.id = id;
this.name = name;
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "userGroup")
private Set<TbModuleOrder> modules = new HashSet<>();
public TbUserGroup addModule(TbModuleOrder module){
module.setUserGroup(this);
this.modules.add(module);
return this;
}
}
| 813 | 0.687577 | 0.687577 | 37 | 20.972973 | 18.681522 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.459459 | false | false |
13
|
0df1695f4ba95998ab29aa1f8812b8fd3f68a474
| 30,794,915,571,194 |
ef09a41d61bf7797aff31ea71ea158c146abf41e
|
/src/main/java/com/vmware/vim25/ClusterDasFailoverLevelAdvancedRuntimeInfo.java
|
45159386c01106301b2b39cad5134e248ca4eb20
|
[
"Apache-2.0",
"BSD-3-Clause"
] |
permissive
|
yavijava/yavijava
|
https://github.com/yavijava/yavijava
|
0221e6604e7839c66694abf10071f481bf8b21a6
|
0640188f3a8747611e06e39fa7a1460f26eb66de
|
refs/heads/gradle
| 2023-09-04T04:15:44.737000 | 2022-10-26T16:18:14 | 2022-10-26T16:18:14 | 22,538,931 | 136 | 128 |
BSD-3-Clause
| false | 2022-10-26T16:20:22 | 2014-08-02T04:00:22 | 2022-10-26T16:18:26 | 2022-10-26T16:20:21 | 4,283 | 141 | 111 | 93 |
Java
| false | false |
/*================================================================================
Copyright (c) 2013 Steve Jin. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of VMware, Inc. nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
================================================================================*/
package com.vmware.vim25;
/**
* @author Steve Jin (http://www.doublecloud.org)
* @version 5.1
*/
@SuppressWarnings("all")
public class ClusterDasFailoverLevelAdvancedRuntimeInfo extends ClusterDasAdvancedRuntimeInfo {
public ClusterDasFailoverLevelAdvancedRuntimeInfoSlotInfo slotInfo;
public int totalSlots;
public int usedSlots;
public int unreservedSlots;
public int totalVms;
public int totalHosts;
public int totalGoodHosts;
public ClusterDasFailoverLevelAdvancedRuntimeInfoHostSlots[] hostSlots;
public ClusterDasFailoverLevelAdvancedRuntimeInfoVmSlots[] vmsRequiringMultipleSlots;
public ClusterDasFailoverLevelAdvancedRuntimeInfoSlotInfo getSlotInfo() {
return this.slotInfo;
}
public int getTotalSlots() {
return this.totalSlots;
}
public int getUsedSlots() {
return this.usedSlots;
}
public int getUnreservedSlots() {
return this.unreservedSlots;
}
public int getTotalVms() {
return this.totalVms;
}
public int getTotalHosts() {
return this.totalHosts;
}
public int getTotalGoodHosts() {
return this.totalGoodHosts;
}
public ClusterDasFailoverLevelAdvancedRuntimeInfoHostSlots[] getHostSlots() {
return this.hostSlots;
}
public ClusterDasFailoverLevelAdvancedRuntimeInfoVmSlots[] getVmsRequiringMultipleSlots() {
return this.vmsRequiringMultipleSlots;
}
public void setSlotInfo(ClusterDasFailoverLevelAdvancedRuntimeInfoSlotInfo slotInfo) {
this.slotInfo = slotInfo;
}
public void setTotalSlots(int totalSlots) {
this.totalSlots = totalSlots;
}
public void setUsedSlots(int usedSlots) {
this.usedSlots = usedSlots;
}
public void setUnreservedSlots(int unreservedSlots) {
this.unreservedSlots = unreservedSlots;
}
public void setTotalVms(int totalVms) {
this.totalVms = totalVms;
}
public void setTotalHosts(int totalHosts) {
this.totalHosts = totalHosts;
}
public void setTotalGoodHosts(int totalGoodHosts) {
this.totalGoodHosts = totalGoodHosts;
}
public void setHostSlots(ClusterDasFailoverLevelAdvancedRuntimeInfoHostSlots[] hostSlots) {
this.hostSlots = hostSlots;
}
public void setVmsRequiringMultipleSlots(ClusterDasFailoverLevelAdvancedRuntimeInfoVmSlots[] vmsRequiringMultipleSlots) {
this.vmsRequiringMultipleSlots = vmsRequiringMultipleSlots;
}
}
|
UTF-8
|
Java
| 4,155 |
java
|
ClusterDasFailoverLevelAdvancedRuntimeInfo.java
|
Java
|
[
{
"context": "===============================\nCopyright (c) 2013 Steve Jin. All Rights Reserved.\n\nRedistribution and use in ",
"end": 111,
"score": 0.9997556805610657,
"start": 102,
"tag": "NAME",
"value": "Steve Jin"
},
{
"context": "=====*/\n\npackage com.vmware.vim25;\n\n/**\n * @author Steve Jin (http://www.doublecloud.org)\n * @version 5.1\n */\n",
"end": 1693,
"score": 0.99973064661026,
"start": 1684,
"tag": "NAME",
"value": "Steve Jin"
}
] | null |
[] |
/*================================================================================
Copyright (c) 2013 <NAME>. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of VMware, Inc. nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
================================================================================*/
package com.vmware.vim25;
/**
* @author <NAME> (http://www.doublecloud.org)
* @version 5.1
*/
@SuppressWarnings("all")
public class ClusterDasFailoverLevelAdvancedRuntimeInfo extends ClusterDasAdvancedRuntimeInfo {
public ClusterDasFailoverLevelAdvancedRuntimeInfoSlotInfo slotInfo;
public int totalSlots;
public int usedSlots;
public int unreservedSlots;
public int totalVms;
public int totalHosts;
public int totalGoodHosts;
public ClusterDasFailoverLevelAdvancedRuntimeInfoHostSlots[] hostSlots;
public ClusterDasFailoverLevelAdvancedRuntimeInfoVmSlots[] vmsRequiringMultipleSlots;
public ClusterDasFailoverLevelAdvancedRuntimeInfoSlotInfo getSlotInfo() {
return this.slotInfo;
}
public int getTotalSlots() {
return this.totalSlots;
}
public int getUsedSlots() {
return this.usedSlots;
}
public int getUnreservedSlots() {
return this.unreservedSlots;
}
public int getTotalVms() {
return this.totalVms;
}
public int getTotalHosts() {
return this.totalHosts;
}
public int getTotalGoodHosts() {
return this.totalGoodHosts;
}
public ClusterDasFailoverLevelAdvancedRuntimeInfoHostSlots[] getHostSlots() {
return this.hostSlots;
}
public ClusterDasFailoverLevelAdvancedRuntimeInfoVmSlots[] getVmsRequiringMultipleSlots() {
return this.vmsRequiringMultipleSlots;
}
public void setSlotInfo(ClusterDasFailoverLevelAdvancedRuntimeInfoSlotInfo slotInfo) {
this.slotInfo = slotInfo;
}
public void setTotalSlots(int totalSlots) {
this.totalSlots = totalSlots;
}
public void setUsedSlots(int usedSlots) {
this.usedSlots = usedSlots;
}
public void setUnreservedSlots(int unreservedSlots) {
this.unreservedSlots = unreservedSlots;
}
public void setTotalVms(int totalVms) {
this.totalVms = totalVms;
}
public void setTotalHosts(int totalHosts) {
this.totalHosts = totalHosts;
}
public void setTotalGoodHosts(int totalGoodHosts) {
this.totalGoodHosts = totalGoodHosts;
}
public void setHostSlots(ClusterDasFailoverLevelAdvancedRuntimeInfoHostSlots[] hostSlots) {
this.hostSlots = hostSlots;
}
public void setVmsRequiringMultipleSlots(ClusterDasFailoverLevelAdvancedRuntimeInfoVmSlots[] vmsRequiringMultipleSlots) {
this.vmsRequiringMultipleSlots = vmsRequiringMultipleSlots;
}
}
| 4,149 | 0.721781 | 0.719856 | 120 | 33.633335 | 31.933508 | 125 | false | false | 0 | 0 | 0 | 0 | 90 | 0.041155 | 0.433333 | false | false |
13
|
5fc1af205ec9c9ace916c24ffe3a5787a4ca5492
| 37,735,582,684,903 |
308169aff50bdd79eaeb1db0fc1f07c3c66aee38
|
/Task38.java
|
4a87ff87a6974cccd44ba66e2caca213b9ed7333
|
[] |
no_license
|
alenakardash/branching
|
https://github.com/alenakardash/branching
|
eaf33c2aa7f58123cc55c8c95bc255116d219fde
|
2e53d206d4bd1f4109d808d0ecf11a257c09599e
|
refs/heads/master
| 2021-03-02T16:27:34.008000 | 2020-03-08T20:34:17 | 2020-03-08T20:34:17 | 244,718,334 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.company.training.branching;
/* Вычислить значение функции:
F(x) = x², если 0 <= x <= 3
F(x) = 4, если x > 3 и x < 0
*/
public class Task38 {
public static void main(String[] args) {
double x;
x = 1;
double f;
if(x >= 0 && x <= 3) {
f = Math.pow(x, 2);
}
else {
f = 4;
}
System.out.print("f = " + f);
}
}
|
UTF-8
|
Java
| 398 |
java
|
Task38.java
|
Java
|
[] | null |
[] |
package com.company.training.branching;
/* Вычислить значение функции:
F(x) = x², если 0 <= x <= 3
F(x) = 4, если x > 3 и x < 0
*/
public class Task38 {
public static void main(String[] args) {
double x;
x = 1;
double f;
if(x >= 0 && x <= 3) {
f = Math.pow(x, 2);
}
else {
f = 4;
}
System.out.print("f = " + f);
}
}
| 398 | 0.5 | 0.464286 | 29 | 11.551724 | 12.971019 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.482759 | false | false |
13
|
872834e3712e514462c49ae8f81ef89495f683a4
| 9,740,985,896,356 |
11269a6a5b1650274065795958dfe6c4a92afdd2
|
/src/ASSIGNMENT/assigment04task2.java
|
2a228f72b6316560c21691bddc7fe036d06ec8e2
|
[] |
no_license
|
Muhaiminur/PROBLEM-SOLVING-JAVA
|
https://github.com/Muhaiminur/PROBLEM-SOLVING-JAVA
|
7834e096fa26d28ed7208bf5507628ebd8f3cdfd
|
00e58a0543a69473e7c597d6c81e185bf145a8a8
|
refs/heads/master
| 2020-04-28T09:08:08.728000 | 2019-03-12T07:14:02 | 2019-03-12T07:14:02 | 175,155,427 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ASSIGNMENT;
/*Task2 ) combine flowcharts and javacodes of finding maximum and
minimum from Task1 into 1 flowchart and 1 javacode. Hint:
write same steps from both flowchart only once. If any line
or any condition (along with yes/no part) is different, then
write the different parts one after another.*/
//finding maximum and minimum
import java.util.Scanner;
public class assigment04task2
{
public static void main(String[]args)
{
Scanner abir=new Scanner(System.in);
int[]a=new int[5];
int c=0;
while(c<a.length)
{
System.out.println("number tavai");
a[c]=abir.nextInt();
c++;
}
int d=0;
int max=a[d];
int min=max;
while(d<a.length)
{
if(max<a[d])
{
max=a[d];
}
else
{
if(min>a[d])
{
min=a[d];
}
}
d++;
}
System.out.println("apnar max ="+max);
System.out.println("apnar minimum ="+min);
}
}
|
UTF-8
|
Java
| 968 |
java
|
assigment04task2.java
|
Java
|
[] | null |
[] |
package ASSIGNMENT;
/*Task2 ) combine flowcharts and javacodes of finding maximum and
minimum from Task1 into 1 flowchart and 1 javacode. Hint:
write same steps from both flowchart only once. If any line
or any condition (along with yes/no part) is different, then
write the different parts one after another.*/
//finding maximum and minimum
import java.util.Scanner;
public class assigment04task2
{
public static void main(String[]args)
{
Scanner abir=new Scanner(System.in);
int[]a=new int[5];
int c=0;
while(c<a.length)
{
System.out.println("number tavai");
a[c]=abir.nextInt();
c++;
}
int d=0;
int max=a[d];
int min=max;
while(d<a.length)
{
if(max<a[d])
{
max=a[d];
}
else
{
if(min>a[d])
{
min=a[d];
}
}
d++;
}
System.out.println("apnar max ="+max);
System.out.println("apnar minimum ="+min);
}
}
| 968 | 0.589876 | 0.579545 | 43 | 21.534883 | 17.779461 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.395349 | false | false |
13
|
fc84b6dc5731f3fcaef46ee0ae61eccc809a0e68
| 9,844,065,047,057 |
b8cfe4364471d964b26ef7fdd502807af28618ef
|
/petro-wf/src/main/java/com/petrooil/core/dao/UserDaoImpl.java
|
e50f12a1a9f0d99624b4373177f5049fdca2a3bc
|
[] |
no_license
|
dambar88/pai-proj
|
https://github.com/dambar88/pai-proj
|
18e16992a200ae70d4b39789a90b0b8e596492f2
|
ad037d3071e14a528a9d68b923334b184008a979
|
refs/heads/master
| 2016-08-05T13:25:25.062000 | 2015-02-28T12:02:53 | 2015-02-28T12:02:53 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.petrooil.core.dao;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.petrooil.core.model.User;
@Repository("userDao")
public class UserDaoImpl implements UserDao {
@Autowired
private SessionFactory sessionFactory;
@SuppressWarnings("unchecked")
public User findByUserName(Serializable username) {
List<User> users = sessionFactory.getCurrentSession().createQuery("from User where username=?")
.setParameter(0, username).list();
if (users.size() > 0) {
return users.get(0);
} else {
return null;
}
}
@Override
public List<User> findAll() {
return sessionFactory.getCurrentSession().createQuery("from User").list();
}
@Override
public User create(User user) {
sessionFactory.getCurrentSession().persist(user);
return user;
}
@Override
public User get(Serializable id) {
return findByUserName(id);
}
@Override
public User update(User user) {
sessionFactory.getCurrentSession().update(user);
return user;
}
@Override
public void delete(User user) {
sessionFactory.getCurrentSession().delete(user);
}
}
|
UTF-8
|
Java
| 1,425 |
java
|
UserDaoImpl.java
|
Java
|
[] | null |
[] |
package com.petrooil.core.dao;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.petrooil.core.model.User;
@Repository("userDao")
public class UserDaoImpl implements UserDao {
@Autowired
private SessionFactory sessionFactory;
@SuppressWarnings("unchecked")
public User findByUserName(Serializable username) {
List<User> users = sessionFactory.getCurrentSession().createQuery("from User where username=?")
.setParameter(0, username).list();
if (users.size() > 0) {
return users.get(0);
} else {
return null;
}
}
@Override
public List<User> findAll() {
return sessionFactory.getCurrentSession().createQuery("from User").list();
}
@Override
public User create(User user) {
sessionFactory.getCurrentSession().persist(user);
return user;
}
@Override
public User get(Serializable id) {
return findByUserName(id);
}
@Override
public User update(User user) {
sessionFactory.getCurrentSession().update(user);
return user;
}
@Override
public void delete(User user) {
sessionFactory.getCurrentSession().delete(user);
}
}
| 1,425 | 0.665263 | 0.663158 | 60 | 21.783333 | 22.308512 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.65 | false | false |
13
|
670deff5cf2db6da9b0d62ab97515affbbb75607
| 9,844,065,044,298 |
cbb233fd3b6b0293700179a27e2493ec8754ad6d
|
/test-task/src/test/java/com/example/test/task/client/presenter/SubstitutionManagementPresenterTest.java
|
be026b4338fdd29adb452c8992a7e8b871fb8806
|
[] |
no_license
|
zaletniy/gwt-testtask
|
https://github.com/zaletniy/gwt-testtask
|
e932341e3b9c5f36214d7491ad04e8e55a869976
|
e7f9bc36f7521c306caf890843ed43f11e409ab4
|
refs/heads/master
| 2020-04-05T23:16:29.720000 | 2012-03-23T15:45:23 | 2012-03-23T15:45:23 | 3,011,322 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
*
*/
package com.example.test.task.client.presenter;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import com.example.test.task.client.AsyncMockStubber;
import com.example.test.task.client.Messages;
import com.example.test.task.client.SubstitutionManagementServiceAsync;
import com.example.test.task.client.event.CreateSubstitutionEvent;
import com.example.test.task.client.event.EditSubstitutionEvent;
import com.example.test.task.client.event.UpdateDataEvent;
import com.example.test.task.client.event.UpdateDataEventHandler;
import com.example.test.task.client.view.StatusIndicator;
import com.example.test.task.client.view.SubstitutionManagementView;
import com.example.test.task.shared.SubstitutionDetails;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* Behavior test for substitution presenter.
*
* @author Ilya Sviridov
*
*/
public class SubstitutionManagementPresenterTest {
EventBus eventBus = new SimpleEventBus();
Messages messages = mock(Messages.class);
//TODO: to think about more general approach of data definition
List<SubstitutionDetails> substitutions = Arrays
.asList(new SubstitutionDetails[] { new SubstitutionDetails(1, "name", "role",
"ruleType", null, null) });
@SuppressWarnings("unchecked")
SubstitutionManagementView<SubstitutionDetails> view = mock(SubstitutionManagementView.class);
SubstitutionManagementServiceAsync service = mock(SubstitutionManagementServiceAsync.class);
StatusIndicator statusIndicator = mock(StatusIndicator.class);
SubstitutionManagementPresenter presenter;
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
presenter = new SubstitutionManagementPresenter(view, service, statusIndicator, eventBus, messages);
// reference data retrieving stubbing
AsyncMockStubber.callSuccessWith(substitutions).when(service)
.getSubstitutions(any(AsyncCallback.class));
// wiring checking
verify(view).setPresenter(presenter);
}
/**
* Tests initializing
*/
@SuppressWarnings("unchecked")
@Test
public void testInit() {
EventBus spyEventBus = spy(eventBus);
presenter = new SubstitutionManagementPresenter(view, service, statusIndicator, spyEventBus, messages);
presenter.go();
verify(view).go();
verify(view).setData(any(List.class));
verify(spyEventBus).addHandler(eq(UpdateDataEvent.TYPE), any(UpdateDataEventHandler.class));
}
/**
* Tests init errors
*/
@SuppressWarnings("unchecked")
@Test
public void testInitServerError() {
doReturn("Server side problems").when(messages).statusLoadingProblems(anyString());
AsyncMockStubber.callErrorWith(new RuntimeException("Server side problems")).when(service)
.getSubstitutions(any(AsyncCallback.class));
presenter = new SubstitutionManagementPresenter(view, service, statusIndicator, eventBus, messages);
verify(statusIndicator).setErrorStatus("Server side problems");
presenter.go();
verify(view).go();
}
/**
*
* Tests selectiong handling
*/
@SuppressWarnings("unchecked")
@Test
public void testOnSelectActionHandling() {
SubstitutionDetails[] selected = new SubstitutionDetails[] { new SubstitutionDetails(),
new SubstitutionDetails(), new SubstitutionDetails() };
presenter.onSelect(Arrays.asList(selected));
verify(view).enableDeleteControl(true);
verify(view).enableUpdateControl(false);
reset(view);
presenter.onSelect(Collections.EMPTY_LIST);
verify(view).enableDeleteControl(false);
verify(view).enableUpdateControl(false);
selected = new SubstitutionDetails[] { new SubstitutionDetails() };
reset(view);
presenter.onSelect(Arrays.asList(selected));
verify(view).enableDeleteControl(true);
verify(view).enableUpdateControl(true);
}
/**
* Tests delete action
*/
@SuppressWarnings("unchecked")
@Test
public void testOnDeleteActionHandling() {
doReturn(substitutions).when(view).getSelectedItems();
AsyncMockStubber.callSuccessWith(Collections.EMPTY_LIST).when(service)
.deleteSubstitution(any(List.class), any(AsyncCallback.class));
presenter.onDeleteAction();
verify(view).setData(eq(Collections.EMPTY_LIST));
verify(view).enableDeleteControl(false);
verify(view).enableUpdateControl(false);
verify(statusIndicator).clear();
}
/**
* Tests updated action
*/
@Test
public void testOnUpdateActionHandling() {
doReturn(substitutions).when(view).getSelectedItems();
EventBus spyEventBus = spy(eventBus);
presenter = new SubstitutionManagementPresenter(view, service, statusIndicator, spyEventBus, messages);
presenter.onUpdateAction();
verify(spyEventBus).fireEvent(any(EditSubstitutionEvent.class));
}
/**
* Tests update action when nothing selected
*/
@Test
public void testOnUpdateActionHandlingNothingSelected() {
doReturn(Collections.EMPTY_LIST).when(view).getSelectedItems();
doReturn("statusInternalError").when(messages).statusInternalError();
EventBus spyEventBus = spy(eventBus);
presenter = new SubstitutionManagementPresenter(view, service, statusIndicator, spyEventBus, messages);
presenter.onUpdateAction();
verify(statusIndicator).setErrorStatus("statusInternalError");
}
/**
* Tests create event publishing
*/
@Test
public void testOnCreateActionHandling() {
EventBus spyEventBus = spy(eventBus);
presenter = new SubstitutionManagementPresenter(view, service, statusIndicator, spyEventBus, messages);
presenter.onCreateAction();
verify(spyEventBus).fireEvent(any(CreateSubstitutionEvent.class));
}
/**
* Tests update event publishing
*/
@SuppressWarnings("unchecked")
@Test
public void testOnUpdateEventHandling() {
doReturn(substitutions).when(view).getSelectedItems();
eventBus.fireEvent(new UpdateDataEvent());
verify(view).setData(any(List.class));
}
}
|
UTF-8
|
Java
| 6,284 |
java
|
SubstitutionManagementPresenterTest.java
|
Java
|
[
{
"context": "or test for substitution presenter.\n * \n * @author Ilya Sviridov\n * \n */\npublic class SubstitutionManagementPresen",
"end": 1361,
"score": 0.9998021125793457,
"start": 1348,
"tag": "NAME",
"value": "Ilya Sviridov"
}
] | null |
[] |
/**
*
*/
package com.example.test.task.client.presenter;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import com.example.test.task.client.AsyncMockStubber;
import com.example.test.task.client.Messages;
import com.example.test.task.client.SubstitutionManagementServiceAsync;
import com.example.test.task.client.event.CreateSubstitutionEvent;
import com.example.test.task.client.event.EditSubstitutionEvent;
import com.example.test.task.client.event.UpdateDataEvent;
import com.example.test.task.client.event.UpdateDataEventHandler;
import com.example.test.task.client.view.StatusIndicator;
import com.example.test.task.client.view.SubstitutionManagementView;
import com.example.test.task.shared.SubstitutionDetails;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* Behavior test for substitution presenter.
*
* @author <NAME>
*
*/
public class SubstitutionManagementPresenterTest {
EventBus eventBus = new SimpleEventBus();
Messages messages = mock(Messages.class);
//TODO: to think about more general approach of data definition
List<SubstitutionDetails> substitutions = Arrays
.asList(new SubstitutionDetails[] { new SubstitutionDetails(1, "name", "role",
"ruleType", null, null) });
@SuppressWarnings("unchecked")
SubstitutionManagementView<SubstitutionDetails> view = mock(SubstitutionManagementView.class);
SubstitutionManagementServiceAsync service = mock(SubstitutionManagementServiceAsync.class);
StatusIndicator statusIndicator = mock(StatusIndicator.class);
SubstitutionManagementPresenter presenter;
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
presenter = new SubstitutionManagementPresenter(view, service, statusIndicator, eventBus, messages);
// reference data retrieving stubbing
AsyncMockStubber.callSuccessWith(substitutions).when(service)
.getSubstitutions(any(AsyncCallback.class));
// wiring checking
verify(view).setPresenter(presenter);
}
/**
* Tests initializing
*/
@SuppressWarnings("unchecked")
@Test
public void testInit() {
EventBus spyEventBus = spy(eventBus);
presenter = new SubstitutionManagementPresenter(view, service, statusIndicator, spyEventBus, messages);
presenter.go();
verify(view).go();
verify(view).setData(any(List.class));
verify(spyEventBus).addHandler(eq(UpdateDataEvent.TYPE), any(UpdateDataEventHandler.class));
}
/**
* Tests init errors
*/
@SuppressWarnings("unchecked")
@Test
public void testInitServerError() {
doReturn("Server side problems").when(messages).statusLoadingProblems(anyString());
AsyncMockStubber.callErrorWith(new RuntimeException("Server side problems")).when(service)
.getSubstitutions(any(AsyncCallback.class));
presenter = new SubstitutionManagementPresenter(view, service, statusIndicator, eventBus, messages);
verify(statusIndicator).setErrorStatus("Server side problems");
presenter.go();
verify(view).go();
}
/**
*
* Tests selectiong handling
*/
@SuppressWarnings("unchecked")
@Test
public void testOnSelectActionHandling() {
SubstitutionDetails[] selected = new SubstitutionDetails[] { new SubstitutionDetails(),
new SubstitutionDetails(), new SubstitutionDetails() };
presenter.onSelect(Arrays.asList(selected));
verify(view).enableDeleteControl(true);
verify(view).enableUpdateControl(false);
reset(view);
presenter.onSelect(Collections.EMPTY_LIST);
verify(view).enableDeleteControl(false);
verify(view).enableUpdateControl(false);
selected = new SubstitutionDetails[] { new SubstitutionDetails() };
reset(view);
presenter.onSelect(Arrays.asList(selected));
verify(view).enableDeleteControl(true);
verify(view).enableUpdateControl(true);
}
/**
* Tests delete action
*/
@SuppressWarnings("unchecked")
@Test
public void testOnDeleteActionHandling() {
doReturn(substitutions).when(view).getSelectedItems();
AsyncMockStubber.callSuccessWith(Collections.EMPTY_LIST).when(service)
.deleteSubstitution(any(List.class), any(AsyncCallback.class));
presenter.onDeleteAction();
verify(view).setData(eq(Collections.EMPTY_LIST));
verify(view).enableDeleteControl(false);
verify(view).enableUpdateControl(false);
verify(statusIndicator).clear();
}
/**
* Tests updated action
*/
@Test
public void testOnUpdateActionHandling() {
doReturn(substitutions).when(view).getSelectedItems();
EventBus spyEventBus = spy(eventBus);
presenter = new SubstitutionManagementPresenter(view, service, statusIndicator, spyEventBus, messages);
presenter.onUpdateAction();
verify(spyEventBus).fireEvent(any(EditSubstitutionEvent.class));
}
/**
* Tests update action when nothing selected
*/
@Test
public void testOnUpdateActionHandlingNothingSelected() {
doReturn(Collections.EMPTY_LIST).when(view).getSelectedItems();
doReturn("statusInternalError").when(messages).statusInternalError();
EventBus spyEventBus = spy(eventBus);
presenter = new SubstitutionManagementPresenter(view, service, statusIndicator, spyEventBus, messages);
presenter.onUpdateAction();
verify(statusIndicator).setErrorStatus("statusInternalError");
}
/**
* Tests create event publishing
*/
@Test
public void testOnCreateActionHandling() {
EventBus spyEventBus = spy(eventBus);
presenter = new SubstitutionManagementPresenter(view, service, statusIndicator, spyEventBus, messages);
presenter.onCreateAction();
verify(spyEventBus).fireEvent(any(CreateSubstitutionEvent.class));
}
/**
* Tests update event publishing
*/
@SuppressWarnings("unchecked")
@Test
public void testOnUpdateEventHandling() {
doReturn(substitutions).when(view).getSelectedItems();
eventBus.fireEvent(new UpdateDataEvent());
verify(view).setData(any(List.class));
}
}
| 6,277 | 0.774825 | 0.774666 | 207 | 29.357489 | 28.154297 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.565217 | false | false |
13
|
65bf20957b9b6ebc0d8758cf8b194bb12ac1c280
| 34,574,486,784,450 |
c7330c756c4861a52d8bacfa102c20e13820460b
|
/webapp/src/main/java/com/it/academy/webapp/controller/AddDeviceController.java
|
ad4fdf96ae1664c7ee88f59a025477a98198eaf4
|
[] |
no_license
|
JanaKoncewaja/it-academy-final
|
https://github.com/JanaKoncewaja/it-academy-final
|
93a0ae6c9290a8b299a79994a771678aab6c9be3
|
005e902320b23f051c6579807fe9b832954ac56a
|
refs/heads/master
| 2022-12-22T18:38:26.620000 | 2019-11-15T17:09:40 | 2019-11-15T17:09:40 | 214,704,712 | 0 | 0 | null | false | 2022-12-16T10:01:41 | 2019-10-12T19:38:13 | 2019-11-15T17:11:52 | 2022-12-16T10:01:38 | 116 | 0 | 0 | 23 |
Java
| false | false |
package com.it.academy.webapp.controller;
import com.it.academy.data.entity.DeviceEntity;
import com.it.academy.domain.Device;
import com.it.academy.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.logging.Logger;
@Controller
@RequestMapping("/addDevice")
public class AddDeviceController {
@Autowired
DeviceService deviceService;
Logger log =Logger.getLogger("AddDeviceController");
@GetMapping
public String getAddPage(){
log.info("Showing the addProductPage");
return "addDevice";
}
@PostMapping
public String addNewDevice(@ModelAttribute DeviceEntity device){
log.info("Adding DEVICE");
deviceService.save(device);
return "redirect:/home";
}
}
|
UTF-8
|
Java
| 887 |
java
|
AddDeviceController.java
|
Java
|
[] | null |
[] |
package com.it.academy.webapp.controller;
import com.it.academy.data.entity.DeviceEntity;
import com.it.academy.domain.Device;
import com.it.academy.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.logging.Logger;
@Controller
@RequestMapping("/addDevice")
public class AddDeviceController {
@Autowired
DeviceService deviceService;
Logger log =Logger.getLogger("AddDeviceController");
@GetMapping
public String getAddPage(){
log.info("Showing the addProductPage");
return "addDevice";
}
@PostMapping
public String addNewDevice(@ModelAttribute DeviceEntity device){
log.info("Adding DEVICE");
deviceService.save(device);
return "redirect:/home";
}
}
| 887 | 0.739572 | 0.739572 | 35 | 24.342857 | 20.692225 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
13
|
f89345cc6db3188f9c46907408a9a6a2c1c7fa25
| 33,964,601,439,352 |
ebbd69eff22b379c17c4ee32da0d913e0ec40676
|
/app/src/main/java/com/example/root/touristhelpline2/StateAdapter.java
|
db531d9bc3e8925d0604d8f0dacdcb6888d56fd3
|
[] |
no_license
|
satyamkapoor04/touristHelpline
|
https://github.com/satyamkapoor04/touristHelpline
|
5e257cc140308bbce023b2358b313121f9a386d5
|
829d066dfb15897803a3051b2e805d1368945e97
|
refs/heads/master
| 2020-03-23T16:18:02.229000 | 2018-07-21T10:32:37 | 2018-07-21T10:32:37 | 141,802,199 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.root.touristhelpline2;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
public class StateAdapter extends RecyclerView.Adapter<StateAdapter.ViewHolder> {
String[] list;
Context context;
public StateAdapter (String[] list, Context context) {
this.list = list;
this.context = context;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from (parent.getContext()).inflate(R.layout.states,parent,false);
return new ViewHolder (view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
String myState = list[position];
int rainbow = context.getResources().getIntArray(R.array.rainbow)[position%4];
holder.state.setBackgroundColor(rainbow);
holder.state.setText(myState);
}
@Override
public int getItemCount() {
return list.length;
}
public class ViewHolder extends RecyclerView.ViewHolder {
TextView state;
public ViewHolder(View itemView) {
super(itemView);
state = itemView.findViewById(R.id.state);
}
}
}
|
UTF-8
|
Java
| 1,450 |
java
|
StateAdapter.java
|
Java
|
[] | null |
[] |
package com.example.root.touristhelpline2;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
public class StateAdapter extends RecyclerView.Adapter<StateAdapter.ViewHolder> {
String[] list;
Context context;
public StateAdapter (String[] list, Context context) {
this.list = list;
this.context = context;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from (parent.getContext()).inflate(R.layout.states,parent,false);
return new ViewHolder (view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
String myState = list[position];
int rainbow = context.getResources().getIntArray(R.array.rainbow)[position%4];
holder.state.setBackgroundColor(rainbow);
holder.state.setText(myState);
}
@Override
public int getItemCount() {
return list.length;
}
public class ViewHolder extends RecyclerView.ViewHolder {
TextView state;
public ViewHolder(View itemView) {
super(itemView);
state = itemView.findViewById(R.id.state);
}
}
}
| 1,450 | 0.694483 | 0.692414 | 52 | 26.884615 | 25.790319 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false |
13
|
aa41ea07d55a6082cb5897f533b6775b74470c11
| 19,232,863,583,438 |
ef72a453355634cb84a7dd1cc1ba7a422081a7f4
|
/spring-boot-jwt-demo/frontend/src/main/java/com/example/RestTemplateConfig.java
|
8a3a00e8f229bcd544c3c263cf8c51fa0ed1df2e
|
[] |
no_license
|
ddobrin/java-spiffe-examples
|
https://github.com/ddobrin/java-spiffe-examples
|
bbe8d9c80fa6e15d2fe297ce0908a9f691db3f2f
|
39cb201d3b626c1d99cff7d6a1af3d556d9eb7a3
|
refs/heads/master
| 2022-12-28T21:58:15.347000 | 2020-10-21T16:57:23 | 2020-10-21T16:57:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example;
import io.spiffe.exception.JwtSourceException;
import io.spiffe.exception.JwtSvidException;
import io.spiffe.exception.SocketEndpointAddressException;
import io.spiffe.svid.jwtsvid.JwtSvidSource;
import io.spiffe.workloadapi.DefaultJwtSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
@Configuration
public class RestTemplateConfig {
@Autowired
JwtSvidSource jwtSvidSource;
@Bean
RestOperations restTemplate() {
RestTemplate restTemplate = new RestTemplate();
restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() {
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
String jwtToken = getJwtToken();
request.getHeaders().add(HttpHeaders.AUTHORIZATION, jwtToken);
return execution.execute(request, body);
}
private String getJwtToken() {
try {
return jwtSvidSource.fetchJwtSvid("backend1", "other-audience").getToken();
} catch (JwtSvidException e) {
throw new RuntimeException("Unable to fetch jwt svid", e);
}
}
});
return restTemplate;
}
@Bean
JwtSvidSource jwtSvidSource() throws JwtSourceException, SocketEndpointAddressException {
return DefaultJwtSource.newSource();
}
}
|
UTF-8
|
Java
| 2,035 |
java
|
RestTemplateConfig.java
|
Java
|
[] | null |
[] |
package com.example;
import io.spiffe.exception.JwtSourceException;
import io.spiffe.exception.JwtSvidException;
import io.spiffe.exception.SocketEndpointAddressException;
import io.spiffe.svid.jwtsvid.JwtSvidSource;
import io.spiffe.workloadapi.DefaultJwtSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
@Configuration
public class RestTemplateConfig {
@Autowired
JwtSvidSource jwtSvidSource;
@Bean
RestOperations restTemplate() {
RestTemplate restTemplate = new RestTemplate();
restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() {
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
String jwtToken = getJwtToken();
request.getHeaders().add(HttpHeaders.AUTHORIZATION, jwtToken);
return execution.execute(request, body);
}
private String getJwtToken() {
try {
return jwtSvidSource.fetchJwtSvid("backend1", "other-audience").getToken();
} catch (JwtSvidException e) {
throw new RuntimeException("Unable to fetch jwt svid", e);
}
}
});
return restTemplate;
}
@Bean
JwtSvidSource jwtSvidSource() throws JwtSourceException, SocketEndpointAddressException {
return DefaultJwtSource.newSource();
}
}
| 2,035 | 0.723833 | 0.723342 | 58 | 34.086208 | 30.286156 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.586207 | false | false |
13
|
10393da74decdf4e6a7ef00f0cfa0274f7ff0890
| 5,901,285,112,464 |
a4a74a2dd67c90b821380f32a66ce23360b206c6
|
/src/main/java/thread/ThreadouterShareVariable.java
|
53080fb74fc1a22ebe03072f5ba89aae468427ea
|
[] |
permissive
|
zhangyongpeng0824/Demo
|
https://github.com/zhangyongpeng0824/Demo
|
e7cbe216184359b9af997022069878beb59f5533
|
d6e68e919836f27d694723a09d746e9cac55ecc4
|
refs/heads/master
| 2022-07-07T05:55:20.506000 | 2020-08-02T08:00:30 | 2020-08-02T08:00:30 | 231,160,586 | 0 | 0 |
Apache-2.0
| false | 2020-01-04T07:48:01 | 2020-01-01T00:38:50 | 2020-01-04T01:57:45 | 2020-01-04T07:47:59 | 59 | 0 | 0 | 0 |
Java
| false | false |
package thread;
public class ThreadouterShareVariable {
public static void main(String[] args) {
final MyThreadTest mt = new MyThreadTest();
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
mt.A();
}
}
}).start();
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
mt.B();
}
}
}).start();
}
}
class MyThreadTest {
private static int x = 1;
public synchronized void A() {
x++;
System.out.println(x);
}
public synchronized void B() {
x--;
System.out.println(x);
}
}
|
UTF-8
|
Java
| 798 |
java
|
ThreadouterShareVariable.java
|
Java
|
[] | null |
[] |
package thread;
public class ThreadouterShareVariable {
public static void main(String[] args) {
final MyThreadTest mt = new MyThreadTest();
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
mt.A();
}
}
}).start();
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
mt.B();
}
}
}).start();
}
}
class MyThreadTest {
private static int x = 1;
public synchronized void A() {
x++;
System.out.println(x);
}
public synchronized void B() {
x--;
System.out.println(x);
}
}
| 798 | 0.432331 | 0.431078 | 45 | 16.733334 | 14.56846 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.244444 | false | false |
13
|
4c8b53fc678be4abc742db2dbe219cd3d97fe12a
| 7,885,559,973,799 |
57a35dd865296f095007525772b4889c35603b76
|
/ueye/src/main/java/net/ueye/module/service/impl/UserToGroupServiceImpl.java
|
98c1e030a21064b799694add2d8566d9e8d34855
|
[
"Apache-2.0"
] |
permissive
|
webueye/ueyeprojects
|
https://github.com/webueye/ueyeprojects
|
1e4e6a3a2d7adfba59e3a8a3055090de223cbe0b
|
e22c62061daf27051863f676a174f9cfd32891e4
|
refs/heads/master
| 2021-01-10T02:14:08.509000 | 2010-09-10T15:35:31 | 2010-09-10T15:35:31 | 43,530,597 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.ueye.module.service.impl;
import java.io.Serializable;
import org.springframework.stereotype.Service;
import net.ueye.module.entity.UserToGroup;
import net.ueye.module.service.UserToGroupService;
/**
* @author rubys@vip.qq.com
* Aug 29, 2009
*/
@Service("userToGroupService")
public class UserToGroupServiceImpl extends BaseServiceImpl<UserToGroup> implements UserToGroupService {
public void delete(long id) {
getUserToGroupDao().delete(UserToGroup.class, id);
}
public void insert(UserToGroup entity) {
getUserToGroupDao().insert(entity);
}
public void update(UserToGroup entity) {
getUserToGroupDao().update(entity);
}
public UserToGroup get(Serializable id) {
return getUserToGroupDao().get(UserToGroup.class, id);
}
}
|
UTF-8
|
Java
| 801 |
java
|
UserToGroupServiceImpl.java
|
Java
|
[
{
"context": "ule.service.UserToGroupService;\r\n\r\n/**\r\n * @author rubys@vip.qq.com\r\n * Aug 29, 2009\r\n */\r\n@Service(\"userToGroupServi",
"end": 253,
"score": 0.9999220371246338,
"start": 237,
"tag": "EMAIL",
"value": "rubys@vip.qq.com"
}
] | null |
[] |
package net.ueye.module.service.impl;
import java.io.Serializable;
import org.springframework.stereotype.Service;
import net.ueye.module.entity.UserToGroup;
import net.ueye.module.service.UserToGroupService;
/**
* @author <EMAIL>
* Aug 29, 2009
*/
@Service("userToGroupService")
public class UserToGroupServiceImpl extends BaseServiceImpl<UserToGroup> implements UserToGroupService {
public void delete(long id) {
getUserToGroupDao().delete(UserToGroup.class, id);
}
public void insert(UserToGroup entity) {
getUserToGroupDao().insert(entity);
}
public void update(UserToGroup entity) {
getUserToGroupDao().update(entity);
}
public UserToGroup get(Serializable id) {
return getUserToGroupDao().get(UserToGroup.class, id);
}
}
| 792 | 0.734082 | 0.726592 | 35 | 20.885714 | 24.246086 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.828571 | false | false |
13
|
e4646d73a4f4b52f92856241db75c43bc76d1a80
| 2,113,123,933,566 |
afd3c1e1318dcb36ac58f8353ee9d0522ab2f265
|
/src/main/java/cn/shmakergroup/caas/interfaces/configuration/facade/dto/UserRegistrationDTO.java
|
1618430e7f51e5bb9d2a65fb0a39f2693d06be2f
|
[] |
no_license
|
imcj/caas-server
|
https://github.com/imcj/caas-server
|
3ee4d9e1d1a99a6cba4eda22cb4041a216d95bd7
|
248238bd504257f845037268c1a027339a307049
|
refs/heads/master
| 2017-12-15T23:22:00.337000 | 2017-01-31T15:15:57 | 2017-01-31T15:15:57 | 77,699,277 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.shmakergroup.caas.interfaces.configuration.facade.dto;
/**
* Created by cj on 2017/1/3.
*/
public class UserRegistrationDTO {
private String username;
private String email;
private String accessKey;
private String accessSecurity;
public UserRegistrationDTO(String username, String email, String accessKey, String accessSecurity) {
this.username = username;
this.email = email;
this.accessKey = accessKey;
this.accessSecurity = accessSecurity;
}
public String getUsername() {
return username;
}
public String getEmail() {
return email;
}
public String getAccessSecurity() {
return accessSecurity;
}
public String getAccessKey() {
return accessKey;
}
}
|
UTF-8
|
Java
| 791 |
java
|
UserRegistrationDTO.java
|
Java
|
[
{
"context": "faces.configuration.facade.dto;\n\n/**\n * Created by cj on 2017/1/3.\n */\n\npublic class UserRegistrationDT",
"end": 87,
"score": 0.9987790584564209,
"start": 85,
"tag": "USERNAME",
"value": "cj"
},
{
"context": ", String accessSecurity) {\n this.username = username;\n this.email = email;\n this.accessK",
"end": 399,
"score": 0.9962319135665894,
"start": 391,
"tag": "USERNAME",
"value": "username"
},
{
"context": "\n\n public String getUsername() {\n return username;\n }\n\n public String getEmail() {\n re",
"end": 575,
"score": 0.9587560296058655,
"start": 567,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
package cn.shmakergroup.caas.interfaces.configuration.facade.dto;
/**
* Created by cj on 2017/1/3.
*/
public class UserRegistrationDTO {
private String username;
private String email;
private String accessKey;
private String accessSecurity;
public UserRegistrationDTO(String username, String email, String accessKey, String accessSecurity) {
this.username = username;
this.email = email;
this.accessKey = accessKey;
this.accessSecurity = accessSecurity;
}
public String getUsername() {
return username;
}
public String getEmail() {
return email;
}
public String getAccessSecurity() {
return accessSecurity;
}
public String getAccessKey() {
return accessKey;
}
}
| 791 | 0.661188 | 0.653603 | 35 | 21.6 | 21.735027 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.457143 | false | false |
13
|
581f47eb2a4c5c02095437ce30ad0b97c26d7e5d
| 27,255,862,509,207 |
548c6d9915eb2c0c70c96d955bb25c547887d402
|
/Spring/_03SpringProperties/src/main/java/night/Grade.java
|
d4a1b672fddc832e897142d6ad4dfc81e98a87c7
|
[] |
no_license
|
yanbubao/review2017
|
https://github.com/yanbubao/review2017
|
8c9c6e405bea774e01617442fb6e4cbb2facc5fe
|
c68e2b1cbc8afb7987d97a9f45a5f9ebc0728a40
|
refs/heads/master
| 2022-12-21T21:07:10.698000 | 2019-09-08T15:55:34 | 2019-09-08T15:55:34 | 203,826,192 | 0 | 0 | null | false | 2022-12-16T02:16:17 | 2019-08-22T15:47:15 | 2019-09-08T15:55:50 | 2022-12-16T02:16:14 | 60 | 0 | 0 | 6 |
Java
| false | false |
package night;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* @author: yanzx
* @date: 2019/08/24 23:38
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Grade {
private String gradeId;
private String gradeName;
}
|
UTF-8
|
Java
| 319 |
java
|
Grade.java
|
Java
|
[
{
"context": "structor;\nimport lombok.ToString;\n\n/**\n * @author: yanzx\n * @date: 2019/08/24 23:38\n */\n@Data\n@AllArgsCons",
"end": 149,
"score": 0.9996647834777832,
"start": 144,
"tag": "USERNAME",
"value": "yanzx"
}
] | null |
[] |
package night;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* @author: yanzx
* @date: 2019/08/24 23:38
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Grade {
private String gradeId;
private String gradeName;
}
| 319 | 0.749216 | 0.711599 | 21 | 14.190476 | 11.370886 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
13
|
9d0983a2ca0dead9a7cd7ecc94ecffa030ac0b8c
| 30,571,577,277,859 |
d3595504d64688d7d0dc734d160ef03e13fb7946
|
/src/java/fr/paris/lutece/plugins/directory/business/EntryTypeCamera.java
|
d00dff6af18767ca9b5345202475a569c4340bb1
|
[] |
no_license
|
lutece-platform/lutece-directory-plugin-directory
|
https://github.com/lutece-platform/lutece-directory-plugin-directory
|
4e950f7f9500df7197c275f2af8b57ae8a923173
|
47d686a282fe34c662dc865d03253e04cb35e0ae
|
refs/heads/master
| 2023-04-28T01:14:22.942000 | 2020-10-02T07:59:44 | 2020-10-02T07:59:44 | 44,175,035 | 0 | 6 | null | false | 2023-04-14T17:03:46 | 2015-10-13T12:34:57 | 2020-10-02T08:00:32 | 2023-04-14T17:03:45 | 3,814 | 0 | 5 | 4 |
Java
| false | false |
/*
* Copyright (c) 2002-2017, Mairie de Paris
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright notice
* and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice
* and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* License 1.0
*/
package fr.paris.lutece.plugins.directory.business;
import fr.paris.lutece.plugins.directory.utils.DirectoryErrorException;
import fr.paris.lutece.plugins.directory.utils.DirectoryUtils;
import fr.paris.lutece.portal.business.regularexpression.RegularExpression;
import fr.paris.lutece.portal.service.i18n.I18nService;
import fr.paris.lutece.portal.service.message.AdminMessage;
import fr.paris.lutece.portal.service.message.AdminMessageService;
import fr.paris.lutece.portal.service.plugin.Plugin;
import fr.paris.lutece.portal.service.regularexpression.RegularExpressionService;
import fr.paris.lutece.portal.service.util.AppLogService;
import fr.paris.lutece.portal.service.util.AppPropertiesService;
import fr.paris.lutece.portal.web.upload.MultipartHttpServletRequest;
import fr.paris.lutece.portal.web.util.LocalizedPaginator;
import fr.paris.lutece.util.ReferenceList;
import fr.paris.lutece.util.filesystem.FileSystemUtil;
import fr.paris.lutece.util.html.Paginator;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.lang.StringUtils;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
/**
*
* class EntryTypeCamera
*
*/
public class EntryTypeCamera extends AbstractEntryTypeUpload
{
private String PROPERTY_IMAGE_TITLE = AppPropertiesService.getProperty( "directory.image.prefix.title", "default" );
protected static final String FIELD_THUMBNAIL_WIDTH = "directory.create_entry.label_width";
protected static final String FIELD_THUMBNAIL_HEIGHT = "directory.create_entry.label_width";
protected static final String FIELD_BIG_THUMBNAIL_WIDTH = "directory.create_entry.label_width";
protected static final String FIELD_BIG_THUMBNAIL_HEIGHT = "directory.create_entry.label_width";
protected static final String ERROR_FIELD_THUMBNAIL = "directory.create_entry.label_error_thumbnail";
protected static final String ERROR_FIELD_BIG_THUMBNAIL = "directory.create_entry.label_error_big_thumbnail";
private static final String PARAMETER_IMAGE_SHOWN_IN_RESULT_LIST = "image_shown_in_result_list";
private static final String PARAMETER_IMAGE_SHOWN_IN_RESULT_RECORD = "image_shown_in_result_record";
private static final String PARAMETER_IMAGE_TYPE = "image_type";
private static final String MESSAGE_ERROR_NOT_AN_IMAGE = "directory.message.error.notAnImage";
private static final String FIELD_IMAGE = "image_full_size";
private final String PREFIX_ENTRY_ID = "directory_";
private final String _template_create = "admin/plugins/directory/entrytypecamera/create_entry_type_camera.html";
private final String _template_modify = "admin/plugins/directory/entrytypecamera/modify_entry_type_camera.html";
private final String _template_html_code_form_entry = "admin/plugins/directory/entrytypecamera/html_code_form_entry_type_camera.html";
private final String _template_html_code_entry_value = "admin/plugins/directory/entrytypecamera/html_code_entry_value_type_camera.html";
private final String _template_html_front_code_form_entry = "skin/plugins/directory/entrytypecamera/html_code_form_entry_type_camera.html";
private final String _template_html_front_code_entry_value = "skin/plugins/directory/entrytypecamera/html_code_entry_value_type_camera.html";
/**
* {@inheritDoc}
*/
@Override
public String getTemplateHtmlFormEntry( boolean isDisplayFront )
{
if ( isDisplayFront )
{
return _template_html_front_code_form_entry;
}
return _template_html_code_form_entry;
}
/**
* {@inheritDoc}
*/
@Override
public String getTemplateHtmlRecordFieldValue( boolean isDisplayFront )
{
if ( isDisplayFront )
{
return _template_html_front_code_entry_value;
}
return _template_html_code_entry_value;
}
/**
* {@inheritDoc}
*/
@Override
public String getEntryData( HttpServletRequest request, Locale locale )
{
String strTitle = request.getParameter( PARAMETER_TITLE );
String strHelpMessage = ( request.getParameter( PARAMETER_HELP_MESSAGE ) != null ) ? request.getParameter( PARAMETER_HELP_MESSAGE ).trim( ) : null;
String strComment = request.getParameter( PARAMETER_COMMENT );
String strMandatory = request.getParameter( PARAMETER_MANDATORY );
String strIndexed = request.getParameter( PARAMETER_INDEXED );
String strIndexedAsTitle = request.getParameter( PARAMETER_INDEXED_AS_TITLE );
String strIndexedAsSummary = request.getParameter( PARAMETER_INDEXED_AS_SUMMARY );
String strWidth = request.getParameter( PARAMETER_WIDTH );
String strHeight = request.getParameter( PARAMETER_HEIGHT );
int nWidth = DirectoryUtils.convertStringToInt( strWidth );
int nHeight = DirectoryUtils.convertStringToInt( strHeight );
String strShowInFormMainSearch = request.getParameter( PARAMETER_SHOWN_IN_ADVANCED_SEARCH );
String strShowInResultList = request.getParameter( PARAMETER_SHOWN_IN_RESULT_LIST );
String strShowInResultRecord = request.getParameter( PARAMETER_SHOWN_IN_RESULT_RECORD );
String strShowInHistory = request.getParameter( PARAMETER_SHOWN_IN_HISTORY );
String strShowInCompleteness = request.getParameter( PARAMETER_SHOWN_IN_COMPLETENESS );
String strError = this.checkEntryData( request, locale );
if ( StringUtils.isNotBlank( strError ) )
{
return strError;
}
this.setTitle( strTitle );
this.setHelpMessage( strHelpMessage );
this.setComment( strComment );
this.setFields( request );
this.setDisplayWidth( nWidth );
this.setDisplayHeight( nHeight );
this.setMandatory( strMandatory != null );
this.setIndexed( strIndexed != null );
this.setIndexedAsTitle( strIndexedAsTitle != null );
this.setIndexedAsSummary( strIndexedAsSummary != null );
this.setShownInAdvancedSearch( strShowInFormMainSearch != null );
this.setShownInResultList( strShowInResultList != null );
this.setShownInResultRecord( strShowInResultRecord != null );
this.setShownInHistory( strShowInHistory != null );
this.setShownInCompleteness( strShowInCompleteness != null );
// image can't be exported in csv
this.setShownInExport( false );
return null;
}
/**
* {@inheritDoc}
*/
@Override
public String getTemplateCreate( )
{
return _template_create;
}
/**
* {@inheritDoc}
*/
@Override
public String getTemplateModify( )
{
return _template_modify;
}
/**
* {@inheritDoc}
*/
@Override
public void getRecordFieldData( Record record, List<String> lstValue, boolean bTestDirectoryError, boolean bAddNewValue, List<RecordField> listRecordField,
Locale locale ) throws DirectoryErrorException
{
// add Empty recordField(Use for data import)
RecordField recordField = new RecordField( );
recordField.setEntry( this );
listRecordField.add( recordField );
}
/**
* {@inheritDoc}
*/
@Override
public void getImportRecordFieldData( Record record, String strImportValue, boolean bTestDirectoryError, List<RecordField> listRecordField, Locale locale )
throws DirectoryErrorException
{
// add Empty recordField
RecordField recordField = new RecordField( );
recordField.setEntry( this );
listRecordField.add( recordField );
}
/**
* {@inheritDoc}
*/
@Override
public void getRecordFieldData( Record record, HttpServletRequest request, boolean bTestDirectoryError, boolean bAddNewValue,
List<RecordField> listRecordField, Locale locale ) throws DirectoryErrorException
{
if ( request instanceof MultipartHttpServletRequest )
{
String sourceImage = request.getParameter( PREFIX_ENTRY_ID + this.getIdEntry( ) );
if ( ( sourceImage != null ) && StringUtils.isNotEmpty( sourceImage ) )
{
// Checks
if ( bTestDirectoryError )
{
this.checkRecordFieldData( sourceImage, locale );
}
File file = new File( );
Calendar c = Calendar.getInstance( );
String fileName = request.getParameter( PROPERTY_IMAGE_TITLE );
if ( fileName != null )
{
file.setTitle( fileName + "_" + c.getTime( ) );
}
else
{
file.setTitle( this.getTitle( ) + "_" + c.getTime( ) );
}
file.setExtension( this.getFields( ).get( 2 ).getImageType( ) != null ? this.getFields( ).get( 2 ).getImageType( ) : "png" );
PhysicalFile physicalFile = new PhysicalFile( );
String base64Image = sourceImage.split( "," ) [1];
byte [ ] imageBytes = javax.xml.bind.DatatypeConverter.parseBase64Binary( base64Image );
physicalFile.setValue( imageBytes );
file.setPhysicalFile( physicalFile );
file.setTitle( this.getFields( ).get( 2 ).getImageType( ) != null ? file.getTitle( ) + "." + this.getFields( ).get( 2 ).getImageType( ) : file
.getTitle( ) + "" );
file.setMimeType( FileSystemUtil.getMIMEType( file.getTitle( ) ) );
ByteArrayInputStream bis = new ByteArrayInputStream( imageBytes );
ByteArrayOutputStream tmp = new ByteArrayOutputStream( );
try
{
BufferedImage image = ImageIO.read( bis );
ImageIO.write( image, this.getFields( ).get( 2 ).getImageType( ) != null ? this.getFields( ).get( 2 ).getImageType( ) : "png", tmp );
bis.close( );
tmp.close( );
file.setSize( tmp.size( ) );
}
catch( IOException e )
{
AppLogService.error( e );
throw new DirectoryErrorException( this.getTitle( ) );
}
// Add the image to the record fields list
RecordField recordField = new RecordField( );
recordField.setEntry( this );
recordField.setValue( FIELD_IMAGE + DirectoryUtils.CONSTANT_UNDERSCORE + 1 );
recordField.setFile( file );
recordField.setFileExtension( file.getExtension( ) );
listRecordField.add( recordField );
}
if ( bTestDirectoryError && this.isMandatory( ) && ( ( sourceImage == null ) || StringUtils.isEmpty( sourceImage ) ) )
{
RecordField recordField = new RecordField( );
recordField.setEntry( this );
recordField.setValue( FIELD_IMAGE );
listRecordField.add( recordField );
throw new DirectoryErrorException( this.getTitle( ) );
}
}
else
if ( bTestDirectoryError )
{
throw new DirectoryErrorException( this.getTitle( ) );
}
}
/**
* {@inheritDoc}
*/
@Override
public Paginator getPaginator( int nItemPerPage, String strBaseUrl, String strPageIndexParameterName, String strPageIndex )
{
return new Paginator( this.getFields( ).get( 0 ).getRegularExpressionList( ), nItemPerPage, strBaseUrl, strPageIndexParameterName, strPageIndex );
}
/**
* {@inheritDoc}
*/
@Override
public ReferenceList getReferenceListRegularExpression( IEntry entry, Plugin plugin )
{
ReferenceList refListRegularExpression = null;
if ( RegularExpressionService.getInstance( ).isAvailable( ) )
{
refListRegularExpression = new ReferenceList( );
List<RegularExpression> listRegularExpression = RegularExpressionService.getInstance( ).getAllRegularExpression( );
for ( RegularExpression regularExpression : listRegularExpression )
{
if ( !entry.getFields( ).get( 0 ).getRegularExpressionList( ).contains( regularExpression ) )
{
refListRegularExpression.addItem( regularExpression.getIdExpression( ), regularExpression.getTitle( ) );
}
}
}
return refListRegularExpression;
}
/**
* {@inheritDoc}
*/
@Override
public LocalizedPaginator getPaginator( int nItemPerPage, String strBaseUrl, String strPageIndexParameterName, String strPageIndex, Locale locale )
{
return new LocalizedPaginator( this.getFields( ).get( 0 ).getRegularExpressionList( ), nItemPerPage, strBaseUrl, strPageIndexParameterName,
strPageIndex, locale );
}
// PROTECTED METHODS
/**
* {@inheritDoc}
*/
@Override
protected String checkEntryData( HttpServletRequest request, Locale locale )
{
String strError = super.checkEntryData( request, locale );
if ( StringUtils.isBlank( strError ) )
{
String strFieldError = StringUtils.EMPTY;
String strTitle = request.getParameter( PARAMETER_TITLE );
String strWidth = request.getParameter( PARAMETER_WIDTH );
String strHeight = request.getParameter( PARAMETER_HEIGHT );
int nWidth = DirectoryUtils.convertStringToInt( strWidth );
int nHeight = DirectoryUtils.convertStringToInt( strHeight );
if ( StringUtils.isBlank( strTitle ) )
{
strFieldError = FIELD_TITLE;
}
if ( !strFieldError.equals( DirectoryUtils.EMPTY_STRING ) )
{
Object [ ] tabRequiredFields = {
I18nService.getLocalizedString( strFieldError, locale )
};
return AdminMessageService.getMessageUrl( request, MESSAGE_MANDATORY_FIELD, tabRequiredFields, AdminMessage.TYPE_STOP );
}
if ( ( strWidth != null ) && ( !strWidth.trim( ).equals( DirectoryUtils.EMPTY_STRING ) ) && ( nWidth == DirectoryUtils.CONSTANT_ID_NULL ) )
{
strFieldError = FIELD_WIDTH;
}
else
if ( ( strHeight != null ) && ( !strHeight.trim( ).equals( DirectoryUtils.EMPTY_STRING ) ) && ( nHeight == DirectoryUtils.CONSTANT_ID_NULL ) )
{
strFieldError = FIELD_HEIGHT;
}
if ( !strFieldError.equals( DirectoryUtils.EMPTY_STRING ) )
{
Object [ ] tabRequiredFields = {
I18nService.getLocalizedString( strFieldError, locale )
};
return AdminMessageService.getMessageUrl( request, MESSAGE_NUMERIC_FIELD, tabRequiredFields, AdminMessage.TYPE_STOP );
}
if ( StringUtils.isNotBlank( strFieldError ) )
{
Object [ ] tabRequiredFields = {
I18nService.getLocalizedString( strFieldError, locale )
};
return AdminMessageService.getMessageUrl( request, MESSAGE_MANDATORY_FIELD, tabRequiredFields, AdminMessage.TYPE_STOP );
}
}
return strError;
}
/**
* {@inheritDoc}
*/
@Override
protected void setFields( HttpServletRequest request, List<Field> listFields )
{
listFields.add( buildFieldFullSize( request ) );
}
private void checkRecordFieldData( String imageSource, Locale locale ) throws DirectoryErrorException
{
BufferedImage image = null;
if ( ( imageSource != null ) && ( imageSource.split( "," ).length > 1 ) )
{
String base64Image = imageSource.split( "," ) [1];
byte [ ] imageBytes = javax.xml.bind.DatatypeConverter.parseBase64Binary( base64Image );
ByteArrayInputStream bis = new ByteArrayInputStream( imageBytes );
try
{
image = ImageIO.read( bis );
bis.close( );
}
catch( IOException e )
{
String strErrorMessage = I18nService.getLocalizedString( MESSAGE_ERROR_NOT_AN_IMAGE, locale );
throw new DirectoryErrorException( this.getTitle( ), strErrorMessage );
}
}
if ( ( image == null ) && StringUtils.isNotBlank( imageSource ) )
{
String strErrorMessage = I18nService.getLocalizedString( MESSAGE_ERROR_NOT_AN_IMAGE, locale );
throw new DirectoryErrorException( this.getTitle( ), strErrorMessage );
}
}
// PRIVATE METHODS
/**
* Build the field full size
*
* @param request
* the HTTP request
* @return the field
*/
private Field buildFieldFullSize( HttpServletRequest request )
{
Field fieldFullImage = DirectoryUtils.findFieldByValueInTheList( FIELD_IMAGE, getFields( ) );
if ( fieldFullImage == null )
{
fieldFullImage = new Field( );
}
if ( request.getParameter( PARAMETER_IMAGE_SHOWN_IN_RESULT_LIST ) != null )
{
fieldFullImage.setShownInResultList( true );
}
else
{
fieldFullImage.setShownInResultList( false );
}
if ( request.getParameter( PARAMETER_IMAGE_SHOWN_IN_RESULT_RECORD ) != null )
{
fieldFullImage.setShownInResultRecord( true );
}
else
{
fieldFullImage.setShownInResultRecord( false );
}
if ( request.getParameter( PARAMETER_IMAGE_TYPE ) != null )
{
fieldFullImage.setImageType( request.getParameter( PARAMETER_IMAGE_TYPE ) );
}
fieldFullImage.setEntry( this );
fieldFullImage.setValue( FIELD_IMAGE );
return fieldFullImage;
}
@Override
protected void checkRecordFieldData( FileItem fileItem, Locale locale ) throws DirectoryErrorException
{
}
}
|
UTF-8
|
Java
| 20,112 |
java
|
EntryTypeCamera.java
|
Java
|
[
{
"context": "/*\n * Copyright (c) 2002-2017, Mairie de Paris\n * All rights reserved.\n *\n * Redistribution and ",
"end": 46,
"score": 0.999692440032959,
"start": 31,
"tag": "NAME",
"value": "Mairie de Paris"
}
] | null |
[] |
/*
* Copyright (c) 2002-2017, <NAME>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright notice
* and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice
* and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* License 1.0
*/
package fr.paris.lutece.plugins.directory.business;
import fr.paris.lutece.plugins.directory.utils.DirectoryErrorException;
import fr.paris.lutece.plugins.directory.utils.DirectoryUtils;
import fr.paris.lutece.portal.business.regularexpression.RegularExpression;
import fr.paris.lutece.portal.service.i18n.I18nService;
import fr.paris.lutece.portal.service.message.AdminMessage;
import fr.paris.lutece.portal.service.message.AdminMessageService;
import fr.paris.lutece.portal.service.plugin.Plugin;
import fr.paris.lutece.portal.service.regularexpression.RegularExpressionService;
import fr.paris.lutece.portal.service.util.AppLogService;
import fr.paris.lutece.portal.service.util.AppPropertiesService;
import fr.paris.lutece.portal.web.upload.MultipartHttpServletRequest;
import fr.paris.lutece.portal.web.util.LocalizedPaginator;
import fr.paris.lutece.util.ReferenceList;
import fr.paris.lutece.util.filesystem.FileSystemUtil;
import fr.paris.lutece.util.html.Paginator;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.lang.StringUtils;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
/**
*
* class EntryTypeCamera
*
*/
public class EntryTypeCamera extends AbstractEntryTypeUpload
{
private String PROPERTY_IMAGE_TITLE = AppPropertiesService.getProperty( "directory.image.prefix.title", "default" );
protected static final String FIELD_THUMBNAIL_WIDTH = "directory.create_entry.label_width";
protected static final String FIELD_THUMBNAIL_HEIGHT = "directory.create_entry.label_width";
protected static final String FIELD_BIG_THUMBNAIL_WIDTH = "directory.create_entry.label_width";
protected static final String FIELD_BIG_THUMBNAIL_HEIGHT = "directory.create_entry.label_width";
protected static final String ERROR_FIELD_THUMBNAIL = "directory.create_entry.label_error_thumbnail";
protected static final String ERROR_FIELD_BIG_THUMBNAIL = "directory.create_entry.label_error_big_thumbnail";
private static final String PARAMETER_IMAGE_SHOWN_IN_RESULT_LIST = "image_shown_in_result_list";
private static final String PARAMETER_IMAGE_SHOWN_IN_RESULT_RECORD = "image_shown_in_result_record";
private static final String PARAMETER_IMAGE_TYPE = "image_type";
private static final String MESSAGE_ERROR_NOT_AN_IMAGE = "directory.message.error.notAnImage";
private static final String FIELD_IMAGE = "image_full_size";
private final String PREFIX_ENTRY_ID = "directory_";
private final String _template_create = "admin/plugins/directory/entrytypecamera/create_entry_type_camera.html";
private final String _template_modify = "admin/plugins/directory/entrytypecamera/modify_entry_type_camera.html";
private final String _template_html_code_form_entry = "admin/plugins/directory/entrytypecamera/html_code_form_entry_type_camera.html";
private final String _template_html_code_entry_value = "admin/plugins/directory/entrytypecamera/html_code_entry_value_type_camera.html";
private final String _template_html_front_code_form_entry = "skin/plugins/directory/entrytypecamera/html_code_form_entry_type_camera.html";
private final String _template_html_front_code_entry_value = "skin/plugins/directory/entrytypecamera/html_code_entry_value_type_camera.html";
/**
* {@inheritDoc}
*/
@Override
public String getTemplateHtmlFormEntry( boolean isDisplayFront )
{
if ( isDisplayFront )
{
return _template_html_front_code_form_entry;
}
return _template_html_code_form_entry;
}
/**
* {@inheritDoc}
*/
@Override
public String getTemplateHtmlRecordFieldValue( boolean isDisplayFront )
{
if ( isDisplayFront )
{
return _template_html_front_code_entry_value;
}
return _template_html_code_entry_value;
}
/**
* {@inheritDoc}
*/
@Override
public String getEntryData( HttpServletRequest request, Locale locale )
{
String strTitle = request.getParameter( PARAMETER_TITLE );
String strHelpMessage = ( request.getParameter( PARAMETER_HELP_MESSAGE ) != null ) ? request.getParameter( PARAMETER_HELP_MESSAGE ).trim( ) : null;
String strComment = request.getParameter( PARAMETER_COMMENT );
String strMandatory = request.getParameter( PARAMETER_MANDATORY );
String strIndexed = request.getParameter( PARAMETER_INDEXED );
String strIndexedAsTitle = request.getParameter( PARAMETER_INDEXED_AS_TITLE );
String strIndexedAsSummary = request.getParameter( PARAMETER_INDEXED_AS_SUMMARY );
String strWidth = request.getParameter( PARAMETER_WIDTH );
String strHeight = request.getParameter( PARAMETER_HEIGHT );
int nWidth = DirectoryUtils.convertStringToInt( strWidth );
int nHeight = DirectoryUtils.convertStringToInt( strHeight );
String strShowInFormMainSearch = request.getParameter( PARAMETER_SHOWN_IN_ADVANCED_SEARCH );
String strShowInResultList = request.getParameter( PARAMETER_SHOWN_IN_RESULT_LIST );
String strShowInResultRecord = request.getParameter( PARAMETER_SHOWN_IN_RESULT_RECORD );
String strShowInHistory = request.getParameter( PARAMETER_SHOWN_IN_HISTORY );
String strShowInCompleteness = request.getParameter( PARAMETER_SHOWN_IN_COMPLETENESS );
String strError = this.checkEntryData( request, locale );
if ( StringUtils.isNotBlank( strError ) )
{
return strError;
}
this.setTitle( strTitle );
this.setHelpMessage( strHelpMessage );
this.setComment( strComment );
this.setFields( request );
this.setDisplayWidth( nWidth );
this.setDisplayHeight( nHeight );
this.setMandatory( strMandatory != null );
this.setIndexed( strIndexed != null );
this.setIndexedAsTitle( strIndexedAsTitle != null );
this.setIndexedAsSummary( strIndexedAsSummary != null );
this.setShownInAdvancedSearch( strShowInFormMainSearch != null );
this.setShownInResultList( strShowInResultList != null );
this.setShownInResultRecord( strShowInResultRecord != null );
this.setShownInHistory( strShowInHistory != null );
this.setShownInCompleteness( strShowInCompleteness != null );
// image can't be exported in csv
this.setShownInExport( false );
return null;
}
/**
* {@inheritDoc}
*/
@Override
public String getTemplateCreate( )
{
return _template_create;
}
/**
* {@inheritDoc}
*/
@Override
public String getTemplateModify( )
{
return _template_modify;
}
/**
* {@inheritDoc}
*/
@Override
public void getRecordFieldData( Record record, List<String> lstValue, boolean bTestDirectoryError, boolean bAddNewValue, List<RecordField> listRecordField,
Locale locale ) throws DirectoryErrorException
{
// add Empty recordField(Use for data import)
RecordField recordField = new RecordField( );
recordField.setEntry( this );
listRecordField.add( recordField );
}
/**
* {@inheritDoc}
*/
@Override
public void getImportRecordFieldData( Record record, String strImportValue, boolean bTestDirectoryError, List<RecordField> listRecordField, Locale locale )
throws DirectoryErrorException
{
// add Empty recordField
RecordField recordField = new RecordField( );
recordField.setEntry( this );
listRecordField.add( recordField );
}
/**
* {@inheritDoc}
*/
@Override
public void getRecordFieldData( Record record, HttpServletRequest request, boolean bTestDirectoryError, boolean bAddNewValue,
List<RecordField> listRecordField, Locale locale ) throws DirectoryErrorException
{
if ( request instanceof MultipartHttpServletRequest )
{
String sourceImage = request.getParameter( PREFIX_ENTRY_ID + this.getIdEntry( ) );
if ( ( sourceImage != null ) && StringUtils.isNotEmpty( sourceImage ) )
{
// Checks
if ( bTestDirectoryError )
{
this.checkRecordFieldData( sourceImage, locale );
}
File file = new File( );
Calendar c = Calendar.getInstance( );
String fileName = request.getParameter( PROPERTY_IMAGE_TITLE );
if ( fileName != null )
{
file.setTitle( fileName + "_" + c.getTime( ) );
}
else
{
file.setTitle( this.getTitle( ) + "_" + c.getTime( ) );
}
file.setExtension( this.getFields( ).get( 2 ).getImageType( ) != null ? this.getFields( ).get( 2 ).getImageType( ) : "png" );
PhysicalFile physicalFile = new PhysicalFile( );
String base64Image = sourceImage.split( "," ) [1];
byte [ ] imageBytes = javax.xml.bind.DatatypeConverter.parseBase64Binary( base64Image );
physicalFile.setValue( imageBytes );
file.setPhysicalFile( physicalFile );
file.setTitle( this.getFields( ).get( 2 ).getImageType( ) != null ? file.getTitle( ) + "." + this.getFields( ).get( 2 ).getImageType( ) : file
.getTitle( ) + "" );
file.setMimeType( FileSystemUtil.getMIMEType( file.getTitle( ) ) );
ByteArrayInputStream bis = new ByteArrayInputStream( imageBytes );
ByteArrayOutputStream tmp = new ByteArrayOutputStream( );
try
{
BufferedImage image = ImageIO.read( bis );
ImageIO.write( image, this.getFields( ).get( 2 ).getImageType( ) != null ? this.getFields( ).get( 2 ).getImageType( ) : "png", tmp );
bis.close( );
tmp.close( );
file.setSize( tmp.size( ) );
}
catch( IOException e )
{
AppLogService.error( e );
throw new DirectoryErrorException( this.getTitle( ) );
}
// Add the image to the record fields list
RecordField recordField = new RecordField( );
recordField.setEntry( this );
recordField.setValue( FIELD_IMAGE + DirectoryUtils.CONSTANT_UNDERSCORE + 1 );
recordField.setFile( file );
recordField.setFileExtension( file.getExtension( ) );
listRecordField.add( recordField );
}
if ( bTestDirectoryError && this.isMandatory( ) && ( ( sourceImage == null ) || StringUtils.isEmpty( sourceImage ) ) )
{
RecordField recordField = new RecordField( );
recordField.setEntry( this );
recordField.setValue( FIELD_IMAGE );
listRecordField.add( recordField );
throw new DirectoryErrorException( this.getTitle( ) );
}
}
else
if ( bTestDirectoryError )
{
throw new DirectoryErrorException( this.getTitle( ) );
}
}
/**
* {@inheritDoc}
*/
@Override
public Paginator getPaginator( int nItemPerPage, String strBaseUrl, String strPageIndexParameterName, String strPageIndex )
{
return new Paginator( this.getFields( ).get( 0 ).getRegularExpressionList( ), nItemPerPage, strBaseUrl, strPageIndexParameterName, strPageIndex );
}
/**
* {@inheritDoc}
*/
@Override
public ReferenceList getReferenceListRegularExpression( IEntry entry, Plugin plugin )
{
ReferenceList refListRegularExpression = null;
if ( RegularExpressionService.getInstance( ).isAvailable( ) )
{
refListRegularExpression = new ReferenceList( );
List<RegularExpression> listRegularExpression = RegularExpressionService.getInstance( ).getAllRegularExpression( );
for ( RegularExpression regularExpression : listRegularExpression )
{
if ( !entry.getFields( ).get( 0 ).getRegularExpressionList( ).contains( regularExpression ) )
{
refListRegularExpression.addItem( regularExpression.getIdExpression( ), regularExpression.getTitle( ) );
}
}
}
return refListRegularExpression;
}
/**
* {@inheritDoc}
*/
@Override
public LocalizedPaginator getPaginator( int nItemPerPage, String strBaseUrl, String strPageIndexParameterName, String strPageIndex, Locale locale )
{
return new LocalizedPaginator( this.getFields( ).get( 0 ).getRegularExpressionList( ), nItemPerPage, strBaseUrl, strPageIndexParameterName,
strPageIndex, locale );
}
// PROTECTED METHODS
/**
* {@inheritDoc}
*/
@Override
protected String checkEntryData( HttpServletRequest request, Locale locale )
{
String strError = super.checkEntryData( request, locale );
if ( StringUtils.isBlank( strError ) )
{
String strFieldError = StringUtils.EMPTY;
String strTitle = request.getParameter( PARAMETER_TITLE );
String strWidth = request.getParameter( PARAMETER_WIDTH );
String strHeight = request.getParameter( PARAMETER_HEIGHT );
int nWidth = DirectoryUtils.convertStringToInt( strWidth );
int nHeight = DirectoryUtils.convertStringToInt( strHeight );
if ( StringUtils.isBlank( strTitle ) )
{
strFieldError = FIELD_TITLE;
}
if ( !strFieldError.equals( DirectoryUtils.EMPTY_STRING ) )
{
Object [ ] tabRequiredFields = {
I18nService.getLocalizedString( strFieldError, locale )
};
return AdminMessageService.getMessageUrl( request, MESSAGE_MANDATORY_FIELD, tabRequiredFields, AdminMessage.TYPE_STOP );
}
if ( ( strWidth != null ) && ( !strWidth.trim( ).equals( DirectoryUtils.EMPTY_STRING ) ) && ( nWidth == DirectoryUtils.CONSTANT_ID_NULL ) )
{
strFieldError = FIELD_WIDTH;
}
else
if ( ( strHeight != null ) && ( !strHeight.trim( ).equals( DirectoryUtils.EMPTY_STRING ) ) && ( nHeight == DirectoryUtils.CONSTANT_ID_NULL ) )
{
strFieldError = FIELD_HEIGHT;
}
if ( !strFieldError.equals( DirectoryUtils.EMPTY_STRING ) )
{
Object [ ] tabRequiredFields = {
I18nService.getLocalizedString( strFieldError, locale )
};
return AdminMessageService.getMessageUrl( request, MESSAGE_NUMERIC_FIELD, tabRequiredFields, AdminMessage.TYPE_STOP );
}
if ( StringUtils.isNotBlank( strFieldError ) )
{
Object [ ] tabRequiredFields = {
I18nService.getLocalizedString( strFieldError, locale )
};
return AdminMessageService.getMessageUrl( request, MESSAGE_MANDATORY_FIELD, tabRequiredFields, AdminMessage.TYPE_STOP );
}
}
return strError;
}
/**
* {@inheritDoc}
*/
@Override
protected void setFields( HttpServletRequest request, List<Field> listFields )
{
listFields.add( buildFieldFullSize( request ) );
}
private void checkRecordFieldData( String imageSource, Locale locale ) throws DirectoryErrorException
{
BufferedImage image = null;
if ( ( imageSource != null ) && ( imageSource.split( "," ).length > 1 ) )
{
String base64Image = imageSource.split( "," ) [1];
byte [ ] imageBytes = javax.xml.bind.DatatypeConverter.parseBase64Binary( base64Image );
ByteArrayInputStream bis = new ByteArrayInputStream( imageBytes );
try
{
image = ImageIO.read( bis );
bis.close( );
}
catch( IOException e )
{
String strErrorMessage = I18nService.getLocalizedString( MESSAGE_ERROR_NOT_AN_IMAGE, locale );
throw new DirectoryErrorException( this.getTitle( ), strErrorMessage );
}
}
if ( ( image == null ) && StringUtils.isNotBlank( imageSource ) )
{
String strErrorMessage = I18nService.getLocalizedString( MESSAGE_ERROR_NOT_AN_IMAGE, locale );
throw new DirectoryErrorException( this.getTitle( ), strErrorMessage );
}
}
// PRIVATE METHODS
/**
* Build the field full size
*
* @param request
* the HTTP request
* @return the field
*/
private Field buildFieldFullSize( HttpServletRequest request )
{
Field fieldFullImage = DirectoryUtils.findFieldByValueInTheList( FIELD_IMAGE, getFields( ) );
if ( fieldFullImage == null )
{
fieldFullImage = new Field( );
}
if ( request.getParameter( PARAMETER_IMAGE_SHOWN_IN_RESULT_LIST ) != null )
{
fieldFullImage.setShownInResultList( true );
}
else
{
fieldFullImage.setShownInResultList( false );
}
if ( request.getParameter( PARAMETER_IMAGE_SHOWN_IN_RESULT_RECORD ) != null )
{
fieldFullImage.setShownInResultRecord( true );
}
else
{
fieldFullImage.setShownInResultRecord( false );
}
if ( request.getParameter( PARAMETER_IMAGE_TYPE ) != null )
{
fieldFullImage.setImageType( request.getParameter( PARAMETER_IMAGE_TYPE ) );
}
fieldFullImage.setEntry( this );
fieldFullImage.setValue( FIELD_IMAGE );
return fieldFullImage;
}
@Override
protected void checkRecordFieldData( FileItem fileItem, Locale locale ) throws DirectoryErrorException
{
}
}
| 20,103 | 0.639867 | 0.637281 | 509 | 38.512772 | 38.335793 | 159 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.510805 | false | false |
13
|
f07bba9ecd498c5b71d62b251bfcb933b1948668
| 20,736,102,142,596 |
772653869677ac5d777573c41760bdf7664b1055
|
/app/src/main/java/com/zwu/citylink/main/side/SideActivity.java
|
086388de97af631554da96bdd6dabacf42b59df4
|
[] |
no_license
|
lin229088559/CityLink
|
https://github.com/lin229088559/CityLink
|
b3b149b546074c03fa651433fcb440f52551f404
|
9cc98b8f252177ee3ff300ca7525a4579885680a
|
refs/heads/master
| 2020-06-27T13:38:06.050000 | 2019-08-04T08:04:27 | 2019-08-04T08:04:27 | 199,967,390 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zwu.citylink.main.side;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatButton;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.easy.mvp.base.view.BaseAppCompatActivity;
import com.zwu.citylink.R;
import com.zwu.citylink.bean.Side;
import com.zwu.citylink.main.login.mvp.v.LoginActivity;
import com.zwu.citylink.main.side.adapter.RecyclerviewAdapter;
import com.zwu.citylink.util.Bar;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
/**
* @Title: SideActivity
* @Package com.zwu.citylink.main.side
* @Description: 侧边栏的界面实现,没有啥东西,所以没有按MVP来写
* @author lin22
* @date 2019/8/2
* @version V1.0
*/
public class SideActivity extends BaseAppCompatActivity {
@BindView(R.id.user_name)
TextView textView;
@BindView(R.id.user_photo)
ImageView imageView;
@BindView(R.id.side_item)
RecyclerView recyclerView;
@BindView(R.id.btn_logout)
AppCompatButton appCompatButton;
SharedPreferences sharedPreferences;
@Override
protected int setLayout() {
return R.layout.activity_side;
}
@Override
protected void destroyPre() {
}
@Override
protected boolean getIntentData() {
return false;
}
@Override
protected void initDate() {
}
@Override
protected void initView() {
Bar.setBar(this);
LinearLayoutManager layoutManager = new LinearLayoutManager(SideActivity.this);
recyclerView.setLayoutManager(layoutManager);
List<Side> list = new ArrayList<>();
int[] photo = {R.drawable.my1, R.drawable.download1, R.drawable.update1, R.drawable.push1, R.drawable.about1};
String[] title = {"个人资料", "我的下载", "版本更新", "修改密码", "关于我们"};
for (int i = 0; i < title.length; i++) {
list.add(new Side(photo[i], title[i]));
}
RecyclerviewAdapter recyclerviewAdapter = new RecyclerviewAdapter(R.layout.side_child, list);
recyclerView.setAdapter(recyclerviewAdapter);
recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
}
@Override
protected void initCustomFunction() {
}
@Override
protected void bindEvent() {
appCompatButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sharedPreferences = getSharedPreferences("data", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.remove("username");
editor.remove("password");
editor.commit();
Intent intent = new Intent(SideActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
});
}
}
|
UTF-8
|
Java
| 3,227 |
java
|
SideActivity.java
|
Java
|
[
{
"context": "@Description: 侧边栏的界面实现,没有啥东西,所以没有按MVP来写\n * @author lin22\n * @date 2019/8/2\n * @version V1.0\n */\npublic cla",
"end": 929,
"score": 0.9996269345283508,
"start": 924,
"tag": "USERNAME",
"value": "lin22"
},
{
"context": "references.edit();\n editor.remove(\"username\");\n editor.remove(\"password\");\n ",
"end": 2878,
"score": 0.9916658401489258,
"start": 2870,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
package com.zwu.citylink.main.side;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatButton;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.easy.mvp.base.view.BaseAppCompatActivity;
import com.zwu.citylink.R;
import com.zwu.citylink.bean.Side;
import com.zwu.citylink.main.login.mvp.v.LoginActivity;
import com.zwu.citylink.main.side.adapter.RecyclerviewAdapter;
import com.zwu.citylink.util.Bar;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
/**
* @Title: SideActivity
* @Package com.zwu.citylink.main.side
* @Description: 侧边栏的界面实现,没有啥东西,所以没有按MVP来写
* @author lin22
* @date 2019/8/2
* @version V1.0
*/
public class SideActivity extends BaseAppCompatActivity {
@BindView(R.id.user_name)
TextView textView;
@BindView(R.id.user_photo)
ImageView imageView;
@BindView(R.id.side_item)
RecyclerView recyclerView;
@BindView(R.id.btn_logout)
AppCompatButton appCompatButton;
SharedPreferences sharedPreferences;
@Override
protected int setLayout() {
return R.layout.activity_side;
}
@Override
protected void destroyPre() {
}
@Override
protected boolean getIntentData() {
return false;
}
@Override
protected void initDate() {
}
@Override
protected void initView() {
Bar.setBar(this);
LinearLayoutManager layoutManager = new LinearLayoutManager(SideActivity.this);
recyclerView.setLayoutManager(layoutManager);
List<Side> list = new ArrayList<>();
int[] photo = {R.drawable.my1, R.drawable.download1, R.drawable.update1, R.drawable.push1, R.drawable.about1};
String[] title = {"个人资料", "我的下载", "版本更新", "修改密码", "关于我们"};
for (int i = 0; i < title.length; i++) {
list.add(new Side(photo[i], title[i]));
}
RecyclerviewAdapter recyclerviewAdapter = new RecyclerviewAdapter(R.layout.side_child, list);
recyclerView.setAdapter(recyclerviewAdapter);
recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
}
@Override
protected void initCustomFunction() {
}
@Override
protected void bindEvent() {
appCompatButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sharedPreferences = getSharedPreferences("data", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.remove("username");
editor.remove("password");
editor.commit();
Intent intent = new Intent(SideActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
});
}
}
| 3,227 | 0.680242 | 0.675151 | 118 | 25.635593 | 25.610401 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.516949 | false | false |
13
|
f105a423f600a53a2de39590acf23be243788545
| 32,332,513,859,300 |
373aaf1ef7fdc5c93755d9df36545c7a787256f6
|
/app/build/generated/source/kapt/debug/com/example/movies_algorithms_fawzy/DI/MovieDetails/MovieDetailsModule_ProvidesMovieDetailsAPIFactory.java
|
33bd816c33daf6d499ab637a7dca0cf616e248af
|
[] |
no_license
|
MFM95/Movies-App
|
https://github.com/MFM95/Movies-App
|
ca5a45f96d52553fbb47b0e44336acc0dd00944c
|
9306cc32d7d6c29d98adbf91ba809e5d7a33a3ab
|
refs/heads/master
| 2020-04-17T12:32:44.509000 | 2019-01-19T19:53:53 | 2019-01-19T19:53:53 | 166,582,966 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// Generated by Dagger (https://google.github.io/dagger).
package com.example.movies_algorithms_fawzy.DI.MovieDetails;
import com.example.movies_algorithms_fawzy.Features.MovieDetailsFeatures.Data.MovieDetailsAPI;
import dagger.internal.Factory;
import dagger.internal.Preconditions;
import javax.inject.Provider;
import retrofit2.Retrofit;
public final class MovieDetailsModule_ProvidesMovieDetailsAPIFactory
implements Factory<MovieDetailsAPI> {
private final MovieDetailsModule module;
private final Provider<Retrofit> retrofitProvider;
public MovieDetailsModule_ProvidesMovieDetailsAPIFactory(
MovieDetailsModule module, Provider<Retrofit> retrofitProvider) {
this.module = module;
this.retrofitProvider = retrofitProvider;
}
@Override
public MovieDetailsAPI get() {
return provideInstance(module, retrofitProvider);
}
public static MovieDetailsAPI provideInstance(
MovieDetailsModule module, Provider<Retrofit> retrofitProvider) {
return proxyProvidesMovieDetailsAPI(module, retrofitProvider.get());
}
public static MovieDetailsModule_ProvidesMovieDetailsAPIFactory create(
MovieDetailsModule module, Provider<Retrofit> retrofitProvider) {
return new MovieDetailsModule_ProvidesMovieDetailsAPIFactory(module, retrofitProvider);
}
public static MovieDetailsAPI proxyProvidesMovieDetailsAPI(
MovieDetailsModule instance, Retrofit retrofit) {
return Preconditions.checkNotNull(
instance.providesMovieDetailsAPI(retrofit),
"Cannot return null from a non-@Nullable @Provides method");
}
}
|
UTF-8
|
Java
| 1,591 |
java
|
MovieDetailsModule_ProvidesMovieDetailsAPIFactory.java
|
Java
|
[] | null |
[] |
// Generated by Dagger (https://google.github.io/dagger).
package com.example.movies_algorithms_fawzy.DI.MovieDetails;
import com.example.movies_algorithms_fawzy.Features.MovieDetailsFeatures.Data.MovieDetailsAPI;
import dagger.internal.Factory;
import dagger.internal.Preconditions;
import javax.inject.Provider;
import retrofit2.Retrofit;
public final class MovieDetailsModule_ProvidesMovieDetailsAPIFactory
implements Factory<MovieDetailsAPI> {
private final MovieDetailsModule module;
private final Provider<Retrofit> retrofitProvider;
public MovieDetailsModule_ProvidesMovieDetailsAPIFactory(
MovieDetailsModule module, Provider<Retrofit> retrofitProvider) {
this.module = module;
this.retrofitProvider = retrofitProvider;
}
@Override
public MovieDetailsAPI get() {
return provideInstance(module, retrofitProvider);
}
public static MovieDetailsAPI provideInstance(
MovieDetailsModule module, Provider<Retrofit> retrofitProvider) {
return proxyProvidesMovieDetailsAPI(module, retrofitProvider.get());
}
public static MovieDetailsModule_ProvidesMovieDetailsAPIFactory create(
MovieDetailsModule module, Provider<Retrofit> retrofitProvider) {
return new MovieDetailsModule_ProvidesMovieDetailsAPIFactory(module, retrofitProvider);
}
public static MovieDetailsAPI proxyProvidesMovieDetailsAPI(
MovieDetailsModule instance, Retrofit retrofit) {
return Preconditions.checkNotNull(
instance.providesMovieDetailsAPI(retrofit),
"Cannot return null from a non-@Nullable @Provides method");
}
}
| 1,591 | 0.79824 | 0.797612 | 43 | 36 | 29.072483 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.511628 | false | false |
13
|
a296c1a1fb833c2d3e409fecb19e5198628cd7ff
| 32,332,513,857,802 |
283aaaff60bc253cc6a3898a3c9d6b7e413f30e3
|
/angelspeech-services/WEB-INF/src/net/angelspeech/util/MessageResourcesManager.java
|
a4f85934fc9f6dbd1bb50ddf6bc18628d9eed345
|
[] |
no_license
|
abendouma/doctor-appointment
|
https://github.com/abendouma/doctor-appointment
|
567c14d4addb7cf3cea4cf2a32e712106d956a65
|
90e8546058bf47fd03292bb3f9c658a813c82638
|
refs/heads/master
| 2020-04-23T04:08:21.786000 | 2011-04-18T17:06:42 | 2011-04-18T17:06:42 | 37,294,076 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.angelspeech.util;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
public class MessageResourcesManager {
private static final String FILE_NAME = "/WEB-INF/classes/MessageResources.properties";
private Properties properties;
public MessageResourcesManager(String basedPath) {
this.properties = new Properties();
try {
this.properties.load(new FileInputStream(basedPath + FILE_NAME));
} catch (IOException e) {
System.out.println(e);
}
}
public String getValue(String key) {
return this.properties.getProperty(key);
}
// public static String CONTEXT_PATH="";
//
// private static final String delimiter = "\\+";
// static Properties properties = null;
// public static void initDefault() {
// try {
// File f = new File("MessageResources.properties");
// if(f.exists())init(f);
// } catch (Exception e) {
// }
// }
//
// public Properties getProperties() {
// return properties;
// }
//
// public static void init(File file) {
// loadConfig(file);
// }
//
// private static void loadConfig(File file) {
// /*
// * Load all the parameters from the resource file
// */
// Properties tmpProperties = new Properties();
//
// try {
// tmpProperties.load(new FileInputStream(file));
// tmpProperties.setProperty("CONTEXT_PATH", CONTEXT_PATH);
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// /*
// * Transform the properties for "+" paths
// */
//
// properties = new Properties();
//
// for (Object key : tmpProperties.keySet()) {
// String value = tmpProperties.getProperty(key.toString());
// if (value != null && value.contains("+")) {
// StringBuffer sb = new StringBuffer();
// String[] keys = value.split(delimiter);
// for (String k : keys) {
// k = k.trim();
// if (tmpProperties.containsKey(k)) {
// sb.append(tmpProperties.getProperty(k));
// } else {
// sb.append(k);
// }
// }
// value = sb.toString();
// }
// properties.put(key, value);
// }
// }
//
// public static String getValue(String key) {
// return properties.getProperty(key);
// }
}
|
UTF-8
|
Java
| 2,227 |
java
|
MessageResourcesManager.java
|
Java
|
[] | null |
[] |
package net.angelspeech.util;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
public class MessageResourcesManager {
private static final String FILE_NAME = "/WEB-INF/classes/MessageResources.properties";
private Properties properties;
public MessageResourcesManager(String basedPath) {
this.properties = new Properties();
try {
this.properties.load(new FileInputStream(basedPath + FILE_NAME));
} catch (IOException e) {
System.out.println(e);
}
}
public String getValue(String key) {
return this.properties.getProperty(key);
}
// public static String CONTEXT_PATH="";
//
// private static final String delimiter = "\\+";
// static Properties properties = null;
// public static void initDefault() {
// try {
// File f = new File("MessageResources.properties");
// if(f.exists())init(f);
// } catch (Exception e) {
// }
// }
//
// public Properties getProperties() {
// return properties;
// }
//
// public static void init(File file) {
// loadConfig(file);
// }
//
// private static void loadConfig(File file) {
// /*
// * Load all the parameters from the resource file
// */
// Properties tmpProperties = new Properties();
//
// try {
// tmpProperties.load(new FileInputStream(file));
// tmpProperties.setProperty("CONTEXT_PATH", CONTEXT_PATH);
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// /*
// * Transform the properties for "+" paths
// */
//
// properties = new Properties();
//
// for (Object key : tmpProperties.keySet()) {
// String value = tmpProperties.getProperty(key.toString());
// if (value != null && value.contains("+")) {
// StringBuffer sb = new StringBuffer();
// String[] keys = value.split(delimiter);
// for (String k : keys) {
// k = k.trim();
// if (tmpProperties.containsKey(k)) {
// sb.append(tmpProperties.getProperty(k));
// } else {
// sb.append(k);
// }
// }
// value = sb.toString();
// }
// properties.put(key, value);
// }
// }
//
// public static String getValue(String key) {
// return properties.getProperty(key);
// }
}
| 2,227 | 0.614279 | 0.614279 | 89 | 23.022472 | 20.423042 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.157303 | false | false |
13
|
9c04e862073803848b7af2ffd5e645c2e1f2e751
| 32,332,513,862,540 |
4ef3f9b3b9e2dc3dde72cf1284004ea26b724e47
|
/src/estruturas/ListaLigada.java
|
cfd8e3bd279533baa67c3c76da7785402f278be5
|
[] |
no_license
|
emanoelbarreiros/algoritmos2019
|
https://github.com/emanoelbarreiros/algoritmos2019
|
ee2842e4b3a102b7d8540f8f9d48b930efedc8e4
|
851b1331cdd7986def14f45a518cb9a68d4d65bf
|
refs/heads/master
| 2020-05-01T13:07:02.054000 | 2019-05-20T12:48:35 | 2019-05-20T12:48:35 | 177,482,048 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package estruturas;
public class ListaLigada {
private Elemento inicio;
public void inserirInicio(Pessoa pessoa) {
Elemento elemento = new Elemento(pessoa);
elemento.setProximo(inicio);
inicio = elemento;
}
public void inserirFim(Pessoa pessoa) {
if (inicio == null) {
Elemento elemento = new Elemento(pessoa);
inicio = elemento;
} else {
Elemento item = inicio;
while (item.getProximo() != null) {
item = item.getProximo();
}
Elemento elemento = new Elemento(pessoa);
item.setProximo(elemento);
}
}
public Pessoa remover(String chave) {
return null;
}
}
|
UTF-8
|
Java
| 611 |
java
|
ListaLigada.java
|
Java
|
[] | null |
[] |
package estruturas;
public class ListaLigada {
private Elemento inicio;
public void inserirInicio(Pessoa pessoa) {
Elemento elemento = new Elemento(pessoa);
elemento.setProximo(inicio);
inicio = elemento;
}
public void inserirFim(Pessoa pessoa) {
if (inicio == null) {
Elemento elemento = new Elemento(pessoa);
inicio = elemento;
} else {
Elemento item = inicio;
while (item.getProximo() != null) {
item = item.getProximo();
}
Elemento elemento = new Elemento(pessoa);
item.setProximo(elemento);
}
}
public Pessoa remover(String chave) {
return null;
}
}
| 611 | 0.679214 | 0.679214 | 31 | 18.709677 | 15.897238 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false |
13
|
58880322933b95d390f6558f04b8b1c7a4d4015f
| 26,826,365,762,006 |
bfb64a3e9c04a44ee8d5781307cd18845bc19bad
|
/src/main/java/com/test/spring/aop/monitor/ServiceMonitor.java
|
ba7a8ad281f113f4f7419ae390881779a8cb99ef
|
[] |
no_license
|
Crayon2f/spring-aop
|
https://github.com/Crayon2f/spring-aop
|
6b4a5dfdc36803d3f89fbd9793843ff2d142ced7
|
ef54538e4bad101849f4869b87aa3bcfb1556d36
|
refs/heads/master
| 2020-03-15T10:52:10.614000 | 2017-03-09T10:17:01 | 2017-03-09T10:17:01 | 132,108,853 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.test.spring.aop.monitor;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;
/**
* Created by miaorf on 2016/7/16.
*/
@Aspect
@Component
public class ServiceMonitor {
private static Logger logger = LoggerFactory.getLogger(ServiceMonitor.class);
/**
* define point
*/
@Pointcut("execution(* com.test.spring.aop..HelloService.*(..))")
public void performance(){}
// @Before("performance()")
// public void startService(){
// System.out.println("-----------service start-------");
// }
// @After("performance()")
// public void endService(){
// System.out.println("-----------service end neither success or failed -------");
// }
//
// @AfterReturning("performance()")
// public void logServiceAccess(JoinPoint joinPoint) {
// System.out.println("service completed:"+joinPoint);
// }
/**
* 必须要返回,不然后面收不到
* @param point
* @return
*/
@Around("performance()")
public Object watchPerformance(ProceedingJoinPoint point){
System.out.println("The service start:");
StopWatch stopWatch = new StopWatch("performance");
stopWatch.start(point.getSignature().toString());
try {
return point.proceed();
} catch (Throwable throwable) {
logger.error("The service not work!",throwable);
throwable.printStackTrace();
}finally {
stopWatch.stop();
stopWatch.start("b");
for (int i = 0; i < 12345; i++) {
}
stopWatch.stop();
StopWatch.TaskInfo[] taskInfo = stopWatch.getTaskInfo();
for (StopWatch.TaskInfo info : taskInfo) {
System.out.println(info.getTaskName());
System.out.println(info.getTimeMillis());
}
logger.info("The {} run time:{}",point.getSignature().toString(),stopWatch.prettyPrint());
}
return null;
}
}
|
UTF-8
|
Java
| 2,176 |
java
|
ServiceMonitor.java
|
Java
|
[
{
"context": "springframework.util.StopWatch;\n\n/**\n * Created by miaorf on 2016/7/16.\n */\n@Aspect\n@Component\npublic class",
"end": 295,
"score": 0.9995865225791931,
"start": 289,
"tag": "USERNAME",
"value": "miaorf"
}
] | null |
[] |
package com.test.spring.aop.monitor;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;
/**
* Created by miaorf on 2016/7/16.
*/
@Aspect
@Component
public class ServiceMonitor {
private static Logger logger = LoggerFactory.getLogger(ServiceMonitor.class);
/**
* define point
*/
@Pointcut("execution(* com.test.spring.aop..HelloService.*(..))")
public void performance(){}
// @Before("performance()")
// public void startService(){
// System.out.println("-----------service start-------");
// }
// @After("performance()")
// public void endService(){
// System.out.println("-----------service end neither success or failed -------");
// }
//
// @AfterReturning("performance()")
// public void logServiceAccess(JoinPoint joinPoint) {
// System.out.println("service completed:"+joinPoint);
// }
/**
* 必须要返回,不然后面收不到
* @param point
* @return
*/
@Around("performance()")
public Object watchPerformance(ProceedingJoinPoint point){
System.out.println("The service start:");
StopWatch stopWatch = new StopWatch("performance");
stopWatch.start(point.getSignature().toString());
try {
return point.proceed();
} catch (Throwable throwable) {
logger.error("The service not work!",throwable);
throwable.printStackTrace();
}finally {
stopWatch.stop();
stopWatch.start("b");
for (int i = 0; i < 12345; i++) {
}
stopWatch.stop();
StopWatch.TaskInfo[] taskInfo = stopWatch.getTaskInfo();
for (StopWatch.TaskInfo info : taskInfo) {
System.out.println(info.getTaskName());
System.out.println(info.getTimeMillis());
}
logger.info("The {} run time:{}",point.getSignature().toString(),stopWatch.prettyPrint());
}
return null;
}
}
| 2,176 | 0.59814 | 0.591163 | 73 | 28.452055 | 24.411451 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.410959 | false | false |
13
|
3430be92f70b4f2c314bd8ba2161b441d34f3692
| 27,513,560,512,697 |
503f99882ed28c7328b1c42319cdfeaf1bc3ff52
|
/mvnforum/contrib/phpbb2mvnforum-jaxb/src/com/mvnforum/jaxb/db/impl/GlobalWatchTypeImpl.java
|
312ae63fe1e53f6107bdb9286f1108ffdf93dbb3
|
[] |
no_license
|
khanhnguyenj/mvnForumJ
|
https://github.com/khanhnguyenj/mvnForumJ
|
3c6872ffff0285874a242aa2707b6c4c087d40ec
|
6e31879a6cb5d18ad5267a245cb2fd96b101be5a
|
refs/heads/main
| 2023-07-09T00:40:04.488000 | 2021-08-18T00:46:02 | 2021-08-18T00:46:02 | 388,469,371 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v1.0.5-b16-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2005.12.29 at 03:19:11 PM GMT+07:00
//
package com.mvnforum.jaxb.db.impl;
public class GlobalWatchTypeImpl implements com.mvnforum.jaxb.db.GlobalWatchType, com.sun.xml.bind.JAXBObject, com.mvnforum.jaxb.db.impl.runtime.UnmarshallableObject, com.mvnforum.jaxb.db.impl.runtime.XMLSerializable, com.mvnforum.jaxb.db.impl.runtime.ValidatableObject
{
protected java.lang.String _WatchCreationDate;
protected java.lang.String _WatchLastSentDate;
protected java.lang.String _WatchEndDate;
protected boolean has_WatchType;
protected int _WatchType;
protected boolean has_WatchOption;
protected int _WatchOption;
protected boolean has_WatchStatus;
protected int _WatchStatus;
public final static java.lang.Class version = (com.mvnforum.jaxb.db.impl.JAXBVersion.class);
private static com.sun.msv.grammar.Grammar schemaFragment;
private final static java.lang.Class PRIMARY_INTERFACE_CLASS() {
return (com.mvnforum.jaxb.db.GlobalWatchType.class);
}
public java.lang.String getWatchCreationDate() {
return _WatchCreationDate;
}
public void setWatchCreationDate(java.lang.String value) {
_WatchCreationDate = value;
}
public java.lang.String getWatchLastSentDate() {
return _WatchLastSentDate;
}
public void setWatchLastSentDate(java.lang.String value) {
_WatchLastSentDate = value;
}
public java.lang.String getWatchEndDate() {
return _WatchEndDate;
}
public void setWatchEndDate(java.lang.String value) {
_WatchEndDate = value;
}
public int getWatchType() {
return _WatchType;
}
public void setWatchType(int value) {
_WatchType = value;
has_WatchType = true;
}
public int getWatchOption() {
return _WatchOption;
}
public void setWatchOption(int value) {
_WatchOption = value;
has_WatchOption = true;
}
public int getWatchStatus() {
return _WatchStatus;
}
public void setWatchStatus(int value) {
_WatchStatus = value;
has_WatchStatus = true;
}
public com.mvnforum.jaxb.db.impl.runtime.UnmarshallingEventHandler createUnmarshaller(com.mvnforum.jaxb.db.impl.runtime.UnmarshallingContext context) {
return new com.mvnforum.jaxb.db.impl.GlobalWatchTypeImpl.Unmarshaller(context);
}
public void serializeBody(com.mvnforum.jaxb.db.impl.runtime.XMLSerializer context)
throws org.xml.sax.SAXException
{
if (has_WatchType) {
context.startElement("", "WatchType");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(javax.xml.bind.DatatypeConverter.printInt(((int) _WatchType)), "WatchType");
} catch (java.lang.Exception e) {
com.mvnforum.jaxb.db.impl.runtime.Util.handlePrintConversionException(this, e, context);
}
context.endElement();
}
if (has_WatchOption) {
context.startElement("", "WatchOption");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(javax.xml.bind.DatatypeConverter.printInt(((int) _WatchOption)), "WatchOption");
} catch (java.lang.Exception e) {
com.mvnforum.jaxb.db.impl.runtime.Util.handlePrintConversionException(this, e, context);
}
context.endElement();
}
if (has_WatchStatus) {
context.startElement("", "WatchStatus");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(javax.xml.bind.DatatypeConverter.printInt(((int) _WatchStatus)), "WatchStatus");
} catch (java.lang.Exception e) {
com.mvnforum.jaxb.db.impl.runtime.Util.handlePrintConversionException(this, e, context);
}
context.endElement();
}
if (_WatchCreationDate!= null) {
context.startElement("", "WatchCreationDate");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(((java.lang.String) _WatchCreationDate), "WatchCreationDate");
} catch (java.lang.Exception e) {
com.mvnforum.jaxb.db.impl.runtime.Util.handlePrintConversionException(this, e, context);
}
context.endElement();
}
if (_WatchLastSentDate!= null) {
context.startElement("", "WatchLastSentDate");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(((java.lang.String) _WatchLastSentDate), "WatchLastSentDate");
} catch (java.lang.Exception e) {
com.mvnforum.jaxb.db.impl.runtime.Util.handlePrintConversionException(this, e, context);
}
context.endElement();
}
if (_WatchEndDate!= null) {
context.startElement("", "WatchEndDate");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(((java.lang.String) _WatchEndDate), "WatchEndDate");
} catch (java.lang.Exception e) {
com.mvnforum.jaxb.db.impl.runtime.Util.handlePrintConversionException(this, e, context);
}
context.endElement();
}
}
public void serializeAttributes(com.mvnforum.jaxb.db.impl.runtime.XMLSerializer context)
throws org.xml.sax.SAXException
{
}
public void serializeURIs(com.mvnforum.jaxb.db.impl.runtime.XMLSerializer context)
throws org.xml.sax.SAXException
{
}
public java.lang.Class getPrimaryInterface() {
return (com.mvnforum.jaxb.db.GlobalWatchType.class);
}
public com.sun.msv.verifier.DocumentDeclaration createRawValidator() {
if (schemaFragment == null) {
schemaFragment = com.sun.xml.bind.validator.SchemaDeserializer.deserialize((
"\u00ac\u00ed\u0000\u0005sr\u0000\u001fcom.sun.msv.grammar.SequenceExp\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xr\u0000\u001dcom.su"
+"n.msv.grammar.BinaryExp\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0002L\u0000\u0004exp1t\u0000 Lcom/sun/msv/gra"
+"mmar/Expression;L\u0000\u0004exp2q\u0000~\u0000\u0002xr\u0000\u001ecom.sun.msv.grammar.Expressi"
+"on\u00f8\u0018\u0082\u00e8N5~O\u0002\u0000\u0002L\u0000\u0013epsilonReducibilityt\u0000\u0013Ljava/lang/Boolean;L\u0000\u000b"
+"expandedExpq\u0000~\u0000\u0002xpppsq\u0000~\u0000\u0000ppsq\u0000~\u0000\u0000ppsq\u0000~\u0000\u0000ppsq\u0000~\u0000\u0000ppsr\u0000\u001dcom."
+"sun.msv.grammar.ChoiceExp\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000\u0001ppsr\u0000\'com.sun.msv."
+"grammar.trex.ElementPattern\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0001L\u0000\tnameClasst\u0000\u001fLcom/su"
+"n/msv/grammar/NameClass;xr\u0000\u001ecom.sun.msv.grammar.ElementExp\u0000\u0000"
+"\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0002Z\u0000\u001aignoreUndeclaredAttributesL\u0000\fcontentModelq\u0000~\u0000\u0002xq"
+"\u0000~\u0000\u0003sr\u0000\u0011java.lang.Boolean\u00cd r\u0080\u00d5\u009c\u00fa\u00ee\u0002\u0000\u0001Z\u0000\u0005valuexp\u0000p\u0000sq\u0000~\u0000\u0000ppsr\u0000"
+"\u001bcom.sun.msv.grammar.DataExp\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0003L\u0000\u0002dtt\u0000\u001fLorg/relaxng/"
+"datatype/Datatype;L\u0000\u0006exceptq\u0000~\u0000\u0002L\u0000\u0004namet\u0000\u001dLcom/sun/msv/util/"
+"StringPair;xq\u0000~\u0000\u0003ppsr\u0000 com.sun.msv.datatype.xsd.IntType\u0000\u0000\u0000\u0000\u0000"
+"\u0000\u0000\u0001\u0002\u0000\u0000xr\u0000+com.sun.msv.datatype.xsd.IntegerDerivedType\u0099\u00f1]\u0090&6k"
+"\u00be\u0002\u0000\u0001L\u0000\nbaseFacetst\u0000)Lcom/sun/msv/datatype/xsd/XSDatatypeImpl"
+";xr\u0000*com.sun.msv.datatype.xsd.BuiltinAtomicType\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xr"
+"\u0000%com.sun.msv.datatype.xsd.ConcreteType\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xr\u0000\'com.su"
+"n.msv.datatype.xsd.XSDatatypeImpl\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0003L\u0000\fnamespaceUrit"
+"\u0000\u0012Ljava/lang/String;L\u0000\btypeNameq\u0000~\u0000\u001dL\u0000\nwhiteSpacet\u0000.Lcom/sun"
+"/msv/datatype/xsd/WhiteSpaceProcessor;xpt\u0000 http://www.w3.org"
+"/2001/XMLSchemat\u0000\u0003intsr\u00005com.sun.msv.datatype.xsd.WhiteSpace"
+"Processor$Collapse\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xr\u0000,com.sun.msv.datatype.xsd.Wh"
+"iteSpaceProcessor\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xpsr\u0000*com.sun.msv.datatype.xsd.M"
+"axInclusiveFacet\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xr\u0000#com.sun.msv.datatype.xsd.Rang"
+"eFacet\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0001L\u0000\nlimitValuet\u0000\u0012Ljava/lang/Object;xr\u00009com.s"
+"un.msv.datatype.xsd.DataTypeWithValueConstraintFacet\"\u00a7Ro\u00ca\u00c7\u008aT"
+"\u0002\u0000\u0000xr\u0000*com.sun.msv.datatype.xsd.DataTypeWithFacet\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0005"
+"Z\u0000\fisFacetFixedZ\u0000\u0012needValueCheckFlagL\u0000\bbaseTypeq\u0000~\u0000\u0019L\u0000\fconcr"
+"eteTypet\u0000\'Lcom/sun/msv/datatype/xsd/ConcreteType;L\u0000\tfacetNam"
+"eq\u0000~\u0000\u001dxq\u0000~\u0000\u001cppq\u0000~\u0000$\u0000\u0001sr\u0000*com.sun.msv.datatype.xsd.MinInclusi"
+"veFacet\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000&ppq\u0000~\u0000$\u0000\u0000sr\u0000!com.sun.msv.datatype.xs"
+"d.LongType\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000\u0018q\u0000~\u0000 t\u0000\u0004longq\u0000~\u0000$sq\u0000~\u0000%ppq\u0000~\u0000$\u0000\u0001s"
+"q\u0000~\u0000,ppq\u0000~\u0000$\u0000\u0000sr\u0000$com.sun.msv.datatype.xsd.IntegerType\u0000\u0000\u0000\u0000\u0000\u0000"
+"\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000\u0018q\u0000~\u0000 t\u0000\u0007integerq\u0000~\u0000$sr\u0000,com.sun.msv.datatype.xsd."
+"FractionDigitsFacet\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0001I\u0000\u0005scalexr\u0000;com.sun.msv.dataty"
+"pe.xsd.DataTypeWithLexicalConstraintFacetT\u0090\u001c>\u001azb\u00ea\u0002\u0000\u0000xq\u0000~\u0000)pp"
+"q\u0000~\u0000$\u0001\u0000sr\u0000#com.sun.msv.datatype.xsd.NumberType\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000"
+"~\u0000\u001aq\u0000~\u0000 t\u0000\u0007decimalq\u0000~\u0000$q\u0000~\u0000:t\u0000\u000efractionDigits\u0000\u0000\u0000\u0000q\u0000~\u00004t\u0000\fmin"
+"Inclusivesr\u0000\u000ejava.lang.Long;\u008b\u00e4\u0090\u00cc\u008f#\u00df\u0002\u0000\u0001J\u0000\u0005valuexr\u0000\u0010java.lang."
+"Number\u0086\u00ac\u0095\u001d\u000b\u0094\u00e0\u008b\u0002\u0000\u0000xp\u0080\u0000\u0000\u0000\u0000\u0000\u0000\u0000q\u0000~\u00004t\u0000\fmaxInclusivesq\u0000~\u0000>\u007f\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff"
+"\u00ffq\u0000~\u0000/q\u0000~\u0000=sr\u0000\u0011java.lang.Integer\u0012\u00e2\u00a0\u00a4\u00f7\u0081\u00878\u0002\u0000\u0001I\u0000\u0005valuexq\u0000~\u0000?\u0080\u0000\u0000"
+"\u0000q\u0000~\u0000/q\u0000~\u0000Asq\u0000~\u0000C\u007f\u00ff\u00ff\u00ffsr\u00000com.sun.msv.grammar.Expression$Null"
+"SetExpression\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000\u0003ppsr\u0000\u001bcom.sun.msv.util.StringP"
+"air\u00d0t\u001ejB\u008f\u008d\u00a0\u0002\u0000\u0002L\u0000\tlocalNameq\u0000~\u0000\u001dL\u0000\fnamespaceURIq\u0000~\u0000\u001dxpq\u0000~\u0000!q\u0000"
+"~\u0000 sq\u0000~\u0000\nppsr\u0000 com.sun.msv.grammar.AttributeExp\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0002L\u0000"
+"\u0003expq\u0000~\u0000\u0002L\u0000\tnameClassq\u0000~\u0000\rxq\u0000~\u0000\u0003q\u0000~\u0000\u0011psq\u0000~\u0000\u0013ppsr\u0000\"com.sun.ms"
+"v.datatype.xsd.QnameType\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000\u001aq\u0000~\u0000 t\u0000\u0005QNameq\u0000~\u0000$q"
+"\u0000~\u0000Gsq\u0000~\u0000Hq\u0000~\u0000Pq\u0000~\u0000 sr\u0000#com.sun.msv.grammar.SimpleNameClass\u0000"
+"\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0002L\u0000\tlocalNameq\u0000~\u0000\u001dL\u0000\fnamespaceURIq\u0000~\u0000\u001dxr\u0000\u001dcom.sun.m"
+"sv.grammar.NameClass\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xpt\u0000\u0004typet\u0000)http://www.w3.org"
+"/2001/XMLSchema-instancesr\u00000com.sun.msv.grammar.Expression$E"
+"psilonExpression\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000\u0003sq\u0000~\u0000\u0010\u0001psq\u0000~\u0000Rt\u0000\tWatchTypet"
+"\u0000\u0000q\u0000~\u0000Xsq\u0000~\u0000\nppsq\u0000~\u0000\fq\u0000~\u0000\u0011p\u0000sq\u0000~\u0000\u0000ppq\u0000~\u0000\u0016sq\u0000~\u0000\nppsq\u0000~\u0000Kq\u0000~\u0000\u0011"
+"pq\u0000~\u0000Mq\u0000~\u0000Tq\u0000~\u0000Xsq\u0000~\u0000Rt\u0000\u000bWatchOptionq\u0000~\u0000\\q\u0000~\u0000Xsq\u0000~\u0000\nppsq\u0000~\u0000\f"
+"q\u0000~\u0000\u0011p\u0000sq\u0000~\u0000\u0000ppq\u0000~\u0000\u0016sq\u0000~\u0000\nppsq\u0000~\u0000Kq\u0000~\u0000\u0011pq\u0000~\u0000Mq\u0000~\u0000Tq\u0000~\u0000Xsq\u0000~\u0000"
+"Rt\u0000\u000bWatchStatusq\u0000~\u0000\\q\u0000~\u0000Xsq\u0000~\u0000\nppsq\u0000~\u0000\fq\u0000~\u0000\u0011p\u0000sq\u0000~\u0000\u0000ppsq\u0000~\u0000\u0013"
+"ppsr\u0000#com.sun.msv.datatype.xsd.StringType\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0001Z\u0000\risAlw"
+"aysValidxq\u0000~\u0000\u001aq\u0000~\u0000 t\u0000\u0006stringsr\u00005com.sun.msv.datatype.xsd.Whi"
+"teSpaceProcessor$Preserve\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000#\u0001q\u0000~\u0000Gsq\u0000~\u0000Hq\u0000~\u0000qq"
+"\u0000~\u0000 sq\u0000~\u0000\nppsq\u0000~\u0000Kq\u0000~\u0000\u0011pq\u0000~\u0000Mq\u0000~\u0000Tq\u0000~\u0000Xsq\u0000~\u0000Rt\u0000\u0011WatchCreatio"
+"nDateq\u0000~\u0000\\q\u0000~\u0000Xsq\u0000~\u0000\nppsq\u0000~\u0000\fq\u0000~\u0000\u0011p\u0000sq\u0000~\u0000\u0000ppq\u0000~\u0000nsq\u0000~\u0000\nppsq\u0000"
+"~\u0000Kq\u0000~\u0000\u0011pq\u0000~\u0000Mq\u0000~\u0000Tq\u0000~\u0000Xsq\u0000~\u0000Rt\u0000\u0011WatchLastSentDateq\u0000~\u0000\\q\u0000~\u0000X"
+"sq\u0000~\u0000\nppsq\u0000~\u0000\fq\u0000~\u0000\u0011p\u0000sq\u0000~\u0000\u0000ppq\u0000~\u0000nsq\u0000~\u0000\nppsq\u0000~\u0000Kq\u0000~\u0000\u0011pq\u0000~\u0000Mq"
+"\u0000~\u0000Tq\u0000~\u0000Xsq\u0000~\u0000Rt\u0000\fWatchEndDateq\u0000~\u0000\\q\u0000~\u0000Xsr\u0000\"com.sun.msv.gram"
+"mar.ExpressionPool\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0001L\u0000\bexpTablet\u0000/Lcom/sun/msv/gram"
+"mar/ExpressionPool$ClosedHash;xpsr\u0000-com.sun.msv.grammar.Expr"
+"essionPool$ClosedHash\u00d7j\u00d0N\u00ef\u00e8\u00ed\u001c\u0003\u0000\u0003I\u0000\u0005countB\u0000\rstreamVersionL\u0000\u0006p"
+"arentt\u0000$Lcom/sun/msv/grammar/ExpressionPool;xp\u0000\u0000\u0000\u0017\u0001pq\u0000~\u0000\u000bq\u0000~"
+"\u0000]q\u0000~\u0000dq\u0000~\u0000\u0006q\u0000~\u0000\bq\u0000~\u0000mq\u0000~\u0000{q\u0000~\u0000\u0082q\u0000~\u0000Jq\u0000~\u0000`q\u0000~\u0000gq\u0000~\u0000uq\u0000~\u0000|q\u0000~"
+"\u0000\u0083q\u0000~\u0000\u0007q\u0000~\u0000\u0005q\u0000~\u0000kq\u0000~\u0000yq\u0000~\u0000\u0080q\u0000~\u0000\u0012q\u0000~\u0000_q\u0000~\u0000\tq\u0000~\u0000fx"));
}
return new com.sun.msv.verifier.regexp.REDocumentDeclaration(schemaFragment);
}
public class Unmarshaller
extends com.mvnforum.jaxb.db.impl.runtime.AbstractUnmarshallingEventHandlerImpl
{
public Unmarshaller(com.mvnforum.jaxb.db.impl.runtime.UnmarshallingContext context) {
super(context, "-------------------");
}
protected Unmarshaller(com.mvnforum.jaxb.db.impl.runtime.UnmarshallingContext context, int startState) {
this(context);
state = startState;
}
public java.lang.Object owner() {
return com.mvnforum.jaxb.db.impl.GlobalWatchTypeImpl.this;
}
public void enterElement(java.lang.String ___uri, java.lang.String ___local, java.lang.String ___qname, org.xml.sax.Attributes __atts)
throws org.xml.sax.SAXException
{
int attIdx;
outer:
while (true) {
switch (state) {
case 0 :
if (("WatchType" == ___local)&&("" == ___uri)) {
context.pushAttributes(__atts, true);
state = 1;
return ;
}
state = 3;
continue outer;
case 12 :
if (("WatchLastSentDate" == ___local)&&("" == ___uri)) {
context.pushAttributes(__atts, true);
state = 13;
return ;
}
state = 15;
continue outer;
case 18 :
revertToParentFromEnterElement(___uri, ___local, ___qname, __atts);
return ;
case 15 :
if (("WatchEndDate" == ___local)&&("" == ___uri)) {
context.pushAttributes(__atts, true);
state = 16;
return ;
}
state = 18;
continue outer;
case 3 :
if (("WatchOption" == ___local)&&("" == ___uri)) {
context.pushAttributes(__atts, true);
state = 4;
return ;
}
state = 6;
continue outer;
case 6 :
if (("WatchStatus" == ___local)&&("" == ___uri)) {
context.pushAttributes(__atts, true);
state = 7;
return ;
}
state = 9;
continue outer;
case 9 :
if (("WatchCreationDate" == ___local)&&("" == ___uri)) {
context.pushAttributes(__atts, true);
state = 10;
return ;
}
state = 12;
continue outer;
}
super.enterElement(___uri, ___local, ___qname, __atts);
break;
}
}
public void leaveElement(java.lang.String ___uri, java.lang.String ___local, java.lang.String ___qname)
throws org.xml.sax.SAXException
{
int attIdx;
outer:
while (true) {
switch (state) {
case 0 :
state = 3;
continue outer;
case 12 :
state = 15;
continue outer;
case 2 :
if (("WatchType" == ___local)&&("" == ___uri)) {
context.popAttributes();
state = 3;
return ;
}
break;
case 5 :
if (("WatchOption" == ___local)&&("" == ___uri)) {
context.popAttributes();
state = 6;
return ;
}
break;
case 14 :
if (("WatchLastSentDate" == ___local)&&("" == ___uri)) {
context.popAttributes();
state = 15;
return ;
}
break;
case 18 :
revertToParentFromLeaveElement(___uri, ___local, ___qname);
return ;
case 8 :
if (("WatchStatus" == ___local)&&("" == ___uri)) {
context.popAttributes();
state = 9;
return ;
}
break;
case 11 :
if (("WatchCreationDate" == ___local)&&("" == ___uri)) {
context.popAttributes();
state = 12;
return ;
}
break;
case 17 :
if (("WatchEndDate" == ___local)&&("" == ___uri)) {
context.popAttributes();
state = 18;
return ;
}
break;
case 15 :
state = 18;
continue outer;
case 3 :
state = 6;
continue outer;
case 6 :
state = 9;
continue outer;
case 9 :
state = 12;
continue outer;
}
super.leaveElement(___uri, ___local, ___qname);
break;
}
}
public void enterAttribute(java.lang.String ___uri, java.lang.String ___local, java.lang.String ___qname)
throws org.xml.sax.SAXException
{
int attIdx;
outer:
while (true) {
switch (state) {
case 0 :
state = 3;
continue outer;
case 12 :
state = 15;
continue outer;
case 18 :
revertToParentFromEnterAttribute(___uri, ___local, ___qname);
return ;
case 15 :
state = 18;
continue outer;
case 3 :
state = 6;
continue outer;
case 6 :
state = 9;
continue outer;
case 9 :
state = 12;
continue outer;
}
super.enterAttribute(___uri, ___local, ___qname);
break;
}
}
public void leaveAttribute(java.lang.String ___uri, java.lang.String ___local, java.lang.String ___qname)
throws org.xml.sax.SAXException
{
int attIdx;
outer:
while (true) {
switch (state) {
case 0 :
state = 3;
continue outer;
case 12 :
state = 15;
continue outer;
case 18 :
revertToParentFromLeaveAttribute(___uri, ___local, ___qname);
return ;
case 15 :
state = 18;
continue outer;
case 3 :
state = 6;
continue outer;
case 6 :
state = 9;
continue outer;
case 9 :
state = 12;
continue outer;
}
super.leaveAttribute(___uri, ___local, ___qname);
break;
}
}
public void handleText(final java.lang.String value)
throws org.xml.sax.SAXException
{
int attIdx;
outer:
while (true) {
try {
switch (state) {
case 0 :
state = 3;
continue outer;
case 12 :
state = 15;
continue outer;
case 16 :
state = 17;
eatText1(value);
return ;
case 4 :
state = 5;
eatText2(value);
return ;
case 18 :
revertToParentFromText(value);
return ;
case 10 :
state = 11;
eatText3(value);
return ;
case 13 :
state = 14;
eatText4(value);
return ;
case 15 :
state = 18;
continue outer;
case 7 :
state = 8;
eatText5(value);
return ;
case 1 :
state = 2;
eatText6(value);
return ;
case 3 :
state = 6;
continue outer;
case 6 :
state = 9;
continue outer;
case 9 :
state = 12;
continue outer;
}
} catch (java.lang.RuntimeException e) {
handleUnexpectedTextException(value, e);
}
break;
}
}
private void eatText1(final java.lang.String value)
throws org.xml.sax.SAXException
{
try {
_WatchEndDate = value;
} catch (java.lang.Exception e) {
handleParseConversionException(e);
}
}
private void eatText2(final java.lang.String value)
throws org.xml.sax.SAXException
{
try {
_WatchOption = javax.xml.bind.DatatypeConverter.parseInt(com.sun.xml.bind.WhiteSpaceProcessor.collapse(value));
has_WatchOption = true;
} catch (java.lang.Exception e) {
handleParseConversionException(e);
}
}
private void eatText3(final java.lang.String value)
throws org.xml.sax.SAXException
{
try {
_WatchCreationDate = value;
} catch (java.lang.Exception e) {
handleParseConversionException(e);
}
}
private void eatText4(final java.lang.String value)
throws org.xml.sax.SAXException
{
try {
_WatchLastSentDate = value;
} catch (java.lang.Exception e) {
handleParseConversionException(e);
}
}
private void eatText5(final java.lang.String value)
throws org.xml.sax.SAXException
{
try {
_WatchStatus = javax.xml.bind.DatatypeConverter.parseInt(com.sun.xml.bind.WhiteSpaceProcessor.collapse(value));
has_WatchStatus = true;
} catch (java.lang.Exception e) {
handleParseConversionException(e);
}
}
private void eatText6(final java.lang.String value)
throws org.xml.sax.SAXException
{
try {
_WatchType = javax.xml.bind.DatatypeConverter.parseInt(com.sun.xml.bind.WhiteSpaceProcessor.collapse(value));
has_WatchType = true;
} catch (java.lang.Exception e) {
handleParseConversionException(e);
}
}
}
}
|
UTF-8
|
Java
| 29,639 |
java
|
GlobalWatchTypeImpl.java
|
Java
|
[] | null |
[] |
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v1.0.5-b16-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2005.12.29 at 03:19:11 PM GMT+07:00
//
package com.mvnforum.jaxb.db.impl;
public class GlobalWatchTypeImpl implements com.mvnforum.jaxb.db.GlobalWatchType, com.sun.xml.bind.JAXBObject, com.mvnforum.jaxb.db.impl.runtime.UnmarshallableObject, com.mvnforum.jaxb.db.impl.runtime.XMLSerializable, com.mvnforum.jaxb.db.impl.runtime.ValidatableObject
{
protected java.lang.String _WatchCreationDate;
protected java.lang.String _WatchLastSentDate;
protected java.lang.String _WatchEndDate;
protected boolean has_WatchType;
protected int _WatchType;
protected boolean has_WatchOption;
protected int _WatchOption;
protected boolean has_WatchStatus;
protected int _WatchStatus;
public final static java.lang.Class version = (com.mvnforum.jaxb.db.impl.JAXBVersion.class);
private static com.sun.msv.grammar.Grammar schemaFragment;
private final static java.lang.Class PRIMARY_INTERFACE_CLASS() {
return (com.mvnforum.jaxb.db.GlobalWatchType.class);
}
public java.lang.String getWatchCreationDate() {
return _WatchCreationDate;
}
public void setWatchCreationDate(java.lang.String value) {
_WatchCreationDate = value;
}
public java.lang.String getWatchLastSentDate() {
return _WatchLastSentDate;
}
public void setWatchLastSentDate(java.lang.String value) {
_WatchLastSentDate = value;
}
public java.lang.String getWatchEndDate() {
return _WatchEndDate;
}
public void setWatchEndDate(java.lang.String value) {
_WatchEndDate = value;
}
public int getWatchType() {
return _WatchType;
}
public void setWatchType(int value) {
_WatchType = value;
has_WatchType = true;
}
public int getWatchOption() {
return _WatchOption;
}
public void setWatchOption(int value) {
_WatchOption = value;
has_WatchOption = true;
}
public int getWatchStatus() {
return _WatchStatus;
}
public void setWatchStatus(int value) {
_WatchStatus = value;
has_WatchStatus = true;
}
public com.mvnforum.jaxb.db.impl.runtime.UnmarshallingEventHandler createUnmarshaller(com.mvnforum.jaxb.db.impl.runtime.UnmarshallingContext context) {
return new com.mvnforum.jaxb.db.impl.GlobalWatchTypeImpl.Unmarshaller(context);
}
public void serializeBody(com.mvnforum.jaxb.db.impl.runtime.XMLSerializer context)
throws org.xml.sax.SAXException
{
if (has_WatchType) {
context.startElement("", "WatchType");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(javax.xml.bind.DatatypeConverter.printInt(((int) _WatchType)), "WatchType");
} catch (java.lang.Exception e) {
com.mvnforum.jaxb.db.impl.runtime.Util.handlePrintConversionException(this, e, context);
}
context.endElement();
}
if (has_WatchOption) {
context.startElement("", "WatchOption");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(javax.xml.bind.DatatypeConverter.printInt(((int) _WatchOption)), "WatchOption");
} catch (java.lang.Exception e) {
com.mvnforum.jaxb.db.impl.runtime.Util.handlePrintConversionException(this, e, context);
}
context.endElement();
}
if (has_WatchStatus) {
context.startElement("", "WatchStatus");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(javax.xml.bind.DatatypeConverter.printInt(((int) _WatchStatus)), "WatchStatus");
} catch (java.lang.Exception e) {
com.mvnforum.jaxb.db.impl.runtime.Util.handlePrintConversionException(this, e, context);
}
context.endElement();
}
if (_WatchCreationDate!= null) {
context.startElement("", "WatchCreationDate");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(((java.lang.String) _WatchCreationDate), "WatchCreationDate");
} catch (java.lang.Exception e) {
com.mvnforum.jaxb.db.impl.runtime.Util.handlePrintConversionException(this, e, context);
}
context.endElement();
}
if (_WatchLastSentDate!= null) {
context.startElement("", "WatchLastSentDate");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(((java.lang.String) _WatchLastSentDate), "WatchLastSentDate");
} catch (java.lang.Exception e) {
com.mvnforum.jaxb.db.impl.runtime.Util.handlePrintConversionException(this, e, context);
}
context.endElement();
}
if (_WatchEndDate!= null) {
context.startElement("", "WatchEndDate");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(((java.lang.String) _WatchEndDate), "WatchEndDate");
} catch (java.lang.Exception e) {
com.mvnforum.jaxb.db.impl.runtime.Util.handlePrintConversionException(this, e, context);
}
context.endElement();
}
}
public void serializeAttributes(com.mvnforum.jaxb.db.impl.runtime.XMLSerializer context)
throws org.xml.sax.SAXException
{
}
public void serializeURIs(com.mvnforum.jaxb.db.impl.runtime.XMLSerializer context)
throws org.xml.sax.SAXException
{
}
public java.lang.Class getPrimaryInterface() {
return (com.mvnforum.jaxb.db.GlobalWatchType.class);
}
public com.sun.msv.verifier.DocumentDeclaration createRawValidator() {
if (schemaFragment == null) {
schemaFragment = com.sun.xml.bind.validator.SchemaDeserializer.deserialize((
"\u00ac\u00ed\u0000\u0005sr\u0000\u001fcom.sun.msv.grammar.SequenceExp\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xr\u0000\u001dcom.su"
+"n.msv.grammar.BinaryExp\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0002L\u0000\u0004exp1t\u0000 Lcom/sun/msv/gra"
+"mmar/Expression;L\u0000\u0004exp2q\u0000~\u0000\u0002xr\u0000\u001ecom.sun.msv.grammar.Expressi"
+"on\u00f8\u0018\u0082\u00e8N5~O\u0002\u0000\u0002L\u0000\u0013epsilonReducibilityt\u0000\u0013Ljava/lang/Boolean;L\u0000\u000b"
+"expandedExpq\u0000~\u0000\u0002xpppsq\u0000~\u0000\u0000ppsq\u0000~\u0000\u0000ppsq\u0000~\u0000\u0000ppsq\u0000~\u0000\u0000ppsr\u0000\u001dcom."
+"sun.msv.grammar.ChoiceExp\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000\u0001ppsr\u0000\'com.sun.msv."
+"grammar.trex.ElementPattern\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0001L\u0000\tnameClasst\u0000\u001fLcom/su"
+"n/msv/grammar/NameClass;xr\u0000\u001ecom.sun.msv.grammar.ElementExp\u0000\u0000"
+"\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0002Z\u0000\u001aignoreUndeclaredAttributesL\u0000\fcontentModelq\u0000~\u0000\u0002xq"
+"\u0000~\u0000\u0003sr\u0000\u0011java.lang.Boolean\u00cd r\u0080\u00d5\u009c\u00fa\u00ee\u0002\u0000\u0001Z\u0000\u0005valuexp\u0000p\u0000sq\u0000~\u0000\u0000ppsr\u0000"
+"\u001bcom.sun.msv.grammar.DataExp\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0003L\u0000\u0002dtt\u0000\u001fLorg/relaxng/"
+"datatype/Datatype;L\u0000\u0006exceptq\u0000~\u0000\u0002L\u0000\u0004namet\u0000\u001dLcom/sun/msv/util/"
+"StringPair;xq\u0000~\u0000\u0003ppsr\u0000 com.sun.msv.datatype.xsd.IntType\u0000\u0000\u0000\u0000\u0000"
+"\u0000\u0000\u0001\u0002\u0000\u0000xr\u0000+com.sun.msv.datatype.xsd.IntegerDerivedType\u0099\u00f1]\u0090&6k"
+"\u00be\u0002\u0000\u0001L\u0000\nbaseFacetst\u0000)Lcom/sun/msv/datatype/xsd/XSDatatypeImpl"
+";xr\u0000*com.sun.msv.datatype.xsd.BuiltinAtomicType\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xr"
+"\u0000%com.sun.msv.datatype.xsd.ConcreteType\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xr\u0000\'com.su"
+"n.msv.datatype.xsd.XSDatatypeImpl\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0003L\u0000\fnamespaceUrit"
+"\u0000\u0012Ljava/lang/String;L\u0000\btypeNameq\u0000~\u0000\u001dL\u0000\nwhiteSpacet\u0000.Lcom/sun"
+"/msv/datatype/xsd/WhiteSpaceProcessor;xpt\u0000 http://www.w3.org"
+"/2001/XMLSchemat\u0000\u0003intsr\u00005com.sun.msv.datatype.xsd.WhiteSpace"
+"Processor$Collapse\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xr\u0000,com.sun.msv.datatype.xsd.Wh"
+"iteSpaceProcessor\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xpsr\u0000*com.sun.msv.datatype.xsd.M"
+"axInclusiveFacet\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xr\u0000#com.sun.msv.datatype.xsd.Rang"
+"eFacet\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0001L\u0000\nlimitValuet\u0000\u0012Ljava/lang/Object;xr\u00009com.s"
+"un.msv.datatype.xsd.DataTypeWithValueConstraintFacet\"\u00a7Ro\u00ca\u00c7\u008aT"
+"\u0002\u0000\u0000xr\u0000*com.sun.msv.datatype.xsd.DataTypeWithFacet\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0005"
+"Z\u0000\fisFacetFixedZ\u0000\u0012needValueCheckFlagL\u0000\bbaseTypeq\u0000~\u0000\u0019L\u0000\fconcr"
+"eteTypet\u0000\'Lcom/sun/msv/datatype/xsd/ConcreteType;L\u0000\tfacetNam"
+"eq\u0000~\u0000\u001dxq\u0000~\u0000\u001cppq\u0000~\u0000$\u0000\u0001sr\u0000*com.sun.msv.datatype.xsd.MinInclusi"
+"veFacet\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000&ppq\u0000~\u0000$\u0000\u0000sr\u0000!com.sun.msv.datatype.xs"
+"d.LongType\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000\u0018q\u0000~\u0000 t\u0000\u0004longq\u0000~\u0000$sq\u0000~\u0000%ppq\u0000~\u0000$\u0000\u0001s"
+"q\u0000~\u0000,ppq\u0000~\u0000$\u0000\u0000sr\u0000$com.sun.msv.datatype.xsd.IntegerType\u0000\u0000\u0000\u0000\u0000\u0000"
+"\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000\u0018q\u0000~\u0000 t\u0000\u0007integerq\u0000~\u0000$sr\u0000,com.sun.msv.datatype.xsd."
+"FractionDigitsFacet\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0001I\u0000\u0005scalexr\u0000;com.sun.msv.dataty"
+"pe.xsd.DataTypeWithLexicalConstraintFacetT\u0090\u001c>\u001azb\u00ea\u0002\u0000\u0000xq\u0000~\u0000)pp"
+"q\u0000~\u0000$\u0001\u0000sr\u0000#com.sun.msv.datatype.xsd.NumberType\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000"
+"~\u0000\u001aq\u0000~\u0000 t\u0000\u0007decimalq\u0000~\u0000$q\u0000~\u0000:t\u0000\u000efractionDigits\u0000\u0000\u0000\u0000q\u0000~\u00004t\u0000\fmin"
+"Inclusivesr\u0000\u000ejava.lang.Long;\u008b\u00e4\u0090\u00cc\u008f#\u00df\u0002\u0000\u0001J\u0000\u0005valuexr\u0000\u0010java.lang."
+"Number\u0086\u00ac\u0095\u001d\u000b\u0094\u00e0\u008b\u0002\u0000\u0000xp\u0080\u0000\u0000\u0000\u0000\u0000\u0000\u0000q\u0000~\u00004t\u0000\fmaxInclusivesq\u0000~\u0000>\u007f\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff"
+"\u00ffq\u0000~\u0000/q\u0000~\u0000=sr\u0000\u0011java.lang.Integer\u0012\u00e2\u00a0\u00a4\u00f7\u0081\u00878\u0002\u0000\u0001I\u0000\u0005valuexq\u0000~\u0000?\u0080\u0000\u0000"
+"\u0000q\u0000~\u0000/q\u0000~\u0000Asq\u0000~\u0000C\u007f\u00ff\u00ff\u00ffsr\u00000com.sun.msv.grammar.Expression$Null"
+"SetExpression\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000\u0003ppsr\u0000\u001bcom.sun.msv.util.StringP"
+"air\u00d0t\u001ejB\u008f\u008d\u00a0\u0002\u0000\u0002L\u0000\tlocalNameq\u0000~\u0000\u001dL\u0000\fnamespaceURIq\u0000~\u0000\u001dxpq\u0000~\u0000!q\u0000"
+"~\u0000 sq\u0000~\u0000\nppsr\u0000 com.sun.msv.grammar.AttributeExp\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0002L\u0000"
+"\u0003expq\u0000~\u0000\u0002L\u0000\tnameClassq\u0000~\u0000\rxq\u0000~\u0000\u0003q\u0000~\u0000\u0011psq\u0000~\u0000\u0013ppsr\u0000\"com.sun.ms"
+"v.datatype.xsd.QnameType\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000\u001aq\u0000~\u0000 t\u0000\u0005QNameq\u0000~\u0000$q"
+"\u0000~\u0000Gsq\u0000~\u0000Hq\u0000~\u0000Pq\u0000~\u0000 sr\u0000#com.sun.msv.grammar.SimpleNameClass\u0000"
+"\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0002L\u0000\tlocalNameq\u0000~\u0000\u001dL\u0000\fnamespaceURIq\u0000~\u0000\u001dxr\u0000\u001dcom.sun.m"
+"sv.grammar.NameClass\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xpt\u0000\u0004typet\u0000)http://www.w3.org"
+"/2001/XMLSchema-instancesr\u00000com.sun.msv.grammar.Expression$E"
+"psilonExpression\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000\u0003sq\u0000~\u0000\u0010\u0001psq\u0000~\u0000Rt\u0000\tWatchTypet"
+"\u0000\u0000q\u0000~\u0000Xsq\u0000~\u0000\nppsq\u0000~\u0000\fq\u0000~\u0000\u0011p\u0000sq\u0000~\u0000\u0000ppq\u0000~\u0000\u0016sq\u0000~\u0000\nppsq\u0000~\u0000Kq\u0000~\u0000\u0011"
+"pq\u0000~\u0000Mq\u0000~\u0000Tq\u0000~\u0000Xsq\u0000~\u0000Rt\u0000\u000bWatchOptionq\u0000~\u0000\\q\u0000~\u0000Xsq\u0000~\u0000\nppsq\u0000~\u0000\f"
+"q\u0000~\u0000\u0011p\u0000sq\u0000~\u0000\u0000ppq\u0000~\u0000\u0016sq\u0000~\u0000\nppsq\u0000~\u0000Kq\u0000~\u0000\u0011pq\u0000~\u0000Mq\u0000~\u0000Tq\u0000~\u0000Xsq\u0000~\u0000"
+"Rt\u0000\u000bWatchStatusq\u0000~\u0000\\q\u0000~\u0000Xsq\u0000~\u0000\nppsq\u0000~\u0000\fq\u0000~\u0000\u0011p\u0000sq\u0000~\u0000\u0000ppsq\u0000~\u0000\u0013"
+"ppsr\u0000#com.sun.msv.datatype.xsd.StringType\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0001Z\u0000\risAlw"
+"aysValidxq\u0000~\u0000\u001aq\u0000~\u0000 t\u0000\u0006stringsr\u00005com.sun.msv.datatype.xsd.Whi"
+"teSpaceProcessor$Preserve\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0000xq\u0000~\u0000#\u0001q\u0000~\u0000Gsq\u0000~\u0000Hq\u0000~\u0000qq"
+"\u0000~\u0000 sq\u0000~\u0000\nppsq\u0000~\u0000Kq\u0000~\u0000\u0011pq\u0000~\u0000Mq\u0000~\u0000Tq\u0000~\u0000Xsq\u0000~\u0000Rt\u0000\u0011WatchCreatio"
+"nDateq\u0000~\u0000\\q\u0000~\u0000Xsq\u0000~\u0000\nppsq\u0000~\u0000\fq\u0000~\u0000\u0011p\u0000sq\u0000~\u0000\u0000ppq\u0000~\u0000nsq\u0000~\u0000\nppsq\u0000"
+"~\u0000Kq\u0000~\u0000\u0011pq\u0000~\u0000Mq\u0000~\u0000Tq\u0000~\u0000Xsq\u0000~\u0000Rt\u0000\u0011WatchLastSentDateq\u0000~\u0000\\q\u0000~\u0000X"
+"sq\u0000~\u0000\nppsq\u0000~\u0000\fq\u0000~\u0000\u0011p\u0000sq\u0000~\u0000\u0000ppq\u0000~\u0000nsq\u0000~\u0000\nppsq\u0000~\u0000Kq\u0000~\u0000\u0011pq\u0000~\u0000Mq"
+"\u0000~\u0000Tq\u0000~\u0000Xsq\u0000~\u0000Rt\u0000\fWatchEndDateq\u0000~\u0000\\q\u0000~\u0000Xsr\u0000\"com.sun.msv.gram"
+"mar.ExpressionPool\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0002\u0000\u0001L\u0000\bexpTablet\u0000/Lcom/sun/msv/gram"
+"mar/ExpressionPool$ClosedHash;xpsr\u0000-com.sun.msv.grammar.Expr"
+"essionPool$ClosedHash\u00d7j\u00d0N\u00ef\u00e8\u00ed\u001c\u0003\u0000\u0003I\u0000\u0005countB\u0000\rstreamVersionL\u0000\u0006p"
+"arentt\u0000$Lcom/sun/msv/grammar/ExpressionPool;xp\u0000\u0000\u0000\u0017\u0001pq\u0000~\u0000\u000bq\u0000~"
+"\u0000]q\u0000~\u0000dq\u0000~\u0000\u0006q\u0000~\u0000\bq\u0000~\u0000mq\u0000~\u0000{q\u0000~\u0000\u0082q\u0000~\u0000Jq\u0000~\u0000`q\u0000~\u0000gq\u0000~\u0000uq\u0000~\u0000|q\u0000~"
+"\u0000\u0083q\u0000~\u0000\u0007q\u0000~\u0000\u0005q\u0000~\u0000kq\u0000~\u0000yq\u0000~\u0000\u0080q\u0000~\u0000\u0012q\u0000~\u0000_q\u0000~\u0000\tq\u0000~\u0000fx"));
}
return new com.sun.msv.verifier.regexp.REDocumentDeclaration(schemaFragment);
}
public class Unmarshaller
extends com.mvnforum.jaxb.db.impl.runtime.AbstractUnmarshallingEventHandlerImpl
{
public Unmarshaller(com.mvnforum.jaxb.db.impl.runtime.UnmarshallingContext context) {
super(context, "-------------------");
}
protected Unmarshaller(com.mvnforum.jaxb.db.impl.runtime.UnmarshallingContext context, int startState) {
this(context);
state = startState;
}
public java.lang.Object owner() {
return com.mvnforum.jaxb.db.impl.GlobalWatchTypeImpl.this;
}
public void enterElement(java.lang.String ___uri, java.lang.String ___local, java.lang.String ___qname, org.xml.sax.Attributes __atts)
throws org.xml.sax.SAXException
{
int attIdx;
outer:
while (true) {
switch (state) {
case 0 :
if (("WatchType" == ___local)&&("" == ___uri)) {
context.pushAttributes(__atts, true);
state = 1;
return ;
}
state = 3;
continue outer;
case 12 :
if (("WatchLastSentDate" == ___local)&&("" == ___uri)) {
context.pushAttributes(__atts, true);
state = 13;
return ;
}
state = 15;
continue outer;
case 18 :
revertToParentFromEnterElement(___uri, ___local, ___qname, __atts);
return ;
case 15 :
if (("WatchEndDate" == ___local)&&("" == ___uri)) {
context.pushAttributes(__atts, true);
state = 16;
return ;
}
state = 18;
continue outer;
case 3 :
if (("WatchOption" == ___local)&&("" == ___uri)) {
context.pushAttributes(__atts, true);
state = 4;
return ;
}
state = 6;
continue outer;
case 6 :
if (("WatchStatus" == ___local)&&("" == ___uri)) {
context.pushAttributes(__atts, true);
state = 7;
return ;
}
state = 9;
continue outer;
case 9 :
if (("WatchCreationDate" == ___local)&&("" == ___uri)) {
context.pushAttributes(__atts, true);
state = 10;
return ;
}
state = 12;
continue outer;
}
super.enterElement(___uri, ___local, ___qname, __atts);
break;
}
}
public void leaveElement(java.lang.String ___uri, java.lang.String ___local, java.lang.String ___qname)
throws org.xml.sax.SAXException
{
int attIdx;
outer:
while (true) {
switch (state) {
case 0 :
state = 3;
continue outer;
case 12 :
state = 15;
continue outer;
case 2 :
if (("WatchType" == ___local)&&("" == ___uri)) {
context.popAttributes();
state = 3;
return ;
}
break;
case 5 :
if (("WatchOption" == ___local)&&("" == ___uri)) {
context.popAttributes();
state = 6;
return ;
}
break;
case 14 :
if (("WatchLastSentDate" == ___local)&&("" == ___uri)) {
context.popAttributes();
state = 15;
return ;
}
break;
case 18 :
revertToParentFromLeaveElement(___uri, ___local, ___qname);
return ;
case 8 :
if (("WatchStatus" == ___local)&&("" == ___uri)) {
context.popAttributes();
state = 9;
return ;
}
break;
case 11 :
if (("WatchCreationDate" == ___local)&&("" == ___uri)) {
context.popAttributes();
state = 12;
return ;
}
break;
case 17 :
if (("WatchEndDate" == ___local)&&("" == ___uri)) {
context.popAttributes();
state = 18;
return ;
}
break;
case 15 :
state = 18;
continue outer;
case 3 :
state = 6;
continue outer;
case 6 :
state = 9;
continue outer;
case 9 :
state = 12;
continue outer;
}
super.leaveElement(___uri, ___local, ___qname);
break;
}
}
public void enterAttribute(java.lang.String ___uri, java.lang.String ___local, java.lang.String ___qname)
throws org.xml.sax.SAXException
{
int attIdx;
outer:
while (true) {
switch (state) {
case 0 :
state = 3;
continue outer;
case 12 :
state = 15;
continue outer;
case 18 :
revertToParentFromEnterAttribute(___uri, ___local, ___qname);
return ;
case 15 :
state = 18;
continue outer;
case 3 :
state = 6;
continue outer;
case 6 :
state = 9;
continue outer;
case 9 :
state = 12;
continue outer;
}
super.enterAttribute(___uri, ___local, ___qname);
break;
}
}
public void leaveAttribute(java.lang.String ___uri, java.lang.String ___local, java.lang.String ___qname)
throws org.xml.sax.SAXException
{
int attIdx;
outer:
while (true) {
switch (state) {
case 0 :
state = 3;
continue outer;
case 12 :
state = 15;
continue outer;
case 18 :
revertToParentFromLeaveAttribute(___uri, ___local, ___qname);
return ;
case 15 :
state = 18;
continue outer;
case 3 :
state = 6;
continue outer;
case 6 :
state = 9;
continue outer;
case 9 :
state = 12;
continue outer;
}
super.leaveAttribute(___uri, ___local, ___qname);
break;
}
}
public void handleText(final java.lang.String value)
throws org.xml.sax.SAXException
{
int attIdx;
outer:
while (true) {
try {
switch (state) {
case 0 :
state = 3;
continue outer;
case 12 :
state = 15;
continue outer;
case 16 :
state = 17;
eatText1(value);
return ;
case 4 :
state = 5;
eatText2(value);
return ;
case 18 :
revertToParentFromText(value);
return ;
case 10 :
state = 11;
eatText3(value);
return ;
case 13 :
state = 14;
eatText4(value);
return ;
case 15 :
state = 18;
continue outer;
case 7 :
state = 8;
eatText5(value);
return ;
case 1 :
state = 2;
eatText6(value);
return ;
case 3 :
state = 6;
continue outer;
case 6 :
state = 9;
continue outer;
case 9 :
state = 12;
continue outer;
}
} catch (java.lang.RuntimeException e) {
handleUnexpectedTextException(value, e);
}
break;
}
}
private void eatText1(final java.lang.String value)
throws org.xml.sax.SAXException
{
try {
_WatchEndDate = value;
} catch (java.lang.Exception e) {
handleParseConversionException(e);
}
}
private void eatText2(final java.lang.String value)
throws org.xml.sax.SAXException
{
try {
_WatchOption = javax.xml.bind.DatatypeConverter.parseInt(com.sun.xml.bind.WhiteSpaceProcessor.collapse(value));
has_WatchOption = true;
} catch (java.lang.Exception e) {
handleParseConversionException(e);
}
}
private void eatText3(final java.lang.String value)
throws org.xml.sax.SAXException
{
try {
_WatchCreationDate = value;
} catch (java.lang.Exception e) {
handleParseConversionException(e);
}
}
private void eatText4(final java.lang.String value)
throws org.xml.sax.SAXException
{
try {
_WatchLastSentDate = value;
} catch (java.lang.Exception e) {
handleParseConversionException(e);
}
}
private void eatText5(final java.lang.String value)
throws org.xml.sax.SAXException
{
try {
_WatchStatus = javax.xml.bind.DatatypeConverter.parseInt(com.sun.xml.bind.WhiteSpaceProcessor.collapse(value));
has_WatchStatus = true;
} catch (java.lang.Exception e) {
handleParseConversionException(e);
}
}
private void eatText6(final java.lang.String value)
throws org.xml.sax.SAXException
{
try {
_WatchType = javax.xml.bind.DatatypeConverter.parseInt(com.sun.xml.bind.WhiteSpaceProcessor.collapse(value));
has_WatchType = true;
} catch (java.lang.Exception e) {
handleParseConversionException(e);
}
}
}
}
| 29,639 | 0.548365 | 0.409663 | 599 | 47.480801 | 42.647438 | 269 | false | false | 0 | 0 | 66 | 0.082594 | 0 | 0 | 0.525876 | false | false |
13
|
c4fd3417a9063e213159ecb1dc96ff6506df8d35
| 28,956,669,549,791 |
394e7f35551558dd2dc5398e13876aaebfbd60d5
|
/DuellPlugin 3/src/de/manimax3/Request/RequestManager.java
|
e3448d83f51859bc9aa83139b1a1e21fd8de4f8e
|
[] |
no_license
|
manimax3/DuellPlugin-3
|
https://github.com/manimax3/DuellPlugin-3
|
bb8c7e9a6b0b39979c12d6d53a490bda9a099331
|
c53dcee29e816f4d296f5b9ed66b06d82e5a24ac
|
refs/heads/master
| 2021-01-23T18:09:28.135000 | 2014-09-01T11:49:08 | 2014-09-01T11:49:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package de.manimax3.Request;
import java.util.ArrayList;
import org.bukkit.entity.Player;
import de.manimax3.duell.DuellManager;
import de.manimax3.main.ConfigManager;
import de.manimax3.main.MessageManager;
import de.manimax3.main.MessageManager.MessageType;
public class RequestManager {
private static RequestManager instance = new RequestManager();
public static RequestManager getInstance(){
return instance;
}
private MessageManager msgmgr = MessageManager.getInstance();
private DuellManager dlmgr = DuellManager.getInstance();
private ConfigManager cfgmgr = ConfigManager.getInstance();
private boolean global;
public ArrayList<Request> requests = new ArrayList<Request>();
public void createRequest(Player requesting, Player requested){
if(!(cfgmgr.get("Duellglobal." + requested.getName()) == null)){
if(cfgmgr.get("Duellglobal." + requested.getName()) == "false"){
msgmgr.sendMessage(requesting, MessageType.INFO, requested.getName() + " is suppressing Duell requests!");
return;
}
}
Request r = new Request(requesting, requested);
requests.add(r);
this.doRequests(r);
}
public boolean hasRequest(Player p){
for(Request r : requests){
if(p.equals(r.getRequested())) return true;
}
return false;
}
private void doRequests(Request r){
msgmgr.sendMessage(r.getRequested(), MessageType.INFO, "The Player " + r.getRequesting().getName() + " wants a Duell againsts you! Use /duell accept or deny");
msgmgr.sendMessage(r.getRequesting(), MessageType.INFO, "The Request got send to Player " + r.getRequested().getName());
}
public Request getRequest(Player p){
for(Request r : requests){
if(p.equals(r.getRequested()) || p.equals(r.getRequesting())) return r;
}
return null;
}
public void removeRequest(Request r){
requests.remove(r);
return;
}
public void acceptRequest(Request r){
msgmgr.sendMessage(r.getRequested(), MessageType.GOOD, "You have accepted the Duell against " + r.getRequesting().getName() + " !");
msgmgr.sendMessage(r.getRequesting(), MessageType.GOOD, "Player " + r.getRequested() + " has accepted the Duell against you!");
msgmgr.sendMessage(r.getRequested(), MessageType.INFO, "Teleport will come in 10 Seconds!");
msgmgr.sendMessage(r.getRequesting(), MessageType.INFO, "Teleport will come in 10 Seconds!");
dlmgr.createDuell(r.getRequesting(), r.getRequested());
dlmgr.startDuell(dlmgr.getDuell(r.getRequesting()));
requests.remove(r);
}
public void denyRequest(Request r){
msgmgr.sendMessage(r.getRequested(), MessageType.INFO, "You denied the Duell request against " + r.getRequesting().getName());
msgmgr.sendMessage(r.getRequesting(), MessageType.INFO, r.getRequested().getName() + "denied the Duell request from you!");
requests.remove(r);
}
}
|
UTF-8
|
Java
| 2,867 |
java
|
RequestManager.java
|
Java
|
[] | null |
[] |
package de.manimax3.Request;
import java.util.ArrayList;
import org.bukkit.entity.Player;
import de.manimax3.duell.DuellManager;
import de.manimax3.main.ConfigManager;
import de.manimax3.main.MessageManager;
import de.manimax3.main.MessageManager.MessageType;
public class RequestManager {
private static RequestManager instance = new RequestManager();
public static RequestManager getInstance(){
return instance;
}
private MessageManager msgmgr = MessageManager.getInstance();
private DuellManager dlmgr = DuellManager.getInstance();
private ConfigManager cfgmgr = ConfigManager.getInstance();
private boolean global;
public ArrayList<Request> requests = new ArrayList<Request>();
public void createRequest(Player requesting, Player requested){
if(!(cfgmgr.get("Duellglobal." + requested.getName()) == null)){
if(cfgmgr.get("Duellglobal." + requested.getName()) == "false"){
msgmgr.sendMessage(requesting, MessageType.INFO, requested.getName() + " is suppressing Duell requests!");
return;
}
}
Request r = new Request(requesting, requested);
requests.add(r);
this.doRequests(r);
}
public boolean hasRequest(Player p){
for(Request r : requests){
if(p.equals(r.getRequested())) return true;
}
return false;
}
private void doRequests(Request r){
msgmgr.sendMessage(r.getRequested(), MessageType.INFO, "The Player " + r.getRequesting().getName() + " wants a Duell againsts you! Use /duell accept or deny");
msgmgr.sendMessage(r.getRequesting(), MessageType.INFO, "The Request got send to Player " + r.getRequested().getName());
}
public Request getRequest(Player p){
for(Request r : requests){
if(p.equals(r.getRequested()) || p.equals(r.getRequesting())) return r;
}
return null;
}
public void removeRequest(Request r){
requests.remove(r);
return;
}
public void acceptRequest(Request r){
msgmgr.sendMessage(r.getRequested(), MessageType.GOOD, "You have accepted the Duell against " + r.getRequesting().getName() + " !");
msgmgr.sendMessage(r.getRequesting(), MessageType.GOOD, "Player " + r.getRequested() + " has accepted the Duell against you!");
msgmgr.sendMessage(r.getRequested(), MessageType.INFO, "Teleport will come in 10 Seconds!");
msgmgr.sendMessage(r.getRequesting(), MessageType.INFO, "Teleport will come in 10 Seconds!");
dlmgr.createDuell(r.getRequesting(), r.getRequested());
dlmgr.startDuell(dlmgr.getDuell(r.getRequesting()));
requests.remove(r);
}
public void denyRequest(Request r){
msgmgr.sendMessage(r.getRequested(), MessageType.INFO, "You denied the Duell request against " + r.getRequesting().getName());
msgmgr.sendMessage(r.getRequesting(), MessageType.INFO, r.getRequested().getName() + "denied the Duell request from you!");
requests.remove(r);
}
}
| 2,867 | 0.714684 | 0.711545 | 74 | 36.743244 | 38.753223 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.22973 | false | false |
13
|
d9857297a166f37e2ac2e9f34bde0183a6dc095c
| 9,964,324,163,883 |
c7449e6cb5ce0711e6432dba5e14e8f1b8eb9708
|
/src/seleniumProject/BrowserMethod.java
|
0ba78156ab4b21ff5745dba8e8d1aae096dde709
|
[] |
no_license
|
bhawnajha80/JavaAndSeleniumCode
|
https://github.com/bhawnajha80/JavaAndSeleniumCode
|
c12b32db43a6214bd450744902142eb248f059b6
|
78d802990587c79a17dae8dd88306844b74ffe54
|
refs/heads/master
| 2022-10-03T18:59:04.267000 | 2020-06-07T02:19:06 | 2020-06-07T02:19:06 | 270,165,738 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package seleniumProject;
public class BrowserMethod extends Configuration {
public static void main(String[] args) {
// TODO Auto-generated method stub
BrowserMethod.Initialsetup();
driver.get("http://newtours.demoaut.com/");
String title = driver.getTitle();
System.out.println(title);
if (title.contains("Tours"))
{
System.out.println("Title is correct");
}
String url = driver.getCurrentUrl();
System.out.println(url);
if(url.contains("tour"))
{
System.out.println("url is correct");
}
driver.navigate().to("https://www.selenium.dev/downloads/");
driver.navigate().back();
//Thread.sleep(2000);
driver.navigate().refresh();
driver.navigate().forward();
driver.navigate().refresh();
}
}
|
UTF-8
|
Java
| 742 |
java
|
BrowserMethod.java
|
Java
|
[] | null |
[] |
package seleniumProject;
public class BrowserMethod extends Configuration {
public static void main(String[] args) {
// TODO Auto-generated method stub
BrowserMethod.Initialsetup();
driver.get("http://newtours.demoaut.com/");
String title = driver.getTitle();
System.out.println(title);
if (title.contains("Tours"))
{
System.out.println("Title is correct");
}
String url = driver.getCurrentUrl();
System.out.println(url);
if(url.contains("tour"))
{
System.out.println("url is correct");
}
driver.navigate().to("https://www.selenium.dev/downloads/");
driver.navigate().back();
//Thread.sleep(2000);
driver.navigate().refresh();
driver.navigate().forward();
driver.navigate().refresh();
}
}
| 742 | 0.683288 | 0.677898 | 47 | 14.787234 | 17.517088 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.595745 | false | false |
13
|
0e738d1a98ed7346076a9a2c94ed97354ae51a35
| 2,310,692,471,731 |
f0607321032c4ccde9a782604b140e654e778282
|
/src/main/java/by/cs/web/bean/ServerController.java
|
063e69f4680514d73667c76618bd38aad77009df
|
[] |
no_license
|
DYefremov/SurfaceInspector
|
https://github.com/DYefremov/SurfaceInspector
|
f96cf23ae032d22e52d4abbf7451e9173cdb6b42
|
076a04bae6850743e641800f6343143ed8935335
|
refs/heads/master
| 2021-01-20T00:04:44.155000 | 2017-07-06T15:26:48 | 2017-07-06T15:26:48 | 89,074,150 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package by.cs.web.bean;
import by.cs.Constants;
import by.cs.web.StandaloneServer;
import org.primefaces.context.RequestContext;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import java.io.Serializable;
/**
* @author Dmitriy V.Yefremov
*/
@ManagedBean
@ApplicationScoped
public class ServerController implements Serializable {
public ServerController() {
}
/**
* Starts service from client
*/
public void startService() {
}
/**
* Stops service from client
*/
public void stopService() {
ServletContext ctx = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
StandaloneServer server = (StandaloneServer) ctx.getAttribute(Constants.SERVER_REFERENCE);
server.stopServer();
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_WARN, "Server shutdown!", "OK!");
RequestContext.getCurrentInstance().showMessageInDialog(message);
}
}
|
UTF-8
|
Java
| 1,133 |
java
|
ServerController.java
|
Java
|
[
{
"context": "text;\nimport java.io.Serializable;\n\n/**\n * @author Dmitriy V.Yefremov\n */\n@ManagedBean\n@ApplicationScoped\npublic class ",
"end": 397,
"score": 0.9998618960380554,
"start": 379,
"tag": "NAME",
"value": "Dmitriy V.Yefremov"
}
] | null |
[] |
package by.cs.web.bean;
import by.cs.Constants;
import by.cs.web.StandaloneServer;
import org.primefaces.context.RequestContext;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import java.io.Serializable;
/**
* @author <NAME>
*/
@ManagedBean
@ApplicationScoped
public class ServerController implements Serializable {
public ServerController() {
}
/**
* Starts service from client
*/
public void startService() {
}
/**
* Stops service from client
*/
public void stopService() {
ServletContext ctx = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
StandaloneServer server = (StandaloneServer) ctx.getAttribute(Constants.SERVER_REFERENCE);
server.stopServer();
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_WARN, "Server shutdown!", "OK!");
RequestContext.getCurrentInstance().showMessageInDialog(message);
}
}
| 1,121 | 0.729921 | 0.729921 | 43 | 25.348837 | 28.238916 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.395349 | false | false |
13
|
7c2470c61bc7c897699530e2355c67cb807fe65f
| 21,835,613,768,546 |
c85a08478ccf0d6ad5ab22a178bfb144521a27b0
|
/util/src/main/java/br/com/edenred/util/gradle/Flavors.java
|
44930256a46046cbbe6411314ceaba55874969b4
|
[
"Apache-2.0"
] |
permissive
|
edenredbrazil/android-mvp-project-setup
|
https://github.com/edenredbrazil/android-mvp-project-setup
|
43e66721b4d567c3c03ebd96112d71e85fffdb2a
|
c8ed8a6334a8ab12dc29711d79f525c89bbc7902
|
refs/heads/master
| 2021-01-21T20:16:53.773000 | 2017-05-23T22:17:10 | 2017-05-23T22:17:10 | 92,214,130 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.com.edenred.util.gradle;
import br.com.edenred.util.R;
import br.com.edenred.util.view.ResourceUtil;
/**
* Created by Edenred Mobile Team
* @author rodrigosimoesrosa
* rodrigo.rosa@consulting-for.edenred.com on 07/03/2016.
*/
public enum Flavors {
MOCKUPAPI(ResourceUtil.getString(R.string.mockupapi)),
MOCKUP(ResourceUtil.getString(R.string.mockup)),
HOMOLOG(ResourceUtil.getString(R.string.homolog)),
QA(ResourceUtil.getString(R.string.qa)),
DEVELOPMENT(ResourceUtil.getString(R.string.development)),
PRODUCTION(ResourceUtil.getString(R.string.production)),
ACCEPTANCE(ResourceUtil.getString(R.string.acceptance));
private String value;
Flavors(String v){
this.value = v;
}
@Override
public String toString() {
return value;
}
}
|
UTF-8
|
Java
| 818 |
java
|
Flavors.java
|
Java
|
[
{
"context": "\n\n/**\n * Created by Edenred Mobile Team\n * @author rodrigosimoesrosa\n * rodrigo.rosa@consulting-for.edenred.com on 07/",
"end": 180,
"score": 0.9638187885284424,
"start": 163,
"tag": "USERNAME",
"value": "rodrigosimoesrosa"
},
{
"context": "denred Mobile Team\n * @author rodrigosimoesrosa\n * rodrigo.rosa@consulting-for.edenred.com on 07/03/2016.\n */\npublic enum Flavors {\n MOCK",
"end": 223,
"score": 0.9999274015426636,
"start": 184,
"tag": "EMAIL",
"value": "rodrigo.rosa@consulting-for.edenred.com"
}
] | null |
[] |
package br.com.edenred.util.gradle;
import br.com.edenred.util.R;
import br.com.edenred.util.view.ResourceUtil;
/**
* Created by Edenred Mobile Team
* @author rodrigosimoesrosa
* <EMAIL> on 07/03/2016.
*/
public enum Flavors {
MOCKUPAPI(ResourceUtil.getString(R.string.mockupapi)),
MOCKUP(ResourceUtil.getString(R.string.mockup)),
HOMOLOG(ResourceUtil.getString(R.string.homolog)),
QA(ResourceUtil.getString(R.string.qa)),
DEVELOPMENT(ResourceUtil.getString(R.string.development)),
PRODUCTION(ResourceUtil.getString(R.string.production)),
ACCEPTANCE(ResourceUtil.getString(R.string.acceptance));
private String value;
Flavors(String v){
this.value = v;
}
@Override
public String toString() {
return value;
}
}
| 786 | 0.717604 | 0.707824 | 30 | 26.299999 | 21.66741 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.433333 | false | false |
13
|
f3aad2b8578e59ac092d0f086e97e5eb99b6e01d
| 5,308,579,591,422 |
26f77dc74b742811927bbdef7143f745055e593e
|
/aula_15_02_2019/src/servlet/SimplesServlet.java
|
85147ae1a7fff24619c22f640f189ded22a70ef0
|
[] |
no_license
|
Lucaswendell/aulas-paulo-petrola-lab-software
|
https://github.com/Lucaswendell/aulas-paulo-petrola-lab-software
|
dd4f6c509459fc4ae51409912d7d22f28183aeee
|
d69408492a75a1ceb5b0c7624790c566cf36e24c
|
refs/heads/master
| 2020-04-24T00:32:23.921000 | 2019-02-20T00:55:28 | 2019-02-20T00:55:28 | 171,569,498 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package servlet;
import javax.servlet.*;
import java.io.*;
public class SimplesServlet extends GenericServlet{
//inicialização a servlet e suas configurações
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
//service -> será chamado a cada nova requisição do usuario
//request -> traz dados que podem ter sido enviados pelo usuario
//reponse -> devolve dados processados
@Override
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
//obtem o stream de resposta
PrintWriter out = response.getWriter();
out.print("Bem vindo ao servlet!");
}
}
|
UTF-8
|
Java
| 666 |
java
|
SimplesServlet.java
|
Java
|
[] | null |
[] |
package servlet;
import javax.servlet.*;
import java.io.*;
public class SimplesServlet extends GenericServlet{
//inicialização a servlet e suas configurações
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
//service -> será chamado a cada nova requisição do usuario
//request -> traz dados que podem ter sido enviados pelo usuario
//reponse -> devolve dados processados
@Override
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
//obtem o stream de resposta
PrintWriter out = response.getWriter();
out.print("Bem vindo ao servlet!");
}
}
| 666 | 0.766313 | 0.766313 | 21 | 30.428572 | 28.114683 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.285714 | false | false |
10
|
bbb0cce0434d744b123c91dc47e9b764d53cc3d3
| 6,519,760,364,839 |
4bfd1a95a43dd5b2202ddfc5eba5a1545b396147
|
/Code Specific applications/Old Code/ExtractDGFasta/src/ExtractSignalPdata.java
|
32362b9e990031cdd99e75558b35dda132e3f798
|
[] |
no_license
|
PatrikBjorkholm/MOPRO2
|
https://github.com/PatrikBjorkholm/MOPRO2
|
be8474c4b6eacf634257ba4aee84954ef8a5397e
|
468466e409dc2874ae6fcd515e70534a63952979
|
refs/heads/master
| 2021-07-13T04:48:00.763000 | 2017-10-09T20:21:28 | 2017-10-09T20:21:28 | 103,980,591 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class ExtractSignalPdata {
public int [] ExtractPositionInSignalP (String Data[])
{
int SignalPposition [] = new int[Data.length-1];
int positions = 0;
for(int a = 0; a < Data[0].length();a++)
{
if(Data[0].charAt(a) == '?')
{
positions = a;
}
}
System.out.println(positions);
for(int a = 1; a < Data.length;a++)
{
char TempChar = ' ';
for(int b = 30; b< Data[a].length();b++)
{
if( Data[a].charAt(b) == 'N')
{
TempChar = 'N';
break;
}
else if(Data[a].charAt(b) == 'Y')
{
TempChar = 'Y';
break;
}
}
// char TempChar = Data[a].charAt(Data[a].charAt(74));//Data[a].length()-1));
String TempString = Data[a].substring(34,36); //((Data[a].length()-15), (Data[a].length()-13));
TempString = TempString.replaceAll(" ","");
// System.out.println(TempChar + "\t" + TempString);
if(TempChar == 'N')
{
SignalPposition[a-1] = 0;
}
else if(TempChar == 'Y')
{
SignalPposition[a-1] = Integer.parseInt(TempString);
}
}
return SignalPposition;
}
}
|
UTF-8
|
Java
| 1,102 |
java
|
ExtractSignalPdata.java
|
Java
|
[] | null |
[] |
public class ExtractSignalPdata {
public int [] ExtractPositionInSignalP (String Data[])
{
int SignalPposition [] = new int[Data.length-1];
int positions = 0;
for(int a = 0; a < Data[0].length();a++)
{
if(Data[0].charAt(a) == '?')
{
positions = a;
}
}
System.out.println(positions);
for(int a = 1; a < Data.length;a++)
{
char TempChar = ' ';
for(int b = 30; b< Data[a].length();b++)
{
if( Data[a].charAt(b) == 'N')
{
TempChar = 'N';
break;
}
else if(Data[a].charAt(b) == 'Y')
{
TempChar = 'Y';
break;
}
}
// char TempChar = Data[a].charAt(Data[a].charAt(74));//Data[a].length()-1));
String TempString = Data[a].substring(34,36); //((Data[a].length()-15), (Data[a].length()-13));
TempString = TempString.replaceAll(" ","");
// System.out.println(TempChar + "\t" + TempString);
if(TempChar == 'N')
{
SignalPposition[a-1] = 0;
}
else if(TempChar == 'Y')
{
SignalPposition[a-1] = Integer.parseInt(TempString);
}
}
return SignalPposition;
}
}
| 1,102 | 0.53176 | 0.511797 | 56 | 18.660715 | 21.4886 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.232143 | false | false |
10
|
00688595aeebc119996ff5d7918bccaa135b7b20
| 5,239,860,120,262 |
4a1b8cdc97f6ed871a931ef03514f4a0a94d08f1
|
/app/src/main/java/com/chen/soft/activity/LawDetail.java
|
6e08bbdff53d389efc1fd728ce27f2c1e414efb1
|
[] |
no_license
|
Brucechen13/LawGroup
|
https://github.com/Brucechen13/LawGroup
|
14914cbcfb3dde18100df5049fb510c87b866776
|
a68ca4e965e0503c49b3b34afdaf6d95fa068f34
|
refs/heads/master
| 2016-09-01T04:13:51.679000 | 2016-02-29T00:07:05 | 2016-02-29T00:07:05 | 43,602,044 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.chen.soft.activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView;
import android.widget.Toast;
import com.chen.soft.R;
import com.chen.soft.adapt.LawBean;
import java.io.InputStream;
import java.net.URLEncoder;
/**
* Created by chenchi_94 on 2015/10/3.
*/
public class LawDetail extends TitleActivity implements View.OnClickListener {
private LawBean law;
private TextView lawText;
private WebView webView;
private String html;
@Override
protected void onBackward(View backwardView) {
// TODO Auto-generated method stub
super.onBackward(backwardView);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initView();
}
private void initView() {
law = (LawBean) getIntent().getParcelableExtra("law");
setContentView(R.layout.activity_law);
setTitle(law.getHanzi());
showBackwardView(R.string.button_backward, true);
lawText = (TextView)findViewById(R.id.lawText);
webView = (WebView)findViewById(R.id.webView);
webView.getSettings().setDefaultTextEncodingName("utf-8");
// 设置可以支持缩放
webView.getSettings().setSupportZoom(true);
// 设置出现缩放工具
webView.getSettings().setBuiltInZoomControls(true);
//扩大比例的缩放
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
webView.getSettings().setLoadWithOverviewMode(true);
new GetNewsTask().execute();
}
private void loadData(){
// String htm = "<html>\n" +
// "<head>\n" +
// "</head>\n" +
// "<body>\n" +
// "wuliu\n" +
// "</body>\n" +
// "</html>";
//webView.loadData(htm, "text/html; charset=UTF-8", null);//loadDataWithBaseURL
try {
//webView.loadData(html, "text/html", "gbk");
webView.loadDataWithBaseURL(null,html, "text/html", "UTF-8", null);
}catch (Exception e){
Log.d("info", e.toString() + "load web error");
}
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stubv
super.onClick(v);
}
class GetNewsTask extends AsyncTask<String, Void, Integer> {
@Override
protected Integer doInBackground(String... params) {
try {
String path = "laws/"+ law.getRoot() + "/" + law.getPinyin();
Log.d("info", path);
InputStream is = getResources().getAssets().open(path);
byte[] buff = new byte[is.available()];
is.read(buff);
html = new String(buff, "gbk");
return -1;
}catch (Exception e){
Log.d("info", e.toString());
return 0;
}
}
@Override
protected void onPostExecute(Integer result) {
super.onPostExecute(result);
Log.d("info", result.toString());
switch (result) {
case -1:
Log.d("info","showLaws");
loadData();
break;
case 0:
Toast.makeText(LawDetail.this, "搜索出错", Toast.LENGTH_SHORT)
.show();
break;
}
}
}
}
|
UTF-8
|
Java
| 3,695 |
java
|
LawDetail.java
|
Java
|
[
{
"context": "am;\nimport java.net.URLEncoder;\n\n/**\n * Created by chenchi_94 on 2015/10/3.\n */\npublic class LawDetail extends",
"end": 412,
"score": 0.999583899974823,
"start": 402,
"tag": "USERNAME",
"value": "chenchi_94"
}
] | null |
[] |
package com.chen.soft.activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView;
import android.widget.Toast;
import com.chen.soft.R;
import com.chen.soft.adapt.LawBean;
import java.io.InputStream;
import java.net.URLEncoder;
/**
* Created by chenchi_94 on 2015/10/3.
*/
public class LawDetail extends TitleActivity implements View.OnClickListener {
private LawBean law;
private TextView lawText;
private WebView webView;
private String html;
@Override
protected void onBackward(View backwardView) {
// TODO Auto-generated method stub
super.onBackward(backwardView);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initView();
}
private void initView() {
law = (LawBean) getIntent().getParcelableExtra("law");
setContentView(R.layout.activity_law);
setTitle(law.getHanzi());
showBackwardView(R.string.button_backward, true);
lawText = (TextView)findViewById(R.id.lawText);
webView = (WebView)findViewById(R.id.webView);
webView.getSettings().setDefaultTextEncodingName("utf-8");
// 设置可以支持缩放
webView.getSettings().setSupportZoom(true);
// 设置出现缩放工具
webView.getSettings().setBuiltInZoomControls(true);
//扩大比例的缩放
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
webView.getSettings().setLoadWithOverviewMode(true);
new GetNewsTask().execute();
}
private void loadData(){
// String htm = "<html>\n" +
// "<head>\n" +
// "</head>\n" +
// "<body>\n" +
// "wuliu\n" +
// "</body>\n" +
// "</html>";
//webView.loadData(htm, "text/html; charset=UTF-8", null);//loadDataWithBaseURL
try {
//webView.loadData(html, "text/html", "gbk");
webView.loadDataWithBaseURL(null,html, "text/html", "UTF-8", null);
}catch (Exception e){
Log.d("info", e.toString() + "load web error");
}
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stubv
super.onClick(v);
}
class GetNewsTask extends AsyncTask<String, Void, Integer> {
@Override
protected Integer doInBackground(String... params) {
try {
String path = "laws/"+ law.getRoot() + "/" + law.getPinyin();
Log.d("info", path);
InputStream is = getResources().getAssets().open(path);
byte[] buff = new byte[is.available()];
is.read(buff);
html = new String(buff, "gbk");
return -1;
}catch (Exception e){
Log.d("info", e.toString());
return 0;
}
}
@Override
protected void onPostExecute(Integer result) {
super.onPostExecute(result);
Log.d("info", result.toString());
switch (result) {
case -1:
Log.d("info","showLaws");
loadData();
break;
case 0:
Toast.makeText(LawDetail.this, "搜索出错", Toast.LENGTH_SHORT)
.show();
break;
}
}
}
}
| 3,695 | 0.562208 | 0.557814 | 121 | 29.099174 | 22.240759 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.619835 | false | false |
10
|
8f94726465ce205b3f8c91898ddce31634b61083
| 15,779,709,872,258 |
4152b9f20932a13fa27535fbe0c8455cea269bd0
|
/jstarcraft-ai-weka/src/main/java/weka/core/EnumHelper.java
|
051d0f9736fd306eae99757c3d7e1549ab666346
|
[
"Apache-2.0",
"GPL-3.0-or-later"
] |
permissive
|
kingrom/jstarcraft-ai
|
https://github.com/kingrom/jstarcraft-ai
|
ab7843bd6c09503bf9156aabbf07386577ddff63
|
5029228e27efa3dd934d431cd8dd90e786b760a7
|
refs/heads/master
| 2020-08-01T21:28:42.582000 | 2019-09-23T09:58:54 | 2019-09-23T09:58:54 | 208,401,831 | 1 | 0 |
Apache-2.0
| true | 2019-09-14T06:54:48 | 2019-09-14T06:54:45 | 2019-09-14T04:31:01 | 2019-09-14T04:30:59 | 16,742 | 0 | 0 | 0 | null | false | false |
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* EnumHelper.java
* Copyright (C) 2015 University of Waikato, Hamilton, New Zealand
*
*/
package weka.core;
import java.lang.reflect.Method;
/**
* Helper/wrapper class for obtaining an arbitrary enum value from an arbitrary
* enum type. An enum value wrapped in this class can be serialized by Weka's
* XML serialization mechanism.
*
* @author Mark Hall (mhall{[at]}pentaho{[dot]}com)
* @version $Revision: $
*/
public class EnumHelper {
/**
* The fully qualified name of the enum class to wrap
*/
protected String m_enumClass;
/**
* The selected/wapped enum value (as obtained by calling toString() on the
* value)
*/
protected String m_selectedEnumValue;
/**
* Constructor
*
* @param e the enum value to wrap
*/
public EnumHelper(Enum e) {
m_selectedEnumValue = e.toString();
m_enumClass = e.getClass().getName();
}
/**
* No-op constructor (for beans conformity)
*/
public EnumHelper() {
}
/**
* Set the fully qualified enum class name
*
* @param enumClass the fully qualified name of the enum class
*/
public void setEnumClass(String enumClass) {
m_enumClass = enumClass;
}
/**
* Get the fully qualified enum class name
*
* @return the fully qualified name of the enum class
*/
public String getEnumClass() {
return m_enumClass;
}
/**
* Set the selected/wrapped enum value (as obtained by calling toString() on the
* enum value)
*
* @param selectedEnumValue the enum value to wrap
*/
public void setSelectedEnumValue(String selectedEnumValue) {
m_selectedEnumValue = selectedEnumValue;
}
/**
* Get the selected/wrapped enum value (as obtained by calling toString() on the
* enum value)
*
* @return the enum value to wrap
*/
public String getSelectedEnumValue() {
return m_selectedEnumValue;
}
/**
* Helper method to recover an enum value given the fully qualified name of the
* enum and the value in question as strings
*
* @param enumClass a string containing the fully qualified name of the enum
* class
* @param enumValue a string containing the value of the enum to find
* @return the enum value as an Object
* @throws Exception if a problem occurs
*/
public static Object valueFromString(String enumClass, String enumValue) throws Exception {
Class<?> eClazz = WekaPackageClassLoaderManager.forName(enumClass);
return valueFromString(eClazz, enumValue);
}
/**
* Helper method to recover an enum value given the fully qualified name of the
* enum and the value in question as strings
*
* @param enumClass the class of the enum
* @param enumValue a string containing the value of the enum to find
* @return the enum value as an Object
* @throws Exception if a problem occurs
*/
public static Object valueFromString(Class<?> enumClass, String enumValue) throws Exception {
Method valuesM = enumClass.getMethod("values");
Enum[] values = (Enum[]) valuesM.invoke(null);
for (Enum e : values) {
if (e.toString().equals(enumValue)) {
return e;
}
}
return null;
}
/**
* Main method for testing this class
*
* @param args arguments
*/
public static void main(String[] args) {
try {
if (args.length != 2) {
System.err.println("usage: weka.core.EnumHelper <enum class> <enum value>");
}
Object eVal = EnumHelper.valueFromString(args[0], args[1]);
System.out.println("The enum's value is: " + eVal.toString());
System.out.println("The enum's class is: " + eVal.getClass().toString());
if (eVal instanceof Enum) {
System.out.println("The value is an instance of Enum superclass");
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 4,830 |
java
|
EnumHelper.java
|
Java
|
[
{
"context": "ka's\n * XML serialization mechanism.\n *\n * @author Mark Hall (mhall{[at]}pentaho{[dot]}com)\n * @version $Revis",
"end": 1048,
"score": 0.9992102384567261,
"start": 1039,
"tag": "NAME",
"value": "Mark Hall"
}
] | null |
[] |
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* EnumHelper.java
* Copyright (C) 2015 University of Waikato, Hamilton, New Zealand
*
*/
package weka.core;
import java.lang.reflect.Method;
/**
* Helper/wrapper class for obtaining an arbitrary enum value from an arbitrary
* enum type. An enum value wrapped in this class can be serialized by Weka's
* XML serialization mechanism.
*
* @author <NAME> (mhall{[at]}pentaho{[dot]}com)
* @version $Revision: $
*/
public class EnumHelper {
/**
* The fully qualified name of the enum class to wrap
*/
protected String m_enumClass;
/**
* The selected/wapped enum value (as obtained by calling toString() on the
* value)
*/
protected String m_selectedEnumValue;
/**
* Constructor
*
* @param e the enum value to wrap
*/
public EnumHelper(Enum e) {
m_selectedEnumValue = e.toString();
m_enumClass = e.getClass().getName();
}
/**
* No-op constructor (for beans conformity)
*/
public EnumHelper() {
}
/**
* Set the fully qualified enum class name
*
* @param enumClass the fully qualified name of the enum class
*/
public void setEnumClass(String enumClass) {
m_enumClass = enumClass;
}
/**
* Get the fully qualified enum class name
*
* @return the fully qualified name of the enum class
*/
public String getEnumClass() {
return m_enumClass;
}
/**
* Set the selected/wrapped enum value (as obtained by calling toString() on the
* enum value)
*
* @param selectedEnumValue the enum value to wrap
*/
public void setSelectedEnumValue(String selectedEnumValue) {
m_selectedEnumValue = selectedEnumValue;
}
/**
* Get the selected/wrapped enum value (as obtained by calling toString() on the
* enum value)
*
* @return the enum value to wrap
*/
public String getSelectedEnumValue() {
return m_selectedEnumValue;
}
/**
* Helper method to recover an enum value given the fully qualified name of the
* enum and the value in question as strings
*
* @param enumClass a string containing the fully qualified name of the enum
* class
* @param enumValue a string containing the value of the enum to find
* @return the enum value as an Object
* @throws Exception if a problem occurs
*/
public static Object valueFromString(String enumClass, String enumValue) throws Exception {
Class<?> eClazz = WekaPackageClassLoaderManager.forName(enumClass);
return valueFromString(eClazz, enumValue);
}
/**
* Helper method to recover an enum value given the fully qualified name of the
* enum and the value in question as strings
*
* @param enumClass the class of the enum
* @param enumValue a string containing the value of the enum to find
* @return the enum value as an Object
* @throws Exception if a problem occurs
*/
public static Object valueFromString(Class<?> enumClass, String enumValue) throws Exception {
Method valuesM = enumClass.getMethod("values");
Enum[] values = (Enum[]) valuesM.invoke(null);
for (Enum e : values) {
if (e.toString().equals(enumValue)) {
return e;
}
}
return null;
}
/**
* Main method for testing this class
*
* @param args arguments
*/
public static void main(String[] args) {
try {
if (args.length != 2) {
System.err.println("usage: weka.core.EnumHelper <enum class> <enum value>");
}
Object eVal = EnumHelper.valueFromString(args[0], args[1]);
System.out.println("The enum's value is: " + eVal.toString());
System.out.println("The enum's class is: " + eVal.getClass().toString());
if (eVal instanceof Enum) {
System.out.println("The value is an instance of Enum superclass");
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
| 4,827 | 0.624638 | 0.622981 | 160 | 29.1875 | 27.974136 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.20625 | false | false |
10
|
e00505a4344125ca14aabbd4b8f8da06ec0c6229
| 2,705,829,433,629 |
075f2b8d4023227545a41adb9a1d316b9c96ce53
|
/src/main/java/wrappers/UltraSonic.java
|
87fd9ee6b1b7dd8dddc446cf780edddf231514cb
|
[] |
no_license
|
Patribots4738/InfiniteRecharge2020
|
https://github.com/Patribots4738/InfiniteRecharge2020
|
fabf2cf4bca4a12c4e75d1e1dd0244f6bff696e6
|
2330247cf113e3a1fa98c4e938e8a743819dab55
|
refs/heads/master
| 2022-11-11T14:54:28.917000 | 2020-01-07T23:44:48 | 2020-01-07T23:44:48 | 231,835,565 | 1 | 1 | null | false | 2020-01-07T23:44:50 | 2020-01-04T22:11:10 | 2020-01-04T22:22:30 | 2020-01-07T23:44:49 | 0 | 0 | 0 | 0 | null | false | false |
package wrappers;
public class UltraSonic{
edu.wpi.first.wpilibj.AnalogInput PWMInput;
public UltraSonic(int port) {
PWMInput = new edu.wpi.first.wpilibj.AnalogInput(port);
}
public double getRaw() {
return PWMInput.getAverageVoltage();
}
public String getDistance() {
double sonicVolts = PWMInput.getAverageVoltage();
sonicVolts = 0.825 + (1.43 * sonicVolts) + (1.63 * sonicVolts * sonicVolts) - (0.28 * sonicVolts * sonicVolts * sonicVolts);
//0.716 + 2.1 * (sonicVolts) + 1.25 * (sonicVolts * sonicVolts) - 0.224 * (sonicVolts * sonicVolts * sonicVolts);
int feet = (int) sonicVolts;
double decimal = sonicVolts - feet;
decimal = decimal * 12;
int inches = (int) decimal;
String feetString = Integer.toString(feet);
String inchesString = Integer.toString(inches);
return "feet: " + feetString + ", inches: " + inchesString;
}
}
|
UTF-8
|
Java
| 968 |
java
|
UltraSonic.java
|
Java
|
[] | null |
[] |
package wrappers;
public class UltraSonic{
edu.wpi.first.wpilibj.AnalogInput PWMInput;
public UltraSonic(int port) {
PWMInput = new edu.wpi.first.wpilibj.AnalogInput(port);
}
public double getRaw() {
return PWMInput.getAverageVoltage();
}
public String getDistance() {
double sonicVolts = PWMInput.getAverageVoltage();
sonicVolts = 0.825 + (1.43 * sonicVolts) + (1.63 * sonicVolts * sonicVolts) - (0.28 * sonicVolts * sonicVolts * sonicVolts);
//0.716 + 2.1 * (sonicVolts) + 1.25 * (sonicVolts * sonicVolts) - 0.224 * (sonicVolts * sonicVolts * sonicVolts);
int feet = (int) sonicVolts;
double decimal = sonicVolts - feet;
decimal = decimal * 12;
int inches = (int) decimal;
String feetString = Integer.toString(feet);
String inchesString = Integer.toString(inches);
return "feet: " + feetString + ", inches: " + inchesString;
}
}
| 968 | 0.622934 | 0.594008 | 36 | 25.916666 | 32.743427 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false |
10
|
f546fac9873d546e72d4c66d703f04d516bb195f
| 23,441,931,524,972 |
c03f2a75c0ac6f010fd4e8764467327d5bd0db04
|
/src/main/java/com/jobness/webmvc/util/RespUtil.java
|
919b83bb07da9627a413c869ff27b16b562dee81
|
[
"MIT"
] |
permissive
|
pushyzheng/schla-webmvc
|
https://github.com/pushyzheng/schla-webmvc
|
8d945bc7dcc73fef9e915e76aed02a451bbb70f8
|
8cd2edba5785765fbc738b66826ee3ea42d5be60
|
refs/heads/master
| 2020-04-28T00:12:39.493000 | 2019-03-10T09:37:35 | 2019-03-10T09:37:35 | 174,807,414 | 3 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jobness.webmvc.util;
import com.alibaba.fastjson.JSON;
import com.jobness.webmvc.pojo.BaseResponse;
import io.netty.handler.codec.http.HttpResponseStatus;
/**
* @author Pushy
* @since 2019/3/6 13:13
*/
public class RespUtil {
public static <T> String success(T data) {
BaseResponse<T> response = new BaseResponse<>(data, "", HttpResponseStatus.OK.code());
return JSON.toJSONString(response);
}
public static String error(HttpResponseStatus status, String message) {
return error(status.code(), message);
}
public static String error(int code, String message) {
BaseResponse<String> response = new BaseResponse<>("", message, code);
return JSON.toJSONString(response);
}
}
|
UTF-8
|
Java
| 757 |
java
|
RespUtil.java
|
Java
|
[
{
"context": "ler.codec.http.HttpResponseStatus;\n\n/**\n * @author Pushy\n * @since 2019/3/6 13:13\n */\npublic class RespUti",
"end": 189,
"score": 0.8966968059539795,
"start": 184,
"tag": "NAME",
"value": "Pushy"
}
] | null |
[] |
package com.jobness.webmvc.util;
import com.alibaba.fastjson.JSON;
import com.jobness.webmvc.pojo.BaseResponse;
import io.netty.handler.codec.http.HttpResponseStatus;
/**
* @author Pushy
* @since 2019/3/6 13:13
*/
public class RespUtil {
public static <T> String success(T data) {
BaseResponse<T> response = new BaseResponse<>(data, "", HttpResponseStatus.OK.code());
return JSON.toJSONString(response);
}
public static String error(HttpResponseStatus status, String message) {
return error(status.code(), message);
}
public static String error(int code, String message) {
BaseResponse<String> response = new BaseResponse<>("", message, code);
return JSON.toJSONString(response);
}
}
| 757 | 0.690885 | 0.677675 | 27 | 27.037037 | 27.508223 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.592593 | false | false |
10
|
23b175dadf7e69d90558048467306a0c24b4aa55
| 7,662,221,683,823 |
b2b338812cce70c719346d8c8181879c53c2d8ef
|
/app/src/main/java/com/yirugao/dec1606_littlemermaid/SettingActivity.java
|
cd6f6b08dd570542dc4b9cd3868d1ead3db5df16
|
[] |
no_license
|
jerroldgao/DEC1606_LittleMermaid
|
https://github.com/jerroldgao/DEC1606_LittleMermaid
|
2d7d6239ebb89e212d8e8f7d851b3826c898867e
|
e635db3d165a9d074ca700193355b7a30c33f355
|
refs/heads/master
| 2021-01-10T09:01:55.022000 | 2016-12-07T03:48:10 | 2016-12-07T03:48:10 | 55,727,448 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.yirugao.dec1606_littlemermaid;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
public class SettingActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// app icon in action bar clicked; goto parent activity.
this.finish();
return true;
default:
// If we got here, the user's action was not recognized.
// Invoke the superclass to handle it.
return super.onOptionsItemSelected(item);
}
}
}
|
UTF-8
|
Java
| 964 |
java
|
SettingActivity.java
|
Java
|
[] | null |
[] |
package com.yirugao.dec1606_littlemermaid;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
public class SettingActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// app icon in action bar clicked; goto parent activity.
this.finish();
return true;
default:
// If we got here, the user's action was not recognized.
// Invoke the superclass to handle it.
return super.onOptionsItemSelected(item);
}
}
}
| 964 | 0.651452 | 0.646266 | 30 | 31.133333 | 23.407597 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.433333 | false | false |
10
|
0ea08550e5eed7c3ea9ac462b1891115f9d06c90
| 11,055,245,849,143 |
f78c18dbda7823e2ec6791ffd54970265aaf43c4
|
/web-service/src/main/java/com/mypack/spring/rest/controller/HelloController.java
|
e23acbb6391dce171e2719e780d0ce95beec4ae3
|
[] |
no_license
|
ik21191/spring-boot-rest-react-app
|
https://github.com/ik21191/spring-boot-rest-react-app
|
dfb990b0d79a89352dd6e4f42c4719b097556e3d
|
7dcc245b1f45fdae391ca2fc70a5d17bc02d60f5
|
refs/heads/master
| 2022-07-31T02:30:52.553000 | 2022-06-18T14:38:46 | 2022-06-18T14:38:46 | 237,638,052 | 0 | 0 | null | false | 2022-06-17T17:00:32 | 2020-02-01T15:52:50 | 2021-04-18T08:12:07 | 2022-06-17T17:00:31 | 51 | 0 | 0 | 0 |
Java
| false | false |
package com.mypack.spring.rest.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@RestController
public class HelloController {
@GetMapping("/api/hello")
public String hello() throws Exception {
System.out.println("hello() of HelloController is called");
int a = 1;
if(a == 1) {
throw new Exception();
}
return "Hello, the time at the server is now " + new Date() + "\n";
}
}
|
UTF-8
|
Java
| 533 |
java
|
HelloController.java
|
Java
|
[] | null |
[] |
package com.mypack.spring.rest.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@RestController
public class HelloController {
@GetMapping("/api/hello")
public String hello() throws Exception {
System.out.println("hello() of HelloController is called");
int a = 1;
if(a == 1) {
throw new Exception();
}
return "Hello, the time at the server is now " + new Date() + "\n";
}
}
| 533 | 0.682927 | 0.679174 | 20 | 25.700001 | 23.696201 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false |
10
|
daafdb562ac41e2526e71544193205f2b4c2b638
| 24,163,486,045,041 |
e214c51ab38905d26b1efc22a22f7b9aa34d358f
|
/org.sqlproc.model.parent/org.sqlproc.model/src/org/sqlproc/model/property/ImplementsExtendsImpl.java
|
0f1be32d3f0086ac959d69299302148d437cbca8
|
[] |
no_license
|
hudec/sql-processor-eclipse
|
https://github.com/hudec/sql-processor-eclipse
|
90e8b0dc97345b58ad5e5a98fdc88be609986c56
|
df465e48e1f76cde7c36420f4b3ee4fc59a43bb4
|
refs/heads/master
| 2021-07-13T01:21:34.023000 | 2021-05-17T09:41:17 | 2021-05-17T09:41:17 | 9,314,404 | 0 | 2 | null | false | 2015-09-01T19:31:17 | 2013-04-09T06:12:25 | 2015-05-08T07:49:34 | 2015-08-25T07:52:10 | 77,896 | 0 | 1 | 5 |
Java
| null | null |
package org.sqlproc.model.property;
import java.util.ArrayList;
import java.util.List;
import org.sqlproc.model.processorModel.PojoType;
import org.sqlproc.model.util.Utils;
import org.sqlproc.plugin.lib.property.ImplementsExtends;
public class ImplementsExtendsImpl implements ImplementsExtends {
PojoType toImplement;
boolean generics;
List<String> dbTables = new ArrayList<String>();
List<String> dbNotTables = new ArrayList<String>();
public ImplementsExtendsImpl(PojoType toImplement, boolean generics, List<String> dbTables, List<String> dbNotTables) {
super();
this.toImplement = toImplement;
this.generics = generics;
this.dbTables.addAll(dbTables);
this.dbNotTables.addAll(dbNotTables);
}
@Override
public String getIdentifier() {
return Utils.getPropertyValue(toImplement);
}
@Override
public boolean isGenerics() {
return generics;
}
@Override
public List<String> getDbTables() {
return dbTables;
}
@Override
public List<String> getDbNotTables() {
return dbNotTables;
}
@Override
public String toString() {
return "ImplementsExtendsImpl [toImplement=" + toImplement + ", generics=" + generics + ", dbTables="
+ dbTables + ", dbNotTables=" + dbNotTables + "]";
}
}
|
UTF-8
|
Java
| 1,236 |
java
|
ImplementsExtendsImpl.java
|
Java
|
[] | null |
[] |
package org.sqlproc.model.property;
import java.util.ArrayList;
import java.util.List;
import org.sqlproc.model.processorModel.PojoType;
import org.sqlproc.model.util.Utils;
import org.sqlproc.plugin.lib.property.ImplementsExtends;
public class ImplementsExtendsImpl implements ImplementsExtends {
PojoType toImplement;
boolean generics;
List<String> dbTables = new ArrayList<String>();
List<String> dbNotTables = new ArrayList<String>();
public ImplementsExtendsImpl(PojoType toImplement, boolean generics, List<String> dbTables, List<String> dbNotTables) {
super();
this.toImplement = toImplement;
this.generics = generics;
this.dbTables.addAll(dbTables);
this.dbNotTables.addAll(dbNotTables);
}
@Override
public String getIdentifier() {
return Utils.getPropertyValue(toImplement);
}
@Override
public boolean isGenerics() {
return generics;
}
@Override
public List<String> getDbTables() {
return dbTables;
}
@Override
public List<String> getDbNotTables() {
return dbNotTables;
}
@Override
public String toString() {
return "ImplementsExtendsImpl [toImplement=" + toImplement + ", generics=" + generics + ", dbTables="
+ dbTables + ", dbNotTables=" + dbNotTables + "]";
}
}
| 1,236 | 0.745955 | 0.745955 | 50 | 23.719999 | 25.936876 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.38 | false | false |
10
|
aa94a3335fe5255814089809140b97ba0a50ae26
| 11,673,721,137,305 |
42e1b8ab764a20b646c83a436a5ba7004df04c28
|
/core-domain/src/test/java/org/uniprot/core/uniref/impl/UniRefEntryLightBuilderTest.java
|
c13885b4647f7098271f6569277f6a2d3c94c830
|
[] |
no_license
|
ebi-uniprot/uniprot-core
|
https://github.com/ebi-uniprot/uniprot-core
|
f73e3a118d932ea2e0257df58799be0ac21f2072
|
ba5a89c0fa277a5718401177a348c871f11b09d7
|
refs/heads/master
| 2023-08-31T12:22:42.872000 | 2023-08-03T13:52:43 | 2023-08-30T09:56:50 | 153,438,376 | 4 | 0 | null | false | 2023-09-13T09:45:22 | 2018-10-17T10:25:32 | 2023-03-20T03:58:58 | 2023-09-13T09:45:21 | 16,878 | 4 | 0 | 6 |
Java
| false | false |
package org.uniprot.core.uniref.impl;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.time.LocalDate;
import java.util.*;
import org.junit.jupiter.api.Test;
import org.uniprot.core.Sequence;
import org.uniprot.core.cv.go.GeneOntologyEntry;
import org.uniprot.core.cv.go.impl.GeneOntologyEntryBuilder;
import org.uniprot.core.impl.SequenceBuilder;
import org.uniprot.core.uniprotkb.taxonomy.Organism;
import org.uniprot.core.uniprotkb.taxonomy.impl.OrganismBuilder;
import org.uniprot.core.uniref.*;
/**
* Created 29/06/2020
*
* @author Edd
*/
class UniRefEntryLightBuilderTest {
@Test
void canSetId() {
String value = "id";
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().id(value).build();
assertThat(entryLight.getId().getValue(), is(value));
}
@Test
void canSetUpdated() {
LocalDate value = LocalDate.now();
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().updated(value).build();
assertThat(entryLight.getUpdated(), is(value));
}
@Test
void canSetEntryType() {
UniRefType value = UniRefType.UniRef50;
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().entryType(value).build();
assertThat(entryLight.getEntryType(), is(value));
}
@Test
void canSetCommonTaxon() {
Organism organism =
new OrganismBuilder().taxonId(9606L).scientificName("scientific").build();
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().commonTaxon(organism).build();
assertThat(entryLight.getCommonTaxon(), is(organism));
}
@Test
void canSetSeedId() {
String value = "seedId";
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().seedId(value).build();
assertThat(entryLight.getSeedId(), is(value));
}
@Test
void testRepresentativeMember() {
String seq = "MVSWGRFICLVVVTMATLSLARPSFSLVED";
Sequence sequence = new SequenceBuilder(seq).build();
UniRefMemberIdType type = UniRefMemberIdType.UNIPARC;
RepresentativeMember member =
new RepresentativeMemberBuilder().memberIdType(type).sequence(sequence).build();
UniRefEntryLight entry = new UniRefEntryLightBuilder().representativeMember(member).build();
assertEquals(member, entry.getRepresentativeMember());
}
@Test
void canSetMembers() {
List<String> value = asList("id1", "id2");
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().membersSet(value).build();
assertThat(entryLight.getMembers(), is(value));
}
@Test
void canAddMembers() {
UniRefEntryLightBuilder entryLightBuilder =
new UniRefEntryLightBuilder().membersSet(asList("id1", "id2"));
entryLightBuilder.membersAdd("id3");
assertThat(entryLightBuilder.build().getMembers(), contains("id1", "id2", "id3"));
}
@Test
void canSetOrganisms() {
Organism organism =
new OrganismBuilder().taxonId(9606L).scientificName("scientific").build();
Organism otherOrganism =
new OrganismBuilder().taxonId(9607L).scientificName("new scientific").build();
LinkedHashSet<Organism> value = new LinkedHashSet<>(asList(organism, otherOrganism));
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().organismsSet(value).build();
assertThat(entryLight.getOrganisms(), is(value));
}
@Test
void canAddOrganisms() {
Organism organism =
new OrganismBuilder().taxonId(9606L).scientificName("scientific").build();
Organism newOrganism =
new OrganismBuilder().taxonId(9607L).scientificName("new scientific").build();
UniRefEntryLightBuilder entryLightBuilder =
new UniRefEntryLightBuilder()
.organismsSet(new LinkedHashSet<>(singletonList(organism)));
entryLightBuilder.organismsAdd(newOrganism);
assertThat(entryLightBuilder.build().getOrganisms(), contains(organism, newOrganism));
}
@Test
void doNotAddDuplicatedOrganisms() {
Organism organism =
new OrganismBuilder().taxonId(9606L).scientificName("scientific").build();
Organism duplicated =
new OrganismBuilder().taxonId(9606L).scientificName("scientific").build();
UniRefEntryLightBuilder entryLightBuilder =
new UniRefEntryLightBuilder()
.organismsSet(new LinkedHashSet<>(singletonList(organism)));
entryLightBuilder.organismsAdd(duplicated);
LinkedHashSet<Organism> result = entryLightBuilder.build().getOrganisms();
assertThat(result.size(), is(1));
assertThat(result, contains(organism));
}
@Test
void canSetMemberCount() {
int value = 100000;
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().memberCount(value).build();
assertThat(entryLight.getMemberCount(), is(value));
}
@Test
void canSetOrganismCount() {
int value = 100000;
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().organismCount(value).build();
assertThat(entryLight.getOrganismCount(), is(value));
}
@Test
void canSetMemberIdTypes() {
Set<UniRefMemberIdType> value =
new HashSet<>(
asList(
UniRefMemberIdType.UNIPROTKB_SWISSPROT,
UniRefMemberIdType.UNIPROTKB_TREMBL));
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().memberIdTypesSet(value).build();
assertThat(entryLight.getMemberIdTypes(), is(value));
}
@Test
void canAddMemberIdTypes() {
UniRefEntryLightBuilder entryLightBuilder =
new UniRefEntryLightBuilder()
.memberIdTypesSet(
new HashSet<>(
asList(
UniRefMemberIdType.UNIPROTKB_SWISSPROT,
UniRefMemberIdType.UNIPROTKB_TREMBL)));
entryLightBuilder.memberIdTypesAdd(UniRefMemberIdType.UNIPARC);
entryLightBuilder.memberIdTypesAdd(UniRefMemberIdType.UNIPARC);
assertThat(
entryLightBuilder.build().getMemberIdTypes(),
containsInAnyOrder(
UniRefMemberIdType.UNIPROTKB_SWISSPROT,
UniRefMemberIdType.UNIPROTKB_TREMBL,
UniRefMemberIdType.UNIPARC));
}
@Test
void canSetGoTerms() {
GeneOntologyEntry entry1 = new GeneOntologyEntryBuilder().id("id1").build();
GeneOntologyEntry entry2 = new GeneOntologyEntryBuilder().id("id2").build();
List<GeneOntologyEntry> value = asList(entry1, entry2);
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().goTermsSet(value).build();
assertThat(entryLight.getGoTerms(), is(value));
}
@Test
void canAddGoTerms() {
GeneOntologyEntry entry1 = new GeneOntologyEntryBuilder().id("id1").build();
GeneOntologyEntry entry2 = new GeneOntologyEntryBuilder().id("id2").build();
UniRefEntryLightBuilder entryLightBuilder =
new UniRefEntryLightBuilder().goTermsSet(asList(entry1, entry2));
GeneOntologyEntry entry3 = new GeneOntologyEntryBuilder().id("id3").build();
entryLightBuilder.goTermsAdd(entry3);
assertThat(entryLightBuilder.build().getGoTerms(), contains(entry1, entry2, entry3));
}
@Test
void testFrom() {
Organism organism =
new OrganismBuilder().taxonId(9606L).scientificName("scientific").build();
Organism commonTaxon = new OrganismBuilder().taxonId(10116L).scientificName("Rat").build();
RepresentativeMember representativeMember =
new RepresentativeMemberBuilder()
.memberIdType(UniRefMemberIdType.UNIPROTKB)
.sequence(new SequenceBuilder("AAAAA").build())
.build();
UniRefEntryLight entry =
new UniRefEntryLightBuilder()
.id("UniRef50_P12345")
.name("Cluster name")
.membersAdd("P12345")
.organismsAdd(organism)
.memberIdTypesAdd(UniRefMemberIdType.UNIPARC)
.updated(LocalDate.now())
.commonTaxon(commonTaxon)
.entryType(UniRefType.UniRef50)
.memberCount(5)
.representativeMember(representativeMember)
.seedId("P12345")
.goTermsAdd(new GeneOntologyEntryBuilder().id("GoId").build())
.build();
UniRefEntryLight fromEntry = UniRefEntryLightBuilder.from(entry).build();
assertThat(entry, is(fromEntry));
assertThat(entry.equals(fromEntry), is(true));
assertThat(entry.hashCode(), is(fromEntry.hashCode()));
}
}
|
UTF-8
|
Java
| 9,504 |
java
|
UniRefEntryLightBuilderTest.java
|
Java
|
[
{
"context": "uniref.*;\n\n/**\n * Created 29/06/2020\n *\n * @author Edd\n */\nclass UniRefEntryLightBuilderTest {\n @Test",
"end": 860,
"score": 0.9913769960403442,
"start": 857,
"tag": "USERNAME",
"value": "Edd"
}
] | null |
[] |
package org.uniprot.core.uniref.impl;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.time.LocalDate;
import java.util.*;
import org.junit.jupiter.api.Test;
import org.uniprot.core.Sequence;
import org.uniprot.core.cv.go.GeneOntologyEntry;
import org.uniprot.core.cv.go.impl.GeneOntologyEntryBuilder;
import org.uniprot.core.impl.SequenceBuilder;
import org.uniprot.core.uniprotkb.taxonomy.Organism;
import org.uniprot.core.uniprotkb.taxonomy.impl.OrganismBuilder;
import org.uniprot.core.uniref.*;
/**
* Created 29/06/2020
*
* @author Edd
*/
class UniRefEntryLightBuilderTest {
@Test
void canSetId() {
String value = "id";
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().id(value).build();
assertThat(entryLight.getId().getValue(), is(value));
}
@Test
void canSetUpdated() {
LocalDate value = LocalDate.now();
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().updated(value).build();
assertThat(entryLight.getUpdated(), is(value));
}
@Test
void canSetEntryType() {
UniRefType value = UniRefType.UniRef50;
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().entryType(value).build();
assertThat(entryLight.getEntryType(), is(value));
}
@Test
void canSetCommonTaxon() {
Organism organism =
new OrganismBuilder().taxonId(9606L).scientificName("scientific").build();
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().commonTaxon(organism).build();
assertThat(entryLight.getCommonTaxon(), is(organism));
}
@Test
void canSetSeedId() {
String value = "seedId";
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().seedId(value).build();
assertThat(entryLight.getSeedId(), is(value));
}
@Test
void testRepresentativeMember() {
String seq = "MVSWGRFICLVVVTMATLSLARPSFSLVED";
Sequence sequence = new SequenceBuilder(seq).build();
UniRefMemberIdType type = UniRefMemberIdType.UNIPARC;
RepresentativeMember member =
new RepresentativeMemberBuilder().memberIdType(type).sequence(sequence).build();
UniRefEntryLight entry = new UniRefEntryLightBuilder().representativeMember(member).build();
assertEquals(member, entry.getRepresentativeMember());
}
@Test
void canSetMembers() {
List<String> value = asList("id1", "id2");
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().membersSet(value).build();
assertThat(entryLight.getMembers(), is(value));
}
@Test
void canAddMembers() {
UniRefEntryLightBuilder entryLightBuilder =
new UniRefEntryLightBuilder().membersSet(asList("id1", "id2"));
entryLightBuilder.membersAdd("id3");
assertThat(entryLightBuilder.build().getMembers(), contains("id1", "id2", "id3"));
}
@Test
void canSetOrganisms() {
Organism organism =
new OrganismBuilder().taxonId(9606L).scientificName("scientific").build();
Organism otherOrganism =
new OrganismBuilder().taxonId(9607L).scientificName("new scientific").build();
LinkedHashSet<Organism> value = new LinkedHashSet<>(asList(organism, otherOrganism));
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().organismsSet(value).build();
assertThat(entryLight.getOrganisms(), is(value));
}
@Test
void canAddOrganisms() {
Organism organism =
new OrganismBuilder().taxonId(9606L).scientificName("scientific").build();
Organism newOrganism =
new OrganismBuilder().taxonId(9607L).scientificName("new scientific").build();
UniRefEntryLightBuilder entryLightBuilder =
new UniRefEntryLightBuilder()
.organismsSet(new LinkedHashSet<>(singletonList(organism)));
entryLightBuilder.organismsAdd(newOrganism);
assertThat(entryLightBuilder.build().getOrganisms(), contains(organism, newOrganism));
}
@Test
void doNotAddDuplicatedOrganisms() {
Organism organism =
new OrganismBuilder().taxonId(9606L).scientificName("scientific").build();
Organism duplicated =
new OrganismBuilder().taxonId(9606L).scientificName("scientific").build();
UniRefEntryLightBuilder entryLightBuilder =
new UniRefEntryLightBuilder()
.organismsSet(new LinkedHashSet<>(singletonList(organism)));
entryLightBuilder.organismsAdd(duplicated);
LinkedHashSet<Organism> result = entryLightBuilder.build().getOrganisms();
assertThat(result.size(), is(1));
assertThat(result, contains(organism));
}
@Test
void canSetMemberCount() {
int value = 100000;
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().memberCount(value).build();
assertThat(entryLight.getMemberCount(), is(value));
}
@Test
void canSetOrganismCount() {
int value = 100000;
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().organismCount(value).build();
assertThat(entryLight.getOrganismCount(), is(value));
}
@Test
void canSetMemberIdTypes() {
Set<UniRefMemberIdType> value =
new HashSet<>(
asList(
UniRefMemberIdType.UNIPROTKB_SWISSPROT,
UniRefMemberIdType.UNIPROTKB_TREMBL));
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().memberIdTypesSet(value).build();
assertThat(entryLight.getMemberIdTypes(), is(value));
}
@Test
void canAddMemberIdTypes() {
UniRefEntryLightBuilder entryLightBuilder =
new UniRefEntryLightBuilder()
.memberIdTypesSet(
new HashSet<>(
asList(
UniRefMemberIdType.UNIPROTKB_SWISSPROT,
UniRefMemberIdType.UNIPROTKB_TREMBL)));
entryLightBuilder.memberIdTypesAdd(UniRefMemberIdType.UNIPARC);
entryLightBuilder.memberIdTypesAdd(UniRefMemberIdType.UNIPARC);
assertThat(
entryLightBuilder.build().getMemberIdTypes(),
containsInAnyOrder(
UniRefMemberIdType.UNIPROTKB_SWISSPROT,
UniRefMemberIdType.UNIPROTKB_TREMBL,
UniRefMemberIdType.UNIPARC));
}
@Test
void canSetGoTerms() {
GeneOntologyEntry entry1 = new GeneOntologyEntryBuilder().id("id1").build();
GeneOntologyEntry entry2 = new GeneOntologyEntryBuilder().id("id2").build();
List<GeneOntologyEntry> value = asList(entry1, entry2);
UniRefEntryLight entryLight = new UniRefEntryLightBuilder().goTermsSet(value).build();
assertThat(entryLight.getGoTerms(), is(value));
}
@Test
void canAddGoTerms() {
GeneOntologyEntry entry1 = new GeneOntologyEntryBuilder().id("id1").build();
GeneOntologyEntry entry2 = new GeneOntologyEntryBuilder().id("id2").build();
UniRefEntryLightBuilder entryLightBuilder =
new UniRefEntryLightBuilder().goTermsSet(asList(entry1, entry2));
GeneOntologyEntry entry3 = new GeneOntologyEntryBuilder().id("id3").build();
entryLightBuilder.goTermsAdd(entry3);
assertThat(entryLightBuilder.build().getGoTerms(), contains(entry1, entry2, entry3));
}
@Test
void testFrom() {
Organism organism =
new OrganismBuilder().taxonId(9606L).scientificName("scientific").build();
Organism commonTaxon = new OrganismBuilder().taxonId(10116L).scientificName("Rat").build();
RepresentativeMember representativeMember =
new RepresentativeMemberBuilder()
.memberIdType(UniRefMemberIdType.UNIPROTKB)
.sequence(new SequenceBuilder("AAAAA").build())
.build();
UniRefEntryLight entry =
new UniRefEntryLightBuilder()
.id("UniRef50_P12345")
.name("Cluster name")
.membersAdd("P12345")
.organismsAdd(organism)
.memberIdTypesAdd(UniRefMemberIdType.UNIPARC)
.updated(LocalDate.now())
.commonTaxon(commonTaxon)
.entryType(UniRefType.UniRef50)
.memberCount(5)
.representativeMember(representativeMember)
.seedId("P12345")
.goTermsAdd(new GeneOntologyEntryBuilder().id("GoId").build())
.build();
UniRefEntryLight fromEntry = UniRefEntryLightBuilder.from(entry).build();
assertThat(entry, is(fromEntry));
assertThat(entry.equals(fromEntry), is(true));
assertThat(entry.hashCode(), is(fromEntry.hashCode()));
}
}
| 9,504 | 0.637416 | 0.626263 | 242 | 38.272728 | 31.096226 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533058 | false | false |
10
|
1e51486af3ecb31e889837448bfe26ab478c1008
| 17,746,804,891,769 |
2c475489d1954115d38fe3a906e6df28460ff81e
|
/src/main/java/Writer.java
|
e7047d0ca829b06bb18b09ad9bdacd628a37914e
|
[] |
no_license
|
leonvsg/OccurrencesHomeWork
|
https://github.com/leonvsg/OccurrencesHomeWork
|
895b270f3fbe14d1f9512bb467f1f9d895021320
|
bc17b47d9baeacf87afa14e71f8da607b101a611
|
refs/heads/master
| 2020-03-14T02:09:29.706000 | 2018-05-10T18:04:15 | 2018-05-10T18:04:15 | 131,393,543 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import org.apache.log4j.Logger;
import java.io.FileWriter;
import java.io.IOException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
public class Writer implements AutoCloseable, Runnable{
private final static Logger logger = Logger.getLogger(Writer.class);
private FileWriter fileWriter;
private BlockingQueue<String> sentences;
private int queueTimeout;
private TimeUnit queueTimeoutTimeUnit;
public Writer(String fileName) throws IOException {
fileWriter = new FileWriter(fileName);
}
public Writer(String fileName, BlockingQueue<String> sentences) throws IOException {
fileWriter = new FileWriter(fileName);
this.sentences = sentences;
queueTimeout = Settings.WRITER_TIMEOUT;
queueTimeoutTimeUnit = Settings.WRITER_TIMEOUT_TIMEUNIT;
}
public synchronized void write(String text) throws IOException {
if (text == null) return;
fileWriter.write(text + "\r\n");
fileWriter.flush();
logger.debug("Предложение \"" + text + "\" записано в файл");
}
@Override
public void close() throws Exception {
if (fileWriter != null) fileWriter.close();
}
@Override
public void run() {
String str = "";
try {
while (str != null){
str = sentences.poll(queueTimeout, queueTimeoutTimeUnit);
logger.debug("Из шины получено предложение: \"" + str + "\"");
write(str);
}
} catch (InterruptedException | IOException e) {
logger.error("Выполнение потока " + Thread.currentThread().getName() + " прервано\n" + e.getMessage());
} catch (Exception e) {
logger.error(e.getMessage());
}
}
}
|
UTF-8
|
Java
| 1,864 |
java
|
Writer.java
|
Java
|
[] | null |
[] |
import org.apache.log4j.Logger;
import java.io.FileWriter;
import java.io.IOException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
public class Writer implements AutoCloseable, Runnable{
private final static Logger logger = Logger.getLogger(Writer.class);
private FileWriter fileWriter;
private BlockingQueue<String> sentences;
private int queueTimeout;
private TimeUnit queueTimeoutTimeUnit;
public Writer(String fileName) throws IOException {
fileWriter = new FileWriter(fileName);
}
public Writer(String fileName, BlockingQueue<String> sentences) throws IOException {
fileWriter = new FileWriter(fileName);
this.sentences = sentences;
queueTimeout = Settings.WRITER_TIMEOUT;
queueTimeoutTimeUnit = Settings.WRITER_TIMEOUT_TIMEUNIT;
}
public synchronized void write(String text) throws IOException {
if (text == null) return;
fileWriter.write(text + "\r\n");
fileWriter.flush();
logger.debug("Предложение \"" + text + "\" записано в файл");
}
@Override
public void close() throws Exception {
if (fileWriter != null) fileWriter.close();
}
@Override
public void run() {
String str = "";
try {
while (str != null){
str = sentences.poll(queueTimeout, queueTimeoutTimeUnit);
logger.debug("Из шины получено предложение: \"" + str + "\"");
write(str);
}
} catch (InterruptedException | IOException e) {
logger.error("Выполнение потока " + Thread.currentThread().getName() + " прервано\n" + e.getMessage());
} catch (Exception e) {
logger.error(e.getMessage());
}
}
}
| 1,864 | 0.638749 | 0.638191 | 54 | 32.166668 | 26.312756 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false |
10
|
6484707c5b51a9efec3798b15a56371cd8a21aa6
| 19,490,561,620,769 |
b3252a8310969148d7bc01edbc07f54a8dcf0c7e
|
/src/main/java/kr/or/ns/crawling/vo/Label.java
|
a0360914a1c3329d72d507694a20b434ada239b1
|
[] |
no_license
|
jeonyeonkyu/Bit155_Final_Project
|
https://github.com/jeonyeonkyu/Bit155_Final_Project
|
a0a3986810b27229c9f40e85207db0c9495cb4be
|
f6725b7d530a10a0d1b3f8d31b874d18dded9d91
|
refs/heads/master
| 2022-12-30T20:09:15.439000 | 2020-08-11T07:49:22 | 2020-08-11T07:49:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package kr.or.ns.crawling.vo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class Label {
private String title;
}
|
UTF-8
|
Java
| 172 |
java
|
Label.java
|
Java
|
[] | null |
[] |
package kr.or.ns.crawling.vo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class Label {
private String title;
}
| 172 | 0.773256 | 0.773256 | 12 | 13.333333 | 9.927515 | 29 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
10
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.