blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
132
path
stringlengths
2
382
src_encoding
stringclasses
34 values
length_bytes
int64
9
3.8M
score
float64
1.5
4.94
int_score
int64
2
5
detected_licenses
listlengths
0
142
license_type
stringclasses
2 values
text
stringlengths
9
3.8M
download_success
bool
1 class
439ade7d89e0076e17ba6d1588f98871fa5d643b
Java
andyb001/LogIt
/src/main/java/com/whittle/logit/dto/ItemDTO.java
UTF-8
2,431
2.171875
2
[]
no_license
package com.whittle.logit.dto; import java.util.Date; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class ItemDTO { private String id; private String name; private String description; private String itemTypeId; private String imageUrl; private Date purchaseDate; private Double cost; private byte[] imageFile; private byte[] barCodeImageFile; private String imageFileStrBytes; private String barCodeImageFileStrBytes; private String imageFileName; private String barCode; public ItemDTO() { } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getItemTypeId() { return itemTypeId; } public void setItemTypeId(String itemTypeId) { this.itemTypeId = itemTypeId; } public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public Date getPurchaseDate() { return purchaseDate; } public void setPurchaseDate(Date purchaseDate) { this.purchaseDate = purchaseDate; } public Double getCost() { return cost; } public void setCost(Double cost) { this.cost = cost; } public byte[] getImageFile() { return imageFile; } public void setImageFile(byte[] imageFile) { this.imageFile = imageFile; } public String getImageFileName() { return imageFileName; } public void setImageFileName(String imageFileName) { this.imageFileName = imageFileName; } public byte[] getBarCodeImageFile() { return barCodeImageFile; } public void setBarCodeImageFile(byte[] barCodeImageFile) { this.barCodeImageFile = barCodeImageFile; } public String getImageFileStrBytes() { return imageFileStrBytes; } public void setImageFileStrBytes(String imageFileStrBytes) { this.imageFileStrBytes = imageFileStrBytes; } public String getBarCodeImageFileStrBytes() { return barCodeImageFileStrBytes; } public void setBarCodeImageFileStrBytes(String barCodeImageFileStrBytes) { this.barCodeImageFileStrBytes = barCodeImageFileStrBytes; } public String getBarCode() { return barCode; } public void setBarCode(String barCode) { this.barCode = barCode; } }
true
34aa9d0875ee2c7d9aa75dc3c4bdc6aaa0c6caee
Java
akashsingh8998/user-management
/src/test/java/com/sapient/exception/TestUserNotFoundException.java
UTF-8
1,407
2.21875
2
[]
no_license
package com.sapient.exception; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; import com.sapient.user_management.UserManagementApplication; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.NONE) @ContextConfiguration(classes=UserManagementApplication.class) public class TestUserNotFoundException { //This test case fails because it was expecting ArithmeticException @Test(expected = UserNotFoundException.class) public void expectUserNotFoundException() throws BatchNotFoundException, UserNotFoundException { throw new UserNotFoundException(); } @Test(expected = UserNotFoundException.class) public void expectUserNotFoundException2() throws BatchNotFoundException, UserNotFoundException { throw new UserNotFoundException("message"); } @Test(expected = UserNotFoundException.class) public void expectUserNotFoundException3() throws BatchNotFoundException, UserNotFoundException { throw new UserNotFoundException("message",null); } }
true
2a34f88674e3e91d572876ac2b03205e7fd7fb42
Java
lightning-zoro/LeetCode
/src/leetcode/FourSumCount.java
UTF-8
915
3.515625
4
[]
no_license
package leetcode; import java.util.HashMap; import java.util.Map; public class FourSumCount { public static int fourSumCount(int[] A, int[] B, int[] C, int[] D) { Map<Integer,Integer> map = new HashMap<Integer, Integer>(); //第一次吧两个集合的俩数之和当key存入map value 出现的次数 for (int i = 0; i < A.length; i++) { for (int j = 0; j < B.length; j++) { int sum = A[i] + B[j]; if(map.containsKey(sum)) map.put(sum, map.get(sum) + 1); else map.put(sum, 1); } } int res = 0; //第二次计算另外俩集合之和的负数 如果map中存在 则去除value值加入res for (int i = 0; i < D.length; i++) { for (int j = 0; j < C.length; j++) { int sum = -(C[i] + D[j]); if(map.containsKey(sum)) res += map.get(sum); } } return res; } }
true
44f18ee8d0c46f13f596735b5d6ea07c9ad01285
Java
sarita-panigrahi/springjunittest
/src/main/java/org/sdrc/boot/web/model/ReportModel.java
UTF-8
747
1.992188
2
[]
no_license
package org.sdrc.boot.web.model; import java.sql.Timestamp; public class ReportModel { private Integer id; private Timestamp createdDate; private String filePath; private Boolean isLive; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Timestamp getCreatedDate() { return createdDate; } public void setCreatedDate(Timestamp createdDate) { this.createdDate = createdDate; } public String getFilePath() { return filePath; } public void setFilePath(String filePath) { this.filePath = filePath; } public Boolean getIsLive() { return isLive; } public void setIsLive(Boolean isLive) { this.isLive = isLive; } }
true
4d9d2df5f610a44b10e960b2affd816262f3939a
Java
zhigangonline/check-excel
/src/main/java/com/use/vo/ImportExcelVo.java
UTF-8
298
1.609375
2
[]
no_license
package com.use.vo; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor public class ImportExcelVo<T> { private String templateFilePath; private String filePath; private String importListName; private Class<T> clazz; }
true
5a7304c82fc6d4b5993b5a37c4ba188b499a0d08
Java
lejuno/PopularMovies
/app/src/main/java/com/lejuno/popularmoviesapp/data/MoviesContract.java
UTF-8
3,230
2.5625
3
[]
no_license
package com.lejuno.popularmoviesapp.data; /** * Created by nomoto on 8/21/15. */ import android.content.ContentResolver; import android.content.ContentUris; import android.net.Uri; import android.provider.BaseColumns; /** * Defines table and column names for the weather database. */ public class MoviesContract { // The "Content authority" is a name for the entire content provider, similar to the // relationship between a domain name and its website. A convenient string to use for the // content authority is the package name for the app, which is guaranteed to be unique on the // device. public static final String CONTENT_AUTHORITY = "com.lejuno.popularmoviesapp"; // Use CONTENT_AUTHORITY to create the base of all URI's which apps will use to contact // the content provider. public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY); // Possible paths (appended to base content URI for possible URI's) // For instance, content://com.example.android.sunshine.app/weather/ is a valid path for // looking at weather data. content://com.example.android.sunshine.app/givemeroot/ will fail, // as the ContentProvider hasn't been given any information on what to do with "givemeroot". // At least, let's hope not. Don't be that dev, reader. Don't be that dev. public static final String PATH_MOVIES = "movies"; /* Inner class that defines the table contents of the weather table */ public static final class MoviesEntry implements BaseColumns { public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_MOVIES).build(); public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_MOVIES; public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_MOVIES; public static final String TABLE_NAME = "movies"; // Online Id stored as integer public static final String COLUMN_MOVIES_ONLINE_ID = "online_id"; // Title stored as string public static final String COLUMN_MOVIES_TITLE = "title"; // Release date stored as string - 2015-08-21 public static final String COLUMN_MOVIES_RELEASE = "release"; // Synopsis stored as string public static final String COLUMN_MOVIES_SYNOPSIS = "synopsis"; // Vote average stored as float public static final String COLUMN_MOVIES_VOTE_AVERAGE = "vote_average"; // Poster URL stored as string public static final String COLUMN_MOVIES_POSTER_URL = "poster_url"; // Popularity stored as float public static final String COLUMN_MOVIES_POPULARITY = "popularity"; // Vote count stored as integer public static final String COLUMN_MOVIES_VOTE_COUNT = "vote_count"; // Incoming position stored as integer public static final String COLUMN_MOVIES_INCOMING_POSITION = "incoming_position"; public static Uri buildMoviesUri(long id) { return ContentUris.withAppendedId(CONTENT_URI, id); } } }
true
21049ae664bf2719c8d654e8d5e9eafc182661a6
Java
IvanYakimtsov/UselessJavaProjects
/Graphics editor/src/com/ivan/imageEditor/fileActions/LoadAction.java
UTF-8
1,648
2.6875
3
[]
no_license
package com.ivan.imageEditor.fileActions; import com.ivan.imageEditor.panels.DrawingManager; import javax.imageio.ImageIO; import javax.swing.*; import java.awt.event.ActionEvent; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; /** * Created by Ivan on 11.03.2017. */ public class LoadAction extends AbstractAction { private DrawingManager drawingManager; public LoadAction(DrawingManager drawingManager, String name) { super(name); this.drawingManager = drawingManager; } @Override public void actionPerformed(ActionEvent event) { String fileName; JFileChooser fileChooser = new JFileChooser(); fileChooser.addChoosableFileFilter(new ImageFileFilter(".png")); fileChooser.addChoosableFileFilter(new ImageFileFilter(".jpg")); int result = fileChooser.showOpenDialog(null); if (result == JFileChooser.APPROVE_OPTION) { try { fileName = fileChooser.getSelectedFile().getAbsolutePath(); File file = new File(fileName); drawingManager.getDrawingArea().setImage(ImageIO.read(file)); } catch (FileNotFoundException ex) { JOptionPane.showMessageDialog(this.drawingManager.getDrawingArea(), "No File Exists"); } catch (IOException ex) { JOptionPane.showMessageDialog(this.drawingManager.getDrawingArea(), "Input/Output Exeption"); } catch (Exception ex) { JOptionPane.showMessageDialog(this.drawingManager.getDrawingArea(), "Undefined Exeption"); } } } }
true
fff2e375a79f70bca0a3fe61dd0e076d59e63dd3
Java
nithijamuna/HARIST
/com.harsit.arti/src/test/java/com/harsit/com/harsit/arti/Test_1.java
UTF-8
692
1.6875
2
[]
no_license
package com.harsit.com.harsit.arti; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.Test; public class Test_1 { @Test public static void Arul() { System.setProperty("webdriver.gecko.driver", "C:\\Users\\Arul\\Downloads\\geckodriver-v0.24.0-win64\\geckodriver.exe"); WebDriver driver=new FirefoxDriver(); driver.manage().window().maximize(); driver.get("https://www.google.com/"); driver.findElement(By.name("q")).sendKeys("arul"); driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS); //driver.close(); } }
true
624b1ab3fac911c9e7609858e8f59c2c25c6c0ed
Java
GeorgiaDesigns/Reserva-Teatro
/src/teatro/TelaReservarIngresso.java
UTF-8
74,343
1.960938
2
[]
no_license
package teatro; import DAOs.conexao; import DAOs.Espetaculos; import java.sql.ResultSet; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JButton; import javax.swing.JOptionPane; import teatro.Assentos; public class TelaReservarIngresso extends javax.swing.JFrame { //private JButton[][] lugares; public TelaReservarIngresso() { // Espetaculos espet = new Espetaculos(); // conexao BD = new conexao("regulus","POO16172","POO16172","POO16172"); // if (!BD.conectaBD()) { // JOptionPane.showMessageDialog(null,"Erro na conexão com o BD"); // } // else // { // try // { // //// ResultSet espetaculos; //// for(int i =0;i<10;i++) //// { //// espetaculos = espet.pegarEspetaculo(BD.c); //// if (!espetaculos.getDate(i).toString().equals("")) //// { //// jComboBox1.addItem(espetaculos.getDate(i).toString()); //// } //// } // // } // catch (Exception ex) { // Logger.getLogger(TelaPrincipal.class.getName()).log(Level.SEVERE, null, ex); // } // } // // initComponents(); jComboBox1.addItem("oie"); // lugares = new JButton[10][]; // for (int i = 0; i < 10; i++) // { // lugares[i] = new JButton[10]; // // for (int j = 0; j < 10; j++) // { // lugares[i][j] = new JButton(); // pnlAssentos.add(lugares[i][j]); // lugares[i][j].setName(i+""+j); // } // } } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel8 = new javax.swing.JLabel(); jLabel18 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox<>(); jButton1 = new javax.swing.JButton(); jComboBox4 = new javax.swing.JComboBox<>(); jComboBox5 = new javax.swing.JComboBox<>(); jPanel1 = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel(); jLabel19 = new javax.swing.JLabel(); jLabel20 = new javax.swing.JLabel(); jLabel21 = new javax.swing.JLabel(); jLabel22 = new javax.swing.JLabel(); jLabel23 = new javax.swing.JLabel(); jLabel24 = new javax.swing.JLabel(); jLabel25 = new javax.swing.JLabel(); jLabel26 = new javax.swing.JLabel(); jLabel27 = new javax.swing.JLabel(); jLabel28 = new javax.swing.JLabel(); jButton55 = new javax.swing.JButton(); jButton56 = new javax.swing.JButton(); jButton77 = new javax.swing.JButton(); jButton78 = new javax.swing.JButton(); jButton79 = new javax.swing.JButton(); jButton80 = new javax.swing.JButton(); jButton81 = new javax.swing.JButton(); jButton82 = new javax.swing.JButton(); jButton83 = new javax.swing.JButton(); jButton57 = new javax.swing.JButton(); jButton84 = new javax.swing.JButton(); jButton58 = new javax.swing.JButton(); jButton85 = new javax.swing.JButton(); jButton59 = new javax.swing.JButton(); jButton86 = new javax.swing.JButton(); jButton60 = new javax.swing.JButton(); jButton61 = new javax.swing.JButton(); jButton62 = new javax.swing.JButton(); jButton63 = new javax.swing.JButton(); jButton64 = new javax.swing.JButton(); jButton65 = new javax.swing.JButton(); jButton66 = new javax.swing.JButton(); jButton87 = new javax.swing.JButton(); jButton88 = new javax.swing.JButton(); jButton89 = new javax.swing.JButton(); jButton90 = new javax.swing.JButton(); jButton91 = new javax.swing.JButton(); jButton92 = new javax.swing.JButton(); jButton93 = new javax.swing.JButton(); jButton94 = new javax.swing.JButton(); jButton95 = new javax.swing.JButton(); jButton96 = new javax.swing.JButton(); jButton97 = new javax.swing.JButton(); jButton98 = new javax.swing.JButton(); jButton99 = new javax.swing.JButton(); jButton100 = new javax.swing.JButton(); jButton101 = new javax.swing.JButton(); jButton102 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); jButton8 = new javax.swing.JButton(); jButton9 = new javax.swing.JButton(); jButton10 = new javax.swing.JButton(); jButton11 = new javax.swing.JButton(); jButton12 = new javax.swing.JButton(); jButton13 = new javax.swing.JButton(); jButton14 = new javax.swing.JButton(); jButton15 = new javax.swing.JButton(); jButton16 = new javax.swing.JButton(); jButton17 = new javax.swing.JButton(); jButton18 = new javax.swing.JButton(); jButton19 = new javax.swing.JButton(); jButton20 = new javax.swing.JButton(); jButton21 = new javax.swing.JButton(); jButton22 = new javax.swing.JButton(); jButton23 = new javax.swing.JButton(); jButton24 = new javax.swing.JButton(); jButton25 = new javax.swing.JButton(); jButton26 = new javax.swing.JButton(); jButton27 = new javax.swing.JButton(); jButton28 = new javax.swing.JButton(); jButton29 = new javax.swing.JButton(); jButton30 = new javax.swing.JButton(); jButton31 = new javax.swing.JButton(); jButton32 = new javax.swing.JButton(); jButton33 = new javax.swing.JButton(); jButton34 = new javax.swing.JButton(); jButton35 = new javax.swing.JButton(); jButton36 = new javax.swing.JButton(); jButton37 = new javax.swing.JButton(); jButton38 = new javax.swing.JButton(); jButton39 = new javax.swing.JButton(); jButton40 = new javax.swing.JButton(); jButton41 = new javax.swing.JButton(); jButton42 = new javax.swing.JButton(); jButton43 = new javax.swing.JButton(); jButton44 = new javax.swing.JButton(); jButton45 = new javax.swing.JButton(); jButton46 = new javax.swing.JButton(); jButton67 = new javax.swing.JButton(); jButton68 = new javax.swing.JButton(); jButton69 = new javax.swing.JButton(); jButton70 = new javax.swing.JButton(); jButton71 = new javax.swing.JButton(); jButton72 = new javax.swing.JButton(); jButton73 = new javax.swing.JButton(); jButton47 = new javax.swing.JButton(); jButton74 = new javax.swing.JButton(); jButton48 = new javax.swing.JButton(); jButton75 = new javax.swing.JButton(); jButton49 = new javax.swing.JButton(); jButton76 = new javax.swing.JButton(); jButton50 = new javax.swing.JButton(); jButton51 = new javax.swing.JButton(); jButton52 = new javax.swing.JButton(); jButton53 = new javax.swing.JButton(); jButton54 = new javax.swing.JButton(); jLabel8.setText(" a"); jLabel18.setText("jLabel18"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Arial Rounded MT Bold", 0, 18)); // NOI18N jLabel1.setText("Reservar Ingresso"); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Escolha um espetáculo", "aaaaaaa" })); jComboBox1.setName("cbxEspetaculo"); // NOI18N jComboBox1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBox1ActionPerformed(evt); } }); jButton1.setText("Efetuar \nCompra"); jButton1.setName("btnCompra"); // NOI18N jComboBox4.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Escolha uma data" })); jComboBox4.setName("cbxData"); // NOI18N jComboBox5.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Escolha um horário" })); jComboBox5.setName("cbxHorario"); // NOI18N jLabel6.setText("Tela"); jLabel7.setText(" a"); jLabel9.setText(" b"); jLabel10.setText(" c"); jLabel11.setText(" d"); jLabel12.setText("e"); jLabel13.setText("f"); jLabel14.setText("g"); jLabel15.setText(" h"); jLabel16.setText("i"); jLabel16.setToolTipText(""); jLabel17.setText("j"); jLabel19.setText("1"); jLabel20.setText("2"); jLabel21.setText("3"); jLabel22.setText("4"); jLabel23.setText("5"); jLabel24.setText("6"); jLabel25.setText("7"); jLabel26.setText("8"); jLabel27.setText("9"); jLabel28.setText("10"); jButton55.setBackground(new java.awt.Color(255, 255, 255)); jButton56.setBackground(new java.awt.Color(255, 255, 255)); jButton77.setBackground(new java.awt.Color(255, 255, 255)); jButton78.setBackground(new java.awt.Color(255, 255, 255)); jButton79.setBackground(new java.awt.Color(255, 255, 255)); jButton80.setBackground(new java.awt.Color(255, 255, 255)); jButton81.setBackground(new java.awt.Color(255, 255, 255)); jButton82.setBackground(new java.awt.Color(255, 255, 255)); jButton83.setBackground(new java.awt.Color(255, 255, 255)); jButton57.setBackground(new java.awt.Color(255, 255, 255)); jButton84.setBackground(new java.awt.Color(255, 255, 255)); jButton58.setBackground(new java.awt.Color(255, 255, 255)); jButton85.setBackground(new java.awt.Color(255, 255, 255)); jButton59.setBackground(new java.awt.Color(255, 255, 255)); jButton86.setBackground(new java.awt.Color(255, 255, 255)); jButton60.setBackground(new java.awt.Color(255, 255, 255)); jButton61.setBackground(new java.awt.Color(255, 255, 255)); jButton62.setBackground(new java.awt.Color(255, 255, 255)); jButton63.setBackground(new java.awt.Color(255, 255, 255)); jButton64.setBackground(new java.awt.Color(255, 255, 255)); jButton65.setBackground(new java.awt.Color(255, 255, 255)); jButton66.setBackground(new java.awt.Color(255, 255, 255)); jButton87.setBackground(new java.awt.Color(255, 255, 255)); jButton88.setBackground(new java.awt.Color(255, 255, 255)); jButton89.setBackground(new java.awt.Color(255, 255, 255)); jButton90.setBackground(new java.awt.Color(255, 255, 255)); jButton91.setBackground(new java.awt.Color(255, 255, 255)); jButton92.setBackground(new java.awt.Color(255, 255, 255)); jButton93.setBackground(new java.awt.Color(255, 255, 255)); jButton94.setBackground(new java.awt.Color(255, 255, 255)); jButton95.setBackground(new java.awt.Color(255, 255, 255)); jButton96.setBackground(new java.awt.Color(255, 255, 255)); jButton97.setBackground(new java.awt.Color(255, 255, 255)); jButton98.setBackground(new java.awt.Color(255, 255, 255)); jButton99.setBackground(new java.awt.Color(255, 255, 255)); jButton100.setBackground(new java.awt.Color(255, 255, 255)); jButton101.setBackground(new java.awt.Color(255, 255, 255)); jButton102.setBackground(new java.awt.Color(255, 255, 255)); jButton3.setBackground(new java.awt.Color(255, 255, 255)); jButton4.setBackground(new java.awt.Color(255, 255, 255)); jButton5.setBackground(new java.awt.Color(255, 255, 255)); jButton6.setBackground(new java.awt.Color(255, 255, 255)); jButton7.setBackground(new java.awt.Color(255, 255, 255)); jButton8.setBackground(new java.awt.Color(255, 255, 255)); jButton9.setBackground(new java.awt.Color(255, 255, 255)); jButton10.setBackground(new java.awt.Color(255, 255, 255)); jButton11.setBackground(new java.awt.Color(255, 255, 255)); jButton12.setBackground(new java.awt.Color(255, 255, 255)); jButton13.setBackground(new java.awt.Color(255, 255, 255)); jButton14.setBackground(new java.awt.Color(255, 255, 255)); jButton15.setBackground(new java.awt.Color(255, 255, 255)); jButton16.setBackground(new java.awt.Color(255, 255, 255)); jButton17.setBackground(new java.awt.Color(255, 255, 255)); jButton18.setBackground(new java.awt.Color(255, 255, 255)); jButton19.setBackground(new java.awt.Color(255, 255, 255)); jButton20.setBackground(new java.awt.Color(255, 255, 255)); jButton21.setBackground(new java.awt.Color(255, 255, 255)); jButton22.setBackground(new java.awt.Color(255, 255, 255)); jButton23.setBackground(new java.awt.Color(255, 255, 255)); jButton24.setBackground(new java.awt.Color(255, 255, 255)); jButton25.setBackground(new java.awt.Color(255, 255, 255)); jButton26.setBackground(new java.awt.Color(255, 255, 255)); jButton27.setBackground(new java.awt.Color(255, 255, 255)); jButton28.setBackground(new java.awt.Color(255, 255, 255)); jButton29.setBackground(new java.awt.Color(255, 255, 255)); jButton30.setBackground(new java.awt.Color(255, 255, 255)); jButton31.setBackground(new java.awt.Color(255, 255, 255)); jButton32.setBackground(new java.awt.Color(255, 255, 255)); jButton33.setBackground(new java.awt.Color(255, 255, 255)); jButton34.setBackground(new java.awt.Color(255, 255, 255)); jButton35.setBackground(new java.awt.Color(255, 255, 255)); jButton36.setBackground(new java.awt.Color(255, 255, 255)); jButton37.setBackground(new java.awt.Color(255, 255, 255)); jButton38.setBackground(new java.awt.Color(255, 255, 255)); jButton39.setBackground(new java.awt.Color(255, 255, 255)); jButton40.setBackground(new java.awt.Color(255, 255, 255)); jButton41.setBackground(new java.awt.Color(255, 255, 255)); jButton42.setBackground(new java.awt.Color(255, 255, 255)); jButton43.setBackground(new java.awt.Color(255, 255, 255)); jButton44.setBackground(new java.awt.Color(255, 255, 255)); jButton45.setBackground(new java.awt.Color(255, 255, 255)); jButton46.setBackground(new java.awt.Color(255, 255, 255)); jButton67.setBackground(new java.awt.Color(255, 255, 255)); jButton68.setBackground(new java.awt.Color(255, 255, 255)); jButton69.setBackground(new java.awt.Color(255, 255, 255)); jButton70.setBackground(new java.awt.Color(255, 255, 255)); jButton71.setBackground(new java.awt.Color(255, 255, 255)); jButton72.setBackground(new java.awt.Color(255, 255, 255)); jButton73.setBackground(new java.awt.Color(255, 255, 255)); jButton47.setBackground(new java.awt.Color(255, 255, 255)); jButton74.setBackground(new java.awt.Color(255, 255, 255)); jButton48.setBackground(new java.awt.Color(255, 255, 255)); jButton75.setBackground(new java.awt.Color(255, 255, 255)); jButton49.setBackground(new java.awt.Color(255, 255, 255)); jButton76.setBackground(new java.awt.Color(255, 255, 255)); jButton50.setBackground(new java.awt.Color(255, 255, 255)); jButton51.setBackground(new java.awt.Color(255, 255, 255)); jButton52.setBackground(new java.awt.Color(255, 255, 255)); jButton53.setBackground(new java.awt.Color(255, 255, 255)); jButton54.setBackground(new java.awt.Color(255, 255, 255)); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(17, 17, 17) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(6, 6, 6) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(jPanel1Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton22, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton13, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton17, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton15, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton16, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton20, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton18, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton19, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton21, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton32, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton23, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton24, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton27, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton25, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton26, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton30, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton28, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton29, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton31, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton42, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton33, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton34, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton37, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton35, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton36, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton40, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton38, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton39, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton41, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton52, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton43, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton44, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton47, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton45, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton46, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton50, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton48, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton49, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton51, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton62, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton53, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton54, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton57, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton55, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton56, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton60, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton58, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton59, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton61, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton72, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton63, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton64, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton67, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton65, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton66, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton70, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton68, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton69, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton71, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton82, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton73, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton74, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton77, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton75, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton76, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton80, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton78, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton79, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton81, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton92, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton83, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton84, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton87, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton85, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton86, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton90, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton88, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton89, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton91, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton102, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton93, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton94, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton97, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton95, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton96, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton100, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton98, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton99, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton101, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton11, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton12, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addContainerGap(19, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel6) .addGap(9, 9, 9) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(jLabel9) .addComponent(jLabel10) .addComponent(jLabel11) .addComponent(jLabel12) .addComponent(jLabel13) .addComponent(jLabel14) .addComponent(jLabel15) .addComponent(jLabel16) .addComponent(jLabel17)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel19) .addGap(10, 10, 10) .addComponent(jLabel20) .addGap(10, 10, 10) .addComponent(jLabel21) .addGap(10, 10, 10) .addComponent(jLabel22) .addGap(10, 10, 10) .addComponent(jLabel23) .addGap(10, 10, 10) .addComponent(jLabel24) .addGap(10, 10, 10) .addComponent(jLabel25) .addGap(10, 10, 10) .addComponent(jLabel26) .addGap(10, 10, 10) .addComponent(jLabel27) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel28) .addGap(15, 15, 15)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton11, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton12, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton22, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton13, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton17, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton16, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton15, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton20, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton19, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton18, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton21, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton32, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton24, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton23, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton27, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton26, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton25, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton30, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton29, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton28, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton31, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton42, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton34, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton33, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton37, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton36, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton35, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton40, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton39, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton38, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton41, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton52, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton44, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton43, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton47, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton46, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton45, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton50, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton49, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton48, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton51, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton62, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton54, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton53, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton57, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton56, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton55, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton60, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton59, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton58, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton61, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton72, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton64, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton63, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton67, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton66, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton65, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton70, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton69, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton68, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton71, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton82, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton74, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton73, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton77, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton76, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton75, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton80, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton79, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton78, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton81, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton92, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton84, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton83, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton87, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton86, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton85, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton90, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton89, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton88, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton91, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton102, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton94, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton93, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton97, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton96, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton95, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton100, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton99, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton98, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton101, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()))) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(108, 108, 108) .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() .addGap(93, 93, 93) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jComboBox1, 0, 192, Short.MAX_VALUE) .addComponent(jComboBox4, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jComboBox5, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addComponent(jButton1))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 96, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(34, 34, 34)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(25, 25, 25) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addGap(26, 26, 26) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(57, 57, 57)))) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jComboBox1ActionPerformed public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(TelaReservarIngresso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(TelaReservarIngresso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(TelaReservarIngresso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(TelaReservarIngresso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TelaReservarIngresso().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton10; private javax.swing.JButton jButton100; private javax.swing.JButton jButton101; private javax.swing.JButton jButton102; private javax.swing.JButton jButton11; private javax.swing.JButton jButton12; private javax.swing.JButton jButton13; private javax.swing.JButton jButton14; private javax.swing.JButton jButton15; private javax.swing.JButton jButton16; private javax.swing.JButton jButton17; private javax.swing.JButton jButton18; private javax.swing.JButton jButton19; private javax.swing.JButton jButton20; private javax.swing.JButton jButton21; private javax.swing.JButton jButton22; private javax.swing.JButton jButton23; private javax.swing.JButton jButton24; private javax.swing.JButton jButton25; private javax.swing.JButton jButton26; private javax.swing.JButton jButton27; private javax.swing.JButton jButton28; private javax.swing.JButton jButton29; private javax.swing.JButton jButton3; private javax.swing.JButton jButton30; private javax.swing.JButton jButton31; private javax.swing.JButton jButton32; private javax.swing.JButton jButton33; private javax.swing.JButton jButton34; private javax.swing.JButton jButton35; private javax.swing.JButton jButton36; private javax.swing.JButton jButton37; private javax.swing.JButton jButton38; private javax.swing.JButton jButton39; private javax.swing.JButton jButton4; private javax.swing.JButton jButton40; private javax.swing.JButton jButton41; private javax.swing.JButton jButton42; private javax.swing.JButton jButton43; private javax.swing.JButton jButton44; private javax.swing.JButton jButton45; private javax.swing.JButton jButton46; private javax.swing.JButton jButton47; private javax.swing.JButton jButton48; private javax.swing.JButton jButton49; private javax.swing.JButton jButton5; private javax.swing.JButton jButton50; private javax.swing.JButton jButton51; private javax.swing.JButton jButton52; private javax.swing.JButton jButton53; private javax.swing.JButton jButton54; private javax.swing.JButton jButton55; private javax.swing.JButton jButton56; private javax.swing.JButton jButton57; private javax.swing.JButton jButton58; private javax.swing.JButton jButton59; private javax.swing.JButton jButton6; private javax.swing.JButton jButton60; private javax.swing.JButton jButton61; private javax.swing.JButton jButton62; private javax.swing.JButton jButton63; private javax.swing.JButton jButton64; private javax.swing.JButton jButton65; private javax.swing.JButton jButton66; private javax.swing.JButton jButton67; private javax.swing.JButton jButton68; private javax.swing.JButton jButton69; private javax.swing.JButton jButton7; private javax.swing.JButton jButton70; private javax.swing.JButton jButton71; private javax.swing.JButton jButton72; private javax.swing.JButton jButton73; private javax.swing.JButton jButton74; private javax.swing.JButton jButton75; private javax.swing.JButton jButton76; private javax.swing.JButton jButton77; private javax.swing.JButton jButton78; private javax.swing.JButton jButton79; private javax.swing.JButton jButton8; private javax.swing.JButton jButton80; private javax.swing.JButton jButton81; private javax.swing.JButton jButton82; private javax.swing.JButton jButton83; private javax.swing.JButton jButton84; private javax.swing.JButton jButton85; private javax.swing.JButton jButton86; private javax.swing.JButton jButton87; private javax.swing.JButton jButton88; private javax.swing.JButton jButton89; private javax.swing.JButton jButton9; private javax.swing.JButton jButton90; private javax.swing.JButton jButton91; private javax.swing.JButton jButton92; private javax.swing.JButton jButton93; private javax.swing.JButton jButton94; private javax.swing.JButton jButton95; private javax.swing.JButton jButton96; private javax.swing.JButton jButton97; private javax.swing.JButton jButton98; private javax.swing.JButton jButton99; private javax.swing.JComboBox<String> jComboBox1; private javax.swing.JComboBox<String> jComboBox4; private javax.swing.JComboBox<String> jComboBox5; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel20; private javax.swing.JLabel jLabel21; private javax.swing.JLabel jLabel22; private javax.swing.JLabel jLabel23; private javax.swing.JLabel jLabel24; private javax.swing.JLabel jLabel25; private javax.swing.JLabel jLabel26; private javax.swing.JLabel jLabel27; private javax.swing.JLabel jLabel28; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; // End of variables declaration//GEN-END:variables }
true
6ec3ccdf4224771891aa85c63f6d7bf31b60ad66
Java
gansert/MineFlowCored
/MineFlowCore/src/gmail/inkzzzmc/com/mfc/commands/api/CommandManager.java
UTF-8
1,918
2.3125
2
[]
no_license
package gmail.inkzzzmc.com.mfc.commands.api; import gmail.inkzzzmc.com.mfc.Main; import gmail.inkzzzmc.com.mfc.commands.*; import java.util.HashSet; import java.util.Set; import org.bukkit.plugin.java.JavaPlugin; public class CommandManager { /** * HashSet of commands. */ private static Set<CommandFactory> commands; /** * * Creates commands HashSet. * Registers commands along with their variables (name, arguments, permission, allowconsole) * */ public CommandManager(final Main plugin) { if(commands == null) { commands = new HashSet<>(); } commands.add(new Command_Logout()); commands.add(new Command_Withdraw(plugin)); commands.add(new Command_WithdrawEXP()); commands.add(new Command_Wild()); commands.add(new Command_WithdrawMcMMO()); commands.add(new Command_Feed(plugin)); commands.add(new Command_JellyLegs()); commands.add(new Command_Fix()); commands.add(new Command_Lightning()); commands.add(new Command_LevelUP(plugin)); commands.add(new Command_Levels()); commands.add(new Command_Discount()); commands.add(new Command_BoosterGive()); commands.add(new Command_GiveSpawner()); commands.add(new Command_Giveccegg()); commands.add(new Command_AddCredits()); commands.add(new Command_RemoveCredits()); commands.add(new Command_Credits()); commands.add(new Command_Redeem()); commands.add(new Command_FirstJoinMessage()); } /** * @param name - Name of command. * @return the command factory class dependant on the @param name. */ public static CommandFactory getCommand(String name) { for(CommandFactory cmd : getCommands()) { if(cmd.getName().equalsIgnoreCase(name)) { return cmd; } } return null; } /** * @return the hashset of commands (List). */ public static Set<CommandFactory> getCommands() { return commands; } }
true
5254cec3a66c62f58cb52f7a2ff2d32363614ed1
Java
eunsukimme/2018_JAVA_PROGRAMMING
/SwingPractice/src/KChatClient.java
UHC
3,844
2.75
3
[]
no_license
package Chat; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.io.*; import java.net.Socket; public class KChatClient extends JApplet implements Runnable, ActionListener { DataInputStream is; // stream DataOutputStream os; // stream JTextField login, typein; // for text input JTextArea ta; // for text output // Cvas cvas; // for sketching JPanel portal, chatroom; // two cards CardLayout cardm; // card layout manager public void init() { setGUIcards(); setLayout(cardm = new CardLayout()); add (portal, "card-login"); // card-1 add (chatroom, "card-chat"); // card-2 cardm.show (this.getContentPane(), "card-login"); // show the 1st card } void setGUIcards() { portal = new JPanel(new BorderLayout()); // card-1 portal.add(new JLabel(new ImageIcon("Americano.jpg")), "Center"); // 1-1 JPanel logpan = new JPanel(); login = new JTextField(20); login.addActionListener(this); logpan.add(new JLabel("̸ ")); logpan.add(login); // 1-2.a, 1-2.b portal.add(logpan, "South"); chatroom = new JPanel(new BorderLayout()); // card-2 typein = new JTextField(); typein.addActionListener(this); chatroom.add(typein, "South"); // 2-2 ta = new JTextArea(14, 25*1); ta.setBackground(new Color(220,255,255)); ta.setEditable(false); ta.setLineWrap(true); JScrollPane spane = new JScrollPane(ta, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); chatroom.add(spane, "Center"); // 2-1 (-> replace it with a dual interface) //- dual design here - 7+ } //+ class Cvas public static void main(String args[]) { KChatClient chatter = new KChatClient(); chatter.init(); chatter.start(); JFrame f = new JFrame("Lab XI. CafeGaggle"); f.getContentPane().add(chatter); f.pack(); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void start() { System.out.println("* Thread starting *"); (new Thread (this)).start(); // threading ( ޽ ޴) } public void run() { System.out.println("run: ... ī ȶ ..."); try { // (create a Socket) & IO stream ΰ Socket sock = new Socket("localhost", 2000); is = new DataInputStream(new BufferedInputStream(sock.getInputStream())); os = new DataOutputStream(new BufferedOutputStream(sock.getOutputStream())); execute(); } catch (IOException e) { System.out.println("."); } } public void execute() { // ޽ ޾Ƽ Ѵ. try { while (true) { // get msg from the server(thread) and display them - String msg = is.readUTF(); ta.append(msg + "\n"); } } catch (IOException e) {} finally { System.out.println("stop"); } } String myname; public void actionPerformed (ActionEvent e) { Component c = (Component) e.getSource(); // textfield Է(̸, äñ) о . if ((JTextField) e.getSource() == login) { myname = login.getText(); //System.out.println("login : " + myname + "ε."); try { os.writeUTF(myname); os.flush(); } catch(IOException ioe) { System.out.println("Fail"); } cardm.show(this.getContentPane(), "card-chat"); //ta.append(myname + " !\n"); typein.requestFocus(); // *focus* } else { //- ê from typein - //ta.append(myname + ": "+ typein.getText() + " \n"); try { os.writeUTF(typein.getText()); os.flush(); typein.setText(""); } catch(IOException ioe) {} } } /* KChatClient */ }
true
4762e3004a83ce44935306029054f8352bd6a953
Java
niksust/WebBestBuy
/src/main/java/com/spring/shopping/model/Order.java
UTF-8
1,502
2.046875
2
[]
no_license
package com.spring.shopping.model; import java.math.BigDecimal; import java.util.Date; public class Order { private Long orderId; private java.util.Date createdDate; private java.util.Date updatedDate; private String emailAddress; private String orderStatus; private BigDecimal orderTotal; private Long customerId; private Long addressId; public Long getAddressId() { return addressId; } public void setAddressId(Long addressId) { this.addressId = addressId; } public Long getCustomerId() { return customerId; } public void setCustomerId(Long customerId) { this.customerId = customerId; } public Long getOrderId() { return orderId; } public void setOrderId(Long orderId) { this.orderId = orderId; } public Date getCreatedDate() { return createdDate; } public void setCreatedDate(java.util.Date createdDate) { this.createdDate = createdDate; } public Date getUpdatedDate() { return updatedDate; } public void setUpdatedDate(java.util.Date updatedDate) { this.updatedDate = updatedDate; } public String getEmailAddress() { return emailAddress; } public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } public String getOrderStatus() { return orderStatus; } public void setOrderStatus(String orderStatus) { this.orderStatus = orderStatus; } public BigDecimal getOrderTotal() { return orderTotal; } public void setOrderTotal(BigDecimal orderTotal) { this.orderTotal = orderTotal; } }
true
ff3a1fb187a5bccf8c12141a5e130a116495fcea
Java
KimJinYounga/SNS_gooroomee
/src/main/java/com/gooroomee/api/comment/CommentsController.java
UTF-8
2,650
2.09375
2
[ "MIT" ]
permissive
package com.gooroomee.api.comment; import com.fasterxml.jackson.core.JsonProcessingException; import com.gooroomee.api.post.detail.PostDetailService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; @Controller @Slf4j @RequiredArgsConstructor @CrossOrigin(origins = "*") @RequestMapping("/comments") public class CommentsController { private final CommentsService commentsService; @PostMapping("/{post_id}") public ResponseEntity storeComments(@PathVariable Long post_id, // @RequestParam(value = "parentId", required = false) Long parentId, @RequestBody @Valid CommentsDto commentsDto) { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) return ResponseEntity.status(HttpStatus.FORBIDDEN).build(); String visitorId = authentication.getName(); Comments comment = this.commentsService.storeComments(visitorId, post_id, commentsDto); return ResponseEntity.ok().body(comment); } @GetMapping("/{post_id}") public ResponseEntity getComments(@PathVariable Long post_id) { List<CommentsDto> commentsDto = this.commentsService.getComments(post_id); return ResponseEntity.ok().body(commentsDto); } @GetMapping("/reply/{comments_id}") public ResponseEntity getCommentReplies(@PathVariable Long comments_id) { List<CommentsDto> commentsDto = this.commentsService.findCommentReplies(comments_id); return ResponseEntity.ok().body(commentsDto); } @DeleteMapping("/{comments_id}") public ResponseEntity deletePost(@PathVariable Long comments_id) { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) return ResponseEntity.status(HttpStatus.FORBIDDEN).build(); String visitorId = authentication.getName(); try { Comments comments = this.commentsService.deleteComment(comments_id, visitorId); return ResponseEntity.ok(comments); } catch (IllegalArgumentException e) { return ResponseEntity.badRequest().build(); } } }
true
3fc12482bc8fd337e7eee5af4d4d95a0b4dddd3b
Java
CoisasAvancadas/viserion
/src/main/java/dao/InscricaoEventoDAO.java
UTF-8
462
1.65625
2
[]
no_license
/* * 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 dao; import model.InscricaoEvento; import javax.enterprise.context.RequestScoped; /** * * @author divensi */ @RequestScoped public class InscricaoEventoDAO extends GenericDAO<Integer, InscricaoEvento> { public InscricaoEventoDAO() { super(); } }
true
7d60f6fa4556008bf9cd2959543dca5e668c632b
Java
sauravjaiswalsj/Competitive-Programming
/codes/java/practice/baiscs/Bitwise.java
UTF-8
245
3.40625
3
[]
no_license
public class Bitwise{ public static void main(String[] args){ int a=3; int b=6; int c = a | b; int d=a&b; int e=a^b; int g=~a & 0x0f; int t=0x0f; System.out.printf(" or %d \nand %d\nxor %d\nnot %d \n0x0f = %d",c,d,e,g,t); } }
true
94dba892c3cfdf90d38de4b23576e269ec983cdc
Java
holly199975/Atm
/app/src/main/java/com/holly/atm/GenderActivity.java
UTF-8
1,032
2.046875
2
[]
no_license
package com.holly.atm; import android.content.Intent; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.parseUri; public class GenderActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_gender); } public void next4(View view) { EditText edGender = findViewById(R.id.ed_gender); int gender = Integer.parseInt(edGender.getText().toString()); user.setGender(gender); Intent main = new Intent(GenderActivity.this,MainActivity.class); setResult(RESULT_OK); main.setFlags(FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(main); } public void back2(View view) { finish(); } }
true
b66a87e2d4df96d36c3d2d308140625f63aee8e3
Java
iCodeIN/AP-CS
/Classwork/GrimshawLine/LineMain.java
UTF-8
564
3.296875
3
[]
no_license
public class LineMain { public static void main(String[] args) { int x1 = 0, y1 = 0, x2 = 50, y2 = 50; Point begin = new Point(x1,y1), end = new Point(x2,y2); Line test1 = new Line(begin, end); Line test2 = new Line(x1,y1,x2,y2); System.out.println(test1.getP1().equals(test2.getP1())); System.out.println(test1.getP2().equals(test2.getP2())); System.out.println(test1); System.out.println(test2); System.out.println(test1.getSlope()); System.out.println(test2.getSlope()); } }
true
418f36e9945a42cd7b706d4a4644680ec1b09f02
Java
weijunfeng/googlePlay
/GooglePlay56/src/org/itheima56/googleplay/holder/CategoryTitleHolder.java
UTF-8
1,031
2.25
2
[]
no_license
package org.itheima56.googleplay.holder; import org.itheima56.googleplay.bean.CategoryBean; import org.itheima56.googleplay.utils.UIUtils; import android.graphics.Color; import android.view.View; import android.widget.TextView; /** * @项目名: GooglePlay56 * @包名: org.itheima56.googleplay.holder * @类名: CategoryTitleHolder * @创建者: 肖琦 * @创建时间: 2015-5-7 下午3:39:30 * @描述: TODO * * @svn版本: $Rev: 36 $ * @更新人: $Author: xq $ * @更新时间: $Date: 2015-05-07 15:46:26 +0800 (Thu, 07 May 2015) $ * @更新描述: TODO */ public class CategoryTitleHolder extends BaseHolder<CategoryBean> { private TextView mTv; @Override protected View initView() { mTv = new TextView(UIUtils.getContext()); mTv.setBackgroundColor(Color.WHITE); mTv.setTextColor(Color.GRAY); mTv.setPadding(UIUtils.dip2px(5), UIUtils.dip2px(5), UIUtils.dip2px(5), UIUtils.dip2px(5)); return mTv; } @Override protected void refreshUI(CategoryBean data) { mTv.setText(data.title); } }
true
c2cda49f7a4d97a2b4bd488be29cf7a566a6a12e
Java
jeantravassos/java-algorithms
/src/main/java/com/leetcode/exercises/BinaryTreeLevelOrderTraversal.java
UTF-8
1,701
3.59375
4
[]
no_license
package com.leetcode.exercises; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; public class BinaryTreeLevelOrderTraversal { public static void main(String[] args) { BinaryTreeLevelOrderTraversal btlot = new BinaryTreeLevelOrderTraversal(); TreeNode tnRoot = new TreeNode(3); TreeNode tn1 = new TreeNode(9); TreeNode tn2 = new TreeNode(20); TreeNode tn3 = new TreeNode(15); TreeNode tn4 = new TreeNode(7); tnRoot.left = tn1; tnRoot.right = tn2; tn2.left = tn3; tn2.right = tn4; btlot.levelOrder(tnRoot); } List<List<Integer>> levels = new ArrayList<List<Integer>>(); public List<List<Integer>> levelOrder(TreeNode root) { List<List<Integer>> levels = new ArrayList<List<Integer>>(); if (root == null) return levels; Queue<TreeNode> queue = new LinkedList<TreeNode>(); queue.add(root); int level = 0; while (!queue.isEmpty()) { levels.add(new ArrayList<Integer>()); int level_length = queue.size(); for (int i = 0; i < level_length; ++i) { TreeNode node = queue.remove(); levels.get(level).add(node.val); if (node.left != null) queue.add(node.left); if (node.right != null) queue.add(node.right); } level++; } return levels; } public List<List<Integer>> levelOrderRecursion(TreeNode root) { if (root == null) return levels; helper(root, 0); return levels; } private void helper(TreeNode root, int level) { if (levels.size() == level) levels.add(new ArrayList<>()); levels.get(level).add(root.val); if (root.left != null) helper(root.left, level + 1); if (root.right != null) helper(root.right, level + 1); } }
true
2bf5efe84b4c2ef4a074f0bbdd9cf50b208bbac2
Java
ChangAnOuYang/xvnan
/src/main/java/com/xvnan/jpbc/plaf/pairing/accumulator/MultiThreadedMulPairingAccumulator.java
UTF-8
633
2.3125
2
[]
no_license
package com.xvnan.jpbc.plaf.pairing.accumulator; import com.xvnan.jpbc.api.Element; import com.xvnan.jpbc.api.Pairing; import com.xvnan.jpbc.plaf.pairing.accumulator.AbstractPairingAccumulator; /** * @author Angelo De Caro (jpbclib@gmail.com) * @since 2.0.0 */ public class MultiThreadedMulPairingAccumulator extends AbstractPairingAccumulator { public MultiThreadedMulPairingAccumulator(Pairing pairing) { super(pairing); } public MultiThreadedMulPairingAccumulator(Pairing pairing, Element value) { super(pairing, value); } protected void reduce(Element value) { this.result.mul(value); } }
true
f0a6e16c8c1e4e997b45783821628c3762a0cfc6
Java
BlackHillSoftware/easysmf-samples
/sample-reports/src/main/java/com/smfreports/zedc/ZedcByJob.java
UTF-8
3,802
2.609375
3
[ "Apache-2.0" ]
permissive
package com.smfreports.zedc; import java.io.IOException; import java.util.*; import com.blackhillsoftware.smf.*; import com.blackhillsoftware.smf.smf30.*; public class ZedcByJob { /** * * List compression statistics for jobs using zEDC compression. * */ public static void main(String[] args) throws IOException { if (args.length < 1) { System.out.println("Usage: ZedcByJob <input-name>"); System.out.println( "<input-name> can be filename, //DD:DDNAME or //'DATASET.NAME'"); return; } // A map of job names to JobInfo entries to collect information about each // group of jobs. Map<String, JobInfo> jobs = new HashMap<String, JobInfo>(); try (SmfRecordReader reader = SmfRecordReader .fromName(args[0]) .include(30,5)) { for (SmfRecord record : reader) { Smf30Record r30 = Smf30Record.from(record); if (!r30.zEdcUsageStatisticsSections().isEmpty()) { jobs.computeIfAbsent( r30.identificationSection().smf30jbn(), jobname -> new JobInfo(jobname)) .add(r30); } } } String headingFormat = "%-8s %8s %13s %13s %8s %13s %13s %8s%n"; String detailFormat = "%-8s %,8d %,13d %,13d %6.1f:1 %,13d %,13d %6.1f:1%n"; System.out.format(headingFormat, "Jobname", "Count", "RD Comp MB", "Uncomp MB", "Ratio", "WR Uncomp MB", "Comp MB", "Ratio" ); // Write report jobs.entrySet() .stream() .map(entry -> entry.getValue()) .sorted(Comparator.comparing(JobInfo::getJobname)) .forEachOrdered(jobname -> { System.out.format(detailFormat, jobname.getJobname(), jobname.count, jobname.compRead / (1024 * 1024), jobname.uncompRead / (1024 * 1024), jobname.readCompRatio(), jobname.uncompWrite / (1024 * 1024), jobname.compWrite / (1024 * 1024), jobname.writeCompRatio()); }); System.out.println("Done"); } static class JobInfo { String jobname; int count = 0; long compRead = 0; long uncompRead = 0; long compWrite = 0; long uncompWrite = 0; JobInfo(String jobName) { this.jobname = jobName; } void add(Smf30Record r30) { count++; ZEdcUsageStatisticsSection zedc = r30.zEdcUsageStatisticsSections().get(0); compRead += zedc.smf30UsInfComprIn(); uncompRead += zedc.smf30UsInfDecomprOut(); uncompWrite += zedc.smf30UsDefUncomprIn(); compWrite += zedc.smf30UsDefComprOut(); } float readCompRatio() { if (compRead == 0) return 0; return (float) uncompRead / compRead; } float writeCompRatio() { if (compWrite == 0) return 0; return (float) uncompWrite / compWrite; } String getJobname() { return jobname; } } }
true
72f292b17082ed5bd7f0af1dc238a915afe45725
Java
tusjain/java
/SpringJPAFromSpringDataBook/src/test/java/com/oreilly/springdata/jpa/core/QuerydslProductRepositoryIntegrationTest.java
UTF-8
1,899
2.09375
2
[ "Apache-2.0" ]
permissive
/* * Copyright 2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.oreilly.springdata.jpa.core; import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; import org.hamcrest.Matchers; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.test.context.ContextConfiguration; import com.mysema.query.types.Predicate; import com.oreilly.springdata.jpa.AbstractIntegrationTest; import com.oreilly.springdata.jpa.ApplicationConfig; /** * Integration test showing the usage of Querydsl {@link Predicate} to query repositories implementing * {@link QueryDslPredicateExecutor}. * * @author Oliver Gierke */ @ContextConfiguration(classes = ApplicationConfig.class) public class QuerydslProductRepositoryIntegrationTest extends AbstractIntegrationTest { /* static final QProduct product = QProduct.product; @Autowired ProductRepository repository; @Test public void findProductsByQuerydslPredicate() { Product iPad = repository.findOne(product.name.eq("iPad")); Predicate tablets = product.description.contains("tablet"); Iterable<Product> result = repository.findAll(tablets); assertThat(result, is(Matchers.<Product> iterableWithSize(1))); assertThat(result, hasItem(iPad)); } */ }
true
b9911c5f0be51e28b3036380844a49bae4fa919e
Java
91song/Android-Biiduu
/app/src/main/java/cn/biiduu/biiduu/data/repository/CoinTingRepository.java
UTF-8
1,468
2.21875
2
[]
no_license
package cn.biiduu.biiduu.data.repository; import cn.biiduu.biiduu.data.retrofit.RetrofitHelper; import cn.biiduu.biiduu.protocol.CoinTingDetailsProtocol; import cn.biiduu.biiduu.protocol.CoinTingListProtocol; import rx.Observable; public class CoinTingRepository extends BaseRepository { private static CoinTingRepository instance; public static CoinTingRepository getInstance() { if (instance == null) { synchronized (CoinTingRepository.class) { if (instance == null) { instance = new CoinTingRepository(); } } } return instance; } public Observable<CoinTingListProtocol> listCoinTing(String classify, int offset, int limit) { return transform(RetrofitHelper.getInstance().getCoinTingService().listCoinTing(classify, offset, limit)); } public Observable<CoinTingDetailsProtocol> getCoinTingDetails(String id) { return transform(RetrofitHelper.getInstance().getCoinTingService().getCoinTingDetails(id)); } public Observable<CoinTingDetailsProtocol> updateCoinTingPlayCount(String id) { return transform(RetrofitHelper.getInstance().getCoinTingService().updateCoinTingPlayCount(id)); } public Observable<CoinTingDetailsProtocol> addCoinTingFeedback(String id, String feedback) { return transform(RetrofitHelper.getInstance().getCoinTingService().addCoinTingFeedback(id, feedback)); } }
true
edf28784a91b71206c6e196ce4ef2e0e4e08207c
Java
JackAbel/voyage
/common/src/main/java/cn/sohu/jack/test/MyInvocationHandler.java
UTF-8
930
2.484375
2
[]
no_license
package cn.sohu.jack.test; import sun.misc.PerformanceLogger; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; /** * @description: * @author: Xiangbao Jin * @since 2020/9/10 5:37 PM */ public class MyInvocationHandler implements InvocationHandler { private Object target; public MyInvocationHandler(Object target) { super(); this.target = target; } @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { System.out.println("-------begin-------" + method.getName()); Object result = method.invoke(proxy, args); System.out.println("-------end-------" + method.getName()); return result; } public Object getProxy() { return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), target.getClass().getInterfaces(), this); } }
true
684c87047cf91611bcdffef3cdb8c68428f87e0c
Java
xutto/architecture
/src/main/java/com/practice/controller/HomeController.java
UTF-8
2,780
2.3125
2
[]
no_license
package com.practice.controller; import com.practice.config.PropertiesConfig; import com.practice.extractor.ModelExtractor; import com.practice.model.AnimalModel; import com.practice.model.PersonModel; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller //@Logeable public class HomeController { private final ModelExtractor animalExtractor; private final ModelExtractor personExtractor; private final PropertiesConfig propertiesConfig; @Autowired public HomeController( @Qualifier("animalExtractor") ModelExtractor animalExtractor, @Qualifier("personExtractorImpl") ModelExtractor personExtractor, final PropertiesConfig propertiesConfig) { this.animalExtractor = animalExtractor; this.personExtractor = personExtractor; this.propertiesConfig = propertiesConfig; } @GetMapping(path = "/", headers = "Accept=application/json", produces = {"application/json"}) @ResponseBody public List<PersonModel> homePage(final HttpServletRequest request) { final String propiedad01 = propertiesConfig.getPropiedad01(); final ArrayList<PersonModel> listResult = new ArrayList<>(); final AnimalModel animalModel = new AnimalModel.Builder() .withNick("meli") .withAge("6") .build(); final PersonModel personModel = new PersonModel.Builder() .withName("polloman") .withSurName("loco") .withCustomNick(request.getParameter("nick")) .build(); final List<String> animalExtraction = animalExtractor.extraction(animalModel); final List<String> personExtraction = personExtractor.extraction(personModel); final PersonModel person1 = new PersonModel.Builder() .withName(propiedad01) .withCustomNick(personModel.getCustomNick()) .withSurName(personModel.getSurName()) .withProperties(animalExtraction) .build(); final PersonModel person2 = new PersonModel.Builder() .withName(personModel.getName()) .withCustomNick(personModel.getCustomNick()) .withSurName(personModel.getSurName()) .withProperties(personExtraction) .build(); listResult.add(person1); listResult.add(person2); return listResult; } }
true
db68532601e7836e497ac2d31cbda1da9728c72d
Java
babu967/EasyTourManager
/app/src/main/java/com/codex/easytourmanager/fragments/EventFragment.java
UTF-8
4,109
1.984375
2
[]
no_license
package com.codex.easytourmanager.fragments; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.codex.easytourmanager.AddEventActivity; import com.codex.easytourmanager.R; import com.codex.easytourmanager.adapters.EventRecyclerViewAdapter; import com.codex.easytourmanager.event_class.EventInfo; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.List; /** * A simple {@link Fragment} subclass. */ public class EventFragment extends Fragment { private FloatingActionButton floatingActionButton; private RecyclerView recyclerView; private List<EventInfo> eventInfoList = new ArrayList<EventInfo>(); private EventRecyclerViewAdapter adapter; private FirebaseAuth auth; private FirebaseUser user; private DatabaseReference rootReference, eventReference; private ProgressDialog progressDialog; public EventFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View convertView=inflater.inflate(R.layout.fragment_event, container, false); auth = FirebaseAuth.getInstance(); user = auth.getCurrentUser(); rootReference = FirebaseDatabase.getInstance().getReference(); progressDialog = new ProgressDialog(getContext()); progressDialog.setMessage("Loading Events"); floatingActionButton = convertView.findViewById(R.id.addEventFloatButton); recyclerView = convertView.findViewById(R.id.event_recycler_view); recyclerView.hasFixedSize(); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()); recyclerView.setLayoutManager(linearLayoutManager); getAllEvents(); progressDialog.show(); DatabaseReference eventRef = rootReference.child("user").child(user.getUid()).child("event"); eventRef.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { eventInfoList.clear(); for (DataSnapshot snapshot : dataSnapshot.getChildren()) { EventInfo eventInfo = snapshot.getValue(EventInfo.class); eventInfoList.add(eventInfo); } adapter = new EventRecyclerViewAdapter(getContext(), eventInfoList); recyclerView.setAdapter(adapter); progressDialog.dismiss(); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { progressDialog.dismiss(); Toast.makeText(getActivity(), databaseError.getMessage(), Toast.LENGTH_SHORT).show(); } }); //Toast.makeText(getActivity(), eventInfoList.get(0).getEventDestination(), Toast.LENGTH_SHORT).show(); floatingActionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), AddEventActivity.class); startActivity(intent); } }); return convertView; } public void getAllEvents() { } }
true
7337764151a47ec6f1e53dde9b6cec7959f00173
Java
App-Lancer/student-scoring
/src/test/StudentIdTestCase.java
UTF-8
385
2.265625
2
[]
no_license
//$Id$ package test; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; import main.entities.StudentId; class StudentIdTestCase { @Test void test() { StudentId studentId = new StudentId("UG", 1234); assertEquals("UG", studentId.getIdType()); assertEquals(1234, studentId.getId()); assertEquals("UG1234", studentId.toString()); } }
true
8eea525ee70487c63bdebada3930a813d4d8dac2
Java
JessedeDoes/DutchTagger
/src/main/java/nl/namescape/nelexicon/ElementConcordancer.java
UTF-8
3,477
2.4375
2
[]
no_license
package nl.namescape.nelexicon; import java.util.HashMap; import java.util.List; import java.util.Map; import nl.namescape.tei.TEITagClasses; import nl.namescape.tokenizer.TEITokenizer; import nl.namescape.util.XML; import org.w3c.dom.Document; import org.w3c.dom.Element; import java.util.UUID; public class ElementConcordancer { Map<String, Document> tokenizedParagraphHash = new HashMap<String, Document>(); int quotationLength = 50; public String getConcordance(Element n) { String id; giveElementAnId(n); Element ancestor = (Element) n.getParentNode(); while (true) { String text = ancestor.getTextContent().trim(); String[] words = text.split("\\s+"); org.ivdnt.openconvert.log.ConverterLog.defaultLog.println("SIZE " + words.length); if (words.length > this.quotationLength || TEITagClasses.isSentenceSplittingElement(ancestor)) { break; } try { ancestor = (Element) ancestor.getParentNode(); } catch (Exception e) { break; } } giveElementAnId(ancestor); giveNamesIds(ancestor); Document tokenizedElement = tokenizedParagraphHash.get(ancestor.getAttribute("xml:id")); if (tokenizedElement == null) { tokenizedElement = new TEITokenizer().tokenizeString(XML.NodeToString(ancestor)); tokenizedParagraphHash.put(ancestor.getAttribute("xml:id"), tokenizedElement); // OK dan hebben niet alle NE's hierin een ID! } // org.ivdnt.openconvert.log.ConverterLog.defaultLog.println(XML.documentToString(tokenizedElement)); List<Element> nameInContextx = XML.getElementsByTagnameAndAttribute(tokenizedElement.getDocumentElement(), n.getTagName(), "xml:id", n.getAttribute("xml:id"), false); if (nameInContextx.size() == 0) { org.ivdnt.openconvert.log.ConverterLog.defaultLog.println(n.getAttribute("xml:id") + " NOT FOUND IN " + XML.documentToString(tokenizedElement)); return ""; } Element nameInContext = nameInContextx.get(0); List<Element> words = TEITagClasses.getTokenElements(tokenizedElement.getDocumentElement()); List<Element> wordsInEntity = TEITagClasses.getTokenElements(nameInContext); Element firstWord = wordsInEntity.get(0); Element lastWord = wordsInEntity.get(wordsInEntity.size()-1); int startIndex = 1, endIndex=0; for (int i=0; i < words.size(); i++) { Element w = words.get(i); if (w==firstWord) startIndex=i; if (w==lastWord) endIndex=i; } int start = Math.max(0, startIndex-10); int end = Math.min(words.size(), endIndex+10); String concordance=""; for (int i=start; i < end; i++) { if (i == startIndex) concordance += "<oVar>"; concordance += words.get(i).getTextContent(); if (i== endIndex) concordance += "</oVar>"; if (i < end -1) { concordance += " "; } } org.ivdnt.openconvert.log.ConverterLog.defaultLog.println("CONC: " + concordance); return concordance; } private void giveElementAnId(Element n) { String id = n.getAttribute("xml:id"); if (id == null || id.length() == 0) { id = UUID.randomUUID().toString(); n.setAttribute("xml:id", id); } } private void giveNamesIds(Element ancestor) { List<Element> namez = TEITagClasses.getNameElements(ancestor); for (Element nm: namez) { String id; giveElementAnId(nm); } } }
true
5c544e1cea9830818320c46d12a01e217d5e6f99
Java
Markoy8/Foundry
/Components/LearningCore/Source/gov/sandia/cognition/learning/algorithm/hmm/ParallelHiddenMarkovModel.java
UTF-8
16,733
2.421875
2
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
/* * File: ParallelHiddenMarkovModel.java * Authors: Kevin R. Dixon * Company: Sandia National Laboratories * Project: Cognitive Foundry * * Copyright Feb 4, 2010, Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the U.S. Government. * Export of this program may require a license from the United States * Government. See CopyrightHistory.txt for complete details. * */ package gov.sandia.cognition.learning.algorithm.hmm; import gov.sandia.cognition.algorithm.ParallelAlgorithm; import gov.sandia.cognition.algorithm.ParallelUtil; import gov.sandia.cognition.annotation.PublicationReference; import gov.sandia.cognition.annotation.PublicationType; import gov.sandia.cognition.math.RingAccumulator; import gov.sandia.cognition.math.matrix.Matrix; import gov.sandia.cognition.math.matrix.Vector; import gov.sandia.cognition.math.matrix.VectorFactory; import gov.sandia.cognition.statistics.ComputableDistribution; import gov.sandia.cognition.statistics.ProbabilityFunction; import gov.sandia.cognition.util.AbstractCloneableSerializable; import gov.sandia.cognition.util.DefaultPair; import gov.sandia.cognition.util.ObjectUtil; import gov.sandia.cognition.util.Pair; import gov.sandia.cognition.util.WeightedValue; import java.util.ArrayList; import java.util.Collection; import java.util.concurrent.Callable; import java.util.concurrent.Future; import java.util.concurrent.ThreadPoolExecutor; /** * A Hidden Markov Model with parallelized processing. * @param <ObservationType> Type of Observations handled by the HMM. * @author Kevin R. Dixon * @since 3.0 */ @PublicationReference( author="William Turin", title="Unidirectional and Parallel Baum–Welch Algorithms", type=PublicationType.Journal, publication="IEEE Transactions on Speech and Audio Processing", year=1998, url="http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=00725318" ) public class ParallelHiddenMarkovModel<ObservationType> extends HiddenMarkovModel<ObservationType> implements ParallelAlgorithm { /** * Thread pool used for parallelization. */ private transient ThreadPoolExecutor threadPool; /** * Creates a new instance of ParallelHiddenMarkovModel */ public ParallelHiddenMarkovModel() { super(); } /** * Creates a new instance of ParallelHiddenMarkovModel * @param numStates * Number of states in the HMM. */ public ParallelHiddenMarkovModel( int numStates ) { super( numStates ); } /** * Creates a new instance of ParallelHiddenMarkovModel * @param initialProbability * Initial probability Vector over the states. Each entry must be * nonnegative and the Vector must sum to 1. * @param transitionProbability * Transition probability matrix. The entry (i,j) is the probability * of transition from state "j" to state "i". As a corollary, all * entries in the Matrix must be nonnegative and the * columns of the Matrix must sum to 1. * @param emissionFunctions * The PDFs that emit symbols from each state. */ public ParallelHiddenMarkovModel( Vector initialProbability, Matrix transitionProbability, Collection<? extends ComputableDistribution<ObservationType>> emissionFunctions ) { super( initialProbability, transitionProbability, emissionFunctions ); } /**\ * Creates a new {@code ParallelHiddenMarkovModel} from another * {@code HiddenMarkovModel}. * * @param other * The other hidden Markov model to copy. */ public ParallelHiddenMarkovModel( final HiddenMarkovModel<ObservationType> other) { this(ObjectUtil.cloneSafe(other.getInitialProbability()), ObjectUtil.cloneSafe(other.getTransitionProbability()), ObjectUtil.cloneSmartElementsAsArrayList( other.getEmissionFunctions())); } public ThreadPoolExecutor getThreadPool() { if (this.threadPool == null) { this.setThreadPool(ParallelUtil.createThreadPool()); } return this.threadPool; } public void setThreadPool( ThreadPoolExecutor threadPool) { this.threadPool = threadPool; } public int getNumThreads() { return ParallelUtil.getNumThreads(this); } /** * Observation likelihood tasks */ transient protected ArrayList<ObservationLikelihoodTask<ObservationType>> observationLikelihoodTasks; @Override public double computeMultipleObservationLogLikelihood( Collection<? extends Collection<? extends ObservationType>> sequences) { ArrayList<LogLikelihoodTask> tasks = new ArrayList<LogLikelihoodTask>( sequences.size() ); for( Collection<? extends ObservationType> sequence : sequences ) { tasks.add( new LogLikelihoodTask( sequence ) ); } ArrayList<Double> results = null; try { results = ParallelUtil.executeInParallel(tasks, this.getThreadPool()); } catch (Exception e) { throw new RuntimeException(e); } double logSum = 0.0; for( int i = 0; i < results.size(); i++ ) { logSum += results.get(i); } return logSum; } /** * ComputeTransitionsTasks. */ transient protected ArrayList<ComputeTransitionsTask> computeTransitionTasks; @Override protected Matrix computeTransitions( ArrayList<WeightedValue<Vector>> alphas, ArrayList<WeightedValue<Vector>> betas, ArrayList<Vector> b) { final int N = alphas.size(); if( this.computeTransitionTasks == null ) { this.computeTransitionTasks = new ArrayList<ComputeTransitionsTask>( N-1 ); } // Make sure it's N-1 this.computeTransitionTasks.ensureCapacity(N-1); while( this.computeTransitionTasks.size() > N-1 ) { this.computeTransitionTasks.remove( this.computeTransitionTasks.size()-1 ); } while( this.computeTransitionTasks.size() < N-1 ) { this.computeTransitionTasks.add( new ComputeTransitionsTask() ); } for( int n = 0; n < N-1; n++ ) { final ComputeTransitionsTask tn = this.computeTransitionTasks.get(n); tn.alphan = alphas.get(n).getValue(); tn.betanp1 = betas.get(n+1).getValue(); tn.bnp1 = b.get(n+1); } RingAccumulator<Matrix> counts = new RingAccumulator<Matrix>(); Matrix A = null; try { Collection<Future<Matrix>> futures = this.getThreadPool().invokeAll(this.computeTransitionTasks); for( Future<Matrix> f : futures ) { counts.accumulate( f.get() ); } A = counts.getSum(); A.dotTimesEquals(this.getTransitionProbability()); normalizeTransitionMatrix(A); } catch (Exception ex) { throw new RuntimeException( ex ); } return A; } /** * NormalizeTransitionTasks. */ transient protected ArrayList<NormalizeTransitionTask> normalizeTransitionTasks; @Override protected void normalizeTransitionMatrix( Matrix A) { final int k = A.getNumColumns(); if( this.normalizeTransitionTasks == null ) { this.normalizeTransitionTasks = new ArrayList<NormalizeTransitionTask>( k ); } this.normalizeTransitionTasks.ensureCapacity(k); while( this.normalizeTransitionTasks.size() > k ) { this.normalizeTransitionTasks.remove( this.normalizeTransitionTasks.size() - 1 ); } while( this.normalizeTransitionTasks.size() < k ) { this.normalizeTransitionTasks.add( new NormalizeTransitionTask() ); } for( int j = 0; j < k; j++ ) { NormalizeTransitionTask task = this.normalizeTransitionTasks.get(j); task.j = j; task.A = A; } try { ParallelUtil.executeInParallel( this.normalizeTransitionTasks, this.getThreadPool()); } catch (Exception ex) { throw new RuntimeException( ex ); } } /** * StateObservationLikelihoodTasks */ transient protected ArrayList<StateObservationLikelihoodTask> stateObservationLikelihoodTasks; @Override protected ArrayList<Vector> computeStateObservationLikelihood( ArrayList<WeightedValue<Vector>> alphas, ArrayList<WeightedValue<Vector>> betas, double scaleFactor ) { final int N = alphas.size(); if( this.stateObservationLikelihoodTasks == null ) { this.stateObservationLikelihoodTasks = new ArrayList<StateObservationLikelihoodTask>( N ); } this.stateObservationLikelihoodTasks.ensureCapacity(N); while( this.stateObservationLikelihoodTasks.size() > N ) { this.stateObservationLikelihoodTasks.remove( this.stateObservationLikelihoodTasks.size()-1 ); } while( this.stateObservationLikelihoodTasks.size() < N ) { this.stateObservationLikelihoodTasks.add( new StateObservationLikelihoodTask() ); } for( int n = 0; n < N; n++ ) { StateObservationLikelihoodTask task = this.stateObservationLikelihoodTasks.get(n); task.alpha = alphas.get(n).getValue(); task.beta = betas.get(n).getValue(); } ArrayList<Vector> gammas = null; try { gammas = ParallelUtil.executeInParallel( this.stateObservationLikelihoodTasks, this.getThreadPool()); } catch (Exception e) { throw new RuntimeException( e ); } return gammas; } /** * Viterbi tasks. */ transient protected ArrayList<ViterbiTask> viterbiTasks; @Override protected Pair<Vector, int[]> computeViterbiRecursion( Vector delta, Vector bn ) { final int k = this.getNumStates(); if( this.viterbiTasks == null ) { this.viterbiTasks = new ArrayList<ViterbiTask>( k ); } this.viterbiTasks.ensureCapacity(k); while( this.viterbiTasks.size() > k ) { this.viterbiTasks.remove( this.viterbiTasks.size()-1 ); } while( this.viterbiTasks.size() < k ) { this.viterbiTasks.add( new ViterbiTask() ); } for( int i = 0; i < k; i++ ) { final ViterbiTask task = this.viterbiTasks.get(i); task.destinationState = i; task.delta = delta; } ArrayList<WeightedValue<Integer>> results; try { results = ParallelUtil.executeInParallel( this.viterbiTasks, this.getThreadPool() ); } catch (Exception e) { throw new RuntimeException( e ); } int[] psis = new int[ k ]; Vector nextDelta = VectorFactory.getDefault().createVector(k); for( int i = 0; i < k; i++ ) { WeightedValue<Integer> value = results.get(i); psis[i] = value.getValue(); nextDelta.setElement(i, value.getWeight() ); } nextDelta.dotTimesEquals(bn); nextDelta.scaleEquals( 1.0/nextDelta.norm1() ); return DefaultPair.create( nextDelta, psis ); } /** * Calls the computeObservationLikelihoods() method. * @param <ObservationType> Observation type */ protected static class ObservationLikelihoodTask<ObservationType> extends AbstractCloneableSerializable implements Callable<double[]> { /** * Observations */ protected Collection<? extends ObservationType> observations; /** * The PDF. */ protected ProbabilityFunction<ObservationType> distributionFunction; /** * Default constructor. */ public ObservationLikelihoodTask() { } public double[] call() { final int N = this.observations.size(); double[] b = new double[ N ]; int n = 0; for( ObservationType observation : this.observations ) { b[n] = this.distributionFunction.evaluate(observation); n++; } return b; } } /** * Calls the computeStateObservationLikelihood() method. */ protected static class StateObservationLikelihoodTask extends AbstractCloneableSerializable implements Callable<Vector> { /** * Alpha at time n. */ protected Vector alpha; /** * Beta at time n. */ protected Vector beta; /** * Default constructor. */ public StateObservationLikelihoodTask() { } public Vector call() throws Exception { return ParallelHiddenMarkovModel.computeStateObservationLikelihood( this.alpha, this.beta, 1.0 ); } } /** * Calls the normalizeTransitionMatrix method. */ protected static class NormalizeTransitionTask extends AbstractCloneableSerializable implements Callable<Void> { /** * Matrix to normalize. */ private Matrix A; /** * Column to normalize. */ private int j; /** * Default constructor. */ public NormalizeTransitionTask() { } public Void call() { ParallelHiddenMarkovModel.normalizeTransitionMatrix( this.A, this.j); return null; } } /** * Calls the computeTransitions method. */ protected static class ComputeTransitionsTask extends AbstractCloneableSerializable implements Callable<Matrix> { /** * Alpha at time n. */ Vector alphan; /** * Alpha at time n. */ Vector betanp1; /** * b at time n+1. */ Vector bnp1; /** * Default constructor. */ public ComputeTransitionsTask() { } public Matrix call() { return ParallelHiddenMarkovModel.computeTransitions( this.alphan, this.betanp1, this.bnp1 ); } } /** * Computes the most-likely "from state" for the given "destination state" * and the given deltas. */ protected class ViterbiTask extends AbstractCloneableSerializable implements Callable<WeightedValue<Integer>> { /** * Destination state for the Viterbi Recursion. */ int destinationState; /** * Previous value of the Viterbi Recursion. */ Vector delta; /** * Default constructor */ ViterbiTask() { } public WeightedValue<Integer> call() throws Exception { return ParallelHiddenMarkovModel.this.findMostLikelyState( this.destinationState, this.delta); } } /** * Computes the log-likelihood of a particular data sequence */ protected class LogLikelihoodTask extends AbstractCloneableSerializable implements Callable<Double> { /** * Data to compute the log-likelihood of */ protected Collection<? extends ObservationType> data; /** * Creates a new instance of LogLikelihoodTask * @param data * Data to compute the log-likelihood of */ public LogLikelihoodTask( Collection<? extends ObservationType> data) { this.data = data; } public Double call() throws Exception { return computeObservationLogLikelihood( this.data ); } } }
true
e6ef598d4239b7472b9d93ffbbaedc0faf6e11ce
Java
Morgancentral99/CreativeCore
/src/me/morgancentral99/encrypted/commands/StaffApp.java
UTF-8
583
2.171875
2
[]
no_license
package me.morgancentral99.encrypted.commands; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import net.md_5.bungee.api.ChatColor; public class StaffApp implements CommandExecutor { @Override public boolean onCommand(CommandSender s, Command cmd, String label, String[] args) { if(label.equalsIgnoreCase("StaffApps")) { s.sendMessage(ChatColor.GOLD + "Check if Staff Applications are Open."); s.sendMessage(ChatColor.GOLD + "https://goo.gl/lGqdwv"); return true; } return false; } }
true
8b35a6fcfd551e3487992584b8d30d68e2512bef
Java
zengzw/LLD-JOB
/job/job-po/src/main/java/com/tsh/job/po/CommomAreaPo.java
UTF-8
1,381
2.265625
2
[]
no_license
package com.tsh.job.po; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import java.io.Serializable; @Entity @Table(name = "commom_area") public class CommomAreaPo implements Serializable{ private static final long serialVersionUID = 1L; /** ID*/ private String id; /** 父ID*/ private String pid; /** 名称*/ private String name; /** 城市级别*/ private Long grade; /** 排序*/ private Long sorting; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") public String getId() { return id; } public void setId(String id) { this.id =id; } @Column(name = "pid") public String getPid() { return pid; } public void setPid(String pid) { this.pid =pid; } @Column(name = "name") public String getName() { return name; } public void setName(String name) { this.name =name; } @Column(name = "grade") public Long getGrade() { return grade; } public void setGrade(Long grade) { this.grade =grade; } @Column(name = "sorting") public Long getSorting() { return sorting; } public void setSorting(Long sorting) { this.sorting =sorting; } }
true
571921f0d358e0055d4c6f3d1b7e4aabcec202ef
Java
gitter-badger/guard
/guard-server/src/test/java/com/demkada/guard/server/scope/ScopeManagerITCase.java
UTF-8
11,377
1.8125
2
[ "Apache-2.0" ]
permissive
package com.demkada.guard.server.scope; /* * Copyright 2019 DEMKADA. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @author <a href="mailto:kad@demkada.com">Kad D.</a> */ import com.demkada.guard.server.commons.model.Scope; import com.demkada.guard.server.commons.utils.Constant; import com.demkada.guard.server.crypto.CryptoManager; import info.archinnov.achilles.generated.ManagerFactoryBuilder_For_Guard; import info.archinnov.achilles.generated.ManagerFactory_For_Guard; import info.archinnov.achilles.junit.AchillesTestResource; import info.archinnov.achilles.junit.AchillesTestResourceBuilder; import io.vertx.core.DeploymentOptions; import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.eventbus.DeliveryOptions; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.VertxUnitRunner; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.atomic.AtomicReference; @RunWith(VertxUnitRunner.class) public class ScopeManagerITCase { @Rule public AchillesTestResource<ManagerFactory_For_Guard> resource = AchillesTestResourceBuilder .forJunit() .withScript("guard.cql") .truncateBeforeAndAfterTest() .tablesToTruncate("users_by_email", "clients_by_id", "scopes_by_name", "consents_by_scope", "authz_code", "refresh_token") .build((cluster, statementsCache) -> ManagerFactoryBuilder_For_Guard .builder(cluster) .doForceSchemaCreation(true) .withDefaultKeyspaceName(Constant.GUARD) .build() ); private Vertx vertx; private Scope scope1; private Scope scope2; private Scope scope3; @Before public void SetUp(TestContext testContext) { scope1 = new Scope(); scope1.setName("scope1"); scope1.setEnDescription("Scope 1 description"); scope2 = new Scope(); scope2.setName("scope2"); scope2.setEnDescription("Scope 2 description"); scope3 = new Scope(); scope3.setName("scope3"); scope3.setEnDescription("Scope 3 description"); vertx = Vertx.vertx(); io.vertx.core.Future<String> ScopeManagerFuture = io.vertx.core.Future.future(); vertx.deployVerticle( ScopeManager.class.getName(), new DeploymentOptions().setConfig( new JsonObject() .put(Constant.CASSANDRA_CLUSTER_CONFIG_KEY, "127.0.0.1") .put(Constant.CASSANDRA_CLUSTER_PORT_KEY, Integer.valueOf(resource.getNativeSession().getCluster().getMetadata().getAllHosts().toArray()[0].toString().split(":")[1])) ), ScopeManagerFuture.completer()); Future<String> future = Future.future(); ScopeManagerFuture.compose(v -> vertx.deployVerticle(CryptoManager.class.getName(), future.completer()), future); future.setHandler(testContext.asyncAssertSuccess()); } @After public void tearDown() { vertx.close(); } @Test public void shouldInsertScope(TestContext testContext) { Async async = testContext.async(); DeliveryOptions options = new DeliveryOptions().addHeader(Constant.ACTION, Constant.ACTION_INSERT_SCOPE); JsonObject entries = new JsonObject().put(Constant.SCOPE, JsonObject.mapFrom(scope1)); vertx.eventBus().send(Constant.SCOPE_MANAGER_QUEUE, entries, options, res -> { testContext.assertTrue(res.succeeded()); testContext.assertNotNull(res.result().body()); Scope s = resource.getManagerFactory().forScope().crud().findById("scope1").get(); testContext.assertNotNull(s); testContext.assertEquals(scope1.getEnDescription(), s.getEnDescription()); async.complete(); }); } @Test public void shouldGetAllScopes(TestContext testContext) { Async async = testContext.async(); resource.getManagerFactory().forScope().crud().insert(scope1).execute(); resource.getManagerFactory().forScope().crud().insert(scope2).execute(); resource.getManagerFactory().forScope().crud().insert(scope3).execute(); DeliveryOptions options = new DeliveryOptions().addHeader(Constant.ACTION, Constant.ACTION_GET_SCOPES); JsonObject entries = new JsonObject(); vertx.eventBus().send(Constant.SCOPE_MANAGER_QUEUE, entries, options, res -> { testContext.assertTrue(res.succeeded()); testContext.assertNotNull(res.result().body()); List<Scope> scopes = new ArrayList<>(); JsonObject body = (JsonObject) res.result().body(); JsonArray array = body.getJsonArray(Constant.RESPONSE); array.forEach(o -> { JsonObject object = (JsonObject) o; scopes.add(object.mapTo(Scope.class)); }); testContext.assertNotNull(scopes); testContext.assertEquals(3, scopes.size()); testContext.assertTrue(scopes.stream().anyMatch(client -> "scope1".equalsIgnoreCase(client.getName()))); testContext.assertTrue(scopes.stream().anyMatch(client -> "scope2".equalsIgnoreCase(client.getName()))); testContext.assertTrue(scopes.stream().anyMatch(client -> "scope3".equalsIgnoreCase(client.getName()))); async.complete(); }); } @Test public void shouldGetAllSpecifiedScopes(TestContext testContext) { Async async = testContext.async(); DeliveryOptions options = new DeliveryOptions().addHeader(Constant.ACTION, Constant.ACTION_GET_SCOPES); JsonObject entries = new JsonObject().put(Constant.SCOPE_NAME, new JsonArray(Arrays.asList("scope2", "scope3"))); resource.getManagerFactory().forScope().crud().insert(scope1).execute(); resource.getManagerFactory().forScope().crud().insert(scope2).execute(); resource.getManagerFactory().forScope().crud().insert(scope3).execute(); vertx.eventBus().send(Constant.SCOPE_MANAGER_QUEUE, entries, options, res -> { testContext.assertTrue(res.succeeded()); List<Scope> scopes = new ArrayList<>(); JsonObject body = (JsonObject) res.result().body(); JsonArray array = body.getJsonArray(Constant.RESPONSE); array.forEach(o -> { JsonObject object = (JsonObject) o; scopes.add(object.mapTo(Scope.class)); }); testContext.assertNotNull(scopes); testContext.assertEquals(2, scopes.size()); testContext.assertFalse(scopes.stream().anyMatch(client -> "scope1".equalsIgnoreCase(client.getName()))); testContext.assertTrue(scopes.stream().anyMatch(client -> "scope2".equalsIgnoreCase(client.getName()))); testContext.assertTrue(scopes.stream().anyMatch(client -> "scope3".equalsIgnoreCase(client.getName()))); async.complete(); }); } @Test public void shouldGetScopeByName(TestContext testContext) { Async async = testContext.async(); resource.getManagerFactory().forScope().crud().insert(scope1).execute(); DeliveryOptions options = new DeliveryOptions().addHeader(Constant.ACTION, Constant.ACTION_GET_SCOPE_BY_NAME); JsonObject entries = new JsonObject().put(Constant.SCOPE_NAME, "scope1"); vertx.eventBus().send(Constant.SCOPE_MANAGER_QUEUE, entries, options, res -> { testContext.assertTrue(res.succeeded()); testContext.assertNotNull(res.result().body()); JsonObject body = (JsonObject) res.result().body(); Scope s = body.getJsonObject(Constant.RESPONSE).mapTo(Scope.class); testContext.assertNotNull(s); testContext.assertEquals(scope1.getName(), s.getName()); async.complete(); }); } @Test public void shouldUpdateScope(TestContext testContext) { Async async = testContext.async(); resource.getManagerFactory().forScope().crud().insert(scope1).execute(); AtomicReference<DeliveryOptions> options = new AtomicReference<>(new DeliveryOptions().addHeader(Constant.ACTION, Constant.ACTION_GET_SCOPE_BY_NAME)); AtomicReference<JsonObject> entries = new AtomicReference<>(new JsonObject().put(Constant.SCOPE_NAME, scope1.getName())); vertx.eventBus().send(Constant.SCOPE_MANAGER_QUEUE, entries.get(), options.get(), res -> { testContext.assertTrue(res.succeeded()); testContext.assertNotNull(res.result().body()); JsonObject body = (JsonObject) res.result().body(); Scope s = body.getJsonObject(Constant.RESPONSE).mapTo(Scope.class); testContext.assertNotNull(s); testContext.assertEquals(scope1.getName(), s.getName()); testContext.assertEquals(scope1.getEnDescription(), s.getEnDescription()); scope2.setName(scope1.getName()); options.set(new DeliveryOptions().addHeader(Constant.ACTION, Constant.ACTION_UPDATE_SCOPE)); entries.set(new JsonObject().put(Constant.SCOPE, JsonObject.mapFrom(scope2))); vertx.eventBus().send(Constant.SCOPE_MANAGER_QUEUE, entries.get(), options.get(), reply -> { testContext.assertTrue(reply.succeeded()); testContext.assertNotNull(reply.result().body()); Scope updated = resource.getManagerFactory().forScope().crud().findById(scope1.getName()).get(); testContext.assertNotNull(updated); testContext.assertEquals(scope2.getName(), updated.getName()); testContext.assertEquals(scope2.getEnDescription(), updated.getEnDescription()); async.complete(); }); }); } @Test public void shouldDeleteScope(TestContext testContext) { Async async = testContext.async(); resource.getManagerFactory().forScope().crud().insert(scope2).execute(); DeliveryOptions options = new DeliveryOptions().addHeader(Constant.ACTION, Constant.ACTION_DELETE_SCOPE); JsonObject entries = new JsonObject().put(Constant.SCOPE_NAME, "scope2"); vertx.eventBus().send(Constant.SCOPE_MANAGER_QUEUE, entries, options, res -> { testContext.assertTrue(res.succeeded()); Scope updated = resource.getManagerFactory().forScope().crud().findById(scope2.getName()).get(); testContext.assertNull(updated); async.complete(); }); } }
true
1c119102d97bd33869346e3025e221326aa1c586
Java
brunoalbrito/javacodedemo
/springFrameworkDebug/demoSrc/cn/java/demo/contexttag/internal/DependencyDescriptorTest.java
UTF-8
1,052
2.265625
2
[]
no_license
package cn.java.demo.contexttag.internal; import java.lang.reflect.Field; import java.util.LinkedHashSet; import java.util.Set; import org.springframework.beans.TypeConverter; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.config.DependencyDescriptor; public class DependencyDescriptorTest { public static void main(String[] args) throws Exception { String beanName = "fooService0"; Field field = FooService.class.getField("beanId"); DependencyDescriptor desc = new DependencyDescriptor(field,true); desc.setContainingClass(FooService.class); ConfigurableListableBeanFactory beanFactory = null; //org.springframework.beans.factory.support.DefaultListableBeanFactory Set<String> autowiredBeanNames = new LinkedHashSet<String>(1); TypeConverter typeConverter = beanFactory.getTypeConverter(); Object value = beanFactory.resolveDependency(desc, beanName, autowiredBeanNames, typeConverter); } public static class FooService { public Integer beanId; } }
true
41d231514ac4583e06dbe481890588f1d27d6503
Java
jmno/SGMC
/Mobile SGMC/app/src/main/java/info/mobilesgmc/modelo/ListaProdutosPredefinida.java
UTF-8
1,028
2.453125
2
[]
no_license
package info.mobilesgmc.modelo; /** * Created by Carolina P Soares on 14/01/2015. */ public class ListaProdutosPredefinida { private int id; private String nome; private String especialidade; private String tipoCirurgia; public ListaProdutosPredefinida(){} public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getEspecialidade() { return especialidade; } public void setEspecialidade(String especialidade) { this.especialidade = especialidade; } public String getTipoCirurgia() { return tipoCirurgia; } public void setTipoCirurgia(String tipoCirurgia) { this.tipoCirurgia = tipoCirurgia; } @Override public String toString() { return nome + " - Tipo Cirurgia: " + tipoCirurgia + " - Especialidade=" + especialidade; } }
true
449cccf5e2196f63722af39c2a63a2034cb44766
Java
mkovacek/DesignPatternsJava
/3. MVC, State/src/org/foi/uzdiz/mkovacek/zadaca_4/mvc/ParkingView.java
UTF-8
2,329
3.046875
3
[]
no_license
/* * 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 org.foi.uzdiz.mkovacek.zadaca_4.mvc; import java.util.Comparator; import org.foi.uzdiz.mkovacek.zadaca_4.mvc.model.Car; import org.foi.uzdiz.mkovacek.zadaca_4.mvc.model.Parking; /** * * @author Matija */ public class ParkingView { public void printParkingSalaryByZones() { Parking.getZones().forEach(zone -> { System.out.println("Zone " + zone.getId() + ", ticket salary " + zone.getTicketSalary()); }); } public void printPenaltySalaryByZones() { Parking.getZones().forEach(zone -> { System.out.println("Zone " + zone.getId() + ", penalty salary " + zone.getPenaltySalary()); }); } public void printNotParkedCarsByZones() { Parking.getNotParkedCars().entrySet().forEach(entry -> { System.out.println("U zoni " + entry.getKey() + " ,automobili se nisu mogli " + entry.getValue().size() + " puta parkirati."); System.out.print("("); entry.getValue().forEach(car -> { System.out.print(" auto_" + car.getId() + " "); }); System.out.println(")"); }); } public void printDumpCarsByZones() { Parking.getDumpCars().entrySet().forEach(entry -> { System.out.println("Iz zone " + entry.getKey() + " ,pauk je odveo " + entry.getValue().size() + " puta automobil."); System.out.print("("); entry.getValue().forEach(car -> { System.out.print(" auto_" + car.getId() + " "); }); System.out.println(")"); }); } public void printTopFiveCarsWithMaxNumOfParking() { Parking.getCars().stream().sorted(Comparator.comparing(Car::getParkingCounter).reversed()).limit(5).forEach(car -> { System.out.println("Automobil_" + car.getId() + " ,se parkirao " + car.getParkingCounter() + " puta."); }); } public void printParkingOccupancyByZone() { Parking.getZones().forEach(zone -> { System.out.println("Trenutna popunjenost zone " + zone.getId() + " iznosi " + zone.getOccupancy() + " %"); }); } }
true
1a64995d47d79affd72b73d9ae70a61048cb1d1f
Java
Pronian/SteamGifts
/src/main/java/com/terr/steamgifts/CookieSync.java
UTF-8
1,861
2.546875
3
[]
no_license
package com.terr.steamgifts; import android.content.Context; import android.content.SharedPreferences; public class CookieSync { private static String cookie = ""; private static String token = ""; public static void updateCookie(String cookie, Context context) { String key = context.getResources().getString(R.string.cookie_key); SharedPreferences sharedPref = context.getSharedPreferences( key, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putString(key, cookie); editor.commit(); CookieSync.cookie = cookie; } /** * * @return empty string if nothing has been found */ public static String getCookie(Context context) { if (cookie.isEmpty()) { String key = context.getResources().getString(R.string.cookie_key); SharedPreferences sharedPref = context.getSharedPreferences( key, Context.MODE_PRIVATE); cookie = sharedPref.getString(key, ""); } return cookie; } public static String getToken(Context context) { if (token.isEmpty()) { String key = context.getResources().getString(R.string.cookie_key); SharedPreferences sharedPref = context.getSharedPreferences( key, Context.MODE_PRIVATE); token = sharedPref.getString("token", ""); } return token; } public static void updateToken(String token, Context context) { String key = context.getResources().getString(R.string.cookie_key); SharedPreferences sharedPref = context.getSharedPreferences( key, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putString("token", token); editor.commit(); CookieSync.token = token; } }
true
66b35d8a4a13d5e36e5abf292a9209285dc404d3
Java
ResurrectionRemix/android_frameworks_base
/tests/testables/tests/src/android/testing/TestableLooperTest.java
UTF-8
5,528
2.09375
2
[ "Apache-2.0", "LicenseRef-scancode-unicode" ]
permissive
/* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package android.testing; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.test.suitebuilder.annotation.SmallTest; import android.testing.TestableLooper.MessageHandler; import android.testing.TestableLooper.RunWithLooper; @SmallTest @RunWith(AndroidTestingRunner.class) @RunWithLooper public class TestableLooperTest { private TestableLooper mTestableLooper; @Before public void setup() throws Exception { mTestableLooper = TestableLooper.get(this); } @Test public void testMessageExecuted() throws Exception { Handler h = new Handler(); Runnable r = mock(Runnable.class); h.post(r); verify(r, never()).run(); mTestableLooper.processAllMessages(); verify(r).run(); } @Test public void testMessageCallback() throws Exception { Handler h = new Handler(); Message m = h.obtainMessage(3); Runnable r = mock(Runnable.class); MessageHandler messageHandler = mock(MessageHandler.class); when(messageHandler.onMessageHandled(any())).thenReturn(false); mTestableLooper.setMessageHandler(messageHandler); m.sendToTarget(); h.post(r); mTestableLooper.processAllMessages(); verify(messageHandler).onMessageHandled(eq(m)); // This should never be run becaus the mock returns false on the first message, and // the second will get skipped. verify(r, never()).run(); } @Test public void testProcessNumberOfMessages() throws Exception { Handler h = new Handler(); Runnable r = mock(Runnable.class); h.post(r); h.post(r); h.post(r); mTestableLooper.processMessages(2); verify(r, times(2)).run(); } @Test public void testProcessAllMessages() throws Exception { Handler h = new Handler(); Runnable r = mock(Runnable.class); Runnable poster = () -> h.post(r); h.post(poster); mTestableLooper.processAllMessages(); verify(r).run(); } @Test public void test3Chain() throws Exception { Handler h = new Handler(); Runnable r = mock(Runnable.class); Runnable poster = () -> h.post(r); Runnable poster2 = () -> h.post(poster); h.post(poster2); mTestableLooper.processAllMessages(); verify(r).run(); } @Test public void testProcessAllMessages_2Messages() throws Exception { Handler h = new Handler(); Runnable r = mock(Runnable.class); Runnable r2 = mock(Runnable.class); h.post(r); h.post(r2); mTestableLooper.processAllMessages(); verify(r).run(); verify(r2).run(); } @Test public void testMainLooper() throws Exception { assertNotEquals(Looper.myLooper(), Looper.getMainLooper()); Runnable r = mock(Runnable.class); Runnable r2 = mock(Runnable.class); TestableLooper testableLooper = new TestableLooper(Looper.getMainLooper()); try { testableLooper.setMessageHandler(m -> { if (m.getCallback() == r) return true; return false; }); new Handler(Looper.getMainLooper()).post(r); testableLooper.processAllMessages(); verify(r).run(); verify(r2, never()).run(); } finally { testableLooper.destroy(); } } @Test public void testNonMainLooperAnnotation() { assertNotEquals(Looper.myLooper(), Looper.getMainLooper()); } @Test @RunWithLooper(setAsMainLooper = true) public void testMainLooperAnnotation() { assertEquals(Looper.myLooper(), Looper.getMainLooper()); } @Test public void testCorrectLooperExecution() throws Exception { boolean[] hasRun = new boolean[] { false }; Runnable r = () -> { assertEquals("Should run on main looper", Looper.getMainLooper(), Looper.myLooper()); hasRun[0] = true; }; TestableLooper testableLooper = new TestableLooper(Looper.getMainLooper()); try { new Handler(Looper.getMainLooper()).post(r); testableLooper.processAllMessages(); assertTrue(hasRun[0]); } finally { testableLooper.destroy(); } } }
true
5e5424e60b16f4783c7385025f04c3051581209c
Java
freeflyerTang/springboot
/springboot-mybatis/src/main/java/com/carol/mapper/AccountMapper2.java
UTF-8
344
1.90625
2
[]
no_license
package com.carol.mapper; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; /** * @Description: 采用声明式事务方式 * @Param: * @return: * @Author: Carol Tang * @Date: 2018/9/7 **/ @Mapper public interface AccountMapper2 { int update(@Param("money") Double money,@Param("id") int id); }
true
55e2a0e13fae1a8c32c5d0324df06f40e846434c
Java
DiegoLeal/GRITTO
/src/main/java/gritto/teste/controller/OfertaController.java
UTF-8
297
1.632813
2
[]
no_license
package gritto.teste.controller; import gritto.teste.service.OfertaService; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.RestController; @RestController @RequiredArgsConstructor public class OfertaController { private final OfertaService service; }
true
ef4f989fd266ed21464ed790142bab562b02c3e9
Java
VijayTripurari/online-shopping
/shoppingbackend/src/main/java/net/vijay/shoppingbackend/daoimpl/OrdersDAOImpl.java
UTF-8
1,752
2.078125
2
[]
no_license
package net.vijay.shoppingbackend.daoimpl; import java.util.ArrayList; import java.util.List; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.stereotype.Repository; import net.vijay.shoppingbackend.dao.OrdersDAO; import net.vijay.shoppingbackend.dao.ProductDAO; import net.vijay.shoppingbackend.dto.OrderItem; import net.vijay.shoppingbackend.dto.Orders; import net.vijay.shoppingbackend.dto.Product; @Repository("orderDAO") public class OrdersDAOImpl implements OrdersDAO { @Autowired private SessionFactory sessionFactory; private Orders order; private static AnnotationConfigApplicationContext context; private static OrdersDAO orderDAO; static { context = new AnnotationConfigApplicationContext(); context.scan("net.vijay.shoppingbackend"); context.refresh(); } @Override public boolean addOrdersEntry(Orders order) { boolean result ; try { sessionFactory.getCurrentSession().persist(order); result = true; } catch(Exception ex) { result = false; } return result; } @Override public boolean getOrdersEntry(int id) { return false; } @Override public boolean addOrderItemEntry(OrderItem orderItem) { boolean result ; try { sessionFactory.getCurrentSession().persist(orderItem); result = true; } catch(Exception ex) { result = false; } return false; } @Override public boolean getOrderItemEntry(int id) { // TODO Auto-generated method stub return false; } }
true
c1104ed9a905861b37bfd64b21e8299018927aa2
Java
sixtyeight/jumbrella
/src/main/java/at/metalab/artnet/jaxrs/SetColorApplication.java
UTF-8
1,186
2.453125
2
[]
no_license
package at.metalab.artnet.jaxrs; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.eclipse.jetty.http.HttpStatus; @Path("/api") public class SetColorApplication { @POST @Produces(MediaType.APPLICATION_JSON) @Path("/color") public Response setColor(Color color) { if (color == null) { return Response.status(HttpStatus.BAD_REQUEST_400).build(); } try { ArtnetPackets.sendMainRoom(color.r, color.g, color.b, 0, 0); return Response.ok().build(); } catch (Exception e) { return Response.serverError().build(); } } @POST @Produces(MediaType.APPLICATION_JSON) @Path("/white") public Response setWhite(White white) { if (white == null) { return Response.status(HttpStatus.BAD_REQUEST_400).build(); } try { ArtnetPackets.sendMainRoom(0, 0, 0, white.amber, white.cold); return Response.ok().build(); } catch (Exception e) { return Response.serverError().build(); } } public static class Color { public int r; public int g; public int b; } public static class White { public int amber; public int cold; } }
true
1b07fd8fd4c6f047a85dd8b3de55a52549717491
Java
vincent-hsin/idiosoul-order
/src/main/java/xyz/idiosoul/fair/order/domain/model/cart/CartItem.java
UTF-8
1,367
2.109375
2
[ "Apache-2.0" ]
permissive
/* * 2016-2018 江西侬农网科技有限公司。ALL Rights Reserved */ /* * 2016-2018 江西侬农网科技有限公司。ALL Rights Reserved */ /* * 2016-2018 江西侬农网科技有限公司。ALL Rights Reserved */ package xyz.idiosoul.fair.order.domain.model.cart; import lombok.Getter; import lombok.ToString; import xyz.idiosoul.fair.order.infrastructure.EntityBase; import javax.persistence.Entity; import javax.persistence.Table; import java.math.BigDecimal; import java.time.LocalDateTime; /** * 购物项 Entity */ @Getter @ToString @Entity public class CartItem extends EntityBase<Long> { private Long skuId; private Integer quantity; protected CartItem() { // for Hibernate } public CartItem(Long skuId) { this.skuId = skuId; this.quantity = 0; this.createTime = LocalDateTime.now(); } public CartItem(Long skuId, Integer quantity) { this.skuId = skuId; this.quantity = quantity; this.createTime = LocalDateTime.now(); } public void editSpecification(long specificationId) { this.skuId = specificationId; this.modifyTime = LocalDateTime.now(); } public void editQuantity(int quantity) { this.quantity = quantity; } public void addQuantity(int quantity) { this.quantity += quantity; } }
true
74352e632ccbc56d69dca6baaed8af0b2dc3e447
Java
Bynine/downtilt
/core/src/challenges/Training.java
UTF-8
675
2.5625
3
[]
no_license
package challenges; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import maps.Stage; public class Training extends Mode { List<Challenge> challengeList = new ArrayList<Challenge>(); private List<Wave> wave = new ArrayList<Wave>(Arrays.asList( new Wave(new EnemySpawner(Arrays.asList(EnemyRepo.zenbasic, EnemyRepo.zenshoot, EnemyRepo.zenfly, EnemyRepo.zenheavy), 2, 2, 60)) )); public Training(Stage stage){ wave.get(0).setEndless(); challengeList.add(new ChallengeTraining(stage, wave)); } @Override List<Challenge> getChallengeList() { return challengeList; } @Override Victory getVictory(){ return null; } }
true
e1969e6d5f37a8dfe23ec6561eaa2d1ddea6ac6f
Java
joemardc98/Enrollment-Evaluation-Management-System
/src/com/jhmvin/orm/SQL.java
UTF-8
1,567
2.640625
3
[]
no_license
package com.jhmvin.orm; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Restrictions; public class SQL { private final String propertyName; public SQL(String propertyName) { this.propertyName = propertyName; } /** * * @param propertyName the column in the database * @return */ public static SQL where(String propertyName) { return new SQL(propertyName); } // Logical public static Criterion or(Criterion... predicates) { return Restrictions.or(predicates); } public static Criterion and(Criterion... predicates) { return Restrictions.and(predicates); } public Criterion equalTo(Object value) { return Restrictions.eq(this.propertyName, value); } public Criterion greaterThan(Object value) { return Restrictions.gt(this.propertyName, value); } public Criterion greaterThanEqual(Object value) { return Restrictions.ge(this.propertyName, value); } public Criterion lessThan(Object value) { return Restrictions.lt(this.propertyName, value); } public Criterion lessThanEqual(Object value) { return Restrictions.le(this.propertyName, value); } public Criterion between(Object from, Object to) { return Restrictions.between(this.propertyName, from, to); } public Criterion isNull() { return Restrictions.isNull(propertyName); } public Criterion isNotNull() { return Restrictions.isNotNull(propertyName); } }
true
4accfc809e4be62e43f74c5ddc7b8dbf1f66b63e
Java
orhanturan3898156/SpringJava
/src/Office_Hours/Practice_05_27_2020/Encapsulation.java
UTF-8
887
3.203125
3
[]
no_license
package Office_Hours.Practice_05_27_2020; public class Encapsulation { /* Encapsulation: hiding data by giving private access modifier. - Other source can only access them by getter() and setter() we will be able to use and modify them. -getter():returns private data -Read only -setter():assigning the argument to the private data - write only */ /* Inheritance: It builds relationship between class. Super and subclass relations. super class: subclass: inherits methods and variables (visible) from super class. It is: -Reusable:if you have 100 similiar class, you dont need to create again and again. -readable; -organized; -easy to memorize -easy to maintain */ }
true
40a82ebe6e28cccf7c22edb8079964c17370adae
Java
gyujin0450/spring
/day2/src/main/java/com/iu/s1/board/BoardService.java
UTF-8
633
1.851563
2
[]
no_license
package com.iu.s1.board; import java.util.List; import org.springframework.web.multipart.MultipartFile; import com.iu.s1.util.Pager; public interface BoardService { //글쓰기 // public int boardWrite(BoardVO boardVO) throws Exception; public int boardWrite(BoardVO boardVO, MultipartFile [] files) throws Exception; //글수정 public int boardUpdate(BoardVO boardVO)throws Exception; //글삭제 public int boardDelete(BoardVO boardVO)throws Exception; //글리스트 public List<BoardVO> boardList(Pager pager) throws Exception; //글보기 public BoardVO boardSelect(BoardVO boardVO)throws Exception; }
true
d810288784084d6ea324a2253f89d37d7e18ca22
Java
uk-gov-mirror/hmcts.finrem-case-orchestration-service
/src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/controllers/CaseDataControllerTest.java
UTF-8
13,217
1.726563
2
[ "MIT" ]
permissive
package uk.gov.hmcts.reform.finrem.caseorchestration.controllers; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest; import uk.gov.hmcts.reform.finrem.caseorchestration.service.CaseDataService; import uk.gov.hmcts.reform.finrem.caseorchestration.service.FeatureToggleService; import uk.gov.hmcts.reform.finrem.caseorchestration.service.IdamService; import uk.gov.hmcts.reform.finrem.caseorchestration.service.UpdateSolicitorDetailsService; import static org.hamcrest.Matchers.is; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static uk.gov.hmcts.reform.finrem.caseorchestration.OrchestrationConstants.AUTHORIZATION_HEADER; import static uk.gov.hmcts.reform.finrem.caseorchestration.OrchestrationConstants.NO_VALUE; import static uk.gov.hmcts.reform.finrem.caseorchestration.OrchestrationConstants.YES_VALUE; import static uk.gov.hmcts.reform.finrem.caseorchestration.TestConstants.AUTH_TOKEN; import static uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.CCDConfigConstant.APP_SOLICITOR_POLICY; @SpringBootTest @AutoConfigureMockMvc public class CaseDataControllerTest extends BaseControllerTest { private static final String CONTESTED_HWF_JSON = "/fixtures/contested/hwf.json"; private static final String CONTESTED_VALIDATE_HEARING_SUCCESSFULLY_JSON = "/fixtures/contested/validate-hearing-successfully.json"; @Autowired private CaseDataController caseDataController; @MockBean private UpdateSolicitorDetailsService updateSolicitorDetailsService; @MockBean private IdamService idamService; @MockBean private FeatureToggleService featureToggleService; @MockBean private CaseDataService caseDataService; @Test public void shouldSuccessfullyMoveCollection() throws Exception { when(idamService.isUserRoleAdmin(isA(String.class))).thenReturn(true); String source = "uploadHearingOrder"; String destination = "uploadHearingOrderRO"; loadRequestContentWith(CONTESTED_VALIDATE_HEARING_SUCCESSFULLY_JSON); mvc.perform(post(String.format("/case-orchestration/move-collection/%s/to/%s", source, destination)) .content(requestContent.toString()) .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(APPLICATION_JSON_VALUE)) .andExpect(status().isOk()); verify(caseDataService, times(1)).moveCollection(any(), eq(source), eq(destination)); } @Test public void shouldSuccessfullyReturnAsAdminConsented() throws Exception { when(idamService.isUserRoleAdmin(isA(String.class))).thenReturn(true); loadRequestContentWith(CONTESTED_HWF_JSON); mvc.perform(post("/case-orchestration/consented/set-defaults") .content(requestContent.toString()) .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andExpect(jsonPath("$.data.isAdmin", is(YES_VALUE))); } @Test public void shouldSuccessfullyReturnNotAsAdminConsented() throws Exception { when(idamService.isUserRoleAdmin(isA(String.class))).thenReturn(false); loadRequestContentWith(CONTESTED_VALIDATE_HEARING_SUCCESSFULLY_JSON); mvc.perform(post("/case-orchestration/consented/set-defaults") .content(requestContent.toString()) .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andExpect(jsonPath("$.data.isAdmin", is(NO_VALUE))) .andExpect(jsonPath("$.data.applicantRepresented", is(YES_VALUE))); } @Test public void shouldSuccessfullyReturnAsAdminContested() throws Exception { when(idamService.isUserRoleAdmin(isA(String.class))).thenReturn(true); loadRequestContentWith(CONTESTED_HWF_JSON); mvc.perform(post("/case-orchestration/contested/set-defaults") .content(requestContent.toString()) .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andExpect(jsonPath("$.data.isAdmin", is(YES_VALUE))); } @Test public void shouldSuccessfullyReturnNotAsAdminContested() throws Exception { when(idamService.isUserRoleAdmin(isA(String.class))).thenReturn(false); loadRequestContentWith(CONTESTED_VALIDATE_HEARING_SUCCESSFULLY_JSON); mvc.perform(post("/case-orchestration/contested/set-defaults") .content(requestContent.toString()) .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andExpect(jsonPath("$.data.isAdmin", is(NO_VALUE))) .andExpect(jsonPath("$.data.applicantRepresented", is(YES_VALUE))); } @Test public void shouldSuccessfullyReturnAsAdminConsentedPaperCase() throws Exception { when(idamService.isUserRoleAdmin(isA(String.class))).thenReturn(true); loadRequestContentWith(CONTESTED_HWF_JSON); mvc.perform(post("/case-orchestration/contested/set-paper-case-defaults") .content(requestContent.toString()) .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andExpect(jsonPath("$.data.isAdmin", is(YES_VALUE))) .andExpect(jsonPath("$.data.fastTrackDecision", is(NO_VALUE))) .andExpect(jsonPath("$.data.paperApplication", is(YES_VALUE))); } @Test public void shouldSuccessfullyReturnNotAsAdminConsentedPaperCase() throws Exception { when(idamService.isUserRoleAdmin(isA(String.class))).thenReturn(false); loadRequestContentWith(CONTESTED_VALIDATE_HEARING_SUCCESSFULLY_JSON); mvc.perform(post("/case-orchestration/contested/set-paper-case-defaults") .content(requestContent.toString()) .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andExpect(jsonPath("$.data.isAdmin", is(NO_VALUE))) .andExpect(jsonPath("$.data.fastTrackDecision", is(NO_VALUE))) .andExpect(jsonPath("$.data.paperApplication", is(YES_VALUE))) .andExpect(jsonPath("$.data.applicantRepresented", is(YES_VALUE))); } @Test public void shouldSuccessfullyReturnAsAdminContestedPaperCase() throws Exception { when(idamService.isUserRoleAdmin(isA(String.class))).thenReturn(true); loadRequestContentWith(CONTESTED_HWF_JSON); mvc.perform(post("/case-orchestration/contested/set-paper-case-defaults") .content(requestContent.toString()) .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andExpect(jsonPath("$.data.isAdmin", is(YES_VALUE))) .andExpect(jsonPath("$.data.fastTrackDecision", is(NO_VALUE))) .andExpect(jsonPath("$.data.paperApplication", is(YES_VALUE))); } @Test public void shouldSuccessfullyReturnNotAsAdminContestedPaperCase() throws Exception { when(idamService.isUserRoleAdmin(isA(String.class))).thenReturn(false); loadRequestContentWith(CONTESTED_VALIDATE_HEARING_SUCCESSFULLY_JSON); mvc.perform(post("/case-orchestration/contested/set-paper-case-defaults") .content(requestContent.toString()) .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andExpect(jsonPath("$.data.isAdmin", is(NO_VALUE))) .andExpect(jsonPath("$.data.fastTrackDecision", is(NO_VALUE))) .andExpect(jsonPath("$.data.paperApplication", is(YES_VALUE))) .andExpect(jsonPath("$.data.applicantRepresented", is(YES_VALUE))); } @Test public void shouldSuccessfullySetOrgPolicy() throws Exception { when(idamService.isUserRoleAdmin(isA(String.class))).thenReturn(false); when(caseDataService.isContestedApplication(any())).thenReturn(true); loadRequestContentWith(CONTESTED_VALIDATE_HEARING_SUCCESSFULLY_JSON); mvc.perform(post("/case-orchestration/contested/set-paper-case-org-policy") .content(requestContent.toString()) .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andExpect(jsonPath("$.data.ApplicantOrganisationPolicy.OrgPolicyCaseAssignedRole", is(APP_SOLICITOR_POLICY))); } public void shouldNotSetOrgPolicyIfInvalidCaseType() throws Exception { when(idamService.isUserRoleAdmin(isA(String.class))).thenReturn(Boolean.FALSE); when(caseDataService.isContestedApplication(any())).thenReturn(false); when(caseDataService.isConsentedApplication(any())).thenReturn(false); loadRequestContentWith(CONTESTED_VALIDATE_HEARING_SUCCESSFULLY_JSON); mvc.perform(post("/case-orchestration/contested/set-paper-case-org-policy") .content(requestContent.toString()) .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andExpect(jsonPath("$.data.ApplicantOrganisationPolicy").doesNotExist()); } @Test public void shouldSuccessfullyPopulateApplicantSolicitorAddressContested() { when(featureToggleService.isRespondentJourneyEnabled()).thenReturn(true); when(caseDataService.isApplicantRepresentedByASolicitor(any())).thenReturn(true); CallbackRequest callbackRequest = buildCallbackRequest(); caseDataController.setContestedDefaultValues(AUTH_TOKEN, callbackRequest); verify(updateSolicitorDetailsService, times(1)).setApplicantSolicitorOrganisationDetails(AUTH_TOKEN, callbackRequest.getCaseDetails()); } @Test public void shouldNotPopulateApplicantSolicitorAddressContested_toggledOff() { when(featureToggleService.isRespondentJourneyEnabled()).thenReturn(false); when(caseDataService.isApplicantRepresentedByASolicitor(any())).thenReturn(true); caseDataController.setContestedDefaultValues(AUTH_TOKEN, buildCallbackRequest()); verifyNoInteractions(updateSolicitorDetailsService); } @Test public void shouldNotPopulateApplicantSolicitorAddressContested_notRepresented() { when(featureToggleService.isRespondentJourneyEnabled()).thenReturn(true); when(caseDataService.isApplicantRepresentedByASolicitor(any())).thenReturn(false); caseDataController.setContestedDefaultValues(AUTH_TOKEN, buildCallbackRequest()); verifyNoInteractions(updateSolicitorDetailsService); } @Test public void shouldSuccessfullyPopulateApplicantSolicitorAddressConsented() { when(featureToggleService.isRespondentJourneyEnabled()).thenReturn(true); when(caseDataService.isApplicantRepresentedByASolicitor(any())).thenReturn(true); CallbackRequest callbackRequest = buildCallbackRequest(); caseDataController.setConsentedDefaultValues(AUTH_TOKEN, callbackRequest); verify(updateSolicitorDetailsService, times(1)).setApplicantSolicitorOrganisationDetails(AUTH_TOKEN, callbackRequest.getCaseDetails()); } @Test public void shouldNotPopulateApplicantSolicitorAddressConsented_toggledOff() { when(featureToggleService.isRespondentJourneyEnabled()).thenReturn(false); when(caseDataService.isApplicantRepresentedByASolicitor(any())).thenReturn(true); caseDataController.setConsentedDefaultValues(AUTH_TOKEN, buildCallbackRequest()); verifyNoInteractions(updateSolicitorDetailsService); } @Test public void shouldNotPopulateApplicantSolicitorAddressConsented_notRepresented() { when(featureToggleService.isRespondentJourneyEnabled()).thenReturn(true); when(caseDataService.isApplicantRepresentedByASolicitor(any())).thenReturn(false); caseDataController.setConsentedDefaultValues(AUTH_TOKEN, buildCallbackRequest()); verifyNoInteractions(updateSolicitorDetailsService); } }
true
21f740432d9d6e8f8faf9c7936f979d09c701c0e
Java
RobertoPacho/PachoMorocho-Jose-Examen
/src/ec/edu/ups/modelo/Reserva.java
ISO-8859-1
3,773
2.5625
3
[]
no_license
package ec.edu.ups.modelo; import java.io.Serializable; import java.util.Calendar; import javax.persistence.*; /** * Entity implementation class for Entity: Reserva * */ @Entity public class Reserva implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; /* * e. Luego, debe ingresar el nmero de personas, la fecha y la hora de la * reserva. * */ private Calendar fecha; private int maxPersonas; @ManyToOne @JoinColumn private Cliente cliente; @ManyToOne @JoinColumn private Restaurante restaurante; public Reserva() { super(); } public Reserva(int id, Calendar fecha, int maxPersonas, Cliente cliente, Restaurante restaurante) { super(); this.id = id; this.fecha = fecha; this.maxPersonas = maxPersonas; this.cliente = cliente; this.restaurante = restaurante; } public Reserva(int id, Calendar fecha, int maxPersonas, Restaurante restaurante) { super(); this.id = id; this.fecha = fecha; this.maxPersonas = maxPersonas; this.restaurante = restaurante; } public Reserva(int id, Calendar fecha, int maxPersonas, Cliente cliente) { super(); this.id = id; this.fecha = fecha; this.maxPersonas = maxPersonas; this.cliente = cliente; } public Reserva(Calendar fecha, int maxPersonas, Cliente cliente, Restaurante restaurante) { super(); this.fecha = fecha; this.maxPersonas = maxPersonas; this.cliente = cliente; this.restaurante = restaurante; } public int getId() { return id; } public void setId(int id) { this.id = id; } public Calendar getFecha() { return fecha; } public void setFecha(Calendar fecha) { this.fecha = fecha; } /** * @return the maxPersonas */ public int getMaxPersonas() { return maxPersonas; } /** * @param maxPersonas the maxPersonas to set */ public void setMaxPersonas(int maxPersonas) { this.maxPersonas = maxPersonas; } /** * @return the cliente */ public Cliente getCliente() { return cliente; } /** * @param cliente the cliente to set */ public void setCliente(Cliente cliente) { this.cliente = cliente; } /** * @return the restaurante */ public Restaurante getRestaurante() { return restaurante; } /** * @param restaurante the restaurante to set */ public void setRestaurante(Restaurante restaurante) { this.restaurante = restaurante; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((cliente == null) ? 0 : cliente.hashCode()); result = prime * result + ((fecha == null) ? 0 : fecha.hashCode()); result = prime * result + id; result = prime * result + maxPersonas; result = prime * result + ((restaurante == null) ? 0 : restaurante.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Reserva other = (Reserva) obj; if (cliente == null) { if (other.cliente != null) return false; } else if (!cliente.equals(other.cliente)) return false; if (fecha == null) { if (other.fecha != null) return false; } else if (!fecha.equals(other.fecha)) return false; if (id != other.id) return false; if (maxPersonas != other.maxPersonas) return false; if (restaurante == null) { if (other.restaurante != null) return false; } else if (!restaurante.equals(other.restaurante)) return false; return true; } @Override public String toString() { return "Reserva [id=" + id + ", fecha=" + fecha + ", maxPersonas=" + maxPersonas + ", clienteReserva=" + cliente + ", restauranteReserva=" + restaurante + "]"; } }
true
349fdb5ba8efb2f278aabd0625d2fdb87bcacd64
Java
DevilC/TaskManagerBaseOnRedis
/src/main/java/taskLoadExceptionPackage/ExceptionFactory.java
UTF-8
1,685
3.09375
3
[]
no_license
package taskLoadExceptionPackage; import taskPackage.Section; import taskPackage.StepTag; import java.lang.annotation.Annotation; import java.lang.reflect.Method; public class ExceptionFactory { /** * 一个方法只能被一个step定义 * @param method 目标方法 * @throws MethodAnnotationDefineExceedMax 抛异常 */ public static void requireOnlyOneStepOnMethod(Method method) throws MethodAnnotationDefineExceedMax { Annotation annotations[] = method.getAnnotations(); checkTargetTagMaxNum(StepTag.class, method, 1); } /** * 一个方法只能被一个section定义 * @param method 目标方法 * @throws MethodAnnotationDefineExceedMax 抛异常 */ public static void requireOnlyOneSectionOnMethod(Method method) throws MethodAnnotationDefineExceedMax { Annotation annotations[] = method.getAnnotations(); checkTargetTagMaxNum(Section.class, method, 1); } /** * 检查目标tag是否在annotations[]中超过规定的count值 * @param targetTag 目标tag类型 * @param method 待检测方法 * @param max 目标最高数量 */ public static void checkTargetTagMaxNum(Class targetTag, Method method, int max) throws MethodAnnotationDefineExceedMax { int count = 0; Annotation annotations[] = method.getAnnotations(); for(Annotation annotation: annotations){ if(annotation.annotationType().equals(targetTag)){ count ++; if(count > max){ throw new MethodAnnotationDefineExceedMax(targetTag, max, method); } } } } }
true
87a45a163a8e6f070c7997dd0f774bfc802eeb4a
Java
alphagov/pay-connector
/src/main/java/uk/gov/pay/connector/charge/model/domain/FeeType.java
UTF-8
793
2.34375
2
[ "LicenseRef-scancode-proprietary-license", "MIT" ]
permissive
package uk.gov.pay.connector.charge.model.domain; import com.fasterxml.jackson.annotation.JsonValue; import org.apache.commons.lang3.StringUtils; import java.util.Arrays; public enum FeeType { RADAR("radar"), THREE_D_S("three_ds"), TRANSACTION("transaction"); FeeType(String name) { this.name = name; } private String name; @JsonValue public String getName() { return name; } public static FeeType fromString(String feeTypeValue) { return Arrays.stream(FeeType.values()) .filter(feeTypeEnum -> StringUtils.equals(feeTypeEnum.getName(), feeTypeValue)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("fee type not recognized: " + feeTypeValue)); } }
true
cd4912aa82b15fec87b4f2e8321b791ef7321c8b
Java
OsiriX-Foundation/KheopsAuthorization
/kheopsAuthorization/src/main/java/online/kheops/auth_server/marshaller/JSONAttributesListMarshaller.java
UTF-8
3,550
2.234375
2
[ "MIT" ]
permissive
package online.kheops.auth_server.marshaller; import org.dcm4che3.data.Attributes; import org.dcm4che3.json.JSONReader; import org.dcm4che3.json.JSONWriter; import javax.json.Json; import javax.json.stream.JsonGenerator; import javax.json.stream.JsonParser; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import java.io.*; import java.lang.annotation.Annotation; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; @Provider @Consumes("application/dicom+json,application/json,text/plain") @Produces("application/dicom+json,application/json") public class JSONAttributesListMarshaller implements MessageBodyReader<List<Attributes>>, MessageBodyWriter<List<Attributes>> { @Override public boolean isReadable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType) { if (aClass.isAssignableFrom(List.class) && type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; return parameterizedType.getActualTypeArguments()[0] == Attributes.class; } return false; } @Override public List<Attributes> readFrom(Class aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap multivaluedMap, InputStream inputStream) throws IOException { final List<Attributes> list = new ArrayList<>(); if(mediaType.isCompatible(MediaType.TEXT_PLAIN_TYPE)) { if(inputStream.read() != -1) { throw new IOException("Expected empty inputstream"); } } else { try (final JsonParser parser = Json.createParser(new FilterInputStream(inputStream) { @Override public void close() {/* close shield */} })) { final JSONReader jsonReader = new JSONReader(parser); jsonReader.readDatasets((fmi, dataset) -> list.add(dataset)); } catch (Exception e) { throw new WebApplicationException("Error while reading JSON datasets", e); } } return list; } @Override public boolean isWriteable(Class<?> aClass, Type genericType, Annotation[] annotations, MediaType mediaType) { if (List.class.isAssignableFrom(aClass) && genericType instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) genericType; return parameterizedType.getActualTypeArguments()[0] == Attributes.class; } return false; } @Override public void writeTo(List<Attributes> attributesList, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) { try (final JsonGenerator generator = Json.createGenerator(new FilterOutputStream(entityStream) { @Override public void close() {/* close shield */} })) { final JSONWriter jsonWriter = new JSONWriter(generator); generator.writeStartArray(); for (final Attributes attributes : attributesList) { jsonWriter.write(attributes); } generator.writeEnd(); generator.flush(); } } }
true
830d2a5bc3838ff8dfe94d40f915fdcc5861f3e2
Java
OsmanBrito/Accorgol
/app/src/main/java/io/rerum/accorgol/view/jogador/fragments/JogadorPerfilFragment.java
UTF-8
11,451
1.664063
2
[]
no_license
package io.rerum.accorgol.view.jogador.fragments; import android.app.AlertDialog; import android.app.Fragment; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.support.annotation.NonNull; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; import com.beardedhen.androidbootstrap.BootstrapButton; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.OnPausedListener; import com.google.firebase.storage.OnProgressListener; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import com.squareup.picasso.Picasso; import java.io.IOException; import java.io.InputStream; import io.rerum.accorgol.R; import io.rerum.accorgol.controller.FirebaseHelper; import io.rerum.accorgol.dao.UsuarioDAO; import io.rerum.accorgol.view.jogador.EditPerfilJogador; import static android.app.Activity.RESULT_OK; /** * Created by osman on 19/11/2017. */ public class JogadorPerfilFragment extends Fragment { private ImageButton fotoButton; private ImageView fotoPerfil; private static final int GALLERY_INTENT = 2; private Context ctx; private StorageReference mStorage; private ProgressDialog progressDoalog; private DatabaseReference mDatabase; private TextView nome; private TextView rg; private TextView dataNascimento; private TextView posicao; private TextView pedominante; private TextView altura; private TextView estado; private TextView cidade; private TextView celular; private BootstrapButton botao; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.perfil_jogador_fragment, container, false); ctx = view.getContext(); mStorage = FirebaseStorage.getInstance().getReference(); nome = (TextView) view.findViewById(R.id.visualizarNomeJogadorPerfil); rg = (TextView) view.findViewById(R.id.visualizarRGPerfilJogador); dataNascimento = (TextView) view.findViewById(R.id.visualizarAnoPerfilJogador); posicao = (TextView) view.findViewById(R.id.visualizarPosicaoJogadorPerfil); pedominante = (TextView) view.findViewById(R.id.visualizarPeJogadorPerfil); altura = (TextView) view.findViewById(R.id.visualizarAlturaJogador); estado = (TextView) view.findViewById(R.id.visualizarEstadoJogador); cidade = (TextView) view.findViewById(R.id.visualizarCidadeJogador); celular = (TextView) view.findViewById(R.id.visualiarCelularJogador); botao = (BootstrapButton) view.findViewById(R.id.editarPerfilJogador); buscarPerfilJogador(); SemVideoFragment semVideoFragment = new SemVideoFragment(); ComVideoFragment comVideoFragment = new ComVideoFragment(); android.app.FragmentManager manager = getFragmentManager(); if (new UsuarioDAO(view.getContext()).hasVideo() == 1 || new FirebaseHelper().recuperar(view.getContext(), "VideoPerfil").equals("Tem")){ manager.beginTransaction().replace(R.id.contentContainervideoJogador, comVideoFragment, comVideoFragment.getTag()).commit(); } else { manager.beginTransaction().replace(R.id.contentContainervideoJogador, semVideoFragment, semVideoFragment.getTag()).commit(); } fotoButton = (ImageButton) view.findViewById(R.id.addFotoPerfil); fotoPerfil = (ImageView) view.findViewById(R.id.visualizarFotoDadosPessoais); fotoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { new AlertDialog.Builder(view.getContext()) .setTitle("Escolha de Foto") .setMessage("Escolha uma opção para adicionar uma fotoButton.") .setPositiveButton("Galeria", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intent, GALLERY_INTENT); } }) .setNeutralButton("Capturar", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dispatchTakeVideoIntent(); } }) .setIcon(R.mipmap.ic_launcher) .setNegativeButton("Cancel", null) .show(); } }); botao.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(ctx, EditPerfilJogador.class); startActivity(intent); } }); return view; } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if ((requestCode == GALLERY_INTENT && resultCode == RESULT_OK) || requestCode == 2) { final Uri uri = data.getData(); final StorageReference filepath = mStorage.child("Fotos/Perfil").child(String.valueOf(new FirebaseHelper().recuperar(ctx, String.valueOf(R.string.id_Usuario)))); progressDoalog = new ProgressDialog(ctx); progressDoalog.setMax(100); progressDoalog.setMessage("Upload da fotoButton"); progressDoalog.setTitle("Fazendo o upload da fotoButton"); progressDoalog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressDoalog.show(); filepath.putFile(uri).addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() { @Override public void onProgress(UploadTask.TaskSnapshot taskSnapshot) { double progress = (100.0 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount(); // Toast.makeText(ctx, "Download: "+progress+"% ", Toast.LENGTH_LONG).show(); System.out.println("Upload is " + progress + "% done"); progressDoalog.setProgress((int) progress); progressDoalog.setCancelable(false); if (progress == 100) { UsuarioDAO dao = new UsuarioDAO(ctx); dao.attFotoUsuario(true); progressDoalog.dismiss(); FirebaseHelper firebaseHelper = new FirebaseHelper(); Uri testeUri = taskSnapshot.getMetadata().getDownloadUrl(); String id = firebaseHelper.recuperar(ctx, String.valueOf(R.string.id_Usuario)); firebaseHelper.armazenar(ctx, String.valueOf(testeUri), String.valueOf(R.string.foto_perfil)); firebaseHelper.attPerfilJogador("/Jogadores/"+id+"/urifoto", String.valueOf(testeUri)); Picasso.with(ctx).load(testeUri).into(fotoPerfil); } } }).addOnPausedListener(new OnPausedListener<UploadTask.TaskSnapshot>() { @Override public void onPaused(UploadTask.TaskSnapshot taskSnapshot) { System.out.println("Upload is paused"); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { // Handle unsuccessful uploads } }).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { // Handle successful uploads on complete Uri downloadUrl = taskSnapshot.getMetadata().getDownloadUrl(); } }); } } public void buscarPerfilJogador(){ FirebaseDatabase database = FirebaseDatabase.getInstance(); final DatabaseReference myRef = database.getReference("/Jogadores/"+new FirebaseHelper().recuperar(ctx, String.valueOf(R.string.id_Usuario))); myRef.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { Log.e("COEEEE", "buscar empresario Ondatachange"); nome.setText(dataSnapshot.child("nomeCompleto").getValue(String.class)); posicao.setText(dataSnapshot.child("posicao").getValue(String.class)); pedominante.setText(dataSnapshot.child("peDominante").getValue(String.class)); altura.setText(dataSnapshot.child("altura").getValue(String.class)); rg.setText(dataSnapshot.child("rg").getValue(String.class)); dataNascimento.setText(dataSnapshot.child("anoNascimento").getValue(String.class)); cidade.setText(dataSnapshot.child("cidade").getValue(String.class)); estado.setText(dataSnapshot.child("estado").getValue(String.class)); celular.setText(dataSnapshot.child("celular").getValue(String.class)); } @Override public void onCancelled(DatabaseError databaseError) { } }); } private void dispatchTakeVideoIntent() { Intent takeVideoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // if (takeVideoIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takeVideoIntent, 2); // } } @Override public void onStart(){ // mDatabase = FirebaseDatabase.getInstance().getReference(); try { Picasso.with(ctx).load(new FirebaseHelper().recuperar(ctx, String.valueOf(R.string.foto_perfil)).toString()).into(fotoPerfil); }catch (Exception e){ Log.e("USUARIO CATHC!!! ", String.valueOf(e)); InputStream istr = null; try { istr = ctx.getAssets().open("ic_laucher.png"); this.fotoPerfil.setImageDrawable(Drawable.createFromStream(istr, null)); } catch (IOException e1) { e1.printStackTrace(); } //set drawable from stream } super.onStart(); } }
true
6077a78b49b74edc7079c31662e7bd210677585d
Java
fshiraz2/JavaBasicsNew
/src/com/syntax/class07/HW.java
UTF-8
273
2.8125
3
[]
no_license
package com.syntax.class07; public class HW { public static void main(String[] args) { //Print numbers from 1 to 100 in 1 line with space //Print numbers from 100 to 1 //Print even numbers from 20 to 1 (2 ways) //Print odd numbers between 20 and 50 (2 ways) } }
true
16ea920224961645d0cc9c1b3e48a29a70dd61ed
Java
yveslox/Genesisras
/practice-code-blue/programme-java/findaverage-number.java
UTF-8
358
3.15625
3
[]
no_license
import java.util.Scanner; class findaveragenumber { public static void main(String args[]) { System.out.println("Input 5 numbers: "); Scanner input = new Scanner("Syteme.in"); int i= 1; int sum = 0; while(i<= 5) { sum = sum + input.nextInt(); i++; } int avg = sum / 5; System.out.println("Average number is : " + avg); } }
true
f1dde6f12c0ad9019fd0fd91bb85cf5193066ea5
Java
bigstar18/prjs
/prj/otcol/web-mgr-platform/src/main/java/gnnt/MEBS/delivery/command/aop/CheckRealFunds.java
UTF-8
2,248
2.03125
2
[ "Apache-2.0" ]
permissive
package gnnt.MEBS.delivery.command.aop; import gnnt.MEBS.base.util.Arith; import gnnt.MEBS.delivery.command.Information; import gnnt.MEBS.delivery.command.SettleReceive; import gnnt.MEBS.delivery.command.model.SettleObject; import gnnt.MEBS.delivery.command.settleExtra.SettleBalanceCheck; import gnnt.MEBS.delivery.model.settle.SettleMatch; import gnnt.MEBS.delivery.services.MoneyDoService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.aspectj.lang.ProceedingJoinPoint; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; public class CheckRealFunds { private final transient Log logger = LogFactory.getLog(CheckRealFunds.class); @Autowired @Qualifier("w_moneyDoService") private MoneyDoService moneyDoService; public Object around(ProceedingJoinPoint paramProceedingJoinPoint) throws Throwable { this.logger.debug("进入交易商资金检查"); SettleReceive localSettleReceive = (SettleReceive)paramProceedingJoinPoint.getTarget(); int i = 0; Object localObject = null; SettleBalanceCheck localSettleBalanceCheck = localSettleReceive.getSettleBalanceCheck(); if (localSettleBalanceCheck.isBalance()) { Object[] arrayOfObject = paramProceedingJoinPoint.getArgs(); Information localInformation = (Information)arrayOfObject[0]; SettleObject localSettleObject = (SettleObject)localInformation.getObject(); SettleMatch localSettleMatch = localSettleObject.getSettleMatch(); double d1 = localSettleObject.getAmount(); String str = ""; if ("B".equals(localSettleBalanceCheck.getBuyOrSell())) { str = localSettleMatch.getFirmID_B(); } else { str = localSettleMatch.getFirmID_S(); } if (localSettleBalanceCheck.isDeduction()) { d1 = -d1; } double d2 = this.moneyDoService.getFirmFunds(str); if (Arith.sub(d2, d1) < 0.0D) { i = -14; } } if (i == 0) { localObject = paramProceedingJoinPoint.proceed(); } else { localObject = Integer.valueOf(i); } return localObject; } }
true
bbb3d2c9e19a9200fb9fbe4cab853e794e1d1c31
Java
mguptasast/mgsample
/SpringMVC/src/com/web/FormController2.java
UTF-8
1,248
2.09375
2
[]
no_license
package com.web; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.multiaction.MultiActionController; @Controller @RequestMapping(value="/Form2.spring") public class FormController2 //extends MultiActionController { public FormController2() { System.out.println("***FormController2 created"); } @RequestMapping(method=RequestMethod.GET,params="operation=create") public void create() { System.out.println("***Create"); } @RequestMapping(method=RequestMethod.GET,params="operation=view") public void view() { System.out.println("***View"); } @RequestMapping(method=RequestMethod.GET,params="operation=delete") public void delete() { System.out.println("***Delete"); } /* @RequestMapping(value="/Delete",method=RequestMethod.GET) public void delete() { System.out.println("***Delete"); } */}
true
9babfb62c4bf9b321e910ba282919ff00d2df22c
Java
eschoysman/Mapper
/test/extra/CountBuilderWays.java
UTF-8
5,097
2.765625
3
[ "MIT" ]
permissive
package extra; import es.utils.mapper.Mapper; import es.utils.mapper.factory.builder.*; import es.utils.mapper.impl.object.ClassMapper; import java.lang.reflect.Method; import java.text.MessageFormat; import java.util.*; import java.util.stream.Collectors; public class CountBuilderWays { private final static Class<?>[] STEPS = new Class<?>[]{ Name.class, From.class, DefaultInput.class, Transformer.class, DefaultOutput.class, To.class, Consume.class, Builder.class }; private static int[][] weights; private static Map<Class<?>,List<Method>> usedMethods; private static int[] ways; public static void main(String[] args) { countWays(); printMatrix(); printUsedMethod(); printWays(); } private static void countWays() { Map<Class<?>,Collection<String>> ignoreMethodsForStep = new HashMap<>(); usedMethods = new LinkedHashMap<>(); countWays(ignoreMethodsForStep); } private static void countWays(Map<Class<?>,Collection<String>> ignoreMethodsForStep) { int n = STEPS.length; initWays(); weights = new int[n][n]; for(int i=0; i<n-1; i++) { // ciclo DA (step di provvenienza) Method[] methods = STEPS[i].getDeclaredMethods(); for(Method method : methods) { if(!ignoreMethodsForStep.getOrDefault(STEPS[i],new HashSet<>()).contains(method.getName())) { Class<?> destination = method.getReturnType(); for(int j=i+1; j<n; j++) { // ciclo A (step di destinazione) if(STEPS[j].isAssignableFrom(destination)) { usedMethods.merge(STEPS[i],new ArrayList<>(Arrays.asList(method)),(a, b)->{a.addAll(b); return a;}); weights[i][j]++; } } } } for(int j=i; j<n; j++) { // ciclo A ways[j] += ways[i]*weights[i][j]; } } } private static void initWays() { int n = STEPS.length; ways = new int[n]; try { Method startingMethod = EMBuilder.class.getDeclaredMethod("using", Mapper.class, ClassMapper.class); Class<?> destination = startingMethod.getReturnType(); for (int i = 0; i < n; i++) { if (STEPS[i].isAssignableFrom(destination)) { ways[i]++; } } } catch (NoSuchMethodException e) { ways[0] = 1; // di base solo il primo step è l'ingresso } } private static void printWays() { String[] names = Arrays.stream(STEPS).map(Class::getSimpleName).toArray(String[]::new); for(int step=1; step<STEPS.length; step++) { System.out.println(MessageFormat.format("Modi diversi possibili da {0} a {1}: {2}", names[0], names[step], ways[step])); } } private static void printMatrix() { String[] headers = Arrays.stream(STEPS).map(Class::getSimpleName).toArray(String[]::new); int[] widths = new int[headers.length]; widths[0] = (headers[0].length()+1)/2; int maxWidth = Arrays.stream(headers).mapToInt(String::length).max().orElse(0); for(int i=1; i<headers.length; i++) { widths[i] = (headers[i-1].length()+headers[i].length()+1)/2; } String splitter = "DA \\ A"; System.out.printf("%"+maxWidth+"s ",splitter); Arrays.stream(headers).forEach(h->System.out.print(" "+h)); System.out.println(); for(int i=0; i<weights.length; i++) { System.out.printf("%"+maxWidth+"s ",headers[i]); for(int j=0; j<weights[i].length; j++) { System.out.printf("%"+(widths[j]+1)+"d", weights[i][j]); } System.out.println(); } } private static void printUsedMethod() { try { usedMethods.put(STEPS[STEPS.length-1],Arrays.asList(STEPS[STEPS.length-1].getMethod("create"))); } catch (NoSuchMethodException e) { e.printStackTrace(); } for(Map.Entry<Class<?>,List<Method>> e : usedMethods.entrySet()) { StringBuilder sb = new StringBuilder(e.getKey().getSimpleName()); sb.append(": "); int prefixLength = sb.length(); String prefix = "\n"; for(int i=0; i<prefixLength; i++) { prefix += " "; } StringJoiner sj = new StringJoiner(prefix); for(Method method : e.getValue()) { sj.add(Arrays.stream(method.getParameterTypes()) .map(Class::getSimpleName) .collect(Collectors.joining(", ", method.getName()+"(",")")) ); } sb.append(sj); System.out.println(sb.toString()); } } }
true
7561dfd35275271afb3ba19e59447adee43b50d8
Java
davidecorsi/java-method-reference
/src/Main.java
UTF-8
1,126
3.96875
4
[]
no_license
import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; /* * I method reference possono essere applicati a 4 tipi di metodo */ public class Main { public static void main(String[] args) { Consumer<String> consumer1 = s -> System.out.println(s); // metodi statici Consumer<String> consumer2 = System.out::println; class Example { public Example() { } public Example(Integer integer) { } } Supplier<Example> supplier1 = () -> new Example(); // costruttore senza argomenti Supplier<Example> supplier2 = Example::new; Function<Integer, Example> function1 = integer -> new Example(integer); // costruttore con argomento Function<Integer, Example> function2 = Example::new; Function<String, String> supplier3 = s -> s.toLowerCase(); // metodo di istanza del tipo di oggetto Function<String, String> supplier4 = String::toLowerCase; Integer integer = 10; Supplier<String> supplier5 = () -> integer.toString(); // metodo di istanza di un oggetto specifico Supplier<String> supplier6 = integer::toString; } }
true
d65bbed368b5aedeb9da59f71d084d82705f1885
Java
Shtramak/hillel-course-project
/education/src/test/java/com/courses/tellus/persistence/repository/hibernate/UniversityRestRepositoryMockTest.java
UTF-8
4,173
2.359375
2
[]
no_license
package com.courses.tellus.persistence.repository.hibernate; import javax.persistence.EntityManager; import javax.persistence.EntityTransaction; import javax.persistence.Query; import javax.persistence.TransactionRequiredException; import java.util.ArrayList; import java.util.List; import com.courses.tellus.entity.model.University; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.willThrow; import static org.mockito.Matchers.*; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.verify; class UniversityRestRepositoryMockTest { @Mock private EntityManager entityManager; @Mock private EntityTransaction transaction; @Mock private University university; @Mock private Query query; private UniversityRepository repository; @BeforeEach void setup() { MockitoAnnotations.initMocks(this); repository = new UniversityRepository(entityManager); } @Test void getAllTestAndReturnList() { List<University> universities = new ArrayList<>(); universities.add(new University()); given(entityManager.createQuery(anyString())).willReturn(query); given(query.getResultList()).willReturn(universities); assertEquals(1, repository.getAll().size()); } @Test void getAllTestAndThrowException() { given(entityManager.createQuery(anyString())).willThrow(IllegalArgumentException.class); assertEquals(0, repository.getAll().size()); } @Test void getByIdTestAndReturnEntity() { given(entityManager.find(any(), anyLong())).willReturn(university); assertTrue(repository.getById(1L).isPresent()); } @Test void getByIdTestAndThrowException() { given(entityManager.find(any(), anyLong())).willThrow(IllegalArgumentException.class); assertFalse(repository.getById(1L).isPresent()); } @Test void updateTestAndReturnSuccessfulValue() { given(entityManager.getTransaction()).willReturn(transaction); assertEquals(1, repository.update(university)); verify(entityManager, atLeastOnce()).merge(university); } @Test void updateTestAndThrowException() { given(entityManager.getTransaction()).willReturn(transaction); given(entityManager.merge(university)).willThrow(TransactionRequiredException.class); assertEquals(0, repository.update(university)); verify(transaction, atLeastOnce()).rollback(); } @Test void insertTestAndReturnSuccessfulValue() { given(entityManager.getTransaction()).willReturn(transaction); assertEquals(1, repository.insert(university)); verify(entityManager, atLeastOnce()).persist(university); } @Test void insertTestAndThrowException() { given(entityManager.getTransaction()).willReturn(transaction); willThrow(TransactionRequiredException.class).given(entityManager).persist(university); assertEquals(0, repository.insert(university)); verify(transaction, atLeastOnce()).rollback(); } @Test void deleteTestAndReturnSuccessfulValue() { given(entityManager.getTransaction()).willReturn(transaction); given(entityManager.find(any(), anyLong())).willReturn(university); assertEquals(1, repository.delete(1L)); verify(entityManager, atLeastOnce()).remove(university); } @Test void deleteTestAndThrowException() { given(entityManager.getTransaction()).willReturn(transaction); given(entityManager.find(any(), anyLong())).willThrow(TransactionRequiredException.class); willThrow(TransactionRequiredException.class).given(entityManager).remove(university); assertEquals(0, repository.delete(1L)); verify(transaction, atLeastOnce()).rollback(); } }
true
90f5d09e3b73532195a58948808c7d208a42b088
Java
josemontiel/ClientManager
/app/src/main/java/com/josemontiel/clientmanager/MainActivityFragment.java
UTF-8
6,031
2.3125
2
[]
no_license
package com.josemontiel.clientmanager; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; import com.josemontiel.clientmanager.models.Client; import com.josemontiel.clientmanager.ui.ClientItemDecoration; import io.realm.Realm; import io.realm.RealmChangeListener; import io.realm.RealmResults; import java.util.ArrayList; import java.util.List; /** * A placeholder fragment containing a simple view. */ public class MainActivityFragment extends Fragment { private Unbinder unbinder; @BindView(R.id.client_rv) RecyclerView recyclerView; ClientAdapter adapter; List<Client> clientList = new ArrayList<>(); /* Callback method. To be called after a Realm Query is done. * */ private RealmChangeListener<RealmResults<Client>> realmChangeListener = new RealmChangeListener<RealmResults<Client>>() { @Override public void onChange(RealmResults<Client> results) { clientList.clear(); for (int i = 0; i < results.size(); i++) { Client client = results.get(i); clientList.add(client); } // Only initialize the RecyclerView and Adapter once. Then just notify the adapter. if (adapter == null) { adapter = new ClientAdapter(clientList); recyclerView.addItemDecoration(new ClientItemDecoration(getContext())); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setLayoutManager( new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); recyclerView.setAdapter(adapter); } else { adapter.notifyDataSetChanged(); } } }; public MainActivityFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_main, container, false); unbinder = ButterKnife.bind(this, view); return view; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); } @Override public void onResume() { super.onResume(); final Realm realm = Realm.getDefaultInstance(); realm.where(Client.class).findAllSortedAsync("firstName").addChangeListener(realmChangeListener); } @Override public void onDestroyView() { // Unbind Butterknife to prevent mem leaks. unbinder.unbind(); // Remove Realm listeners final Realm realm = Realm.getDefaultInstance(); realm.removeAllChangeListeners(); super.onDestroyView(); } class ClientAdapter extends RecyclerView.Adapter<ClientAdapter.ClientHolder> { List<Client> clientList; ClientAdapter(List<Client> clientList) { this.clientList = clientList; } @Override public ClientHolder onCreateViewHolder(ViewGroup parent, int viewType) { final View view = LayoutInflater.from(getContext()).inflate(R.layout.item_client, parent, false); final ClientHolder clientHolder = new ClientHolder(view); clientHolder.rootView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final int position = clientHolder.getAdapterPosition(); Client client = getClient(position); editClient(client); } }); clientHolder.callButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final int position = clientHolder.getAdapterPosition(); Client client = getClient(position); makeCall(client); } }); return clientHolder; } @Override public void onBindViewHolder(ClientHolder holder, int position) { Client client = getClient(position); holder.nameTv.setText(client.firstName+" "+client.lastName); holder.dobTv.setText(client.dob); holder.phoneTv.setText(client.phoneNumber); holder.zipTv.setText(String.valueOf(client.zipCode)); } @Override public int getItemCount() { return clientList != null ? clientList.size() : 0; } Client getClient(int position) { return clientList.get(position); } class ClientHolder extends RecyclerView.ViewHolder { View rootView; @BindView(R.id.item_client_name) TextView nameTv; @BindView(R.id.item_client_phone) TextView phoneTv; @BindView(R.id.item_client_dob) TextView dobTv; @BindView(R.id.item_client_zip) TextView zipTv; @BindView(R.id.item_client_call) Button callButton; ClientHolder(View itemView) { super(itemView); this.rootView = itemView; // Bind Views. ButterKnife.bind(this, itemView); } } } /** * Initiates the Client Activity with a phone number to find a {@link Client} and edit it * @param client {@link Client} existing Client to edit */ private void editClient(Client client) { Intent intent = new Intent(getContext(), ClientActivity.class); intent.putExtra(ClientActivity.EXTRA_CLIENT_PHONE, client.phoneNumber); startActivity(intent); } /** * Opens the Dialer app with the {@link Client#phoneNumber} pre filled. * @param client {@link Client} existing Client to call */ private void makeCall(Client client) { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:"+client.phoneNumber)); startActivity(intent); } }
true
2e27aa58ffbdaa7fba01527b4ade39e113ecbca2
Java
sengeiou/zeroner_app
/sources/com/inuker/bluetooth/library/connect/listener/BleConnectStatusListener.java
UTF-8
402
2.125
2
[]
no_license
package com.inuker.bluetooth.library.connect.listener; import com.inuker.bluetooth.library.receiver.listener.BluetoothClientListener; public abstract class BleConnectStatusListener extends BluetoothClientListener { public abstract void onConnectStatusChanged(String str, int i); public void onSyncInvoke(Object... args) { onConnectStatusChanged(args[0], args[1].intValue()); } }
true
b175bd153311f9c0ce9d3800ff5e5ddc7aa3ded0
Java
Ivanko-Mosiychuk/FlightRadarTest
/IdeaProjects/FlyRadar/src/test/java/ua/radar/tests/StatisticPageTest.java
UTF-8
1,138
2.265625
2
[]
no_license
package ua.radar.tests; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import ua.radar.base.BasePage; import ua.radar.base.BaseTest; import ua.radar.pages.MainPage; import ua.radar.pages.StatisticPage; public class StatisticPageTest extends BaseTest { private StatisticPage statisticPage; @BeforeClass public void preparePage() { System.out.println("Before class " + this.getClass().getSimpleName()); statisticPage = new MainPage().goToStatisticPage(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } @Test public void testRadarListIsEmpty(){ Assert.assertTrue(statisticPage.isRadarListNotEmpty()); } @Test public void testCountryIsInList(){ Assert.assertTrue(statisticPage.isCountryInList("Germany")); } @AfterClass public void goToMainPage(){ System.out.println("After class " + this.getClass().getSimpleName()); statisticPage.goToMainPage(); } }
true
6bb96ad42e4176c82c21ab0ab2f30ba9a6b28585
Java
RogrB/GameOfLife
/gol_prosedyre/CellGrid.java
UTF-8
4,900
3
3
[]
no_license
package gol_prosedyre; public class CellGrid { private double boardheight; private double boardwidth; private cell[] cells; private int nextIndex = 0; private static CellGrid inst = new CellGrid(); private CellGrid() { } public static CellGrid getInstance() {return inst; } public void init(double boardheight, double boardwidth) { this.boardheight = boardheight; this.boardwidth = boardwidth; int input = (int)boardheight*(int)boardwidth; this.cells = new cell[input]; } public double getBoardHeight() { return this.boardheight; } public double getBoardWidth() { return this.boardwidth; } public cell[] getCells() { return this.cells; } public void createCell(int x, int y, boolean alive) { this.cells[nextIndex] = new cell(x, y, alive); nextIndex++; } public void setCellState(int x, int y, boolean state) { for (int i = 0; i < cells.length; i++) { if (cells[i].getCellX() == x && cells[i].getCellY() == y) { cells[i].setState(state); } } } public boolean getCellState(int x, int y) { for (int i = 0; i < cells.length; i++) { if (cells[i].getCellX() == x && cells[i].getCellY() == y) { return cells[i].getState(); } } return false; } public void resetCells() { nextIndex = 0; for (int i = 0; i < boardwidth; i++) { for (int j = 0; j < boardheight; j++) { this.cells[nextIndex] = new cell(i, j, false); nextIndex++; } } } public void fillDead() { int teller = 0; for (int i = 0; i < boardwidth; i++) { for (int j = 0; j < boardheight; j++) { if (!cells[teller].getState()) { this.cells[teller] = new cell(i, j, false); } teller++; } } } public void testPrint() { int teller = 0; for (int i = 0; i < boardwidth; i++) { for (int j = 0; j < boardheight; j++) { if (this.cells[teller].getState()) { System.out.print("X"); } else { System.out.print("-"); } teller++; } System.out.println(); } } public void checkNextGeneration() { int neighbours = 0; for (int i = 0; i < this.boardwidth; i++) { for (int j = 0; j < this.boardwidth; j++) { if (getCellState(i, j-1)) { neighbours++; } if (getCellState(i, j+1)) { neighbours++; } if (getCellState(i-1, j-1)) { neighbours++; } if (getCellState(i-1, j)) { neighbours++; } if (getCellState(i-1, j+1)) { neighbours++; } if (getCellState(i+1, j-1)) { neighbours++; } if (getCellState(i+1, j)) { neighbours++; } if (getCellState(i+1, j+1)) { neighbours++; } setNeighbours(i, j, neighbours); neighbours = 0; } neighbours = 0; } nextGeneration(); } public void setNeighbours(int x, int y, int neighbours) { for (int i = 0; i < cells.length; i++) { if (cells[i].getCellX() == x && cells[i].getCellY() == y) { cells[i].setNeighbours(neighbours); } } } public void nextGeneration() { // setter cellestatus i henhold til spillets regler for (int i = 0; i < cells.length; i++) { if (cells[i].getState() == true && cells[i].getNeighbours() < 2) { cells[i].setState(false); } if (cells[i].getState() == true && cells[i].getNeighbours() == 2 || cells[i].getNeighbours() == 3) { // trengs vel egentlig ikke? cells[i].setState(true); } if (cells[i].getState() == true && cells[i].getNeighbours() > 3) { cells[i].setState(false); } if (cells[i].getState() == false && cells[i].getNeighbours() == 3) { cells[i].setState(true); } } } }
true
9b212c36c2cb99ab573789234f5624a76266cac6
Java
omeros/Algoquest
/AlgoquestOld.java
UTF-8
12,006
3.125
3
[]
no_license
package Algoquest; import java.awt.Rectangle; /** * The algorithem for Finds the largest Bound in an a given Main Bound . * * @author (Omer Golan) * @version (15.11.19) //(04.01.16) */ public class AlgoquestOld { int count; int counEreaIsBlock; /* Constructor for objects of class Algoquest */ public AlgoquestOld() { count=0; counEreaIsBlock=0; } /******** checking if a given area is clear of shapes **********************************/ public boolean ereaIsClear(double l,double r,double t,double b, Bound [] arrayOfShaps) /***************************************************************************************/ { int length=arrayOfShaps.length; int i; for(i=0;i<length;i++) { double t2=arrayOfShaps[i].getTop(); double b2=arrayOfShaps[i].getBottom(); double r2=arrayOfShaps[i].getRight(); double l2=arrayOfShaps[i].getLeft(); // Rectangle rect = new Rectangle(l,b,r-l,t-b); //(int x, int y, int width, int height) // top left top right if( ( ( (b<t2)&&(t2<=t)&&(l<=l2)&&(l2<r) )|| (b<t2)&&(t2<=t)&&(l<r2)&&(r2<=r) ) ){ //--1 return false; } // bottom left bottom right if( ( (b<=b2)&&(b2<t)&&(l<=l2)&&(l2<r) )|| ( (b<=b2)&&(b2<t)&&(l<r2)&&(r2<=r) ) ){ //--2 return false; } // top and bottom of other is in this bound if( ( (b<t2)&&(t2<=t)&&(l2<=l)&&(r<=r2) )||( (b<=b2)&&(b2<t)&&(l2<=l)&&(r<=r2) )) { return false; } // right and left of other is in this bound if( ( (b2<=b)&&(t<=t2)&&(l<=l2)&&(l2<r) ) || ( (b2<=b)&&(t<=t2)&&(l<r2)&&(r2<=r) ) ) { return false; } // the array of Bounds is cover the coordinates if( (b2<=b)&&(t<=t2)&&(l2<=l)&&(r<=r2) ) { return false; } // the array of Bounds is inside of the coordinates if( (b<=b2)&&(t2<=t)&&(l<=l2)&&(r2<=r) ) { return false; } } return true; } /** check to see if the Bound is full of shapes *******************************/ public boolean ereaIsBlock(double l,double r,double t,double b, Bound [] arrayOfShaps) /******************************************************************************/ { System.out.println(" ereaIsBlock function : "+counEreaIsBlock); counEreaIsBlock++; if( coordinatesInShap(l,r,t,b,arrayOfShaps) ) // <===================== { return true; } if (ereaIsClear(l,r,t,b,arrayOfShaps ) ) { return false; } return ( ereaIsBlock(l,((r-l)/2)+l,t,((t-b)/2)+b,arrayOfShaps) )&& ( ereaIsBlock(((r-l)/2)+l,r,t,((t-b)/2)+b,arrayOfShaps)) && ( ereaIsBlock(l,((r-l)/2)+l,((t-b)/2)+b,b,arrayOfShaps) )&& ( ereaIsBlock(((r-l)/2)+l,r,((t-b)/2)+b,b,arrayOfShaps) ); } /******************checking if a given cordinates is in a shape Bound**************/ public boolean coordinatesInShap(double l,double r,double t,double b, Bound [] arrayOfShaps) /*****************************************************************************/ { int i; double top; double botttom; double left; double right; for ( i=0;i<arrayOfShaps.length;i++) { top=arrayOfShaps[i].getTop(); botttom=arrayOfShaps[i].getBottom(); left=arrayOfShaps[i].getLeft(); right=arrayOfShaps[i].getRight(); if( ((botttom<=b)&&(t<=top)&&(left<=l)&&(r<=right) )) { return true; } } return false; } /************ The Main algorithm ************************************************/ public BoundList findMax(double l,double r,double t,double b, Bound []arrayOfShaps) /*******************************************************************************/ { System.out.println(" Main function : "+count); count++; if (ereaIsClear(l,r,t,b,arrayOfShaps ) ) { Bound newB =new Bound(l,r,t,b); BoundNode bn=new BoundNode(newB,null); BoundList bl =new BoundList(bn); return bl; } if(ereaIsBlock(l,r,t,b,arrayOfShaps) ) { return null; } BoundList b1; BoundList b2; BoundList b3; BoundList b4; b1=findMax(l,((r-l)/2)+l,t,((t-b)/2)+b,arrayOfShaps); // left top b2=findMax(((r-l)/2)+l,r,t,((t-b)/2)+b,arrayOfShaps); // right top b3=findMax(l,((r-l)/2)+l,((t-b)/2)+b,b,arrayOfShaps); // left bottom b4=findMax(((r-l)/2)+l,r,((t-b)/2)+b,b,arrayOfShaps); // right bottom BoundList b5=unitTheGroup(b1,b2,b3,b4); b1=null; b2=null; b3=null; b4=null; return b5; } /***** unit the bounds in 4 difference lists of Bounds to one list of bound *************/ public BoundList unitTheGroup(BoundList b1,BoundList b2,BoundList b3,BoundList b4) /*************************************************************************************/ { BoundList p1=b1; BoundList p2=b2; BoundList f1; BoundList f2; BoundList f3; BoundList f4; if ((b1!=null)&&(b2!=null)&&(b3!=null)&&(b4!=null) ){ f1=b1.combine(b2); //combin b1 and b2 to new list- f1 f2=b2.combine(b1); f1.refresh(); f2.refresh(); f1=f1.unit(f2); f1=f1.combine(b3); //combin f1 and b3 to new list- f1 f2=b3.combine(f1); f1.refresh(); f2.refresh(); f1=f1.unit(f2); f1=f1.combine(b4); //combin f1 and b4 to new list- f1 f2=b4.combine(f1); f1.refresh(); f2.refresh(); f1=f1.unit(f2); return f1; } // 1 list are null if ((b1!=null)&&(b2!=null)&&(b3!=null)&&(b4==null) ){ f1=b1.combine(b2); //combin b1 and b2 to new list- f1 f2=b2.combine(f1); // f1=f1.combin(f2); // f2=f2.combin(f1); f2=f2.unit(f1); f3=f2.combine(b3); //combin f1 and b3 to new list- f1 f4=b3.combine(f3); // f4=f4.combin(f3); // f4=f3.combin(f4); f4=f4.unit(f3); return f4; } if ((b1!=null)&&(b2!=null)&&(b3==null)&&(b4!=null) ){ f1=b1.combine(b2); //combin b1 and b2 to new list- f1 f2=b2.combine(b1); f2=f2.unit(f1); f2=f2.combine(b4); //combin f2 and b4 to new list- f1 f3=b4.combine(f2); f4=f3.unit(f2); return f4; } if ((b1!=null)&&(b2==null)&&(b3!=null)&&(b4!=null) ){ f1=b1.combine(b3); //combin b1 and b3 to new list- f1 f2=b3.combine(b1); f2=f1.unit(f2); f3=f2.combine(b4); //combin f2 and b4 to new list- f1 f4=b4.combine(f3); f4=f4.unit(f3); return f4; } if ((b1==null)&&(b2!=null)&&(b3!=null)&&(b4!=null) ){ f1=b2.combine(b3); //combin b2 and b3 to new list- f1 f2=b3.combine(f1); f1=f1.unit(f2); f3=f1.combine(b4); //combin f1 and b4 to new list- f1 f4=b4.combine(f3); f4=f3.unit(f4); return f4; } /// 2 lists are null if ((b1==null)&&(b2==null)&&(b3!=null)&&(b4!=null) ){ f1=b3.combine(b4); //combin b3 and b4 to new list- f1 f2=b4.combine(f1); f2=f2.unit(f1); return f2; } if ((b1!=null)&&(b2==null)&&(b3==null)&&(b4!=null) ){ f1=b1.combine(b4); //combin b1 and b4 to new list- f1 f2=b4.combine(f1); return f2; } if ((b1!=null)&&(b2!=null)&&(b3==null)&&(b4==null) ){ f1=b1.combine(b2); //combin b1 and b2 to new list- f1 f2=b2.combine(f1); f2=f2.unit(f1); return f2; } if ((b1!=null)&&(b2==null)&&(b3!=null)&&(b4==null) ){ f1=b1.combine(b3); //combin b1 and b3 to new list- f1 f2=b3.combine(f1); f2=f2.unit(f1); return f2; } if ((b1==null)&&(b2!=null)&&(b3!=null)&&(b4==null) ){ f1=b2.combine(b3); //combin b2 and b3 to new list- f1 f2=b3.combine(f1); f2=f2.unit(f1); return f2; } if ((b1==null)&&(b2!=null)&&(b3==null)&&(b4!=null) ){ f1=b2.combine(b4); //combin b2 and b4 to new list- f1 f2=b4.combine(f1); f2=f2.unit(f1); return f2; } // one list is not null if ((b1!=null)&&(b2==null)&&(b3==null)&&(b4==null) ){ return b1; } if ((b1==null)&&(b2!=null)&&(b3==null)&&(b4==null) ){ return b2; } if ((b1==null)&&(b2==null)&&(b3!=null)&&(b4==null) ){ return b3; } if ((b1==null)&&(b2==null)&&(b3==null)&&(b4!=null) ){ return b4; } return null; } /** find the max Bound in an List of boundsNodes *********************/ public Bound findTheMaxBound( BoundList List) /*********************************************************************/ { if( List !=null) { BoundNode p1=List.getHead(); BoundNode maximal=p1; double max=0.0; double s; while(p1!=null) { s=p1.getSize(); if(max<s) { max=s; maximal=p1; } p1=p1.getNext(); } Bound m=maximal.getBound(); return m; } return null; } } // Backup : //if( ( (b<t2)&&(t2<=t)&&(l<r2)&&(r2<=r) )|| ( (b<t2)&&(t2<=t)&&(l<=l2)&&(l2<r) ) ){ //--1 // return false; //} //if( ( (b<=b2)&&(b2<t)&&(l<r2)&&(r2<=r) )|| ( (b<=b2)&&(b2<t)&&(l<=l2)&&(l2<r) ) ){ //--2 // return false; //} //// case 2 //if( ( (t2<=t)&&(t2>b)&&(r2>r)&&(l2<r) )|| ( (t2<=t)&&(t2>b)&&(l2<l)&&(r2>l) ) ){ //--3 // return false; //} //if( ( (b2>=b)&&(b2<t)&&(r2>r)&&(l2<r) )|| ( (b2>=b)&&(b2<t)&&(l2<l)&&(r2>l) ) ){ //--4 // return false; //} //// case 3 //if( ( (t2>=t)&&(b2<t)&&(r2<=r)&&(r2>l) )|| ( (t2>=t)&&(b2<t)&&(l2>=l)&&(l2<r) ) ){ //--5 // return false; //} //// ( (b2<b)&&(t2>b)&&(l2>=l)&&(l2<r) ) ){ // //if( ( (t2<=t)&&(t2>b)&&(r2<=r)&&(r2>l) )|| ( (t2<=t)&&(t2>b)&&(l2>=l)&&(l2<r) ) ){ //--6 // return false; //} //if ( (t2>=t)&&(b2<=b)&&(r2>=r)&&(l2<=l) ){ //--7 // return false; //}
true
c3ba0022f80b4869e4ac201db6375a0e13ae8f2a
Java
k-nish/Java_nyuumon
/src/kadai11/PoisonMatango.java
UTF-8
466
3.0625
3
[]
no_license
package kadai11; import kadai10.Hero; public class PoisonMatango extends Matango { private int times = 5; public PoisonMatango(char suffix) { super(suffix); } public void attack(Hero h) { super.attack(h); if (this.times != 0) { System.out.println("さらに毒の胞子をばらまいた!"); int damage = h.getHp() / 5; h.setHp(h.getHp() - damage); System.out.println(damage + "ポイントのダメージ!"); this.times--; } } }
true
5cb98e6a8e0d8c3920691d287381d907cc37f24a
Java
elad-m/pizzapp
/app/src/main/java/com/pizzapp/model/pizza/Pizza.java
UTF-8
2,513
3.21875
3
[]
no_license
package com.pizzapp.model.pizza; import java.io.Serializable; import java.util.List; import java.util.Vector; /** * This class represent a pizza in an order. */ public class Pizza implements Serializable { private static final int DEFAULT_NUMBER_OF_SLICES = 1; private static final String OUT_OF_BOUNDS_MSG = "There no pizza part in the given index."; private int numberOfSlices; private Size size; private Crust crust; private List<PizzaPart> parts; public Pizza(int numberOfSlices, Size size, Crust crust) { this.numberOfSlices = numberOfSlices; this.size = size; this.crust = crust; parts = new Vector<>(); for (int i = 0; i < numberOfSlices; ++i) { parts.add(new PizzaPart(i)); } } /** * copy constructor if the user want to duplicate pizza. * * @param pizza another pizza. */ public Pizza(Pizza pizza) { this.numberOfSlices = pizza.numberOfSlices; this.size = pizza.size; this.crust = pizza.crust; this.parts = pizza.parts; } public Pizza(Size size, Crust crust) { this(DEFAULT_NUMBER_OF_SLICES, size, crust); } public double getPrice() { double price = size.getPrice() + crust.getPrice(); for (PizzaPart part : parts) { if (part.isHasTopping()) { for (Topping topping : part.getToppings()) price += topping.getPrice() / (double) numberOfSlices; } } return price; } public Size getSize() { return size; } public void setSize(Size size) { this.size = size; } public String getSizeName() { return size.getName(); } public Crust getCrust() { return crust; } public String getCrustName() { return crust.getName(); } public Pizza setCrust(Crust crust) { this.crust = crust; return this; } public void removePizzaToppings() { for (PizzaPart part : parts) { part.removeAllToppings(); } } public PizzaPart getPizzaPart(int index) throws IndexOutOfBoundsException { if (index < 0 || index > numberOfSlices) { throw new IndexOutOfBoundsException(OUT_OF_BOUNDS_MSG); } return parts.get(index); } public List<PizzaPart> getParts() { return parts; } public int getNumberOfParts() { return this.parts.size(); } }
true
b480590e093badaa4fec940444eb72aa458e1a25
Java
carldea/cudami
/dc-cudami-client/src/main/java/de/digitalcollections/cudami/client/identifiable/web/CudamiWebpagesClient.java
UTF-8
5,521
2.03125
2
[ "MIT" ]
permissive
package de.digitalcollections.cudami.client.identifiable.web; import com.fasterxml.jackson.databind.ObjectMapper; import de.digitalcollections.cudami.client.CudamiBaseClient; import de.digitalcollections.cudami.client.exceptions.HttpException; import de.digitalcollections.model.identifiable.entity.Website; import de.digitalcollections.model.identifiable.resource.FileResource; import de.digitalcollections.model.identifiable.web.Webpage; import de.digitalcollections.model.paging.PageRequest; import de.digitalcollections.model.paging.PageResponse; import de.digitalcollections.model.paging.SearchPageRequest; import de.digitalcollections.model.view.BreadcrumbNavigation; import java.net.http.HttpClient; import java.util.List; import java.util.Locale; import java.util.UUID; public class CudamiWebpagesClient extends CudamiBaseClient<Webpage> { public CudamiWebpagesClient(HttpClient http, String serverUrl, ObjectMapper mapper) { super(http, serverUrl, Webpage.class, mapper); } public long count() throws HttpException { return Long.parseLong(doGetRequestForString("/v5/webpages/count")); } public Webpage create() { return new Webpage(); } public PageResponse<Webpage> find(PageRequest pageRequest) throws HttpException { return doGetRequestForPagedObjectList("/v5/webpages", pageRequest); } public Webpage findActiveOne(UUID uuid, Locale locale) throws HttpException { return doGetRequestForObject( String.format("/v5/webpages/%s?active=true&pLocale=%s", uuid, locale)); } public PageResponse<Webpage> findActiveSubpages(UUID uuid, SearchPageRequest searchPageRequest) throws HttpException { return doGetSearchRequestForPagedObjectList( String.format("/v5/webpages/%s/children?active=true", uuid), searchPageRequest); } public Webpage findOne(UUID uuid) throws HttpException { return doGetRequestForObject(String.format("/v5/webpages/%s", uuid)); } public Webpage findOne(UUID uuid, Locale locale) throws HttpException { return findOne(uuid, locale.toString()); } public Webpage findOne(UUID uuid, String locale) throws HttpException { return doGetRequestForObject(String.format("/v5/webpages/%s?pLocale=%s", uuid, locale)); } public Webpage findOneByIdentifier(String namespace, String id) throws HttpException { return doGetRequestForObject( String.format("/v5/webpages/identifier/%s:%s.json", namespace, id)); } public PageResponse<Webpage> findSubpages(UUID uuid, SearchPageRequest searchPageRequest) throws HttpException { return doGetSearchRequestForPagedObjectList( String.format("/v5/webpages/%s/children", uuid), searchPageRequest); } public PageResponse<Webpage> getActiveChildren(UUID uuid, PageRequest pageRequest) throws HttpException { return doGetRequestForPagedObjectList( String.format("/v5/webpages/%s/children?active=true", uuid), pageRequest, Webpage.class); } public List<Webpage> getActiveChildrenTree(UUID uuid) throws HttpException { return doGetRequestForObjectList( String.format("/v5/webpages/%s/childrentree?active=true", uuid)); } public BreadcrumbNavigation getBreadcrumbNavigation(UUID uuid) throws HttpException { return (BreadcrumbNavigation) doGetRequestForObject( String.format("/v5/webpages/%s/breadcrumb", uuid), BreadcrumbNavigation.class); } public List<Webpage> getChildren(UUID uuid) throws HttpException { return doGetRequestForObjectList(String.format("/v5/webpages/%s/children", uuid)); } public PageResponse<Webpage> getChildren(UUID uuid, PageRequest pageRequest) throws HttpException { return doGetRequestForPagedObjectList( String.format("/v5/webpages/%s/children", uuid), pageRequest); } public List<Webpage> getChildrenTree(UUID uuid) throws HttpException { return doGetRequestForObjectList(String.format("/v5/webpages/%s/childrentree", uuid)); } public Webpage getParent(UUID uuid) throws HttpException { return doGetRequestForObject(String.format("/v5/webpages/%s/parent", uuid)); } public List getRelatedFileResources(UUID uuid) throws HttpException { return doGetRequestForObjectList( String.format("/v5/entities/%s/related/fileresources", uuid), FileResource.class); } public Website getWebsite(UUID rootWebpageUuid) throws HttpException { return (Website) doGetRequestForObject( String.format("/v5/webpages/%s/website", rootWebpageUuid), Website.class); } public Webpage save(Webpage webpage) throws HttpException { return doPostRequestForObject("/v5/webpages", webpage); } public Webpage saveWithParentWebpage(Webpage webpage, UUID parentWebpageUuid) throws HttpException { return doPostRequestForObject( String.format("/v5/webpages/%s/webpage", parentWebpageUuid), webpage); } public Webpage saveWithParentWebsite(Webpage webpage, UUID parentWebsiteUuid) throws HttpException { return doPostRequestForObject( String.format("/v5/websites/%s/webpage", parentWebsiteUuid), webpage); } public Webpage update(UUID uuid, Webpage webpage) throws HttpException { return doPutRequestForObject(String.format("/v5/webpages/%s", uuid), webpage); } public boolean updateChildrenOrder(UUID webpageUuid, List<Webpage> children) throws HttpException { return Boolean.parseBoolean( doPutRequestForString(String.format("/v5/webpages/%s/children", webpageUuid), children)); } }
true
2b095f759642fdb2bbd2ba87e160c5889d013f32
Java
roh-7/VolleyDemo
/app/src/main/java/in/example/android/volleydemo/SongsAdapter.java
UTF-8
1,506
2.578125
3
[]
no_license
package in.example.android.volleydemo; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.util.ArrayList; import java.util.List; /** * Created by rohitramaswamy on 13/01/18. */ public class SongsAdapter extends RecyclerView.Adapter<SongsAdapter.ViewHolder> { List<Song> songs = new ArrayList<>(); Context context; public SongsAdapter(List<Song> songs, Context context) { this.songs = songs; this.context = context; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view; view = LayoutInflater.from(parent.getContext()).inflate(R.layout.single_item,parent,false); return new ViewHolder(view); } @Override public void onBindViewHolder(ViewHolder holder, int position) { holder.song_name.setText(songs.get(position).getName()); holder.artist_name.setText(songs.get(position).getArtist()); } @Override public int getItemCount() { if(songs == null) { return 0; } else { Log.v("size",String.valueOf(songs.size())); return (int) songs.size(); } } class ViewHolder extends RecyclerView.ViewHolder { TextView song_name,artist_name; public ViewHolder(View itemView) { super(itemView); song_name = itemView.findViewById(R.id.song_name); artist_name = itemView.findViewById(R.id.artist_name); } } }
true
457885dee483d7618508a40f62da3609261eb4d8
Java
yrsoojin/firstPrj
/src/project_controller/LoginController.java
UHC
4,371
2.5
2
[]
no_license
package project_controller; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import javafx.application.Platform; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; import javafx.scene.image.ImageView; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.stage.Stage; import project_constructor.User; public class LoginController implements Initializable { @FXML private TextField idField; @FXML private PasswordField pwField; @FXML private Button logBtn; @FXML private ImageView imageView; @FXML private CheckBox saveID; project_dao.UserDao uDao = new project_dao.UserDao(); Alert alert = new Alert(Alert.AlertType.INFORMATION); public static String id; String pw; static boolean checkbox; //üũ¸ ´ @Override public void initialize(URL location, ResourceBundle resources) { if(uDao.bringID()!=null) { // ID set System.out.println("bring the id"); idField.setText(uDao.bringID()); saveID.setSelected(true); } //ġ  pwField.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { if(event.getCode().equals(KeyCode.ENTER)) { login(null); } } }); saveID.setOnAction(e -> saveIDBtnChecked(e)); } public void saveIDBtnChecked(ActionEvent e) { //üũڽ üũ id if(!saveID.isSelected()) { uDao.saveIDdelete(); } } public void login(ActionEvent event) { if(idField.getText().equals("") || pwField.getText().equals("")) { alert.setTitle(" ׸"); alert.setHeaderText(" ׸ Է ּ."); alert.show(); } //̵,н尡 admin̸ ڸ else if (idField.getText().equals("admin") && pwField.getText().equals("admin")) { Stage root = (Stage)logBtn.getScene().getWindow(); try { Parent root1 = FXMLLoader.load(getClass().getResource("../project_fxml/admin.fxml")); Scene scene = new Scene(root1); root.setScene(scene); root.setResizable(false); root.show(); root.setTitle(" "); } catch (Exception e) { } } else if (uDao.idVerify(idField.getText())==0) { alert.setTitle("̵ Ȯ"); alert.setHeaderText(" Դϴ.\nٽ Ȯ ּ."); alert.show(); } else if(uDao.idLoad(idField.getText(), pwField.getText())==0) { alert.setTitle("йȣ Ȯ"); alert.setHeaderText("йȣ Ʋϴ.\nٽ Ȯ ּ."); alert.show(); } else { id = idField.getText(); pw = pwField.getText(); if(saveID.isSelected()) { //üũڽ Ȯ , id User save = new User(id); uDao.saveIDinsert(save); } Stage root = (Stage)logBtn.getScene().getWindow(); try { Parent root1 = FXMLLoader.load(getClass().getResource("../project_fxml/user.fxml")); Scene scene = new Scene(root1); scene.getStylesheets().add(getClass().getResource("User.css").toString()); root.setScene(scene); root.setResizable(false); root.show(); root.setTitle(" : " + id + " α"); } catch (IOException e) { e.printStackTrace(); } } } public void register(ActionEvent event) { Stage stage = new Stage(); Parent root; try { root = FXMLLoader.load(getClass().getResource("../project_fxml/register.fxml")); Scene scene = new Scene(root); scene.getStylesheets().add(getClass().getResource("Register.css").toString()); stage.setScene(scene); stage.setResizable(false); stage.show(); stage.setTitle("ȸ"); } catch (IOException e) { e.printStackTrace(); } } public void cancel(ActionEvent event) { Platform.exit(); } }
true
5785a14e7b14775bb551d65c4458f8df408f40f8
Java
danieldp92/KGEN
/src/main/java/ui/cui/arguments/ConfigArguments.java
UTF-8
335
2.140625
2
[]
no_license
package ui.cui.arguments; public class ConfigArguments extends Arguments { private String datasetPath; public ConfigArguments(String datasetPath, String outputPath) { this.datasetPath = datasetPath; this.outputPath = outputPath; } public String getDatasetPath() { return datasetPath; } }
true
81c3f80fabb34dc43f0863bfe4257f6678e57842
Java
JoaquinLosada/RoyalWebAutomationFramework
/src/test/java/royal/TestTest.java
UTF-8
626
2.09375
2
[]
no_license
package royal; import org.testng.annotations.Test; import static org.assertj.core.api.Assertions.assertThat; /** * Sample Test */ public class TestTest extends Base { private static final String TEXT = "100 HOUR SALE"; private static final String SEARCH_BUTTON_CSS = "#find-a-cruise"; private static final String TITLE = ".show-for-desktop .text-large"; @Test public void firstTest() { goTo("https://www.royalcaribbean.com/"); await().until(el(SEARCH_BUTTON_CSS)).clickable(); el(SEARCH_BUTTON_CSS).click(); assertThat(el(TITLE).text()).isEqualTo(TEXT); } }
true
73e3a0ffecb12edb8fec4512eb0f6a50341b3310
Java
Rekoe/rk_svnadmin
/src/main/java/com/rekoe/service/SvnUserService.java
UTF-8
3,551
2.1875
2
[]
no_license
package com.rekoe.service; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.SqlCallback; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Lang; import com.rekoe.domain.Pj; import com.rekoe.domain.SVNRoleType; import com.rekoe.domain.Usr; /** * @author 科技㊣²º¹³M<br/> * 2014年2月3日 下午4:48:45 <br/> * http://www.rekoe.com <br/> * QQ:5382211 */ @IocBean(args = { "refer:dao" }) public class SvnUserService extends BaseService<Usr> { private final String REGEX_USERNAME = "^[a-zA-Z0-9]{1,16}$"; public SvnUserService() { } public SvnUserService(Dao dao) { super(dao); } public boolean nameOk(String name) { if (StringUtils.isBlank(name)) { return false; } if (!isUsername(name)) { return false; } return Lang.isEmpty(dao().fetch(getEntityClass(), Cnd.where("usr", "=", name))); } public Usr get(String usr) { return dao().fetch(getEntityClass(), Cnd.where("usr", "=", usr)); } /** * 校验用户名 * * @param username * @return 校验通过返回true,否则返回false */ public boolean isUsername(String username) { return Pattern.matches(REGEX_USERNAME, username); } /** * 获取这个项目组未选的用户(不包括*) * * @param pj * 项目 * @param gr * 组 * @return 项目组未选的用户(不包括*) */ public List<Usr> listUnSelected(String pj, String gr) { Sql sql = Sqls.create("select usr,name,psw,email,role from usr a where a.usr <> '*' " + " and not exists (select usr from pj_gr_usr b where a.usr = b.usr and b.pj=@pj and b.gr=@gr) and a.is_lock=false order by a.usr"); sql.setParam("pj", pj).setParam("gr", gr); final List<Usr> list = new ArrayList<Usr>(); sql.setCallback(new SqlCallback() { @Override public Object invoke(Connection conn, ResultSet rs, Sql sql) throws SQLException { while (rs.next()) { list.add(readUsr(rs)); } return list; } }); dao().execute(sql); return list; } public List<Usr> listSelected(String pj) { Sql sql = Sqls.create("select * from usr a where a.usr <> '*' " + " and exists (select usr from pj_gr_usr b where a.usr = b.usr and b.pj=@pj) and a.is_lock=false order by a.usr"); sql.setParam("pj", pj); final List<Usr> list = new ArrayList<Usr>(); sql.setCallback(new SqlCallback() { @Override public Object invoke(Connection conn, ResultSet rs, Sql sql) throws SQLException { while (rs.next()) { list.add(readUsr(rs)); } return list; } }); dao().execute(sql); return list; } Usr readUsr(ResultSet rs) throws SQLException { Usr result = new Usr(); result.setUsr(rs.getString("usr")); result.setName(rs.getString("name")); result.setPsw(rs.getString("psw")); result.setRole(SVNRoleType.valueOf(rs.getString("role"))); result.setEmail(rs.getString("email")); return result; } @Inject private ProjectService projectService; public List<Pj> getPjList(String usr) { List<Pj> list = projectService.getList(usr);// 用户可以看到的所有项目 return list; } }
true
25928bfb0bc4c2d9b3f734bf019cbdc31894f535
Java
LanleiZhao/java
/src/day10/Bank/Bank.java
UTF-8
906
3.625
4
[]
no_license
package day10.Bank; public class Bank { // 属性 private Customer[] customers; private int numberOfCustomers; // 构造器 public Bank(int maxServerCustomers){ this.customers = new Customer[maxServerCustomers]; this.numberOfCustomers = 0; } // 方法 // 添加用户 public void addCustomer(String firstName, String lastName){ this.customers[numberOfCustomers] = new Customer(firstName, lastName); numberOfCustomers ++; System.out.println("新增了用户["+ firstName+","+lastName+"]"); } // 获取客户数量 public int getNumberOfCustomers(){ return this.numberOfCustomers; } // 获取客户,判断是否越界 public Customer getCustomer(int index){ if (index>=0 && index<this.numberOfCustomers){ return this.customers[index]; } return null; } }
true
25900d2b0766f96ef55dd6e4ab8b9a122919592a
Java
cckmit/mall
/mall-user/mall-user-service/src/main/java/com/suyan/mall/user/service/impl/AdminRoleServiceImpl.java
UTF-8
2,415
1.84375
2
[]
no_license
/* * Copyright (c) 2020. * 项目名称:素焉商城 * 创建人:素焉 * 开源地址: https://github.com/lixaviers/mall */ package com.suyan.mall.user.service.impl; import com.suyan.mall.user.service.IAdminRoleService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import com.suyan.mall.user.biz.AdminRoleBiz; import com.suyan.mall.user.convertor.AdminRoleConvertor; import com.suyan.mall.user.model.AdminRole; import com.suyan.mall.user.req.AdminRoleDTO; import com.suyan.mall.user.req.AdminRoleQueryDTO; import com.suyan.mall.user.resp.AdminRoleVO; import com.suyan.query.QueryResultVO; import java.util.List; /** * @CopyRright (c): <素焉代码生成工具> * @Comments: <Service 管理员角色管理类> */ @Slf4j @Service("adminRoleService") public class AdminRoleServiceImpl implements IAdminRoleService { @Autowired private AdminRoleBiz adminRoleBiz; @Override @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackFor = Exception.class) public int deleteAdminRole(Long id) { return adminRoleBiz.deleteAdminRole(id); } @Override @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackFor = Exception.class) public Long createAdminRole(AdminRoleDTO adminRoleDTO) { return adminRoleBiz.createAdminRole(AdminRoleConvertor.toAdminRole(adminRoleDTO)); } @Override @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackFor = Exception.class) public int updateAdminRole(AdminRoleDTO adminRoleDTO) { return adminRoleBiz.updateAdminRole(AdminRoleConvertor.toAdminRole(adminRoleDTO)); } @Override @Transactional(readOnly = true) public AdminRoleVO getAdminRole(Long id ) { return AdminRoleConvertor.toAdminRoleVO(adminRoleBiz.getAdminRole(id)); } @Override @Transactional(readOnly = true) public QueryResultVO<AdminRoleVO> queryAdminRole(AdminRoleQueryDTO adminRoleQueryDTO) { return AdminRoleConvertor.toQueryResult(adminRoleBiz.queryAdminRole(adminRoleQueryDTO)); } }
true
134da4280b0303506780ded8aea5bd3ab9d1370a
Java
cc8848/jlibav-1
/jlibav/src/main/java/org/libav/avutil/IDictionaryWrapper.java
UTF-8
2,422
2.46875
2
[]
no_license
/* * Copyright (C) 2012 Ondrej Perutka * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either * version 3 of the License, or (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * <http://www.gnu.org/licenses/>. */ package org.libav.avutil; import java.util.List; import org.libav.LibavException; import org.libav.bridge.IWrapper; /** * Wrapper for the AVDictionary. * * @author Ondrej Perutka */ public interface IDictionaryWrapper extends IWrapper, Iterable<IDictionaryWrapper.Pair> { /** * Get value for the given key. * * @param key a key * @param flags see AV_DICT_ flags * @return a value or null if there is no entry for the given key */ String get(String key, int flags); /** * Set value for the given key. If the value is null the entry will be * removed from the dictionary. * * @param key a key * @param value a value * @param flags see AV_DICT_ flags * @throws LibavException if an error occured */ void set(String key, String value, int flags) throws LibavException; /** * Free the dictionary and all its resources. */ void free(); /** * Copy content of this dictionary into another dictionary. * * @param dictionary a dictionary * @param flags see AV_DICT_ flags */ void copyTo(IDictionaryWrapper dictionary, int flags); /** * Convert this dictionary into a list of key-value pairs. * * @return list of key-value pairs */ List<Pair> toList(); public static class Pair { private String key; private String value; public Pair(String key, String value) { this.key = key; this.value = value; } public String getKey() { return key; } public String getValue() { return value; } } }
true
67377bbf08acbc03dace7855a8d232bf023e4e58
Java
kalyanasundaramshubha/juneTests
/src/arraysorting.java
UTF-8
490
3.34375
3
[]
no_license
import java.util.Arrays; //package practice; public class arraysorting { public static void main(String[]arguments){ String names[]={"Meera","Keshav","Diya","Madhav","Aditi","Manu","Arjun","Anirudh"}; String age[]={"5","9","6","4","7"}; Arrays.sort(age); System.out.println("Get the least age: "+age[0]); Arrays.sort(names); for(int i=0;i<names.length;i++){ System.out.println("Sorted order: "+names[i]); } } }
true
c3846f40c5b32782d6118588fe4b937546ea2390
Java
wooseok01/Visualization_CR
/DataVisualization/src/main/java/com/ajou/visualization/action/GetCredosData2.java
UTF-8
2,686
2.28125
2
[]
no_license
package com.ajou.visualization.action; import java.util.ArrayList; import java.util.HashMap; import org.springframework.beans.factory.annotation.Autowired; import com.ajou.visualization.dao.AllDao; import com.ajou.visualization.model.Consult2; import com.ajou.visualization.model.Description; import com.ajou.visualization.model.SimilarityPerson; public class GetCredosData2 { private AllDao dao; public GetCredosData2(){} public GetCredosData2(AllDao dao) { super(); this.dao = dao; } @Autowired public void setDao(AllDao dao) {this.dao = dao;} public AllDao getDao() {return dao;} public ArrayList<Consult2> getCredosData(){ ArrayList<Consult2> consultList = new ArrayList<Consult2>(); consultList = dao.getCredosData2(); return consultList; } public ArrayList<String> getPatientName(){ ArrayList<Consult2> consultList = dao.getCredosData2(); ArrayList<String> patientList = new ArrayList<String>(); for(int i=0; i<consultList.size(); i+=4){ patientList.add(consultList.get(i).getName()); } System.out.println(patientList.toString()); return patientList; } public void getMeaningValue(){ String value[] = {"better", "betterworse", "maintain", "worse", "worsebetter"}; ArrayList<Consult2> betterList = new ArrayList<Consult2>(); ArrayList<Consult2> betterworseList = new ArrayList<Consult2>(); ArrayList<Consult2> maintainList = new ArrayList<Consult2>(); ArrayList<Consult2> worseList = new ArrayList<Consult2>(); ArrayList<Consult2> worsebetterList = new ArrayList<Consult2>(); betterList = dao.getMeaningValue(value[0]); betterworseList = dao.getMeaningValue(value[1]); maintainList = dao.getMeaningValue(value[2]); worseList = dao.getMeaningValue(value[3]); worsebetterList = dao.getMeaningValue(value[4]); HashMap<String, Integer> map = sortingTestQuestion(betterList); } public HashMap<String, Integer> sortingTestQuestion(ArrayList<Consult2> list){ HashMap<String, Integer> result = new HashMap<String, Integer>(); for(int i=0; i<list.size(); i++){ if(result.get(list.get(i).getQ_kdsq_15()+"") == null){ result.put(list.get(i).getQ_kdsq_15()+"",1); }else{ int temp = result.get(list.get(i).getQ_kdsq_15()+"")+1; result.put(list.get(i).getQ_kdsq_15()+"", temp); } } return result; } public ArrayList<Description> getDescription(){ return dao.getDescription(); } public ArrayList<SimilarityPerson> getSimilarityPerson() { return dao.getSimilarityPerson(); } public ArrayList<String> getSimilarityColumn() { return dao.getSimilarityColumn(); } public ArrayList<String> getCredosQuestions() { return dao.getCredosQuestions(); } }
true
9e8aa3bf8c33c42b916be831b89b6cf7c6ac5e3a
Java
sitelabs/courier
/util/src/main/java/com/alibaba/china/courier/model/resource/AbstractResource.java
GB18030
2,380
2.359375
2
[]
no_license
package com.alibaba.china.courier.model.resource; /* * Copyright 1999-2004 Alibaba.com All right reserved. This software is the confidential and proprietary information of * Alibaba.com ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only * in accordance with the terms of the license agreement you entered into with Alibaba.com. */ import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.commons.lang3.StringUtils; import com.alibaba.china.courier.model.Resource; /** * Resource.javaʵļԴ * * @author stan.liyh 2012-5-7 10:16:18 */ abstract public class AbstractResource implements Resource, Serializable { private static final long serialVersionUID = -1669211528258841728L; // ļҪ·,Ҫ֤ȫΨһ protected String name; // ļչ protected String extension; // ʱ protected long lastModified = 0; protected boolean isFolder = false; protected List<Resource> children = new ArrayList<Resource>(); public String getName() { return name; } public String getExtension() { if (StringUtils.isBlank(this.extension)) { int pos = StringUtils.lastIndexOf(getName(), "."); if (pos > 0) { this.extension = StringUtils.substring(getName(), (pos + 1)); } } return extension; } public long getLastModified() { return this.lastModified; } public boolean isNew(Resource old) { return this.getLastModified() == old.getLastModified(); } public void setLastModified(long lastModified) { this.lastModified = lastModified; } public void setName(String name) { this.name = name; } public void setExtension(String extension) { this.extension = extension; } public void isFolder(boolean isFolder) { this.isFolder = isFolder; } public boolean isFolder() { return this.isFolder; } public Resource getParent() { return null; } public List<Resource> getChildren() { return Collections.EMPTY_LIST; } }
true
2651265565c7758f508684c6a6f2361535bf4b8f
Java
khnguyendinh/demozk
/src/main/java/khoand/demozk/controllers/MyWindow.java
UTF-8
230
1.78125
2
[]
no_license
package khoand.demozk.controllers; import org.zkoss.zul.Window; /** * Created by quantri on 03/02/2018. */ public class MyWindow extends Window { String var = "abc"; public String getVar(){ return var; } }
true
5d96025dede2205c7fedbf104f7d168344ddf36a
Java
hadishatti/intranet
/src/main/java/qa/tecnositafgulf/searchcriteria/ClientsSearchCriteira.java
UTF-8
5,320
2.40625
2
[]
no_license
package qa.tecnositafgulf.searchcriteria; import javax.persistence.EntityManager; import javax.persistence.Query; import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * Created by klajdi on 09/05/18. */ public class ClientsSearchCriteira implements Serializable{ private String likeClientName; private String likeClientDescription; private String likeClientImg; private String likeClientLink; private static final int DEFAULTPAGESIZE = 8; private static final int DEFAULTPAGESTARTINDEX = 0; private static final String DEFAULTPAGEORDER = "name"; private static final String DEFAULTPAGEORDERMODE = "desc"; private Integer startIndex = DEFAULTPAGESTARTINDEX; private Integer pageSize = DEFAULTPAGESIZE; private String pageOrderMode = DEFAULTPAGEORDERMODE; private String orderByFieldName = DEFAULTPAGEORDER; public Query toQuery(EntityManager entityManager){ StringBuilder sb = new StringBuilder(); sb.append("SELECT client FROM Client client "); Query query = addConstraint(entityManager, sb, new StringBuilder(" ORDER BY client.").append(getOrderByFieldName()).append(" ").append(getPageOrderMode()).toString()); if(this.getStartIndex() > 0){ query.setFirstResult(this.getStartIndex() * this.getPageSize()); } if (this.getPageSize() > 0) { query.setMaxResults(this.getPageSize()); } return query; } public Query getCountQuery(EntityManager em) { StringBuilder sb = new StringBuilder(); sb.append("SELECT COUNT(*) FROM Client client "); Query query = addConstraint(em, sb, null); return query; } private Query addConstraint(EntityManager entityManager, StringBuilder sb, String orderBy){ List<String> conditions = new ArrayList<>(); boolean isClientName = (likeClientName != null); boolean isClientDescription = (likeClientDescription != null); boolean isClientImg = (likeClientImg != null); boolean isClientLink = (likeClientLink != null); if(isClientName) conditions.add("client.name like :likeClientName"); if(isClientDescription) conditions.add("client.description like :likeClientDescription"); if(isClientImg) conditions.add("client.img like :likeClientImg"); if(isClientLink) conditions.add("client.link like :likeClientLink"); for (int i = 0; i < conditions.size(); i++) { if(i == 0){ sb.append(" where "); sb.append(conditions.get(i)); }else{ sb.append(" and "); sb.append(conditions.get(i)); } } //order By condition if (orderBy != null && !orderBy.isEmpty()) sb.append(orderBy); // create query Query query = entityManager.createQuery(sb.toString()); if(isClientName) query.setParameter("likeClientName","%"+likeClientName+"%"); if(isClientDescription) query.setParameter("likeClientDescription", "%"+likeClientDescription+"%"); if(isClientImg) query.setParameter("likeClientImg", "%"+likeClientImg+"%"); if(isClientLink) query.setParameter("likeClientLink", "%"+likeClientLink+"%"); return query; } public void clear() { startIndex = DEFAULTPAGESTARTINDEX; pageSize = DEFAULTPAGESIZE; pageOrderMode = DEFAULTPAGEORDERMODE; orderByFieldName = DEFAULTPAGEORDER; } public void clearFilters() { likeClientName = null; likeClientDescription = null; likeClientImg = null; likeClientLink = null; } public String getLikeClientName() { return likeClientName; } public void setLikeClientName(String likeClientName) { this.likeClientName = likeClientName; } public String getLikeClientDescription() { return likeClientDescription; } public void setLikeClientDescription(String likeClientDescription) { this.likeClientDescription = likeClientDescription; } public String getLikeClientImg() { return likeClientImg; } public void setLikeClientImg(String likeClientImg) { this.likeClientImg = likeClientImg; } public String getLikeClientLink() { return likeClientLink; } public void setLikeClientLink(String likeClientLink) { this.likeClientLink = likeClientLink; } public Integer getStartIndex() { return startIndex; } public void setStartIndex(Integer startIndex) { this.startIndex = startIndex; } public Integer getPageSize() { return pageSize; } public void setPageSize(Integer pageSize) { this.pageSize = pageSize; } public String getPageOrderMode() { return pageOrderMode; } public void setPageOrderMode(String pageOrderMode) { this.pageOrderMode = pageOrderMode; } public String getOrderByFieldName() { return orderByFieldName; } public void setOrderByFieldName(String orderByFieldName) { this.orderByFieldName = orderByFieldName; } }
true
eef6dc168a7d3d591f62b9ee309624b4d17b7da2
Java
onerbal/communication-service
/campaign-service/src/main/java/org/example/campaign/controller/CampaignController.java
UTF-8
934
2.09375
2
[ "MIT" ]
permissive
package org.example.campaign.controller; import org.example.campaign.service.CampaignService; import org.example.common.converter.ModelConverter; import org.example.common.model.campaign.CampaignModel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/api/v1/campaign") public class CampaignController { @Autowired private CampaignService campaignService; @GetMapping("/create") public ResponseEntity<CampaignModel> createCampaign() { return new ResponseEntity<>((CampaignModel) ModelConverter.convert(campaignService.createCampaign(), CampaignModel.class), HttpStatus.OK); } }
true
78b68d44011c274fbfdf163cd347283b3b257090
Java
riojano0/bootcamp-weather-after-year
/src/main/java/com/montivero/poc/client/domain/yahooQuery/ChannelResponse.java
UTF-8
419
1.757813
2
[]
no_license
package com.montivero.poc.client.domain.yahooQuery; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @Setter @Getter @NoArgsConstructor @JsonIgnoreProperties(ignoreUnknown = true) public class ChannelResponse { private Location location; private Wind wind; private Atmosphere atmosphere; private Item item; }
true
bdc16e370b900581098960b9f661921dd0a71773
Java
nbdd0121/XRMI
/com/nwgjb/compiler/MemoryClassLoader.java
UTF-8
793
2.578125
3
[ "BSD-2-Clause" ]
permissive
package com.nwgjb.compiler; import java.util.HashMap; class MemoryClassLoader extends ClassLoader{ private HashMap<String, MemoryByteCode> byteCodes=new HashMap<String, MemoryByteCode>(); protected Class<?> findClass(String name) throws ClassNotFoundException { String slashedName=name.replace(".","/"); MemoryByteCode mbc=byteCodes.get(slashedName); if (byteCodes==null){ mbc=byteCodes.remove(slashedName); if (mbc==null){ return super.findClass(name); } } return defineClass(name, mbc.getBytes(), 0, mbc.getBytes().length); } public void addClass(String name, MemoryByteCode mbc) { byteCodes.put(name, mbc); } }
true
90e6d1f6150fc919ebd71c700e735affb8cfcdad
Java
sonake/youyd_springcloud_service
/youyd-authentication-server/src/main/java/com/youyd/auth/validate/impl/ValidateCodeGenerator.java
UTF-8
342
1.75
2
[ "MIT" ]
permissive
package com.youyd.auth.validate.impl; import org.springframework.web.context.request.ServletWebRequest; /** * 校验码生成器 * @author : LGG * @create : 2019-06-18 14:34 **/ public interface ValidateCodeGenerator { /** * 生成校验码 * @param request * @return */ ValidateCode generate(ServletWebRequest request); }
true
00ef2a879ce39c85b750980915404085f3a47f3b
Java
ItechsGS/20200610
/mobile/src/main/java/com/org/godspeed/allOtherClasses/ExerciseTypeScreen.java
UTF-8
8,573
2.03125
2
[]
no_license
package com.org.godspeed.allOtherClasses; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.SearchView; import android.widget.TextView; import com.android.volley.VolleyLog; import com.org.godspeed.R; import com.org.godspeed.utility.CustomTypeface; import com.org.godspeed.utility.ExerciseTypeClass; import java.util.Locale; import java.util.Vector; public class ExerciseTypeScreen extends Activity implements SearchView.OnQueryTextListener { int[] strExerciseTypeID = {R.string.single, R.string.superset, R.string.complex, R.string.amrap, R.string.tabata, R.string.cft, R.string.emotm, R.string.eomotom, R.string.cluster, R.string.hybrid, R.string.circuit}; private Vector<ExerciseTypeClass> vectorExerciseType; private ListView listViewExerciseType; private ListViewAdapter adapter; private Context context; private SearchView searchViewExerciseType; private ImageView imageViewBackArrow; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.layout_exercise_type_listview); context = this; Log.e("Screen", "Excercise Type"); searchViewExerciseType = findViewById(R.id.searchViewExerciseType); searchViewExerciseType.setOnQueryTextListener(this); int searchFrameId = searchViewExerciseType.getContext().getResources().getIdentifier("android:id/search_edit_frame", null, null); View searchFrame = searchViewExerciseType.findViewById(searchFrameId); searchFrame.setBackgroundResource(R.drawable.bg_white_rounded); int searchPlateId = searchViewExerciseType.getContext().getResources().getIdentifier("android:id/search_plate", null, null); View searchPlate = findViewById(searchPlateId); searchPlate.setBackgroundResource(R.drawable.bg_white_rounded); int searchBarId = searchViewExerciseType.getContext().getResources().getIdentifier("android:id/search_bar", null, null); View searchBar = findViewById(searchBarId); searchBar.setBackgroundResource(R.drawable.bg_white_rounded); vectorExerciseType = new Vector<ExerciseTypeClass>(); for (int i = 0; i < strExerciseTypeID.length; i++) { ExerciseTypeClass objExerciseType = new ExerciseTypeClass(); objExerciseType.exerciseTypeName = getString(strExerciseTypeID[i]); objExerciseType.isSelected = false; vectorExerciseType.add(objExerciseType); } adapter = new ListViewAdapter(context); listViewExerciseType = findViewById(R.id.listViewExerciseType); listViewExerciseType.setAdapter(adapter); listViewExerciseType.setDivider(null); imageViewBackArrow = findViewById(R.id.imageViewBackArrow); imageViewBackArrow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); overridePendingTransition(R.anim.ltr_anim, R.anim.rtl_anim); } }); } @Override protected void onResume() { super.onResume(); if (DaysWiseExerciseList.isExerciseDataSaved) { onBackPressed(); overridePendingTransition(R.anim.ltr_anim, R.anim.rtl_anim); } } @Override public boolean onQueryTextSubmit(String s) { return false; } @Override public boolean onQueryTextChange(String newText) { adapter.filter(newText); return false; } public class ViewHolder { TextView textViewExerciseType; RelativeLayout rLayoutForExerciseType; ImageView imageViewNext, imageViewSelectUnSelectExerciseType; } public class ListViewAdapter extends BaseAdapter { private Context context; private LayoutInflater vi; private ExerciseTypeScreen.ViewHolder holder; private Vector<ExerciseTypeClass> vectorExerciseTypeLocal = new Vector<ExerciseTypeClass>(); public ListViewAdapter(Context context) { this.context = context; vi = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); fillVectorDefaultValues(); } private void fillVectorDefaultValues() { for (int i = 0; i < vectorExerciseType.size(); i++) { this.vectorExerciseTypeLocal.add(vectorExerciseType.get(i)); } } @Override public int getCount() { return this.vectorExerciseTypeLocal.size(); } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { if (convertView == null) { holder = new ExerciseTypeScreen.ViewHolder(); convertView = vi.inflate(R.layout.layout_exercise_list_days_based, null); holder.textViewExerciseType = convertView.findViewById(R.id.textViewExerciseName); holder.textViewExerciseType.setTypeface(CustomTypeface.load_AGENCYR_Fonts(context)); holder.imageViewSelectUnSelectExerciseType = convertView.findViewById(R.id.imageViewSelectUnSelectExerciseType); holder.imageViewSelectUnSelectExerciseType.setVisibility(View.VISIBLE); holder.imageViewSelectUnSelectExerciseType.setImageResource(R.drawable.unselected_tick_icon); holder.imageViewSelectUnSelectExerciseType.setClickable(false); holder.rLayoutForExerciseType = convertView.findViewById(R.id.rLayoutForDaysName); convertView.setTag(holder); } else { holder = (ExerciseTypeScreen.ViewHolder) convertView.getTag(); } final ExerciseTypeClass objExerciseType = this.vectorExerciseTypeLocal.get(position); holder.textViewExerciseType.setText(objExerciseType.exerciseTypeName); if (objExerciseType.isSelected) { holder.imageViewSelectUnSelectExerciseType.setImageResource(R.drawable.selected_tick_icon); } else { holder.imageViewSelectUnSelectExerciseType.setImageResource(R.drawable.unselected_tick_icon); } holder.rLayoutForExerciseType.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { objExerciseType.isSelected = !objExerciseType.isSelected; adapter.notifyDataSetChanged(); startActivity(new Intent(context, ExerciseNameScreen.class)); Log.d(VolleyLog.TAG, "*************** ExerciseNameScreen *************"); overridePendingTransition(R.anim.exit, R.anim.enter); } }); // holder.rLayoutForExerciseType.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // //Need to show Either web page of Contact Us or FAQ // //startActivity(new Intent(context,ExerciseNameScreen.class)); // } // }); return convertView; } // Filter Class public void filter(String charText) { charText = charText.toLowerCase(Locale.getDefault()); this.vectorExerciseTypeLocal.clear(); if (charText.length() == 0) { fillVectorDefaultValues(); } else { for (int i = 0; i < vectorExerciseType.size(); i++) { ExerciseTypeClass obj = vectorExerciseType.get(i); if (obj.exerciseTypeName.toLowerCase(Locale.getDefault()).contains(charText)) { this.vectorExerciseTypeLocal.add(obj); } } } notifyDataSetChanged(); } } }
true
fd95ef4513ec02f36b2384876312386411672e3f
Java
CDLUC3/mrt-ingest
/ingest-src/src/main/java/org/cdlib/mrt/ingest/handlers/HandlerDigest.java
UTF-8
4,808
1.921875
2
[ "BSD-3-Clause" ]
permissive
/* Copyright (c) 2011, Regents of the University of California 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 the University of California 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 OWNER 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 org.cdlib.mrt.ingest.handlers; import java.io.File; import java.net.URL; import java.util.Properties; import org.cdlib.mrt.ingest.IngestRequest; import org.cdlib.mrt.ingest.JobState; import org.cdlib.mrt.ingest.ProfileState; import org.cdlib.mrt.core.ManifestBuild; import org.cdlib.mrt.utility.FileUtil; import org.cdlib.mrt.utility.LoggerInf; import org.cdlib.mrt.utility.StringUtil; import org.cdlib.mrt.utility.TException; /** * create manifest based on current queue path * @author mreyes */ public class HandlerDigest extends Handler<JobState> { private static final String NAME = "HandlerDigest"; private static final String MESSAGE = NAME + ": "; private static final boolean DEBUG = true; private LoggerInf logger = null; private Properties conf = null; private Integer defaultStorage = null; /** * create manifest for all queue data * * @param profileState target storage service info * @param ingestRequest ingest request info * @param jobState * @return HandlerResult result in creating manifest */ public HandlerResult handle(ProfileState profileState, IngestRequest ingestRequest, JobState jobState) throws TException { try { File manifest = new File(ingestRequest.getQueuePath().getAbsolutePath() + "/system/mrt-manifest.txt"); manifest.createNewFile(); String sharedPath = ingestRequest.getIngestQueuePath(); String baseURL = null; if (StringUtil.isEmpty(sharedPath)) { // Use network protocol // Requires symlink from webapps/ingestqueue to home ingest queue directory URL link = new URL(ingestRequest.getLink()); String port = ""; String path = link.getPath(); if (link.getPort() != -1) port = ":" + link.getPort(); baseURL = link.getProtocol() + "://" + link.getHost() + port + path + "/ingestqueue/" + ingestRequest.getJob().grabBatchID().getValue() + "/" + ingestRequest.getQueuePath().getName(); } else { // Use file prototcol baseURL = "file:" + ingestRequest.getIngestQueuePath() + "/" + ingestRequest.getJob().grabBatchID().getValue() + "/" + ingestRequest.getQueuePath().getName(); } if (DEBUG) System.out.println("[debug] " + MESSAGE + " baseURL: " + baseURL); // build manifest ManifestBuild.getPostManifest(baseURL, ingestRequest.getQueuePath(), manifest); FileUtil.removeLineFromFile(manifest.getAbsolutePath(), "system/mrt-manifest.txt", "CONTAIN"); return new HandlerResult(true, "SUCCESS: " + NAME + " created manifest"); } catch (TException te) { te.printStackTrace(System.err); return new HandlerResult(false, "[error]: " + MESSAGE + te.getDetail()); } catch (Exception e) { e.printStackTrace(System.err); String msg = "[error] " + MESSAGE + "creating manifest: " + e.getMessage(); return new HandlerResult(false, msg); } finally { // cleanup? } } public String getName() { return NAME; } }
true
5fb74a030198eae483cdb795710e69a3d1fb612e
Java
AndrzejPoloczek/gamehub
/gamebind/src/test/java/gamehub/gamebind/strategy/CancelOwnerStrategyTest.java
UTF-8
786
2.171875
2
[]
no_license
package gamehub.gamebind.strategy; import gamehub.gamebind.exception.GameCancelException; import gamehub.gamebind.model.GameBind; import gamehub.gamebind.model.GameBindStatus; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import static org.mockito.Mockito.*; @RunWith(SpringJUnit4ClassRunner.class) public class CancelOwnerStrategyTest { @InjectMocks private CancelOwnerStrategy testObj; @Mock private GameBind bind; @Test public void shouldCancel() throws GameCancelException { // when testObj.cancel(bind, "player"); // then verify(bind).setStatus(GameBindStatus.CANCELED); } }
true
66bf112f874e9980ca2f42fca7531ad4b737442f
Java
Pasinozavr/5th-year-le-man
/Java/TD1/EnsembleDeChiffres.java
UTF-8
1,531
3.21875
3
[]
no_license
import java.util.Random; public class EnsembleDeChiffres { private boolean[] present; private Random rnd; public EnsembleDeChiffres() { rnd = new Random(); present = new boolean[10]; for (int i = 0; i < 10; i++) { present[i] = false; } } public void ajoute(int i) { if (i >= 0 && i < 10) present[i - 1] = true; else System.out.println("Errored number"); } public void retire(int i) { if (i >= 0 && i < 10) present[i - 1] = false; else System.out.println("Errored number"); } public void tirerAuHasard() { for (int i = 0; i < 10; i++) { present[i] = rnd.nextBoolean(); } } public boolean appartient(int i) { return present[i - 1]; } public EnsembleDeChiffres intersectionAvec(EnsembleDeChiffres e) { for (int i = 0; i < 10; i++) { if (!this.present[i] || !e.present[i]) { this.present[i] = false; } } return this; } public EnsembleDeChiffres unionAvec(EnsembleDeChiffres e) { for (int i = 0; i < 10; i++) { if (!this.present[i] && !e.present[i]) { this.present[i] = false; } else { this.present[i] = true; } } return this; } public boolean estInclusDans(EnsembleDeChiffres e) { for (int i = 0; i < 10; i++) { if (e.present[i] != this.present[i]) { return false; } } return true; } public void affiche() { System.out.print("{ "); for (int i = 0; i < 10; i++) { if (this.present[i]) { System.out.print("" + i + " "); } } System.out.println("}"); } }
true
b117a682cf998713ff05998d60bd094c4f2dd25b
Java
AstiaSun/basic-spring-framework
/src/main/java/com/ukma/aic/graph/DependencyGraph.java
UTF-8
840
2.953125
3
[]
no_license
package com.ukma.aic.graph; import java.util.LinkedList; public class DependencyGraph<T> extends LinkedList<T> { DependencyGraph() { super(); } DependencyGraph(DependencyGraph<T> dependencyGraph) { super(dependencyGraph); } Node getNodeByName(String beanName) { for (T t : this) { Node node = (Node) t; if (node.getBeanName().equals(beanName)) { return node; } } return null; } @Override public boolean contains(Object o) { String beanName = ((Node) o).getBeanName(); while (iterator().hasNext()) { Node nextNode = (Node) iterator().next(); if (nextNode.getBeanName().equals(beanName)) { return true; } } return false; } }
true
22b7b547dec98eb4298f62b900ebf7156301ccfc
Java
darthvaderson/android_native_demo
/app/src/main/java/com/example/testapp/ConcertDBManager.java
UTF-8
3,118
2.4375
2
[]
no_license
package com.example.testapp; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class ConcertDBManager extends SQLiteOpenHelper { static final String DB_CONCERT = "concert.db"; static final String TABLE_CONCERT = "concerts"; static final int DB_VERSION = 1; Context mContext = null; private static ConcertDBManager mDBManager = null; // concert.db 이름으로 DB 생성 public static ConcertDBManager getInstance( Context context ){ if (mDBManager == null){ mDBManager = new ConcertDBManager( context, DB_CONCERT, null, DB_VERSION ); } return mDBManager; } private ConcertDBManager (Context context, String dbName, SQLiteDatabase.CursorFactory factory, int version ){ super(context, dbName, factory, version); mContext = context; } //@override // TABLE_CONCERT 으로 concert.db에 테이블 생성 public void onCreate( SQLiteDatabase db ){ db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_CONCERT + "(_id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, img TEXT, start_date TEXT, end_date TEXT, time TEXT, price TEXT, place TEXT, theater TEXT, playtime TEXT, genre TEXT, search TEXT)" ); } //@override public void onOpen (SQLiteDatabase db){ super.onOpen(db); } //@override public void onUpgrade( SQLiteDatabase db, int oldVersion, int newVersion ){ { if(oldVersion < newVersion ){ db.execSQL ("DROP TABLE IF EXISTS " + TABLE_CONCERT ); onCreate(db); } } } public void resetTable( SQLiteDatabase db ){ db.execSQL ("DROP TABLE IF EXISTS " + TABLE_CONCERT ); onCreate(db); } public long insert(ContentValues addRowValue) { return getWritableDatabase().insert(TABLE_CONCERT, null, addRowValue); } public int insertAll ( ContentValues[] values ){ SQLiteDatabase db = getWritableDatabase(); db.beginTransaction(); for(ContentValues contentValues : values){ db.insert( TABLE_CONCERT, null, contentValues ); } db.setTransactionSuccessful(); db.endTransaction(); Log.d("Data Inserted", "DATA INSERT_ALL TASK COMPLETED"); return values.length; } public Cursor query( String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy ){ return getReadableDatabase().query( TABLE_CONCERT, columns, selection, selectionArgs, groupBy, having, orderBy); } public int update ( ContentValues updateRowValue, String whereClause, String[] whereArgs ){ return getWritableDatabase().update( TABLE_CONCERT, updateRowValue, whereClause, whereArgs); } public int delete(String whereClause, String[] whereArgs ){ return getWritableDatabase().delete(TABLE_CONCERT, whereClause, whereArgs); } }
true
7c68c993b53eac34d957b68d3e29e1ec3d041058
Java
DjVidiX/TAS-FirstProject
/Marek/Player.java
UTF-8
436
2.53125
3
[]
no_license
class Player { private String name; //private Interfejs interfejs; private static int id; private Boolean ready; public Player() { this.name = "Undefined"; } public Player(String name, int id) { this.name = name; this.id = id; } public int getId() { return id; } public String getName() { return name; } public void setReady() { this.ready = true; } public Boolean isReady() { return ready; } }
true
9a6c181759d048b8f884dca62887be946462ac33
Java
basakciftci/NewStarts
/src/main/java/WhileLoopPractice/StarTree.java
UTF-8
432
3.171875
3
[]
no_license
package WhileLoopPractice; import java.util.Scanner; public class StarTree{ public static void main(String[] args){ Scanner input =new Scanner( System.in ); System.out.println("Please enter the number"); int num=input.nextInt(); int count=0; String star="*"; while (count<num){ System.out.println(star); star+="*"; count++; } } }
true
3a14db4a1142ebdee7e31b3644fa8616822f6443
Java
AhmedMaad/E-Commerce-User-Candroid
/app/src/main/java/com/maad/buyfromcandroiduser/HomeActivity.java
UTF-8
970
2.09375
2
[]
no_license
package com.maad.buyfromcandroiduser; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; public class HomeActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); } public void showFurnitureProducts(View view) { openActivity("Furniture"); } public void showElectronicsProducts(View view) { openActivity("Electronics"); } public void showFashionProducts(View view) { openActivity("Clothes"); } private void openActivity(String cat){ Intent i = new Intent(this, ProductActivity.class); i.putExtra("cat", cat); startActivity(i); } }
true
904b2806765710c65d2a093b2aa76bf225a52e1e
Java
wangzhengbo/TCC4Java
/test/cn/com/tcc/UndefineSymbolTest.java
UTF-8
1,388
2.296875
2
[ "Apache-2.0" ]
permissive
package cn.com.tcc; import java.io.File; import java.io.IOException; import org.junit.Assert; import org.junit.Test; import com.sun.jna.Function; public class UndefineSymbolTest extends BaseTest { @Test public void undefineSymbol() throws IOException { // symbol 'NAME' not defined State state = new State(); Assert.assertTrue(state.compile(new File("test/undefineSymbol.c"))); Assert.assertTrue(state.relocateAuto()); Function func = state.getFunction("testUndefineSymbol"); Assert.assertNotNull(func); Assert.assertEquals(0, func.invokeInt(new Object[] {})); state.delete(); // symbol 'NAME' defined state = new State(); state.defineSymbol("NAME"); Assert.assertTrue(state.compile(new File("test/undefineSymbol.c"))); Assert.assertTrue(state.relocateAuto()); func = state.getFunction("testUndefineSymbol"); Assert.assertNotNull(func); Assert.assertEquals(1, func.invokeInt(new Object[] {})); state.delete(); // symbol 'NAME' not defined state = new State(); state.defineSymbol("NAME"); state.undefineSymbol("NAME"); Assert.assertTrue(state.compile(new File("test/undefineSymbol.c"))); Assert.assertTrue(state.relocateAuto()); func = state.getFunction("testUndefineSymbol"); Assert.assertNotNull(func); Assert.assertEquals(0, func.invokeInt(new Object[] {})); state.delete(); } }
true
91d4a70ca017b440bd6d1bcc1295d9074d6eab5f
Java
DomKing/stream-and-lambda
/src/main/java/org/prcode/functional/stream/terminal/StreamToArrayDemo.java
UTF-8
1,440
3.203125
3
[ "MIT" ]
permissive
package org.prcode.functional.stream.terminal; import org.junit.jupiter.api.Test; import java.util.stream.Stream; /** * @author kangd001 * @date 2021/7/7 22:09 */ public class StreamToArrayDemo { @Test public void toArrayWithFuncNormalTest() { Stream<String> stringStream = Stream.of("this", "is", "toArrayWithFuncTest"); //String[]::new 等效于 size -> new String[size] String[] strings = stringStream.toArray(String[]::new); for (String str : strings) { System.out.print(str + " "); } } @Test public void toArrayWithFuncWrongSizeTest() { Stream<String> stringStream = Stream.of("this", "is", "toArrayWithFuncTest"); String[] strings = stringStream.toArray(size -> new String[2]); for (String str : strings) { System.out.print(str + " "); } } @Test public void toArrayWithFuncWrongTypeTest() { Stream<String> stringStream = Stream.of("this", "is", "toArrayWithFuncTest"); Integer[] nums = stringStream.toArray(Integer[]::new); for (Integer i : nums) { System.out.print(i + " "); } } @Test public void toArrayTest() { Stream<String> stringStream = Stream.of("this", "is", "toArrayTest"); Object[] objects = stringStream.toArray(); for (Object obj : objects) { System.out.print(obj + " "); } } }
true
57bc446fadc08689f7ba422cf40e966e9ab2ccc9
Java
irishaha/java-2017f-homework
/Fianl Project/杨楠-151220142/Final_Project/src/test/java/FinalProject/StageTest.java
UTF-8
552
1.914063
2
[]
no_license
package FinalProject; import static org.junit.Assert.*; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; public class StageTest { @BeforeClass public static void beforeClass() { Level l = new Level(); } @Before public void before() { Stage.ground_above[0][5].settype(1); for(int i=0;i<Huluwa.getkinds();i++) Stage.ground_above[2][2+i].settype(8); } @Ignore public void testNot_complete() { int z = 0; if(new Stage(20,11).not_complete()) z = 1; assertEquals(0,z); } }
true
fa5c04e12bfabd3d2a8f8a7ade5a7f1eb8889046
Java
VianneyDoleans/SpamFilterBot
/DataGenerator/src/main/java/dataGenerator/MainWindow.java
UTF-8
2,254
2.65625
3
[]
no_license
package dataGenerator; import javafx.application.Application; import javafx.application.Platform; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; import java.io.IOException; public class MainWindow extends Application { private SceneController sceneController; private Parent textJudgmentRequestedFXML; private JudgmentRequestedController textJudgmentRequestedController; private Parent loadFileFXML; private LoadFileController loadFileController; private void initJudgmentRequested() throws IOException { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/views/JudgmentRequested.fxml")); this.textJudgmentRequestedFXML = fxmlLoader.load(); this.textJudgmentRequestedController = fxmlLoader.getController(); this.textJudgmentRequestedController.init(); } private void initLoadFile() throws IOException { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/views/LoadFile.fxml")); this.loadFileFXML = fxmlLoader.load(); this.loadFileController = fxmlLoader.getController(); this.loadFileController.giveJudgmentRequestedController(this.textJudgmentRequestedController); this.loadFileController.init(); } @Override public void start(Stage stage) throws IOException { initJudgmentRequested(); initLoadFile(); Scene scene = new Scene(this.loadFileFXML, 700, 400); this.sceneController = new SceneController(scene); sceneController.add(LoadFileController.class.getSimpleName(), this.loadFileFXML); sceneController.add(JudgmentRequestedController.class.getSimpleName(), this.textJudgmentRequestedFXML); this.loadFileController.initSceneController(sceneController); this.textJudgmentRequestedController.initSceneController(sceneController); stage.setScene(scene); stage.setOnCloseRequest(e -> { this.textJudgmentRequestedController.close(); Platform.exit(); }); stage.setMinWidth(700); stage.setMinHeight(400); stage.show(); } public static void main(String[] args) { launch(args); } }
true
98002292e36ac9dfb98842a67e8945ddf2bf3324
Java
Decongo/Ticket-To-Ride
/common/src/main/java/weber/kaden/common/injectedInterfaces/iCommandManager.java
UTF-8
339
2.0625
2
[]
no_license
package weber.kaden.common.injectedInterfaces; import java.util.List; import weber.kaden.common.command.CommandData.CommandData; import weber.kaden.common.model.Game; public interface iCommandManager { List<Game> gamesList(); Game getGameByID(String gameID); List<CommandData> getLatestCommands(String gameID); }
true
b626d60041fd76dc4c9b246995d891f18efc9044
Java
blikoon/Ubufundi
/App3.6.2/app/src/main/java/com/blikoon/app362/RepoService.java
UTF-8
252
1.757813
2
[]
no_license
package com.blikoon.app362; import java.util.List; import retrofit2.Call; import retrofit2.http.GET; public interface RepoService { @GET("orgs/blikoon/repos") Call<List<Repo>> getRepos(); //You can add other methods as need arises. }
true
d72c428af91b419ddaaa87c06159edf05ac6d3bb
Java
HensCoderoad/GeneralManager
/manager/src/main/java/com/general/manager/entity/vo/UserVO.java
UTF-8
1,883
2.234375
2
[]
no_license
package com.general.manager.entity.vo; import com.general.manager.entity.Role; import lombok.Data; import javax.validation.Valid; import java.io.Serializable; import java.util.Date; import java.util.Set; @Data public class UserVO implements Serializable { private Long uid; private String username; private String nickname; private Set<Role> roles; private Date createTime; private Date updateTime; public UserVO(Long uid, String username, String nickname) { this.uid = uid; this.username = username; this.nickname = nickname; } public UserVO() { } public Set<Role> getRoles() { return roles; } public void setRoles(Set<Role> roles) { this.roles = roles; } public Long getUid() { return uid; } public void setUid(Long uid) { this.uid = uid; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } @Override public String toString() { return "UserVO{" + "uid=" + uid + ", username='" + username + '\'' + ", nickname='" + nickname + '\'' + ", roles=" + roles + ", createTime=" + createTime + ", updateTime=" + updateTime + '}'; } }
true