blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
3b13eaf68ccf81bea55ca59314b687a659f030da
5f23ac9d74160109415ffdada4c4705e14c6c468
/threading-playground/src/main/java/com/garethahealy/threading/playground/disruptor/impl/LongEventMain.java
dda56703dd40adc1d18b43d1f89592b5fae08909
[ "Apache-2.0" ]
permissive
fuse-forks/jboss-fuse-examples
25d016b38dd5dd98e5a0345b115ddbace699f018
0e771493bc21cad3e9e5d3b72a7c9cf2297c1d07
refs/heads/master
2021-01-22T07:03:34.469797
2014-11-26T20:58:10
2014-11-26T20:58:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,219
java
package com.garethahealy.threading.playground.disruptor.impl; import com.lmax.disruptor.TimeoutException; public class LongEventMain { public void doWork() throws TimeoutException { // // Executor that will be used to construct new threads for consumers // Executor executor = Executors.newCachedThreadPool(); // // // The factory for the event // ExchangeFactory factory = new ExchangeFactory(); // // // Specify the size of the ring buffer, must be power of 2. // int bufferSize = 1024; // // // Construct the Disruptor // Disruptor<Exchange> disruptor = new Disruptor<>(factory, bufferSize, executor); // // // Connect the handler // disruptor.handleEventsWith(new ExchangeConsumer()); // // // Start the Disruptor, starts all threads running // disruptor.start(); // // // Get the ring buffer from the Disruptor to be used for publishing. // RingBuffer<Exchange> ringBuffer = disruptor.getRingBuffer(); // // ExchangeProducer producer = new ExchangeProducer(ringBuffer); // // ByteBuffer bb = ByteBuffer.allocate(8); // for (long l = 0; true; l++) { // bb.putLong(0, l); // producer.onData(bb); // } // //disruptor.shutdown(10, TimeUnit.SECONDS); } }
[ "garethahealy@gmail.com" ]
garethahealy@gmail.com
f664c110336a8daccc53bc417ca0d331a00f4a74
93f636686d7939a923d4b733c4daa1b4ed1cb57c
/Examen2_CrysthelAparicio/src/Examen2/admin_respuestas.java
76b88f7fe435452e82f2b970bda64c0a7c9f0e3b
[ "MIT" ]
permissive
CrysthelAparicio/Examen2_CrysthelAparicio
e9ff064c7fa34f6e71dc33e3fb669c33f4438b3d
4766fd73c27d835092977732b5944aaff882639f
refs/heads/master
2020-03-08T22:02:26.791828
2018-04-07T16:45:30
2018-04-07T16:45:30
128,420,757
0
0
null
null
null
null
UTF-8
Java
false
false
2,251
java
package Examen2; import java.io.EOFException; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; public class admin_respuestas { private ArrayList<Respuestas> listas_respuestas = new ArrayList(); private File archivo = null; public admin_respuestas(String path) { archivo = new File(path); } public ArrayList<Respuestas> getListas_respuestas() { return listas_respuestas; } public void setListas_respuestas(ArrayList<Respuestas> listas_respuestas) { this.listas_respuestas = listas_respuestas; } public File getArchivo() { return archivo; } public void setArchivo(File archivo) { this.archivo = archivo; } public void set_respuestas(Respuestas a) { listas_respuestas.add(a); } public void cargarArchivo() { try { listas_respuestas = new ArrayList(); Respuestas temp; if (archivo.exists()) { FileInputStream entrada = new FileInputStream(archivo); ObjectInputStream objeto = new ObjectInputStream(entrada); try { while ((temp = (Respuestas) objeto.readObject()) != null) { listas_respuestas.add(temp); } } catch (EOFException e) { //ENCONTRO EL FINAL DEL ARCHIVO } objeto.close(); entrada.close(); } } catch (Exception e) { e.printStackTrace(); } } public void escribirArchivo() { FileOutputStream fw = null; ObjectOutputStream bw = null; try { fw = new FileOutputStream(archivo); bw = new ObjectOutputStream(fw); for (Respuestas t : listas_respuestas) { bw.writeObject(t); } bw.flush(); } catch (Exception ex) { } finally { try { bw.close(); fw.close(); } catch (Exception e) { } } } }
[ "crysthel.aparicio@unitec.edu" ]
crysthel.aparicio@unitec.edu
3ab01b38fe65e993d3c3ed9bd577ab325ed10a19
01d23a30770d622d0582438e7c93a7b5319341c4
/src/main/java/round1/firstLevel76.java
b7cc6d7722860e5b4284db54994cbe98fead94c2
[]
no_license
vikingss/LeetCode
d98b83d0e7116db202b08598cf06111ce4eab29b
e756160a33bc968706333d7328d664a9d31cefe9
refs/heads/master
2020-03-31T08:26:54.443528
2019-02-14T02:59:05
2019-02-14T02:59:05
152,057,359
0
0
null
null
null
null
UTF-8
Java
false
false
1,014
java
package round1; /** Count the number of prime numbers less than a non-negative number, n. Example: Input: 10 Output: 4 Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7. */ public class firstLevel76 { public static int countPrimes(int n) { int[] mark = new int[n]; mark[2] = 0; for(int i = 3; i < n; ++i){ if(i % 2 == 0){ mark[i] = 1; } } for(int i = 3; i < n; i += 2){ if(mark[i] == 0){ if(i * i > n){ break; } for(int j = 2; i * j < n; ++j){ mark[i*j] = 1; } } } int cnt = 0; for(int i = 2; i < n; ++i){ if(mark[i] == 0){ cnt++; } } return cnt; } public static void main(String[] args) { int n = 100; System.out.println(firstLevel76.countPrimes(n)); } }
[ "xunruibo@autohome.com.cn" ]
xunruibo@autohome.com.cn
34e1fadef32cfddaf043a05f85b1af23e51ea1c1
51a37b7108f2f69a1377d98f714711af3c32d0df
/src/leetcode/P039.java
aba19677005f0bf5ff2ed45b496e7a40783ba03b
[]
no_license
stupidchen/leetcode
1dd2683ba4b1c0382e9263547d6c623e4979a806
72d172ea25777980a49439042dbc39448fcad73d
refs/heads/master
2022-03-14T21:15:47.263954
2022-02-27T15:33:15
2022-02-27T15:33:15
55,680,865
7
1
null
null
null
null
UTF-8
Java
false
false
1,505
java
import java.util.*; /** * Created by mike on 1/30/18. */ public class P039 { public void search(List<List<Integer>> solSet, Deque<Integer> curSol, int[] candidates, int point, int target) { if (target == 0) { List<Integer> sol = new LinkedList<>(); for (Integer i: curSol) sol.add(i); solSet.add(sol); return; } if (point >= candidates.length) return; int limit = target / candidates[point]; for (int i = 0; i < limit; i++) { curSol.offer(candidates[point]); } target = target % candidates[point]; for (int i = limit; i > 0; i--) { search(solSet, curSol, candidates, point + 1, target); curSol.pollLast(); target += candidates[point]; } search(solSet, curSol, candidates, point + 1, target); } public List<List<Integer>> combinationSum(int[] candidates, int target) { Arrays.sort(candidates); for (int i = 0; i < candidates.length >> 1; i++) { int tmp = candidates[i]; candidates[i] = candidates[candidates.length - 1 - i]; candidates[candidates.length - 1 - i] = tmp; } List<List<Integer>> solSet = new LinkedList<>(); search(solSet, new LinkedList<>(), candidates, 0, target); return solSet; } public static void main(String[] args) { P039 p = new P039(); p.combinationSum(new int[]{2, 1}, 7); } }
[ "chenhuajun@baidu.com" ]
chenhuajun@baidu.com
070095fa66e238bcb5ed6694db8f918fc120e74f
b93aae3bda9fcd6e6c6d1eda59298665f789e93b
/GameForm.java
f2fe78d8b302588c5b579a34b96fa3d3abf61c44
[]
no_license
carlcc/FlashBall
e44faea9083260340a0f09b39292a305e1f461f7
66fae36a358a5b77443432d8047edddd140178d8
refs/heads/master
2021-07-15T03:45:00.309544
2015-06-06T17:14:37
2015-06-06T17:14:37
36,988,365
0
0
null
null
null
null
GB18030
Java
false
false
3,052
java
import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.print.attribute.standard.Media; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; public class GameForm extends JFrame { private GamePanel gp; private JPanel abilityPanel; private AbilityIcon[] abilityIcons; private GameForm thisForm; public GameForm() { this(1000, 500); } public GameForm(int width, int height) { super(); this.setSize(width, height); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setLayout(new BorderLayout()); JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("游戏"); JMenuItem item = new JMenuItem("开始"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { startGame(); } }); menu.add(item); item = new JMenuItem("帮助"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String msg = "按键说明:\n上下左右箭头控制上下左右\nq------cd 5秒,5秒内上下左右以恒定速度移动。\n" + "w------闪现,cd 5秒,瞬间移动到前方一定距离,距离与当前速度有关(闪现到灰色球处)\ne------无敌," + "cd 5秒,3秒内无敌\ns------开始游戏\n得分显示在窗体标题上"; JOptionPane.showMessageDialog(thisForm, msg); } }); menu.add(item); item = new JMenuItem("关于"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String msg = "Just for fun"; JOptionPane.showMessageDialog(thisForm, msg); } }); menu.add(item); menuBar.add(menu); this.add(menuBar, BorderLayout.NORTH); this.abilityPanel = new JPanel(); this.abilityPanel.setSize(width, 400); this.abilityPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); this.abilityIcons = new AbilityIcon[] { new AbilityIcon("疾走", 100, 100, 5), new AbilityIcon("闪现", 100, 100, 5), new AbilityIcon("无敌", 100, 100, 8), }; gp = new GamePanel(width, height, this); for (int i = 0; i < this.abilityIcons.length; ++i) this.abilityPanel.add(this.abilityIcons[i]); this.add(this.abilityPanel, BorderLayout.SOUTH); this.add(gp, BorderLayout.CENTER); this.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { gp.keyTyped(e); } @Override public void keyReleased(KeyEvent e) { gp.keyReleased(e); } @Override public void keyPressed(KeyEvent e) { gp.keyPressed(e); } }); } public void startGame() { gp.startGame(); } public AbilityIcon[] getAbilityIcons() { return this.abilityIcons; } }
[ "carlmarxchen@foxmail.com" ]
carlmarxchen@foxmail.com
1e74a46b64c931c68438b389057891a5038dba09
f697a14bf0ff7d7e235d504dfa3669b6293ef783
/GCP/samples/AdvancedHttpFunction/src/main/java/samples/gcp/functions/HttpMethod.java
d56b274f2d8bb2156b6b9f025943267f9c8c1b55
[ "Apache-2.0" ]
permissive
Rsekhar84/CloudFunctions
00d51d999e36a8c69f1e6ff7ab1c9c3c909c4b44
f6be64b46f7939e4b5353e0f0e845d2d31b6b295
refs/heads/main
2023-05-13T05:23:12.920223
2021-06-04T15:25:32
2021-06-04T15:25:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,028
java
/* * 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 samples.gcp.functions; import com.google.cloud.functions.HttpFunction; import com.google.cloud.functions.HttpRequest; import com.google.cloud.functions.HttpResponse; import com.google.gson.Gson; import com.google.gson.JsonObject; import java.io.BufferedWriter; import java.io.IOException; import java.io.PrintWriter; import java.net.HttpURLConnection; import java.nio.charset.StandardCharsets; import java.util.Base64; import java.util.Optional; import java.util.logging.Logger; public class HttpMethod implements HttpFunction { private static final Logger logger = Logger.getLogger(HttpMethod.class.getName()); private static final Gson gson = new Gson(); // This is a simple helper function for getting request params... private String getParam(HttpRequest request, String paramName) { String value = null; Optional<String> param = request.getFirstQueryParameter(paramName); if (param.isPresent()) { value = param.get(); } return value; } // This is a simple function for getting json params... private String getParam(JsonObject json, String paramName) { String value = null; if (json.has(paramName)) { value = json.get(paramName).getAsString(); } return value; } // This is the entry point for the function... @Override public void service(HttpRequest request, HttpResponse response) throws IOException { String contentType = request.getContentType().orElse(""); logger.info("contentType = "+contentType); // Process the request based on the type of content... switch (contentType) { case "application/json": JsonObject body = gson.fromJson(request.getReader(), JsonObject.class); processRequest(body,request,response); break; default: processRequest(request,response); } return; } private void processRequest(HttpRequest request, HttpResponse response) throws IOException { BufferedWriter writer = response.getWriter(); StringBuilder str = new StringBuilder(); // This function will only support GET methods... switch (request.getMethod()) { case "GET": response.setStatusCode(HttpURLConnection.HTTP_OK); String userName = getParam(request,"username"); String userPriv = getParam(request,"userpriv"); str.append("<p>This is a GET funtion call<br>"); str.append("User name is '"+userName+"' <br>"); str.append("User privelege is '"+userPriv+"' <br></p>"); logger.info(str.toString()); writer.write(str.toString()); break; case "POST": response.setStatusCode(HttpURLConnection.HTTP_OK); { str.append("<p>This is a POST function call<br>"); str.append("<ul>"); request.getQueryParameters().forEach( (param, values) -> { String value = values.get(0); str.append("<li>Field: '"+param+"' -> Value: '"+value+"'</li>"); }); str.append("</ul><br></p>"); logger.info(str.toString()); writer.write(str.toString()); } break; default: response.setStatusCode(HttpURLConnection.HTTP_BAD_METHOD); str.append("<p>This call is not supported<br></p>"); logger.info(str.toString()); writer.write(str.toString()); break; } return; } private void processRequest(JsonObject body, HttpRequest request, HttpResponse response) throws IOException { BufferedWriter writer = response.getWriter(); StringBuilder str = new StringBuilder(); // This function will only support POST methods... switch (request.getMethod()) { case "POST": response.setStatusCode(HttpURLConnection.HTTP_OK); String userName = getParam(body,"username"); String userPriv = getParam(body,"userpriv"); str.append("<p>This is a POST funtion call<br>"); str.append("User name is '"+userName+"' <br>"); str.append("User privelege is '"+userPriv+"' <br></p>"); logger.info(str.toString()); writer.write(str.toString()); break; default: response.setStatusCode(HttpURLConnection.HTTP_BAD_METHOD); str.append("<p>This call is not supported<br></p>"); logger.info(str.toString()); writer.write(str.toString()); break; } return; } }
[ "tim.tpayne@gmail.com" ]
tim.tpayne@gmail.com
f0fd500137624f4dfeeef1b1125a840d3f5892ae
147104b284683b9285db49e719144479aef35300
/findbugsTestCases/src/java/SillyBoxedUsage.java
ff37c7323a0c87ed48eaaf865df8e03a82e08225
[]
no_license
gleclaire/findbugs-2.0.2
b092cc5efbb443df7f8fe944375f10744c00f495
e8ebba0e775bed94940ac8a581ccc0a4fbb23db7
refs/heads/master
2021-01-01T19:28:46.435973
2013-01-29T23:52:19
2013-01-29T23:52:19
7,505,038
3
2
null
2016-03-03T12:06:57
2013-01-08T16:34:14
Java
UTF-8
Java
false
false
579
java
public class SillyBoxedUsage { public String testBad1(int value) { return new Integer(value).toString(); } public String testGood1(int value) { return Integer.toString(value); } public String testBad2(float value) { return new Float(value).toString(); } public String testGood2(float value) { return Float.toString(value); } public String testBad3(double value) { return new Double(value).toString(); } public String testGood3(double value) { return Double.toString(value); } }
[ "garvin.leclaire@gmail.com" ]
garvin.leclaire@gmail.com
b1d75ac5fda152ed951d657bb3092ba45296d176
fbdd88f07e0ed7e55ea8c1dfb8738c5c25450496
/project/SpringExam1/src/test/java/com/exam/test3/TV.java
18a9ebf98a8f5d6ed65411a9c4eb122832c3335e
[]
no_license
minkyung0421/Spring_vacation
62854adc09244e7c4f833dec70eddbb0e0aec216
ec8771dcaa1470d87287dc0a1b6370a0ebf6054d
refs/heads/master
2020-03-29T04:26:36.598149
2018-09-20T01:22:21
2018-09-20T01:22:21
149,531,773
0
0
null
null
null
null
UTF-8
Java
false
false
148
java
package com.exam.test3; public interface TV { public void turnOn(); public void turnOff(); public void volumeUp(); public void volumeDown(); }
[ "aza923@e-mirim.hs.kr" ]
aza923@e-mirim.hs.kr
b9262417cadedca29f21c7c4fdeae21dc92b8a62
2920c0fbeb1d9926b12ab53b52148e3918771999
/src/main/java/com/example/demo/mapper/GradeMapper.java
e7f1e601a2507cf07957dbefa70cf4a07c91de10
[]
no_license
wch7788/hysf
7afcbbb720fd242cc772081f1ed036e1d6ef9ef2
e633cea7eee4a33423f6a014b21644ca82f2a4da
refs/heads/master
2020-04-18T22:47:08.206361
2020-01-06T01:52:01
2020-01-06T01:52:01
167,804,206
0
0
null
null
null
null
UTF-8
Java
false
false
577
java
package com.example.demo.mapper; import com.example.demo.dto.grade.GradeResponse; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.sql.Date; import java.util.List; import java.util.Map; @Mapper public interface GradeMapper { List<GradeResponse> getGradeList(@Param("courseId") String courseId, @Param("date") Date date); List<Map<String, Object>> getCourseList(); List<Map<String, Object>> getTeacherList(); List<Map<String, Object>> getGradeCourse(); List<Date> getGradeDate(String courseId); }
[ "17826615651@163.com" ]
17826615651@163.com
31faba6cb1101bf2344b3566255225791f89ed70
71e68cef80d83b67c463a05427f595bdf2e5b51c
/project/Android_AmazonML/android/SmartUnlock/app/src/main/java/eem209as/smartunlock/DataClass.java
37a17434cdb7077866d0669b95b272068fd7bebe
[ "BSD-2-Clause" ]
permissive
UCLA-ECE209AS-2018W/Boyang-Xuerui
dd2ce9f38deb8e74f870774054a9d176925b8845
18900113059c7c9e2260abeeaddf0888c59e5c1b
refs/heads/master
2021-04-06T20:08:10.848164
2018-03-24T06:06:42
2018-03-24T06:06:42
125,327,959
0
0
null
null
null
null
UTF-8
Java
false
false
490
java
package eem209as.smartunlock; import java.util.HashMap; import java.util.Map; /** * Created by boyang on 3/19/18. */ class DataClass { boolean isSafe = false; float ax = 0; float ay = 0; float az = 0; double g = 0.0; double lat = 0.0; double lng = 0.0; float acu = 0; double alt = 0.0; float speed = 0; String provider = ""; String timeStamp = ""; String dayStamp = ""; Map<String, String> wifiInfo = null; int result = 0; }
[ "caiboyang.private@gmail.com" ]
caiboyang.private@gmail.com
0c00c093781b82bd2c21ea734fd06af4d632564e
a1541f498731e9c8b0b9c0abe7031fb0d86c53e8
/src/main/java/com/moonsolid/sc/domain/Plan.java
427808bcc6b502b4a4cf73dca9384f485c57e135
[]
no_license
MoonSolid/share-community-server
12bfeb6126d29684b0b72b5ce116b908e407b8fc
7f434dbba5efb03405dcc3ecac36c489dd4e3869
refs/heads/master
2020-12-30T01:33:42.784141
2020-04-02T00:05:48
2020-04-02T00:05:48
238,815,188
0
0
null
null
null
null
UTF-8
Java
false
false
3,272
java
package com.moonsolid.sc.domain; import java.io.Serializable; public class Plan implements Serializable { private static final long serialVersionUID = 20200313L; private int no; private String place; private String description; private String memo; private String cost; private String title; @Override public String toString() { return "Plan [no=" + no + ", place=" + place + ", description=" + description + ", memo=" + memo + ", cost=" + cost + ", title=" + title + "]"; } public static Plan valueOf(String csv) { String[] data = csv.split(","); Plan plan = new Plan(); plan.setNo(Integer.parseInt(data[0])); plan.setPlace(data[1]); plan.setDescription(data[2]); plan.setMemo(data[3]); plan.setCost(data[4]); plan.setTitle(data[5]); return plan; } public String toCsvString() { return String.format("%d,%s,%s,%s,%s,%s\n", this.getNo(), this.getPlace(), this.getDescription(), this.getMemo(), this.getCost(), this.getTitle()); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((cost == null) ? 0 : cost.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((memo == null) ? 0 : memo.hashCode()); result = prime * result + no; result = prime * result + ((place == null) ? 0 : place.hashCode()); result = prime * result + ((title == null) ? 0 : title.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Plan other = (Plan) obj; if (cost == null) { if (other.cost != null) return false; } else if (!cost.equals(other.cost)) return false; if (description == null) { if (other.description != null) return false; } else if (!description.equals(other.description)) return false; if (memo == null) { if (other.memo != null) return false; } else if (!memo.equals(other.memo)) return false; if (no != other.no) return false; if (place == null) { if (other.place != null) return false; } else if (!place.equals(other.place)) return false; if (title == null) { if (other.title != null) return false; } else if (!title.equals(other.title)) return false; return true; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getNo() { return no; } public void setNo(int no) { this.no = no; } public String getPlace() { return place; } public void setPlace(String place) { this.place = place; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getMemo() { return memo; } public void setMemo(String memo) { this.memo = memo; } public String getCost() { return cost; } public void setCost(String cost) { this.cost = cost; } }
[ "rnreo20@gmail.com" ]
rnreo20@gmail.com
50f34285d5fd137973d6bd97d684e961b461dc52
29e31c1cb676dcffd7d977892b424459cb81cea9
/src/main/java/ru/papont/spring5recipeapp/services/RecipeService.java
3eb4390d223d9468c29e536b9a91c2210ed06b9e
[]
no_license
papont/spring5-recipe-app
92e6f2bb2f507c56b5ff4d1593ceeb33f2dd9742
f10fb462b8885df930ab84906dab6fb2b4bd914d
refs/heads/master
2021-05-12T19:26:50.544259
2018-01-22T20:32:34
2018-01-22T20:32:34
117,094,097
0
0
null
null
null
null
UTF-8
Java
false
false
219
java
package ru.papont.spring5recipeapp.services; import ru.papont.spring5recipeapp.model.Recipe; import java.util.Set; public interface RecipeService { Set<Recipe> getReсipes(); Recipe findById(Long aLong); }
[ "trusoff.a@yandex.ru" ]
trusoff.a@yandex.ru
66220ad57ed416713a2156c3f87493ff685adac1
fec716092763a516b4433454a10866f00674a2ca
/java-persistence/simple-rpg/src/com/whitecloak/training/rpg/model/Hero.java
7c166a4b5704f8da7c987a402301563611c3a7a6
[]
no_license
bryeduria/wc-training-snippets
37b5f589de6c090b25e7999f4d3806849d86c77c
50f169fc70f334fc3179638a5da860c662f1de2d
refs/heads/master
2020-07-05T16:25:27.267822
2019-08-16T09:52:32
2019-08-16T09:52:32
202,698,612
0
0
null
2019-08-16T09:23:54
2019-08-16T09:23:54
null
UTF-8
Java
false
false
1,109
java
package com.whitecloak.training.rpg.model; import java.util.Set; public class Hero { private int id; private String name; private int level; private HeroStats stats; private Equipments equipments; private Set<HeroSkill> skills; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getLevel() { return level; } public void setLevel(int level) { this.level = level; } public HeroStats getStats() { return stats; } public void setStats(HeroStats status) { this.stats = status; } public Equipments getEquipments() { return equipments; } public void setEquipments(Equipments equipments) { this.equipments = equipments; } public Set<HeroSkill> getSkills() { return skills; } public void setSkills(Set<HeroSkill> skills) { this.skills = skills; } }
[ "bryan.eduria@whitecloak.com" ]
bryan.eduria@whitecloak.com
eaf9b96f7cabf16ae5f09bda5e96cabdca44e60d
b80d5f3dfd48e859d14c7b53d529d9b99da2bf88
/swing5-comp/JTable/src/TweakingTableEditing/TweakingTableEditingDemo.java
686c8bb47eb62ec9569d810f01c2d1460bd84b8c
[]
no_license
divannn/swng
35f96d30e8e2187fad0cd8584b64c91cd910d579
ed943181620e3dcc367def3c7db9cabc781d223f
refs/heads/master
2021-01-21T13:11:47.130036
2012-10-28T21:48:56
2012-10-28T21:48:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,877
java
package TweakingTableEditing; import java.awt.AWTEvent; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.GridLayout; import java.awt.KeyboardFocusManager; import java.awt.event.FocusEvent; import java.awt.event.KeyEvent; import javax.swing.BorderFactory; import javax.swing.DefaultCellEditor; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.KeyStroke; import javax.swing.UIManager; import javax.swing.table.DefaultTableModel; /** * Enhancements: * <br>1. Remove borders for common editors - text field and combo. * <br>2. Open popup for combo editor automatically. * <br>3. Add rows on tabbing to a cell beyond the last cell. * <br> * <br> Also there are two useful properties in JTable that controls some aspects of editing. * <br><strong>"JTable.autoStartsEdit"</strong>: * The value is of type Java.lang.Boolean. This property tells whether JTable should start edit when a key is types. If the value of this property is null, it defaults to Boolean.TRUE. So this feature is enabled by default in JTable. * <br><strong>"terminateEditOnFocusLost"</strong>: * The value is of type Java.lang.Boolean. This property tells whether what to do when focus goes outside of JTable. It first tries to commit the changes in editor, if can't be committed then the changes are cancelled. If the value of this property is null, it default to Boolean.FALSE. So this feature is disabled by default in JTable. You can enable this feature as follows: * table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); * <br> * <br> * Also there are useful methods for editing table (not used here): * <br> * {@link DefaultCellEditor#setClickCountToStart(int)} * <br> * {@link JTable#setSurrendersFocusOnKeystroke(boolean)}) * @author santosh * @author idanilov * @jdk 1.5 */ public class TweakingTableEditingDemo extends JFrame { private String [] columnNames = { "Combo editor","col2","col3", }; private String [][] data = { {"1","2","3",}, {"6","7","8",}, {"11","12","13",}, {"16","17","18",}, {"21","22","23",}, }; public TweakingTableEditingDemo() { super(TweakingTableEditingDemo.class.getSimpleName()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setContentPane(createContents()); } private JPanel createContents() { JPanel result = new JPanel(new GridLayout(2,1)); result.add(createDefaultTable()); result.add(createImprovedTable()); return result; } private JPanel createDefaultTable() { DefaultTableModel dtm = new DefaultTableModel(data,columnNames); JTable table = new JTable(dtm); JComboBox combo = new JComboBox(new String[] {"item1", "item2", "item3"}); table.getColumn(columnNames[0]).setCellEditor(new DefaultCellEditor(combo)); table.setPreferredScrollableViewportSize(new Dimension(300,100)); JScrollPane sp = new JScrollPane(table); JPanel result = new JPanel(new BorderLayout()); result.add(new JLabel("Default table:"),BorderLayout.NORTH); result.add(sp,BorderLayout.CENTER); return result; } private JPanel createImprovedTable() { DefaultTableModel dtm = new DefaultTableModel(data,columnNames); JTable table = new JTable(dtm) { // add rows on tabbing to a cell beyond the last cell. private final KeyStroke TAB = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0); public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) { AWTEvent currentEvent = EventQueue.getCurrentEvent(); if (currentEvent instanceof KeyEvent) { KeyEvent ke = (KeyEvent) currentEvent; if (ke.getSource() != this) { return; } // focus change with keyboard. if (rowIndex == 0 && columnIndex == 0 && KeyStroke.getKeyStrokeForEvent(ke).equals(TAB)) { ((DefaultTableModel) getModel()).addRow(new Object[getColumnCount()]); rowIndex = getRowCount() - 1; } } super.changeSelection(rowIndex, columnIndex, toggle, extend); } }; //uncomment this line to start editing in cell only by F2. //table.putClientProperty("JTable.autoStartsEdit",Boolean.FALSE); //uncomment this line to stop editing on table focus lost. //table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); JTextField tf = new JTextField(); tf.setBorder(BorderFactory.createEmptyBorder());// remove border. table.setDefaultEditor(Object.class, new DefaultCellEditor(tf)); JComboBox combo = new JComboBox(new String[] { "item1", "item2", "item3" }) { // make JComboBox popup open when user invokes editing with F2 key. public void processFocusEvent(FocusEvent fe) { super.processFocusEvent(fe); Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager() .getFocusOwner(); if (isDisplayable() && fe.getID() == FocusEvent.FOCUS_GAINED && focusOwner == this && !isPopupVisible()) { showPopup(); } } }; combo.setBorder(BorderFactory.createEmptyBorder());// remove border. table.getColumn(columnNames[0]).setCellEditor(new DefaultCellEditor(combo)); table.setPreferredScrollableViewportSize(new Dimension(300,100)); JScrollPane sp = new JScrollPane(table); JPanel result = new JPanel(new BorderLayout()); result.add(new JLabel("Improved table:"),BorderLayout.NORTH); result.add(sp,BorderLayout.CENTER); return result; } public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e){ e.printStackTrace(); } TweakingTableEditingDemo f = new TweakingTableEditingDemo(); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } }
[ "divannn@mail.ru" ]
divannn@mail.ru
8b0b84e53c9b6e909cb36984f1674764713d6261
760d4617d78aa613186f7547c735198c39d700c8
/sorter/src/test/java/sortpom/processinstruction/IgnoredSectionsStoreTest.java
da48a28f9368ac7d45be9d6eacf8a46069b3a8ac
[ "LicenseRef-scancode-free-unknown", "BSD-3-Clause" ]
permissive
sachsgit/sortpom
753dcdc8138c955be31b80d658fafc8004e9ddb3
861853d14805abfb845c08876cdef739a4913ad1
refs/heads/master
2022-05-14T03:20:59.673482
2022-04-11T02:00:14
2022-04-11T02:00:14
219,858,614
0
0
BSD-3-Clause
2022-04-11T02:00:14
2019-11-05T22:00:21
Java
UTF-8
Java
false
false
12,039
java
package sortpom.processinstruction; import org.junit.Before; import org.junit.Test; import refutils.ReflectionHelper; import java.util.ArrayList; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; /** * @author bjorn * @since 2013-12-28 */ public class IgnoredSectionsStoreTest { private IgnoredSectionsStore ignoredSectionsStore; private ArrayList<String> ignoredSections; @SuppressWarnings("unchecked") @Before public void setUp() { ignoredSectionsStore = new IgnoredSectionsStore(); ignoredSections = new ReflectionHelper(ignoredSectionsStore).getField(ArrayList.class); } @Test public void replaceNoSectionShouldReturnSameXml() { String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n" + " <artifactId>sortpom</artifactId>\n" + " <description name=\"pelle\" id=\"id\" other=\"övrigt\">Här använder vi åäö</description>\n" + " <groupId>sortpom</groupId>\n" + " <modelVersion>4.0.0</modelVersion>\n" + " <name>SortPom</name>\n" + " <!-- Egenskaper för projektet -->\n" + " <properties>\n" + " <compileSource>1.6</compileSource>\n" + " <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n" + " </properties>\n" + " <reporting />\n" + " <version>1.0.0-SNAPSHOT</version>\n" + "</project>"; String replaced = ignoredSectionsStore.replaceIgnoredSections(xml); assertThat(replaced, is(xml)); assertThat(ignoredSections.size(), is(0)); } @Test public void replaceOneSectionShouldCreateOneToken() { String xml = "abc<?sortpom ignore?>def<?sortpom resume?>cba"; String replaced = ignoredSectionsStore.replaceIgnoredSections(xml); assertThat(replaced, is("abc<?sortpom token='0'?>cba")); assertThat(ignoredSections.size(), is(1)); assertThat(ignoredSections.get(0), is("<?sortpom ignore?>def<?sortpom resume?>")); } @Test public void replaceMultipleSectionShouldCreateManyTokens() { String xml = "abc<?sortpom ignore?>def1<?sortpom resume?>cbaabc<?SORTPOM Ignore?>def2<?sortPom reSUME?>cba"; String replaced = ignoredSectionsStore.replaceIgnoredSections(xml); assertThat(replaced, is("abc<?sortpom token='0'?>cbaabc<?sortpom token='1'?>cba")); assertThat(ignoredSections.size(), is(2)); assertThat(ignoredSections.get(0), is("<?sortpom ignore?>def1<?sortpom resume?>")); assertThat(ignoredSections.get(1), is("<?SORTPOM Ignore?>def2<?sortPom reSUME?>")); } @Test public void replaceMultipleLineXmlShouldCreateManyTokens() { String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n" + "\n" + " <modelVersion>4.0.0</modelVersion>\n" + "\n" + " <!-- Basics -->\n" + " <groupId>something</groupId>\n" + " <artifactId>maven-sortpom-sorter</artifactId>\n" + " <version>1.0</version>\n" + " <packaging>jar</packaging>\n" + " <name>SortPom Sorter</name>\n" + " <description>The sorting functionality</description>\n" + "\n" + " <dependencies>\n" + " <dependency>\n" + " <groupId>org.jdom</groupId>\n" + " <artifactId>jdom</artifactId>\n" + " <version>1.1.3</version>\n" + " </dependency>\n" + " <dependency>\n" + " <groupId>junit</groupId>\n" + " <artifactId>junit</artifactId>\n" + " <?sortpom ignore?>\n" + " <version>4.11</version><!--$NO-MVN-MAN-VER$ -->\n" + " <?sortpom resume?>\n" + " <scope>test</scope>\n" + " </dependency>\n" + " <dependency>\n" + " <groupId>commons-io</groupId>\n" + " <artifactId>commons-io</artifactId>\n" + " <?sortpom ignore?>\n" + " <version>2.1</version><!--$NO-MVN-MAN-VER$ -->\n" + " <?sortpom resume?>\n" + " </dependency>\n" + "\n" + " <!-- Test dependencies -->\n" + " <dependency>\n" + " <groupId>com.google.code.reflection-utils</groupId>\n" + " <artifactId>reflection-utils</artifactId>\n" + " <version>0.0.1</version>\n" + " <scope>test</scope>\n" + " </dependency>\n" + " </dependencies>\n" + "\n" + "</project>\n"; ignoredSectionsStore.replaceIgnoredSections(xml); assertThat(ignoredSections.size(), is(2)); assertThat(ignoredSections.get(0), is("<?sortpom ignore?>\n" + " <version>4.11</version><!--$NO-MVN-MAN-VER$ -->\n" + " <?sortpom resume?>")); assertThat(ignoredSections.get(1), is("<?sortpom ignore?>\n" + " <version>2.1</version><!--$NO-MVN-MAN-VER$ -->\n" + " <?sortpom resume?>")); } @Test public void revertTokensInOrderShouldWork() { String xml = "abc<?sortpom token='0'?>cbaabc<?sortpom token='1'?>cba"; ignoredSections.add("<?sortpom ignore?>def1<?sortpom resume?>"); ignoredSections.add("<?SORTPOM Ignore?>def2<?sortPom reSUME?>"); String replaced = ignoredSectionsStore.revertIgnoredSections(xml); assertThat(replaced, is("abc<?sortpom ignore?>def1<?sortpom resume?>cbaabc<?SORTPOM Ignore?>def2<?sortPom reSUME?>cba")); } @Test public void revertTokensInRearrangedOrderShouldPlaceTextInRightOrder() { String xml = "abc<?sortpom token='1'?>cbaabc<?sortpom token='0'?>cba"; ignoredSections.add("<?sortpom ignore?>def0<?sortpom resume?>"); ignoredSections.add("<?SORTPOM Ignore?>def1<?sortPom reSUME?>"); String replaced = ignoredSectionsStore.revertIgnoredSections(xml); assertThat(replaced, is("abc<?SORTPOM Ignore?>def1<?sortPom reSUME?>cbaabc<?sortpom ignore?>def0<?sortpom resume?>cba")); } @Test public void revertTokensInMultipleLinesShouldPlaceTextInRightOrder() { String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n" + "\n" + " <modelVersion>4.0.0</modelVersion>\n" + "\n" + " <!-- Basics -->\n" + " <groupId>something</groupId>\n" + " <artifactId>maven-sortpom-sorter</artifactId>\n" + " <version>1.0</version>\n" + " <packaging>jar</packaging>\n" + "\n" + " <dependencies>\n" + " <dependency>\n" + " <groupId>commons-io</groupId>\n" + " <artifactId>commons-io</artifactId>\n" + " <?sortpom token='1'?>\n" + " </dependency>\n" + " <dependency>\n" + " <groupId>org.jdom</groupId>\n" + " <artifactId>jdom</artifactId>\n" + " <version>1.1.3</version>\n" + " </dependency>\n" + "\n" + " <!-- Test dependencies -->\n" + " <dependency>\n" + " <groupId>com.google.code.reflection-utils</groupId>\n" + " <artifactId>reflection-utils</artifactId>\n" + " <version>0.0.1</version>\n" + " <scope>test</scope>\n" + " </dependency>\n" + " <dependency>\n" + " <groupId>junit</groupId>\n" + " <artifactId>junit</artifactId>\n" + " <?sortpom token='0'?>\n" + " <scope>test</scope>\n" + " </dependency>\n" + " </dependencies>\n" + " <name>SortPom Sorter</name>\n" + " <description>The sorting functionality</description>\n" + "\n" + "</project>\n"; ignoredSections.add("<?sortpom ignore?>\n" + " <version>4.11</version><!--$NO-MVN-MAN-VER$ -->\n" + " <?sortpom resume?>"); ignoredSections.add("<?sortpom ignore?>\n" + " <version>2.1</version><!--$NO-MVN-MAN-VER$ -->\n" + " <?sortpom resume?>"); String replaced = ignoredSectionsStore.revertIgnoredSections(xml); assertThat(replaced, is("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n" + "\n" + " <modelVersion>4.0.0</modelVersion>\n" + "\n" + " <!-- Basics -->\n" + " <groupId>something</groupId>\n" + " <artifactId>maven-sortpom-sorter</artifactId>\n" + " <version>1.0</version>\n" + " <packaging>jar</packaging>\n" + "\n" + " <dependencies>\n" + " <dependency>\n" + " <groupId>commons-io</groupId>\n" + " <artifactId>commons-io</artifactId>\n" + " <?sortpom ignore?>\n" + " <version>2.1</version><!--$NO-MVN-MAN-VER$ -->\n" + " <?sortpom resume?>\n" + " </dependency>\n" + " <dependency>\n" + " <groupId>org.jdom</groupId>\n" + " <artifactId>jdom</artifactId>\n" + " <version>1.1.3</version>\n" + " </dependency>\n" + "\n" + " <!-- Test dependencies -->\n" + " <dependency>\n" + " <groupId>com.google.code.reflection-utils</groupId>\n" + " <artifactId>reflection-utils</artifactId>\n" + " <version>0.0.1</version>\n" + " <scope>test</scope>\n" + " </dependency>\n" + " <dependency>\n" + " <groupId>junit</groupId>\n" + " <artifactId>junit</artifactId>\n" + " <?sortpom ignore?>\n" + " <version>4.11</version><!--$NO-MVN-MAN-VER$ -->\n" + " <?sortpom resume?>\n" + " <scope>test</scope>\n" + " </dependency>\n" + " </dependencies>\n" + " <name>SortPom Sorter</name>\n" + " <description>The sorting functionality</description>\n" + "\n" + "</project>\n")); } }
[ "bjorn.ekryd@gmail.com" ]
bjorn.ekryd@gmail.com
ccd868045d3f31de57ca14da7eeddb377218c1d3
39575b0c1ef8782b0cf9f8c0ded306c45e731f5f
/src/ru/viljinsky/dialogs/DialogsControl.java
870b757b4a4a71f904655d0115971eb463af0b1b
[]
no_license
viljinsky/timegrid2
d8c4b6d8f374411248ab85fbc243b19d3643853b
c143ccb14315e3a30f911dca6f6d512193977b94
refs/heads/master
2021-01-22T23:43:46.586171
2015-05-14T09:45:42
2015-05-14T09:45:42
31,596,756
1
0
null
null
null
null
UTF-8
Java
false
false
3,087
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 ru.viljinsky.dialogs; import java.util.Map; import javax.swing.ComboBoxModel; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JTextField; import javax.swing.event.ListDataListener; /** * * @author вадик */ interface IMyControl{ public void setValue(Object value); public Object getValue(); public JComponent getComponent(); public String getColumnName(); } class TextControl extends JTextField implements IMyControl{ String columnName; public TextControl(String columnName){ super(10); this.columnName=columnName; } @Override public String getColumnName(){ return columnName; } @Override public void setValue(Object value) { if (value==null) setText(""); else setText(value.toString()); } @Override public Object getValue() { if (getText().isEmpty()) return null; else return getText(); } @Override public JComponent getComponent() { return this; } } class ListControl extends JComboBox implements IMyControl{ Object value; String columnName; Map<Object,Object> lookup; class ListModel implements ComboBoxModel{ @Override public void setSelectedItem(Object anItem) { for (Object key:lookup.keySet()){ if (lookup.get(key).equals(anItem)){ value = key; break; } } } @Override public Object getSelectedItem() { return lookup.get(value); } @Override public int getSize() { return lookup.size(); } @Override public Object getElementAt(int index) { int n=0; for (Object key:lookup.keySet()){ if (n==index) return lookup.get(key); n+=1; } return null; } @Override public void addListDataListener(ListDataListener l) { } @Override public void removeListDataListener(ListDataListener l) { } } public ListControl(String columnName,Map<Object,Object> lookup){ super(); this.columnName = columnName; this.lookup=lookup; setModel(new ListModel()); } @Override public void setValue(Object value) { this.value=value; } @Override public Object getValue() { return value ; } @Override public JComponent getComponent() { return this; } @Override public String getColumnName() { return columnName; } }
[ "Iljinsky" ]
Iljinsky
57e4109c5671bb2f89aebeb06f11e24fd1e3d2c1
3c985445861c86518ac152441d68d5eacc440bb2
/src/main/java/com/shop/business/chicmeproduct/service/impl/ChicmeProductServiceImpl.java
887907d0da04d29870267f745011e70636e7d8de
[]
no_license
gulangzai/shop
df2ada63d844605cbf79cf2d11ef097b8ab67f18
1ddab358219c2ee88c261d2f8471b940e7c9c592
refs/heads/master
2021-07-03T09:22:02.769221
2017-09-23T14:30:39
2017-09-23T14:30:39
100,442,481
1
1
null
null
null
null
UTF-8
Java
false
false
2,389
java
package com.shop.business.chicmeproduct.service.impl; import java.util.List; import javax.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.lanbao.base.Page; import com.lanbao.base.PageData; import com.shop.business.chicmeproduct.dao.ChicmeProductDao; import com.shop.business.chicmeproduct.service.ChicmeProductService; @Service("chicmeProductService") public class ChicmeProductServiceImpl implements ChicmeProductService { @Autowired public ChicmeProductDao chicmeProductDao; /* * save */ public int save(PageData pd)throws Exception{ chicmeProductDao.save("ChicmeProductMapper.save", pd); int ID = (int) pd.get("ID"); return ID; } /* * delete */ public void delete(PageData pd)throws Exception{ chicmeProductDao.delete("ChicmeProductMapper.delete", pd); } /* *edit */ public void edit(PageData pd)throws Exception{ chicmeProductDao.update("ChicmeProductMapper.edit", pd); } /* *list */ public List<PageData> list(Page page)throws Exception{ return (List<PageData>)chicmeProductDao.findForList("ChicmeProductMapper.datalistPage", page); } public int datalistPageCount(Page page) throws Exception { // TODO Auto-generated method stub return (int)chicmeProductDao.findForObject("ChicmeProductMapper.datalistPageCount", page); } /* *listAll */ public List<PageData> listAll(PageData pd)throws Exception{ return (List<PageData>)chicmeProductDao.findForList("ChicmeProductMapper.listAll", pd); } /* *findById */ public PageData findById(PageData pd)throws Exception{ return (PageData)chicmeProductDao.findForObject("ChicmeProductMapper.findById", pd); } /* *deleteAll */ public void deleteAll(String[] ArrayDATA_IDS)throws Exception{ chicmeProductDao.delete("ChicmeProductMapper.deleteAll", ArrayDATA_IDS); } public List<PageData> findByClassId(Page page) throws Exception { // TODO Auto-generated method stub return (List<PageData>)chicmeProductDao.findForList("ChicmeProductMapper.findByClassId", page); } public List<PageData> findNewHot(Page page) throws Exception { // TODO Auto-generated method stub return (List<PageData>)chicmeProductDao.findForList("ChicmeProductMapper.findNewHot", page); } }
[ "1871710810@qq.com" ]
1871710810@qq.com
8164182fbe17c578ab04dfae61fe6dbc67aa4973
c34ac928eae8b2b7923d036f78dbea0168ebae0f
/spb/euretick2/src/main/java/com/jf/euretick2/config/HystrixConfig.java
537c205cff6269cf25acc48c66d841b546a401fe
[]
no_license
suhaihao/springcloud
350719ef4b386eb50d76d0eb6cdac12d9df7d9a1
f59a585cd475722130d8b079c7b746faeea90433
refs/heads/master
2020-04-09T17:46:26.088356
2018-12-05T08:54:20
2018-12-05T08:54:46
160,490,817
0
0
null
null
null
null
UTF-8
Java
false
false
892
java
package com.jf.euretick2.config; import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class HystrixConfig { @Bean public HystrixMetricsStreamServlet hystrixMetricsStreamServlet() { return new HystrixMetricsStreamServlet(); } @Bean public ServletRegistrationBean registration(HystrixMetricsStreamServlet servlet){ ServletRegistrationBean registrationBean = new ServletRegistrationBean(); registrationBean.setServlet(servlet); registrationBean.setEnabled(true);//是否启用该registrationBean registrationBean.addUrlMappings("/actuator/hystrix.stream"); return registrationBean; } }
[ "suhai505604843@qq.com" ]
suhai505604843@qq.com
68bbec2088a5f0707709757742685a5971157d6e
2c2481682dbd0d928ec318370319a0b114d7d768
/web-saver/common/src/main/java/ru/geekbrains/common/message/Address.java
49cce98ff53ebfba98b68bb324a6ce562568bb08
[]
no_license
ChernetsovNG/geekbrains
f3e5fa947460d79ee7742c16a1718917df740fd0
0cd3dc0491b4993eaf3f91eed0b1d6572f561795
refs/heads/master
2021-01-18T13:16:49.811653
2019-03-03T13:13:09
2019-03-03T13:13:09
100,375,364
0
0
null
null
null
null
UTF-8
Java
false
false
255
java
package ru.geekbrains.common.message; import lombok.Data; import java.io.Serializable; @Data public class Address implements Serializable { private final String address; public Address(String address) { this.address = address; } }
[ "n.chernetsov86@gmail.com" ]
n.chernetsov86@gmail.com
14bc8099a425c4e953d61ed529e0073b67ac10f3
5aef648be1123e6492bcd55e01ff8b91ca8db5f7
/app/src/test/java/com/android/shopingDemoTest/ExampleUnitTest.java
31fa419e556fa9039849e2d312c60a7eab0ef5ce
[]
no_license
devRohitGangurde/demoShoppingCart
6ef1a82e03727e9ff585e61b8dc6682b92f9aa96
02c2c0154cf0ce50b647c42b12556495de1419a1
refs/heads/master
2022-12-16T10:22:41.145728
2020-09-21T05:04:25
2020-09-21T05:04:25
297,233,327
0
0
null
null
null
null
UTF-8
Java
false
false
388
java
package com.android.shopingDemoTest; 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); } }
[ "rohit.gangurde@netwininfo.com" ]
rohit.gangurde@netwininfo.com
cbe4208edf389863e45505761ee074ac9a72da18
38c71315fc26dc4db9ea67a78cc6ed95160888c0
/module_lib/src/UI3/java/com/lechuang/module/mytry/TryDetailsActivity.java
06b4e23bc38b932719193fbcf2a5c506988e10ff
[]
no_license
nmbwq/taomimi
cbc10e0224a497b6c9c18984ec3f81ee7132647d
e39a7aad0ae6e602c0f97465162896a8630cbf2d
refs/heads/master
2020-07-12T19:36:26.138642
2019-08-28T09:10:09
2019-08-28T09:10:09
204,891,520
0
0
null
null
null
null
UTF-8
Java
false
false
37,925
java
package java.com.lechuang.module.mytry; import android.content.ActivityNotFoundException; import android.content.ClipData; import android.content.ClipboardManager; import android.content.ComponentName; import android.content.Intent; import android.graphics.Paint; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.RelativeLayout; import android.widget.TextView; import com.alibaba.android.arouter.facade.annotation.Autowired; import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.launcher.ARouter; import com.bumptech.glide.Glide; import com.chad.library.adapter.base.BaseViewHolder; import com.common.app.arouter.ARouters; import com.common.app.base.BaseActivity; import com.common.app.base.BaseApplication; import com.common.app.http.NetWork; import com.common.app.http.RxObserver; import com.common.app.http.api.Qurl; import com.common.app.http.cancle.ApiCancleManager; import com.common.app.utils.CountDownTextView; import com.common.app.utils.Logger; import com.common.app.utils.OnClickEvent; import com.common.app.utils.ShareUtils; import com.common.app.utils.Utils; import com.common.app.view.NumSeekBar; import com.common.app.view.SquareImageView; import com.lechuang.module.R; import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.api.RefreshLayout; import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener; import com.umeng.socialize.UMShareListener; import com.umeng.socialize.bean.SHARE_MEDIA; import com.yanzhenjie.permission.Action; import com.yanzhenjie.permission.AndPermission; import com.yanzhenjie.permission.Permission; import com.zhouwei.mzbanner.BannerBgContainer; import com.zhouwei.mzbanner.MZBannerView; import com.zhouwei.mzbanner.holder.MZHolderCreator; import com.zhouwei.mzbanner.holder.MZViewHolder; import java.com.lechuang.module.ModuleApi; import java.com.lechuang.module.bean.JoinSuccessBean; import java.com.lechuang.module.bean.MyTryBean; import java.com.lechuang.module.bean.ShowInMyCardBean; import java.com.lechuang.module.bean.TryDetailsBean; import java.com.lechuang.module.bean.TryRuleBean; import java.com.lechuang.module.mytry.adapter.MyTryRvAdapter; import java.com.lechuang.module.mytry.adapter.TryDetailsAdapter; import java.com.lechuang.module.mytry.adapter.TryDetailsBannerViewHolder; import java.com.lechuang.module.mytry.bean.MyTryAllEntity; import java.com.lechuang.module.mytry.bean.TryDetailsEntity; import java.com.lechuang.module.product.adapter.BannerViewHolder; import java.sql.Time; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.schedulers.Schedulers; @Route(path = ARouters.PATH_TRY_DETAILS) public class TryDetailsActivity extends BaseActivity implements View.OnClickListener, OnRefreshLoadMoreListener { private PopupWindow mPopupWindow; private TextView mTvButton,mTvPopContent,mTvPopFinish,mTvPopNext,mTvPopMinus,mTvPopNum,mTvPopPlus,mTvNowTishi; private SmartRefreshLayout mSmartRefreshLayout; public BannerBgContainer mBannerBgContainer; // private NumSeekBar numSeekBar; private RecyclerView mRvFenSi; private LinearLayout mLlFriend,mTvPopJingGao,mLlFenxiang; private ImageView mImageView; private int num=0; @Autowired public int id;//参与活动商品id @Autowired public int obtype;//1.参与试用 2参与中查看详情 3待开奖 4未中奖 5已中奖 @Autowired public String winNum;//已开奖状态 需要 public static boolean refresh=false; private LinearLayout mLlPopweixin,mLlPoppengyou,mLlPophaoyou,mLlPopkongjian; private ImageView mIvPopFinish; private int chaNumber=0; @Override protected int getLayoutId() { return R.layout.activity_try_details; } @Override protected void findViews() { $(R.id.iv_common_back).setOnClickListener(this); $(R.id.iv_common_right).setOnClickListener(this); mImageView = $(R.id.iv_tishi); mImageView.setOnClickListener(this); mSmartRefreshLayout = $(R.id.mSmartRefreshLayout); mLlFriend = $(R.id.ll_friend); mLlFenxiang = $(R.id.ll_fenxiang); mLlFenxiang.setOnClickListener( this ); mRvFenSi = $(R.id.rv_mytry); mTvButton = $(R.id.tv_btn); } @Override protected void initView() { ARouter.getInstance().inject(this); if (obtype==1){ ((TextView) $(R.id.iv_common_title)).setText("试用专区"); }else { ((TextView) $(R.id.iv_common_title)).setText("我的试用"); } mSmartRefreshLayout.setOnRefreshLoadMoreListener ( this ); mSmartRefreshLayout.setEnableLoadMore ( false ); } @Override protected void getData() { updataAlipay(); } @Override public void onClick(View view) { int id = view.getId(); if (id == R.id.et_bind_zfb_save){ updataAlipay(); }else if (id== R.id.iv_common_back){ finish(); }else if (id==R.id.iv_common_right){ AndPermission.with(TryDetailsActivity.this) .permission( Permission.Group.STORAGE) .onGranted(new Action() { @Override public void onAction(List<String> permissions) { //这里需要读写的权限 ARouter.getInstance().build(ARouters.PATH_SHARE_APP).navigation(); } }) .onDenied(new Action() { @Override public void onAction(@NonNull List<String> permissions) { if (AndPermission.hasAlwaysDeniedPermission(TryDetailsActivity.this, permissions)) { //这个里面提示的是一直不过的权限 } } }) .start(); }else if (id==R.id.iv_tishi){ mImageView.setVisibility( View.GONE ); }else if (id==R.id.ll_fenxiang){ getPopShareApp(); }else if (id==R.id.iv_finish){ mPopupWindow.dismiss(); }else if (id==R.id.ll_shareweixin){ ShareUtils.umShare(this, SHARE_MEDIA.WEIXIN, MyTryActivity.uriListUm, new UMShareListener() { @Override public void onStart(SHARE_MEDIA share_media) { Logger.e("-----", "onStart"); } @Override public void onResult(SHARE_MEDIA share_media) { Logger.e("-----", "onResult"); } @Override public void onError(SHARE_MEDIA share_media, Throwable throwable) { Logger.e("-----", "onError"); } @Override public void onCancel(SHARE_MEDIA share_media) { Logger.e("-----", "onCancel"); } }); }else if (id==R.id.ll_sharepengyou){ ShareUtils.umShare(this, SHARE_MEDIA.WEIXIN_CIRCLE, MyTryActivity.uriListUm, new UMShareListener() { @Override public void onStart(SHARE_MEDIA share_media) { Logger.e("-----", "onStart"); } @Override public void onResult(SHARE_MEDIA share_media) { Logger.e("-----", "onResult"); } @Override public void onError(SHARE_MEDIA share_media, Throwable throwable) { Logger.e("-----", "onError"); } @Override public void onCancel(SHARE_MEDIA share_media) { Logger.e("-----", "onCancel"); } }); // addShare(image,SHARE_MEDIA.WEIXIN_CIRCLE); }else if (id==R.id.ll_sharehaoyou){ ShareUtils.umShare(this, SHARE_MEDIA.QQ, MyTryActivity.uriListUm, new UMShareListener() { @Override public void onStart(SHARE_MEDIA share_media) { Logger.e("-----", "onStart"); } @Override public void onResult(SHARE_MEDIA share_media) { Logger.e("-----", "onResult"); } @Override public void onError(SHARE_MEDIA share_media, Throwable throwable) { Logger.e("-----", "onError"); } @Override public void onCancel(SHARE_MEDIA share_media) { Logger.e("-----", "onCancel"); } }); }else if (id==R.id.ll_sharekongjian){ ShareUtils.umShare(this, SHARE_MEDIA.QZONE, MyTryActivity.uriListUm, new UMShareListener() { @Override public void onStart(SHARE_MEDIA share_media) { Logger.e("-----", "onStart"); } @Override public void onResult(SHARE_MEDIA share_media) { Logger.e("-----", "onResult"); } @Override public void onError(SHARE_MEDIA share_media, Throwable throwable) { Logger.e("-----", "onError"); } @Override public void onCancel(SHARE_MEDIA share_media) { Logger.e("-----", "onCancel"); } }); } } private void getPopShareApp(){ View contentView = LayoutInflater.from ( this ).inflate ( R.layout.popupwind_share_goods, null ); mPopupWindow = new PopupWindow ( contentView, RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT, true ); //mLlPopweixin,mLlPoppengyou,mLlPophaoyou,mLlPopkongjian mLlPopweixin = (LinearLayout) contentView.findViewById ( R.id.ll_shareweixin ); mLlPoppengyou = (LinearLayout) contentView.findViewById ( R.id.ll_sharepengyou ); mLlPophaoyou = (LinearLayout) contentView.findViewById ( R.id.ll_sharehaoyou ); mLlPopkongjian = (LinearLayout) contentView.findViewById ( R.id.ll_sharekongjian ); mIvPopFinish = (ImageView) contentView.findViewById ( R.id.iv_finish ); mLlPopweixin.setOnClickListener( this ); mLlPoppengyou.setOnClickListener( this ); mLlPophaoyou.setOnClickListener( this ); mLlPopkongjian.setOnClickListener( this ); mIvPopFinish.setOnClickListener( this ); mPopupWindow.setContentView ( contentView ); mPopupWindow.showAtLocation ( contentView, Gravity.BOTTOM, 0, 0 ); } private void updataAlipay() { Map<String, Object> allParam = new HashMap<>(); allParam.put("id", id); allParam.put("obtype", obtype); if (!TextUtils.isEmpty(winNum)) { allParam.put("winNum", winNum); } NetWork.getInstance() .setTag( Qurl.tryDetails) .getApiService(ModuleApi.class) .tryDetails(allParam) .subscribeOn( Schedulers.io()) .observeOn( AndroidSchedulers.mainThread()) .subscribe(new RxObserver<TryDetailsBean> (TryDetailsActivity.this,true,false) { @Override public void onSuccess(final TryDetailsBean result) { if (result==null){ setRefreshLoadMoreState ( true, true ); return; } setRefreshLoadMoreState ( true, false ); setHomeAdapter(result); if (result.retype==1){ mTvButton.setText( "参与试用" ); mLlFriend.setVisibility( View.VISIBLE ); mLlFenxiang.setVisibility( View.VISIBLE ); mImageView.setVisibility( View.VISIBLE ); mTvButton.setOnClickListener( new OnClickEvent() { @Override public void singleClick(View v) { getCardsNum(result.retype); // showPopupWindow(); } } ); }else if (result.retype==2){ mTvButton.setText( "兑换更多试用码" ); mLlFriend.setVisibility( View.GONE ); mImageView.setVisibility( View.GONE ); mLlFenxiang.setVisibility( View.VISIBLE ); mTvButton.setOnClickListener( new OnClickEvent() { @Override public void singleClick(View v) { getCardsNum(result.retype); // showPopupWindow(); } } ); }else if (result.retype==3){//预计开奖 mLlFriend.setVisibility( View.VISIBLE ); mImageView.setVisibility( View.VISIBLE ); mLlFenxiang.setVisibility( View.VISIBLE ); mTvButton.setText( "预计开奖时间 "+result.product.preWinTime ); // result.product.preWinTime }else if (result.retype==4){//未中奖 // mTvButton.setText( "未中奖" ); mLlFenxiang.setVisibility( View.GONE ); mImageView.setVisibility( View.GONE ); LinearLayout.LayoutParams params=(LinearLayout.LayoutParams)mRvFenSi.getLayoutParams(); params.bottomMargin = 0; mRvFenSi.setLayoutParams( params ); }else if (result.retype==5){//中奖 // mTvButton.setText( "中奖" ); mLlFriend.setVisibility( View.GONE ); mImageView.setVisibility( View.GONE ); mLlFenxiang.setVisibility( View.VISIBLE ); mTvButton.setText( result.product.weChatNum+" 复制微信号" ); mTvButton.setOnClickListener( new OnClickEvent() { @Override public void singleClick(View v) { ClipData clipData = ClipData.newPlainText("app_inviteCode", result.product.weChatNum); ((ClipboardManager) TryDetailsActivity.this.getSystemService(CLIPBOARD_SERVICE)).setPrimaryClip(clipData); getWechatApi(); } } ); } //设置banner // setBannerData(result.product.showImgList); //价格 // mTvPrice.setText( ""+result.product.price ); //原价 // mTvYuanPrice.setText( result.ProductBean.price ); //标题 // mTvTitle.setText( result.product.name ); //进度条 // int num=result.product.realNum*100/result.product.needNum; // numSeekBar.setProgress( num ); // // // mTvContent.setText( result.regular ); } }); } /** * 跳转到微信 */ private void getWechatApi(){ try { Intent intent = new Intent(); ComponentName cmp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI"); intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setComponent(cmp); startActivity(intent); } catch (ActivityNotFoundException e) { // TODO: handle exception toast( "检查到您手机没有安装微信,请安装后使用该功能" ); } } /** * 设置adapter数据 * * @param result */ private List<TryDetailsEntity> mHomeAllEntities; private TryDetailsAdapter mHomeRvAdapter; private void setHomeAdapter(TryDetailsBean result) { if (mHomeAllEntities == null) { mHomeAllEntities = new ArrayList<>(); } mHomeAllEntities.clear(); if (result.product.showImgList != null && result.product.showImgList.size() > 0){ TryDetailsEntity homeAllEntity = new TryDetailsEntity(TryDetailsEntity.TYPE_HEADER); //更新使用者数据 homeAllEntity.mBanner = result.product; homeAllEntity.retype = result.retype; homeAllEntity.shortRegular = result.shortRegular; homeAllEntity.winNum = result.product.winNum; mHomeAllEntities.add(homeAllEntity); } // if (result.retype==4||result.retype==5){ // // }else { for (int i =0;i<result.product.detailImgList.size();i++){ TryDetailsEntity homeAllEntity = new TryDetailsEntity(TryDetailsEntity.TYPE_PRODUCT); homeAllEntity.images = result.product.detailImgList.get( i ); mHomeAllEntities.add(homeAllEntity); } // } if (mHomeRvAdapter ==null){ mHomeRvAdapter = new TryDetailsAdapter<TryDetailsEntity, BaseViewHolder>(mHomeAllEntities){ @Override protected void addItemTypeView() { addItemType(TryDetailsEntity.TYPE_HEADER, R.layout.activity_try_details_title); addItemType(TryDetailsEntity.TYPE_PRODUCT, R.layout.item_trydetails_list); } @Override protected void convert(BaseViewHolder helper, final TryDetailsEntity item) { if (helper.getItemViewType() == TryDetailsEntity.TYPE_HEADER) { setBannerData(helper,item); // setMarqueeView(helper,item.UseList); // ImageView imageView=helper.getView( R.id.iv_macard_bg ); // ImageView ivDi=helper.getView( R.id.iv_dibu ); // LogUtils.w( "tag1","是"+item.imgUrl ); // if (item.imgUrl!=null){ // Glide.with( BaseApplication.getApplication()).load(item.imgUrl).placeholder(R.drawable.bg_common_img_null).into(imageView); // ivDi.setVisibility( View.VISIBLE ); // } } else if (helper.getItemViewType() == TryDetailsEntity.TYPE_PRODUCT) { try { ImageView squareImageView = helper.getView( R.id.iv_item_all_product_tupian ); Glide.with(BaseApplication.getApplication()).load(item.images).into(squareImageView); //商品图片 /*ImageView ivItemAllFenLei = helper.getView(R.id.iv_item_all_product_tupian); Glide.with(BaseApplication.getApplication()).load(item.mProductListBean.showImg).placeholder(R.drawable.bg_common_img_null).into(ivItemAllFenLei); LogUtils.w( "tag1","图片是啥"+item.mProductListBean.showImg );*/ } catch (Exception e) { Logger.e("---->", e.toString()); } } } }; mRvFenSi.setHasFixedSize ( true ); mRvFenSi.setNestedScrollingEnabled ( false ); GridLayoutManager gridLayoutManager = new GridLayoutManager ( TryDetailsActivity.this, 1 ); mRvFenSi.setLayoutManager ( gridLayoutManager ); mRvFenSi.setAdapter ( mHomeRvAdapter ); } else { /*mHomeRvAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { int itemViewType = mHomeRvAdapter.getItemViewType(position); if (itemViewType == HomeAllEntity.TYPE_PRODUCT) { try { RouterBean routerBean = new RouterBean(); routerBean.type = 9; routerBean.tbCouponId = mHomeAllEntities.get(position).mProductListBean.tbCouponId; routerBean.mustParam = "type=1" + "&id=" + (TextUtils.isEmpty(mHomeAllEntities.get(position).mProductListBean.id) ? "" : mHomeAllEntities.get(position).mProductListBean.id) + "&tbItemId=" + mHomeAllEntities.get(position).mProductListBean.tbItemId; LinkRouterUtils.getInstance().setRouterBean(getActivity(), routerBean); } catch (Exception e) { toast(e.toString()); } } } });*/ mHomeRvAdapter.notifyDataSetChanged(); } } //设置Banner private List<String> mBannderData = new ArrayList<>(); private void setBannerData(BaseViewHolder helper, final TryDetailsEntity list){ MZBannerView bannerView = helper.getView(R.id.banner_all); if (list.mBanner.showImgList == null || list.mBanner.showImgList.size() <= 0) { return; } //价格 // mTvPrice.setText( ""+list.price ); BannerBgContainer bannerBgContainer = mBannerBgContainer; if (mBannderData == null) { mBannderData = new ArrayList<>(); } mBannderData.clear(); for (int i = 0; i < list.mBanner.showImgList.size(); i++) { mBannderData.add(list.mBanner.showImgList.get(i)); } bannerView.setBannerBgContainer(bannerBgContainer); // bannerView.setPages(mBannderData, new MZHolderCreator<TryDetailsBannerViewHolder>() { // @Override // public TryDetailsBannerViewHolder createViewHolder() { // return new TryDetailsBannerViewHolder(); // } // }); bannerView.setPages(mBannderData, new MZHolderCreator<BannerViewHolder>() { @Override public BannerViewHolder createViewHolder() { return new BannerViewHolder(); } }); bannerView.setIndicatorVisible( false ); bannerView.setIndicatorNumVisible( true ); bannerView.start(); // mTvContent = $(R.id.tv_content); // mTvPrice = $(R.id.tv_price); // mTvYuanPrice = $(R.id.tv_yuan_price); // mTvTitle = $(R.id.tv_biaoti); if (!TextUtils.isEmpty( list.mBanner.needNum+"" )){ TextView mTvNeedPeople=helper.getView( R.id.tv_try_details_needpeople ); mTvNeedPeople.setText( "需"+list.mBanner.needNum+"人次" ); } if (!TextUtils.isEmpty( list.mBanner.realNum+"" )){ TextView mTvAllPeople=helper.getView( R.id.tv_try_details_allpeople ); mTvAllPeople.setText( "共"+list.mBanner.realNum+"人次参与" ); } chaNumber=list.mBanner.needNum-list.mBanner.realNum; TextView mTvYuanPrice=helper.getView( R.id.tv_yuan_price ); TextView mTvTitle=helper.getView( R.id.tv_biaoti ); NumSeekBar numSeekBar = helper.getView(R.id.numSeekBar); //原价 mTvYuanPrice.setText( ""+list.mBanner.price ); mTvYuanPrice.getPaint().setFlags( Paint.STRIKE_THRU_TEXT_FLAG); //标题 mTvTitle.setText( list.mBanner.name ); //进度条 int num=list.mBanner.realNum*100/list.mBanner.needNum; numSeekBar.setSeekBarStyle(R.drawable.pro_seekbar_10); numSeekBar.setProgress( num ); LinearLayout guize=helper.getView( R.id.ll_try_guize );//规则 TextView textView=helper.getView( R.id.tv_try_short_regular );//短提示 LinearLayout winningBuju=helper.getView( R.id.ll_winning_buju );//底部 TextView tryTime=helper.getView( R.id.tv_yry_time );//时间 RelativeLayout winningNum=helper.getView( R.id.rl_winning_num );//中奖码 TextView tishiOne=helper.getView( R.id.tv_try_tishione );//提示1 TextView tishiTwo=helper.getView( R.id.tv_try_tishitwo );//提示2 TextView zhongJiang=helper.getView( R.id.tv_try_zhongjiang );//中奖 TextView showWinningNum=helper.getView( R.id.tv_winning_num );//显示的中奖码 TextView textViewGuize=helper.getView( R.id.tv_guize ); textViewGuize.setOnClickListener( new OnClickEvent() { @Override public void singleClick(View v) { ARouter.getInstance().build(ARouters.PATH_TRY_RULE).navigation(); } } ); if (list.retype==1||list.retype==2||list.retype==3){//参与试用||兑换更多试用码 guize.setVisibility( View.VISIBLE ); textView.setText( list.shortRegular ); winningBuju.setVisibility( View.GONE ); zhongJiang.setVisibility( View.GONE ); // }else if (list.retype==3){//预计开奖 }else if (list.retype==4){//未中奖 guize.setVisibility( View.GONE ); tryTime.setVisibility( View.VISIBLE ); zhongJiang.setVisibility( View.VISIBLE ); zhongJiang.setText( "未中奖, 试试其他商品吧"); tryTime.setText( "开始时间 "+list.mBanner.startTime+"\n结束时间 "+ list.mBanner.endTime); winningNum.setVisibility( View.VISIBLE );//中奖码 showWinningNum.setText( list.winNum ); tishiOne.setVisibility( View.GONE ); tishiTwo.setVisibility( View.GONE ); }else if (list.retype==5){//中奖 guize.setVisibility( View.GONE ); tryTime.setVisibility( View.VISIBLE ); tryTime.setText( "开始时间 "+list.mBanner.startTime+"\n结束时间 "+ list.mBanner.endTime); zhongJiang.setVisibility( View.VISIBLE ); zhongJiang.setText( "恭喜您, 已中奖, 中奖码为"+ list.winNum); winningNum.setVisibility( View.GONE );//中奖码 tishiOne.setVisibility( View.VISIBLE ); tishiTwo.setVisibility( View.VISIBLE ); } } private void getCardsNum(final int retype){ NetWork.getInstance() .setTag(Qurl.haveCardsNums) .getApiService(ModuleApi.class) .haveCardsNums() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new RxObserver<ShowInMyCardBean>(TryDetailsActivity.this, true, true) { @Override public void onSuccess(ShowInMyCardBean result) { if (result == null || TextUtils.isEmpty(result.number)) { // if (retype==1){ showPopupWindow(0); // } return; } if (retype==1){ showPopupWindow( Integer.parseInt(result.number) ); }else if (retype==2){ /*if (Integer.parseInt( result.number )==0){ showPopupWindow( Integer.parseInt(result.number) ); }else { showPopupWindowOther( Integer.parseInt(result.number) ); }*/ showPopupWindowOther( Integer.parseInt(result.number) ); } // toast( result.number ); } @Override public void onFailed(int errorCode, String moreInfo) { super.onFailed(errorCode, moreInfo); // if (retype==1){ showPopupWindow(0); // } } @Override public void onError(Throwable e) { super.onError(e); // if (retype==1){ showPopupWindow(0); // } } }); } private void getProduct(final int type,String num,final int id) { ApiCancleManager.getInstance().removeAll(); final Map<String, Object> allParam = new HashMap<>(); allParam.put("num", num); allParam.put("page", 1 + ""); allParam.put("type", "0");//参与活动 if (!TextUtils.isEmpty(""+id)) { allParam.put("id", id); } NetWork.getInstance() .setTag(Qurl.joinSuccess) .getApiService(ModuleApi.class) .joinSuccess(allParam) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new RxObserver<JoinSuccessBean>(TryDetailsActivity.this, false, true) { @Override public void onSuccess(JoinSuccessBean result) { if (result == null) { setRefreshLoadMoreState(true, true); return; } setRefreshLoadMoreState(true, false); if (!TextUtils.isEmpty(""+id)) {//id != null 是点击参与试用,需要跳转页面 mPopupWindow.dismiss(); updataAlipay(); Bundle bundle = new Bundle(); bundle.putSerializable("joinSuccess", result); bundle.putInt( "id", id ); ARouter.getInstance().build(ARouters.PATH_JOIN_SUCCESS_A).withInt("type",type ).with(bundle).navigation(); // ARouter.getInstance().build(ARouters.PATH_JOIN_SUCCESS_A).navigation(); } } @Override public void onFailed(int errorCode, String moreInfo) { super.onFailed(errorCode, moreInfo); setRefreshLoadMoreState(false, false); // if (errorCode==11003){ // toast( "活动已截止" ); // } // toast( moreInfo ); } @Override public void onError(Throwable e) { super.onError(e); setRefreshLoadMoreState(false, false); } }); } private void showPopupWindow( int content) { View contentView = LayoutInflater.from ( this ).inflate ( R.layout.popupwind_try_details, null ); mPopupWindow = new PopupWindow ( contentView, RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT, true ); //mTvPopContent,mTvPopFinish,mTvPopNext mTvPopContent = (TextView) contentView.findViewById ( R.id.tv_content ); mTvPopFinish = (TextView) contentView.findViewById ( R.id.tv_finish ); mTvPopNext = (TextView) contentView.findViewById ( R.id.tv_next ); // content=1; if (content==0 ){ mTvPopFinish.setText( "放弃" ); mTvPopNext.setText( "去邀请" ); mTvPopContent.setText ( "您的黄卡当前为"+content+"张\n快去邀请好友获得黄卡吧!" ); mTvPopNext.setOnClickListener( new OnClickEvent() { @Override public void singleClick(View v) { mPopupWindow.dismiss(); getPopShareApp(); } } ); }else { mTvPopFinish.setText( "取消" ); mTvPopNext.setText( "确定" ); mTvPopContent.setText ( "您的黄卡当前为"+content+"张\n确定参与试用该商品吗?" ); mTvPopNext.setOnClickListener( new OnClickEvent() { @Override public void singleClick(View v) { getProduct(0,"1",id); } } ); } mTvPopFinish.setOnClickListener( new OnClickEvent() { @Override public void singleClick(View v) { mPopupWindow.dismiss(); } } ); mPopupWindow.setContentView ( contentView ); mPopupWindow.showAtLocation ( contentView, Gravity.BOTTOM, 0, 0 ); } private void showPopupWindowOther(final int content) { View contentView = LayoutInflater.from ( this ).inflate ( R.layout.popupwind_try_details_other, null ); mPopupWindow = new PopupWindow ( contentView, RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT, true ); //mTvPopContent,mTvPopFinish,mTvPopNext mTvPopContent = (TextView) contentView.findViewById ( R.id.tv_content ); mTvPopFinish = (TextView) contentView.findViewById ( R.id.tv_finish ); mTvPopNext = (TextView) contentView.findViewById ( R.id.tv_next ); mTvNowTishi = (TextView) contentView.findViewById ( R.id.tv_nowtishi ); //mTvPopMinus,mTvPopNum,mTvPopPlus mTvPopMinus = (TextView) contentView.findViewById ( R.id.minus ); mTvPopNum = (TextView) contentView.findViewById ( R.id.num ); mTvPopPlus = (TextView) contentView.findViewById ( R.id.plus ); mTvPopJingGao = (LinearLayout) contentView.findViewById ( R.id.ll_jinggao ); mTvPopMinus.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { int nowNum=Integer.parseInt( mTvPopNum.getText().toString() ); if (nowNum-1<1){ //出提示 mTvPopJingGao.setVisibility( View.GONE ); }else { int nextNum=nowNum - 1; mTvPopNum.setText( ""+nextNum ); mTvPopJingGao.setVisibility( View.GONE ); } } } ); mTvPopPlus.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { int nowNum=Integer.parseInt( mTvPopNum.getText().toString() ); if (chaNumber!=0&&nowNum+1>chaNumber){ //出提示 mTvNowTishi.setText( "已达到参与人次上限" ); mTvPopJingGao.setVisibility( View.VISIBLE ); return; } if (nowNum+1>content){ //出提示 mTvNowTishi.setText( "黄卡数量不足" ); mTvPopJingGao.setVisibility( View.VISIBLE ); // if (nowNum<100){ // int nextNum=nowNum + 1; // mTvPopNum.setText( ""+nextNum ); // } }else { int nextNum=nowNum + 1; mTvPopNum.setText( ""+nextNum ); } } } ); /*mTvPopPlus.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { return false; } } );*/ mTvPopFinish.setOnClickListener( new OnClickEvent() { @Override public void singleClick(View v) { mPopupWindow.dismiss(); } } ); mTvPopNext.setOnClickListener( new OnClickEvent() { @Override public void singleClick(View v) { getProduct(1,mTvPopNum.getText().toString(),id); } } ); mTvPopContent.setText ( "您当前有"+content+"张黄卡,请选择兑换试用码" ); mPopupWindow.setContentView ( contentView ); mPopupWindow.showAtLocation ( contentView, Gravity.BOTTOM, 0, 0 ); } @Override protected void onResume() { super.onResume(); // getAllData(); if (refresh){ mSmartRefreshLayout.autoRefresh(500); refresh=false; } } @Override public void onLoadMore(RefreshLayout refreshLayout) { } @Override public void onRefresh(RefreshLayout refreshLayout) { num=0; updataAlipay(); } /** * @param state 刷新加载的状态, * @param noMoreData 加载没有更多的数据 */ private void setRefreshLoadMoreState(boolean state, boolean noMoreData) { mSmartRefreshLayout.finishRefresh ( state ); } }
[ "1763312610@qq.com" ]
1763312610@qq.com
633b4ab9be5c9bebb273c6cb7f48df719db8be07
5bb51a5d41c26ed8a18d8c3731277a81ba9c4a3e
/UserAppGitTest/src/main/java/com/lti/dao/PersonDao.java
0e232b6384be6ead6e3aedd71833c61821817232
[]
no_license
JaiG1998/UserAppGit
c9cb6266503db37ab95a9721fe1e927f8339c33d
a5a636441437fdd3b6ee11aa3b26b7e1f58571ae
refs/heads/master
2022-11-30T15:28:22.383701
2020-08-14T18:36:37
2020-08-14T18:36:37
287,598,547
0
0
null
null
null
null
UTF-8
Java
false
false
2,312
java
package com.lti.dao; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; import javax.persistence.Persistence; import com.lti.model.Address; import com.lti.model.Job; import com.lti.model.Passport; import com.lti.model.Person; public class PersonDao { EntityManagerFactory emf; EntityManager em; EntityTransaction tx; public void addPerson(Person person){ emf = Persistence.createEntityManagerFactory("pu"); em = emf.createEntityManager(); tx = em.getTransaction(); tx.begin(); em.merge(person); tx.commit(); } public void addPassport(Passport passport){ emf = Persistence.createEntityManagerFactory("pu"); em = emf.createEntityManager(); tx = em.getTransaction(); tx.begin(); em.merge(passport); tx.commit(); } public Person findPerson(int id){ emf = Persistence.createEntityManagerFactory("pu"); em = emf.createEntityManager(); return em.find(Person.class, id); } public void addPersonWithJob(Person person, Job job){ // new job new person emf = Persistence.createEntityManagerFactory("pu"); em = emf.createEntityManager(); tx = em.getTransaction(); person.setJob(job); job.setPerson(person); tx.begin(); em.merge(person); tx.commit(); } public void addJobWithPerson(Job job, int personId){ // new job with exiting person emf = Persistence.createEntityManagerFactory("pu"); em = emf.createEntityManager(); Person person = findPerson(personId); tx = em.getTransaction(); job.setPerson(person); tx.begin(); em.merge(job); tx.commit(); } public void addPersonWithAddress(Person person, Address address){ emf = Persistence.createEntityManagerFactory("pu"); em = emf.createEntityManager(); tx = em.getTransaction(); person.setAddress(address); address.setPerson(person); tx.begin(); em.merge(person); tx.commit(); } public void addAddressWithPerson(Address address, int personId){ emf = Persistence.createEntityManagerFactory("pu"); em = emf.createEntityManager(); Person person = findPerson(personId); tx = em.getTransaction(); address.setPerson(person); tx.begin(); em.merge(address); tx.commit(); } }
[ "jaigupta1998@gmail.com" ]
jaigupta1998@gmail.com
507a987751ab9fc117d817a069602b3372ec4635
8c2f0d274ad905449e6f7154b52b0071887d2b35
/src/main/java/com/bj98bj/emerald/item/ItemEmeraldChestplate.java
92e703229bb2b7ee44b8454f10f6d13d741c2d21
[]
no_license
BJ98BJ/Emerald
2df4a6b76d0b35df879ff2f69c8c398e5388b8ab
aeb3e50877b2ba2a06464e8fd96236a7f8ee54e9
refs/heads/master
2020-07-26T04:08:26.242072
2014-07-16T08:59:10
2014-07-16T08:59:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
310
java
package com.bj98bj.emerald.item; import com.bj98bj.emerald.creativeTab.CreativeTabEmerald; /** * Created by Björn on 07.07.2014. */ public class ItemEmeraldChestplate extends ItemEmerald { public ItemEmeraldChestplate(){ super(); this.setUnlocalizedName("emeraldChestplate"); } }
[ "bj98bj@outlook.com" ]
bj98bj@outlook.com
3fe7ae6f66d9b11c12fe4b3271bf7833f3dff0c5
19d544080d521ebe6e27a3dcd9dc1c63c59e0c63
/core/src/main/java/ro/fortsoft/wicket/dashboard/Widget.java
ff2c4586193b02852b7f26783160d3c77b26b70a
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
talkvip/wicket-dashboard
ccbd65a1adeb72d250ca2aa8cfa3da9b5b98afdd
a29c96e6ff5f93903eed4d811716eb4dcd629c8f
refs/heads/master
2021-01-24T05:07:04.760642
2012-11-07T11:45:09
2012-11-07T11:45:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,424
java
/* * Copyright 2012 Decebal Suiu * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or 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 ro.fortsoft.wicket.dashboard; import java.io.Serializable; import java.util.Map; import org.apache.wicket.markup.html.panel.Panel; import ro.fortsoft.wicket.dashboard.web.WidgetView; /** * @author Decebal Suiu */ public interface Widget extends Serializable { public String getId(); public String getTitle(); public void setTitle(String title); public WidgetLocation getLocation(); public void setLocation(WidgetLocation location); public WidgetView createView(String viewId); public boolean isCollapsed(); public void setCollapsed(boolean collapsed); public void init(); public boolean hasSettings(); public Map<String, String> getSettings(); public void setSettings(Map<String, String> settings); public Panel createSettingsPanel(String settingsPanelId); }
[ "decebal.suiu@gmail.com" ]
decebal.suiu@gmail.com
bcb0786f42b3602bff3d86ac2056cdbb7e5c0b88
0ed255e2ddede9907b3f143c52dfac75cd9c529f
/src/main/java/com/mycompany/app/actionTypes/ActionTypeFactory.java
85ffd0c2c41058de76bc3cd912e24d323528dc73
[]
no_license
athultr7/role-based-autherizator
028ba6d18c671c5b9634459b1d12fbed322bcc7d
ffbf020e50e73dfd605fceab0f767641db0979c8
refs/heads/main
2022-12-28T12:25:22.974099
2020-10-20T13:24:01
2020-10-20T13:24:01
305,716,786
0
0
null
null
null
null
UTF-8
Java
false
false
876
java
package com.mycompany.app.actionTypes; public class ActionTypeFactory { public static ActionType getActionType(String actionType) { if (actionType.equals("READ") || actionType.equals("read") || actionType.equals("Read")) { return new Read(); } else if (actionType.equals("WRITE") || actionType.equals("write") || actionType.equals("Write")) { return new Write(); } else if (actionType.equals("DELETE") || actionType.equals("delete") || actionType.equals("Delete")) { return new Delete(); } else if (actionType.equals("ADD") || actionType.equals("add") || actionType.equals("Add")) { return new Add(); } else if (actionType.equals("GRANT") || actionType.equals("grant") || actionType.equals("Grant")) { return new Grant(); } return null; } }
[ "raghav.sharma@oyorooms.com" ]
raghav.sharma@oyorooms.com
ffe18b80907f2f31a1b3c5dd446bcb990a60f2de
4c1bcb0e01640d7c83cb2da970568a0b23c25b25
/src/main/java/edu/nova/chardin/patrol/agent/strategy/anti/CoveringSoftLimitVertexFocusedEdgeChooser.java
623ba05016241762092f5067a37bb339967c8741
[]
no_license
cehardin/nsu-patrol
1159c8e99321aae8b26865baff8c3f3371797d78
6ce6667d1278a9de6fb35b6d3e1840e63f62bc03
refs/heads/master
2021-01-17T07:01:55.460771
2017-10-30T02:08:47
2017-10-30T02:08:47
34,594,488
0
0
null
null
null
null
UTF-8
Java
false
false
2,113
java
package edu.nova.chardin.patrol.agent.strategy.anti; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import edu.nova.chardin.patrol.agent.AgentContext; import edu.nova.chardin.patrol.graph.EdgeId; import edu.nova.chardin.patrol.graph.VertexId; import java.util.Optional; import lombok.NonNull; import org.apache.commons.math3.util.Pair; public class CoveringSoftLimitVertexFocusedEdgeChooser implements CoveringEdgeChooser { @Override public Optional<EdgeId> choose( @NonNull final AgentContext context, @NonNull final ImmutableSet<VertexId> coveredVertices, @NonNull final ImmutableMap<VertexId, VertexData> verticesData, @NonNull final ImmutableMap<EdgeId, EdgeData> edgesData, @NonNull final ImmutableSet<EdgeId> edgesToAvoid) { final double attackInterval = context.getAttackInterval(); final int currentTimestep = context.getCurrentTimeStep(); return coveredVertices.stream() .map(coveredVertex -> { final int lastTimestepVisitied = Optional.ofNullable(verticesData.get(coveredVertex)) .map(VertexData::getTimestepVisited) .orElse(0); final Pair<Integer, EdgeId> bestEdgeDistance = context.bestDistanceToVertex(coveredVertex); final int distance = bestEdgeDistance.getFirst(); final EdgeId edge = bestEdgeDistance.getSecond(); final int arrivalTimestep = currentTimestep + distance; final double timestepsUnivisitedAfterArrival = arrivalTimestep - lastTimestepVisitied; final double score = timestepsUnivisitedAfterArrival / attackInterval; return Pair.create(edge, Pair.create(score, distance)); }) .filter(p -> p.getSecond().getFirst() >= 1.0) .filter(p -> !edgesToAvoid.contains(p.getKey())) .map(p -> Pair.create(p.getFirst(), p.getSecond().getSecond())) .min((p1, p2) -> p1.getSecond().compareTo(p2.getSecond())) .map(Pair::getFirst); } }
[ "cehardin@hotmail.com" ]
cehardin@hotmail.com
1bd9801ed2e489a4c0fdef8e05be46ea129feebf
fbf95d693ad5beddfb6ded0be170a9e810a10677
/finance/egov/egov-collection/src/main/java/org/egov/collection/service/CollectionService.java
89d97a2809ba24bce5078ffeeeb9ee56005c2196
[ "MIT", "LicenseRef-scancode-generic-cla", "GPL-1.0-or-later", "GPL-3.0-or-later", "LicenseRef-scancode-proprietary-license", "GPL-3.0-only" ]
permissive
egovernments/DIGIT-OSS
330cc364af1b9b66db8914104f64a0aba666426f
bf02a2c7eb783bf9fdf4b173faa37f402e05e96e
refs/heads/master
2023-08-15T21:26:39.992558
2023-08-08T10:14:31
2023-08-08T10:14:31
353,807,330
25
91
MIT
2023-09-10T13:23:31
2021-04-01T19:35:55
Java
UTF-8
Java
false
false
7,391
java
/* * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, * accountability and the service delivery of the government organizations. * * Copyright (C) 2017 eGovernments Foundation * * The updated version of eGov suite of products as by eGovernments Foundation * is available at http://www.egovernments.org * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/ or * http://www.gnu.org/licenses/gpl.html . * * In addition to the terms of the GPL license to be adhered to in using this * program, the following additional terms are to be complied with: * * 1) All versions of this program, verbatim or modified must carry this * Legal Notice. * Further, all user interfaces, including but not limited to citizen facing interfaces, * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any * derived works should carry eGovernments Foundation logo on the top right corner. * * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. * For any further queries on attribution, including queries on brand guidelines, * please contact contact@egovernments.org * * 2) Any misrepresentation of the origin of the material is prohibited. It * is required that all modified versions of this material be marked in * reasonable ways as different from the original version. * * 3) This license does not grant any rights to any user of the program * with regards to rights under trademark law for use of the trade names * or trademarks of eGovernments Foundation. * * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. * */ package org.egov.collection.service; import org.egov.collection.constants.CollectionConstants; import org.egov.collection.entity.OnlinePayment; import org.egov.collection.entity.ReceiptDetail; import org.egov.collection.entity.ReceiptHeader; import org.egov.collection.integration.pgi.PaymentRequest; import org.egov.collection.integration.services.DebitAccountHeadDetailsService; import org.egov.collection.utils.CollectionCommon; import org.egov.collection.utils.CollectionsUtil; import org.egov.commons.entity.Source; import org.egov.infstr.models.ServiceDetails; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.Date; import java.util.List; @Service public class CollectionService { private CollectionsUtil collectionsUtil; private ReceiptHeaderService receiptHeaderService; private CollectionCommon collectionCommon; @Autowired private ApplicationContext beanProvider; public PaymentRequest populateAndPersistReceipts(final ServiceDetails paymentService, final ReceiptHeader receiptHeader, final List<ReceiptDetail> receiptDetailList, final BigDecimal paymentAmount, final Character collectionType) { // only newly created receipts need to be initialised with the data. // The cancelled receipt can be excluded from this processing. if (receiptHeader.getStatus() == null) { receiptHeader.setReceiptdate(new Date()); receiptHeader.setReceipttype(CollectionConstants.RECEIPT_TYPE_BILL); receiptHeader.setIsModifiable(Boolean.FALSE); // recon flag should be set as false when the receipt is // actually // created on successful online transaction receiptHeader.setIsReconciled(Boolean.TRUE); receiptHeader.setCollectiontype(collectionType); receiptHeader.setStatus(collectionsUtil.getStatusForModuleAndCode( CollectionConstants.MODULE_NAME_RECEIPTHEADER, CollectionConstants.RECEIPT_STATUS_CODE_PENDING)); receiptHeader.setSource(Source.SYSTEM.toString()); BigDecimal debitAmount = BigDecimal.ZERO; for (final ReceiptDetail creditChangeReceiptDetail : receiptDetailList) { // calculate sum of creditamounts as a debit value to // create a // debit account head and add to receipt details debitAmount = debitAmount.add(creditChangeReceiptDetail.getCramount()); debitAmount = debitAmount.subtract(creditChangeReceiptDetail.getDramount()); for (final ReceiptDetail receiptDetail : receiptHeader.getReceiptDetails()) if (creditChangeReceiptDetail.getReceiptHeader().getReferencenumber() .equals(receiptDetail.getReceiptHeader().getReferencenumber()) && receiptDetail.getOrdernumber().equals(creditChangeReceiptDetail.getOrdernumber())) receiptDetail.setCramount(creditChangeReceiptDetail.getCramount()); } // end of outer for loop receiptHeader.setTotalAmount(paymentAmount); // Add Online Payment Details final OnlinePayment onlinePayment = new OnlinePayment(); onlinePayment.setStatus(collectionsUtil.getStatusForModuleAndCode( CollectionConstants.MODULE_NAME_ONLINEPAYMENT, CollectionConstants.ONLINEPAYMENT_STATUS_CODE_PENDING)); onlinePayment.setReceiptHeader(receiptHeader); onlinePayment.setService(paymentService); receiptHeader.setOnlinePayment(onlinePayment); DebitAccountHeadDetailsService debitAccountHeadService = (DebitAccountHeadDetailsService) beanProvider .getBean(collectionsUtil.getBeanNameForDebitAccountHead()); receiptHeader.addReceiptDetail(debitAccountHeadService.addDebitAccountHeadDetails(debitAmount, receiptHeader, BigDecimal.ZERO, paymentAmount, CollectionConstants.INSTRUMENTTYPE_ONLINE)); } receiptHeaderService.persistReceiptObject(receiptHeader); /** * Construct Request Object For The Payment Gateway */ return collectionCommon.createPaymentRequest(paymentService, receiptHeader); }// end of method public void setCollectionsUtil(final CollectionsUtil collectionsUtil) { this.collectionsUtil = collectionsUtil; } public void setReceiptHeaderService(final ReceiptHeaderService receiptHeaderService) { this.receiptHeaderService = receiptHeaderService; } public void setCollectionCommon(final CollectionCommon collectionCommon) { this.collectionCommon = collectionCommon; } }
[ "venki@egovernments.org" ]
venki@egovernments.org
54cb03070652566a001f30fdbc39e47c606ff133
3040b98d2ad4aa240c490e09eea3242947e95f12
/OneKeyRepairClient/app/src/main/java/wit/hmj/onekeyrepair/utils/PhotoViewPager.java
43fdf72350960baca03679ad823115521e237fab
[]
no_license
humengjun/OneKeyRepair
543eaa7948b0e29a9a2c069d76cb24710dd90d22
2d814c38e570b5e448bf65f8992ece11b8ca08c3
refs/heads/master
2020-03-28T15:15:00.034950
2018-09-13T02:48:43
2018-09-13T02:48:43
148,571,611
0
0
null
null
null
null
UTF-8
Java
false
false
3,222
java
package wit.hmj.onekeyrepair.utils; import java.util.HashMap; import java.util.LinkedHashMap; import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; /** * 自定义viewpager */ public class PhotoViewPager extends ViewPager { private float mTrans; private float mScale; /** * 最大的缩小比例 */ private static final float SCALE_MAX = 0.5f; /** * 保存position与对于的View */ private HashMap<Integer, View> mChildrenViews = new LinkedHashMap<Integer, View>(); /** * 滑动时左边的元素 */ private View mLeft; /** * 滑动时右边的元素 */ private View mRight; public PhotoViewPager(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { // Log.e(TAG, "position=" + position+", positionOffset = "+positionOffset+" ,positionOffsetPixels = " + positionOffsetPixels+" , currentPos = " + getCurrentItem()); //滑动特别小的距离时,我们认为没有动,可有可无的判断 float effectOffset = isSmall(positionOffset) ? 0 : positionOffset; //获取左边的View mLeft = findViewFromObject(position); //获取右边的View mRight = findViewFromObject(position + 1); // 添加切换动画效果 animateStack(mLeft, mRight, effectOffset, positionOffsetPixels); super.onPageScrolled(position, positionOffset, positionOffsetPixels); } public void setObjectForPosition(View view, int position) { mChildrenViews.put(position, view); } /** * 通过过位置获得对应的View * * @param position * @return */ public View findViewFromObject(int position) { return mChildrenViews.get(position); } private boolean isSmall(float positionOffset) { return Math.abs(positionOffset) < 0.0001; } protected void animateStack(View left, View right, float effectOffset, int positionOffsetPixels) { if (right != null) { /** * 缩小比例 如果手指从右到左的滑动(切换到后一个):0.0~1.0,即从一半到最大 * 如果手指从左到右的滑动(切换到前一个):1.0~0,即从最大到一半 */ mScale = (1 - SCALE_MAX) * effectOffset + SCALE_MAX; /** * x偏移量: 如果手指从右到左的滑动(切换到后一个):0-720 如果手指从左到右的滑动(切换到前一个):720-0 */ mTrans = -getWidth() - getPageMargin() + positionOffsetPixels; right.setScaleX(mScale); right.setScaleY(mScale); right.setTranslationX(mTrans); } if (left != null) { left.bringToFront(); } } @Override public boolean onTouchEvent(MotionEvent ev) { try { return super.onTouchEvent(ev); } catch (IllegalArgumentException ex) { ex.printStackTrace(); } return false; } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { try { return super.onInterceptTouchEvent(ev); } catch (IllegalArgumentException ex) { ex.printStackTrace(); } return false; } }
[ "1260739930@qq.com" ]
1260739930@qq.com
9222d0cdd5bbb0cdb445a71d38fe185a1751c199
301588f1887e711ee5d1509611aab556d7af7928
/src/main/java/com/kelloggs/upc/common/dto/ProductTypeDTO.java
e816f3be6236b967150ee1ca332435a8afeca524
[]
no_license
Harshit23121991/PMSystem
8241e40adbe337e307812458649507fd4a62c66c
e611b187bb5915ad8e471a404b1724f89d006476
refs/heads/master
2020-03-26T18:43:11.214095
2018-08-18T14:33:14
2018-08-18T14:33:14
145,226,736
0
0
null
null
null
null
UTF-8
Java
false
false
813
java
package com.kelloggs.upc.common.dto; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; import com.thoughtworks.xstream.annotations.XStreamAlias; @XmlRootElement(name = "ProductType", namespace = "com.kelloggs.upc.common.dto") @XStreamAlias("ProductType") public class ProductTypeDTO implements Serializable { /** * */ private static final long serialVersionUID = 1L; private int productTypeId; private String productTypeName; public int getProductTypeId() { return productTypeId; } public void setProductTypeId(final int iProductTypeId) { this.productTypeId = iProductTypeId; } public String getProductTypeName() { return productTypeName; } public void setProductTypeName(final String iProductTypeName) { this.productTypeName = iProductTypeName; } }
[ "harshit.a.k.eee@gmail.com" ]
harshit.a.k.eee@gmail.com
09a5499ba7b98fa6b744dcb94d6a47afef4fde04
a7cdda31bdd89e93f73bf5c8f8e3cb3dcbd3bcf3
/Unit_Test/src/com/prep/test/TrackingServiceTests.java
538498815b7b3ce28ca34fd72cf53ba581d5cb02
[]
no_license
bk1613/spring-mircosoft-project
d5b33acf5b48a94e3eeec2372786c56c82696fdb
f4deb8fbf5a52be13b6604a60a9c1ec6420ed314
refs/heads/main
2023-03-23T23:33:46.410836
2021-03-07T02:55:37
2021-03-07T02:55:37
322,388,585
0
0
null
null
null
null
UTF-8
Java
false
false
1,438
java
package com.prep.test; import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import com.prep.main.InvalidGoalException; import com.prep.main.TrackingService; public class TrackingServiceTests { private TrackingService service; @BeforeClass public static void before() { System.out.println("Before Class"); } @AfterClass public static void after() { System.out.println("After Class"); } @Before public void setUp() { System.out.println("Before"); service = new TrackingService(); } @After public void tearDown() { System.out.println("After"); } @Test public void NewTrackingServiceTotalIsZero() { assertEquals("Tracking service total was not zero", 0, service.getTotal()); } @Test public void WhenAddingProteinTotalIncreasesByThatAmount() { service.addProtein(10); assertEquals(10, service.getTotal()); } @Test public void WhenRemovingProteinTotalRemainsZero() { service.removeProtein(5); assertEquals(0, service.getTotal()); } @Test(expected = InvalidGoalException.class) public void WhenGoalIsSetToLessThanZeroExceptionIsThrown() throws InvalidGoalException { service.setGoal(-5); } @Ignore @Test(timeout = 200) public void BadTest() { for(int i = 0; i < 10000000; i++) service.addProtein(1); } }
[ "bk1613@nyu.edU" ]
bk1613@nyu.edU
13c6699a6e0e94eea95d2c46446f924a729ccf46
52b948436b826df8164565ffe69e73a92eb92cda
/Tests/RGTTests/bears/patches/SzFMV2018-Tavasz-AutomatedCar_351742666-351759763/Arja/190/patch/Dashboard.java
34b12ecc7e93c3a9b9a46912e1683b87e0c4ffd3
[]
no_license
tdurieux/ODSExperiment
910365f1388bc684e9916f46f407d36226a2b70b
3881ef06d6b8d5efb751860811def973cb0220eb
refs/heads/main
2023-07-05T21:30:30.099605
2021-08-18T15:56:56
2021-08-18T15:56:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,840
java
package hu.oe.nik.szfmv.visualization; import hu.oe.nik.szfmv.automatedcar.bus.packets.input.ReadOnlyInputPacket; import javax.swing.*; import java.awt.*; /** * Dashboard shows the state of the ego car, thus helps in debugging. */ public class Dashboard extends JPanel { private final int width = 250; private final int height = 700; private final int dashboardBoundsX = 770; private final int dashboardBoundsY = 0; private final int backgroundColor = 0x888888; private final int progressBarsPanelX = 25; private final int progressBarsPanelY = 400; private final int progressBarsPanelWidth = 200; private final int progressBarsPanelHeight = 100; private final JPanel progressBarsPanel = new JPanel(); private final JLabel gasLabel = new JLabel(); private final JProgressBar gasProgressBar = new JProgressBar(); private final JLabel breakLabel = new JLabel(); private final JProgressBar breakProgressBar = new JProgressBar(); private final int speedMeterX = 10; private final int speedMeterY = 50; private final int tachoMeterX = 130; private final int tachoMeterY = 50; private final int meterHeight = 100; private final int meterWidth = 100; private int speedAngle; private int rpmAngle; /** * Initialize the dashboard */ public Dashboard() { initializeDashboard(); } /** * Update the displayed values * @param inputPacket Contains all the required values coming from input. */ public void updateDisplayedValues(ReadOnlyInputPacket inputPacket) { gasProgressBar.setValue(inputPacket.getGasPedalPosition()); breakProgressBar.setValue(inputPacket.getBreakPedalPosition()); speedAngle = calculateSpeedometer(0); rpmAngle = calculateTachometer(0); } /** * Initializes the dashboard components */ private void initializeDashboard() { // Not using any layout manager, but fixed coordinates setLayout(null); setBackground(new Color(backgroundColor)); gasLabel.setText("gas pedal"); setBounds(dashboardBoundsX, dashboardBoundsY, width, height); initializeProgressBars(); } /** * Initializes the progress bars on the dashboard */ private void initializeProgressBars() { progressBarsPanel.setBackground(new Color(backgroundColor)); progressBarsPanel.setBounds( progressBarsPanelX, progressBarsPanelY, progressBarsPanelWidth, progressBarsPanelHeight); gasLabel.setText("gas pedal"); breakLabel.setText("break pedal"); gasProgressBar.setStringPainted(true); breakProgressBar.setStringPainted(true); add(progressBarsPanel); progressBarsPanel.add(gasLabel); progressBarsPanel.add(gasProgressBar); progressBarsPanel.add(breakLabel); progressBarsPanel.add(breakProgressBar); } /** * Drawing the Speedometer and the Tachometer. * * @param g {@link Graphics} object that can draw to the canvas */ protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.BLACK); g.drawOval(speedMeterX, speedMeterY, meterWidth, meterHeight); g.drawOval(tachoMeterX, tachoMeterY, meterWidth, meterHeight); g.setColor(Color.RED); g.fillArc(speedMeterX, speedMeterY, meterWidth, meterHeight, speedAngle, 2); g.fillArc(tachoMeterX, tachoMeterY, meterWidth, meterHeight, rpmAngle, 2); } /** * Map the RPM to a displayable value for the gauge. * * @param rpm The unmapped input value of the Tachometer's visual display. * * @return The mapped value between [-75, 255] interval. */ private int calculateTachometer(int rpm) { final int minRpmValue = 0; final int maxRpmValue = 10000; final int minRpmMeter = -75; final int maxRpmMeter = 255; int newrpm = maxRpmValue - rpm; return (newrpm - minRpmValue) * (maxRpmMeter - minRpmMeter) / (maxRpmValue - minRpmValue) + minRpmMeter; } /** * Map the Speed to a displayable value for the gauge. * * @param speed The unmapped input value of the Speedometer's visual display. * * @return The mapped value between [-75, 255] interval. */ private int calculateSpeedometer(int speed) { final int minSpeedValue = 0; final int maxSpeedValue = 500; final int minSpeedMeter = -75; final int maxSpeedMeter = 255; int newspeed = maxSpeedValue - speed; return (newspeed - minSpeedValue) * (maxSpeedMeter - minSpeedMeter) / (maxSpeedValue - minSpeedValue) + minSpeedMeter; } }
[ "he_ye_90s@hotmail.com" ]
he_ye_90s@hotmail.com
ad7578aa6da606c46cd05eca9711ce7102effee6
aa4c318c55490afaf5e5e490ab79320128a74c96
/FoodItem.java
321ae43ae7c34bc1a254b06b06b39a5996a4ac0e
[]
no_license
AlexSkarlatov/analysis-and-notes-on-design-patterns
1b7bfc3c664a8241e398340210bae8d49bb9b764
535066c4e5b504e389d614a2b949dff9f8fb9518
refs/heads/master
2023-02-27T14:21:17.369010
2021-02-05T21:38:43
2021-02-05T21:38:43
263,449,561
0
0
null
2021-02-05T21:39:29
2020-05-12T20:51:51
Java
UTF-8
Java
false
false
661
java
package com.company.items; import com.company.Packing; public abstract class FoodItem implements Packing { //members // double subtax=0.2; double price ; String name; //methods //getters and setters // public Double getint(){ // return 3.0; // } public double getPrice(){ return this.price; } public void setPrice(Double price) { this.price = price; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String pack() { return "null"; } }
[ "noreply@github.com" ]
noreply@github.com
1cb3c97152052b42b408e2884663180d17f2b1eb
325ba9c5a54c5347cf9d5f051608ab58ca785314
/app/src/main/java/br/com/rcsports/listener/IOnClickListener.java
60dc1476c51266cac789c0cdcfa161495506906c
[]
no_license
pcelestino/rcsports-android
41af495738ca0c53cbf954a5f63c1af84bdbaa3b
64c021e4a3f0396fbe469dd2820794a7f5be286d
refs/heads/master
2021-01-22T23:58:03.314115
2015-01-17T16:25:01
2015-01-17T16:25:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
204
java
package br.com.rcsports.listener; /** * Created by Pedro on 15/12/2014. */ public interface IOnClickListener { public void onClickSave(); public void onCLickDelete(Object object); }
[ "mr.pedrosilveira@gmail.com" ]
mr.pedrosilveira@gmail.com
3eaa08026e34632e7ad39bc85c267bc257af075b
5e1d3adc82b82365aafe2ca0d5ba0f23a288f2ea
/src/main/java/eu/clarin/cmdi/curation/component_registry/XSDCache.java
f00a5ca981eb4b96e3ad19c759b5e08230631c05
[]
no_license
davoros/clarin-curation-module
3170e448431bf9f47e1c9c1b0060b375965f6328
8e7fbaac1b5aca2c6f3524a7f65163506d78a0d9
refs/heads/master
2021-01-10T12:50:52.705681
2015-12-23T12:23:00
2015-12-23T12:23:00
48,431,825
2
0
null
null
null
null
UTF-8
Java
false
false
2,133
java
package eu.clarin.cmdi.curation.component_registry; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; import javax.xml.XMLConstants; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import javax.xml.validation.ValidatorHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import eu.clarin.cmdi.curation.io.Downloader; import eu.clarin.cmdi.curation.xml.CMDIContentHandler; public class XSDCache { private static final Logger _logger = LoggerFactory.getLogger(XSDCache.class); //Singleton private static volatile XSDCache instance = new XSDCache(); private Map<String, Schema> cache = new HashMap<>(); private XSDCache(){} public static XSDCache getInstance(){ return instance; } public Schema getSchema(String profile) throws Exception{ if(!cache.containsKey(profile)){ //fall-back: xsd dir, download _logger.trace("Schema for {} is not in the cache, searching in the local FS", profile); Schema schema = loadSchemaFromFile(profile); cache.put(profile, schema); } return cache.get(profile); } private Schema loadSchemaFromFile(String profile) throws Exception{ Path schema = Paths.get(ComponentRegistryService.SCHEMA_FOLDER, profile + ".xsd"); _logger.trace("Loading {} schema from {}", profile, schema); if(Files.notExists(schema)){ _logger.trace("Schema for {} is not in the local FS, downloading it", profile); Downloader downloader = new Downloader(getProfileURL(profile), ComponentRegistryService.SCHEMA_FOLDER + "/" + profile + ".xsd"); downloader.download(); } SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); return schemaFactory.newSchema(schema.toFile()); } public synchronized String getProfileURL(String profileId) { return ComponentRegistryService.CLARIN_COMPONENT_REGISTRY_REST_URL + ComponentRegistryService.PROFILE_PREFIX + profileId + "/xsd"; } }
[ "davor.ostojic@oeaw.ac.at" ]
davor.ostojic@oeaw.ac.at
bd21d8d8f4504ea1cb94b8fff3c1a190030a0136
4dba6b0de388e97f32db560db2c058e752ab6b19
/src/main/java/com/tao/utils/CsvUtil.java
3beb6aaa3cb369207cc4f8200b96eafa92b4017a
[]
no_license
taoCoder/framebase
826a4bfbb527f45b86756cba1ba8ee78277a69bb
361ac55936e51e1c679c0c5bd21f7b1ee82e6306
refs/heads/master
2020-04-01T20:31:08.795005
2019-03-04T11:00:36
2019-03-04T11:00:36
153,607,503
0
0
null
null
null
null
UTF-8
Java
false
false
2,469
java
package com.tao.utils; import com.tao.annotation.Column; import com.tao.common.DataFormatter; import com.tao.entity.CsvVo; import org.springframework.util.CollectionUtils; import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.*; /** * @author huangtao54 * @description csv * @date 2019/1/10 */ public class CsvUtil { public static <T> List<String[]> getContent(List<T> list) throws Exception { if (CollectionUtils.isEmpty(list)) { throw new IllegalArgumentException("list is empty"); } Class cls = list.get(0).getClass(); Field[] declaredFields = cls.getDeclaredFields(); List<Field> fields = new ArrayList<>(); List<String[]> content = new ArrayList<>(fields.size()); List<String> header = new ArrayList<>(fields.size()); Map<String, DataFormatter> formatterMap = new HashMap<>(fields.size()); for (Field field : declaredFields) { if (field.getAnnotation(Column.class) != null) { fields.add(field); header.add(field.getAnnotation(Column.class).name()); formatterMap.put(field.getName(), field.getAnnotation(Column.class).formatter().newInstance()); } } content.add(header.toArray(new String[fields.size()])); for (T bean : list) { List<String> values = new ArrayList<>(fields.size()); for (Field field : fields) { String fieldName = field.getName(); PropertyDescriptor pd = new PropertyDescriptor(fieldName, cls); Method getter = pd.getReadMethod(); Object value = getter.invoke(bean); if (value instanceof Class) { continue; } else { DataFormatter df = formatterMap.get(fieldName); value = df.format(value); } values.add(String.valueOf(value)); } content.add(values.toArray(new String[values.size()])); } return content; } public static void main(String[] args) throws Exception { List<CsvVo> list = new ArrayList<>(); list.add(new CsvVo(1, "tao1", new Date(), "no1")); list.add(new CsvVo(2, "tao2", new Date(), "no2")); List<String[]> content = CsvUtil.getContent(list); System.out.println(content); } }
[ "huangtao8@jd.com" ]
huangtao8@jd.com
467eb496a5e34c881b9e9f3093e6adf4ad069c74
fd52518659eebe1d8612202bbc2fc6f9370a8e0a
/app/src/main/java/com/travisit/travisitstandard/vvm/destination/GuideCompleteProfileFragment.java
4cd9125fafe7718edcf102ee8aac7541c500df20
[]
no_license
NourhanGehad/TravisitStandard
c98061e8480b786a21c611541a7f86d096c0bb78
e7615fb1949d778a1f547d32bc7e1882e2372e6b
refs/heads/master
2023-03-04T03:52:12.197178
2021-02-11T15:11:07
2021-02-11T15:11:07
277,179,312
1
3
null
2020-10-23T09:16:25
2020-07-04T20:17:39
Java
UTF-8
Java
false
false
7,117
java
package com.travisit.travisitstandard.vvm.destination; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import androidx.navigation.Navigation; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import com.travisit.travisitstandard.R; import com.travisit.travisitstandard.databinding.FragmentGuideCompleteProfileBinding; import com.travisit.travisitstandard.model.User; import com.travisit.travisitstandard.utils.PathUtil; import com.travisit.travisitstandard.vvm.AppActivity; import com.travisit.travisitstandard.vvm.vm.ProfileVM; import static android.app.Activity.RESULT_OK; public class GuideCompleteProfileFragment extends Fragment { private static final int REQUEST_IMAGE_PP = 125; private ProfileVM vm; private String ppPath = ""; private FragmentGuideCompleteProfileBinding binding; private final TextWatcher watcher = new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override public void afterTextChanged(Editable s) { if (getFieldText("full name").length() == 0 || getFieldText("email").length() == 0 || getFieldText("phone").length() == 0 || getFieldText("rate").length() == 0 || getFieldText("membership number").length() == 0 || getFieldText("license number").length() == 0 || getFieldText("education").length() == 0 || getFieldText("experience").length() == 0){ binding.fGuideCompleteProfileBtnSubmit.setEnabled(false); } else { binding.fGuideCompleteProfileBtnSubmit.setEnabled(true); } } }; public GuideCompleteProfileFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ((AppActivity) getActivity()).changeBottomNavVisibility(View.GONE, false); getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); binding = FragmentGuideCompleteProfileBinding.inflate(inflater, container, false); View view = binding.getRoot(); return view; } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); vm = ViewModelProviders.of(this).get(ProfileVM.class); handleUserInteractions(view); } private void handleUserInteractions(View view) { binding.fGuideCompleteProfileBtnSubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { vm.uploadFile(ppPath); vm.filePMutableLiveData.observe(getActivity(), new Observer<User>() { @Override public void onChanged(User user) { Log.d("YOU", "DID IT"); } }); vm.editGuideProfile( getFieldText("full name"), getFieldText("email"), getFieldText("phone"), getFieldText("education"), getFieldText("experience"), Integer.parseInt(getFieldText("rate")), Integer.parseInt(getFieldText("membership number")), Integer.parseInt(getFieldText("license number")) ); vm.profileMutableLiveData.observe(getActivity(), new Observer<User>() { @Override public void onChanged(User user) { Navigation.findNavController(view).navigate(R.id.action_from_g_complete_profile_to_account_status); } }); } }); binding.fGuideCompleteProfileCivPp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pickImage(REQUEST_IMAGE_PP); } }); binding.fGuideCompleteProfileTietFullName.addTextChangedListener(watcher); binding.fGuideCompleteProfileTietEmailAddress.addTextChangedListener(watcher); binding.fGuideCompleteProfileTietPhone.addTextChangedListener(watcher); binding.fGuideCompleteProfileTietExperienceYears.addTextChangedListener(watcher); } private void pickImage(int requestCode) { Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); intent.setType("image/*"); if (intent.resolveActivity(getActivity().getPackageManager()) != null) { startActivityForResult(intent, requestCode); } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { Uri thumbnail = data.getData(); PathUtil pathUtil = new PathUtil(getActivity()); String path = pathUtil.getPath(thumbnail); Log.d("CompleteProfile", "Selected Image path: " + path); if (requestCode == REQUEST_IMAGE_PP) { ppPath = path; binding.fGuideCompleteProfileCivPp.setImageURI(thumbnail); } } } private String getFieldText(String fieldName){ switch (fieldName){ case "full name": return binding.fGuideCompleteProfileTietFullName.getText().toString(); case "email": return binding.fGuideCompleteProfileTietEmailAddress.getText().toString(); case "phone": return binding.fGuideCompleteProfileTietPhone.getText().toString(); case "experience": return binding.fGuideCompleteProfileTietExperienceYears.getText().toString(); case "education": return binding.fGuideCompleteProfileTietEducation.getText().toString(); case "rate": return binding.fGuideCompleteProfileTietRate.getText().toString(); case "license number": return binding.fGuideCompleteProfileTietRate.getText().toString(); case "membership number": return binding.fGuideCompleteProfileTietRate.getText().toString(); default: return "invalid"; } } @Override public void onDestroyView() { super.onDestroyView(); binding = null; } }
[ "hayllie.jul11th.vh@gmail.com" ]
hayllie.jul11th.vh@gmail.com
a7f82ec605d8499b35c0344550f12c1869cca350
2806e9a10ce98f77d9eefb50107425f23afdf3d8
/src/java/Fabriquant/Fabriquant.java
1b260b471f2087c1d1c7ccdb3e995e979dbdaf76
[]
no_license
algyon/SiteWebAllan
c3abc4482be40ab759258af5fb54ba7d33bcb9f1
619bb51e5782af01fc67a3667e4137cb5396b6ab
refs/heads/master
2021-01-12T17:48:00.580293
2016-11-16T23:03:12
2016-11-16T23:03:12
69,393,694
0
1
null
null
null
null
UTF-8
Java
false
false
6,279
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 Fabriquant; import Cpu.Cpu; import Cooling.Cooling; import Ram.Ram; import Stockage.Stockage; import CarteMere.CarteMere; import CarteGraphique.CarteGraphique; import Boitier.Boitier; import Alimentation.Alimentation; import java.io.Serializable; import java.util.Collection; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; /** * * @author David */ @Entity @Table(name = "fabriquant") @NamedQueries({ @NamedQuery(name = "Fabriquant.findAll", query = "SELECT f FROM Fabriquant f"), @NamedQuery(name = "Fabriquant.findByFabriquantId", query = "SELECT f FROM Fabriquant f WHERE f.fabriquantId = :fabriquantId"), @NamedQuery(name = "Fabriquant.findByNomFabriquant", query = "SELECT f FROM Fabriquant f WHERE f.nomFabriquant = :nomFabriquant")}) public class Fabriquant implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "fabriquant_id") private Integer fabriquantId; @Basic(optional = false) @NotNull @Size(min = 1, max = 255) @Column(name = "nom_fabriquant") private String nomFabriquant; @OneToMany(cascade = CascadeType.ALL, mappedBy = "fabriquantId") private Collection<Stockage> stockageCollection; @OneToMany(cascade = CascadeType.ALL, mappedBy = "fabriquantId") private Collection<CarteMere> carteMereCollection; @OneToMany(cascade = CascadeType.ALL, mappedBy = "fabriquantId") private Collection<Boitier> boitierCollection; @OneToMany(cascade = CascadeType.ALL, mappedBy = "fabriquantId") private Collection<CarteGraphique> carteGraphiqueCollection; @OneToMany(cascade = CascadeType.ALL, mappedBy = "fabriquantId") private Collection<Alimentation> alimentationCollection; @OneToMany(cascade = CascadeType.ALL, mappedBy = "fabriquantId") private Collection<Cooling> coolingCollection; @OneToMany(cascade = CascadeType.ALL, mappedBy = "fabriquantId") private Collection<Cpu> cpuCollection; @OneToMany(cascade = CascadeType.ALL, mappedBy = "fabriquantId") private Collection<Ram> ramCollection; public Fabriquant() { } public Fabriquant(Integer fabriquantId) { this.fabriquantId = fabriquantId; } public Fabriquant(Integer fabriquantId, String nomFabriquant) { this.fabriquantId = fabriquantId; this.nomFabriquant = nomFabriquant; } public Integer getFabriquantId() { return fabriquantId; } public void setFabriquantId(Integer fabriquantId) { this.fabriquantId = fabriquantId; } public String getNomFabriquant() { return nomFabriquant; } public void setNomFabriquant(String nomFabriquant) { this.nomFabriquant = nomFabriquant; } public Collection<Stockage> getStockageCollection() { return stockageCollection; } public void setStockageCollection(Collection<Stockage> stockageCollection) { this.stockageCollection = stockageCollection; } public Collection<CarteMere> getCarteMereCollection() { return carteMereCollection; } public void setCarteMereCollection(Collection<CarteMere> carteMereCollection) { this.carteMereCollection = carteMereCollection; } public Collection<Boitier> getBoitierCollection() { return boitierCollection; } public void setBoitierCollection(Collection<Boitier> boitierCollection) { this.boitierCollection = boitierCollection; } public Collection<CarteGraphique> getCarteGraphiqueCollection() { return carteGraphiqueCollection; } public void setCarteGraphiqueCollection(Collection<CarteGraphique> carteGraphiqueCollection) { this.carteGraphiqueCollection = carteGraphiqueCollection; } public Collection<Alimentation> getAlimentationCollection() { return alimentationCollection; } public void setAlimentationCollection(Collection<Alimentation> alimentationCollection) { this.alimentationCollection = alimentationCollection; } public Collection<Cooling> getCoolingCollection() { return coolingCollection; } public void setCoolingCollection(Collection<Cooling> coolingCollection) { this.coolingCollection = coolingCollection; } public Collection<Cpu> getCpuCollection() { return cpuCollection; } public void setCpuCollection(Collection<Cpu> cpuCollection) { this.cpuCollection = cpuCollection; } public Collection<Ram> getRamCollection() { return ramCollection; } public void setRamCollection(Collection<Ram> ramCollection) { this.ramCollection = ramCollection; } @Override public int hashCode() { int hash = 0; hash += (fabriquantId != null ? fabriquantId.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Fabriquant)) { return false; } Fabriquant other = (Fabriquant) object; if ((this.fabriquantId == null && other.fabriquantId != null) || (this.fabriquantId != null && !this.fabriquantId.equals(other.fabriquantId))) { return false; } return true; } @Override public String toString() { return nomFabriquant; } }
[ "algyon@gmail.com" ]
algyon@gmail.com
07a889a8670707821eea4d000228209b846d1ebb
82d6dee8facaefac526e980d7d2ce4922cb13541
/src/test/SignUP.java
70b3c056090438b9333708c972424c2889e3aee7
[]
no_license
das-rajesh/Inventory
dffd048b59d7fd33b60e6c1504fcd46a6d9897cc
84e2d4ce205c06e88656cc29b3a344f2f885292b
refs/heads/master
2020-03-25T19:53:08.079445
2018-08-09T05:34:30
2018-08-09T05:34:30
144,105,273
0
0
null
null
null
null
UTF-8
Java
false
false
13,546
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 test; /** * * @author admin */ public class SignUP extends javax.swing.JFrame { /** * Creates new form SignUP */ public SignUP() { initComponents(); } /** * 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() { jTextField4 = new javax.swing.JTextField(); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jTextField5 = new javax.swing.JTextField(); jTextField6 = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jTextField4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField4ActionPerformed(evt); } }); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setText(" Full Name"); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jLabel2.setText(" Mobile No"); jLabel3.setText(" Email Id"); jTextField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField2ActionPerformed(evt); } }); jTextField3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField3ActionPerformed(evt); } }); jLabel4.setText("Enter Password"); jLabel5.setText("Re-Enter Password"); jTextField5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField5ActionPerformed(evt); } }); jTextField6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField6ActionPerformed(evt); } }); jButton1.setLabel("Sign Up"); jButton2.setText("Back"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(62, 62, 62) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel5)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(153, 153, 153) .addComponent(jButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton2))) .addContainerGap(113, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(31, 31, 31) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton2)) .addContainerGap(72, Short.MAX_VALUE)) ); jLabel2.getAccessibleContext().setAccessibleName(" Mobile No"); jButton2.getAccessibleContext().setAccessibleName("Back"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField1ActionPerformed private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField2ActionPerformed private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField3ActionPerformed private void jTextField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField4ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField4ActionPerformed private void jTextField5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField5ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField5ActionPerformed private void jTextField6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField6ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField6ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: new Login().setVisible(true); this.dispose(); }//GEN-LAST:event_jButton2ActionPerformed /** * @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(SignUP.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(SignUP.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(SignUP.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(SignUP.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 SignUP().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JPanel jPanel1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; private javax.swing.JTextField jTextField6; // End of variables declaration//GEN-END:variables }
[ "39552295+das-rajesh@users.noreply.github.com" ]
39552295+das-rajesh@users.noreply.github.com
bf908922ee7048e03ebf94ea3e1e660e4bd4bf13
f569ce7051039ce55de257e6d127cdc532171229
/src/dev/Sandefur/fear/entities/Static/Objects/TableMap.java
0abc4ba45e5da879708f45130167cecc001daf08
[]
no_license
Draonc/10thFear
f68c924c43b9c1e34ee23f00dff15d33c4f12056
a9c57129153e1ad5d9911dc968f4d0f29dd3152d
refs/heads/master
2020-04-23T17:47:47.956639
2019-02-18T20:08:34
2019-02-18T20:08:34
171,344,906
0
0
null
null
null
null
UTF-8
Java
false
false
654
java
package dev.Sandefur.fear.entities.Static.Objects; import java.awt.Graphics2D; import dev.Sandefur.fear.Handler; import dev.Sandefur.fear.entities.Static.StaticEntity; import dev.Sandefur.fear.gfx.Assets; import dev.Sandefur.fear.tiles.Tile; public class TableMap extends StaticEntity { public TableMap(Handler handler, float x, float y) { super(handler, x, y, Tile.TILEWIDTH, Tile.TILEHEIGHT); } @Override public void tick() { } @Override public void render(Graphics2D g) { g.drawImage(Assets.tableMap,(int) (x - handler.getGameCamera().getxOffset()), (int) (y - handler.getGameCamera().getyOffset()), width, height, null); } }
[ "Draonc02@gmial.com" ]
Draonc02@gmial.com
6878bd1f5b5ca3e47c011a968270d6b4430e65af
05072b2a79799aa8b05a9d1c69e36b11bcf8258e
/Room.java
8ecfd2a236de4b133a3d11a9f96249d5553be0d7
[]
no_license
McKyle/APCS-Game
3856c69a91ba122aa249392b6193a943a66a8385
1d0393d623419399b397a4db472ecd45b2c6087d
refs/heads/master
2021-04-28T07:41:04.167069
2018-03-06T16:34:01
2018-03-06T16:34:01
122,229,585
0
0
null
null
null
null
UTF-8
Java
false
false
1,485
java
/** * Class to represent different rooms in house. * * @author Kyle McCoy and Joseph Rosenberry * @version 2/6/18 */ import java.util.*; public class Room extends Thing { private ArrayList<Treasure> loot; private boolean obstacle; private boolean visited; public Room(String n, String d) { super (n, d); loot = new ArrayList<Treasure>(); Treasure t1 = new Treasure("Crown", "Gold", 200000); Treasure t2 = new Treasure("Chalice", "Silver", 50000); Treasure t3 = new Treasure("Idol", "Jade", 50000); Treasure t4 = new Treasure("Bag o' Gold", "", 100000); Treasure t5 = new Treasure("Ring", "Diamond", 500000); int t = (int)(Math.random()*5); if (t == 0) { loot.add(t1); } if (t == 1) { loot.add(t2); } if (t == 2) { loot.add(t3); } if (t == 3) { loot.add(t4); } if (t == 4) { loot.add(t5); } int i = (int)(Math.random()*2); if (i == 0) obstacle = false; if (i == 1) obstacle = true; } public boolean isObstacle() { return obstacle; } public ArrayList<Treasure> getLoot() { return loot; } public boolean beenVisited() { return visited; } public void done() { visited = true; } }
[ "noreply@github.com" ]
noreply@github.com
03026f1b3192f3988b809f3c785ac7f4011a0730
1c2d8a1f7ee73ceddbce79bce798ece5295eb5b4
/class-29/demos/app/src/main/java/com/ncarignan/buycheapthings/MainActivity.java
e405209a3926f25d31073476591b3883574a0d4b
[]
no_license
codefellows/seattle-java-401d8
ddfe93dec7b9b6059f3ce8959e5e2a81f368aa49
519c4d14cfd7f06b183e5f1431bfacc00fc4e54b
refs/heads/master
2023-05-20T03:28:01.747313
2021-06-09T20:34:16
2021-06-09T20:34:16
295,298,554
5
9
null
2021-08-12T16:05:11
2020-09-14T03:55:59
Java
UTF-8
Java
false
false
7,138
java
package com.ncarignan.buycheapthings; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.room.Room; import androidx.room.RoomDatabase; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceManager; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.TextView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity implements CheapThingAdapter.ClickOnCheapThingListener { Database database; @Override public void onResume() { // this is probably the correct place for ALL rendered info super.onResume(); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); TextView address = findViewById(R.id.preferencesAddress); address.setText(preferences.getString("addressPotato", "Go to Settings to set an address for shipping")); } @RequiresApi(api = Build.VERSION_CODES.O) @Override protected void onCreate(Bundle savedInstanceState) {//{6, 92, 10, 30} super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); database = Room.databaseBuilder(getApplicationContext(), Database.class, "ncarignan_cheap_things") .allowMainThreadQueries() .build(); NotificationChannel channel = new NotificationChannel("basic", "basic", NotificationManager.IMPORTANCE_HIGH); channel.setDescription("basic notifications"); // Register the channel with the system; you can't change the importance // or other notification behaviors after this NotificationManager notificationManager = getSystemService(NotificationManager.class); notificationManager.createNotificationChannel(channel); // ===================== RecyclerView ArrayList<CheapThing> cheapThings = (ArrayList<CheapThing>) database.cheapThingDao().getAllCheapThingsReversed(); RecyclerView recyclerView = findViewById(R.id.cart_preview); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setAdapter(new CheapThingAdapter(cheapThings, this)); // ==================== // element by id // click/type // callback Button buyButton = MainActivity.this.findViewById(R.id.buybutton); buyButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { EditText itemNameInput = MainActivity.this.findViewById(R.id.editItemName); EditText itemQuantityInput = MainActivity.this.findViewById(R.id.editTextQuantity); EditText itemPriceInput = MainActivity.this.findViewById(R.id.editTextPriceDecimal); String itemName = itemNameInput.getText().toString(); int quantity = Integer.parseInt(itemQuantityInput.getText().toString()); float price = Float.parseFloat(itemPriceInput.getText().toString()); System.out.println(String.format("We are going to buy %d %ss for $%f", quantity, itemName, price)); NotificationCompat.Builder builder = new NotificationCompat.Builder(MainActivity.this, "basic") .setSmallIcon(R.drawable.ic_launcher_background) .setContentTitle(itemName) .setContentText("Buying " + quantity + " " + itemName) .setStyle(new NotificationCompat.BigTextStyle() .bigText("Much longer text that cannot fit one line...")) .setPriority(NotificationCompat.PRIORITY_MAX); notificationManager.notify(89898989, builder.build()); // TODO: save the item to the database CheapThing cheapThing = new CheapThing(itemName, quantity, price); database.cheapThingDao().saveTheThing(cheapThing); cheapThings.add(0, cheapThing); recyclerView.getAdapter().notifyItemInserted(0); // recyclerView.getLayoutManager().smoothScrollToPosition(0); recyclerView.smoothScrollToPosition(0); // Intent goToPaymentConfirmation = new Intent(MainActivity.this, PaymentConfirmation.class); // goToPaymentConfirmation.putExtra("name", itemName); // goToPaymentConfirmation.putExtra("quantity", quantity); // goToPaymentConfirmation.putExtra("price", price); // MainActivity.this.startActivity(goToPaymentConfirmation); } }); Button goToCartButton = MainActivity.this.findViewById(R.id.visit_cart); goToCartButton.setOnClickListener((view) -> { System.out.println("going to cart"); // going to another app is called an intent // its generic, it gets handled by something else // explicit (internal to the app or the domain (send to a specific page we control) // implicit (goes anywhere, tells android the things we want to do, android opens a choice box of everything registered that can do it) // Intent shareToPhoneIntent = new Intent(Intent.ACTION_SEND); // shareToPhoneIntent.putExtra(Intent.EXTRA_TEXT, "Sharing this to the phone y'all!"); // // I forgot this last time // shareToPhoneIntent.setType("text/plain"); // MainActivity.this.startActivity(Intent.createChooser(shareToPhoneIntent, "where do you want to send this message,huh?")); Intent goToCartIntent = new Intent(MainActivity.this, Cart.class); MainActivity.this.startActivity(goToCartIntent); }); ImageButton goToSettingsButton = findViewById(R.id.settingsButton); goToSettingsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { openSettingsPage(); } }); Button goToOrderHistory = findViewById(R.id.order_history_nav); goToOrderHistory.setOnClickListener((view) -> { Intent intent = new Intent(MainActivity.this, OrderHistory.class); MainActivity.this.startActivity(intent); }); } public void openSettingsPage(){ Intent intent = new Intent(this, UserSettings.class); startActivity(intent); } @Override public void clickOnCheapThing(CheapThing cheapThing) { } // onCreate is one of six LifeCycle methods we can override. // onCreate gets called at a specific time: // when we first view the home page (when the app opens) }
[ "nick.carignan@sbcglobal.net" ]
nick.carignan@sbcglobal.net
47042bac55fe6d3435832a036c298fbad5fb0f6f
3c70d4d15575ce48de349a243b3ba95accb47b85
/src/main/java/com/example/demo/exceptions/DatasInvalidasException.java
3b8b39a53f173bb6099952402096a3a4a460812c
[]
no_license
MarLubanco/teste-backend
a8b7b061da6e70af936ce43f72468f8ecadd8eea
027bed88975bd99ae4bdfdd9b11f6f721ed32a7c
refs/heads/master
2020-03-26T22:09:29.207165
2018-08-24T09:48:07
2018-08-24T10:06:04
145,435,821
0
1
null
2018-08-20T15:27:31
2018-08-20T15:27:31
null
UTF-8
Java
false
false
173
java
package com.example.demo.exceptions; public class DatasInvalidasException extends Exception { public DatasInvalidasException(String message) { super(message); } }
[ "lubanco@edu.unifil.br" ]
lubanco@edu.unifil.br
bafbe5cd8272518f3a91a47eebd0f24c2c7e7283
caab8283287b6f616b35d9076680b7f5c741689f
/day02/src/com/atguigu/java1/LockTest.java
1540b0e05b060afe8e793f417169f13355a24654
[]
no_license
luwang951753/JavaSenior
cf338bb335204a90f37356fd762845bc5743aafb
8d7984f0f3a84b2706a71d36614b8bf4b4964be6
refs/heads/master
2021-02-19T10:32:33.443234
2020-03-16T09:03:50
2020-03-16T09:03:50
245,304,462
0
0
null
null
null
null
UTF-8
Java
false
false
1,802
java
package com.atguigu.java1; import java.util.concurrent.locks.ReentrantLock; /** * 解决线程安全问题的方式三: Lock锁 --- JDK5.0新增 * * 1.面试题: synchronized 与 Lock的异同? * 相同: 二者都可以解决线程安全问题 * 不同: synchronized机制在执行完相应的同步代码以后,自动的释放同步监视器 * Lock需要手动的启动同步(lock()),同时结束同步也需要手动的实现(unlock()) * * 面试题: 如何解决线程安全问题?有几种方式 * * @Author lw * @Create2020-03-08 17:55 */ class Window implements Runnable{ private int ticket = 100; //1.实例化ReantrantLock private ReentrantLock lock = new ReentrantLock(); @Override public void run() { while(true){ try{ //2.调用锁定方法lock() lock.lock(); if(ticket>0){ try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(Thread.currentThread().getName()+":集票,票号为:"+ticket); ticket--; }else{ break; } }finally { //3.调用解锁方法: unlock lock.unlock(); } } } } public class LockTest { public static void main(String[] args) { Window w = new Window(); Thread t1 = new Thread(w); Thread t2 = new Thread(w); Thread t3 = new Thread(w); t1.setName("窗口1"); t2.setName("窗口2"); t3.setName("窗口3"); t1.start(); t2.start(); t3.start(); } }
[ "luwang951753@sina.com" ]
luwang951753@sina.com
2df9debf6d64fd4dc1a634ada43f8464e7b2404c
f97823f5c56c6a9470d9fd56b9731d2d06752ea8
/src/main/java/mapping/struct/GameVersionCFG.java
cf8004069519e56c6154c1bc1a95d801142929c9
[ "MIT" ]
permissive
Hexeption/UDP-Java
551151fb9bfcf94c6a9e0a82cf6db59903a1135c
749e26505008cb715822bb20c091dc13cc053712
refs/heads/master
2020-03-27T22:28:04.033077
2018-07-25T23:46:00
2018-07-25T23:46:00
147,233,718
4
1
null
null
null
null
UTF-8
Java
false
false
309
java
package mapping.struct; /** * Version config data wrapper. * * @author bloo * @since 8/13/2017 */ public class GameVersionCFG { public GameVersionCFG.Downloads downloads; public static class Downloads { public Downloads.Client client; public static class Client { public String url; } } }
[ "waffleiron42@yahoo.com" ]
waffleiron42@yahoo.com
7e3abc8ca6350076b7ee46f04b1cb14962ba3b37
c2a93d062b1769c8d6af40a23229e5a8695558c0
/src/main/java/testCases/NewUser.java
bb5620c29204cd53e0ef0b057c2dc7af6bab9952
[]
no_license
maheshwaranvk/PIN_PASSWORD
2c9ac6125dd73043774d91afd6cebe69c9a21dc5
15f2991e7619c7d943b6222ad6c303bbb27a163b
refs/heads/master
2023-03-02T22:38:16.367679
2021-02-17T23:43:59
2021-02-17T23:43:59
339,885,517
0
0
null
null
null
null
UTF-8
Java
false
false
1,214
java
package testCases; import java.io.IOException; import java.text.ParseException; import org.openqa.selenium.WebDriverException; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import base.ProjectSpecificMethods; import pages.LoginPage; public class NewUser extends ProjectSpecificMethods { @BeforeTest public void getExcelFileName() { excelFileName="NewUser"; } @Test(dataProvider = "fetchData") public void runNewUser(String intnID, String dateOfBirth, String zipCd, String prsnID) throws ParseException, WebDriverException, IOException { new LoginPage().enterTestCnfg() .enterTestCnfgYSA() .enterUDPSchema() .clickNewUser() .enterSSN(prsnID) .enterDOB(dateOfBirth).addScreenshot() .clickSubmit() .enterZip(zipCd).addScreenshot() .clickContinue() .enterUserID(intnID) .enterPassword() .reEnterPassword() .enterVoicePin() .reEnterVoicePin() .addScreenshot() .clickContinue() .ansQuestion().addScreenshot() .clickContinueESQ() .addScreenshot() .clickContinuRSA() .addScreenshot() .clickContinueLS() .checkHomePageLoaded() .verifyTitle() .addScreenshot() ; } }
[ "53971467+maheshwaranvk@users.noreply.github.com" ]
53971467+maheshwaranvk@users.noreply.github.com
febdf8f96fc4b1511437623120011fabe628a37c
234c3446b2e739c379adc9629e53221cb70a8a86
/app/src/main/java/com/droid/utils/IOAuthCallBack.java
6b1bdc83f6842848b18ecfa78cc65945e0494070
[]
no_license
gunix007/AndroidTvLauncher-1
2bd761305a45e0e68ce8dc8e493d9806036655d0
f52b428540ae0c2b26408378709e0c77efa86d2c
refs/heads/master
2023-03-28T00:25:06.781620
2021-03-28T13:21:07
2021-03-28T13:21:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
151
java
package com.droid.utils; /** * 数据回调接口 */ public interface IOAuthCallBack { void getIOAuthCallBack(String result, int state); }
[ "qiulei.xia@ele.me" ]
qiulei.xia@ele.me
d245e5b93440037e7272d702bc6b57fb09b45870
15809b78d6d2eecbc2b072fcba42f1ece9be4c27
/src/main/java/com/covid19figthers/volunteers/repository/CityRepository.java
1e5d2c1fb0d4223976f57e5002d4acfc5b4e5f2d
[]
no_license
elPenas/volunteer
5f9fb9a8aef3e24466f0728ea2fd2f6fadab4a7d
6b4227a624ff1359062126a7c7b2f1868baf9196
refs/heads/master
2022-12-13T11:31:18.683667
2020-03-19T19:59:28
2020-03-19T19:59:28
248,591,183
0
0
null
2022-12-12T06:14:43
2020-03-19T19:47:11
Java
UTF-8
Java
false
false
371
java
package com.covid19figthers.volunteers.repository; import com.covid19figthers.volunteers.domain.City; import org.springframework.data.jpa.repository.*; import org.springframework.stereotype.Repository; /** * Spring Data repository for the City entity. */ @SuppressWarnings("unused") @Repository public interface CityRepository extends JpaRepository<City, Long> { }
[ "phantomquest@gmail.com" ]
phantomquest@gmail.com
83a61a76dce5912642e77880a00d193692594a6b
9e0a8b8f18de00300402efb0c6eb9048a1da3a53
/MaxSumContigousSubarray.java
78a43cc95bb1af2a1a0739786884f2969110a41b
[]
no_license
diksha-94/Java-Programs
e283ed97519d7c55ecc9a316244399c3bfca1ac6
223d29d8d2d548ee6bded06b4c4720b2e189a458
refs/heads/master
2020-06-02T19:33:40.689164
2017-06-12T14:23:48
2017-06-12T14:23:48
94,104,646
0
0
null
null
null
null
UTF-8
Java
false
false
4,471
java
import java.util.*; public class MaxSumContigousSubarray { // DO NOT MODFIY THE LIST. public static void main(String[] args){ int[] a = {-120, -202, -293, -60, -261, -67, 10, 82, -334, -393, -428, -182, -138, -167, -465, -347, -39, -51, -61, -491, -216, -36, -281, -361, -271, -368, -122, -114, -53, -488, -327, -182, -221, -381, -431, -161, -59, -494, -406, -298, -268, -425, -88, -320, -371, -5, 36, 89, -194, -140, -278, -65, -38, -144, -407, -235, -426, -219, 62, -299, 1, -454, -247, -146, 24, 2, -59, -389, -77, -19, -311, 18, -442, -186, -334, 41, -84, 21, -100, 65, -491, 94, -346, -412, -371, 89, -56, -365, -249, -454, -226, -473, 91, -412, -30, -248, -36, -95, -395, -74, -432, 47, -259, -474, -409, -429, -215, -102, -63, 80, 65, 63, -452, -462, -449, 87, -319, -156, -82, 30, -102, 68, -472, -463, -212, -267, -302, -471, -245, -165, 43, -288, -379, -243, 35, -288, 62, 23, -444, -91, -24, -110, -28, -305, -81, -169, -348, -184, 79, -262, 13, -459, -345, 70, -24, -343, -308, -123, -310, -239, 83, -127, -482, -179, -11, -60, 35, -107, -389, -427, -210, -238, -184, 90, -211, -250, -147, -272, 43, -99, 87, -267, -270, -432, -272, -26, -327, -409, -353, -475, -210, -14, -145, -164, -300, -327, -138, -408, -421, -26, -375, -263, 7, -201, -22, -402, -241, 67, -334, -452, -367, -284, -95, -122, -444, -456, -152, 25, 21, 61, -320, -87, 98, 16, -124, -299, -415, -273, -200, -146, -437, -457, 75, 84, -233, -54, -292, -319, -99, -28, -97, -435, -479, -255, -234, -447, -157, 82, -450, 86, -478, -58, 9, -500, -87, 29, -286, -378, -466, 88, -366, -425, -38, -134, -184, 32, -13, -263, -371, -246, 33, -41, -192, -14, -311, -478, -374, -186, -353, -334, -265, -169, -418, 63, 77, 77, -197, -211, -276, -190, -68, -184, -185, -235, -31, -465, -297, -277, -456, -181, -219, -329, 40, -341, -476, 28, -313, -78, -165, -310, -496, -450, -318, -483, -22, -84, 83, -185, -140, -62, -114, -141, -189, -395, -63, -359, 26, -318, 86, -449, -419, -2, 81, -326, -339, -56, -123, 10, -463, 41, -458, -409, -314, -125, -495, -256, -388, 75, 40, -37, -449, -485, -487, -376, -262, 57, -321, -364, -246, -330, -36, -473, -482, -94, -63, -414, -159, -200, -13, -405, -268, -455, -293, -298, -416, -222, -207, -473, -377, -167, 56, -488, -447, -206, -215, -176, 76, -304, -163, -28, -210, -18, -484, 45, 10, 79, -441, -197, -16, -145, -422, -124, 79, -464, -60, -214, -457, -400, -36, 47, 8, -151, -489, -327, 85, -297, -395, -258, -31, -56, -500, -61, -18, -474, -426, -162, -79, 25, -361, -88, -241, -225, -367, -440, -200, 38, -248, -429, -284, -23, 19, -220, -105, -81, -269, -488, -204, -28, -138, 39, -389, 40, -263, -297, -400, -158, -310, -270, -107, -336, -164, 36, 11, -192, -359, -136, -230, -410, -66, 67, -396, -146, -158, -264, -13, -15, -425, 58, -25, -241, 85, -82, -49, -150, -37, -493, -284, -107, 93, -183, -60, -261, -310, -380}; System.out.println("Max: "+maxSubArray(a)); } public static int maxSubArray(int[] a) { int n = a.length; int[] array = new int[n]; int[] temp =new int[n]; int j = 0; for(Integer i : a){ array[j] = i; temp[j] = i; j++; } combination(array, temp, n, 0); int max = Integer.MIN_VALUE; int sum = 0; for(List<Integer> list : resultList){ sum = 0; for(Integer i : list){ sum+=i; } if(sum>max) { max = sum; } } return max; } public static void combination(int[] array, int[] temp, int n, int k){ if(k==n-1) { array[k]=0; addCombination(array,temp,n); array[k]=1; addCombination(array,temp,n); return; } array[k]=0; combination(array, temp, n, k+1); array[k]=1; combination(array, temp, n, k+1); } public static List<List<Integer>> resultList = new ArrayList<List<Integer>>(); public static void addCombination(int[] str, int[] temp, int n){ //System.out.println("Add combination"); Boolean zero = false; Boolean one = false; Boolean flag = false; int sum = 0; for(int i=0;i<n;i++){ if(str[i]==0 && one == true){ zero =true; } if(str[i]==1 && one == true && zero == true){ flag = false; break; } if(str[i]==1){ one = true; flag = true; } } if(flag){ List<Integer> tempList = new ArrayList<Integer>(); for(int i=0;i<n;i++){ if(str[i] == 1){ tempList.add(temp[i]); } } //System.out.println(tempList); resultList.add(tempList); } } }
[ "diksha.bajaj@hpe.com" ]
diksha.bajaj@hpe.com
4f34cc050d0eb8c3813db3b1fcaee10bbecf4374
70daf03c1a4e12f07e90185d0ab9fe5cf0b11293
/src/test/java/guru/springframework/converters/NotesCommandToNotesTest.java
440dfd6b5b3695c162aaf5ba1dc75abf70fa8e0f
[]
no_license
morri909/spring5-reactive-mongo-recipe-app
b03262fb13ab44cd221f5f67610da829d8594555
7e566cae758a044d668a3c8aec1638d7975467c1
refs/heads/master
2023-03-13T23:12:32.934585
2021-03-11T16:17:45
2021-03-11T16:17:45
344,643,185
0
0
null
null
null
null
UTF-8
Java
false
false
1,081
java
package guru.springframework.converters; import guru.springframework.commands.NotesCommand; import guru.springframework.domain.Notes; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public class NotesCommandToNotesTest { public static final String ID_VALUE = "1"; public static final String RECIPE_NOTES = "Notes"; NotesCommandToNotes converter; @Before public void setUp() throws Exception { converter = new NotesCommandToNotes(); } @Test public void testNullParameter() throws Exception { assertNull(converter.convert(null)); } @Test public void testEmptyObject() throws Exception { assertNotNull(converter.convert(new NotesCommand())); } @Test public void convert() throws Exception { //given NotesCommand notesCommand = new NotesCommand(); notesCommand.setId(ID_VALUE); notesCommand.setRecipeNotes(RECIPE_NOTES); //when Notes notes = converter.convert(notesCommand); //then assertNotNull(notes); assertEquals(ID_VALUE, notes.getId()); assertEquals(RECIPE_NOTES, notes.getRecipeNotes()); } }
[ "morri909@umn.edu" ]
morri909@umn.edu
da4e74b20094e47e8c6b570a2e88215cd64408d5
e38f60b97ef36896dd4d061c1f16ca45601823eb
/src/main/org/uva/ql/ast/Statement.java
f9d83d168920ea29d33e7dfce97845aaff52b7e1
[]
no_license
EdwinOuwehand/ql-dsl
dae59af26a6e839ec2fc63cf6334e3461603ae0f
f0895b045606952cb0ed0aef09100a118194e640
refs/heads/master
2020-03-13T10:38:20.647061
2018-10-16T09:25:21
2018-10-16T09:25:21
131,087,386
1
0
null
null
null
null
UTF-8
Java
false
false
241
java
package org.uva.ql.ast; import org.uva.ql.visitor.StatementVisitor; public abstract class Statement extends TreeNode { public abstract String getId(); public abstract <T, C> T accept(StatementVisitor<T, C> visitor, C context); }
[ "e.ouwehand@sig.eu" ]
e.ouwehand@sig.eu
7433e289826aa6f4272d77a73144b98d6d8a9013
d4fdb17c6ec0d851747b3799212d25598d113271
/src/main/java/openrecordz/domain/validator/UserRegistrationValidation.java
93173ce0719c03411f1ca3e7920d4822d0573675
[]
no_license
williamaurreav23/openrecordz-server
378170e09f7473c2d7980bc1d7cd487b3b44cc00
f2740cc4fa239b3e0feabfef4c32516cba1db80b
refs/heads/master
2022-01-12T21:23:28.718533
2019-03-19T12:12:52
2019-03-19T12:12:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,009
java
package openrecordz.domain.validator; import org.apache.commons.validator.EmailValidator; import org.springframework.validation.Errors; import org.springframework.validation.ValidationUtils; import org.springframework.validation.Validator; import openrecordz.util.UsernameValidator; import openrecordz.web.form.UserRegistrationForm; public class UserRegistrationValidation implements Validator { @Override public boolean supports(Class<?> arg0) { // TODO Auto-generated method stub return UserRegistrationForm.class.equals(arg0); } @Override public void validate(Object obj, Errors e) { UserRegistrationForm userRegistration = (UserRegistrationForm) obj; // ValidationUtils.rejectIfEmpty(e, "name", "name.empty"); ValidationUtils.rejectIfEmptyOrWhitespace(e, "fullName", "required.fullName", "Field Name is required."); ValidationUtils.rejectIfEmptyOrWhitespace(e, "username", "required.username", "Field username is required."); UsernameValidator usernameValidator = new UsernameValidator(); boolean isUsernameValid = usernameValidator.validate(userRegistration.getUsername()); if (!userRegistration.getUsername().equals("") && !isUsernameValid) e.rejectValue("username", "username.notvalid"); ValidationUtils.rejectIfEmptyOrWhitespace(e, "email", "required.email", "Field email is required."); boolean isEmail = EmailValidator.getInstance().isValid(userRegistration.getEmail()); if (userRegistration.getEmail()!=null) { if (!userRegistration.getEmail().equals("") && !isEmail) e.rejectValue("email", "notemail"); } if (e.hasFieldErrors("email")) { userRegistration.setFromSocial(false); } if (userRegistration.isFromSocial()==false) { ValidationUtils.rejectIfEmptyOrWhitespace(e, "password", "required.password", "Field password is required."); } if (userRegistration.isAcceptTermsOfService()==false) e.rejectValue("acceptTermsOfService", "accepttermsofservice"); } }
[ "andrea.leo83@gmail.com" ]
andrea.leo83@gmail.com
7c39d19ef0b8d77e1a72d9000e93cd335064172a
7ae4a7dc0e15a9203254adccbf1a376d9f74bc26
/ms-common-ext/ms-common-ext-spring/ms-common-ext-spring-web/ms-common-ext-spring-web-exception/src/main/java/com/jrmcdonald/common/ext/spring/web/exception/handler/config/ExceptionHandlerConfiguration.java
4d31209635185c2ce5368e4e7622feb9ad6b67f9
[ "MIT" ]
permissive
jrmcdonald/ms-common
8c39223fb310f8d55b976f56de11da07f71bc709
e97c6b9e38ab6cd85a6c4f748974526788fdf941
refs/heads/main
2023-07-07T23:15:17.696991
2021-08-13T12:10:18
2021-08-13T12:10:18
267,060,323
0
0
MIT
2021-08-13T12:06:37
2020-05-26T14:08:38
Java
UTF-8
Java
false
false
450
java
package com.jrmcdonald.common.ext.spring.web.exception.handler.config; import com.jrmcdonald.common.ext.spring.web.exception.handler.ServiceExceptionHandler; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class ExceptionHandlerConfiguration { @Bean public ServiceExceptionHandler customerExceptionHandler() { return new ServiceExceptionHandler(); } }
[ "jamie.r.mcdonald@waitrose.co.uk" ]
jamie.r.mcdonald@waitrose.co.uk
2bbaff01cc424b1ee9173ef6ffc4e84916048332
424bceba718caf82dd90d15d728958cb23f6333f
/eventoappSwing/src/DaoInterface/Ievaluationp.java
59ac36a4823e34a8777a766e40de0765d4a89b81
[]
no_license
MedAminerihane/eventoswing
5d95eeb0507bb664a7f37424574dff39b6de004c
4b76ac45842ada324853d40772397b332fbc047a
refs/heads/master
2020-09-14T19:36:45.896044
2016-08-26T00:43:50
2016-08-26T00:43:50
66,322,284
0
0
null
null
null
null
UTF-8
Java
false
false
388
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 DAOinterface; import Entites.Utilisateur; /** * * @author user */ public interface Ievaluationp { public void evaluerprestataire(int note ,Utilisateur e,Utilisateur prestataire); }
[ "medamine.rihane@hotmail.com" ]
medamine.rihane@hotmail.com
1f919bd384c14295dfd217d96c1400fe137871f2
e57083ea584d69bc9fb1b32f5ec86bdd4fca61c0
/sample-project-5400/src/main/java/com/example/project/sample5400/other/sample7/Other7_307.java
b741439705cc900c0068222a0ac279782e181038
[]
no_license
snicoll-scratches/test-spring-components-index
77e0ad58c8646c7eb1d1563bf31f51aa42a0636e
aa48681414a11bb704bdbc8acabe45fa5ef2fd2d
refs/heads/main
2021-06-13T08:46:58.532850
2019-12-09T15:11:10
2019-12-09T15:11:10
65,806,297
5
3
null
null
null
null
UTF-8
Java
false
false
84
java
package com.example.project.sample5400.other.sample7; public class Other7_307 { }
[ "snicoll@pivotal.io" ]
snicoll@pivotal.io
19407332bb56a1e4132430b9c0fdc7d58b3848dc
6ee6cc888f0a82e36fd1687fed4a109f0cb800a7
/leetcode/212.java
91d97a7679d67a300dbbc4cfeff35d5850cbff21
[]
no_license
Rayleigh0328/OJ
1977e3dfc05f96437749b6259eda4d13133d2c87
3d7caaf356c69868a2f4359377ec75e15dafb4c3
refs/heads/master
2021-01-21T04:32:03.645841
2019-12-01T06:33:44
2019-12-01T06:33:44
49,385,474
1
0
null
null
null
null
UTF-8
Java
false
false
5,739
java
class Solution { Set<String> wordsFound; int boardRowCount; int boardColumnCount; char [][] board; Trie trie; public List<String> findWords(char[][] board, String[] words) { trie = new Trie(words); wordsFound = new HashSet<>(); boardRowCount = board.length; if (boardRowCount == 0) return wordsFound.stream().collect(Collectors.toList()); boardColumnCount = board[0].length; if (boardColumnCount == 0) return wordsFound.stream().collect(Collectors.toList()); this.board = board; Set<Position> visited = new HashSet<>(); for (int i=0;i<boardRowCount;++i) for (int j=0;j<boardColumnCount;++j) { Position p = new Position(i,j); if (trie.root.next.get(getChar(p)) != null) solve(p, trie.root.next.get(getChar(p)), visited); } return wordsFound.stream().collect(Collectors.toList()); } private Set<Position> buildNextPosSet(Position pos, Trie.TrieNode node, Set<Position> visited){ List<Position> candidateList = new LinkedList<>(); candidateList.add(new Position(pos.x - 1, pos.y)); candidateList.add(new Position(pos.x + 1, pos.y)); candidateList.add(new Position(pos.x , pos.y-1)); candidateList.add(new Position(pos.x , pos.y+1)); Set<Position> result = new HashSet<>(); for (Position nextPos : candidateList) if (inBoundary(nextPos) && node.next.get(getChar(nextPos)) != null && !visited.contains(nextPos) ) result.add(nextPos); return result; } private void solve(Position pos, Trie.TrieNode node, Set<Position> visited){ if (!node.wordsEndHere.isEmpty()) wordsFound.add((String) trie.getDict().get(node.wordsEndHere.get(0))); visited.add(pos); Set<Position> nextPosSet = buildNextPosSet(pos, node, visited); for (Position nextPos : nextPosSet) solve(nextPos, node.next.get(getChar(nextPos)), visited); visited.remove(pos); } private Character getChar(Position pos){ return board[pos.x][pos.y]; } private boolean inBoundary(Position pos){ if (pos.x < 0) return false; if (pos.x >= boardRowCount) return false; if (pos.y < 0) return false; if (pos.y >= boardColumnCount) return false; return true; } } class Position{ public int x; public int y; public Position() { this(0,0); } public Position(int x, int y) { this.x = x; this.y = y; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Position position = (Position) o; if (x != position.x) return false; return y == position.y; } @Override public int hashCode() { int result = x; result = 31 * result + y; return result; } } public class Trie { public static class TrieNode{ List<Integer> wordsEndHere; Map<Character, TrieNode> next; public TrieNode(){ wordsEndHere = new ArrayList<>(); next = new HashMap<>(); } } public TrieNode root; private ArrayList dict; public Trie(){ root = new TrieNode(); dict = new ArrayList(); } public Trie(String[] a){ this(); for (int i=0;i<a.length;++i){ insertWord(a[i]); } } public ArrayList getDict() { return dict; } public void insertWord(String st){ int index = dict.size(); dict.add(st); TrieNode currentNode = root; for (int i=0; i<st.length(); ++i){ Character ch = st.charAt(i); TrieNode nextNode = currentNode.next.get(ch); if (nextNode == null){ nextNode = new TrieNode(); currentNode.next.put(ch, nextNode); } currentNode = nextNode; } currentNode.wordsEndHere.add(index); } private TrieNode search(String st){ TrieNode currentNode = root; for (int i=0; i<st.length();++i){ Character ch = st.charAt(i); currentNode = currentNode.next.get(ch); if (currentNode == null) return null; } return currentNode; } public boolean checkWordInDict(String st){ TrieNode node = search(st); if (node == null) return false; return !node.wordsEndHere.isEmpty(); } public Set<Integer> getAllPrefixWords(String st){ TrieNode currentNode = root; Set<Integer> indexSet = new HashSet<>(); for (int i=0; i<st.length();++i){ indexSet.addAll(currentNode.wordsEndHere); Character ch = st.charAt(i); currentNode = currentNode.next.get(ch); if (currentNode == null) return indexSet; } return indexSet; } public Set<Integer> getAllWordsInTrie() { return getAllWordsStartWithString(""); } public Set<Integer> getAllWordsStartWithString(String st){ return getAllWordsStartWithString(search(st)); } private Set<Integer> getAllWordsStartWithString(TrieNode node){ Set<Integer> result = new HashSet<>(); dfs(node, result); return result; } private void dfs(TrieNode node, Set<Integer> indexSet){ if (node == null) return; indexSet.addAll(node.wordsEndHere); for (Character ch : node.next.keySet()){ dfs(node.next.get(ch), indexSet); } } }
[ "jingyun.bian@centro-T000325.centro.net" ]
jingyun.bian@centro-T000325.centro.net
2090ed59553e3ec9cd9177190c73b7f7a61be46b
e561d6ea521a4d7eee9c96eca671ae6212406309
/Java/src/kakao/blind2020/Test.java
e7074444f1e7a19d350de55c2e2496c8f6731b57
[]
no_license
Seungpang/Algorithms
02a9a9dc3225caf8651c03208334082024deb65f
f7e6c5f28ce3b6509cb91d7aca162f36ae837b82
refs/heads/master
2023-08-19T03:30:24.346606
2023-08-17T15:50:18
2023-08-17T15:50:18
176,178,409
0
0
null
null
null
null
UTF-8
Java
false
false
529
java
package kakao.blind2020; public class Test { public static void main(String[] args) { Test a = new Test(); int[] arr = {-2,0,10,-19,4,6,-8}; System.out.println(a.checkIfExist(arr)); } public boolean checkIfExist(int[] arr) { int n = arr.length; for (int i = 0; i < n; i++) { int num = arr[i] * 2; for (int j = 0; j < n ; j++) { if (num == arr[j]) return true; } } return false; } }
[ "obey1342@gmail.com" ]
obey1342@gmail.com
89c279c1c07071d3bfcb883e890a16948bb26754
db988cf1f2f73e158a5189c892835cbe7355f6e1
/MACMaven/src/test/java/macconfigforms/BankingConfig.java
c8f54805c613908d59f6f6313e367a63d6bd4a3d
[]
no_license
vdileepdevops/mac
f2e4ad421d0741cc99f6de9368723991707522bf
eb89f140ad8788d00935b01b6536ab2fab9ff141
refs/heads/master
2023-02-28T14:12:43.754997
2021-02-10T11:11:38
2021-02-10T11:11:38
337,700,012
0
0
null
null
null
null
UTF-8
Java
false
false
31,083
java
package macconfigforms; import org.testng.annotations.Test; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import java.util.concurrent.TimeUnit; import org.apache.commons.io.FileUtils; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; public class BankingConfig { public static WebDriver driver; @BeforeClass public static void home() throws Throwable { System.setProperty("webdriver.chrome.driver", "E://Eclipse//chromedriver87//chromedriver.exe"); driver=new ChromeDriver(); driver.get("http://13.234.192.218:65504"); driver.findElement(By.name("username")).sendKeys("admin@kapilit.com"); driver.findElement(By.name("password")).sendKeys("kapil"); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS); driver.findElement(By.xpath("//input[@class='btn btn-b-icon px-3 border-0 btn-block']")).click(); Thread.sleep(2000); } @AfterClass public void window() { driver.close(); } @Test(priority=0) public void memType() throws Throwable { driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); WebDriverWait wait=new WebDriverWait(driver,10); WebElement w=wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-root/app-navigation/div/nav/ul/li[4]/a"))); w.click(); WebDriverWait wait1=new WebDriverWait(driver,10); WebElement w1=wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='acc-73']/div[1]/div[1]/a"))); w1.click(); WebDriverWait wait2=new WebDriverWait(driver,10); WebElement w2=wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='collapse74']/div/ul/li[1]/a"))); w2.click(); driver.findElement(By.xpath("//input[@formcontrolname='pmembertype']")).sendKeys("Regular Type"); Thread.sleep(2000); driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-membertype-new/div[2]/div/div/form/div[1]/div[6]/div/div[1]/label")).click(); driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-membertype-new/div[2]/div/div/form/div[1]/div[6]/div/div[2]/label")).click(); driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-membertype-new/div[2]/div/div/form/div[1]/div[6]/div/div[3]/label")).click(); Thread.sleep(2000); driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-membertype-new/div[2]/div/div/form/div[2]/div/div/a/i")).click(); Thread.sleep(2000); WebElement w3=driver.findElement(By.id("toast-container")); String text=w3.getText(); System.out.println(text); Date d = new Date(); System.out.println(d.toString()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); Thread.sleep(2000); File screenshotFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshotFile , new File("E:\\Eclipse\\MAC Screen Shots\\Config forms\\"+sdf.format(d)+".jpg")); } //Share Creation Details @Test(priority=1) public void share() { driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); // WebDriverWait wait=new WebDriverWait(driver,10); // WebElement w=wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-root/app-navigation/div/nav/ul/li[4]/a"))); // w.click(); // WebDriverWait wait1=new WebDriverWait(driver,10); // WebElement w1=wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='acc-73']/div[1]/div[1]/a"))); // w1.click(); WebDriverWait wait2=new WebDriverWait(driver,10); WebElement w2=wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='collapse74']/div/ul/li[3]/a"))); w2.click(); driver.findElement(By.xpath("//input[@formcontrolname='psharename']")).sendKeys("Regular Share Class"); driver.findElement(By.xpath("//input[@formcontrolname='psharecode']")).sendKeys("RSC"); WebDriverWait wa1=new WebDriverWait(driver,15); WebElement we1=wa1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-shares-config-new/div[2]/div/div[4]/div/div/button"))); we1.click(); } @Test(priority=2) public void shareConfig() throws Throwable { WebElement mul=driver.findElement(By.xpath("//*[@id='pmembertypeid']/div/div/div[2]/input")); mul.click(); WebElement w3=driver.findElement(By.xpath("//*[@id='pmembertypeid']/div/div/div[2]/input")); w3.sendKeys("ELECTED REGULAR MEMBERS",Keys.ENTER); // w3.sendKeys("Non-Elected Members",Keys.ENTER); WebElement mul1=driver.findElement(By.xpath("//*[@id='pApplicanttype']/div/div/div[2]/input")); mul1.click(); WebElement w4=driver.findElement(By.xpath("//*[@id='pApplicanttype']/div/div/div[2]/input")); w4.sendKeys("Regular/General",Keys.ENTER); // w4.sendKeys("Senior Citizen",Keys.ENTER); driver.findElement(By.xpath("//input[@formcontrolname='pfacevalue']")).sendKeys("1200"); driver.findElement(By.xpath("//input[@formcontrolname='pminshares']")).sendKeys("5"); driver.findElement(By.xpath("//input[@formcontrolname='pmaxshares']")).sendKeys("50"); driver.findElement(By.id("inlineRadio2")).click(); driver.findElement(By.xpath("//input[@formcontrolname='pmultipleshares']")).clear(); driver.findElement(By.xpath("//input[@formcontrolname='pmultipleshares']")).sendKeys("5"); Thread.sleep(2000); driver.findElement(By.xpath("//*[@id='share-config']/app-share-capital/div[1]/div/div/a")).click(); Thread.sleep(2000); driver.findElement(By.xpath("//*[@id='share-config']/app-share-capital/div[3]/a[2]")).click(); WebElement toggle1 =driver.findElement(By.id("Employment")); JavascriptExecutor js1 = (JavascriptExecutor)driver; js1.executeScript("arguments[0].click();", toggle1); driver.findElement(By.xpath("//*[@id='referral-commission']/app-share-referral-commission/form/div[2]/div[1]/div[2]/div/div[2]/label")).click(); driver.findElement(By.name("pcommissionpercentageValue")).sendKeys("2"); WebElement toggle2=driver.findElement(By.id("tds")); JavascriptExecutor js2= (JavascriptExecutor)driver; js2.executeScript("arguments[0].click();",toggle2); Select s=new Select(driver.findElement(By.id("ptdssection"))); s.selectByVisibleText("194H"); Thread.sleep(2000); driver.findElement(By.xpath("//*[@id='referral-commission']/app-share-referral-commission/div/a[2]")).click(); Thread.sleep(2000); WebElement w5=driver.findElement(By.id("toast-container")); String text=w5.getText(); System.out.println(text); Date d = new Date(); System.out.println(d.toString()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); Thread.sleep(2000); File screenshotFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshotFile , new File("E:\\Eclipse\\MAC Screen Shots\\Config forms\\"+sdf.format(d)+".jpg")); } // A/c Type Creation @Test(priority=3) public void saving() { driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); // WebDriverWait wait=new WebDriverWait(driver,10); // WebElement w=wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-root/app-navigation/div/nav/ul/li[4]/a"))); // w.click(); // WebDriverWait wait1=new WebDriverWait(driver,10); // WebElement w1=wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='acc-73']/div[1]/div[1]/a"))); // w1.click(); WebDriverWait wait2=new WebDriverWait(driver,10); WebElement w2=wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='collapse74']/div/ul/li[4]/a"))); w2.click(); driver.findElement(By.xpath("//input[@formcontrolname='pSavingAccountname']")).sendKeys("Salary Saving Account "); driver.findElement(By.xpath("//*[@id='savingnameandcode']/app-savings-name-code/div[3]/a[2]")).click(); } @Test(priority=4) public void saConfig() { WebElement m1=driver.findElement(By.xpath("//*[@id='pMembertypeid']/div/div/div[2]/input")); m1.click(); WebElement w3=driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-savings-config-new/div[2]/div/div[2]/app-savings-configuration/form/div[1]/div[1]/div/ng-select/div/div/div[2]/input")); w3.sendKeys("ELECTED REGULAR MEMBERS",Keys.ENTER); // w3.sendKeys("Non-Elected Members",Keys.ENTER); WebElement m2=driver.findElement(By.xpath("//*[@id='pApplicanttype']/div/div/div[2]/input")); m2.click(); WebElement w4=driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-savings-config-new/div[2]/div/div[2]/app-savings-configuration/form/div[1]/div[2]/div/ng-select/div/div/div[2]/input")); w4.sendKeys("Regular/General",Keys.ENTER); // w4.sendKeys("Senior Citizen",Keys.ENTER); driver.findElement(By.xpath("//input[@formcontrolname='pMinopenamount']")).clear(); driver.findElement(By.xpath("//input[@formcontrolname='pMinopenamount']")).sendKeys("10000"); Select s=new Select(driver.findElement(By.xpath("//select[@formcontrolname='pInterestpayout']"))); s.selectByVisibleText(" Monthly"); driver.findElement(By.xpath("//input[@formcontrolname='pInterestrate']")).clear(); driver.findElement(By.xpath("//input[@formcontrolname='pInterestrate']")).sendKeys("11.5"); driver.findElement(By.xpath("//input[@formcontrolname='pMinbalance']")).clear(); driver.findElement(By.xpath("//input[@formcontrolname='pMinbalance']")).sendKeys("1000"); WebElement toggle1=driver.findElement(By.id("penaltyapplicable")); JavascriptExecutor js1=(JavascriptExecutor) driver; js1.executeScript("arguments[0].click();", toggle1); driver.findElement(By.xpath("//input[@formcontrolname='pPenaltyvalue']")).sendKeys("100"); JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("window.scrollBy(0,-350)", ""); WebElement toggle2=driver.findElement(By.id("savingspayinapplicable")); JavascriptExecutor js2=(JavascriptExecutor) driver; js2.executeScript("arguments[0].click();", toggle2); Select s1=new Select(driver.findElement(By.xpath("//select[@formcontrolname='pSavingspayinmode']"))); s1.selectByVisibleText(" Monthly"); driver.findElement(By.xpath("//*[@id='savingconfig']/app-savings-configuration/form/div[2]/div[2]/div/div[2]/div[2]/div[1]/div/input")).sendKeys("1000"); driver.findElement(By.xpath("//*[@id='savingconfig']/app-savings-configuration/form/div[2]/div[2]/div/div[2]/div[2]/div[2]/div/input")).sendKeys("10000"); WebElement toggle3=driver.findElement(By.id("withdrawallimitapplicable")); JavascriptExecutor js3=(JavascriptExecutor)driver; js3.executeScript("arguments[0].click();",toggle3); driver.findElement(By.xpath("//input[@formcontrolname='pMaxwithdrawllimit']")).sendKeys("5000"); driver.findElement(By.xpath("//*[@id='savingconfig']/app-savings-configuration/form/div[3]/a[2]")).click(); driver.findElement(By.xpath("//*[@id='savingconfig']/app-savings-configuration/form/div[5]/a[2]")).click(); } @Test(priority=5) public void saloanfacility() { WebElement toggle4=driver.findElement(By.id("loanfacilityapplicable")); JavascriptExecutor js4=(JavascriptExecutor)driver; js4.executeScript("arguments[0].click()", toggle4); driver.findElement(By.xpath("//input[@formcontrolname='pEligiblepercentage']")).sendKeys("80"); driver.findElement(By.xpath("//input[@formcontrolname='pAgeperiod']")).sendKeys("6"); Select s2=new Select(driver.findElement(By.xpath("//select[@formcontrolname='pAgeperiodtype']"))); s2.selectByVisibleText("Months"); driver.findElement(By.xpath("//*[@id='loanfacility']/app-loan-facility/div[3]/a[2]")).click(); } @Test(priority=6) public void sadocuments() { driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-savings-config-new/div[2]/div/div[4]/app-identification-documents/div[2]/div[2]/a/img[1]")).click(); driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-savings-config-new/div[2]/div/div[4]/app-identification-documents/div[2]/div[2]/div/div/div/table/tbody/tr[1]/td[1]/input")).click(); driver.findElement(By.xpath("//*[@id='mandatorykyc']/app-identification-documents/div[3]/div/div/a[2]")).click(); } @Test(priority=7) public void sareferences() throws Throwable { WebElement toggle5=driver.findElement(By.id("referralCommissionapplicable")); JavascriptExecutor js5=(JavascriptExecutor)driver; js5.executeScript("arguments[0].click();", toggle5); driver.findElement(By.id("pCommissionValue")).sendKeys("500"); WebElement toggle6=driver.findElement(By.id("Istdsapplicable")); JavascriptExecutor js6=(JavascriptExecutor)driver; js6.executeScript("arguments[0].click();", toggle6); Select s3=new Select(driver.findElement(By.xpath("//select[@formcontrolname='ptdssection']"))); s3.selectByIndex(8); Thread.sleep(2000); driver.findElement(By.xpath("//*[@id='refferral']/app-referral-commission/div[3]/div/div/a[2]")).click(); Thread.sleep(2000); WebElement w3=driver.findElement(By.id("toast-container")); String text=w3.getText(); System.out.println(text); Date d = new Date(); System.out.println(d.toString()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); Thread.sleep(2000); File screenshotFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshotFile , new File("E:\\Eclipse\\MAC Screen Shots\\Config forms\\"+sdf.format(d)+".jpg")); } //Fixed Deposit Creation @Test(priority=8) public void fd() { driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); // WebDriverWait wait=new WebDriverWait(driver,10); // WebElement w=wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-root/app-navigation/div/nav/ul/li[4]/a"))); // w.click(); // WebDriverWait wait1=new WebDriverWait(driver,10); // WebElement w1=wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='acc-73']/div[1]/div[1]/a"))); // w1.click(); WebDriverWait wait2=new WebDriverWait(driver,10); WebElement w2=wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='collapse74']/div/ul/li[6]/a"))); w2.click(); driver.findElement(By.xpath("//input[@formcontrolname='pFdname']")).sendKeys(" Yearly Fixed Deposit "); driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-fdconfig-new/div[3]/div/div/div/button")).click(); } @Test(priority=9) public void fdConfig() { WebElement m1=driver.findElement(By.xpath("//*[@id='pMembertypeid']/div/div/div[2]/input")); m1.click(); WebElement w3=driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-fdconfig-new/div[2]/div/div/div/div[2]/app-fdconfiguration/form/div[1]/div[1]/div/ng-select/div/div/div[2]/input")); w3.sendKeys("ELECTED REGULAR MEMBERS",Keys.ENTER); // w3.sendKeys("Non-Elected Members",Keys.ENTER); WebElement m2=driver.findElement(By.xpath("//*[@id='pApplicanttype']/div/div/div[2]/input")); m2.click(); WebElement w4=driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-fdconfig-new/div[2]/div/div/div/div[2]/app-fdconfiguration/form/div[1]/div[2]/div/ng-select/div/div/div[2]/input")); w4.sendKeys("Regular/General",Keys.ENTER); // w4.sendKeys("Senior Citizen",Keys.ENTER); driver.findElement(By.xpath("//*[@id='monthly']")).click(); driver.findElement(By.xpath("//input[@formcontrolname='pMininstalmentamount']")).sendKeys("50000"); driver.findElement(By.xpath("//input[@formcontrolname='pMaxinstalmentamount']")).sendKeys("1000000"); driver.findElement(By.xpath("//*[@id='option2']")).click(); driver.findElement(By.xpath("//input[@formcontrolname='pMultiplesofamount']")).clear(); driver.findElement(By.xpath("//input[@formcontrolname='pMultiplesofamount']")).sendKeys("1000"); driver.findElement(By.xpath("//input[@formcontrolname='pfromnoofmonths']")).sendKeys("12"); driver.findElement(By.xpath("//input[@formcontrolname='ptonoofmonths']")).sendKeys("72"); driver.findElement(By.xpath("//input[@formcontrolname='pInterestratefrom']")).sendKeys("8"); driver.findElement(By.xpath("//input[@formcontrolname='pInterestrateto']")).sendKeys("11.5"); WebElement toggle1=driver.findElement(By.id("Referral-fd")); JavascriptExecutor js1=(JavascriptExecutor)driver; js1.executeScript("arguments[0].click();", toggle1); driver.findElement(By.xpath("//*[@id='fdConfiguration']/app-fdconfiguration/form/div[3]/div[4]/div[1]/div/div/div[2]/div/div/div[2]/label")).click(); driver.findElement(By.xpath("//input[@formcontrolname='pCommissionValue']")).sendKeys("4"); driver.findElement(By.xpath("//*[@id='fdConfiguration']/app-fdconfiguration/form/div[3]/div[4]/div[2]/div/a[2]")).click(); //Add button driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-fdconfig-new/div[3]/div/div/div/button")).click(); // Save & Continue } @Test(priority=10) public void fdprematurity() { //Loan Facility Details WebElement toggle2=driver.findElement(By.id("loanfacty")); JavascriptExecutor js2=(JavascriptExecutor)driver; js2.executeScript("arguments[0].click();", toggle2); driver.findElement(By.xpath("//input[@formcontrolname='pEligiblepercentage']")).sendKeys("80"); driver.findElement(By.xpath("//input[@formcontrolname='pAgeperiod']")).sendKeys("3"); Select s2=new Select(driver.findElement(By.xpath("//select[@formcontrolname='pAgeperiodtype']"))); s2.selectByVisibleText("Months"); // Prematurity details WebElement toggle3=driver.findElement(By.id("lockin")); JavascriptExecutor js3=(JavascriptExecutor)driver; js3.executeScript("arguments[0].click();", toggle3); driver.findElement(By.xpath("//input[@formcontrolname='pPrematuretyageperiod']")).sendKeys("6"); Select s3=new Select(driver.findElement(By.xpath("//select[@formcontrolname='pPrematuretyageperiodtype']"))); s3.selectByVisibleText("Months"); driver.findElement(By.xpath("//input[@formcontrolname='pminprematuritypercentage']")).sendKeys("0"); driver.findElement(By.xpath("//input[@formcontrolname='pmaxprematuritypercentage']")).sendKeys("12"); Select s4=new Select(driver.findElement(By.xpath("//select[@formcontrolname='pprematurityperiodtype']"))); s4.selectByVisibleText("Months"); driver.findElement(By.xpath("//input[@formcontrolname='pPercentage']")).sendKeys("2"); driver.findElement(By.xpath("//*[@id='fdLoanFacility']/app-fdloanandfacility/form/div[5]/div[2]/div[4]/div/a")).click(); //Late fee details WebElement toggle4=driver.findElement(By.id("latefee")); JavascriptExecutor js4=(JavascriptExecutor)driver; js4.executeScript("arguments[0].click();", toggle4); driver.findElement(By.xpath("//input[@formcontrolname='pLatefeepayblevalue']")).sendKeys("500"); driver.findElement(By.xpath("//input[@formcontrolname='pLatefeeapplicablefrom']")).clear(); driver.findElement(By.xpath("//input[@formcontrolname='pLatefeeapplicablefrom']")).sendKeys("10"); Select s5=new Select(driver.findElement(By.xpath("//select[@formcontrolname='pLatefeeapplicabletype']"))); s5.selectByVisibleText("Days"); driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-fdconfig-new/div[3]/div/div/div/button")).click();// Save & Continue } @Test(priority=11) public void fddocuments() throws Throwable { WebDriverWait wa2=new WebDriverWait(driver,10); WebElement we2=wa2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-fdconfig-new/div[2]/div/div/div/div[4]/app-fdidentification/form/div/div/app-identification-documents/div[2]/div[2]/a/img[1]"))); we2.click(); driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-fdconfig-new/div[2]/div/div/div/div[4]/app-fdidentification/form/div/div/app-identification-documents/div[2]/div[2]/div/div/div/table/tbody/tr[1]/td[1]/input")).click(); driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-fdconfig-new/div[3]/div/div/div/button")).click(); //save Thread.sleep(2000); WebElement w3=driver.findElement(By.id("toast-container")); String text=w3.getText(); System.out.println(text); Date d = new Date(); System.out.println(d.toString()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); Thread.sleep(2000); File screenshotFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshotFile , new File("E:\\Eclipse\\MAC Screen Shots\\Config forms\\"+sdf.format(d)+".jpg")); } //RD Transaction Creation @Test(priority=12) public void rd() { driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); // WebDriverWait wait=new WebDriverWait(driver,10); // WebElement w=wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-root/app-navigation/div/nav/ul/li[4]/a"))); // w.click(); // WebDriverWait wait1=new WebDriverWait(driver,10); // WebElement w1=wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='acc-73']/div[1]/div[1]/a"))); // w1.click(); WebDriverWait wait2=new WebDriverWait(driver,10); WebElement w2=wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='collapse74']/div/ul/li[5]/a"))); w2.click(); driver.findElement(By.xpath("//input[@formcontrolname='pRdname']")).sendKeys("Monthly Recurring Deposits"); WebDriverWait wa1=new WebDriverWait(driver,10); WebElement we1=wa1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-rdconfig-new/div[2]/div[2]/button"))); we1.click(); } @Test(priority=13) public void rdConfig() { WebElement m1=driver.findElement(By.xpath("//*[@id='pMembertypeid']/div/div/div[2]/input")); m1.click(); WebElement w3=driver.findElement(By.xpath("//*[@id='pMembertypeid']/div/div/div[2]/input")); w3.sendKeys("ELECTED REGULAR MEMBERS",Keys.ENTER); // w3.sendKeys("Non-Elected Members",Keys.ENTER); WebElement m2=driver.findElement(By.xpath("//*[@id='pApplicanttype']/div/div/div[2]/input")); m2.click(); WebElement w4=driver.findElement(By.xpath("//*[@id='pApplicanttype']/div/div/div[2]/input")); w4.sendKeys("Regular/General",Keys.ENTER); // w4.sendKeys("Senior Citizen",Keys.ENTER); driver.findElement(By.xpath("//input[@formcontrolname='pMininstalmentamount']")).sendKeys("1000"); driver.findElement(By.xpath("//input[@formcontrolname='pMaxinstalmentamount']")).sendKeys("20000"); driver.findElement(By.xpath("//*[@id='option2']")).click(); driver.findElement(By.xpath("//input[@formcontrolname='pMultiplesofamount']")).clear(); driver.findElement(By.xpath("//input[@formcontrolname='pMultiplesofamount']")).sendKeys("1000"); Select s1=new Select(driver.findElement(By.xpath("//select[@formcontrolname='pInstalmentpayin']"))); s1.selectByVisibleText("Monthly"); driver.findElement(By.xpath("//input[@formcontrolname='pfromnoofmonths']")).sendKeys("12"); driver.findElement(By.xpath("//input[@formcontrolname='ptonoofmonths']")).sendKeys("72"); driver.findElement(By.xpath("//input[@formcontrolname='pInterestratefrom']")).sendKeys("8"); driver.findElement(By.xpath("//input[@formcontrolname='pInterestrateto']")).sendKeys("11.5"); WebElement toggle1=driver.findElement(By.id("Referral-fd")); JavascriptExecutor js1=(JavascriptExecutor)driver; js1.executeScript("arguments[0].click();", toggle1); driver.findElement(By.xpath("//*[@id='rdconfig']/app-rdconfiguration/form/div[2]/div[5]/div/div/div[3]/div[1]/div/div/div[2]/div/div/div[2]/label")).click(); driver.findElement(By.xpath("//input[@formcontrolname='pCommissionValue']")).sendKeys("4"); driver.findElement(By.xpath("//*[@id='rdconfig']/app-rdconfiguration/form/div[2]/div[5]/div/div/div[3]/div[2]/div/a[2]")).click(); //Add button driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-rdconfig-new/div[2]/div[2]/button")).click(); } @Test(priority=14) public void rdPrematurity() { //Loan Facility Details WebElement toggle2=driver.findElement(By.id("loanfacty")); JavascriptExecutor js2=(JavascriptExecutor)driver; js2.executeScript("arguments[0].click();", toggle2); driver.findElement(By.xpath("//input[@formcontrolname='pEligiblepercentage']")).sendKeys("60"); driver.findElement(By.xpath("//input[@formcontrolname='pAgeperiod']")).sendKeys("3"); Select s2=new Select(driver.findElement(By.xpath("//select[@formcontrolname='pAgeperiodtype']"))); s2.selectByVisibleText("Months"); // Prematurity details WebElement toggle3=driver.findElement(By.id("lockin")); JavascriptExecutor js3=(JavascriptExecutor)driver; js3.executeScript("arguments[0].click();", toggle3); driver.findElement(By.xpath("//input[@formcontrolname='pPrematuretyageperiod']")).sendKeys("3"); Select s3=new Select(driver.findElement(By.xpath("//select[@formcontrolname='pPrematuretyageperiodtype']"))); s3.selectByVisibleText("Months"); driver.findElement(By.xpath("//input[@formcontrolname='pminprematuritypercentage']")).sendKeys("0"); driver.findElement(By.xpath("//input[@formcontrolname='pmaxprematuritypercentage']")).sendKeys("12"); Select s4=new Select(driver.findElement(By.xpath("//select[@formcontrolname='pprematurityperiodtype']"))); s4.selectByVisibleText("Months"); driver.findElement(By.xpath("//input[@formcontrolname='pPercentage']")).sendKeys("2"); driver.findElement(By.xpath("//*[@id='loanfacility']/app-rdloanandfacility/form/div[5]/div[2]/div[4]/div/a")).click(); //Late fee details WebElement toggle4=driver.findElement(By.id("latefee")); JavascriptExecutor js4=(JavascriptExecutor)driver; js4.executeScript("arguments[0].click();", toggle4); driver.findElement(By.xpath("//input[@formcontrolname='pLatefeepayblevalue']")).sendKeys("500"); driver.findElement(By.xpath("//input[@formcontrolname='pLatefeeapplicablefrom']")).sendKeys("5"); Select s5=new Select(driver.findElement(By.xpath("//select[@formcontrolname='pLatefeeapplicabletype']"))); s5.selectByVisibleText("Days"); driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-rdconfig-new/div[2]/div[2]/button")).click(); } @Test(priority=15) public void rdDocuments() throws Throwable { WebDriverWait wa2=new WebDriverWait(driver,10); WebElement we2=wa2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-rdconfig-new/div[2]/div[1]/div[4]/app-rdidentification/div[2]/div[2]/app-identification-documents/div[2]/div[2]/a/img[1]"))); we2.click(); driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-rdconfig-new/div[2]/div[1]/div[4]/app-rdidentification/div[2]/div[2]/app-identification-documents/div[2]/div[2]/div/div/div/table/tbody/tr[1]/td[1]/input")).click(); driver.findElement(By.xpath("/html/body/app-root/app-navigation/div/div[2]/div[1]/div[3]/app-rdconfig-new/div[2]/div[2]/button")).click(); //save Thread.sleep(2000); WebElement w3=driver.findElement(By.id("toast-container")); String text=w3.getText(); System.out.println(text); Date d = new Date(); System.out.println(d.toString()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); Thread.sleep(2000); File screenshotFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshotFile , new File("E:\\Eclipse\\MAC Screen Shots\\Config forms\\"+sdf.format(d)+".jpg")); } }
[ "Admin@KCS-TECH-LAXMANG" ]
Admin@KCS-TECH-LAXMANG
9e7e53034d19d1644be0fa26fd63b3158c897cdc
bfd2036ee468becaa46d0ee616936e24b12517aa
/app/src/main/java/com/example/jerryyin/jcamera2/tools/JImageSaveTool.java
dc38f7d7f7cde538b68239e3cfaafedbff1e902a
[]
no_license
Jerry-Yin/JCamera2
68baea806bb28d301fad364392ec9e4b82b624d9
373a06cda20aff1e832bde1d6e3ce1f4c6696084
refs/heads/master
2021-01-10T16:37:53.039408
2015-12-10T03:15:16
2015-12-10T03:15:16
47,666,015
0
0
null
null
null
null
UTF-8
Java
false
false
3,140
java
package com.example.jerryyin.jcamera2.tools; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Environment; import android.provider.MediaStore; import android.widget.Toast; import com.example.jerryyin.jcamera2.activity.JCameraActivity; import com.example.jerryyin.jcamera2.activity.ResultActivity; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; /** * Created by JerryYin on 12/10/15. * 存储照片或者图片的工具类 */ public class JImageSaveTool { /** * 存储到SD卡指定目录,普通方法 * @param data 照片数据 */ public static void saveImageToSd( Context context, byte[] data){ String statue = Environment.getExternalStorageState(); if (statue.equals(Environment.MEDIA_MOUNTED)) { //如果存在SdCard String imgPath = Environment.getExternalStorageDirectory() + "/Aj"; File file1 = new File(imgPath); file1.mkdir(); File file = new File(imgPath, "picture.jpeg"); FileOutputStream outputStream = null; try { outputStream = new FileOutputStream(file); outputStream.write(data); Toast.makeText(context, "存储完毕!", Toast.LENGTH_SHORT).show(); outputStream.close(); // goToShowImg(file); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } /** * 存储到指定目录,并且插入到系统的图库中 * 资料来源:http://www.stormzhang.com/android/2014/07/24/android-save-image-to-gallery/ * @param context * @param bitmap */ public static void saveImageToGallery(Context context, Bitmap bitmap){ //首先保存图片 File imgPath = new File(Environment.getExternalStorageDirectory(), "AJ"); if (! imgPath.exists()){ imgPath.mkdir(); } String fileName = System.currentTimeMillis() + ".jpg"; File file = new File(imgPath, fileName); try { FileOutputStream fileOutputStream = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream); fileOutputStream.flush(); fileOutputStream.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } //其次,再插入到系统图库 try { MediaStore.Images.Media.insertImage(context.getContentResolver(), file.getAbsolutePath(), fileName, null); } catch (FileNotFoundException e) { e.printStackTrace(); } //最后通知图库更新 context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + file.getAbsolutePath()))); } }
[ "846597629@qq.com" ]
846597629@qq.com
cd042518cceef66ecd2c4faa5d9c34a480f30da6
a8a976dffe97cc074b1be8ad54d10de361946674
/DiabetesDetection/src/MyPack/FrmDSS.java
16ebb7778be09fb591c27d8073c906da58b0ca49
[]
no_license
ingleaditi17/Hackathon-4.0
701d145963c1b4fa72ae861234a47c7b25a21338
416983378250f9b993faba463846d86568877635
refs/heads/master
2022-09-09T00:34:58.568557
2018-03-20T19:40:14
2018-03-20T19:40:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
19,099
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package MyPack; import dataPack.DataItem; import dataPack.DataSet; import dataPack.NaiveBayes; import java.awt.Dimension; import java.awt.Toolkit; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; /** * * */ public class FrmDSS extends javax.swing.JFrame { /** * Creates new form FrmDSS */ int val=0; DefaultTableModel tm; Object[] colHeader; MainForm parent; DataSet ds; NaiveBayes nb; public FrmDSS(MainForm parent) { this.parent = parent; initComponents(); Dimension sd = Toolkit.getDefaultToolkit().getScreenSize(); setLocation(sd.width / 2 - this.getWidth()/ 2, sd.height / 2 - this.getHeight()/ 2); // colHeader = new Object[]{"AGE","SEX","HBA1C","RESTING BP","PLASMA GLUCOSE","CHLORESTROL","HEMOGLOBIN","DATE","HYPERTENSION","HEREDITORI","SEIZER ATTACK","FOOT ULCERS","HEAD INJURY","BACTERIAL MENINGITIS","VIRAL DISEASE","PREDICTION","MEDICINES"}; //colHeader = new Object[]{"AGE","SEX","HBA1C","RESTING BP","PLASMA GLUCOSE","CHLORESTROL","DATE","PULSE RATE","HYPERTENSION","HEREDITORY","SEIZER ATTACK","FOOT ULCERS","HEAD INJURY","BACTERIAL MENINGITIS","VIRAL DISEASE","SEVERITY INDEX","TREATMENT"}; colHeader = new Object[]{"AGE","SEX","HBA1C","RESTING BP","PLASMA GLUCOSE","CHLORESTROL","PULSE RATE","HYPERTENSION","DATE","FOOT ULCERS","SEVERITY INDEX","TREATMENT"}; tm = new DefaultTableModel(colHeader, 0); jTable1.setModel(tm); ds = new DataSet(); ds.inputTotal = 10; ds.outputDataLength = 5; ds.inputDataLength = new int[11]; for(int i=0;i<11;i++){ ds.inputDataLength[i] = parent.attributes[i].length; } for(int i=0;i<parent.dataSet.dataSet.size();i++){ int[] ii = new int[10]; for(int j=0;j<10;j++){ ii[j] = parent.dataSet.dataSet.elementAt(i).dataItem[j]; } ds.list.add(new DataItem(ii,parent.dataSet.dataSet.elementAt(i).dataItem[10])); } nb = new NaiveBayes(ds); } /** * 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(); jPanel4 = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jLabel7 = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jButton2 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel3.setBackground(new java.awt.Color(102, 102, 102)); new JavaLib.LoadForm(); jPanel4.setBackground(new java.awt.Color(0, 0, 0)); jLabel3.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N jLabel3.setForeground(new java.awt.Color(204, 204, 204)); jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); jLabel3.setText("Mining Signatures from Event Sequences and "); jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/MyPack/heart.png"))); // NOI18N javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 774, Short.MAX_VALUE) .addContainerGap()) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel3) .addContainerGap(39, Short.MAX_VALUE)) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) ); jButton1.setBackground(new java.awt.Color(102, 102, 102)); jButton1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton1.setText("Back"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); new JavaLib.LoadForm(); jLabel7.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel7.setText("Decision Support System"); new JavaLib.LoadForm(); jTable1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String [] { "Title 1", "Title 2", "Title 3", "Title 4" } )); jScrollPane1.setViewportView(jTable1); jButton2.setBackground(new java.awt.Color(102, 102, 102)); jButton2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton2.setText("ANALYSE SINGLE ENTRY"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); new JavaLib.LoadForm(); jButton5.setBackground(new java.awt.Color(102, 102, 102)); jButton5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton5.setText("ANALYSE MULTIPLE ENTRY"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); new JavaLib.LoadForm(); jButton6.setBackground(new java.awt.Color(102, 102, 102)); jButton6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton6.setText("Data Visualization"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 90, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, 980, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 980, Short.MAX_VALUE))) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(386, 386, 386) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 228, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 376, Short.MAX_VALUE))) .addContainerGap()) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: this.setVisible(false); parent.setVisible(true); }//GEN-LAST:event_jButton1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed this.setVisible(false); val=1; new FrmLoadCSV(this, 1, parent).setVisible(true); // DlgAddEntry d = new DlgAddEntry(this, true, parent); // d.setlastOptionOff(); // d.setVisible(true); // if (!d.cancel) { // int[] iii = new int[10]; // for(int j=0;j<10;j++){ // //iii[j] = d.vals[j]; // iii[j] = d.se.dataItem[j]; // } // // int op = nb.classify(new DataItem(iii, 0) ); // // String s[] = new String[17]; //// for (int j = 0; j < 10; j++) { //// s[j] = parent.attributes[j][d.vals[j]]; //// } // s[0] = parent.attributes[0][d.se.dataItem[0]]; // s[1] = parent.attributes[1][d.se.dataItem[1]]; // s[2] = parent.attributes[2][d.se.dataItem[2]]; // s[3] = parent.attributes[3][d.se.dataItem[3]]; // s[4] = parent.attributes[4][d.se.dataItem[4]]; // s[5] = parent.attributes[5][d.se.dataItem[5]]; // s[6] = parent.attributes[6][d.se.dataItem[6]]; // s[7] = d.se.descr[7]; // s[8] = parent.attributes[7][d.se.dataItem[7]]; // s[9] = d.se.descr[9]; // s[10] = parent.attributes[8][d.se.dataItem[8]]; // s[11] = d.se.descr[11]; // s[12] = parent.attributes[9][d.se.dataItem[9]]; // s[13] = d.se.descr[14]; // s[14] = d.se.descr[15]; // // s[15] = parent.attributes[10][op]; // s[16] = parent.medicines[op]; // tm.addRow(s); // System.out.println("Probable Output: " + op); // } }//GEN-LAST:event_jButton2ActionPerformed public void StartCalculations(){ int op1=0,op2=0,op3=0,op4=0,op5=0,total=0; if(parent.compareSet.dataSet.size() > 0){ for(int i=0;i<parent.compareSet.dataSet.size();i++){ int[] iii = new int[10]; String s[] = new String[17]; for(int j=0;j<10;j++){ // if(val!=1) iii[j] = parent.compareSet.dataSet.elementAt(i).dataItem[j]; // s[j] = parent.attributes[j][parent.compareSet.dataSet.elementAt(i)[j]]; // System.out.println(parent.compareSet.dataSet.elementAt(j).descr[j]); } int op = nb.classify(new DataItem(iii, 0) ); s[0] = parent.attributes[0][parent.compareSet.dataSet.elementAt(i).dataItem[0]]; s[1] = parent.attributes[1][parent.compareSet.dataSet.elementAt(i).dataItem[1]]; // s[2] = parent.attributes[2][parent.compareSet.dataSet.elementAt(i).dataItem[2]]; s[2] =parent.compareSet.dataSet.elementAt(i).descr[2]; s[3] = parent.attributes[3][parent.compareSet.dataSet.elementAt(i).dataItem[3]]; s[4] = parent.attributes[4][parent.compareSet.dataSet.elementAt(i).dataItem[4]]; s[5] = parent.attributes[5][parent.compareSet.dataSet.elementAt(i).dataItem[5]]; // s[6] = parent.attributes[6][parent.compareSet.dataSet.elementAt(i).dataItem[6]]; s[6] = parent.compareSet.dataSet.elementAt(i).descr[4]; s[7] = parent.attributes[7][parent.compareSet.dataSet.elementAt(i).dataItem[7]]; String str=parent.dataSet.dataSet.elementAt(i).descr[6].substring(0,1); String str1=parent.dataSet.dataSet.elementAt(i).descr[6].substring(1); s[8] = str1+"-"+str+"-2014"; s[9] = parent.compareSet.dataSet.elementAt(i).descr[10]; //s[10] = parent.attributes[8][parent.compareSet.dataSet.elementAt(i).dataItem[8]]; s[10] = op+"";//parent.compareSet.dataSet.elementAt(i).descr[10]; // s[11] = parent.compareSet.dataSet.elementAt(i).descr[11]; // s[12] = parent.attributes[9][parent.compareSet.dataSet.elementAt(i).dataItem[9]]; // s[13] = parent.compareSet.dataSet.elementAt(i).descr[14]; // s[14] = parent.compareSet.dataSet.elementAt(i).descr[15]; s[11] = parent.medicines[op];;//parent.attributes[10][op]; s[12] = parent.medicines[op]; if(op==0) op1++; else if(op==1) op2++; else if(op==2) op3++; else if(op==3) op4++; else if(op==4) op5++; total++; tm.addRow(s); System.out.println("Probable Output: " + op); System.out.println("parent.medicines[op] " + parent.medicines[op]); } System.out.println("0 " + op1); System.out.println("1 " + op2); System.out.println("2 " + op3); System.out.println("3 " + op4); System.out.println("4 " + op5); System.out.println("total " + total); for(int j=0;j<10;j++){ // iii[j] = parent.compareSet.dataSet.elementAt(i).dataItem[j]; // s[j] = parent.attributes[j][parent.compareSet.dataSet.elementAt(i)[j]]; System.out.println("j==="+parent.compareSet.dataSet.elementAt(j).descr[j]); } } } private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed // TODO add your handling code here: this.setVisible(false); new FrmLoadCSV(this, 1, parent).setVisible(true); }//GEN-LAST:event_jButton5ActionPerformed private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed // TODO add your handling code here: new Graph().setVisible(true); }//GEN-LAST:event_jButton6ActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel7; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSeparator jSeparator1; private javax.swing.JTable jTable1; // End of variables declaration//GEN-END:variables }
[ "34166732+Gagnants@users.noreply.github.com" ]
34166732+Gagnants@users.noreply.github.com
f29489daeb3f9a364dc66e76b229982cce7033dc
739b3fb3403f06118a76aa083603a3cd6319985d
/src/test/java/org/fastrackit/features/search/CartWithoutLoginTest.java
16d2e44abadf83f1fbca59c1fd68722eb14d082e
[]
no_license
nataliaandreica/AcreditareNataliaAndreica
1d49657a9ffcb08766e1d2cafec02a0c2283dc5b
ee33d029619f842d32227016249a424530ef8961
refs/heads/master
2020-12-21T22:46:40.595121
2020-02-17T20:31:05
2020-02-17T20:31:05
236,590,216
1
0
null
2020-10-13T19:06:21
2020-01-27T20:42:19
Java
UTF-8
Java
false
false
859
java
package org.fastrackit.features.search; import net.serenitybdd.junit.runners.SerenityRunner; import net.thucydides.core.annotations.Managed; import net.thucydides.core.annotations.Steps; import org.fastrackit.steps.serenity.CartSteps; import org.fastrackit.steps.serenity.LoginSteps; import org.junit.Test; import org.junit.runner.RunWith; import org.openqa.selenium.WebDriver; @RunWith(SerenityRunner.class) public class CartWithoutLoginTest { @Managed(uniqueSession = true) private WebDriver driver; @Steps private LoginSteps loginSteps; @Steps private CartSteps cartSteps; @Test public void addToCartTestWithoutLogin() { loginSteps.navigateToHomepage(); cartSteps.goToAllProducts(); cartSteps.clickOnProduct(); cartSteps.addProducToCart(); cartSteps.checkAddedToCart(); } }
[ "nataliaandreica@yahoo.com" ]
nataliaandreica@yahoo.com
75bf9e1fef30998c743d6b7d15f9c45efa728b94
fe0622b62c8ff249f5c3f22109d6e89f1f30e525
/src/main/java/cn/net/colin/common/util/JsonUtils.java
3f6634ffb8d30f230c28ba78a2ec6da0f98ddb35
[]
no_license
siasColin/springboot2example
ec58876b998ec9adbeba1d211370bda352dc3f34
7127ce49411f38940748a32b2b946b01afc8e23f
refs/heads/master
2023-04-27T01:50:24.912515
2023-02-23T06:24:12
2023-02-23T06:24:12
244,126,899
4
3
null
2023-04-14T17:33:08
2020-03-01T10:14:27
Java
UTF-8
Java
false
false
2,546
java
package cn.net.colin.common.util; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.List; import java.util.Map; /** * @author: sxf * Jackson 常用方法工具类 */ public class JsonUtils { public static final ObjectMapper mapper = new ObjectMapper(); private static final Logger logger = LoggerFactory.getLogger(JsonUtils.class); public static String toString(Object obj) { if (obj == null) { return null; } if (obj.getClass() == String.class) { return (String) obj; } try { return mapper.writeValueAsString(obj); } catch (JsonProcessingException e) { logger.error("json序列化出错:" + obj, e); return null; } } public static <T> T toBean(String json, Class<T> tClass) { try { return mapper.readValue(json, tClass); } catch (IOException e) { logger.error("json解析出错:" + json, e); return null; } } public static <E> List<E> toList(String json, Class<E> eClass) { try { return mapper.readValue(json, mapper.getTypeFactory().constructCollectionType(List.class, eClass)); } catch (IOException e) { logger.error("json解析出错:" + json, e); return null; } } public static <K, V> Map<K, V> toMap(String json, Class<K> kClass, Class<V> vClass) { try { return mapper.readValue(json, mapper.getTypeFactory().constructMapType(Map.class, kClass, vClass)); } catch (IOException e) { logger.error("json解析出错:" + json, e); return null; } } public static <T> T nativeRead(String json, TypeReference<T> type) { try { return mapper.readValue(json, type); } catch (IOException e) { logger.error("json解析出错:" + json, e); return null; } } public static String jsonPretty(String jsonStr){ try{ Object obj = mapper.readValue(jsonStr, Object.class); jsonStr = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj); }catch (Exception e){ logger.error("json解析出错:" + jsonStr, e); } return jsonStr; } }
[ "1540247870@qq.com" ]
1540247870@qq.com
d096abe46d79ea402d7548ba3f0586a540a3f1c9
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.mobileqqi/classes.jar/hkc.java
1b05d3b49f4d22e11237df149a36aa95c213cbbf
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
3,142
java
import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import com.tencent.open.adapter.CommonDataAdapter; import com.tencent.open.appcenter.QZoneAppWebViewActivity; import com.tencent.open.appcommon.AppClient; import com.tencent.open.appcommon.Common; import com.tencent.open.base.FileUtils; import com.tencent.open.base.LogUtility; import com.tencent.open.downloadnew.MyAppApi; import java.io.File; import java.util.HashMap; public final class hkc implements Runnable { public hkc(Bundle paramBundle1, Bundle paramBundle2, String paramString1, String paramString2, String paramString3) {} public void run() { boolean bool; String str1; Object localObject; Intent localIntent; Bundle localBundle; if (Common.a(this.jdField_a_of_type_AndroidOsBundle.getString("schemaUrl")).get("auto_download") != null) { bool = true; if (!MyAppApi.a().a(CommonDataAdapter.a().a(), this.jdField_b_of_type_AndroidOsBundle, bool, false)) { str1 = Common.e() + File.separator + "qapp_center_detail.htm"; localObject = new File(str1); if (!((File)localObject).exists()) { LogUtility.d(AppClient.jdField_a_of_type_JavaLangString, "file" + str1 + " not exist copyassets."); FileUtils.a("Page/system", Common.f()); } localIntent = new Intent(); localBundle = new Bundle(); if (!((File)localObject).exists()) { break label380; } localObject = "file:///" + str1; label170: str1 = "&from=-10&id=" + this.jdField_a_of_type_JavaLangString + "&channelId=" + this.jdField_b_of_type_JavaLangString; if (!bool) { break label442; } str1 = str1 + "&auto_download=1"; } } label411: label442: for (;;) { String str2 = str1; if (!TextUtils.isEmpty(this.c)) { if (!this.c.equals(this.jdField_a_of_type_JavaLangString)) { break label411; } } for (str2 = str1;; str2 = str1 + "&" + this.c) { localIntent.setClass(CommonDataAdapter.a().a(), QZoneAppWebViewActivity.class); localBundle.putString("APP_URL", (String)localObject); localBundle.putBoolean("FROM_FEED", true); localBundle.putString("APP_PARAMS", str2); LogUtility.b("Jie", "APP_URL:" + (String)localObject + " | PARAMS >>> " + localBundle.getString("APP_PARAMS")); localIntent.putExtras(localBundle); localIntent.putExtra("adapter_action", "action_app_detail"); localIntent.addFlags(872415232); CommonDataAdapter.a().a().startActivity(localIntent); return; bool = false; break; label380: localObject = Common.l() + File.separator + "qapp_center_detail.htm"; break label170; } } } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mobileqqi\classes2.jar * Qualified Name: hkc * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
e9c362ef2d7c094b5f8511e9603663f20f983b32
4a2ee4ccaefbd0c1303cab2c83ceff8b6566007a
/NotepadFormat/src/JFrameText.java
7fe53cb3f33fc2ff6919854685064fa3157aa770
[]
no_license
karimohsen/Java
f310cd269490b90ca63804c1f706abee33ea2f1e
77c6e0a3e92aacfbc134e62049ce011cb3a1710d
refs/heads/master
2021-01-01T04:12:25.358468
2016-04-17T09:17:14
2016-04-17T09:17:14
56,428,309
0
0
null
null
null
null
UTF-8
Java
false
false
13,092
java
import java.awt.Color; import java.awt.Font; import java.io.File; import javax.swing.JFileChooser; import javax.swing.JOptionPane; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * JFrameText.java * * Created on Jan 6, 2015, 1:39:33 PM */ /** * * @author Karim */ public class JFrameText extends javax.swing.JFrame { public String temp = new String(); /** Creates new form JFrameText */ public JFrameText() { initComponents(); } /** 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() { jScrollPane1 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItem2 = new javax.swing.JMenuItem(); jMenuItem3 = new javax.swing.JMenuItem(); jMenuItem4 = new javax.swing.JMenuItem(); jMenuItem10 = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); jMenuItem5 = new javax.swing.JMenuItem(); jMenuItem6 = new javax.swing.JMenuItem(); jMenuItem7 = new javax.swing.JMenuItem(); jMenuItem8 = new javax.swing.JMenuItem(); jMenuItem9 = new javax.swing.JMenuItem(); jMenuItem11 = new javax.swing.JMenuItem(); jMenu3 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jTextArea1.setColumns(20); jTextArea1.setRows(5); jScrollPane1.setViewportView(jTextArea1); jMenu1.setText("File"); jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem2.setText("New"); jMenuItem2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem2ActionPerformed(evt); } }); jMenu1.add(jMenuItem2); jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem3.setText("Open"); jMenuItem3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem3ActionPerformed(evt); } }); jMenu1.add(jMenuItem3); jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem4.setText("Save"); jMenuItem4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem4ActionPerformed(evt); } }); jMenu1.add(jMenuItem4); jMenuItem10.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem10.setText("Exit"); jMenuItem10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem10ActionPerformed(evt); } }); jMenu1.add(jMenuItem10); jMenuBar1.add(jMenu1); jMenu2.setText("Edit"); jMenu2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenu2ActionPerformed(evt); } }); jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem5.setText("Copy"); jMenuItem5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem5ActionPerformed(evt); } }); jMenu2.add(jMenuItem5); jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem6.setText("Paste"); jMenuItem6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem6ActionPerformed(evt); } }); jMenu2.add(jMenuItem6); jMenuItem7.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem7.setText("Cut"); jMenuItem7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem7ActionPerformed(evt); } }); jMenu2.add(jMenuItem7); jMenuItem8.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem8.setText("SelectAll"); jMenuItem8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem8ActionPerformed(evt); } }); jMenu2.add(jMenuItem8); jMenuItem9.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DELETE, 0)); jMenuItem9.setText("Delete"); jMenuItem9.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem9ActionPerformed(evt); } }); jMenu2.add(jMenuItem9); jMenuItem11.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.ALT_MASK)); jMenuItem11.setText("Format"); jMenuItem11.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem11ActionPerformed(evt); } }); jMenu2.add(jMenuItem11); jMenuBar1.add(jMenu2); jMenu3.setText("Help"); jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem1.setText("about"); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); jMenu3.add(jMenuItem1); jMenuBar1.add(jMenu3); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed // TODO add your handling code here: jTextArea1.setText(""); }//GEN-LAST:event_jMenuItem2ActionPerformed private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed // TODO add your handling code here: JFileChooser jfile = new JFileChooser(); int choice=jfile.showOpenDialog(rootPane); if(choice==JFileChooser.APPROVE_OPTION){ File f = jfile.getSelectedFile(); jTextArea1.setText(f.toString()); } }//GEN-LAST:event_jMenuItem3ActionPerformed private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed JFileChooser jfile = new JFileChooser(); int choice=jfile.showSaveDialog(rootPane); if(choice==JFileChooser.APPROVE_OPTION){ File f = jfile.getSelectedFile(); jTextArea1.setText(f.toString()); } }//GEN-LAST:event_jMenuItem4ActionPerformed private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed jTextArea1.copy(); }//GEN-LAST:event_jMenuItem5ActionPerformed private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed jTextArea1.selectAll(); }//GEN-LAST:event_jMenuItem8ActionPerformed private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed jTextArea1.paste(); }//GEN-LAST:event_jMenuItem6ActionPerformed private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed jTextArea1.cut(); }//GEN-LAST:event_jMenuItem7ActionPerformed private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed jTextArea1.replaceSelection(""); }//GEN-LAST:event_jMenuItem9ActionPerformed private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed System.exit(0); }//GEN-LAST:event_jMenuItem10ActionPerformed private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed JOptionPane.showMessageDialog(rootPane,"Karim Abd El Mohsen"); }//GEN-LAST:event_jMenuItem1ActionPerformed private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jMenu2ActionPerformed private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed // TODO add your handling code here: java.awt.EventQueue.invokeLater(new Runnable() { public void run() { FormatDialog dialog = new FormatDialog(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); if(dialog.Apply){ Font f = new Font (dialog.textformateselected,Font.BOLD,dialog.formatesize); jTextArea1.setFont(f); if(dialog.color.equals("RED")) jTextArea1.setForeground(Color.red); else if(dialog.color.equals("YELLOW")) jTextArea1.setForeground(Color.yellow); else if(dialog.color.equals("GREEN")) jTextArea1.setForeground(Color.green); else if(dialog.color.equals("BLUE")) jTextArea1.setForeground(Color.blue); dialog.dispose(); } } }); }//GEN-LAST:event_jMenuItem11ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new JFrameText().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenu jMenu3; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jMenuItem10; private javax.swing.JMenuItem jMenuItem11; private javax.swing.JMenuItem jMenuItem2; private javax.swing.JMenuItem jMenuItem3; private javax.swing.JMenuItem jMenuItem4; private javax.swing.JMenuItem jMenuItem5; private javax.swing.JMenuItem jMenuItem6; private javax.swing.JMenuItem jMenuItem7; private javax.swing.JMenuItem jMenuItem8; private javax.swing.JMenuItem jMenuItem9; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextArea jTextArea1; // End of variables declaration//GEN-END:variables }
[ "karim.abdelmohsen.1992@gmail.com" ]
karim.abdelmohsen.1992@gmail.com
4313d1cd415e7f5d20c450a46b71fd4bc890d48c
e5fb513f3e33990d150690b93b6289c33695cd7f
/src/main/java/one/digitalinnovation/controledeponto/model/AccessLevel.java
f94c47f78e01d72b28f94a1014061fa406573552
[]
no_license
TiagoGIM/api-gerenciador-de-ponto
0e92ece4668f860c7bcd1e475ca0aad2def67878
e360b43a88c219d143545ad0bab83288f663e62b
refs/heads/main
2023-07-12T07:54:04.266663
2021-08-23T21:42:17
2021-08-23T21:42:17
399,247,774
0
0
null
null
null
null
UTF-8
Java
false
false
314
java
package one.digitalinnovation.controledeponto.model; import lombok.*; import javax.persistence.Entity; import javax.persistence.Id; @Getter @Setter @AllArgsConstructor @NoArgsConstructor @EqualsAndHashCode @Builder @Entity public class AccessLevel { @Id private Long id; private Long description; }
[ "herique.sa@gmail.com" ]
herique.sa@gmail.com
4e0f698bb2b47dd5bc3b9e2379cfb1a88c5e09cd
bbc261ef139aab100b7eb65e6862e4da44628fed
/src/main/java/com/example/demo/bootstrap/TodoLoader.java
e0af34ea42cf0ae60dc0359bf38fb8c0f3375673
[]
no_license
CutupAngel/SpringBoot
478bb23083cee948fd693a19c8ba6e28e1fa9354
94d738feec1b939e30e161ea574b3419d55b7e75
refs/heads/master
2023-06-26T09:28:16.356786
2021-07-28T10:01:33
2021-07-28T10:01:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,413
java
package com.example.demo.bootstrap; import com.example.demo.model.Todo; import com.example.demo.model.TodoStatus; import com.example.demo.repositories.TodoRepository; import lombok.SneakyThrows; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.stereotype.Component; import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.List; @Component public class TodoLoader implements CommandLineRunner { public final TodoRepository todoRepository; // @Autowired // private JavaMailSender javaMailSender; public TodoLoader(TodoRepository todoRepository) { this.todoRepository = todoRepository; } @Override public void run(String... args) { loadTodos(); } private void checkHosts() throws UnknownHostException { System.out.println("CommandLineRunner is my ip address"); StringBuilder hostName = new StringBuilder(InetAddress.getLocalHost().toString()); int index = hostName.indexOf("/"); int dotIndex = 0, dotPIndex; System.out.println(InetAddress.getLocalHost().toString()); do { dotPIndex = dotIndex; dotIndex = hostName.indexOf(".", dotPIndex+1); }while ( dotIndex != -1 ) ; String ipAddress = hostName.substring(index+1, dotPIndex); System.out.println(ipAddress + " is my ip address"); int timeout=1000; for (int i=1;i<255;i++){ String host=ipAddress + "." + i; try { if (InetAddress.getByName(host).isReachable(timeout)){ Todo todo = new Todo(host, getHostFromIp(host), TodoStatus.AVAILABLE); System.out.println(host + " is reachable"); todoRepository.save(todo); } else { Todo todo = new Todo(host, "Unnamed(due to con)", TodoStatus.UNAVAILABLE); todoRepository.save(todo); sendEmail(host); } } catch (IOException e) { e.printStackTrace(); } } } public String getHostFromIp(String ipaddr) throws UnknownHostException { InetAddress inetAddress = InetAddress.getByName(ipaddr); return inetAddress.getHostName(); } private void loadTodos() { if (todoRepository.count() == 0) { try { checkHosts(); } catch (UnknownHostException e) { e.printStackTrace(); } System.out.println("Sample Todos Loaded"); } else { List<Todo> todoList = todoRepository.findBytodoStatus(TodoStatus.UNAVAILABLE); for (Todo todo : todoList) { sendEmail(todo.getIpAddress()); } } } @SneakyThrows public void sendEmail(String msgTxt) { SimpleMailMessage msg = new SimpleMailMessage(); msg.setTo("jupiter1206jove@gmail.com", "angel126mic@gmail.com"); msg.setSubject("Testing from Spring Boot"); msg.setText(msgTxt); // javaMailSender.send(msg); } }
[ "jupiter1206jove@gmail.com" ]
jupiter1206jove@gmail.com
63aa7abe47b28e0b93e4ea090d8deb1a770a8b6d
8bcedac56f1a7b17e9a80682772d34249473a428
/src/Cadastro/EditarUsuario.java
370bd527fb6a83be2810cc97b303fe1c82662cdd
[]
no_license
betorods/SistemaBibliotecario
185cea2a7680d24f127910b05a59818c7ae91077
4315b3596d8c1609715453017890611c7dfb78c5
refs/heads/master
2021-01-13T02:03:42.493693
2015-04-08T16:57:00
2015-04-08T16:57:00
33,620,097
0
0
null
null
null
null
UTF-8
Java
false
false
35,370
java
package Cadastro; /** * * @author Alberto */ import util.Conexao; import sistemabibliotecario.BuscaUsuario; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; import net.proteanit.sql.DbUtils; import sistemabibliotecario.TelaPrincipal; public class EditarUsuario extends javax.swing.JFrame { Connection conecta; PreparedStatement pst; ResultSet rs; public EditarUsuario() throws ClassNotFoundException { initComponents(); conecta = Conexao.conexao(); } //Classes de comandos public void pesquisaUsuario(){ String sql ="Select codigo, nome,dataNasc,localNasc,cpf,rg,telFixo,telCelular,mae,pai,endereco,bairro,cep,cidade,sexo,estado from TBusuario where codigo like ?" ; try{ pst = conecta.prepareStatement(sql); pst.setString(1, id_usuario.getText()+"%");// %para quando apagar trazer de volta as informações do BD. rs = pst.executeQuery(); tabEditar.setModel(DbUtils.resultSetToTableModel(rs)); } catch(SQLException error){ JOptionPane.showMessageDialog(null, error); } } public void listarUsuario(){ String sql = "Select *from TBusuario order by codigo Asc"; // order by codigo Desc ou Asc para ordenar try{ pst = conecta.prepareStatement(sql); rs = pst.executeQuery(); tabEditar.setModel(DbUtils.resultSetToTableModel(rs)); } catch(SQLException error){ JOptionPane.showMessageDialog(null, error); } } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { nomeProfessor = new javax.swing.JLabel(); enderecoProfessor = new javax.swing.JLabel(); nome = new javax.swing.JTextField(); endereco = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); bairro = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); rg = new javax.swing.JTextField(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); mae = new javax.swing.JTextField(); jLabel17 = new javax.swing.JLabel(); pai = new javax.swing.JTextField(); jLabel18 = new javax.swing.JLabel(); localNasc = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); cidade = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); limpar = new javax.swing.JButton(); voltar = new javax.swing.JButton(); dataNasc = new javax.swing.JFormattedTextField(); cpf = new javax.swing.JFormattedTextField(); telCelular = new javax.swing.JFormattedTextField(); telFixo = new javax.swing.JFormattedTextField(); cep = new javax.swing.JFormattedTextField(); jButton2 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); tabEditar = new javax.swing.JTable(); jLabel12 = new javax.swing.JLabel(); id_usuario = new javax.swing.JTextField(); deletarUsuario = new javax.swing.JButton(); Sexo = new javax.swing.JTextField(); estado = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBounds(new java.awt.Rectangle(350, 25, 0, 0)); setResizable(false); nomeProfessor.setText("Nome:"); enderecoProfessor.setText("Endereço"); nome.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { nomeActionPerformed(evt); } }); endereco.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { enderecoActionPerformed(evt); } }); jLabel1.setText("Estado"); jLabel2.setText("Sexo"); jLabel3.setText("Data de Nascimento"); jLabel4.setText("Bairro"); bairro.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bairroActionPerformed(evt); } }); jLabel6.setText("CEP"); jLabel7.setText("Tel. Fixo:"); jLabel8.setText("Tel. Celular:"); jLabel9.setText("CPF:"); jLabel10.setText("RG:"); jLabel11.setText("Cidade:"); jLabel16.setText("Nome da Mãe:"); jLabel17.setText("Nome do Pai:"); jLabel18.setText("Local de Nascimento:"); localNasc.setMinimumSize(new java.awt.Dimension(5, 20)); localNasc.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { localNascActionPerformed(evt); } }); jLabel5.setFont(new java.awt.Font("Times New Roman", 0, 24)); // NOI18N jLabel5.setText("Editar Usuário"); jButton1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alberto\\Documents\\NetBeansProjects\\Projetos\\icones\\icons\\disk.png")); // NOI18N jButton1.setText("Editar"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); limpar.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alberto\\Documents\\NetBeansProjects\\Projetos\\icones\\icons\\paintbrush.png")); // NOI18N limpar.setText("Limpar"); limpar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { limparActionPerformed(evt); } }); voltar.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alberto\\Documents\\NetBeansProjects\\Projetos\\icones\\icons\\door_out.png")); // NOI18N voltar.setText("Voltar"); voltar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { voltarActionPerformed(evt); } }); try { dataNasc.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####"))); } catch (java.text.ParseException ex) { ex.printStackTrace(); } dataNasc.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { dataNascActionPerformed(evt); } }); try { cpf.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#########-##"))); } catch (java.text.ParseException ex) { ex.printStackTrace(); } try { telCelular.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##)####-####"))); } catch (java.text.ParseException ex) { ex.printStackTrace(); } try { telFixo.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##)####-####"))); } catch (java.text.ParseException ex) { ex.printStackTrace(); } telFixo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { telFixoActionPerformed(evt); } }); try { cep.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#####-###"))); } catch (java.text.ParseException ex) { ex.printStackTrace(); } cep.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cepActionPerformed(evt); } }); jButton2.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alberto\\Documents\\NetBeansProjects\\Projetos\\icones\\icons\\cancel.png")); // NOI18N jButton2.setText("Cancelar"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); tabEditar.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); tabEditar.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { tabEditarMouseClicked(evt); } }); jScrollPane1.setViewportView(tabEditar); jLabel12.setText("Codigo:"); id_usuario.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { id_usuarioKeyReleased(evt); } }); deletarUsuario.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alberto\\Documents\\NetBeansProjects\\Projetos\\icones\\icons\\delete.png")); // NOI18N deletarUsuario.setText("Deletar"); deletarUsuario.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deletarUsuarioActionPerformed(evt); } }); Sexo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { SexoActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(25, 25, 25) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(2, 2, 2) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel16) .addComponent(mae, javax.swing.GroupLayout.PREFERRED_SIZE, 443, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel17) .addGroup(layout.createSequentialGroup() .addComponent(jLabel9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cpf, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(11, 11, 11) .addComponent(jLabel10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(rg, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(telCelular, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(telFixo, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(nome, javax.swing.GroupLayout.PREFERRED_SIZE, 437, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(nomeProfessor) .addGroup(layout.createSequentialGroup() .addComponent(jLabel12) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(id_usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 549, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pai, javax.swing.GroupLayout.PREFERRED_SIZE, 443, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3) .addComponent(dataNasc, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(Sexo, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel18) .addComponent(localNasc, javax.swing.GroupLayout.PREFERRED_SIZE, 252, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGap(0, 0, Short.MAX_VALUE))) .addGap(25, 25, 25)) .addGroup(layout.createSequentialGroup() .addComponent(jButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(deletarUsuario) .addGap(28, 28, 28) .addComponent(voltar) .addGap(29, 29, 29) .addComponent(limpar) .addGap(33, 33, 33) .addComponent(jButton2) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(cidade, javax.swing.GroupLayout.PREFERRED_SIZE, 446, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4) .addComponent(bairro, javax.swing.GroupLayout.PREFERRED_SIZE, 446, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(endereco, javax.swing.GroupLayout.PREFERRED_SIZE, 446, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(enderecoProfessor) .addComponent(jLabel11)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(estado, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGap(52, 52, 52)) .addGroup(layout.createSequentialGroup() .addComponent(cep) .addGap(25, 25, 25)))))) .addGroup(layout.createSequentialGroup() .addGap(217, 217, 217) .addComponent(jLabel5) .addGap(0, 0, Short.MAX_VALUE)) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {telCelular, telFixo}); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel12) .addComponent(id_usuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(nomeProfessor) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(nome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jLabel2) .addComponent(jLabel18)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(dataNasc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(localNasc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(Sexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cpf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(rg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9) .addComponent(jLabel10) .addComponent(telCelular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(telFixo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7) .addComponent(jLabel8)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel16) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(mae, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel17) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(pai, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(enderecoProfessor) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(endereco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(jLabel6)) .addGap(7, 7, 7) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(bairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel11) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(estado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(voltar) .addComponent(limpar) .addComponent(jButton2) .addComponent(deletarUsuario)) .addGap(20, 20, 20)) ); pack(); }// </editor-fold>//GEN-END:initComponents public void EditarUsuario2(){ String sql = " Update TBusuario set nome = ?,dataNasc = ?,localNasc = ?,cpf = ?,rg = ?,telFixo = ?,telCelular = ?,mae = ?,pai= ?,endereco = ?,bairro = ?,cep = ?,cidade = ?,sexo = ?,estado = ? WHERE codigo = ?"; try{ pst = conecta.prepareStatement(sql); pst.setString(1, nome.getText()); pst.setString(2, dataNasc.getText()); pst.setString(3, localNasc.getText()); pst.setString(4, cpf.getText()); pst.setString(5, rg.getText()); pst.setString(6, telFixo.getText()); pst.setString(7, telCelular.getText()); pst.setString(8, mae.getText()); pst.setString(9, pai.getText()); pst.setString(10, endereco.getText()); pst.setString(11, bairro.getText()); pst.setString(12, cep.getText()); pst.setString(13, cidade.getText()); pst.setString(14, Sexo.getText()); pst.setString(15, estado.getText()); pst.setInt(16,Integer.parseInt(id_usuario.getText())); pst.execute(); listarUsuario(); JOptionPane.showMessageDialog(null, "Atualizado com sucesso","Atualização!", JOptionPane.INFORMATION_MESSAGE); limpar(); } catch(SQLException error){ JOptionPane.showMessageDialog(null, error); } } public void mostraItens(){ int seleciona = tabEditar.getSelectedRow(); nome.setText(tabEditar.getModel().getValueAt(seleciona,1).toString()); dataNasc.setText(tabEditar.getModel().getValueAt(seleciona,2).toString()); localNasc.setText(tabEditar.getModel().getValueAt(seleciona,3).toString()); cpf.setText(tabEditar.getModel().getValueAt(seleciona,4).toString()); rg.setText(tabEditar.getModel().getValueAt(seleciona,5).toString()); telFixo.setText(tabEditar.getModel().getValueAt(seleciona,6).toString()); telCelular.setText(tabEditar.getModel().getValueAt(seleciona,7).toString()); mae.setText(tabEditar.getModel().getValueAt(seleciona,8).toString()); pai.setText(tabEditar.getModel().getValueAt(seleciona,9).toString()); endereco.setText(tabEditar.getModel().getValueAt(seleciona,10).toString()); bairro.setText(tabEditar.getModel().getValueAt(seleciona,11).toString()); cep.setText(tabEditar.getModel().getValueAt(seleciona,12).toString()); cidade.setText(tabEditar.getModel().getValueAt(seleciona,13).toString()); Sexo.setText(tabEditar.getModel().getValueAt(seleciona,14).toString()); estado.setText(tabEditar.getModel().getValueAt(seleciona,15).toString()); /* pst.setString(14, Sex); pst.setString(15, estados.getSelectedItem().toString());*/ } public void deletarUsuario(){ String sql = "Delete from tbusuario where codigo = ?"; try{ pst = conecta.prepareStatement(sql); pst.setInt(1,Integer.parseInt(id_usuario.getText())); pst.execute(); JOptionPane.showMessageDialog(null,"Usuario deletado com sucesso."); listarUsuario(); } catch(SQLException error){ JOptionPane.showMessageDialog(null, error); } } public void limpar(){ nome.setText(""); dataNasc.setText(""); localNasc.setText(""); cpf.setText(""); rg.setText(""); telCelular.setText(""); telFixo.setText(""); mae.setText(""); pai.setText(""); endereco.setText(""); bairro.setText(""); cep.setText(""); cidade.setText(""); } private void nomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nomeActionPerformed // TODO add your handling code here: }//GEN-LAST:event_nomeActionPerformed private void enderecoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enderecoActionPerformed // TODO add your handling code here: }//GEN-LAST:event_enderecoActionPerformed private void bairroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bairroActionPerformed // TODO add your handling code here: }//GEN-LAST:event_bairroActionPerformed private void localNascActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_localNascActionPerformed // TODO add your handling code here: }//GEN-LAST:event_localNascActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed EditarUsuario2(); }//GEN-LAST:event_jButton1ActionPerformed private void limparActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_limparActionPerformed limpar(); }//GEN-LAST:event_limparActionPerformed private void voltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_voltarActionPerformed new sistemabibliotecario.TelaPrincipal().show(); this.setVisible(false); }//GEN-LAST:event_voltarActionPerformed private void dataNascActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataNascActionPerformed // TODO add your handling code here: }//GEN-LAST:event_dataNascActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed System.exit(0); }//GEN-LAST:event_jButton2ActionPerformed private void telFixoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_telFixoActionPerformed // TODO add your handling code here: }//GEN-LAST:event_telFixoActionPerformed private void id_usuarioKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_id_usuarioKeyReleased pesquisaUsuario(); }//GEN-LAST:event_id_usuarioKeyReleased private void tabEditarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabEditarMouseClicked mostraItens(); }//GEN-LAST:event_tabEditarMouseClicked private void cepActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cepActionPerformed // TODO add your handling code here: }//GEN-LAST:event_cepActionPerformed private void deletarUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deletarUsuarioActionPerformed deletarUsuario(); }//GEN-LAST:event_deletarUsuarioActionPerformed private void SexoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SexoActionPerformed // TODO add your handling code here: }//GEN-LAST:event_SexoActionPerformed /** * @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(EditarUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(EditarUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(EditarUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(EditarUsuario.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() { try { new EditarUsuario().setVisible(true); } catch (ClassNotFoundException ex) { Logger.getLogger(EditarUsuario.class.getName()).log(Level.SEVERE, null, ex); } } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField Sexo; private javax.swing.JTextField bairro; private javax.swing.JFormattedTextField cep; private javax.swing.JTextField cidade; private javax.swing.JFormattedTextField cpf; private javax.swing.JFormattedTextField dataNasc; private javax.swing.JButton deletarUsuario; private javax.swing.JTextField endereco; private javax.swing.JLabel enderecoProfessor; private javax.swing.JTextField estado; private javax.swing.JTextField id_usuario; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JButton limpar; private javax.swing.JTextField localNasc; private javax.swing.JTextField mae; private javax.swing.JTextField nome; private javax.swing.JLabel nomeProfessor; private javax.swing.JTextField pai; private javax.swing.JTextField rg; private javax.swing.JTable tabEditar; private javax.swing.JFormattedTextField telCelular; private javax.swing.JFormattedTextField telFixo; private javax.swing.JButton voltar; // End of variables declaration//GEN-END:variables // private String Sex; }
[ "beto.rod@hotmail.com" ]
beto.rod@hotmail.com
0cac6f6a34aa3f551b9845d547818b5484d0308e
6ce955abfc4fa4b9cb36f6c72d607bd1dcd18cf3
/master/verso/verso/src/verso/reverse/enums/Modifiers.java
a62b6beadc95925c88a3be044e59a0327fb67124
[]
no_license
Eldodo/VERSO
193ef4795f2fc9d1242caba0bd22552cabb70014
a1a2199d9f06d866268cc12ce04ac22d56b6e633
refs/heads/master
2021-09-14T06:30:25.883867
2019-06-11T03:10:51
2019-06-11T03:10:51
190,816,795
0
0
null
2021-08-02T17:02:55
2019-06-07T22:18:09
HTML
UTF-8
Java
false
false
1,607
java
package verso.reverse.enums; import java.util.EnumSet; import com.github.javaparser.ast.Modifier; /** * Defines all the possible modifiers and their symbols to be used * in the grammar * @author rishi * */ public class Modifiers { /*PRIVATE(2, "-"), PRIVATE_STATIC(10, "- {static}"), PRIVATE_FINAL_STATIC(26, ""), PROTECTED(4, "#"), PROTECTED_STATIC(12, "{static}"), PROTECTED_ABSTRACT(1028, "# {abstract}"), PROTECTED_FINAL_STATIC(28, ""), PUBLIC(1, "+"), PUBLIC_STATIC(9, "+ {static}"), PUBLIC_ABSTRACT(1025, "+ {abstract}"), PUBLIC_FINAL_STATIC(25, ""), PACKAGE(0, "~"), PACKAGE_STATIC(8, "~ {static}"), PACKAGE_ABSTRACT(1024, "~ {abstract}"), PACKAGE_FINAL_STATIC(24, "");*/ public int modifier; public String symbol; /** * Initializes the modifiers with number and symobol for it * @param modifier * @param symbol */ private Modifiers(int modifier, String symbol) { this.modifier = modifier; this.symbol = symbol; } /** * Returns value for modifier * @param modifier2 * @return */ public static String valueOf(EnumSet<Modifier> modifier){ String s = ""; for(Modifier mod : modifier) { //System.out.println(mod.asString()); switch(mod.asString()) { case "final": return ""; case "private": s+="-"; break; case "protected": s+="#"; break; case "public": s+="+"; break; } } for(Modifier mod : modifier) { switch(mod.asString()) { case "static": s+=" {static}"; break; case "abstract": s+=" {abstract}"; break; } } return s; } }
[ "dorian.vandamme@laposte.net" ]
dorian.vandamme@laposte.net
1275883ff1c254034cde57c480210001c992ff7b
c081ea7651b0aabd2b1d966fc6f5bf8201972f43
/spring-restconsumer-samples/server-example/src/main/java/io/eyolas/example/server/domain/stadium/StadiumRepository.java
dbd0a1688f2675785666024f7244478910d234ee
[]
no_license
eyolas/spring-rest-consumer
ee7c8ac0710a2344a65024a6d9f05eeee046d4ba
86b4ba5c014e06529fe8c20cc434d30f7b3824f1
refs/heads/master
2020-05-31T04:33:26.636984
2014-10-07T11:46:55
2014-10-07T11:46:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
613
java
package io.eyolas.example.server.domain.stadium; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RepositoryRestResource; import io.eyolas.example.server.domain.city.City; /** * * @author eyolas */ @RepositoryRestResource(collectionResourceRel = "stadiums", path = "stadiums") public interface StadiumRepository extends JpaRepository<Stadium, Long>{ List<Stadium> findByNameContainingIgnoreCaseAndCity(@Param("name") String name, @Param("city") City city); }
[ "dtouzet@gmail.com" ]
dtouzet@gmail.com
ac25af340bf7fc97179a5d7dfaa16673d07852b6
b676e77226b357ff97138fb81b36abea9d8deb97
/app/src/main/java/pawan/t4a/com/onlinetracing/Activity/OTP_Screen.java
7bfbeffd9c87baa7eb11a3b611f5889c61eb9bc8
[]
no_license
veerpawan/FindMe_Talent4assure
f3bde60f0781cad90b7832244ca4c44333c06990
741fcb508843a32c921d4ee6fefbab5e8e886376
refs/heads/master
2021-01-19T09:12:19.387820
2017-02-15T15:24:16
2017-02-15T15:24:16
82,074,872
0
0
null
null
null
null
UTF-8
Java
false
false
10,621
java
package pawan.t4a.com.onlinetracing.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.os.Bundle; import android.support.design.widget.Snackbar; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import java.util.List; import java.util.concurrent.TimeUnit; import okhttp3.OkHttpClient; import pawan.t4a.com.onlinetracing.Interface.RequestInterface; import pawan.t4a.com.onlinetracing.Models.UserSuccessBean; import pawan.t4a.com.onlinetracing.Models.getOtpBean; import pawan.t4a.com.onlinetracing.R; import pawan.t4a.com.onlinetracing.constant.URL_Mapping; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; public class OTP_Screen extends AppCompatActivity { String user_otp, user_fname, user_mname, user_lname, str_email, str_mobile, str_password, str_dob, serialnumber, operatorname, imeinumber; Button btn_reg; EditText et_otp; String otp_message; List<UserSuccessBean> userSuccessBeen; ProgressDialog pDialog; String user_id, user_name; SharedPreferences sharedPreferences; @Override public void onBackPressed() { //super.onBackPressed(); Intent i = new Intent(getApplicationContext(), RegisterActivity.class); startActivity(i); finish(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.generate_otp_screen); et_otp = (EditText) findViewById(R.id.otp_message); btn_reg = (Button) findViewById(R.id.btn_reg); pDialog = new ProgressDialog(OTP_Screen.this); pDialog.setMessage("Loading....Please Wait"); pDialog.setIndeterminate(false); pDialog.setCancelable(false); pDialog.hide(); Intent intent = getIntent(); user_otp = intent.getStringExtra("user_otp"); //Log.e("inside_otpscreen", user_otp); user_fname = intent.getStringExtra("user_fname"); //Log.e("inside_otpscreen", user_fname); user_mname = intent.getStringExtra("user_mname"); //Log.e("inside_otpscreen", user_mname); user_lname = intent.getStringExtra("user_lname"); //Log.e("inside_otpscreen", user_lname); str_email = intent.getStringExtra("user_email"); //Log.e("inside_otpscreen", str_email); str_mobile = intent.getStringExtra("user_mobile"); //Log.e("inside_otpscreen", str_mobile); str_password = intent.getStringExtra("user_password"); //Log.e("inside_otpscreen", str_password); str_dob = intent.getStringExtra("user_dob"); serialnumber = intent.getStringExtra("user_serialnumber"); //Log.e("inside_otpscreen", serialnumber); operatorname = intent.getStringExtra("user_operatorname"); //Log.e("inside_otpscreen", operatorname); imeinumber = intent.getStringExtra("user_imeinumber"); //Log.e("inside_otpscreen", imeinumber); btn_reg.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { otp_message = et_otp.getText().toString(); //pDialog.show(); if (otp_message.isEmpty()) { pDialog.hide(); snackbartext("Fields Cannot be Empty"); } else if (otp_message.equals(user_otp)) { register_user(); } else { pDialog.hide(); snackbartext("Please Enter Correct OTP"); } } }); } public void register_user() { OkHttpClient okHttpClient = new OkHttpClient.Builder() .readTimeout(150, TimeUnit.SECONDS) .connectTimeout(90, TimeUnit.SECONDS) .build(); Retrofit retrofit = new Retrofit.Builder() .baseUrl(URL_Mapping.userpath) .addConverterFactory(GsonConverterFactory.create()) .client(okHttpClient) .build(); RequestInterface service1 = retrofit.create(RequestInterface.class); Call<List<UserSuccessBean>> call1 = service1.reg_user( user_fname, user_mname, user_lname, str_email, str_mobile, str_password, str_dob, serialnumber, operatorname, imeinumber); call1.enqueue(new Callback<List<UserSuccessBean>>() { @Override public void onResponse(Call<List<UserSuccessBean>> call, Response<List<UserSuccessBean>> response) { userSuccessBeen = response.body(); pDialog.hide(); int success_msg = userSuccessBeen.get(0).getSuccess(); if (userSuccessBeen.isEmpty()) { snackbartext("Something went wrong"); } else if (success_msg == 1) { et_otp.setText(""); user_id = userSuccessBeen.get(0).getUser_id(); user_name = userSuccessBeen.get(0).getUser_name(); sharedPreferences = getSharedPreferences("MyPrefs", 0); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString("userID", user_id); editor.putString("username", user_name); //editor.apply(); editor.commit(); snackbartext("Successfully Registered"); Intent i = new Intent(getApplicationContext(), FindLocation.class); startActivity(i); finish(); } else if (success_msg == 0) { snackbartext("Something went wrong"); /* startActivity(new Intent(getApplicationContext(), OTP_Screen.class)); getIntent().putExtra("user_otp", user_otp);*/ //getIntent().putExtra("user_name_intent", user_name); /* AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this); builder.setCancelable(false); builder.setTitle("Please Enter otp"); // Set up the input final EditText input = new EditText(RegisterActivity.this); // Specify the type of input expected; this, for example, sets the input as a password, and will mask the text input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); builder.setView(input); // Set up the buttons builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { m_Text = input.getText().toString(); if (m_Text.equals(user_otp)) { sharedPreferences = getSharedPreferences("MyPrefs", 0); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString("userID", user_id); editor.putString("username", user_name); //editor.apply(); editor.commit(); snackbartext("Successfully Registered"); Intent serviceIntent = new Intent(RegisterActivity.this, MyService.class); startService(serviceIntent); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.show(); */ //Toast.makeText(getApplicationContext(), "Thanx", Toast.LENGTH_LONG).show(); /* Intent i = new Intent(getApplicationContext(), FindLocation.class); startActivity(i); finish();*/ //startActivity(new Intent(getApplicationContext(), LoginActivity.class)); //getIntent().putExtra("user_id_intent", user_id); //getIntent().putExtra("user_name_intent", user_name); } else { Snackbar snackbar = Snackbar.make(findViewById(android.R.id.content), "Something went wrong", Snackbar.LENGTH_LONG); View sbView = snackbar.getView(); TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); sbView.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.colorredprimary)); textView.setTextColor(Color.WHITE); snackbar.show(); } } @Override public void onFailure(Call<List<UserSuccessBean>> call, Throwable t) { Log.e("problemm", t.toString()); } }); } public void snackbartext(String message) { Snackbar snackbar = Snackbar.make(findViewById(android.R.id.content), message, Snackbar.LENGTH_LONG); View sbView = snackbar.getView(); TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); sbView.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.colorredprimary)); textView.setTextColor(Color.YELLOW); snackbar.show(); } }
[ "veerpawan888@gmail.com" ]
veerpawan888@gmail.com
d6ea8757e1fa2c56cfcf003fd8b6bc38bed24e1f
5a2c1f3c548590eb473ca81f5ca5ec582df746b5
/xspectra.cloudminder.listofservices/src/xspectra/getlist/serviceimpl/CloudMinderTaskServiceImpl.java
21fcafc6a048232e541df5758b741629c9b132f1
[]
no_license
anvitabajpai/example.osgi.project
0f526fa88c69c38640a1c6c0956c238893677e0e
af9f3385461ddad9cb43aefd0db482eec9357cbd
refs/heads/master
2016-08-03T20:20:24.982265
2014-04-04T06:22:23
2014-04-04T06:22:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,334
java
package xspectra.getlist.serviceimpl; import xspectra.getlist.service.CloudMinderTaskService; public class CloudMinderTaskServiceImpl implements CloudMinderTaskService{ @Override public String getTaskList() { String jsonString ="[{\"Name\":\"Box\","+ "\"URL\":\"http://cloudminder.mycroftcloud.com/chs/login/alexg001/Box/\","+ "\"Image URL\":\"https://cloudminder.mycroftcloud.com/iam/im/alexg001/binaryattribute/?contentType=image&attribute=image&objectType=DIGITAL%20MANAGED%20OBJECT&uniqueValue=93f244a2_9b0d5750_76719bad_ceae31&uniqueAttr=tag&alternate=/ui/images/default.gif\"},"+ "{\"Name\":\"Test Application 2\","+ "\"URL\":\"http://cloudminder.mycroftcloud.com/chs/login/alexg001/Test Application 2/\","+ "\"Image URL\":\"https://cloudminder.mycroftcloud.com/iam/im/alexg001/binaryattribute/?contentType=image&attribute=image&objectType=DIGITAL%20MANAGED%20OBJECT&uniqueValue=207d19ac_fe8a9db8_e3493240_a3a2ac&uniqueAttr=tag&alternate=/ui/images/default.gif\"},"+ "{\"Name\":\"Request access to services\","+ "\"URL\":\"https://cloudminder.mycroftcloud.com/iam/im/alexg001/ui7/index.jsp??facesViewId=/app/page/relationship/relationship.jsp\","+ "\"Image URL\":\"https://cloudminder.mycroftcloud.com/iam/im/ui/services/my_services.gif\"}]"; return jsonString; } }
[ "anvita.bajpai2@gmail.com" ]
anvita.bajpai2@gmail.com
eaa382605bcc86c617df37cb212f384251614bd7
f09e2543e000d310d0f906cb324786316e4de954
/src/main/java/com/greenfoxacademy/zelenamackatribes/users/services/AvatarServiceImpl.java
8a1252cb075a77af4d1b28480ae5439477db5f06
[]
no_license
Radek2rady/Tribes-Zelena-Macka-BE
27a3c8a20ed2ab7e292093fca37fe3c04f0a8abd
964f6ceee510f27affff45932f3c33d55dc66702
refs/heads/master
2023-08-16T20:39:09.174107
2021-09-24T07:09:15
2021-09-24T07:09:15
409,866,288
1
0
null
null
null
null
UTF-8
Java
false
false
5,163
java
package com.greenfoxacademy.zelenamackatribes.users.services; import com.greenfoxacademy.zelenamackatribes.users.exceptions.AvatarUploadException; import com.greenfoxacademy.zelenamackatribes.users.exceptions.avatarUploadException.AvatarUploadFilesizeException; import com.greenfoxacademy.zelenamackatribes.users.exceptions.avatarUploadException.AvatarUploadFiletypeException; import com.greenfoxacademy.zelenamackatribes.users.exceptions.avatarUploadException.AvatarUploadReadWriteException; import com.greenfoxacademy.zelenamackatribes.users.models.UserEntity; import com.greenfoxacademy.zelenamackatribes.users.repositories.UserRepository; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; import java.util.Arrays; import java.util.List; import javax.imageio.ImageIO; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.imgscalr.Scalr; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @Service public class AvatarServiceImpl implements AvatarService { private static final String AVATARS_DIR = "resources/static/avatars/"; private static final List<String> ALLOWED_TYPES = Arrays.asList("image/png", "image/jpeg", "image/gif"); private static final int AVATAR_SIZE = 256; private static final long MAX_FILE_SIZE = 5242880; private static final Logger logger = LogManager.getLogger(AvatarServiceImpl.class); private UserRepository userRepository; @Autowired public AvatarServiceImpl(UserRepository userRepository) throws AvatarUploadException { this.userRepository = userRepository; init(); } @Override public void upload(MultipartFile multipartFile, long userId) throws AvatarUploadException { String incomingFileName = multipartFile.getOriginalFilename(); String incomingFileExtension = incomingFileName .substring(incomingFileName.lastIndexOf(".")).toLowerCase(); String savedFileName = userId + "-original" + incomingFileExtension; validate(multipartFile); saveOriginal(multipartFile, savedFileName); createResizedJpeg(savedFileName, userId + "-avatar"); assignToUser(userId); } private void init() throws AvatarUploadException { Path uploadFolder = Paths.get(AVATARS_DIR); if (!Files.exists(uploadFolder)) { try { Files.createDirectories(uploadFolder); logger.info("AvatarService: created " + AVATARS_DIR + " folder"); } catch (IOException e) { throw new AvatarUploadReadWriteException("Cannot create folder for storing avatars"); } } } private void validate(MultipartFile multipartFile) throws AvatarUploadException { if (multipartFile.getSize() > MAX_FILE_SIZE) { throw new AvatarUploadFilesizeException("Maximum file size limit exceeded (5MB)"); } if (!ALLOWED_TYPES.contains(multipartFile.getContentType())) { throw new AvatarUploadFiletypeException("Given file is not JPEG, GIF or PNG image."); } BufferedImage bi; try { bi = ImageIO.read(multipartFile.getInputStream()); bi.flush(); } catch (IOException | NullPointerException e) { throw new AvatarUploadFiletypeException("Image file corrupted or not supported."); } } private void saveOriginal(MultipartFile multipartFile, String fileName) throws AvatarUploadException { try (InputStream originalFileInputStream = multipartFile.getInputStream()) { Path originalFilePath = Paths.get(AVATARS_DIR).resolve(fileName); Files.copy(originalFileInputStream, originalFilePath, StandardCopyOption.REPLACE_EXISTING); } catch (IOException ioe) { throw new AvatarUploadReadWriteException("Could not save image file: " + fileName); } } private void createResizedJpeg(String originalFileName, String newFileName) throws AvatarUploadException { Path originalFilePath = Paths.get(AVATARS_DIR).resolve(originalFileName); File sourceFile = new File(originalFilePath.toString()); BufferedImage bufferedImage = null; try { bufferedImage = ImageIO.read(sourceFile); } catch (IOException e) { throw new AvatarUploadReadWriteException("Could not load original image file: " + originalFilePath); } BufferedImage outputImage = Scalr.resize(bufferedImage, AVATAR_SIZE); Path newFilePath = Paths.get(AVATARS_DIR).resolve(newFileName + ".jpg"); File newImageFile = newFilePath.toFile(); try { ImageIO.write(outputImage, "jpg", newImageFile); } catch (IOException e) { throw new AvatarUploadReadWriteException("Could not create resized avatar version: " + newFilePath); } outputImage.flush(); } private void assignToUser(long userId) { UserEntity user = userRepository.getOne(userId); user.setAvatar(Paths.get(AVATARS_DIR).resolve(userId + "-avatar.jpg").toString()); userRepository.save(user); } }
[ "73898733+Radek2rady@users.noreply.github.com" ]
73898733+Radek2rady@users.noreply.github.com
00f965f42819f21fa54fca67dc3939904744d37b
10b4020af07853f901593f0671dcecb22e02c71a
/tools/src/androidTest/java/com/dixon/tools/ExampleInstrumentedTest.java
abdc7fd5e3d7ea88d4f18e0daebaa7caaf30fcb3
[]
no_license
zhxyComing/PhoneShare
c961c810670bc472340bab01d1fd156b74429dfa
889209bae43b87df3f584da468ba1919c7c42af6
refs/heads/master
2020-09-30T13:53:56.463345
2020-01-22T03:40:54
2020-01-22T03:40:54
227,300,987
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package com.dixon.tools; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.dixon.tools.test", appContext.getPackageName()); } }
[ "dixon@bogon.luojilab.intra" ]
dixon@bogon.luojilab.intra
1d1da16de54dd951aa3da83f82c953c01d46e6a4
bfb98eb10af5cdbac314261baed408f2225c3748
/shardingsphere-prop/src/main/java/com/gupaovip/shardingsphere/shardingsphereprop/mapper/TConfigMapper.java
121b9127ae5b41dad575eb1f8f8694c9ca2ca614
[]
no_license
Clierbin/shardingsphere-spring
c2d17ee52a5ea450d9b3dbc4a30a384184361e8d
c186a65d7d1b1509859de493f059e79b11339cf6
refs/heads/master
2023-06-23T07:36:35.629537
2022-06-17T07:40:04
2022-06-17T07:40:04
221,165,951
0
0
null
2022-06-21T02:13:24
2019-11-12T08:20:38
Java
UTF-8
Java
false
false
949
java
package com.gupaovip.shardingsphere.shardingsphereprop.mapper; import com.gupaovip.shardingsphere.shardingsphereprop.entity.TConfigDO; import org.apache.ibatis.annotations.Mapper; @Mapper public interface TConfigMapper { /** * * @mbg.generated Tue Nov 12 15:15:10 CST 2019 */ int deleteByPrimaryKey(Integer configId); /** * * @mbg.generated Tue Nov 12 15:15:10 CST 2019 */ int insert(TConfigDO record); /** * * @mbg.generated Tue Nov 12 15:15:10 CST 2019 */ int insertSelective(TConfigDO record); /** * * @mbg.generated Tue Nov 12 15:15:10 CST 2019 */ TConfigDO selectByPrimaryKey(Integer configId); /** * * @mbg.generated Tue Nov 12 15:15:10 CST 2019 */ int updateByPrimaryKeySelective(TConfigDO record); /** * * @mbg.generated Tue Nov 12 15:15:10 CST 2019 */ int updateByPrimaryKey(TConfigDO record); }
[ "q243132465@163.com" ]
q243132465@163.com
134df80a55f14ab4107eadea35ab2d181c4f915d
4e39eeaf01fd0c233d1d19b442a70dc15e188eeb
/src/main/java/org/usfirst/frc/team4488/robot/sensors/ShockSonic.java
89d84aa1a5bd76d970876148f1cfd5bbe8495b2b
[ "MIT" ]
permissive
shockwave4488/FRC-2019-Public
02ac173bfc6aebb6024471e4aae2ee6cb8bb3756
174ac97c000d915ed96ec839efb480c0ab1f11e0
refs/heads/master
2020-09-25T13:37:31.221450
2019-12-05T04:32:00
2019-12-05T04:32:00
226,014,810
0
0
MIT
2019-12-05T04:37:32
2019-12-05T04:18:41
Java
UTF-8
Java
false
false
739
java
package org.usfirst.frc.team4488.robot.sensors; import edu.wpi.first.wpilibj.AnalogInput; public class ShockSonic { private double currentDistance; private AnalogInput US0; private double VOLTS_TO_MILLIVOLTS = 1000.0; private double MILLIVOLTS_PER_INCH = 9.8; public ShockSonic(int channel) { US0 = new AnalogInput(channel); } public double getDistance() { currentDistance = (US0.getVoltage() * VOLTS_TO_MILLIVOLTS) / MILLIVOLTS_PER_INCH; // Numbers that were used last year to convert getVoltage and etc. to inches. // 9.8mV per inch return currentDistance; } public boolean withinProximity(double distance) { if (getDistance() < distance) { return true; } return false; } }
[ "tyjwaldo@gmail.com" ]
tyjwaldo@gmail.com
086a6b96755e704f5a3f35186c5c3dcd103c76f0
eb5c234e008f4b8e51937fe2c724f1b31de80f54
/comm/src/main/java/com/yundian/comm/adapter/base/IListAdapter.java
cbfd43ff150fcd0e4fbd91e26ae6420c9a02a29e
[ "Apache-2.0" ]
permissive
yaobanglin/blackad
15174d9da38c5ec302fa83962dec4e4750ab7fc8
ad4f59f1e97cc4299f4a237d0aad410cdb750a77
refs/heads/master
2021-01-25T04:48:19.095711
2017-07-10T03:40:30
2017-07-10T03:40:30
93,988,041
1
0
null
2017-06-11T07:13:11
2017-06-11T07:13:11
null
UTF-8
Java
false
false
354
java
package com.yundian.comm.adapter.base; import java.util.List; /** * Created by yaowang on 16/3/31. */ public interface IListAdapter<T> { void setList(List<T> list); void addData(T t); void addList(List<T> list); void remove(int index); void remove(T t); void clear(); void notifyDataSetChanged(); List<T> getList(); }
[ "wuchuang@ywwl.com" ]
wuchuang@ywwl.com
5555727b6c276dec5717a4bd81f9b7b16d6e017a
341ef8277356f165b4f5d022958f4b5b914eb0e0
/src/java/nxt/http/GetSubscriptionsToAccount.java
5951ecdc19df7ba6a3492424aa124e2b86af1313
[ "MIT" ]
permissive
michaelmattig/burstcoin
75dd6c9ea55a71e21ddd7f105ed0fd9439069cdd
1b52cdbc71072bc39bed2ad6e97d1884edca1570
refs/heads/master
2021-01-15T19:52:22.903691
2017-08-14T19:32:14
2017-08-14T19:32:14
99,830,791
0
0
null
2017-08-14T19:23:31
2017-08-09T16:38:43
Java
UTF-8
Java
false
false
1,082
java
package nxt.http; import nxt.Account; import nxt.NxtException; import nxt.Subscription; import nxt.db.DbIterator; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONStreamAware; import javax.servlet.http.HttpServletRequest; public final class GetSubscriptionsToAccount extends APIServlet.APIRequestHandler { static final GetSubscriptionsToAccount instance = new GetSubscriptionsToAccount(); private GetSubscriptionsToAccount() { super(new APITag[] {APITag.ACCOUNTS}, "account"); } @Override JSONStreamAware processRequest(HttpServletRequest req) throws NxtException { Account account = ParameterParser.getAccount(req); JSONObject response = new JSONObject(); JSONArray subscriptions = new JSONArray(); DbIterator<Subscription> accountSubscriptions = Subscription.getSubscriptionsToId(account.getId()); for(Subscription subscription : accountSubscriptions) { subscriptions.add(JSONData.subscription(subscription)); } response.put("subscriptions", subscriptions); return response; } }
[ "burstcoin@hushmail.com" ]
burstcoin@hushmail.com
0410a6e08cceb43136078642c156b2edc44cee9e
dbe4cba7e2bfa23b9d8fdcc58f3d6c0c53d72b8b
/Nikhil/SqEx.java
9f78b37766c63591b2aa6d1b312f66105f8fd946
[]
no_license
kumarisk/java_programs
0f176dac135db2b2c34ff118cafffef188fd0448
f6070166b2100e01358aadfe2a81772febed5002
refs/heads/master
2022-11-22T18:00:45.017367
2020-07-19T16:52:05
2020-07-19T16:52:05
280,909,327
0
0
null
null
null
null
UTF-8
Java
false
false
353
java
class Square { public void sq(int a) { System.out.print("\nSquare="+(a*a)); } public void sq(float a) { System.out.print("\nSquare="+(a*a)); } public void sq(double a) { System.out.print("\nSquare="+(a*a)); } } class SqEx { public static void main(String args[]) { Square s1=new Square(); s1.sq(10); s1.sq(12.5); s1.sq(10); } }
[ "0abcdef098@gmail.com" ]
0abcdef098@gmail.com
690210a12b1bfd96cb16439cd67c39fb50dada58
881b71676b944c2083fd9852d83e278bdd9f6d86
/approvaltests-util/src/test/java/com/spun/util/io/tests/XMLUtilsTest.java
13e0af2b15c588b8142ab43ab64fa36ced290145
[ "Apache-2.0" ]
permissive
sjturley/ApprovalTests.Java
b137020a7c417c7064760864dbdf58728543b63a
b3f792043d69dbdea2a1c379cf501d309f084ab2
refs/heads/master
2022-10-09T22:47:46.619213
2020-06-09T18:49:20
2020-06-09T18:49:20
267,700,183
0
0
Apache-2.0
2020-05-28T21:26:47
2020-05-28T21:26:46
null
UTF-8
Java
false
false
1,655
java
package com.spun.util.io.tests; import org.w3c.dom.Document; import com.spun.util.io.XMLUtils; import com.spun.util.io.xml.XmlExtractorUtil; import junit.framework.TestCase; public class XMLUtilsTest extends TestCase { public void testXML() throws Exception { // String xml = "<?xml version=\"1.0\" ?><QBXML><QBXMLMsgsRs><ItemQueryRs requestID=\"2\" statusCode=\"0\" statusSeverity=\"Info\" statusMessage=\"Status OK\">1</ItemQueryRs></QBXMLMsgsRs></QBXML>"; String xml = "<?xml version=\"1.0\" ?>\n" + "<QBXML>\n" + "<QBXMLMsgsRs>\n" + "<HostQueryRs statusCode=\"0\" statusSeverity=\"Info\" statusMessage=\"Status OK\">\n" + "<HostRet>\n" + "<ProductName>superpro</ProductName>\n" + "<MajorVersion>16</MajorVersion>\n" + "<MinorVersion>0</MinorVersion>\n" + "<SupportedQBXMLVersion>1.0</SupportedQBXMLVersion>\n" + "<SupportedQBXMLVersion>1.1</SupportedQBXMLVersion>\n" + "<SupportedQBXMLVersion>2.0</SupportedQBXMLVersion>\n" + "<SupportedQBXMLVersion>2.1</SupportedQBXMLVersion>\n" + "<SupportedQBXMLVersion>3.0</SupportedQBXMLVersion>\n" + "<SupportedQBXMLVersion>4.0</SupportedQBXMLVersion>\n" + "<SupportedQBXMLVersion>4.1</SupportedQBXMLVersion>\n" + "<SupportedQBXMLVersion>5.0</SupportedQBXMLVersion>\n" + "</HostRet>\n" + "</HostQueryRs>\n" + "</QBXMLMsgsRs>\n" + "</QBXML>\n" + ""; Document document = XMLUtils.parseXML(xml); assertEquals(true, document.hasChildNodes()); // assertNotNull(XmlExtractorUtil.traverseToTag("ItemQueryRs", document)); assertNotNull(XmlExtractorUtil.traverseToTag("HostRet", document)); } }
[ "isidore@setgame.com" ]
isidore@setgame.com
e5d472c50e815698ad4a62ece2acd5602af53b2e
d4896a7eb2ee39cca5734585a28ca79bd6cc78da
/sources/com/google/android/material/circularreveal/CircularRevealFrameLayout.java
789d2f630cce9c19cef8407ef945a4c8f7ac0230
[]
no_license
zadweb/zadedu.apk
a235ad005829e6e34ac525cbb3aeca3164cf88be
8f89db0590333929897217631b162e39cb2fe51d
refs/heads/master
2023-08-13T03:03:37.015952
2021-10-12T21:22:59
2021-10-12T21:22:59
416,498,604
0
0
null
null
null
null
UTF-8
Java
false
false
2,723
java
package com.google.android.material.circularreveal; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.widget.FrameLayout; import com.google.android.material.circularreveal.CircularRevealWidget; public class CircularRevealFrameLayout extends FrameLayout implements CircularRevealWidget { private final CircularRevealHelper helper; @Override // com.google.android.material.circularreveal.CircularRevealWidget public void buildCircularRevealCache() { this.helper.buildCircularRevealCache(); } @Override // com.google.android.material.circularreveal.CircularRevealWidget public void destroyCircularRevealCache() { this.helper.destroyCircularRevealCache(); } @Override // com.google.android.material.circularreveal.CircularRevealWidget public CircularRevealWidget.RevealInfo getRevealInfo() { return this.helper.getRevealInfo(); } @Override // com.google.android.material.circularreveal.CircularRevealWidget public void setRevealInfo(CircularRevealWidget.RevealInfo revealInfo) { this.helper.setRevealInfo(revealInfo); } @Override // com.google.android.material.circularreveal.CircularRevealWidget public int getCircularRevealScrimColor() { return this.helper.getCircularRevealScrimColor(); } @Override // com.google.android.material.circularreveal.CircularRevealWidget public void setCircularRevealScrimColor(int i) { this.helper.setCircularRevealScrimColor(i); } public Drawable getCircularRevealOverlayDrawable() { return this.helper.getCircularRevealOverlayDrawable(); } @Override // com.google.android.material.circularreveal.CircularRevealWidget public void setCircularRevealOverlayDrawable(Drawable drawable) { this.helper.setCircularRevealOverlayDrawable(drawable); } public void draw(Canvas canvas) { CircularRevealHelper circularRevealHelper = this.helper; if (circularRevealHelper != null) { circularRevealHelper.draw(canvas); } else { super.draw(canvas); } } @Override // com.google.android.material.circularreveal.CircularRevealHelper.Delegate public void actualDraw(Canvas canvas) { super.draw(canvas); } public boolean isOpaque() { CircularRevealHelper circularRevealHelper = this.helper; if (circularRevealHelper != null) { return circularRevealHelper.isOpaque(); } return super.isOpaque(); } @Override // com.google.android.material.circularreveal.CircularRevealHelper.Delegate public boolean actualIsOpaque() { return super.isOpaque(); } }
[ "midoekid@gmail.com" ]
midoekid@gmail.com
645402f6830b32b6fd82531f9190c875bfe67da7
3ad507d286158cdbbd2170130552e5a3c0415d1c
/stockPartOne/src/com/example/stockpartone/MainFragment.java
a38d52cb697646800494a6c6daa07b459873fd5c
[]
no_license
jijunjun1112/hw9
61ecc0d819a8841f8a15dd24ff039255cbbc5fff
2db044e9ca088b8ec36e8a7b481b4eecd01b7392
refs/heads/master
2020-04-05T08:02:11.040509
2014-04-22T05:54:49
2014-04-22T05:54:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,338
java
package com.example.stockpartone; import java.util.Arrays; import java.util.Collection; import java.util.List; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.Toast; import com.facebook.FacebookException; import com.facebook.FacebookOperationCanceledException; import com.facebook.FacebookRequestError; import com.facebook.HttpMethod; import com.facebook.Request; import com.facebook.RequestAsyncTask; import com.facebook.Response; import com.facebook.Session; import com.facebook.Session.OpenRequest; import com.facebook.Session.StatusCallback; import com.facebook.SessionState; import com.facebook.UiLifecycleHelper; import com.facebook.widget.FacebookDialog; import com.facebook.widget.LoginButton; import com.facebook.widget.WebDialog; import com.facebook.widget.WebDialog.OnCompleteListener; public class MainFragment extends Fragment { private static final String TAG = "MainFragment"; private UiLifecycleHelper uiHelper; private Button shareButton; private static final List<String> PERMISSIONS = Arrays.asList("publish_actions"); private static final String PENDING_PUBLISH_KEY = "pendingPublishReauthorization"; private boolean pendingPublishReauthorization = false; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); uiHelper = new UiLifecycleHelper(getActivity(), callback); uiHelper.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view=inflater.inflate(R.layout.activity_main, container, false); LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton); authButton.setFragment(this); authButton.setReadPermissions(Arrays.asList("basic_info")); // shareButton=(Button) view.findViewById(R.id.shareButton); // shareButton.setOnClickListener(new View.OnClickListener() { // // @Override // public void onClick(View v) { // Intent intent = new Intent(getActivity(), LoginUsingActivityActivity.class); // startActivity(intent); // } // }); if (savedInstanceState != null) { pendingPublishReauthorization = savedInstanceState.getBoolean(PENDING_PUBLISH_KEY, false); } return view; } private void onSessionStateChange(Session session, SessionState state, Exception exception) { if (state.isOpened()) { shareButton.setVisibility(View.VISIBLE); publishFeedDialog(); Log.i(TAG,"sessionstatechange"); if(pendingPublishReauthorization==true){ Log.i(TAG,"pendingPublishReauthorization:true"); }else{ Log.i(TAG,"pendingPublishReauthorization:false"); } if(state.equals(SessionState.OPENED_TOKEN_UPDATED)){ Log.i(TAG,"SessionState.OPENED_TOKEN_UPDATED:true"); }else{ Log.i(TAG,"SessionState.OPENED_TOKEN_UPDATED:false"); } if (pendingPublishReauthorization && state.equals(SessionState.OPENED_TOKEN_UPDATED)) { pendingPublishReauthorization = false; //publishStory(); publishFeedDialog(); } System.out.println("log in"); Log.i(TAG, "Logged in..."); } else if (state.isClosed()) { shareButton.setVisibility(View.INVISIBLE); System.out.println("log out"); Log.i(TAG, "Logged out..."); } } private boolean isSubsetOf(Collection<String> subset, Collection<String> superset) { for (String string : subset) { if (!superset.contains(string)) { return false; } } return true; } private void publishFeedDialog() { Bundle params = new Bundle(); params.putString("name", "Facebook SDK for Android"); params.putString("caption", "Build great social apps and get more installs."); params.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps."); params.putString("link", "https://developers.facebook.com/android"); params.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png"); WebDialog feedDialog = ( new WebDialog.FeedDialogBuilder(getActivity(), Session.getActiveSession(), params)) .setOnCompleteListener(new OnCompleteListener() { @Override public void onComplete(Bundle values, FacebookException error) { if (error == null) { // When the story is posted, echo the success // and the post Id. final String postId = values.getString("post_id"); if (postId != null) { Toast.makeText(getActivity(), "Posted story, id: "+postId, Toast.LENGTH_SHORT).show(); } else { // User clicked the Cancel button Toast.makeText(getActivity().getApplicationContext(), "Publish cancelled", Toast.LENGTH_SHORT).show(); } } else if (error instanceof FacebookOperationCanceledException) { // User clicked the "x" button Toast.makeText(getActivity().getApplicationContext(), "Publish cancelled", Toast.LENGTH_SHORT).show(); } else { // Generic, ex: network error Toast.makeText(getActivity().getApplicationContext(), "Error posting story", Toast.LENGTH_SHORT).show(); } } }) .build(); feedDialog.show(); } private void publishStory() { Session session = Session.getActiveSession(); if (session != null){ // Check for publish permissions List<String> permissions = session.getPermissions(); if (!isSubsetOf(PERMISSIONS, permissions)) { pendingPublishReauthorization = true; Session.NewPermissionsRequest newPermissionsRequest = new Session .NewPermissionsRequest(this, PERMISSIONS); session.requestNewPublishPermissions(newPermissionsRequest); return; } Bundle postParams = new Bundle(); postParams.putString("name", "Facebook SDK for Android"); postParams.putString("caption", "Build great social apps and get more installs."); postParams.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps."); postParams.putString("link", "https://developers.facebook.com/android"); postParams.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png"); Request.Callback callback= new Request.Callback() { public void onCompleted(Response response) { JSONObject graphResponse = response .getGraphObject() .getInnerJSONObject(); String postId = null; try { postId = graphResponse.getString("id"); } catch (JSONException e) { Log.i(TAG, "JSON error "+ e.getMessage()); } FacebookRequestError error = response.getError(); if (error != null) { Toast.makeText(getActivity() .getApplicationContext(), error.getErrorMessage(), Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getActivity() .getApplicationContext(), postId, Toast.LENGTH_LONG).show(); } } }; Request request = new Request(session, "me/feed", postParams, HttpMethod.POST, callback); RequestAsyncTask task = new RequestAsyncTask(request); task.execute(); } } private Session.StatusCallback callback = new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { onSessionStateChange(session, state, exception); } }; @Override public void onResume() { super.onResume(); Session session = Session.getActiveSession(); if (session != null && (session.isOpened() || session.isClosed()) ) { onSessionStateChange(session, session.getState(), null); } uiHelper.onResume(); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); uiHelper.onActivityResult(requestCode, resultCode, data, new FacebookDialog.Callback() { @Override public void onError(FacebookDialog.PendingCall pendingCall, Exception error, Bundle data) { Log.e("Activity", String.format("Error: %s", error.toString())); } @Override public void onComplete(FacebookDialog.PendingCall pendingCall, Bundle data) { Log.i("Activity", "Success!"); } }); } @Override public void onPause() { super.onPause(); uiHelper.onPause(); } @Override public void onDestroy() { super.onDestroy(); uiHelper.onDestroy(); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(PENDING_PUBLISH_KEY, pendingPublishReauthorization); uiHelper.onSaveInstanceState(outState); } }
[ "jijunjun1112@126.com" ]
jijunjun1112@126.com
811210423beb939bfacdd7b7d659e47a2d0c61eb
f459c0db2a3249e8ab23ae6bb5e6d6090faa1edd
/whizu-jquery-ui/src/main/java/org/whizu/jquery/ui/Slider.java
bf2d9587284bd05476c0fefbfb20e99f6f50e767
[]
no_license
KwintenP/whizu.java
4d22edef2e407ae5a43cf777d33e9ee867fc5845
426441c9e35f8883cf9cc63326fa21a2fda27b26
refs/heads/master
2020-05-29T11:05:40.754207
2013-08-26T19:50:12
2013-08-26T19:50:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,292
java
/******************************************************************************* * Copyright (c) 2013 Rudy D'hauwe @ Whizu * Licensed under the EUPL V.1.1 * * This Software is provided to You under the terms of the European * Union Public License (the "EUPL") version 1.1 as published by the * European Union. Any use of this Software, other than as authorized * under this License is strictly prohibited (to the extent such use * is covered by a right of the copyright holder of this Software). * * This Software is provided under the License on an "AS IS" basis and * without warranties of any kind concerning the Software, including * without limitation merchantability, fitness for a particular purpose, * absence of defects or errors, accuracy, and non-infringement of * intellectual property rights other than copyright. This disclaimer * of warranty is an essential part of the License and a condition for * the grant of any rights to this Software. * * For more details, see <http://joinup.ec.europa.eu/software/page/eupl>. * * Contributors: * 2013 - Rudy D'hauwe @ Whizu - initial API and implementation *******************************************************************************/ package org.whizu.jquery.ui; public class Slider { }
[ "rdhauwe@whizu.org" ]
rdhauwe@whizu.org
1fdddeffb5d3c50e058e94dadef62984421d3c85
61433695648bb9d920d5df1f56d4a3afd28549c1
/src/main/java/com/doit/wheels/dao/repositories/CountryRepository.java
ab10a9c6242bca126b464a460c741ee944b7ebc3
[]
no_license
martinprause/wheels-mobile
701ffbd189df888fec8e13d5d36672b52f52c4b2
06c6973cd91ccd915c849ca8cf7f0db8d2bb9a3e
refs/heads/master
2021-09-03T19:29:02.090543
2018-01-11T12:30:40
2018-01-11T12:30:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
163
java
package com.doit.wheels.dao.repositories; import com.doit.wheels.dao.entities.Country; public interface CountryRepository extends GenericRepository<Country>{ }
[ "denis.gorbach@do-it.co" ]
denis.gorbach@do-it.co
aad5bcfb7fdaffaf46bc2aa6f5cb7a5d9301fe72
cba8b1747a5efaddbb2341045a422f795c843b59
/src/main/java/by/bsuir/movierating/exception/UserInputException.java
706e6dff92204de9b7b821c9726e9d7d618e9405
[]
no_license
Queliath/MovieRating
ab9c4d8470574fe5f0126d1a2d5c6e6fd8fa84f2
569fa1aadc43917b4a08949720bb42b56734ba79
refs/heads/master
2020-05-21T22:33:49.434264
2017-02-01T13:00:02
2017-02-01T13:00:02
63,341,599
3
1
null
2019-03-21T10:03:06
2016-07-14T14:04:23
Java
UTF-8
Java
false
false
283
java
package by.bsuir.movierating.exception; public class UserInputException extends RuntimeException { public UserInputException(String message) { super(message); } public UserInputException(String message, Throwable cause) { super(message, cause); } }
[ "uladzislau_kastsevich@epam.com" ]
uladzislau_kastsevich@epam.com
333a79db4cee97b8a2ebc7bf648743c2bfa9662e
adfa622c9000a0007f98c737dee445983bb29e13
/app/src/main/java/com/zhbf/zdd/common/untils/SystemBarTintManager.java
165dc371cd2ac2f9497a6f4a2c0882774e8abe9b
[]
no_license
d9823/MVPForKotlin
ecb5d2748d3da9e380256659c79e3430cc7083a4
e7316cabc69296cb952fb2ed0493954a7f711e41
refs/heads/master
2020-03-23T21:41:32.053908
2018-07-24T08:51:36
2018-07-24T08:51:36
142,125,692
0
0
null
null
null
null
UTF-8
Java
false
false
19,355
java
package com.zhbf.zdd.common.untils; import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.os.Build; import android.util.DisplayMetrics; import android.util.TypedValue; import android.view.Gravity; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.FrameLayout.LayoutParams; import java.lang.reflect.Method; /** * Created by Administrator on 2015/11/18. */ public class SystemBarTintManager { static { // Android allows a system property to override the presence of the navigation bar. // Used by the emulator. // See https://github.com/android/platform_frameworks_base/blob/master/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java#L1076 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { try { Class c = Class.forName("android.os.SystemProperties"); Method m = c.getDeclaredMethod("get", String.class); m.setAccessible(true); sNavBarOverride = (String) m.invoke(null, "qemu.hw.mainkeys"); } catch (Throwable e) { sNavBarOverride = null; } } } /** * The default system bar tint color value. */ public static final int DEFAULT_TINT_COLOR = 0x99000000; private static String sNavBarOverride; private final SystemBarConfig mConfig; private boolean mStatusBarAvailable; private boolean mNavBarAvailable; private boolean mStatusBarTintEnabled; private boolean mNavBarTintEnabled; private View mStatusBarTintView; private View mNavBarTintView; /** * Constructor. Call this in the host activity onCreate method after its * content view has been set. You should always create new instances when * the host activity is recreated. * * @param activity The host activity. */ @SuppressWarnings("ResourceType") @TargetApi(19) public SystemBarTintManager(Activity activity) { Window win = activity.getWindow(); ViewGroup decorViewGroup = (ViewGroup) win.getDecorView(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { // check theme attrs int[] attrs = {android.R.attr.windowTranslucentStatus, android.R.attr.windowTranslucentNavigation}; TypedArray a = activity.obtainStyledAttributes(attrs); try { mStatusBarAvailable = a.getBoolean(0, false); mNavBarAvailable = a.getBoolean(1, false); } finally { a.recycle(); } // check window flags WindowManager.LayoutParams winParams = win.getAttributes(); int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; if ((winParams.flags & bits) != 0) { mStatusBarAvailable = true; } bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION; if ((winParams.flags & bits) != 0) { mNavBarAvailable = true; } } mConfig = new SystemBarConfig(activity, mStatusBarAvailable, mNavBarAvailable); // device might not have virtual navigation keys if (!mConfig.hasNavigtionBar()) { mNavBarAvailable = false; } if (mStatusBarAvailable) { setupStatusBarView(activity, decorViewGroup); } if (mNavBarAvailable) { setupNavBarView(activity, decorViewGroup); } } /** * Enable tinting of the system status bar. * * If the platform is running Jelly Bean or earlier, or translucent system * UI modes have not been enabled in either the theme or via window flags, * then this method does nothing. * * @param enabled True to enable tinting, false to disable it (default). */ public void setStatusBarTintEnabled(boolean enabled) { mStatusBarTintEnabled = enabled; if (mStatusBarAvailable) { mStatusBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE); } } /** * Enable tinting of the system navigation bar. * * If the platform does not have soft navigation keys, is running Jelly Bean * or earlier, or translucent system UI modes have not been enabled in either * the theme or via window flags, then this method does nothing. * * @param enabled True to enable tinting, false to disable it (default). */ public void setNavigationBarTintEnabled(boolean enabled) { mNavBarTintEnabled = enabled; if (mNavBarAvailable) { mNavBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE); } } /** * Apply the specified color tint to all system UI bars. * * @param color The color of the background tint. */ public void setTintColor(int color) { setStatusBarTintColor(color); setNavigationBarTintColor(color); } /** * Apply the specified drawable or color resource to all system UI bars. * * @param res The identifier of the resource. */ public void setTintResource(int res) { setStatusBarTintResource(res); setNavigationBarTintResource(res); } /** * Apply the specified drawable to all system UI bars. * * @param drawable The drawable to use as the background, or null to remove it. */ public void setTintDrawable(Drawable drawable) { setStatusBarTintDrawable(drawable); setNavigationBarTintDrawable(drawable); } /** * Apply the specified alpha to all system UI bars. * * @param alpha The alpha to use */ public void setTintAlpha(float alpha) { setStatusBarAlpha(alpha); setNavigationBarAlpha(alpha); } /** * Apply the specified color tint to the system status bar. * * @param color The color of the background tint. */ public void setStatusBarTintColor(int color) { if (mStatusBarAvailable) { mStatusBarTintView.setBackgroundColor(color); } } /** * Apply the specified drawable or color resource to the system status bar. * * @param res The identifier of the resource. */ public void setStatusBarTintResource(int res) { if (mStatusBarAvailable) { mStatusBarTintView.setBackgroundResource(res); } } /** * Apply the specified drawable to the system status bar. * * @param drawable The drawable to use as the background, or null to remove it. */ @SuppressWarnings("deprecation") public void setStatusBarTintDrawable(Drawable drawable) { if (mStatusBarAvailable) { mStatusBarTintView.setBackgroundDrawable(drawable); } } /** * Apply the specified alpha to the system status bar. * * @param alpha The alpha to use */ @TargetApi(11) public void setStatusBarAlpha(float alpha) { if (mStatusBarAvailable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mStatusBarTintView.setAlpha(alpha); } } /** * Apply the specified color tint to the system navigation bar. * * @param color The color of the background tint. */ public void setNavigationBarTintColor(int color) { if (mNavBarAvailable) { mNavBarTintView.setBackgroundColor(color); } } /** * Apply the specified drawable or color resource to the system navigation bar. * * @param res The identifier of the resource. */ public void setNavigationBarTintResource(int res) { if (mNavBarAvailable) { mNavBarTintView.setBackgroundResource(res); } } /** * Apply the specified drawable to the system navigation bar. * * @param drawable The drawable to use as the background, or null to remove it. */ @SuppressWarnings("deprecation") public void setNavigationBarTintDrawable(Drawable drawable) { if (mNavBarAvailable) { mNavBarTintView.setBackgroundDrawable(drawable); } } /** * Apply the specified alpha to the system navigation bar. * * @param alpha The alpha to use */ @TargetApi(11) public void setNavigationBarAlpha(float alpha) { if (mNavBarAvailable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mNavBarTintView.setAlpha(alpha); } } /** * Get the system bar configuration. * * @return The system bar configuration for the current device configuration. */ public SystemBarConfig getConfig() { return mConfig; } /** * Is tinting enabled for the system status bar? * * @return True if enabled, False otherwise. */ public boolean isStatusBarTintEnabled() { return mStatusBarTintEnabled; } /** * Is tinting enabled for the system navigation bar? * * @return True if enabled, False otherwise. */ public boolean isNavBarTintEnabled() { return mNavBarTintEnabled; } private void setupStatusBarView(Context context, ViewGroup decorViewGroup) { mStatusBarTintView = new View(context); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getStatusBarHeight()); params.gravity = Gravity.TOP; if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) { params.rightMargin = mConfig.getNavigationBarWidth(); } mStatusBarTintView.setLayoutParams(params); mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR); mStatusBarTintView.setVisibility(View.GONE); decorViewGroup.addView(mStatusBarTintView); } private void setupNavBarView(Context context, ViewGroup decorViewGroup) { mNavBarTintView = new View(context); LayoutParams params; if (mConfig.isNavigationAtBottom()) { params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getNavigationBarHeight()); params.gravity = Gravity.BOTTOM; } else { params = new LayoutParams(mConfig.getNavigationBarWidth(), LayoutParams.MATCH_PARENT); params.gravity = Gravity.RIGHT; } mNavBarTintView.setLayoutParams(params); mNavBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR); mNavBarTintView.setVisibility(View.GONE); decorViewGroup.addView(mNavBarTintView); } /** * Class which describes system bar sizing and other characteristics for the current * device configuration. * */ public static class SystemBarConfig { private static final String STATUS_BAR_HEIGHT_RES_NAME = "status_bar_height"; private static final String NAV_BAR_HEIGHT_RES_NAME = "navigation_bar_height"; private static final String NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME = "navigation_bar_height_landscape"; private static final String NAV_BAR_WIDTH_RES_NAME = "navigation_bar_width"; private static final String SHOW_NAV_BAR_RES_NAME = "config_showNavigationBar"; private final boolean mTranslucentStatusBar; private final boolean mTranslucentNavBar; private final int mStatusBarHeight; private final int mActionBarHeight; private final boolean mHasNavigationBar; private final int mNavigationBarHeight; private final int mNavigationBarWidth; private final boolean mInPortrait; private final float mSmallestWidthDp; private SystemBarConfig(Activity activity, boolean translucentStatusBar, boolean traslucentNavBar) { Resources res = activity.getResources(); mInPortrait = (res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT); mSmallestWidthDp = getSmallestWidthDp(activity); mStatusBarHeight = getInternalDimensionSize(res, STATUS_BAR_HEIGHT_RES_NAME); mActionBarHeight = getActionBarHeight(activity); mNavigationBarHeight = getNavigationBarHeight(activity); mNavigationBarWidth = getNavigationBarWidth(activity); mHasNavigationBar = (mNavigationBarHeight > 0); mTranslucentStatusBar = translucentStatusBar; mTranslucentNavBar = traslucentNavBar; } @TargetApi(14) private int getActionBarHeight(Context context) { int result = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { TypedValue tv = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true); result = TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics()); } return result; } @TargetApi(14) private int getNavigationBarHeight(Context context) { Resources res = context.getResources(); int result = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { if (hasNavBar(context)) { String key; if (mInPortrait) { key = NAV_BAR_HEIGHT_RES_NAME; } else { key = NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME; } return getInternalDimensionSize(res, key); } } return result; } @TargetApi(14) private int getNavigationBarWidth(Context context) { Resources res = context.getResources(); int result = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { if (hasNavBar(context)) { return getInternalDimensionSize(res, NAV_BAR_WIDTH_RES_NAME); } } return result; } @TargetApi(14) private boolean hasNavBar(Context context) { Resources res = context.getResources(); int resourceId = res.getIdentifier(SHOW_NAV_BAR_RES_NAME, "bool", "android"); if (resourceId != 0) { boolean hasNav = res.getBoolean(resourceId); // check override flag (see static block) if ("1".equals(sNavBarOverride)) { hasNav = false; } else if ("0".equals(sNavBarOverride)) { hasNav = true; } return hasNav; } else { // fallback return !ViewConfiguration.get(context).hasPermanentMenuKey(); } } private int getInternalDimensionSize(Resources res, String key) { int result = 0; int resourceId = res.getIdentifier(key, "dimen", "android"); if (resourceId > 0) { result = res.getDimensionPixelSize(resourceId); } return result; } @SuppressLint("NewApi") private float getSmallestWidthDp(Activity activity) { DisplayMetrics metrics = new DisplayMetrics(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { activity.getWindowManager().getDefaultDisplay().getRealMetrics(metrics); } else { // TODO this is not correct, but we don't really care pre-kitkat activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); } float widthDp = metrics.widthPixels / metrics.density; float heightDp = metrics.heightPixels / metrics.density; return Math.min(widthDp, heightDp); } /** * Should a navigation bar appear at the bottom of the screen in the current * device configuration? A navigation bar may appear on the right side of * the screen in certain configurations. * * @return True if navigation should appear at the bottom of the screen, False otherwise. */ public boolean isNavigationAtBottom() { return (mSmallestWidthDp >= 600 || mInPortrait); } /** * Get the height of the system status bar. * * @return The height of the status bar (in pixels). */ public int getStatusBarHeight() { return mStatusBarHeight; } /** * Get the height of the action bar. * * @return The height of the action bar (in pixels). */ public int getActionBarHeight() { return mActionBarHeight; } /** * Does this device have a system navigation bar? * * @return True if this device uses soft key navigation, False otherwise. */ public boolean hasNavigtionBar() { return mHasNavigationBar; } /** * Get the height of the system navigation bar. * * @return The height of the navigation bar (in pixels). If the device does not have * soft navigation keys, this will always return 0. */ public int getNavigationBarHeight() { return mNavigationBarHeight; } /** * Get the width of the system navigation bar when it is placed vertically on the screen. * * @return The nbsp;width of the navigation bar (in pixels). If the device does not have * soft navigation keys, this will always return 0. */ public int getNavigationBarWidth() { return mNavigationBarWidth; } /** * Get the layout inset for any system UI that appears at the top of the screen. * * @param withActionBar True to include the height of the action bar, False otherwise. * @return The layout inset (in pixels). */ public int getPixelInsetTop(boolean withActionBar) { return (mTranslucentStatusBar ? mStatusBarHeight : 0) + (withActionBar ? mActionBarHeight : 0); } /** * Get the layout inset for any system UI that appears at the bottom of the screen. * * @return The layout inset (in pixels). */ public int getPixelInsetBottom() { if (mTranslucentNavBar && isNavigationAtBottom()) { return mNavigationBarHeight; } else { return 0; } } /** * Get the layout inset for any system UI that appears at the right of the screen. * * @return The layout inset (in pixels). */ public int getPixelInsetRight() { if (mTranslucentNavBar && !isNavigationAtBottom()) { return mNavigationBarWidth; } else { return 0; } } } }
[ "feiyu9823@gmail.com" ]
feiyu9823@gmail.com
fd04948e4313c1a29ee3bd9b2bce8f15e9c62aff
83bfc74c8d1e34f3c808622bb092a807cae187d5
/GT-RarasNet/shared/src/main/java/com/rarasnet/rnp/shared/profissionais/profile/ProfissionaisModel.java
3089c0b693c3266043e7ed4b61aa1b7624e6188f
[ "Unlicense" ]
permissive
monsores/rarasapp
d7539be6f73e9b3f959fecebb36169974bcbe828
17537396ae81899e0d611b44cbb0e848963fcf39
refs/heads/master
2021-06-16T15:59:23.613976
2017-01-11T17:34:07
2017-01-11T17:34:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,211
java
package com.rarasnet.rnp.shared.profissionais.profile; import java.util.ArrayList; /** * Created by Farina on 22/10/2015. */ public class ProfissionaisModel { private AssociatesListHeaderModel associatesListHeaderModel; private ArrayList<AssociatesListItemModel> associatesListItemModel; public ProfissionaisModel(AssociatesListHeaderModel associatesListHeaderModel, ArrayList<AssociatesListItemModel> associatesListItemModel) { this.associatesListHeaderModel = associatesListHeaderModel; this.associatesListItemModel = associatesListItemModel; } public AssociatesListHeaderModel getAssociatesListHeaderModel() { return associatesListHeaderModel; } public void setAssociatesListHeaderModel(AssociatesListHeaderModel associatesListHeaderModel) { this.associatesListHeaderModel = associatesListHeaderModel; } public ArrayList<AssociatesListItemModel> getAssociatesListItemModel() { return associatesListItemModel; } public void setAssociatesListItemModel(ArrayList<AssociatesListItemModel> associatesListItemModel) { this.associatesListItemModel = associatesListItemModel; } }
[ "maciel.lucas@outlook.com" ]
maciel.lucas@outlook.com
d2173071e69764d9ac3443eb3a1707f7ae07a673
8afb5afd38548c631f6f9536846039ef6cb297b9
/_OVERFLOW/Resource-Store/01_Questions/_JAVA/680_Valid_Palindrome_II.java
1322258e6f3c2ca093b1a33c8a13bec567de392c
[ "MIT" ]
permissive
bgoonz/UsefulResourceRepo2.0
d87588ffd668bb498f7787b896cc7b20d83ce0ad
2cb4b45dd14a230aa0e800042e893f8dfb23beda
refs/heads/master
2023-03-17T01:22:05.254751
2022-08-11T03:18:22
2022-08-11T03:18:22
382,628,698
10
12
MIT
2022-10-10T14:13:54
2021-07-03T13:58:52
null
UTF-8
Java
false
false
728
java
class Solution { public boolean validPalindrome(String s) { if (s == null || s.length() == 0) { return true; } int start = 0, end = s.length() - 1; while (start < end) { if (s.charAt(start) != s.charAt(end)) { return isPalindrome(s, start + 1, end) || isPalindrome(s, start, end - 1); } ++start; --end; } return true; } private boolean isPalindrome(String s, int start, int end) { while (start < end) { if (s.charAt(start) != s.charAt(end)) { return false; } ++start; --end; } return true; } }
[ "bryan.guner@gmail.com" ]
bryan.guner@gmail.com
2ad612e10ced68cfb8aa9b03b4f1ea1dbae8aebd
2d408cda3b12f56127818d1119c5e9eaf0a03a45
/workspace/p7_sqlite/gen/com/example/p7_sqlite/BuildConfig.java
5cb4070934fae5d06e6c422ed46c05067f1bdf1a
[]
no_license
jhonj624/android-cymetria-colvanes
83be30e1001f48fe93f4806c6be0cb4ad197087c
69e782cc81b5945d259b0c372e77fcfad22f3a64
refs/heads/master
2021-01-15T09:33:59.969209
2015-02-18T15:20:33
2015-02-18T15:20:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
163
java
/** Automatically generated file. DO NOT MODIFY */ package com.example.p7_sqlite; public final class BuildConfig { public final static boolean DEBUG = true; }
[ "julianfigueroa@sikuani.net" ]
julianfigueroa@sikuani.net
61f2c7c3767c0880dddfada6337142a37432b74b
52112f7d30ac1b8f4a1ee41c93c887f21176a047
/src/cn/sdp/pkv/pyramid/index/ExtendPyramid.java
f44d21dc8b26f78261abce9fdcb08c92feb43b16
[]
no_license
winstone/SPKV
e2dd2ece840815fedcff9f01507c4d2090ebd8b0
4003386814bb2c9d2c160a89615409b57bf7da9a
refs/heads/master
2021-01-19T08:20:20.242409
2014-08-08T05:23:13
2014-08-08T05:24:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,533
java
package cn.sdp.pkv.pyramid.index; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import cn.sdp.pkv.pyramid.model.PyramidResult; import cn.sdp.pkv.util.Configs; public class ExtendPyramid extends Pyramid{ private double hvInterval; private int hvDimension; private double[] sliceValue; private final int DIMENSION_THRESHOLD = Configs.DIMENSION_THRESHOLD; public ExtendPyramid(int d, Object[] lb, Object[] ub) { super(d, lb, ub); // TODO Auto-generated constructor stub if (d > DIMENSION_THRESHOLD) hvDimension = DIMENSION_THRESHOLD; else hvDimension = d-1; hvInterval = Math.pow(2.0, hvDimension); sliceValue = new double[dimension]; Arrays.fill(sliceValue, 0.5); } @Override public PyramidResult getPyramidResult(Object[] origin) { double[] v = getNormalization(origin); int pyId = getPyramidId(v); double hv = getHv(v, pyId); return new PyramidResult(v, pyId*hvInterval+hv); } public List<PyramidRange> getPyramidRange(Object[] qlbound, Object[] qubound) { double[] ql = getNormalization(qlbound); double[] qu = getNormalization(qubound); List<Integer> intersectPy = getIntersects(ql, qu); return getRange(intersectPy, ql, qu); } public List<PyramidRange> getPyramidKNNRange(double[] norV, double distance, int pyId) { int d = pyId%dimension; double high = Double.compare(norV[d]+distance,1.0)>0?1.0:(norV[d]+distance); double low = Double.compare(norV[d]-distance,0.0)<0?0.0:(norV[d]-distance); if (pyId < dimension) { if (Double.compare(low, 0.5) > 0) return Collections.emptyList(); else low = Math.abs(0.5-low); if (Double.compare(high, 0.5) > 0) high = 0.0; else high = Math.abs(0.5-high); } else { if (Double.compare(high, 0.5) < 0) return Collections.emptyList(); else high = Math.abs(0.5-high); if (Double.compare(low, 0.5) < 0) low = 0.0; else low = Math.abs(0.5-low); } List<PyramidRange> knnRanges = new ArrayList<PyramidRange>(); searchKNNRange(0, 0, 0, norV, distance, pyId, Math.min(low, high), Math.max(low, high), knnRanges); return knnRanges; } private void searchKNNRange(int depth, int d, int value, double[] norV, double distance, int pId, double vlow, double vhigh, List<PyramidRange> res) { if (depth == hvDimension) { res.add(new PyramidRange(pId*hvInterval+value+vlow, pId*hvInterval+value+vhigh)); return; } if (d == pId%dimension) { searchKNNRange(depth, d+1, value, norV, distance, pId, vlow, vhigh, res); } else { double high = Double.compare(norV[d]+distance,1.0)>0?1.0:(norV[d]+distance); double low = Double.compare(norV[d]-distance,0.0)<0?0.0:(norV[d]-distance); if (high <= sliceValue[d]) { value <<= 1; searchKNNRange(depth+1, d+1, value, norV, distance, pId, vlow, vhigh, res); } else if (low > sliceValue[d]) { value <<= 1; value |= 1; searchKNNRange(depth+1, d+1, value, norV, distance, pId, vlow, vhigh, res); } else { value <<= 1; searchKNNRange(depth+1, d+1, value, norV, distance, pId, vlow, vhigh, res); value |= 1; searchKNNRange(depth+1, d+1, value, norV, distance, pId, vlow, vhigh, res); } } } private List<PyramidRange> getRange(List<Integer> intersectPy, double[] ql, double[] qu) { List<PyramidRange> res = new ArrayList<PyramidRange>(); for (int pId : intersectPy) { double tlow = Math.abs(0.5-ql[pId%dimension]); double thigh = Math.abs(0.5-qu[pId%dimension]); double low = 0.0; double high = 0.0; if ((0.5-ql[pId%dimension])*(0.5-qu[pId%dimension]) >= 0) { low = Math.min(tlow, thigh); high = Math.max(tlow, thigh); } else { if (pId < dimension) high = tlow; else high = thigh; low = 0; } searchRange(0, 0, 0, ql, qu, pId, low, high, res); } return res; } private void searchRange(int depth, int d, int value, double[] ql, double[] qu, int pId, double low, double high, List<PyramidRange> res) { if (depth == hvDimension) { res.add(new PyramidRange(pId*hvInterval+value+low, pId*hvInterval+value+high)); return; } if (d == pId%dimension) { searchRange(depth, d+1, value, ql, qu, pId, low, high, res); } else { if (qu[d] <= sliceValue[d]) { value <<= 1; searchRange(depth+1, d+1, value, ql, qu, pId, low, high, res); } else if (ql[d] > sliceValue[d]) { value <<= 1; value |= 1; searchRange(depth+1, d+1, value, ql, qu, pId, low, high, res); } else { value <<= 1; searchRange(depth+1, d+1, value, ql, qu, pId, low, high, res); value |= 1; searchRange(depth+1, d+1, value, ql, qu, pId, low, high, res); } } } private List<Integer> getIntersects(double[] ql, double[] qu) { List<Integer> inters = new ArrayList<Integer>(); for (int i = 0;i < dimension;i++) { boolean flag = true; for (int j = 0;j < dimension;j++) { if (j == i) continue; if (ql[i] > qu[j] || ql[i] > 1-ql[j]) { flag = false; break; } } if (flag) inters.add(i); flag = true; for (int j = 0;j < dimension;j++) { if (j == i) continue; if (1-qu[i] > qu[j] || 1-qu[i] > 1-ql[j]) { flag = false; break; } } if (flag) inters.add(i+dimension); } return inters; } private double getHv(double[] v, int pyId) { int partition = getPartitionValue(v, pyId); return partition+Math.abs(0.5-v[pyId%dimension]); } private int getPartitionValue(double[] v, int pyId) { int partition = 0; pyId %= dimension; int round = 0, i = 0; while (round < hvDimension) { if (i != pyId) { round++; partition <<= 1; if (v[i] < 0 || v[i] > sliceValue[i]) partition |= 1; } i++; } return partition; } private int getPyramidId(double[] v) { int jmax = 0; double maxr = 0.0; for (int i = 0;i < dimension;i++) { if (v[i] >= 0) { double tempr = Math.abs(0.5-v[i]); if (tempr > maxr) { maxr = tempr; jmax = i; } } } if (v[jmax] < 0.5) return jmax; else return jmax+dimension; } @Override public int getInterval() { return ((Double)hvInterval).intValue(); } }
[ "tangyu@act.buaa.edu.cn" ]
tangyu@act.buaa.edu.cn
730be2856f078b74c06ec86a385f09d692363fb5
4409b952a865601cce1e53b7d4cd6049d75a5549
/app/src/main/java/com/example/matt/a339project/Adapters/PurchaseListAdapter.java
0b168b49a3b98933ea5ebab79f9ef067819af868
[]
no_license
loganbuschette/CPRE339-Project
bd1bdc2cdf1056243b9d90b13246f5b98ee16c9d
ced13c0ce315a46aa4e9c43d981cb54c6b064491
refs/heads/master
2020-12-24T06:03:03.860198
2016-12-05T20:32:30
2016-12-05T20:32:30
73,236,033
0
0
null
null
null
null
UTF-8
Java
false
false
1,447
java
package com.example.matt.a339project.Adapters; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.example.matt.a339project.Objects.Merchandise.Merchandise; import com.example.matt.a339project.R; import java.text.NumberFormat; import java.util.List; public class PurchaseListAdapter extends ArrayAdapter<Merchandise> { public PurchaseListAdapter(Context context, int resource, List<Merchandise> merch) { super(context, resource, merch); } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi; vi = LayoutInflater.from(getContext()); v = vi.inflate(R.layout.statement_item, null); } Merchandise m = getItem(position); if (m != null) { TextView title = (TextView) v.findViewById(R.id.merchTitle); TextView price = (TextView) v.findViewById(R.id.merchPrice); if (title != null) { title.setText(m.getItemTitle()); } if (price != null) { NumberFormat format = NumberFormat.getCurrencyInstance(); price.setText(format.format(m.getSaleCost())); } } return v; } }
[ "logan.buschette12@gmail.com" ]
logan.buschette12@gmail.com
92886aea774e8404659db8c2c40cbcdbe2be2720
09649412e12bdc15cf61607e881203735cfafa50
/src/test/java/com/microsoft/bingads/api/test/entities/bid_suggestion_data/BulkKeywordBidSuggestionTest.java
d10a79dfb012faf81fcfdf92065c82a4f9542e1c
[ "MIT" ]
permissive
yosefarr/BingAds-Java-SDK
cec603b74a921e71c6173ce112caccdf7c1fdbc8
d1c333d0ba5b7e434c85a92c7a80dad0add0d634
refs/heads/master
2021-01-18T15:02:53.945816
2016-03-06T13:18:32
2016-03-06T13:18:32
51,738,651
0
1
null
2016-02-15T07:38:14
2016-02-15T07:38:13
null
UTF-8
Java
false
false
2,088
java
package com.microsoft.bingads.api.test.entities.bid_suggestion_data; import com.microsoft.bingads.api.test.entities.BulkEntityTest; import com.microsoft.bingads.bulk.entities.BulkKeywordBidSuggestion; import com.microsoft.bingads.internal.functionalinterfaces.BiConsumer; import com.microsoft.bingads.internal.functionalinterfaces.Function; import com.microsoft.bingads.internal.functionalinterfaces.Supplier; import java.util.Map; public abstract class BulkKeywordBidSuggestionTest extends BulkEntityTest<BulkKeywordBidSuggestion> { @Override protected void onEntityCreation(BulkKeywordBidSuggestion entity) { } @Override protected <TProperty> void testWriteProperty(String header, String expectedRowValue, TProperty propertyValue, BiConsumer<BulkKeywordBidSuggestion, TProperty> setFunc) { this.<TProperty>testWriteProperty(header, expectedRowValue, propertyValue, setFunc, new Supplier<BulkKeywordBidSuggestion>() { @Override public BulkKeywordBidSuggestion get() { return new BulkKeywordBidSuggestion(); } }); } @Override protected <TProperty> void testReadProperty(String header, String input, TProperty expectedResult, Function<BulkKeywordBidSuggestion, TProperty> actualValueFunc) { this.<TProperty>testReadProperty(header, input, expectedResult, actualValueFunc, new Supplier<BulkKeywordBidSuggestion>() { @Override public BulkKeywordBidSuggestion get() { return new BulkKeywordBidSuggestion(); } }); } @Override protected <TProperty> void testReadProperty(Map<String, String> rowValues, TProperty expectedResult, Function<BulkKeywordBidSuggestion, TProperty> actualValueFunc) { this.<TProperty>testReadProperty(rowValues, expectedResult, actualValueFunc, new Supplier<BulkKeywordBidSuggestion>() { @Override public BulkKeywordBidSuggestion get() { return new BulkKeywordBidSuggestion(); } }); } }
[ "bing_ads_sdk@microsoft.com" ]
bing_ads_sdk@microsoft.com
2ae17e93577c20876a8fd27ab708ff3c2cb22742
e0b83daf42616e752906399582a59a4fd03cd60f
/irshad dir/programming/java2019/try1/book2/Constror in Inheritance/ST32.java
f01b1078cbedd00a8df944db99200ffdf30f94c1
[]
no_license
irshadkhan248/JavaPythonAndroidMysqlCode
f63b6d756bf6a64e9050980567e6a81c6081843a
659da56425632b68d80c86ae6a8d9a2edeea364f
refs/heads/master
2021-05-23T11:50:50.536914
2020-04-05T16:27:52
2020-04-05T16:27:52
253,271,492
0
0
null
null
null
null
UTF-8
Java
false
false
324
java
class A{ A(){ System.out.println("1"); } /*A(int a){ System.out.println("50"); }*/ } class B extends A{ B(){ System.out.println("2"); } B(int b){ //this(); System.out.println("3"); } } class ST32{ public static void main(String args[]){ A a=new A(); //A a1=new A(1); B B1=new B(); B b=new B(2); } }
[ "irshad.khan@wohlig.in" ]
irshad.khan@wohlig.in
641e98dfa23c65e85e101a0509cf81f26b1e904c
acb42fb8cc7692237d3bab347b750d47e1dbd5bb
/src-gen/main/java/org/sig3d/citygml/_2/energy/_1/LayerPropertyType.java
3a5666ae05a1d4013533adf3715751c88e6fc2b2
[ "Apache-2.0" ]
permissive
sensor-freak/energy-ade-citygml4j
830bdf8a9a4fcca94cddb6153039c10ee7423c39
3d7c8094c4e92fe96dfb3af1c20fbf6ec792c408
refs/heads/master
2020-12-26T06:13:00.360662
2020-02-04T09:07:49
2020-02-04T09:07:49
237,412,512
0
0
Apache-2.0
2020-02-04T09:07:51
2020-01-31T11:00:25
null
UTF-8
Java
false
false
7,472
java
// // Generated with ade-xjc - XML Schema binding compiler for CityGML ADEs, version 2.9.0 // ade-xjc is part of the citygml4j project, see https://github.com/citygml4j // Any modifications to this file will be lost upon recompilation of the source // Generated: Wed Feb 13 16:55:57 CET 2019 // package org.sig3d.citygml._2.energy._1; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import org.w3._1999.xlink.ActuateType; import org.w3._1999.xlink.ShowType; import org.w3._1999.xlink.TypeType; /** * <p>Java-Klasse für LayerPropertyType complex type. * * <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist. * * <pre> * &lt;complexType name="LayerPropertyType"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element ref="{http://www.sig3d.org/citygml/2.0/energy/1.0}Layer" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;attGroup ref="{http://www.opengis.net/gml}AssociationAttributeGroup"/&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "LayerPropertyType", propOrder = { "layer" }) public class LayerPropertyType { @XmlElement(name = "Layer") protected LayerType layer; @XmlAttribute(name = "remoteSchema", namespace = "http://www.opengis.net/gml") @XmlSchemaType(name = "anyURI") protected String remoteSchema; @XmlAttribute(name = "type", namespace = "http://www.w3.org/1999/xlink") protected TypeType type; @XmlAttribute(name = "href", namespace = "http://www.w3.org/1999/xlink") protected String href; @XmlAttribute(name = "role", namespace = "http://www.w3.org/1999/xlink") protected String role; @XmlAttribute(name = "arcrole", namespace = "http://www.w3.org/1999/xlink") protected String arcrole; @XmlAttribute(name = "title", namespace = "http://www.w3.org/1999/xlink") protected String title; @XmlAttribute(name = "show", namespace = "http://www.w3.org/1999/xlink") protected ShowType show; @XmlAttribute(name = "actuate", namespace = "http://www.w3.org/1999/xlink") protected ActuateType actuate; /** * Ruft den Wert der layer-Eigenschaft ab. * * @return * possible object is * {@link LayerType } * */ public LayerType getLayer() { return layer; } /** * Legt den Wert der layer-Eigenschaft fest. * * @param value * allowed object is * {@link LayerType } * */ public void setLayer(LayerType value) { this.layer = value; } public boolean isSetLayer() { return (this.layer!= null); } /** * Ruft den Wert der remoteSchema-Eigenschaft ab. * * @return * possible object is * {@link String } * */ public String getRemoteSchema() { return remoteSchema; } /** * Legt den Wert der remoteSchema-Eigenschaft fest. * * @param value * allowed object is * {@link String } * */ public void setRemoteSchema(String value) { this.remoteSchema = value; } public boolean isSetRemoteSchema() { return (this.remoteSchema!= null); } /** * Ruft den Wert der type-Eigenschaft ab. * * @return * possible object is * {@link TypeType } * */ public TypeType getType() { if (type == null) { return TypeType.SIMPLE; } else { return type; } } /** * Legt den Wert der type-Eigenschaft fest. * * @param value * allowed object is * {@link TypeType } * */ public void setType(TypeType value) { this.type = value; } public boolean isSetType() { return (this.type!= null); } /** * Ruft den Wert der href-Eigenschaft ab. * * @return * possible object is * {@link String } * */ public String getHref() { return href; } /** * Legt den Wert der href-Eigenschaft fest. * * @param value * allowed object is * {@link String } * */ public void setHref(String value) { this.href = value; } public boolean isSetHref() { return (this.href!= null); } /** * Ruft den Wert der role-Eigenschaft ab. * * @return * possible object is * {@link String } * */ public String getRole() { return role; } /** * Legt den Wert der role-Eigenschaft fest. * * @param value * allowed object is * {@link String } * */ public void setRole(String value) { this.role = value; } public boolean isSetRole() { return (this.role!= null); } /** * Ruft den Wert der arcrole-Eigenschaft ab. * * @return * possible object is * {@link String } * */ public String getArcrole() { return arcrole; } /** * Legt den Wert der arcrole-Eigenschaft fest. * * @param value * allowed object is * {@link String } * */ public void setArcrole(String value) { this.arcrole = value; } public boolean isSetArcrole() { return (this.arcrole!= null); } /** * Ruft den Wert der title-Eigenschaft ab. * * @return * possible object is * {@link String } * */ public String getTitle() { return title; } /** * Legt den Wert der title-Eigenschaft fest. * * @param value * allowed object is * {@link String } * */ public void setTitle(String value) { this.title = value; } public boolean isSetTitle() { return (this.title!= null); } /** * Ruft den Wert der show-Eigenschaft ab. * * @return * possible object is * {@link ShowType } * */ public ShowType getShow() { return show; } /** * Legt den Wert der show-Eigenschaft fest. * * @param value * allowed object is * {@link ShowType } * */ public void setShow(ShowType value) { this.show = value; } public boolean isSetShow() { return (this.show!= null); } /** * Ruft den Wert der actuate-Eigenschaft ab. * * @return * possible object is * {@link ActuateType } * */ public ActuateType getActuate() { return actuate; } /** * Legt den Wert der actuate-Eigenschaft fest. * * @param value * allowed object is * {@link ActuateType } * */ public void setActuate(ActuateType value) { this.actuate = value; } public boolean isSetActuate() { return (this.actuate!= null); } }
[ "cnagel@virtualcitysystems.de" ]
cnagel@virtualcitysystems.de
0c65cdce3ee9a61204161039b1a7c0d41a52897d
7ed43e919540b95b22846b9d151fa482b58fdef4
/service/src/main/java/by/epam/parser/service/ParserUtil.java
b7cd8407848560dedb09b35326efed6e8b4434b6
[]
no_license
AmalKabulov/task05
de715fdb37b28ddd1a83f207193f48ba967d0c66
c32718d2b9b38030b2c76c91ac28c01d8d859801
refs/heads/master
2020-04-10T09:37:56.320310
2018-03-12T13:07:39
2018-03-12T13:07:39
124,268,664
0
0
null
null
null
null
UTF-8
Java
false
false
276
java
package by.epam.parser.service; import by.epam.parser.dao.parser.ParserDirector; import java.util.Set; public class ParserUtil { private ParserUtil() { } public static Set<String> getParsers() { return ParserDirector.getInstance().getNames(); } }
[ "amal.kabulov@compit.by" ]
amal.kabulov@compit.by
3c0e37c71e65191a64c45d3539dd2021ef525a7e
71551f036347c418e5416c04b3a6e2991ea3ae49
/data-structures/assignments/proj1/Queue.java
8bc7c5025b394a15c6e4692100e4aad22d88b507
[]
no_license
funkshun/firstyear-files-git
419e233c8c6846ebce5499305baf5bf626a4d42b
9d46caf7e1e89923167b32abfb0e78fb87cea12c
refs/heads/master
2020-07-03T09:44:12.983229
2017-04-24T13:49:48
2017-04-24T13:49:48
66,580,491
0
0
null
null
null
null
UTF-8
Java
false
false
2,322
java
//package proj1; public class Queue<T> { private T[] arr; private int pointer; private int rear; private int members; private int size; public Queue(int capacity){ arr = (T[]) new Object[capacity]; pointer = 0; rear = 0; members = 0; size = capacity; } public boolean isEmpty(){ return members == 0; } public boolean isFull(){ return members == size; } public T peek(){ if(isEmpty()){ throw new RuntimeException("No Values in Queue"); } return arr[pointer]; } public T dequeue(){ if(isEmpty()){ throw new RuntimeException("No Values in Queue"); } members--; T tmp = arr[pointer]; pointer = (pointer + 1) % size; return tmp; } public void enqueue(T element){ if(isFull()){ throw new RuntimeException("Queue is Full"); } arr[rear] = element; rear = (rear + 1) % size; members++; } public int getMembers(){ return this.members; } //testing /*public static void main(String[] args) { Queue<Integer> q1 = new Queue<Integer>(10); q1.enqueue(1); q1.enqueue(2); q1.enqueue(3); q1.enqueue(4); q1.enqueue(5); System.out.println(q1.dequeue()); System.out.println(q1.peek()); System.out.println(q1.dequeue()); System.out.println(q1.dequeue()); System.out.println(q1.dequeue()); System.out.println(q1.dequeue()); q1.enqueue(7); q1.enqueue(8); q1.enqueue(9); q1.enqueue(10); q1.enqueue(11); System.out.println(q1.dequeue()); System.out.println(q1.peek()); System.out.println(q1.dequeue()); System.out.println(q1.dequeue()); System.out.println(q1.dequeue()); System.out.println(q1.dequeue()); q1.enqueue(12); q1.enqueue(13); q1.enqueue(14); q1.enqueue(15); q1.enqueue(16); System.out.println(q1.dequeue()); System.out.println(q1.dequeue()); System.out.println(q1.dequeue()); System.out.println(q1.dequeue()); System.out.println(q1.dequeue()); }*/ }
[ "boofullwood@gmail.com" ]
boofullwood@gmail.com
6ba7aa091ebe6eead6a03ae3c1ead9c914cd3e31
0827e2d1f52d7e852cffc2b8e6d85eea7b2589d6
/app/src/main/java/com/onefengma/taobuxiu/model/events/GuidanceRefreshEvent.java
955337412990f3098c0951cf19e2b2550952bed5
[]
no_license
chufengma/b2bApp
8d0819b80b8c68a5502f421fa5537ccc839000f9
766b187199bed3e7cc81e8a91aea206df8070331
refs/heads/master
2020-05-21T16:46:04.413775
2017-04-12T13:02:33
2017-04-12T13:02:33
65,114,350
0
0
null
null
null
null
UTF-8
Java
false
false
128
java
package com.onefengma.taobuxiu.model.events; /** * Created by chufengma on 16/9/12. */ public class GuidanceRefreshEvent { }
[ "chufengma@foxmail.com" ]
chufengma@foxmail.com
9b3bff2bfb3669f19159b082bc1a4ad510f4867a
76be1486af87710e9346f786929af32873da79b7
/app/src/main/java/com/fc/mydemo/activity/xml/DomParserDemo.java
66256f2fe15cb064e3ccffcbb5655b298327daf7
[]
no_license
frozencloud/MyDemo
eeebd136aae8819e08016dde365bab9b4b81cee8
06d15a87d04bb2eba4c2e28030c3484d7a466b4a
refs/heads/master
2021-01-17T14:43:04.531629
2016-06-30T13:01:11
2016-06-30T13:01:11
48,479,399
0
0
null
null
null
null
UTF-8
Java
false
false
1,462
java
package com.fc.mydemo.activity.xml; import android.app.ListActivity; import android.os.Bundle; import android.widget.SimpleAdapter; import com.fc.mydemo.R; import com.fc.mydemo.xmlparse.DomParserHelper; import com.fc.mydemo.xmlparse.channel; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class DomParserDemo extends ListActivity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); SimpleAdapter adapter = new SimpleAdapter(this, getData(), R.layout.activity_list, new String[]{"id", "name"}, new int[]{ R.id.textId, R.id.textName}); setListAdapter(adapter); } private List<Map<String, String>> getData() { List<Map<String, String>> list = new ArrayList<Map<String, String>>(); InputStream stream = getResources().openRawResource(R.raw.channels); List<channel> channlist = DomParserHelper.getChannelList(stream); for (int i = 0; i < channlist.size(); i++) { Map<String, String> map = new HashMap<String, String>(); channel chann = channlist.get(i); map.put("id", chann.getId()); map.put("url", chann.getUrl()); map.put("name", chann.getName()); list.add(map); } return list; } }
[ "sishuiliunian321@163.com" ]
sishuiliunian321@163.com
72a0c22a96d144ee06785534627f1dafe00ad964
8f463cf9f7ce294103cbfffdf287c78b5cf4b0a9
/src/entities/Main.java
dab096daaece5a2725e6ff8d2a87cf46c2725495
[]
no_license
blank-manash/school-management-system
23574e4f8051ddb72a91056e1b02bac3357edbdd
b472d8d5e82269cf3b7631e139578edc98d24879
refs/heads/main
2023-08-03T03:47:17.689676
2021-09-28T00:24:39
2021-09-28T00:24:39
411,046,119
0
0
null
null
null
null
UTF-8
Java
false
false
2,136
java
package entities; import java.util.Scanner; public class Main { private final static School school = new School(); final static Scanner sc = new Scanner(System.in); public static void main(final String[] args) { prompt(); while (true) { final Integer i = sc.nextInt(); if (i == 0) { break; } else { switch (i) { case 1: school.addCourse(); break; case 2: school.addTeacher(); break; case 3: school.addStudent(); break; case 4: school.listPopulation(); break; case 5: school.listTeachers(); break; case 6: school.listStudentByGrade(); break; case 7: school.listStudentBySubject(); break; case 8: school.listSubjectsOfTeacher(); break; case 9: school.listSubjectOfStudent(); break; case 10: school.feesOfStudent(); break; case 11: school.removeCourse(); break; case 12: school.deleteStudent(); break; case 13: school.deleteTeacher(); default: prompt(); break; } } } System.out.println("\n Closing Application!"); } public static final void prompt() { System.out.println("\n\nSchool Management\n======================\n"); System.out.println("0 : Exit the Program"); System.out.println("1 : Add a Course"); System.out.println("2 : Add a Teacher"); System.out.println("3 : Add a Student"); System.out.println("4 : List All The School Population"); System.out.println("5 : List all the teachers"); System.out.println("6 : List all the students by grade"); System.out.println("7 : List the students enrolled in a subject"); System.out.println("8 : List all the subjects taught by a teacher."); System.out.println("9 : List all the subjects enrolled for a student."); System.out.println("10 : Present the fees payable by a particular student."); System.out.println("11 : Delete a Course"); System.out.println("12 : Delete a Student"); System.out.println("13 : Delete a Teacher"); System.out.println("14 : Repeat This Prompt"); System.out.print("Enter a choice : "); } }
[ "manash@iitk.ac.in" ]
manash@iitk.ac.in
253d96a10fdb714015470fb1cb201349ee0967eb
4452f312dbe8b9fc4bc1fad77aff8f876a89ce75
/demo/src/main/java/com/example/demo/model/User.java
4d5df120321307f65060fdbb7642c6472f7a1129
[]
no_license
PeteATX/SpringBootDisRecLogin
5b1b8f676f19da68098017a1714ab2e8d1ee5b1b
5ddc43a49b966a74f45ce9f21566a53d7dc77d7c
refs/heads/master
2021-03-15T09:22:11.945151
2020-03-12T15:53:07
2020-03-12T15:53:07
246,839,945
0
0
null
null
null
null
UTF-8
Java
false
false
3,185
java
package com.example.demo.model; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.validator.constraints.Length; import javax.persistence.*; import javax.validation.constraints.Email; import javax.validation.constraints.NotEmpty; import java.util.HashSet; import java.util.Set; @Data @Builder @AllArgsConstructor @NoArgsConstructor @Entity @Table(name = "users") public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "user_id") private int id; @Column(name = "user_name") @Length(min = 5, message = "*Your user name must have at least 5 characters") @NotEmpty(message = "*Please provide a user name") private String userName; @Column(name = "email") @Email(message = "*Please provide a valid Email") @NotEmpty(message = "*Please provide an email") private String email; @Column(name = "password") @Length(min = 5, message = "*Your password must have at least 5 characters") @NotEmpty(message = "*Please provide your password") private String password; @Column(name = "name") @NotEmpty(message = "*Please provide your name") private String name; @Column(name = "last_name") @NotEmpty(message = "*Please provide your last name") private String lastName; @Column(name = "active") private Boolean active; @ManyToMany(cascade = CascadeType.MERGE) @JoinTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id")) private Set<Role> roles; public int getId() { return id; } public void setId(int id) { this.id = id; } public void setUserName(String userName) { this.userName = userName; } public void setEmail(String email) { this.email = email; } public void setName(String name) { this.name = name; } public void setLastName(String lastName) { this.lastName = lastName; } public void setActive(Boolean active) { this.active = active; } public void setRoles(Set<Role> roles) { this.roles = roles; } public Set<Role> getRoles() { // TODO Auto-generated method stub return null; } public String getUserName() { // TODO Auto-generated method stub return null; } public String getPassword() { // TODO Auto-generated method stub return null; } public void setPassword(String encode) { // TODO Auto-generated method stub } public void setActive(boolean b) { // TODO Auto-generated method stub } public void setRoles(HashSet<Role> hashSet) { // TODO Auto-generated method stub } public String getName() { // TODO Auto-generated method stub return null; } public boolean getActive() { // TODO Auto-generated method stub return false; } public String getLastName() { // TODO Auto-generated method stub return null; } public String getEmail() { // TODO Auto-generated method stub return null; } public static Object builder() { // TODO Auto-generated method stub return null; } }
[ "pete.2392@hotmail.com" ]
pete.2392@hotmail.com
fefdffc73bad1b8f22df77beb0c824187e013370
3a6b03115f89c52c0990048d653e2d66ff85feba
/java/nio/channels/Channels.java
2cb2753f002230476a1739669564abe3e8e28c7a
[]
no_license
isabella232/android-sdk-sources-for-api-level-1
9159e92080649343e6e2be0da2b933fa9d3fea04
c77731af5068b85a350e768757d229cae00f8098
refs/heads/master
2023-03-18T05:07:06.633807
2015-06-13T13:35:17
2015-06-13T13:35:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,565
java
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://kpdus.tripod.com/jad.html // Decompiler options: packimports(3) fieldsfirst ansi space // Source File Name: Channels.java package java.nio.channels; import java.io.*; import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetEncoder; // Referenced classes of package java.nio.channels: // ReadableByteChannel, WritableByteChannel public final class Channels { Channels() { throw new RuntimeException("Stub!"); } public static InputStream newInputStream(ReadableByteChannel channel) { throw new RuntimeException("Stub!"); } public static OutputStream newOutputStream(WritableByteChannel channel) { throw new RuntimeException("Stub!"); } public static ReadableByteChannel newChannel(InputStream inputStream) { throw new RuntimeException("Stub!"); } public static WritableByteChannel newChannel(OutputStream outputStream) { throw new RuntimeException("Stub!"); } public static Reader newReader(ReadableByteChannel channel, CharsetDecoder decoder, int minBufferCapacity) { throw new RuntimeException("Stub!"); } public static Reader newReader(ReadableByteChannel channel, String charsetName) { throw new RuntimeException("Stub!"); } public static Writer newWriter(WritableByteChannel channel, CharsetEncoder encoder, int minBufferCapacity) { throw new RuntimeException("Stub!"); } public static Writer newWriter(WritableByteChannel channel, String charsetName) { throw new RuntimeException("Stub!"); } }
[ "root@ifeegoo.com" ]
root@ifeegoo.com
72aec6fa21a19da4b1f6c839c45edba5f567bd3b
68a9a8e44ec0ad464d95898f0203ac3c9d08774c
/src/main/java/com/court/booking/system/csvupload/service/CSVService.java
2cd39480628d448d74b5d022c1bf1cd6f215e9d0
[ "MIT" ]
permissive
swatichauhan814/book
320f1994a14f9dedc56aba21724fd7d36e9538f1
10b7c798672b482b237ed918192674df1e62fe83
refs/heads/master
2023-04-23T12:50:21.445088
2021-05-15T10:03:24
2021-05-15T10:03:24
304,610,996
0
0
null
null
null
null
UTF-8
Java
false
false
4,301
java
package com.court.booking.system.csvupload.service; import com.court.booking.system.csvupload.CourtCSV; import com.court.booking.system.csvupload.SportCSV; import com.court.booking.system.exception.FailureCodes; import com.court.booking.system.exception.SportManagementCSVException; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile; import org.supercsv.exception.SuperCsvConstraintViolationException; import org.supercsv.io.CsvBeanReader; import org.supercsv.io.ICsvBeanReader; import org.supercsv.prefs.CsvPreference; import java.io.BufferedReader; import java.io.InputStreamReader; import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import static com.court.booking.system.helpers.DateUtil.convertToTimestamp; @Component @Slf4j public class CSVService { private final CSVOperationService csvOperationService; public CSVService(CSVOperationService csvOperationService) { this.csvOperationService = csvOperationService; } public void validateAndSaveCourt(MultipartFile multipartFile) { List<CSVMapper> csvMapperList = readCSV(multipartFile, CourtCSV.class, new CourtCSV()); List<CourtCSV> courtCSVList = csvMapperList.stream() .map(csvMapper -> (CourtCSV) csvMapper) .map(CourtCSV::trim) .filter(this::validateTimings) .collect(Collectors.toList()); csvOperationService.saveCourt(courtCSVList); } public void validateAndSaveSport(MultipartFile multipartFile) { List<CSVMapper> csvMapperList = readCSV(multipartFile, SportCSV.class, new SportCSV()); List<SportCSV> sportCSVList = csvMapperList.stream() .map(csvMapper -> (SportCSV) csvMapper) .map(SportCSV::trim) .collect(Collectors.toList()); csvOperationService.saveSport(sportCSVList); } private boolean validateTimings(CourtCSV courtCSV) { Timestamp openingTimestamp = convertToTimestamp(courtCSV.getOpeningTime()); Timestamp closingTimestamp = convertToTimestamp(courtCSV.getClosingTime()); if (!openingTimestamp.toLocalDateTime().isBefore(closingTimestamp.toLocalDateTime())) { log.error("Opening Time of court should be before closing time"); throw new SportManagementCSVException("Invalid courtTimings", FailureCodes.INVALID_TIMING); } return true; } private List<CSVMapper> readCSV(MultipartFile file, Class<? extends CSVMapper> csvMapperClass, CSVMapper csvObject) throws SportManagementCSVException { try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getInputStream())); ICsvBeanReader beanReader = new CsvBeanReader(reader, CsvPreference.STANDARD_PREFERENCE)) { beanReader.getHeader(true); List<CSVMapper> csvMappedObjects = new ArrayList<>(); CSVMapper csvMapperImpl = beanReader.read(csvMapperClass, csvObject.getNameMapping(), csvObject.getProcessors()); while (csvMapperImpl != null) { csvMappedObjects.add(csvMapperImpl); csvMapperImpl = beanReader.read(csvMapperClass, csvObject.getNameMapping(), csvObject.getProcessors()); } return csvMappedObjects; } catch (SuperCsvConstraintViolationException e) { String invalidValueSuppliedFromCSVForHeader = csvObject.getNameMapping()[e.getCsvContext().getColumnNumber() - 1]; List<Object> objectList = e.getCsvContext().getRowSource(); String court = null; if (objectList.get(0) != null) { court = String.valueOf(objectList.get(0)); } throw new SportManagementCSVException("Mandatory field : " + invalidValueSuppliedFromCSVForHeader + ", is invalid/null for court : " + court + " at row number : " + e.getCsvContext().getRowNumber(), FailureCodes.CSV_MANDATORY_FIELD_IS_NULL); } catch (Exception e) { throw new SportManagementCSVException("Reading of csv file=" + file + " failed", e, FailureCodes.CSV_READING_FAILED); } } }
[ "swati.chauhan814@gmail.com" ]
swati.chauhan814@gmail.com