blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
13bdd124de70bbc9150703d3dc9feda4cfa80b21 | eb00845231b3133f993228441fdc5674fa3fda8f | /src/main/java/com/signeasy/entity/ResourcePermission.java | ef987b182f6eef2630da92e399a34901a325d3c4 | [] | no_license | hpant/SignEasyAuth | fde8b802c3e4cc9d2e758c0ee0df540ab82eb1cc | 97b9f13309a4743e5178720805a3744095d157ff | refs/heads/master | 2023-05-31T04:59:32.816127 | 2021-06-14T17:25:28 | 2021-06-14T17:25:28 | 376,902,575 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,055 | java | package com.signeasy.entity;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
@Table(name = "RESOURCE_PERMISSION")
@Getter
@Setter
@Entity
public class ResourcePermission {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="id")
private int id;
@JsonIgnore
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "resource_id", referencedColumnName = "id")
private Resource resource;
@Column(name="permission", nullable = false, unique=true)
private String permission;
@ManyToMany(mappedBy = "resourcePermissions")
private Set<Role> roles = new HashSet<>();
}
| [
"root@Harshs-MacBook-Air.local"
] | root@Harshs-MacBook-Air.local |
9e6b13de178e86f7392e1eb5118bdf84d1bd39ac | a744882fb7cf18944bd6719408e5a9f2f0d6c0dd | /sourcecode8/src/sun/net/www/protocol/jar/URLJarFileCallBack.java | 24a1ffd96c6b5cf3fb6a020644d7157dcbab26f0 | [
"Apache-2.0"
] | permissive | hanekawasann/learn | a39b8d17fd50fa8438baaa5b41fdbe8bd299ab33 | eef678f1b8e14b7aab966e79a8b5a777cfc7ab14 | refs/heads/master | 2022-09-13T02:18:07.127489 | 2020-04-26T07:58:35 | 2020-04-26T07:58:35 | 176,686,231 | 0 | 0 | Apache-2.0 | 2022-09-01T23:21:38 | 2019-03-20T08:16:05 | Java | UTF-8 | Java | false | false | 1,472 | java | /*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.net.www.protocol.jar;
import java.io.*;
import java.net.*;
import java.util.jar.*;
/*
* This interface is used to call back to sun.plugin package.
*/
public interface URLJarFileCallBack {
public JarFile retrieve(URL url) throws IOException;
}
| [
"763803382@qq.com"
] | 763803382@qq.com |
e663957440d2c003d27f2ef5315e817d8e2a7dde | 596f445fb4d597ea90d307aaf4cf2d8670015df4 | /FoodFinder/src/foodfinder/Home.java | c46004bafc3e08fa6650ef5521d34780fb2c71e9 | [] | no_license | soumiknafiulferdous/Food-Finder-Desktop-Application | 9acf619670247512be88a3ee478ab6c346788829 | ebac33e0d9630cadf2f1cf161f9972448ad2eaa6 | refs/heads/master | 2022-07-13T17:12:11.426463 | 2020-05-18T16:11:44 | 2020-05-18T16:11:44 | 264,702,828 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,171 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package foodfinder;
import java.awt.Image;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
/**
*
* @author User
*/
public class Home extends javax.swing.JFrame {
/**
* Creates new form Home
*/
Connection connect = null;
public String str="";
public String str2="";
public Home() {
initComponents();
}
public Home(String str1,String username) {
initComponents();
try{
// Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager.getConnection("jdbc:mysql://localhost/foodfinder","root","");
System.out.println("Successfully Connected to Mysql1");
}catch(Exception e){
System.out.println("Not Connected..");
e.printStackTrace();
}
str=str1;
str2=username;
name.setText(username);
Fillcombo();
Fillcombo1();
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
search = new javax.swing.JButton();
location = new javax.swing.JComboBox<>();
jLabel4 = new javax.swing.JLabel();
cuisine = new javax.swing.JComboBox<>();
search2 = new javax.swing.JButton();
search1 = new javax.swing.JButton();
name = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel3.setBackground(new java.awt.Color(0, 51, 51));
jLabel1.setBackground(new java.awt.Color(0, 153, 153));
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
jLabel1.setForeground(new java.awt.Color(0, 153, 102));
jLabel1.setText("Food Finder");
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 0, 0));
jLabel2.setText("Log Out");
jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel2MouseClicked(evt);
}
});
jPanel1.setBackground(new java.awt.Color(204, 204, 255));
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
jLabel3.setText("Location:");
search.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
search.setText("Search");
search.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
searchActionPerformed(evt);
}
});
location.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
location.setMaximumRowCount(30);
location.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
locationActionPerformed(evt);
}
});
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
jLabel4.setText("Cuisine :");
cuisine.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
cuisine.setMaximumRowCount(30);
cuisine.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cuisineActionPerformed(evt);
}
});
search2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
search2.setText("Search");
search2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
search2ActionPerformed(evt);
}
});
search1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
search1.setText("Search");
search1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
search1ActionPerformed(evt);
}
});
name.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
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(252, 252, 252)
.addComponent(search, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cuisine, javax.swing.GroupLayout.PREFERRED_SIZE, 296, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(search1, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(location, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(search2, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(47, 47, 47))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(name, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(179, 179, 179)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cuisine, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(name, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(174, 174, 174)
.addComponent(search1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(89, 89, 89)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(location, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(114, 114, 114)
.addComponent(search2, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 87, Short.MAX_VALUE)
.addComponent(search, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(49, 49, 49))
);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(105, 105, 105)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 223, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(42, 42, 42))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap(28, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 2, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseClicked
LoginForm lf=new LoginForm();
lf.setVisible(true);
lf.setLocationRelativeTo(null);
this.dispose();
}//GEN-LAST:event_jLabel2MouseClicked
private void searchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchActionPerformed
// TODO add your handling code here:
String str5=String.valueOf(location.getSelectedItem());
String str6=String.valueOf(cuisine.getSelectedItem());
MyDatabaseHandler mdb=new MyDatabaseHandler();
mdb.connectDatabase();
ArrayList<product>list=mdb.BindTable(str5,str6,3);
if(list.size()>0)
{
Jtable jt=new Jtable(str,str2);
jt.setVisible(true);
jt.setLocationRelativeTo(null);
jt.populateJTable(str5,str6,3);
this.dispose();
}
else
{
JOptionPane.showMessageDialog(this,"Found no restaurant of this combination in this area.");
}
}//GEN-LAST:event_searchActionPerformed
private void search2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_search2ActionPerformed
// TODO add your handling code here:
Jtable jt=new Jtable(str,str2);
String str1=String.valueOf(location.getSelectedItem());
jt.setVisible(true);
jt.setLocationRelativeTo(null);
jt.populateJTable(str1,"",2);
this.dispose();
}//GEN-LAST:event_search2ActionPerformed
private void search1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_search1ActionPerformed
// TODO add your handling code here:
Jtable jt=new Jtable(str,str2);
String str2=String.valueOf(cuisine.getSelectedItem());
jt.setVisible(true);
jt.setLocationRelativeTo(null);
jt.populateJTable("",str2,1);
this.dispose();
}//GEN-LAST:event_search1ActionPerformed
private void locationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_locationActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_locationActionPerformed
private void cuisineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cuisineActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cuisineActionPerformed
public void Fillcombo()
{
try{
String query="select distinct location from restaurant";
PreparedStatement p=connect.prepareStatement(query);
ResultSet rs=p.executeQuery();
while(rs.next()){
String name=rs.getString("location");
location.addItem(name);
}
}
catch(Exception e){
}
}
public void Fillcombo1()
{
try{
String query="select distinct cuisine from restaurant";
PreparedStatement p=connect.prepareStatement(query);
ResultSet rs=p.executeQuery();
while(rs.next()){
String name=rs.getString("cuisine");
cuisine.addItem(name);
}
}
catch(Exception e){
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Home().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JComboBox<String> cuisine;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel3;
private javax.swing.JComboBox<String> location;
private javax.swing.JLabel name;
private javax.swing.JButton search;
private javax.swing.JButton search1;
private javax.swing.JButton search2;
// End of variables declaration//GEN-END:variables
}
| [
"noreply@github.com"
] | soumiknafiulferdous.noreply@github.com |
f9e4181d7681ad44700b7d46141d5898177be3ae | a8a27704a78ae56b1eabc0340d1f00b9e51f28bf | /src/main/java/com/github/east196/core/vo/LatLon.java | 838658cc59343152ffe715b9045c703f6144bb66 | [
"Apache-2.0"
] | permissive | East196/easyboot | ab3b36098fd8c65c221aba632ebcb693f61cce44 | b5f4a2d86c3b69a4a1fc9b163824626c31c4032f | refs/heads/master | 2022-06-06T18:58:55.310633 | 2020-10-15T01:30:13 | 2020-10-15T01:30:13 | 148,030,648 | 1 | 0 | Apache-2.0 | 2022-05-20T21:38:06 | 2018-09-09T13:57:02 | Java | UTF-8 | Java | false | false | 538 | java | package com.github.east196.core.vo;
import com.fasterxml.jackson.annotation.JsonAlias;
import lombok.Data;
@Data
public class LatLon {
@JsonAlias({"alarmId","faultId","riskId"})
private String eventId;
private Double lat;
private Double lon;
public LatLon() {
}
public LatLon(String eventId) {
this.eventId = eventId;
}
public LatLon(String eventId, Double lat, Double lon) {
this.eventId = eventId;
this.lat = lat;
this.lon = lon;
}
}
| [
"2901180515@qq.com"
] | 2901180515@qq.com |
59971a55cbd993994f9031e1ae50906bb178de91 | 6e4152c3084d0df03e2e3a746aad9adfa53e5b0e | /src/edu/nyu/cs/hps/adversarialshortestpath/Helper.java | 0d77c9cb9d888f1ffdf0cb423de3586e3a390bdf | [] | no_license | webrantley/AdversarialShortestPath | ea052342b40b6fdf2384022657c81b76e8f647af | 2e4c3406ca33e9367e6ba45198f5b886399df176 | refs/heads/master | 2021-01-10T23:46:13.360152 | 2017-03-31T22:24:22 | 2017-03-31T22:24:22 | 70,402,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,235 | java | package edu.nyu.cs.hps.adversarialshortestpath;
import java.util.*;
public class Helper {
public static ArrayList<LinkedList<Edge>> converter(int[][] map){
int n = map.length;
ArrayList<LinkedList<Edge>> adjacentTable = new ArrayList<>();
for(int i = 0; i < n; i++){
LinkedList<Edge> e = new LinkedList<>();
for(int j = 0; j < n; j++){
if(map[i][j] != 0){
e.add(new Edge(i,j,map[i][j]));
}
}
adjacentTable.add(e);
}
return adjacentTable;
}
public static int countBridges(long[][] map, Set<Integer> startSet, Set<Integer> endSet){
int count = 0;
for(Integer i : startSet){
for(Integer j : endSet){
if(map[i][j] != 0){
count++;
}
}
}
return count;
}
public static int countPathNum(ArrayList<HashSet<Integer>> prevs, int current){
if(prevs.get(current).isEmpty()){
return 1;
}
int count = 0;
for(Integer preve : prevs.get(current)){
count += countPathNum(prevs, preve);
}
return count;
}
}
| [
"lyy910619@gmail.com"
] | lyy910619@gmail.com |
12e62b3ff082619ffcea14367a5786c162c089f2 | 4af16df92ef766a61f650274357e10832822740d | /sbs-eureka-web/src/main/java/com/github/chen0040/eureka/web/configs/BeanConfig.java | 53be2dd4fa991e7225c3e89a73b9218cb412904e | [
"MIT"
] | permissive | ansatsing/spring-cloud-magento-slingshot | bebd971df099d7b29f14f233d2ed4493fe624d66 | 8914d78a99ebf01393b485ac651612e558d28b11 | refs/heads/master | 2020-03-11T14:07:13.774339 | 2017-10-19T15:21:09 | 2017-10-19T15:21:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 198 | java | package com.github.chen0040.eureka.web.configs;
import org.springframework.context.annotation.Configuration;
/**
* Created by xschen on 12/27/16.
*/
@Configuration
public class BeanConfig {
}
| [
"xs0040@gmail.com"
] | xs0040@gmail.com |
e6401123077e3227c3902f1c379ea0724294db11 | 048c828f46525615ed5e80f6181aa48a40c8ddfe | /src/main/java/musiclibrary/mvc/controller/TrackListController.java | 96229e8e76a4be5984035a5ef6802aecf2ed6bef | [] | no_license | yayayaka/WebRest | 547ce5de49b68ba8adaf4c2e65b564f3e8f655e9 | e166a7fb1fbb84227ff89adf18c5adf067b98fb9 | refs/heads/master | 2020-05-16T00:32:01.660571 | 2019-05-04T19:49:46 | 2019-05-04T19:49:46 | 182,582,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,436 | java | package musiclibrary.mvc.controller;
import com.google.inject.*;
import musiclibrary.entities.*;
import musiclibrary.entities.Artist;
import musiclibrary.mvc.model.Model;
import musiclibrary.mvc.view.Listener;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class TrackListController extends GenericController<TrackList> {
private TrackListController() {
}
@Inject
public TrackListController(Model<TrackList> trackListContainer) {
this.container = trackListContainer;
}
@Override
public void add(TrackList trackList) {
container.put(-1, trackList);
}
@Override
public void del(int id) {
container.remove(id);
}
@Override
public void replace(TrackList trackList) {
container.update(trackList);
}
@Override
public TrackList get(int id) {
return container.getItem(id);
}
@Override
public List<TrackList> getAll() {
return container.getItems();
}
}
//package musiclibrary.mvc.controller;
//
//import com.google.common.collect.ImmutableList;
//import com.google.inject.Inject;
//import com.google.inject.Singleton;
//import musiclibrary.entities.*;
//import musiclibrary.entities.TrackList;
//import musiclibrary.mvc.model.Model;
//import musiclibrary.mvc.view.Listener;
//
//@Singleton
//public class TrackListController extends GenericController<TrackList> {
// private TrackListController() {
// }
//
// @Inject
// public TrackListController(Model<TrackList> TrackListContainer) {
// this.container = TrackListContainer;
// }
//
// public int add(Album album, ImmutableList<Track> tracks) throws InterruptedException {
// int id=0;
// id=getNextId();
// TrackList TrackList = new TrackList(id, album,tracks);
// container.put(id,TrackList);
// return id;
// }
//
// public void change(int changedTrackListId, Album album, ImmutableList<Track> tracks) throws InterruptedException {
// try {
// TrackList TrackList = new TrackList(changedTrackListId, album,tracks);
// container.remove(changedTrackListId);
// container.put(changedTrackListId,TrackList);
// } catch (Exception e) {
// throw new RuntimeException("Cant change TrackList",e);
// }
// }
//}
| [
"yayayaka@yandex.ru"
] | yayayaka@yandex.ru |
66c37fd048a9c30be197bcec3ec61f8aa36d4682 | f36c275c8b0d73a872c139fddbfbd989507b02d6 | /src/main/java/BinaryTree/Easy_Problems/RangeSumOfBST.java | 67215371bbc1f8552ca051e3a964310c4b126e5e | [] | no_license | Amandalin1171/LeetCode_Exercise | 9135bcb7d4da11a1b33bce3df2af3097da890d3a | 0601e32a23f272a4b9ea7368809b0726d3a7b4e0 | refs/heads/master | 2022-10-27T20:21:54.330093 | 2020-06-15T00:50:45 | 2020-06-15T00:50:45 | 233,981,230 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,778 | java | package BinaryTree.Easy_Problems;
/**
* 938. Range Sum of BST
* Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive).
*
* The binary search tree is guaranteed to have unique values.
*
* Example 1:
* Input: root = [10,5,15,3,7,null,18], L = 7, R = 15
* Output: 32
* Example 2:
*
* Input: root = [10,5,15,3,7,13,18,1,null,6], L = 6, R = 10
* Output: 23
*
* Note:
* The number of nodes in the tree is at most 10000.
* The final answer is guaranteed to be less than 2^31.
*/
import BinaryTree.TreeNode;
/**
* DFS:
* 方法1: 自己写的代码比较冗长,但是无所谓traverse的顺序
* 方法2: preSum的方法,每一层去累加,判断条件和遍历的顺序非常固定不能更改
*/
public class RangeSumOfBST {
//方法1:自己写的
int sum = 0;
public int rangeSumBST(TreeNode root, int L, int R) {
//corner case
if(L > R || root == null) return 0;
return sum(root, L, R);
}
//每一层return上去一个数,遍历的顺序无所谓
private int sum(TreeNode node, int L, int R) {
if(node == null) return 0;
if(node.val >= L && node.val <= R) return node.val + sum(node.left, L, R) + sum(node.right, L, R);
else if(node.val < L) return sum(node.right, L, R);
else if(node.val > R) return sum(node.left, L, R);
return sum;
}
//方法2:很干净的代码,但是需要思路清晰不能更改遍历的顺序
public int rangeSumBST2(TreeNode root, int L, int R) {
if(root == null) return 0;
int sum = 0;
if(L < root.val) sum += rangeSumBST(root.left, L, R);
if(root.val < R) sum += rangeSumBST(root.right, L, R);
if(root.val >= L && root.val <= R) sum += root.val;
return sum;
}
}
| [
"you@example.com"
] | you@example.com |
5bc35f23403499ed237742b777ef64e91bbc9ab4 | 22361430ab12e5a7c1eba4664293fc4a39051d9b | /QMRServer/src/com/game/player/message/ReqNonageTimeMessage.java | 42f1b945d6add45e38fc1d5c3c92f7f2285ffb30 | [] | no_license | liuziangexit/QMR | ab93a66623e670a7f276683d94188d1b627db853 | 91ea3bd35ee3a1ebf994fb3fd6ffdbaa6fbf4d22 | refs/heads/master | 2020-03-30T00:22:31.028514 | 2017-12-20T05:41:17 | 2017-12-20T05:41:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 884 | java | package com.game.player.message;
import com.game.message.Message;
import org.apache.mina.core.buffer.IoBuffer;
/**
* @author Commuication Auto Maker
*
* @version 1.0.0
*
* 请求防沉迷在线时间消息
*/
public class ReqNonageTimeMessage extends Message{
/**
* 写入字节缓存
*/
public boolean write(IoBuffer buf){
return true;
}
/**
* 读取字节缓存
*/
public boolean read(IoBuffer buf){
return true;
}
@Override
public int getId() {
return 103207;
}
@Override
public String getQueue() {
return null;
}
@Override
public String getServer() {
return null;
}
@Override
public String toString(){
StringBuffer buf = new StringBuffer("[");
if(buf.charAt(buf.length()-1)==',') buf.deleteCharAt(buf.length()-1);
buf.append("]");
return buf.toString();
}
} | [
"ctl70000@163.com"
] | ctl70000@163.com |
8d894252d1fe5842e9c685826d18af4d7da309ce | f1c752546c32fac83f336a234553109b454e4608 | /app/src/main/java/sanguinebits/com/ezyfoods/pastOrders/PastOrdersPresenter.java | 0827d7a4c21a98dc7d5df449eccb7373d613e7a5 | [] | no_license | ArmaanDroid/EzyFoodsApp | 7c470d98b2e94bd4a2dede3a1821cc3e0dd0f211 | 8af0d337e11ff0ef215f1da60e2b47d4309827da | refs/heads/master | 2020-05-15T07:12:35.762036 | 2019-04-18T18:11:15 | 2019-04-18T18:11:15 | 182,135,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,367 | java | package sanguinebits.com.ezyfoods.pastOrders;
import android.app.Activity;
import android.support.v4.widget.SwipeRefreshLayout;
import apis.RequestEndPoints;
import apis.WebRequestBody;
import base.BasePresenter;
import model.ApiResponse;
public class PastOrdersPresenter extends BasePresenter {
private PastOrdersView mView;
private Activity activity;
public PastOrdersPresenter(Activity activity,PastOrdersView mView) {
super(activity);
this.activity=activity;
this.mView=mView;
}
void getPastOrders(final SwipeRefreshLayout mySwipeRefreshLayout){
WebRequestBody requestBody=new WebRequestBody();
requestBody.setRequestName(RequestEndPoints.get_orders);
mView.showProgress("Please wait...");
mySwipeRefreshLayout.setRefreshing(true);
makeRequest(requestBody, new WeResponseCallback() {
@Override
public void onResponse(ApiResponse commonPojo) throws Exception {
mView.hidePorgress();
mView.onOrdersLoaded(commonPojo.getOrders());
mySwipeRefreshLayout.setRefreshing(false);
}
@Override
public void failure(Exception e, String message) {
mView.hidePorgress();
mySwipeRefreshLayout.setRefreshing(false);
}
});
}
}
| [
"hk77755@gmail.com"
] | hk77755@gmail.com |
4c956dce10029854ea6c0beae5d944ba830b201f | b01aa88d86e8ea5a54a897301aa6858756847b88 | /WebSales/src/java/controller/ProcessController.java | b82dca82de747cb5e42302d815630420d328766e | [] | no_license | huyhue/Java-Web | 65428c00bfd24cdbceb97d391cacf336eb566ac2 | f25a181822ee191491c0d77a96619a7fdf18fe20 | refs/heads/master | 2023-01-27T17:27:58.552786 | 2020-12-07T16:39:40 | 2020-12-07T16:39:40 | 296,848,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,285 | java | package controller;
import java.io.IOException;
import java.util.Random;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import dao.KhachHangDAO;
import model.KhachHang;
@WebServlet("/Process")
public class ProcessController extends HttpServlet {
private static final long serialVersionUID = 1L;
public ProcessController() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setCharacterEncoding("text/html;charset=utf-8");
HttpSession session = request.getSession();
session.getAttribute("");
String chucNang = request.getParameter("chucNang");
String maKH = request.getParameter("id");
if(chucNang==null){
}else if(chucNang.equals("Delete")){ //Chức năng xóa khách hàng
// UndoDAO.undoCustomer.push(KhachHangDAO.mapKhachHang.get(maKH));
new KhachHangDAO().del(maKH);
}else
//chức năng xóa toàn bộ khách hàng
if(chucNang.equals("DelAll")){
new KhachHangDAO().delAll();
}else
//chức năng undoAll
if(chucNang.equals("UndoAll")){
new KhachHangDAO().undo();
}else
//chức năng undoOne
if(chucNang.equals("UndoOne")){
new UndoDAO().restoreDeletedCustomer();
}else
//chức năng sửa khách hàng
if(chucNang.equals("Edit")){
String matKhau = request.getParameter("matKhau");
String tenKhachHang = request.getParameter("ten");
String gioiTinh = request.getParameter("gioiTinh");
String soDienThoai = request.getParameter("soDienThoai");
String email = request.getParameter("email");
String ngaySinh = request.getParameter("ngaySinh");
String diaChi = request.getParameter("diaChi");
String soLuongMua = request.getParameter("soLuongMua"); //chua co thong tin
String role = request.getParameter("chkOwner");
String quyen = "";
if (role != null) {
quyen = "owner";
} else {
quyen = "user";
}
KhachHang kh = new KhachHang(maKH, matKhau, tenKhachHang, gioiTinh, soDienThoai, email, ngaySinh,
diaChi, soLuongMua, quyen);
new KhachHangDAO().edit(maKH, kh);
}else
//chức năng thêm khách hàng
if(chucNang.equals("Add")){
String tenKH=request.getParameter("tenKH");
String tenTKKH=request.getParameter("tkkh");
String pass=request.getParameter("pass");
String email=request.getParameter("email");
String diaChi=request.getParameter("diachi");
String sdt=request.getParameter("sdt");
String ma="KH"+new KhachHangDAO().random(3000);
KhachHang kh = new KhachHang(ma, tenKH, pass, sdt, tenTKKH);
new KhachHangDAO().add( kh);
}
response.sendRedirect("myAccount.jsp");
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
| [
"tpgiahuy5@gmail.com"
] | tpgiahuy5@gmail.com |
5f09ae9831270319b730a21008ed225479161b92 | d43556071eda9068c1e9618d68b5597e6a85ff37 | /src/main/java/br/com/caelum/zhit/parser/GitBlobParser.java | b59f36b7c391a19784ce9d5eb3bd4053112f849f | [] | no_license | williammizuta/zhit | c2e385d7398126e89a10c301f1f12924e52a181c | a77fbf9e36f5277113dbe494458205b45e89fa15 | refs/heads/master | 2016-09-05T09:08:12.862106 | 2013-11-06T20:48:20 | 2013-11-06T20:48:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | package br.com.caelum.zhit.parser;
import br.com.caelum.zhit.model.GitBlob;
public class GitBlobParser implements GitObjectParser<GitBlob> {
@Override
public GitBlob parse(String objectContent) {
return new GitBlob(objectContent);
}
}
| [
"chico.sokol@gmail.com"
] | chico.sokol@gmail.com |
7857cab14b3f34973ffa3a31fc3f4a6de14f44af | 2a663a472ff43a98c7bdd40a8a77afad098bd36b | /build/generated-sources/ap-source-output/entity/ExactDateTranslations_.java | c8cb012f5f5deb546eea199cfc2cbab829e31d09 | [] | no_license | mthambipillai/historyquiz | 6e9a78536c6c8232bffe50ab0bdaa29550110404 | c1e15cfc6ca2a26e8eb984500d7320e2d24d6e46 | refs/heads/master | 2021-09-12T23:22:23.393940 | 2018-04-22T15:58:34 | 2018-04-22T15:58:34 | 105,642,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | package entity;
import entity.ExactDate;
import entity.ExactDateTranslationsPK;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="EclipseLink-2.5.1.v20130918-rNA", date="2017-08-23T18:25:10")
@StaticMetamodel(ExactDateTranslations.class)
public class ExactDateTranslations_ {
public static volatile SingularAttribute<ExactDateTranslations, ExactDate> exactDate;
public static volatile SingularAttribute<ExactDateTranslations, ExactDateTranslationsPK> exactDateTranslationsPK;
public static volatile SingularAttribute<ExactDateTranslations, Boolean> isDefault;
public static volatile SingularAttribute<ExactDateTranslations, String> event;
} | [
"melkiorthambipillai@gmail.com"
] | melkiorthambipillai@gmail.com |
ffdc3180ff6cf71221ba8c098aefb92409847f03 | 62e334192393326476756dfa89dce9f0f08570d4 | /ztk_code/ztk-knowledge-parent/knowledge-web-server/src/main/java/com/huatu/ztk/knowledge/controller/v4/QuestionErrorControllerV4.java | e99cfdc6f16a1cc83de8f0c9f99316e3e3f4e6ed | [] | no_license | JellyB/code_back | 4796d5816ba6ff6f3925fded9d75254536a5ddcf | f5cecf3a9efd6851724a1315813337a0741bd89d | refs/heads/master | 2022-07-16T14:19:39.770569 | 2019-11-22T09:22:12 | 2019-11-22T09:22:12 | 223,366,837 | 1 | 2 | null | 2022-06-30T20:21:38 | 2019-11-22T09:15:50 | Java | UTF-8 | Java | false | false | 10,998 | java | package com.huatu.ztk.knowledge.controller.v4;
import com.google.common.collect.Maps;
import com.huatu.tiku.entity.download.QuestionErrorDownloadTask;
import com.huatu.ztk.commons.exception.BizException;
import com.huatu.ztk.commons.exception.CommonErrors;
import com.huatu.ztk.commons.exception.ErrorResult;
import com.huatu.ztk.commons.exception.SuccessMessage;
import com.huatu.ztk.knowledge.api.SubjectDubboService;
import com.huatu.ztk.knowledge.bean.QuestionPointTree;
import com.huatu.ztk.knowledge.bean.SubjectTree;
import com.huatu.ztk.knowledge.common.RedisKnowledgeKeys;
import com.huatu.ztk.knowledge.service.QuestionErrorService;
import com.huatu.ztk.knowledge.service.QuestionPointService;
import com.huatu.ztk.knowledge.service.v1.impl.QuestionErrorServiceImplV1;
import com.huatu.ztk.user.service.UserSessionService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.awt.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* Created by huangqingpeng on 2018/11/21.
*/
@RestController
@Slf4j
@RequestMapping(value = "/v4/errors",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class QuestionErrorControllerV4 {
@Autowired
UserSessionService userSessionService;
@Autowired
SubjectDubboService subjectDubboService;
@Autowired
QuestionErrorService questionErrorService;
@Autowired
QuestionPointService questionPointService;
/**
* 查询错题树结构
*
* @param token
* @param terminal
* @param subject
* @return
* @throws BizException
*/
@RequestMapping(value = "/trees", method = RequestMethod.GET)
public Object pointTrees(@RequestHeader(required = false) String token,
@RequestHeader int terminal,
@RequestParam(defaultValue = "-1") int subject,
HttpServletRequest httpServletRequest) throws BizException {
log.info("token={},terminal={},subject={},url={}", token, terminal, subject, httpServletRequest.getRequestURL().toString());
userSessionService.assertSession(token);
//取得用户ID
long userId = userSessionService.getUid(token);
if (subject < 0) { //没有传科目id,从session取科目id
subject = userSessionService.getSubject(token);
}
int newSubject = subjectDubboService.getBankSubject(subject);
List<QuestionPointTree> questionPointTrees = questionErrorService.queryErrorPointTrees(userId, newSubject);
if (CollectionUtils.isNotEmpty(questionPointTrees)) {
System.out.println("questionPointTrees.get(0).getAccuracy().before = " + questionPointTrees.get(0).getAccuracy());
questionPointService.handleAccuracy(questionPointTrees, userId);
System.out.println("questionPointTrees.get(0).getAccuracy().after = " + questionPointTrees.get(0).getAccuracy());
}
HashMap<Object, Object> map = Maps.newHashMap();
int total = 0;
for (QuestionPointTree questionPointTree : questionPointTrees) {
total += questionPointTree.getWnum();
}
map.put("tree", questionPointTrees);
map.put("total", total);
return map;
}
/**
* 用户删除指定的错题
*
* @param qid 试题id
* @return
*/
@RequestMapping(value = "/questions/{qid}", method = RequestMethod.DELETE)
public Object deleteErrorQuestion(@PathVariable int qid,
@RequestHeader(required = false) String token,
@RequestHeader int terminal,
HttpServletRequest httpServletRequest) throws BizException {
log.info("token={},qid={},terminal={},url={}", token, qid, terminal, httpServletRequest.getRequestURL().toString());
userSessionService.assertSession(token);
//取得用户ID
long userId = userSessionService.getUid(token);
int subject = userSessionService.getSubject(token);
questionErrorService.deleteErrorQuestion(qid, userId, subject);
return SuccessMessage.create("删除错题成功");
}
/**
* 清空错题本
*
* @return
*/
@RequestMapping(value = "/clear", method = RequestMethod.DELETE)
public Object clearErrorQuestion(@RequestHeader(required = false) String token,
@RequestHeader int terminal,
@RequestParam(defaultValue = "-1") int subject,
HttpServletRequest httpServletRequest) throws BizException {
log.info("token={},terminal={},subject={},url={}", token, terminal, subject, httpServletRequest.getRequestURL().toString());
userSessionService.assertSession(token);
//取得用户ID
long userId = userSessionService.getUid(token);
if (subject < 0) {
subject = userSessionService.getSubject(token);
}
questionErrorService.clearErrorQuestion(userId, subject);
return SuccessMessage.create("错题本清空成功");
}
@RequestMapping(value = "down/description", method = RequestMethod.GET)
public Object createPreDownloadSimple(){
return questionErrorService.getDownDescription();
}
/**
* 预下载逻辑结果
*
* @return
*/
@RequestMapping(value = "down/pre", method = RequestMethod.POST)
public Object createPreDownloadInfo(@RequestHeader String token,
@RequestHeader int terminal,
@RequestHeader String cv,
@RequestParam(defaultValue = "-1") int num,
@RequestParam(defaultValue = "-1") String pointIds) throws BizException {
log.info("createPreDownloadInfo method:{},{},{},{}", token, terminal, cv, pointIds);
userSessionService.assertSession(token);
long uid = userSessionService.getUid(token);
int subject = userSessionService.getNewSubject(token);
return questionErrorService.createPreDownloadInfo(uid, pointIds, subject,num);
}
/**
* 创建错题导出任务,获取需要导出的试题ID,创建答题卡,并返回导出任务的信息(名称,试题信息,答题卡ID等)
*
* @param token
* @param terminal
* @param cv
* @param pointIds
* @return
* @throws BizException
*/
@RequestMapping(value = "down/task", method = RequestMethod.POST)
public Object createDownloadTask(@RequestHeader String token,
@RequestHeader int terminal,
@RequestHeader String cv,
@RequestParam String pointIds) throws BizException {
log.info("createDownloadTask method:{},{},{},{}", token, terminal, cv, pointIds);
userSessionService.assertSession(token);
long uid = userSessionService.getUid(token);
int realSubject = userSessionService.getSubject(token);
String userName = userSessionService.getUname(token);
List<SubjectTree> subjectTree = subjectDubboService.getSubjectTree();
Optional<SubjectTree> any = subjectTree.stream().flatMap(i -> i.getChildrens().stream().map(a -> {
a.setName(i.getName() + a.getName());
return a;
})).filter(i -> i.getId() == realSubject).findAny(); //获取用户的考试类型科目信息
if (!any.isPresent()) {
throw new BizException(ErrorResult.create(10022212,"科目信息有误"));
}
int newSubject = userSessionService.getNewSubject(token);
return questionErrorService.createDownloadTask(uid,userName, pointIds, newSubject,any.get());
}
/**
* 下载任务列表
* @param token
* @param terminal
* @param cv
* @return
* @throws BizException
*/
@RequestMapping(value = "down/list",method = RequestMethod.GET)
public Object downList(@RequestHeader String token,
@RequestHeader int terminal,
@RequestHeader String cv,
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "20") int size) throws BizException {
userSessionService.assertSession(token);
long uid = userSessionService.getUid(token);
int subject = userSessionService.getSubject(token);
return questionErrorService.findDownList(uid,subject,page,size);
}
@RequestMapping(value = "down/info",method = RequestMethod.GET)
public Object downInfo(@RequestHeader String token,
@RequestParam Long taskId) throws BizException {
userSessionService.assertSession(token);
return questionErrorService.findDownInfo(taskId);
}
@RequestMapping(value = "down/order/list",method = RequestMethod.GET)
public Object getOrderDetail(@RequestHeader String token,
@RequestHeader int terminal,
@RequestHeader String cv,
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "20") int size) throws BizException {
userSessionService.assertSession(token);
long uid = userSessionService.getUid(token);
return questionErrorService.findOrderByUserId(uid,page,size);
}
@RequestMapping(value = "down/remove",method = RequestMethod.DELETE)
public Object deleteDownTask(@RequestHeader String token,
@RequestHeader int terminal,
@RequestHeader String cv,
@RequestParam(defaultValue = "") String taskIds) throws BizException {
userSessionService.assertSession(token);
long uid = userSessionService.getUid(token);
List<Long> collect = Arrays.stream(taskIds.split(",")).filter(NumberUtils::isDigits).map(Long::parseLong).collect(Collectors.toList());
if(CollectionUtils.isEmpty(collect)){
throw new BizException(CommonErrors.INVALID_ARGUMENTS);
}
return questionErrorService.deleteDownTask(uid,collect);
}
@RequestMapping(value = "reset/{userId}")
public Object restTree(@PathVariable long userId){
questionErrorService.restCheckLock(userId);
return SuccessMessage.create("重置错题本成功");
}
}
| [
"jelly_b@126.com"
] | jelly_b@126.com |
b0950b5a7d084fb666ba93387b9ccbd48e8892c4 | 9f85650a756a6009f631c52a64d0bbb00810a31e | /app/src/main/java/adapter/UserStoriesAdapter.java | a37abbc8fa4d1185001765406e515635937aa3bf | [] | no_license | scha14/SoberStories | e9f3165ac7d16e91f03a37fa3ea0e7eadf756eb0 | d34c3b070a4dd0ca8da637fdf58c104f8cc66b36 | refs/heads/master | 2020-04-02T06:08:22.278815 | 2016-06-16T10:30:52 | 2016-06-16T10:30:52 | 61,284,202 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,199 | java | package adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Toast;
import com.parse.FindCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseUser;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
import model.Story;
import soberstories.app.jsmtech.sobersstories.R;
/**
* Created by Sukriti on 6/4/16.
*/
public class UserStoriesAdapter extends RecyclerView.Adapter<UserStoriesAdapter.RV_ViewHolder> {
private List<Story> listOfStories;
private Context mContext;
String username = new ParseUser().getCurrentUser().getUsername();
View itemView;
public String url;
public UserStoriesAdapter(Context context, ArrayList<Story> StoryList) {
this.mContext = context;
this.listOfStories = StoryList;
}
@Override
public RV_ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.user_single_story_view, parent, false); // link to xml
return new RV_ViewHolder(itemView);
}
@Override
public void onBindViewHolder(final RV_ViewHolder holder,final int position) {
final Story story = listOfStories.get(holder.getAdapterPosition());
url = story.getStoryImageUrl();
final String description = story.getStoryDescription();
final String storyCaption = story.getStoryCaption();
holder.mDeleteStory.setVisibility(View.GONE);
String storyUploadersUsername = story.getUserName();
Picasso.with(mContext)
.load(url)
.fit()
.centerCrop()
.into(holder.mStoryImage);
Toast.makeText(mContext, storyUploadersUsername + " : " + username, Toast.LENGTH_SHORT).show();
if(storyUploadersUsername.equals(username)){
holder.mDeleteStory.setVisibility(View.VISIBLE);
holder.mDeleteStory.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 1. Delete from listOfBookings Arraylist and Update View with new array list.
listOfStories.remove(holder.getAdapterPosition());
notifyItemRemoved(holder.getAdapterPosition());
// 2. Delete Booking from the Backend
ParseQuery<Story> query = ParseQuery.getQuery(Story.class);
query.whereEqualTo(Story.STORY_USERNAME, ParseUser.getCurrentUser().getUsername()); // Need to check the query it could be wrong.
query.whereEqualTo("objectId", story.getId());
query.findInBackground(new FindCallback<Story>() {
@Override
public void done(List<Story> objects, ParseException e) {
if (e == null) {
for (ParseObject storyToBeDeleted : objects) {
storyToBeDeleted.deleteInBackground();
//
}
Toast.makeText(mContext, "Story Deleted", Toast.LENGTH_SHORT).show();
}
}
});
}
});
}
}
@Override
public int getItemCount() {
return listOfStories.size();
}
@Override
public long getItemId(int position) {
return super.getItemId(position);
}
public class RV_ViewHolder extends RecyclerView.ViewHolder {
protected ImageView mStoryImage;
protected ImageButton mDeleteStory;
public RV_ViewHolder(View itemView) {
super(itemView);
mStoryImage = (ImageView) itemView.findViewById(R.id.single_story_image);
mDeleteStory = (ImageButton) itemView.findViewById(R.id.delete);
}
}
}
| [
"Sukriti@Sukritis-MacBook-Pro.local"
] | Sukriti@Sukritis-MacBook-Pro.local |
4a1858d92766d84eb498e74a11d7087eac13639f | 67ea5b5da2d8791f9c77b93fcb8a6f5e5c37eeba | /libraryservice/src/main/java/com/JPoP2/service/impl/LibraryServiceImplFeignClient.java | 39c3e9b9735366af6e62aab1e07db3750b3fe363 | [] | no_license | Bishal1503/JPOP_2 | d2c6224e30c8c60b06bf5e55ab7b14ce11d7f9c6 | d8c04f3d757f8d0c481412ad8b2ccb065b45673e | refs/heads/master | 2020-09-06T13:41:03.477119 | 2019-11-26T09:21:18 | 2019-11-26T09:21:18 | 220,440,475 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,583 | java | package com.JPoP2.service.impl;
import com.JPoP2.client.BookClient;
import com.JPoP2.client.UserClient;
import com.JPoP2.config.SpringSecurityConfig;
import com.JPoP2.entity.Library;
import com.JPoP2.model.Book;
import com.JPoP2.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.JPoP2.repository.LibraryRepository;
import com.JPoP2.service.LibraryService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("v2")
public class LibraryServiceImplFeignClient implements LibraryService {
@Autowired
private LibraryRepository libraryRepository;
@Autowired
private SpringSecurityConfig securityConfig;
@Autowired
UserClient userClient;
@Autowired
BookClient bookClient;
@Override
public Map<String, String> validateLogin(String emailId, String password) {
Map<String, String> authToken = new HashMap<>();
authToken.put("authToken", securityConfig.validateLogin(emailId, password));
return authToken;
}
@Override
public List<Book> getAllBooks() {
return bookClient.getAllBooks().getBody();
}
@Override
public Book getBookById(Long bookId) {
return bookClient.getBookById(bookId).getBody();
}
@Override
public Book addBook(Book book) {
return bookClient.addBook(book).getBody();
}
@Override
public Long deleteBookById(Long bookId) {
return bookClient.deleteBookById(bookId).getBody();
}
@Override
public List<User> getAllUsers() {
return userClient.getAllUsers().getBody();
}
@Override
public User getUserById(Long userId) {
return userClient.getUserById(userId).getBody();
}
@Override
public User addUser(User user) {
securityConfig.addUserForAuthentication(user.getEmailId(), user.getRole());
return userClient.addUser(user).getBody();
}
@Override
public Long deleteUserById(Long userId) {
securityConfig.deleteUserForAuthentication(this.getUserById(userId).getEmailId());
return userClient.deleteUserById(userId).getBody();
}
@Override
public User updateUserById(Long userId, User user) {
return userClient.updateUserById(userId, user).getBody();
}
@Override
public Library issueBookToUser(Long userId, Long bookId) {
Library library = new Library();
library.setUserId(userId);
library.setBookId(bookId);
return libraryRepository.save(library);
}
}
| [
"Bishal_Chhotray@epam.com"
] | Bishal_Chhotray@epam.com |
8f471b9013398e255bf2c859d74af82be7cae8a3 | 896ca3cb7c0463310cae1ddd5746a91bd160305d | /pet-clinic-data/src/main/java/guru/springframework/sfgpetclinic/services/map/VisitMapService.java | 89f35cd9e71af158328fa7f74bfa2ddef4357bf1 | [] | no_license | nisler/sfg-pet-clinic | 8aca09fdbd28538dee3ac8bd05d78630b5b660c9 | 4b201604c4a853e8fa79151e914633f6f8253233 | refs/heads/master | 2022-11-27T10:02:54.702733 | 2020-08-05T20:28:33 | 2020-08-05T20:28:33 | 265,637,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,156 | java | package guru.springframework.sfgpetclinic.services.map;
import guru.springframework.sfgpetclinic.model.Visit;
import guru.springframework.sfgpetclinic.services.VisitService;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
import java.util.Set;
@Service
@Profile({"default", "map"})
public class VisitMapService extends AbstractMapService<Visit, Long> implements VisitService {
@Override
public Set<Visit> findAll() {
return super.findAll();
}
@Override
public Visit findById(Long id) {
return super.findById(id);
}
@Override
public Visit save(Visit visit) {
if (visit.getPet() == null ||
visit.getPet().getOwner() == null ||
visit.getPet().getId() == null ||
visit.getPet().getOwner().getId() == null) {
throw new RuntimeException("Invalid Visit");
}
return super.save(visit);
}
@Override
public void delete(Visit visit) {
super.delete(visit);
}
@Override
public void deleteById(Long id) {
super.deleteById(id);
}
}
| [
"bnisler@gmail.com"
] | bnisler@gmail.com |
e63271bd4d5cbfb0dfea7a8b19c8d2f6c9010e90 | a4210c188c2b13eefbd0b9ef35925922775d1655 | /clockviewlibrary/src/test/java/com/don/clockviewlibrary/ExampleUnitTest.java | a7591393c7e25f64d1a5947f3f2098a527770be0 | [
"Apache-2.0"
] | permissive | WangxlForkLib/ClockView | 1c23fe24cb07f4356aa03af221aa9e184921229c | 1f8a5d13f46abd84ae8f5c66fde7655cdf48f9a4 | refs/heads/master | 2021-07-23T14:41:03.973995 | 2017-11-01T08:42:20 | 2017-11-01T08:42:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package com.don.clockviewlibrary;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"tang562250920@gmail.com"
] | tang562250920@gmail.com |
86d6b4f1b5562cdfeed18dddd0e957d13ea128c2 | f487532281c1c6a36a5c62a29744d8323584891b | /sdk/java/src/main/java/com/pulumi/azure/streamanalytics/inputs/StreamInputBlobSerializationArgs.java | f20ac790a934ae731423e7ae9f9b9194587cbb65 | [
"BSD-3-Clause",
"MPL-2.0",
"Apache-2.0"
] | permissive | pulumi/pulumi-azure | a8f8f21c46c802aecf1397c737662ddcc438a2db | c16962e5c4f5810efec2806b8bb49d0da960d1ea | refs/heads/master | 2023-08-25T00:17:05.290397 | 2023-08-24T06:11:55 | 2023-08-24T06:11:55 | 103,183,737 | 129 | 57 | Apache-2.0 | 2023-09-13T05:44:10 | 2017-09-11T20:19:15 | Java | UTF-8 | Java | false | false | 6,043 | java | // *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.azure.streamanalytics.inputs;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Import;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;
public final class StreamInputBlobSerializationArgs extends com.pulumi.resources.ResourceArgs {
public static final StreamInputBlobSerializationArgs Empty = new StreamInputBlobSerializationArgs();
/**
* The encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. It currently can only be set to `UTF8`.
*
* > **NOTE:** This is required when `type` is set to `Csv` or `Json`.
*
*/
@Import(name="encoding")
private @Nullable Output<String> encoding;
/**
* @return The encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. It currently can only be set to `UTF8`.
*
* > **NOTE:** This is required when `type` is set to `Csv` or `Json`.
*
*/
public Optional<Output<String>> encoding() {
return Optional.ofNullable(this.encoding);
}
/**
* The delimiter that will be used to separate comma-separated value (CSV) records. Possible values are ` ` (space), `,` (comma), ` ` (tab), `|` (pipe) and `;`.
*
* > **NOTE:** This is required when `type` is set to `Csv`.
*
*/
@Import(name="fieldDelimiter")
private @Nullable Output<String> fieldDelimiter;
/**
* @return The delimiter that will be used to separate comma-separated value (CSV) records. Possible values are ` ` (space), `,` (comma), ` ` (tab), `|` (pipe) and `;`.
*
* > **NOTE:** This is required when `type` is set to `Csv`.
*
*/
public Optional<Output<String>> fieldDelimiter() {
return Optional.ofNullable(this.fieldDelimiter);
}
/**
* The serialization format used for incoming data streams. Possible values are `Avro`, `Csv` and `Json`.
*
*/
@Import(name="type", required=true)
private Output<String> type;
/**
* @return The serialization format used for incoming data streams. Possible values are `Avro`, `Csv` and `Json`.
*
*/
public Output<String> type() {
return this.type;
}
private StreamInputBlobSerializationArgs() {}
private StreamInputBlobSerializationArgs(StreamInputBlobSerializationArgs $) {
this.encoding = $.encoding;
this.fieldDelimiter = $.fieldDelimiter;
this.type = $.type;
}
public static Builder builder() {
return new Builder();
}
public static Builder builder(StreamInputBlobSerializationArgs defaults) {
return new Builder(defaults);
}
public static final class Builder {
private StreamInputBlobSerializationArgs $;
public Builder() {
$ = new StreamInputBlobSerializationArgs();
}
public Builder(StreamInputBlobSerializationArgs defaults) {
$ = new StreamInputBlobSerializationArgs(Objects.requireNonNull(defaults));
}
/**
* @param encoding The encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. It currently can only be set to `UTF8`.
*
* > **NOTE:** This is required when `type` is set to `Csv` or `Json`.
*
* @return builder
*
*/
public Builder encoding(@Nullable Output<String> encoding) {
$.encoding = encoding;
return this;
}
/**
* @param encoding The encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. It currently can only be set to `UTF8`.
*
* > **NOTE:** This is required when `type` is set to `Csv` or `Json`.
*
* @return builder
*
*/
public Builder encoding(String encoding) {
return encoding(Output.of(encoding));
}
/**
* @param fieldDelimiter The delimiter that will be used to separate comma-separated value (CSV) records. Possible values are ` ` (space), `,` (comma), ` ` (tab), `|` (pipe) and `;`.
*
* > **NOTE:** This is required when `type` is set to `Csv`.
*
* @return builder
*
*/
public Builder fieldDelimiter(@Nullable Output<String> fieldDelimiter) {
$.fieldDelimiter = fieldDelimiter;
return this;
}
/**
* @param fieldDelimiter The delimiter that will be used to separate comma-separated value (CSV) records. Possible values are ` ` (space), `,` (comma), ` ` (tab), `|` (pipe) and `;`.
*
* > **NOTE:** This is required when `type` is set to `Csv`.
*
* @return builder
*
*/
public Builder fieldDelimiter(String fieldDelimiter) {
return fieldDelimiter(Output.of(fieldDelimiter));
}
/**
* @param type The serialization format used for incoming data streams. Possible values are `Avro`, `Csv` and `Json`.
*
* @return builder
*
*/
public Builder type(Output<String> type) {
$.type = type;
return this;
}
/**
* @param type The serialization format used for incoming data streams. Possible values are `Avro`, `Csv` and `Json`.
*
* @return builder
*
*/
public Builder type(String type) {
return type(Output.of(type));
}
public StreamInputBlobSerializationArgs build() {
$.type = Objects.requireNonNull($.type, "expected parameter 'type' to be non-null");
return $;
}
}
}
| [
"noreply@github.com"
] | pulumi.noreply@github.com |
542f961146a199b6c6e067330c59060dde437c08 | eea7e75bf2c9762b82a50cbc0d28f629d6e0ab78 | /fire-mode/src/main/java/io/github/therealmone/fireres/firemode/model/ThermocoupleMeanTemperature.java | f87ccd3a688d8657d41ba99250a8aef79caaae1f | [] | no_license | vxed/fire-res | f2f9bb1fd8244aa284912463354ec4b2be66809f | 372fb0b8b4809cc8223f7b7a8e4c834a922bdb94 | refs/heads/main | 2023-05-19T00:24:32.481277 | 2021-04-18T19:37:25 | 2021-04-18T19:37:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package io.github.therealmone.fireres.firemode.model;
import io.github.therealmone.fireres.core.model.IntegerPoint;
import io.github.therealmone.fireres.core.model.IntegerPointSequence;
import java.util.List;
public class ThermocoupleMeanTemperature extends IntegerPointSequence {
public ThermocoupleMeanTemperature(List<IntegerPoint> value) {
super(value);
}
}
| [
"36332304+therealmone@users.noreply.github.com"
] | 36332304+therealmone@users.noreply.github.com |
481f3a1deae413bc1004d0f4e85d0cb1787750c6 | a6e5d93e352da189d27480ec1b156b44226c6b43 | /omPortalCore/omWeb-Portal/src/main/java/org/ppl/mall/config/DubboConfig.java | 97ee89194ab7e42aaf6025f39389bfa3a84486ac | [] | no_license | luruijiao/OpenMallX | 9d8be257d1b3ff825c9c83ae450e87290dc44f26 | 454bd7d2591a62327111747a5bf3d092d402098e | refs/heads/master | 2020-12-06T04:48:20.330180 | 2018-11-04T10:49:52 | 2018-11-04T10:49:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,230 | java | package org.ppl.mall.config;
import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ConsumerConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import com.alibaba.dubbo.config.spring.context.annotation.DubboComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* dubbo配置
* @author PPL
*/
@Configuration
@DubboComponentScan(basePackages={
"org.ppl.mall.controller",
"org.ppl.mall.tools"
})
public class DubboConfig {
@Bean
public ApplicationConfig applicationConfig() {
ApplicationConfig applicationConfig = new ApplicationConfig();
applicationConfig.setName("omWeb-Portal");
return applicationConfig;
}
@Bean
public ConsumerConfig consumerConfig() {
ConsumerConfig consumerConfig = new ConsumerConfig();
consumerConfig.setTimeout(3000);
return consumerConfig;
}
@Bean
public RegistryConfig registryConfig() {
RegistryConfig registryConfig = new RegistryConfig();
registryConfig.setAddress("127.0.0.1:2181");
registryConfig.setProtocol("zookeeper");
return registryConfig;
}
}
| [
"a120209520@icloud.com"
] | a120209520@icloud.com |
9f3dd477181e3b1ec16d7440c6b44747f66470ef | e50bcaba1c314d3c1b1a78e0e520a1b3606dc464 | /src/main/java/kn/inferno/domain/repository/AbsenceRepository.java | 124b90772f02b14d2d4961ab7c6cc43daa136ac3 | [] | no_license | vmhub/AbsenceCalendar | c0cc6b3c722d54044ff71f18bdf24850035bb5d5 | d3ec0c7b83257573d6139063b6664012ec721621 | refs/heads/master | 2021-01-10T01:28:38.803883 | 2016-01-12T09:07:31 | 2016-01-12T09:07:31 | 49,421,638 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 582 | java | package kn.inferno.domain.repository;
import kn.inferno.domain.model.Absence;
import org.springframework.data.repository.CrudRepository;
import java.sql.Date;
import java.util.List;
public interface AbsenceRepository extends CrudRepository<Absence, Integer> {
List<Absence> findByDateFromBetween(Date dateFrom, Date dateTo);
List<Absence> findByEmployeeIdAndDateFromBetween(int employeeId, Date dateFrom, Date dateTo);
List<Absence> findByEmployeeIdAndDateToBetween(int employeeId, Date dateFrom, Date dateTo);
List<Absence> findByEmployeeId (int employeeId);
}
| [
"dmitri89@ut.ee"
] | dmitri89@ut.ee |
c038540f95465c47a9ffb0cf3081dd2c03c5435b | c1d82df68087fadb02772b008091337cd63ced8e | /app/build/generated/source/buildConfig/test/debug/com/technolab/galaxy/arcanoid/test/BuildConfig.java | f63666c38eceacc16db90dde751288f754f9e974 | [] | no_license | Elikur/Arcanoid | f023915457579302731706142aa36f50f9274cd3 | 1d296f137713627224ad26f069d902f25a1c7a57 | refs/heads/master | 2021-01-25T00:37:28.930428 | 2017-06-18T11:03:07 | 2017-06-18T11:03:07 | 94,681,107 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 475 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.technolab.galaxy.arcanoid.test;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.technolab.galaxy.arcanoid.test";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"nosal_vadim@mail.ru"
] | nosal_vadim@mail.ru |
f60fdb55668c056ebdd32d30578dc2ed6075b153 | e64225a1e6612f996ae3ef707ac2f11317f39afc | /src/main/java/org/albaross/agents4j/learning/QNeg.java | 4550d6e2823cf3507a0e676e63b6eb9a284ce11a | [
"MIT"
] | permissive | Albaross/agents4j-learning | 52e65d9246559fbedbca5f222b8d00210ea9d2fb | 023572327c4d0395a26a9d3f2be4b4358f5e5d11 | refs/heads/master | 2021-01-01T19:59:16.204227 | 2017-10-27T09:35:51 | 2017-10-27T09:35:51 | 98,739,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,048 | java | package org.albaross.agents4j.learning;
import org.albaross.agents4j.learning.utils.ActionDecoder;
import org.albaross.agents4j.learning.utils.ActionEncoder;
import org.albaross.agents4j.learning.utils.StateEncoder;
import org.deeplearning4j.nn.multilayer.MultiLayerNetwork;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.api.ops.impl.accum.Min;
import org.nd4j.linalg.api.ops.impl.indexaccum.IMin;
import org.nd4j.linalg.factory.Nd4j;
public class QNeg<S, A> extends QNet<S, A> {
public QNeg(MultiLayerNetwork net, StateEncoder<S> stateEncoder, ActionEncoder<A> actionEncoder, ActionDecoder<A> actionDecoder) {
super(net, stateEncoder, actionEncoder, actionDecoder);
}
@Override
protected INDArray maxVal(INDArray in) {
return Nd4j.getExecutioner().exec(new Min(in), 1);
}
@Override
protected INDArray maxIdx(INDArray in) {
return Nd4j.getExecutioner().exec(new IMin(in), 1);
}
@Override
protected double calcWeight(double reward, double gamma, double min) {
return -0.01 * reward + gamma * min;
}
}
| [
"Manuel.Barbi@adesso.de"
] | Manuel.Barbi@adesso.de |
cd609aaf1646d61d5cf7d05125f7fc9f7d635dbb | 06ec7b791bc8c15074898542e5a2284c73c0d7b2 | /backend/project/project/src/main/java/lt/vtmc/project/security/SecurityEntryPoint.java | 0a379eb5c1425dc8e712a225ef6c8bb4d0182f0a | [] | no_license | Vilniaus-Technologiju-Mokymo-Centras/IT-Projektai-2021-Good_Enough | 9fcefadcb89f1f13ca81e306558de7e8e1db52b2 | d72348ea2a5126344c50d85d1d3521d185a525c8 | refs/heads/main | 2023-05-07T12:16:41.500963 | 2021-05-28T13:22:54 | 2021-05-28T13:22:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | package lt.vtmc.project.security;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;
@Component("restAuthenticationEntryPoint")
public class SecurityEntryPoint implements AuthenticationEntryPoint {
public SecurityEntryPoint() {
}
@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException, ServletException {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
}
}
| [
"gretamundryte@gmail.com"
] | gretamundryte@gmail.com |
051a2ac73b09724170c879ac3020880a74de8276 | e450cc54ea12fdb13916486fa59dd7cae30fb06f | /src/main/java/com/testecase/model/Cliente.java | c388fff1218dbf1cb7c298a99eba730c5601fab3 | [] | no_license | matheustf/testecase | 5aba17f93c49887194d1216ec68cc77f75e85d9a | bc036283ef657acec65c7c9106b8af913cbb91d2 | refs/heads/master | 2023-06-15T07:08:12.792322 | 2021-07-02T18:01:12 | 2021-07-02T18:01:12 | 382,425,091 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,029 | java | package com.testecase.model;
import java.time.LocalDate;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document
public class Cliente {
@Id
private Integer id;
private String nome;
private LocalDate dataNascimento;
private Long telefone;
public Cliente(Integer id, String nome, LocalDate dataNascimento, Long telefone) {
super();
this.id = id;
this.nome = nome;
this.dataNascimento = dataNascimento;
this.telefone = telefone;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public Long getTelefone() {
return telefone;
}
public void setTelefone(Long telefone) {
this.telefone = telefone;
}
public LocalDate getDataNascimento() {
return dataNascimento;
}
public void setDataNascimento(LocalDate dataNascimento) {
this.dataNascimento = dataNascimento;
}
}
| [
"teles.matheus@hotmail.com"
] | teles.matheus@hotmail.com |
f7c2667ca4fefcb20da3c3a1f7a804e4bd91cda3 | 289ea2577a09e39bcd8e51c9a8d8686bd0d6d992 | /src/Interface/BaseMobile.java | 8701965b5cae149a90f8a3acb449d42264c70c37 | [] | no_license | VeeraMohanSelenium/Selenium_Online_May_26_2018 | af368a40a7799d16787ba563879bed6321e551e8 | ccfab07a984e307b05964996ad4ae332afbc5dff | refs/heads/master | 2020-03-24T04:00:47.443239 | 2018-08-30T13:16:23 | 2018-08-30T13:16:23 | 137,999,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package Interface;
public abstract class BaseMobile implements Mobile{
abstract public void test();
@Override
public void display() {
// TODO Auto-generated method stub
System.out.println("Screen");
}
@Override
public void flash() {
// TODO Auto-generated method stub
System.out.println();
}
}
| [
"USER@USER-PC"
] | USER@USER-PC |
43584876ad65276a6e3416d41afb60e2e045a0f7 | 08c17ec05b4ed865c2b9be53f19617be7562375d | /aws-java-sdk-resourcegroupstaggingapi/src/main/java/com/amazonaws/services/resourcegroupstaggingapi/model/transform/DescribeReportCreationRequestMarshaller.java | 06db98f0011685c46562de38b39f95b6b5ad4383 | [
"Apache-2.0"
] | permissive | shishir2510GitHub1/aws-sdk-java | c43161ac279af9d159edfe96dadb006ff74eefff | 9b656cfd626a6a2bfa5c7662f2c8ff85b7637f60 | refs/heads/master | 2020-11-26T18:13:34.317060 | 2019-12-19T22:41:44 | 2019-12-19T22:41:44 | 229,156,587 | 0 | 1 | Apache-2.0 | 2020-02-12T01:52:47 | 2019-12-19T23:45:32 | null | UTF-8 | Java | false | false | 1,793 | java | /*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.resourcegroupstaggingapi.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.resourcegroupstaggingapi.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* DescribeReportCreationRequestMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class DescribeReportCreationRequestMarshaller {
private static final DescribeReportCreationRequestMarshaller instance = new DescribeReportCreationRequestMarshaller();
public static DescribeReportCreationRequestMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(DescribeReportCreationRequest describeReportCreationRequest, ProtocolMarshaller protocolMarshaller) {
if (describeReportCreationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
d58f34c97cb2e25f98e3e3e3d3471ee3f99c5b5d | dfaab7f22988c6b37515b1d2bf94e7f56bc1ad29 | /JavaBaseDataType/src/com/Object/extend/Parent.java | 798b50fa401d5f76bd88817fe9977824a17e45bb | [] | no_license | feng-tianyou/JavaLeanDemo | 4566a8dfbc663f435576583f656d086412997e4d | fbf4fbe7e2671989d45d47722f1de0585f6d55d8 | refs/heads/master | 2021-06-18T07:08:50.246569 | 2017-06-05T13:44:44 | 2017-06-05T13:44:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 160 | java | package com.Object.extend;
public class Parent {
public String name = "父类属性名称";
public void eat(){
System.out.println("父类吃东西");
}
}
| [
"feng.daisuke@gmail.com"
] | feng.daisuke@gmail.com |
80edf86c0dc981f2d74fa5324fe9a42936298ade | 4726d657dec20cc611112ddfb1fbf174474f859d | /src/main/java/com/mmall/dto/AclModuleLevelDto.java | d1c960cb8d7c6a060061c4b43592665d221bfd4a | [] | no_license | sijilaowang/permission | 6d188b331d60cbd2f7b567c58b016589932930a5 | f9ad89858c10218617bcd899c3ce6e7ba3740e34 | refs/heads/master | 2022-12-23T08:45:21.492591 | 2019-07-03T03:23:17 | 2019-07-03T03:23:17 | 160,144,013 | 0 | 0 | null | 2022-12-16T08:44:30 | 2018-12-03T06:37:13 | Java | UTF-8 | Java | false | false | 827 | java | package com.mmall.dto;
import com.google.common.collect.Lists;
import com.mmall.model.SysAclModule;
import lombok.Data;
import lombok.ToString;
import org.springframework.beans.BeanUtils;
import java.util.List;
@Data
@ToString
public class AclModuleLevelDto extends SysAclModule {
private List<AclModuleLevelDto> sysAclModuleList = Lists.newArrayList();
private List<AclDto> aclDtoList = Lists.newArrayList();
/**
* 将SysAclModule类型数据转成成AclModuleLevelDto 类型
* @param sysAclModule
* @return
*/
public static AclModuleLevelDto adapt(SysAclModule sysAclModule) {
if(null == sysAclModule) {
return null;
}
AclModuleLevelDto dto = new AclModuleLevelDto();
BeanUtils.copyProperties(sysAclModule,dto);
return dto;
}
}
| [
"286949442@qq.com"
] | 286949442@qq.com |
31d3bdba2572523668bf3a454e886e8501cc8df6 | 869b72d3767ae095b8ba0c479f715d605479bc1a | /src/com/example/weather/Aboutus.java | 8844207a7600a6d1d47dfba13b60a2873444041e | [] | no_license | darshanhs90/Android-WeatherApp | 2bdd0f671eab32eefabdac0346c268e58af3c692 | 02b6cbae8539d48f9b636bd35fd08840e3b90cca | refs/heads/master | 2020-05-19T07:46:57.474292 | 2015-04-05T03:05:34 | 2015-04-05T03:05:34 | 33,428,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 713 | java | package com.example.weather;
import com.android.anup.weather.maps.R;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class Aboutus extends Fragment {
Activity mActivity;
public Aboutus(Activity activity) {
// TODO Auto-generated constructor stub
this.mActivity=activity;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_aboutus, container, false);
return rootView;
}
}
| [
"hsdars@gmail.com"
] | hsdars@gmail.com |
28da4bfb04ea16b76f050722b5c949679f9f167f | bfca993232c008c6b0a2f919e43c0527fe0222d8 | /nywc/src/main/java/com/arloor/nywc/domain/MiaoshaActivity.java | b08ca8d5c60a0d84541d9c81f5ecc78ed63b1a2f | [] | no_license | arloor/nywc | 6aa16caf24378c1b928a3fc10eed6d7fd034074b | 1a591983bb9628ab0bfbc2297bfe5f5c9cb843ce | refs/heads/master | 2021-06-09T20:47:58.301093 | 2020-02-26T15:41:31 | 2020-02-26T15:41:31 | 127,611,663 | 3 | 1 | null | 2021-06-04T00:57:07 | 2018-04-01T08:33:38 | Java | UTF-8 | Java | false | false | 413 | java | package com.arloor.nywc.domain;
public class MiaoshaActivity extends MiaoshaActivityKey {
private Integer num;
private String status;
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
} | [
"admin@arloor.com"
] | admin@arloor.com |
408aa7ba76ca50aea7faf891527436a34c0b502f | 3f85f219dfe794485889cbba187498863c59ae83 | /src/test/java/com/softwaretestingtraning/app/HelperLentaPagination.java | e31dfc2c184fd34e1b2a0ba3c9d6fcea4926ac3a | [] | no_license | Vla8islav/bankiru-selenide-lenta-test | be4a3c7ed11a511d63c4d3e16bc5c409c2a00888 | 1e810ff5fcce7a4dae484b6b8eebc194f80a7740 | refs/heads/master | 2021-01-12T08:17:34.130183 | 2016-12-29T12:52:19 | 2016-12-29T12:52:19 | 76,531,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,434 | java | package com.softwaretestingtraning.app;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.WebDriverRunner;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
class HelperLentaPagination {
HelperLentaPagination() {
}
int extractCurrentNewsPageFromTheUrl() {
String currentUrl = WebDriverRunner.url();
int currentPageNumber = 0;
try {
URL aURL = new URL(currentUrl);
String pageNumberStr = aURL.getPath().replaceAll("[^\\d]", "");
currentPageNumber += Integer.parseInt(pageNumberStr);
} catch (MalformedURLException e) {
System.err.print("Malformed current url " + currentUrl);
}
return currentPageNumber;
}
void openLastPage() {
scrollPaginationIntoView();
if (Selenide.$(".ui-pagination__next").exists()) {
int numberOfRightArrows = Selenide.$$(".ui-pagination__next").size();
String lastPageSelectorCSS = "ul.ui-pagination__list li:nth-last-child(" + Integer.toString(numberOfRightArrows + 1) + ") a";
Selenide.$(lastPageSelectorCSS).click();
scrollPaginationIntoView();
}
}
void openFirstPage() {
scrollPaginationIntoView();
if (Selenide.$(".ui-pagination__prev").exists()) {
int numberOfLeftArrows = Selenide.$$(".ui-pagination__prev").size();
int numberOfPaginationElements = Selenide.$$(".ui-pagination__item").size();
String lastPageSelectorCSS = "ul.ui-pagination__list li:nth-last-child(" + Integer.toString(numberOfPaginationElements - numberOfLeftArrows) + ") a";
Selenide.$(lastPageSelectorCSS).click();
scrollPaginationIntoView();
}
}
String getCurrentPagePaginationNumber() {
return Selenide.$(".ui-pagination__list .ui-pagination__item--active a").getText();
}
void openNextPage() {
scrollPaginationIntoView();
if (Selenide.$(".ui-pagination__next").isDisplayed()) {
Selenide.$(".ui-pagination__list .ui-pagination__next").click();
scrollPaginationIntoView();
}
}
void scrollPaginationIntoView() {
List<String> paginationSelectorsList = new ArrayList<>();
paginationSelectorsList.add("#news-pagination");
paginationSelectorsList.add(".layout-column-center div.border-bottom-dotted");
paginationSelectorsList.add(".layout-columns-wrapper .widget .text-list:last-of-type");
paginationSelectorsList.add("#comments__pagination");
for (String currentPaginationSelector : paginationSelectorsList) {
if (Selenide.$(currentPaginationSelector).exists()) {
scrollPageToTheElementBySelectorCSS(currentPaginationSelector);
}
}
Selenide.$(".ui-pagination__list").shouldBe(Condition.visible);
}
private void scrollPageToTheElementBySelectorCSS(String currentPaginationSelectorCSS) {
Object height = Selenide.executeJavaScript("return document.querySelectorAll('" + currentPaginationSelectorCSS + "')[0].offsetHeight + " +
"document.querySelectorAll('" + currentPaginationSelectorCSS + "')[0].offsetTop;");
Selenide.executeJavaScript("window.scrollTo(0," + height.toString() + " + 200);");
}
} | [
"pilipenko@banki.ru"
] | pilipenko@banki.ru |
52ba7f46353805588c3b99ffa0e4545b7c0c150d | 7e8a0c60888a34e8e504c4be96a63ac6ce4d60a5 | /src/main/java/com/coding/sales/vip/VipLevelHandler.java | c1b87e3f7f181a1c5093183efaaa523a5b0d5f07 | [] | no_license | smalrt/kata-precious_metal_sales_system | 25cdc6a5c5fddcb1f9796fb9c294aac49411b69c | cbdfebd5a7bd559808d7c371634a3868307a6c66 | refs/heads/master | 2021-07-07T07:16:36.056902 | 2019-07-02T15:24:06 | 2019-07-02T15:24:06 | 194,834,415 | 0 | 0 | null | 2020-10-13T14:17:18 | 2019-07-02T09:39:06 | Java | UTF-8 | Java | false | false | 952 | java | package com.coding.sales.vip;
import java.math.BigDecimal;
public class VipLevelHandler {
/**
* 积分转换成等级
* @param score
* @return
*/
public static VipLevelEnum resolver(int score){
if (score < 10000) {
return VipLevelEnum.NORMAL;
} else if (score < 50000) {
return VipLevelEnum.GOLD;
} else if (score < 100000) {
return VipLevelEnum.PLATINUM;
} else{
return VipLevelEnum.DIAMOND;
}
}
/**
* 计算应加积分
* @param viper
* @param afterDiscountAmt
* @return
*/
public static int handlerPoint(Vip viper, BigDecimal afterDiscountAmt){
int addScore = 0;
BigDecimal multiple = viper.getLevel().getMultiple();
addScore += Integer.parseInt(afterDiscountAmt.multiply(multiple).setScale(0, BigDecimal.ROUND_HALF_UP).toString());
return addScore;
}
}
| [
"huxiaohua@csii.com.cn"
] | huxiaohua@csii.com.cn |
90d61551b650d94e41012bc750030ad354a7be93 | a355563cab3aa4d92507f285e5358bc2e83f620a | /src/main/java/com/uuauth/aps/domain/service/impl/RemoteAuthServiceImpl.java | afac58770cfa229c95088e69fca9c831a8a54387 | [] | no_license | zhaohaolin/uuauth-ams | 18147d854e89d7c664cbbf35a4366f0ae65e6a3b | 9032083fb31a424523d9cf1386b3771c87aff6de | refs/heads/master | 2016-09-06T18:27:15.817156 | 2013-10-15T01:52:19 | 2013-10-15T01:52:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,596 | java | /*
* CopyRight (c) 2005-2012 GLOBE Co, Ltd. All rights reserved.
* Filename: RemoteAuthServiceImpl.java
* Creator: joe.zhao
* Create-Date: 下午03:12:55
*/
package com.uuauth.aps.domain.service.impl;
import java.util.List;
import com.uuauth.ams.domain.entity.EmployeeInfo;
import com.uuauth.ams.domain.entity.EmployeeRole;
import com.uuauth.ams.domain.entity.ProjectInfo;
import com.uuauth.ams.domain.entity.ProjectRole;
import com.uuauth.ams.domain.entity.TemplateContent;
import com.uuauth.ams.domain.repository.BasePostRepository;
import com.uuauth.ams.domain.repository.EmployeeInfoRepository;
import com.uuauth.ams.domain.repository.EmployeeRoleRepository;
import com.uuauth.ams.domain.repository.ProjectInfoRepository;
import com.uuauth.ams.domain.repository.ProjectRoleRepository;
import com.uuauth.ams.domain.repository.TemplateContentRepository;
import com.uuauth.aps.domain.service.RemoteAuthService;
/**
* TODO
*
* @author joe.zhao
* @version $Id: RemoteAuthServiceImpl, v 0.1 2012-5-9 下午03:12:55 Exp $
*/
public class RemoteAuthServiceImpl implements RemoteAuthService {
private ProjectInfoRepository projectInfoRepository;
private ProjectRoleRepository projectRoleRepository;
private EmployeeInfoRepository employeeInfoRepository;
private EmployeeRoleRepository employeeRoleRepository;
private TemplateContentRepository templateContentRepository;
private BasePostRepository basePostRepository;
private String domain = ".globe.com";
@Override
public ProjectInfo getProjectInfo(String proToken) {
ProjectInfo info = projectInfoRepository.getOne(proToken);
return info;
}
@Override
public EmployeeInfo getUserInfo(String uname) {
EmployeeInfo info = employeeInfoRepository.getUserInfo(uname);
return info;
}
@Override
public String getUserRole(ProjectInfo pro, int uid) {
// 查询指定token的系统的详细信息
ProjectInfo project = projectInfoRepository.getOne(pro.getToken());
if (null == project) {
return "";
}
// 设置工程信息
pro.setDescription(project.getDescription());
pro.setHomepage(project.getHomepage());
pro.setLoginpassword(project.getLoginpassword());
pro.setLoginurl(project.getLoginurl());
pro.setName(project.getName());
// 设置角色信息
String roleList = "|";
int templateId = 0;
// 查询当前uid的用户详细信息
EmployeeInfo employee = employeeInfoRepository.getOne(uid);
if (null == employee)
return "";
templateId = basePostRepository.getOne(employee.getPostid())
.getRoleTmpId();
if (0 != templateId) {
List<TemplateContent> template = templateContentRepository
.listByTemplateIdAndToken(templateId, pro.getToken());
if (null != template && !template.isEmpty()) {
for (TemplateContent content : template) {
roleList += content.getRoleName() + "|";
}
}
}
List<EmployeeRole> employeeRoleList = employeeRoleRepository
.listByEmployeeIdAndToken(uid, pro.getToken());
if (null != employeeRoleList && !employeeRoleList.isEmpty()) {
for (EmployeeRole role : employeeRoleList) {
roleList += role.getRoleName() + "|";
}
}
return roleList;
}
@Override
public List<ProjectRole> getProjRoleList(String token) {
return projectRoleRepository.list(token);
}
@Override
public EmployeeInfo getUserInfoByNick(String nick) {
return employeeInfoRepository.getUserInfoByNick(nick);
}
@Override
public String getDomain() {
return this.domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public void setProjectRoleRepository(
ProjectRoleRepository projectRoleRepository) {
this.projectRoleRepository = projectRoleRepository;
}
public void setProjectInfoRepository(
ProjectInfoRepository projectInfoRepository) {
this.projectInfoRepository = projectInfoRepository;
}
public void setEmployeeInfoRepository(
EmployeeInfoRepository employeeInfoRepository) {
this.employeeInfoRepository = employeeInfoRepository;
}
public void setEmployeeRoleRepository(
EmployeeRoleRepository employeeRoleRepository) {
this.employeeRoleRepository = employeeRoleRepository;
}
public void setTemplateContentRepository(
TemplateContentRepository templateContentRepository) {
this.templateContentRepository = templateContentRepository;
}
public void setBasePostRepository(BasePostRepository basePostRepository) {
this.basePostRepository = basePostRepository;
}
}
| [
"zhaohaolin2010@gmail.com"
] | zhaohaolin2010@gmail.com |
4d17e0a1f906b6c1b8a8a6ab0e97e212b004ff55 | 335a273aefbdc72f6a2a3dc3f67c742854b1a8a5 | /back-end/src/main/java/br/com/animati/service/MedicoServiceImpl.java | 6cbd4a9546915518b0c3e1bdf6e6e4f76f63bae6 | [] | no_license | edersonlcaldatto/PlataformaSaudeFinal | 60ee3f46f9cf857527ae8e2d59bb52aaa4ea804d | 9ee60a5390684745b7c412951c47600b1de08e2f | refs/heads/main | 2023-01-16T05:05:53.214887 | 2020-11-30T10:35:07 | 2020-11-30T10:35:07 | 316,844,007 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 991 | java | package br.com.animati.service;
import br.com.animati.DAO.MedicoDAO;
import br.com.animati.entity.Medico;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class MedicoServiceImpl implements MedicoService {
@Autowired
private MedicoDAO medicoDAO;
@Override
public void cadastrar(Medico Medico) {
medicoDAO.save(Medico);
}
@Override
public void editar(Medico Medico) {
medicoDAO.save(Medico);
}
@Override
public void deletar(long idMedico) throws Exception {
medicoDAO.deleteById(idMedico);
}
@Override
public List<Medico> listar() {
return medicoDAO.findAll();
}
@Override
public Optional<Medico> findById(long IdMedico) {
return medicoDAO.findById(IdMedico);
}
@Override
public void limparLista() {
medicoDAO.deleteAll();
}
}
| [
"caldatto17@gmail.com"
] | caldatto17@gmail.com |
1ab136c92799df6e17f1ecec2e98dc9cc2342d91 | 8fb05b1928703a16fcd3f52ff0bbc38cbe891ca7 | /Algo uisng java/Leetcode/Palindrome9.java | 6f720c197d8ef3eae28932f476c16c73cdf2991b | [] | no_license | kishan-0904/Self-Programs | f5c1e12c2008e096b195443aeccc2da7b63621a3 | fd4da2b48535f0d279c2a7a8680c775b2fe300b7 | refs/heads/main | 2023-06-03T07:12:48.220422 | 2021-06-24T07:18:09 | 2021-06-24T07:18:09 | 378,049,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,145 | java | // Time - O(n) Space- O(1)
import java.util.*;
public class Palindrome9 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
sc.close();
boolean result = isPalindrome(num);
if(result == true)
System.out.println("Palindrome");
else
System.out.println("Not Palindrome");
}
public static boolean isPalindrome(int n)
{
if(n<0 || (n%10 == 0 && n!=0))
return false;
int reversedNum = 0;
int pop;
while(n>reversedNum)
{
pop = n%10;
reversedNum = reversedNum * 10 + pop;
n = n/10;
}
return (n == reversedNum || n == reversedNum/10);
}
}
// Alternate Solution
/*
if(n<0 || (n%10 == 0 && n!=0))
return false;
String str = Integer.toString(n);
for(int i =0; i<str.length()-i-1; i++)
{
if(str.charAt(i) == str.charAt(str.length()-i-1))
continue;
else
return false;
}
return true;
*/ | [
"noreply@github.com"
] | kishan-0904.noreply@github.com |
a78ce13f2fee8bacd60f975436416272797ec7e5 | 8e7877557da2a89268326ece92789358180c40c0 | /Utilities/PursuitPath.java | 67e039a3e5cbbd71612a00adc7ebd403b87e72e7 | [] | no_license | FTCjavaCoder/FTCUltimateGoal_RobotTeam | a3311b216f53c30c3c0dc67ff19be84d5e64005b | 715323bbd2c8b6226a71831d4c7b3881d559d380 | refs/heads/master | 2023-04-02T09:28:32.313451 | 2021-03-27T01:04:56 | 2021-03-27T01:04:56 | 298,702,237 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,288 | java | package UltimateGoal_RobotTeam.Utilities;
public class PursuitPath {
/**
* PursuitPath holds an array of points that define the driving path for the robot
* The methods within the class are used to define basic 2D geometries and append them to the
* arraylist of points. The robot hardware class HardwareBilly implements drivePursuit as the
* means for the robot to follow the points.
*
* --- Are these methods really needed since not invoked? ----
* Recommend that the ArrayList fieldPoints is defined in BasicAuto - DONE!!
* Recommend that the method to findPursuitPoint is added to RobotHardware - DONE!!
* Recommend COMMENTING out this file and then DELETING after testing
*/
//
// public ArrayList<PursuitLines> fieldLines = new ArrayList();
// public ArrayList<PursuitPoint> fieldPoints = new ArrayList();
//
// public ArrayList<PursuitLines> tempLocations = new ArrayList();
// private final double TIME_STEP = 0.1;
// private final int TOTAL_POINTS = (int) Math.round(30.0 / TIME_STEP);
public PursuitPath() {
//empty constructor to instantiate
}
// public void appendPoints() {
// fieldLines.addAll(tempLocations);
// tempLocations.clear();
// }
// public void defineLine(double x1, double y1,double x2, double y2){
// PursuitLines L = new PursuitLines(x1, y1, x2, y2);
// fieldPoints.add(new PursuitPoint(x1,y1));
// fieldPoints.add(new PursuitPoint(x2,y2));
//
// fieldLines.add(L);
//
// }
//
// public void defineRectangle(double x1, double y1, double w, double h) {
// //Define rectangle from start x1, y1 to end at the same spot
// //w and l can be negative or positive
//// double ratioWidth = Math.abs(w)/(2*(Math.abs(w)+Math.abs(h)));
//// double ratioHeight = Math.abs(h)/(2*(Math.abs(w)+Math.abs(h)));
// PursuitLines L1;
//
// //define first X segment
// L1 = new PursuitLines(x1, y1, x1 + w, y1);
// fieldLines.add(L1);
//
// //define first Y segment
// L1 = new PursuitLines(x1 + w, y1, x1 + w, y1 + h);
// fieldLines.add(L1);
//
// //define second X segment
// L1 = new PursuitLines(x1 + w, y1 + h, x1, y1 + h);
// fieldLines.add(L1);
//
// //define second Y segment
// L1 = new PursuitLines(x1, y1 + h, x1, y1);
// fieldLines.add(L1);
//
// }
//
// public void defineArc(PursuitPoint center, double radius, double startAngleRad, double includedAngleRad, int points, pathDirection pd) {
// //Follow a circle of radius, offset by startAngleRad radians, for a total angle of includedAngleRad,
// // divided into points
// double maxPoints = points;
// double scale = 1.0;
// if(pd.equals(pathDirection.NEGATIVE)){
// scale = -1.0;
// }
// for(int i =0; i<points;i++) {
// double angle = scale * (i/maxPoints) * includedAngleRad;
// double x = radius * Math.cos(angle - startAngleRad);
// double y = radius * Math.sin(angle - startAngleRad);
// fieldPoints.add(new PursuitPoint(x+center.x, y+center.y));
// }
//
// }
//
// public enum pathDirection {POSITIVE,NEGATIVE};
}
| [
"karlemily@comcast.net"
] | karlemily@comcast.net |
677aff8510d20ac7939b070c03ed56ef73fae86a | be28a7b64a4030f74233a79ebeba310e23fe2c3a | /generated-tests/qmosa/tests/s1019/110_firebird/evosuite-tests/org/firebirdsql/encodings/EncodingFactory_ESTest_scaffolding.java | 957e1ab6a606610b8c77c3d6c5bfec443098bbf1 | [
"MIT"
] | permissive | blindsubmissions/icse19replication | 664e670f9cfcf9273d4b5eb332562a083e179a5f | 42a7c172efa86d7d01f7e74b58612cc255c6eb0f | refs/heads/master | 2020-03-27T06:12:34.631952 | 2018-08-25T11:19:56 | 2018-08-25T11:19:56 | 146,074,648 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,937 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Fri Aug 24 13:39:38 GMT 2018
*/
package org.firebirdsql.encodings;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class EncodingFactory_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.firebirdsql.encodings.EncodingFactory";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("file.encoding", "UTF-8");
java.lang.System.setProperty("java.awt.headless", "true");
java.lang.System.setProperty("java.io.tmpdir", "/tmp");
java.lang.System.setProperty("user.country", "US");
java.lang.System.setProperty("user.dir", "/home/ubuntu/evosuite_readability_gen/projects/110_firebird");
java.lang.System.setProperty("user.home", "/home/ubuntu");
java.lang.System.setProperty("user.language", "en");
java.lang.System.setProperty("user.name", "ubuntu");
java.lang.System.setProperty("user.timezone", "Etc/UTC");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(EncodingFactory_ESTest_scaffolding.class.getClassLoader() ,
"org.firebirdsql.encodings.Encoding_Cp850",
"org.firebirdsql.encodings.Encoding",
"org.firebirdsql.encodings.Encoding_OneByte",
"org.firebirdsql.encodings.Encoding_Cp857",
"org.firebirdsql.encodings.Encoding_ISO8859_13",
"org.firebirdsql.encodings.CharacterTranslator",
"org.firebirdsql.jdbc.FBSQLException",
"org.firebirdsql.encodings.EncodingFactory",
"org.firebirdsql.encodings.Encoding_Cp1253",
"org.firebirdsql.encodings.Encoding_NotOneByte",
"org.firebirdsql.encodings.Encoding_Cp860",
"org.firebirdsql.encodings.Encoding_Cp1252",
"org.firebirdsql.encodings.Encoding_Cp1255",
"org.firebirdsql.encodings.Encoding_Cp1254",
"org.firebirdsql.encodings.Encoding_Cp862",
"org.firebirdsql.encodings.Encoding_Cp865",
"org.firebirdsql.encodings.Encoding_Cp1257",
"org.firebirdsql.encodings.Encoding_Cp864",
"org.firebirdsql.encodings.Encoding_Cp1256",
"org.firebirdsql.encodings.Encoding_ISO8859_2",
"org.firebirdsql.encodings.Encoding_Cp869",
"org.firebirdsql.encodings.Encoding_ISO8859_3",
"org.firebirdsql.encodings.Encoding_ISO8859_6",
"org.firebirdsql.encodings.Encoding_ISO8859_5",
"org.firebirdsql.encodings.Encoding_ISO8859_8",
"org.firebirdsql.encodings.Encoding_ISO8859_9",
"org.firebirdsql.encodings.Encoding_Cp1251",
"org.firebirdsql.encodings.Encoding_Cp1250"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(EncodingFactory_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"org.firebirdsql.encodings.EncodingFactory",
"org.firebirdsql.encodings.CharacterTranslator",
"org.firebirdsql.encodings.Encoding_NotOneByte",
"org.firebirdsql.encodings.Encoding_OneByte",
"org.firebirdsql.encodings.Encoding_Cp860",
"org.firebirdsql.encodings.Encoding_Cp857",
"org.firebirdsql.encodings.Encoding_ISO8859_6",
"org.firebirdsql.encodings.Encoding_Cp865",
"org.firebirdsql.encodings.Encoding_ISO8859_3",
"org.firebirdsql.encodings.Encoding_Cp850",
"org.firebirdsql.encodings.Encoding_ISO8859_13",
"org.firebirdsql.encodings.Encoding_Cp864",
"org.firebirdsql.encodings.Encoding_Cp869",
"org.firebirdsql.encodings.Encoding_ISO8859_9",
"org.firebirdsql.encodings.Encoding_Cp862",
"org.firebirdsql.encodings.Encoding_Cp1251",
"org.firebirdsql.encodings.Encoding_Cp1256",
"org.firebirdsql.encodings.Encoding_ISO8859_5",
"org.firebirdsql.encodings.Encoding_Cp1253",
"org.firebirdsql.encodings.Encoding_ISO8859_8",
"org.firebirdsql.encodings.Encoding_ISO8859_2",
"org.firebirdsql.encodings.Encoding_Cp1257",
"org.firebirdsql.encodings.Encoding_Cp1255",
"org.firebirdsql.encodings.Encoding_Cp1250",
"org.firebirdsql.encodings.Encoding_Cp1252",
"org.firebirdsql.encodings.Encoding_Cp1254"
);
}
}
| [
"my.submission.blind@gmail.com"
] | my.submission.blind@gmail.com |
298083202535ef4e42b280f818d2b35d5d56d797 | 9d657adc1e70f43748eb744571fd3514e8d74169 | /etraining-web/src/br/com/etraining/web/utils/ValidationBean.java | 5a6dc3bcc2bdee074d1e9710a28d687207589bfa | [] | no_license | jefersonestevo/etraining-fatec | b54d43ee2ec41e1e132fc86059dc5d1e7540dd99 | fa972acc75ec319748da04c3c3d73cb40fd23374 | refs/heads/master | 2020-04-13T03:26:40.302606 | 2013-06-15T23:29:52 | 2013-06-15T23:29:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,933 | java | package br.com.etraining.web.utils;
import java.util.Calendar;
import java.util.Date;
import org.apache.commons.lang.time.DateUtils;
import br.com.etraining.web.managedbeans.EtrainingManagedBean;
public class ValidationBean {
public static boolean isPeriodoDataValido(Date dataInicial, Date dataFinal,
EtrainingManagedBean bean) {
boolean hasError = false;
Date anoAtual = getAnoAtual();
if (anoAtual.after(dataInicial)) {
bean.addErrorMessage(bean.getMessage("Data_Inicial_Anterior_2013"));
hasError = true;
}
if (anoAtual.after(dataFinal)) {
bean.addErrorMessage(bean.getMessage("Data_Final_Anterior_2013"));
hasError = true;
}
if (dataFinal.before(dataInicial)) {
bean.addErrorMessage(bean
.getMessage("Data_Final_Anterior_Data_Inicial"));
hasError = true;
}
Date dataAtual = DateUtils.truncate(new Date(), Calendar.DATE);
Date dataTesteInicial = DateUtils.truncate(dataInicial, Calendar.DATE);
Date dataTesteFinal = DateUtils.truncate(dataFinal, Calendar.DATE);
if (dataAtual.before(dataTesteInicial)) {
bean.addErrorMessage(bean.getMessage("Data_Inicial_Futuro"));
hasError = true;
}
if (dataAtual.before(dataTesteFinal)) {
bean.addErrorMessage(bean.getMessage("Data_Final_Futuro"));
hasError = true;
}
return hasError;
}
public static boolean isDataValido(Date data, EtrainingManagedBean bean) {
boolean hasError = false;
Date anoAtual = getAnoAtual();
if (anoAtual.before(data)) {
bean.addErrorMessage(bean.getMessage("Data_Anterior_2013"));
hasError = true;
}
return hasError;
}
private static Date getAnoAtual() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DATE, 31);
cal.set(Calendar.MONTH, Calendar.DECEMBER);
cal.set(Calendar.YEAR, 2012);
cal.set(Calendar.HOUR, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
cal.add(Calendar.DATE, -1);
return cal.getTime();
}
}
| [
"jefersonestevo@gmail.com"
] | jefersonestevo@gmail.com |
7c82331e2927d498ffd73a98401d74763148bcf3 | bfc8d0f3867cc4e583e17d2bf2b48505bc6a98dd | /app/src/main/java/com/asuscomm/yangyinetwork/smsreceiveexample/AppController.java | 538669ab26c6a8094ac02a901d470334fc54375d | [] | no_license | CodeRecipeJYP/SMSReceiver | 36ecf71805c95ffb10d832f42659d5544d2fcb50 | df9f675458d0a55e6270b6fd023026cb1a5c0608 | refs/heads/master | 2021-01-19T02:12:59.997587 | 2017-04-06T19:29:28 | 2017-04-06T19:29:28 | 87,265,680 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 425 | java | package com.asuscomm.yangyinetwork.smsreceiveexample;
import android.app.Application;
import android.content.IntentFilter;
import android.util.Log;
/**
* Created by jaeyoung on 2017. 4. 5..
*/
public class AppController extends Application {
private final String TAG = "JYP/"+getClass().getSimpleName();
@Override
public void onCreate() {
super.onCreate();
Log.d(TAG, "onCreate: ");
}
}
| [
"pjo901018@korea.ac.kr"
] | pjo901018@korea.ac.kr |
d907956ebb48349dfb6b2a1d013652bc1deed8aa | b72ab07feb6be8c4e641e9dd017f31f05d2ac577 | /src/main/java/no/rubato/controller/PersonController.java | 0dd4c484bcfa792b68a02e1469b9bc26352dfbe8 | [] | no_license | mtalham/Rubato-Api | 1825794c839210c3f5b80ff7db81f91a388b8bf1 | 107373fffefc3da7fa5fd12f2cf6cced47cfdc43 | refs/heads/master | 2022-04-11T03:29:43.115404 | 2020-03-28T20:09:21 | 2020-03-28T20:09:21 | 210,192,098 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,237 | java | package no.rubato.controller;
import no.rubato.model.BandInformation;
import no.rubato.model.PersonDto;
import no.rubato.model.Persons;
import no.rubato.service.PersonsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@CrossOrigin
@RequestMapping("/api/person/")
public class PersonController {
private final PersonsService personsService;
@Autowired
public PersonController(PersonsService personsService) {
this.personsService = personsService;
}
/// Update Profile Information
@RequestMapping(value = "/update/{id}", method = RequestMethod.PUT)
public ResponseEntity<?> updateInfo(@PathVariable("id") long id, @RequestBody Persons persons) {
Persons currentPerson = personsService.findById(id);
if (currentPerson == null) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
currentPerson.setUsername(persons.getUsername());
currentPerson.setName(persons.getName());
currentPerson.setPassword(persons.getPassword());
currentPerson.setConfirmPassword(persons.getConfirmPassword());
currentPerson.setPhone(persons.getPhone());
currentPerson.setPrice(persons.getPrice());
currentPerson.setVipps(persons.getVipps());
currentPerson.setAbout(persons.getAbout());
currentPerson.setRole(persons.getRole());
personsService.savePerson(currentPerson);
return new ResponseEntity<>(persons, HttpStatus.OK);
}
/// Delete Profile
@RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE)
public ResponseEntity<?> deleteUser(@PathVariable("id") long id) {
Persons currentPerson = personsService.findById(id);
if (currentPerson == null) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
personsService.deletePersonById(id);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
/// List All Users For Admin Use Only
@GetMapping("/list-all") // Show all Users from Database
public ResponseEntity<?> getAll() {
return new ResponseEntity<>(personsService.getAll(), HttpStatus.OK);
}
/// Search By Email, Phone, Role, Orders For Admin Use Only
@RequestMapping(value = "/search/{searchId}", method = RequestMethod.GET)
public List<PersonDto> searchUsers(@PathVariable String searchId) {
return personsService.searchUsers(searchId);
}
// Search By Id
@RequestMapping(value = "/searchById/{id}", method = RequestMethod.GET)
public Persons searchPersonById(@PathVariable long id) {
return personsService.findById(id);
}
/// More Complex Booking Request Mapping
/// Cancel Booking Request Mapping
@RequestMapping(value = "/update-band/{id}", method = RequestMethod.PUT)
public ResponseEntity<?> updateBandInfo(
@PathVariable("id") long id, @RequestBody BandInformation bandInformation) {
Persons currentPerson = personsService.findById(id);
if (currentPerson == null) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<>(
personsService.updateBand(currentPerson, bandInformation), HttpStatus.OK);
}
}
| [
"mtalhamunir@outlook.com"
] | mtalhamunir@outlook.com |
ef7a16f6aa5c4adbd8494fe9dd5c58f24fdd2a3d | ca985aee0b9b8e0383074a60d65a84323e3db46d | /requester/src/main/java/com/florian935/requester/rsocketjwt/domain/HelloRequests.java | 0d8b429340343e45ce59e4ae827ab423bd340614 | [] | no_license | Florian935/springboot_rsocket_retrosocket_jwt | 60d548bc7983812ffccde29e2da9e9ff073696f3 | 677302ae5810ecea3df41ba75b3db4a500bd77bd | refs/heads/main | 2023-07-13T11:48:20.509154 | 2021-08-26T16:52:45 | 2021-08-26T16:52:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package com.florian935.requester.rsocketjwt.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.FieldDefaults;
import java.util.List;
import static lombok.AccessLevel.PRIVATE;
@NoArgsConstructor
@AllArgsConstructor
@Data
@FieldDefaults(level = PRIVATE)
public class HelloRequests {
List<String> ids;
}
| [
"florian.martin63000@gmail.com"
] | florian.martin63000@gmail.com |
75d41c57b5dcb5ccf882bc151a2bbd583eab5c86 | 0a2c367f47f80dcd8bce1cedbaf98501f6a2c949 | /GeeksforGeeks_DP/src/DP4_LongestCommonSubsequence/LongestCommonIncreasingSubsequence.java | 3fa64002cf4beefb75a0c343372842b26f0e6c74 | [] | no_license | xinyu-liu/Interview-Experience | 199f0593fc63d3889573940cd2db7e502e410720 | 318450ea95b5583bfc353d798f715437ab05695b | refs/heads/master | 2021-01-01T06:26:24.230590 | 2015-02-22T18:51:42 | 2015-02-22T18:51:42 | 31,174,204 | 3 | 0 | null | null | null | null | GB18030 | Java | false | false | 875 | java | package DP4_LongestCommonSubsequence;
public class LongestCommonIncreasingSubsequence {
// 时间复杂度 O(n^2), 空间复杂度 O(n^2)
public int lcis(String s1, String s2){
char[] a = s1.toCharArray();
char[] b = s2.toCharArray();
int m = a.length;
int n = b.length;
int[][] dp = new int[m+1][n+1];
for(int i = 0; i < m; i++){
int max = 0;
for(int j = 0; j < n; j++){
if(a[i] == b[j]){
dp[i+1][j+1] = max+1;
}
else{
dp[i+1][j+1] = dp[i][j+1];
if(a[i] > b[j] && max < dp[i][j+1]) max = dp[i][j+1];
}
}
}
// find max
int max = 0;
for(int j = 1; j <= n; j++){
if(max < dp[m][j]) max = dp[m][j];
}
return max;
}
public static void main(String[] args){
LongestCommonIncreasingSubsequence sol = new LongestCommonIncreasingSubsequence();
System.out.print( sol.lcis("15241","1924") );
}
}
| [
"xinyuliu0510@gmail.com"
] | xinyuliu0510@gmail.com |
9155e9a7e582d0a9afa2f10776fd4e0d0954b180 | 6351a619099343a965118d44975784453e5d8013 | /06_04/AnonymousClassListener.java | 1ad872db360d9bcf4c4bd4dbc838b8db2a0e4dcf | [] | no_license | gagreen/2019_Semyeong_JAVAGUI | 30b3b8bad1f1159d22932c3b495face49ba76a35 | f360c7365a898ff358f89d84f87121cba5ae2e45 | refs/heads/master | 2022-11-10T13:56:01.656640 | 2020-06-26T12:56:54 | 2020-06-26T12:56:54 | 272,732,586 | 1 | 0 | null | null | null | null | UHC | Java | false | false | 791 | java | import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class AnonymousClassListener extends JFrame{
public AnonymousClassListener() {
setTitle("Action 이벤트 리스너 작성");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new FlowLayout());
JButton btn = new JButton("Action");
c.add(btn);
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JButton b = (JButton)e.getSource();
if(b.getText().equals("Action")) {
b.setText("액션빔");
}else {
b.setText("Action");
}
setTitle(b.getText());
}
});
setSize(350, 150);
setVisible(true);
}
public static void main(String[] args) {
new AnonymousClassListener();
}
} | [
"minsung6088@naver.com"
] | minsung6088@naver.com |
b1d5f781327f5f1638b03dcd9ceb9159b8588c43 | 33111728b3e1c663ddd81a6a59ce8aef6a4baa77 | /src/test/java/com/github/artemzi/PlayTest.java | d3ba55a0b23fa54285e91b730b63fe16c01f5e08 | [] | no_license | artemzi/java-boilerplate-playground | 296971130f81c33563329e1cccc07dbee9968a8a | 458521a03dfb1955c528da323e53f0392fa8f918 | refs/heads/master | 2020-03-28T15:45:07.051264 | 2018-09-13T15:23:08 | 2018-09-13T15:23:08 | 148,622,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package com.github.artemzi;
import org.junit.Test;
public class PlayTest {
@Test public void printToOutput() {
// todo add tests
// ByteArrayOutputStream out = new ByteArrayOutputStream();
// Play.print(new PrintStream(out), "");
// Assert.assertEquals("Hello, World!\n", out.toString());
}
}
| [
"arzinoviev@gmail.com"
] | arzinoviev@gmail.com |
686dc1c639664d64ac3b20c885bea7b19dd6b5fe | 7f6eb412ff8bf8bc4ea1ad2ea0cc29089ad57f6e | /DemoChapt/prince/src/main/java/za/ac/cput/AssgnPrince/App.java | 060d60b1d38326c7c5ca1d1782090d94f5f385ec | [] | no_license | Luuyhisa/AssignmentM2_20 | a85d57e750c3ffa1c46acb5d4c889ab7766f41c7 | a5fd033d6d647560b7b9a736341c4a90ca25d17d | refs/heads/master | 2021-01-16T12:24:08.867022 | 2019-08-12T00:47:53 | 2019-08-12T00:47:53 | 243,119,283 | 0 | 0 | null | 2020-10-13T19:51:03 | 2020-02-25T22:46:48 | Java | UTF-8 | Java | false | false | 177 | java | package za.ac.cput.AssgnPrince;
/**
* pppp
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"216060117@mycput.ac.za"
] | 216060117@mycput.ac.za |
9e01af052a74dda14d0c4496287424704cf7661b | 38953cb223da60f5a9a2666f92fb5d390eddd565 | /iPaaS-User/src/main/java/com/ai/paas/ipaas/user/dto/MdsSearchRestfullReq.java | ac6ee1a8033e166bbe40ad4066e62b208cb86f76 | [] | no_license | cloud-paas/service-mgmt-backend | d46297a63c2677e30d38e3e09c2c3d0929ec3f06 | a66a0d72b702a6b4a4e4eb03e1f39a1a65722905 | refs/heads/master | 2020-11-29T14:46:39.005009 | 2017-01-10T02:19:20 | 2017-01-10T02:19:20 | 76,229,292 | 0 | 0 | null | 2016-12-12T06:41:35 | 2016-12-12T06:41:35 | null | UTF-8 | Java | false | false | 1,125 | java | package com.ai.paas.ipaas.user.dto;
/**
* 请求restfull服务请求
* @author mapl
*/
public class MdsSearchRestfullReq {
private String userId;
private String applyType;
private String serviceId;
private String topicEnName;
private String partition;
private String offset;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getApplyType() {
return applyType;
}
public void setApplyType(String applyType) {
this.applyType = applyType;
}
public String getServiceId() {
return serviceId;
}
public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}
public String getTopicEnName() {
return topicEnName;
}
public void setTopicEnName(String topicEnName) {
this.topicEnName = topicEnName;
}
public String getPartition() {
return partition;
}
public void setPartition(String partition) {
this.partition = partition;
}
public String getOffset() {
return offset;
}
public void setOffset(String offset) {
this.offset = offset;
}
}
| [
"29419065@qq.com"
] | 29419065@qq.com |
c3eaa8c00ba8aa04f20ae6e0b59e1df4fa6b92a2 | 87df4aa0a080e466d86b24ec79105b59aa72c876 | /src/com/yangsen/bean/User.java | 43ea300a6bb2c9d724df65ab30b7d96e29eb2458 | [] | no_license | SmallForest/MessageBoard | eae5c4e57879bd2d43d907300fc33a1053bf3955 | 33ee1707a7961b1498f0fef933dddd39d7985ac1 | refs/heads/master | 2020-04-26T12:46:36.302841 | 2019-03-04T06:22:55 | 2019-03-04T06:22:55 | 173,560,284 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,198 | java | package com.yangsen.bean;
import java.util.Date;
public class User {
private int id;
private String username;
private String password;
private String realName;
private String birthday;
private String phone;
private String address;
public User() {
}
public User(int id, String username, String password, String realname, String birthday, String phone, String address) {
this.id = id;
this.username = username;
this.password = password;
this.realName = realname;
this.birthday = birthday;
this.phone = phone;
this.address = address;
}
public User(String username, String password) {
this.username = username;
this.password = password;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRealname() {
return realName;
}
public void setRealname(String realname) {
this.realName = realname;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", username='" + username + '\'' +
", password='" + password + '\'' +
", realName='" + realName + '\'' +
", birthday=" + birthday +
", phone='" + phone + '\'' +
", address='" + address + '\'' +
'}';
}
}
| [
"1032817724@qq.com"
] | 1032817724@qq.com |
a0588e040b57d0ee4d7da63e0ddc524a08c4d5f1 | 06cb4a6d146dcf2dca6f46ee2231f0544bd60988 | /8-For Loops/src/Assignment_13.java | b155b842c3e1cc040028dc7c74cbafbe1fefac54 | [] | no_license | mevlude/Javascript-sdet- | 58cee0a08ad216ec2d24ec22fd445628a7dbd30c | d8e1c25f889783efb8d583ddfd8ec3187e3edb75 | refs/heads/master | 2020-03-25T23:53:29.392766 | 2018-12-10T00:57:42 | 2018-12-10T00:57:42 | 144,297,690 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 790 | java |
public class Assignment_13 {
public static void main(String[] args) {
System.out.println(sumOdd(1,100)); // should print 2500
System.out.println(sumOdd(-1,100)); // should print -1
System.out.println(sumOdd(100,100)); // should print 0
System.out.println(sumOdd(100,-100)); // should print -1
System.out.println(sumOdd(100,1000)); // should print 247500
}
public static boolean isOdd(int number) {
if(number > 0 && number%2==1 ) {
return true;
}else {
return false;
}
}
public static int sumOdd(int start, int end) {
int sum=0;
if(start<0||end<0||end<start) {
return -1;
}else {
for(int i=start;i<=end;i++) {
if(isOdd(i)) {
sum=sum+i;
}
}
//System.out.println(sum);
return sum;
}
}
}
| [
"mvldcngz@hotmail.com"
] | mvldcngz@hotmail.com |
58e1c37b243a60ff2716a2a2e13470c3be90e895 | e96669ac99e153784325511780fb0752b6807fbc | /app/src/main/java/com/example/yttest/MainActivity.java | 55b883e9834588ffe08421d0a0dc1f5e632d30dc | [] | no_license | LalitSinghRana/YTtest | 61a237c177c952318ac1b78aafbd9a30b48624bd | 0a9b6c777b163edfe8cc0b459f2278c4bf7605d9 | refs/heads/master | 2023-06-10T03:31:05.188193 | 2021-06-21T09:31:53 | 2021-06-21T09:31:53 | 378,870,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 789 | java | package com.example.yttest;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
private Intent intent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
intent = new Intent(this, MyService.class);
// ContextCompat.startForegroundService(this, intent);
}
public void startForeSer(View view) {
ContextCompat.startForegroundService(this, intent);
}
public void stopForeSer(View view) {
stopService(intent);
}
} | [
"lalitrn44@gmail.com"
] | lalitrn44@gmail.com |
1b76af281fb0e5fd71f60e3313b36065a293942f | 35cc6c50128f116e1826aeb7f170b3f407e4adfc | /Connector/app/src/main/java/com/web/connector/fragment/SecondDrawerFragment.java | 38d7a520465c0e6056b2a3dcf393e3e46bb1570f | [] | no_license | ConnectorPj/AndroidConnector | 91519216510d1a9d9ba93d184d9bca9d5ec5178c | 4dcecd7d2487e52ea4c918303ff1d1bf250faa89 | refs/heads/master | 2020-09-06T12:37:18.979806 | 2017-06-22T07:09:01 | 2017-06-22T07:09:01 | 94,419,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,754 | java | package com.web.connector.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.DrawerBuilder;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.web.connector.R;
/**
* A simple {@link Fragment} subclass.
* This is just a demo fragment with a long scrollable view of editTexts. Don't see this as a reference for anything
*/
public class SecondDrawerFragment extends Fragment {
private static final String KEY_TITLE = "title";
private Drawer result;
public SecondDrawerFragment() {
// Required empty public constructor
}
public static SecondDrawerFragment newInstance(String title) {
SecondDrawerFragment f = new SecondDrawerFragment();
Bundle args = new Bundle();
args.putString(KEY_TITLE, title);
f.setArguments(args);
return (f);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
// don't look at this layout it's just a listView to show how to handle the keyboard
View view = inflater.inflate(R.layout.fragment_simple_sample, container, false);
result = new DrawerBuilder()
.withActivity(getActivity())
.withRootView((ViewGroup) view.findViewById(R.id.rootView))
.withDisplayBelowStatusBar(false)
.withSavedInstance(savedInstanceState)
.addDrawerItems(
new PrimaryDrawerItem().withName(R.string.drawer_item_home).withIcon(FontAwesome.Icon.faw_home).withIdentifier(1),
new PrimaryDrawerItem().withName(R.string.drawer_item_free_play).withIcon(FontAwesome.Icon.faw_gamepad),
new PrimaryDrawerItem().withName(R.string.drawer_item_custom).withIcon(FontAwesome.Icon.faw_eye)
)
.buildForFragment();
TextView textView = (TextView) view.findViewById(R.id.title);
textView.setText(getArguments().getString(KEY_TITLE));
result.getDrawerLayout().setFitsSystemWindows(false);
result.getSlider().setFitsSystemWindows(false);
return view;
}
@Override
public void onSaveInstanceState(Bundle outState) {
//add the values which need to be saved from the drawer to the bundle
outState = result.saveInstanceState(outState);
super.onSaveInstanceState(outState);
}
}
| [
"1993jhy@gmail.com"
] | 1993jhy@gmail.com |
c652abab59a2e14f7683a240fa9f975a64281ae9 | 8ecc5844e7bbb36091a0a1f0700490ab255fb4d2 | /app/src/main/java/com/hch/commenttextapp/UserBean.java | 9541e51ac20480cb8e1ad5868d04ebbcc02c4131 | [] | no_license | 469412882/CommentTextApp | d0deaa06a447e159a40acbf58858721a68d9b1fd | cf5e93233c318cb24dd36ae998c6c718c04629c2 | refs/heads/master | 2021-08-14T09:56:39.410848 | 2017-11-15T09:20:53 | 2017-11-15T09:20:53 | 110,811,989 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | package com.hch.commenttextapp;
/**
* Created by hch on 2017/11/15.
*/
public class UserBean {
private String userId;
private String userName;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
| [
"huachunhu@9188.com"
] | huachunhu@9188.com |
d21367e2eb42606aa0e526f16373be405d33725d | be2da1256619024a0b43c314e94842f72fc0486a | /imbra/src/com/inmost/imbra/login/RangeSeekBar.java | 28348faf3aa1ff6bbd0bea9c123e4ecf516f26ae | [] | no_license | xingyes/inmost | 1c66a6a1df0e5eb442db14c5cba7c5e6d0c54c24 | f5ff4342cc913248be4dd158e0e504a7710dc19a | refs/heads/master | 2021-01-20T11:01:30.034115 | 2015-07-16T06:51:33 | 2015-07-16T06:51:33 | 40,540,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 50,638 | java | package com.inmost.imbra.login;
import java.math.BigDecimal;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.RectF;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
import android.widget.ImageView;
import com.inmost.imbra.R;
import com.xingy.util.DPIUtil;
//
///**
// * Widget that lets users select a minimum and maximum value on a given numerical range. The range value types can be one of Long, Double, Integer, Float, Short, Byte or BigDecimal.<br />
// * <br />
// * Improved {@link MotionEvent} handling for smoother use, anti-aliased painting for improved aesthetics.
// *
// * @author Stephan Tittel (stephan.tittel@kom.tu-darmstadt.de)
// * @author Peter Sinnott (psinnott@gmail.com)
// * @author Thomas Barrasso (tbarrasso@sevenplusandroid.org)
// *
// * @param <T>
// * The Number type of the range values. One of Long, Double, Integer, Float, Short, Byte or BigDecimal.
// */
//public class RangeSeekBar<T extends Number> extends ImageView {
// private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
//// private final Bitmap thumbImage = BitmapFactory.decodeResource(getResources(), R.drawable.seek_thumb_normal);
//// private final Bitmap thumbPressedImage = BitmapFactory.decodeResource(getResources(), R.drawable.seek_thumb_pressed);
// private final Bitmap thumbImage = BitmapFactory.decodeResource(getResources(), R.drawable.radio_on);
// private final Bitmap thumbPressedImage = BitmapFactory.decodeResource(getResources(), R.drawable.radio_on);
// private final float thumbWidth = thumbImage.getWidth();
// private final float thumbHalfWidth = 0.5f * thumbWidth;
// private final float thumbHalfHeight = 0.5f * thumbImage.getHeight();
// private final float lineHeight = 0.3f * thumbHalfHeight;
// private final float padding = thumbHalfWidth;
// private final T absoluteMinValue, absoluteMaxValue;
// private final NumberType numberType;
// private final double absoluteMinValuePrim, absoluteMaxValuePrim;
// private double normalizedMinValue = 0d;
// private double normalizedMaxValue = 1d;
// private Thumb pressedThumb = null;
// private boolean notifyWhileDragging = false;
// private OnRangeSeekBarChangeListener<T> listener;
//
// /**
// * Default color of a {@link RangeSeekBar}, #FF33B5E5. This is also known as "Ice Cream Sandwich" blue.
// */
// public static final int DEFAULT_COLOR = Color.argb(0xFF, 0x33, 0xB5, 0xE5);
//
// /**
// * An invalid pointer id.
// */
// public static final int INVALID_POINTER_ID = 255;
//
// // Localized constants from MotionEvent for compatibility
// // with API < 8 "Froyo".
// public static final int ACTION_POINTER_UP = 0x6, ACTION_POINTER_INDEX_MASK = 0x0000ff00, ACTION_POINTER_INDEX_SHIFT = 8;
//
// private float mDownMotionX;
// private int mActivePointerId = INVALID_POINTER_ID;
//
// /**
// * On touch, this offset plus the scaled value from the position of the touch will form the progress value. Usually 0.
// */
// float mTouchProgressOffset;
//
// private int mScaledTouchSlop;
// private boolean mIsDragging;
//
// /**
// * Creates a new RangeSeekBar.
// *
// * @param absoluteMinValue
// * The minimum value of the selectable range.
// * @param absoluteMaxValue
// * The maximum value of the selectable range.
// * @param context
// * @throws IllegalArgumentException
// * Will be thrown if min/max value type is not one of Long, Double, Integer, Float, Short, Byte or BigDecimal.
// */
// public RangeSeekBar(T absoluteMinValue, T absoluteMaxValue, Context context) throws IllegalArgumentException {
// super(context);
// this.absoluteMinValue = absoluteMinValue;
// this.absoluteMaxValue = absoluteMaxValue;
// absoluteMinValuePrim = absoluteMinValue.doubleValue();
// absoluteMaxValuePrim = absoluteMaxValue.doubleValue();
// numberType = NumberType.fromNumber(absoluteMinValue);
//
// // make RangeSeekBar focusable. This solves focus handling issues in case EditText widgets are being used along with the RangeSeekBar within ScollViews.
// setFocusable(true);
// setFocusableInTouchMode(true);
// init();
// }
//
// private final void init() {
// mScaledTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
// }
//
// public boolean isNotifyWhileDragging() {
// return notifyWhileDragging;
// }
//
// /**
// * Should the widget notify the listener callback while the user is still dragging a thumb? Default is false.
// *
// * @param flag
// */
// public void setNotifyWhileDragging(boolean flag) {
// this.notifyWhileDragging = flag;
// }
//
// /**
// * Returns the absolute minimum value of the range that has been set at construction time.
// *
// * @return The absolute minimum value of the range.
// */
// public T getAbsoluteMinValue() {
// return absoluteMinValue;
// }
//
// /**
// * Returns the absolute maximum value of the range that has been set at construction time.
// *
// * @return The absolute maximum value of the range.
// */
// public T getAbsoluteMaxValue() {
// return absoluteMaxValue;
// }
//
// /**
// * Returns the currently selected min value.
// *
// * @return The currently selected min value.
// */
// public T getSelectedMinValue() {
// return normalizedToValue(normalizedMinValue);
// }
//
// /**
// * Sets the currently selected minimum value. The widget will be invalidated and redrawn.
// *
// * @param value
// * The Number value to set the minimum value to. Will be clamped to given absolute minimum/maximum range.
// */
// public void setSelectedMinValue(T value) {
// // in case absoluteMinValue == absoluteMaxValue, avoid division by zero when normalizing.
// if (0 == (absoluteMaxValuePrim - absoluteMinValuePrim)) {
// setNormalizedMinValue(0d);
// }
// else {
// setNormalizedMinValue(valueToNormalized(value));
// }
// }
//
// /**
// * Returns the currently selected max value.
// *
// * @return The currently selected max value.
// */
// public T getSelectedMaxValue() {
// return normalizedToValue(normalizedMaxValue);
// }
//
// /**
// * Sets the currently selected maximum value. The widget will be invalidated and redrawn.
// *
// * @param value
// * The Number value to set the maximum value to. Will be clamped to given absolute minimum/maximum range.
// */
// public void setSelectedMaxValue(T value) {
// // in case absoluteMinValue == absoluteMaxValue, avoid division by zero when normalizing.
// if (0 == (absoluteMaxValuePrim - absoluteMinValuePrim)) {
// setNormalizedMaxValue(1d);
// }
// else {
// setNormalizedMaxValue(valueToNormalized(value));
// }
// }
//
// /**
// * Registers given listener callback to notify about changed selected values.
// *
// * @param listener
// * The listener to notify about changed selected values.
// */
// public void setOnRangeSeekBarChangeListener(OnRangeSeekBarChangeListener<T> listener) {
// this.listener = listener;
// }
//
// /**
// * Handles thumb selection and movement. Notifies listener callback on certain events.
// */
// @Override
// public boolean onTouchEvent(MotionEvent event) {
//
// if (!isEnabled())
// return false;
//
// int pointerIndex;
//
// final int action = event.getAction();
// switch (action & MotionEvent.ACTION_MASK) {
//
// case MotionEvent.ACTION_DOWN:
// // Remember where the motion event started
// mActivePointerId = event.getPointerId(event.getPointerCount() - 1);
// pointerIndex = event.findPointerIndex(mActivePointerId);
// mDownMotionX = event.getX(pointerIndex);
//
// pressedThumb = evalPressedThumb(mDownMotionX);
//
// // Only handle thumb presses.
// if (pressedThumb == null)
// return super.onTouchEvent(event);
//
// setPressed(true);
// invalidate();
// onStartTrackingTouch();
// trackTouchEvent(event);
// attemptClaimDrag();
//
// break;
// case MotionEvent.ACTION_MOVE:
// if (pressedThumb != null) {
//
// if (mIsDragging) {
// trackTouchEvent(event);
// }
// else {
// // Scroll to follow the motion event
// pointerIndex = event.findPointerIndex(mActivePointerId);
// final float x = event.getX(pointerIndex);
//
// if (Math.abs(x - mDownMotionX) > mScaledTouchSlop) {
// setPressed(true);
// invalidate();
// onStartTrackingTouch();
// trackTouchEvent(event);
// attemptClaimDrag();
// }
// }
//
// if (notifyWhileDragging && listener != null) {
// listener.onRangeSeekBarValuesChanged(this, getSelectedMinValue(), getSelectedMaxValue());
// }
// }
// break;
// case MotionEvent.ACTION_UP:
// if (mIsDragging) {
// trackTouchEvent(event);
// onStopTrackingTouch();
// setPressed(false);
// }
// else {
// // Touch up when we never crossed the touch slop threshold
// // should be interpreted as a tap-seek to that location.
// onStartTrackingTouch();
// trackTouchEvent(event);
// onStopTrackingTouch();
// }
//
// pressedThumb = null;
// invalidate();
// if (listener != null) {
// listener.onRangeSeekBarValuesChanged(this, getSelectedMinValue(), getSelectedMaxValue());
// }
// break;
// case MotionEvent.ACTION_POINTER_DOWN: {
// final int index = event.getPointerCount() - 1;
// // final int index = ev.getActionIndex();
// mDownMotionX = event.getX(index);
// mActivePointerId = event.getPointerId(index);
// invalidate();
// break;
// }
// case MotionEvent.ACTION_POINTER_UP:
// onSecondaryPointerUp(event);
// invalidate();
// break;
// case MotionEvent.ACTION_CANCEL:
// if (mIsDragging) {
// onStopTrackingTouch();
// setPressed(false);
// }
// invalidate(); // see above explanation
// break;
// }
// return true;
// }
//
// private final void onSecondaryPointerUp(MotionEvent ev) {
// final int pointerIndex = (ev.getAction() & ACTION_POINTER_INDEX_MASK) >> ACTION_POINTER_INDEX_SHIFT;
//
// final int pointerId = ev.getPointerId(pointerIndex);
// if (pointerId == mActivePointerId) {
// // This was our active pointer going up. Choose
// // a new active pointer and adjust accordingly.
// // TODO: Make this decision more intelligent.
// final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
// mDownMotionX = ev.getX(newPointerIndex);
// mActivePointerId = ev.getPointerId(newPointerIndex);
// }
// }
//
// private final void trackTouchEvent(MotionEvent event) {
// final int pointerIndex = event.findPointerIndex(mActivePointerId);
// final float x = event.getX(pointerIndex);
//
// if (Thumb.MIN.equals(pressedThumb)) {
// setNormalizedMinValue(screenToNormalized(x));
// }
// else if (Thumb.MAX.equals(pressedThumb)) {
// setNormalizedMaxValue(screenToNormalized(x));
// }
// }
//
// /**
// * Tries to claim the user's drag motion, and requests disallowing any ancestors from stealing events in the drag.
// */
// private void attemptClaimDrag() {
// if (getParent() != null) {
// getParent().requestDisallowInterceptTouchEvent(true);
// }
// }
//
// /**
// * This is called when the user has started touching this widget.
// */
// void onStartTrackingTouch() {
// mIsDragging = true;
// }
//
// /**
// * This is called when the user either releases his touch or the touch is canceled.
// */
// void onStopTrackingTouch() {
// mIsDragging = false;
// }
//
// /**
// * Ensures correct size of the widget.
// */
// @Override
// protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// int width = 200;
// if (MeasureSpec.UNSPECIFIED != MeasureSpec.getMode(widthMeasureSpec)) {
// width = MeasureSpec.getSize(widthMeasureSpec);
// }
// int height = thumbImage.getHeight();
// if (MeasureSpec.UNSPECIFIED != MeasureSpec.getMode(heightMeasureSpec)) {
// height = Math.min(height, MeasureSpec.getSize(heightMeasureSpec));
// }
// setMeasuredDimension(width, height);
// }
//
// /**
// * Draws the widget on the given canvas.
// */
// @Override
// protected synchronized void onDraw(Canvas canvas) {
// super.onDraw(canvas);
//
// // draw seek bar background line
// final RectF rect = new RectF(padding, 0.5f * (getHeight() - lineHeight), getWidth() - padding, 0.5f * (getHeight() + lineHeight));
// paint.setStyle(Style.FILL);
// paint.setColor(Color.GRAY);
// paint.setAntiAlias(true);
// canvas.drawRect(rect, paint);
//
// // draw seek bar active range line
// rect.left = normalizedToScreen(normalizedMinValue);
// rect.right = normalizedToScreen(normalizedMaxValue);
//
// // orange color
// paint.setColor(DEFAULT_COLOR);
// canvas.drawRect(rect, paint);
//
// // draw minimum thumb
// drawThumb(normalizedToScreen(normalizedMinValue), Thumb.MIN.equals(pressedThumb), canvas);
//
// // draw maximum thumb
// drawThumb(normalizedToScreen(normalizedMaxValue), Thumb.MAX.equals(pressedThumb), canvas);
// }
//
// /**
// * Overridden to save instance state when device orientation changes. This method is called automatically if you assign an id to the RangeSeekBar widget using the {@link #setId(int)} method. Other members of this class than the normalized min and max values don't need to be saved.
// */
// @Override
// protected Parcelable onSaveInstanceState() {
// final Bundle bundle = new Bundle();
// bundle.putParcelable("SUPER", super.onSaveInstanceState());
// bundle.putDouble("MIN", normalizedMinValue);
// bundle.putDouble("MAX", normalizedMaxValue);
// return bundle;
// }
//
// /**
// * Overridden to restore instance state when device orientation changes. This method is called automatically if you assign an id to the RangeSeekBar widget using the {@link #setId(int)} method.
// */
// @Override
// protected void onRestoreInstanceState(Parcelable parcel) {
// final Bundle bundle = (Bundle) parcel;
// super.onRestoreInstanceState(bundle.getParcelable("SUPER"));
// normalizedMinValue = bundle.getDouble("MIN");
// normalizedMaxValue = bundle.getDouble("MAX");
// }
//
// /**
// * Draws the "normal" resp. "pressed" thumb image on specified x-coordinate.
// *
// * @param screenCoord
// * The x-coordinate in screen space where to draw the image.
// * @param pressed
// * Is the thumb currently in "pressed" state?
// * @param canvas
// * The canvas to draw upon.
// */
// private void drawThumb(float screenCoord, boolean pressed, Canvas canvas) {
// canvas.drawBitmap(pressed ? thumbPressedImage : thumbImage, screenCoord - thumbHalfWidth, (float) ((0.5f * getHeight()) - thumbHalfHeight), paint);
// }
//
// /**
// * Decides which (if any) thumb is touched by the given x-coordinate.
// *
// * @param touchX
// * The x-coordinate of a touch event in screen space.
// * @return The pressed thumb or null if none has been touched.
// */
// private Thumb evalPressedThumb(float touchX) {
// Thumb result = null;
// boolean minThumbPressed = isInThumbRange(touchX, normalizedMinValue);
// boolean maxThumbPressed = isInThumbRange(touchX, normalizedMaxValue);
// if (minThumbPressed && maxThumbPressed) {
// // if both thumbs are pressed (they lie on top of each other), choose the one with more room to drag. this avoids "stalling" the thumbs in a corner, not being able to drag them apart anymore.
// result = (touchX / getWidth() > 0.5f) ? Thumb.MIN : Thumb.MAX;
// }
// else if (minThumbPressed) {
// result = Thumb.MIN;
// }
// else if (maxThumbPressed) {
// result = Thumb.MAX;
// }
// return result;
// }
//
// /**
// * Decides if given x-coordinate in screen space needs to be interpreted as "within" the normalized thumb x-coordinate.
// *
// * @param touchX
// * The x-coordinate in screen space to check.
// * @param normalizedThumbValue
// * The normalized x-coordinate of the thumb to check.
// * @return true if x-coordinate is in thumb range, false otherwise.
// */
// private boolean isInThumbRange(float touchX, double normalizedThumbValue) {
// return Math.abs(touchX - normalizedToScreen(normalizedThumbValue)) <= thumbHalfWidth;
// }
//
// /**
// * Sets normalized min value to value so that 0 <= value <= normalized max value <= 1. The View will get invalidated when calling this method.
// *
// * @param value
// * The new normalized min value to set.
// */
// public void setNormalizedMinValue(double value) {
// normalizedMinValue = Math.max(0d, Math.min(1d, Math.min(value, normalizedMaxValue)));
// invalidate();
// }
//
// /**
// * Sets normalized max value to value so that 0 <= normalized min value <= value <= 1. The View will get invalidated when calling this method.
// *
// * @param value
// * The new normalized max value to set.
// */
// public void setNormalizedMaxValue(double value) {
// normalizedMaxValue = Math.max(0d, Math.min(1d, Math.max(value, normalizedMinValue)));
// invalidate();
// }
//
// /**
// * Converts a normalized value to a Number object in the value space between absolute minimum and maximum.
// *
// * @param normalized
// * @return
// */
// @SuppressWarnings("unchecked")
// private T normalizedToValue(double normalized) {
// return (T) numberType.toNumber(absoluteMinValuePrim + normalized * (absoluteMaxValuePrim - absoluteMinValuePrim));
// }
//
// /**
// * Converts the given Number value to a normalized double.
// *
// * @param value
// * The Number value to normalize.
// * @return The normalized double.
// */
// private double valueToNormalized(T value) {
// if (0 == absoluteMaxValuePrim - absoluteMinValuePrim) {
// // prevent division by zero, simply return 0.
// return 0d;
// }
// return (value.doubleValue() - absoluteMinValuePrim) / (absoluteMaxValuePrim - absoluteMinValuePrim);
// }
//
// /**
// * Converts a normalized value into screen space.
// *
// * @param normalizedCoord
// * The normalized value to convert.
// * @return The converted value in screen space.
// */
// private float normalizedToScreen(double normalizedCoord) {
// return (float) (padding + normalizedCoord * (getWidth() - 2 * padding));
// }
//
// /**
// * Converts screen space x-coordinates into normalized values.
// *
// * @param screenCoord
// * The x-coordinate in screen space to convert.
// * @return The normalized value.
// */
// private double screenToNormalized(float screenCoord) {
// int width = getWidth();
// if (width <= 2 * padding) {
// // prevent division by zero, simply return 0.
// return 0d;
// }
// else {
// double result = (screenCoord - padding) / (width - 2 * padding);
// return Math.min(1d, Math.max(0d, result));
// }
// }
//
// /**
// * Callback listener interface to notify about changed range values.
// *
// * @author Stephan Tittel (stephan.tittel@kom.tu-darmstadt.de)
// *
// * @param <T>
// * The Number type the RangeSeekBar has been declared with.
// */
// public interface OnRangeSeekBarChangeListener<T> {
// public void onRangeSeekBarValuesChanged(RangeSeekBar<?> bar, T minValue, T maxValue);
// }
//
// /**
// * Thumb constants (min and max).
// */
// private static enum Thumb {
// MIN, MAX
// };
//
// /**
// * Utility enumaration used to convert between Numbers and doubles.
// *
// * @author Stephan Tittel (stephan.tittel@kom.tu-darmstadt.de)
// *
// */
// private static enum NumberType {
// LONG, DOUBLE, INTEGER, FLOAT, SHORT, BYTE, BIG_DECIMAL;
//
// public static <E extends Number> NumberType fromNumber(E value) throws IllegalArgumentException {
// if (value instanceof Long) {
// return LONG;
// }
// if (value instanceof Double) {
// return DOUBLE;
// }
// if (value instanceof Integer) {
// return INTEGER;
// }
// if (value instanceof Float) {
// return FLOAT;
// }
// if (value instanceof Short) {
// return SHORT;
// }
// if (value instanceof Byte) {
// return BYTE;
// }
// if (value instanceof BigDecimal) {
// return BIG_DECIMAL;
// }
// throw new IllegalArgumentException("Number class '" + value.getClass().getName() + "' is not supported");
// }
//
// public Number toNumber(double value) {
// switch (this) {
// case LONG:
// return new Long((long) value);
// case DOUBLE:
// return value;
// case INTEGER:
// return new Integer((int) value);
// case FLOAT:
// return new Float(value);
// case SHORT:
// return new Short((short) value);
// case BYTE:
// return new Byte((byte) value);
// case BIG_DECIMAL:
// return new BigDecimal(value);
// }
// throw new InstantiationError("can't convert " + this + " to a Number object");
// }
// }
//}
public class RangeSeekBar<T extends Number> extends ImageView {
public static final Integer DEFAULT_MINIMUM = 0;
public static final Integer DEFAULT_MAXIMUM = 100;
public static final int HEIGHT_IN_DP = 30;
public static final int TEXT_LATERAL_PADDING_IN_DP = 3;
private static final int INITIAL_PADDING_IN_DP = 8;
private int LINE_HEIGHT_IN_DP = 1; /* in dp */
private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Bitmap thumbImage = BitmapFactory.decodeResource(getResources(), R.drawable.seek_thumb_normal);
private final Bitmap thumbPressedImage = BitmapFactory.decodeResource(getResources(),
R.drawable.seek_thumb_pressed);
private final Bitmap thumbDisabledImage = BitmapFactory.decodeResource(getResources(),
R.drawable.seek_thumb_disabled);
private final float thumbWidth = thumbImage.getWidth();
private final float thumbHalfWidth = 0.5f * thumbWidth;
private final float thumbHalfHeight = 0.5f * thumbImage.getHeight();
private float INITIAL_PADDING;
private float padding;
private T absoluteMinValue, absoluteMaxValue;
private NumberType numberType;
private double absoluteMinValuePrim, absoluteMaxValuePrim;
private double normalizedMinValue = 0d;
private double normalizedMaxValue = 1d;
private Thumb pressedThumb = null;
private boolean notifyWhileDragging = false;
private OnRangeSeekBarChangeListener<T> listener;
/**
* Default color of a {@link RangeSeekBar}, #FF33B5E5. This is also known as "Ice Cream Sandwich" blue.
*/
public static final int DEFAULT_COLOR = Color.argb(0xFF, 0x33, 0xB5, 0xE5);
/**
* An invalid pointer id.
*/
public static final int INVALID_POINTER_ID = 255;
// Localized constants from MotionEvent for compatibility
// with API < 8 "Froyo".
public static final int ACTION_POINTER_UP = 0x6, ACTION_POINTER_INDEX_MASK = 0x0000ff00, ACTION_POINTER_INDEX_SHIFT = 8;
private float mDownMotionX;
private int mActivePointerId = INVALID_POINTER_ID;
private int mScaledTouchSlop;
private boolean mIsDragging;
private int mTextOffset;
private int mTextSize;
private int mDistanceToTop;
private RectF mRect;
private static final int DEFAULT_TEXT_SIZE_IN_DP = 14;
private static final int DEFAULT_TEXT_DISTANCE_TO_BUTTON_IN_DP = 8;
private static final int DEFAULT_TEXT_DISTANCE_TO_TOP_IN_DP = 8;
private boolean mSingleThumb;
public RangeSeekBar(Context context) {
super(context);
init(context, null);
}
public RangeSeekBar(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public RangeSeekBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context, attrs);
}
private T extractNumericValueFromAttributes(TypedArray a, int attribute, int defaultValue) {
TypedValue tv = a.peekValue(attribute);
if (tv == null) {
return (T) Integer.valueOf(defaultValue);
}
int type = tv.type;
if (type == TypedValue.TYPE_FLOAT) {
return (T) Float.valueOf(a.getFloat(attribute, defaultValue));
} else {
return (T) Integer.valueOf(a.getInteger(attribute, defaultValue));
}
}
private void init(Context context, AttributeSet attrs) {
if (attrs == null) {
setRangeToDefaultValues();
} else {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.RangeSeekBar, 0, 0);
setRangeValues(
extractNumericValueFromAttributes(a, R.styleable.RangeSeekBar_absoluteMinValue, DEFAULT_MINIMUM),
extractNumericValueFromAttributes(a, R.styleable.RangeSeekBar_absoluteMaxValue, DEFAULT_MAXIMUM));
mSingleThumb = a.getBoolean(R.styleable.RangeSeekBar_singleThumb, false);
LINE_HEIGHT_IN_DP = (Integer)extractNumericValueFromAttributes(a,R.styleable.RangeSeekBar_lineWidth,1);
a.recycle();
}
setValuePrimAndNumberType();
INITIAL_PADDING = DPIUtil.dip2px(INITIAL_PADDING_IN_DP);
mTextSize = DPIUtil.dip2px(DEFAULT_TEXT_SIZE_IN_DP);
mDistanceToTop = DPIUtil.dip2px(DEFAULT_TEXT_DISTANCE_TO_TOP_IN_DP);
mTextOffset = this.mTextSize + DPIUtil.dip2px(DEFAULT_TEXT_DISTANCE_TO_BUTTON_IN_DP) + this.mDistanceToTop;
float lineHeight = DPIUtil.dip2px(LINE_HEIGHT_IN_DP);
mRect = new RectF(padding,
mTextOffset + thumbHalfHeight - lineHeight / 2,
getWidth() - padding,
mTextOffset + thumbHalfHeight + lineHeight / 2);
// make RangeSeekBar focusable. This solves focus handling issues in case EditText widgets are being used along with the RangeSeekBar within ScollViews.
setFocusable(true);
setFocusableInTouchMode(true);
mScaledTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
}
public void setRangeValues(T minValue, T maxValue) {
this.absoluteMinValue = minValue;
this.absoluteMaxValue = maxValue;
setValuePrimAndNumberType();
}
@SuppressWarnings("unchecked")
// only used to set default values when initialised from XML without any values specified
private void setRangeToDefaultValues() {
this.absoluteMinValue = (T) DEFAULT_MINIMUM;
this.absoluteMaxValue = (T) DEFAULT_MAXIMUM;
setValuePrimAndNumberType();
}
private void setValuePrimAndNumberType() {
absoluteMinValuePrim = absoluteMinValue.doubleValue();
absoluteMaxValuePrim = absoluteMaxValue.doubleValue();
numberType = NumberType.fromNumber(absoluteMinValue);
}
public void resetSelectedValues() {
setSelectedMinValue(absoluteMinValue);
setSelectedMaxValue(absoluteMaxValue);
}
public boolean isNotifyWhileDragging() {
return notifyWhileDragging;
}
/**
* Should the widget notify the listener callback while the user is still dragging a thumb? Default is false.
*
* @param flag
*/
public void setNotifyWhileDragging(boolean flag) {
this.notifyWhileDragging = flag;
}
/**
* Returns the absolute minimum value of the range that has been set at construction time.
*
* @return The absolute minimum value of the range.
*/
public T getAbsoluteMinValue() {
return absoluteMinValue;
}
/**
* Returns the absolute maximum value of the range that has been set at construction time.
*
* @return The absolute maximum value of the range.
*/
public T getAbsoluteMaxValue() {
return absoluteMaxValue;
}
/**
* Returns the currently selected min value.
*
* @return The currently selected min value.
*/
public T getSelectedMinValue() {
return normalizedToValue(normalizedMinValue);
}
/**
* Sets the currently selected minimum value. The widget will be invalidated and redrawn.
*
* @param value The Number value to set the minimum value to. Will be clamped to given absolute minimum/maximum range.
*/
public void setSelectedMinValue(T value) {
// in case absoluteMinValue == absoluteMaxValue, avoid division by zero when normalizing.
if (0 == (absoluteMaxValuePrim - absoluteMinValuePrim)) {
setNormalizedMinValue(0d);
} else {
setNormalizedMinValue(valueToNormalized(value));
}
}
/**
* Returns the currently selected max value.
*
* @return The currently selected max value.
*/
public T getSelectedMaxValue() {
return normalizedToValue(normalizedMaxValue);
}
/**
* Sets the currently selected maximum value. The widget will be invalidated and redrawn.
*
* @param value The Number value to set the maximum value to. Will be clamped to given absolute minimum/maximum range.
*/
public void setSelectedMaxValue(T value) {
// in case absoluteMinValue == absoluteMaxValue, avoid division by zero when normalizing.
if (0 == (absoluteMaxValuePrim - absoluteMinValuePrim)) {
setNormalizedMaxValue(1d);
} else {
setNormalizedMaxValue(valueToNormalized(value));
}
}
/**
* Registers given listener callback to notify about changed selected values.
*
* @param listener The listener to notify about changed selected values.
*/
public void setOnRangeSeekBarChangeListener(OnRangeSeekBarChangeListener<T> listener) {
this.listener = listener;
}
/**
* Handles thumb selection and movement. Notifies listener callback on certain events.
*/
@Override
public boolean onTouchEvent(MotionEvent event) {
if (!isEnabled()) {
return false;
}
int pointerIndex;
final int action = event.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
// Remember where the motion event started
mActivePointerId = event.getPointerId(event.getPointerCount() - 1);
pointerIndex = event.findPointerIndex(mActivePointerId);
mDownMotionX = event.getX(pointerIndex);
pressedThumb = evalPressedThumb(mDownMotionX);
// Only handle thumb presses.
if (pressedThumb == null) {
return super.onTouchEvent(event);
}
setPressed(true);
invalidate();
onStartTrackingTouch();
trackTouchEvent(event);
attemptClaimDrag();
break;
case MotionEvent.ACTION_MOVE:
if (pressedThumb != null) {
if (mIsDragging) {
trackTouchEvent(event);
} else {
// Scroll to follow the motion event
pointerIndex = event.findPointerIndex(mActivePointerId);
final float x = event.getX(pointerIndex);
if (Math.abs(x - mDownMotionX) > mScaledTouchSlop) {
setPressed(true);
invalidate();
onStartTrackingTouch();
trackTouchEvent(event);
attemptClaimDrag();
}
}
if (notifyWhileDragging && listener != null) {
listener.onRangeSeekBarValuesChanged(this, getSelectedMinValue(), getSelectedMaxValue());
}
}
break;
case MotionEvent.ACTION_UP:
if (mIsDragging) {
trackTouchEvent(event);
onStopTrackingTouch();
setPressed(false);
} else {
// Touch up when we never crossed the touch slop threshold
// should be interpreted as a tap-seek to that location.
onStartTrackingTouch();
trackTouchEvent(event);
onStopTrackingTouch();
}
pressedThumb = null;
invalidate();
if (listener != null) {
listener.onRangeSeekBarValuesChanged(this, getSelectedMinValue(), getSelectedMaxValue());
}
break;
case MotionEvent.ACTION_POINTER_DOWN: {
final int index = event.getPointerCount() - 1;
// final int index = ev.getActionIndex();
mDownMotionX = event.getX(index);
mActivePointerId = event.getPointerId(index);
invalidate();
break;
}
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(event);
invalidate();
break;
case MotionEvent.ACTION_CANCEL:
if (mIsDragging) {
onStopTrackingTouch();
setPressed(false);
}
invalidate(); // see above explanation
break;
}
return true;
}
private final void onSecondaryPointerUp(MotionEvent ev) {
final int pointerIndex = (ev.getAction() & ACTION_POINTER_INDEX_MASK) >> ACTION_POINTER_INDEX_SHIFT;
final int pointerId = ev.getPointerId(pointerIndex);
if (pointerId == mActivePointerId) {
// This was our active pointer going up. Choose
// a new active pointer and adjust accordingly.
// TODO: Make this decision more intelligent.
final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
mDownMotionX = ev.getX(newPointerIndex);
mActivePointerId = ev.getPointerId(newPointerIndex);
}
}
private final void trackTouchEvent(MotionEvent event) {
final int pointerIndex = event.findPointerIndex(mActivePointerId);
final float x = event.getX(pointerIndex);
if (Thumb.MIN.equals(pressedThumb) && !mSingleThumb) {
setNormalizedMinValue(screenToNormalized(x));
} else if (Thumb.MAX.equals(pressedThumb)) {
setNormalizedMaxValue(screenToNormalized(x));
}
}
/**
* Tries to claim the user's drag motion, and requests disallowing any ancestors from stealing events in the drag.
*/
private void attemptClaimDrag() {
if (getParent() != null) {
getParent().requestDisallowInterceptTouchEvent(true);
}
}
/**
* This is called when the user has started touching this widget.
*/
void onStartTrackingTouch() {
mIsDragging = true;
}
/**
* This is called when the user either releases his touch or the touch is canceled.
*/
void onStopTrackingTouch() {
mIsDragging = false;
}
/**
* Ensures correct size of the widget.
*/
@Override
protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = 200;
if (MeasureSpec.UNSPECIFIED != MeasureSpec.getMode(widthMeasureSpec)) {
width = MeasureSpec.getSize(widthMeasureSpec);
}
int height = thumbImage.getHeight() + DPIUtil.dip2px(HEIGHT_IN_DP);
if (MeasureSpec.UNSPECIFIED != MeasureSpec.getMode(heightMeasureSpec)) {
height = Math.min(height, MeasureSpec.getSize(heightMeasureSpec));
}
setMeasuredDimension(width, height);
}
/**
* Draws the widget on the given canvas.
*/
@Override
protected synchronized void onDraw(Canvas canvas) {
super.onDraw(canvas);
paint.setTextSize(mTextSize);
paint.setStyle(Style.FILL);
paint.setColor(Color.GRAY);
paint.setAntiAlias(true);
// draw min and max labels
String minLabel = "Min";
String maxLabel = "Max";
float minMaxLabelSize = Math.max(paint.measureText(minLabel), paint.measureText(maxLabel));
float minMaxHeight = mTextOffset + thumbHalfHeight + mTextSize / 3;
canvas.drawText(minLabel, 0, minMaxHeight, paint);
canvas.drawText(maxLabel, getWidth() - minMaxLabelSize, minMaxHeight, paint);
padding = INITIAL_PADDING + minMaxLabelSize + thumbHalfWidth;
// draw seek bar background line
mRect.left = padding;
mRect.right = getWidth() - padding;
canvas.drawRect(mRect, paint);
boolean selectedValuesAreDefault = (getSelectedMinValue().equals(getAbsoluteMinValue()) &&
getSelectedMaxValue().equals(getAbsoluteMaxValue()));
int colorToUseForButtonsAndHighlightedLine = selectedValuesAreDefault ?
Color.GRAY : // default values
DEFAULT_COLOR; //non default, filter is active
// draw seek bar active range line
mRect.left = normalizedToScreen(normalizedMinValue);
mRect.right = normalizedToScreen(normalizedMaxValue);
paint.setColor(colorToUseForButtonsAndHighlightedLine);
canvas.drawRect(mRect, paint);
// draw minimum thumb if not a single thumb control
if (!mSingleThumb) {
drawThumb(normalizedToScreen(normalizedMinValue), Thumb.MIN.equals(pressedThumb), canvas,
selectedValuesAreDefault);
}
// draw maximum thumb
drawThumb(normalizedToScreen(normalizedMaxValue), Thumb.MAX.equals(pressedThumb), canvas,
selectedValuesAreDefault);
// draw the text if sliders have moved from default edges
if (!selectedValuesAreDefault) {
paint.setTextSize(mTextSize);
paint.setColor(Color.WHITE);
// give text a bit more space here so it doesn't get cut off
int offset = DPIUtil.dip2px(TEXT_LATERAL_PADDING_IN_DP);
String minText = String.valueOf(getSelectedMinValue());
String maxText = String.valueOf(getSelectedMaxValue());
float minTextWidth = paint.measureText(minText) + offset;
float maxTextWidth = paint.measureText(maxText) + offset;
if (!mSingleThumb) {
canvas.drawText(minText,
normalizedToScreen(normalizedMinValue) - minTextWidth * 0.5f,
mDistanceToTop + mTextSize,
paint);
}
canvas.drawText(maxText,
normalizedToScreen(normalizedMaxValue) - maxTextWidth * 0.5f,
mDistanceToTop + mTextSize,
paint);
}
}
/**
* Overridden to save instance state when device orientation changes. This method is called automatically if you assign an id to the RangeSeekBar widget using the {@link #setId(int)} method. Other members of this class than the normalized min and max values don't need to be saved.
*/
@Override
protected Parcelable onSaveInstanceState() {
final Bundle bundle = new Bundle();
bundle.putParcelable("SUPER", super.onSaveInstanceState());
bundle.putDouble("MIN", normalizedMinValue);
bundle.putDouble("MAX", normalizedMaxValue);
return bundle;
}
/**
* Overridden to restore instance state when device orientation changes. This method is called automatically if you assign an id to the RangeSeekBar widget using the {@link #setId(int)} method.
*/
@Override
protected void onRestoreInstanceState(Parcelable parcel) {
final Bundle bundle = (Bundle) parcel;
super.onRestoreInstanceState(bundle.getParcelable("SUPER"));
normalizedMinValue = bundle.getDouble("MIN");
normalizedMaxValue = bundle.getDouble("MAX");
}
/**
* Draws the "normal" resp. "pressed" thumb image on specified x-coordinate.
*
* @param screenCoord The x-coordinate in screen space where to draw the image.
* @param pressed Is the thumb currently in "pressed" state?
* @param canvas The canvas to draw upon.
*/
private void drawThumb(float screenCoord, boolean pressed, Canvas canvas, boolean areSelectedValuesDefault) {
Bitmap buttonToDraw;
if (areSelectedValuesDefault) {
buttonToDraw = thumbDisabledImage;
} else {
buttonToDraw = pressed ? thumbPressedImage : thumbImage;
}
canvas.drawBitmap(buttonToDraw, screenCoord - thumbHalfWidth,
mTextOffset,
paint);
}
/**
* Decides which (if any) thumb is touched by the given x-coordinate.
*
* @param touchX The x-coordinate of a touch event in screen space.
* @return The pressed thumb or null if none has been touched.
*/
private Thumb evalPressedThumb(float touchX) {
Thumb result = null;
boolean minThumbPressed = isInThumbRange(touchX, normalizedMinValue);
boolean maxThumbPressed = isInThumbRange(touchX, normalizedMaxValue);
if (minThumbPressed && maxThumbPressed) {
// if both thumbs are pressed (they lie on top of each other), choose the one with more room to drag. this avoids "stalling" the thumbs in a corner, not being able to drag them apart anymore.
result = (touchX / getWidth() > 0.5f) ? Thumb.MIN : Thumb.MAX;
} else if (minThumbPressed) {
result = Thumb.MIN;
} else if (maxThumbPressed) {
result = Thumb.MAX;
}
return result;
}
/**
* Decides if given x-coordinate in screen space needs to be interpreted as "within" the normalized thumb x-coordinate.
*
* @param touchX The x-coordinate in screen space to check.
* @param normalizedThumbValue The normalized x-coordinate of the thumb to check.
* @return true if x-coordinate is in thumb range, false otherwise.
*/
private boolean isInThumbRange(float touchX, double normalizedThumbValue) {
return Math.abs(touchX - normalizedToScreen(normalizedThumbValue)) <= thumbHalfWidth;
}
/**
* Sets normalized min value to value so that 0 <= value <= normalized max value <= 1. The View will get invalidated when calling this method.
*
* @param value The new normalized min value to set.
*/
private void setNormalizedMinValue(double value) {
normalizedMinValue = Math.max(0d, Math.min(1d, Math.min(value, normalizedMaxValue)));
invalidate();
}
/**
* Sets normalized max value to value so that 0 <= normalized min value <= value <= 1. The View will get invalidated when calling this method.
*
* @param value The new normalized max value to set.
*/
private void setNormalizedMaxValue(double value) {
normalizedMaxValue = Math.max(0d, Math.min(1d, Math.max(value, normalizedMinValue)));
invalidate();
}
/**
* Converts a normalized value to a Number object in the value space between absolute minimum and maximum.
*
* @param normalized
* @return
*/
@SuppressWarnings("unchecked")
private T normalizedToValue(double normalized) {
double v = absoluteMinValuePrim + normalized * (absoluteMaxValuePrim - absoluteMinValuePrim);
// TODO parameterize this rounding to allow variable decimal points
return (T) numberType.toNumber(Math.round(v * 100) / 100d);
}
/**
* Converts the given Number value to a normalized double.
*
* @param value The Number value to normalize.
* @return The normalized double.
*/
private double valueToNormalized(T value) {
if (0 == absoluteMaxValuePrim - absoluteMinValuePrim) {
// prevent division by zero, simply return 0.
return 0d;
}
return (value.doubleValue() - absoluteMinValuePrim) / (absoluteMaxValuePrim - absoluteMinValuePrim);
}
/**
* Converts a normalized value into screen space.
*
* @param normalizedCoord The normalized value to convert.
* @return The converted value in screen space.
*/
private float normalizedToScreen(double normalizedCoord) {
return (float) (padding + normalizedCoord * (getWidth() - 2 * padding));
}
/**
* Converts screen space x-coordinates into normalized values.
*
* @param screenCoord The x-coordinate in screen space to convert.
* @return The normalized value.
*/
private double screenToNormalized(float screenCoord) {
int width = getWidth();
if (width <= 2 * padding) {
// prevent division by zero, simply return 0.
return 0d;
} else {
double result = (screenCoord - padding) / (width - 2 * padding);
return Math.min(1d, Math.max(0d, result));
}
}
/**
* Callback listener interface to notify about changed range values.
*
* @param <T> The Number type the RangeSeekBar has been declared with.
* @author Stephan Tittel (stephan.tittel@kom.tu-darmstadt.de)
*/
public interface OnRangeSeekBarChangeListener<T> {
public void onRangeSeekBarValuesChanged(RangeSeekBar<?> bar, T minValue, T maxValue);
}
/**
* Thumb constants (min and max).
*/
private static enum Thumb {
MIN, MAX
}
;
/**
* Utility enumeration used to convert between Numbers and doubles.
*
* @author Stephan Tittel (stephan.tittel@kom.tu-darmstadt.de)
*/
private static enum NumberType {
LONG, DOUBLE, INTEGER, FLOAT, SHORT, BYTE, BIG_DECIMAL;
public static <E extends Number> NumberType fromNumber(E value) throws IllegalArgumentException {
if (value instanceof Long) {
return LONG;
}
if (value instanceof Double) {
return DOUBLE;
}
if (value instanceof Integer) {
return INTEGER;
}
if (value instanceof Float) {
return FLOAT;
}
if (value instanceof Short) {
return SHORT;
}
if (value instanceof Byte) {
return BYTE;
}
if (value instanceof BigDecimal) {
return BIG_DECIMAL;
}
throw new IllegalArgumentException("Number class '" + value.getClass().getName() + "' is not supported");
}
public Number toNumber(double value) {
switch (this) {
case LONG:
return Long.valueOf((long) value);
case DOUBLE:
return value;
case INTEGER:
return Integer.valueOf((int) value);
case FLOAT:
return Float.valueOf((float)value);
case SHORT:
return Short.valueOf((short) value);
case BYTE:
return Byte.valueOf((byte) value);
case BIG_DECIMAL:
return BigDecimal.valueOf(value);
}
throw new InstantiationError("can't convert " + this + " to a Number object");
}
}
} | [
"xingyao@vip.qq.com"
] | xingyao@vip.qq.com |
937e8c0b245334210feb55dc7bc22e3fa2f5f35c | b14930e4eaad657807c33245fb56ae506518990b | /src/main/java/PageObject/LoginPage.java | 1e3efa637913247c3af6f804814471d779123bc5 | [] | no_license | rsaruri/Digital.isracard | 3b08480306e848c586ba1918d2456dff826b812a | b92aefcea763ede8dfedba4cf8cffd0c7d62b3a2 | refs/heads/master | 2022-11-30T18:00:07.052816 | 2020-08-10T08:59:44 | 2020-08-10T08:59:44 | 286,329,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,355 | java | package PageObject;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class LoginPage extends BasePage {
@FindBy (id = "otpLoginId_ID")
public WebElement idInput;
@FindBy (name="otpLoginLastDigits_ID")
public WebElement digitsInput;
@FindBy (id="otpLoginPwd")
public WebElement passInput;
@FindBy (xpath = "//*[@ng-bind='vm.epiData.LoginButtonText']")
public WebElement submitBtn;
/**
* c-tor login page
* @param driver
*/
public LoginPage (WebDriver driver) {
super(driver);
PageFactory.initElements(driver, this);
}
/**
* Enter ID number to id field
* @param id
* @return
*/
public LoginPage withId (String id) {
idInput.sendKeys(id);
return this;
}
/**
* Enter last 6 digits of credit card to last digits field
* @param digits
* @return
*/
public LoginPage withLastDigits (String digits) {
digitsInput.sendKeys(digits);
return this;
}
/**
* Enter password to password field
* @param pass
* @return
*/
public LoginPage withPassword (String pass) {
passInput.sendKeys(pass);
return this;
}
/**
* submit - go to transaction page
*/
public TransactionPage submit() {
submitBtn.click();
return new TransactionPage(driver);
}
}
| [
"rina.saruri@gmail.com"
] | rina.saruri@gmail.com |
498162a74ca25c0ed92001e69c9fbbe7db168ffa | faca6217618b8d0f1bbddf0ebd023f5f2c9a72ef | /platforms/android/ant-gen/everito/san/BuildConfig.java | fdc5708835aa11d7feb9d16ce79bb24ba2b86789 | [] | no_license | everitosan/Musawesome | a9f80e0ad95c39df2eaca36709a0da36cffacc4e | 136add0becb880a15903cfa35fdb4b1d1e6d2af2 | refs/heads/master | 2020-06-05T01:00:09.245193 | 2014-07-02T00:32:06 | 2014-07-02T00:32:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | /** Automatically generated file. DO NOT MODIFY */
package everito.san;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"everardo.ipn@gmail.com"
] | everardo.ipn@gmail.com |
77450752bbf402a5ea3e45e5b05f9b38d87c8e01 | d902852bae434d74976461dd3b17273f63f9ac8c | /ADFWeek1/Day7LearningSpringIOC/src/com/accenture/ioc/client/EmployeeServiceClient.java | 8268aaac0bd7f63bd03cfae12bff69b45dad9d32 | [] | no_license | samkit5495/Accenture-GFT-Training-JAVA | d303665927d6715c9c9c867b6c6c9ebf38bacb17 | f516324de1ff6ba21e43ccc282facd470cde1630 | refs/heads/main | 2023-01-07T18:44:12.940330 | 2020-11-03T04:25:59 | 2020-11-03T04:25:59 | 309,571,614 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,395 | java | package com.accenture.ioc.client;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import com.accenture.ioc.utility.EmployeeSQLQueries;
public class EmployeeServiceClient {
public static void main(String[] args) {
//1. Identify the config file to be read by spring container
Resource res=new ClassPathResource("SpringContainerConfig.xml");
//2. Create the container to make it read the config file and create the beans
//lazy bean
BeanFactory container=new XmlBeanFactory(res);
//active bean
// ApplicationContext container=new ClassPathXmlApplicationContext("SpringContainerConfig.xml");
System.out.println("Container Instaintiated");
EmployeeSQLQueries empQueries1=(EmployeeSQLQueries) container.getBean("dbQuery");
EmployeeSQLQueries empQueries2=(EmployeeSQLQueries) container.getBean("dbQuery");
EmployeeSQLQueries empQueries3=(EmployeeSQLQueries) container.getBean("dbQuery");
/*System.out.println(empQueries.getSearchEmployee());
System.out.println(empQueries.getCreateEmployee());
System.out.println(empQueries.getDeleteEmployee());*/
}
}
| [
"samkit5495@gmail.com"
] | samkit5495@gmail.com |
620bcfb500a9da7c67c43b97596f5e63e795cfc1 | b473c2f1ccf7b67e3d061a2d11e669c33982e7bf | /apache-batik/sources/org/apache/batik/css/engine/Messages.java | 58a0c6e52048793257eeb601107993ca838b1172 | [
"Apache-2.0"
] | permissive | eGit/appengine-awt | 4ab046498bad79eddf1f7e74728bd53dc0044526 | 4262657914eceff1fad335190613a272cc60b940 | refs/heads/master | 2021-01-01T15:36:07.658506 | 2015-08-26T11:40:24 | 2015-08-26T11:40:24 | 41,421,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,406 | java | /*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.apache.batik.css.engine;
import java.util.Locale;
import java.util.MissingResourceException;
import org.apache.batik.i18n.LocalizableSupport;
/**
* This class manages the message for the css.engine module.
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
* @version $Id: Messages.java 478160 2006-11-22 13:35:06Z dvholten $
*/
public class Messages {
/**
* This class does not need to be instantiated.
*/
protected Messages() {
}
/**
* The error messages bundle class name.
*/
protected static final String RESOURCES =
"org.apache.batik.css.engine.resources.Messages";
/**
* The localizable support for the error messages.
*/
protected static LocalizableSupport localizableSupport =
new LocalizableSupport(RESOURCES, Messages.class.getClassLoader());
/**
* Implements {@link org.apache.batik.i18n.Localizable#setLocale(Locale)}.
*/
public static void setLocale(Locale l) {
localizableSupport.setLocale(l);
}
/**
* Implements {@link org.apache.batik.i18n.Localizable#getLocale()}.
*/
public static Locale getLocale() {
return localizableSupport.getLocale();
}
/**
* Implements {@link
* org.apache.batik.i18n.Localizable#formatMessage(String,Object[])}.
*/
public static String formatMessage(String key, Object[] args)
throws MissingResourceException {
return localizableSupport.formatMessage(key, args);
}
}
| [
"HebnerN@gmail.com"
] | HebnerN@gmail.com |
25657ede24f578dcbe32b2f4647c64b8da492b2e | 2eadf6560a077e418d5d73d0cfd9a347d49298a9 | /zzz/src/main/java/com/paises/bd/crearBD.java | 10ff785f56d69b0d36f3d9fa8c2b83f1ecaae198 | [] | no_license | jjberciano1975/zzz | d7d7006906a1a6da8f1d13acf9b6273945bd63d4 | 4f66d484b01345541b1fad511a25b79183c341bb | refs/heads/master | 2021-04-27T04:52:39.735874 | 2018-02-23T09:03:09 | 2018-02-23T09:03:09 | 122,586,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,221 | java | package com.paises.bd;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import com.paises.entities.User;
/**
* @author www.imagineanddo.com
*
*/
public class crearBD {
/**
* @param args
* @throws IllegalAccessException
* @throws InstantiationException
*
*/
public static void main(String[] args) {
String driver = "org.apache.derby.jdbc.EmbeddedDriver";
String dbName = "BdPaises";
String dbParam = "create=true"; //Si la base de datos no existe, se crear� una nueva
String dbschema= "schema=paises";
String dbuser= "user=paises";
String dbpass= "password=manager";
// String dbDirectory = "//localhost:8080/BdPaises";
//String connectionURL = "jdbc:derby:" +dbDirectory + ";" +dbName + ";" + dbParam+ ";" + dbuser+ ";" + dbpass;
String connectionURL = "jdbc:derby:" +dbName + ";"+ dbParam; //+ ";" + dbschema + ";" + dbuser+ ";" + dbpass;
/* Si no se especifica la ruta donde se crear� la base de datos,
por defecto se crear� en la misma carpeta donde se encuentra el derby.jar
En ese caso la cadena de conexi� ser�a la siguiente:
String connectionURL = "jdbc:derby:" + dbName + ";" + dbParam;
*/
Connection conn = null;
try{
Class.forName(driver);
} catch(java.lang.ClassNotFoundException e) {
e.printStackTrace();
}
try {
conn = DriverManager.getConnection(connectionURL);
Statement st = conn.createStatement();
String sqlCreateTableUsers =
"CREATE TABLE users ( " +
"NAME VARCHAR(30) NOT NULL, " +
"EMAIL VARCHAR(30) NOT NULL, " +
"PASSWORD VARCHAR(30) NOT NULL, " +
"IDUSER INTEGER NOT NULL CONSTRAINT idUser_PK PRIMARY KEY " +
")";
st.execute(sqlCreateTableUsers);
ResultSet rs = st.executeQuery("select name,email,password,iduser from user");
while (rs.next())
{
//System.out.println (rs.getString (1) + " " + rs.getString (2)+ " " + rs.getInt(3));
User u = new User(rs.getString (1),rs.getString (2),rs.getString (3),rs.getInt(4));
}
/* String sqlCreateTableCohes =
"CREATE TABLE COCHES ( " +
"marca VARCHAR(30) NOT NULL, " +
"modelo VARCHAR(30) NOT NULL, " +
"idUser INTEGER NOT NULL CONSTRAINT idCoches_PK PRIMARY KEY " +
")";*/
/* st.execute(sqlCreateTableCohes);
System.out.println("La base de datos '" + dbName + "' se ha creado correctamente");
st.executeUpdate("INSERT INTO coches VALUES('Renault', 'R21', 1)");
st.executeUpdate("INSERT INTO coches VALUES('Seat', '124 L', 2)");
st.executeUpdate("INSERT INTO coches VALUES('Fiat', 'uno', 3)");
st.executeUpdate("INSERT INTO coches VALUES('Renault', 'R12', 4)");*/
/* st.execute("drop table users ");
String sqlCreateTableUsers =
"CREATE TABLE users ( " +
"name VARCHAR(30) NOT NULL, " +
"email VARCHAR(30) NOT NULL, " +
"idUser INTEGER NOT NULL CONSTRAINT idUser_PK PRIMARY KEY " +
")";
st.execute(sqlCreateTableUsers);
System.out.println("La base de datos '" + dbName + "' se ha creado correctamente");
st.executeUpdate("INSERT INTO users VALUES('Juan Perez', 'JuanPerez@lamoto.com', 1)");
st.executeUpdate("INSERT INTO users VALUES('Renzo Lopez', 'RenzoLopez@lamoto.com', 2)");
st.executeUpdate("INSERT INTO users VALUES('Carla Mendivil', 'CarlaMendivil@lamoto.com', 3)");
*/
System.out.println("insert se ha hecho correctamente");
} catch (Throwable e) {
System.out.println("Error al crear la base de datos '" + dbName + "'");
e.printStackTrace();
} finally {
try { conn.close(); }
catch (Throwable t){}
}
}
} | [
"jjb@wpsnetwork.com"
] | jjb@wpsnetwork.com |
23745a80b5dba3f371cbdf6a8a111f7a26d990e9 | 7f518ea8b231af43781e4431ce4469235b5115e3 | /persistence/src/main/java/org/apache/karaf/sample/acna15/persistence/entity/Book.java | 86a224b5d1b79c4c3c553e24cb1b336b2e937a79 | [] | no_license | jbonofre/acna15 | b253c2957939d3819f967ecafa4e3bc0b5623885 | 5f8683913281d3c8b61d6ab7c6daa991f9eff05c | refs/heads/master | 2016-09-11T03:26:33.828214 | 2015-04-22T20:14:23 | 2015-04-22T20:14:23 | 33,983,920 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 908 | java | package org.apache.karaf.sample.acna15.persistence.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.io.Serializable;
@Entity
public class Book implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id;
private String name;
private String isbn;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
@Override
public String toString() {
return "Book [id=" + id + ", name=" + name + ", isbn=" + isbn + "]";
}
}
| [
"jbonofre@apache.org"
] | jbonofre@apache.org |
d541eebba549ce2d0939767734e057d6294ef9d0 | 51c0be4518f9f6e37f7d6fa6a77c898fd44bca8d | /src/java/nc/handler/BulletEvent.java | 7c4bfc5665571f8a984a092d5d1df39e7165db4f | [] | no_license | kmecpp/NuclearCraft-OLD | 5c7e4efcfd5a9ebc3ba94922e378a804f173839d | abf98de93303400f2a9f0904af3f6c1de32251a0 | refs/heads/master | 2021-06-01T02:38:24.570508 | 2016-03-20T20:31:04 | 2016-03-20T20:31:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package nc.handler;
import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.player.PlayerEvent;
@Cancelable
public class BulletEvent extends PlayerEvent
{
public final ItemStack gun;
public BulletEvent(EntityPlayer player, ItemStack gun)
{
super(player);
this.gun = gun;
}
} | [
"joedodd35@gmail.com"
] | joedodd35@gmail.com |
837e56bf6d64869f204e9d212c16ea55a201e4e9 | dc8a99bfb7a8e6edd88c09d29e663423b3e448f9 | /src/test/java/com/oracle/jp/cowweb/CowsayControllerTest.java | 0529f1e201febbe67c67cbd78e3352ee0bae59f2 | [
"MIT"
] | permissive | shtfresh/cowweb-for-wercker-demo- | 1d84d03642276f6d58050100e60ef3418def5d6c | dbb69fd5750e46233f869bdbcbf4a54ab7b7159b | refs/heads/master | 2020-04-01T00:35:48.132850 | 2019-01-25T08:10:45 | 2019-01-25T08:10:45 | 152,703,869 | 0 | 1 | MIT | 2019-01-25T06:22:08 | 2018-10-12T06:26:52 | Java | UTF-8 | Java | false | false | 1,652 | java | package com.oracle.jp.cowweb;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {Application.class},
initializers = {ConfigFileApplicationContextInitializer.class})
@WebAppConfiguration
public class CowsayControllerTest {
@Autowired
private WebApplicationContext context;
private MockMvc mockMvc;
@Before
public void setupMockMvc() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(context).build();
}
@Test
public void testEcho() throws Exception {
mockMvc.perform(get("/cowsay/ping"))
.andExpect(status().isOk())
.andExpect(content().contentType("text/plain;charset=UTF-8"))
.andExpect(content().string("I'm working..."));
}
} | [
"hhiroshell@gmail.com"
] | hhiroshell@gmail.com |
840b956c9bdeaa2247f9e1938c6e685b6a7af1e4 | b74f2c19ea8e730b93e3da8842fc0ca3db9639dd | /aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/S3OutputUrl.java | 4c0ff9d90de7585ed51fb10447d52e9b0bbd6bfb | [
"Apache-2.0"
] | permissive | mgivney/aws-sdk-java | 2de4a597beeda68735ba5bb822f45e924de29d14 | 005db50a80c825dc305306a0633cac057b95b054 | refs/heads/master | 2021-05-02T04:51:13.281576 | 2016-12-16T01:48:44 | 2016-12-16T01:48:44 | 76,672,974 | 1 | 0 | null | 2016-12-16T17:36:09 | 2016-12-16T17:36:09 | null | UTF-8 | Java | false | false | 3,699 | java | /*
* Copyright 2011-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.simplesystemsmanagement.model;
import java.io.Serializable;
/**
* <p>
* A URL for the Amazon S3 bucket where you want to store the results of this request.
* </p>
*/
public class S3OutputUrl implements Serializable, Cloneable {
/**
* <p>
* A URL for an Amazon S3 bucket where you want to store the results of this request.
* </p>
*/
private String outputUrl;
/**
* <p>
* A URL for an Amazon S3 bucket where you want to store the results of this request.
* </p>
*
* @param outputUrl
* A URL for an Amazon S3 bucket where you want to store the results of this request.
*/
public void setOutputUrl(String outputUrl) {
this.outputUrl = outputUrl;
}
/**
* <p>
* A URL for an Amazon S3 bucket where you want to store the results of this request.
* </p>
*
* @return A URL for an Amazon S3 bucket where you want to store the results of this request.
*/
public String getOutputUrl() {
return this.outputUrl;
}
/**
* <p>
* A URL for an Amazon S3 bucket where you want to store the results of this request.
* </p>
*
* @param outputUrl
* A URL for an Amazon S3 bucket where you want to store the results of this request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public S3OutputUrl withOutputUrl(String outputUrl) {
setOutputUrl(outputUrl);
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getOutputUrl() != null)
sb.append("OutputUrl: " + getOutputUrl());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof S3OutputUrl == false)
return false;
S3OutputUrl other = (S3OutputUrl) obj;
if (other.getOutputUrl() == null ^ this.getOutputUrl() == null)
return false;
if (other.getOutputUrl() != null && other.getOutputUrl().equals(this.getOutputUrl()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getOutputUrl() == null) ? 0 : getOutputUrl().hashCode());
return hashCode;
}
@Override
public S3OutputUrl clone() {
try {
return (S3OutputUrl) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| [
""
] | |
88960ad5ce256227be1b17eb73cb7b7be9cc0794 | 99c00e723dcb08eca0e056103dbcac3fdf1a8440 | /RideRead/app/src/main/java/com/rideread/rideread/activity/BaseActivity.java | a8576dd38c20cf1f39dffb8f9e51cc87aa6a7283 | [] | no_license | Ride-Read/ride-read-android | d41ed8d5b2cd79a59c704ccb26a0512d6f3258c9 | bd27be24b9ed88d763106e522ed5166285843c88 | refs/heads/master | 2021-06-18T06:28:35.535748 | 2017-06-04T13:06:38 | 2017-06-04T13:06:38 | 79,616,100 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,200 | java | package com.rideread.rideread.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;
import com.avos.avoscloud.im.v2.AVIMClient;
import com.rideread.rideread.App;
import com.rideread.rideread.event.EmptyEvent;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
/**
* Created by Jackbing on 2017/1/26.
*/
public class BaseActivity extends AppCompatActivity {
public AVIMClient client;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(!App.baseQueue.contains(this)){
App.baseQueue.add(this);
}
}
@Override
protected void onResume() {
super.onResume();
//EventBus.getDefault().register(this);
}
protected void startActivity(Class<?> cls) {
Intent intent = new Intent(this, cls);
startActivity(intent);
}
protected void startActivity(Class<?> cls, String... objs) {
Intent intent = new Intent(this, cls);
for (int i = 0; i < objs.length; i++) {
intent.putExtra(objs[i], objs[i]);
}
startActivity(intent);
}
protected boolean filterException(Exception e) {
if (e != null) {
e.printStackTrace();
toast(e.getMessage());
return false;
} else {
return true;
}
}
protected void toast(String str) {
Toast.makeText(this, str, Toast.LENGTH_SHORT).show();
}
protected void showToast(String content) {
Toast.makeText(this, content, Toast.LENGTH_SHORT).show();
}
protected void showToast(int resId) {
Toast.makeText(this, resId, Toast.LENGTH_SHORT).show();
}
@Override
protected void onPause() {
super.onPause();
//EventBus.getDefault().unregister(this);
}
public AVIMClient getClient() {
return client;
}
public void setClient(AVIMClient client) {
this.client = client;
}
}
| [
"jackbing228@gmail.com"
] | jackbing228@gmail.com |
73c301dfd3153473679bda1f84c08e9e98a8d1cb | 570ad26481a159f27e1bd4615a72cdf71986348d | /AutoTest/src/android/telephony/MSimTelephonyManager.java | 46396c13cb2a146164df2ff6c74a5863ccbacadb | [
"Apache-2.0"
] | permissive | q315099997/test-platform | 184071824153a0dd7b3b532d556edecd1c71c148 | 427e3182725738f5af662df612ccf4c96133e3ec | refs/heads/master | 2023-03-25T06:52:13.360922 | 2014-12-20T03:22:27 | 2014-12-20T03:22:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 220 | java | package android.telephony;
public class MSimTelephonyManager {
public boolean isMultiSimEnabled() {
return false;
}
public void listen(PhoneStateListener listener, int events) {
}
}
| [
"doctang@163.com"
] | doctang@163.com |
d1cc32959c34f94e66d53f17c51491872bb01397 | 1dad35d94d554096b0980c52ed46092849ae30f8 | /src/com/example/fivecardpokerandroid/HelpActivity.java | d5feb23877e48a2cec33fab99d4eb3630abb0fc2 | [] | no_license | kevfly16/FiveCardPokerAndroidApp | 1990db6471aabdfd074fdf4e106edc96d2a57e86 | 825db788c0a743249eed5b9846f373516d728abf | refs/heads/master | 2016-09-03T02:38:41.357883 | 2014-09-07T04:08:54 | 2014-09-07T04:08:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,103 | java | package com.example.fivecardpokerandroid;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class HelpActivity extends Activity {
Button backButton;
TextView descriptionTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_help);
descriptionTextView = (TextView) findViewById(R.id.descriptionTextView);
backButton = (Button) findViewById(R.id.backButton);
backButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
back();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.help, menu);
return true;
}
public void back() {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
}
| [
"kevfly16@gmail.com"
] | kevfly16@gmail.com |
321a640d795cbf799f3ab7fe6f49f734ab2c609a | 8ad82b92980f9252ce588d2b745ee38818bb66ed | /SistemaCafeteria/SistemaCafeteria-ejb/build/generated-sources/ap-source-output/Classes/Foods_.java | 35410b941c93286b624ebbbbc7b21ed9275f3163 | [] | no_license | Topodo/Sistema_Cafeteria | 81d91ebb5a9597076b6654babccca9c0e734bf9a | f989fd55d8d6fe0359159f475fdbe946beeb5ac9 | refs/heads/master | 2021-01-21T11:49:48.011820 | 2017-05-21T10:21:41 | 2017-05-21T10:21:41 | 91,758,137 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 723 | java | package Classes;
import Classes.Orders;
import javax.annotation.Generated;
import javax.persistence.metamodel.ListAttribute;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="EclipseLink-2.5.2.v20140319-rNA", date="2017-05-20T23:08:44")
@StaticMetamodel(Foods.class)
public class Foods_ {
public static volatile SingularAttribute<Foods, Integer> foodsStock;
public static volatile SingularAttribute<Foods, String> foodsName;
public static volatile SingularAttribute<Foods, Integer> idFoods;
public static volatile SingularAttribute<Foods, String> foodsPrice;
public static volatile ListAttribute<Foods, Orders> ordersList;
} | [
"cbzn1994@gmail.com"
] | cbzn1994@gmail.com |
a0c191c3f6f0ec6d82cdf118393dc8be699e7b97 | 43d07af1742e01001c17eba4196f30156b08fbcc | /com/sun/tools/internal/ws/util/WSDLFetcher.java | f8d58a0d6460a8033894150a59057c1909c1aed2 | [] | no_license | kSuroweczka/jdk | b408369b4b87ab09a828aa3dbf9132aaf8bb1b71 | 7ec3e8e31fcfb616d4a625191bcba0191ca7c2d4 | refs/heads/master | 2021-12-30T00:58:24.029054 | 2018-02-01T10:07:14 | 2018-02-01T10:07:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,896 | java | /* */ package com.sun.tools.internal.ws.util;
/* */
/* */ import com.sun.istack.internal.NotNull;
/* */ import com.sun.tools.internal.ws.resources.WscompileMessages;
/* */ import com.sun.tools.internal.ws.wscompile.WsimportListener;
/* */ import com.sun.tools.internal.ws.wscompile.WsimportOptions;
/* */ import com.sun.tools.internal.ws.wsdl.parser.DOMForest;
/* */ import com.sun.tools.internal.ws.wsdl.parser.MetadataFinder;
/* */ import com.sun.xml.internal.txw2.output.IndentingXMLStreamWriter;
/* */ import com.sun.xml.internal.ws.api.server.PortAddressResolver;
/* */ import com.sun.xml.internal.ws.streaming.SourceReaderFactory;
/* */ import com.sun.xml.internal.ws.wsdl.parser.WSDLConstants;
/* */ import com.sun.xml.internal.ws.wsdl.writer.DocumentLocationResolver;
/* */ import com.sun.xml.internal.ws.wsdl.writer.WSDLPatcher;
/* */ import java.io.File;
/* */ import java.io.FileOutputStream;
/* */ import java.io.IOException;
/* */ import java.io.OutputStream;
/* */ import java.net.MalformedURLException;
/* */ import java.net.URL;
/* */ import java.util.HashMap;
/* */ import java.util.Map;
/* */ import java.util.Set;
/* */ import javax.xml.namespace.QName;
/* */ import javax.xml.stream.XMLOutputFactory;
/* */ import javax.xml.stream.XMLStreamException;
/* */ import javax.xml.stream.XMLStreamReader;
/* */ import javax.xml.stream.XMLStreamWriter;
/* */ import javax.xml.transform.dom.DOMSource;
/* */ import org.w3c.dom.Document;
/* */ import org.w3c.dom.Element;
/* */ import org.w3c.dom.Node;
/* */ import org.w3c.dom.NodeList;
/* */
/* */ public class WSDLFetcher
/* */ {
/* */ private WsimportOptions options;
/* */ private WsimportListener listener;
/* 235 */ private static String WSDL_PATH = "META-INF/wsdl";
/* 236 */ private static String WSDL_FILE_EXTENSION = ".wsdl";
/* 237 */ private static String SCHEMA_FILE_EXTENSION = ".xsd";
/* */
/* */ public WSDLFetcher(WsimportOptions options, WsimportListener listener)
/* */ {
/* 65 */ this.options = options;
/* 66 */ this.listener = listener;
/* */ }
/* */
/* */ public String fetchWsdls(MetadataFinder forest)
/* */ throws IOException, XMLStreamException
/* */ {
/* 79 */ String rootWsdl = null;
/* 80 */ for (String root : forest.getRootDocuments()) {
/* 81 */ rootWsdl = root;
/* */ }
/* */
/* 84 */ Set externalRefs = forest.getExternalReferences();
/* 85 */ Map documentMap = createDocumentMap(forest, getWSDLDownloadDir(), rootWsdl, externalRefs);
/* 86 */ String rootWsdlName = fetchFile(rootWsdl, forest, documentMap, getWSDLDownloadDir());
/* 87 */ for (String reference : forest.getExternalReferences()) {
/* 88 */ fetchFile(reference, forest, documentMap, getWSDLDownloadDir());
/* */ }
/* 90 */ return WSDL_PATH + "/" + rootWsdlName;
/* */ }
/* */
/* */ private String fetchFile(String doc, DOMForest forest, Map<String, String> documentMap, File destDir) throws IOException, XMLStreamException
/* */ {
/* 95 */ DocumentLocationResolver docLocator = createDocResolver(doc, forest, documentMap);
/* 96 */ WSDLPatcher wsdlPatcher = new WSDLPatcher(new PortAddressResolver()
/* */ {
/* */ public String getAddressFor(@NotNull QName serviceName, @NotNull String portName) {
/* 99 */ return null;
/* */ }
/* */ }
/* */ , docLocator);
/* */
/* 103 */ XMLStreamReader xsr = null;
/* 104 */ XMLStreamWriter xsw = null;
/* 105 */ OutputStream os = null;
/* 106 */ String resolvedRootWsdl = null;
/* */ try
/* */ {
/* 109 */ xsr = SourceReaderFactory.createSourceReader(new DOMSource(forest.get(doc)), false);
/* 110 */ XMLOutputFactory writerfactory = XMLOutputFactory.newInstance();
/* 111 */ resolvedRootWsdl = docLocator.getLocationFor(null, doc);
/* 112 */ File outFile = new File(destDir, resolvedRootWsdl);
/* 113 */ os = new FileOutputStream(outFile);
/* 114 */ if (this.options.verbose) {
/* 115 */ this.listener.message(WscompileMessages.WSIMPORT_DOCUMENT_DOWNLOAD(doc, outFile));
/* */ }
/* 117 */ xsw = writerfactory.createXMLStreamWriter(os);
/* */
/* 120 */ IndentingXMLStreamWriter indentingWriter = new IndentingXMLStreamWriter(xsw);
/* 121 */ wsdlPatcher.bridge(xsr, indentingWriter);
/* 122 */ this.options.addGeneratedFile(outFile);
/* */ } finally {
/* */ try {
/* 125 */ if (xsr != null) xsr.close();
/* 126 */ if (xsw != null) xsw.close();
/* */ }
/* 128 */ finally { if (os != null) os.close();
/* */ }
/* */ }
/* 131 */ return resolvedRootWsdl;
/* */ }
/* */
/* */ private Map<String, String> createDocumentMap(MetadataFinder forest, File baseDir, String rootWsdl, Set<String> externalReferences)
/* */ {
/* 136 */ Map map = new HashMap();
/* 137 */ String rootWsdlFileName = rootWsdl;
/* */
/* 140 */ int slashIndex = rootWsdl.lastIndexOf("/");
/* 141 */ if (slashIndex >= 0)
/* 142 */ rootWsdlFileName = rootWsdl.substring(slashIndex + 1);
/* */ NodeList serviceNodes;
/* */ String rootWsdlName;
/* 144 */ if (!rootWsdlFileName.endsWith(WSDL_FILE_EXTENSION)) {
/* 145 */ Document rootWsdlDoc = forest.get(rootWsdl);
/* 146 */ serviceNodes = rootWsdlDoc.getElementsByTagNameNS(WSDLConstants.QNAME_SERVICE.getNamespaceURI(), WSDLConstants.QNAME_SERVICE.getLocalPart());
/* */ String rootWsdlName;
/* */ String rootWsdlName;
/* 147 */ if (serviceNodes.getLength() == 0) {
/* 148 */ rootWsdlName = "Service";
/* */ } else {
/* 150 */ Node serviceNode = serviceNodes.item(0);
/* 151 */ String serviceName = ((Element)serviceNode).getAttribute("name");
/* 152 */ rootWsdlName = serviceName;
/* */ }
/* 154 */ rootWsdlFileName = rootWsdlName + WSDL_FILE_EXTENSION;
/* */ } else {
/* 156 */ rootWsdlName = rootWsdlFileName.substring(0, rootWsdlFileName.length() - 5);
/* */ }
/* */
/* 159 */ map.put(rootWsdl, sanitize(rootWsdlFileName));
/* */
/* 161 */ int i = 1;
/* 162 */ for (String ref : externalReferences) {
/* 163 */ Document refDoc = forest.get(ref);
/* 164 */ Element rootEl = refDoc.getDocumentElement();
/* */
/* 166 */ String fileName = null;
/* 167 */ int index = ref.lastIndexOf("/");
/* 168 */ if (index >= 0)
/* 169 */ fileName = ref.substring(index + 1);
/* */ String fileExtn;
/* */ String fileExtn;
/* 171 */ if ((rootEl.getLocalName().equals(WSDLConstants.QNAME_DEFINITIONS.getLocalPart())) && (rootEl.getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/"))) {
/* 172 */ fileExtn = WSDL_FILE_EXTENSION;
/* */ }
/* */ else
/* */ {
/* */ String fileExtn;
/* 173 */ if ((rootEl.getLocalName().equals(WSDLConstants.QNAME_SCHEMA.getLocalPart())) && (rootEl.getNamespaceURI().equals("http://www.w3.org/2001/XMLSchema")))
/* 174 */ fileExtn = SCHEMA_FILE_EXTENSION;
/* */ else
/* 176 */ fileExtn = ".xml";
/* */ }
/* 178 */ if ((fileName != null) && ((fileName.endsWith(WSDL_FILE_EXTENSION)) || (fileName.endsWith(SCHEMA_FILE_EXTENSION))))
/* 179 */ map.put(ref, rootWsdlName + "_" + fileName);
/* */ else {
/* 181 */ map.put(ref, rootWsdlName + "_metadata" + i++ + fileExtn);
/* */ }
/* */ }
/* 184 */ return map;
/* */ }
/* */
/* */ private DocumentLocationResolver createDocResolver(final String baseWsdl, final DOMForest forest, final Map<String, String> documentMap) {
/* 188 */ return new DocumentLocationResolver()
/* */ {
/* */ public String getLocationFor(String namespaceURI, String systemId) {
/* */ try {
/* 192 */ URL reference = new URL(new URL(baseWsdl), systemId);
/* 193 */ systemId = reference.toExternalForm();
/* */ } catch (MalformedURLException e) {
/* 195 */ throw new RuntimeException(e);
/* */ }
/* 197 */ if (documentMap.get(systemId) != null) {
/* 198 */ return (String)documentMap.get(systemId);
/* */ }
/* 200 */ String parsedEntity = (String)forest.getReferencedEntityMap().get(systemId);
/* 201 */ return (String)documentMap.get(parsedEntity);
/* */ }
/* */ };
/* */ }
/* */
/* */ private String sanitize(String fileName)
/* */ {
/* 208 */ fileName = fileName.replace('?', '.');
/* 209 */ StringBuilder sb = new StringBuilder(fileName);
/* 210 */ for (int i = 0; i < sb.length(); i++) {
/* 211 */ char c = sb.charAt(i);
/* 212 */ if ((!Character.isLetterOrDigit(c)) && (c != '/') && (c != '.') && (c != '_') && (c != ' ') && (c != '-'))
/* */ {
/* 220 */ sb.setCharAt(i, '_');
/* */ }
/* */ }
/* 223 */ return sb.toString();
/* */ }
/* */
/* */ private File getWSDLDownloadDir() {
/* 227 */ File wsdlDir = new File(this.options.destDir, WSDL_PATH);
/* 228 */ boolean created = wsdlDir.mkdirs();
/* 229 */ if ((this.options.verbose) && (!created)) {
/* 230 */ this.listener.message(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(wsdlDir));
/* */ }
/* 232 */ return wsdlDir;
/* */ }
/* */ }
/* Location: D:\dt\jdk\tools.jar
* Qualified Name: com.sun.tools.internal.ws.util.WSDLFetcher
* JD-Core Version: 0.6.2
*/ | [
"starlich.1207@gmail.com"
] | starlich.1207@gmail.com |
1e3d4313e3cc9a4816ca7c14f2afd38eee9201da | d7035ce28d6fedaa92d09709fbe1d491adcffba0 | /app/src/main/java/com/collosteam/simplesitereader/app/db/DBHelper.java | 439c25a3dfe1aba80a23156a7c51289ab0e6ea01 | [] | no_license | Collosteam/SimpleSiteReader | bf5242981dc90d6fd7b3ab1cde8e4da2a33ec702 | 4e4c5a391c50a69cc082ce501dfa387d15727973 | refs/heads/master | 2016-09-10T10:15:32.756696 | 2014-08-06T21:56:32 | 2014-08-06T21:56:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,384 | java | package com.collosteam.simplesitereader.app.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by Collos on 7/16/2014.
*/
public class DBHelper extends SQLiteOpenHelper implements DBColumn{
private static final String DATABASE_NAME = "my_db";
private static final int DATABASE_VERSION = 1;
public static final String TABLE = "users" ;
private static final String SQL_CREATE_ENTRIES = "CREATE TABLE IF NOT EXISTS "
+ TABLE + "("
+ ID + " INTEGER UNIQUE PRIMARY KEY AUTOINCREMENT, "
+ NAME + " TEXT NOT NULL, "
+ PASS + " TEXT NOT NULL, "
+ EMAIL + " TEXT NOT NULL, "
+ "UNIQUE (" + ID + ") ON CONFLICT IGNORE);" ;
private static final String SQL_DELETE_ENTRIES = "DROP TABLE IF EXISTS " + TABLE ;
public DBHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
public void onCreate(SQLiteDatabase db) {
db.execSQL(SQL_CREATE_ENTRIES);
}
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// Удаляем предыдущую таблицу при апгрейде
db.execSQL(SQL_DELETE_ENTRIES);
// Создаём новый экземпляр таблицы
onCreate(db);
}
}
| [
"miroshnychenkoandrew@gmail.com"
] | miroshnychenkoandrew@gmail.com |
f28de466ffaa8bd996075a8b433bf1742623b99f | 8217d0c8b73d8704d022ecf6295505042a960857 | /app/src/main/java/com/techsol/cedc/METEFLA/LoginActivity.java | f1e9d8718d37962de49b2a3536d10a9122ee6082 | [
"MIT"
] | permissive | CE4DC/METEFLA | fe1a4373ec3e3ca9574e71d23926480d8e9ef833 | f8780196898b90c2ab799e65674720bb58bda9d8 | refs/heads/master | 2021-07-23T10:04:42.934097 | 2017-11-03T18:09:10 | 2017-11-03T18:09:10 | 104,962,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,144 | java | package com.techsol.cedc.METEFLA;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
public class LoginActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
public void onClickLogin(View v) {
Intent intent;
SharedPreferences userPrefs = this.getSharedPreferences("userPrefs", MODE_PRIVATE);
SharedPreferences.Editor editor = userPrefs.edit();
switch (v.getId()) {
case R.id.login_doctor:
editor.putInt("USERTYPE", 1);
intent = new Intent(this, QRScanActivity.class);
startActivity(intent);
break;
case R.id.login_technician:
editor.putInt("USERTYPE", 2);
intent = new Intent(this, QRScanActivity.class);
startActivity(intent);
break;
}
editor.apply();
}
}
| [
"chelkyl@g.clemson.edu"
] | chelkyl@g.clemson.edu |
1e5e5672736a3b87e83aa17e5f9d51e25142b759 | eedcd12920c3e1d635465b459a221eb23074195e | /app/src/main/java/com/example/acadroidquizadmin/SpeedMath/AddQuestionSMActivity.java | 7678497986903bb07e837a3af160ba0298076264 | [] | no_license | zaheeransari763/AcaDroidQuiz_Admin | 146123659fc450f8c24bbb33f37854b185438e07 | 04f36cd5722cf5a82f465730c36c2b32b88f17b1 | refs/heads/master | 2023-05-11T12:12:02.593698 | 2021-05-30T18:55:35 | 2021-05-30T18:55:35 | 372,293,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,363 | java | package com.example.acadroidquizadmin.SpeedMath;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.Manifest;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.example.acadroidquizadmin.Adapter.QuestionsAdapter;
import com.example.acadroidquizadmin.Category.TypeQuestionActivity;
import com.example.acadroidquizadmin.Model.QuestionModel;
import com.example.acadroidquizadmin.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
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 org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
public class AddQuestionSMActivity extends AppCompatActivity {
RecyclerView recyclerView;
Button add_btn, excel_btn;
QuestionsAdapter adapter;
public static List<QuestionModel> list;
Dialog loadingBar;
String categoryNme;
String setId;
TextView loadText;
DatabaseReference myRef;
public static final int CELL_COUNT = 6;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_question_s_m);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
myRef = FirebaseDatabase.getInstance().getReference();
categoryNme = getIntent().getStringExtra("category");
setId = getIntent().getStringExtra("setId");
getSupportActionBar().setTitle(categoryNme);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
recyclerView = findViewById(R.id.recycler_view);
LinearLayoutManager manager = new LinearLayoutManager(this);
manager.setOrientation(RecyclerView.VERTICAL);
recyclerView.setLayoutManager(manager);
loadingBar = new Dialog(this);
loadingBar.setContentView(R.layout.loading_ailog);
loadingBar.getWindow().setBackgroundDrawable(getDrawable(R.drawable.loading_design));
loadingBar.getWindow().setLayout(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
loadingBar.setCancelable(false);
loadText = loadingBar.findViewById(R.id.loadText);
list = new ArrayList<>();
adapter = new QuestionsAdapter(list, categoryNme, new QuestionsAdapter.DeleteListener() {
@Override
public void onLongClick(final int position, final String id) {
new AlertDialog.Builder(AddQuestionSMActivity.this, R.style.Theme_AppCompat_Light_Dialog)
.setTitle("Delete Question")
.setMessage("Press confirm to delete or cancel to be safe")
.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
loadingBar.show();
myRef.child("Sets").child(setId).child(id).removeValue().addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
list.remove(position);
adapter.notifyItemRemoved(position);
Toast.makeText(AddQuestionSMActivity.this, "Question Deleted", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(AddQuestionSMActivity.this, "Error Occurred! :" + task.getException().getMessage(), Toast.LENGTH_SHORT).show();
}
loadingBar.dismiss();
}
});
}
})
.setNegativeButton("Cancel", null)
.setIcon(R.drawable.warning)
.show();
}
});
recyclerView.setAdapter(adapter);
getDataFromDatabase(categoryNme, setId);
add_btn = findViewById(R.id.add_Btn);
add_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AddQuestionIntent();
}
});
excel_btn = findViewById(R.id.excel_btn);
excel_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//ImportFromExcel();
if (ActivityCompat.checkSelfPermission(AddQuestionSMActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
SelectFromExcel();
} else {
ActivityCompat.requestPermissions(AddQuestionSMActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 101);
}
}
});
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == 101) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
SelectFromExcel();
} else {
Toast.makeText(this, "Please allow permission!", Toast.LENGTH_SHORT).show();
}
}
}
private void SelectFromExcel() {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.setType("*/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(Intent.createChooser(intent, "Select File"), 102);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 102) {
if (resultCode == RESULT_OK) {
String filepath = data.getData().getPath();
if (filepath.endsWith(".xlsx")) {
readFile(data.getData());
} else {
Toast.makeText(this, "please choose correct file", Toast.LENGTH_SHORT).show();
}
}
}
}
private void getDataFromDatabase(String categoryNme, final String setId) {
loadingBar.show();
FirebaseDatabase.getInstance().getReference()
.child("Sets").child(setId).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
for (DataSnapshot dataSnapshot : snapshot.getChildren()) {
String id = dataSnapshot.getKey();
String quest = dataSnapshot.child("question").getValue().toString();
String optA = dataSnapshot.child("optiona").getValue().toString();
String optB = dataSnapshot.child("optionb").getValue().toString();
String optC = dataSnapshot.child("optionc").getValue().toString();
String optD = dataSnapshot.child("optiond").getValue().toString();
String correctAnswer = dataSnapshot.child("correctAns").getValue().toString();
list.add(new QuestionModel(id, quest, optA, optB, optC, optD, correctAnswer, setId));
}
loadingBar.dismiss();
adapter.notifyDataSetChanged();
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
Toast.makeText(AddQuestionSMActivity.this, "Error occurred!", Toast.LENGTH_SHORT).show();
loadingBar.dismiss();
finish();
}
});
}
private void AddQuestionIntent() {
//Add question to database code here
Intent questionIntent = new Intent(this, TypeQuestionSMActivity.class);
questionIntent.putExtra("category", categoryNme);
questionIntent.putExtra("setId", setId);
startActivity(questionIntent);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
}
return super.onOptionsItemSelected(item);
}
private void readFile(final Uri fileUri) {
loadText.setText("scanning document...");
loadingBar.show();
AsyncTask.execute(new Runnable() {
@Override
public void run() {
final HashMap<String, Object> parentMap = new HashMap<>();
final List<QuestionModel> tempList = new ArrayList<>();
try {
InputStream inputStream = getContentResolver().openInputStream(fileUri);
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
FormulaEvaluator formulaEvaluator = workbook.getCreationHelper().createFormulaEvaluator();
int rowsCount = sheet.getPhysicalNumberOfRows();
if (rowsCount > 0) {
for (int r = 0; r < rowsCount; r++) {
Row row = sheet.getRow(r);
if (row.getPhysicalNumberOfCells() == CELL_COUNT) {
String question = getCellData(row, 0, formulaEvaluator);
String a = getCellData(row, 1, formulaEvaluator);
String b = getCellData(row, 2, formulaEvaluator);
String c = getCellData(row, 3, formulaEvaluator);
String d = getCellData(row, 4, formulaEvaluator);
String correctAns = getCellData(row, 5, formulaEvaluator);
if (correctAns.equals(a) || correctAns.equals(b) || correctAns.equals(c) || correctAns.equals(d)) {
HashMap<String, Object> questionMap = new HashMap<>();
questionMap.put("question", question);
questionMap.put("optiona", a);
questionMap.put("optionb", b);
questionMap.put("optionc", c);
questionMap.put("optiond", d);
questionMap.put("correctAns", correctAns);
questionMap.put("setId", setId);
final String id = UUID.randomUUID().toString();
parentMap.put(id, questionMap);
tempList.add(new QuestionModel(id, question, a, b, c, d, correctAns, setId));
} else {
final int finalR = r;
runOnUiThread(new Runnable() {
@Override
public void run() {
loadText.setText("loading...");
loadingBar.dismiss();
Toast.makeText(AddQuestionSMActivity.this, "Row no. " + (finalR + 1) + " has no correct option", Toast.LENGTH_SHORT).show();
}
});
return;
}
} else {
final int finalR1 = r;
runOnUiThread(new Runnable() {
@Override
public void run() {
loadText.setText("loading...");
loadingBar.dismiss();
Toast.makeText(AddQuestionSMActivity.this, "Row no. " + (finalR1 + 1) + " has incorrect data", Toast.LENGTH_SHORT).show();
}
});
return;
}
}
runOnUiThread(new Runnable() {
@Override
public void run() {
loadText.setText("Uploading question");
FirebaseDatabase.getInstance().getReference()
.child("Sets").child(setId).updateChildren(parentMap).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
list.addAll(tempList);
adapter.notifyDataSetChanged();
} else {
loadText.setText("loading");
Toast.makeText(AddQuestionSMActivity.this, "something went wrong", Toast.LENGTH_SHORT).show();
}
loadingBar.dismiss();
}
});
}
});
} else {
runOnUiThread(new Runnable() {
@Override
public void run() {
loadText.setText("loading");
loadingBar.dismiss();
Toast.makeText(AddQuestionSMActivity.this, "File is empty!", Toast.LENGTH_SHORT).show();
}
});
return;
}
} catch (final FileNotFoundException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
@Override
public void run() {
loadText.setText("loading");
loadingBar.dismiss();
Toast.makeText(AddQuestionSMActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
});
} catch (final IOException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
@Override
public void run() {
loadText.setText("loading");
loadingBar.dismiss();
Toast.makeText(AddQuestionSMActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
}
});
}
@Override
protected void onStart() {
super.onStart();
adapter.notifyDataSetChanged();
}
private String getCellData(Row row, int cellPosition, FormulaEvaluator formulaEvaluator) {
String value = "";
Cell cell = row.getCell(cellPosition);
switch (cell.getCellType()) {
case Cell.CELL_TYPE_BOOLEAN:
return value + cell.getBooleanCellValue();
case Cell.CELL_TYPE_NUMERIC:
return value + cell.getNumericCellValue();
case Cell.CELL_TYPE_STRING:
return value + cell.getStringCellValue();
default:
return value;
}
}
} | [
"zaheeransari763@gmail.com"
] | zaheeransari763@gmail.com |
08b125e973e9554f147e524c289eacd6fdcc302c | 3458a770f6a3a11211f31eae6890ae9046aeb97a | /AndroidEdu/FolioStation/app/src/main/java/edu/ucsb/cs/cs185/foliostation/utilities/ImageUtilities.java | 34b62bd6f7b607d7f467136b68d9da74d9a72326 | [] | no_license | windmill-cloud/MobileEdu | 33aff92394e2045320ee80c71e167ff660fecc37 | b364c42e0ddf1374db185155fe30708ddf15acc6 | refs/heads/master | 2021-06-18T05:28:07.860942 | 2017-06-10T04:26:49 | 2017-06-10T04:26:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,100 | java | /*
* Copyright (c) 2017 - present, Xuan Wang
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*
*/
package edu.ucsb.cs.cs185.foliostation.utilities;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
/**
* Created by xuanwang on 2/25/17.
*/
public class ImageUtilities {
public static Bitmap scale(Bitmap realImage, float maxImageSize,
boolean filter) {
float ratio = Math.min(
maxImageSize / realImage.getWidth(),
maxImageSize / realImage.getHeight());
int width = Math.round( ratio * realImage.getWidth());
int height = Math.round( ratio * realImage.getHeight());
Bitmap newBitmap = Bitmap.createScaledBitmap(realImage, width,
height, filter);
return newBitmap;
}
public static int convertDpToPixel(Context context, int dp){
Resources resources = context.getResources();
DisplayMetrics metrics = resources.getDisplayMetrics();
float px = dp * ((float)metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);
return (int)px;
}
public static int getScreenXYmaxDimension(Context context){
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
int maxXYScreenSize = Math.max(displayMetrics.heightPixels, displayMetrics.widthPixels);
return maxXYScreenSize;
}
public static int getThumbnailPixelSize(Context context, int dp){
return convertDpToPixel(context, dp);
}
public static Drawable scale(Context context, Drawable image, int size) {
Bitmap b = ((BitmapDrawable)image).getBitmap();
Bitmap bitmapResized = Bitmap.createScaledBitmap(b, size, size, false);
return new BitmapDrawable(context.getResources(), bitmapResized);
}
}
| [
"xuan-wang@outlook.com"
] | xuan-wang@outlook.com |
e7370aae40a92de45bb9e099168c3da13c7ebdef | 8cce2550835f1389b75369dda05e91a552403179 | /src/main/java/com/tmq/food4u/util/Generator.java | 6419cca8eb589321eacb9db7c576522ae5de75d6 | [] | no_license | stefanofiorenza/spring-boot-rest-api-template | 67d98c591c6d5592549728c23778d2158ff03124 | 6a30751b00db8e310b809436e0ef50ad4626f62c | refs/heads/master | 2022-02-23T19:57:50.002009 | 2019-08-11T11:14:43 | 2019-08-11T11:14:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 294 | java | package com.tmq.food4u.util;
import com.tmq.food4u.dao.entity.User;
/**
* Author: quytm
* Email : minhquylt95@gmail.com
* Date : Aug 05, 2019
*/
public class Generator {
public static String generateToke(User user) {
return user.getId() + "_" + user.getUsername();
}
}
| [
"minhquylt95@gmail.com"
] | minhquylt95@gmail.com |
50d45d9902ec8306137dcd9f788ab55f41495627 | 1f87a5322010e61977b1ab35ae50f21b8d725b16 | /bytebank-herdado-conta/src/br/com/bytebank/banco/modelo/ContaCorrente.java | 55e5904bfdb10d77272481c3886d98b65f023ab0 | [] | no_license | GHenrique22/eclipse-workspace | 8ebe0eb0549de3284406c31400cae1ed766cd04e | 0c13fa128d17073a49b3969147de1c8a8c6103fe | refs/heads/master | 2020-05-18T02:35:03.846016 | 2020-01-21T15:06:45 | 2020-01-21T15:06:45 | 184,121,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 584 | java | package br.com.bytebank.banco.modelo;
public class ContaCorrente extends Conta implements Tributavel {
public ContaCorrente(int agencia, int numero) {
super(agencia, numero);
}
@Override
public void saca(double valor) throws SaldoInsuficienteException {
double ValorASacar = valor + 0.2;
super.saca(ValorASacar);
}
@Override
public void deposita(double valor) {
super.saldo += valor;
}
@Override
public double getValorImposto() {
return super.saldo * 0.01;
}
@Override
public String toString() {
return "Conta concorrente: " + super.toString();
}
}
| [
"btkgustavo@gmail.com"
] | btkgustavo@gmail.com |
6954aacad1802d3dfe4688a9332178c4417c16ee | 8604f2d1e480f89817957470fbe4ae2faa71ba4d | /src/com/tzutalin/dlib/PeopleDet.java | 4e336dff3b10eb0135571f448b98531e99d7d30e | [] | no_license | zhencang/FacialLandmarkAndroid | 0ba93486d81fb665c5900973132b14cb70d8fc30 | a3ef067e98c832620745a9f521db9ffb217bbc60 | refs/heads/master | 2021-01-19T12:24:52.989230 | 2017-03-22T08:56:17 | 2017-03-22T08:56:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,494 | java | /*
* Copyright (C) 2015 TzuTaLin
*
* 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.tzutalin.dlib;
import android.content.Context;
import android.graphics.Bitmap;
import android.util.Log;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Tzutalin on 2015/10/20.
*/
public class PeopleDet {
private static final String TAG = "main";
protected static boolean sInitialized = false;
static {
try {
System.loadLibrary("people_det");
jniNativeClassInit();
sInitialized = true;
android.util.Log.d("main", "jniNativeClassInit success");
} catch (UnsatisfiedLinkError e) {
android.util.Log.d("main", "library not found!");
}
}
protected Context mContext;
public List<VisionDetRet> detBitmapFace(Bitmap mBitmap) {
int w = mBitmap.getWidth();
int h = mBitmap.getHeight();
int[] pix = new int[w * h];
mBitmap.getPixels(pix, 0, w, 0, 0, w, h);
List<VisionDetRet> ret = new ArrayList<VisionDetRet>();
String landmarkPath = "";
// If landmark exits , then use it
if (new File(Constants.getFaceShapeModelPath()).exists()) {
landmarkPath = Constants.getFaceShapeModelPath();
}
Log.d("main", "landmark file "+landmarkPath);
int size = jniBitmapFaceDect(pix, w,h,landmarkPath);
Log.d("main", "face size"+size);
for (int i = 0; i != size; i++) {
VisionDetRet det = new VisionDetRet();
int success = jniGetDLibHOGFaceRet(det, i);
if (success >= 0) {
ret.add(det);
}
}
return ret;
}
private native static void jniNativeClassInit();
private native int jniGetDLibHOGFaceRet(VisionDetRet det, int index);
//Bitmap
private native int jniBitmapFaceDect(int[] image,int w,int h,String landmarkModelPath);
}
| [
"1142749677@qq.com"
] | 1142749677@qq.com |
adc14e707a2dd834172d0d467fdfa4c0012fe86e | 6dc818eac00d33bb873402b40f2828090800b0c4 | /JSP 폴더/JSP Files/210320_sourcecode/webStudy01/src/kr/or/ddit/enumpkg/MimeType.java | a09fc89b981d7fff147dafaed4d56fe5451835c6 | [] | no_license | JeonghoonWon/ddit | 0df0d29db4a2a1e15a7754adddb6fb5ef87935be | 478812565f3c2ed297e80bc69a5699c58c1dfdb8 | refs/heads/master | 2023-06-01T18:42:04.310131 | 2021-06-29T07:48:42 | 2021-06-29T07:48:42 | 342,758,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 691 | java | package kr.or.ddit.enumpkg;
public enum MimeType {
JSON("application/json;charset=UTF-8"),
XML("application/xml;charset=UTF-8"),
PLAIN("text/plain;charset=UTF-8"),
HTML("text/html;charset=UTF-8");
private MimeType(String mime) {
this.mime = mime;
}
private String mime;
public String getMime() {
return mime;
}
public static MimeType searchMimeType(String accept) {
accept = accept.toUpperCase();
MimeType searched = HTML;
for(MimeType tmp : values()) {
if(accept.contains(tmp.name())) {
searched = tmp;
break;
}
}
return searched;
}
public static String getMimeText(String accept) {
return searchMimeType(accept).getMime();
}
}
| [
"expedition1205@gmail.com"
] | expedition1205@gmail.com |
5cd79107e1c5a78f6d83af605528d32b446b1586 | 5542f383c4cb91695aca6e39942d301b6f576aff | /src/main/java/frc/robot/commands/ElevatorClimb.java | ba1f611462a6fab916dfac22280e14ccf86f5cd3 | [] | no_license | HastingsSecondaryCollege/Hastings-Heroes-FRC-2019 | eb557fc3c4f5b9059afbcb873797aa5e2781cb38 | 8bf803f30a858018152598817388e5677e7e8608 | refs/heads/master | 2020-12-01T05:45:56.277013 | 2019-12-28T05:33:06 | 2019-12-28T05:33:06 | 230,569,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,043 | java | /*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot.commands;
import edu.wpi.first.wpilibj.command.Command;
import frc.robot.Robot;
import frc.robot.RobotMap;
import com.ctre.phoenix.motorcontrol.ControlMode;
public class ElevatorClimb extends Command {
public int m_ClimbLevel;
public ElevatorClimb(int ClimbLevel) {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
requires(Robot.elevatorSub);
m_ClimbLevel = ClimbLevel;
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
if (m_ClimbLevel == RobotMap.CLIMB_LEVEL_THREE) {
Robot.TalonElevator.set(ControlMode.Position, RobotMap.ENCODER_BEFORE_LEVEL_THREE_CLIMB);
} else {
Robot.TalonElevator.set(ControlMode.Position, RobotMap.ENCODER_BEFORE_LEVEL_TWO_CLIMB);
}
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
}
// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return Robot.timeyClimbey.get() >= RobotMap.HAB_CLIMB_DELAY;
}
// Called once after isFinished returns true
@Override
protected void end() {
Robot.TalonElevator.configPeakOutputForward(RobotMap.ELEVATOR_MAX_CLIMB_SPEED);
Robot.TalonElevator.set(ControlMode.Position, RobotMap.ENCODER_LEVEL_AFTER_CLIMB);
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
}
}
| [
"47234669+TestStudent6508@users.noreply.github.com"
] | 47234669+TestStudent6508@users.noreply.github.com |
6bfcf26b753f2ad97070e6b66f766f7d54e7ff72 | 532e3f4530353fdf9b6befb8a88c1dd450f42c36 | /ddog/src/main/java/com/foogaro/datadog/ddog/command/ping/Ping.java | f8bceb4ee96e4d44b87dff04fdd0de838ae4f330 | [
"GPL-3.0-only",
"BSD-3-Clause"
] | permissive | DataDog/Miscellany | 9aad31b7ac2d635c1a9dd9af8f4ab927c9914e3a | b55849ab0b2ec95642d4082a834218b32276884e | refs/heads/master | 2023-08-10T20:20:41.437060 | 2022-09-23T06:40:40 | 2022-09-23T06:40:40 | 48,389,989 | 204 | 149 | BSD-3-Clause | 2023-07-21T13:35:55 | 2015-12-21T19:27:04 | Python | UTF-8 | Java | false | false | 4,001 | java | package com.foogaro.datadog.ddog.command.ping;
import com.foogaro.datadog.ddog.command.ping.client.NettyUdpClient;
import com.foogaro.datadog.ddog.command.ping.server.NettyUdpServer;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFuture;
import io.netty.channel.socket.DatagramPacket;
import io.netty.util.CharsetUtil;
import picocli.CommandLine;
import java.net.InetSocketAddress;
import java.util.Locale;
import static com.foogaro.datadog.ddog.DDogConsts.*;
@CommandLine.Command(name = "ping", helpCommand = true, description = "Used to check connectivity between servers.", mixinStandardHelpOptions = true)
public class Ping implements Runnable {
@CommandLine.Spec
CommandLine.Model.CommandSpec spec;
@CommandLine.Option(names = {"--message"}, description = "The message to send over the wire.", required = true)
private String message;
@CommandLine.Option(names = {"--mode"}, description = "The mode to be used: client or server.", required = true)
private String mode;
@CommandLine.Option(names = {"--bind-address"}, description = "Bind address. Default is " + DEFAULT_PING_BIND_ADDRESS + ".")
private String bindAddress = DEFAULT_PING_BIND_ADDRESS;
@CommandLine.Option(names = {"--bind-port"}, description = "Server port. Default is " + DEFAULT_PING_BIND_PORT + ".")
private int bindPort = DEFAULT_PING_BIND_PORT;
@CommandLine.Option(names = {"--target-host"}, description = "Target host:port pairs. Default is " + DEFAULT_PING_TARGET_HOST + ".")
private String targetHost = DEFAULT_PING_TARGET_HOST;
@CommandLine.Option(names = {"--target-port"}, description = "Target port. Default is " + DEFAULT_PING_TARGET_PORT + ".")
private int targetPort = DEFAULT_PING_TARGET_PORT;
@CommandLine.Option(names = "--verbose", description = "Verbose output of the command. Default is false.")
private boolean verbose = Boolean.FALSE;
@Override
public void run() {
dumpParameters();
PingMode pingMode = PingMode.valueOf(mode.toUpperCase());
switch (pingMode) {
case CLIENT:
client();
case SERVER:
server();
default:
throw new AssertionError("The mode must be client or server.");
}
}
private void dumpParameters() {
System.out.println("Parameters");
System.out.println("\tmessage: " + message);
System.out.println("\tmode: " + mode);
System.out.println("\tbind-address: " + bindAddress);
System.out.println("\tbind-port: " + bindPort);
System.out.println("\ttarget-host: " + targetHost);
System.out.println("\ttarget-port: " + targetPort);
System.out.println("\tverbose: " + verbose);
}
private void client() {
InetSocketAddress remoteAddress = new InetSocketAddress(targetHost, targetPort);
NettyUdpClient client = new NettyUdpClient(targetHost, targetPort);
try {
ChannelFuture channelFuture = client.start();
System.out.println("Client sending message " + message + " to server");
ByteBuf byteBuf = Unpooled.copiedBuffer(message, CharsetUtil.UTF_8);
client.write(new DatagramPacket(byteBuf, remoteAddress));
// Wait until the connection is closed.
channelFuture.channel().closeFuture().sync();
} catch (Exception ex) {
System.err.println(ex.getMessage());
}
}
private void server() {
NettyUdpServer server = null;
try {
server = new NettyUdpServer(bindAddress, bindPort);
ChannelFuture future = server.start();
// Wait until the connection is closed.
future.channel().closeFuture().sync();
} catch (InterruptedException ex) {
System.err.println(ex.getMessage());
}
}
public enum PingMode {
CLIENT,
SERVER
}
}
| [
"l.fugaro@gmail.com"
] | l.fugaro@gmail.com |
f42769b34d93a63ef11511267e358a6f23e3aed2 | 7d3e493b453f2a8790ee033e31f5f1586d60ac9d | /app/src/test/java/com/example/pratyush/learningjunction/ExampleUnitTest.java | 5acd7ab7b975451b5c1b64b282e61199bec6b844 | [] | no_license | space4pratyush/Learning-Junction | 780b798b268724c489f0a1c829c0706048fa71cf | 5b686184937ad4dc7aa1412b914579eb24e38552 | refs/heads/master | 2020-03-25T22:43:36.135469 | 2018-08-28T07:12:24 | 2018-08-28T07:12:24 | 144,238,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.example.pratyush.learningjunction;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"pratyushkumar92@gmail.com"
] | pratyushkumar92@gmail.com |
900566b176ca14715acbe18c0999d238e7d2b904 | 0747edaa0b193e8c64fc5cb1d3a51ceff2e81853 | /Condicional4.java | d8a96f919ec3048cc778a6bdeda047186295fdc5 | [
"MIT"
] | permissive | nataliaellem/OOP | e8802d16fac10198ed6795ae00b54c1da5c37064 | bc352ecc2982bb4cede17a7b9842d06f95ee7c39 | refs/heads/main | 2023-08-23T03:36:53.719868 | 2021-10-20T23:44:23 | 2021-10-20T23:44:23 | 332,340,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 826 | java | import java.util.Scanner;
public class Condicional4 {
public static void main(String args[]){
Scanner input = new Scanner(System.in);
int num;
System.out.print("Digite a nota: ");
num = input.nextInt();
if (num >= 0 && num < 40){
System.out.print("Conceito F\n");
}
else if (num >= 40 && num < 60){
System.out.print("Conceito E\n");
}
else if (num >= 60 && num < 70){
System.out.print("Conceito D\n");
}
else if (num >= 70 && num < 80){
System.out.print("Conceito C\n");
}
else if (num >= 80 && num < 90){
System.out.print("Conceito B\n");
}
else if (num >= 90 && num <= 100){
System.out.print("Conceito A\n");
}
}
} | [
"nataliaem212@gmail.com"
] | nataliaem212@gmail.com |
027755d7c5727b1ac0d042f242beaad5a8f0db74 | 81ce28189320c1c752da71f67ddc6258563a68e1 | /src/java/awt/Robot.java | ada32f150579597b780570e7aadb166527cab881 | [] | no_license | gxstax/jdk1.8-source | b4ec18f497cc360c4f26cd9b6900d088aa521d6b | 1eac0bc92f4a46c5017c20cfc6cf0d6f123da732 | refs/heads/master | 2022-12-02T18:37:05.190465 | 2020-08-22T09:41:24 | 2020-08-22T09:41:24 | 281,435,589 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,266 | java | /*
* Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.awt;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.awt.image.DirectColorModel;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
import java.awt.peer.RobotPeer;
import java.lang.reflect.InvocationTargetException;
import sun.awt.ComponentFactory;
import sun.awt.SunToolkit;
import sun.awt.image.SunWritableRaster;
import sun.security.util.SecurityConstants;
/**
* This class is used to generate native system input events
* for the purposes of test automation, self-running demos, and
* other applications where control of the mouse and keyboard
* is needed. The primary purpose of Robot is to facilitate
* automated testing of Java platform implementations.
* <p>
* Using the class to generate input events differs from posting
* events to the AWT event queue or AWT components in that the
* events are generated in the platform's native input
* queue. For example, <code>Robot.mouseMove</code> will actually move
* the mouse cursor instead of just generating mouse move events.
* <p>
* Note that some platforms require special privileges or extensions
* to access low-level input control. If the current platform configuration
* does not allow input control, an <code>AWTException</code> will be thrown
* when trying to construct Robot objects. For example, X-Window systems
* will throw the exception if the XTEST 2.2 standard extension is not supported
* (or not enabled) by the X server.
* <p>
* Applications that use Robot for purposes other than self-testing should
* handle these error conditions gracefully.
*
* @author Robi Khan
* @since 1.3
*/
public class Robot {
private static final int MAX_DELAY = 60000;
private RobotPeer peer;
private boolean isAutoWaitForIdle = false;
private int autoDelay = 0;
private static int LEGAL_BUTTON_MASK = 0;
// location of robot's GC, used in mouseMove(), getPixelColor() and captureScreenImage()
private Point gdLoc;
private DirectColorModel screenCapCM = null;
/**
* Constructs a Robot object in the coordinate system of the primary screen.
* <p>
*
* @throws AWTException if the platform configuration does not allow
* low-level input control. This exception is always thrown when
* GraphicsEnvironment.isHeadless() returns true
* @throws SecurityException if <code>createRobot</code> permission is not granted
* @see GraphicsEnvironment#isHeadless
* @see SecurityManager#checkPermission
* @see AWTPermission
*/
public Robot() throws AWTException {
if (GraphicsEnvironment.isHeadless()) {
throw new AWTException("headless environment");
}
init(GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice());
}
/**
* Creates a Robot for the given screen device. Coordinates passed
* to Robot method calls like mouseMove and createScreenCapture will
* be interpreted as being in the same coordinate system as the
* specified screen. Note that depending on the platform configuration,
* multiple screens may either:
* <ul>
* <li>share the same coordinate system to form a combined virtual screen</li>
* <li>use different coordinate systems to act as independent screens</li>
* </ul>
* This constructor is meant for the latter case.
* <p>
* If screen devices are reconfigured such that the coordinate system is
* affected, the behavior of existing Robot objects is undefined.
*
* @param screen A screen GraphicsDevice indicating the coordinate
* system the Robot will operate in.
* @throws AWTException if the platform configuration does not allow
* low-level input control. This exception is always thrown when
* GraphicsEnvironment.isHeadless() returns true.
* @throws IllegalArgumentException if <code>screen</code> is not a screen
* GraphicsDevice.
* @throws SecurityException if <code>createRobot</code> permission is not granted
* @see GraphicsEnvironment#isHeadless
* @see GraphicsDevice
* @see SecurityManager#checkPermission
* @see AWTPermission
*/
public Robot(GraphicsDevice screen) throws AWTException {
checkIsScreenDevice(screen);
init(screen);
}
private void init(GraphicsDevice screen) throws AWTException {
checkRobotAllowed();
gdLoc = screen.getDefaultConfiguration().getBounds().getLocation();
Toolkit toolkit = Toolkit.getDefaultToolkit();
if (toolkit instanceof ComponentFactory) {
peer = ((ComponentFactory)toolkit).createRobot(this, screen);
disposer = new RobotDisposer(peer);
sun.java2d.Disposer.addRecord(anchor, disposer);
}
initLegalButtonMask();
}
private static synchronized void initLegalButtonMask() {
if (LEGAL_BUTTON_MASK != 0) return;
int tmpMask = 0;
if (Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled()){
if (Toolkit.getDefaultToolkit() instanceof SunToolkit) {
final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
for (int i = 0; i < buttonsNumber; i++){
tmpMask |= InputEvent.getMaskForButton(i+1);
}
}
}
tmpMask |= InputEvent.BUTTON1_MASK|
InputEvent.BUTTON2_MASK|
InputEvent.BUTTON3_MASK|
InputEvent.BUTTON1_DOWN_MASK|
InputEvent.BUTTON2_DOWN_MASK|
InputEvent.BUTTON3_DOWN_MASK;
LEGAL_BUTTON_MASK = tmpMask;
}
/* determine if the security policy allows Robot's to be created */
private void checkRobotAllowed() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(SecurityConstants.AWT.CREATE_ROBOT_PERMISSION);
}
}
/* check if the given device is a screen device */
private void checkIsScreenDevice(GraphicsDevice device) {
if (device == null || device.getType() != GraphicsDevice.TYPE_RASTER_SCREEN) {
throw new IllegalArgumentException("not a valid screen device");
}
}
private transient Object anchor = new Object();
static class RobotDisposer implements sun.java2d.DisposerRecord {
private final RobotPeer peer;
public RobotDisposer(RobotPeer peer) {
this.peer = peer;
}
public void dispose() {
if (peer != null) {
peer.dispose();
}
}
}
private transient RobotDisposer disposer;
/**
* Moves mouse pointer to given screen coordinates.
* @param x X position
* @param y Y position
*/
public synchronized void mouseMove(int x, int y) {
peer.mouseMove(gdLoc.x + x, gdLoc.y + y);
afterEvent();
}
/**
* Presses one or more mouse buttons. The mouse buttons should
* be released using the {@link #mouseRelease(int)} method.
*
* @param buttons the Button mask; a combination of one or more
* mouse button masks.
* <p>
* It is allowed to use only a combination of valid values as a {@code buttons} parameter.
* A valid combination consists of {@code InputEvent.BUTTON1_DOWN_MASK},
* {@code InputEvent.BUTTON2_DOWN_MASK}, {@code InputEvent.BUTTON3_DOWN_MASK}
* and values returned by the
* {@link InputEvent#getMaskForButton(int) InputEvent.getMaskForButton(button)} method.
*
* The valid combination also depends on a
* {@link Toolkit#areExtraMouseButtonsEnabled() Toolkit.areExtraMouseButtonsEnabled()} value as follows:
* <ul>
* <li> If support for extended mouse buttons is
* {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
* then it is allowed to use only the following standard button masks:
* {@code InputEvent.BUTTON1_DOWN_MASK}, {@code InputEvent.BUTTON2_DOWN_MASK},
* {@code InputEvent.BUTTON3_DOWN_MASK}.
* <li> If support for extended mouse buttons is
* {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java
* then it is allowed to use the standard button masks
* and masks for existing extended mouse buttons, if the mouse has more then three buttons.
* In that way, it is allowed to use the button masks corresponding to the buttons
* in the range from 1 to {@link MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}.
* <br>
* It is recommended to use the {@link InputEvent#getMaskForButton(int) InputEvent.getMaskForButton(button)}
* method to obtain the mask for any mouse button by its number.
* </ul>
* <p>
* The following standard button masks are also accepted:
* <ul>
* <li>{@code InputEvent.BUTTON1_MASK}
* <li>{@code InputEvent.BUTTON2_MASK}
* <li>{@code InputEvent.BUTTON3_MASK}
* </ul>
* However, it is recommended to use {@code InputEvent.BUTTON1_DOWN_MASK},
* {@code InputEvent.BUTTON2_DOWN_MASK}, {@code InputEvent.BUTTON3_DOWN_MASK} instead.
* Either extended {@code _DOWN_MASK} or old {@code _MASK} values
* should be used, but both those models should not be mixed.
* @throws IllegalArgumentException if the {@code buttons} mask contains the mask for extra mouse button
* and support for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
* @throws IllegalArgumentException if the {@code buttons} mask contains the mask for extra mouse button
* that does not exist on the mouse and support for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java
* @see #mouseRelease(int)
* @see InputEvent#getMaskForButton(int)
* @see Toolkit#areExtraMouseButtonsEnabled()
* @see MouseInfo#getNumberOfButtons()
* @see java.awt.event.MouseEvent
*/
public synchronized void mousePress(int buttons) {
checkButtonsArgument(buttons);
peer.mousePress(buttons);
afterEvent();
}
/**
* Releases one or more mouse buttons.
*
* @param buttons the Button mask; a combination of one or more
* mouse button masks.
* <p>
* It is allowed to use only a combination of valid values as a {@code buttons} parameter.
* A valid combination consists of {@code InputEvent.BUTTON1_DOWN_MASK},
* {@code InputEvent.BUTTON2_DOWN_MASK}, {@code InputEvent.BUTTON3_DOWN_MASK}
* and values returned by the
* {@link InputEvent#getMaskForButton(int) InputEvent.getMaskForButton(button)} method.
*
* The valid combination also depends on a
* {@link Toolkit#areExtraMouseButtonsEnabled() Toolkit.areExtraMouseButtonsEnabled()} value as follows:
* <ul>
* <li> If the support for extended mouse buttons is
* {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
* then it is allowed to use only the following standard button masks:
* {@code InputEvent.BUTTON1_DOWN_MASK}, {@code InputEvent.BUTTON2_DOWN_MASK},
* {@code InputEvent.BUTTON3_DOWN_MASK}.
* <li> If the support for extended mouse buttons is
* {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java
* then it is allowed to use the standard button masks
* and masks for existing extended mouse buttons, if the mouse has more then three buttons.
* In that way, it is allowed to use the button masks corresponding to the buttons
* in the range from 1 to {@link MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}.
* <br>
* It is recommended to use the {@link InputEvent#getMaskForButton(int) InputEvent.getMaskForButton(button)}
* method to obtain the mask for any mouse button by its number.
* </ul>
* <p>
* The following standard button masks are also accepted:
* <ul>
* <li>{@code InputEvent.BUTTON1_MASK}
* <li>{@code InputEvent.BUTTON2_MASK}
* <li>{@code InputEvent.BUTTON3_MASK}
* </ul>
* However, it is recommended to use {@code InputEvent.BUTTON1_DOWN_MASK},
* {@code InputEvent.BUTTON2_DOWN_MASK}, {@code InputEvent.BUTTON3_DOWN_MASK} instead.
* Either extended {@code _DOWN_MASK} or old {@code _MASK} values
* should be used, but both those models should not be mixed.
* @throws IllegalArgumentException if the {@code buttons} mask contains the mask for extra mouse button
* and support for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
* @throws IllegalArgumentException if the {@code buttons} mask contains the mask for extra mouse button
* that does not exist on the mouse and support for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java
* @see #mousePress(int)
* @see InputEvent#getMaskForButton(int)
* @see Toolkit#areExtraMouseButtonsEnabled()
* @see MouseInfo#getNumberOfButtons()
* @see java.awt.event.MouseEvent
*/
public synchronized void mouseRelease(int buttons) {
checkButtonsArgument(buttons);
peer.mouseRelease(buttons);
afterEvent();
}
private void checkButtonsArgument(int buttons) {
if ( (buttons|LEGAL_BUTTON_MASK) != LEGAL_BUTTON_MASK ) {
throw new IllegalArgumentException("Invalid combination of button flags");
}
}
/**
* Rotates the scroll wheel on wheel-equipped mice.
*
* @param wheelAmt number of "notches" to move the mouse wheel
* Negative values indicate movement up/away from the user,
* positive values indicate movement down/towards the user.
*
* @since 1.4
*/
public synchronized void mouseWheel(int wheelAmt) {
peer.mouseWheel(wheelAmt);
afterEvent();
}
/**
* Presses a given key. The key should be released using the
* <code>keyRelease</code> method.
* <p>
* Key codes that have more than one physical key associated with them
* (e.g. <code>KeyEvent.VK_SHIFT</code> could mean either the
* left or right shift key) will map to the left key.
*
* @param keycode Key to press (e.g. <code>KeyEvent.VK_A</code>)
* @throws IllegalArgumentException if <code>keycode</code> is not
* a valid key
* @see #keyRelease(int)
* @see KeyEvent
*/
public synchronized void keyPress(int keycode) {
checkKeycodeArgument(keycode);
peer.keyPress(keycode);
afterEvent();
}
/**
* Releases a given key.
* <p>
* Key codes that have more than one physical key associated with them
* (e.g. <code>KeyEvent.VK_SHIFT</code> could mean either the
* left or right shift key) will map to the left key.
*
* @param keycode Key to release (e.g. <code>KeyEvent.VK_A</code>)
* @throws IllegalArgumentException if <code>keycode</code> is not a
* valid key
* @see #keyPress(int)
* @see KeyEvent
*/
public synchronized void keyRelease(int keycode) {
checkKeycodeArgument(keycode);
peer.keyRelease(keycode);
afterEvent();
}
private void checkKeycodeArgument(int keycode) {
// rather than build a big table or switch statement here, we'll
// just check that the key isn't VK_UNDEFINED and assume that the
// peer implementations will throw an exception for other bogus
// values e.g. -1, 999999
if (keycode == KeyEvent.VK_UNDEFINED) {
throw new IllegalArgumentException("Invalid key code");
}
}
/**
* Returns the color of a pixel at the given screen coordinates.
* @param x X position of pixel
* @param y Y position of pixel
* @return Color of the pixel
*/
public synchronized Color getPixelColor(int x, int y) {
Color color = new Color(peer.getRGBPixel(gdLoc.x + x, gdLoc.y + y));
return color;
}
/**
* Creates an image containing pixels read from the screen. This image does
* not include the mouse cursor.
* @param screenRect Rect to capture in screen coordinates
* @return The captured image
* @throws IllegalArgumentException if <code>screenRect</code> width and height are not greater than zero
* @throws SecurityException if <code>readDisplayPixels</code> permission is not granted
* @see SecurityManager#checkPermission
* @see AWTPermission
*/
public synchronized BufferedImage createScreenCapture(Rectangle screenRect) {
checkScreenCaptureAllowed();
// according to the spec, screenRect is relative to robot's GD
Rectangle translatedRect = new Rectangle(screenRect);
translatedRect.translate(gdLoc.x, gdLoc.y);
checkValidRect(translatedRect);
BufferedImage image;
DataBufferInt buffer;
WritableRaster raster;
if (screenCapCM == null) {
/*
* Fix for 4285201
* Create a DirectColorModel equivalent to the default RGB ColorModel,
* except with no Alpha component.
*/
screenCapCM = new DirectColorModel(24,
/* red mask */ 0x00FF0000,
/* green mask */ 0x0000FF00,
/* blue mask */ 0x000000FF);
}
// need to sync the toolkit prior to grabbing the pixels since in some
// cases rendering to the screen may be delayed
Toolkit.getDefaultToolkit().sync();
int pixels[];
int[] bandmasks = new int[3];
pixels = peer.getRGBPixels(translatedRect);
buffer = new DataBufferInt(pixels, pixels.length);
bandmasks[0] = screenCapCM.getRedMask();
bandmasks[1] = screenCapCM.getGreenMask();
bandmasks[2] = screenCapCM.getBlueMask();
raster = Raster.createPackedRaster(buffer, translatedRect.width, translatedRect.height, translatedRect.width, bandmasks, null);
SunWritableRaster.makeTrackable(buffer);
image = new BufferedImage(screenCapCM, raster, false, null);
return image;
}
private static void checkValidRect(Rectangle rect) {
if (rect.width <= 0 || rect.height <= 0) {
throw new IllegalArgumentException("Rectangle width and height must be > 0");
}
}
private static void checkScreenCaptureAllowed() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(
SecurityConstants.AWT.READ_DISPLAY_PIXELS_PERMISSION);
}
}
/*
* Called after an event is generated
*/
private void afterEvent() {
autoWaitForIdle();
autoDelay();
}
/**
* Returns whether this Robot automatically invokes <code>waitForIdle</code>
* after generating an event.
* @return Whether <code>waitForIdle</code> is automatically called
*/
public synchronized boolean isAutoWaitForIdle() {
return isAutoWaitForIdle;
}
/**
* Sets whether this Robot automatically invokes <code>waitForIdle</code>
* after generating an event.
* @param isOn Whether <code>waitForIdle</code> is automatically invoked
*/
public synchronized void setAutoWaitForIdle(boolean isOn) {
isAutoWaitForIdle = isOn;
}
/*
* Calls waitForIdle after every event if so desired.
*/
private void autoWaitForIdle() {
if (isAutoWaitForIdle) {
waitForIdle();
}
}
/**
* Returns the number of milliseconds this Robot sleeps after generating an event.
*/
public synchronized int getAutoDelay() {
return autoDelay;
}
/**
* Sets the number of milliseconds this Robot sleeps after generating an event.
* @throws IllegalArgumentException If <code>ms</code> is not between 0 and 60,000 milliseconds inclusive
*/
public synchronized void setAutoDelay(int ms) {
checkDelayArgument(ms);
autoDelay = ms;
}
/*
* Automatically sleeps for the specified interval after event generated.
*/
private void autoDelay() {
delay(autoDelay);
}
/**
* Sleeps for the specified time.
* To catch any <code>InterruptedException</code>s that occur,
* <code>Thread.sleep()</code> may be used instead.
* @param ms time to sleep in milliseconds
* @throws IllegalArgumentException if <code>ms</code> is not between 0 and 60,000 milliseconds inclusive
* @see Thread#sleep
*/
public synchronized void delay(int ms) {
checkDelayArgument(ms);
try {
Thread.sleep(ms);
} catch(InterruptedException ite) {
ite.printStackTrace();
}
}
private void checkDelayArgument(int ms) {
if (ms < 0 || ms > MAX_DELAY) {
throw new IllegalArgumentException("Delay must be to 0 to 60,000ms");
}
}
/**
* Waits until all events currently on the event queue have been processed.
* @throws IllegalThreadStateException if called on the AWT event dispatching thread
*/
public synchronized void waitForIdle() {
checkNotDispatchThread();
// post a dummy event to the queue so we know when
// all the events before it have been processed
try {
SunToolkit.flushPendingEvents();
EventQueue.invokeAndWait( new Runnable() {
public void run() {
// dummy implementation
}
} );
} catch(InterruptedException ite) {
System.err.println("Robot.waitForIdle, non-fatal exception caught:");
ite.printStackTrace();
} catch(InvocationTargetException ine) {
System.err.println("Robot.waitForIdle, non-fatal exception caught:");
ine.printStackTrace();
}
}
private void checkNotDispatchThread() {
if (EventQueue.isDispatchThread()) {
throw new IllegalThreadStateException("Cannot call method from the event dispatcher thread");
}
}
/**
* Returns a string representation of this Robot.
*
* @return the string representation.
*/
public synchronized String toString() {
String params = "autoDelay = "+getAutoDelay()+", "+"autoWaitForIdle = "+isAutoWaitForIdle();
return getClass().getName() + "[ " + params + " ]";
}
}
| [
"gaoxx@heytea.com"
] | gaoxx@heytea.com |
dfc99f379e46f01e96ac7b449d9ec9281caae432 | 115244b185356f4472a9b369813ed749710bb6a0 | /lkclass/src/main/java/tech/yunjing/biconlife/liblkclass/http/xhttp/request/UriRequestFactory.java | b55c673eddd3ae9f4f0b6b8c79a22e8f21117c16 | [] | no_license | yinianzhijian0425/CitySelectTest | 4edf1da483648b24d7a4f4da2716f58e8485e5d6 | 615b004ec61b8e0f43ebe4c9d71b68e107bf434e | refs/heads/master | 2021-08-19T19:45:05.189973 | 2017-11-27T08:40:15 | 2017-11-27T08:40:15 | 112,169,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,894 | java | package tech.yunjing.biconlife.liblkclass.http.xhttp.request;
import android.text.TextUtils;
import java.lang.reflect.Constructor;
import java.lang.reflect.Type;
import java.util.HashMap;
import tech.yunjing.biconlife.liblkclass.common.util.LKLogUtil;
import tech.yunjing.biconlife.liblkclass.http.xhttp.RequestParams;
import tech.yunjing.biconlife.liblkclass.http.xhttp.app.RequestTracker;
/**
* Created by wyouflf on 15/11/4.
* Uri请求创建工厂
*/
public final class UriRequestFactory {
private static Class<? extends RequestTracker> defaultTrackerCls;
private static final HashMap<String, Class<? extends UriRequest>>
SCHEME_CLS_MAP = new HashMap<String, Class<? extends UriRequest>>();
private UriRequestFactory() {
}
public static UriRequest getUriRequest(RequestParams params, Type loadType) throws Throwable {
// get scheme
String scheme = null;
String uri = params.getUri();
int index = uri.indexOf(":");
String startStr = "/";
if (index > 0) {
scheme = uri.substring(0, index);
} else if (uri.startsWith(startStr)) {
scheme = "file";
}
// get UriRequest
if (!TextUtils.isEmpty(scheme)) {
String http = "http";
String assets = "assets";
String file = "file";
Class<? extends UriRequest> cls = SCHEME_CLS_MAP.get(scheme);
if (cls != null) {
Constructor<? extends UriRequest> constructor
= cls.getConstructor(RequestParams.class, Class.class);
return constructor.newInstance(params, loadType);
} else {
if (scheme.startsWith(http)) {
return new HttpRequest(params, loadType);
} else if (assets.equals(scheme)) {
return new AssetsRequest(params, loadType);
} else if (file.equals(scheme)) {
return new LocalFileRequest(params, loadType);
} else {
throw new IllegalArgumentException("The url not be support: " + uri);
}
}
} else {
throw new IllegalArgumentException("The url not be support: " + uri);
}
}
public static void registerDefaultTrackerClass(Class<? extends RequestTracker> trackerCls) {
UriRequestFactory.defaultTrackerCls = trackerCls;
}
public static RequestTracker getDefaultTracker() {
try {
return defaultTrackerCls == null ? null : defaultTrackerCls.newInstance();
} catch (Throwable ex) {
LKLogUtil.e(ex.getMessage(), ex);
}
return null;
}
public static void registerRequestClass(String scheme, Class<? extends UriRequest> uriRequestCls) {
SCHEME_CLS_MAP.put(scheme, uriRequestCls);
}
}
| [
"dongxining@vv.cc"
] | dongxining@vv.cc |
3e6dbd788a1eb0b40a190773b7d363f5aa00b66c | 802934efe97183d1c07931c8a24edbd4dbf69d1f | /leetcode/java/reverseNodesInK.java | e6c6f07f51772a90b1dc036dd5aa76d65b525cb9 | [] | no_license | teaspring/problems | 153a3c37866c1f8310819e6e726a09735896a20d | f42230938daeb241f5f0ffddb5ab5de4b431004b | refs/heads/master | 2022-11-29T00:16:27.225454 | 2022-11-18T07:05:23 | 2022-11-18T09:42:52 | 12,702,541 | 5 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,583 | java | /*
* given a SLL, reverse every k nodes at a time and return is modified head
* if rest nodes less than k, remain them
* e.g, 1->2->3->4->5
* k=2, 2->1->4->3->5
* k=3, 3->2->1->4->5
* {1}, k=2, => {1}
* */
import java.io.*;
import java.util.*;
class ListNode{
int val;
ListNode next;
ListNode(int x){
val = x;
next = null;
}
}
public class reverseNodesInK{
private void reverse(ListNode pre, ListNode h, ListNode e, ListNode post){
if(h==null) return;
ListNode l1=h, l2=h.next, after = l2.next;
while(l2 != post){ //l1->l2->after => l1<-l2 after
l2.next = l1;
if(after == null) break;
l1 = l2;
l2 = after;
after = l2.next;
}
if(pre != null) pre.next = e;
h.next = post;
return;
}
public ListNode reverseKGroups(ListNode head, int k){
if(head==null || k<2) return head;
ListNode pre = null, h=head, post = null;
head = null;
while(h != null){
ListNode e = h;
int i=0;
for(i=1;i<k && e.next != null;++i){
e = e.next;
}
if(i<k) break;
post = e.next;
reverse(pre, h, e, post);
if(head==null) head = e;
pre = h; //move forward. after reverse, h becomes prev of post
h=post;
}
if(head == null) return h;
return head;
}
public static void main(String[] args){
return;
}
}
| [
"iceberg_yu@hotmail.com"
] | iceberg_yu@hotmail.com |
7b9dce3ea7384ffa4bb5f8438e6ecec134c085fe | b2f6d32815bfb0f81febbb60b31e0dc08c504cba | /Roteiro-Arvore-Binaria-de-Busca-environment/src/main/java/adt/bst/BSTNode.java | 79e35d23ad58460d7c270501fa0f44b4238e1381 | [] | no_license | anarcoqzn/roteirosLEDA | 6c36a5c42d8020793ce07d59c6aabf9449bc0d58 | 100d14401c71478444cb5c2d520a1ac4f63c375f | refs/heads/master | 2020-03-12T01:25:40.123678 | 2018-04-20T14:57:24 | 2018-04-20T14:57:24 | 130,376,081 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 119 | java | package adt.bst;
import adt.bt.BTNode;
public class BSTNode<T extends Comparable<T>> extends BTNode<T>{
}
| [
"anarcoqr@gmail.com"
] | anarcoqr@gmail.com |
1dfac78d115b6ddcceca6b4cc1c695c3eccb29e7 | c501583b9b998984eb52229b9d3c38cd8f93d86e | /src/main/java/com/tencentcloudapi/postgres/v20170312/models/OpenDBExtranetAccessRequest.java | aa83ee52016c6481bf13d3094dc376c898a18d00 | [
"Apache-2.0"
] | permissive | CoolLittle/tencentcloud-sdk-java | 20cf19d0648edda1a92d90e55b023a7c9774ffd4 | 9ed1f3da70a1e01df441ec23ca56973dc8c7f634 | refs/heads/master | 2020-03-25T20:36:42.081853 | 2018-08-06T03:11:32 | 2018-08-06T03:11:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,078 | java | package com.tencentcloudapi.postgres.v20170312.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class OpenDBExtranetAccessRequest extends AbstractModel{
/**
* 实例ID,形如postgres-hez4fh0v
*/
@SerializedName("DBInstanceId")
@Expose
private String DBInstanceId;
/**
* 获取实例ID,形如postgres-hez4fh0v
* @return DBInstanceId 实例ID,形如postgres-hez4fh0v
*/
public String getDBInstanceId() {
return this.DBInstanceId;
}
/**
* 设置实例ID,形如postgres-hez4fh0v
* @param DBInstanceId 实例ID,形如postgres-hez4fh0v
*/
public void setDBInstanceId(String DBInstanceId) {
this.DBInstanceId = DBInstanceId;
}
/**
* 内部实现,用户禁止调用
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "DBInstanceId", this.DBInstanceId);
}
}
| [
"tencentcloudapi@tencent.com"
] | tencentcloudapi@tencent.com |
27664ea21763978c76191b83eb22b1389c742c4a | c28f5816aeb737867f9d860e00adecdbaf52e27c | /amigosservices/fraud/src/main/java/com/amigoscode/fraud/FraudCheckService.java | 7ea7d6c83d3146349103634e1041ff3f159c297f | [] | no_license | gundambison/jasakeren | 3568f703493133925abfb5ba4a3b0f6306a86b00 | 07be43b9783b6707e2fddd761ae73bdb64277014 | refs/heads/master | 2023-04-27T15:29:10.931958 | 2023-04-24T08:21:31 | 2023-04-24T08:21:31 | 4,132,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 670 | java | package com.amigoscode.fraud;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
@Service
@AllArgsConstructor
public class FraudCheckService {
private final FraudCheckHistoryRepository fraudCheckHistoryRepository;
public boolean isFraudulentCustomer( Integer customerId){
fraudCheckHistoryRepository.save(
FraudCheckHistory.builder()
.customerId( customerId )
.isFraudster(false)
.createdAt( LocalDateTime.now() )
.build()
);
return false; //sementara
}
}
| [
"gundambison@gmail.com"
] | gundambison@gmail.com |
7908ff82799601e8e853dc68a3705f3d76b5456b | 3a57f66e22fd3f65034a320377853ec0e15c9ee2 | /src/leet/test/IntegerToRomanTest.java | 4b7b1685528e3e6538aa905c459bd02be1652bbc | [] | no_license | joyoinc/lc-java | 198b8265f6a1f53588164549c64af32391d96fc0 | b13514592042195ffd2f7a0ca15ee0a72e6caa20 | refs/heads/master | 2020-12-24T17:35:49.048238 | 2014-11-07T21:51:19 | 2014-11-07T21:51:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 319 | java | package leet.test;
import static org.junit.Assert.*;
import leet.Solution;
import org.junit.Test;
public class IntegerToRomanTest {
@Test
public void test() {
Solution sol = new Solution();
String res;
int num;
// add test case
res = "VII";
num = 7;
assertEquals(res, sol.intToRoman(num));
}
}
| [
"zhi.yuan.skywalker@gmail.com"
] | zhi.yuan.skywalker@gmail.com |
78e193ac91b992a4ea3af42e6163b9c268e0765d | a4ac6d6667571a50f13e2243adbbdd2237dea0ec | /TYJP/Programming/src/com/string/Q3.java | 9cfcf59900363fff2a2b5acb6c992067d856844a | [] | no_license | SHAIKTOUSIF/Test-Repository | 2d70ca35c66450cc974780ca0ba343bf867a45a7 | c6a7167de05aac31f083bd691b793b839145d6d3 | refs/heads/master | 2020-07-05T17:55:50.874800 | 2020-05-15T06:54:44 | 2020-05-15T06:54:44 | 202,719,646 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 904 | java | //3. Write a program to reverse first half separately and 2nd half separately?
package com.string;
import java.util.Scanner;
public class Q3 {
public static void main(String[] args) {
String reverse="";
String reverse1="";
System.out.println("Enter a string you want to reverse");
Scanner sc=new Scanner(System.in);
String str =sc.nextLine();
String word=str;
sc.close();
for(int i=(str.length()-1)/2;i>=0;i--)
{
reverse=reverse+str.charAt(i);
}
for(int j=(str.length()-1);j>=(str.length())/2;j--)
{
reverse1=reverse1+str.charAt(j);
}
//System.out.println(reverse+reverse1);
System.out.println("first half : "+reverse);
System.out.println("second half : "+reverse1);
if(reverse==word)
System.out.println("palindrome string");
//(string.length()+4)/2
else
System.out.println("Not a palindrome string");
}
}
| [
"tousif@LAPTOP-P04MERIM"
] | tousif@LAPTOP-P04MERIM |
82a4cfbb44b4878b5971fb7f915fce7f5c5a8231 | d450b62e0cebfcfc592350192cd424009c347733 | /jOOQ-test/examples/org/jooq/examples/sqlserver/adventureworks/sales/tables/records/StorecontactRecord.java | 5bc5aded0a476efd7c0d1d20fc5ee349b1f9d3e3 | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | rtincar/jOOQ | 9ccec69ff0d4af5217829413c1132a0d08acded8 | d0304fdfa77c0a8fd79614f7ff72b558783ec6a8 | refs/heads/master | 2020-12-25T11:21:22.173304 | 2012-03-01T16:32:48 | 2012-03-01T16:32:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,088 | java | /**
* This class is generated by jOOQ
*/
package org.jooq.examples.sqlserver.adventureworks.sales.tables.records;
/**
* This class is generated by jOOQ.
*/
@javax.persistence.Entity
@javax.persistence.Table(name = "StoreContact", schema = "Sales", uniqueConstraints = {
@javax.persistence.UniqueConstraint(columnNames = {"CustomerID", "ContactID"})
})
public class StorecontactRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.examples.sqlserver.adventureworks.sales.tables.records.StorecontactRecord> {
private static final long serialVersionUID = 1308727119;
/**
* An uncommented item
*
* PRIMARY KEY
* <p>
* <code><pre>
* CONSTRAINT FK_StoreContact_Store_CustomerID
* FOREIGN KEY (CustomerID)
* REFERENCES Sales.Store (CustomerID)
* </pre></code>
*/
public void setCustomerid(java.lang.Integer value) {
setValue(org.jooq.examples.sqlserver.adventureworks.sales.tables.Storecontact.STORECONTACT.CUSTOMERID, value);
}
/**
* An uncommented item
*
* PRIMARY KEY
* <p>
* <code><pre>
* CONSTRAINT FK_StoreContact_Store_CustomerID
* FOREIGN KEY (CustomerID)
* REFERENCES Sales.Store (CustomerID)
* </pre></code>
*/
@javax.persistence.Column(name = "CustomerID")
public java.lang.Integer getCustomerid() {
return getValue(org.jooq.examples.sqlserver.adventureworks.sales.tables.Storecontact.STORECONTACT.CUSTOMERID);
}
/**
* An uncommented item
*
* PRIMARY KEY
* <p>
* <code><pre>
* CONSTRAINT FK_StoreContact_Contact_ContactID
* FOREIGN KEY (ContactID)
* REFERENCES Person.Contact (ContactID)
* </pre></code>
*/
public void setContactid(java.lang.Integer value) {
setValue(org.jooq.examples.sqlserver.adventureworks.sales.tables.Storecontact.STORECONTACT.CONTACTID, value);
}
/**
* An uncommented item
*
* PRIMARY KEY
* <p>
* <code><pre>
* CONSTRAINT FK_StoreContact_Contact_ContactID
* FOREIGN KEY (ContactID)
* REFERENCES Person.Contact (ContactID)
* </pre></code>
*/
@javax.persistence.Column(name = "ContactID")
public java.lang.Integer getContactid() {
return getValue(org.jooq.examples.sqlserver.adventureworks.sales.tables.Storecontact.STORECONTACT.CONTACTID);
}
/**
* An uncommented item
* <p>
* <code><pre>
* CONSTRAINT FK_StoreContact_ContactType_ContactTypeID
* FOREIGN KEY (ContactTypeID)
* REFERENCES Person.ContactType (ContactTypeID)
* </pre></code>
*/
public void setContacttypeid(java.lang.Integer value) {
setValue(org.jooq.examples.sqlserver.adventureworks.sales.tables.Storecontact.STORECONTACT.CONTACTTYPEID, value);
}
/**
* An uncommented item
* <p>
* <code><pre>
* CONSTRAINT FK_StoreContact_ContactType_ContactTypeID
* FOREIGN KEY (ContactTypeID)
* REFERENCES Person.ContactType (ContactTypeID)
* </pre></code>
*/
@javax.persistence.Column(name = "ContactTypeID")
public java.lang.Integer getContacttypeid() {
return getValue(org.jooq.examples.sqlserver.adventureworks.sales.tables.Storecontact.STORECONTACT.CONTACTTYPEID);
}
/**
* An uncommented item
*/
public void setRowguid(java.lang.String value) {
setValue(org.jooq.examples.sqlserver.adventureworks.sales.tables.Storecontact.STORECONTACT.ROWGUID, value);
}
/**
* An uncommented item
*/
@javax.persistence.Column(name = "rowguid")
public java.lang.String getRowguid() {
return getValue(org.jooq.examples.sqlserver.adventureworks.sales.tables.Storecontact.STORECONTACT.ROWGUID);
}
/**
* An uncommented item
*/
public void setModifieddate(java.sql.Timestamp value) {
setValue(org.jooq.examples.sqlserver.adventureworks.sales.tables.Storecontact.STORECONTACT.MODIFIEDDATE, value);
}
/**
* An uncommented item
*/
@javax.persistence.Column(name = "ModifiedDate")
public java.sql.Timestamp getModifieddate() {
return getValue(org.jooq.examples.sqlserver.adventureworks.sales.tables.Storecontact.STORECONTACT.MODIFIEDDATE);
}
/**
* Create a detached StorecontactRecord
*/
public StorecontactRecord() {
super(org.jooq.examples.sqlserver.adventureworks.sales.tables.Storecontact.STORECONTACT);
}
}
| [
"lukas.eder@gmail.com"
] | lukas.eder@gmail.com |
b673806797b5c51d6b53c5dc44d775f40526ebb3 | 382a5fb19b7d3161cd7100e629bc9cd23a2d9a36 | /app/src/main/java/com/cs3680/justin/js_project5_networkdata/SingleFragmentActivity.java | b8469ac91fe77117136fb7ccf2d945218356ce4c | [] | no_license | jshums/CS3680_Project5 | 7f01014aa2e4eec70803ad1d1e8ca064ae2a5f89 | 960a525ba847c583ca208cde9719faae61993ffe | refs/heads/master | 2020-05-18T14:48:26.467240 | 2017-03-14T04:46:55 | 2017-03-14T04:46:55 | 84,255,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 936 | java | package com.cs3680.justin.js_project5_networkdata;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
/**
* Created by justi on 2/18/2017.
*/
public abstract class SingleFragmentActivity extends AppCompatActivity {
protected abstract Fragment createFragment();
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fragment);
FragmentManager fm = getSupportFragmentManager();
Fragment fragment = fm.findFragmentById(R.id.fragment_container);
if (fragment == null) {
fragment = createFragment();
fm.beginTransaction()
.add(R.id.fragment_container, fragment)
.commit();
}
}
}
| [
"jubleshum@gmail.com"
] | jubleshum@gmail.com |
6e1e4c3392c36df249df7925bfbdddf5cca6cc8d | d60a75fa55970b7c523867f683bad80c3e5379e7 | /src/com/facade/TheaterLights.java | dbe2f299991c1355fba23a7f8821ea9d7bd968c8 | [] | no_license | magicflung/DesignPattern | ce94b91913466c6c796bff73021c4ad5c3cac93e | 06bd68081f7ef22a5123a8fb5f31957ce990ff88 | refs/heads/master | 2022-11-10T23:26:32.123766 | 2020-07-05T12:22:48 | 2020-07-05T12:22:48 | 275,370,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 452 | java | package com.facade;
public class TheaterLights {
int brightness; // 1~10
public void on() {
System.out.println("打开灯...");
}
public void off() {
System.out.println("关闭灯...");
}
public void setBrightness(int brightness) {
this.brightness = brightness;
System.out.println("灯管亮度调为" + brightness);
}
public int getBrightness() {
return brightness;
}
}
| [
"chaste86@163.com"
] | chaste86@163.com |
b42017f70080d7f78897e44d87a5604d00f96e6e | 691a66ad9b9833993ad66033d8f5695d4b482be7 | /service-common/src/main/java/com/yfny/servicecommon/generator/task/APIUnitTestTask.java | a03aa105de56364b66e246bf6e24424e00499c6c | [] | no_license | zxkjgkpt/MySpringCloud | 5f7299963341736c1b945c6f44dfaab5f2c3138b | 8b9c744e5d5064fa6fde005c584cddafd54aad4a | refs/heads/master | 2020-04-22T14:48:01.290763 | 2019-03-29T01:39:07 | 2019-03-29T01:39:07 | 170,456,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,965 | java | package com.yfny.servicecommon.generator.task;
import com.yfny.servicecommon.generator.task.base.AbstractTask;
import com.yfny.servicecommon.generator.utils.ConfigUtil;
import com.yfny.servicecommon.generator.utils.FileUtil;
import com.yfny.servicecommon.generator.utils.FreemarketConfigUtils;
import com.yfny.servicecommon.generator.utils.StringUtil;
import com.yfny.servicecommon.util.CodeInfoUtils;
import freemarker.template.TemplateException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 代码生成器API单元测试任务
* Created by jisongZhou on 2019/3/7.
**/
public class APIUnitTestTask extends AbstractTask {
public APIUnitTestTask(String className) {
super(className);
}
@Override
public void run() throws IOException, TemplateException {
// 生成APIUnitTest填充数据
System.out.println("Generating APIUnitTest.java");
Map<String, Object> testData = new HashMap<>();
testData.put("BasePackageName", ConfigUtil.getConfiguration().getPackageName());
testData.put("APIUnitTestPackageName", ConfigUtil.getConfiguration().getPath().getUnittest());
testData.put("APIBaseTestPackageName", ConfigUtil.getConfiguration().getPath().getBasetest());
testData.put("Author", ConfigUtil.getConfiguration().getAuthor());
testData.put("Date", new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
testData.put("RequestInfoList", CodeInfoUtils.getRequestInfos());
String filePath = FileUtil.getTestPath() + StringUtil.package2Path(ConfigUtil.getConfiguration().getPackageName()) + StringUtil.package2Path(ConfigUtil.getConfiguration().getPath().getUnittest());
String fileName = "APIUnitTest.java";
// 生成Controller文件
FileUtil.generateToJava(FreemarketConfigUtils.TYPE_API_UNIT_TEST, testData, filePath + fileName);
}
}
| [
"568777035@qq.com"
] | 568777035@qq.com |
a0274114015a3d253af21cadaafd483c999fcf51 | 93cead2b93080bc9f92758a41b7cca985a1e0ef4 | /build/host/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/com/example/flutter_module/R.java | fa6b4850a330455510f6a792b6753f424606d454 | [] | no_license | lyh28/flutter_module | 20beb9d6d0e09e5281b80b10d7109e33db852dc0 | 4b36e08575a5679a2d59b7aced2ac2d8901aa4ec | refs/heads/master | 2020-06-29T20:06:56.829210 | 2019-08-27T08:01:56 | 2019-08-27T08:01:56 | 200,605,611 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,023 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package com.example.flutter_module;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int coordinatorLayoutStyle = 0x7f03006f;
public static final int font = 0x7f030098;
public static final int fontProviderAuthority = 0x7f03009a;
public static final int fontProviderCerts = 0x7f03009b;
public static final int fontProviderFetchStrategy = 0x7f03009c;
public static final int fontProviderFetchTimeout = 0x7f03009d;
public static final int fontProviderPackage = 0x7f03009e;
public static final int fontProviderQuery = 0x7f03009f;
public static final int fontStyle = 0x7f0300a0;
public static final int fontWeight = 0x7f0300a1;
public static final int keylines = 0x7f0300bb;
public static final int layout_anchor = 0x7f0300be;
public static final int layout_anchorGravity = 0x7f0300bf;
public static final int layout_behavior = 0x7f0300c0;
public static final int layout_dodgeInsetEdges = 0x7f0300ec;
public static final int layout_insetEdge = 0x7f0300f5;
public static final int layout_keyline = 0x7f0300f6;
public static final int statusBarBackground = 0x7f030143;
}
public static final class bool {
private bool() {}
public static final int abc_action_bar_embed_tabs = 0x7f040000;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f050046;
public static final int notification_icon_bg_color = 0x7f050047;
public static final int notification_material_background_media_default_color = 0x7f050048;
public static final int primary_text_default_material_dark = 0x7f05004d;
public static final int ripple_material_light = 0x7f050052;
public static final int secondary_text_default_material_dark = 0x7f050053;
public static final int secondary_text_default_material_light = 0x7f050054;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f06004b;
public static final int compat_button_inset_vertical_material = 0x7f06004c;
public static final int compat_button_padding_horizontal_material = 0x7f06004d;
public static final int compat_button_padding_vertical_material = 0x7f06004e;
public static final int compat_control_corner_material = 0x7f06004f;
public static final int notification_action_icon_size = 0x7f060085;
public static final int notification_action_text_size = 0x7f060086;
public static final int notification_big_circle_margin = 0x7f060087;
public static final int notification_content_margin_start = 0x7f060088;
public static final int notification_large_icon_height = 0x7f060089;
public static final int notification_large_icon_width = 0x7f06008a;
public static final int notification_main_column_padding_top = 0x7f06008b;
public static final int notification_media_narrow_margin = 0x7f06008c;
public static final int notification_right_icon_size = 0x7f06008d;
public static final int notification_right_side_padding_top = 0x7f06008e;
public static final int notification_small_icon_background_padding = 0x7f06008f;
public static final int notification_small_icon_size_as_large = 0x7f060090;
public static final int notification_subtext_size = 0x7f060091;
public static final int notification_top_pad = 0x7f060092;
public static final int notification_top_pad_large_text = 0x7f060093;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f070063;
public static final int notification_bg = 0x7f070064;
public static final int notification_bg_low = 0x7f070065;
public static final int notification_bg_low_normal = 0x7f070066;
public static final int notification_bg_low_pressed = 0x7f070067;
public static final int notification_bg_normal = 0x7f070068;
public static final int notification_bg_normal_pressed = 0x7f070069;
public static final int notification_icon_background = 0x7f07006a;
public static final int notification_template_icon_bg = 0x7f07006b;
public static final int notification_template_icon_low_bg = 0x7f07006c;
public static final int notification_tile_bg = 0x7f07006d;
public static final int notify_panel_notification_icon_bg = 0x7f07006e;
}
public static final class id {
private id() {}
public static final int action0 = 0x7f080006;
public static final int action_container = 0x7f08000e;
public static final int action_divider = 0x7f080010;
public static final int action_image = 0x7f080011;
public static final int action_text = 0x7f080017;
public static final int actions = 0x7f080018;
public static final int async = 0x7f08001e;
public static final int blocking = 0x7f080022;
public static final int bottom = 0x7f080023;
public static final int cancel_action = 0x7f080025;
public static final int chronometer = 0x7f08002b;
public static final int end = 0x7f08003f;
public static final int end_padder = 0x7f080040;
public static final int forever = 0x7f08004a;
public static final int icon = 0x7f08004f;
public static final int icon_group = 0x7f080050;
public static final int info = 0x7f080053;
public static final int italic = 0x7f080055;
public static final int left = 0x7f080058;
public static final int line1 = 0x7f080059;
public static final int line3 = 0x7f08005a;
public static final int media_actions = 0x7f08005e;
public static final int none = 0x7f080065;
public static final int normal = 0x7f080066;
public static final int notification_background = 0x7f080067;
public static final int notification_main_column = 0x7f080068;
public static final int notification_main_column_container = 0x7f080069;
public static final int right = 0x7f080074;
public static final int right_icon = 0x7f080075;
public static final int right_side = 0x7f080076;
public static final int start = 0x7f08009b;
public static final int status_bar_latest_event_content = 0x7f08009c;
public static final int tag_transition_group = 0x7f0800a0;
public static final int text = 0x7f0800a1;
public static final int text2 = 0x7f0800a2;
public static final int time = 0x7f0800a8;
public static final int title = 0x7f0800a9;
public static final int top = 0x7f0800ac;
}
public static final class integer {
private integer() {}
public static final int cancel_button_image_alpha = 0x7f090004;
public static final int status_bar_notification_info_maxnum = 0x7f090009;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f0a0029;
public static final int notification_action_tombstone = 0x7f0a002a;
public static final int notification_media_action = 0x7f0a002b;
public static final int notification_media_cancel_action = 0x7f0a002c;
public static final int notification_template_big_media = 0x7f0a002d;
public static final int notification_template_big_media_custom = 0x7f0a002e;
public static final int notification_template_big_media_narrow = 0x7f0a002f;
public static final int notification_template_big_media_narrow_custom = 0x7f0a0030;
public static final int notification_template_custom_big = 0x7f0a0031;
public static final int notification_template_icon_group = 0x7f0a0032;
public static final int notification_template_lines_media = 0x7f0a0033;
public static final int notification_template_media = 0x7f0a0034;
public static final int notification_template_media_custom = 0x7f0a0035;
public static final int notification_template_part_chronometer = 0x7f0a0036;
public static final int notification_template_part_time = 0x7f0a0037;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0c0026;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0d00ed;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0d00ee;
public static final int TextAppearance_Compat_Notification_Info_Media = 0x7f0d00ef;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d00f0;
public static final int TextAppearance_Compat_Notification_Line2_Media = 0x7f0d00f1;
public static final int TextAppearance_Compat_Notification_Media = 0x7f0d00f2;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0d00f3;
public static final int TextAppearance_Compat_Notification_Time_Media = 0x7f0d00f4;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0d00f5;
public static final int TextAppearance_Compat_Notification_Title_Media = 0x7f0d00f6;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0d016b;
public static final int Widget_Compat_NotificationActionText = 0x7f0d016c;
public static final int Widget_Support_CoordinatorLayout = 0x7f0d0178;
}
public static final class styleable {
private styleable() {}
public static final int[] CoordinatorLayout = { 0x7f0300bb, 0x7f030143 };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f0300be, 0x7f0300bf, 0x7f0300c0, 0x7f0300ec, 0x7f0300f5, 0x7f0300f6 };
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
public static final int[] FontFamily = { 0x7f03009a, 0x7f03009b, 0x7f03009c, 0x7f03009d, 0x7f03009e, 0x7f03009f };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x7f030098, 0x7f0300a0, 0x7f0300a1 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_font = 3;
public static final int FontFamilyFont_fontStyle = 4;
public static final int FontFamilyFont_fontWeight = 5;
}
}
| [
"641740435@qq.com"
] | 641740435@qq.com |
5d99920e1fb6ba4a78bf9f1bf4658243e915201b | 5abc2c48dee7e7f0afe9091ecca3854f10219e44 | /src/org/jbox2d/callbacks/TreeRayCastCallback.java | c5ebcfac86e246c3fc7131d5159628ae1751dd48 | [] | no_license | LoDoMa/JLime | f249f6bcfb0455416af35e566e696fdab4c5cf00 | 7758ecdc01438399b37693f44f8edca5bcaab3c7 | refs/heads/master | 2021-01-20T21:24:05.792648 | 2014-05-17T14:37:58 | 2014-05-17T14:37:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,968 | java | /*******************************************************************************
* Copyright (c) 2013, Daniel Murphy
* 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.
*
* 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 HOLDER 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.jbox2d.callbacks;
import org.jbox2d.collision.RayCastInput;
import org.jbox2d.collision.broadphase.DynamicTree;
// updated to rev 100
/**
* callback for {@link org.jbox2d.collision.broadphase.DynamicTree}
* @author Daniel Murphy
*
*/
public interface TreeRayCastCallback {
/**
*
* @param input
* @param nodeId
* @return the fraction to the node
*/
public float raycastCallback(RayCastInput input, int nodeId);
}
| [
"lovro.kalinovcic@gail.com"
] | lovro.kalinovcic@gail.com |
57260d8eccf0d8bb9a8398f189270028050a8919 | 5231bfae2cb9d13a364da6bea2bd4ce673ecdfe3 | /src/main/java/enums/MaritalStatus.java | 35aa1c16578aea03b64ed4686bcb563ac130d0a4 | [] | no_license | elirandav/nice-september-2016 | da82c7e5619da372f0adf4afeb9e52ee7d56d39e | 2014c191c0769b0b0ab150dee819b89d482ac494 | refs/heads/master | 2021-06-05T11:04:53.216907 | 2016-09-11T13:54:22 | 2016-09-11T13:54:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 822 | java | package enums;
import lombok.Getter;
/**
* Created by Jeka on 06/09/2016.
*/
@Getter
public enum MaritalStatus {
SINGLE(1,"רווק"), MARRIED(2,"נשוי"), DIVORCED(3,"גרוש"), WIDOW(7,"אלמן");
private final int dbCode;
private final String hebrewDesc;
MaritalStatus(int dbCode, String hebrewDesc) {
this.dbCode= dbCode;
this.hebrewDesc = hebrewDesc;
}
@Override
public String toString() {
return hebrewDesc;
}
public static MaritalStatus findByDbCode(int dbCode) {
MaritalStatus[] statuses = values();
for (MaritalStatus status : statuses) {
if (status.dbCode == dbCode) {
return status;
}
}
throw new RuntimeException("dbcode " + dbCode + " not bound");
}
}
| [
"bsevgeny@gmail.com"
] | bsevgeny@gmail.com |
7e620aa3c0b49bd2654e25ba6bb6a25ea9bf4a51 | 98caa9b459cf1a9615e7335cadb33ff35e5c3b32 | /eds-starter-simple-archetype/src/main/resources/archetype-resources/src/main/java/service/TreeLoadService.java | d1af5de2331dcc6ec5433896a341c5789bacc778 | [] | no_license | xloggerster/archetypes | 533a941487409254e422a84e07d231b1c3e301ed | 540a8a3fb0f575a4076673c600ecb51e8a50c28f | refs/heads/master | 2021-01-17T10:33:54.736795 | 2013-05-31T02:34:34 | 2013-05-31T02:34:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,975 | java | #set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.service;
import static ch.ralscha.extdirectspring.annotation.ExtDirectMethodType.TREE_LOAD;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod;
import ${package}.SimpleUserDb;
import ${package}.User;
import ${package}.util.PropertyOrderingFactory;
import com.google.common.base.Function;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
@Service
public class TreeLoadService {
@Autowired
private SimpleUserDb db;
@ExtDirectMethod(TREE_LOAD)
public ImmutableList<Node> getTree(String node) {
if ("root".equals(node) || !StringUtils.hasText(node)) {
Node root = new Node();
root.id = "Company";
root.text = "Company";
root.leaf = false;
root.expanded = true;
ImmutableList.Builder<Node> builder = ImmutableList.builder();
for (String department : db.getDepartments()) {
Node child = new Node();
child.id = department;
child.text = department;
child.leaf = false;
builder.add(child);
}
root.children = builder.build();
return ImmutableList.<Node> builder().add(root).build();
}
List<User> users = PropertyOrderingFactory.createOrdering("lastName")
.sortedCopy(db.findAllFromDepartment(node));
return ImmutableList.copyOf(Collections2.transform(users, new Function<User, Node>() {
@Override
public Node apply(User input) {
Node n = new Node();
n.id = input.getId();
n.text = input.getLastName() + " " + input.getFirstName();
n.leaf = true;
return n;
}
}));
}
public static class Node {
public String id;
public String text;
public boolean leaf;
public boolean expanded;
public ImmutableList<Node> children;
}
}
| [
"ralphschaer@gmail.com"
] | ralphschaer@gmail.com |
38218617a510c2bd118a9b5573922afb14b76842 | cb274cdc11f8cabce6f19372780d1c929113bf74 | /EngSoftControleMaquinario/src/javafxmvc/model/dao/PecaDAO.java | e40f8a3b21211bff4e737d4bb1ad66ef7c8a75f3 | [] | no_license | dbandrei/ControleMaquinario | fc83400108b747dbe7d89902061f2626a86181f4 | 2ce5ef05e7f341412af0b13b3482497454652aa7 | refs/heads/master | 2021-01-02T08:44:36.572263 | 2017-08-08T03:18:19 | 2017-08-08T03:18:19 | 99,059,418 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,902 | java | package javafxmvc.model.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafxmvc.model.domain.Peca;
public class PecaDAO {
private Connection connection;
String nome;
public Connection getConnection() {
return connection;
}
public void setConnection(Connection connection) {
this.connection = connection;
}
public boolean inserir(Peca peca) {
String sql = "INSERT INTO peca(nome, marca, descricao)"
+ "VALUES(?,?,?)";
try {
PreparedStatement stmt = connection.prepareStatement(sql);
stmt.setString(1, peca.getNome());
stmt.setString(2, peca.getMarca());
stmt.setString(3, peca.getDescricao());
stmt.execute();
return true;
} catch (SQLException ex) {
Logger.getLogger(PecaDAO.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}
public boolean alterar(Peca peca) {
String sql = "UPDATE peca SET nome=?, marca=?, descricao=?"
+ "WHERE id_peca=?";
try {
PreparedStatement stmt = connection.prepareStatement(sql);
stmt.setString(1, peca.getNome());
stmt.setString(2, peca.getMarca());
stmt.setString(3, peca.getDescricao());
stmt.setInt(4, peca.getIdPeca());
stmt.execute();
return true;
} catch (SQLException ex) {
Logger.getLogger(PecaDAO.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}
public boolean remover(Peca peca) {
String sql = "DELETE FROM peca WHERE id_peca=?";
try {
PreparedStatement stmt = connection.prepareStatement(sql);
stmt.setInt(1, peca.getIdPeca());
stmt.execute();
return true;
} catch (SQLException ex) {
Logger.getLogger(PecaDAO.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}
public List<Peca> listar() {
String sql = "SELECT * FROM peca ORDER BY nome";
List<Peca> retorno = new ArrayList<>();
try {
PreparedStatement stmt = connection.prepareStatement(sql);
ResultSet resultado = stmt.executeQuery();
while (resultado.next()) {
Peca peca = new Peca();
peca.setIdPeca(resultado.getInt("id_peca"));
peca.setNome(resultado.getString("nome"));
peca.setMarca(resultado.getString("marca"));
peca.setDescricao(resultado.getString("descricao"));
retorno.add(peca);
}
} catch (SQLException ex) {
Logger.getLogger(PecaDAO.class.getName()).log(Level.SEVERE, null, ex);
}
return retorno;
}
public Peca buscar(Peca peca) {
String sql = "SELECT * FROM peca WHERE id_peca=?";
Peca retorno = new Peca();
try {
PreparedStatement stmt = connection.prepareStatement(sql);
stmt.setInt(1, peca.getIdPeca());
ResultSet resultado = stmt.executeQuery();
if (resultado.next()) {
peca.setIdPeca(resultado.getInt("id_peca"));
peca.setNome(resultado.getString("nome"));
peca.setMarca(resultado.getString("marca"));
peca.setDescricao(resultado.getString("descricao"));
retorno = peca;
}
} catch (SQLException ex) {
Logger.getLogger(PecaDAO.class.getName()).log(Level.SEVERE, null, ex);
}
return retorno;
}
public List<Peca> pesquisar(String nome) {
this.nome = nome;
String sql = "SELECT * FROM peca WHERE UPPER(NOME) LIKE '%"+ nome +"%' ORDER BY nome";
List<Peca> retorno = new ArrayList<>();
try {
PreparedStatement stmt = connection.prepareStatement(sql);
ResultSet resultado = stmt.executeQuery();
while (resultado.next()) {
Peca peca = new Peca();
peca.setIdPeca(resultado.getInt("id_peca"));
peca.setNome(resultado.getString("nome"));
peca.setMarca(resultado.getString("marca"));
peca.setDescricao(resultado.getString("descricao"));
retorno.add(peca);
}
} catch (SQLException ex) {
Logger.getLogger(PecaDAO.class.getName()).log(Level.SEVERE, null, ex);
}
return retorno;
}
}
| [
"Mattheus@DESKTOP-SOUHEDK"
] | Mattheus@DESKTOP-SOUHEDK |
137fbfc00bf8ddba427066c713328e4452c073fc | 1c3c59b1e14ec3e0764a7231d35926bcbc032ca5 | /src/Testing.java | cb09bfe3f4dc0e51335168a796e8cf5474810f84 | [] | no_license | NabeelSMADI/Prog3-TrafficLightTimer | 567131d410fb6b70cfc4a648fcaee86f25c3bb30 | a8f9749787acad8fe59ca2e5e484059a3b3820ba | refs/heads/master | 2020-06-27T00:58:01.190415 | 2017-07-12T18:01:50 | 2017-07-12T18:01:50 | 97,037,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 769 | java |
public class Testing extends Thread{
Timer timerT = new Timer() ;
public static boolean blinking = true;
public static boolean testing = false;
public void run() {
timerT.start();
while (true){
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
if(testing){
System.out.println("on");
if(blinking){
TrafficLight.blinkOn();
timerT.blinking((long) 1);
}else{
TrafficLight.blinkOff();
timerT.blinking((long) 1);
}
}
}
}}
| [
"smady91@hotmail.com"
] | smady91@hotmail.com |
06d8b82ff05f7e9a211f44d2c7e5fc5c9b68486d | 77831004c27019f65b945a15ee78775dd71a11a6 | /src/com/geekykel/pattern/structural/facadepattern/Lights.java | 76e4aa009a530be6af76ce78a221a45f2dda8289 | [] | no_license | kelvinator07/OOP-Design-Patterns | 1a7caf176d72cc089fd751ff75c0ca05bb363252 | f0f01c7e77686905ed9a31f173b7ec92199c6d80 | refs/heads/master | 2022-12-03T13:28:22.071110 | 2020-08-19T23:44:34 | 2020-08-19T23:44:34 | 281,362,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 957 | java | package com.geekykel.pattern.structural.facadepattern;
public class Lights {
// String description = "Lights";
// public void on() {
// System.out.println(description + " on");
// }
//
// public void off() {
// System.out.println(description + " off");
// }
public void dim(int level) {
System.out.println(description + " dimming to " + level + "%");
}
public String toString() {
return description;
}
private String description = "Lights";
private String favoriteColorTemperature;
public void on() {
System.out.println(description + " on");
System.out.println("Color temperature is: " + this.favoriteColorTemperature);
}
public void off() {
System.out.println(description + " off");
}
public void setFavoriteColorTemperature(String favoriteColorTemperature) {
this.favoriteColorTemperature = favoriteColorTemperature;
}
}
| [
"isievwore@systemspecs.com.ng"
] | isievwore@systemspecs.com.ng |
d07acd65e82921c19d12ecaeaca7bd7ddf8cb95e | 334f24b1627ad30b12ab661b63d5c69d5a578b4a | /src/Dfs.java | 86fa90d9bcfcf68d4d6e9b9cc41ea136e4df325a | [] | no_license | amichai-H/Algo-2 | 78e96cb05f14b311277b0fdca885578d275d45cb | 391a0a00193dbccec328ccafc6c65160b14248c7 | refs/heads/master | 2022-11-13T00:03:11.338167 | 2020-07-04T18:06:30 | 2020-07-04T18:06:30 | 270,266,291 | 17 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,221 | java | import java.util.Iterator;
import java.util.Stack;
public class Dfs {
Graph graph;
int n ;
int[] pred;
int[] start;
int[] end ;
private enum Color
{
WHITE,
GRAY,
BLACK
}
public Dfs(Graph g){
this.graph = new Graph(g);
this.n = graph.size();
this.pred = new int[n];
this.start = new int[n];
this.end = new int[n];
dfsAt(1);
}
public void dfsAt(int u){
Stack<Integer> stack = new Stack<>();
Iterator<edge_data>[] iters = new Iterator[n];
for (int i=1; i<n;i++){
iters[i] = graph.getEdges(i).iterator();
}
boolean hasCycle = false;
int startCycle;
int endCycle;
Color[] visted = new Color[n];
for (int i = 1; i <n; i++){
visted[i] = Color.WHITE;
}
int time = 1;
stack.push(u);
while (!stack.isEmpty()){
u = stack.peek();
visted[u] = Color.GRAY;
start[u] = time++;
if (iters[u].hasNext()){
int v = iters[u].next().getDst();
if (visted[v]==Color.WHITE){
visted[v] = Color.GRAY;
pred[v] = u;
start[v] = time++;
stack.push(v);
}
else if(!hasCycle &&visted[v]==Color.GRAY && pred[u] != v) {
hasCycle = true;
startCycle = u;
endCycle = v;
}
}
else {
end[u] = time++;
visted[u] = Color.BLACK;
stack.pop();
System.out.print( "<-"+ u);
}
}
System.out.println(" cycle? "+hasCycle);
}
public static void main(String [] args){
Graph g = new Graph();
for (int i=0; i<7 ; i++)
g.addNode();
g.add2Edge(1,2);
g.add2Edge(2,3);
g.add2Edge(3,4);
g.add2Edge(1,5);
g.add2Edge(1,6);
g.add2Edge(6,7);
g.add2Edge(7,4);
// System.out.println(g.getEdges(1).iterator().hasNext());
Dfs dfs = new Dfs(g);
}
}
| [
"51719573+amichai-H@users.noreply.github.com"
] | 51719573+amichai-H@users.noreply.github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.