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
4dc2ad3a19f8b58f582f23c57b9795cf2c863fdf
44c7aef60ff20249ddbe1bc29df14e0af7f60989
/app/src/main/java/com/example/demo/MainActivity.java
87b29e85fb47698ee5f04fe66b14d75f9ddfbaad
[]
no_license
turbonan/Get-Post
0002bf8d61c7500f85c3115c905da3ff31a39762
6a64b2ac442d1f290aad66718858707d7e23899a
refs/heads/master
2022-11-21T02:23:51.212717
2020-07-07T03:14:05
2020-07-07T03:14:05
276,799,114
0
0
null
null
null
null
UTF-8
Java
false
false
2,396
java
package com.example.demo; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; public class MainActivity extends AppCompatActivity { Button get , post; EditText show; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); get = (Button) findViewById(R.id.get); post = (Button) findViewById(R.id.post); show = (EditText)findViewById(R.id.show); //利用Handler更新UI final Handler h = new Handler(){ @Override public void handleMessage(Message msg) { if(msg.what==0x123){ show.setText(msg.obj.toString()); } } }; get.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new Thread(new AccessNetwork("GET", "http://api.bilibili.cn/author_recommend?aid=[id] ", null, h)).start(); } }); post.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new Thread(new AccessNetwork("POST", "https://waishuo.leanapp.cn/api/v1.0/users/login" ,null , h)).start(); } }); } } class AccessNetwork implements Runnable{ private String op ; private String url; private String params; private Handler h; public AccessNetwork(String op, String url, String params,Handler h) { super(); this.op = op; this.url = url; this.params = params; this.h = h; } @Override public void run() { Message m = new Message(); m.what = 0x123; if(op.equals("GET")){ Log.i("iiiiiii","发送GET请求"); m.obj = GetPostUtil.sendGet(url, params); Log.i("iiiiiii","----"+m.obj); } if(op.equals("POST")){ Log.i("iiiiiii","发送POST请求"); m.obj = GetPostUtil.sendPost(url, params); Log.i("gggggggg","----"+m.obj); } h.sendMessage(m); } }
[ "2441140167@qq.com" ]
2441140167@qq.com
5a07cfc4d336bb653fbcb8f75a84c71550a77ad8
f3a474ec9f7fb94a5c749124d8126420ed0e4689
/src/main/java/com/nezha/ArtConcurrentBook/chapter03/MonitorExample.java
a0750c2dcb3fea956e0f221c095403caca078a40
[]
no_license
nezha/Algorithm
6e261a0bcaec3bd8316bc6e6ee2d9c0a299b651e
0260ab241ae0db4b0a9b92a6a38d94b37db7eba0
refs/heads/master
2020-05-22T16:34:56.941454
2017-08-24T08:47:13
2017-08-24T08:47:13
84,704,647
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package com.nezha.ArtConcurrentBook.chapter03; class MonitorExample { int a = 0; public synchronized void writer() { //1 a++; //2 } //3 public synchronized void reader() { //4 int i = a; //5 //���� } //6 }
[ "nezhaxiaozi@outlook.com" ]
nezhaxiaozi@outlook.com
0efa4a2e88d069690de64a0373536cbc29a3737e
1d37aa19995ea61e13a123e5a6e02ac0d8ee2ed1
/1st/src/main/java/com/taskagile/AppApplication.java
265ee84c670588a68054b9c10743271d77cbd378
[]
no_license
YoungChulShin/book_taskagile_server
0f51cd536ddf05419ac644a9422cc3cc083413c2
8957732ab304f19c788f9c601122caf344a90f7b
refs/heads/master
2023-02-24T01:02:05.775224
2021-01-31T14:31:47
2021-01-31T14:31:47
279,430,468
0
0
null
null
null
null
UTF-8
Java
false
false
311
java
package com.taskagile; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class AppApplication { public static void main(String[] args) { SpringApplication.run(AppApplication.class, args); } }
[ "go1323@gmail.com" ]
go1323@gmail.com
0b272b62e45ebffd22ce17afeca1ec84e3b55f4a
88c6fd68381f5dbff106a517aeb765f44df539e9
/src/main/java/com/project/voizfonica/data/InvoiceRepository.java
9cf66d3154ee3dd81ce3eff8e979870465659993
[]
no_license
Mohanaprasad1997/Voizfonica_Team5
49aa321ff3b888f74575acdba9760a0bd12dee16
261d18550a34dbf6f9c7cda9fbe1052fe8c5b0e8
refs/heads/master
2022-12-12T02:47:49.344887
2019-08-19T15:43:13
2019-08-19T15:43:13
203,202,016
0
0
null
2022-12-04T08:06:04
2019-08-19T15:42:05
CSS
UTF-8
Java
false
false
231
java
package com.project.voizfonica.data; import com.project.voizfonica.model.Invoice; import org.springframework.data.mongodb.repository.MongoRepository; public interface InvoiceRepository extends MongoRepository<Invoice,String> { }
[ "deivasree.iprimed@gmail.com" ]
deivasree.iprimed@gmail.com
735d543cf4e658ba5a8e6e0e5cb5d53e9ce9d3f9
3e14a5dce29efca6f95f679f9550ce381ab90bd5
/src/Controller/ctlTypeDocument.java
ef7737409e5ba487af6050e48544dd7ce434458b
[]
no_license
anmarub/ManagementCV_java
ec0d5c1f7ba074b7951adfacd786f34c3d6fdf22
586cff1684d493ba17e40cb37e33b7db96df2d74
refs/heads/master
2023-07-27T22:49:06.735866
2021-09-11T16:16:15
2021-09-11T16:16:15
405,436,439
0
0
null
null
null
null
UTF-8
Java
false
false
2,772
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 Controller; import java.util.LinkedList; import Class.clsTypeDocument; import Model.modelTypeDocument; /** * * @author andres.rubiano */ public class ctlTypeDocument { modelTypeDocument modelTipoDocumento; public ctlTypeDocument() { this.modelTipoDocumento = new modelTypeDocument(); } public boolean createTipoDocumento(clsTypeDocument tipoDocumento){ try{ this.modelTipoDocumento.createtipoDocumento(tipoDocumento); System.out.println("Controlador Genero: Informacion Llamada Correctamente "); return true; }catch(Exception errors){ System.out.println("Error Crear Genero: " + errors); return false; } } public clsTypeDocument searchTipoDocumento(String codigo){ clsTypeDocument TipoDocumento = null; try{ TipoDocumento = this.modelTipoDocumento.searchtipoDocumento(codigo); System.out.println("Controlador Genero: Informacion Llamada Correctamente "); return TipoDocumento; }catch(Exception errors){ System.out.println("Error Buscar Genero: " + errors); return null; } } public boolean updateTipoDocumento(clsTypeDocument tipoDocumento){ try{ this.modelTipoDocumento.updatetipoDocumento(tipoDocumento); System.out.println("Controlador Genero: Informacion Llamada Correctamente "); return true; }catch(Exception errors){ System.out.println("Error Actualizar Genero: " + errors); return false; } } public boolean deleteTipoDocumento(String cod_TipoDocumento){ try{ this.modelTipoDocumento.deletetipoDocumento(cod_TipoDocumento); System.out.println("Controlador Genero: Informacion Llamada Correctamente "); return true; }catch(Exception errors){ System.out.println("Error Buscar Genero: " + errors); return false; } } public LinkedList<clsTypeDocument> ListTipoDocumentos(){ LinkedList<clsTypeDocument> listGenero = null; try { listGenero = this.modelTipoDocumento.ListTipoDocumentos(); System.out.println("Controlador Genero: Paso controlado correcto!!"); return listGenero; } catch (Exception e) { System.out.println("Controlador: Error Lista Genero: " + e); return listGenero; } } }
[ "76189850+anmarub@users.noreply.github.com" ]
76189850+anmarub@users.noreply.github.com
9c3c048af80c2319925f599f61bfd37dfb05b2d1
3beb540f6b5a7b8c13646dabf1b37678b88b382d
/STARSplanner/src/controllers/swopController.java
1f918a33ad5b17d779f4393acca2b4bb8d700445
[]
no_license
wchua045/My-STudent-Automated-Registration-System-MySTARS-
bcc1212271921b21498ed677e3692c545078d5ca
3b88de45d6b67438ca7ef9511e621b477eaebd7d
refs/heads/main
2023-01-23T19:44:53.034076
2020-12-15T10:04:48
2020-12-15T10:04:48
321,622,979
0
0
null
null
null
null
UTF-8
Java
false
false
12,314
java
package controllers; import java.util.ArrayList; import controllers.manager.courseManager; import controllers.manager.indexManager; import controllers.manager.studentManager; import controllers.manager.swopManager; import entities.Course; import entities.Index; import entities.PendingSwop; import entities.Student; import entities.User; /** * Provides methods to create, drop, and handle swop requests by students. * Both students who want to swap indexes with one another must be from the same course, and they must each already be in an index of that course. Then, they must enter * each other's matriculation number and password to ensure that no other third party can swap with their pending swaps. When trying to add a new swap, the system does * multiple checks to ensure that a pending swap added would be valid. This prevents conflicts when a pending swap is being carried out. * @author Daniel * */ public class swopController { // private static swopManager swopMgr = new swopManager(); // private static studentManager studMgr = new studentManager(); // private static indexManager indexMgr = new indexManager(); /** * Creates a new swop if a matching one does not already exist * @param course Desired course code to swop * @param fromMatric Matriculation number of current student. * @param fromIndex Index of the current student (must be existing) * @param toMatric Matriculation number of the swop partner * @param toIndex Index that the current student wants to swop to * @param toPW Password of the swop partner for validation of swop * @return True if swop is successfully registered. False otherwise. */ public static boolean registerSwop (String course, String fromMatric, int fromIndex, String toMatric, int toIndex, String toPW) { swopManager swopMgr = new swopManager(); studentManager studMgr = new studentManager(); indexManager indexMgr = new indexManager(); courseManager courseMgr = new courseManager(); Course courseObj = new Course(); courseObj.setCourseCode(course); courseObj = courseMgr.find(courseObj); ArrayList<Index> indexList = new ArrayList<Index>(); indexList = courseObj.getIndexList(); // Instantiating one queryswop for query purposes PendingSwop querySwop = new PendingSwop(); querySwop.setCourseCode(course); querySwop.setFromMatric(fromMatric); querySwop.setFromIndex(fromIndex); querySwop.setToMatric(toMatric); querySwop.setToIndex(toIndex); // Instantiating the relevant students Student fromStudent = new Student(); fromStudent.setMatricNum(fromMatric); fromStudent = studMgr.findByMatric(fromStudent); Student toStudent = new Student(); toStudent.setMatricNum(toMatric); toStudent = studMgr.findByMatric(toStudent); // Instantiating the relevant index Index fromIndexObj = new Index(); fromIndexObj.setIndex(fromIndex); fromIndexObj.setCourseCode(course); fromIndexObj = indexMgr.find(fromIndexObj); Index toIndexObj = new Index(); toIndexObj.setIndex(toIndex); toIndexObj.setCourseCode(course); toIndexObj = indexMgr.find(toIndexObj); // Check if fromStudent, toStudent, fromIndexObj, toIndexObj exist if (fromStudent == null || fromIndexObj == null) { System.out.println("Can't find index in your registered courses. Please check and try again."); return false; } if (toStudent == null || toIndexObj == null) { System.out.println("Can't find swap partner or the requested course index. Please check and try again."); return false; } // Check if both students in the swop have their respective indexes if(!swopController.bothStudentsHaveIndex(fromStudent, fromIndex, toStudent, toIndex)){ return false; } // Check if a swop created by fromMatric exists if (swopController.isSimilar(querySwop)) { System.out.println("You have created a similar pending swop. Please check swops."); return false; } // Check if "From" exists as the destination of a pending swop of someone else. else if (swopController.isDestination(querySwop)) { System.out.println("Someone has created a pending swop with you. Please check friend's particulars."); return false; } // Check if a valid swop has been created by another Student else if(swopController.isComplement(querySwop)) { // swopIndex (this works) indexMgr.swopIndex(querySwop); // swopStudentIndex studMgr.swopStudentIndex(querySwop); return true; } else { // Check if the pw given for the swop partner is valid String hashedPW = User.generateHashedPassword(toPW); if(toStudent == null || !toStudent.validate(hashedPW)) { System.out.println("Invalid User/Password for swap partner"); return false; } // Check if the swop clashes with "From" timetable and "To" timetable // Drop current index temporarily fromStudent.getTimetable().clearIndex(fromIndexObj); // Check for clash when you add the new index if (fromStudent.getTimetable().checkClash(toIndexObj)) { System.out.println("The new index chosen clashes with your timetable"); return false; } // create a new swop swopMgr.create(querySwop); System.out.println("New swap has been successfully created"); return true; } } /** * Deletes the matching PendingSwop, if it exists. All fields must match. * @param fromMatric Matriculation number of current student. * @param fromIndex Index of the current student (must be existing) * @param toMatric Matriculation number of the swop partner * @param toIndex Index that the current student wants to swop to * @return True if swop is found and deleted; False if swop not found. */ public static boolean dropSwop (String course, String fromMatric, int fromIndex, String toMatric, int toIndex) { swopManager swopMgr = new swopManager(); // Instantiating one queryswop for query purposes PendingSwop querySwop = new PendingSwop(); querySwop.setCourseCode(course); querySwop.setFromMatric(fromMatric); querySwop.setFromIndex(fromIndex); querySwop.setToMatric(toMatric); querySwop.setToIndex(toIndex); if(swopController.exists(querySwop)) { // if exists, delete the swop swopMgr.delete(querySwop); System.out.println("Swap has been deleted created"); return true; } else { // Say swop not found System.out.println("Swap not found!"); return false; } } /** * Returns any PendingSwop that belongs to the current student. * @param matric Matriculation number of the student. * @return Pending Swops belonging to the student, as specified by matriculation number. */ public static ArrayList<PendingSwop> getStudentSwopList (String matric) { swopManager swopMgr = new swopManager(); PendingSwop querySwop = new PendingSwop(); querySwop.setFromMatric(matric); return swopMgr.findMatric(querySwop); } /** * Check if the exact pending swop exists. * @param query A PendingSwop object containing courseCode, fromMatric, fromIndex, toMatric & toIndex. This was entered by the student. * @return True if exact match is found; False otherwise. */ public static boolean exists (PendingSwop query) { swopManager swopMgr = new swopManager(); PendingSwop foundSwop = swopMgr.find(query); if (foundSwop != null) return true; else return false; } /** * Checks if the current user already has a similar swop (registered course code & index matches) * @param query A PendingSwop object containing courseCode, fromMatric, fromIndex, toMatric & toIndex. This was entered by the student. * @return True if similar match is found; False otherwise. */ public static boolean isSimilar (PendingSwop query) { swopManager swopMgr = new swopManager(); PendingSwop foundSwop = swopMgr.isSimilar(query); if (foundSwop != null) return true; else return false; } /** * Checks if the there is a pending swop which belongs to the swop partner. If found, we can perform the swop. * @param query A PendingSwop object containing courseCode, fromMatric, fromIndex, toMatric & toIndex. This was entered by the student. * @return True if a swop match is found; False otherwise. */ public static boolean isComplement (PendingSwop query) { swopManager swopMgr = new swopManager(); PendingSwop complement = new PendingSwop(); complement.setCourseCode(query.getCourseCode()); complement.setFromMatric(query.getToMatric()); complement.setFromIndex(query.getToIndex()); complement.setToMatric(query.getFromMatric()); complement.setToIndex(query.getFromIndex()); PendingSwop foundSwop = swopMgr.find(complement); if (foundSwop != null) return true; else return false; } /** * Check if another student already has created a pending swop with the current student as the swop partner. Used to prompt the current student to check partners's particulars * @param query A PendingSwop object containing courseCode, fromMatric, fromIndex, toMatric & toIndex. This was entered by the student. * @return True if student has a swop partner but pending swop does not match; False otherwise. */ public static boolean isDestination (PendingSwop query) { swopManager swopMgr = new swopManager(); PendingSwop destination = new PendingSwop(); destination.setToMatric(query.getFromMatric()); destination.setToIndex(query.getFromIndex()); PendingSwop foundSwop = swopMgr.findDestination(destination); if (foundSwop != null) return true; else return false; } /** * Checks if both students have their respective indexes. Otherwise, the pending swop would not be valid. * @param fromMatric Matriculation number of current student. * @param fromIndex Index of the current student (must be existing) * @param toMatric Matriculation number of the swop partner * @param toIndex Index that the current student wants to swop to * @return True if both students have their respective indexes; False otherwise. */ public static boolean bothStudentsHaveIndex (Student fromStudent, int fromIndex, Student toStudent, int toIndex) { Boolean fromStudentHasFromIndex = false; for (Index value : fromStudent.getIndexList()) { if(value.getIndex() == fromIndex) { fromStudentHasFromIndex = true; break; } } if (!fromStudentHasFromIndex) { System.out.println("You do not have that index. Please try again."); return false; } // Check if the destination (toStudent) has the toIndex Boolean toStudentHasToIndex = false; for (Index value : toStudent.getIndexList()) { if(value.getIndex() == toIndex) { toStudentHasToIndex = true; break; } } if (!toStudentHasToIndex) { System.out.println("Swap partner does not belong to that index. Please try again."); return false; } return true; } }
[ "noreply@github.com" ]
noreply@github.com
5bfff52fa5f610b2a6f09d2989e8853b05e5ae3a
b794f04673a5e5c3c15300b5644aa8b003a0840e
/Language/src/intelligence/instinct/Object.java
45f3b368cf7cf6143718348283c21ce2c6ff4ffd
[]
no_license
valery-labuzhsky/myprojects
e956395687cda19d405f782e22999d4f47579911
92322b7d00ab55b8906a77111b83cca8b3978628
refs/heads/master
2023-04-26T01:35:33.048640
2023-04-23T12:37:33
2023-04-23T12:37:33
62,510,855
0
0
null
2022-01-04T18:11:38
2016-07-03T18:56:01
Java
UTF-8
Java
false
false
248
java
package intelligence.instinct; /** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: </p> * @author unascribed * @version 1.0 */ public interface Object { public Action getAction(String name); }
[ "ynicorn@gmail.com" ]
ynicorn@gmail.com
867e79e8b57b5521e9bc87648ebd45eaa6c1862f
2a3f19a4a2b91d9d715378aadb0b1557997ffafe
/sources/com/ensighten/google/gson/stream/JsonWriter.java
98e9f0ac55ca6cb1b109aee76a1f8d9cbd1be2cf
[]
no_license
amelieko/McDonalds-java
ce5062f863f7f1cbe2677938a67db940c379d0a9
2fe00d672caaa7b97c4ff3acdb0e1678669b0300
refs/heads/master
2022-01-09T22:10:40.360630
2019-04-21T14:47:20
2019-04-21T14:47:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,793
java
package com.ensighten.google.gson.stream; import com.facebook.internal.ServerProtocol; import com.newrelic.agent.android.util.SafeJsonPrimitive; import java.io.Closeable; import java.io.Flushable; import java.io.IOException; import java.io.Writer; public class JsonWriter implements Closeable, Flushable { private static final String[] HTML_SAFE_REPLACEMENT_CHARS; private static final String[] REPLACEMENT_CHARS = new String[128]; private String deferredName; private boolean htmlSafe; private String indent; private boolean lenient; private final Writer out; private String separator = ":"; private boolean serializeNulls = true; private int[] stack = new int[32]; private int stackSize = 0; static { for (int i = 0; i <= 31; i++) { REPLACEMENT_CHARS[i] = String.format("\\u%04x", new Object[]{Integer.valueOf(i)}); } REPLACEMENT_CHARS[34] = "\\\""; REPLACEMENT_CHARS[92] = "\\\\"; REPLACEMENT_CHARS[9] = "\\t"; REPLACEMENT_CHARS[8] = "\\b"; REPLACEMENT_CHARS[10] = "\\n"; REPLACEMENT_CHARS[13] = "\\r"; REPLACEMENT_CHARS[12] = "\\f"; String[] strArr = (String[]) REPLACEMENT_CHARS.clone(); HTML_SAFE_REPLACEMENT_CHARS = strArr; strArr[60] = "\\u003c"; HTML_SAFE_REPLACEMENT_CHARS[62] = "\\u003e"; HTML_SAFE_REPLACEMENT_CHARS[38] = "\\u0026"; HTML_SAFE_REPLACEMENT_CHARS[61] = "\\u003d"; HTML_SAFE_REPLACEMENT_CHARS[39] = "\\u0027"; } public JsonWriter(Writer out) { push(6); if (out == null) { throw new NullPointerException("out == null"); } this.out = out; } public final void setIndent(String indent) { if (indent.length() == 0) { this.indent = null; this.separator = ":"; return; } this.indent = indent; this.separator = ": "; } public boolean isLenient() { return this.lenient; } public final void setLenient(boolean lenient) { this.lenient = lenient; } public final boolean isHtmlSafe() { return this.htmlSafe; } public final void setHtmlSafe(boolean htmlSafe) { this.htmlSafe = htmlSafe; } public final boolean getSerializeNulls() { return this.serializeNulls; } public final void setSerializeNulls(boolean serializeNulls) { this.serializeNulls = serializeNulls; } public JsonWriter beginArray() throws IOException { writeDeferredName(); return open(1, "["); } public JsonWriter endArray() throws IOException { return close(1, 2, "]"); } public JsonWriter beginObject() throws IOException { writeDeferredName(); return open(3, "{"); } public JsonWriter endObject() throws IOException { return close(3, 5, "}"); } private JsonWriter open(int empty, String openBracket) throws IOException { beforeValue(true); push(empty); this.out.write(openBracket); return this; } private JsonWriter close(int empty, int nonempty, String closeBracket) throws IOException { int peek = peek(); if (peek != nonempty && peek != empty) { throw new IllegalStateException("Nesting problem."); } else if (this.deferredName != null) { throw new IllegalStateException("Dangling name: " + this.deferredName); } else { this.stackSize--; if (peek == nonempty) { newline(); } this.out.write(closeBracket); return this; } } private void push(int newTop) { int[] iArr; if (this.stackSize == this.stack.length) { iArr = new int[(this.stackSize * 2)]; System.arraycopy(this.stack, 0, iArr, 0, this.stackSize); this.stack = iArr; } iArr = this.stack; int i = this.stackSize; this.stackSize = i + 1; iArr[i] = newTop; } private int peek() { if (this.stackSize != 0) { return this.stack[this.stackSize - 1]; } throw new IllegalStateException("JsonWriter is closed."); } private void replaceTop(int topOfStack) { this.stack[this.stackSize - 1] = topOfStack; } public JsonWriter name(String name) throws IOException { if (name == null) { throw new NullPointerException("name == null"); } else if (this.deferredName != null) { throw new IllegalStateException(); } else if (this.stackSize == 0) { throw new IllegalStateException("JsonWriter is closed."); } else { this.deferredName = name; return this; } } private void writeDeferredName() throws IOException { if (this.deferredName != null) { beforeName(); string(this.deferredName); this.deferredName = null; } } public JsonWriter value(String value) throws IOException { if (value == null) { return nullValue(); } writeDeferredName(); beforeValue(false); string(value); return this; } public JsonWriter nullValue() throws IOException { if (this.deferredName != null) { if (this.serializeNulls) { writeDeferredName(); } else { this.deferredName = null; return this; } } beforeValue(false); this.out.write(SafeJsonPrimitive.NULL_STRING); return this; } public JsonWriter value(boolean value) throws IOException { writeDeferredName(); beforeValue(false); this.out.write(value ? ServerProtocol.DIALOG_RETURN_SCOPES_TRUE : "false"); return this; } public JsonWriter value(double value) throws IOException { if (Double.isNaN(value) || Double.isInfinite(value)) { throw new IllegalArgumentException("Numeric values must be finite, but was " + value); } writeDeferredName(); beforeValue(false); this.out.append(Double.toString(value)); return this; } public JsonWriter value(long value) throws IOException { writeDeferredName(); beforeValue(false); this.out.write(Long.toString(value)); return this; } public JsonWriter value(Number value) throws IOException { if (value == null) { return nullValue(); } writeDeferredName(); String obj = value.toString(); if (this.lenient || !(obj.equals("-Infinity") || obj.equals("Infinity") || obj.equals("NaN"))) { beforeValue(false); this.out.append(obj); return this; } throw new IllegalArgumentException("Numeric values must be finite, but was " + value); } public void flush() throws IOException { if (this.stackSize == 0) { throw new IllegalStateException("JsonWriter is closed."); } this.out.flush(); } public void close() throws IOException { this.out.close(); int i = this.stackSize; if (i > 1 || (i == 1 && this.stack[i - 1] != 7)) { throw new IOException("Incomplete document"); } this.stackSize = 0; } /* JADX WARNING: Removed duplicated region for block: B:15:0x0030 */ private void string(java.lang.String r8) throws java.io.IOException { /* r7 = this; r1 = 0; r0 = r7.htmlSafe; if (r0 == 0) goto L_0x0025; L_0x0005: r0 = HTML_SAFE_REPLACEMENT_CHARS; L_0x0007: r2 = r7.out; r3 = "\""; r2.write(r3); r4 = r8.length(); r3 = r1; L_0x0013: if (r3 >= r4) goto L_0x0046; L_0x0015: r2 = r8.charAt(r3); r5 = 128; // 0x80 float:1.794E-43 double:6.32E-322; if (r2 >= r5) goto L_0x0028; L_0x001d: r2 = r0[r2]; if (r2 != 0) goto L_0x002e; L_0x0021: r2 = r3 + 1; r3 = r2; goto L_0x0013; L_0x0025: r0 = REPLACEMENT_CHARS; goto L_0x0007; L_0x0028: r5 = 8232; // 0x2028 float:1.1535E-41 double:4.067E-320; if (r2 != r5) goto L_0x003f; L_0x002c: r2 = "\\u2028"; L_0x002e: if (r1 >= r3) goto L_0x0037; L_0x0030: r5 = r7.out; r6 = r3 - r1; r5.write(r8, r1, r6); L_0x0037: r1 = r7.out; r1.write(r2); r1 = r3 + 1; goto L_0x0021; L_0x003f: r5 = 8233; // 0x2029 float:1.1537E-41 double:4.0676E-320; if (r2 != r5) goto L_0x0021; L_0x0043: r2 = "\\u2029"; goto L_0x002e; L_0x0046: if (r1 >= r4) goto L_0x004f; L_0x0048: r0 = r7.out; r2 = r4 - r1; r0.write(r8, r1, r2); L_0x004f: r0 = r7.out; r1 = "\""; r0.write(r1); return; */ throw new UnsupportedOperationException("Method not decompiled: com.ensighten.google.gson.stream.JsonWriter.string(java.lang.String):void"); } private void newline() throws IOException { if (this.indent != null) { this.out.write("\n"); int i = this.stackSize; for (int i2 = 1; i2 < i; i2++) { this.out.write(this.indent); } } } private void beforeName() throws IOException { int peek = peek(); if (peek == 5) { this.out.write(44); } else if (peek != 3) { throw new IllegalStateException("Nesting problem."); } newline(); replaceTop(4); } private void beforeValue(boolean root) throws IOException { switch (peek()) { case 1: replaceTop(2); newline(); return; case 2: this.out.append(','); newline(); return; case 4: this.out.append(this.separator); replaceTop(5); return; case 6: break; case 7: if (!this.lenient) { throw new IllegalStateException("JSON must have only one top-level value."); } break; default: throw new IllegalStateException("Nesting problem."); } if (this.lenient || root) { replaceTop(7); return; } throw new IllegalStateException("JSON must start with an array or an object."); } }
[ "makfc1234@gmail.com" ]
makfc1234@gmail.com
04987f0c25f7a377e88935c66944d8f06e850aab
ea505043c038fb5c4793ca04cbd67682557456c5
/library/core/src/main/java/com/google/android/exoplayer2/extractor/ts/TsExtractor.java
0c43e149f8d98bde42c00683d7b36bebd88f1f9f
[ "MIT" ]
permissive
sanjaysingh1990/radio
c0c34f271747d52f9f3de6ea41992e4a3f4bc1bf
507b28cce5b8663a31c4eb383aa568be67751c9e
refs/heads/master
2021-05-23T06:09:25.228840
2017-06-28T17:47:34
2017-06-28T17:47:34
94,840,860
0
0
MIT
2018-10-24T18:54:51
2017-06-20T02:24:48
Java
UTF-8
Java
false
false
20,963
java
/* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.android.exoplayer2.extractor.ts; import android.support.annotation.IntDef; import android.util.SparseArray; import android.util.SparseBooleanArray; import android.util.SparseIntArray; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.extractor.Extractor; import com.google.android.exoplayer2.extractor.ExtractorInput; import com.google.android.exoplayer2.extractor.ExtractorOutput; import com.google.android.exoplayer2.extractor.ExtractorsFactory; import com.google.android.exoplayer2.extractor.PositionHolder; import com.google.android.exoplayer2.extractor.SeekMap; import com.google.android.exoplayer2.extractor.TrackOutput; import com.google.android.exoplayer2.extractor.ts.DefaultTsPayloadReaderFactory.Flags; import com.google.android.exoplayer2.extractor.ts.TsPayloadReader.DvbSubtitleInfo; import com.google.android.exoplayer2.extractor.ts.TsPayloadReader.EsInfo; import com.google.android.exoplayer2.extractor.ts.TsPayloadReader.TrackIdGenerator; import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.ParsableBitArray; import com.google.android.exoplayer2.util.ParsableByteArray; import com.google.android.exoplayer2.util.TimestampAdjuster; import com.google.android.exoplayer2.util.Util; import java.io.IOException; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * Facilitates the extraction of data from the MPEG-2 TS container format. */ public final class TsExtractor implements Extractor { /** * Factory for {@link TsExtractor} instances. */ public static final ExtractorsFactory FACTORY = new ExtractorsFactory() { @Override public Extractor[] createExtractors() { return new Extractor[] {new TsExtractor()}; } }; /** * Modes for the extractor. */ @Retention(RetentionPolicy.SOURCE) @IntDef({MODE_MULTI_PMT, MODE_SINGLE_PMT, MODE_HLS}) public @interface Mode {} /** * Behave as defined in ISO/IEC 13818-1. */ public static final int MODE_MULTI_PMT = 0; /** * Assume only one PMT will be contained in the stream, even if more are declared by the PAT. */ public static final int MODE_SINGLE_PMT = 1; /** * Enable single PMT mode, map {@link TrackOutput}s by their type (instead of PID) and ignore * continuity counters. */ public static final int MODE_HLS = 2; public static final int TS_STREAM_TYPE_MPA = 0x03; public static final int TS_STREAM_TYPE_MPA_LSF = 0x04; public static final int TS_STREAM_TYPE_AAC = 0x0F; public static final int TS_STREAM_TYPE_AC3 = 0x81; public static final int TS_STREAM_TYPE_DTS = 0x8A; public static final int TS_STREAM_TYPE_HDMV_DTS = 0x82; public static final int TS_STREAM_TYPE_E_AC3 = 0x87; public static final int TS_STREAM_TYPE_H262 = 0x02; public static final int TS_STREAM_TYPE_H264 = 0x1B; public static final int TS_STREAM_TYPE_H265 = 0x24; public static final int TS_STREAM_TYPE_ID3 = 0x15; public static final int TS_STREAM_TYPE_SPLICE_INFO = 0x86; public static final int TS_STREAM_TYPE_DVBSUBS = 0x59; private static final int TS_PACKET_SIZE = 188; private static final int TS_SYNC_BYTE = 0x47; // First byte of each TS packet. private static final int TS_PAT_PID = 0; private static final int MAX_PID_PLUS_ONE = 0x2000; private static final long AC3_FORMAT_IDENTIFIER = Util.getIntegerCodeForString("AC-3"); private static final long E_AC3_FORMAT_IDENTIFIER = Util.getIntegerCodeForString("EAC3"); private static final long HEVC_FORMAT_IDENTIFIER = Util.getIntegerCodeForString("HEVC"); private static final int BUFFER_PACKET_COUNT = 5; // Should be at least 2 private static final int BUFFER_SIZE = TS_PACKET_SIZE * BUFFER_PACKET_COUNT; @Mode private final int mode; private final List<TimestampAdjuster> timestampAdjusters; private final ParsableByteArray tsPacketBuffer; private final ParsableBitArray tsScratch; private final SparseIntArray continuityCounters; private final TsPayloadReader.Factory payloadReaderFactory; private final SparseArray<TsPayloadReader> tsPayloadReaders; // Indexed by pid private final SparseBooleanArray trackIds; // Accessed only by the loading thread. private ExtractorOutput output; private int remainingPmts; private boolean tracksEnded; private TsPayloadReader id3Reader; public TsExtractor() { this(0); } /** * @param defaultTsPayloadReaderFlags A combination of {@link DefaultTsPayloadReaderFactory} * {@code FLAG_*} values that control the behavior of the payload readers. */ public TsExtractor(@Flags int defaultTsPayloadReaderFlags) { this(MODE_SINGLE_PMT, defaultTsPayloadReaderFlags); } /** * @param mode Mode for the extractor. One of {@link #MODE_MULTI_PMT}, {@link #MODE_SINGLE_PMT} * and {@link #MODE_HLS}. * @param defaultTsPayloadReaderFlags A combination of {@link DefaultTsPayloadReaderFactory} * {@code FLAG_*} values that control the behavior of the payload readers. */ public TsExtractor(@Mode int mode, @Flags int defaultTsPayloadReaderFlags) { this(mode, new TimestampAdjuster(0), new DefaultTsPayloadReaderFactory(defaultTsPayloadReaderFlags)); } /** * @param mode Mode for the extractor. One of {@link #MODE_MULTI_PMT}, {@link #MODE_SINGLE_PMT} * and {@link #MODE_HLS}. * @param timestampAdjuster A timestamp adjuster for offsetting and scaling sample timestamps. * @param payloadReaderFactory Factory for injecting a custom set of payload readers. */ public TsExtractor(@Mode int mode, TimestampAdjuster timestampAdjuster, TsPayloadReader.Factory payloadReaderFactory) { this.payloadReaderFactory = Assertions.checkNotNull(payloadReaderFactory); this.mode = mode; if (mode == MODE_SINGLE_PMT || mode == MODE_HLS) { timestampAdjusters = Collections.singletonList(timestampAdjuster); } else { timestampAdjusters = new ArrayList<>(); timestampAdjusters.add(timestampAdjuster); } tsPacketBuffer = new ParsableByteArray(BUFFER_SIZE); tsScratch = new ParsableBitArray(new byte[3]); trackIds = new SparseBooleanArray(); tsPayloadReaders = new SparseArray<>(); continuityCounters = new SparseIntArray(); resetPayloadReaders(); } // Extractor implementation. @Override public boolean sniff(ExtractorInput input) throws IOException, InterruptedException { byte[] buffer = tsPacketBuffer.data; input.peekFully(buffer, 0, BUFFER_SIZE); for (int j = 0; j < TS_PACKET_SIZE; j++) { for (int i = 0; true; i++) { if (i == BUFFER_PACKET_COUNT) { input.skipFully(j); return true; } if (buffer[j + i * TS_PACKET_SIZE] != TS_SYNC_BYTE) { break; } } } return false; } @Override public void init(ExtractorOutput output) { this.output = output; output.seekMap(new SeekMap.Unseekable(C.TIME_UNSET)); } @Override public void seek(long position, long timeUs) { int timestampAdjustersCount = timestampAdjusters.size(); for (int i = 0; i < timestampAdjustersCount; i++) { timestampAdjusters.get(i).reset(); } tsPacketBuffer.reset(); continuityCounters.clear(); // Elementary stream readers' state should be cleared to get consistent behaviours when seeking. resetPayloadReaders(); } @Override public void release() { // Do nothing } @Override public int read(ExtractorInput input, PositionHolder seekPosition) throws IOException, InterruptedException { byte[] data = tsPacketBuffer.data; // Shift bytes to the start of the buffer if there isn't enough space left at the end if (BUFFER_SIZE - tsPacketBuffer.getPosition() < TS_PACKET_SIZE) { int bytesLeft = tsPacketBuffer.bytesLeft(); if (bytesLeft > 0) { System.arraycopy(data, tsPacketBuffer.getPosition(), data, 0, bytesLeft); } tsPacketBuffer.reset(data, bytesLeft); } // Read more bytes until there is at least one packet size while (tsPacketBuffer.bytesLeft() < TS_PACKET_SIZE) { int limit = tsPacketBuffer.limit(); int read = input.read(data, limit, BUFFER_SIZE - limit); if (read == C.RESULT_END_OF_INPUT) { return RESULT_END_OF_INPUT; } tsPacketBuffer.setLimit(limit + read); } // Note: see ISO/IEC 13818-1, section 2.4.3.2 for detailed information on the format of // the header. final int limit = tsPacketBuffer.limit(); int position = tsPacketBuffer.getPosition(); while (position < limit && data[position] != TS_SYNC_BYTE) { position++; } tsPacketBuffer.setPosition(position); int endOfPacket = position + TS_PACKET_SIZE; if (endOfPacket > limit) { return RESULT_CONTINUE; } tsPacketBuffer.skipBytes(1); tsPacketBuffer.readBytes(tsScratch, 3); if (tsScratch.readBit()) { // transport_error_indicator // There are uncorrectable errors in this packet. tsPacketBuffer.setPosition(endOfPacket); return RESULT_CONTINUE; } boolean payloadUnitStartIndicator = tsScratch.readBit(); tsScratch.skipBits(1); // transport_priority int pid = tsScratch.readBits(13); tsScratch.skipBits(2); // transport_scrambling_control boolean adaptationFieldExists = tsScratch.readBit(); boolean payloadExists = tsScratch.readBit(); // Discontinuity check. boolean discontinuityFound = false; int continuityCounter = tsScratch.readBits(4); if (mode != MODE_HLS) { int previousCounter = continuityCounters.get(pid, continuityCounter - 1); continuityCounters.put(pid, continuityCounter); if (previousCounter == continuityCounter) { if (payloadExists) { // Duplicate packet found. tsPacketBuffer.setPosition(endOfPacket); return RESULT_CONTINUE; } } else if (continuityCounter != (previousCounter + 1) % 16) { discontinuityFound = true; } } // Skip the adaptation field. if (adaptationFieldExists) { int adaptationFieldLength = tsPacketBuffer.readUnsignedByte(); tsPacketBuffer.skipBytes(adaptationFieldLength); } // Read the payload. if (payloadExists) { TsPayloadReader payloadReader = tsPayloadReaders.get(pid); if (payloadReader != null) { if (discontinuityFound) { payloadReader.seek(); } tsPacketBuffer.setLimit(endOfPacket); payloadReader.consume(tsPacketBuffer, payloadUnitStartIndicator); Assertions.checkState(tsPacketBuffer.getPosition() <= endOfPacket); tsPacketBuffer.setLimit(limit); } } tsPacketBuffer.setPosition(endOfPacket); return RESULT_CONTINUE; } // Internals. private void resetPayloadReaders() { trackIds.clear(); tsPayloadReaders.clear(); SparseArray<TsPayloadReader> initialPayloadReaders = payloadReaderFactory.createInitialPayloadReaders(); int initialPayloadReadersSize = initialPayloadReaders.size(); for (int i = 0; i < initialPayloadReadersSize; i++) { tsPayloadReaders.put(initialPayloadReaders.keyAt(i), initialPayloadReaders.valueAt(i)); } tsPayloadReaders.put(TS_PAT_PID, new SectionReader(new PatReader())); id3Reader = null; } /** * Parses Program Association Table data. */ private class PatReader implements SectionPayloadReader { private final ParsableBitArray patScratch; public PatReader() { patScratch = new ParsableBitArray(new byte[4]); } @Override public void init(TimestampAdjuster timestampAdjuster, ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) { // Do nothing. } @Override public void consume(ParsableByteArray sectionData) { int tableId = sectionData.readUnsignedByte(); if (tableId != 0x00 /* program_association_section */) { // See ISO/IEC 13818-1, section 2.4.4.4 for more information on table id assignment. return; } // section_syntax_indicator(1), '0'(1), reserved(2), section_length(12), // transport_stream_id (16), reserved (2), version_number (5), current_next_indicator (1), // section_number (8), last_section_number (8) sectionData.skipBytes(7); int programCount = sectionData.bytesLeft() / 4; for (int i = 0; i < programCount; i++) { sectionData.readBytes(patScratch, 4); int programNumber = patScratch.readBits(16); patScratch.skipBits(3); // reserved (3) if (programNumber == 0) { patScratch.skipBits(13); // network_PID (13) } else { int pid = patScratch.readBits(13); tsPayloadReaders.put(pid, new SectionReader(new PmtReader(pid))); remainingPmts++; } } if (mode != MODE_HLS) { tsPayloadReaders.remove(TS_PAT_PID); } } } /** * Parses Program Map Table. */ private class PmtReader implements SectionPayloadReader { private static final int TS_PMT_DESC_REGISTRATION = 0x05; private static final int TS_PMT_DESC_ISO639_LANG = 0x0A; private static final int TS_PMT_DESC_AC3 = 0x6A; private static final int TS_PMT_DESC_EAC3 = 0x7A; private static final int TS_PMT_DESC_DTS = 0x7B; private static final int TS_PMT_DESC_DVBSUBS = 0x59; private final ParsableBitArray pmtScratch; private final int pid; public PmtReader(int pid) { pmtScratch = new ParsableBitArray(new byte[5]); this.pid = pid; } @Override public void init(TimestampAdjuster timestampAdjuster, ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) { // Do nothing. } @Override public void consume(ParsableByteArray sectionData) { int tableId = sectionData.readUnsignedByte(); if (tableId != 0x02 /* TS_program_map_section */) { // See ISO/IEC 13818-1, section 2.4.4.4 for more information on table id assignment. return; } // TimestampAdjuster assignment. TimestampAdjuster timestampAdjuster; if (mode == MODE_SINGLE_PMT || mode == MODE_HLS || remainingPmts == 1) { timestampAdjuster = timestampAdjusters.get(0); } else { timestampAdjuster = new TimestampAdjuster( timestampAdjusters.get(0).getFirstSampleTimestampUs()); timestampAdjusters.add(timestampAdjuster); } // section_syntax_indicator(1), '0'(1), reserved(2), section_length(12) sectionData.skipBytes(2); int programNumber = sectionData.readUnsignedShort(); // reserved (2), version_number (5), current_next_indicator (1), section_number (8), // last_section_number (8), reserved (3), PCR_PID (13) sectionData.skipBytes(5); // Read program_info_length. sectionData.readBytes(pmtScratch, 2); pmtScratch.skipBits(4); int programInfoLength = pmtScratch.readBits(12); // Skip the descriptors. sectionData.skipBytes(programInfoLength); if (mode == MODE_HLS && id3Reader == null) { // Setup an ID3 track regardless of whether there's a corresponding entry, in case one // appears intermittently during playback. See [Internal: b/20261500]. EsInfo dummyEsInfo = new EsInfo(TS_STREAM_TYPE_ID3, null, null, new byte[0]); id3Reader = payloadReaderFactory.createPayloadReader(TS_STREAM_TYPE_ID3, dummyEsInfo); id3Reader.init(timestampAdjuster, output, new TrackIdGenerator(programNumber, TS_STREAM_TYPE_ID3, MAX_PID_PLUS_ONE)); } int remainingEntriesLength = sectionData.bytesLeft(); while (remainingEntriesLength > 0) { sectionData.readBytes(pmtScratch, 5); int streamType = pmtScratch.readBits(8); pmtScratch.skipBits(3); // reserved int elementaryPid = pmtScratch.readBits(13); pmtScratch.skipBits(4); // reserved int esInfoLength = pmtScratch.readBits(12); // ES_info_length. EsInfo esInfo = readEsInfo(sectionData, esInfoLength); if (streamType == 0x06) { streamType = esInfo.streamType; } remainingEntriesLength -= esInfoLength + 5; int trackId = mode == MODE_HLS ? streamType : elementaryPid; if (trackIds.get(trackId)) { continue; } trackIds.put(trackId, true); TsPayloadReader reader; if (mode == MODE_HLS && streamType == TS_STREAM_TYPE_ID3) { reader = id3Reader; } else { reader = payloadReaderFactory.createPayloadReader(streamType, esInfo); if (reader != null) { reader.init(timestampAdjuster, output, new TrackIdGenerator(programNumber, trackId, MAX_PID_PLUS_ONE)); } } if (reader != null) { tsPayloadReaders.put(elementaryPid, reader); } } if (mode == MODE_HLS) { if (!tracksEnded) { output.endTracks(); remainingPmts = 0; tracksEnded = true; } } else { tsPayloadReaders.remove(pid); remainingPmts = mode == MODE_SINGLE_PMT ? 0 : remainingPmts - 1; if (remainingPmts == 0) { output.endTracks(); tracksEnded = true; } } } /** * Returns the stream info read from the available descriptors. Sets {@code data}'s position to * the end of the descriptors. * * @param data A buffer with its position set to the start of the first descriptor. * @param length The length of descriptors to read from the current position in {@code data}. * @return The stream info read from the available descriptors. */ private EsInfo readEsInfo(ParsableByteArray data, int length) { int descriptorsStartPosition = data.getPosition(); int descriptorsEndPosition = descriptorsStartPosition + length; int streamType = -1; String language = null; List<DvbSubtitleInfo> dvbSubtitleInfos = null; while (data.getPosition() < descriptorsEndPosition) { int descriptorTag = data.readUnsignedByte(); int descriptorLength = data.readUnsignedByte(); int positionOfNextDescriptor = data.getPosition() + descriptorLength; if (descriptorTag == TS_PMT_DESC_REGISTRATION) { // registration_descriptor long formatIdentifier = data.readUnsignedInt(); if (formatIdentifier == AC3_FORMAT_IDENTIFIER) { streamType = TS_STREAM_TYPE_AC3; } else if (formatIdentifier == E_AC3_FORMAT_IDENTIFIER) { streamType = TS_STREAM_TYPE_E_AC3; } else if (formatIdentifier == HEVC_FORMAT_IDENTIFIER) { streamType = TS_STREAM_TYPE_H265; } } else if (descriptorTag == TS_PMT_DESC_AC3) { // AC-3_descriptor in DVB (ETSI EN 300 468) streamType = TS_STREAM_TYPE_AC3; } else if (descriptorTag == TS_PMT_DESC_EAC3) { // enhanced_AC-3_descriptor streamType = TS_STREAM_TYPE_E_AC3; } else if (descriptorTag == TS_PMT_DESC_DTS) { // DTS_descriptor streamType = TS_STREAM_TYPE_DTS; } else if (descriptorTag == TS_PMT_DESC_ISO639_LANG) { language = data.readString(3).trim(); // Audio type is ignored. } else if (descriptorTag == TS_PMT_DESC_DVBSUBS) { streamType = TS_STREAM_TYPE_DVBSUBS; dvbSubtitleInfos = new ArrayList<>(); while (data.getPosition() < positionOfNextDescriptor) { String dvbLanguage = data.readString(3).trim(); int dvbSubtitlingType = data.readUnsignedByte(); byte[] initializationData = new byte[4]; data.readBytes(initializationData, 0, 4); dvbSubtitleInfos.add(new DvbSubtitleInfo(dvbLanguage, dvbSubtitlingType, initializationData)); } } // Skip unused bytes of current descriptor. data.skipBytes(positionOfNextDescriptor - data.getPosition()); } data.setPosition(descriptorsEndPosition); return new EsInfo(streamType, language, dvbSubtitleInfos, Arrays.copyOfRange(data.data, descriptorsStartPosition, descriptorsEndPosition)); } } }
[ "bisht.sanjaysingh97@gmail.com" ]
bisht.sanjaysingh97@gmail.com
fb795dd5343ed00d2dacc6c1d17b2b0fdd2fa320
a9a794e21912b13e5bfc86b2872ed3c6559ce7ba
/app/src/main/java/com/rs/timepass/Backend/ChangeProfileAPI.java
f43aba1164bb3f506f665324ecb5820c90399fa6
[]
no_license
manishesprit/ChatApp
d10805378dbeb7621f1ab715ef93beab674f846d
8278a9b82a800755d25edb12d7711466429d48b0
refs/heads/master
2020-02-26T17:27:08.412496
2016-11-15T04:50:23
2016-11-15T04:50:23
58,038,635
0
0
null
null
null
null
UTF-8
Java
false
false
6,331
java
package com.rs.timepass.Backend; import android.app.Activity; import android.content.Context; import android.net.Uri; import com.android.volley.AuthFailureError; import com.android.volley.NetworkError; import com.android.volley.NoConnectionError; import com.android.volley.ParseError; import com.android.volley.Response; import com.android.volley.ServerError; import com.android.volley.TimeoutError; import com.android.volley.VolleyError; import com.rs.timepass.Adapter.Adapter; import com.rs.timepass.Bean.UserBean; import com.rs.timepass.R; import com.rs.timepass.Utils.Config; import com.rs.timepass.Utils.Log; import com.rs.timepass.Utils.Pref; import org.json.JSONObject; import java.util.HashMap; public class ChangeProfileAPI { private Context context; private HashMap<String, String> mParams = null; private Adapter mAdapter = null; private ResponseListener responseListener; private UserBean userBean; public ChangeProfileAPI(Context context, ResponseListener responseListener, UserBean userBean) { this.context = context; this.mParams = new HashMap<String, String>(); Config.API_CHANGE_PROFILE = Config.HOST + Config.API_CHANGE_PROFILE_JSON + Config.userid + "=" + Pref.getValue(context, Config.PREF_USER_ID, 0) + "&" + Config.name + "=" + userBean.name + "&" + Config.mobile + "=" + userBean.mobile + "&" + Config.city + "=" + userBean.city + "&" + Config.status + "=" + userBean.status; this.userBean = userBean; Log.print(":::: API_CHANGE_PROFILE::::" + Config.API_CHANGE_PROFILE); this.responseListener = responseListener; } public void execute() { this.mAdapter = new Adapter(this.context); this.mAdapter.doGet(Config.TAG_CHANGE_PROFILE, Config.API_CHANGE_PROFILE, mParams, new APIResponseListener() { @Override public void onResponse(String response) { mParams = null; // Parse Response and Proceed Further parse(response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { mParams = null; if (error instanceof TimeoutError || error instanceof NoConnectionError) { if (!((Activity) context).isFinishing()) { // AlertDailogView // .showAlert( // context, // context.getResources() // .getString( // R.string.connectionErrorMessage), // context.getResources() // .getString( // R.string.tryAgain), // false).show(); } } else if (error instanceof AuthFailureError) { // } else if (error instanceof ServerError) { // } else if (error instanceof NetworkError) { // } else if (error instanceof ParseError) { // } // Inform Caller that the API call is failed responseListener.onResponce(Config.TAG_CHANGE_PROFILE, Config.API_FAIL, context.getResources() .getString( R.string.connectionErrorMessage)); } }); } /* * Parse the response and prepare for callback */ private void parse(String response) { int code = 0; String mesg = null; JSONObject jsonObject = null; try { jsonObject = new JSONObject(response); code = jsonObject.getInt(Config.code); mesg = jsonObject.getString(Config.message); if (code == 0) { Pref.setValue(context, Config.PREF_MOBILE, Uri.decode(userBean.mobile.toString().trim())); Pref.setValue(context, Config.PREF_NAME, Uri.decode(userBean.name.toString().trim())); Pref.setValue(context, Config.PREF_CITY, Uri.decode(userBean.city.toString().trim())); Pref.setValue(context, Config.PREF_STATUS, Uri.decode(userBean.status)); } } catch (Exception e) { code = -1; mesg = "Exception :: " + this.getClass() + " :: parse() :: " + e.getLocalizedMessage(); Log.error(this.getClass() + " :: Exception :: ", e); Log.print(this.getClass() + " :: Exception :: ", e); } doCallBack(code, mesg, userBean); /** release variables */ response = null; jsonObject = null; } /* * Send control back to the caller which includes * * Status: Successful or Failure Message: Its an Object, if required */ private void doCallBack(int code, String mesg, UserBean userBean) { try { if (code == 0) { responseListener.onResponce(Config.TAG_CHANGE_PROFILE, Config.API_SUCCESS, userBean); } else if (code > 0) { responseListener.onResponce(Config.TAG_CHANGE_PROFILE, Config.API_FAIL, mesg); } else if (code < 0) { responseListener.onResponce(Config.TAG_CHANGE_PROFILE, Config.API_FAIL, mesg); } } catch (Exception e) { Log.error(this.getClass() + " :: Exception :: ", e); Log.print(this.getClass() + " :: Exception :: ", e); } } /* * Cancel API Request */ public void doCancel() { if (mAdapter != null) { mAdapter.doCancel(Config.TAG_CHANGE_PROFILE); } } }
[ "manish.esprit@hmail.com" ]
manish.esprit@hmail.com
05de8166681c67d891587c24e6c35ac181dc8e08
62240ec5ccfdf097d72759eb6e2101318412c9e4
/AVL/src/arbolBB/Vistaa.java
b2e60d877bc4d1a46da412798faa6b9dc42652ee
[]
no_license
DannyMORAGA/ISR
70d146830dc4f21f4a6a0fe5910b13594c276065
4a2495ba2bf55115c591a0ad635a091b26a38134
refs/heads/master
2020-04-22T07:42:49.509724
2019-05-23T05:04:35
2019-05-23T05:04:35
170,211,072
0
0
null
null
null
null
UTF-8
Java
false
false
15,092
java
/* JEHU DANIEL MORAGA GALVEZ 0901-17-3945 22/05/2019 Programa de arbols AVL con balanceo. */ package arbolBB; import java.awt.BorderLayout; import java.awt.Image; import java.awt.Rectangle; import java.awt.Toolkit; import javax.swing.JInternalFrame; import javax.swing.JLayeredPane; import javax.swing.JOptionPane; /** * * @author */ public class Vistaa extends javax.swing.JFrame { private PROCESAVL Arbo = new PROCESAVL(); /** * Crea una funcion vista */ public Vistaa() { initComponents(); this.inicializar(false); } private void inicializar(boolean enable) { this.InOrden.setEnabled(enable); this.PostOrden.setEnabled(enable); this.PreOrden.setEnabled(enable); } /** * 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() { jPanel2 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); impresion = new javax.swing.JTextArea(); jDesktopPane1 = new javax.swing.JDesktopPane(); jInternalFrame2 = new javax.swing.JInternalFrame(); botonInsertar = new javax.swing.JButton(); InOrden = new javax.swing.JButton(); PreOrden = new javax.swing.JButton(); PostOrden = new javax.swing.JButton(); txtdato = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); jPanel2.setBackground(new java.awt.Color(255, 255, 255)); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Panel de Pruebas", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 10))); // NOI18N jPanel2.setOpaque(false); jScrollPane1.setOpaque(false); impresion.setEditable(false); impresion.setColumns(20); impresion.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N impresion.setRows(5); impresion.setBorder(javax.swing.BorderFactory.createTitledBorder("Resultados de operaciones")); impresion.setOpaque(false); jScrollPane1.setViewportView(impresion); jDesktopPane1.setOpaque(false); jInternalFrame2.setIconifiable(true); jInternalFrame2.setMaximizable(true); jInternalFrame2.setResizable(true); jInternalFrame2.setEnabled(false); jInternalFrame2.setFocusCycleRoot(false); jInternalFrame2.setVisible(true); javax.swing.GroupLayout jInternalFrame2Layout = new javax.swing.GroupLayout(jInternalFrame2.getContentPane()); jInternalFrame2.getContentPane().setLayout(jInternalFrame2Layout); jInternalFrame2Layout.setHorizontalGroup( jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 584, Short.MAX_VALUE) ); jInternalFrame2Layout.setVerticalGroup( jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 290, Short.MAX_VALUE) ); jDesktopPane1.add(jInternalFrame2); jInternalFrame2.setBounds(10, 10, 600, 320); botonInsertar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N botonInsertar.setText("Insertar"); botonInsertar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { botonInsertarActionPerformed(evt); } }); InOrden.setFont(new java.awt.Font("Tahoma", 3, 11)); // NOI18N InOrden.setText("InOrden"); InOrden.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { InOrdenActionPerformed(evt); } }); PreOrden.setFont(new java.awt.Font("Tahoma", 3, 11)); // NOI18N PreOrden.setText("PreOrden"); PreOrden.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { PreOrdenActionPerformed(evt); } }); PostOrden.setFont(new java.awt.Font("Tahoma", 3, 11)); // NOI18N PostOrden.setText("PostOrden"); PostOrden.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { PostOrdenActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap(24, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(InOrden, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(4, 4, 4) .addComponent(PreOrden) .addGap(4, 4, 4)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(txtdato, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(botonInsertar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(PostOrden, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 325, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jDesktopPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 616, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 1, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(jDesktopPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 327, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(botonInsertar, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtdato, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(InOrden, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(PreOrden, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(PostOrden, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(20, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void botonInsertarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonInsertarActionPerformed //Se coloca en el boton las instrucciones de insertar por medio de un try y catch para verificar que se haga bien el proceso. try{ if (this.Arbo.insertar(Integer.parseInt(txtdato.getText()))) { this.inicializar(true); complementos(); JOptionPane.showMessageDialog(null, "El dato fue insertado correctamente", " ...", 1); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "No se pudo insertar el dato", "Intenta de nuevo...", 0); } }//GEN-LAST:event_botonInsertarActionPerformed private void InOrdenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_InOrdenActionPerformed // Pone las las instrucciones para mostrar el ordenamiento de INORDEN para el arbol. String recorrido = null; recorrido = this.Arbo.inOrden(); this.impresion.setText(""); this.impresion.setText(recorrido); }//GEN-LAST:event_InOrdenActionPerformed private void PreOrdenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PreOrdenActionPerformed // Pone las las instrucciones para mostrar el ordenamiento de PREORDEN para el arbol. String recorrido = null; recorrido = this.Arbo.preOrden(); this.impresion.setText(""); this.impresion.setText(recorrido); }//GEN-LAST:event_PreOrdenActionPerformed private void PostOrdenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PostOrdenActionPerformed // Pone las las instrucciones para mostrar el ordenamiento de POSTORDEN para el arbol. String recorrido = null; recorrido = this.Arbo.postOrden(); this.impresion.setText(""); this.impresion.setText(recorrido); }//GEN-LAST:event_PostOrdenActionPerformed public void complementos(){//Se llama a la funcion de repintarArbol el cual crea la manera grafica del arbol this.repintarArbol(); } private void repintarArbol() { //PERMITE DIBUJAR EL ARBOL de manera grafica. this.jDesktopPane1.removeAll(); Rectangle tamaño = this.jInternalFrame2.getBounds(); this.jInternalFrame2 = null; this.jInternalFrame2 = new JInternalFrame("Representación gráfica", true); this.jDesktopPane1.add(this.jInternalFrame2, JLayeredPane.DEFAULT_LAYER); this.jInternalFrame2.setVisible(true); this.jInternalFrame2.setBounds(tamaño); this.jInternalFrame2.setEnabled(false); this.jInternalFrame2.add(this.Arbo.getDibujo(), BorderLayout.CENTER); } /** * @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(Vistaa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Vistaa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Vistaa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Vistaa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Vistaa().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton InOrden; private javax.swing.JButton PostOrden; private javax.swing.JButton PreOrden; private javax.swing.JButton botonInsertar; private javax.swing.JTextArea impresion; private javax.swing.JDesktopPane jDesktopPane1; private javax.swing.JInternalFrame jInternalFrame2; private javax.swing.JPanel jPanel2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextField txtdato; // End of variables declaration//GEN-END:variables }
[ "danielmoraga6@gmail.com" ]
danielmoraga6@gmail.com
fcae8e638e50ce5c5d3759a9852523e8333930a7
604a8d54215a238d5bc38ffef50e057075bb6b98
/Duck/src/FlyNoWay.java
75c061a189cfe4a4695ca91d7b02b63d077eecbb
[]
no_license
f33losopher/HaterRater
b8f6b3638ac9156c08d55a8021d0816aec577314
9640c9deb103c4627e426cf000cd24d78f99ad00
refs/heads/master
2021-01-10T19:33:17.050652
2011-10-02T02:21:48
2011-10-02T02:21:48
2,364,804
0
1
null
null
null
null
UTF-8
Java
false
false
111
java
public class FlyNoWay implements FlyBehavior { public void fly() { System.out.println("I can't fly"); } }
[ "f33losopher@gmail.com" ]
f33losopher@gmail.com
810e293a3fe1a0aed8dab5e5f0e7c32f709f32c2
18523f9bf47346b3e138e0381467d36e00ea2b8b
/src/MyBot.java
ddc4e79152a7ff092b23b3e059ced8e6305dae87
[]
no_license
necalai/checker_bot
d3fe7832837eb25c4b83defb8f617e6fe937ce5e
62a1f01c52ff6e5549afcf59cf12e1c16518cc87
refs/heads/master
2020-03-23T22:06:29.628832
2018-07-24T12:07:24
2018-07-24T12:07:24
142,153,513
0
0
null
null
null
null
UTF-8
Java
false
false
1,263
java
import org.telegram.abilitybots.api.bot.AbilityBot; import org.telegram.abilitybots.api.db.DBContext; import org.telegram.abilitybots.api.objects.Ability; import org.telegram.abilitybots.api.objects.Locality; import org.telegram.abilitybots.api.objects.Privacy; import org.telegram.telegrambots.bots.DefaultBotOptions; public class MyBot extends AbilityBot { public MyBot(String botToken, String botUsername, DefaultBotOptions botOptions) { super(botToken, botUsername, botOptions); } public MyBot(String botToken, String botUsername, DBContext db, DefaultBotOptions botOptions) { super(botToken, botUsername, db, botOptions); } public MyBot(String botToken, String botUsername) { super(botToken, botUsername); } public MyBot(String botToken, String botUsername, DBContext db) { super(botToken, botUsername, db); } @Override public int creatorId() { return 0; } public Ability hello() { return Ability.builder() .name("test") .info("hello bot") .locality(Locality.ALL) .privacy(Privacy.PUBLIC) .action(ctx -> silent.send("hello!", ctx.chatId())) .build(); } }
[ "nivavilin@gmail.com" ]
nivavilin@gmail.com
f2af8ea2be07699fb42be082546478900d7ad437
da049f1efd756eaac6f40a4f6a9c4bdca7e16a06
/PrizeMusic/PrizeOnLineMusic/UImageLoad_DownLoad/src/com/prize/app/database/dao/DownLoadDataDAO.java
b6abfb8a8dac2728c107c8824ca07efa06c9d41b
[]
no_license
evilhawk00/AppGroup
c22e693320039f4dc7b384976a513f94be5bccbe
a22714c1e6b9f5c157bebb2c5dbc96b854ba949a
refs/heads/master
2022-01-11T18:04:27.481162
2018-04-19T03:02:26
2018-04-19T03:02:26
420,370,518
1
0
null
null
null
null
UTF-8
Java
false
false
3,734
java
package com.prize.app.database.dao; import java.util.ArrayList; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.text.TextUtils; import com.prize.app.database.DownLoadDataTable; import com.prize.app.database.DownloadGameTable; import com.prize.app.database.PrizeDatabaseHelper; import com.prize.app.database.beans.DownLoadDataBean; import com.prize.app.net.datasource.base.AppsItemBean; /** * 类描述:下载列表操作管理工具 * * @author huanglingjun * @version 版本 */ public class DownLoadDataDAO { private static SQLiteDatabase database; /** 游戏数据库表名 */ public static String mColunmGameItemName[] = new String[] { DownLoadDataTable.DOWNLOADTYPE, DownLoadDataTable.PACKAGENAME}; private static DownLoadDataDAO instance; public static DownLoadDataDAO getInstance() { if (null == instance) { instance = new DownLoadDataDAO(); } return instance; } /** 插入列表 */ public boolean insertApp(String downloadType, String packageName,String timeDelta) { ContentValues contentValues = new ContentValues(); contentValues.put(DownLoadDataTable.DOWNLOADTYPE, downloadType); contentValues.put(DownLoadDataTable.PACKAGENAME, packageName); contentValues.put(DownLoadDataTable.TIMEDALTA, timeDelta); PrizeDatabaseHelper.insert(DownLoadDataTable.TABLE_NAME_DOWNLOAD_DATA, null, contentValues); return true; } public ContentValues getContentValues(String downloadType, String packageName,String timeDelta) { ContentValues contentValues = new ContentValues(); contentValues.put(DownLoadDataTable.DOWNLOADTYPE, downloadType); contentValues.put(DownLoadDataTable.PACKAGENAME, packageName); contentValues.put(DownLoadDataTable.TIMEDALTA, timeDelta); return contentValues; } /** 插入所有数据到列表 */ public boolean replace(String downloadType, String packageName,String timeDelta) { ContentValues contentValues = getContentValues(downloadType,packageName,timeDelta); PrizeDatabaseHelper.replace(DownLoadDataTable.TABLE_NAME_DOWNLOAD_DATA, contentValues); return true; } /** 根据pkgname删除一个条数据 */ public int deleteSingle(String pkgName) { int state = PrizeDatabaseHelper.deleteCollection( DownLoadDataTable.TABLE_NAME_DOWNLOAD_DATA, DownLoadDataTable.PACKAGENAME + "=?", new String[] { pkgName }); return state; } /** * 方法描述:清空列表 */ public void deleteAll() { PrizeDatabaseHelper.deleteAllData(DownLoadDataTable.TABLE_NAME_DOWNLOAD_DATA); } /** * 方法描述:获取下载成功的apk * * @return ArrayList<AppsItemBean> * @see 类名/完整类名/完整类名#方法名 */ public ArrayList<DownLoadDataBean> getHasDownloadedAppList() { ArrayList<DownLoadDataBean> list = new ArrayList<DownLoadDataBean>(); Cursor cursor = null; try { cursor = PrizeDatabaseHelper.query( DownLoadDataTable.TABLE_NAME_DOWNLOAD_DATA, DownLoadDataTable.ACCOUNT_COLUMNS, null, null, null, null, null); if (cursor != null) { while (cursor.moveToNext()) { DownLoadDataBean downloadApp = new DownLoadDataBean(); downloadApp.downloadType = cursor.getString(cursor .getColumnIndex(DownLoadDataTable.DOWNLOADTYPE)); downloadApp.packageName = cursor.getString(cursor .getColumnIndex(DownLoadDataTable.PACKAGENAME)); downloadApp.timeDelta = Long.parseLong(cursor.getString(cursor .getColumnIndex(DownLoadDataTable.TIMEDALTA))); list.add(downloadApp); } } } catch (NumberFormatException e) { e.printStackTrace(); } finally { if (cursor != null && !cursor.isClosed()) { cursor.close(); } } return list; } }
[ "649830103@qq.com" ]
649830103@qq.com
30bf8facd51b8a05adac7d1a64c7bd3aa6211845
6fa07c35a661c62497709233120f866438d4da5f
/src/main/java/com/vamekh/client/presenter/EditReturnPresenter.java
3cf0d5bfe987b9d9597ac7853e63d01a6e061885
[]
no_license
vamekhgoiati/project4
fa4c8fd6ea461b33513296463bdffeecb847066a
a8861ef84ff01f1b057fb76799cd7c501a0c0185
refs/heads/master
2016-09-09T19:06:45.052166
2014-12-01T13:27:41
2014-12-01T13:27:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,287
java
package com.vamekh.client.presenter; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.HasClickHandlers; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.HasValue; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.Widget; import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent.HasSelectHandlers; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; import com.vamekh.client.InstitutionServiceAsync; import com.vamekh.client.ReturnServiceAsync; import com.vamekh.client.event.EditReturnCancelledEvent; import com.vamekh.client.event.ReturnUpdatedEvent; import com.vamekh.shared.InstitutionDTO; import com.vamekh.shared.ReturnDTO; import com.vamekh.shared.TemplateDTO; public class EditReturnPresenter implements Presenter{ public interface Display{ HasSelectHandlers getSaveButton(); HasSelectHandlers getCancelButton(); InstitutionDTO getInstitution(); void setInstitution(InstitutionDTO inst); TemplateDTO getTemplate(); void setTemplate(TemplateDTO template); Widget asWidget(); } private ReturnServiceAsync rpcService; private InstitutionServiceAsync institutionRpcService; private HandlerManager eventBus; private Display display; private ReturnDTO returnDTO; public EditReturnPresenter(ReturnServiceAsync rpcService, InstitutionServiceAsync institutionRpcService, HandlerManager eventBus, Display display, int fi){ this.rpcService = rpcService; this.institutionRpcService = institutionRpcService; this.eventBus = eventBus; this.display = display; returnDTO = new ReturnDTO(); bind(); institutionRpcService.getInstitution(fi, new AsyncCallback<InstitutionDTO>() { public void onFailure(Throwable caught) { Window.alert("Error retrieving institution"); } public void onSuccess(InstitutionDTO result) { EditReturnPresenter.this.display.setInstitution(result); } }); } public EditReturnPresenter(ReturnServiceAsync rpcService, HandlerManager eventBus, Display display, int fi, int id){ this.rpcService = rpcService; this.eventBus = eventBus; this.display = display; bind(); rpcService.getReturn(id, new AsyncCallback<ReturnDTO>() { public void onSuccess(ReturnDTO result) { returnDTO = result; EditReturnPresenter.this.display.setInstitution(returnDTO.getInstitution()); EditReturnPresenter.this.display.setTemplate(returnDTO.getTemplate()); } public void onFailure(Throwable caught) { Window.alert("Error retrieving return"); } }); } private void bind() { this.display.getSaveButton().addSelectHandler(new SelectHandler() { public void onSelect(SelectEvent event) { doSave(); } }); this.display.getCancelButton().addSelectHandler(new SelectHandler() { public void onSelect(SelectEvent event) { eventBus.fireEvent(new EditReturnCancelledEvent(EditReturnPresenter.this.display.getInstitution())); } }); } private void doSave(){ returnDTO.setInstitution(display.getInstitution()); returnDTO.setTemplate(display.getTemplate()); if(returnDTO.getId() > 0){ rpcService.updateReturn(returnDTO, new AsyncCallback<ReturnDTO>() { public void onSuccess(ReturnDTO result) { eventBus.fireEvent(new ReturnUpdatedEvent(result)); } public void onFailure(Throwable caught) { Window.alert("Error updating return"); } }); } else { rpcService.addReturn(returnDTO, new AsyncCallback<ReturnDTO>() { public void onFailure(Throwable caught) { Window.alert("Error adding return"); } public void onSuccess(ReturnDTO result) { eventBus.fireEvent(new ReturnUpdatedEvent(result)); } }); } } public void go(HasWidgets container) { container.clear(); container.add(display.asWidget()); } }
[ "vamekh@linux-pus1.site" ]
vamekh@linux-pus1.site
f65f18ea6737a82432c73fd052d5d24a847c4a41
a29433043c0061ce8d482b86086988957431f6b1
/app/src/main/java/com/example/wzwang/syncmessage/BackgroundService.java
02249d0bf49c8572a0b3cee8d426896bf9da3ac1
[]
no_license
ZhenyingZhu/SyncMessage-android
c87f0bfbaa32b3930246d05b5c69f5d8a7f1b98b
f240483bd5552289c6c0283ab0bed0fb145cc7a7
refs/heads/master
2021-01-15T13:07:08.408046
2014-08-06T15:17:21
2014-08-06T15:17:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
673
java
package com.example.wzwang.syncmessage; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.util.Log; public class BackgroundService extends Service { public int count = 0; public BackgroundService() { } @Override public void onCreate() { super.onCreate(); new Thread(new Runnable() { @Override public void run() { } }).start(); } @Override public IBinder onBind(Intent intent) { // TODO: Return the communication channel to the service. throw new UnsupportedOperationException("Not yet implemented"); } }
[ "ww2339@columbia.edu" ]
ww2339@columbia.edu
2937f09470f10c94f466483cd828135626cf318d
c3e82a11e98e68ddbb0bf5742889b1517e4c5c75
/src/test/java/com/ramllah/cocacola/CocacolaApplicationTests.java
6ad7c034426dd1d330a4459eb08af3f81de1cf41
[]
no_license
sharifhh/CocaCola
92a9db3f3ffff37eeb1f4d22165615c30e4dc234
2e3d6d896f582a7fbf3e42b41ba345562943025f
refs/heads/master
2020-03-22T06:12:04.042614
2018-07-03T17:07:32
2018-07-03T17:07:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
348
java
package com.ramllah.cocacola; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class CocacolaApplicationTests { @Test public void contextLoads() { } }
[ "1140010@student.birzeit.edu" ]
1140010@student.birzeit.edu
ff014f53190291f93813d7465069cffa1886524b
869b4845a43c53b65273edb00a255256f17011c0
/regression/TestLockSanityChecks/src/test_unique_names/BadC2.java
8cc326600b1adf0e02c546e7287c04d1d3919098
[]
no_license
surelogic/regression
62879ef0b7dd197dfc6961e08fc2f71e3e0ced2a
a391ebc3959f730d2607e3bdfa9239a999b861c5
refs/heads/master
2021-04-30T23:41:12.571603
2016-04-20T16:50:26
2016-04-20T16:50:26
50,687,446
0
0
null
null
null
null
UTF-8
Java
false
false
414
java
package test_unique_names; import com.surelogic.RegionLock; import com.surelogic.PolicyLock; import com.surelogic.Region; /** * Bad: Reuses lock names L1 and P1 */ @Region("public R2") @RegionLock("L1 is this protects R2" /* is UNASSOCIATED: L1 is already inherited from C1 */) @PolicyLock("P1 is class" /* is UNASSOCIATED: P1 is already inherited from C1 */) public class BadC2 extends C1 { }
[ "nathan.boy@surelogic.com" ]
nathan.boy@surelogic.com
147f00353529778b75e93612e470a68b90eb0221
c1474ed75d7c0de393aa6f8a67e9c10df9ea6753
/chapter06/src/main/java/com/learn/chapter06/transaction/service/UserBatchService.java
783e41a76a11048e30a51c976bb740cf3a70294c
[]
no_license
liman657/springbootlearn
95e55e0434e6afc2de499fb0dd38b5207e71d6f4
73ab85a2a235a4276af602389c862ea808529ab2
refs/heads/master
2021-12-14T13:44:19.535279
2021-11-06T08:31:01
2021-11-06T08:31:01
155,731,724
1
0
null
null
null
null
UTF-8
Java
false
false
291
java
package com.learn.chapter06.transaction.service; import com.learn.chapter06.mybatis.POJO.User; import java.util.List; /** * autor:liman * mobilNo:15528212893 * mail:657271181@qq.com * comment: */ public interface UserBatchService { public int insertUsers(List<User> userList); }
[ "657271181@qq.com" ]
657271181@qq.com
b7d07e0377fca89ce48a90eb716dac6612edf4f9
27788437c69a20cffa1e5f97136c42f8024b36f6
/webauthn4j-core/src/test/java/com/webauthn4j/data/extension/UvmEntryTest.java
7164593c5f1d856312f06932e140f2747493767b
[ "Apache-2.0" ]
permissive
webauthn4j/webauthn4j
0b787ad400938b0d1757889919ce0bd027d1e264
432defbd13c296272b38b12565e93559c3c2fe19
refs/heads/master
2023-09-01T07:03:41.220676
2023-08-11T06:57:27
2023-08-11T06:57:27
134,147,639
346
75
Apache-2.0
2023-09-04T14:50:11
2018-05-20T12:14:36
Java
UTF-8
Java
false
false
3,427
java
/* * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.webauthn4j.data.extension; import com.webauthn4j.data.KeyProtectionType; import com.webauthn4j.data.MatcherProtectionType; import com.webauthn4j.data.UserVerificationMethod; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; class UvmEntryTest { @Test void constructor_test() { UvmEntry target = new UvmEntry(new Number[]{2, 2, 2}); assertThat(target.getUserVerificationMethod()).isEqualTo(UserVerificationMethod.FINGERPRINT_INTERNAL); assertThat(target.getKeyProtectionType()).isEqualTo(KeyProtectionType.HARDWARE); assertThat(target.getMatcherProtectionType()).isEqualTo(MatcherProtectionType.TEE); } @Test void getUserVerificationMethod_with_invalid_data_test() { UvmEntry target = new UvmEntry(new Number[]{}); assertThatThrownBy(target::getUserVerificationMethod).isInstanceOf(IllegalStateException.class); } @Test void getKeyProtectionType_with_invalid_data_test() { UvmEntry target = new UvmEntry(new Number[]{}); assertThatThrownBy(target::getKeyProtectionType).isInstanceOf(IllegalStateException.class); } @Test void getMatcherProtectionType_with_invalid_data_test() { UvmEntry target = new UvmEntry(new Number[]{}); assertThatThrownBy(target::getMatcherProtectionType).isInstanceOf(IllegalStateException.class); } @Test void getter_test() { //noinspection MismatchedQueryAndUpdateOfCollection UvmEntry instance = new UvmEntry(UserVerificationMethod.FINGERPRINT_INTERNAL, KeyProtectionType.HARDWARE, MatcherProtectionType.TEE); assertThat(instance.getUserVerificationMethod()).isEqualTo(UserVerificationMethod.FINGERPRINT_INTERNAL); assertThat(instance.getKeyProtectionType()).isEqualTo(KeyProtectionType.HARDWARE); assertThat(instance.getMatcherProtectionType()).isEqualTo(MatcherProtectionType.TEE); assertThat(instance.get(0)).isEqualTo(UserVerificationMethod.FINGERPRINT_INTERNAL.getValue()); assertThat(instance.get(1)).isEqualTo(KeyProtectionType.HARDWARE.getValue()); assertThat(instance.get(2)).isEqualTo(MatcherProtectionType.TEE.getValue()); assertThat(instance.size()).isEqualTo(3); } @Test void equals_hashCode_test() { UvmEntry instanceA = new UvmEntry(UserVerificationMethod.FINGERPRINT_INTERNAL, KeyProtectionType.HARDWARE, MatcherProtectionType.TEE); UvmEntry instanceB = new UvmEntry(UserVerificationMethod.FINGERPRINT_INTERNAL, KeyProtectionType.HARDWARE, MatcherProtectionType.TEE); assertThat(instanceA) .isEqualTo(instanceB) .hasSameHashCodeAs(instanceB); } }
[ "mail@ynojima.net" ]
mail@ynojima.net
bd32a3adfb5de0767c55bf63cfedef8414024f8d
7df3f63b915552bbfdbc03f298dc8fa27e1c4970
/src/main/common/kr/or/ddit/vo/ChatingRoomVO.java
06df11649af1a9bb8ba530b7198e916f9539b5b1
[]
no_license
ttlye3764/hope
eb3ae92dec62caabf012767b58b0bc2df12e99ca
dfb2f8e1c794180e7f37b8d2e16f1e62fdbd4d61
refs/heads/master
2022-12-18T06:23:50.094708
2020-09-29T17:49:36
2020-09-29T17:49:36
289,200,827
0
0
null
null
null
null
UTF-8
Java
false
false
341
java
package kr.or.ddit.vo; public class ChatingRoomVO { private String ch_no; private String ch_date; public String getCh_no() { return ch_no; } public void setCh_no(String ch_no) { this.ch_no = ch_no; } public String getCh_date() { return ch_date; } public void setCh_date(String ch_date) { this.ch_date = ch_date; } }
[ "jaeho@218.38.137.27" ]
jaeho@218.38.137.27
583b6ddb4729cd062daad0decc611b45a70760f7
f5a608798f5d24fe18799caef3565e3f4a809da9
/src/main/java/com/bear/blogvillage/aspect/MyAspect.java
94c0525d0f20e359d7791f80a5563d735c0fea47
[]
no_license
xiongmaomao/blogvillage
fc980fd6c85053b590fb2e450f89de831445ce0a
7f4985f02f72489b96dff190c6ad8653302a68d6
refs/heads/master
2020-04-07T02:58:29.992062
2019-02-01T09:24:33
2019-02-01T09:24:33
157,997,506
0
0
null
null
null
null
UTF-8
Java
false
false
740
java
/* package com.bear.blogvillage.aspect; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.springframework.stereotype.Component; @Aspect @Component public class MyAspect { @Around("execution(* com.bear.blogvillage.user.controller.UserController.*(..))") public Object handleMethod(ProceedingJoinPoint pjp) throws Throwable { System.out.println("pjp start============"); Object[] args = pjp.getArgs(); for (Object arg : args) { System.out.println("args is ========"+arg); } Object obj = pjp.proceed(); System.out.println("pjp end============"); return obj; } } */
[ "1938534292@qq.com" ]
1938534292@qq.com
1b8ad412b7e155710434cc4322a188bed97bb66e
02fd64aa5ed660d74bfd8f4bbaa750913d85aa4e
/src/main/java/br/gov/ba/pm/sgeapm/repository/SerieRepository.java
9f4e05a863c7ebc070b2ce8d89ed0dd431705854
[]
no_license
jrjrsilva/sgeapm
92173dd13a84391ef98c35a5431340aacbdbc7b4
e8c668ea39cd9f35503f5c453998f55b0006f621
refs/heads/master
2020-07-20T16:25:07.050402
2019-09-06T00:24:33
2019-09-06T00:24:33
206,677,278
0
0
null
null
null
null
UTF-8
Java
false
false
596
java
package br.gov.ba.pm.sgeapm.repository; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import br.gov.ba.pm.sgeapm.domain.Serie; public interface SerieRepository extends JpaRepository<Serie, Long>{ @Query("select s from Serie s where s.nome like :search% or s.apelido like :search%") Page<Serie> findBySerieOrApelido(@Param("search") String search, Pageable pageable); }
[ "jrjrsilva@gmail.com" ]
jrjrsilva@gmail.com
050e51f43d98a071d8020a64044457be02665644
e1d9247a0642fcfd00184036e9fe0240a4390045
/shiro-spring/src/main/java/com/zcf/shiro/chapter12/service/PermissionService.java
abda5dceadb25d955aac126ea1b742af7ab14f30
[]
no_license
zcf9916/shiro
61ce033eb7ed9bc856bfe9f28eeb90f8bd85fec3
bdeeb0b369b65ac988f4bfba888d27c34432414f
refs/heads/master
2021-01-11T22:50:05.392798
2017-01-13T10:04:00
2017-01-13T10:04:00
78,324,806
0
0
null
null
null
null
UTF-8
Java
false
false
320
java
package com.zcf.shiro.chapter12.service; import com.zcf.shiro.chapter12.entity.Permission; /** * <p>User: Zhang Kaitao * <p>Date: 14-1-28 * <p>Version: 1.0 */ public interface PermissionService { public Permission createPermission(Permission permission); public void deletePermission(Long permissionId); }
[ "8797393@qq.com" ]
8797393@qq.com
48d35478838b88580ebd265474f88d217d60cea5
0d2802bda624b382e7aaa07f86b672cef154cdef
/test/app/controllers/Application.java
5ff7252a967807f2412b3f8ee768e02ec8564188
[]
no_license
takayuki-okazawa/Play-Freamework2.1.x
c02231d61a6b0f13367dae687ac74b13afe535c6
0f9939279fafcdd64867083285e99331d4cb0084
refs/heads/master
2020-05-20T12:20:15.026964
2013-08-26T05:22:08
2013-08-26T05:22:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,748
java
package controllers; import play.*; import play.mvc.*; import views.html.*; //test7 import org.codehaus.jackson.node.ObjectNode; //test8 import org.codehaus.jackson.JsonNode; import play.libs.Json; public class Application extends Controller { public static Result index() { //test1 //return ok(index.render("Your new application is ready.")); //test2 return ok("It works!"); } public static Result hello(String name) { //test3 //http://localhost:9000/hello/hoge return ok("Hello " + name + "!"); } public static Result getParameters(String parameter) { //test4 //http://localhost:9000/getParameters?parameter=hoge return ok("Parameter is " + parameter); } public static Result contentType() { //test5 // return ok("<h1>Hello World1!</h1>").as("text/html"); //test6 response().setContentType("text/html"); return ok("<h1>Hello World2!</h1>"); } public static Result responseJson() { //test7 response().setContentType("application/json"); ObjectNode result = Json.newObject(); result.put("status","OK"); result.put("message","Hello World"); return ok(result); } @BodyParser.Of(BodyParser.Json.class) public static Result requestJson() { /* CURL curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"name":"takayuki"}' http://localhost:9000/requestJson */ //test8 JsonNode json = request().body().asJson(); String name = json.findPath("name").getTextValue(); return ok("Hello "+name+ "."); } }
[ "takayuki.hack@gmail.com" ]
takayuki.hack@gmail.com
04a88500820c90c3c6d32eb2a086278d7410c31a
7f2d8ebcdd8248a033720ec99a71f237e04a8924
/RatingApp/app/src/main/java/com/hayavadana/ratingapp/ReviewCommentListItemAdapter.java
2ef7c87a29bea42b1414dab8e98446fbdccc6a60
[]
no_license
hayavadana/On-Rate-Droid
9d94f9a8b1151c9c3fbc1e45afca456b5ca6e939
7f5592e07bba854187c9d31e334d6bab81cfc445
refs/heads/master
2021-01-20T19:20:05.109162
2016-06-24T11:16:14
2016-06-24T11:16:14
61,863,052
0
0
null
null
null
null
UTF-8
Java
false
false
1,764
java
package com.hayavadana.ratingapp; import android.app.Activity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.RatingBar; import android.widget.TextView; import java.util.ArrayList; public class ReviewCommentListItemAdapter extends ArrayAdapter { private final Activity context; private final ArrayList<ReviewComment> reviewsList; public ReviewCommentListItemAdapter(Activity context, ArrayList<ReviewComment> allReviews) { super(context, R.layout.reviewcomment_list_item,allReviews); this.context = context; this.reviewsList = allReviews; } @Override public View getView(int position, View view, ViewGroup parent) { LayoutInflater inflater = context.getLayoutInflater(); View rowView= inflater.inflate(R.layout.reviewcomment_list_item, null, true); TextView txtReviewComment = (TextView) rowView.findViewById(R.id.textViewAReviewComment); String tempstr = reviewsList.get(position).getCommentString(); txtReviewComment.setText(tempstr); RatingBar busRatingObj = (RatingBar)rowView.findViewById(R.id.RatingBarARating); String avgRatingStr = reviewsList.get(position).getRating(); float ratingFloat; try { ratingFloat = Float.valueOf(avgRatingStr).floatValue(); busRatingObj.setRating(ratingFloat); } catch (NumberFormatException nfe) { System.out.println("NumberFormatException: " + nfe.getMessage()); } busRatingObj.setFocusable(false); busRatingObj.setClickable(false); return rowView; } }
[ "Sridhar@Sridhars-MacBook.local" ]
Sridhar@Sridhars-MacBook.local
b0700e12b1d3aabd6af861577cfa883ea3292dc4
0970e87eb6effc0ad924b63f1095df9fbe3dbebf
/StringItem.java
3114ba0453078fcb74929504a900c890ca359513
[]
no_license
kaireylee/GenericContainer
c2d81007cb7f49c709856107583fb58d291c27ed
562c01b5d07867109cc90ef8478f5ee341579b92
refs/heads/master
2021-08-30T03:48:37.701351
2017-12-15T23:05:35
2017-12-15T23:05:35
114,418,238
1
0
null
null
null
null
UTF-8
Java
false
false
727
java
public class StringItem extends GenericItem{ private String value; public StringItem(){ this.value = new String(""); } public StringItem(String value){ this.value = new String(value); } public StringItem(char value){ this.value = new String(Character.toString(value)); } public boolean isLess(GenericItem gi){ return (this.value.compareTo(((StringItem) gi).get()) < 0); } public boolean isEqual(GenericItem gi){ if(this.equals(gi)){ return true; } else return false; } public boolean isGreater(GenericItem gi){ return (this.value.compareTo(((StringItem) gi).get()) > 0); } public String get(){ return value; } public void set(String value){ this.value = value; } }
[ "kairey@gmail.com" ]
kairey@gmail.com
31eb74db43ab17bbef2650ec291cbad2d3786b53
329580838d4b4bb5b2f1e10b3e3d28feb83bc71a
/app/src/main/java/com/example/twitter_clone/profileTab.java
24a9e39fcb038dc45821370b1cf66b538e1f1233
[]
no_license
moshirey/intsgramclone
bd7487d6f4e24b4fb8080d6b971ee29646838b63
d1887be85432f289a582e994afb0073c2d2dbd72
refs/heads/master
2020-08-29T10:41:58.081233
2019-10-28T09:36:33
2019-10-28T09:36:33
218,008,676
0
0
null
null
null
null
UTF-8
Java
false
false
3,719
java
package com.example.twitter_clone; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.parse.ParseException; import com.parse.ParseUser; import com.parse.SaveCallback; /** * A simple {@link Fragment} subclass. */ public class profileTab extends Fragment { private EditText username, bio, profession,hobbies,sport; private Button btnupdate ,btnlogout; public profileTab() { // Required empty public constructor } @Override public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view= inflater.inflate(R.layout.fragment_profile_tab, container, false); username=view.findViewById(R.id.edtusername); bio= view.findViewById(R.id.edtbio); profession=view.findViewById(R.id.edtprofession); hobbies=view.findViewById(R.id.edthobbies); sport=view.findViewById(R.id.edtsport); btnupdate=view.findViewById(R.id.btnupdate); btnlogout=view.findViewById(R.id.btnlogout); final ParseUser parseUser=ParseUser.getCurrentUser(); final ProgressDialog progressDialog=new ProgressDialog(getContext()); if (parseUser.get("profile")==null){ username.setText(""); }else {username.setText(parseUser.get("profile")+"");} if (parseUser.get("profile_bio")==null){ bio.setText(""); }else {bio.setText(parseUser.get("profile_bio")+"");} if (parseUser.get("profile_profession")==null){ profession.setText(""); }else {profession.setText(parseUser.get("profile_profession")+"");} if (parseUser.get("profile_hobbies")==null){ hobbies.setText(""); }else {hobbies.setText(parseUser.get("profile_hobbies")+"");} if (parseUser.get("profile_fav_sport")==null){ sport.setText(""); }else {sport.setText(parseUser.get("profile_fav_sport")+"");} btnupdate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { progressDialog.show(); parseUser.put("profile",username.getText().toString()); parseUser.put("profile_bio",bio.getText().toString()); parseUser.put("profile_profession",profession.getText().toString()); parseUser.put("profile_hobbies",hobbies.getText().toString()); parseUser.put("profile_fav_sport",sport.getText().toString()); parseUser.saveInBackground(new SaveCallback() { @Override public void done(ParseException e) { if (e==null){ Toast.makeText(getContext(),"its saved",Toast.LENGTH_LONG).show(); progressDialog.dismiss(); }else { Toast.makeText(getContext(),"an error",Toast.LENGTH_LONG).show(); } } }); } }); btnlogout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { parseUser.getCurrentUser().logOut(); Intent intent=new Intent(); intent.setClass(getContext(),signup_activity.class); startActivity(intent); } }); return view; } }
[ "moshire7@gmail.com" ]
moshire7@gmail.com
a8d0c4ce22aabae5ca2b60be6c8f7563da56f5cc
6ed38b1c0793ccdd25ccc1c9138057e56245b03e
/RectanglesAnimationComponent.java
917896efa5bc27c3cba8dfbf167d2896574cc73b
[]
no_license
egSef/RectanglesAnimation
971e4edd7ff93ab2aca397f980855aa35fef104b
472ab134baacd8eee6ceb929767fca09a8b4ae06
refs/heads/master
2020-03-18T12:03:20.383142
2018-05-24T11:39:11
2018-05-24T11:39:11
134,706,024
0
0
null
null
null
null
UTF-8
Java
false
false
2,844
java
package rectanglesanimation; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.util.Random; import javax.swing.JComponent; /** * @author egsef */ public class RectanglesAnimationComponent extends JComponent{ private static int width = 1, height = 1; private static int x1 = 1900, y1 = 1000; private static int x2 = 1901, y2 = 1001; private static int x3 = 1902, y3 = 1002; private static int x4 = 1900, y4 = 1000; private static int x5 = 1901, y5 = 1001; private static int x6 = 1902, y6 = 1002; private static int x7 = 1900, y7 = 1000; private static int x8 = 1901, y8 = 1001; private static int x9 = 1902, y9 = 1002; private int angle; private int STRING_X = 450, STRING_Y = 0; public RectanglesAnimationComponent () {} public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; Color background = new Color(51,51,51); g2.setColor(background); g2.fillRect(0, 0, getWidth(), getHeight()); int red = new Random().nextInt(256); int green = new Random().nextInt(256); int blue = new Random().nextInt(256); g2.setColor(new Color(red, green, blue)); g2.setFont(new Font("Courier", 2, 40)); g2.drawString("TIME IS AN ABYSS... DEATH IS NOT THE WORST", STRING_X, STRING_Y); Rectangle rec1 = new Rectangle(x1, y1, width, height); Rectangle rec2 = new Rectangle(x2, y2, width, height); Rectangle rec3 = new Rectangle(x3, y3, width, height); Rectangle rec4 = new Rectangle(x4, y4, width, height); Rectangle rec5 = new Rectangle(x5, y5, width, height); Rectangle rec6 = new Rectangle(x6, y6, width, height); Rectangle rec7 = new Rectangle(x7, y7, width, height); Rectangle rec8 = new Rectangle(x8, y8, width, height); Rectangle rec9 = new Rectangle(x9, y9, width, height); g2.draw(rec1); g2.fill(rec1); g2.rotate(angle, x1, y1); g2.draw(rec2); g2.fill(rec2); g2.draw(rec3); g2.fill(rec3); g2.draw(rec4); g2.fill(rec4); g2.draw(rec5); g2.fill(rec5); g2.draw(rec6); g2.fill(rec6); g2.draw(rec7); g2.fill(rec7); g2.draw(rec8); g2.fill(rec8); g2.draw(rec9); g2.fill(rec9); } public void translateAndGrowRectsBy(int dx, int dy) { x1 = x1 - dx; y1 = y1 - dy; y2 = y2 - dy; x3 = x3 + dx; y3 = y3 - dy; x4 = x4 - dx; x6 = x6 + dx; x7 = x7 - dx; y7 = y7 + dy; y8 = y8 + dy; x9 = x9 + dx; y9 = y9 + dy; width = width + dx / 2; height = height + dy / 2; angle = angle + dx; STRING_Y = STRING_Y + dx; repaint(); } }
[ "noreply@github.com" ]
noreply@github.com
e75e0d424804ff89c4a907082b5fa25d4164d9f1
1891e5b26d397cf081653997c0446262b231a616
/test/src/test16/Son.java
b3fc67cdb969fa6fbbc51d32e1a0af3eaf79c52e
[]
no_license
llkwer/java
4d83ee0a55ab1acbfc73f7868e119aead6ef423d
b276ad0208e276f718d951ae26ab73785937e8bf
refs/heads/master
2020-03-22T17:31:12.862105
2018-07-23T08:39:12
2018-07-23T08:39:12
139,947,618
0
0
null
null
null
null
UTF-8
Java
false
false
88
java
package test16; public class Son extends Father{ Son(){ super("abc"); } }
[ "koitt03-A@koitt03-A-PC" ]
koitt03-A@koitt03-A-PC
c81c22896b3fc0022c2daa8deb2d38d5aa239ccc
1328d624fa1bdca95f688d55f043cb43c477899b
/app/src/main/java/top/ljaer/www/phonemanager/fragment/CacheFragment.java
9679544969f37a30b804c1c220abcb63666208b9
[]
no_license
LJaer/PhoneManager
3f212710ab4acdbe456b363f12625503267651e8
c902d117f3b31f5ce62b3c91913b6c4504594205
refs/heads/master
2021-01-23T17:20:22.010092
2016-10-27T16:46:58
2016-10-27T16:46:58
68,600,570
0
0
null
null
null
null
UTF-8
Java
false
false
12,139
java
package top.ljaer.www.phonemanager.fragment; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.IPackageDataObserver; import android.content.pm.IPackageStatsObserver; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageStats; import android.content.pm.Signature; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; import android.os.SystemClock; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.text.format.Formatter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.TextView; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import top.ljaer.www.phonemanager.AntivirusActivity; import top.ljaer.www.phonemanager.R; import top.ljaer.www.phonemanager.db.dao.AntivirusDao; import top.ljaer.www.phonemanager.utils.MD5Util; /** * Created by jaer on 2016/10/27. */ public class CacheFragment extends Fragment { private List<CachInfo> list; private TextView tv_cachefragment_text; private ProgressBar pb_cachefragment_progressbar; private ListView lv_cachefragment_caches; private Button btn_cachefragment_clear; private PackageManager pm; private MyAdapter myAdapter; //初始化操作 @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } //设置fragment的布局 @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { list = new ArrayList<CachInfo>(); list.clear(); //参数1:布局文件 //参数2:容器 //参数3:自动挂载 ,一律false View view = inflater.inflate(R.layout.fragment_cache,container,false); tv_cachefragment_text = (TextView) view.findViewById(R.id.tv_cachefragment_text); pb_cachefragment_progressbar = (ProgressBar) view.findViewById(R.id.pb_cachefragment_progressbar); lv_cachefragment_caches = (ListView) view.findViewById(R.id.lv_cachefragment_caches); btn_cachefragment_clear = (Button) view.findViewById(R.id.btn_cachefragment_clear); lv_cachefragment_caches.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //跳转到详情页面 Intent intent = new Intent(); intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS"); intent.setData(Uri.parse("package:"+list.get(position).getPackageName())); startActivity(intent); } }); return view; } //设置填充显示数据 @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); scanner(); } /** * 扫描 */ private void scanner() { //1、获取包的管理者 //getActivity() : 获取fragment所在的activity pm = getActivity().getPackageManager(); tv_cachefragment_text.setText("正在初始化128核扫描引擎....."); new Thread() { @Override public void run() { SystemClock.sleep(100); List<PackageInfo> installedPackages = pm.getInstalledPackages(PackageManager.GET_SIGNATURES); pb_cachefragment_progressbar.setMax(installedPackages.size()); int count = 0; for (final PackageInfo packageInfo : installedPackages) { SystemClock.sleep(50); //设置进度条的最大进度和当前 count++; pb_cachefragment_progressbar.setProgress(count); //反射获取缓存 try { Class<?> loadClass = getActivity().getClass().getClassLoader().loadClass("android.content.pm.PackageManager"); Method method = loadClass.getDeclaredMethod("getPackageSizeInfo", String.class,IPackageStatsObserver.class); //receiver : 类的实例,隐藏参数,方法不是静态的必须指定 method.invoke(pm, packageInfo.packageName,mStatsObserver); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } //设置扫描显示的应用的名称 final String name = packageInfo.applicationInfo.loadLabel(pm).toString(); if(getActivity()!=null){ getActivity().runOnUiThread(new Runnable() { @Override public void run() { tv_cachefragment_text.setText("正在扫描:"+name); } }); } } //扫描完成 if (getActivity() != null) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { tv_cachefragment_text.setVisibility(View.GONE); pb_cachefragment_progressbar.setVisibility(View.GONE); myAdapter = new MyAdapter(); //listview设置adapter lv_cachefragment_caches.setAdapter(myAdapter); if (list.size()>0){ btn_cachefragment_clear.setVisibility(View.VISIBLE); //清理缓存 btn_cachefragment_clear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //真正的实现清理缓存 try { Class<?> loadClass = getActivity().getClass().getClassLoader().loadClass("android.content.pm.PackageManager"); //Long.class Long TYPE long Method method = loadClass.getDeclaredMethod("freeStorageAndNotify", Long.TYPE,IPackageDataObserver.class); method.invoke(pm, Long.MAX_VALUE,new MyIPackageDataObserver()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } //清理缓存 list.clear(); //更新界面 myAdapter.notifyDataSetChanged(); //隐藏button按钮 btn_cachefragment_clear.setVisibility(View.GONE); } }); } } }); } } }.start(); } private class MyAdapter extends BaseAdapter{ @Override public int getCount() { return list.size(); } @Override public Object getItem(int position) { return list.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { View cacheView; ViewHolder viewHolder; if(convertView==null){ cacheView = View.inflate(getActivity(), R.layout.item_cache, null); viewHolder = new ViewHolder(); viewHolder.iv_itemcache_icon= (ImageView) cacheView.findViewById(R.id.iv_itemcache_icon); viewHolder.tv_itemcache_name = (TextView) cacheView.findViewById(R.id.tv_itemcache_name); viewHolder.tv_itemcache_size = (TextView) cacheView.findViewById(R.id.tv_itemcache_size); cacheView.setTag(viewHolder); }else { cacheView = convertView; viewHolder= (ViewHolder) cacheView.getTag(); } //设置显示数据 CachInfo cachInfo = list.get(position); //根据包名获取application信息 try { ApplicationInfo applicationInfo = pm.getApplicationInfo(cachInfo.getPackageName(), 0); Drawable icon = applicationInfo.loadIcon(pm); String name = applicationInfo.loadLabel(pm).toString(); //设置显示 viewHolder.iv_itemcache_icon.setImageDrawable(icon); viewHolder.tv_itemcache_name.setText(name); viewHolder.tv_itemcache_size.setText(cachInfo.getCachesize()); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return cacheView; } } //获取缓存大小 IPackageStatsObserver.Stub mStatsObserver = new IPackageStatsObserver.Stub() { public void onGetStatsCompleted(PackageStats stats, boolean succeeded) { long cachesize = stats.cacheSize;//缓存大小 //long codesize = stats.codeSize;//应用程序的大小 //long datasize = stats.dataSize;//数据大小 if (cachesize>0){ String cache = Formatter.formatFileSize(getActivity(), cachesize); list.add(new CachInfo(stats.packageName,cache)); } //String code = Formatter.formatFileSize(getActivity(), codesize); //String data = Formatter.formatFileSize(getActivity(), datasize); //System.out.println(stats.packageName+"cachesize:"+cache +" codesize:"+code+" datasize:"+data); } }; private class MyIPackageDataObserver extends IPackageDataObserver.Stub{ //当缓存清理完成之后调用的方法 @Override public void onRemoveCompleted(String packageName, boolean succeeded) throws RemoteException { } } static class ViewHolder{ ImageView iv_itemcache_icon; TextView tv_itemcache_name,tv_itemcache_size; } class CachInfo{ private String packageName; private String cachesize; public String getPackageName() { return packageName; } public void setPackageName(String packageName) { this.packageName = packageName; } public String getCachesize() { return cachesize; } public void setCachesize(String cachesize) { this.cachesize = cachesize; } public CachInfo(String packageName, String cachesize) { super(); this.packageName = packageName; this.cachesize = cachesize; } } }
[ "673820543@qq.com" ]
673820543@qq.com
e86e46306d26152e58d119b6891bf33cf6cd2d5d
9ee5fb1ec5a79127047d210d8f3c8dbad51a64c7
/app/src/main/java/com/admin/nidhi_khushali/AdminNewMain.java
17464a6d7f22c7b51e8b7aeefee6c0bce3c978e5
[]
no_license
khushali-1507606/Project_recruitment
9f8c31c3769ff19f4060753f5a868dbf49e049c5
8a8b46095c96bc444d081f81b5f2c4e92b8d7e14
refs/heads/master
2020-04-17T23:01:14.809513
2019-01-22T15:30:01
2019-01-22T15:30:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
16,432
java
package com.admin.nidhi_khushali; import android.Manifest; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.net.ConnectivityManager; import android.os.Build; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; import android.widget.Toast; import com.example.win_10.newapp.Login; import com.example.win_10.newapp.R; import com.example.win_10.newapp.RecModelClass; import com.example.win_10.newapp.RecyclerAdapter; import com.example.win_10.newapp.RecyclerViewClickListener; import com.util.Session; import java.util.ArrayList; public class AdminNewMain extends AppCompatActivity { RecyclerView recyclerView; RecyclerAdapter adapter; RecModelClass recModelClass,recModelClass1,recModelClass2,recModelClass3; ArrayList<RecModelClass> arrayList; Session sessionLogin; TextView txtHeading; private static final int RESULT_LOAD_IMAGE = 1; private static final int PERMISSION_REQUEST_CODE = 200; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_admin_new_main); isInternetOn(); if(ContextCompat.checkSelfPermission(AdminNewMain.this, Manifest.permission.READ_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED){ ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},RESULT_LOAD_IMAGE); } if (checkPermission()) { //main logic or main code // . write your main code to execute, It will execute if the permission is already given. } else { requestPermission(); } txtHeading=findViewById(R.id.welcome); txtHeading.setSelected(true); txtHeading.setEllipsize(TextUtils.TruncateAt.MARQUEE); txtHeading.setSingleLine(true); sessionLogin=new Session(this); recyclerView=(RecyclerView)findViewById(R.id.recAdmin); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recModelClass=new RecModelClass(R.drawable.imgadd,"Manage","Advertisements"); recModelClass1=new RecModelClass(R.drawable.candidetails,"Candidate","Details"); recModelClass2=new RecModelClass(R.drawable.score,"Candidate","Score"); recModelClass3=new RecModelClass(R.drawable.results,"Results",""); arrayList=new ArrayList<>(); arrayList.add(recModelClass); arrayList.add(recModelClass1); arrayList.add(recModelClass2); arrayList.add(recModelClass3); RecyclerViewClickListener listener = (view, position) -> { // Toast.makeText(view.getContext(), "Position " + position, Toast.LENGTH_SHORT).show(); switch (position){ case 0: AlertDialog.Builder builder=new AlertDialog.Builder(this); String ar[]={"Add new Advertisments","Current Advertisments","Advertisment History"}; builder.setItems(ar, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i==0){ // Toast.makeText(AdminNewMain.this, "Create", Toast.LENGTH_SHORT).show(); startActivity(new Intent(AdminNewMain.this,Test_create__adv.class)); } else if (i==1){ //Toast.makeText(AdminNewMain.this, "View current advertisments", Toast.LENGTH_SHORT).show(); startActivity(new Intent(AdminNewMain.this,currentAdvertisements.class)); } else if (i==2){ //Toast.makeText(AdminNewMain.this, "View advertisments history", Toast.LENGTH_SHORT).show(); startActivity(new Intent(AdminNewMain.this,allAdvertisements.class)); } } }); AlertDialog alertDialog=builder.create(); alertDialog.show(); break; case 1: //Toast.makeText(this, "Candidate Details", Toast.LENGTH_SHORT).show(); AlertDialog.Builder builder1=new AlertDialog.Builder(this); String ar1[]={"For Current Recruitments","For Past Recruitments"}; builder1.setItems(ar1, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i==0){ //Toast.makeText(AdminNewMain.this, "Create", Toast.LENGTH_SHORT).show(); startActivity(new Intent(AdminNewMain.this,CandidateDetails.class)); } else if (i==1){ //Toast.makeText(AdminNewMain.this, "View current advertisments", Toast.LENGTH_SHORT).show(); startActivity(new Intent(AdminNewMain.this,pastCandidates.class)); } } }); AlertDialog alertDialog1=builder1.create(); alertDialog1.show(); break; case 2: //Toast.makeText(this, "Candidate Scores", Toast.LENGTH_SHORT).show(); AlertDialog.Builder builder2=new AlertDialog.Builder(this); String ar2[]={"Current Candidates' Score","Past Candidates' Score"}; builder2.setItems(ar2, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i==0){ //Toast.makeText(AdminNewMain.this, "Create", Toast.LENGTH_SHORT).show(); Intent intent=new Intent(AdminNewMain.this,CandidateScore.class); intent.putExtra("mode","C"); startActivity(intent); //startActivity(new Intent(AdminNewMain.this,CandidateDetails.class)); } else if (i==1){ //Toast.makeText(AdminNewMain.this, "View current advertisments", Toast.LENGTH_SHORT).show(); Intent intent=new Intent(AdminNewMain.this,CandidateScore.class); intent.putExtra("mode","P"); startActivity(intent); } } }); AlertDialog alertDialog2=builder2.create(); alertDialog2.show(); break; case 3: AlertDialog.Builder builder3=new AlertDialog.Builder(this); String ar3[]={"Create Result","Currently Declared Results","Past Results"}; builder3.setItems(ar3, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i==0){ // Toast.makeText(AdminNewMain.this, "Create", Toast.LENGTH_SHORT).show(); startActivity(new Intent(AdminNewMain.this,Results_create.class)); } else if (i==1){ //Toast.makeText(AdminNewMain.this, "View current advertisments", Toast.LENGTH_SHORT).show(); Intent intent=new Intent(AdminNewMain.this,Results_show.class); intent.putExtra("mode","C"); startActivity(intent); } else if (i==2){ //Toast.makeText(AdminNewMain.this, "View advertisments history", Toast.LENGTH_SHORT).show(); Intent intent=new Intent(AdminNewMain.this,Results_show.class); intent.putExtra("mode","P"); startActivity(intent); } } }); AlertDialog alertDialog3=builder3.create(); alertDialog3.show(); break; } }; adapter=new RecyclerAdapter(this,arrayList,listener); recyclerView.setAdapter(adapter); } private boolean checkPermission() { if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { // Permission is not granted return false; } return true; } private void requestPermission() { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, PERMISSION_REQUEST_CODE); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { switch (requestCode) { case RESULT_LOAD_IMAGE: // If request is cancelled, the result arrays are empty. if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); // startActivityForResult(galleryIntent, RESULT_LOAD_IMAGE); Toast.makeText(this, "EXTERNAL STORAGE PERMISSIONS GRANTED", Toast.LENGTH_SHORT).show(); } else { android.app.AlertDialog.Builder builder=new android.app.AlertDialog.Builder(AdminNewMain.this); builder.setTitle("Alert!"); builder.setIcon(R.drawable.alert); builder.setMessage("To continue allow this app access to External Storage"); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if(ContextCompat.checkSelfPermission(AdminNewMain.this,Manifest.permission.READ_EXTERNAL_STORAGE)!=PackageManager.PERMISSION_GRANTED){ ActivityCompat.requestPermissions(AdminNewMain.this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},RESULT_LOAD_IMAGE); } } }); android.app.AlertDialog showmsg=builder.create(); showmsg.show(); //Toast.makeText(getApplicationContext(), "Please provide access to the gallery", Toast.LENGTH_LONG).show(); //do something like displaying a message that he didn`t allow the app to access gallery and you wont be able to let him select from gallery } break; case PERMISSION_REQUEST_CODE: if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { Toast.makeText(getApplicationContext(), "Permission Granted", Toast.LENGTH_SHORT).show(); // main logic } else { //Toast.makeText(getApplicationContext(), "Permission Denied", Toast.LENGTH_SHORT).show(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { showMessageOKCancel("To continue please grant Camera Permissions", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { requestPermission(); } } }); } } } break; } } private void showMessageOKCancel(String message, DialogInterface.OnClickListener okListener) { new android.app.AlertDialog.Builder(AdminNewMain.this) .setMessage(message) .setIcon(R.drawable.alert) .setPositiveButton("OK", okListener) // .setNegativeButton("Cancel", null) .create() .show(); } public final boolean isInternetOn() { // get Connectivity Manager object to check connection ConnectivityManager connec = (ConnectivityManager)getSystemService(getBaseContext().CONNECTIVITY_SERVICE); // Check for network connections if ( connec.getNetworkInfo(0).getState() == android.net.NetworkInfo.State.CONNECTED || connec.getNetworkInfo(0).getState() == android.net.NetworkInfo.State.CONNECTING || connec.getNetworkInfo(1).getState() == android.net.NetworkInfo.State.CONNECTING || connec.getNetworkInfo(1).getState() == android.net.NetworkInfo.State.CONNECTED ) { // if connected with internet // Toast.makeText(this, " Connected ", Toast.LENGTH_LONG).show(); return true; } else if ( connec.getNetworkInfo(0).getState() == android.net.NetworkInfo.State.DISCONNECTED || connec.getNetworkInfo(1).getState() == android.net.NetworkInfo.State.DISCONNECTED ) { android.app.AlertDialog alertDialog = new android.app.AlertDialog.Builder( AdminNewMain.this).create(); // Setting Dialog Title alertDialog.setTitle("Alert"); // Setting Dialog Message alertDialog.setMessage("To continue please turn on internet connection"); // Setting Icon to Dialog alertDialog.setIcon(R.drawable.alert); // Setting OK Button alertDialog.setButton(Dialog.BUTTON_POSITIVE,"OK",new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) { //Toast.makeText(getApplicationContext(), "Okay", Toast.LENGTH_SHORT).show(); isInternetOn(); } }); // Showing Alert Message alertDialog.show(); return false; } return false; } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_admin,menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case R.id.logout: sessionLogin.setAdminLoginVar("false"); // Toast.makeText(this, "Logging out", Toast.LENGTH_SHORT).show(); startActivity(new Intent(AdminNewMain.this, Login.class)); finish(); } return true; } }
[ "kapoor.khushali07@gmail.com" ]
kapoor.khushali07@gmail.com
2168aca4b5304cb97ca6e1f93c382881e4382fe9
935666698682a117fb668535c11a558cb2e2440c
/com-boot-es/src/test/java/com/zbcn/combootes/user/service/impl/FuzzyQueryServiceImplTest.java
86cbede07bb0a08ed06fa6dc98972aa683d08e93
[]
no_license
1363653611/SpringBootDemon
5570765a65f9f96417bad33fc3004c16fbc89feb
55ba18b64ba741af35585f7e7b2fa67790c12ab3
refs/heads/master
2022-12-25T18:47:21.080134
2021-02-05T08:11:50
2021-02-05T08:11:50
207,982,232
1
1
null
2022-12-16T00:42:09
2019-09-12T06:40:02
Java
UTF-8
Java
false
false
1,048
java
package com.zbcn.combootes.user.service.impl; import com.alibaba.fastjson.JSONArray; import com.zbcn.combootes.user.entity.UserInfo; import com.zbcn.combootes.user.service.FuzzyQueryService; import org.elasticsearch.common.unit.Fuzziness; import org.elasticsearch.index.query.FuzzyQueryBuilder; import org.elasticsearch.index.query.QueryBuilders; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.List; @RunWith(SpringRunner.class) @SpringBootTest class FuzzyQueryServiceImplTest { @Autowired FuzzyQueryService fuzzyQueryService; @Test void fuzzyQuery() { FuzzyQueryBuilder fuzziness = QueryBuilders.fuzzyQuery("name", "三").fuzziness(Fuzziness.AUTO); List<UserInfo> userInfos = fuzzyQueryService.fuzzyQuery(fuzziness); System.out.println(JSONArray.toJSONString(userInfos)); } }
[ "zbcn810@163.com" ]
zbcn810@163.com
6c7e0b93a1a1338f2715a34c6fb7290c833a205d
db264ffd95e6fac39486702067ac598fada95f2b
/src/main/java/com/example/controller/StaffController.java
9d5f7f24dda15e385db8ea92477f8f0c72bc31c4
[ "MIT" ]
permissive
PrasannaVenkatesan/angular-crud
f5efdc09657a263a411da1d6235e09e0061054c8
dec3e63467c154795a611e99773b402728b36916
refs/heads/master
2020-07-14T03:56:30.872204
2017-06-14T06:16:25
2017-06-14T06:16:25
94,296,129
0
0
null
null
null
null
UTF-8
Java
false
false
1,897
java
package com.example.controller; import static org.mockito.Mockito.verify; import java.util.List; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.example.model.Staff; import com.example.repository.StaffRepository; @RestController @RequestMapping("/api/staff") public class StaffController { @Autowired private StaffRepository staffrep; @RequestMapping(method = RequestMethod.POST) public Staff create(@RequestBody Staff staff) { staff.setId(null); return staffrep.saveAndFlush(staff); } @RequestMapping(value="{id}",method=RequestMethod.PUT) public Staff update(@PathVariable Integer id,@RequestBody Staff updatestaff) { Staff staff = staffrep.getOne(id); staff.setName(updatestaff.getName()); staff.setDepart(updatestaff.getDepart()); staff.setAge(updatestaff.getAge()); return staffrep.saveAndFlush(staff); } @RequestMapping(value="{id}",method=RequestMethod.DELETE) public void delete(@PathVariable Integer id) { staffrep.delete(id); } @RequestMapping(method = RequestMethod.GET) public List<Staff> display(){ return staffrep.findAll(); } @RequestMapping(value="{id}",method=RequestMethod.GET) public Staff displayone(@PathVariable Integer id) { return staffrep.findOne(id); } @RequestMapping(value="fnd/{subject}",method=RequestMethod.GET) public Staff subjectdisplay(@PathVariable String subject) { return staffrep.findBySubject(subject); } @RequestMapping(value="age/{age}",method=RequestMethod.GET) public List<Staff> age(@PathVariable Integer age) { return staffrep.findByAge(age); } }
[ "prasanna.v@KGFSL.COM" ]
prasanna.v@KGFSL.COM
0df498a5880f0a503b43a356d383d95c32b01a8d
5d97180f46a4a0d6a28433ee64486f3b806a8e61
/src/java/negocio/TipoProductoObj.java
7e57f2bf3fae84b9532a2655b0b10b8734597a54
[]
no_license
TeresaLicito/Bogocenter
a5fbe2eae95ec9deb361e07229c00947719aa180
2eb176448965d900695da25615bf1f0013eb9fe3
refs/heads/master
2021-07-01T22:49:17.914932
2017-09-19T19:34:21
2017-09-19T19:34:21
104,119,287
0
0
null
null
null
null
UTF-8
Java
false
false
630
java
package negocio; public class TipoProductoObj { private String codTipo_Producto, nombre, descripcion; public String getCodTipo_Producto() { return codTipo_Producto; } public void setCodTipo_Producto(String codTipo_Producto) { this.codTipo_Producto = codTipo_Producto; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } }
[ "noreply@github.com" ]
noreply@github.com
ae4f5cfd20e5156c427345d1682ad70082ed386c
f8153963af4f5fd50d3b4483cf7e6534360d106e
/kun-workflow/kun-workflow-executor/src/test/java/com/miotech/kun/workflow/executor/kubernetes/KubernetesResourceManageTest.java
c67af52bdf098490c10388d3b2c3fad46594fa93
[ "Apache-2.0" ]
permissive
hypmiotech/kun-scheduler
1c8409cd20f014ec1041d320657b46cabe751673
a53ced5b75ba49972350cc1b38f8bfac9ad1874d
refs/heads/master
2023-07-27T19:42:49.988414
2021-09-03T09:55:53
2021-09-03T09:55:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,516
java
package com.miotech.kun.workflow.executor.kubernetes; import com.google.inject.Inject; import com.miotech.kun.commons.utils.Props; import com.miotech.kun.workflow.core.model.resource.ResourceQueue; import com.miotech.kun.workflow.executor.CommonTestBase; import io.fabric8.kubernetes.api.model.Namespace; import io.fabric8.kubernetes.api.model.Quantity; import io.fabric8.kubernetes.api.model.ResourceQuota; import io.fabric8.kubernetes.client.Config; import io.fabric8.kubernetes.client.ConfigBuilder; import io.fabric8.kubernetes.client.DefaultKubernetesClient; import io.fabric8.kubernetes.client.KubernetesClient; import org.junit.Ignore; import org.junit.Test; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; @Ignore public class KubernetesResourceManageTest extends CommonTestBase { @Inject private KubernetesResourceManager kubernetesResourceManager; private KubernetesClient client; @Override protected void configuration() { Props props = new Props(); props.put("executor.env.name", "KUBERNETES"); props.put("executor.env.version", "1.15"); props.put("executor.env.logPath", "/server/lib/logs"); props.put("executor.env.resourceQueues", "default,test"); props.put("executor.env.resourceQueues.default.quota.cores", 2); props.put("executor.env.resourceQueues.default.quota.memory", 6); props.put("executor.env.resourceQueues.default.quota.workerNumbers", 3); props.put("executor.env.resourceQueues.test.quota.cores", 2); props.put("executor.env.resourceQueues.test.quota.memory", 1); props.put("executor.env.resourceQueues.test.quota.workerNumbers", 3); Config config = new ConfigBuilder().withMasterUrl("http://localhost:9880").build(); client = new DefaultKubernetesClient(config); bind(KubernetesClient.class, client); bind(Props.class, props); super.configuration(); } @Test public void testCreateNameSpaceAfterSetup() { kubernetesResourceManager.init(); List<Namespace> nameSpaces = client.namespaces().list().getItems(); List<String> foundNameSpace = nameSpaces.stream(). map(namespace -> namespace.getMetadata().getName()) .collect(Collectors.toList()); //verify assertThat(foundNameSpace, hasItems("default","test")); ResourceQuota defaultQuota = client.resourceQuotas().inNamespace("default").withName("default").get(); ResourceQueue defaultQueue = coverQuotaToQueue(defaultQuota); assertThat(defaultQueue.getCores(), is(2)); assertThat(defaultQueue.getMemory(), is(6)); assertThat(defaultQueue.getWorkerNumbers(), is(3)); ResourceQuota testQuota = client.resourceQuotas().inNamespace("test").withName("test").get(); ResourceQueue testQueue = coverQuotaToQueue(testQuota); assertThat(testQueue.getCores(), is(2)); assertThat(testQueue.getMemory(), is(1)); assertThat(testQueue.getWorkerNumbers(), is(3)); //clean up client.resourceQuotas().inNamespace("default").delete(); client.resourceQuotas().inNamespace("test").delete(); } @Test public void testCreateResourceQueue() { ResourceQueue toCreate = ResourceQueue.newBuilder() .withQueueName("queue-create") .withCores(2) .withMemory(2) .withWorkerNumbers(2) .build(); kubernetesResourceManager.createResourceQueue(toCreate); ResourceQuota createdQuota = client.resourceQuotas().inNamespace("queue-create").withName("queue-create").get(); ResourceQueue createdQueue = coverQuotaToQueue(createdQuota); assertThat(createdQueue, is(toCreate)); //clean up client.resourceQuotas().inNamespace("queue-create").delete(); } @Test public void testUpdateResourceQueue() { ResourceQueue toCreate = ResourceQueue.newBuilder() .withQueueName("queue-create") .withCores(2) .withMemory(2) .withWorkerNumbers(2) .build(); kubernetesResourceManager.createResourceQueue(toCreate); ResourceQueue toUpdate = toCreate .cloneBuilder() .withCores(3) .withMemory(3) .withWorkerNumbers(3) .build(); kubernetesResourceManager.updateResourceQueue(toUpdate); ResourceQuota updatedQuota = client.resourceQuotas().inNamespace("queue-create").withName("queue-create").get(); ResourceQueue updatedQueue = coverQuotaToQueue(updatedQuota); assertThat(updatedQueue, is(toUpdate)); //cleanUp client.resourceQuotas().inNamespace("queue-create").delete(); } private ResourceQueue coverQuotaToQueue(ResourceQuota resourceQuota) { Map<String, Quantity> hards = resourceQuota.getSpec().getHard(); return ResourceQueue.newBuilder() .withQueueName(resourceQuota.getMetadata().getName()) .withCores(Integer.parseInt(hards.get("limits.cpu").getAmount())) .withMemory(Integer.parseInt(hards.get("limits.memory").getAmount())) .withWorkerNumbers(Integer.parseInt(hards.get("pods").getAmount())) .build(); } }
[ "w_yide@163.com" ]
w_yide@163.com
d7458c91fa33266be3b3b2e635edff52e013474e
7febc3ff643a3e71aff292f7f26e95d2e11ce0da
/kogito-test-utils/src/main/java/org/kie/kogito/testcontainers/KogitoInfinispanContainer.java
2b17bd02c9584e38fb913798c329a8c034032693
[ "Apache-2.0" ]
permissive
dupliaka/kogito-runtimes
b12b01fa5d909cc99ba003c43f229ee31dea7c3d
545dc5d120133bff8b5edbb85db1cc894db19425
refs/heads/master
2023-02-27T20:58:21.507819
2020-12-03T09:37:13
2020-12-07T07:59:31
319,295,156
0
1
Apache-2.0
2021-01-29T11:14:31
2020-12-07T11:15:20
null
UTF-8
Java
false
false
2,430
java
/** * Copyright 2020 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kie.kogito.testcontainers; import org.kie.kogito.resources.TestResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testcontainers.containers.BindMode; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.output.Slf4jLogConsumer; import org.testcontainers.containers.wait.strategy.Wait; /** * This container wraps Infinispan container * */ public class KogitoInfinispanContainer extends GenericContainer<KogitoInfinispanContainer> implements TestResource { private static final Logger LOGGER = LoggerFactory.getLogger(KogitoInfinispanContainer.class); public static final String NAME = "infinispan"; public static final int PORT = 11222; public static final String INFINISPAN_PROPERTY = "container.image." + NAME; public static final String CONF_PATH = "/opt/infinispan/server/conf/"; public KogitoInfinispanContainer() { addExposedPort(PORT); withLogConsumer(new Slf4jLogConsumer(LOGGER)); waitingFor(Wait.forHttp("/")); setDockerImageName(System.getProperty(INFINISPAN_PROPERTY)); withClasspathResourceMapping("testcontainers/infinispan/infinispan-local.xml", CONF_PATH + "infinispan-local.xml", BindMode.READ_ONLY); withClasspathResourceMapping("testcontainers/infinispan/users.properties", CONF_PATH + "users.properties", BindMode.READ_ONLY); withClasspathResourceMapping("testcontainers/infinispan/groups.properties", CONF_PATH + "groups.properties", BindMode.READ_ONLY); setCommand("/opt/infinispan/bin/server.sh -c infinispan-local.xml"); } @Override public int getMappedPort() { return getMappedPort(PORT); } @Override public String getResourceName() { return NAME; } }
[ "noreply@github.com" ]
noreply@github.com
e9b093fe7127947e356e2029ae15edc6fdb6c1b4
c9a075e4f54f26c78f10fcdae34a106ab478ae55
/src/main/java/com/lk/manage/mywork/model/RoleResource.java
c9548d369e6e7634363b5d6d236fb69782e855a5
[]
no_license
DanieLong/mywork
249873ca4e20062d080998abe314f3f962124d03
55218e24b8a4bf677d6b8aff54889adb0769c538
refs/heads/master
2020-03-11T23:58:23.476803
2018-04-20T09:55:57
2018-04-20T09:55:57
130,337,034
0
0
null
null
null
null
UTF-8
Java
false
false
179
java
package com.lk.manage.mywork.model; import java.util.List; public class RoleResource { private String id; private String roleId; private List<Resource> resources; }
[ "longke@cictec.cn" ]
longke@cictec.cn
b6dcd9155f9abc76ec86fdcc5b25437257fb1200
6236e26a8e40306d9c8a369de59f58c5d19431ed
/httpsnippet-demo/src/main/java/io/github/atkawa7/httpsnippet/demo/config/DemoConfig.java
557e174f9c2ffb42d45c5ec69010018646688866
[ "Apache-2.0" ]
permissive
atkawa7/httpsnippet
1f137eb6ba779788a98d1640dc08ce8ce42c88c1
6a951c9157b890073da2235a5f0f8b198d3fe3ef
refs/heads/master
2023-01-04T23:33:02.762501
2021-04-21T17:15:47
2021-04-21T17:15:47
173,534,034
19
6
Apache-2.0
2022-12-30T17:23:36
2019-03-03T05:17:59
Java
UTF-8
Java
false
false
4,322
java
package io.github.atkawa7.httpsnippet.demo.config; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import io.github.atkawa7.httpsnippet.demo.domain.EntityMarker; import io.github.atkawa7.httpsnippet.demo.processors.SpeakerProcessor; import io.github.atkawa7.httpsnippet.demo.processors.SpeakerProcessorImpl; import io.github.atkawa7.httpsnippet.demo.repository.RepositoryMarker; import io.github.atkawa7.httpsnippet.demo.repository.SpeakerRepository; import io.github.atkawa7.httpsnippet.demo.resources.SpeakerResource; import io.github.atkawa7.httpsnippet.demo.service.SpeakerService; import io.github.atkawa7.httpsnippet.demo.service.SpeakerServiceImpl; import io.github.atkawa7.httpsnippet.demo.swagger.extensions.ExternalDocsVendorExtension; import io.github.atkawa7.httpsnippet.demo.swagger.extensions.LogoVendorExtension; import io.github.atkawa7.httpsnippet.demo.swagger.plugins.CodeSampleOperationBuilderPlugin; import io.github.atkawa7.httpsnippet.http.MediaType; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.service.Tag; import springfox.documentation.service.VendorExtension; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; @Configuration @EntityScan(basePackageClasses = EntityMarker.class) @EnableJpaRepositories(basePackageClasses = RepositoryMarker.class) public class DemoConfig { @Bean public DemoProperties demoProperties(Environment environment) { return new DemoProperties(environment); } @Bean public SpeakerService speakerService(SpeakerRepository speakerRepository) { return new SpeakerServiceImpl(speakerRepository); } @Bean public SpeakerProcessor speakerProcessor(SpeakerService speakerService) { return new SpeakerProcessorImpl(speakerService); } @Bean public CodeSampleOperationBuilderPlugin codeSampleProcessor(DemoProperties demoProperties) { return new CodeSampleOperationBuilderPlugin(demoProperties); } @Bean public Docket docket(DemoProperties demoProperties) { Set<String> protocols = new HashSet<>(Collections.singleton("http")); List<VendorExtension> apiInfoVendorExtensions = Collections.singletonList( new LogoVendorExtension(demoProperties).getObjectVendorExtension()); List<VendorExtension> docketVendorExtensions = Collections.singletonList( new ExternalDocsVendorExtension(demoProperties).getObjectVendorExtension()); ApiInfo apiInfo = new ApiInfoBuilder() .title(demoProperties.getApplicationName()) .description(demoProperties.getApplicationDescription()) .contact( new Contact( demoProperties.getApplicationName(), demoProperties.getApplicationDomain(), demoProperties.getApplicationSupport())) .license(demoProperties.getApplicationLicenseName()) .licenseUrl(demoProperties.getApplicationLicenseUrl()) .version(demoProperties.getApplicationVersion()) .termsOfServiceUrl(demoProperties.getApplicationLicenseUrl()) .extensions(apiInfoVendorExtensions) .build(); return new Docket(DocumentationType.OAS_30) .protocols(protocols) .apiInfo(apiInfo) .produces(Collections.singleton(MediaType.APPLICATION_JSON)) .consumes(Collections.singleton(MediaType.APPLICATION_JSON)) .extensions(docketVendorExtensions) .tags(new Tag("Speakers", "Speakers at Spring One Conference")) .select() .apis(RequestHandlerSelectors.basePackage(SpeakerResource.class.getPackage().getName())) .paths(PathSelectors.any()) .build(); } }
[ "atkawa7@yahoo.com" ]
atkawa7@yahoo.com
20c79251644a38760a68988ca00d2cfe3a91b64e
075344f5410ccbc9ded2773cc22f88079ce55280
/app/src/main/java/com/example/fitgenerator/adapters/FitsMainAdapter.java
da851510a971bdea83621162685f5e51d54f3726
[]
no_license
OmarGuajardo/FitGenerator
2cb982772e9a830c17e1f94d7bfa9986f4ed4be2
931252c66d3da532158b1fac8b2b60410c04486b
refs/heads/master
2022-11-29T16:31:49.032713
2020-08-13T20:05:39
2020-08-13T20:05:39
277,947,141
1
0
null
null
null
null
UTF-8
Java
false
false
2,025
java
package com.example.fitgenerator.adapters; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.example.fitgenerator.R; import com.example.fitgenerator.models.Fit; import com.example.fitgenerator.models.Section; import java.util.List; public class FitsMainAdapter extends RecyclerView.Adapter<FitsMainAdapter.ViewHolder> { List<Section> sectionList; Context context; public FitsMainAdapter(List<Section> sectionList, Context context) { this.sectionList = sectionList; this.context = context; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); View view = layoutInflater.inflate(R.layout.header_fit_item, parent, false); return new ViewHolder(view); } @Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { Section section = sectionList.get(position); String sectionName = section.getSectionName(); List<Fit> items = section.getSectionItems(); holder.sectionNameTextView.setText(sectionName); ChildRecyclerAdapter childRecyclerAdapter = new ChildRecyclerAdapter(items,context); holder.childRecyclerView.setAdapter(childRecyclerAdapter); } @Override public int getItemCount() { return sectionList.size(); } public class ViewHolder extends RecyclerView.ViewHolder { TextView sectionNameTextView; RecyclerView childRecyclerView; public ViewHolder(@NonNull View itemView) { super(itemView); sectionNameTextView = itemView.findViewById(R.id.sectionNameTextView); childRecyclerView = itemView.findViewById(R.id.childRecyclerView); } } }
[ "omar.guajardog@outlook.com" ]
omar.guajardog@outlook.com
4421d3231670ccdb63e5d64bc2282cab67afa4e4
17aa64e839f88415d5778025f393b054a2374de0
/app/src/main/java/com/aserbao/aserbaosandroid/functions/screen/ScreenActivity.java
e2803a5d182a101319115e5eb6da813292798316
[]
no_license
zhuhuajian0527/AserbaosAndroid
dc7093e7a04b4fd8b37dc65cfba4f8f7b3c8f471
b10f87b01e580f0c88264981ec3e36830f04901a
refs/heads/master
2021-03-28T18:39:19.932430
2020-03-16T12:51:33
2020-03-16T12:51:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
786
java
package com.aserbao.aserbaosandroid.functions.screen; import android.view.View; import com.aserbao.aserbaosandroid.comon.base.BaseRecyclerViewActivity; import com.aserbao.aserbaosandroid.comon.base.beans.BaseRecyclerBean; /* * 作用: * @author aserbao * @date: on 2020-02-28 * @project: AserbaosAndroid * @package: com.aserbao.aserbaosandroid.functions.screen */ public class ScreenActivity extends BaseRecyclerViewActivity { @Override public void initGetData() { mBaseRecyclerBean.add(new BaseRecyclerBean("获取View旋转后在屏幕中的位置",0)); } @Override public void itemClickBack(View view, int position, boolean isLongClick, int comeFrom) { switch (position){ case 0: break; } } }
[ "aserbao@163.com" ]
aserbao@163.com
9b8624571a77245b9764f8f2df4093fa9e2da24d
b9463ac6cac5b2eea02b5f0961bd0ee05f777f95
/test/native_jdbc_programing/service/TransactionServiceTest.java
1cc6b4ae94b9421db457b40784f712df20045953
[]
no_license
stpn94/native_jdbc_prog
c9c6a9f2dc91ad2b69d84dbcb3a763a1bd27e132
dc5c0e1c8d26f0fd734802d14ecdfee43c0fa16b
refs/heads/master
2023-03-19T11:24:30.357169
2021-03-08T10:58:33
2021-03-08T10:58:33
341,812,866
0
0
null
null
null
null
UTF-8
Java
false
false
3,815
java
package native_jdbc_programing.service; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; import native_jdbc_programing.dto.Department; import native_jdbc_programing.dto.Title; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TransactionServiceTest { private static TransactionService service; @BeforeClass public static void setUpBeforeClass() throws Exception { service = new TransactionService(); } @AfterClass public static void tearDownClass() throws Exception { service = null; } @After public void tearDown() throws Exception { System.out.println("----------------"); } // ------------------------------------------------------------------------- @Test public void test01TransAddTitleAndDepartment_FailTitle() { System.out.printf("%s()%n", "testTransAddTitleAndDepartment_FailTitle"); Title title = new Title(1, "영업"); Department dept = new Department(5, "비상계획부", 10); String res = service.transAddTitleAndDepartment(title, dept); Assert.assertEquals("rollback", res); } @Test public void test02TransAddTitleAndDepartment_FailDept() { System.out.printf("%s()%n", "testTransAddTitleAndDepartment_FailTitle"); Title title = new Title(6, "인턴"); Department dept = new Department(1, "비상계획부", 10); String res = service.transAddTitleAndDepartment(title, dept); Assert.assertEquals("rollback", res); } @Test public void test03TransAddTitleAndDepartment_FailBoth() { System.out.printf("%s()%n", "testTransAddTitleAndDepartment_FailTitle"); Title title = new Title(1, "인턴"); Department dept = new Department(1, "비상계획부", 10); String res = service.transAddTitleAndDepartment(title, dept); Assert.assertEquals("rollback", res); } @Test public void test04TransAddTitleAndDepartment_Success() { System.out.printf("%s()%n", "testTransAddTitleAndDepartment_FailTitle"); Title title = new Title(6, "인턴"); Department dept = new Department(5, "비상계획부", 10); String res = service.transAddTitleAndDepartment(title, dept); Assert.assertEquals("commit", res); } // ------------------------------------------------------------------------- @Test public void test05TransRemoveTitleAndDepartment_FailTitle() { System.out.printf("%s()%n", "testTransRemoveTitleAndDepartment_FailTitle"); Title title = new Title(6); Department dept = new Department(0); int res = service.transRemoveTitleAndDepartment(title, dept); Assert.assertEquals(1, res); } @Test public void test06TransRemoveTitleAndDepartment_FailDept() { System.out.printf("%s()%n", "testTransRemoveTitleAndDepartment_FailDept"); Title title = new Title(0); Department dept = new Department(15); int res = service.transRemoveTitleAndDepartment(title, dept); Assert.assertEquals(0, res); } @Test public void test07TransRemoveTitleAndDepartment_FailBoth() { System.out.printf("%s()%n", "testTransRemoveTitleAndDepartment_FailBoth"); Title title = new Title(0); Department dept = new Department(0); int res = service.transRemoveTitleAndDepartment(title, dept); Assert.assertEquals(0, res); } @Test public void test08TransRemoveTitleAndDepartment_Success() { System.out.printf("%s()%n", "testTransRemoveTitleAndDepartment_Success"); Title title = new Title(6); Department dept = new Department(5); int res = service.transRemoveTitleAndDepartment(title, dept); Assert.assertEquals(2, res); } // ------------------------------------------------------------------------- }
[ "stpn94@gmail.com" ]
stpn94@gmail.com
5d48222424bb9c9fedc6ab675204fdc73c3ea8a4
6f0b1c6af160b0a326594fe86b7976f918ee5ece
/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/ValidateAddUpdateSqlViewAction.java
785219c7b91af6b2d9ff8b404ebc98206efe9f98
[ "BSD-3-Clause" ]
permissive
steffeli/inf5750-tracker-capture
9132261928e43099b2a3ad58344dd1efdab3ad83
1666418b71d124b37770a3ccc8d4f1215be5a29e
refs/heads/master
2021-01-22T00:09:55.665406
2015-12-08T14:54:19
2015-12-08T14:54:19
46,442,738
0
1
null
2016-03-09T16:58:25
2015-11-18T19:40:12
Java
UTF-8
Java
false
false
5,060
java
package org.hisp.dhis.dataadmin.action.sqlview; /* * Copyright (c) 2004-2015, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * Neither the name of the HISP project nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import org.hisp.dhis.common.IllegalQueryException; import org.hisp.dhis.i18n.I18n; import org.hisp.dhis.sqlview.SqlView; import org.hisp.dhis.sqlview.SqlViewService; import org.hisp.dhis.sqlview.SqlViewType; import com.opensymphony.xwork2.Action; /** * @author Dang Duy Hieu */ public class ValidateAddUpdateSqlViewAction implements Action { private static final String ADD = "add"; // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- private SqlViewService sqlViewService; public void setSqlViewService( SqlViewService sqlViewService ) { this.sqlViewService = sqlViewService; } // ------------------------------------------------------------------------- // I18n // ------------------------------------------------------------------------- private I18n i18n; public void setI18n( I18n i18n ) { this.i18n = i18n; } // ------------------------------------------------------------------------- // Input // ------------------------------------------------------------------------- private String mode; public void setMode( String mode ) { this.mode = mode; } private String name; public void setName( String name ) { this.name = name; } private String sqlquery; public void setSqlquery( String sqlquery ) { this.sqlquery = sqlquery; } private boolean query; public void setQuery( boolean query ) { this.query = query; } // ------------------------------------------------------------------------- // Output // ------------------------------------------------------------------------- private String message; public String getMessage() { return message; } // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @Override public String execute() { message = null; if ( name == null || name.trim().isEmpty() ) { message = i18n.getString( "name_is_null" ); return INPUT; } if ( mode.equals( ADD ) && sqlViewService.getSqlView( name ) != null ) { message = i18n.getString( "name_in_use" ); return INPUT; } if ( sqlquery == null || sqlquery.trim().isEmpty() ) { message = i18n.getString( "sqlquery_is_empty" ); return INPUT; } try { SqlView sqlView = new SqlView( name, sqlquery, SqlViewType.VIEW ); // Avoid variable check sqlViewService.validateSqlView( sqlView, null, null ); } catch ( IllegalQueryException ex ) { message = ex.getMessage(); return INPUT; } if ( !query ) { message = sqlViewService.testSqlGrammar( sqlquery ); } if ( message != null ) { return INPUT; } return SUCCESS; } }
[ "steffen.lien@mimedi.no" ]
steffen.lien@mimedi.no
d5e8bd570a895129fc471b7e1d5dce5148d12c1b
a79c006dc4ae5755a025e71d9a97a71dd5b30d4e
/cms/.svn/pristine/45/45ec5ae5f4520b313c6ca5a8861be852d7d4ea93.svn-base
36a56adb07ca52359e54d96dad5dc1d92b882658
[]
no_license
chocoai/workspace
d62774d92e255662374dae1894e36e08ea9529e6
ab0e20d7945ef8af439d848625eb30eb8f46e668
refs/heads/master
2020-04-13T07:37:52.922076
2018-11-09T11:03:09
2018-11-09T11:03:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,676
package com.yhcrt.weihu.core.manager.impl; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.yhcrt.weihu.cms.manager.assist.CmsResourceMng; import com.yhcrt.weihu.common.hibernate3.Updater; import com.yhcrt.weihu.core.dao.CmsSiteDao; import com.yhcrt.weihu.core.entity.CmsSite; import com.yhcrt.weihu.core.entity.CmsSiteCompany; import com.yhcrt.weihu.core.entity.CmsUser; import com.yhcrt.weihu.core.entity.CmsWorkflow; import com.yhcrt.weihu.core.manager.CmsSiteCompanyMng; import com.yhcrt.weihu.core.manager.CmsSiteMng; import com.yhcrt.weihu.core.manager.CmsUserMng; import com.yhcrt.weihu.core.manager.CmsUserSiteMng; import com.yhcrt.weihu.core.manager.CmsWorkflowMng; import com.yhcrt.weihu.core.manager.FtpMng; @Service @Transactional public class CmsSiteMngImpl implements CmsSiteMng { private static final Logger log = LoggerFactory .getLogger(CmsSiteMngImpl.class); @Transactional(readOnly = true) public List<CmsSite> getList() { return dao.getList(false); } @Transactional(readOnly = true) public List<CmsSite> getListFromCache() { return dao.getList(true); } @Transactional(readOnly = true) public List<CmsSite> getListByMaster(Boolean master) { return dao.getListByMaster(master); } @Transactional(readOnly = true) public List<CmsSite> getListByParent(Integer parentId){ return dao.getListByParent(parentId); } @Transactional(readOnly = true) public boolean hasRepeatByProperty(String property){ return (getList().size()-dao.getCountByProperty(property))>0?true:false; } @Transactional(readOnly = true) public List<CmsSite> getTopList(){ return dao.getTopList(); } @Transactional(readOnly = true) public CmsSite findByDomain(String domain) { return dao.findByDomain(domain); } @Transactional(readOnly = true) public CmsSite findByAccessPath(String accessPath){ return dao.findByAccessPath(accessPath); } @Transactional(readOnly = true) public CmsSite findById(Integer id) { CmsSite entity = dao.findById(id); return entity; } public CmsSite save(CmsSite currSite, CmsUser currUser, CmsSite bean, Integer uploadFtpId,Integer syncPageFtpId) throws IOException { if (uploadFtpId != null) { bean.setUploadFtp(ftpMng.findById(uploadFtpId)); } if(syncPageFtpId!=null){ bean.setSyncPageFtp(ftpMng.findById(syncPageFtpId)); } bean.init(); dao.save(bean); // 复制本站模板 cmsResourceMng.copyTplAndRes(currSite, bean); // 处理管理员 cmsUserMng.addSiteToUser(currUser, bean, bean.getFinalStep()); //保存站点相关公司信息 CmsSiteCompany company=new CmsSiteCompany(); company.setName(bean.getName()); siteCompanyMng.save(bean,company); return bean; } public CmsSite update(CmsSite bean, Integer uploadFtpId,Integer syncPageFtpId) { CmsSite entity = findById(bean.getId()); if (uploadFtpId != null) { entity.setUploadFtp(ftpMng.findById(uploadFtpId)); } else { entity.setUploadFtp(null); } if (syncPageFtpId != null) { entity.setSyncPageFtp(ftpMng.findById(syncPageFtpId)); } else { entity.setSyncPageFtp(null); } Updater<CmsSite> updater = new Updater<CmsSite>(bean); entity = dao.updateByUpdater(updater); return entity; } public CmsSite update(CmsSite bean, Integer uploadFtpId) { CmsSite entity = findById(bean.getId()); if (uploadFtpId != null) { entity.setUploadFtp(ftpMng.findById(uploadFtpId)); } else { entity.setUploadFtp(null); } Updater<CmsSite> updater = new Updater<CmsSite>(bean); entity = dao.updateByUpdater(updater); return entity; } public void updateTplSolution(Integer siteId, String solution,String mobileSol) { CmsSite site = findById(siteId); if(StringUtils.isNotBlank(solution)){ site.setTplSolution(solution); } if(StringUtils.isNotBlank(mobileSol)){ site.setTplMobileSolution(mobileSol); } } public void updateTplSolution(Integer siteId, String solution,boolean mobile) { CmsSite site = findById(siteId); if(mobile){ site.setTplMobileSolution(solution); }else{ site.setTplSolution(solution); } } public void updateRefers(Integer siteId, Integer[] referIds){ CmsSite site = findById(siteId); Set<CmsSite>refers=site.getRefers(); refers.clear(); for(Integer referId:referIds){ refers.add(findById(referId)); } site.setRefers(refers); } public void updateAttr(Integer siteId,Map<String,String>attr){ CmsSite site = findById(siteId); site.getAttr().putAll(attr); } public void updateAttr(Integer siteId,Map<String,String>...attrs){ CmsSite site = findById(siteId); for(Map<String,String>m:attrs){ site.getAttr().putAll(m); } } public CmsSite deleteById(Integer id) { // 删除用户、站点关联 cmsUserSiteMng.deleteBySiteId(id); // 删除工作流相关 List<CmsWorkflow>workflows=workflowMng.getList(id, null); for(CmsWorkflow workflow:workflows){ workflowMng.deleteById(workflow.getId()); } CmsSite bean = dao.findById(id); bean.getRefers().clear(); bean.getToRefers().clear(); dao.deleteById(id); log.info("delete site "+id); // 删除模板 /* try { cmsResourceMng.delTplAndRes(bean); } catch (IOException e) { log.error("delete Template and Resource fail!", e); } */ return bean; } public CmsSite[] deleteByIds(Integer[] ids) { CmsSite[] beans = new CmsSite[ids.length]; for (int i = 0, len = ids.length; i < len; i++) { beans[i] = deleteById(ids[i]); } return beans; } private CmsUserMng cmsUserMng; private CmsUserSiteMng cmsUserSiteMng; private CmsResourceMng cmsResourceMng; private FtpMng ftpMng; private CmsSiteDao dao; @Autowired private CmsSiteCompanyMng siteCompanyMng; @Autowired private CmsWorkflowMng workflowMng; @Autowired public void setCmsUserMng(CmsUserMng cmsUserMng) { this.cmsUserMng = cmsUserMng; } @Autowired public void setCmsUserSiteMng(CmsUserSiteMng cmsUserSiteMng) { this.cmsUserSiteMng = cmsUserSiteMng; } @Autowired public void setCmsResourceMng(CmsResourceMng cmsResourceMng) { this.cmsResourceMng = cmsResourceMng; } @Autowired public void setFtpMng(FtpMng ftpMng) { this.ftpMng = ftpMng; } @Autowired public void setDao(CmsSiteDao dao) { this.dao = dao; } @Transactional(readOnly = true) public CmsSite findByDomain(String domain, boolean cacheable) { return dao.findByDomain(domain, cacheable); } }
[ "250344934@qq.com" ]
250344934@qq.com
1d2f8af1762bc09d1689fbd4c7084693413c377a
c4cca2d1e3bff135e5f80f5e42573ab81747e32c
/auth-service/src/main/java/com/application/authservice/model/User.java
da7de4df9f02f460b159c45caa5238bb14ea587c
[]
no_license
carlosneir4/muservices
63d617cecb8e579c97647bbb121c3919ed9204e7
7da1bde690a935c1afb8b42320a2d876fdb66839
refs/heads/master
2020-04-07T06:40:53.274428
2018-11-19T01:51:28
2018-11-19T01:51:28
158,146,332
0
0
null
null
null
null
UTF-8
Java
false
false
2,279
java
package com.application.authservice.model; import com.application.authservice.model.audit.DateAudit; import org.hibernate.annotations.NaturalId; import javax.persistence.*; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; import java.util.HashSet; import java.util.Set; @Entity @Table(name = "users", uniqueConstraints = { @UniqueConstraint(columnNames = { "username" }), @UniqueConstraint(columnNames = { "email" }) }) public class User extends DateAudit { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotBlank @Size(max = 40) private String name; @NotBlank @Size(max = 15) private String username; @NaturalId @NotBlank @Size(max = 40) @Email private String email; @NotBlank @Size(max = 100) private String password; @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "user_roles", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id")) private Set<Role> roles = new HashSet<>(); public User() { } public User(String name, String username, String email, String password) { this.name = name; this.username = username; this.email = email; this.password = password; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Set<Role> getRoles() { return roles; } public void setRoles(Set<Role> roles) { this.roles = roles; } }
[ "carlosneir4@gmail.com" ]
carlosneir4@gmail.com
44d167c954611b4107f1e0fc241ff77245d516ce
29708d52d186b91362fcc9ea8c8ba32910c7e656
/src/app/quiz/presentationtier/AudioContainerController.java
153d1c8ac1b48060832f8eb033da0b80d722295c
[]
no_license
arifcseru/mastermind_daffodils
a9a519f5a5b941612a2c2eb494daed541dc7ff3c
65da7a7a07eb3c05d53df56db38277c7da7174cc
refs/heads/main
2023-04-08T21:43:57.894521
2021-04-20T20:38:43
2021-04-20T20:38:43
305,134,876
0
0
null
2021-04-20T20:38:44
2020-10-18T15:35:51
Java
UTF-8
Java
false
false
1,243
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 app.quiz.presentationtier; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.URL; import java.util.ResourceBundle; import javafx.fxml.Initializable; import javax.swing.Timer; /** * FXML Controller class * * @author Arifur_Rahman */ public class AudioContainerController implements ActionListener, Initializable, ControlledScreen { ScreensController myController; Timer timer = new Timer(1000, (ActionListener) this); public static int counter = 0; @Override public void initialize(URL url, ResourceBundle rb) { timer.start(); QuizScreenController.mediaVisited = true; } @Override public void setScreenParent(ScreensController screensController) { myController = screensController; } @Override public void actionPerformed(ActionEvent e) { counter++; if (counter >= 5) { timer.stop(); myController.setScreen(ScreensFramework.quizScreen); } System.out.println(counter); } }
[ "arifur.rahman@valmetpartners.com" ]
arifur.rahman@valmetpartners.com
fcf6973efb37595746e17864495211ba601fe303
8986ac78d03a59e3d08683b86136535acdd9f1f1
/app/src/test/java/com/ryanman/androidimagehostpot/ExampleUnitTest.java
50c734aefd08b23bd20e80ee47388e28ab4c5db4
[]
no_license
swieliong/ImageOverlayZoom
c6a717c5a88163d0f632e784b77769e2df073260
f30b1ae8f38e0077613b0d30a92d0dcad9e63b64
refs/heads/master
2021-01-10T03:11:23.934260
2016-01-05T01:36:54
2016-01-05T01:36:54
48,988,566
0
0
null
null
null
null
UTF-8
Java
false
false
309
java
package com.ryanman.test; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "swie.liong@ymail.com" ]
swie.liong@ymail.com
e58f203656e2e3f6607972065adbb8ac6f536b75
e9204c20176ed3adb9a742f6361793015edd815d
/app/src/main/java/jp/ac/titech/itpro/sdl/dowsegoal/Hard.java
a448bf047608a9ec52c7650d901dcae79c39fab4
[]
no_license
yuhhfw/sdl.DowseGoal
5bf5248399cc42b2743d7338346382f65d40cec6
4fc77bb492d32e01c997b447ae21c34d20acaad8
refs/heads/master
2020-06-04T20:51:02.653876
2019-07-02T11:04:02
2019-07-02T11:04:02
192,174,302
0
0
null
null
null
null
UTF-8
Java
false
false
12,201
java
package jp.ac.titech.itpro.sdl.dowsegoal; import android.Manifest; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.location.Location; import android.os.Handler; import android.os.Vibrator; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationCallback; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationResult; import com.google.android.gms.location.LocationServices; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.model.LatLng; import java.util.Random; import static com.google.android.gms.common.api.GoogleApiClient.*; public class Hard extends AppCompatActivity implements OnMapReadyCallback, ConnectionCallbacks, OnConnectionFailedListener, SensorEventListener { private final static String TAG = MainActivity.class.getSimpleName(); private final static String[] PERMISSIONS = { Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION }; private final static int REQ_PERMISSIONS = 1234; private enum State { STOPPED, REQUESTING, STARTED } private State state = State.STOPPED; private GoogleApiClient apiClient; private GoogleMap map; private FusedLocationProviderClient locationClient; private LocationRequest request; private LocationCallback callback; /** スレッドUI操作用ハンドラ */ private Handler mHandler = new Handler(); private RotationView rotationView; private SensorManager manager; private Sensor gyroscope; private double now_omegaZ = 0; private double temp_timestamp = 0.0; Random random = new Random(); Random random2 = new Random(); int random_theta = random.nextInt(360); double random_dist = (500.0 + random2.nextInt(500))/(double) 1000; private LatLng now_LatLng; @Override protected void onCreate(Bundle savedInstanceState) { Log.d(TAG, "onCreate"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_hard); Intent i = getIntent(); /* 現在の位置情報を取得し保存 そこから半径distの範囲を指定しランダムにゴールを設置 distの1/20の範囲内にゴールを捉えればいいようにする */ //確認用 TextView info_comment = findViewById(R.id.info_comment); info_comment.setText("Decided Goal!"); TextView info_com2 = findViewById(R.id.info_comment2); info_com2.setText("Find the Goal!"); info_com2.setVisibility(View.GONE); Button goal_button; goal_button = findViewById(R.id.goal_button); goal_button.setVisibility(View.GONE); decideGoal(); //goalへの方向を3秒表示 mHandler.postDelayed(new Runnable() { @Override public void run() { // TODO: ここで処理を実行する //textの変更と方向指示器の削除 TextView info_com = findViewById(R.id.info_comment); info_com.setText("Find the goal!"); CheckIn.start = System.currentTimeMillis(); } }, 3000); //goal button goal_button.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view){ Log.d(TAG, "onClick - Goal"); CheckIn.end = System.currentTimeMillis(); Intent intent = new Intent(Hard.this, Goal.class); startActivity(intent); } }); apiClient = new Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); locationClient = LocationServices.getFusedLocationProviderClient(this); request = new LocationRequest(); request.setInterval(500L); request.setFastestInterval(250L); request.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY); callback = new LocationCallback() { @Override public void onLocationResult(LocationResult locationResult) { Log.d(TAG, "onLocationResult"); if (locationResult == null) { Log.d(TAG, "onLocationResult: locationResult == null"); return; } Location location = locationResult.getLastLocation(); now_LatLng = new LatLng(location.getLatitude(), location.getLongitude()); //Goalに近づいたらボタンを表示、バイブレーション Log.d(TAG,"before vibe"); if(now_LatLng != null) { Log.d(TAG, "now_LatLng is not null"); Log.d(TAG,"now_lat:" + now_LatLng.latitude); Log.d(TAG,"now_lng:" + now_LatLng.longitude); Log.d(TAG, "Goal_lat:" + CheckIn.Goal_LatLng.latitude); Log.d(TAG, "Goal_lng:" + CheckIn.Goal_LatLng.longitude); if(calcDistanceToGoal(now_LatLng, CheckIn.Goal_LatLng) < (CheckIn.dist*CheckIn.dist/100)) { //もとは100 TextView info_com = findViewById(R.id.info_comment); info_com.setVisibility(View.GONE); TextView info_com2 = findViewById(R.id.info_comment2); info_com2.setVisibility(View.VISIBLE); ((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).vibrate(200); }else{ TextView info_com2 = findViewById(R.id.info_comment2); info_com2.setVisibility(View.GONE); TextView info_com = findViewById(R.id.info_comment); info_com.setVisibility(View.VISIBLE); ((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).cancel(); } if (calcDistanceToGoal(now_LatLng, CheckIn.Goal_LatLng) < (CheckIn.dist * CheckIn.dist / 400)) { //もとは400 ((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).cancel(); Button goal; goal = findViewById(R.id.goal_button); goal.setVisibility(View.VISIBLE); ((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).vibrate(1000); }else{ Button goal; goal = findViewById(R.id.goal_button); goal.setVisibility(View.GONE); } } if (map == null) { Log.d(TAG, "onLocationResult: map == null"); return; } } }; } @Override protected void onStart() { super.onStart(); Log.d(TAG, "onStart"); apiClient.connect(); } @Override public void onMapReady(GoogleMap map) { Log.d(TAG, "onMapReady"); map.moveCamera(CameraUpdateFactory.zoomTo(15f)); this.map = map; } @Override protected void onResume() { super.onResume(); Log.d(TAG, "onResume"); if (state != State.STARTED && apiClient.isConnected()) { startLocationUpdate(true); } else { state = State.REQUESTING; } } @Override protected void onStop() { super.onStop(); Log.d(TAG, "onStop"); apiClient.disconnect(); } @Override protected void onPause() { super.onPause(); Log.d(TAG, "onPause"); if (state == State.STARTED) { stopLocationUpdate(); } } @Override public void onConnected(@Nullable Bundle bundle) { Log.d(TAG, "onConnected"); if (state == State.REQUESTING) { startLocationUpdate(true); } } @Override public void onConnectionSuspended(int i) { Log.d(TAG, "onConnectionSuspented"); } @Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed"); } private void startLocationUpdate(boolean reqPermission) { Log.d(TAG, "startLocationUpdate"); for (String permission : PERMISSIONS) { if (ContextCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) { if (reqPermission) { ActivityCompat.requestPermissions(this, PERMISSIONS, REQ_PERMISSIONS); } else { String text = getString(R.string.toast_requires_permission_format, permission); Toast.makeText(this, text, Toast.LENGTH_SHORT).show(); } return; } } locationClient.requestLocationUpdates(request, callback, null); state = State.STARTED; } @Override public void onRequestPermissionsResult(int reqCode, @NonNull String[] permissions, @NonNull int[] grants) { Log.d(TAG, "onRequestPermissionsResult"); switch (reqCode) { case REQ_PERMISSIONS: startLocationUpdate(false); break; } } private void stopLocationUpdate() { Log.d(TAG, "stopLocationUpdate"); locationClient.removeLocationUpdates(callback); // state = State.STOPPED; } private void decideGoal(){ double lat, lon; double one_lat = 6389.137/360; //1度を簡易的に距離換算 double one_lon = 6356.752314/360; //1度を簡易的に距離換算 //Goalの座標を設定 lat = MainActivity.START_LatLng.latitude +(CheckIn.dist*random_dist*Math.cos(Math.toRadians(random_theta)))/one_lat; lon = MainActivity.START_LatLng.longitude + (CheckIn.dist*random_dist*Math.sin(Math.toRadians(random_theta)))/one_lon; //簡易デモ用 //lat = MainActivity.START_LatLng.latitude; //lon = MainActivity.START_LatLng.longitude; CheckIn.Goal_LatLng = new LatLng(lat,lon); } private double calcDistanceToGoal(LatLng now, LatLng goal){ double lat_dist,lon_dist; lat_dist = (now.latitude - goal.latitude)*6389.137/360; lon_dist = (now.longitude - goal.longitude)*6389.137/360; return lat_dist*lat_dist + lon_dist*lon_dist; } @Override public void onSensorChanged(SensorEvent event) { float omegaZ = event.values[2]; // z-axis angular velocity (rad/sec) // TODO: calculate right direction that cancels the rotation //元が角速度(rad/ns)なので*0.000000001して秒数を利用する //予定だったが区分求積法のスタイル的に0.0000000009の方がずれない... now_omegaZ += omegaZ * (event.timestamp - temp_timestamp) * 0.0000000009; rotationView.setDirection(now_omegaZ); temp_timestamp = event.timestamp; } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { Log.d(TAG, "onAccuracyChanged: accuracy=" + accuracy); } }
[ "tai.y.aa@m.titech.ac.jp" ]
tai.y.aa@m.titech.ac.jp
601e444b5d8f0d70a2f2d2d0a172e6e46f4aef42
5d08e93df83672098bb8839592cdf0733bdb8285
/ETAHTI/app/src/androidTest/java/com/aplikasianaknegeri/e_tahti/ExampleInstrumentedTest.java
d75fbc49b62e66d4305942c2be679d4d668c50b6
[]
no_license
ekannas/etahti
182ca168eed101a476e4d4fa6ce038ef13060ac1
92c6444767d2f1e02d522544711d3c25b32aade8
refs/heads/main
2023-04-06T03:53:43.251169
2021-04-05T10:44:44
2021-04-05T10:44:44
354,799,199
0
0
null
null
null
null
UTF-8
Java
false
false
774
java
package com.aplikasianaknegeri.e_tahti; 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.aplikasianaknegeri.e_tahti", appContext.getPackageName()); } }
[ "annassolichin01@gmail.com" ]
annassolichin01@gmail.com
d3a5cc34456738f51c0757355bbdcfa44c75594d
dc3a664e058d9632d229dc6b4411af3f91259b0a
/src/main/java/com/remswork/project/alice/model/support/Date.java
bfaf8e0516a246385fb85b927f134f9c6c9d170e
[ "MIT" ]
permissive
tachibanana/alice-core
0a51ade8c37dbb5c2e1d2546e88c758653bfceed
594e29ae4fd5d8cc87600901bfe4e128e05b1231
refs/heads/master
2021-04-03T05:15:31.271265
2018-03-09T13:48:55
2018-03-09T13:48:55
124,546,127
1
0
MIT
2018-03-09T13:47:34
2018-03-09T13:47:34
null
UTF-8
Java
false
false
1,152
java
package com.remswork.project.alice.model.support; import java.util.Calendar; import java.util.Locale; @Deprecated public class Date { private int day; private int month; private int year; public Date() { super(); } public Date(int day, int month, int year) { this.day = day; this.month = month; this.year = year; } public int getDay() { return day; } public void setDay(int day) { this.day = day; } public int getMonth() { return month; } public void setMonth(int month) { this.month = month; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public Date now() { Calendar calendar = Calendar.getInstance(); setDay(calendar.get(Calendar.DAY_OF_MONTH)); setMonth(calendar.get(Calendar.MONTH)+1); setYear(calendar.get(Calendar.YEAR)); return this; } @Override public String toString() { return String.format(Locale.ENGLISH, "%d/%d/%d", getMonth(), getDay(), getYear()); } }
[ "erafaelmanuel@gmail.com" ]
erafaelmanuel@gmail.com
261e082c569894763e9140aff3d0abbba14e8cc9
4384916c46143be347367a6e0149bf3b7da23a1b
/JavaFiles/MapsActivity.java
db86180ce5997cb7219f6ae3e350bcda39f6b32d
[]
no_license
SeniorCapstone/MobileApp
1b6ed5c5a662791ede8055203ed8b7f81d35912e
4835a1c70748e73e764328c205738b18d87e4ac9
refs/heads/master
2021-08-21T20:30:51.292849
2017-11-29T00:55:43
2017-11-29T00:55:43
106,027,671
0
0
null
null
null
null
UTF-8
Java
false
false
1,872
java
package com.example.emilio.testapplication; import android.support.v4.app.FragmentActivity; import android.os.Bundle; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } /** * Manipulates the map once available. * This callback is triggered when the map is ready to be used. * This is where we can add markers or lines, add listeners or move the camera. In this case, * we just add a marker near Sydney, Australia. * If Google Play services is not installed on the device, the user will be prompted to install * it inside the SupportMapFragment. This method will only be triggered once the user has * installed Google Play services and returned to the app. */ @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; // Add a marker in Sydney and move the camera LatLng sydney = new LatLng(-34, 151); mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); } }
[ "noreply@github.com" ]
noreply@github.com
fc83c32e58e14ef8ea4d6408bc0db24f6014b155
e770778e830e9a34b926c5a4df94b011a7e039b1
/ZDIM/src/zhwx/common/view/photoview/gestures/VersionedGestureDetector.java
32ea8aef0d4174d29e47be6cff22d6e58d61c737
[]
no_license
lixinxiyou01/zdhx-im-yunxin-run
bc5290458dd0e8a4d37339da7ddb07a6d10ad317
3ad40223c15dac575e860136e24be690387405ad
refs/heads/master
2021-01-12T06:51:59.284750
2017-10-10T08:25:40
2017-10-10T08:25:40
83,505,395
3
4
null
null
null
null
UTF-8
Java
false
false
1,538
java
package zhwx.common.view.photoview.gestures; /******************************************************************************* * Copyright 2011, 2012 Chris Banes. * * 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. *******************************************************************************/ import android.content.Context; import android.os.Build; public final class VersionedGestureDetector { public static GestureDetector newInstance(Context context, OnGestureListener listener) { final int sdkVersion = Build.VERSION.SDK_INT; GestureDetector detector; if (sdkVersion < Build.VERSION_CODES.ECLAIR) { detector = new CupcakeGestureDetector(context); } else if (sdkVersion < Build.VERSION_CODES.FROYO) { detector = new EclairGestureDetector(context); } else { detector = new FroyoGestureDetector(context); } detector.setOnGestureListener(listener); return detector; } }
[ "lixin890403@163.com" ]
lixin890403@163.com
460626658e212fca8267cd8c614ece4e6718bef8
eeada781233ccb7450a2a4c9b48c2ed7e13e3daf
/app/src/main/java/com/unokim/example/iot/data/source/local/DeviceItemDao.java
5940c9deb8aa17f2686f506ba778a1fada997592
[]
no_license
uno-kim/android-iot
31a2f30e0893b774bf1a901d7b30969df16e3deb
19ec20b0ae5fc5d250055c503ec2c17e0eba7e0d
refs/heads/master
2020-05-27T12:53:34.749624
2019-05-31T11:57:44
2019-05-31T11:57:44
188,626,264
0
0
null
null
null
null
UTF-8
Java
false
false
1,685
java
package com.unokim.example.iot.data.source.local; import com.unokim.example.iot.data.source.entity.DeviceItem; import java.util.List; import androidx.annotation.NonNull; import androidx.room.Dao; import androidx.room.Delete; import androidx.room.Insert; import androidx.room.OnConflictStrategy; import androidx.room.Query; import androidx.room.Update; import io.reactivex.Flowable; @Dao public interface DeviceItemDao { @Insert(onConflict = OnConflictStrategy.REPLACE) void insert(DeviceItem item); @Insert(onConflict = OnConflictStrategy.REPLACE) void insert(DeviceItem... items); @Insert(onConflict = OnConflictStrategy.REPLACE) void insert(List<DeviceItem> items); @Update void update(DeviceItem item); @Update void update(DeviceItem... items); @Delete void delete(DeviceItem item); @Delete void delete(DeviceItem... items); @Query("DELETE FROM DeviceItem") void deleteAll(); @Query("SELECT * FROM DeviceItem WHERE groupId = :groupId ORDER BY `order` ASC, favorite ASC") Flowable<List<DeviceItem>> getDevicesFlowable(@NonNull String groupId); @Query("SELECT * FROM DeviceItem WHERE locationId = :locationId ORDER BY `order` ASC, " + "favorite ASC") Flowable<List<DeviceItem>> getFavoriteDevicesFlowableByLocation(@NonNull String locationId); @Query("SELECT * FROM DeviceItem WHERE favorite = 1 ORDER BY `order` ASC") Flowable<List<DeviceItem>> getAllFavoriteDevicesFlowable(); @Query("SELECT * FROM DeviceItem WHERE groupId = :groupId AND favorite = 1 ORDER BY `order` " + "ASC") List<DeviceItem> getFavoriteDevices(@NonNull String groupId); }
[ "ms.uno.kim@gmail.com" ]
ms.uno.kim@gmail.com
236ae2c50ace84cfaab27000d9e5ce546d12beb0
c94b28e059d704e99719e2d91eee62f06332a2f2
/src/main/java/pluralsight/java/course/constructors/MathEquation.java
520759299f6f15339a622e5a2f56f08689d9a244
[]
no_license
KDawid/Pluralsight-Java
14e8a097c3cc82c5ce6018d8e2f6962c1f7f7d99
220064afaee73701ca851236ea9d1db2cda9032d
refs/heads/master
2022-12-26T10:37:27.176832
2019-11-10T14:21:27
2019-11-10T14:21:27
198,266,634
0
0
null
null
null
null
UTF-8
Java
false
false
1,191
java
package pluralsight.java.course.constructors; public class MathEquation { private double leftVal; private double rightVal; private char opCode = 'a'; private double result; public double getLeftVal() { return leftVal; } public void setLeftVal(double leftVal) { this.leftVal = leftVal; } public double getRightVal() { return rightVal; } public void setRightVal(double rightVal) { this.rightVal = rightVal; } public double getOpCode() { return opCode; } public void setOpCode(char opCode) { this.opCode = opCode; } public double getResult() { return result; } public MathEquation(char opCode) { this.opCode = opCode; } public MathEquation(char opCode, double leftVal, double rightVal) { this(opCode); this.leftVal = leftVal; this.rightVal = rightVal; } public void execute() { switch (opCode) { case 'a': result = leftVal + rightVal; break; case 's': result = leftVal - rightVal; break; case 'd': result = rightVal != 0.0d ? leftVal / rightVal : 0.0d; break; case 'm': result = leftVal * rightVal; break; default: System.out.println("Error - invalid opCode"); result = 0.0d; break; } } }
[ "david.kelemen@ericsson.com" ]
david.kelemen@ericsson.com
70015a538bb4dccc7d4121783dd4720067ee6780
3a23f43664078bbd33d05a13ab7050d13329ce65
/src/com/xinyu/tools/Request.java
ed426fb9301fb3c1add897648311c7e17c24849d
[]
no_license
33dajin33/TDOA_RCE
3253cb96fdb39b9dcbf625d78b2cd2a5c5cab97a
a6f1a35e149ddfb877a5a606f5aa2f8c23a5c18c
refs/heads/master
2023-03-20T19:43:14.703113
2021-03-17T08:51:32
2021-03-17T08:51:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,534
java
package com.xinyu.tools; import java.io.*; import java.net.*; public class Request { private static final String CODING = "GBK"; private static Response response; static { System.out.println("静态代码块"); response = new Response(); } public static Response get(String url) { return get(url, null); } public static Response get(String url, String cookie) { try { HttpURLConnection conn = http(url); conn.setRequestMethod("GET"); //设置Cookie if (cookie != null) { conn.setRequestProperty("Cookie", cookie); } response = getResponse(conn, url, cookie); } catch (SocketTimeoutException e) { System.out.println("连接超时"); } catch (IOException e) { e.printStackTrace(); } return response; } public static Response post(String url, String params) { return post(url, params, null); } public static Response post(String url, String params, String cookie) { try { HttpURLConnection conn = http(url); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-type", "application/x-www-form-urlencoded"); //设置Cookie if (cookie != null) { conn.setRequestProperty("Cookie", cookie); } OutputStream outputStream = conn.getOutputStream(); outputStream.write(params.getBytes()); outputStream.flush(); outputStream.close(); response = getResponse(conn, url, cookie); } catch (IOException e) { e.printStackTrace(); } return response; } public static Response upload(String url, StringBuilder tempParams) { return upload(url, tempParams, null); } public static Response upload(String url, StringBuilder tempParams, String cookie) { try { HttpURLConnection conn = http(url); conn.setRequestMethod("POST"); conn.setRequestProperty("Accept-Charset", CODING); conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + "********"); //设置Cookie if (cookie != null) { conn.setRequestProperty("Cookie", cookie); } DataOutputStream requestStream = new DataOutputStream(conn.getOutputStream()); requestStream.writeBytes("--" + "********" + "\r\n"); tempParams.append("\r\n"); requestStream.writeBytes(tempParams.toString()); requestStream.flush(); response = getResponse(conn, url, cookie); } catch (IOException e) { e.printStackTrace(); } return response; } /** * 文件删除专用,重新上传auth.inc.php文件 * * @param url * @return */ public static Response uploadBackupFile(String url) { try { HttpURLConnection conn = http(url + "/general/data_center/utils/upload.php?action=upload&filetype=nmsl&repkid=/.%3C%3E./.%3C%3E./.%3C%3E./"); conn.setRequestMethod("POST"); conn.setRequestProperty("Accept-Charset", CODING); conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + "********"); DataOutputStream requestStream = new DataOutputStream(conn.getOutputStream()); requestStream.writeBytes("--" + "********" + "\r\n"); StringBuilder tempParams = new StringBuilder(); tempParams.append("Content-Disposition: form-data; name=\"FILE1\"; filename=\"auth.inc.php\""); tempParams.append("\r\n"); tempParams.append("\r\n"); requestStream.writeBytes(tempParams.toString()); //第一种方式,从文件读取,发送文件数据 int bytesRead; byte[] buffer = new byte[1024]; InputStream inputStream = Request.class.getResourceAsStream("/auth.inc.php"); DataInputStream in = new DataInputStream(inputStream); while ((bytesRead = in.read(buffer)) != -1) { requestStream.write(buffer, 0, bytesRead); } requestStream.writeBytes("\r\n"); requestStream.writeBytes("--" + "********" + "\r\n"); requestStream.flush(); response = getResponse(conn, url, null); } catch (IOException e) { e.printStackTrace(); } return response; } /** * 请求的基本设置在这里完成 * * @param url * @return */ private static HttpURLConnection http(String url) throws IOException { URL url_object = new URL(url); //创建URL对象 HttpURLConnection conn = (HttpURLConnection) url_object.openConnection(); //打开一个HttpURLConnection连接 conn.setConnectTimeout(3 * 1000); //设置连接主机超时时间 conn.setReadTimeout(3 * 1000); //设置从主机读取数据超时时间 conn.setDoOutput(true); //设置该连接允许读取 conn.setDoInput(true); //设置该连接允许写入 conn.setUseCaches(false); //关闭缓存,默认为true conn.setInstanceFollowRedirects(false); //关闭自动重定向(自动容易出现问题,这里手动处理) conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.7 Safari/537.36"); return conn; } /** * 连接,处理状态码 * * @param conn * @param cookie * @return * @throws IOException */ private static Response getResponse(HttpURLConnection conn, String url, String cookie) { try { conn.connect(); // System.out.println(conn.getResponseCode()); response.setText(null); //如果500异常,强行读数据流会报错,这里避免掉 // System.out.println(conn.getResponseCode()); if (conn.getResponseCode() != 500 && conn.getResponseCode() != 404 && conn.getResponseCode() != 403) { response.setText(streamToString(conn.getInputStream())); } else { //防止404时响应包出现空指针异常 response.setText(""); } response.setCode(conn.getResponseCode()); //状态码 response.setHead(conn.getHeaderFields().toString()); //响应头信息_getHeaderField("Set-Cookie") } catch (IOException e) { System.out.println("未知异常:Request类182行"); e.printStackTrace(); response = new Response(0, null, null); } return response; } /** * 处理数据流 * * @param inputStream * @return */ private static String streamToString(InputStream inputStream) { String resultString = null; ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); int len = 0; byte data[] = new byte[1024]; try { while ((len = inputStream.read(data)) != -1) { byteArrayOutputStream.write(data, 0, len); } byte[] allData = byteArrayOutputStream.toByteArray(); resultString = new String(allData, CODING); } catch (IOException e) { e.printStackTrace(); } return resultString; } }
[ "xinyu2428@outlook.com" ]
xinyu2428@outlook.com
1e06f31dd829b15b58f2c16ad92adbd258f9a37e
2d1476f6da5c0af042409044ffa27bf00c2d27c0
/src/kchandra423/graphics/textures/TextureImage.java
15b374a343b73c62591b24f3058abd37323beced
[]
no_license
HHSAPCompSci2020/capstone-project-66-smart
f18a8dc76204f119d06e8861c4c9751ee49b92a2
83d53c5e83de1ffb7bb52a639f03a89dcfec5aed
refs/heads/main
2023-05-28T08:52:30.403177
2021-05-26T07:24:03
2021-05-26T07:24:03
362,941,526
1
0
null
null
null
null
UTF-8
Java
false
false
965
java
package kchandra423.graphics.textures; import processing.core.PApplet; import processing.core.PImage; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; class TextureImage extends Texture { private final PImage image; TextureImage(String pathName) { BufferedImage img = null; try { img = ImageIO.read(new File(pathName)); } catch (IOException e) { e.printStackTrace(); } image = new PImage(img); } @Override public void draw(PApplet p, int x, int y) { p.image(image, x, y); } @Override public PImage getImage() { return image; } @Override public void resize(int w, int h) { image.resize(w, h); } @Override public int getWidth() { return image.width; } @Override public int getHeight() { return image.height; } }
[ "kchandra423@student.fuhsd.org" ]
kchandra423@student.fuhsd.org
2bbbe91a185ef0a3dd12e9ef69279c912b82ba67
4e334e849fa57199a85980ccf196626c8bf9551c
/src/org/jdownloader/captcha/v2/solver/twocaptcha/RequestOptions.java
b2c4e670430f0832f5c038d872eb2cd9b0dba936
[]
no_license
mirror/jdownloader
d838620c75778a6e4239d471e2d920c7e3bd4af3
5f50ef81a535c64d31713ed043587eac7a3da057
refs/heads/master
2023-09-03T11:41:24.520587
2023-03-23T15:00:17
2023-03-23T15:00:17
7,533,389
370
130
null
2020-02-06T06:59:13
2013-01-10T02:56:54
Java
UTF-8
Java
false
false
133
java
package org.jdownloader.captcha.v2.solver.twocaptcha; public class RequestOptions { public RequestOptions() { } }
[ "jdguest@ebf7c1c2-ba36-0410-9fe8-c592906822b4" ]
jdguest@ebf7c1c2-ba36-0410-9fe8-c592906822b4
ae0c931cd292d06faaf8562d3cb6d1f11e421bdb
7c62ff60a2e0caec0dbcc6158947d85c39126bce
/src/main/java/com/example/apache/zookeeper/client/approach2/GetChildrenZnode.java
284643458b19d6157f914fff74a002f19741fcea
[]
no_license
rahamath18/Apache-ZooKeeper-Example
21d181e1e3004878dc6d7170a1f2579250c1724c
55134b3d2714e5bde908b60b7f644e41efc4cf61
refs/heads/master
2021-12-27T09:48:24.808320
2020-02-05T18:21:12
2020-02-05T18:21:12
238,518,693
0
0
null
2021-12-14T21:39:35
2020-02-05T18:21:29
Java
UTF-8
Java
false
false
1,311
java
package com.example.apache.zookeeper.client.approach2; import java.io.IOException; import java.util.List; import java.util.concurrent.CountDownLatch; import org.apache.zookeeper.WatchedEvent; import org.apache.zookeeper.Watcher; import org.apache.zookeeper.Watcher.Event.KeeperState; import org.apache.zookeeper.ZooKeeper; import org.apache.zookeeper.data.Stat; public class GetChildrenZnode { public static void main(String args[]) throws IOException, InterruptedException { String host = "localhost"; int sessionTimeout = 5000; String path = "/zookeeper_test_1"; // Znode path & name final CountDownLatch connectedSignal = new CountDownLatch(1); ZooKeeper zoo = new ZooKeeper(host, sessionTimeout, new Watcher() { public void process(WatchedEvent we) { if (we.getState() == KeeperState.SyncConnected) { connectedSignal.countDown(); } } }); connectedSignal.await(); try { Stat stat = zoo.exists(path, true); // Stat checks the path if (stat != null) { List<String> children = zoo.getChildren(path, false); for (int i = 0; i < children.size(); i++) System.out.println(children.get(i)); // Print children's } else { System.out.println("Node does not exists"); } zoo.close(); } catch (Exception e) { e.printStackTrace(); } } }
[ "rahamath18@yahoo.com" ]
rahamath18@yahoo.com
d14c2919f9f1f7c9f18f6d971ac29e185d5e1f54
78bf826afc0564bd62d4bb55688e137ee8d32961
/src/main/java/io/github/delirius325/jmeter/backendlistener/elasticsearch/ElasticSearchMetric.java
fa945af08ec5d66af60b4daa50f311bd43306ace
[ "MIT" ]
permissive
densgorban/jmeter-elasticsearch-backend-listener
ffc2c003701e563dda209960c9815ae033afbfef
ceae96f0cebb0ced31fca95f2a450c6e048f91fd
refs/heads/master
2020-03-26T08:34:05.299723
2018-08-06T14:56:00
2018-08-06T14:56:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,973
java
package io.github.delirius325.jmeter.backendlistener.elasticsearch; import org.apache.jmeter.assertions.AssertionResult; import org.apache.jmeter.samplers.SampleResult; import org.apache.jmeter.threads.JMeterContextService; import org.apache.jmeter.visualizers.backend.BackendListenerContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.InetAddress; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; public class ElasticSearchMetric { private static final Logger logger = LoggerFactory.getLogger(ElasticSearchMetric.class); private SampleResult sampleResult; private String esTestMode; private String esTimestamp; private int ciBuildNumber; private HashMap<String, Object> json; public ElasticSearchMetric(SampleResult sr, String testMode, String timeStamp, int buildNumber) { this.sampleResult = sr; this.esTestMode = testMode.trim(); this.esTimestamp = timeStamp.trim(); this.ciBuildNumber = buildNumber; this.json = new HashMap<>(); } /** * This method returns the current metric as a Map(String, Object) for the provided sampleResult * @param context BackendListenerContext * @return a JSON Object as Map(String, Object) */ public Map<String, Object> getMetric(BackendListenerContext context) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat(this.esTimestamp); //add all the default SampleResult parameters this.json.put("AllThreads", this.sampleResult.getAllThreads()); this.json.put("BodySize", this.sampleResult.getBodySizeAsLong()); this.json.put("Bytes", this.sampleResult.getBytesAsLong()); this.json.put("SentBytes", this.sampleResult.getSentBytes()); this.json.put("ConnectTime", this.sampleResult.getConnectTime()); this.json.put("ContentType", this.sampleResult.getContentType()); this.json.put("DataType", this.sampleResult.getDataType()); this.json.put("ErrorCount", this.sampleResult.getErrorCount()); this.json.put("GrpThreads", this.sampleResult.getGroupThreads()); this.json.put("IdleTime", this.sampleResult.getIdleTime()); this.json.put("Latency", this.sampleResult.getLatency()); this.json.put("ResponseTime", this.sampleResult.getTime()); this.json.put("SampleCount", this.sampleResult.getSampleCount()); this.json.put("SampleLabel", this.sampleResult.getSampleLabel()); this.json.put("ThreadName", this.sampleResult.getThreadName()); this.json.put("URL", this.sampleResult.getURL()); this.json.put("ResponseCode", this.sampleResult.getResponseCode()); this.json.put("StartTime", sdf.format(new Date(this.sampleResult.getStartTime()))); this.json.put("EndTime", sdf.format(new Date(this.sampleResult.getEndTime()))); this.json.put("Timestamp", sdf.format(new Date(this.sampleResult.getTimeStamp()))); this.json.put("InjectorHostname", InetAddress.getLocalHost().getHostName()); // Add the details according to the mode that is set switch(this.esTestMode) { case "debug": addDetails(); break; case "error": addDetails(); break; case "info": if(!this.sampleResult.isSuccessful()) addDetails(); break; } addAssertions(); addElapsedTime(sdf); addCustomFields(context); return this.json; } /** * This method adds all the assertions for the current sampleResult * */ private void addAssertions() { AssertionResult[] assertionResults = this.sampleResult.getAssertionResults(); if(assertionResults != null) { Map<String, Object>[] assertionArray = new HashMap[assertionResults.length]; Integer i = 0; for(AssertionResult assertionResult : assertionResults) { HashMap<String, Object> assertionMap = new HashMap<>(); boolean failure = assertionResult.isFailure() || assertionResult.isError(); assertionMap.put("failure", failure); assertionMap.put("failureMessage", assertionResult.getFailureMessage()); assertionMap.put("name", assertionResult.getName()); assertionArray[i] = assertionMap; i++; } this.json.put("AssertionResults", assertionArray); } } /** * This method adds the ElapsedTime as a key:value pair in the JSON object. Also, * depending on whether or not the tests were launched from a CI tool (i.e Jenkins), * it will add a hard-coded version of the ElapsedTime for results comparison purposes * * @param sdf SimpleDateFormat */ private void addElapsedTime(SimpleDateFormat sdf) { Date elapsedTime; if(this.ciBuildNumber != 0) { elapsedTime = getElapsedTime(true); this.json.put("BuildNumber", this.ciBuildNumber); if(elapsedTime != null) this.json.put("ElapsedTimeComparison", sdf.format(elapsedTime)); } elapsedTime = getElapsedTime(false); if(elapsedTime != null) this.json.put("ElapsedTime", sdf.format(elapsedTime)); } /** * Methods that add all custom fields added by the user in the Backend Listener's GUI panel * * @param context BackendListenerContext */ private void addCustomFields(BackendListenerContext context) { Iterator<String> pluginParameters = context.getParameterNamesIterator(); while(pluginParameters.hasNext()) { String parameterName = pluginParameters.next(); if(!parameterName.contains("es.") && !context.getParameter(parameterName).trim().equals("")) { this.json.put(parameterName, context.getParameter(parameterName).trim()); } } } /** * Method that adds the request and response's body/headers * */ private void addDetails() { this.json.put("RequestHeaders", this.sampleResult.getRequestHeaders()); this.json.put("RequestBody", this.sampleResult.getSamplerData()); this.json.put("ResponseHeaders", this.sampleResult.getResponseHeaders()); this.json.put("ResponseBody", this.sampleResult.getResponseDataAsString()); this.json.put("ResponseMessage", this.sampleResult.getResponseMessage()); } /** * This method is meant to return the elapsed time a human readable format. The purpose of this is * mostly for build comparison in Kibana. By doing this, the user is able to set the X-axis of his graph * to this date and split the series by build numbers. It allows him to overlap test results and see if * there is regression or not. * * @param forBuildComparison boolean to determine if there is CI (continuous integration) or not * @return The elapsed time in YYYY-MM-dd HH:mm:ss format */ protected Date getElapsedTime(boolean forBuildComparison) { String sElapsed; //Calculate the elapsed time (Starting from midnight on a random day - enables us to compare of two loads over their duration) long start = JMeterContextService.getTestStartTime(); long end = System.currentTimeMillis(); long elapsed = (end - start); long minutes = (elapsed / 1000) / 60; long seconds = (elapsed / 1000) % 60; Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); //If there is more than an hour of data, the number of minutes/seconds will increment this cal.set(Calendar.MINUTE, (int) minutes); cal.set(Calendar.SECOND, (int) seconds); if(forBuildComparison) { sElapsed = String.format("2017-01-01 %02d:%02d:%02d", cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND)); } else { sElapsed = String.format("%s %02d:%02d:%02d", DateTimeFormatter.ofPattern("yyyy-mm-dd").format(LocalDateTime.now()), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND)); } SimpleDateFormat formatter = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss"); try { return formatter.parse(sElapsed); } catch (ParseException e) { logger.error("Unexpected error occured computing elapsed date", e); return null; } } }
[ "antho325@hotmail.com" ]
antho325@hotmail.com
431bf0981b97a45b19b5426fc2f26dc4f03b05bc
2ccd99a60c799eb78cac2bb108d807cb6ded4db0
/src/java/org/jasig/cas/authentication/principal/WebApplicationService.java
0a0fd8041826ee896aaf7bb7fcae5f05beaf1d58
[]
no_license
trungbui1811/passportv4
dff7163dc37070ebeda497e1ceda14538937a3a1
5c6782a2e95649c6ec35c237aed61d46a7eca202
refs/heads/master
2020-12-11T06:17:34.066799
2020-02-04T07:30:33
2020-02-04T07:30:33
233,786,919
0
0
null
null
null
null
UTF-8
Java
false
false
396
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 org.jasig.cas.authentication.principal; /** * * @author TrungBH */ public interface WebApplicationService extends Service{ Response getResponse(String paramString); String getArtifactId(); }
[ "haitd@antsoft.vn" ]
haitd@antsoft.vn
b2780d68c0f1febc6e70d14c8728e10f716bbb9b
567806f8b2aa2c02cb3b91c884a23ce8d8787082
/Modulo_II/JEE/HolaMundoSpringMVC/src/controlador/BusquedaOfertas.java
8ac3ec839ac510499276b995da59dc97c1bbc6c1
[]
no_license
jrb9x/DesarrolloWeb
850ba0f2b3af091608e30ea455ec62943fa6428b
291779d165b1243a9a6d8135d83f2efb39460087
refs/heads/master
2021-01-22T04:54:24.329771
2017-02-27T12:42:24
2017-02-27T12:42:24
81,597,261
0
0
null
null
null
null
UTF-8
Java
false
false
1,377
java
package controlador; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import beans.BusquedaOferta; import beans.Oferta; import modelo.negocio.IGestionOfertas; @Controller @RequestMapping("/busquedaOfertas.do") public class BusquedaOfertas { @Autowired IGestionOfertas gestionOfertas; @RequestMapping(method=RequestMethod.GET) public String rellenaFormulario(Model modelo){ BusquedaOferta bo = new BusquedaOferta(); bo.setNumeroNoches(1); bo.setPrecioMax(60); modelo.addAttribute("bo", bo); return "busquedaOfertas"; } @RequestMapping(method=RequestMethod.POST) public String procesaFormulario(@ModelAttribute("bo") BusquedaOferta bo, BindingResult result, Model modelo){ if(bo.getPrecioMax() < 0) result.rejectValue("precioMax", "negativo"); if(result.hasErrors()) return "busquedaOfertas"; List<Oferta> ofertas; ofertas = gestionOfertas.buscarOfertasPorPrecioyNoches(bo); modelo.addAttribute("ofertas", ofertas); return "vistaOfertas"; } }
[ "jorge91rb@gmail.com" ]
jorge91rb@gmail.com
d6d1051365e0902a799241aa8ec6be767eceb7fd
010af329f73332ff36476c38f749fd6805086acc
/app/src/main/java/com/ruanjie/donkey/ui/sign/FindPasswordActivity.java
1f1c85e327adbb8d15b5c65d50d1fd6196a65326
[]
no_license
Superingxz/YellowDonkey
f577feed32485b49ccab06660121af6a43a37320
a47691c815d4f25d1298f2f3b68f17f8961d4ad5
refs/heads/master
2023-02-01T10:03:38.011876
2020-12-18T09:07:53
2020-12-18T09:07:53
322,543,723
0
0
null
null
null
null
UTF-8
Java
false
false
4,523
java
package com.ruanjie.donkey.ui.sign; import android.content.Context; import android.content.Intent; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.widget.AppCompatEditText; import android.text.TextUtils; import android.util.Patterns; import com.mirkowu.basetoolbar.BaseToolbar; import com.ruanjie.donkey.R; import com.ruanjie.donkey.app.Constants; import com.ruanjie.donkey.event.PhoneEvent; import com.ruanjie.donkey.ui.sign.contract.FindPasswordContract; import com.ruanjie.donkey.ui.sign.presenter.FindPasswordPresenter; import com.ruanjie.donkey.widget.TimerTextView; import com.softgarden.baselibrary.base.ToolbarActivity; import com.vondear.rxtool.view.RxToast; import org.greenrobot.eventbus.EventBus; import butterknife.BindView; import butterknife.OnClick; /** * 项目名: YellowDonkey * 包名: com.ruanjie.donkey.ui.sign * 文件名: FindPasswordActivity * 创建者: QJM * 创建时间: 2019/8/1 21:16 * 描述: TODO */ public class FindPasswordActivity extends ToolbarActivity<FindPasswordPresenter> implements FindPasswordContract.View { @BindView(R.id.et_phone) AppCompatEditText etPhone = null; @BindView(R.id.et_verification_code) AppCompatEditText etVerificationCode = null; @BindView(R.id.tv_get_verification_code) TimerTextView tvGetVerificationCode = null; @OnClick(R.id.tv_get_verification_code) void onGetCode(){ final String mPhone = etPhone.getText().toString().trim(); if (checkPhone(mPhone)){ getPresenter().getVerificationCode(mPhone, Constants.FORGET_PASSWORD); } } @OnClick(R.id.bt_next) void onNext(){ final String mPhone = etPhone.getText().toString().trim(); final String mVerificationCode = etVerificationCode.getText().toString().trim(); if (checkform(mPhone,mVerificationCode)){ getPresenter().checkVerificationCode(mPhone,mVerificationCode,Constants.FORGET_PASSWORD); } } public static void start(Context context) { // starter.putExtra(F); context.startActivity(new Intent(context, FindPasswordActivity.class)); } @Override public FindPasswordPresenter createPresenter() { return new FindPasswordPresenter(this); } @Nullable @Override protected BaseToolbar.Builder setToolbar(@NonNull BaseToolbar.Builder builder) { return builder.setTitle(getString(R.string.find_password)); } @Override protected void initialize() { } @Override protected Object getLayoutId() { return R.layout.activity_find_password; } @Override public boolean checkPhone(String phone) { boolean isPass = true; if (TextUtils.isEmpty(phone)){ etPhone.setError(getString(R.string.phone_empty)); isPass = false; } else if (!Patterns.PHONE.matcher(phone).matches() || phone.length() != 11) { RxToast.error(getString(R.string.phone_error)); etPhone.setError(getString(R.string.phone_error)); isPass = false; }else { etPhone.setError(null); } return isPass; } @Override public boolean checkform(String phone, String code) { boolean isPass = true; if (TextUtils.isEmpty(phone)){ etPhone.setError(getString(R.string.phone_empty)); isPass = false; } else if (!Patterns.PHONE.matcher(phone).matches() || phone.length() != 11) { RxToast.error(getString(R.string.phone_error)); etPhone.setError(getString(R.string.phone_error)); isPass = false; }else { etPhone.setError(null); } if (TextUtils.isEmpty(code)){ RxToast.error(getString(R.string.code_empty)); etVerificationCode.setError(getString(R.string.code_empty)); isPass = false; }else { etVerificationCode.setError(null); } return isPass; } @Override public void getVerificationCodeSuccess() { tvGetVerificationCode.start(); } @Override public void getVerificationCodeFail(String message) { tvGetVerificationCode.cancel(); } @Override public void verificationSuccess(String phone, String verificationCode) { EventBus.getDefault().postSticky(new PhoneEvent(phone,verificationCode)); ChangePasswordActivity.start(getContext()); } }
[ "moyaozhi@anjiu-tech.com" ]
moyaozhi@anjiu-tech.com
7901a50666d8031e009f6b6d4a506fdb17b27f63
17fcced27e95570e80c6e4cdf068e15f83636409
/SpringORM/src/main/java/com/spring/ORM/entities/Student.java
a8b4581d9ea3dfecb4df2f9ad1f062adaa9e4dfa
[]
no_license
Rahulgithub-code/SpringFramework
d5ef4f15e2c589df2531c22c2dc98363504e3a2c
c7ec56d5d85366de614afc0f3f5b8e191ffb02f1
refs/heads/main
2023-05-08T01:34:48.900003
2021-05-23T00:30:13
2021-05-23T00:30:13
365,273,714
0
0
null
null
null
null
UTF-8
Java
false
false
1,101
java
package com.spring.ORM.entities; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "studen_details") public class Student { @Id @Column(name = "student_id") private int studentId; @Column(name = "student_name") private String studentname; @Column(name = "student_city") private String studentCity; public Student(int studentId, String studentname, String studentCity) { super(); this.studentId = studentId; this.studentname = studentname; this.studentCity = studentCity; } public Student() { super(); // TODO Auto-generated constructor stub } public int getStudentId() { return studentId; } public void setStudentId(int studentId) { this.studentId = studentId; } public String getStudentname() { return studentname; } public void setStudentname(String studentname) { this.studentname = studentname; } public String getStudentCity() { return studentCity; } public void setStudentCity(String studentCity) { this.studentCity = studentCity; } }
[ "noreply@github.com" ]
noreply@github.com
cc229f4abcbac29a76ac9c4110b6606be5dcc652
89f61dc9121e8bcaec3e2a28e24f68bc95a52080
/src/main/java/com/vivek/twitter/kafka/Application.java
8dcd257c6201b915c7ba49bfc5a793ff92a1d3a6
[]
no_license
Vivek-Dh/Twitter-Kafka
47545381a8129267672f48395d4880bb097c5ace
66e43359a8cc0392c51a97fd8e08daeed9b30022
refs/heads/master
2020-04-14T17:38:38.342465
2019-01-03T15:12:19
2019-01-03T15:12:19
163,988,142
0
0
null
null
null
null
UTF-8
Java
false
false
527
java
package com.vivek.twitter.kafka; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.PropertySource; @SpringBootApplication(scanBasePackages= {"com.vivek.twitter.kafka","com.vivek.twitter.kafka.controller"}) @PropertySource("classpath:/twitter.properties") public class Application { public static void main(String[] args) throws InterruptedException { SpringApplication.run(Application.class, args); } }
[ "vivekdh45@gmail.com" ]
vivekdh45@gmail.com
e4594e29acc187b7a71f31294522f8925d2b6e23
fff3f7ca5dab581c2b8d82e6e14f436d55a8fc36
/utilslibrary/src/main/java/com/wangdh/utilslibrary/netlibrary/test/NetRXTest.java
da27bdbbad28cbb6ff1184e96d4f4e24d1f48ef7
[]
no_license
dhkyhb/demobase
4a088177767ea5de1b7e4e08d518fa1f47bb3979
8eedaafc4503c051e634ef25857d5f3aa8231a7f
refs/heads/master
2022-09-15T06:17:50.675001
2020-01-18T09:52:03
2020-01-18T09:52:03
267,829,345
0
0
null
null
null
null
UTF-8
Java
false
false
13,295
java
package com.wangdh.utilslibrary.netlibrary.test; import android.arch.lifecycle.LifecycleOwner; import android.content.Context; import com.google.gson.Gson; import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import com.parkingwang.okhttp3.LogInterceptor.LogInterceptor; import com.wangdh.utilslibrary.exception.AppException; import com.wangdh.utilslibrary.netlibrary.clien.OnlineContext; import com.wangdh.utilslibrary.netlibrary.clien.OnlineListener; import com.wangdh.utilslibrary.netlibrary.server.HttpResponse; import com.wangdh.utilslibrary.netlibrary.server.XH_RXOnline; import com.wangdh.utilslibrary.netlibrary.server.xiaohua.API_Xiaohua; import com.wangdh.utilslibrary.netlibrary.server.xiaohua.XiaohuaBody; import com.wangdh.utilslibrary.utils.TLog; import java.io.IOException; import java.util.ArrayList; import java.util.List; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.observers.DisposableObserver; import io.reactivex.schedulers.Schedulers; import okhttp3.OkHttpClient; import okhttp3.Request; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; /** * @author wangdh * @time 2019/2/20 16:05 * @describe */ public class NetRXTest { public static final String BASE_URL = "https://api.douban.com/v2/movie/"; //https://api.douban.com/v2/movie/?start=0&count=20 public static String getJson() { BeanBaseHead<BeanTestBody> http = new BeanBaseHead<>(); http.setCode("1"); http.setKey("key"); http.setSmg("smg"); http.setVerify("jamisekfpawefwe"); BeanAddition beanAddition = new BeanAddition(); beanAddition.setBrand("setBrand"); beanAddition.setImei("setImei"); beanAddition.setModel("setModel"); beanAddition.setRelease("setRelease"); beanAddition.setSdk_int("setSdk_int"); http.setAddition(beanAddition); BeanTestBody beanTestBody = new BeanTestBody(); beanTestBody.setName("名字"); ArrayList<BeanBody2> strings = new ArrayList<>(); for (int i = 0; i < 5; i++) { BeanBody2 beanBody2 = new BeanBody2(); beanBody2.setName("i=" + i); beanBody2.setS(i); beanBody2.setSex("性别"); strings.add(beanBody2); } beanTestBody.setBeanBody2List(strings); http.setObj(beanTestBody); String s = new Gson().toJson(http); BeanBaseHead<BeanTestBody> beanBaseHead = new Gson().fromJson(s, BeanBaseHead.class); String name = beanBaseHead.getObj().getName(); TLog.e(name); List<BeanBody2> beanBody2List = beanBaseHead.getObj().getBeanBody2List(); for (BeanBody2 beanBody2 : beanBody2List) { TLog.e(beanBody2.toString()); } return s; } public static void _1() { TLog.e("NetRXTest:"); OkHttpClient.Builder okHttpClient = new OkHttpClient.Builder(); okHttpClient.addInterceptor(new LogInterceptor()); Retrofit retrofit = new Retrofit.Builder() .client(okHttpClient.build()) .baseUrl(API_Xiaohua.url) .addConverterFactory(GsonConverterFactory.create()) .build(); //获取接口实例 API_Xiaohua api = retrofit.create(API_Xiaohua.class); //调用方法得到一个Call //call; //= api.xhList("desc",1,3,"4bccc3f1ee021fd12621dfffb8ddcfcf","1418816972"); Call<HttpResponse> call = api.xhList2(); //进行网络请求 call.enqueue(new Callback<HttpResponse>() { @Override public void onResponse(Call<HttpResponse> call, Response<HttpResponse> response) { int code = response.code(); TLog.e("code:" + code); TLog.e("message:" + response.message()); TLog.e(response.body().toString()); } @Override public void onFailure(Call<HttpResponse> call, Throwable t) { t.printStackTrace(); } }); } public static void _2() { TLog.e("NetTest2:"); OkHttpClient.Builder okHttpClient = new OkHttpClient.Builder(); okHttpClient.addInterceptor(new LogInterceptor()); Retrofit retrofit = new Retrofit.Builder() .client(okHttpClient.build()) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .baseUrl(API_Xiaohua.url) .build(); //获取接口实例 API_Xiaohua api = retrofit.create(API_Xiaohua.class); DisposableObserver<HttpResponse> disposableObserver = new DisposableObserver<HttpResponse>() { @Override public void onNext(HttpResponse movieSubject) { TLog.e(movieSubject.toString()); // List<MovieSubject.SubjectsBean> subjects = movieSubject.getSubjects(); // for (MovieSubject.SubjectsBean subject : subjects) { // TLog.e(subject.toString()); // } } @Override public void onError(Throwable e) { TLog.e("错误" + e.getMessage()); } @Override public void onComplete() { TLog.e("停止"); } }; // Observable<XiaohuaRespose> call = api.xhList(); // //调用方法得到一个Call // call.subscribeOn(Schedulers.io()) // .observeOn(AndroidSchedulers.mainThread()) // .compose(lifecycleProvider.bindUntilEvent(ActivityEvent.PAUSE)) // .subscribe(disposableObserver); } public static void _3() { TLog.e("NetTest2:"); OkHttpClient okHttpClient = new OkHttpClient(); Retrofit retrofit = new Retrofit.Builder() .client(okHttpClient) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .baseUrl("http://192.168.191.1:8080/") .build(); //获取接口实例 MovieService movieService = retrofit.create(MovieService.class); DisposableObserver<MovieSubject> disposableObserver = new DisposableObserver<MovieSubject>() { @Override public void onNext(MovieSubject movieSubject) { List<MovieSubject.SubjectsBean> subjects = movieSubject.getSubjects(); for (MovieSubject.SubjectsBean subject : subjects) { TLog.e(subject.toString()); } } @Override public void onError(Throwable e) { e.printStackTrace(); TLog.e("错误" + e.getMessage()); } @Override public void onComplete() { TLog.e("停止"); } }; //调用方法得到一个Call Observable<MovieSubject> top250 = movieService.test(); Observable<MovieSubject> movieSubjectObservable = top250.subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); // if (lifecycleProvider != null) { // movieSubjectObservable = movieSubjectObservable.compose(lifecycleProvider.bindUntilEvent(ActivityEvent.PAUSE)); // } movieSubjectObservable.subscribe(disposableObserver); } // http://localhost:8888/test/1 // http://192.168.56.1:8888/test/1 // http://192.168.222.2:8888/test/1 // http://192.168.2.115:8888/test/1 // http://127.0.0.1:8888/test/1 public static void _4() { String url = "http://192.168.191.1:8080/test/1"; // String url = "http://www.baidu.com"; TLog.e(url); OkHttpClient okHttpClient = new OkHttpClient().newBuilder().addInterceptor(new LogInterceptor()).build(); final Request request = new Request.Builder() .url(url) .get()//默认就是GET请求,可以不写 .build(); okhttp3.Call call = okHttpClient.newCall(request); call.enqueue(new okhttp3.Callback() { @Override public void onFailure(okhttp3.Call call, IOException e) { TLog.e("错误:" + e.getLocalizedMessage()); } @Override public void onResponse(okhttp3.Call call, okhttp3.Response response) throws IOException { TLog.e("onResponse:" + response.body().string()); } }); } public static <T> T getHttp(final Class<T> service) { OkHttpClient.Builder okHttpClient = new OkHttpClient.Builder(); okHttpClient.addInterceptor(new LogInterceptor()); Retrofit retrofit = new Retrofit.Builder() .client(okHttpClient.build()) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .baseUrl(API_Xiaohua.url) .build(); return retrofit.create(service); } public static void test(Context context) { XH_RXOnline online = new XH_RXOnline(); if (context instanceof LifecycleOwner) { online.setLifecycleOwner((LifecycleOwner) context); // online.setCloseEvent(ActivityEvent.RESUME); } API_Xiaohua api = online.getAPI(API_Xiaohua.class); online.connectFuc(api.xhList(), new OnlineListener() { @Override public void succeed(Object o, OnlineContext context) { HttpResponse<XiaohuaBody> xiaohuaBodyXiaohuaRespose = (HttpResponse<XiaohuaBody>) o; int size = xiaohuaBodyXiaohuaRespose.getResult().getList().size(); TLog.e("收到的笑话集合大小为:" + size); } @Override public void fail(String errorCode, AppException exception) { } }); /*DisposableObserver<XiaohuaRespose> disposableObserver = new DisposableObserver<XiaohuaRespose>() { @Override public void onNext(XiaohuaRespose bean) { TLog.e(bean.toString()); // List<MovieSubject.SubjectsBean> subjects = movieSubject.getSubjects(); // for (MovieSubject.SubjectsBean subject : subjects) { // TLog.e(subject.toString()); // } } @Override public void onError(Throwable e) { e.printStackTrace(); TLog.e("错误" + e.getMessage()); } @Override public void onComplete() { TLog.e("停止"); } }; StandardRXOnline standardRXOnline = new StandardRXOnline(); API_Xiaohua http = (API_Xiaohua)standardRXOnline.getAPI(API_Xiaohua.class); standardRXOnline.connect(http.xhList(),disposableObserver);*/ } public static void http() { TLog.e("http:"); OkHttpClient.Builder okHttpClient = new OkHttpClient.Builder(); okHttpClient.addInterceptor(new LogInterceptor()); Retrofit retrofit = new Retrofit.Builder() .client(okHttpClient.build()) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .baseUrl(API_Xiaohua.url) .build(); //获取接口实例 API_Xiaohua api = retrofit.create(API_Xiaohua.class); DisposableObserver<HttpResponse> disposableObserver = new DisposableObserver<HttpResponse>() { @Override public void onNext(HttpResponse bean) { TLog.e(bean.toString()); // List<MovieSubject.SubjectsBean> subjects = movieSubject.getSubjects(); // for (MovieSubject.SubjectsBean subject : subjects) { // TLog.e(subject.toString()); // } } @Override public void onError(Throwable e) { e.printStackTrace(); TLog.e("错误" + e.getMessage()); } @Override public void onComplete() { TLog.e("停止"); } }; Observable observable = api.xhList(); observable.subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(disposableObserver); /*//调用方法得到一个Call Observable<MovieSubject> top250 = movieService.test(); Observable<MovieSubject> movieSubjectObservable = top250.subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); // if (lifecycleProvider != null) { // movieSubjectObservable = movieSubjectObservable.compose(lifecycleProvider.bindUntilEvent(ActivityEvent.PAUSE)); // } movieSubjectObservable.subscribe(disposableObserver);*/ } public void getList(DisposableObserver observer) { } }
[ "243823965@qq.com" ]
243823965@qq.com
fa4105951e362a77ffdb8e87075209e1a2cecfd6
0d9e55ffa33b9d9d3cca010185072e67873d31cf
/java110-project/src/main/java/bitcamp/java110/cms/util/DataSource.java
51ea079855db4d8ab828c12f79fa63c5b595148f
[]
no_license
JeahaOh/java110
ac8294ec63520146694ae818e666ae489f3b0b4c
a0e2ae7f0113830e88b8b60116fb25b46bef6c2a
refs/heads/master
2020-04-01T16:21:12.270103
2018-10-17T00:50:42
2018-10-17T00:50:42
147,172,002
0
0
null
null
null
null
UTF-8
Java
false
false
4,031
java
package bitcamp.java110.cms.util; import java.sql.Connection; import java.sql.DriverManager; import java.util.ArrayList; /* 지금까지 모습. Servlet 객체는 한개만 만들어 진다. 쓰레드는 자신의 스택 메모리 영역을 각자 하나씩 갖고있다. 두개의 쓰레드가 한 객체에게 service 메소드를 호출해서 request response를 주고 받게된다면? 한쪽 쓰레드에서 service 객체의 instance 변수를 바꾸려고 한다면? 공유자원이기 때문에 큰일남. -> local변수를 써야함. 쓰레스 => 물류센터에서 바쁘게 움직이는 녀석이랄까? 옛날에 봤던 만화를 되생각해봐. 일 없는 쓰레드가 쉬는곳 쓰레드 풀. 근데 두 쓰레드가 한 커넥션으로 DBMS에게 정보를 보낼때? 멀티스레드가 커넥션을 공유하면 다른 스레드 작업과 묶임 한놈이 rollback하거나 commit이 겹쳐버리면 좓되는것임ㅇㅇ (커넥션 공유의 치명적인 단점) 그래서 서버사이드 멀티쓰레드 서버에서는 커넥션을 하나만 쓰는것이 아님 해결책. 쓰레드가 커넥션은 가지고 다니고, 자기 트렌젝션을 쓴다. 트랜젝션 관리. Servlet -> Service insert -> DAO update -> DAO | -> DAO V Service의 역할 업무 로직, 트랜젝션 관리 Service를 사용하여 TransactionManager -> DataSource commit과 rollback */ public class DataSource { String url; String username; String password; ArrayList<Connection> connections = new ArrayList<>(); // 쓰레드를 보관하는 객체 ThreadLocal<Connection> local = new ThreadLocal<>(); public DataSource( String driver, String url, String username, String password) throws Exception { Class.forName(driver); this.url = url; this.username = username; this.password = password; } // DAO가 쓸 녀석 public Connection getConnection() throws Exception { Connection con = local.get(); if(local.get() != null) { return con; } else { return getConnection(false); } } // transaction manager에게 빌려줌 public Connection getConnection(boolean useTransaction) throws Exception { Connection con = null; while (connections.size() > 0) { con = connections.remove(0); // 유효하고 사용가능하다면 (3초이내에 응답이 오면 유효한것) if(!con.isClosed() && con.isValid(3)) { System.out.println("기존 connection 사용!"); break; } con = null; // } if(con == null) { System.out.println("새 connection 생성!"); return DriverManager.getConnection(url, username, password); } if(useTransaction) { con.setAutoCommit(false); local.set(con); } else { con.setAutoCommit(true); } return con; } // DAO에게서 반납받음 public void returnConnection(Connection con) { returnConnection(con, false); } // TransactionManager에게서 반납받음 public void returnConnection(Connection con, boolean useTransaction) { if(useTransaction) { local.remove(); } if(local.get() == null) { // 트랜잭션으로 사용하는 커넥션이 아닐때만 커넥션 풀에 반납 받음. connections.add(con); } } } /* DAO가 Transaction이 false인 con과 true인 con, TransactionManager가 Transaction이 false인 con과 true인 con 을 반납하는 process가 다름 어렵다 시바... 비지니스 로직은 DB에서 하면 절대 안됨. 프로그램 코드에서 끝내야함. */
[ "jeaha1217@gmail.com" ]
jeaha1217@gmail.com
1a22af11a797eb86f451a444acc023873dda5c4b
13ccb643434f633903a0dc2f01935c73bfc06d4e
/src/main/java/com/aris/async/EventProducer.java
29513eaad91fe2612690550f7f45df425b669186
[]
no_license
Silky-Littleraisin/ShiningAris
bd3609c1d7dba4b8d83f0e0be9c6c7b633e85af0
11d1ce4d03e9189da14701c7381dca716c10e2f7
refs/heads/master
2022-06-22T11:44:27.273682
2019-12-01T01:16:41
2019-12-01T01:16:41
222,421,118
0
0
null
2019-11-19T07:03:10
2019-11-18T10:21:34
CSS
UTF-8
Java
false
false
732
java
package com.aris.async; import com.alibaba.fastjson.JSONObject; import com.aris.util.JedisAdapter; import com.aris.util.RedisKeyUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * Created by aris on 2018/7/30. */ @Service public class EventProducer { @Autowired JedisAdapter jedisAdapter; public boolean fireEvent(EventModel eventModel) { try { String json = JSONObject.toJSONString(eventModel); String key = RedisKeyUtil.getEventQueueKey(); jedisAdapter.lpush(key, json); return true; } catch (Exception e) { return false; } } }
[ "rangersmiku@gmail.com" ]
rangersmiku@gmail.com
144549044c64025a2bc4f7495ca6ea4bc89e741a
4c10d3de19d38ffecdf88080bfd8ad549987a4a9
/src/dp/HouseRobber.java
a004a801ebf22f13137360410c5bc49ec98d37cc
[]
no_license
shubham-cs17/Coding2020
1cbb84766d032ec3c43e0db3760f9b007cef01c9
705ecc8113e5520693ffdc6b4dfd4dc76292b15c
refs/heads/master
2021-04-19T18:50:34.173305
2020-06-15T14:40:35
2020-06-15T14:40:35
249,627,453
0
0
null
2020-06-15T14:40:37
2020-03-24T06:11:30
null
UTF-8
Java
false
false
686
java
package dp; /** * @author Shubham Kumar * @date 26/4/20 */ public class HouseRobber { public static void main(String[] args) { int arr[] ={1,2,3,1}; System.out.println(rob(arr)); } public static int rob(int[] nums) { int dp[] = new int[nums.length]; if(nums.length==0) return 0; if(nums.length==1) return nums[0]; if(nums.length==2){ return nums[0]>nums[1]?nums[0]:nums[1]; } dp[0]= nums[0]; dp[1]= nums[0]>nums[1]?nums[0]:nums[1]; for(int i = 2;i<nums.length;i++) { dp[i] = dp[i-1]>(nums[i]+dp[i-2])?dp[i-1]:nums[i]+dp[i-2]; System.out.println(i+" "+dp[i]); } return dp[nums.length-1]; } }
[ "shubh.iter@gmail.com" ]
shubh.iter@gmail.com
9ef1ca5433acedb9fb302d420492674a257b87f0
e1671893c54600ded36f3487f7833d8191de06f3
/src/main/java/LeetCode/_90_SubsetsII.java
14c7e490f755e283a38b1f322fe72345e41c692f
[]
no_license
hieuminhduong/LeetCode
e2ef34bbd33765b7ed8c46f5ad4ea3b90e7ef0ee
dee4f44fbbf7dcde2bf902d90009517c8b0b159b
refs/heads/master
2023-03-17T08:52:47.588122
2021-03-11T13:56:50
2021-03-11T13:56:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,917
java
package LeetCode; /* https://leetcode.com/problems/subsets-ii/ Medium. Array, Backtracking. Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets. Example: Input: [1,2,2] Output: [ [2], [1], [1,2,2], [2,2], [1,2], [] ] */ import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * @see _78_Subsets */ class _90_SubsetsII { public static List<List<Integer>> subsetsWithDup(int[] nums) { if (nums == null || nums.length == 0) return new ArrayList<>(); Arrays.sort(nums); final List<List<Integer>> res = new ArrayList<>(); backtrack(res, new ArrayList<>(), nums, 0); return res; } private static void backtrack(final List<List<Integer>> res, final List<Integer> arr, final int[] nums, int start) { res.add(new ArrayList<>(arr)); for (int i = start; i < nums.length; i++) { // skip duplicates if (i > start && nums[i] == nums[i - 1]) continue; arr.add(nums[i]); backtrack(res, arr, nums, i + 1); arr.remove(arr.size() - 1); } } public static List<List<Integer>> subsetsWithDup2(int[] nums) { if (nums == null || nums.length == 0) return new ArrayList<>(); Arrays.sort(nums); final List<List<Integer>> res = new ArrayList<>(); res.add(new ArrayList<>()); int start = 0; for (int i = 0; i < nums.length; i++) { if (i == 0 || nums[i] != nums[i - 1]) start = 0; final int size = res.size(); while (start < size) { final List<Integer> arr = new ArrayList<>(res.get(start)); arr.add(nums[i]); res.add(arr); start++; } } return res; } }
[ "lx70716@gmail.com" ]
lx70716@gmail.com
d95e18789961fe4cbcfd8758bfe25b1f731a6784
4ddff7c87688a7b6ec2ea6d0e4d699c91ef73fd2
/src/main/java/com/zzc/modules/sysmgr/product/dao/ProductCategoryDao.java
d6f4cf784eaef3c8e301d90946aff9a2fcc233dc
[]
no_license
1033132510/SCM
56146e99e840c912d1a17f763250d9ab170e7d3c
6a4b8d4bc8685bb5167bd14021f3129a9f5bab91
refs/heads/master
2021-01-21T12:15:23.021648
2017-05-19T08:14:45
2017-05-19T08:14:45
91,782,654
0
0
null
null
null
null
UTF-8
Java
false
false
249
java
package com.zzc.modules.sysmgr.product.dao; import com.zzc.core.dao.BaseDao; import com.zzc.modules.sysmgr.product.entity.ProductCategory; /** * 11 * @author apple * */ public interface ProductCategoryDao extends BaseDao<ProductCategory> { }
[ "lenovo" ]
lenovo
81859ade796467b76ccb534ded47ee7785eb145f
8f9236ce71073487e0dad49368c1dce1b03b1bd4
/app/src/main/java/com/fission/sample/asynctaskapp/MainActivity.java
ab32b89ec05df9b216d5a0099b30836a1b5e341c
[]
no_license
lakshmi-fission/Android_Repo
63fd8a4d71d6efd482fce28d5586705fe2076266
1923ba133ba145b47eebcd73fa57f36c7f9417f3
refs/heads/master
2021-09-03T19:06:48.041610
2018-01-11T09:14:49
2018-01-11T09:14:49
117,075,129
0
0
null
null
null
null
UTF-8
Java
false
false
1,482
java
package com.fission.sample.asynctaskapp; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import org.w3c.dom.Text; public class MainActivity extends AppCompatActivity implements MainView { private ImageView mIVDownloaded; private TextView mTVResult; private Button mBTStartDownload; private Presenter mPresenter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mIVDownloaded = (ImageView)findViewById(R.id.iv_download); mTVResult = (TextView)findViewById(R.id.tv_result); mBTStartDownload = (Button)findViewById(R.id.btn_download); mPresenter = new PresenterImp(this); mBTStartDownload.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mPresenter.startDownloadImage(); } }); } @Override protected void onDestroy() { super.onDestroy(); mPresenter.OnDestroy(); } @Override public TextView getTextView() { return mTVResult; } @Override public ImageView getImageView() { return mIVDownloaded; } @Override public Button getButton() { return mBTStartDownload; } }
[ "lakshmi.sala@fissionlabs.in" ]
lakshmi.sala@fissionlabs.in
0dccb11aaaf68348607c889584aa1c7a7a757cbc
6b2542400a56de686a7f84978fd6df4c45fc056a
/app-vo/src/main/java/com/blackstrawai/ap/dropdowns/ExpenseDropdownVo.java
3db5a3664078095728fca0df87cca7c84545fd0a
[]
no_license
BhargavMaddikera-BM/erp_fintech
adb6f2bb8b9b4e555930a1714b90a57603cc055c
ea78162e490f46adb998ca8a4e935c2aa144a753
refs/heads/master
2023-03-14T15:40:04.206288
2021-02-26T09:23:48
2021-02-26T09:23:48
342,523,642
0
0
null
null
null
null
UTF-8
Java
false
false
1,975
java
package com.blackstrawai.ap.dropdowns; import java.util.List; import com.blackstrawai.ap.expense.NatureOfSpendingVO; import com.blackstrawai.ap.expense.StatusVO; import com.blackstrawai.settings.chartofaccounts.MinimalChartOfAccountsVo; public class ExpenseDropdownVo { private List<NatureOfSpendingVO> natureOfSpendingVOList; private List<StatusVO> statusVOList; private List<BasicEmployeeVo> employee; private List<BasicVendorVo> basicVendorVoList; private List<BasicCustomerVo> basicCustomerVoList; private List<MinimalChartOfAccountsVo> chartOfAccounts; private String dateFormat; public List<MinimalChartOfAccountsVo> getChartOfAccounts() { return chartOfAccounts; } public String getDateFormat() { return dateFormat; } public void setDateFormat(String dateFormat) { this.dateFormat = dateFormat; } public void setChartOfAccounts(List<MinimalChartOfAccountsVo> chartOfAccounts) { this.chartOfAccounts = chartOfAccounts; } public List<NatureOfSpendingVO> getNatureOfSpendingVOList() { return natureOfSpendingVOList; } public void setNatureOfSpendingVOList(List<NatureOfSpendingVO> natureOfSpendingVOList) { this.natureOfSpendingVOList = natureOfSpendingVOList; } public List<StatusVO> getStatusVOList() { return statusVOList; } public void setStatusVOList(List<StatusVO> statusVOList) { this.statusVOList = statusVOList; } public List<BasicEmployeeVo> getEmployee() { return employee; } public void setEmployee(List<BasicEmployeeVo> employee) { this.employee = employee; } public List<BasicVendorVo> getBasicVendorVoList() { return basicVendorVoList; } public void setBasicVendorVoList(List<BasicVendorVo> basicVendorVoList) { this.basicVendorVoList = basicVendorVoList; } public List<BasicCustomerVo> getBasicCustomerVoList() { return basicCustomerVoList; } public void setBasicCustomerVoList(List<BasicCustomerVo> basicCustomerVoList) { this.basicCustomerVoList = basicCustomerVoList; } }
[ "bhargav.maddikera@blackstraw.ai" ]
bhargav.maddikera@blackstraw.ai
d9e5cdd51dcb63b8b57231182d4c0cf9406ce1b4
7e7025b3e5cfbe40e88d618334705517f56b7397
/app/src/main/java/com/lowesta/puochat/FriendsFragment.java
440114db67e89249873130b8418c149ac23641e5
[]
no_license
lovestasan/PuoChat
afb82a63efe2b434fc0a46e86a875c3df670ddd2
00bceb22e157bd468c2a6d3a2ba7908646d8bfce
refs/heads/master
2022-01-28T06:49:15.234667
2019-02-06T16:31:19
2019-02-06T16:31:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
655
java
package com.lowesta.puochat; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; /** * A simple {@link Fragment} subclass. */ public class FriendsFragment extends Fragment { public FriendsFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_friends, container, false); } }
[ "46308063+Sansan1222@users.noreply.github.com" ]
46308063+Sansan1222@users.noreply.github.com
f079bcb1ad78db9a25104feb0b2f3e7dcf2a2b23
b3781c5b3225a540c65a160e3ec7747f9a6c9fa7
/Newest Version/src/Piece.java
9d2e8f3035f8f57438f1e8947385cdf2910ff955
[]
no_license
Wozunubi/Chess-Game
b137a20210b23a364caf1abc7f7140a1890bc44d
d13f6cc47a534c07a7435fd58beecb79404cd678
refs/heads/main
2023-07-15T02:02:32.221831
2021-08-25T03:52:12
2021-08-25T03:52:12
397,974,349
0
0
null
null
null
null
UTF-8
Java
false
false
1,504
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. */ // Importing library for ImageIcon import javax.swing.ImageIcon; /** * * @author ahhhhhh */ public abstract class Piece { private int x, y; // Piece x and y position private boolean isWhite; // Piece colour private ImageIcon image; // Image to represent the piece // Constructor public Piece(int x, int y, boolean isWhite, ImageIcon image) { // Sets global variables to variables passed in this.x = x; this.y = y; this.isWhite = isWhite; this.image = image; } // Returns whether the piece is black or white public boolean getIsWhite() { return isWhite; } // Returns the x position public int getX() { return x; } // Returns the y position public int getY() { return y; } // Sets the x position public void setX(int x) { this.x = x; } // Sets the y position public void setY(int y) { this.y = y; } // Returns the image icon public ImageIcon getImage() { return image; } // This method will be overridden in the subclasses public boolean isLegalMove(Chess chess, int xPos, int yPos) { return true; } }
[ "noreply@github.com" ]
noreply@github.com
4a5c39b407f340ec7d193731581c830d570545b4
99f876879e590503cf818aade2c470d7b1755e0f
/LG-SuperMarket/src/main/java/com/easybuy/supermarket/entity/UserRegistration.java
d5ec20eb25eb5691b9366bee806511e04ed883f3
[]
no_license
Lakshmi-Ganesh/Learning
83484e1be07db032bdade674c38e9201e68c06c9
7223cbb60f07abc5e934406439fab9fc5f3a874e
refs/heads/master
2023-01-11T16:13:33.871705
2019-12-24T12:31:26
2019-12-24T12:31:26
203,987,258
0
1
null
2023-01-05T22:05:34
2019-08-23T11:40:27
CSS
UTF-8
Java
false
false
2,799
java
package com.easybuy.supermarket.entity; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; @Entity @Table(name="UserRegistration") public class UserRegistration { @Id @GeneratedValue @Column(name="userId") private Long userId; @Column(name="first_name") @JsonProperty("firstName") private String firstName; @Column(name="last_name") @JsonProperty("lastName") private String lastName; @Column(name="password") @JsonProperty("password") private String password; @Column(name="confirm_password") @JsonProperty("confirmPassword") private String confirmPassword; @Column(name="email") @JsonProperty("emailId") private String emailId; @Column(name="gender") @JsonProperty("gender") private String gender; @Column(name="dob") @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="dd-mm-yyyy") private Date dateOfBirth; public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getConfirmPassword() { return confirmPassword; } public void setConfirmPassword(String confirmPassword) { this.confirmPassword = confirmPassword; } public String getEmailId() { return emailId; } public void setEmailId(String emailId) { this.emailId = emailId; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public Date getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(Date dateOfBirth) { this.dateOfBirth = dateOfBirth; } @Override public String toString() { return "UserRegistration [userId=" + userId + ", firstName=" + firstName + ", lastName=" + lastName + ", password=" + password + ", confirmPassword=" + confirmPassword + ", emailId=" + emailId + ", gender=" + gender + ", dateOfBirth=" + dateOfBirth + ", getClass()=" + getClass() + ", hashCode()=" + hashCode() + ", toString()=" + super.toString() + "]"; } }
[ "734823@PC404472.cts.com" ]
734823@PC404472.cts.com
4054f2e7e543ced27b605f368a973f2945d1401b
1a154e7d7092dfbef9fb7d0fe8916a577388bd31
/jb4dc-code-generate-root/jb4dc-code-generate-service/src/main/java/org/mybatis/generatorex/codegen/ibatis2/sqlmap/elements/UpdateByPrimaryKeyWithoutBLOBsElementGenerator.java
5980242d4fc9aa860b42cbd3bcb1a18ad8962c3c
[]
no_license
zhuibobo/jb4dc-root
def9589af785d46f723dc467c5a1572c1e3f32f1
a63af9a9505fdfe87d92971e6faf7546a5657b53
refs/heads/master
2023-03-10T07:45:34.174987
2022-04-25T07:11:48
2022-04-25T07:11:48
194,888,652
0
1
null
2023-03-03T03:58:41
2019-07-02T15:20:05
Java
UTF-8
Java
false
false
3,852
java
/** * Copyright 2006-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mybatis.generatorex.codegen.ibatis2.sqlmap.elements; import org.mybatis.generatorex.api.IntrospectedColumn; import org.mybatis.generatorex.api.dom.OutputUtilities; import org.mybatis.generatorex.api.dom.xml.Attribute; import org.mybatis.generatorex.api.dom.xml.TextElement; import org.mybatis.generatorex.api.dom.xml.XmlElement; import org.mybatis.generatorex.codegen.ibatis2.Ibatis2FormattingUtilities; import java.util.Iterator; /** * * @author Jeff Butler * */ public class UpdateByPrimaryKeyWithoutBLOBsElementGenerator extends AbstractXmlElementGenerator { public UpdateByPrimaryKeyWithoutBLOBsElementGenerator() { super(); } @Override public void addElements(XmlElement parentElement) { XmlElement answer = new XmlElement("update"); //$NON-NLS-1$ answer.addAttribute(new Attribute( "id", introspectedTable.getUpdateByPrimaryKeyStatementId())); //$NON-NLS-1$ answer.addAttribute(new Attribute("parameterClass", //$NON-NLS-1$ introspectedTable.getBaseRecordType())); context.getCommentGenerator().addComment(answer); StringBuilder sb = new StringBuilder(); sb.append("update "); //$NON-NLS-1$ sb.append(introspectedTable.getFullyQualifiedTableNameAtRuntime()); answer.addElement(new TextElement(sb.toString())); // set up for first column sb.setLength(0); sb.append("set "); //$NON-NLS-1$ Iterator<IntrospectedColumn> iter = introspectedTable.getBaseColumns() .iterator(); while (iter.hasNext()) { IntrospectedColumn introspectedColumn = iter.next(); sb.append(Ibatis2FormattingUtilities .getEscapedColumnName(introspectedColumn)); sb.append(" = "); //$NON-NLS-1$ sb.append(Ibatis2FormattingUtilities .getParameterClause(introspectedColumn)); if (iter.hasNext()) { sb.append(','); } answer.addElement(new TextElement(sb.toString())); // set up for the next column if (iter.hasNext()) { sb.setLength(0); OutputUtilities.xmlIndent(sb, 1); } } boolean and = false; for (IntrospectedColumn introspectedColumn : introspectedTable .getPrimaryKeyColumns()) { sb.setLength(0); if (and) { sb.append(" and "); //$NON-NLS-1$ } else { sb.append("where "); //$NON-NLS-1$ and = true; } sb.append(Ibatis2FormattingUtilities .getEscapedColumnName(introspectedColumn)); sb.append(" = "); //$NON-NLS-1$ sb.append(Ibatis2FormattingUtilities .getParameterClause(introspectedColumn)); answer.addElement(new TextElement(sb.toString())); } if (context.getPlugins() .sqlMapUpdateByPrimaryKeyWithoutBLOBsElementGenerated(answer, introspectedTable)) { parentElement.addElement(answer); } } }
[ "j.d.r565" ]
j.d.r565
6dbd4c48359d8835c160da0dfb35ff2195c67a14
eac159c2453c9be29748e1271ae02232212488f5
/app/src/main/java/com/example/pedro/prottipo1/MenuActivity.java
cb29aceac2713abdadc70c0c1c1b807730898b19
[]
no_license
pedrollandim/analise_de_custos_com_lesao_por_pressao
8c69c465ecb85624ec480d30aef7c88305a4959f
1b18f989f6a4f4cff9eb6eb89754f939dd11e845
refs/heads/main
2023-07-25T07:26:53.921114
2021-09-03T23:59:31
2021-09-03T23:59:31
400,907,032
1
0
null
null
null
null
UTF-8
Java
false
false
3,034
java
package com.example.pedro.prottipo1; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.example.pedro.prottipo1.modelo.Paciente; public class MenuActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_menu); Button novoPaciente =(Button)findViewById(R.id.menu_novo_paciente); novoPaciente.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent irParaTelaNovoPaciente = new Intent(MenuActivity.this,cadastroPacienteActivity.class); startActivity(irParaTelaNovoPaciente); } }); Button listaPA =(Button)findViewById(R.id.menu_pacientes_lista); listaPA.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent irParaTelaListaPaciente = new Intent(MenuActivity.this,ListaPacientesActivity.class); startActivity(irParaTelaListaPaciente); } }); Button escalaBraden = (Button)findViewById(R.id.menu_avaliacao); escalaBraden.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Paciente paciente = (Paciente) new Paciente(); Intent intentVaiParaCadastroPA = new Intent(MenuActivity.this,EscalaBradenActivity.class); intentVaiParaCadastroPA.putExtra("paciente",paciente ); startActivity(intentVaiParaCadastroPA); } }); Button resultado =(Button)findViewById(R.id.menu_resultados); resultado.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent irParaResultado = new Intent(MenuActivity.this,ResultadosActivity.class); startActivity(irParaResultado); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflar = getMenuInflater(); inflar.inflate(R.menu.menu_menu,menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_menu_ok: //Paciente teste = new Paciente(); //Toast.makeText(MenuActivity.this,"coren: "+teste.getCorenPA(),Toast.LENGTH_LONG).show(); //Toast.makeText(MenuActivity.this,"Saindo.",Toast.LENGTH_LONG).show(); finish(); break; } return super.onOptionsItemSelected(item); } }
[ "pedrolino.landim@gmail.com" ]
pedrolino.landim@gmail.com
1b852c5b20ada0302062c3d996d1a0c99d881a80
7c9e21da91d6e8a0868aac8f0ced5b0f0bbb3024
/src/behavior/mediator/CPU.java
e678217d14ea0d0d1fe803303cb1017e00346f8a
[]
no_license
PlumpMath/DesignPattern-603
701765e927d555ab95595d99d002ab77f52a8529
987f7cfd4a01eb0b8e9f220689a6bc690abb3eb2
refs/heads/master
2021-01-20T09:42:17.404269
2016-05-12T09:30:14
2016-05-12T09:30:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
package behavior.mediator; public class CPU extends Colleague { //分解出来的视频数据 private String videoData = ""; //分解出来的声音数据 private String soundData = ""; /** * 构造函数 */ public CPU(Mediator mediator) { super(mediator); } /** * 获取分解出来的视频数据 */ public String getVideoData() { return this.videoData; } /** * 获取分解出来的声音数据 */ public String getSoundData() { return this.soundData; } public void executeData(String data) { //把数据分开,前面是视频数据,后面是声音数据 String[] array = data.split(","); this.videoData = array[0]; this.soundData = array[1]; //通知主板,CPU完成工作 getMediator().changed(this); } }
[ "yuzhong@bong.cn" ]
yuzhong@bong.cn
998a90956137b2276baf0133e4861263c37a7400
e05eba3874bacf835a115da8411fe7cee77ee755
/src/main/java/com/codegen/cody/common/supcan/SupcanController.java
bcb4d2806998b0b6a864d43352ea8f997f52fa88
[]
no_license
a229053098/code-generator
16fcd2a6ca5561a172e77da9b3ad20d49d1a3205
668bc068e7805837a8b1da4a423c00530d7a902c
refs/heads/master
2022-04-01T23:31:51.160152
2020-02-10T10:34:47
2020-02-10T10:34:47
222,842,037
0
1
null
null
null
null
UTF-8
Java
false
false
6,480
java
/** * Copyright &copy; 2012-2014 <a href="https://github.com/codegen/cody">Cody</a> All rights reserved. */ package com.codegen.cody.common.supcan; import java.lang.reflect.Method; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Map; import org.apache.ibatis.session.SqlSessionFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.codegen.cody.common.config.Global; import com.codegen.cody.common.supcan.annotation.treelist.SupTreeList; import com.codegen.cody.common.supcan.annotation.treelist.cols.SupCol; import com.codegen.cody.common.supcan.annotation.treelist.cols.SupGroup; import com.codegen.cody.common.supcan.treelist.TreeList; import com.codegen.cody.common.supcan.treelist.cols.Col; import com.codegen.cody.common.supcan.treelist.cols.Group; import com.codegen.cody.common.utils.CacheUtils; import com.codegen.cody.common.utils.SpringContextHolder; import com.codegen.cody.common.utils.StringUtils; import com.codegen.cody.common.web.BaseController; /** * 硕正Controller * @author Codegen * @version 2013-11-13 */ @Controller @RequestMapping(value = "${adminPath}/supcan") public class SupcanController extends BaseController { private static final String SUPCAN_CACHE = "supcanCache"; /** * 获取硕正树列表描述(根据注解获取XML) * @return */ @RequestMapping(value = "treeList/{typeAlias}.xml") @ResponseBody public TreeList treeList(@PathVariable("typeAlias") String typeAlias) { // 如果使用Cache,并且在Cache里存在,则直接返回。 boolean useCache = Global.getConfig("supcan.useCache") == "true"; if (useCache){ Object object = CacheUtils.get(SUPCAN_CACHE, typeAlias); if (object != null){ return (TreeList)object; } } // 实体类型 Class<?> clazz; try{ // 根据别名获取MyBaits注册类型。 SqlSessionFactory sqlSessionFactory = SpringContextHolder.getBean(SqlSessionFactory.class); clazz = sqlSessionFactory.getConfiguration().getTypeAliasRegistry().resolveAlias(typeAlias); }catch (Exception e) { // 取不到类型,返回空。 return null; } // 获取硕正注解配置 SupTreeList supTreeList = clazz.getAnnotation(SupTreeList.class); // 没有硕正注解配置,则返回空 if (supTreeList == null){ return null; } // 实例化硕正树列表对象 TreeList treeList = new TreeList(supTreeList); // 获取表头分组 Map<String, Group> groupMap = Maps.newHashMap(); if (supTreeList !=null && supTreeList.groups() != null){ for (SupGroup supGroup : supTreeList.groups()){ groupMap.put(supGroup.id(), new Group(supGroup)); } } // 获取表头列 List<Object> cols = treeList.getCols(); for (Method m : clazz.getMethods()){ SupCol supCol = m.getAnnotation(SupCol.class); if (supCol != null){ // 转为为Col对象 Col col = new Col(supCol); if (StringUtils.isBlank(col.getName())){ col.setName(StringUtils.uncapitalize(StringUtils.substring(m.getName(), 3))); } // 无分组 if (StringUtils.isBlank(supCol.groupId())){ cols.add(col); } // 有分组 else{ Group group = groupMap.get(supCol.groupId()); if (group != null){ group.getCols().add(col); } } } } // 创建字段排序类 Comparator<Object> comparator = new Comparator<Object>() { @Override public int compare(Object o1, Object o2) { int sort1 = 0, sort2 = 0; if (o1 instanceof Group){ sort1 = ((Group)o1).getSort(); }else if (o1 instanceof Col){ sort1 = ((Col)o1).getSort(); } if (o2 instanceof Group){ sort2 = ((Group)o2).getSort(); }else if (o2 instanceof Col){ sort2 = ((Col)o2).getSort(); } return new Integer(sort1).compareTo(new Integer(sort2)); } }; // 将列表转换为树结构并排序 listToTree(cols, groupMap, null, comparator); // 整体排序 Collections.sort(cols, comparator); // 如果使用Cache,则保存到Cache if (useCache){ CacheUtils.put(SUPCAN_CACHE, typeAlias, treeList); } return treeList; } /** * 将分组转换为树结构 * @param list * @param groupMap * @param parentId */ private void listToTree(List<Object> colList, Map<String, Group> groupMap, String parentId, Comparator<Object> comparator){ for (Map.Entry<String, Group> e : groupMap.entrySet()){ Group g = e.getValue(); if (StringUtils.equals(parentId, g.getParentId())){ colList.add(g); // 判断是否有子节点,有的话则加进去 for (Map.Entry<String, Group> ec : groupMap.entrySet()){ Group gc = ec.getValue(); if (g.getId() != null && g.getId().equals(gc.getParentId())){ List<Object> childrenList = Lists.newArrayList(); listToTree(childrenList, groupMap, gc.getParentId(), comparator); g.getCols().addAll(childrenList); break; } } // 排序 Collections.sort(g.getCols(), comparator); } } } /** * 获取硕正树列表描述(注册对象方法获取XML) 测试实例 * @return */ @RequestMapping(value = "treeList/test/test.xml") @ResponseBody public TreeList treeListTest() { // 创建树列表描述对象 TreeList treeList = new TreeList(); // 设置树列表,表头 List<Object> cols = treeList.getCols(); cols.add(new Col("id", "编号")); cols.add(new Col("office", "归属部门")); cols.add(new Col("loginName", "登录名")); cols.add(new Col("name", "名称")); cols.add(new Col("remarks", "备注")); // 设置树列表,多层表头 // 分组1 Group group = new Group("时间"); List<Object> groupCol = group.getCols(); groupCol.add(new Col("createDate", "创建时间")); groupCol.add(new Col("updateDate", "更新时间")); // 分组2 Group group2 = new Group("时间2"); List<Object> group2Col = group2.getCols(); group2Col.add(new Col("createDate2", "创建时间2")); group2Col.add(new Col("updateDate2", "更新时间2")); // 将分组2添加到,分组1的表头 groupCol.add(group2); // 将分组1添加到,主表头 cols.add(group); // 返回TreeList描述对象 return treeList; } }
[ "liuyunjie@7pa.com" ]
liuyunjie@7pa.com
72b5de0125e68be6e76dd35ffac88e98fa9766dc
cee07e9b756aad102d8689b7f0db92d611ed5ab5
/src_6/org/benf/cfr/tests/TernaryTest1.java
953f8a06ca267821c70141ffdaf2d8cc98b5e33a
[ "MIT" ]
permissive
leibnitz27/cfr_tests
b85ab71940ae13fbea6948a8cc168b71f811abfd
b3aa4312e3dc0716708673b90cc0a8399e5f83e2
refs/heads/master
2022-09-04T02:45:26.282511
2022-08-11T06:14:39
2022-08-11T06:14:39
184,790,061
11
5
MIT
2022-02-24T07:07:46
2019-05-03T16:49:01
Java
UTF-8
Java
false
false
215
java
package org.benf.cfr.tests; public class TernaryTest1 { public static void main(String [] args) { Object x = args.length < 3 ? new TernaryTest1() : new Object(); System.out.println(x); } }
[ "lee@benf.org" ]
lee@benf.org
912efb4d8f1b01d83a00dae0e28a569d59a74862
3fa6bb11c2ac290896fbb6e27a9f2f70bf134038
/src/main/java/com/extr/service/UserServiceImpl.java
76a576520915e4373d6e26046e6149aed7f60df9
[]
no_license
kukeoo/yitihuasoftware-progect
06e38316ab2bc3df7706144cc076659a20245d2e
0b570ab6f4b182a1c030a34fcba95c22a7d69d18
refs/heads/master
2022-12-25T02:17:10.830002
2019-06-06T08:24:07
2019-06-06T08:24:07
190,318,270
0
0
null
2022-12-16T01:59:08
2019-06-05T03:16:58
Java
UTF-8
Java
false
false
2,237
java
package com.extr.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.extr.domain.user.User; import com.extr.Mapper.UserMapper; import com.extr.util.Page; /** * @author Ocelot * @date 2014年6月8日 下午8:21:31 */ @Service public class UserServiceImpl implements UserService { @Autowired public UserMapper userMapper; @Override @Transactional public int addUser(User user) { try { int userId = -1; userMapper.insertUser(user); userId = user.getId(); if (user.getRoleListStack() == null) userMapper.grantUserRole(userId, 3); else userMapper.grantUserRole(user.getId(), user.getRoleListStack().get(0).getId()); return userId; } catch (Exception e) { if(e.getClass().getName().equals("org.springframework.dao.DuplicateKeyException")) throw new RuntimeException("duplicate-username"); else throw new RuntimeException(e.getMessage()); } } @Override @Transactional public int addAdmin(User user) { try { int userId = -1; userMapper.insertUser(user); userId = user.getId(); if (user.getRoleListStack() == null) userMapper.grantUserRole(userId, 1); else userMapper.grantUserRole(user.getId(), user.getRoleListStack().get(0).getId()); return userId; } catch (Exception e) { if(e.getClass().getName().equals("org.springframework.dao.DuplicateKeyException")) throw new RuntimeException("duplicate-username"); else throw new RuntimeException(e.getMessage()); } } @Override public List<User> getUserListByRoleId(int roleId,Page<User> page) { // TODO Auto-generated method stub List<User> userList = userMapper.getUserListByRoleId(roleId, page); return userList; } @Override public void updateUser(User user, String oldPassword) { // TODO Auto-generated method stub userMapper.updateUser(user, oldPassword); } @Override public User getUserById(int user_id) { // TODO Auto-generated method stub return userMapper.getUserById(user_id); } @Override public void disableUser(int user_id) { // TODO Auto-generated method stub } }
[ "791633494@qq.com" ]
791633494@qq.com
5773df7c24c511a60e9609c73bf64a1e04f0128f
80ff474779ac5bbb61811e02ec826be07400a4d1
/src/test/java/il/ac/bgu/cs/bp/bpjs/model/BProgramTest.java
3da3e5333145338b9593ff86fe40f2b6f5f40a37
[ "MIT" ]
permissive
acepace/BPjs
2cba1e882a3edb1ecec568544509a24263b4d83b
1e57cf51f5228f3cbc6e3839a6cc165c02d6f3db
refs/heads/develop
2021-04-05T23:45:41.628992
2018-04-10T10:01:24
2018-04-10T10:01:24
124,888,914
0
0
MIT
2018-05-12T07:11:55
2018-03-12T12:54:12
Java
UTF-8
Java
false
false
8,754
java
/* * The MIT License * * Copyright 2017 BPjs Group BGU. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package il.ac.bgu.cs.bp.bpjs.model; import il.ac.bgu.cs.bp.bpjs.execution.BProgramRunner; import il.ac.bgu.cs.bp.bpjs.execution.listeners.InMemoryEventLoggingListener; import il.ac.bgu.cs.bp.bpjs.execution.listeners.PrintBProgramRunnerListener; import static java.util.Arrays.asList; import java.util.Optional; import static java.util.stream.Collectors.toList; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import org.junit.Test; /** * * @author michael */ public class BProgramTest { @Test public void testGlobalScopeAccessors() throws InterruptedException { BProgram sut = new SingleResourceBProgram("RandomProxy.js"); new BProgramRunner(sut).run(); assertEquals( 1000.0, sut.getFromGlobalScope("TOTAL_COUNT", Double.class).get(), 3 ); assertFalse( sut.getFromGlobalScope("does-not-exist", Double.class).isPresent() ); } @Test public void testAppendSource() throws InterruptedException { String coreSource = "bp.registerBThread(function() {\n" + " bsync( {request: bp.Event(\"1\")} );\n" + " bsync( {request: bp.Event(\"2\")} );\n" + " bsync( {request: bp.Event(\"3\")} );\n" + "});" + "bp.log.info('Source code evaluated');"; String additionalSource = "bp.registerBThread(function(){\n" + " bsync({waitFor: bp.Event(\"2\")});\n" + " bsync({request: bp.Event(\"2a\"),\n" + " block: bp.Event(\"3\")});\n" + "});\n" + "bp.log.info('Additional code evaluated');"; BProgram sanitySut = new StringBProgram(coreSource); BProgramRunner rnr = new BProgramRunner(sanitySut); rnr.addListener(new PrintBProgramRunnerListener() ); InMemoryEventLoggingListener el = rnr.addListener( new InMemoryEventLoggingListener()); System.out.println("Sanity run"); rnr.run(); System.out.println("/Sanity run"); System.out.println(""); assertEquals( asList("1","2","3"), el.getEvents().stream().map(BEvent::getName).collect(toList()) ); System.out.println("Test Run"); BProgram sut = new StringBProgram(coreSource); sut.appendSource(additionalSource); rnr.setBProgram(sut); rnr.run(); assertEquals( asList("1","2","2a", "3"), el.getEvents().stream().map(BEvent::getName).collect(toList()) ); } @Test public void testPrependSource() throws InterruptedException { String prependedCode = "var e1=bp.Event(\"1\");\n" + "var e2=bp.Event(\"2\");\n" + "var e3=bp.Event(\"3\");\n" + "bp.log.info('Prepended code evaluated');"; String coreSource = "bp.registerBThread(function() {\n" + " bsync( {request: e1} );\n" + " bsync( {request: e2} );\n" + " bsync( {request: e3} );\n" + "});" + "bp.log.info('Source code evaluated');"; BProgramRunner rnr = new BProgramRunner(); rnr.addListener(new PrintBProgramRunnerListener() ); InMemoryEventLoggingListener el = rnr.addListener( new InMemoryEventLoggingListener()); BProgram sut = new StringBProgram(coreSource); sut.prependSource(prependedCode); rnr.setBProgram(sut); rnr.run(); assertEquals( asList("1", "2", "3"), el.getEvents().stream().map(BEvent::getName).collect(toList()) ); } @Test public void testPrependAndAppendSource() throws InterruptedException { System.out.println("\n\ntestPrependAndAppendSource"); String prependedCode = "var e1=bp.Event(\"1\");\n" + "var e2=bp.Event(\"2\");\n" + "var e3=bp.Event(\"3\");\n" + "bp.log.info('prepended code evaluated');\n" + "var o1=1; var o2=1; var o3=1;"; String coreSource = "bp.registerBThread(function() {\n" + " bsync( {request: e1} );\n" + " bsync( {request: e2} );\n" + " bsync( {request: e3} );\n" + "});" + "bp.log.info('main code evaluated');\n" + "var o2=2; var o3=2;"; String appendedSource = "bp.registerBThread(function(){\n" + " bsync({waitFor: e2});\n" + " bsync({request: bp.Event(\"2a\"),\n" + " block: e3});\n" + "});\n" + "bp.log.info('appended code evaluated');\n" + "var o3=3;"; BProgramRunner rnr = new BProgramRunner(); rnr.addListener(new PrintBProgramRunnerListener() ); InMemoryEventLoggingListener el = rnr.addListener( new InMemoryEventLoggingListener()); BProgram sut = new StringBProgram(coreSource); sut.prependSource(prependedCode); sut.appendSource(appendedSource); rnr.setBProgram(sut); rnr.run(); assertEquals( asList("1","2","2a","3"), el.getEvents().stream().map(BEvent::getName).collect(toList()) ); assertEquals( Optional.of(1.0), sut.getFromGlobalScope("o1", Number.class)); assertEquals( Optional.of(2.0), sut.getFromGlobalScope("o2", Number.class)); assertEquals( Optional.of(3.0), sut.getFromGlobalScope("o3", Number.class)); System.out.println("-- testPrependAndAppendSource DONE"); } @Test( expected=IllegalStateException.class ) public void testIllegalAppend() throws InterruptedException { String coreSource = "bp.registerBThread(function() {\n" + " bsync( {request: bp.Event(\"1\")} );\n" + " bsync( {request: bp.Event(\"2\")} );\n" + " bsync( {request: bp.Event(\"3\")} );\n" + "});" + "bp.log.info('Source code evaluated');"; BProgram sut = new StringBProgram(coreSource); BProgramRunner rnr = new BProgramRunner(sut); rnr.run(); sut.appendSource("bp.log.info('grrr');"); } @Test( expected=IllegalStateException.class ) public void testIllegalPrepend() throws InterruptedException { String coreSource = "bp.registerBThread(function() {\n" + " bsync( {request: bp.Event(\"1\")} );\n" + " bsync( {request: bp.Event(\"2\")} );\n" + " bsync( {request: bp.Event(\"3\")} );\n" + "});" + "bp.log.info('Source code evaluated');"; BProgram sut = new StringBProgram(coreSource); BProgramRunner rnr = new BProgramRunner(sut); rnr.run(); sut.prependSource("bp.log.info('grrr');"); } }
[ "mich.barsinai@gmail.com" ]
mich.barsinai@gmail.com
c3a5935da97b9e04436ebc1b63943f34da9ebd88
e7c8941e538f65615b66fa1477139063861f49c1
/app/src/main/java/de/suparv2exnerdjocokg/suparv2exnerdjo/Medication/MedicineHeadlineFragment.java
75562c869082832160ff501a094cfdcccdb48641
[]
no_license
EkoSHtw/SuparV2Exnerdjo
5a01e549e21f48ea7e8f84804d3b7f208ec2d931
e3383f7d49cfdb5c9b77c38e64b55592518fcce8
refs/heads/master
2021-01-12T10:57:32.350204
2017-10-04T23:08:08
2017-10-04T23:08:08
72,763,230
0
0
null
null
null
null
UTF-8
Java
false
false
4,630
java
package de.suparv2exnerdjocokg.suparv2exnerdjo.Medication; import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import de.suparv2exnerdjocokg.suparv2exnerdjo.R; import de.suparv2exnerdjocokg.suparv2exnerdjo.dummy.DummyMedicine; import java.util.ArrayList; import java.util.List; /** * A fragment representing a list of Items. * <p/> * interface. */ public class MedicineHeadlineFragment extends Fragment { // TODO: Customize parameter argument names private static final String ARG_COLUMN_COUNT = "column-count"; // TODO: Customize parameters private int mColumnCount = 1; private TextView substance; private TextView tradeName; private TextView intensity; private TextView form; private TextView morning; private TextView noon; private TextView afternoon; private TextView night; private TextView unit; private TextView information; private TextView reason; //private OnListFragmentInteractionListener mListener; /** * Mandatory empty constructor for the fragment manager to instantiate the * fragment (e.g. upon screen orientation changes). */ public MedicineHeadlineFragment() { } // TODO: Customize parameter initialization @SuppressWarnings("unused") public static MedicineListFragment newInstance(int columnCount) { MedicineListFragment fragment = new MedicineListFragment(); Bundle args = new Bundle(); args.putInt(ARG_COLUMN_COUNT, columnCount); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mColumnCount = getArguments().getInt(ARG_COLUMN_COUNT); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_medication, container, false); substance = (TextView) view.findViewById(R.id.substance); intensity = (TextView) view.findViewById(R.id.intensity); form = (TextView) view.findViewById(R.id.form); morning = (TextView) view.findViewById(R.id.morning); noon = (TextView) view.findViewById(R.id.noon); afternoon = (TextView) view.findViewById(R.id.afternoon); night = (TextView) view.findViewById(R.id.night); unit = (TextView) view.findViewById(R.id.unit); information = (TextView) view.findViewById(R.id.information); reason = (TextView) view.findViewById(R.id.reason); substance.setText("Wirkstoff"); intensity.setText("Menge"); form.setText("Form"); morning.setText("Morgens"); morning.setTextSize(8); noon.setText("Mittags"); noon.setTextSize(8); afternoon.setText("Abends"); afternoon.setTextSize(8); night.setText("Zur Nacht"); night.setTextSize(8); unit.setText("Häufigkeit"); information.setText("Hinweise"); reason.setText("Grund"); return view; } @Override public void onAttach(Context context) { super.onAttach(context); /*if (context instanceof OnListFragmentInteractionListener) { mListener = (OnListFragmentInteractionListener) context; } else { throw new RuntimeException(context.toString() + " must implement OnListFragmentInteractionListener"); }*/ } @Override public void onDetach() { super.onDetach(); //mListener = null; } /** * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated * to the activity and potentially other fragments contained in that * activity. * <p/> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. */ /*public interface OnListFragmentInteractionListener { // TODO: Update argument type and name void onListFragmentInteraction(Medicine item); }*/ }
[ "monique.exner@gmail.com" ]
monique.exner@gmail.com
e78b1c5632b97f8eadb7e4233f06d1418edde13b
20946f57e35b361d561172cce84e78aacb38d002
/src/com/clafu/controller/IndexBKController.java
548ea71719a10a77d01b11e057f76ba33cd713b2
[]
no_license
PluCial/Clafu
62046a500db342fcc5e41e67eabc8a1f7654ffe0
79c6377b9d0a46e0b3a043e6a7d6a54743cba08f
refs/heads/master
2016-09-06T12:31:56.891879
2015-08-31T02:29:07
2015-08-31T02:29:07
41,651,503
0
0
null
null
null
null
UTF-8
Java
false
false
1,280
java
package com.clafu.controller; import java.util.ArrayList; import org.slim3.controller.Navigation; import org.slim3.datastore.S3QueryResultList; import com.clafu.Constants; import com.clafu.model.ContentModel; import com.clafu.model.UserModel; import com.clafu.service.ContentService; public class IndexBKController extends BaseController { @Override protected Navigation execute(UserModel userModel, boolean isLogin) throws Exception { String cursor = asString("cursor"); S3QueryResultList<ContentModel> contentList = ContentService.getContentList(cursor); // リクエストスコープの設定 requestScope("contentList", contentList == null ? new ArrayList<ContentModel>() : contentList); requestScope("cursor", contentList.getEncodedCursor()); requestScope("hasNext", String.valueOf(contentList.hasNext())); requestScope("moreContentsType", Constants.READ_MORE_CONTENT_TYPE_NEW); return forward("index.jsp"); } @Override protected String getPageTitle() { return "これでもアクセスが増えなかったらもう諦めよう!"; } @Override protected String getPageUri() { return "/"; } }
[ "it.trick.cos@gmail.com" ]
it.trick.cos@gmail.com
617774c65b5ad96decf1fcc43cff41b269907a41
8899cc8568b4777bc6b019f80154c3081d0d49c0
/src/main/java/com/dcms/cms/action/member/ext/SellerMemberAct.java
72782bb61ad43aa036b0239c01a4440ffe9fda55
[]
no_license
dailinyi/maoyuan
5f1b1e674222dbac6cf01c69e0747a1d76a126e9
970b0aeccc41f517a8153a4ee9169a3e11b67b6e
refs/heads/master
2016-09-01T23:51:26.401322
2015-09-13T14:38:32
2015-09-13T14:38:32
40,807,636
0
0
null
null
null
null
UTF-8
Java
false
false
7,883
java
package com.dcms.cms.action.member.ext; import com.dcms.cms.entity.main.CmsSite; import com.dcms.cms.entity.main.CmsUser; import com.dcms.cms.entity.main.Content; import com.dcms.cms.entity.main.MemberConfig; import com.dcms.cms.manager.assist.CmsDictionaryMng; import com.dcms.cms.manager.main.CmsUserExtMng; import com.dcms.cms.manager.main.CmsUserMng; import com.dcms.cms.manager.main.ContentMng; import com.dcms.cms.statistic.utils.QRMng; import com.dcms.cms.web.CmsUtils; import com.dcms.cms.web.FrontUtils; import com.dcms.cms.web.WebErrors; import com.dcms.common.web.ResponseUtils; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; import static com.dcms.cms.Constants.TPLDIR_SELLER_MEMBER; /** * Created by Daily on 2015/8/30. */ @Controller public class SellerMemberAct { public static final String MEMBER_CENTER = "tpl.memberCenter"; public static final String PROMOTION_QR = "tpl.memberPromotionQr"; public static final String MEMBER_PASSWORD = "tpl.memberPassword"; /** * 会员中心页 * * 如果没有登录则跳转到登陆页 * * @param request * @param response * @param model * @return */ @RequestMapping(value = "/seller/index.jspx", method = RequestMethod.GET) public String index(HttpServletRequest request, HttpServletResponse response, ModelMap model) { CmsSite site = CmsUtils.getSite(request); CmsUser user = CmsUtils.getUser(request); FrontUtils.frontData(request, model, site); MemberConfig mcfg = site.getConfig().getMemberConfig(); // 没有开启会员功能 if (!mcfg.isMemberOn()) { return FrontUtils.showMessage(request, model, "member.memberClose"); } if (user == null) { return FrontUtils.showLogin(request, model, site); } Integer channelId = Integer.valueOf(cmsDictionaryMng.findValue("sellerCheck","栏目ID").getValue()); List<Content> unfinishedCheck = contentMng.findUnfinishCheck(user.getId(),channelId); if (unfinishedCheck != null && unfinishedCheck.size() > 0){ model.addAttribute("uncheck",true); } return FrontUtils.getTplPath(request, site.getSolutionPath(), TPLDIR_SELLER_MEMBER, MEMBER_CENTER); } @RequestMapping(value = "/seller/promotion.jspx", method = RequestMethod.GET) public String qrList(HttpServletRequest request, HttpServletResponse response, ModelMap model) { CmsSite site = CmsUtils.getSite(request); CmsUser user = CmsUtils.getUser(request); FrontUtils.frontData(request, model, site); MemberConfig mcfg = site.getConfig().getMemberConfig(); // 没有开启会员功能 if (!mcfg.isMemberOn()) { return FrontUtils.showMessage(request, model, "member.memberClose"); } if (user == null) { return FrontUtils.showLogin(request, model, site); } if (StringUtils.isBlank(user.getPromotionQR())){ //生成推广链接 String promotionUrl = cmsDictionaryMng.findValue("seller", "推广链接").getValue().replace("#{shopCode}", user.getPromotionCode()); String promotionQrUrl = qrMng.stringToQR(request.getContextPath() + site.getUploadPath(),promotionUrl); cmsUserMng.updateQr(user.getId(),null,promotionQrUrl,null); } return FrontUtils.getTplPath(request, site.getSolutionPath(), TPLDIR_SELLER_MEMBER, PROMOTION_QR); } /** * 密码修改输入页 * * @param request * @param response * @param model * @return */ @RequestMapping(value = "/seller/pwd.jspx", method = RequestMethod.GET) public String passwordInput(HttpServletRequest request, HttpServletResponse response, ModelMap model) { CmsSite site = CmsUtils.getSite(request); CmsUser user = CmsUtils.getUser(request); FrontUtils.frontData(request, model, site); MemberConfig mcfg = site.getConfig().getMemberConfig(); // 没有开启会员功能 if (!mcfg.isMemberOn()) { return FrontUtils.showMessage(request, model, "member.memberClose"); } if (user == null) { return FrontUtils.showLogin(request, model, site); } return FrontUtils.getTplPath(request, site.getSolutionPath(), TPLDIR_SELLER_MEMBER, MEMBER_PASSWORD); } /** * 密码修改提交页 * * @param origPwd * 原始密码 * @param newPwd * 新密码 * @param email * 邮箱 * @param nextUrl * 下一个页面地址 * @param request * @param response * @param model * @return * @throws IOException */ @RequestMapping(value = "/seller/pwd.jspx", method = RequestMethod.POST) public String passwordSubmit(String origPwd, String newPwd, String email, String nextUrl, HttpServletRequest request, HttpServletResponse response, ModelMap model) throws IOException { CmsSite site = CmsUtils.getSite(request); CmsUser user = CmsUtils.getUser(request); FrontUtils.frontData(request, model, site); MemberConfig mcfg = site.getConfig().getMemberConfig(); // 没有开启会员功能 if (!mcfg.isMemberOn()) { return FrontUtils.showMessage(request, model, "member.memberClose"); } if (user == null) { return FrontUtils.showLogin(request, model, site); } WebErrors errors = validatePasswordSubmit(user.getId(), origPwd, newPwd, request); if (errors.hasErrors()) { errors.toModel(model); return passwordInput(request,response,model); } cmsUserMng.updatePwd(user.getId(), newPwd); model.addAttribute("success",true); return "redirect:info.jspx"; } /** * 验证密码是否正确 * * @param origPwd * 原密码 * @param request * @param response */ @RequestMapping("/seller/checkPwd.jspx") public void checkPwd(String origPwd, HttpServletRequest request, HttpServletResponse response) { CmsUser user = CmsUtils.getUser(request); boolean pass = cmsUserMng.isPasswordValid(user.getId(), origPwd); ResponseUtils.renderJson(response, pass ? "true" : "false"); } private WebErrors validatePasswordSubmit(Integer id, String origPwd, String newPwd, HttpServletRequest request) { WebErrors errors = WebErrors.create(request); if (errors.ifBlank(origPwd, "origPwd", 100)) { return errors; } if (errors.ifMaxLength(newPwd, "newPwd", 100)) { return errors; } if (!cmsUserMng.isPasswordValid(id, origPwd)) { errors.addErrorCode("member.origPwdInvalid"); return errors; } return errors; } @Autowired private CmsUserMng cmsUserMng; @Autowired private CmsUserExtMng cmsUserExtMng; @Autowired private QRMng qrMng; @Autowired private CmsDictionaryMng cmsDictionaryMng; @Autowired private ContentMng contentMng; }
[ "dailinyi@vip.qq.com" ]
dailinyi@vip.qq.com
f17ce63ebba6f612f1b49ced5c34b0d3cabbdea8
02a0c6b31a8f64c9917d413d51fe11a92c0c4cab
/src/com/bridgelabz/autowire/annotation/HumanAnno.java
b770b7efcfa9f9e536a4245cd7b88bdfaa974e6a
[]
no_license
DeepaliKalagate/SpringCore
482969ee60bf44732f7fc3e89c49132be109ddc5
6472cce0df0fb5c97fbe0950d56fdb359cce5a63
refs/heads/master
2020-09-05T22:02:55.461948
2019-11-08T13:29:21
2019-11-08T13:29:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package com.bridgelabz.autowire.annotation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; public class HumanAnno { private Heart heart; public HumanAnno() { } public HumanAnno(Heart heart) { this.heart=heart; System.out.println("Human constructor call as heart as argument"); } @Autowired @Qualifier("octopuseheart") public void setheart(Heart heart) { System.out.println("Setter method called"); this.heart=heart; } public void startPumping() { if(heart!=null) { heart.pump(); System.out.println("Name of Animal : "+heart.getNameOfAnimal() + "\nNo of heart is : "+heart.getNoOfHeart()); } else { System.out.println("Dead"); } } }
[ "dipakalagate1991@gmail.com" ]
dipakalagate1991@gmail.com
5c99afa3ce58648c0c73749be45d4da55591ea5d
63e2877bedb4896f3d1b034ea072f578d869a432
/app-builder/src/main/java/appbuilder/ui/FormDesignDlg.java
60cf08f2728e3b076389b7f3af416d1907fb1285
[]
no_license
luizsodrerj/framework
b951b98a5cd1c45d100db0c93fabf9b1fc5a2396
dead6bb0406a416e6b77216863bb3388e951315a
refs/heads/labweb
2023-02-21T21:26:29.980893
2023-02-20T22:09:58
2023-02-20T22:09:58
24,303,153
0
0
null
2022-03-25T19:12:19
2014-09-21T20:41:35
JavaScript
UTF-8
Java
false
false
5,423
java
package appbuilder.ui; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.border.EmptyBorder; import appbuilder.entity.ComponentType; import appbuilder.entity.FormField; import framework.presentation.swing.Window; import framework.swing.Button; import framework.swing.Label; import javax.swing.SwingConstants; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import java.awt.event.ActionEvent; public class FormDesignDlg extends JDialog { private static final long serialVersionUID = 1L; private List<FormField>fields = new ArrayList<FormField>(); private final JPanel contentPanel = new JPanel(); private JTextField textField; private JPanel previewPane; public void setFields(List<FormField> fields) { this.fields = fields; } public List<FormField> getFields() { return fields; } public void populatePreviewPane() { Dimension prefSize = new Dimension(350, 45); for (FormField field : fields) { ComponentType compType = field.getComponentType(); String fieldLabel = field.getLabel(); Label label = null; switch (compType.getId()) { case ComponentType.CAIXA_DE_TEXTO: label = getLabel(fieldLabel); JTextField tx = new JTextField(); tx.setPreferredSize(prefSize); tx.setColumns(35); addToPreview(tx, label); break; case ComponentType.AREA_DE_TEXTO: label = getLabel(fieldLabel); JTextArea ta = new JTextArea(); ta.setPreferredSize(new Dimension(395, 75)); addToPreview(ta, label); break; case ComponentType.CAIXA_DE_CHECAGEM: label = getLabel(fieldLabel); JCheckBox ck = new JCheckBox(); ck.setSelected(true); addToPreview(ck, label); break; case ComponentType.LISTA_DE_VALORES: label = getLabel(fieldLabel); JComboBox cb = new JComboBox(); cb.setPreferredSize( new Dimension( (int)prefSize.getWidth() + 45, (int)prefSize.getHeight() ) ); addToPreview(cb, label); break; default: break; } previewPane.doLayout(); } } private Label getLabel(String fieldLabel) { Label label = new Label(fieldLabel); label.setHorizontalAlignment(SwingConstants.RIGHT); label.setPreferredSize(new Dimension(180, 40)); return label; } private void addToPreview(Component field, Label label) { JPanel panel = new JPanel(); panel.setPreferredSize(new Dimension(750,100)); if (field instanceof JCheckBox) { label.setHorizontalAlignment(SwingConstants.LEFT); panel.add(field); panel.add(label); } else { panel.add(label); panel.add(field); } previewPane.add(panel); } void novoCampoActionPerformed() { FieldDlg dialog = new FieldDlg(); dialog.postConstruct(); dialog.setParentForm(this); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); Window.centralizeWindow(dialog); dialog.setModal(true); dialog.setVisible(true); } /** * Launch the application. */ public static void main(String[] args) { try { FormDesignDlg dialog = new FormDesignDlg(); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); Window.centralizeWindow(dialog); dialog.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } /** * Create the dialog. */ public FormDesignDlg() { setBounds(100, 100, 1192, 776); getContentPane().setLayout(new BorderLayout()); contentPanel.setBackground(Color.WHITE); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(null); JLabel lblInformeONome = new Label("Informe o nome do Formul\u00E1rio"); lblInformeONome.setBounds(12, 13, 253, 16); contentPanel.add(lblInformeONome); textField = new AppTextField(); textField.setBounds(12, 42, 760, 35); contentPanel.add(textField); textField.setColumns(10); JSeparator separator = new JSeparator(); separator.setBounds(6, 186, 1150, 16); contentPanel.add(separator); JButton novoCampo = new Button("Incluir novo Campo"); novoCampo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { novoCampoActionPerformed(); } }); novoCampo.setBounds(861, 13, 301, 47); contentPanel.add(novoCampo); JButton cancelar = new Button("Cancelar e Retornar"); cancelar.setBounds(861, 123, 301, 47); contentPanel.add(cancelar); JButton finalizar = new Button("Finalizar e Retornar"); finalizar.setBounds(861, 69, 301, 47); contentPanel.add(finalizar); JSeparator separator_1 = new JSeparator(); separator_1.setOrientation(SwingConstants.VERTICAL); separator_1.setBounds(815, 13, 13, 161); contentPanel.add(separator_1); Label lblpreviewDoLayout = new Label("Informe o nome do Formul\u00E1rio"); lblpreviewDoLayout.setText("\"PREVIEW\" do Layout do Formul\u00E1rio"); lblpreviewDoLayout.setBounds(12, 202, 390, 16); contentPanel.add(lblpreviewDoLayout); previewPane = new JPanel(); previewPane.setBounds(12, 243, 1150, 472); contentPanel.add(previewPane); } }
[ "luizsodrerj@gmail.com" ]
luizsodrerj@gmail.com
3d05a867a9946852327643fc2dbdca8bb2c11138
93e43f88513a1019985329669c94b5137394c1db
/source code/finalPatch/src/FinalPatch/RegisterDataGUI.java
765e741895bed997b13e8d348b7f2a60a6872dd5
[]
no_license
nourmat/MIPS-processor-simulator
d85367f75b5ce115190a30b5b2d635fdecc420d0
de90c6aa1d6f268fa6624661ac23044b6b11c7aa
refs/heads/main
2023-04-27T06:00:03.478742
2021-05-06T01:55:02
2021-05-06T01:55:02
364,754,232
0
0
null
null
null
null
UTF-8
Java
false
false
2,023
java
package FinalPatch; import javax.swing.*; import java.awt.*; /** * This Class is for making an object that containes 3 Labels * 1st JLabel so it is one with contains the name * 2nd one is number of the register * 3rd one is the value that the register is saving * intaillay the value is zero */ public class RegisterDataGUI extends JPanel{ private int value = 0; private JLabel nameLabel; private JLabel numberLabel; private JLabel valueLabel; private boolean printHex = false; public RegisterDataGUI(String text, int number){ nameLabel = new JLabel(text); numberLabel = new JLabel(""+number); valueLabel = new JLabel(""+value); initialize(); } public void initialize(){ this.setLayout(new GridLayout(1,3,0,20)); //this.setBorder(BorderFactory.createLineBorder(Color.BLACK)); this.add(nameLabel); this.add(numberLabel); this.add(valueLabel); nameLabel.setVerticalAlignment(SwingConstants.CENTER); nameLabel.setHorizontalAlignment(SwingConstants.CENTER); numberLabel.setVerticalAlignment(SwingConstants.CENTER); numberLabel.setHorizontalAlignment(SwingConstants.CENTER); valueLabel.setPreferredSize(new Dimension(70,0)); //valueLabel.setVerticalAlignment(SwingConstants.CENTER); //valueLabel.setHorizontalAlignment(SwingConstants.CENTER); nameLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); numberLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); valueLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); } //SETTERS public void setValue(int value) { this.value = value; if (printHex) valueLabel.setText("0x" + Integer.toHexString(value).toUpperCase()); else { valueLabel.setText("" + value); } } public void setPrintHex(boolean printHex) { this.printHex = printHex; setValue(value); } }
[ "nourmat" ]
nourmat
6fcea082d10a8abb46d007345efb8684ec665766
64d10f1355cf4e86f30add6b697f31cf7a3799d2
/src/com/zthdev/activity/base/ZDevTabActivity.java
933750357133b1cf2ca56cb9e236d13a44b6f2a6
[]
no_license
zthuan0625/ZthDevFramwork
d84e977d1a756cdf08e5b881fd4458cb7c64e26e
780f675f2694582e9abdcd515e61421c753a6295
refs/heads/master
2021-01-22T11:37:27.472721
2015-09-24T02:41:14
2015-09-24T02:41:14
29,447,969
0
0
null
null
null
null
UTF-8
Java
false
false
3,871
java
package com.zthdev.activity.base; import java.lang.reflect.Field; import android.app.Activity; import android.os.Bundle; import android.util.DisplayMetrics; import android.view.GestureDetector; import android.view.GestureDetector.OnGestureListener; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import com.zthdev.annotation.BindID; import com.zthdev.app.ZDevAppContext; import com.zthdev.custom.view.ScrollTabHost; /** * * 类名称:ZDevTabActivity <br> * 类描述:带TabHost的Activity,支持滑动切换 <br> * 创建人:赵腾欢 * 创建时间:2014-10-20 下午3:00:17 <br> * @version V1.0 */ public abstract class ZDevTabActivity extends Activity implements OnGestureListener { /** * TabHost */ private ScrollTabHost mTabHost; /** * 手势解析 */ private GestureDetector mGestureDetector; /** * 在该方法里面返回Activity的布局文件 */ public abstract int initLayoutView(); /** * 初始化TabHost的数据 * @param mTabHost */ public abstract void intTabHostData(ScrollTabHost mTabHost); /** * 初始化数据 */ public abstract void initData(); /** * 在该方法里面定义需要自定义的监听事件 */ public abstract void initViewListener(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(initLayoutView()); ZDevAppContext.getInstance().pushActivity(this); initTab(); intTabHostData(mTabHost); initTabTouch(); injectAllView(); initData(); initViewListener(); } /** * 初始化TabHost */ private void initTab() { mTabHost = (ScrollTabHost) findViewById(android.R.id.tabhost); mTabHost.setup(); } /** * 初始化TabHost滑动事件 */ private void initTabTouch() { DisplayMetrics metrics = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(metrics); mTabHost.initSwitchAnimation(metrics.widthPixels); mGestureDetector = new GestureDetector(this,this); mTabHost.setOnTouchListener(mOnTouchListener); } /** * 反射获得所有的控件并判断是否使用了bindID注解 如果使用则自动匹配相应ID */ protected void injectAllView() { Field[] fields = this.getClass().getDeclaredFields(); for (Field field : fields) { field.setAccessible(true); // 判断该字段是否存在指定的注解 if (field.isAnnotationPresent(BindID.class)) { BindID inject = field.getAnnotation(BindID.class); int resourid = inject.id(); try { field.set(this, findViewById(resourid)); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } } } private OnTouchListener mOnTouchListener = new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return mGestureDetector.onTouchEvent(event); } }; @Override public boolean onTouchEvent(MotionEvent event) { return mGestureDetector.onTouchEvent(event); } @Override public boolean onDown(MotionEvent e) { return false; } @Override public void onShowPress(MotionEvent e) { } @Override public boolean onSingleTapUp(MotionEvent e) { return false; } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return false; } @Override public void onLongPress(MotionEvent e) { } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,float velocityY) { //判断X方向的滑动速度 int vel = velocityX > 10 ? -1 : 1; mTabHost.setCurrentTab(mTabHost.getCurrentTab() + vel); return true; } @Override protected void onDestroy() { super.onDestroy(); ZDevAppContext.getInstance().popActivity(this); } }
[ "243558612@qq.com" ]
243558612@qq.com
98529e356ac2dbca68a9ddd27f56c215ceb6e76e
cfe621e8c36e6ac5053a2c4f7129a13ea9f9f66b
/AndroidApplications/com.zeptolab.ctr.ads-912244/src/com/IQzone/postitial/obfuscated/le.java
dead3e834fe9b11f08ab57915ca05a30332d912b
[]
no_license
linux86/AndoirdSecurity
3165de73b37f53070cd6b435e180a2cb58d6f672
1e72a3c1f7a72ea9cd12048d9874a8651e0aede7
refs/heads/master
2021-01-11T01:20:58.986651
2016-04-05T17:14:26
2016-04-05T17:14:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
645
java
package com.IQzone.postitial.obfuscated; import com.IQzone.postitial.b.a; import java.util.HashSet; import java.util.Iterator; import java.util.Set; final class le implements Runnable { private /* synthetic */ la a; le(la laVar) { this.a = laVar; } public final void run() { Set hashSet; synchronized (la.f(this.a)) { hashSet = new HashSet(la.f(this.a)); } la.l(); new StringBuilder("notifying listeners ").append(hashSet.size()).toString(); Iterator it = hashSet.iterator(); while (it.hasNext()) { ((a) it.next()).a(); } } }
[ "jack.luo@mail.utoronto.ca" ]
jack.luo@mail.utoronto.ca
118205a2533a950f7fd24f598c2e9ddc690bcd4b
63eafd10ac6b53a4c507ae6622b0acc8b1bd3ea5
/src/main/java/de/blau/android/util/Util.java
8686f67a8eb8a63485132a140410b734dc4ca766
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
KaartGroup/osmeditor4android
f00b6d518693eea96f05986fae5c873420e38605
5fa909779f07ecb9d8b2b0c9b7bd03e00eae9179
refs/heads/master
2020-09-24T10:54:31.350310
2020-04-30T12:05:39
2020-04-30T12:05:39
225,742,203
0
4
NOASSERTION
2019-12-04T00:13:59
2019-12-04T00:13:58
null
UTF-8
Java
false
false
26,006
java
package de.blau.android.util; import java.io.IOException; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import org.xml.sax.XMLReader; import com.google.android.material.floatingactionbutton.FloatingActionButton; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Parcel; import android.text.Editable; import android.text.Html; import android.text.Spanned; import android.text.style.CharacterStyle; import android.text.style.MetricAffectingSpan; import android.util.Log; import android.view.View; import android.widget.ScrollView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.view.ViewCompat; import androidx.core.widget.NestedScrollView; import androidx.fragment.app.FragmentActivity; import de.blau.android.App; import de.blau.android.Logic; import de.blau.android.R; import de.blau.android.exception.OsmServerException; import de.blau.android.osm.BoundingBox; import de.blau.android.osm.Node; import de.blau.android.osm.OsmElement; import de.blau.android.osm.Relation; import de.blau.android.osm.RelationMember; import de.blau.android.osm.StorageDelegator; import de.blau.android.osm.ViewBox; import de.blau.android.osm.Way; import de.blau.android.presets.Preset; import de.blau.android.resources.TileLayerServer; public final class Util { private static final String DEBUG_TAG = "Util"; /** * Private constructor */ private Util() { // don't allow instantiating of this class } /** * Wrap an Object in an ArrayList * * @param <T> the Object type * @param o the input String * @return an ArrayList containing only s */ public static <T> List<T> wrapInList(@NonNull T o) { List<T> v = new ArrayList<>(1); v.add(o); return v; } /** * Convert a &lt;String, String&gt; Map to a Map of &lt;String, ArrayList&lt;String&gt;&gt; * * @param map the input Map * @return the converted Map */ @NonNull public static LinkedHashMap<String, List<String>> getListMap(@NonNull Map<String, String> map) { LinkedHashMap<String, List<String>> result = new LinkedHashMap<>(); for (Entry<String, String> e : map.entrySet()) { result.put(e.getKey(), wrapInList(e.getValue())); } return result; } /** * Sort a list of ways in the order they are connected * * Note: there is likely a far better algorithm than this, assumes that ways could be reversed. Further this will in * general not work for closed ways and assumes that the ways can actually be arranged as a single sorted sequence. * * @param list List of ways * @return null if not connected or not all ways connected or the sorted list of ways */ public static List<OsmElement> sortWays(@NonNull List<OsmElement> list) { List<OsmElement> result = new ArrayList<>(); List<OsmElement> unconnected = new ArrayList<>(list); OsmElement e = unconnected.get(0); unconnected.remove(0); if (!e.getName().equals(Way.NAME)) { return null; // not all are ways } result.add(e); while (true) { boolean found = false; for (OsmElement w : unconnected) { if (!Way.NAME.equals(w.getName())) { return null; // not all are ways } // this is a bit complicated because we don't want to reverse ways just yet Node firstNode1 = ((Way) result.get(0)).getFirstNode(); Node firstNode2 = ((Way) result.get(0)).getLastNode(); Node lastNode1 = ((Way) result.get(result.size() - 1)).getFirstNode(); Node lastNode2 = ((Way) result.get(result.size() - 1)).getLastNode(); Node wFirstNode = ((Way) w).getFirstNode(); Node wLastNode = ((Way) w).getLastNode(); if (wFirstNode.equals(firstNode1) || wFirstNode.equals(firstNode2) || wLastNode.equals(firstNode1) || wLastNode.equals(firstNode2)) { result.add(0, w); unconnected.remove(w); found = true; break; } else if (wFirstNode.equals(lastNode1) || wFirstNode.equals(lastNode2) || wLastNode.equals(lastNode1) || wLastNode.equals(lastNode2)) { result.add(w); unconnected.remove(w); found = true; break; } } if (!found && !unconnected.isEmpty()) { return null; } else if (unconnected.isEmpty()) { return result; } } } /** * Sort a list of RelationMemberDescription in the order they are connected * * Note: there is likely a far better algorithm than this, ignores way direction. * * @param list List of relation members * @return fully or partially sorted List of RelationMembers, if partially sorted the unsorted elements will come * first * @param <T> Class that extents RelationMember */ @NonNull public static <T extends RelationMember> List<T> sortRelationMembers(@NonNull List<T> list) { List<T> result = new ArrayList<>(); List<T> unconnected = new ArrayList<>(list); int nextWay = 0; while (true) { nextWay = nextWay(nextWay, unconnected); if (nextWay >= unconnected.size()) { break; } T currentRmd = unconnected.get(nextWay); unconnected.remove(currentRmd); result.add(currentRmd); int start = result.size() - 1; for (int i = nextWay; i < unconnected.size();) { T rmd = unconnected.get(i); if (!rmd.downloaded() || !Way.NAME.equals(rmd.getType())) { i++; continue; } Way startWay = (Way) result.get(start).getElement(); Way endWay = (Way) result.get(result.size() - 1).getElement(); Way currentWay = (Way) rmd.getElement(); // the following works for all situation including closed ways but will be a bit slow if (haveCommonNode(endWay, currentWay)) { result.add(rmd); unconnected.remove(rmd); } else if (haveCommonNode(startWay, currentWay)) { result.add(start, rmd); unconnected.remove(rmd); } else { i++; } } } unconnected.addAll(result); // return with unsorted elements at top return unconnected; } /** * Test if two ways have a common Node * * Note should be moved to the Way class * * @param way1 first Way * @param way2 second Way * @return true if the have a common Node */ private static boolean haveCommonNode(@Nullable Way way1, @Nullable Way way2) { if (way1 != null && way2 != null) { List<Node> way1Nodes = way1.getNodes(); int size1 = way1Nodes.size(); List<Node> way2Nodes = way2.getNodes(); int size2 = way2Nodes.size(); // optimization: check start and end first, this should make partially sorted list reasonably fast if (way2Nodes.contains(way1Nodes.get(0)) || way2Nodes.contains(way1Nodes.get(size1 - 1)) || way1Nodes.contains(way2Nodes.get(0)) || way1Nodes.contains(way2Nodes.get(size2 - 1))) { return true; } // nope have to iterate List<Node> slice = way2Nodes.subList(1, size2 - 1); for (int i = 1; i < size1 - 2; i++) { if (slice.contains(way1Nodes.get(i))) { return true; } } } return false; } /** * Return the next Way index in a list of RelationMemberDescriptions * * @param start starting index * @param unconnected List of T * @param <T> Class that extents RelationMember * @return the index of the next Way, or that value of start */ private static <T extends RelationMember> int nextWay(int start, @NonNull List<T> unconnected) { // find first way int firstWay = start; for (; firstWay < unconnected.size(); firstWay++) { T rm = unconnected.get(firstWay); if (rm.downloaded() && Way.NAME.equals(rm.getType())) { break; } } return firstWay; } /** * Safely return a short cut (aka one character) from the string resources * * @param ctx Android context * @param res the id of a string resource * @return character or 0 if no short cut can be found */ public static char getShortCut(@NonNull Context ctx, int res) { String s = ctx.getString(res); if (s != null && s.length() >= 1) { return s.charAt(0); } else { return 0; } } /** * Get the location of the center of the given osm-element * * @param delegator the StorageDelegator instance * @param osmElementType the typoe of OSM element as a String (NODE, WAY, RELATION) * @param osmId the id of the object * @return {lat, lon} or null */ public static int[] getCenter(@NonNull final StorageDelegator delegator, @NonNull final String osmElementType, long osmId) { OsmElement osmElement = delegator.getOsmElement(osmElementType, osmId); if (osmElement instanceof Node) { Node n = (Node) osmElement; return new int[] { n.getLat(), n.getLon() }; } if (osmElement instanceof Way) { double[] coords = Geometry.centroidLonLat((Way) osmElement); if (coords != null) { return new int[] { (int) (coords[1] * 1E7), (int) (coords[0] * 1E7) }; } } if (osmElement instanceof Relation) { // the center of the bounding box is naturally just a rough estimate BoundingBox bbox = osmElement.getBounds(); if (bbox != null) { ViewBox vbox = new ViewBox(bbox); return new int[] { (int) (vbox.getCenterLat() * 1E7), vbox.getLeft() + (vbox.getRight() - vbox.getLeft()) / 2 }; } } return null; } /** * Convert a list to a semicolon separated string * * @param list the List to convert * @return string containing the individual list values separated by ; or the empty string if list is null or empty */ @NonNull public static String listToOsmList(@Nullable List<String> list) { StringBuilder osmList = new StringBuilder(""); if (list != null) { for (String s : list) { if (osmList.length() > 0) { osmList.append(";"); } osmList.append(s); } } return osmList.toString(); } /** * Scroll to the supplied view * * @param sv the ScrollView or NestedScrollView to scroll * @param row the row to display, if null scroll to top or bottom of sv * @param up if true scroll to top if row is null, otherwise scroll to bottom * @param force if true always try to scroll even if row is already on screen */ public static void scrollToRow(@NonNull final View sv, @Nullable final View row, final boolean up, boolean force) { Rect scrollBounds = new Rect(); sv.getHitRect(scrollBounds); Log.d(DEBUG_TAG, "scrollToRow bounds " + scrollBounds); if (row != null && row.getLocalVisibleRect(scrollBounds) && !force) { return; // already on screen } if (row == null) { Log.d(DEBUG_TAG, "scrollToRow scrolling to top or bottom"); sv.post(new Runnable() { @Override public void run() { if (sv instanceof ScrollView) { ((ScrollView) sv).fullScroll(up ? ScrollView.FOCUS_UP : ScrollView.FOCUS_DOWN); } else if (sv instanceof NestedScrollView) { ((NestedScrollView) sv).fullScroll(up ? ScrollView.FOCUS_UP : ScrollView.FOCUS_DOWN); } else { Log.e(DEBUG_TAG, "scrollToRow unexpected view " + sv); } } }); } else { Log.d(DEBUG_TAG, "scrollToRow scrolling to row"); sv.post(new Runnable() { @SuppressLint("NewApi") @Override public void run() { final int target = up ? row.getTop() : row.getBottom(); if (sv instanceof ScrollView) { ((ScrollView) sv).smoothScrollTo(0, target); } else if (sv instanceof NestedScrollView) { ((NestedScrollView) sv).smoothScrollTo(0, target); } else { Log.e(DEBUG_TAG, "scrollToRow unexpected view " + sv); } } }); } } /** * Set the background tint list for a FloatingActionButton in a version independent way * * @param fab the FloatingActionButton * @param tint a ColorStateList */ public static void setBackgroundTintList(@NonNull FloatingActionButton fab, @NonNull ColorStateList tint) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { fab.setBackgroundTintList(tint); } else { ViewCompat.setBackgroundTintList(fab, tint); } } /** * Convert first letter of v to upper case using English * * @param v the input String * @return a String with its first letter as a capital (or null if v was null) */ @Nullable public static String capitalize(@Nullable String v) { if (v != null && v.length() > 0) { char[] a = v.toCharArray(); a[0] = Character.toUpperCase(a[0]); return String.valueOf(a); } return v; } /** * Share the supplied position with other apps * * @param activity this activity * @param lonLat coordinates to share * @param z the zoom level or null */ public static void sharePosition(@NonNull Activity activity, @Nullable double[] lonLat, @Nullable Integer z) { if (lonLat != null) { Uri geo = Uri.parse("geo:" + String.format(Locale.US, "%.7f", lonLat[1]) + "," + String.format(Locale.US, "%.7f", lonLat[0]) + (z != null ? "?z=" + z.toString() : "")); Log.d(DEBUG_TAG, "sharing " + geo); Intent geoIntent = new Intent(Intent.ACTION_VIEW, geo); activity.startActivity(geoIntent); } } /** * Check that a double is not zero * * @param a the double to test * @return true if not zero */ public static boolean notZero(double a) { return a < -Double.MIN_VALUE || a > Double.MIN_VALUE; } /** * Check if two floating point values are the same within a tolereance range * * @param d1 value 1 * @param d2 value 2 * @param tolerance the tolerance * @return true if the difference between the values is smaller than the tolerance */ public static boolean equals(double d1, double d2, double tolerance) { return Math.abs(d1 - d2) < tolerance; } /** * Remove formating from s and truncate it if necessary, typically used in a TextWatcher * * @param activity if non-null and the string has been truncated display a toast with this activity * @param s Editable that needs to be sanitized * @param maxStringLength maximum length the string is allowed to have */ public static void sanitizeString(@Nullable Activity activity, @NonNull Editable s, int maxStringLength) { // remove formating from pastes etc CharacterStyle[] toBeRemovedSpans = s.getSpans(0, s.length(), MetricAffectingSpan.class); for (CharacterStyle toBeRemovedSpan : toBeRemovedSpans) { s.removeSpan(toBeRemovedSpan); } // truncate if longer than max supported string length int len = s.length(); if (len > maxStringLength) { s.delete(maxStringLength, len); if (activity != null) { Snack.toastTopWarning(activity, activity.getString(R.string.toast_string_too_long, len)); } } } /** * Replacement for Long.compare prior to Android 19 * * @param x first value to compare * @param y second value to compare * @return -1 if x is numerically smaller than y, 0 if equal and +1 if x is numerically larger than y */ @SuppressLint("NewApi") public static int longCompare(long x, long y) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { return Long.compare(x, y); } return Long.valueOf(x).compareTo(y); } private static class UlTagHandler implements Html.TagHandler { @Override public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) { if (tag.equals("ul") && !opening) { output.append("\n"); } if (tag.equals("li") && opening) { output.append("\n\t•"); } } } /** * Backwards compatible version of Html.fromHtml * * @param html string with HTML markup to convert * @return a Spanned formated as the markup required */ @SuppressWarnings("deprecation") public static Spanned fromHtml(@NonNull String html) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY, null, new UlTagHandler()); } else { return Html.fromHtml(html, null, new UlTagHandler()); } } /** * Convert a Drawable to a Bitmap See * https://stackoverflow.com/questions/3035692/how-to-convert-a-drawable-to-a-bitmap/9390776 * * @param drawable input Drawable * @return a Bitmap */ public static Bitmap drawableToBitmap(@NonNull Drawable drawable) { if (drawable instanceof BitmapDrawable) { return ((BitmapDrawable) drawable).getBitmap(); } // We ask for the bounds if they have been set as they would be most // correct, then we check we are > 0 final int width = !drawable.getBounds().isEmpty() ? drawable.getBounds().width() : drawable.getIntrinsicWidth(); final int height = !drawable.getBounds().isEmpty() ? drawable.getBounds().height() : drawable.getIntrinsicHeight(); // Now we check we are > 0 final Bitmap bitmap = Bitmap.createBitmap(width <= 0 ? 1 : width, height <= 0 ? 1 : height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); drawable.draw(canvas); return bitmap; } /** * Get the size of a bundle in bytes * * @param bundle the Bundle * @return the size in bytes */ public static int getBundleSize(@NonNull Bundle bundle) { Parcel parcel = Parcel.obtain(); parcel.writeBundle(bundle); int size = parcel.dataSize(); parcel.recycle(); return size; } /** * Clear all the places where we've cached icons * * @param context Android Context */ public static void clearIconCaches(@NonNull Context context) { Preset[] presets = App.getCurrentPresets(context); for (Preset p : presets) { if (p != null) { p.clearIcons(); } } Logic logic = App.getLogic(); if (logic != null) { de.blau.android.Map map = logic.getMap(); if (map != null) { de.blau.android.layer.data.MapOverlay dataLayer = map.getDataLayer(); if (dataLayer != null) { dataLayer.clearIconCaches(); dataLayer.invalidate(); } } } TileLayerServer.clearLogos(); } /** * If aspects of the configuration have changed clear icon caches * * Side effect updates stored Configuration * * @param context Android Context * @param newConfig new Configuration */ public static void clearCaches(@NonNull Context context, @NonNull Configuration newConfig) { Configuration oldConfig = App.getConfiguration(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { if (oldConfig == null || oldConfig.densityDpi != newConfig.densityDpi || oldConfig.fontScale != newConfig.fontScale) { // if the density has changed the icons will have wrong dimension remove them clearIconCaches(context); App.setConfiguration(newConfig); } } } /** * Determine if we have less than 32MB of heap * * @return true if the heap is small */ public static boolean smallHeap() { return Runtime.getRuntime().maxMemory() <= 32L * 1024L * 1024L; // less than 32MB } /** * See https://stackoverflow.com/questions/29657781/how-to-i-get-the-ietf-bcp47-language-code-in-android-api-21 * * Modified from: https://github.com/apache/cordova-plugin-globalization/blob/master/src/android/Globalization.java * * Returns a well-formed ITEF BCP 47 language tag representing this locale string identifier for the client's * current locale * * @param loc the Locale to use * @return String: The BCP 47 language tag for the current locale */ public static String toBcp47Language(@NonNull Locale loc) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return loc.toLanguageTag(); } // we will use a dash as per BCP 47 final char SEP = '-'; String language = loc.getLanguage(); String region = loc.getCountry(); String variant = loc.getVariant(); // special case for Norwegian Nynorsk since "NY" cannot be a variant as per BCP 47 // this goes before the string matching since "NY" wont pass the variant checks if (language.equals("no") && region.equals("NO") && variant.equals("NY")) { language = "nn"; region = "NO"; variant = ""; } if (language.isEmpty() || !language.matches("\\p{Alpha}{2,8}")) { language = "und"; // Follow the Locale#toLanguageTag() implementation // which says to return "und" for Undetermined } else if (language.equals("iw")) { language = "he"; // correct deprecated "Hebrew" } else if (language.equals("in")) { language = "id"; // correct deprecated "Indonesian" } else if (language.equals("ji")) { language = "yi"; // correct deprecated "Yiddish" } // ensure valid country code, if not well formed, it's omitted if (!region.matches("\\p{Alpha}{2}|\\p{Digit}{3}")) { region = ""; } // variant subtags that begin with a letter must be at least 5 characters long if (!variant.matches("\\p{Alnum}{5,8}|\\p{Digit}\\p{Alnum}{3}")) { variant = ""; } StringBuilder bcp47Tag = new StringBuilder(language); if (!region.isEmpty()) { bcp47Tag.append(SEP).append(region); } if (!variant.isEmpty()) { bcp47Tag.append(SEP).append(variant); } return bcp47Tag.toString(); } /** * Display a toast if we got an IOException downloading * * @param activity the calling Activity * @param iox the IOException */ public static void toastDowloadError(@NonNull final FragmentActivity activity, @NonNull final IOException iox) { activity.runOnUiThread(new Runnable() { @Override public void run() { if (iox instanceof OsmServerException) { Snack.toastTopWarning(activity, activity.getString(R.string.toast_download_failed, ((OsmServerException) iox).getErrorCode(), iox.getMessage())); } else { Snack.toastTopWarning(activity, activity.getString(R.string.toast_server_connection_failed, iox.getMessage())); } } }); } /** * Check if the device supports WebView * * Unluckily it is totally unclear if this helps with disabled packages. * * @param ctx an Android Context * @return true if the system has a WebView implementation */ public static boolean supportsWebView(@NonNull Context ctx) { return Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT_WATCH ? true : ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WEBVIEW); } }
[ "simon@poole.ch" ]
simon@poole.ch
0dacf1f877b77303ea9a975e67e981d6ac8a67a8
d8d9de6067211421ec3591d724af5439b2a8b65d
/src/org/sosy_lab/java_smt/solvers/cvc5/CVC5NumeralFormulaManager.java
cbe77a4f5e7558cfcac70a09cbf76651de766d9d
[ "Apache-2.0" ]
permissive
sosy-lab/java-smt
c08ba90d46639801dcb17e28ae55686ff2f0b7a6
d32310b5b21753786f8e3dca1d2709679f337986
refs/heads/master
2023-09-04T15:07:37.738429
2023-08-28T18:12:13
2023-08-28T18:12:13
46,414,758
158
50
Apache-2.0
2023-08-24T04:16:52
2015-11-18T11:36:07
Java
UTF-8
Java
false
false
5,998
java
// This file is part of JavaSMT, // an API wrapper for a collection of SMT solvers: // https://github.com/sosy-lab/java-smt // // SPDX-FileCopyrightText: 2020 Dirk Beyer <https://www.sosy-lab.org> // // SPDX-License-Identifier: Apache-2.0 package org.sosy_lab.java_smt.solvers.cvc5; import static io.github.cvc5.Kind.ADD; import static io.github.cvc5.Kind.DIVISION; import static io.github.cvc5.Kind.INTS_DIVISION; import static io.github.cvc5.Kind.INTS_MODULUS; import static io.github.cvc5.Kind.MULT; import static io.github.cvc5.Kind.SUB; import com.google.common.collect.ImmutableSet; import io.github.cvc5.CVC5ApiException; import io.github.cvc5.Kind; import io.github.cvc5.Solver; import io.github.cvc5.Sort; import io.github.cvc5.Term; import java.math.BigInteger; import java.util.List; import java.util.regex.Pattern; import org.sosy_lab.java_smt.api.NumeralFormula; import org.sosy_lab.java_smt.basicimpl.AbstractNumeralFormulaManager; @SuppressWarnings("ClassTypeParameterName") abstract class CVC5NumeralFormulaManager< ParamFormulaType extends NumeralFormula, ResultFormulaType extends NumeralFormula> extends AbstractNumeralFormulaManager< Term, Sort, Solver, ParamFormulaType, ResultFormulaType, Term> { /** * CVC4 fails hard when creating Integers/Rationals instead of throwing an exception for invalid * number format. Thus lets check the format. */ public static final Pattern INTEGER_NUMBER = Pattern.compile("(-)?(\\d)+"); public static final Pattern RATIONAL_NUMBER = Pattern.compile("(-)?(\\d)+(.)?(\\d)*"); /** * Operators for arithmetic functions that return a numeric value. Remove if not needed after * tests! */ @SuppressWarnings("unused") private static final ImmutableSet<Kind> NUMERIC_FUNCTIONS = ImmutableSet.of(ADD, SUB, MULT, DIVISION, INTS_DIVISION, INTS_MODULUS); protected final Solver solver; CVC5NumeralFormulaManager(CVC5FormulaCreator pCreator, NonLinearArithmetic pNonLinearArithmetic) { super(pCreator, pNonLinearArithmetic); solver = pCreator.getEnv(); } protected abstract Sort getNumeralType(); @Override protected boolean isNumeral(Term pVal) { // There seems to be no way of checking if a Term is const in CVC5 return pVal.isIntegerValue() || pVal.isRealValue(); } /** * Check whether the current term is numeric and the value of a term is determined by only * numerals, i.e. no variable is contained. This method should check as precisely as possible the * situations in which CVC5 supports arithmetic operations like multiplications. * * <p>Example: TRUE for "1", "2+3", "ite(x,2,3) and FALSE for "x", "x+2", "ite(1=2,x,0)" */ /* Enable if needed! boolean consistsOfNumerals(Term val) { Set<Term> finished = new HashSet<>(); Deque<Term> waitlist = new ArrayDeque<>(); waitlist.add(val); while (!waitlist.isEmpty()) { Term e = waitlist.pop(); if (!finished.add(e)) { continue; } if (isNumeral(e)) { // true, skip and check others } else if (NUMERIC_FUNCTIONS.contains(e.getKind())) { Iterables.addAll(waitlist, e); } else if (ITE.equals(e.getKind())) { // ignore condition, just use the if- and then-case waitlist.add(e.getChild(1)); waitlist.add(e.getChild(2)); } else { return false; } } return true; } */ @Override protected Term makeNumberImpl(long i) { // we connot use "new Rational(long)", because it uses "unsigned long". return makeNumberImpl(Long.toString(i)); } @Override protected Term makeNumberImpl(BigInteger pI) { return makeNumberImpl(pI.toString()); } @Override protected Term makeNumberImpl(String pI) { if (!RATIONAL_NUMBER.matcher(pI).matches()) { throw new NumberFormatException("number is not an rational value: " + pI); } try { return solver.mkReal(pI); } catch (CVC5ApiException e) { throw new IllegalArgumentException( "You tried creating a invalid rational number with input Sring: " + pI + ".", e); } } @Override protected Term makeVariableImpl(String varName) { Sort type = getNumeralType(); return getFormulaCreator().makeVariable(type, varName); } @Override protected Term multiply(Term pParam1, Term pParam2) { return solver.mkTerm(Kind.MULT, pParam1, pParam2); /* * In CVC4 we had to check if the terms consist of only numerals, if this * fails we have to do it again! if (consistsOfNumerals(pParam1) || consistsOfNumerals(pParam2)) { return solver.mkTerm(Kind.MULT, pParam1, pParam2); } else { return super.multiply(pParam1, pParam2); } */ } @Override protected Term modulo(Term pParam1, Term pParam2) { return solver.mkTerm(Kind.INTS_MODULUS, pParam1, pParam2); } @Override protected Term negate(Term pParam1) { return solver.mkTerm(Kind.NEG, pParam1); } @Override protected Term add(Term pParam1, Term pParam2) { return solver.mkTerm(Kind.ADD, pParam1, pParam2); } @Override protected Term subtract(Term pParam1, Term pParam2) { return solver.mkTerm(Kind.SUB, pParam1, pParam2); } @Override protected Term equal(Term pParam1, Term pParam2) { return solver.mkTerm(Kind.EQUAL, pParam1, pParam2); } @Override protected Term greaterThan(Term pParam1, Term pParam2) { return solver.mkTerm(Kind.GT, pParam1, pParam2); } @Override protected Term greaterOrEquals(Term pParam1, Term pParam2) { return solver.mkTerm(Kind.GEQ, pParam1, pParam2); } @Override protected Term lessThan(Term pParam1, Term pParam2) { return solver.mkTerm(Kind.LT, pParam1, pParam2); } @Override protected Term lessOrEquals(Term pParam1, Term pParam2) { return solver.mkTerm(Kind.LEQ, pParam1, pParam2); } @Override protected Term distinctImpl(List<Term> pParam) { return solver.mkTerm(Kind.DISTINCT, pParam.toArray(new Term[0])); } }
[ "baier-daniel@gmx.net" ]
baier-daniel@gmx.net
6617761f195d6ae9aaae1262cfe87aafc32063a8
2a1f46619a0d1acba5da9e60d13c1e189df1680c
/src/Behavioral/Mediator/MediatorPatternDemo.java
a36ad0b7bfb110683d3cdc088c19f84285da8b12
[]
no_license
DengHuiJun/DesignPattren
046067c6f2904d1e41d4dd7637bd67e976159ba0
d7c2c10010ccb12c0a11386e97b9015cdc622813
refs/heads/master
2016-09-06T17:23:01.859580
2015-09-14T07:54:45
2015-09-14T07:54:45
41,772,126
0
0
null
null
null
null
UTF-8
Java
false
false
322
java
package Behavioral.Mediator; /** * Created by zero on 15-9-10. */ public class MediatorPatternDemo { public static void main(String[] args) { User robert = new User("Robert"); User john = new User("John"); robert.sendMessage("Hi! John!"); john.sendMessage("Hello! Robert!"); }}
[ "783352994@qq.com" ]
783352994@qq.com
90d33f194194ef8e0177cb9f69ce2e568b7542d5
59aac42e38ddb4e936023f0c366d299910da6390
/src/main/java/com/geekluxun/apache/commons/collections/FactoryUtilsDemo.java
72040981c3231016198e40559973f2e747f435bc
[]
no_license
geekluxun/crazy-java
96301d43ce4677bcdab10a0c87c911691464167e
23852d025bf7d535ac14e95c8a86c2912ddb01a6
refs/heads/master
2023-03-06T17:44:53.483320
2022-05-24T08:41:29
2022-05-24T08:41:29
138,288,079
1
0
null
2023-02-22T07:14:15
2018-06-22T10:10:36
Java
UTF-8
Java
false
false
934
java
package com.geekluxun.apache.commons.collections; import org.apache.commons.collections4.Factory; import org.apache.commons.collections4.FactoryUtils; import java.math.BigDecimal; /** * Copyright,2018-2019,geekluxun Co.,Ltd. * * @Author: luxun * @Create: 2018-07-13 13:55 * @Description: * @Other: */ public class FactoryUtilsDemo { public static void main(String[] argc) { FactoryUtilsDemo demo = new FactoryUtilsDemo(); demo.demo1(); demo.demo2(); } private void demo1() { Factory<BigDecimal> factory = FactoryUtils.constantFactory(new BigDecimal("10.0")); BigDecimal value = factory.create(); value = factory.create(); value = value.add(new BigDecimal("2.0")); System.out.println(); } private void demo2() { Factory<BigDecimal> value = FactoryUtils.prototypeFactory(new BigDecimal("20")); System.out.println(); } }
[ "geekluxun@163.com" ]
geekluxun@163.com
d576b9b4a472ea624bb2d5a5dde56dd6186fe962
1c1ba340fb4b7ee76e56c405a1a85136392dc88a
/src/main/java/com/bbc/news/felix/controller/RecipeControllerInterface.java
67a1180670a02db5e8d4ef34e05d2c7c70483111
[]
no_license
felixcs1/recipe-book
17f17c078d8f516f0f7067439581ddab48d74e96
96024acdac548e284bf8e01f76b445f906ba85bc
refs/heads/master
2020-04-27T00:15:09.495214
2019-03-21T08:45:29
2019-03-21T08:45:29
173,928,530
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
package com.bbc.news.felix.controller; import com.bbc.news.felix.model.Recipe; import java.util.ArrayList; public interface RecipeControllerInterface { public ArrayList<Recipe> getAllRecipes(); public Recipe getRecipeById(int id); public Recipe addRecipe(Recipe recipe); public Recipe updateRecipe(int id, Recipe recipe); public boolean deleteRecipe(int id); }
[ "Felix.Stephenson@bbc.co.uk" ]
Felix.Stephenson@bbc.co.uk
d8f9cc1ec4875227ff61a87c450037bf36548792
857e4a79b67cbd7314c6d710e45323930b0c8061
/src/com/lw/adapter/NovelListAdpater.java
1694e47a44373b1cb394fd4875334c94382a682a
[]
no_license
liu149339750/NovelReader
6460d58aea37eaed5be38e3f82979dfe8a9dfc41
f6dc7d051f218d90ec293320890c46bf2606462d
refs/heads/master
2021-01-19T19:22:46.582037
2018-05-14T13:19:26
2018-05-14T13:19:26
88,413,841
0
0
null
null
null
null
UTF-8
Java
false
false
2,672
java
package com.lw.adapter; import java.util.ArrayList; import java.util.List; import com.lw.bean.Novel; import com.lw.bean.Novels; import com.lw.novelreader.NovelItem; import com.lw.novelreader.R; import com.lw.novelreader.R.layout; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; public class NovelListAdpater extends BaseAdapter { // private List<Novel> result; private List<Novels> mNovels; private LayoutInflater mInflater; private int mLayout; // public NovelListAdpater(Context context,List<Novel> result) { // this.result = result; // mInflater = LayoutInflater.from(context); // mLayout = R.layout.search_item; // } // // public NovelListAdpater(Context context,List<Novel> result,int layout) { // this.result = result; // mInflater = LayoutInflater.from(context); // mLayout = layout; // } public NovelListAdpater(Context context,Novels result) { this.mNovels = new ArrayList<Novels>(); mNovels.add(result); mInflater = LayoutInflater.from(context); mLayout = R.layout.search_item; } public NovelListAdpater(Context context,Novels result,int layout) { this.mNovels = new ArrayList<Novels>(); mNovels.add(result); mInflater = LayoutInflater.from(context); mLayout = layout; } public NovelListAdpater(Context context,List<Novels> result) { this.mNovels = result; mInflater = LayoutInflater.from(context); mLayout = R.layout.search_item; } public NovelListAdpater(Context context,List<Novels> result,int layout) { this.mNovels = result; mInflater = LayoutInflater.from(context); mLayout = layout; } @Override public int getCount() { int c = 0; if(mNovels != null) { for(Novels n : mNovels) { c += n.getNovels().size(); } } return c; } @Override public Novel getItem(int arg0) { int c = 0; Novel novel = null; if(mNovels != null) { for(Novels n : mNovels) { int size = n.getNovels().size(); if(arg0 < c + size) { novel = n.getNovels().get(arg0 - c); break; } c = c + size; } } return novel; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { NovelItem item = null; if(convertView == null) { convertView = mInflater.inflate(mLayout, null); item = new NovelItem(convertView); convertView.setTag(item); } else { item = (NovelItem) convertView.getTag(); } item.bind(getItem(position)); return convertView; } }
[ "hnyjliuwei@163.com" ]
hnyjliuwei@163.com
7c50009e38455e0302f43894146c8f00e02f19b7
3d92200a990b5346f30e754a13f02a41b2e372c5
/HeightBalancedBT.java
f60fb6d1c3a8ca53ae5f792856e7ec367b7fe783
[]
no_license
anushree1808/LeetCode-Solutions
0b089241eb628054cc7143d7ab12589581ea9b53
4c29c6df6721f5be2822e0023f6c8235190d3ccd
refs/heads/master
2021-01-01T04:38:17.411270
2018-04-25T01:54:01
2018-04-25T01:54:01
97,216,304
0
0
null
null
null
null
UTF-8
Java
false
false
511
java
package LeetCode; public class HeightBalancedBT { public boolean isBalanced(TreeNode root) { if(root==null) return true; int lh = height(root.left); int rh = height(root.right); return Math.abs(lh-rh)<2 && isBalanced(root.left) && isBalanced(root.right); } public int height(TreeNode root) { if (root==null) { return 0; } return Math.max(height(root.left), height(root.right))+1; } }
[ "noreply@github.com" ]
noreply@github.com
0668f6eaee6ca56f427bef5c50bdce638b6037ce
55e664f3bf26eb4c87dd6aa82f6efc1155081aa3
/src/main/java/com/ys/rent/service/impl/RoleServiceImpl.java
53a8fc07914af9e1795963ed6fddf9f0a6ae52e9
[]
no_license
scoundrel93/Rent
c3d51194dd4969331c28b747f39081b611847819
894237067349c569bb67e4e199da1c5a888379a2
refs/heads/master
2021-01-01T15:13:02.175625
2017-07-18T11:21:33
2017-07-18T11:21:33
97,589,185
0
0
null
null
null
null
UTF-8
Java
false
false
1,758
java
package com.ys.rent.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ys.rent.dao.RoleDao; import com.ys.rent.po.Role; import com.ys.rent.service.RoleService; import com.ys.rent.utils.PagerUtils; /** * 角色的业务层实现类 * @author 云尚公寓 * */ @Service public class RoleServiceImpl implements RoleService{ @Autowired private RoleDao roleDao; /** * 角色列表 */ @Override public PagerUtils<Role> getRoleList(String roleName, int pageIndex) { PagerUtils<Role> pr = new PagerUtils<Role>(); int dataCount = roleDao.getRoleCount(roleName); pr.setPageIndex(pageIndex); pr.setPageSize(10); pr.setDataCount(dataCount); pr.setPageCount(dataCount%10 == 0 ? dataCount/10 : dataCount/10 + 1); pr.setDataList(roleDao.getRoleList(roleName, 10 , 10 * (pageIndex - 1))); return pr; } /** * 得到角色信息,用于管理员列表的角色查询 */ @Override public List<Role> getList() { return roleDao.getList(); } /** * 添加角色 */ @Override public void addRole(Role role) { roleDao.addRole(role); } /** * 根据id查询角色 */ @Override public Role findRoleById(String id) { return roleDao.findRoleById(id); } /** * 修改角色 */ @Override public void editRole(Role role) { roleDao.editRole(role); } /** * 删除角色 */ @Override public void deleteRole(Role role) { roleDao.deleteRole(role); } /** * 批量删除角色 */ @SuppressWarnings("rawtypes") @Override public void deleteRoles(List roleList) { roleDao.deleteRoles(roleList); } @Override public Role getroleName(String id) { return roleDao.getroleName(id); } }
[ "scoundrel93@yeah.net" ]
scoundrel93@yeah.net
126c6f84bb2655b17ebd799b602f4da72d1ac0ea
377405a1eafa3aa5252c48527158a69ee177752f
/src/twitter4j/Trends.java
3177ad0b854644dd7f3593a2f5e1782f3ad1fb53
[]
no_license
apptology/AltFuelFinder
39c15448857b6472ee72c607649ae4de949beb0a
5851be78af47d1d6fcf07f9a4ad7f9a5c4675197
refs/heads/master
2016-08-12T04:00:46.440301
2015-10-25T18:25:16
2015-10-25T18:25:16
44,921,258
0
1
null
null
null
null
UTF-8
Java
false
false
586
java
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package twitter4j; import java.io.Serializable; import java.util.Date; // Referenced classes of package twitter4j: // TwitterResponse, Location, Trend public interface Trends extends TwitterResponse, Comparable, Serializable { public abstract Date getAsOf(); public abstract Location getLocation(); public abstract Date getTrendAt(); public abstract Trend[] getTrends(); }
[ "rich.foreman@apptology.com" ]
rich.foreman@apptology.com
a6ab690b0f5be2a696ba5987c69e595d598f8ae7
8d8fd9193370093da5dc130e3e7d2cf5a0ad708e
/src/main/java/kitchenpos/ordertable/domain/OrderTable.java
eea4d490aa7aeb0aa58635dbf0c8b23ccee1c56a
[]
no_license
slamdunk7575/jwp-refactoring-toy
dcc22e5b1d93981517c7cb95eb6b363696fdcece
382221f20e5441939b05c957fa1ba417cf8c1164
refs/heads/master
2023-08-31T16:56:55.155930
2021-10-23T12:35:46
2021-10-23T12:35:46
388,087,401
0
0
null
null
null
null
UTF-8
Java
false
false
2,186
java
package kitchenpos.ordertable.domain; import kitchenpos.order.domain.NumberOfGuests; import javax.persistence.*; import java.util.Objects; @Entity public class OrderTable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "table_group_id") private Long tableGroupId; @Embedded private NumberOfGuests numberOfGuests; @Column(name = "empty") private boolean empty; protected OrderTable() { } public OrderTable(Long id, int numberOfGuests, boolean empty) { this(id, null, numberOfGuests, empty); } public OrderTable(Long id, Long tableGroupId, int numberOfGuests, boolean empty) { this.id = id; this.tableGroupId = tableGroupId; this.numberOfGuests = new NumberOfGuests(numberOfGuests); this.empty = empty; } public boolean isEmpty() { return empty; } public void updateTableGroup(Long tableGroupId) { this.tableGroupId = tableGroupId; this.empty = false; } public void unGroup() { this.tableGroupId = null; } public void updateEmpty(boolean empty) { validateOrderTableGroup(); this.empty = empty; } public void validateOrderTableGroup() { if (Objects.nonNull(tableGroupId)) { throw new IllegalArgumentException("그룹 지정이 되어있어 상태를 변경할 수 없습니다."); } } public boolean hasTableGroup() { return Objects.nonNull(tableGroupId); } public void updateNumberOfGuests(int numberOfGuests) { checkOrderTableNotEmpty(); this.numberOfGuests.update(numberOfGuests); } private void checkOrderTableNotEmpty() { if (empty) { throw new IllegalArgumentException("빈 주문 테이블의 손님 수는 변경할 수 없습니다."); } } public Long getId() { return id; } public Long getTableGroupId() { if (Objects.nonNull(tableGroupId)){ return tableGroupId; } return null; } public int getNumberOfGuests() { return numberOfGuests.value(); } }
[ "slamdunk7575@gmail.com" ]
slamdunk7575@gmail.com