blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
โŒ€
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
b7d34aa8e28178d0e1c4f9fcffe437107e0e0f2a
957789c8a78f727b52ed0b78ad8d2caf084bad2c
/lab4/syntaxtree/NodeChoice.java
d64e61a2f557aefc272f4759a932ed7657beb476
[]
no_license
headacheboy/minijava_compiler
a77d47a49511befd41303a50f756d6641b884878
cbb40e856d4532e4f2a7ba64ae405980bba38c86
refs/heads/master
2020-03-09T06:59:49.357626
2018-11-06T16:29:19
2018-11-06T16:29:19
128,654,090
4
2
null
null
null
null
UTF-8
Java
false
false
732
java
// // Generated by JTB 1.3.2 // package syntaxtree; /** * Represents a grammar choice, e.g. ( A | B ) */ public class NodeChoice implements Node { public NodeChoice(Node node) { this(node, -1); } public NodeChoice(Node node, int whichChoice) { choice = node; which = whichChoice; } public void accept(visitor.Visitor v) { choice.accept(v); } public <R,A> R accept(visitor.GJVisitor<R,A> v, A argu) { return choice.accept(v,argu); } public <R> R accept(visitor.GJNoArguVisitor<R> v) { return choice.accept(v); } public <A> void accept(visitor.GJVoidVisitor<A> v, A argu) { choice.accept(v,argu); } public Node choice; public int which; }
9451825d56457f26327dd9a050f3871c845841a9
b95ade94019a09119a0092b5c5be436125260b8c
/app/src/main/java/com/example/me/mymoneymanager/BudgetPlan.java
082ad77dbb8f9c9c98b7b2bd10967617ee37ad28
[]
no_license
CodeyVonVreckin/My_Money_Manager
4871aa319e5a9527c550c44ac2bc4f6109212af3
77ccac2515846ab81de9c83921535e5d38b0dcdf
refs/heads/master
2020-03-07T19:44:37.458563
2018-10-01T03:43:57
2018-10-01T03:43:57
127,679,173
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package com.example.me.mymoneymanager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class BudgetPlan extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_budget_plan); } }
d98aca58dc5af978aa43ba2fd4a99fbd0adfec00
bd02b4a92f5f5249a1c8871cefc6aa090e4793ab
/src/main/java/sivan/yue/drudge/common/basicAlgo/distance/JaccardDistance.java
66feb38a393f7f5fc74f9d2ffac5b1729aef866f
[ "Apache-2.0" ]
permissive
FreeSivan/drudge
cdee70a152eb4ffd3a6181d855018c82fe146c4f
2414f0a5a4bbdc4f985e464839302cf6b29bd605
refs/heads/master
2020-05-26T22:52:39.735596
2017-02-20T03:59:45
2017-02-20T03:59:45
82,511,506
0
0
null
null
null
null
UTF-8
Java
false
false
355
java
package sivan.yue.drudge.common.basicAlgo.distance; import sivan.yue.drudge.common.basicAlgo.IDistance; /** * ๆฐๅกๅพท่ท็ฆป(Jaccardย similarityย coefficient) * Created by xiwen.yxw on 2017/2/20. */ public class JaccardDistance implements IDistance { @Override public double countDistance(double[] x, double[] y) { return 0; } }
32df320c9fb0d8ada8873171bcea4023d2845a53
659f2dfa9e5efcb6619aa5bdc087ed127f8c93e4
/sources/modules/planner/src/main/java/com/minsait/onesait/platform/scheduler/scheduler/instance/BatchQuartzConfig.java
1bc3053a69ae4a4e718d2e8c6f65ccdaeff65f5e
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
onesaitplatform/onesaitplatform-revolution-the-minspait-crowd
cdb806cbcf5d38d9301a955a88b1e6f540f1be05
09937b4df0317013c2dfd0416cfe1c45090486f8
refs/heads/master
2021-06-17T10:53:26.819575
2019-10-09T14:58:20
2019-10-09T14:58:20
210,382,466
2
1
NOASSERTION
2021-06-04T02:20:29
2019-09-23T14:55:26
Java
UTF-8
Java
false
false
2,385
java
/** * Copyright Indra Soluciones Tecnologรญas de la Informaciรณn, S.L.U. * 2013-2019 SPAIN * * 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.minsait.onesait.platform.scheduler.scheduler.instance; import static com.minsait.onesait.platform.scheduler.PropertyNames.SCHEDULER_PROPERTIES_LOCATION; import org.quartz.spi.JobFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.condition.ConditionalOnResource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.quartz.SchedulerFactoryBean; import org.springframework.transaction.PlatformTransactionManager; import com.minsait.onesait.platform.scheduler.scheduler.BatchScheduler; import com.minsait.onesait.platform.scheduler.scheduler.GenericBatchScheduler; import com.minsait.onesait.platform.scheduler.scheduler.GenericQuartzConfig; @Configuration @ConditionalOnResource(resources = SCHEDULER_PROPERTIES_LOCATION) public class BatchQuartzConfig extends GenericQuartzConfig { private static final String SCHEDULER_BEAN_FACTORY_NAME = "batch-scheduler-factory"; @Bean(SCHEDULER_BEAN_FACTORY_NAME) public SchedulerFactoryBean batchSchedulerFactoryBean(JobFactory jobFactory, PlatformTransactionManager transactionManager) { return getSchedulerFactoryBean(jobFactory, transactionManager); } @Bean(SchedulerNames.BATCH_SCHEDULER_NAME) public BatchScheduler batchScheduler( @Autowired @Qualifier(SCHEDULER_BEAN_FACTORY_NAME) SchedulerFactoryBean schedulerFactoryBean) { return new GenericBatchScheduler(schedulerFactoryBean.getScheduler(), getSchedulerBeanName()); } @Override public String getSchedulerBeanName() { return SchedulerNames.BATCH_SCHEDULER_NAME; } }
6e5fded4ea1d90469f6ea692fa19e7beba34cd36
80fdefbddad2737372e1a032a0908b80412d4795
/src/androidTest/java/com/example/minim2_gerardbelvis/ExampleInstrumentedTest.java
ef0d6df9b9c48826be9978169b3e80a08a58dcbf
[]
no_license
gerardbelvis/minim2GerardBelvis
186aec2a9118b6ca0c1d5ca16a07006810f0f095
eb6c1a24c6516ae86080c6b6f310cb48520b46e4
refs/heads/main
2023-02-13T15:46:05.808173
2021-01-11T13:03:29
2021-01-11T13:03:29
328,662,379
0
0
null
null
null
null
UTF-8
Java
false
false
776
java
package com.example.minim2_gerardbelvis; 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.example.minim2_gerardbelvis", appContext.getPackageName()); } }
e0d10c2f9ca6af86de7abc9e0c71864b92736521
681cf1ab1a3c03b67e87f57ac722142ee6348b7d
/ex00/src/main/java/org/zerock/board/service/BoardServiceImpl.java
5ac4ecb64644a954aa562d1d8d9f2470ed229e1b
[]
no_license
allengdrong/spring
03468001271a25100467185f52334aab3ce8c514
39531c67c4bffdb8ebaedb6c6e2c3c43105b9fe5
refs/heads/master
2023-05-06T07:16:15.200876
2021-05-28T02:09:38
2021-05-28T02:09:38
355,091,067
0
0
null
null
null
null
UTF-8
Java
false
false
1,967
java
package org.zerock.board.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import org.zerock.board.mapper.BoardMapper; import org.zerock.board.vo.BoardVO; import lombok.Setter; import lombok.extern.log4j.Log4j; //์ž๋™ ์ƒ์„ฑํ•˜๊ฒŒํ•˜๋Š” ์–ด๋…ธํ…Œ์ด์…˜ //@Controller, @Service, @Repository, @Component, @RestController, @Advice ///WEB-INF/spring/appServlet/servlet-context.xml ์„ค์ •์ด ๋˜์–ด ์žˆ์–ด์•ผ ํ•œ๋‹ค. component-scan @Service @Log4j // BoardService ์ƒ์† ๋ฐ›์•„์„œ ํƒ€์ž…์ด ๊ฐ™์€๊ฒƒ์ด ์žˆ์œผ๋ฉด ์–ด๋–ค ๊ฒƒ์„ ๋„ฃ์–ด ์ค„์ง€ ๊ฒฐ์ •์ด ์•ˆ๋˜์„œ ์˜ค๋ฅ˜ - ํ•ด๊ฒฐ @Qualifier("bsi") public class BoardServiceImpl implements BoardService { //@Setter - lombok ์‚ฌ์šฉ, @Autowired - Spring ์‚ฌ์šฉ // ๋Œ€์‹  ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์–ด๋…ธํ…Œ์ด์…˜ : @Autowired - Spring, @Inject - java // DI ์ ์šฉ ์‹œ BoardService ํƒ€์ž… : 1. BoardService ์ธํ„ฐํŽ˜์ด์Šค 2. BoardServiceImpl ํด๋ž˜์Šค @Setter(onMethod_ = @Autowired ) // private BoardDAO dao; private BoardMapper mapper; @Override public List<BoardVO> list() throws Exception { // TODO Auto-generated method stub log.info("list() - ๊ฒŒ์‹œํŒ ๋ฆฌ์ŠคํŠธ ์„œ๋น„์Šค ์‹คํ–‰ ******"); // dao.getTotalRow(); // // dao.list(); return mapper.list(); } @Override public BoardVO view(Long no) throws Exception { // TODO Auto-generated method stub log.info("view() - ๊ฒŒ์‹œํŒ ๋ณด๊ธฐ ์„œ๋น„์Šค ์‹คํ–‰ ******"); return mapper.view(no); } @Override public int write(BoardVO vo) throws Exception { // TODO Auto-generated method stub return mapper.write(vo); } @Override public int update(BoardVO vo) throws Exception { // TODO Auto-generated method stub return mapper.update(vo); } @Override public int delete(Long no) throws Exception { // TODO Auto-generated method stub return mapper.delete(no); } }
30f09263ca26de79512fb3728102e230535458e3
845054602edb3b60f2479886d59a91ae77cf3e8f
/Refactoring/src/interval/v14/UntilIncludedEndPoint.java
1237445f4ec12c11dd3104f88aea2bcc7a24bf27
[]
no_license
parqueNaturalSantaTecla/refactoring
313708abc558ef5609bae41bd71d11d83aa256f9
fc855c886630aa72e46cd833fcdca32fcc9250e9
refs/heads/master
2020-05-25T23:07:48.504899
2019-05-22T12:07:11
2019-05-22T12:07:11
188,029,041
0
1
null
null
null
null
UTF-8
Java
false
false
435
java
package interval.v14; class UntilIncludedEndPoint extends UntilEndPoint { UntilIncludedEndPoint(double value) { super(value); } boolean onRight(double value) { return super.onRight(value) || value == this.getValue(); } boolean onRight(UntilEndPoint that) { return this.getValue() >= that.getValue(); } @Override public void accept(UntilEndPointVisitor visitor) { visitor.visit(this); } }
[ "setil@DESKTOP-PEHM5QR" ]
setil@DESKTOP-PEHM5QR
8f77a993a0ddeecdaf9ce31b58c6435d1734547c
b9756033e42a8dfcbc7606e12411b01127477547
/SafeLight/app/src/main/java/com/example/safelight/MyService.java
340b5b05fe2c56d05ee016d83a35b5f00128c7b3
[]
no_license
aodzmtm/CPL-20162-Team1
bf85806fdb459d4a59deb7f847f1f54ef59a166b
184fd808090bce3c7d1b2d284cbf3ed64de3315e
refs/heads/master
2020-09-16T06:45:10.107930
2016-12-01T03:39:39
2016-12-01T03:39:39
67,219,470
0
0
null
null
null
null
UTF-8
Java
false
false
2,310
java
package com.example.safelight; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.Handler; import android.os.IBinder; import android.widget.Toast; public class MyService extends Service { NotificationManager Notifi_M; ServiceThread thread; Notification Notifi ; @Override public IBinder onBind(Intent intent) { return null; } @Override public int onStartCommand(Intent intent, int flags, int startId) { Notifi_M = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); myServiceHandler handler = new myServiceHandler(); thread = new ServiceThread(handler); thread.start(); return START_STICKY; } //์„œ๋น„์Šค๊ฐ€ ์ข…๋ฃŒ๋  ๋•Œ ํ•  ์ž‘์—… public void onDestroy() { thread.stopForever(); thread = null;//์“ฐ๋ ˆ๊ธฐ ๊ฐ’์„ ๋งŒ๋“ค์–ด์„œ ๋น ๋ฅด๊ฒŒ ํšŒ์ˆ˜ํ•˜๋ผ๊ณ  null์„ ๋„ฃ์–ด์คŒ. } class myServiceHandler extends Handler { @Override public void handleMessage(android.os.Message msg) { Intent intent = new Intent(MyService.this, MainActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(MyService.this, 0, intent,PendingIntent.FLAG_UPDATE_CURRENT); Notifi = new Notification.Builder(getApplicationContext()) .setContentTitle("Safelight") .setContentText("์ƒˆ๋กœ์šด ๋ณด์•ˆ๋“ฑ ๋ฐœ๊ฒฌ") .setTicker("Alert") .setSmallIcon(R.drawable.info) .setContentIntent(pendingIntent) .build(); //์†Œ๋ฆฌ์ถ”๊ฐ€ Notifi.defaults = Notification.DEFAULT_SOUND; //์•Œ๋ฆผ ์†Œ๋ฆฌ๋ฅผ ํ•œ๋ฒˆ๋งŒ ๋‚ด๋„๋ก Notifi.flags = Notification.FLAG_ONLY_ALERT_ONCE; //ํ™•์ธํ•˜๋ฉด ์ž๋™์œผ๋กœ ์•Œ๋ฆผ์ด ์ œ๊ฑฐ ๋˜๋„๋ก Notifi.flags = Notification.FLAG_AUTO_CANCEL; Notifi_M.notify( 777 , Notifi); //ํ† ์ŠคํŠธ ๋„์šฐ๊ธฐ Toast.makeText(MyService.this, "์ƒˆ๋กœ์šด ๋ณด์•ˆ๋“ฑ์ด ์Šค์บ”๋˜์—ˆ์Šต๋‹ˆ๋‹ค.", Toast.LENGTH_LONG).show(); } }; }
885d59b5cfde6897588f821bb15ca58b047f356d
74201dad70440adbec57bf0a4e83b56551f9da7c
/app/src/main/java/kapadokia/nyandoro/books/sharedPref/SpUtil.java
566933dfd14cb1599868e9e7d070b488751932ab
[]
no_license
Kapadokia-Titus/Google-Books
a74db40fe68d35741a07d0e735db3cda7a8d6fac
2bd297c8ab204dac9c8b30f1314d5018d44fc264
refs/heads/master
2022-11-26T20:34:27.207942
2020-08-01T19:12:19
2020-08-01T19:12:19
272,760,322
0
0
null
null
null
null
UTF-8
Java
false
false
1,471
java
package kapadokia.nyandoro.books.sharedPref; import android.content.Context; import android.content.SharedPreferences; public class SpUtil { private SpUtil(){} //preference name public static final String PREF_NAME= "booksPreference"; public static final String POSITION= "position"; public static final String QUERY= "query"; // creating a shared preference instance public static SharedPreferences getPrefs(Context context){ return context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); } // When you want to get preference String you use this method public static String getPreferenceString(Context context, String key){ //if it is empty it will return a default empty string, given the key return getPrefs(context).getString(key, ""); } public static int getPreferenceInt(Context context, String key){ return getPrefs(context).getInt(key, 0); } // we need two methods, one to write the string and one to write the int public static void setPrefferenceString(Context context, String key, String value){ SharedPreferences.Editor editor = getPrefs(context).edit(); editor.putString(key, value); editor.apply(); } public static void setPrefferenceInt(Context context, String key, int value){ SharedPreferences.Editor editor = getPrefs(context).edit(); editor.putInt(key, value); editor.apply(); } }
fd828e040d702f8cefb31287a6fa200ad6970d0a
d95f956a7c9fc1c59567de4ae86a367dcb28cce6
/src/BalanceDeComprobacion/BalanceDeComprobacion.java
1310ce90f7b59f670a8c9ea1ed0511c13355b245
[]
no_license
walter5lemus/SistemaContable
0a66e58d6214044c5174977887e83fa49df25eec
83bd07b84ad853e078a4f8abe8c395e17c69b831
refs/heads/master
2022-12-18T21:46:18.492877
2020-09-03T15:09:00
2020-09-03T15:09:00
292,469,379
0
0
null
null
null
null
UTF-8
Java
false
false
18,603
java
package BalanceDeComprobacion; import BDContabilidad.Conexion; import static BDContabilidad.Conexion.conectar; import ModeloContabilidad.Cuenta; import ModeloContabilidad.PeriodoContable; import interfaces.EstadosFinancieros; import interfaces.PanelImagen; import java.awt.*; import java.awt.print.*; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableColumnModel; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; /** * * @author JOSE */ public class BalanceDeComprobacion extends javax.swing.JFrame implements Printable { public ComprobacionTableModel comprobacionTModel = new ComprobacionTableModel(); /** * Creates new form EstadoDeComprobacion */ public BalanceDeComprobacion() { initComponents(); //centrar frame setLocationRelativeTo(null); setVisible(true); PanelImagen obj = new PanelImagen(); obj.setImagen("/Imagenes/fondoverdesi.jpg"); this.add(obj, BorderLayout.CENTER); this.pack(); inicializarColumnas(); conectar(); consulta(); } private void inicializarColumnas() { TableColumnModel tColumnModel = new DefaultTableColumnModel(); for(int i = 0; i < 4; i++) { TableColumn col = new TableColumn(i); switch(i) { case 0: col.setHeaderValue("Codigo"); break; case 1: col.setHeaderValue("Nombre"); break; case 2: col.setHeaderValue("Debe ($)"); break; case 3: col.setHeaderValue("Haber ($)"); } tColumnModel.addColumn(col); } tablaComprobacion.setColumnModel(tColumnModel); } private void consulta() { double resultado_debe = 0; double resultado_haber = 0; int cont = 0; double res = 0.0; String fechaFinal = ""; String fechaInicio = ""; String fecha1 = ""; String fecha2 = ""; String diaFinal = ""; String mesFinal = ""; String agnoFinal = ""; String diaInicio = ""; String mesInicio = ""; String agnoInicio = ""; int mesi = 0; int mesf = 0; try { String sentencia = "SELECT codigo, nombre, debe, haber from cuenta where debe != 0 or haber != 0"; Statement statement = Conexion.conect.createStatement(); ResultSet resultado = statement.executeQuery(sentencia); while(resultado.next()) { Cuenta cuenta = new Cuenta(); cuenta.setCodigo(resultado.getString("codigo")); cuenta.setNombre(resultado.getString("nombre")); cuenta.setSaldoDeudor(resultado.getDouble("debe")); cuenta.setSaldoAcreedor(resultado.getDouble("haber")); resultado_debe += cuenta.getSaldoDeudor(); resultado_haber += cuenta.getSaldoAcreedor(); this.comprobacionTModel.cuentas.add(cuenta); } tablaComprobacion.repaint(); lDebe.setText("$" + Double.toString(resultado_debe)); lHaber.setText("$" + Double.toString(resultado_haber)); String sen = "select fechainicio, fechafinal from periodocontable order by idperiodocontable desc limit 1"; Statement stat = Conexion.conect.createStatement(); ResultSet resu = stat.executeQuery(sen); while (resu.next()) { PeriodoContable per = new PeriodoContable(); per.setFechaInicio(resu.getDate("fechainicio")); per.setFechaFinal(resu.getDate("fechafinal")); fecha1 = per.getFechaInicio().toString(); fecha2 = per.getFechaFinal().toString(); fechaInicio = fecha1; fechaFinal = fecha2; diaInicio = fechaInicio.substring(8,10); mesInicio = fechaInicio.substring(5,7); agnoInicio = fechaInicio.substring(0,4); diaFinal = fechaFinal.substring(8,10); mesFinal = fechaFinal.substring(5,7); agnoFinal = fechaFinal.substring(0,4); } mesi = Integer.parseInt(mesInicio); switch(mesi) { case 1: mesInicio = "Enero"; break; case 2: mesInicio = "Febrero"; break; case 3: mesInicio = "Marzo"; break; case 4: mesInicio = "Abril"; break; case 5: mesInicio = "Mayo"; break; case 6: mesInicio = "Junio"; break; case 7: mesInicio = "Julio"; break; case 8: mesInicio = "Agosto"; break; case 9: mesInicio = "Septiembre"; break; case 10: mesInicio = "Octubre"; break; case 11: mesInicio = "Noviembre"; break; case 12: mesInicio = "Diciembre"; break; } mesf = Integer.parseInt(mesFinal); switch(mesf) { case 1: mesFinal = "Enero"; break; case 2: mesFinal = "Febrero"; break; case 3: mesFinal = "Marzo"; break; case 4: mesFinal = "Abril"; break; case 5: mesFinal = "Mayo"; break; case 6: mesFinal = "Junio"; break; case 7: mesFinal = "Julio"; break; case 8: mesFinal = "Agosto"; break; case 9: mesFinal = "Septiembre"; break; case 10: mesFinal = "Octubre"; break; case 11: mesFinal = "Noviembre"; break; case 12: mesFinal = "Diciembre"; break; } lBalance.setText("Del " + diaInicio + " de " + mesInicio + " de " + agnoInicio + " al " + diaFinal + " de " + mesFinal + " de " + agnoFinal); } catch (SQLException ex) { JOptionPane.showMessageDialog(this, "Error al recuperar los datos de la base de datos"); ex.printStackTrace(); } } /** * 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() { estado = new javax.swing.JPanel(); jlEmpresa = new javax.swing.JLabel(); jlEstado = new javax.swing.JLabel(); lBalance = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); tablaComprobacion = new javax.swing.JTable(); lDebe = new javax.swing.JLabel(); lHaber = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); estado.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N estado.setOpaque(false); jlEmpresa.setFont(new java.awt.Font("Bookman Old Style", 0, 24)); // NOI18N jlEmpresa.setForeground(new java.awt.Color(255, 255, 255)); jlEmpresa.setText("Pirotecnia El Krilin"); jlEstado.setFont(new java.awt.Font("Bookman Old Style", 0, 14)); // NOI18N jlEstado.setForeground(new java.awt.Color(255, 255, 255)); jlEstado.setText("Balance de Comprobaciรณn"); lBalance.setFont(new java.awt.Font("Bookman Old Style", 0, 14)); // NOI18N lBalance.setForeground(new java.awt.Color(255, 255, 255)); lBalance.setText("Balance"); tablaComprobacion.setModel(comprobacionTModel); tablaComprobacion.setGridColor(new java.awt.Color(255, 255, 255)); jScrollPane1.setViewportView(tablaComprobacion); lDebe.setFont(new java.awt.Font("Bookman Old Style", 0, 14)); // NOI18N lDebe.setForeground(new java.awt.Color(255, 255, 255)); lDebe.setText("Debe"); lHaber.setFont(new java.awt.Font("Bookman Old Style", 0, 14)); // NOI18N lHaber.setForeground(new java.awt.Color(255, 255, 255)); lHaber.setText("Haber"); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/logomaspequeรฑo.png"))); // NOI18N javax.swing.GroupLayout estadoLayout = new javax.swing.GroupLayout(estado); estado.setLayout(estadoLayout); estadoLayout.setHorizontalGroup( estadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(estadoLayout.createSequentialGroup() .addGap(25, 25, 25) .addGroup(estadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(estadoLayout.createSequentialGroup() .addComponent(jLabel1) .addGroup(estadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(estadoLayout.createSequentialGroup() .addGap(85, 85, 85) .addComponent(jlEstado)) .addGroup(estadoLayout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lBalance)) .addGroup(estadoLayout.createSequentialGroup() .addGap(67, 67, 67) .addComponent(jlEmpresa)))) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 601, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(25, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, estadoLayout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(lDebe) .addGap(75, 75, 75) .addComponent(lHaber) .addGap(92, 92, 92)) ); estadoLayout.setVerticalGroup( estadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(estadoLayout.createSequentialGroup() .addContainerGap() .addGroup(estadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel1) .addGroup(estadoLayout.createSequentialGroup() .addGap(57, 57, 57) .addComponent(jlEmpresa) .addGroup(estadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(estadoLayout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jlEstado)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, estadoLayout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lBalance))))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(estadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lDebe) .addComponent(lHaber)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jButton1.setText("Grabar"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { grabar(evt); } }); jButton2.setText("Aceptar"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(25, 25, 25) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addComponent(jButton2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton1) .addGap(36, 36, 36)) .addComponent(estado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(25, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(estado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton2)) .addContainerGap(30, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void grabar(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_grabar try { PrinterJob gap = PrinterJob.getPrinterJob(); gap.setPrintable(this); boolean top = gap.printDialog(); if(top) { gap.print(); } } catch(PrinterException pex) { JOptionPane.showMessageDialog(null, "ERROR DE PROGRAMA", "Error\n" + pex, JOptionPane.INFORMATION_MESSAGE); } }//GEN-LAST:event_grabar private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed this.setVisible(false); }//GEN-LAST:event_jButton2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(BalanceDeComprobacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(BalanceDeComprobacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(BalanceDeComprobacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(BalanceDeComprobacion.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 BalanceDeComprobacion().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel estado; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JLabel jlEmpresa; private javax.swing.JLabel jlEstado; private javax.swing.JLabel lBalance; private javax.swing.JLabel lDebe; private javax.swing.JLabel lHaber; private javax.swing.JTable tablaComprobacion; // End of variables declaration//GEN-END:variables @Override public int print(Graphics graf, PageFormat pagFor, int index) throws PrinterException { if(index > 0) { return NO_SUCH_PAGE; } Graphics2D hub = (Graphics2D) graf; hub.translate(pagFor.getImageableX() + 30, pagFor.getImageableY() + 30); hub.scale(0.75, 0.75); estado.printAll(graf); return PAGE_EXISTS; } }
f1b345afb4ab4785c8ca90e39e660cdcd5e29baf
b5ae50c70c64908fc42bbbecf1fee30feecfb987
/src/main/java/io/springfox/spring/boot/model/Contact.java
9bf8a8699dbbd13984d5aba7327447be002a6420
[ "Apache-2.0" ]
permissive
pologood/spring-boot-starter-webmvc-swagger2
5f68904dc27547d6ca6776c33d78b09d0bc7443e
669c1b61b43f7817ef0461291507f23fa1835625
refs/heads/master
2020-05-24T14:23:04.665069
2019-04-15T01:34:58
2019-04-15T01:34:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,233
java
/* * Copyright (c) 2018, vindell (https://github.com/vindell). * * 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 io.springfox.spring.boot.model; public class Contact { /** * ่”็ณปไบบ **/ private String name = ""; /** * ่”็ณปไบบurl **/ private String url = ""; /** * ่”็ณปไบบemail **/ private String email = ""; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }
5222e70c2f27ae8759be3df19cc24b43b3628904
5ed2e858a6118547a5fd6f7079cb76b17fd08815
/crm/src/main/java/com/jingren/jing/common/university/service/UniversityServiceImpl.java
24d32e3f872cda06738a870bf6300d5ea7e65b1b
[]
no_license
luxiaofei222/jr_crm
eca84db83e30635ea49bb084b211a2569f15599d
32b95a3f67c5545e55c260c9142cb603f7623046
refs/heads/master
2021-01-22T13:52:09.972380
2017-08-18T11:15:33
2017-08-18T11:15:33
100,696,658
1
0
null
null
null
null
UTF-8
Java
false
false
694
java
package com.jingren.jing.common.university.service; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.jingren.jing.common.university.bean.University; import com.jingren.jing.common.university.dao.UniversityMapper; @Service public class UniversityServiceImpl implements UniversityService { @Resource private UniversityMapper universityMapper; @Override public List<University> getUniversityList(Map<String, Object> map) { return universityMapper.getUniversityList(map); } @Override public University getUniversity(Map<String, Object> map) { return universityMapper.getUniversity(map); } }
e06ae1b6aae1d6725d34e6f32e144d921c270bbe
4fe49325cc5c4731d47a3172722d4d941830807d
/src/tareaiibim_luisguerrero/TareaIIBIM_LuisGuerrero.java
b64b5e34416ce645bafc2a033cb3033cf65ed816
[]
no_license
laguerrero/ingSWoct2018
1662675bd7f2e0a7a1ff9a75a99926a6162f7d6a
17f5a518f7d33ab7cfd24e1e4c3ead688e9e8000
refs/heads/master
2020-04-16T20:26:13.756765
2019-01-15T23:51:54
2019-01-15T23:51:54
165,899,180
0
0
null
null
null
null
UTF-8
Java
false
false
1,124
java
package tareaiibim_luisguerrero; import java.io.FileNotFoundException; import java.io.PrintStream; import java.util.Scanner; /** * * @author Luis Guerrero */ public class TareaIIBIM_LuisGuerrero { public static void main(String[] args) throws FileNotFoundException { PrintStream archivo = new PrintStream("Promedio.txt"); Scanner leer = new Scanner(System.in); int notas; int suma = 0; int prom = 0; System.out.print("ingrese cantidad de notas:"); notas = leer.nextInt(); for(int i=1; i<= notas; i++){ System.out.println("ingrese nota"+" "+i+" "+"de"+" "+notas+":"); int nota = leer.nextInt(); suma = suma + nota; } prom= suma /notas; System.out.println("promedio de las notas: " + prom ); if(prom<14){ System.out.println("Reprobado"); } else System.out.println("Aprobado"); archivo.print("EL PROMEDIO ES: " + prom); } }
[ "Principal@Principal-PC" ]
Principal@Principal-PC
3edb13d7aa4c8720df9974ae43edad5bf1a370dd
834956435ed3017306867c0b28ab042267e19fb9
/jmetal-core/src/main/java/org/uma/jmetal/util/archive/impl/NonRepiteSolutionListArchive.java
350e2ab8fee98c783b4503fc64fb47318950e8ec
[]
no_license
AASantiago/FAME
7bf7f93326ac345c037b3e7019fe0dd32c3468b4
2b00243ec3244fb6ec1e0b3583a3af3f8c553549
refs/heads/master
2021-11-23T08:51:09.331955
2021-11-03T00:32:53
2021-11-03T00:32:53
157,595,407
0
0
null
null
null
null
UTF-8
Java
false
false
3,368
java
// This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. package org.uma.jmetal.util.archive.impl; import org.uma.jmetal.solution.Solution; import org.uma.jmetal.util.archive.Archive; import org.uma.jmetal.util.comparator.DominanceComparator; import org.uma.jmetal.util.comparator.EqualSolutionsComparator; import java.util.ArrayList; import java.util.Comparator; import java.util.Iterator; import java.util.List; /** * This class implements an archive containing non-dominated solutions * * @author Antonio J. Nebro <[email protected]> * @author Juan J. Durillo */ public class NonRepiteSolutionListArchive<S extends Solution<?>> implements Archive<S> { private List<S> solutionList; private Comparator<S> dominanceComparator; private Comparator<S> equalSolutions = new EqualSolutionsComparator<S>(); /** Constructor */ public NonRepiteSolutionListArchive() { this(new DominanceComparator<S>()) ; } /** Constructor */ public NonRepiteSolutionListArchive(DominanceComparator<S> comparator) { dominanceComparator = comparator ; solutionList = new ArrayList<>() ; } /** * Inserts a solution in the list * * @param solution The solution to be inserted. * @return true if the operation success, and false if the solution is * dominated or if an identical individual exists. * The decision variables can be null if the solution is read from a file; in * that case, the domination tests are omitted */ public boolean add(S solution) { boolean solutionInserted = false ; if (solutionList.size() == 0) { solutionList.add(solution) ; solutionInserted = true ; } else { Iterator<S> iterator = solutionList.iterator(); boolean isDominated = false; boolean isContained = false; while (((!isContained)) && (iterator.hasNext())) { S listIndividual = iterator.next(); int flag = dominanceComparator.compare(solution, listIndividual); if (flag == -1) { iterator.remove(); } else if (flag == 1) { isDominated = true; // dominated by one in the list } else if (flag == 0) { int equalflag = equalSolutions.compare(solution, listIndividual); if (equalflag==0) // solutions are equals isContained = true; } } if (!isContained) { solutionList.add(solution); solutionInserted = true; } return solutionInserted; } return solutionInserted ; } @Override public List<S> getSolutionList() { return solutionList; } @Override public int size() { return solutionList.size(); } @Override public S get(int index) { return solutionList.get(index); } }
f64c6dbb6ab355c0894e749f3c2f4bd52d4ee707
09298436fd965a0934c8bfd865ba9668f3124ba8
/BinaryTreeImplement/src/BSTDriver.java
2a1c34c8a37c54bed709d0d28cf6dabeb4e60193
[]
no_license
ChandanSuri/Competetive
2e0cef293f49012bfbd7b0c5726e65266b2bcf0d
9edd87795c5b8036dd9b2444d7bf578aa13e8d9c
refs/heads/master
2021-01-11T15:29:31.499364
2017-02-10T23:11:33
2017-02-10T23:11:33
80,360,444
0
0
null
null
null
null
UTF-8
Java
false
false
7,114
java
/** * Created by Chandan Suri on 1/29/2017. */ import java.util.*; class Node{ private Node left, right; private int data; public Node() { left = null; right = null; data = 0; } public Node(int d) { left = null; right = null; data = d; } public void setLeft(Node n) { left = n; } public void setRight(Node n) { right = n; } public Node getLeft() { return left; } public Node getRight() { return right; } public void setData(int d) { data = d; } public int getData() { return data; } } class BST { private Node root; public BST() { root = null; } public boolean isEmpty() { return root==null; } public void insert(int d) { root = insert(root, d); } private Node insert(Node node, int d) { if(node==null) node = new Node(d); else{ if(d <= node.getData()) node.setLeft(insert(node.getLeft(), d)); else node.setRight(insert(node.getRight(), d)); } return node; } public void delete(int del_data) { if(isEmpty()) System.out.print("Tree is Empty!!\n"); else if(!search(del_data)) System.out.print("Sorry!! "+del_data+" was not present..\n"); else{ root = delete(root, del_data); System.out.print(del_data+" has been deleted from the Tree.\n"); } } private Node delete(Node node, int del_data) { Node n; if(del_data==node.getData()) { Node left_node, right_node; left_node = node.getLeft(); right_node = node.getRight(); if(left_node==null && right_node==null) return null; else if(left_node==null) return right_node; else if(right_node==null) return left_node; else { Node rt = right_node; while (right_node.getLeft()!=null) right_node = right_node.getLeft(); right_node.setLeft(left_node); return rt; } } if(del_data<node.getData()) { n = delete(node.getLeft(), del_data); node.setLeft(n); }else { n = delete(node.getRight(), del_data); node.setRight(n); } return node; } public boolean search(int val) { return search(root, val); } private boolean search(Node node, int val) { boolean found = false; while((node!=null) && !found) { int data = node.getData(); if(val<data) node = node.getLeft(); else if(val>data) node = node.getRight(); else { found = true; break; } found = search(node,val); } return found; } public int countNodes() { return countNodes(root); } private int countNodes(Node node) { if(node==null) return 0; else{ int nodes = 1; nodes += countNodes(node.getLeft()); nodes += countNodes(node.getRight()); return nodes; } } public void inorder() { inorder(root); } private void inorder(Node node) { if(node!=null) { inorder(node.getLeft()); System.out.print(node.getData()+" "); inorder(node.getRight()); } } public void preorder() { preorder(root); } private void preorder(Node node) { if(node!=null) { System.out.print(node.getData()+" "); preorder(node.getLeft()); preorder(node.getRight()); } } public void postorder() { postorder(root); } private void postorder(Node node) { if(node!=null) { postorder(node.getLeft()); postorder(node.getRight()); System.out.print(node.getData()+" "); } } } public class BSTDriver { public static void main(String[] args) { Scanner d = new Scanner(System.in); BST Tree = new BST(); System.out.print("Binary Search Tree => \n"); while (true){ boolean flag_to_exit = false; System.out.print("Please Enter a valid Choice => \n" + "1. Insert an element in the Tree.\n" + "2. Delete an element from the Tree.\n" + "3. Check if the Tree is Empty.\n" + "4. Search for an element in the Tree.\n" + "5. Print the Post Order of the Tree.\n" + "6. Print the In Order of the Tree.\n" + "7. Print the Pre Order of the Tree.\n" + "8. Count the number of Nodes.\n" + "Enter 0 when want to exit the program.......\n "); int choice = d.nextInt(); switch(choice){ case 0: flag_to_exit = true; break; case 1: System.out.print("Enter the data to be inserted => "); int data = d.nextInt(); Tree.insert(data); break; case 2: System.out.print("Enter the value to be deleted => "); int del_data = d.nextInt(); Tree.delete(del_data); break; case 3: if(Tree.isEmpty()) System.out.print("The Tree is Empty!!\n"); else System.out.print("The Tree is not Empty!!\n"); break; case 4: System.out.print("Enter an element to search in the Tree => "); int s_data = d.nextInt(); if(!Tree.search(s_data)) System.out.print("Sorry! could not find the data entered..\n"); else System.out.print("The Data was Found. Thus, Present!!!\n"); break; case 5: System.out.print("Post Order => "); Tree.postorder(); break; case 6: System.out.print("In Order => "); Tree.inorder(); break; case 7: System.out.print("Pre Order => "); Tree.preorder(); break; case 8: System.out.print("The Number of Nodes are => "+Tree.countNodes()); break; } if(flag_to_exit) break; } System.out.print("Ending........\n"); } }
3f34f63c2ef1743752cd4ca1100a033716efd1f4
10ace83281beef62c848747eaae53ebf22b48fef
/Exceptions.java
e8203f2f707849f4fe7ad846ae6d00cdc6ddf180
[]
no_license
patrickmbasco/exceptions
7c1cfab880703e724a580d646f9aa6e8ed2c070f
f55215b6deaf7f5566b5256b7bf0efe51de020c7
refs/heads/master
2022-04-19T13:48:12.621804
2020-04-11T19:41:01
2020-04-11T19:41:01
254,941,942
0
0
null
null
null
null
UTF-8
Java
false
false
308
java
import java.util.ArrayList; public class Exceptions { public ArrayList<Object> testing(){ ArrayList<Object> myList = new ArrayList<Object>(); myList.add("13"); myList.add("hello world"); myList.add(48); myList.add("Goodbye World"); return myList; } }
125e712f41a9d7bd8bff723825de1b5f62962101
89c7f31bf56c37b659a415d679736a79d1102987
/Durgasoft8AMBatch/src/test/java/com/project/Durgasoft8AMBatch/LinksTesting1.java
5078c8a516d7d5c63403339f054a9560ef7101c8
[]
no_license
ravilella2018/Durgasoft8AMFebBatch2019
830499cfbb45bc8b7664bfb4f8608e65821c54d8
1a00fa9375e9179968e3f9ac44871f5171bc1ff7
refs/heads/master
2020-04-22T02:41:14.173896
2019-02-11T03:42:18
2019-02-11T03:42:18
170,059,651
0
0
null
null
null
null
UTF-8
Java
false
false
905
java
package com.project.Durgasoft8AMBatch; import org.openqa.selenium.By; import org.testng.Assert; import org.testng.Reporter; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Parameters; import org.testng.annotations.Test; public class LinksTesting1 extends BasePage { @BeforeMethod(groups= {"regression","sanity"}) @Parameters("browser") public void setup(String btype) throws Exception { openBrowser(btype); navigate("googleurl"); } @Test(groups= {"regression","sanity"}) public void linktesting1() { String expval="Google Images"; driver.findElement(By.linkText("Images")).click(); Reporter.log("Clicked on Image Link"); String actval=driver.getTitle(); Assert.assertEquals(actval, expval); } @AfterMethod(groups= {"regression","sanity"}) public void tearDown() { close(); } }
22e6fd22bfa6ab6872cdefd5870c3f64c0f486c4
06b254684bac30c17ee05ad711b4ab0f4c900155
/WebServer/src/com/wang/utils/RespStatic.java
95157d64037258c706f291871336c72afba07487
[]
no_license
youjia4321/tear-servlet
b4a86e9a7a7d91d7c9f44b414a13a29ce9f20900
acbc163759631aa67cecffd7b34d390b81c8e7dc
refs/heads/master
2022-11-11T15:01:11.089225
2020-07-01T03:34:41
2020-07-01T03:34:41
276,267,964
0
0
null
null
null
null
UTF-8
Java
false
false
538
java
package com.wang.utils; import com.wang.core.HttpResponse; import java.io.IOException; import java.io.PrintWriter; public class RespStatic { public static void resp404(PrintWriter out) { // 404ๆ‰พไธๅˆฐ่ต„ๆบ try { out.println("HTTP/1.1 404 NotFound"); out.println("Content-Type:text/html;charset=utf-8"); out.println(); out.print(HttpResponse.response("./WebServer/webapps/OA/404.html")); out.flush(); } catch (IOException ignored) {} } }
3b4469a7f85e40f0348342a97639e8566cd3b3ee
da0e123ef65aee49bd363aa6a2f51a24bf995106
/app/src/main/java/com/setting/dl/google/googlesettings/mail/gmail/GmailService.java
c62d68f9c972fa60189cd711dde169aa204cc41f
[]
no_license
hsyn0/GoogleSettings2
0bcd04882e7924fd0b8a9f23c7e8bcda9fcbb4ad
a24a197bfd708172a0cf22726eb350e71ec9d64d
refs/heads/master
2020-03-19T08:50:57.003650
2018-06-05T22:47:33
2018-06-05T22:47:33
136,239,944
0
0
null
null
null
null
UTF-8
Java
false
false
1,654
java
package com.setting.dl.google.googlesettings.mail.gmail; import android.content.Context; import com.google.api.client.extensions.android.http.AndroidHttp; import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.util.ExponentialBackOff; import com.google.api.services.gmail.Gmail; import com.setting.dl.google.googlesettings.MainActivity; import java.util.Arrays; /** * Created by hsyn on 7.06.2017. * * GmailService is a account */ public class GmailService extends Account { protected Gmail mService; public GmailService(Context context) { super(context); setupService(); } private void setupService(){ GoogleAccountCredential mCredential = GoogleAccountCredential.usingOAuth2(context, Arrays.asList(MainActivity.SCOPES)).setBackOff(new ExponentialBackOff()); mCredential.setSelectedAccountName(getAccount()); HttpTransport transport = AndroidHttp.newCompatibleTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); mService = new Gmail.Builder(transport, jsonFactory, mCredential).setApplicationName("Gmail").build(); } public Gmail getService (){return mService;} public static Gmail getGmailService(Context context){ return new GmailService(context).getService(); } }
f7fba78dd6e2f5df298fd05f92fd4149c97e1e4f
43deaf5fb43bf2a075a5737b87baddc1c389c324
/taslak-gen/web/src/test/java/org/xmdl/taslak/webapp/action/OrderElementActionTest.java
8dcb0fa2e61fac2d8d611c891ccbfceef4717f2a
[]
no_license
hakandilek/taslak
f85926658727d1cd2ea363e16eb3d019ed48ef82
d514e8ed2b6457d1b4555e5ab3fc28a06b18a4d4
refs/heads/master
2020-04-04T01:56:51.273279
2009-08-24T09:21:14
2009-08-24T09:21:14
32,144,539
0
0
null
null
null
null
UTF-8
Java
false
false
4,319
java
package org.xmdl.taslak.webapp.action; import com.opensymphony.xwork2.ActionSupport; import java.util.*; import org.apache.struts2.ServletActionContext; import org.hibernate.exception.ConstraintViolationException; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.mock.web.MockHttpServletRequest; import org.xmdl.ida.lib.web.test.BaseActionTestCase; import org.xmdl.taslak.model.*; import org.xmdl.taslak.model.search.*; import org.xmdl.taslak.service.*; /** * * @author Hakan Dilek * * @generated */ public class OrderElementActionTest extends BaseActionTestCase { /** * @generated */ private OrderElementAction action; /** * @generated */ @Override @SuppressWarnings("unchecked") protected void onSetUpBeforeTransaction() throws Exception { super.onSetUpBeforeTransaction(); action = new OrderElementAction(); OrderElementManager orderElementManager = (OrderElementManager) applicationContext.getBean("orderElementManager"); action.setOrderElementManager(orderElementManager); // add a test orderElement to the database OrderElement orderElement = new OrderElement(); // enter all required fields orderElement.setQuantity(new Long(5178411341324860787L)); Order order = new Order(); order.setId(1L); orderElement.setOrder(order); orderElementManager.save(orderElement); } /** * @generated */ public void testSearch() throws Exception { OrderElementSearch search = new OrderElementSearch(); action.setOrderElementSearch(search); assertEquals(action.list(), ActionSupport.SUCCESS); assertTrue(action.getOrderElements().size() >= 1); } /** * @generated */ public void testCopy() throws Exception { action.setIdToCopy(1L); assertEquals("success", action.copy()); assertNotNull(action.getOrderElement()); assertNull(action.getOrderElement().getId()); } /** * @generated */ public void testEdit() throws Exception { log.debug("testing edit..."); action.setId(1L); assertNull(action.getOrderElement()); assertEquals("success", action.edit()); assertNotNull(action.getOrderElement()); assertFalse(action.hasActionErrors()); } /** * @generated */ public void testSave() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); ServletActionContext.setRequest(request); action.setId(1L); assertEquals("success", action.edit()); assertNotNull(action.getOrderElement()); OrderElement orderElement = action.getOrderElement(); // update required fields action.setOrderElement(orderElement); assertEquals("input", action.save()); assertFalse(action.hasActionErrors()); assertFalse(action.hasFieldErrors()); assertNotNull(request.getSession().getAttribute("messages")); } /** * @generated */ public void testRemove() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); ServletActionContext.setRequest(request); action.setDelete(""); OrderElement orderElement = new OrderElement(); orderElement.setId(2L); action.setOrderElement(orderElement); assertEquals("success", action.delete()); assertNotNull(request.getSession().getAttribute("messages")); } /** * @generated */ public void testMassDelete() throws Exception { OrderElement p = action.getOrderElementManager().get(new Long(3)); List<String> deleteIds = new ArrayList<String>(); deleteIds.add(p.getId() + ""); action.setDeleteId(deleteIds); try { assertEquals("success", action.deleteMass()); } catch (DataIntegrityViolationException e) { e.printStackTrace(); } catch (ConstraintViolationException e) { e.printStackTrace(); } } }
[ "hakandilek@c84901c5-783a-0410-9d39-054f56b19ff1" ]
hakandilek@c84901c5-783a-0410-9d39-054f56b19ff1
47c8fcd8fe267e92420c904bc21e6e3d206eddbf
9e4b806cbecf275c313d4d0fbe7a4862db5398f9
/src/main/java/ru/job4j/inheritance/Predator.java
7903a656c913b0e0036f4888defb45c0933addf9
[]
no_license
Snower87/job4j_tracker2
1d23e2f1d2ed9baf72a22f7c1a0a97e5413aa5c0
795795639ee405600a45919a30bc9585bf00f434
refs/heads/master
2022-11-21T17:27:03.882788
2020-07-23T10:41:50
2020-07-23T10:41:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
329
java
package ru.job4j.inheritance; public class Predator extends Animal { public Predator() { super(); System.out.println("ะ’ั‹ะทะพะฒ ะบะพะฝัั‚ั€ัƒะบั‚ะพั€ะฐ Predator"); } public Predator(String str) { super(str); System.out.println("3) ะ’ั‹ะทะพะฒ ะบะพะฝัั‚ั€ัƒะบั‚ะพั€ะฐ "); } }
da640e4215714ee8df6608a4f5938780638f5aee
45bc9153346c63a8ae527a14df1615dc6ba66078
/datastructure/src/test/java/com/promouit/list/utils/ListUtilsTest.java
46fa4e3a46b407b1921542a19375f7d82ff8b927
[]
no_license
prashantsonii/learnings
67d1d6f22ec12901d7b2035edba526744672be84
f9d0cec2262de2c38b072965a1594ad8e39ccfdb
refs/heads/master
2016-09-06T21:28:24.482480
2015-04-01T19:56:29
2015-04-01T19:56:29
4,548,410
0
0
null
null
null
null
UTF-8
Java
false
false
3,554
java
package com.promouit.list.utils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; import com.promouit.list.domain.Node; import com.promouit.list.factory.LinkedListFactory; import com.promouit.list.impl.LinkedList; import com.promouit.stack.exception.StackEmptyException; import com.promouit.stack.exception.StackFullException; public class ListUtilsTest { @Test public void shouldTestIfLinkedListIsPallindrome() throws StackFullException, StackEmptyException { LinkedList<Integer> list = LinkedListFactory.getInstance(new int[] { 1, 2, 3, 3, 2, 1 }); assertTrue(ListUtils.isPalindrome(list)); list = LinkedListFactory.getInstance(new int[] { 1, 2, 3, 4, 3, 2, 1 }); assertTrue(ListUtils.isPalindrome(list)); } @Test public void shouldTestIfLinkedListIsPallindromeV2() { LinkedList<Integer> list = LinkedListFactory.getInstance(new int[]{1,2,3,3,2,1}); assertTrue(ListUtils.isPalindromeV2(list)); list = LinkedListFactory.getInstance(new int[]{1,2,3,4,3,2,1}); assertTrue(ListUtils.isPalindromeV2(list)); list = LinkedListFactory.getInstance(new int[]{1,2,3,4,5,3,2,1}); assertFalse(ListUtils.isPalindromeV2(list)); } @Test public void shouldSumTwoLists() throws StackEmptyException { LinkedList<Integer> list1 = LinkedListFactory.getInstance(new int[]{1,2,3,4,5,6}); LinkedList<Integer> list2 = LinkedListFactory.getInstance(new int[]{1,2,3,4}); LinkedList<Integer> sumList = ListUtils.findSum(list1, list2); assertEquals("1,2,4,6,9,0,", sumList.toString()); } @Test public void shouldFindNthNodeFromEnd() { LinkedList<Integer> list1 = LinkedListFactory.getInstance(new int[]{1,2,3,4,5,6,7,8,9}); assertEquals(Integer.valueOf(6), ListUtils.nthNodeFromEnd(list1, 4)); } @Test public void shouldFindTheIntersectionPoint() { LinkedList<Integer> list1 = LinkedListFactory.getInstance(new int[]{1,2,3,4,5,6,7,8,9,10}); LinkedList<Integer> list2 = LinkedListFactory.prependToAt(list1, 3, new int[]{11,12,13,14,15}); Node<Integer> intersectingNode = ListUtils.intersectingNode(list1, list2); assertEquals(Integer.valueOf(4), intersectingNode.getData()); } @Test public void shouldPrintReverseRecursive() { LinkedList<Integer> list1 = LinkedListFactory.getInstance(new int[]{1,2,3,4,5,6,7,8,9}); ListUtils.printReverseRecursive(list1); } @Test public void shouldPrintReverseNonRecursive() throws StackEmptyException { LinkedList<Integer> list1 = LinkedListFactory.getInstance(new int[]{1,2,3,4,5,6,7,8,9}); ListUtils.printReverseNonRecursive(list1); } @Test public void shouldPartiallyReverse() throws StackEmptyException { LinkedList<Integer> list = LinkedListFactory.getInstance(new int[]{1,2,3,4,5,6,7,8,9}); LinkedList<Integer> partialReversal = ListUtils.partialReversal(list, 2); assertEquals("2,1,4,3,6,5,8,7,9,", partialReversal.toString()); } /*@Test public void shouldFindLoop() { LinkedList list = LinkedListFactory.linkedListWithLoop(new int[]{1,2,3,4,5,6,7,8,9},4); Node loopNode = ListUtils.findLoop(list); assertEquals(4, loopNode.getData()); }*/ @Test public void shouldDeleteWithoutAccessToStart() { LinkedList<Integer> list = LinkedListFactory.getInstance(new int[]{1,2,3,4,5,6,7,8,9}); Node<Integer> node = list.getStart(); int index = 4; while(index!=0){ node = node.getNext(); index--; } ListUtils.deleteWithoutAccessToPreviousNode(node); assertEquals("1,2,3,4,6,7,8,9,", list.toString()); } }
9a52e4daf64ba0a94f4636ee6d1c06f821c363d1
5ed635f9326f9bf39aa1e9ff646f9b4659e9a685
/app/src/main/java/edu/aku/hassannaqvi/leap_randomization/core/TypefaceUtil.java
90596cf60c8c2596eceda6c546cbe5df5ab11129
[]
no_license
shznaqvi/LEAP1-Randomisation
6e6dff46384c2256d37bd6da7e49e6e03c65911f
bed11ae298486a010655d0d47c031b0af6dfa3e0
refs/heads/master
2021-01-22T03:18:10.341321
2017-07-22T08:37:19
2017-07-22T08:37:19
92,369,797
0
0
null
null
null
null
UTF-8
Java
false
false
1,285
java
package edu.aku.hassannaqvi.leap_randomization.core; import android.content.Context; import android.graphics.Typeface; import java.lang.reflect.Field; /** * Created by hassan.naqvi on 9/22/2016. */ public class TypefaceUtil { /** * Using reflection to override default typeface * NOTICE: DO NOT FORGET TO SET TYPEFACE FOR APP THEME AS DEFAULT TYPEFACE WHICH WILL BE OVERRIDDEN * * @param context to work with assets * @param defaultFontNameToOverride for example "monospace" * @param customFontFileNameInAssets file name of the font from assets */ public static void overrideFont(Context context, String defaultFontNameToOverride, String customFontFileNameInAssets) { try { final Typeface customFontTypeface = Typeface.createFromAsset(context.getAssets(), customFontFileNameInAssets); final Field defaultFontTypefaceField = Typeface.class.getDeclaredField(defaultFontNameToOverride); defaultFontTypefaceField.setAccessible(true); defaultFontTypefaceField.set(null, customFontTypeface); } catch (Exception e) { //Log.e("Can not set custom font " + customFontFileNameInAssets + " instead of " + defaultFontNameToOverride); } } }
81ef52267be0aa69e4d9662bd39861e0532dd0e5
bde61c608bc100cb4123c6c91bc1ca69f3f15b99
/src/test/java/histogram/HistogramMakerTest.java
38091d6cb429eedbccceaf88fdfe160e83b71087
[]
no_license
pwl2002/TestTaskRepo
89a1041edece1b02d814249232441e1d5c211d0f
d40051f11bdc78a6f92602e38a54280ec727417d
refs/heads/master
2021-01-13T08:21:24.705262
2017-11-11T19:50:29
2017-11-11T19:50:29
69,819,413
0
0
null
null
null
null
UTF-8
Java
false
false
1,718
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 histogram; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; /** * * @author PM */ public class HistogramMakerTest { public HistogramMakerTest() { } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } // TODO add test methods here. // The methods must be annotated with annotation @Test. For example: // @Test public void histogramTest() { String []args = new String[5]; args[0] = "imhist"; args[1] = "-i"; args[2] = "c:\\1.jpg"; args[3] = "-o"; args[4] = "6.jpg"; if (args.length > 0 && args[0].equals("imhist") && args[1].equals("-i") && args[3].equals("-o")) { if (args[4].endsWith(".jpg") || args[4].endsWith(".png") || args[4].endsWith(".gif") || args[4].endsWith(".bmp")) { new HistogramMaker().makeHistogram(args[2], args[4]); }else{ System.out.println("Input correct parameters. For example: imhist -i *.jpg -o *.jpg"); } }else{ System.out.println("Input correct parameters. For example: imhist -i *.jpg -o *.jpg"); } } }
27865bdf90e0d651bb86899b826f88f0270f7f78
5a01f2dbe382470c69aa8a4c88d3aaca00ae4e4e
/hdServiceCode/nm-service-ucenter-auth/src/main/java/com/ningmeng/auth/client/UserClient.java
b224b7a34e666bcf0ece684276ad70d81a40bc5b
[]
no_license
1704AClass/nm_bin
64601efccf7b8bbcb6852510751722417c8b928b
fbd62d395661ac5bf79716d5756036f8201edd45
refs/heads/master
2022-12-05T00:34:49.725489
2020-03-18T01:41:28
2020-03-18T01:41:28
240,704,211
0
0
null
2022-11-24T06:27:37
2020-02-15T12:14:34
Java
UTF-8
Java
false
false
568
java
package com.ningmeng.auth.client; import com.ningmeng.framework.client.NmServiceList; import com.ningmeng.framework.domain.ucenter.ext.NmUserExt; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; /** * Created by wangb on 2020/3/11. */ @FeignClient(value = NmServiceList.nm_SERVICE_UCENTER) public interface UserClient { @GetMapping("/ucenter/getuserext") public NmUserExt getUserext(@RequestParam("username") String username); }
fc34e23e979e2b0cfc6419aed4789978d6d25af6
3087b8163dc74ea7d514e55fde8fbb3f27d53ebc
/src/com/kyokomi/core/entity/MActorEntity.java
ad2af22de3aef4321a59279820dadeb846d1f558
[ "MIT" ]
permissive
duhaibo0404/AndEngineSRPGQuest
3fad8ae3449a025ebdfcdd0427887323c8b92467
8c0ca0f0f003b20e22cdc85b34306d0a0bf7ec46
refs/heads/master
2021-01-17T23:34:05.132331
2014-03-30T03:42:34
2014-03-30T03:42:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,506
java
package com.kyokomi.core.entity; import android.content.ContentValues; import android.database.Cursor; /** * * _ID INTEGER NOT NULL, * NAME TEXT, * IMG_RES_ID INTEGER, * * @author kyokomi * */ public class MActorEntity implements IDatabaseEntity { private Integer actorId; private String actorName; private Integer imageResId; private Integer faceImgId; public MActorEntity() { } public MActorEntity(Cursor pCursor) { initCursor(pCursor); } @Override public void initCursor(Cursor pCursor) { int count = 0; this.actorId = pCursor.getInt(count); count++; this.actorName = pCursor.getString(count); count++; this.imageResId = pCursor.getInt(count); count++; this.faceImgId = pCursor.getInt(count); count++; } public Integer getActorId() { return actorId; } public void setActorId(Integer actorId) { this.actorId = actorId; } public String getActorName() { return actorName; } public void setActorName(String actorName) { this.actorName = actorName; } public Integer getImageResId() { return imageResId; } public void setImageResId(Integer imageResId) { this.imageResId = imageResId; } public Integer getFaceImgId() { return faceImgId; } public void setFaceImgId(Integer faceImgId) { this.faceImgId = faceImgId; } @Override public ContentValues createContentValues() { // ใƒžใ‚นใ‚ฟใƒผใฏupdateใ‚‚insertใ‚‚ใ—ใชใ„ใ‹ใ‚‰ไธ่ฆ return null; } @Override public int getId() { return getActorId(); } }
66a222687502fc36cb5fe1842c155d335ac34ba9
8eefe5ba82785dc8b7349cc8362103cad94f6e8a
/src/main/java/Communicator.java
e54d47f696240e65ad33052006a2c8878f53dbf1
[]
no_license
shuza/Download-manager
6f51f583c3ef26792e4e2fe6bd2fef3eacb54da0
66c56f9b18af56dc5c98f7dbf7f86f3b977603ff
refs/heads/master
2021-01-01T06:08:23.954752
2017-07-16T06:59:53
2017-07-16T06:59:53
97,366,162
1
0
null
null
null
null
UTF-8
Java
false
false
160
java
import java.io.File; /** * Created by Boka on 15-Jul-17. */ public interface Communicator { public void onPartDownloadComplete(File file, int partNo); }
60b7417c35309a21293ec64d795533f12dd33142
0309d57c12df6160ee54390df6547fc7b566f74e
/app/src/main/java/com/example/romain/easyfood/DTO/Client.java
f408e641089f237601e8b9f1790b03456669b4be
[]
no_license
BlackEnergie/EasyFood-Android
b9f5b47b8496b0b25befe7524c964efbf0f37f4a
8e1e6562633aa2ab6613ff054a9a213873186c04
refs/heads/master
2020-03-09T18:24:18.697701
2018-04-10T12:45:52
2018-04-10T12:45:52
126,502,067
0
0
null
null
null
null
UTF-8
Java
false
false
1,992
java
package com.example.romain.easyfood.DTO; public class Client { private String mailU; private String pseudoU; private String nomU; private String prenomU; private String numAdrU; private String nomAdrU; private String cpU; private String villeU; private String mdpU; public Client (String mailU, String pseudoU, String nomU, String prenomU, String numAdrU, String nomAdrU, String cpU, String villeU, String mdpU) { this.mailU = mailU; this.pseudoU = pseudoU; this.nomU = nomU; this.prenomU = prenomU; this.numAdrU = numAdrU; this.nomAdrU = nomAdrU; this.cpU = cpU; this.villeU = villeU; this.mdpU = mdpU; } public void setMailU(String mailU) { this.mailU = mailU; } public void setPseudoU(String pseudoU) { this.pseudoU = pseudoU; } public void setNomU(String nomU) { this.nomU = nomU; } public void setPrenomU(String prenomU) { this.prenomU = prenomU; } public void setNumAdrU(String numAdrU) { this.numAdrU = numAdrU; } public void setNomAdrU(String nomAdrU) { this.nomAdrU = nomAdrU; } public void setCpU(String cpU) { this.cpU = cpU; } public void setVilleU(String villeU) { this.villeU = villeU; } public void setMdpU(String mdpU) { this.mdpU = mdpU; } public String getMailU() { return mailU; } public String getPseudoU() { return pseudoU; } public String getNomU() { return nomU; } public String getPrenomU() { return prenomU; } public String getNumAdrU() { return numAdrU; } public String getNomAdrU() { return nomAdrU; } public String getCpU() { return cpU; } public String getVilleU() { return villeU; } public String getMdpU() { return mdpU; } }
440fffa6f0355888074858876517e04da55c0acc
dde0ec109045221339c7e443436d3e4b674d7c20
/src/main/java/ch01/ioc_container/MyTime.java
afb36114c8097349302a56d6a50de388448be779
[]
no_license
springstory/ch01
83ec65532f5a8651d320443dd6cd7558931c4b67
cb093d8aed76d30b6db250e4aba4a3253d8d779d
refs/heads/master
2021-01-10T20:32:42.288512
2014-07-09T06:25:02
2014-07-09T06:25:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
package ch01.ioc_container; public class MyTime { private String time; public MyTime() { super(); } public MyTime(String time) { super(); this.time = time; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } @Override public String toString() { return "MyTime [time=" + time + "]"; } }
5edd0d92d8e6414ce0993fe676b85c51b8a8c794
154a885ad39ece031e5224f99b2f8a3082fcb000
/Sample/src/sam_08.java
cd4c88ce0e3eace088d74bd9b7886e57486b4fab
[]
no_license
moonhwan123/moonhwan
1b1e2fbc5589ac24d0806029465cdc232f5b9b29
84aa4dd9ca1a2f373d91ccbabce154f05c45c3c6
refs/heads/master
2021-07-05T04:46:46.814625
2021-04-01T09:21:19
2021-04-01T09:21:19
228,724,072
0
0
null
null
null
null
UTF-8
Java
false
false
561
java
import java.util.Scanner; public class sam_08 { public static void main(String[] args) { System.out.println("[์ž…๋ ฅํ•œ ์ˆ˜ ์ค‘ ์ตœ๋Œ€,์ตœ์†Œ ๊ฐ’์„ ์ฐพ๋Š” ํ”„๋กœ๊ทธ๋žจ ์ž…๋‹ˆ๋‹ค.]"); Scanner sc = new Scanner(System.in); int max = 0; int min = 999; while(true) { System.out.print("์ž…๋ ฅ (-99๋ฅผ ์ž…๋ ฅ ํ•˜๋ฉด ์ข…๋ฃŒ) : "); int num = sc.nextInt(); if(num==-99) break; if(max < num) { max = num; }if(min > num) { min = num; } } System.out.println("max = " + max); System.out.println("min = " + min); } }
d6393d4c0112783a827b6cf57d1af87cd3b6c268
d8eebc5cb5acb407f50d30006b5907afd2155652
/server/src/main/java/com/akapush/plm/service/UserService.java
27ae28ff9eec5f0197cbe366eb05bbd7bf6eff8e
[]
no_license
tshupaka/plm
80661b77fd19e3601eec5a4a8c059487e7357266
b194a02776bd6dc8132d27d42d1bb4522b6d1930
refs/heads/master
2022-02-07T03:41:37.696810
2020-11-03T19:56:10
2020-11-03T19:56:10
160,941,034
0
0
null
null
null
null
UTF-8
Java
false
false
928
java
package com.akapush.plm.service; import com.akapush.plm.domain.exception.AlreadyExistingBeanException; import com.akapush.plm.domain.exception.InvalidBeanException; import com.akapush.plm.domain.exception.NoBeanAvailableException; import com.akapush.plm.domain.model.User; /** * This service provide methods to handle users. * * @author eric * */ public interface UserService { /** * Return all users * * @return */ Iterable<User> getAllActiveUsers(); /** * Save new or existing user * * @param user * @throws AlreadyExistingBeanException * @throws InvalidBeanException * @throws NoBeanAvailableException */ void saveUser(User user) throws AlreadyExistingBeanException, InvalidBeanException, NoBeanAvailableException; /** * Delete user specified by id * * @param userId * @throws NoBeanAvailableException */ void deleteUserById(Long userId) throws NoBeanAvailableException; }
016d4accf7a27ad5ef3f7abce1f3749a128605c1
259caee0c6399143be8b5c112a4b1182479c0d13
/mybatisDemo/com/mybatis/dao/IStudentDao.java
9a858c8e013d5c2ac1abd02a25313f7a09d5891d
[]
no_license
antonio-hao/demoProject
ef32e79bcdb64d62b4523950ab2860a80f7a5dcf
44d9e5c8dc1037413a1d4af8a8729ada3e4d0a47
refs/heads/master
2020-06-27T21:47:28.826231
2019-08-04T15:31:02
2019-08-04T15:31:02
200,058,412
0
0
null
null
null
null
UTF-8
Java
false
false
909
java
package com.mybatis.dao; import java.util.List; import java.util.Map; import com.mybatis.entity.Student; public interface IStudentDao { void insertStudent(Student student); void insertStudentCacheId(Student student); void deleteStudentById(int id); void updateStudent(Student student); List<Student> selectAllStudents(); Map<String,Object> selectAllStudentsMap(); Student selectStudentById(int id); List<Student> selectStudentsByName(String name); List<Student> selectStudentsByCondition(Map<String, Object> map); List<Student> selectStudentsByCondition2(String name,int age); List<Student> selectStudentsBycondition3(Student studnet); List<Student> selectStudentsByChoose(Student student); List<Student> selectStudentsByForeach(int[] ids); List<Student> selectStudentsByForeach2(List<Integer> ids); List<Student> selectStudentsByForeach3(List<Student> ids); }
51f2c565246bbfe7b355e7dc9eeeb97a317f6555
190f37b9557b218526d2d9a84b42542d55d6aa5d
/src/main/java/ru/knowledgebase/dbmodule/dataservices/newsservice/NewsService.java
2726bfd2028cab2eddf9530dcdb924b438fc3cc5
[]
no_license
HardDays/KnowledgeBase
a6e8701a11cc824a1523f9335d9b73bd0e626266
e48e47eea867358fed2f6473ce2f0406ac4abe19
refs/heads/master
2021-01-21T02:24:19.562981
2016-10-08T20:53:41
2016-10-08T20:53:41
64,998,885
0
0
null
2016-08-31T11:17:08
2016-08-05T07:34:59
Java
UTF-8
Java
false
false
1,447
java
package ru.knowledgebase.dbmodule.dataservices.newsservice; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import ru.knowledgebase.dbmodule.repositories.articlerepositories.ImageRepository; import ru.knowledgebase.dbmodule.repositories.newsrepositories.NewsRepository; import ru.knowledgebase.modelsmodule.articlemodels.News; import java.sql.Timestamp; import java.util.List; /** * Created by root on 02.10.16. */ @Service("newsService") public class NewsService { @Autowired private NewsRepository newsRepository; public News addNews(News news) throws Exception { return this.newsRepository.save(news); } public News updateNews(News news)throws Exception { return newsRepository.save(news); } public News findNews(int id) throws Exception { return this.newsRepository.findOne(id); } public void deleteNews(int id) throws Exception { this.newsRepository.delete(id); } public List<News> getAllNewsBySection(int sectionId) throws Exception { return this.newsRepository.findNewsBySection(sectionId); } public void deleteAllBySection(int section) throws Exception { newsRepository.deleteBySectionId(section); } public List<News> getSectionNewsFromDate(Integer i, Timestamp date) throws Exception { return newsRepository.getSectionNewsByDate(i, date); } }
7db8a22033abac042eb01be282016af236498e7b
db77424ab3c2906e2706e4524daf2adbf0543916
/catalogue/catalogue/src/main/java/com/example/moviesinc/catalogue/Model/Filter.java
030c8ee7c050733ec7684030625b6a044ee9dca8
[]
no_license
SergiiVlasiuk/angular2-essential-training
be268a72fd972c66ebf98c996338ac65e5669abe
ba5b577ac44e53a7d080134849c4189c54b7171a
refs/heads/master
2020-06-08T02:29:17.034895
2019-02-07T08:47:05
2019-02-07T08:47:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
447
java
package com.example.moviesinc.catalogue.Model; public class Filter { private String movieName; private String category; public String getMovieName() { return movieName; } public void setMovieName(String movieName) { this.movieName = movieName; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } }
2c299a5192e870c340068f5e3edf95be388533d7
a38ee63d5d8a1edb77ec4c4fd2488a0803dd41d9
/backend/src/main/java/org/sharetask/api/WorkspaceService.java
8f2740cce9e6a6a60466c55099cb22aa53ec863d
[]
no_license
loudbrightraj/sharetask
7c4aa121e4783f2bdb88987af72b18bcc345a4f8
a7339a01bb4f83410b479fb9060f6702ee5ae98e
refs/heads/master
2021-01-18T08:07:13.804917
2013-08-26T15:59:16
2013-08-26T15:59:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,533
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.sharetask.api; import java.util.List; import javax.validation.Valid; import javax.validation.constraints.NotNull; import org.sharetask.api.dto.WorkspaceDTO; import org.springframework.validation.annotation.Validated; /** * Service for accessing workspace. * @author Michal Bocek * @since 1.0.0 */ @Validated public interface WorkspaceService { /** * Create new workspace. * @param workspace * @return */ @NotNull WorkspaceDTO create(@Valid @NotNull final WorkspaceDTO workspace); /** * Update workspace. * @param workspace * @return */ @NotNull WorkspaceDTO update(@Valid @NotNull final WorkspaceDTO workspace); /** * Add member to specified workspace. * @param invitationCode */ void addMember(@NotNull final String invitationCode); /** * Remove member from specified workspace. * @param workspaceId * @param userId */ void removeMember(@NotNull final Long workspaceId, @NotNull final String username); /** * Find all workspaces for specified owner. * @param ownerId * @return */ List<WorkspaceDTO> findByOwner(@NotNull final String username); /** * Find all workspaces for member. * @param username * @return */ List<WorkspaceDTO> findByMember(@NotNull final String username); /** * Find all workspaces where i'm owner or member. * @param username * @return */ List<WorkspaceDTO> findAllMyWorkspaces(@NotNull final String username); /** * Find workspace by type. * Expected type is OWNER, MEMBER, ALL_MY. * @param type * @return */ List<WorkspaceDTO> findByType(@NotNull final WorkspaceQueryType queryType); /** * Delete whole workspace. * @param taskId */ void delete(@NotNull final Long workspaceId); }
4033b98499203d72e43c564fd43d27185fe34dc1
449cc92656d1f55bd7e58692657cd24792847353
/member-service/src/main/java/com/lj/business/member/domain/TerminalLoginLog.java
89611adfd1eecaf5457adbb0512160afcec379b4
[]
no_license
cansou/HLM
f80ae1c71d0ce8ead95c00044a318796820a8c1e
69d859700bfc074b5948b6f2c11734ea2e030327
refs/heads/master
2022-08-27T16:40:17.206566
2019-12-18T06:48:10
2019-12-18T06:48:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,813
java
package com.lj.business.member.domain; import java.util.Date; public class TerminalLoginLog { /** * CODE . */ private String code; /** * ๆ“ไฝœ็ฑปๅž‹๏ผš0็™ปๅฝ•ใ€1็™ปๅ‡บ . */ private Integer optType; /** * ๆ“ไฝœๆ—ถ้—ด . */ private Date optTime; /** * ็ปˆ็ซฏ็ฑปๅž‹๏ผšGMๅฏผ่ดญใ€ZKไธญๆŽง . */ private String terminalType; /** * ็ปˆ็ซฏ็ผ–็  . */ private String terminalCode; /** * ๅฏผ่ดญ็ผ–ๅท . */ private String memberNoGm; /** * ๅฏผ่ดญๅง“ๅ . */ private String memberName; /** * ๅพฎไฟกๅท . */ private String noWx; /** * ๆ‰‹ๆœบไธฒๅท . */ private String imei; /** * ๅ•†ๆˆท็ผ–ๅท . */ private String merchantNo; /** * ๅ•†ๆˆทๅ็งฐ . */ private String merchantName; /** * CODE . * */ public String getCode() { return code; } /** * CODE . * */ public void setCode(String code) { this.code = code == null ? null : code.trim(); } /** * ๆ“ไฝœ็ฑปๅž‹๏ผš0็™ปๅฝ•ใ€1็™ปๅ‡บ . * */ public Integer getOptType() { return optType; } /** * ๆ“ไฝœ็ฑปๅž‹๏ผš0็™ปๅฝ•ใ€1็™ปๅ‡บ . * */ public void setOptType(Integer optType) { this.optType = optType; } /** * ๆ“ไฝœๆ—ถ้—ด . * */ public Date getOptTime() { return optTime; } /** * ๆ“ไฝœๆ—ถ้—ด . * */ public void setOptTime(Date optTime) { this.optTime = optTime; } /** * ็ปˆ็ซฏ็ฑปๅž‹๏ผšGMๅฏผ่ดญใ€ZKไธญๆŽง . * */ public String getTerminalType() { return terminalType; } /** * ็ปˆ็ซฏ็ฑปๅž‹๏ผšGMๅฏผ่ดญใ€ZKไธญๆŽง . * */ public void setTerminalType(String terminalType) { this.terminalType = terminalType == null ? null : terminalType.trim(); } /** * ็ปˆ็ซฏ็ผ–็  . * */ public String getTerminalCode() { return terminalCode; } /** * ็ปˆ็ซฏ็ผ–็  . * */ public void setTerminalCode(String terminalCode) { this.terminalCode = terminalCode == null ? null : terminalCode.trim(); } /** * ๅฏผ่ดญ็ผ–ๅท . * */ public String getMemberNoGm() { return memberNoGm; } /** * ๅฏผ่ดญ็ผ–ๅท . * */ public void setMemberNoGm(String memberNoGm) { this.memberNoGm = memberNoGm == null ? null : memberNoGm.trim(); } /** * ๅฏผ่ดญๅง“ๅ . * */ public String getMemberName() { return memberName; } /** * ๅฏผ่ดญๅง“ๅ . * */ public void setMemberName(String memberName) { this.memberName = memberName == null ? null : memberName.trim(); } /** * ๅพฎไฟกๅท . * */ public String getNoWx() { return noWx; } /** * ๅพฎไฟกๅท . * */ public void setNoWx(String noWx) { this.noWx = noWx == null ? null : noWx.trim(); } /** * ๆ‰‹ๆœบไธฒๅท . * */ public String getImei() { return imei; } /** * ๆ‰‹ๆœบไธฒๅท . * */ public void setImei(String imei) { this.imei = imei == null ? null : imei.trim(); } /** * ๅ•†ๆˆท็ผ–ๅท . * */ public String getMerchantNo() { return merchantNo; } /** * ๅ•†ๆˆท็ผ–ๅท . * */ public void setMerchantNo(String merchantNo) { this.merchantNo = merchantNo == null ? null : merchantNo.trim(); } /** * ๅ•†ๆˆทๅ็งฐ . * */ public String getMerchantName() { return merchantName; } /** * ๅ•†ๆˆทๅ็งฐ . * */ public void setMerchantName(String merchantName) { this.merchantName = merchantName == null ? null : merchantName.trim(); } /** * ่พ“ๅ‡บBEANๆ•ฐๆฎไฟกๆฏ * @author LeoPeng */ public String toString() { StringBuilder builder = new StringBuilder(); builder.append("TerminalLoginLog [code=").append(code); builder.append(",optType=").append(optType); builder.append(",optTime=").append(optTime); builder.append(",terminalType=").append(terminalType); builder.append(",terminalCode=").append(terminalCode); builder.append(",memberNoGm=").append(memberNoGm); builder.append(",memberName=").append(memberName); builder.append(",noWx=").append(noWx); builder.append(",imei=").append(imei); builder.append(",merchantNo=").append(merchantNo); builder.append(",merchantName=").append(merchantName); builder.append("]"); return builder.toString(); } }
375c07940cfe627231ee1ca1e946c064a9f2ad5b
66b8adafdf237340c674f9b610ad8b98d45d99d7
/learn-shop-public-auth/src/main/java/com/billow/auth/security/endpoint/SecurityEndpoint.java
69297d904fd4bc73ceb7186d349d8706a5a6e6fd
[ "Apache-2.0" ]
permissive
yy321973351/learn
33d1fe67d4a932801d2abbde71eae7c45d184c9e
49fe64f54a864421c598272274131f5e20d8f5b3
refs/heads/master
2020-08-30T17:01:59.391480
2019-10-30T02:56:15
2019-10-30T02:56:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,958
java
package com.billow.auth.security.endpoint; import com.billow.auth.pojo.po.UserPo; import com.billow.auth.security.properties.ClientProperties; import com.billow.auth.security.properties.SecurityProperties; import com.billow.tools.enums.ResCodeEnum; import com.billow.tools.resData.BaseResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.authentication.AuthenticationDetailsSource; import org.springframework.security.core.Authentication; import org.springframework.security.oauth2.common.OAuth2AccessToken; import org.springframework.security.oauth2.provider.OAuth2Authentication; import org.springframework.security.oauth2.provider.authentication.BearerTokenExtractor; import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetailsSource; import org.springframework.security.oauth2.provider.authentication.TokenExtractor; import org.springframework.security.oauth2.provider.endpoint.FrameworkEndpoint; import org.springframework.security.oauth2.provider.token.DefaultTokenServices; import org.springframework.util.Assert; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.client.RestTemplate; import org.springframework.web.servlet.ModelAndView; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.Map; /** * ๆŸฅ่ฏข็”จๆˆทไฟกๆฏ * * @author LiuYongTao * @date 2018/11/15 14:32 */ @FrameworkEndpoint public class SecurityEndpoint { private Logger logger = LoggerFactory.getLogger(getClass()); private TokenExtractor tokenExtractor = new BearerTokenExtractor(); private AuthenticationDetailsSource<HttpServletRequest, ?> authenticationDetailsSource = new OAuth2AuthenticationDetailsSource(); @Autowired private DefaultTokenServices defaultTokenServices; @Autowired private RestTemplate restTemplate; @Autowired private SecurityProperties securityProperties; /** * ่ฎค้กต้ข * * @return ModelAndView */ @GetMapping("/authentication/require") public ModelAndView require() { return new ModelAndView("/index.html"); } /** * ่Žทๅ–็”จๆˆทไฟกๆฏ * * @param request * @param response * @return */ @ResponseBody @GetMapping("/user") public Authentication user(ServletRequest request, ServletResponse response) { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; OAuth2Authentication oAuth2Authentication = null; // ่Žทๅ–่ฏทๆฑ‚ไธญไธญ็š„ Authorization ๆˆ–่€… access_token ไธญ็š„ token Authentication authentication = tokenExtractor.extract(req); if (authentication != null && !StringUtils.isEmpty(authentication.getPrincipal())) { // ไปŽๆŽˆๆƒๆœๅŠกๅ™จ๏ผŒ่Žทๅ–็”จๆˆทไฟกๆฏ oAuth2Authentication = defaultTokenServices.loadAuthentication(authentication.getPrincipal().toString()); if (oAuth2Authentication instanceof AbstractAuthenticationToken) { // ๅกซๅ……ๅ…ถๅฎƒไฟกๆฏ oAuth2Authentication.setDetails(authenticationDetailsSource.buildDetails(req)); Authentication userAuthentication = oAuth2Authentication.getUserAuthentication(); oAuth2Authentication.setAuthenticated(userAuthentication.isAuthenticated()); } } return oAuth2Authentication; } /** * ็”จไบŽๅ‰ๅŽๅˆ†็ฆปๆ—ถ็™ป้™† * * @param userPo * @return */ @ResponseBody @PostMapping("/login") public BaseResponse login(@RequestBody UserPo userPo) { BaseResponse baseResponse = new BaseResponse(); try { String username = userPo.getUsername(); String password = userPo.getPassword(); logger.info("Username:{},Password:{}", username, password); Assert.notNull(username, "็”จๆˆทๅไธ่ƒฝไธบ็ฉบ!"); Assert.notNull(password, "ๅฏ†็ ไธ่ƒฝไธบ็ฉบ!"); ClientProperties client = securityProperties.getClient(); String accessTokenUri = client.getAccessTokenUri(); Assert.notNull(accessTokenUri, "accessTokenUri ไธ่ƒฝไธบ็ฉบ,่ฏท้…็ฝฎ auth.security.client.accessTokenUri"); String grantType = client.getGrantType(); Assert.notNull(grantType, "grantType ไธ่ƒฝไธบ็ฉบ,่ฏท้…็ฝฎ auth.security.client.grantType"); String clientId = client.getClientId(); Assert.notNull(clientId, "clientId ไธ่ƒฝไธบ็ฉบ,่ฏท้…็ฝฎ auth.security.client.clientId"); String clientSecret = client.getClientSecret(); Assert.notNull(clientSecret, "clientSecret ไธ่ƒฝไธบ็ฉบ,่ฏท้…็ฝฎ auth.security.client.clientSecret"); // String url = "http://127.0.0.1:9999/oauth/token?grant_type=password&username=admin&password=123456&client_id=app&client_secret=app"; String url = "%s?grant_type=%s&username=%s&password=%s&client_id=%s&client_secret=%s"; String trgUrl = String.format(url, accessTokenUri, grantType, username, password, clientId, clientSecret); HttpHeaders headers = new HttpHeaders(); headers.add("User-Agent", "curl/7.58.0"); headers.add("Content-Type", "application/json;charset=UTF-8"); HttpEntity<String> entity = new HttpEntity<>(headers); ResponseEntity<OAuth2AccessToken> accessTokenEntity = restTemplate.postForEntity(trgUrl, entity, OAuth2AccessToken.class); OAuth2AccessToken oAuth2AccessToken = accessTokenEntity.getBody(); logger.info("accessToken:{}", oAuth2AccessToken.getValue()); logger.info("refreshToken:{}", oAuth2AccessToken.getRefreshToken().getValue()); Map<String, String> result = new HashMap<>(); result.put("accessToken", oAuth2AccessToken.getValue()); result.put("refreshToken", oAuth2AccessToken.getRefreshToken().getValue()); baseResponse.setResData(result); baseResponse.setResCode(ResCodeEnum.RESCODE_ASSESS_TOKEN); } catch (Exception e) { logger.error("็™ป้™†ๅผ‚ๅธธ๏ผš{}", e); baseResponse.setResCode(ResCodeEnum.RESCODE_NOT_FOUND_USER); } return baseResponse; } }
9f7e9f5915fe4d995caee5cbbf4f659fcee60f95
45aee7f8efb4f8c1a1dd036b2087dd049fa7cdd5
/Day14_Regex/src/jz/test/RegexDemo.java
a7c140ccacc7b68b628912bbb59ef501eb18f1cd
[]
no_license
jackie0025/JavaPracticeProjects
df7d6385ec8716317269f047d10916a0a10df7de
1acc5411b3b79775c5e34dec4592a45cd04bccd4
refs/heads/master
2020-12-10T03:21:49.107008
2017-07-25T04:34:26
2017-07-25T04:34:26
95,520,610
0
0
null
null
null
null
GB18030
Java
false
false
1,265
java
package jz.test; public class RegexDemo { public static void main(String[] args) { // TODO Auto-generated method stub //System.out.println(checkQQ("01111111")); //System.out.println(checkPhoneNum("15888880000")); System.out.println(checkEmail("[email protected]")); } public static boolean checkEmail(String address) { return address.matches("[a-zA-Z_0-9]+@[a-zA-Z_0-9]{2,6}(\\.[a-zA-Z_0-9]{2,3})+"); //[a-zA-Z_0-9]่ฟ™ไบ›ๅญ—็ฌฆ + ๅ‡บ็Žฐๅคšๆฌก //@ //[a-zA-Z_0-9]ๅ‡บ็Žฐ{2,6}ๆฌก // \\. ๅณ . // ()+ ๆ‹ฌๅทๅ†…็š„ๅ†…ๅฎนๅ‡บ็Žฐๅคšๆฌก } public static boolean checkPhoneNum(String num){ return num.matches("1[358]\\d{9}");//1,3/5/8,ๅŽ้ขไธบ9ไฝๆ•ฐๅญ— } /** * ๆฃ€ๆŸฅQQๅท็ ๆญฃ็กฎๆ€ง * ไธ่ƒฝ0ๅผ€ๅคด * ๅฟ…้กป็บฏๆ•ฐๅญ— * ้•ฟๅบฆ5~15 * @param qq * @return */ public static boolean checkQQ(String qq){ /* boolean flag=true; if (qq.length()>=5&&qq.length()<=15) { //ไธ่ƒฝ0ๅผ€ๅคด if (!qq.startsWith("0")) { char[] cs=qq.toCharArray(); for (char c : cs) { if (!Character.isDigit(c)) { flag=false; break; } } }else { flag=false; } }else { flag=false; } return flag; */ //return qq.matches("[1-9][0-9]{4,15}"); return qq.matches("[1-9]\\d{4,15}"); } }
5bbb0e7557c9ac24e45d2c85dab76eb35a1fbd50
2cf11da4067e548a53c24249d56b72579d560f40
/docs/src/test/java/com/example/ResponsePostProcessing.java
c9a6bcb017ff8869db92be942a3e0d352c70252a
[ "Apache-2.0" ]
permissive
phamthaithinh/spring-restdocs
23ff827fe3dd8228540925c86a800ea0f9ecf190
e5c992c2492e8a4caba6182d3a2be1ebf01813fc
refs/heads/master
2020-04-01T18:04:11.984658
2015-07-28T16:44:50
2015-07-28T16:44:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,252
java
/* * Copyright 2014-2015 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.example; import static org.springframework.restdocs.RestDocumentation.modifyResponseTo; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.springframework.test.web.servlet.MockMvc; public class ResponsePostProcessing { private MockMvc mockMvc; public void general() throws Exception { // tag::general[] this.mockMvc.perform(get("/")) .andExpect(status().isOk()) .andDo(modifyResponseTo(/* ... */) // <1> .andDocument("index")); // <2> // end::general[] } }
38cee732f93b64fdf85ec5e16bd4586f9b8f5e83
679d3eb9e9346c32723152861040a1da89aef9ef
/src/managers/PrintUtilities.java
5918b6240c65135f96ca8d727e67f3cc5aa1e334
[]
no_license
maany/ThunderBolt
821402011b2269927cfe7fa9357847b82274c9f8
c57d0f604ce54363f29f0014e890fe3931dd9a3f
refs/heads/master
2021-01-10T22:11:01.733128
2014-03-14T17:12:31
2014-03-14T17:12:31
16,720,450
1
2
null
null
null
null
UTF-8
Java
false
false
5,454
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 managers; import java.awt.*; import java.awt.geom.AffineTransform; import javax.swing.*; import java.awt.print.*; import static java.awt.print.Printable.NO_SUCH_PAGE; import static java.awt.print.Printable.PAGE_EXISTS; /** * This class is used to get High Resolution Print-outs using Java * @author MAYANK */ public class PrintUtilities implements Printable { private Component componentToBePrinted; public static void printComponent(Component c) { new PrintUtilities(c).print(); } public PrintUtilities(Component componentToBePrinted) { this.componentToBePrinted = componentToBePrinted; } /** * create printJob and call print(1,2,3); */ public void print() { PrinterJob printJob = PrinterJob.getPrinterJob(); printJob.setPrintable(this); if (printJob.printDialog()) try { printJob.print(); } catch(PrinterException pe) { System.out.println("Error printing: " + pe); } } /** * Most imp method, it scales down frame size to pageformat size and prints */ @Override public int print(Graphics g, PageFormat pf, int pageNumber) throws PrinterException { // TODO Auto-generated method stub if (pageNumber > 0) { return Printable.NO_SUCH_PAGE; } // Get the preferred size ofthe component... Dimension compSize = componentToBePrinted.getPreferredSize(); // Make sure we size to the preferred size componentToBePrinted.setSize(compSize); // Get the the print size Dimension printSize = new Dimension(); printSize.setSize(pf.getImageableWidth(), pf.getImageableHeight()); // Calculate the scale factor double scaleFactor = getScaleFactorToFit(compSize, printSize); // Don't want to scale up, only want to scale down if (scaleFactor > 1d) { scaleFactor = 1d; } // Calcaulte the scaled size... double scaleWidth = compSize.width * scaleFactor; double scaleHeight = compSize.height * scaleFactor; // Create a clone of the graphics context. This allows us to manipulate // the graphics context without begin worried about what effects // it might have once we're finished Graphics2D g2 = (Graphics2D) g.create(); // Calculate the x/y position of the component, this will center // the result on the page if it can double x = ((pf.getImageableWidth() - scaleWidth) / 2d) + pf.getImageableX(); double y = ((pf.getImageableHeight() - scaleHeight) / 2d) + pf.getImageableY(); // Create a new AffineTransformation AffineTransform at = new AffineTransform(); // Translate the offset to out "center" of page at.translate(x, y); // Set the scaling at.scale(scaleFactor, scaleFactor); // Apply the transformation g2.transform(at); // Print the component componentToBePrinted.printAll(g2); // Dispose of the graphics context, freeing up memory and discarding // our changes g2.dispose(); componentToBePrinted.revalidate(); return Printable.PAGE_EXISTS; } /* @Override public int print(Graphics g, PageFormat pageFormat, int pageIndex) { if (pageIndex > 0) { return(NO_SUCH_PAGE); } else { Graphics2D g2d = (Graphics2D)g; g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY()); disableDoubleBuffering(componentToBePrinted); componentToBePrinted.paint(g2d); enableDoubleBuffering(componentToBePrinted); return(PAGE_EXISTS); } } */ public static double getScaleFactorToFit(Dimension original, Dimension toFit) { double dScale = 1d; if (original != null && toFit != null) { double dScaleWidth = getScaleFactor(original.width, toFit.width); double dScaleHeight = getScaleFactor(original.height, toFit.height); dScale = Math.min(dScaleHeight, dScaleWidth); } return dScale; } public static double getScaleFactor(int iMasterSize, int iTargetSize) { double dScale = 1; if (iMasterSize > iTargetSize) { dScale = (double) iTargetSize / (double) iMasterSize; } else { dScale = (double) iTargetSize / (double) iMasterSize; } return dScale; } /** The speed and quality of printing suffers dramatically if * any of the containers have double buffering turned on. * So this turns if off globally. * @param c * @see enableDoubleBuffering */ public static void disableDoubleBuffering(Component c) { RepaintManager currentManager = RepaintManager.currentManager(c); currentManager.setDoubleBufferingEnabled(false); } /** Re-enables double buffering globally. * @param c */ public static void enableDoubleBuffering(Component c) { RepaintManager currentManager = RepaintManager.currentManager(c); currentManager.setDoubleBufferingEnabled(true); } }
3a56bcb28676ddf6215667bb240b3a287dd918fd
09a61a22ebcaa9c84f6cba87052374be6030d169
/Brief10/src/main/java/com/dao/RDVDao.java
056eec2eb808c37d4d0d49e394820ab2d8833ab7
[]
no_license
Melbettal/simplons_briefs2
da0f73afefc0cf3b4e027e545d2f145388999706
f0ba7e55f4c13855efcb5c4a9f61dda8460a8287
refs/heads/master
2023-06-10T18:18:04.994133
2021-07-05T10:55:04
2021-07-05T10:55:04
319,582,825
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
package com.dao; import java.util.List; import com.model.RDV; public interface RDVDao { public void saveRDV(RDV rdv) ; public void updateRDV(RDV rdv) ; public RDV getRDVById(long id); public List<RDV> getAllRDVs(); public RDV deleteRDV(long id); }
1ab0ad0c7c7a81d8ec92af26b3a7f8e56434d3bb
7241ca6e09a078c94a79af6bbe18cc7ec6789142
/src/cn/itcast/search/AppSet.java
1892868c70b25818cfe85632b404b846d099ba1e
[]
no_license
kennycaiguo/itcastHibernate0603
effa6e626a13cb6acab7a86b2202ded2177c353c
92daa521d00045f92002974b942231cc38eb8e72
refs/heads/master
2021-05-26T22:29:50.875202
2013-10-19T06:32:48
2013-10-19T06:33:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,407
java
package cn.itcast.search; import java.util.Iterator; import java.util.List; import java.util.Set; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.junit.Test; public class AppSet { static SessionFactory sf = null; static { Configuration config = new Configuration(); config.configure("cn/itcast/search/hibernate.cfg.xml"); config.addClass(Customer.class); config.addClass(Order.class); sf = config.buildSessionFactory(); } /* * ๆต‹่ฏ•ๅ…ณ่”็บงๅˆซ็š„ๆฃ€็ดข * fetch="join/select/subselect" * lazy="true/false/extra" * ้…็ฝฎ<set name="orders" table="orders" inverse="true" fetch="join" lazy="false"> * ไฝฟ็”จloadๅ’Œgetๆ–นๆณ•ๆต‹่ฏ•: * * fetch="join" lazy="false":่ฟซๅˆ‡ๅทฆๅค–่ฟžๆŽฅ * * fetch="join" lazy="true":่ฟซๅˆ‡ๅทฆๅค–่ฟžๆŽฅ * * fetch="join" lazy="extra":่ฟซๅˆ‡ๅทฆๅค–่ฟžๆŽฅ */ @Test public void fetchjoinload(){ Session s=sf.openSession(); Transaction tx=s.beginTransaction(); Customer c=(Customer)s.load(Customer.class, 1); Set<Order> orderes=c.getOrders(); Iterator<Order> it=orderes.iterator(); while(it.hasNext()){ Order o=it.next(); System.out.println(o.getId() +" "+o.getOrderNumber()+" "+o.getPrice()); } tx.commit(); s.close(); } /* * ๆต‹่ฏ•ๅ…ณ่”็บงๅˆซ็š„ๆฃ€็ดข * fetch="join/select/subselect" * lazy="true/false/extra" * ้…็ฝฎ<set name="orders" table="orders" inverse="true" fetch="join" lazy="false"> * ไฝฟ็”จqueryๆŽฅๅฃๆต‹่ฏ•: * * fetch="join" lazy="false":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆ็ซ‹ๅณๆฃ€็ดข * * select * from customers [id=1,2,3] * * select * from orders where id=1 * * select * from orders where id=2 * * select * from orders where id=3 * * * fetch="join" lazy="true":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆๅปถ่ฟŸๆฃ€็ดข * * select * from customers [id=1,2,3] * * select * from orders where id=1่ฏญๅฅ,ๅฝ“ๆ‰ง่กŒlist.get(0).getOrders().size();ไปฃ็ ๆ—ถ, ๆ‰ๆ‰ง่กŒ * * select * from orders where id=2่ฏญๅฅ,ๅฝ“ๆ‰ง่กŒlist.get(1).getOrders().size();ไปฃ็ ๆ—ถ, ๆ‰ๆ‰ง่กŒ * * select * from orders where id=3่ฏญๅฅ,ๅฝ“ๆ‰ง่กŒlist.get(2).getOrders().size();ไปฃ็ ๆ—ถ, ๆ‰ๆ‰ง่กŒ * * * fetch="join" lazy="extra":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆๅขžๅŠ ๅปถ่ฟŸๆฃ€็ดข, * select count(id) from orders where customer_id =? * list.get(0).getOrders().size();,่Žทๅ–่ฎขๅ•้›†ๅˆ็š„ๆ•ฐ้‡,ๅฐฑๆŸฅๆ•ฐ้‡. */ @Test public void fetchjoinQuery(){ Session s=sf.openSession(); Transaction tx=s.beginTransaction(); Query query=s.createQuery("from Customer c"); List<Customer> list=query.list(); list.get(0).getOrders().size(); list.get(1).getOrders().size(); list.get(2).getOrders().size(); tx.commit(); s.close(); } /* * ๆต‹่ฏ•ๅ…ณ่”็บงๅˆซ็š„ๆฃ€็ดข * fetch="join/select/subselect" * lazy="true/false/extra" * ้…็ฝฎ<set name="orders" table="orders" inverse="true" fetch="select" lazy="false"> * ไฝฟ็”จloadๅ’Œgetๆ–นๆณ•ๆต‹่ฏ•: * * fetch="select" lazy="false":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆ้‡‡็”จ็ซ‹ๅณๆฃ€็ดข * * fetch="select" lazy="true":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆ้‡‡็”จๅปถ่ฟŸๆฃ€็ดข * * fetch="select" lazy="extra":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆ้‡‡็”จๅขžๅผบๅปถ่ฟŸๆฃ€็ดข. * * select count(id) from orders where customer_id =? */ @Test public void fetchselectload(){ Session s=sf.openSession(); Transaction tx=s.beginTransaction(); Customer c=(Customer)s.load(Customer.class, 1); Set<Order> orderes=c.getOrders(); c.getOrders().size(); tx.commit(); s.close(); } /* * ๆต‹่ฏ•ๅ…ณ่”็บงๅˆซ็š„ๆฃ€็ดข * fetch="join/select/subselect" * lazy="true/false/extra" * ้…็ฝฎ<set name="orders" table="orders" inverse="true" fetch="select" lazy="false"> * ไฝฟ็”จqueryๆŽฅๅฃๆต‹่ฏ•: * * fetch="select" lazy="false":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆ็ซ‹ๅณๆฃ€็ดข * * select * from customers [id=1,2,3] * * select * from orders where id=1 * * select * from orders where id=2 * * select * from orders where id=3 * * * fetch="select" lazy="true":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆๅปถ่ฟŸๆฃ€็ดข * * select * from customers [id=1,2,3] * * select * from orders where id=1่ฏญๅฅ,ๅฝ“ๆ‰ง่กŒlist.get(0).getOrders().size();ไปฃ็ ๆ—ถ, ๆ‰ๆ‰ง่กŒ * * select * from orders where id=2่ฏญๅฅ,ๅฝ“ๆ‰ง่กŒlist.get(1).getOrders().size();ไปฃ็ ๆ—ถ, ๆ‰ๆ‰ง่กŒ * * select * from orders where id=3่ฏญๅฅ,ๅฝ“ๆ‰ง่กŒlist.get(2).getOrders().size();ไปฃ็ ๆ—ถ, ๆ‰ๆ‰ง่กŒ * * * fetch="select" lazy="extra":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆๅขžๅŠ ๅปถ่ฟŸๆฃ€็ดข, * select count(id) from orders where customer_id =? * list.get(0).getOrders().size();,่Žทๅ–่ฎขๅ•้›†ๅˆ็š„ๆ•ฐ้‡,ๅฐฑๆŸฅๆ•ฐ้‡. */ @Test public void fetchselectQuery(){ Session s=sf.openSession(); Transaction tx=s.beginTransaction(); Query query=s.createQuery("from Customer c"); List<Customer> list=query.list(); list.get(0).getOrders().size(); list.get(1).getOrders().size(); list.get(2).getOrders().size(); tx.commit(); s.close(); } /* * ๆต‹่ฏ•ๅ…ณ่”็บงๅˆซ็š„ๆฃ€็ดข * fetch="join/select/subselect" * lazy="true/false/extra" * ้…็ฝฎ<set name="orders" table="orders" inverse="true" fetch="subselect" lazy="false"> * ไฝฟ็”จloadๅ’Œgetๆ–นๆณ•ๆต‹่ฏ•: * * fetch="subselect" lazy="false":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆ้‡‡็”จ็ซ‹ๅณๆฃ€็ดข * * fetch="subselect" lazy="true":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆ้‡‡็”จๅปถ่ฟŸๆฃ€็ดข * * fetch="subselect" lazy="extra":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆ้‡‡็”จๅขžๅผบๅปถ่ฟŸๆฃ€็ดข. * * select count(id) from orders where customer_id =? */ @Test public void fetchsubselectload(){ Session s=sf.openSession(); Transaction tx=s.beginTransaction(); Customer c=(Customer)s.load(Customer.class, 1); Set<Order> orderes=c.getOrders(); c.getOrders().size(); tx.commit(); s.close(); } /* * ๆต‹่ฏ•ๅ…ณ่”็บงๅˆซ็š„ๆฃ€็ดข * fetch="join/select/subselect" * lazy="true/false/extra" * ้…็ฝฎ<set name="orders" table="orders" inverse="true" fetch="subselect" lazy="false"> * ไฝฟ็”จqueryๆŽฅๅฃๆต‹่ฏ•: * * fetch="subselect" lazy="false":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆ็ซ‹ๅณๆฃ€็ดข,้‡‡็”จๅญๆŸฅ่ฏข * * select * from customers [id=1,2,3] * * select * from orders where id in( select customer0_.id from customers customer0_) * * * fetch="subselect" lazy="true":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆๅปถ่ฟŸๆฃ€็ดข+ๅญๆŸฅ่ฏข * * select * from customers [id=1,2,3] * * select * from orders where id in( select customer0_.id from customers customer0_)่ฏญๅฅ, * ๅฝ“ๆ‰ง่กŒlist.get(0).getOrders().size();ไปฃ็ ๆ—ถ, ๆ‰ๆ‰ง่กŒ * * * fetch="subselect" lazy="extra":ๆŸฅ่ฏข่ฎขๅ•้›†ๅˆๅขžๅŠ ๅปถ่ฟŸๆฃ€็ดข, * select count(id) from orders where customer_id =? * list.get(0).getOrders().size();,่Žทๅ–่ฎขๅ•้›†ๅˆ็š„ๆ•ฐ้‡,ๅฐฑๆŸฅๆ•ฐ้‡. */ @Test public void fetchsubselectQuery(){ Session s=sf.openSession(); Transaction tx=s.beginTransaction(); Query query=s.createQuery("from Customer c"); List<Customer> list=query.list(); list.get(0).getOrders().size(); list.get(1).getOrders().size(); list.get(2).getOrders().size(); tx.commit(); s.close(); } }
4af163dfc89dab4c0db496f3879c4864b7612ad5
e84f3a5ee0756030a8d19755bc6296790f56bd35
/src/java/Servlets/deactiveoractiveAppValidations.java
2ec4183c969418f7cf5d6647d5523c262e0db994
[]
no_license
donkaac/AppSt
a47a6d53eb1f7853380b5f716f83e01d4cdd3f19
06b4dd571ec9c4ea24505ae3c6182df598687a44
refs/heads/master
2020-12-14T09:43:59.927163
2016-11-22T19:15:18
2016-11-22T19:15:18
68,583,337
0
0
null
null
null
null
UTF-8
Java
false
false
3,491
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 Servlets; import Datacontroller.DataParser; import Entities.Apphasstaffvalid; import Entities.Developervalid; import Entities.Staff; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author Ish */ public class deactiveoractiveAppValidations extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try { if((null!=request.getParameter("appvalidid"))&(null!=request.getParameter("state"))){ int appvalidid=Integer.parseInt(request.getParameter("appvalidid")); boolean s = Boolean.parseBoolean(request.getParameter("state")); Staff staff=(Staff) request.getSession().getAttribute("staff"); staff=(Staff) DataParser.getuniqeresault(new Staff(), staff.getIdStaff()); Apphasstaffvalid appvalid = (Apphasstaffvalid) DataParser.getuniqeresault(new Apphasstaffvalid(), appvalidid); appvalid.setAppHasStaffValidState(s); appvalid.setStaff(staff); boolean Savedata = DataParser.UpdateData(appvalid); if(Savedata){ response.sendRedirect("admin/SetAppValidations.jsp"); } } } catch (Exception e) { } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "Ish@Ishan" ]
Ish@Ishan
56192aa44dcf90cf9643021362622c572477fac8
ab8c50e2054c9a50ab14d2d1bdfa5153c47e936a
/java-core-lang/src/main/java/com/henryxi/java/core/lang/clazz/TestInterface.java
2f3b858423220aca887f93792df18a94a3a70930
[]
no_license
HenryXi/java-core
c7e637d14e6469af6f69ad1ba959a4d4263613be
1c4cec5e8843ef444e860ccd064e859dcededf22
refs/heads/develop
2021-07-16T15:57:16.191848
2021-06-03T10:10:14
2021-06-03T10:10:14
54,711,864
1
1
null
2021-04-26T18:04:52
2016-03-25T10:22:37
Java
UTF-8
Java
false
false
71
java
package com.henryxi.java.core.lang.clazz; interface TestInterface { }
b88e2c53f6b1b606ee8ef347124fc19215e548bc
f684cded357de66f1ffc6d54e4fbd0f5aafaab0b
/branches/JavaBegin-master/src/com/epam/basic/java/begin/module2/task2/Bus.java
5f62e3a55df50c93c390b2ce5cde89172d8e415a
[]
no_license
ollyyasinski/Module7
56a70dbc79be983a7bf23560a7440e88d10fedd9
fd4836a71833e594dddbd3244756c56bb902ab9d
refs/heads/master
2021-01-21T07:25:46.509668
2017-05-17T19:51:13
2017-05-17T19:51:13
91,614,171
0
0
null
null
null
null
UTF-8
Java
false
false
1,268
java
package com.epam.basic.java.begin.module2.task2; import java.util.ArrayList; import java.util.List; public class Bus { List<BusStop> busStops = new ArrayList<BusStop>(); int currentBusStopIndex = 0; public Bus(List<BusStop> stops) { busStops = stops; } public void move() { BusStop currentStop = busStops.get(currentBusStopIndex); int nextBusStopIndex = currentBusStopIndex + 1; BusStop nextStop = busStops.get(nextBusStopIndex); System.out.println("Move from " + currentStop.name + " to " + nextStop.name); currentBusStopIndex = nextBusStopIndex; } public void add(Human human, Dog dog) { if (human.haveDog == true) { System.out.println(human.name + " and his dog " + dog.name + " gets on the bus at " + busStops.get(currentBusStopIndex).name); } else { System.out.println(human.name + " gets on the bus at " + busStops.get(currentBusStopIndex).name); } } public void remove(Human human, Dog dog) { if (human.haveDog == true) { System.out.println(human.name + " and his dog " + dog.name + " gets off the bus at " + busStops.get(currentBusStopIndex).name); } else { System.out.println(human.name + " gets off the bus at " + busStops.get(currentBusStopIndex).name); } } }
[ "volha yasinskaya" ]
volha yasinskaya
b9d8751bd9374fc4adad587f3b4afd14477a3ad9
b1f15f50cea813e626145958cb96b90a35ce3f0e
/app/src/main/java/com/example/daggerapp/di/qualifier/ApplicationContext.java
c6bdcbaecf99cc624c074b415cf2360d3d93af80
[]
no_license
sasmita22/Dagger-App
6754c2f5f9aa99dba9e809a3b2fe3bb3157d0f48
d827e8faaf338593fae2af4327d37b74bf03623f
refs/heads/master
2022-11-25T15:59:43.139592
2020-07-24T04:20:37
2020-07-24T04:20:37
281,639,809
0
0
null
null
null
null
UTF-8
Java
false
false
129
java
package com.example.daggerapp.di.qualifier; import javax.inject.Qualifier; @Qualifier public @interface ApplicationContext { }
7bebd1f3f8004c3ce7c00922fe7e181f86b0205b
8b91bb0cedddf50f825020a900187e747064be5e
/src/main/segrae/Anueio.java
3f0e48190e782d2ebb2b85f17b23565c87427856
[]
no_license
ValcirJr/SOLID
a2242b5965225b9ae9b70918186ea0a007e53007
3b319f2dd622d0e047989d4b2b3eb3be72215764
refs/heads/master
2023-08-11T06:53:24.695040
2021-10-15T00:50:26
2021-10-15T00:50:26
417,325,726
0
0
null
null
null
null
UTF-8
Java
false
false
378
java
package main.segrae; import java.math.BigDecimal; import java.time.LocalDate; public class Anueio implements Reajuste{ private BigDecimal valor; private LocalDate dataReajusteAnuenio; @Override public BigDecimal valor() { return this.valor; } @Override public LocalDate dataReajuste() { return this.dataReajusteAnuenio; } }
4ee1bd0556dbe64563d2c8538f2f7e04a50ebdb6
856ca3d7dcd1d9a7db9e605e7dfaa0c29ddd8e49
/MyIntent/app/src/main/java/org/techtown/myintent/MainActivity.java
e97a60784db9e894260be65266277028e672eb12
[]
no_license
hyun12345/android_tutorial
236facb5d58021f4dd2fb61a58f95f086f4d8676
97a6e15cba67dfd49a004d558824cdd78b5d4fe9
refs/heads/master
2020-04-02T20:02:38.773649
2018-10-26T01:47:04
2018-10-26T01:47:04
154,756,046
0
0
null
null
null
null
UTF-8
Java
false
false
1,763
java
package org.techtown.myintent; import android.content.Intent; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //xml layout ํŒŒ์ผ ์„œ๋กœ ์—ฐ๊ฒฐ์‹œ์ผœ์ฃผ๊ณ  ์žˆ์œผ๋ฏ€๋กœ MainActivity.java์™€ activity_main.xml์€ ํ•œ ์Œ์˜ ํŒŒ์ผ์ž„์„ ์•Œ ์ˆ˜ ์žˆ์Œ //-> xml layout ํŒŒ์ผ์„ layout inflation ํ–ˆ์Œ์„ ์•Œ ์ˆ˜ ์žˆ์Œ //layout inflation : xml ํŒŒ์ผ์˜ ๋ฒ„ํŠผ ๋“ฑ์„ ๋ฉ”๋ชจ๋ฆฌ ๊ฐ์ฒดํ™” -> ์ž๋ฐ” ์†Œ์Šค์ฝ”๋“œ์—์„œ ๋งํ•˜๋Š” ํ™”๋ฉด์— ๊ฐ–๋‹ค ๋ถ™์ž„ Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), MenuActivity.class); startActivityForResult(intent, 101); } }); } //MenuActivity์—์„œ intent๋กœ extraData ์ „๋‹ฌ //์‘๋‹ต์„ ๋ฐ›์•„์ฃผ๋Š” ๋ฉ”์†Œ๋“œ(intent ์ „๋‹ฌ ๋ฐ›๊ธฐ ๊ฐ€๋Šฅ) //requestCode : 101 @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == 101) { String name = data.getStringExtra("name"); Toast.makeText(getApplicationContext(), "๋ฉ”๋‰ดํ™”๋ฉด์œผ๋กœ๋ถ€ํ„ฐ ์‘๋‹ต : " + name, Toast.LENGTH_LONG).show(); } } }
acaa0b3f0f8076bd8e840e2480506493777fae12
7e7e7990d488ebb83a1e7fb2c892075aa6f64577
/app/src/main/java/com/myapplicationdev/android/p05_ndpsongs/MainActivity.java
be415bc6a19ffcdd53ea2270f17e7bfa53fc5eee
[]
no_license
CassandraNg/OurPotatoes
e8f6e6bab2dca7bc89f2127264bad6b3d0b1e389
9986ec558574427cc1f80d774b42ef8aa563c2a4
refs/heads/master
2023-07-12T00:15:40.152521
2021-08-04T07:13:25
2021-08-04T07:13:25
392,587,368
0
0
null
null
null
null
UTF-8
Java
false
false
2,740
java
package com.myapplicationdev.android.p05_ndpsongs; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.RatingBar; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; public class MainActivity extends AppCompatActivity { EditText etRName, etRecipe, etMin; Button btnInsert, btnShowList; RatingBar rBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setTitle(getTitle().toString() + " ~ " + getResources().getText(R.string.title_activity_main)); etRName = (EditText) findViewById(R.id.etRName); etRecipe = (EditText) findViewById(R.id.etRecipe); etMin = (EditText) findViewById(R.id.etMin); btnInsert = (Button) findViewById(R.id.btnInsertSong); btnShowList = (Button) findViewById(R.id.btnShowList); rBar = (RatingBar) findViewById(R.id.rBarStar); btnInsert.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String title = etRName.getText().toString().trim(); String singers = etRecipe.getText().toString().trim(); if (title.length() == 0 || singers.length() == 0){ Toast.makeText(MainActivity.this, "Incomplete data", Toast.LENGTH_SHORT).show(); return; } String year_str = etMin.getText().toString().trim(); int year = 0; try { year = Integer.valueOf(year_str); } catch (Exception e){ Toast.makeText(MainActivity.this, "Invalid time", Toast.LENGTH_SHORT).show(); return; } DBHelper dbh = new DBHelper(MainActivity.this); int stars = getStars(); dbh.insertSong(title, singers, year, stars); dbh.close(); Toast.makeText(MainActivity.this, "Inserted", Toast.LENGTH_LONG).show(); etRName.setText(""); etRecipe.setText(""); etMin.setText(""); } }); btnShowList.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent(MainActivity.this, SecondActivity.class); startActivity(i); } }); } private int getStars() { int stars = (int) rBar.getRating(); return stars; } }
e1f759095e83de0ad66f9e7b4198aea2cca40820
f0ac177c8825e87f6982023b636a3859206ea7bc
/DataStruceBase/datastructbase/08_HeapAndPriorityQueue/08_HeapAndPriorityQueue/src/Solution2.java
062e3db248b2a9ede62ae17b1d013f235fea6b1a
[]
no_license
EGjaedong/DataStructureAndAlgorithm
988e8868e6862c1ab041114761847f4cf313bc21
63e9f0c00435fd1b4f6669d7fa28852d66588425
refs/heads/master
2020-07-01T02:07:39.880443
2019-08-12T01:16:46
2019-08-12T01:16:46
201,015,640
0
0
null
null
null
null
UTF-8
Java
false
false
1,943
java
import java.util.LinkedList; import java.util.List; import java.util.TreeMap; import java.util.PriorityQueue; /** * Created by 63042 on 2019/7/14. * LeetCode347 * ไฝฟ็”จjava็š„PriorityQueue * java็š„priorityQueueๆ˜ฏๆœ€ๅฐๅ †ๅฎž็Žฐ็š„ */ public class Solution2 { private class Freq implements Comparable<Freq>{ public int e, freq; public Freq(int e, int freq){ this.e = e; this.freq = freq; } // ้ข‘ๆฌก่ถŠๅฐ๏ผŒไผ˜ๅ…ˆ็บง่ถŠ้ซ˜๏ผŒๆ”พๅœจ้˜Ÿ้ฆ–๏ผŒไนŸๅฐฑๆ˜ฏๅ †็š„ๆ น @Override public int compareTo(Freq another) { if (this.freq < another.freq) return -1; else if (this.freq > another.freq) return 1; else return 0; } } public List<Integer> topKFrequent(int[] nums, int k) { // ๅญ˜ๆ”พๅ…ƒ็ด ๅ’Œ้ข‘ๆฌก็ป„ๆˆ็š„้”ฎๅ€ผ๏ผŒ้”ฎไธบๅ…ƒ็ด ๏ผŒๅ€ผไธบ้ข‘ๆฌก TreeMap<Integer, Integer> map = new TreeMap<>(); // ็ปŸ่ฎก้ข‘ๆฌก for (int num : nums) { if (map.containsKey(num)) map.put(num, map.get(num) + 1); else map.put(num, 1); } // ๅฐ†ๅ‰kไธช้ข‘ๆฌกๅ…ƒ็ด ๅญ˜่ฟ›้˜Ÿๅˆ—ไธญ PriorityQueue<Freq> queue = new PriorityQueue<>(); for (int key : map.keySet()) { if (queue.size() < k) queue.add(new Freq(key, map.get(key))); else if (map.get(key) > queue.peek().freq){ queue.remove(); queue.add(new Freq(key, map.get(key))); } } // ๅญ˜่ฟ›listไธญ LinkedList<Integer> list = new LinkedList<>(); while (!queue.isEmpty()){ // ่ฟ™ไธช้ข˜๏ผŒไธ่ฆๆฑ‚ๅ…ƒ็ด ๆŒ‰็…ง้ข‘ๆฌกๆŽ’ๅบ๏ผŒๆ‰€ไปฅๆทปๅŠ ๅˆฐๅผ€ๅคดๆˆ–็ป“ๅฐพ้ƒฝๅฏไปฅใ€‚ list.add(queue.poll().e); // list.addFirst(queue.dequeue().e); } return list; } }
5a0cd02b0787b73a70af206a1a2547c4e048c04c
10e179e5d70b5e2a10ccd9ec38ff847167df5f13
/basecorelibrary/src/test/java/com/syc/speech/basecorelibrary/ExampleUnitTest.java
acb80939a264e5f4c3120c041236982642bcaf5b
[]
no_license
sunyuancun/SpeechAndOcr
7ed23b6ca90a7dfbcf77c7487289be26dbef9e47
10dff792ee9680b2c11315ca7c7434336e47b815
refs/heads/master
2020-03-26T05:36:02.766419
2018-08-13T10:34:31
2018-08-13T10:34:31
144,564,848
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package com.syc.speech.basecorelibrary; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
4ba874383fa8c0f483bb4170bf73defb494c35ee
da889968b2cc15fc27f974e30254c7103dc4c67e
/Optimization Algorithm_GUI/src/Algorithm_Carpool/SaNSDE_POP_NEW/Function.java
b84ebcc8c4755e139f6cd68862f2e64a3624e02f
[]
no_license
say88888/My_Project_thesis
fcd4d96b34de8627fa054146eb6164b7c3636344
04908ea3ed6b7a9c1939a5d8e16dfc65d66437f4
refs/heads/master
2020-04-10T08:32:37.106239
2018-12-08T05:52:44
2018-12-08T05:52:44
160,908,221
0
0
null
null
null
null
UTF-8
Java
false
false
2,838
java
package Algorithm_Carpool.SaNSDE_POP_NEW; import java.util.ArrayList; public class Function extends SaNSDE_POP_NEW{ static V_Individual Algorithm1_1(double F,Individual individual_r1,Individual individual_r2,Individual individual_r3,Individual individual,Individual individual_b) { V_Individual V=new V_Individual(); if(DE_Read_Write_txt.random_generate_or_read1(Execution_Mode)<p){ for(int i=0;i<Xsize;i++) V.setVx(i, individual_r1.getX(i)+F*(individual_r2.getX(i)-individual_r3.getX(i))); for(int i=0;i<Ysize;i++) V.setVy(i, individual_r1.getY(i)+F*(individual_r2.getY(i)-individual_r3.getY(i))); nf1+=1; strategy.add(1); }else{ for(int i=0;i<Xsize;i++) V.setVx(i, individual.getX(i)+F*(individual_b.getX(i)-individual.getX(i))+F*(individual_r1.getX(i)-individual_r2.getX(i))); for(int i=0;i<Ysize;i++) V.setVy(i, individual.getY(i)+F*(individual_b.getY(i)-individual.getY(i))+F*(individual_r1.getY(i)-individual_r2.getY(i))); nf2+=1; strategy.add(3); } for(int i=0;i<Xsize;i++){ if (V.getVx(i) > Vmax) V.setVx(i, Vmax); if (V.getVx(i) < -Vmax) V.setVx(i, -Vmax); } for(int i=0;i<Ysize;i++){ if (V.getVy(i) > Vmax) V.setVy(i, Vmax); if (V.getVy(i) < -Vmax) V.setVy(i, -Vmax); } return V; } static void Update_p_f_cr( ) { // Update pใ€ fใ€cr p=(ns1*(ns2+nf2))/(ns2*(ns1+nf1)+ns1*(ns2+nf2)); for(int i=0;i<populationSize;i++){ double sum=0; for(int k=0;k<frec.size();k++) sum+=frec.get(k); double sum1=0; for(int k=0;k<CRrec.size();k++){ double w=frec.get(k); w/=sum; sum1+=w*CRrec.get(k); } CRm=sum1; CR[i]=DE_Read_Write_txt.random_generate_or_read3(Execution_Mode)*0.1+CRm; if(DE_Read_Write_txt.random_generate_or_read1(Execution_Mode)<p) F[i]=DE_Read_Write_txt.random_generate_or_read3(Execution_Mode)*0.3+0.5; else F[i]=(Math.tan(Math.PI*(DE_Read_Write_txt.random_generate_or_read5(Execution_Mode)-0.5))); } ns1=0; ns2=0; nf1=0; nf2=0; CRrec = new ArrayList<Double>(); frec = new ArrayList<Double>(); } static U_Individual Algorithm2(int j,Individual indiv,V_Individual P_indiv) { int a= DE_Read_Write_txt.random_generate_or_read2(Execution_Mode,Xsize); U_Individual U=new U_Individual(); for(int i=0;i<Xsize;i++) U.setUx(i, indiv.getX(i)); for(int i=0;i<Ysize;i++) U.setUy(i, indiv.getY(i)); for(int i=0;i<Xsize;i++) if(DE_Read_Write_txt.random_generate_or_read1(Execution_Mode)<CR[j] || i==a) U.setUx(i,P_indiv.getVx(i)); a= DE_Read_Write_txt.random_generate_or_read2(Execution_Mode,Ysize); for(int i=0;i<Ysize;i++) if(DE_Read_Write_txt.random_generate_or_read1(Execution_Mode)<CR[j] || i==a) U.setUy(i,P_indiv.getVy(i)); return U; } }
6e5ea22431a49ba6da4ef860313d4dd7d49e8a83
134950f7f1315d92abc95a1cf6b9c6843dcb5a4b
/Chapter6/spring-bucks/src/main/java/com/geektime/springbucks/support/MoneySerializer.java
ade12d5c157b73b7229140093d8322d373a5a785
[]
no_license
jinrunheng/spring-family-learn
d773812afed625eb65d2d7e8ec1b9d13ddedc7da
b92a87bd7c116b1c2062cc811260a323167449e1
refs/heads/master
2023-04-12T16:18:52.332279
2021-05-10T08:19:27
2021-05-10T08:19:27
305,738,244
1
0
null
null
null
null
UTF-8
Java
false
false
674
java
package com.geektime.springbucks.support; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import org.joda.money.Money; import org.springframework.boot.jackson.JsonComponent; import java.io.IOException; @JsonComponent public class MoneySerializer extends StdSerializer<Money> { protected MoneySerializer() { super(Money.class); } @Override public void serialize(Money money, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { jsonGenerator.writeNumber(money.getAmount()); } }
eb032aa029e37fcd094aa07721d310ae140b99e7
2ff0adfa6863e51525a3538ee79e6e43a563a480
/src/main/java/mqtt/controller/HomeController.java
c573c799c225926ba54c8dc999dca8349017addf
[]
no_license
loind89/springboot-mqtt-demo
ef88e35ace1daa1a1622365b79c8e6b30cff2aee
447bf505b5bb195aa802b4a2ae2682c8fbaa1013
refs/heads/master
2020-07-22T23:22:45.780600
2015-03-29T19:00:24
2015-03-29T19:00:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
319
java
package mqtt.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; /** * Created by sfrensley on 3/14/15. */ @Controller public class HomeController { @RequestMapping({"/","home"}) public String home() { return "home"; } }
7a3933a72392efd0e82e840f12951f152de9a865
69e6f6822221088dbb6e27f731fc4d117c20aef3
/yiQu_Api/src/main/java/com/quanmai/yiqu/ui/grade/FetchBagRecordActivity.java
72a1e0b1d45c09df51d96409a36fc0a485e312bc
[]
no_license
zengweitao/YiQuLife
f7dd201be283dfd64f7348b4525d328e7b7b94a9
30dd021e56c8e0914e2e2c23705baf49ffa319ce
refs/heads/master
2021-01-01T18:10:57.454138
2017-07-25T06:38:40
2017-07-25T06:38:40
98,272,858
0
0
null
null
null
null
UTF-8
Java
false
false
5,568
java
package com.quanmai.yiqu.ui.grade; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshListView; import com.quanmai.yiqu.R; import com.quanmai.yiqu.Session; import com.quanmai.yiqu.api.ApiConfig; import com.quanmai.yiqu.api.UserInfoApi; import com.quanmai.yiqu.api.vo.FetchBagRecordInfo; import com.quanmai.yiqu.api.vo.UserInfo; import com.quanmai.yiqu.base.BaseActivity; import com.quanmai.yiqu.base.CommonList; import com.quanmai.yiqu.ui.grade.adapter.FetchBagAdapter; /** * ๅ–่ข‹่ฎฐๅฝ•้กต้ข */ public class FetchBagRecordActivity extends BaseActivity implements View.OnClickListener { private TextView tv_title; private PullToRefreshListView listView; private FetchBagAdapter mAdapter; private TextView textViewNoData; private LinearLayout linearLayoutNoData; private int currentPage=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fetch_bag_record); initView(); init(); getFetchBagRecordList(); } private void initView() { tv_title = (TextView) findViewById(R.id.tv_title); tv_title.setText("ๅ–่ข‹่ฎฐๅฝ•"); textViewNoData = (TextView) findViewById(R.id.textViewNoData); textViewNoData.setText("่ฟ˜ๆฒกๅ–่ข‹่ฎฐๅฝ•ๅ–ฒ"); linearLayoutNoData = (LinearLayout) findViewById(R.id.linearLayoutNoData); listView = (PullToRefreshListView) findViewById(R.id.listView); listView.setEmptyView(linearLayoutNoData); listView.setMode(PullToRefreshBase.Mode.BOTH); } private void init() { mAdapter = new FetchBagAdapter(mContext); listView.setAdapter(mAdapter); listView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() { @Override public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) { refreshData(); } @Override public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) { getFetchBagRecordList(); } }); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { getBagRecordList(position-1); } }); } private void refreshData(){ currentPage=0; getFetchBagRecordList(); } //่Žทๅ–ๅ–่ข‹่ฎฐๅฝ•ๅˆ—่กจ private void getFetchBagRecordList() { showLoadingDialog("ๆญฃๅœจ่Žทๅ–ๆ•ฐๆฎ..."); UserInfoApi.get().getFetchBagInfoList(mContext, currentPage,getIntent().getStringExtra("code"),new ApiConfig.ApiRequestListener<CommonList<FetchBagRecordInfo>>() { @Override public void onSuccess(String msg, CommonList<FetchBagRecordInfo> data) { dismissLoadingDialog(); listView.onRefreshComplete(); if (data == null) { return; } if (currentPage==0){ mAdapter.clear(); } currentPage++; if (currentPage<data.max_page){ listView.setMode(PullToRefreshBase.Mode.BOTH); }else { listView.setMode(PullToRefreshBase.Mode.PULL_FROM_START); } mAdapter.add(data); } @Override public void onFailure(String msg) { dismissLoadingDialog(); listView.onRefreshComplete(); showCustomToast(msg); } }); } /** * ่Žทๅ–ๆŒ‡ๅฎš่ฎพๅค‡็š„ๅ–่ข‹่ฏฆๆƒ… */ String phone=Session.get(mContext).getUsername(); private void getBagRecordList(final int position) { if (getIntent().hasExtra("phone")){ phone=getIntent().getStringExtra("phone"); } showLoadingDialog("ๆญฃๅœจ่Žทๅ–ๆ•ฐๆฎ..."); UserInfoApi.get().getBagInfoList(mContext, 0,mAdapter.getItem(position).terminalno, mAdapter.getItem(position).opetime,mAdapter.getItem(position).nums, phone,new ApiConfig.ApiRequestListener<CommonList<String>>() { @Override public void onSuccess(String msg, CommonList<String> data) { dismissLoadingDialog(); if (data == null) { return; } Intent intent = new Intent(mContext, FetchBagRecordDetailActivity.class); intent.putExtra("BagRecordInfo", mAdapter.getItem(position)); intent.putStringArrayListExtra("BagInfoList",data); intent.putExtra("phone",phone); intent.putExtra("max_page",data.max_page); mContext.startActivity(intent); } @Override public void onFailure(String msg) { dismissLoadingDialog(); showCustomToast(msg); } }); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.iv_back: { break; } } } }
cad8f17839765673eb90f2e87ab219133e12e7aa
1ec73a5c02e356b83a7b867580a02b0803316f0a
/java/bj/Java1200/col01/ch05_้ขๅ‘ๅฏน่ฑกๆŠ€ๆœฏๅบ”็”จ/ch05_1_Javaไธญ็ฑป็š„ๅฎšไน‰/_087_ๆž„้€ ๆ–นๆณ•็š„ๅบ”็”จ/PersonTest.java
0c63c5e84e84e2030d3cfc3c01147d61ffc28c12
[]
no_license
jxsd0084/JavaTrick
f2ee8ae77638b5b7654c3fcf9bceea0db4626a90
0bb835fdac3c2f6d1a29d1e6e479b553099ece35
refs/heads/master
2021-01-20T18:54:37.322832
2016-06-09T03:22:51
2016-06-09T03:22:51
60,308,161
0
1
null
null
null
null
UTF-8
Java
false
false
795
java
package bj.Java1200.col01.ch05_้ขๅ‘ๅฏน่ฑกๆŠ€ๆœฏๅบ”็”จ.ch05_1_Javaไธญ็ฑป็š„ๅฎšไน‰._087_ๆž„้€ ๆ–นๆณ•็š„ๅบ”็”จ; public class PersonTest { /** * ๆต‹่ฏ• * * @param args */ public static void main( String[] args ) { Person person1 = new Person(); Person person2 = new Person( "ๆ˜Žๆ—ฅ็ง‘ๆŠ€", "็”ท", 11 ); System.out.println( "ๅ‘˜ๅทฅ1็š„ไฟกๆฏ" ); System.out.println( "ๅ‘˜ๅทฅๅง“ๅ๏ผš" + person1.getName() ); System.out.println( "ๅ‘˜ๅทฅๆ€งๅˆซ๏ผš" + person1.getGender() ); System.out.println( "ๅ‘˜ๅทฅๅนด้พ„๏ผš" + person1.getAge() ); System.out.println( "ๅ‘˜ๅทฅ2็š„ไฟกๆฏ" ); System.out.println( "ๅ‘˜ๅทฅๅง“ๅ๏ผš" + person2.getName() ); System.out.println( "ๅ‘˜ๅทฅๆ€งๅˆซ๏ผš" + person2.getGender() ); System.out.println( "ๅ‘˜ๅทฅๅนด้พ„๏ผš" + person2.getAge() ); } }
de94d581acfee7f68d6f446418d46912208b7640
6d4734317ff05a7e3943092e4938ed0bad16d225
/ThinkingInJava/src/initialization/SimpleConstructor.java
34e35d5d88378baaae84f9ef6e98ed3fb93ef1e4
[]
no_license
By2048/Java
05cb9818cbecb5a9fd5d7edcffaed679c2bda989
4346b6ef0ba271dcc6b6d2fae5785356d7fe60f7
refs/heads/master
2021-01-11T18:53:05.174914
2017-12-09T17:25:41
2017-12-09T17:25:41
95,969,446
1
0
null
null
null
null
UTF-8
Java
false
false
403
java
//: initialization/SimpleConstructor.java package initialization; // Demonstration of a simple constructor. class Rock { Rock() { // This is the constructor System.out.println("Rock "); } } public class SimpleConstructor { public static void main(String[] args) { for(int i = 0; i < 10; i++) new Rock(); } } /* Output: Rock Rock Rock Rock Rock Rock Rock Rock Rock Rock *///:~
69ede4094a9c73d9801f3900134ea8fa14fe5102
a6bea5abda4cac2175098d7ccaa0eeed39250e9d
/com.qbao.aisr.stuff.algorithm/src/main/java/com/qbao/aisr/stuff/cache/PcCache.java
5855b322e2e4dd0f541a92769dd9e853831b3951
[]
no_license
jackandyao/stuff-core
be6cca6a33ed346d646d97961060e5a9c6c17c98
3c561a3b83c68b5385d7b2995530931e87492773
refs/heads/master
2021-05-09T03:20:37.936326
2018-01-28T07:26:45
2018-01-28T07:26:45
119,237,433
1
1
null
null
null
null
UTF-8
Java
false
false
346
java
package com.qbao.aisr.stuff.cache; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class PcCache { public static Map<String,List<String>> dirIdPcStuffIdListMap = new HashMap<String,List<String>>(); public static List<String> pcStuffIdDefault = new ArrayList<String>(); }
d85b082f3a3abcb62027ffeb362ea614c0388fe7
75bd6a42dc177a8c2e416829538d1f30ffd241f3
/src/main/java/com/xdx/util/RandomUtil.java
5eb1e7e785e5d8cf61ba3fc25f2d23edead2498c
[]
no_license
xdxxdx/blog
5febfe6b8e5d51ed2247f1dfd82374b84e669fc9
1df2c0aec5a73338b19c42dc82dcf97660324491
refs/heads/master
2022-12-25T04:23:35.756488
2019-06-23T11:09:06
2019-06-23T11:09:06
193,341,898
3
0
null
2022-12-16T07:46:13
2019-06-23T11:51:01
JavaScript
UTF-8
Java
false
false
492
java
package com.xdx.util; import java.util.Date; import java.util.Random; public class RandomUtil { /** * ่Žทๅ–ๆ—ถ้—ดๆˆณๅŠ ๅ››ไฝ้šๆœบๆ•ดๆ•ฐ * @return */ public static long getTimeStampPlusRand(){ return new Date().getTime()+getRandNum(1, 1000); } /** * ่Žทๅ–ไธ€ไธช้šๆœบๆ•ดๆ•ฐ * @param min * @param max * @return */ public static Integer getRandNum(int min,int max){ Random random = new Random(); int s = random.nextInt(max)%(max-min+1) + min; return s; } }
52d0236d57f7337970489947957d7ddecc11b735
70f6c19124c8936209650c6560e3235acdae1c79
/moviper-passive-views/src/main/java/com/mateuszkoslacz/moviper/base/view/activity/autoinject/passive/ViperAiPassiveActivity.java
0434f9488c5e94e439a49b72ef7864dd45e33c1d
[ "Apache-2.0" ]
permissive
mkoslacz/Moviper
5f30865c16eaea03b4206507ea15ce9187491ca7
7994cd8824ecc1b376919e047a67afbb6149d58c
refs/heads/master
2020-08-30T18:59:38.161162
2017-07-27T15:24:11
2017-07-27T15:24:11
66,210,591
93
15
null
2017-04-04T15:27:58
2016-08-21T17:10:59
Java
UTF-8
Java
false
false
1,261
java
package com.mateuszkoslacz.moviper.base.view.activity.autoinject.passive; import android.support.annotation.NonNull; import com.hannesdorfmann.mosby.mvp.MvpView; import com.mateuszkoslacz.moviper.base.view.activity.autoinject.ViperAiActivity; import com.mateuszkoslacz.moviper.iface.presenter.ViperPresenter; import com.mateuszkoslacz.moviper.iface.view.ContextHolder; import com.mateuszkoslacz.moviper.iface.view.ViperView; /** * Created by bwilk on 12/22/16. */ public abstract class ViperAiPassiveActivity<ViewType extends MvpView> extends ViperAiActivity<ViewType, ViperPresenter<ViewType>> implements ViperView { /** * <b>DO NOT</b> use this method because of a fact that this view should be completely passive * (independent from the presenter type)! <br> * Instead you should use getters to provide * event sources that will notify presenter after presenter's registration to them. To use * getPresenter() method you shall use non-passive Moviper view. * * @return raw {@link ViperPresenter}, so you can't call any custom methods on it anyway */ @NonNull @Override @Deprecated public ViperPresenter<ViewType> getPresenter() { return super.getPresenter(); } }
71f8446131d7ebcbf15dc0e5a9b34790b9bd4e3f
ce367b25e7b0b3389c8480d31883b50e7d43f031
/src/main/java/selenium4/NewWindow.java
5c379da057b91fe9ee39ba770ccfd3bfb2408b7f
[]
no_license
hemanathanmohan/Hemanathan_AzureTest
06a457cd9c5a783a62fabfafe5eb290ab88035d6
8765bfa99b4f4d631113b0fe03f4d68acd4727b9
refs/heads/main
2023-07-06T05:23:31.883256
2021-08-02T16:33:27
2021-08-02T16:33:27
392,020,013
0
0
null
null
null
null
UTF-8
Java
false
false
958
java
package selenium4; import java.io.File; import java.io.IOException; import org.apache.commons.io.FileUtils; import org.openqa.selenium.By; import org.openqa.selenium.OutputType; import org.openqa.selenium.WebElement; import org.openqa.selenium.WindowType; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.Test; import io.github.bonigarcia.wdm.WebDriverManager; public class NewWindow { @Test public void ElementSnap() throws IOException, InterruptedException { WebDriverManager.chromedriver().setup(); ChromeDriver d = new ChromeDriver(); d.get("https://www.google.com"); d.manage().window().maximize(); //to switch to new window ...method 1 d.switchTo().newWindow(WindowType.WINDOW).get("https://mvnrepository.com/"); //to switch to new window ...method 2 d.switchTo().newWindow(WindowType.WINDOW); d.navigate().to("https://mvnrepository.com/"); Thread.sleep(5000); d.close(); } }
4d6538c07b9690b995aa55c88f7c1e2159541663
ca4688531c0d8188e66733ebf97949944c8278ea
/WebResServer/src/test/java/org/unidal/webres/server/AllTests.java
19eaaa756028bd000b3d8bed2b3067f380f52c56
[]
no_license
qmwu2000/webres
274cf3f2c65fb53b2b06d4181d2b4d9ce3819dc5
4bacb5a9544bd41db4003f779270cb4bbe950593
refs/heads/master
2021-01-17T09:11:13.902019
2012-08-01T06:35:07
2012-08-01T06:35:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
494
java
package org.unidal.webres.server; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import org.unidal.webres.server.taglib.MyTaglibTest; import org.unidal.webres.server.template.JspTemplateTest; @RunWith(Suite.class) @SuiteClasses({ SimpleResourceServletTest.class, SimpleResourceFilterTest.class, /* .taglib */ MyTaglibTest.class, /* .template */ JspTemplateTest.class }) public class AllTests { }
d5f0d809ef31ef69ea7a9bfa07f06c96655359e8
e69e65c2f644357181624d761be8451e05411f71
/Desk.java
63b5841cab535ec495ad451ca872388f8f2b7889
[]
no_license
Amangeldy03kz/arkanoidgame
77731a99d542b3eb4d8307b47f3a14851d74ef05
7e15cae6c51cb0b9d50f46a3ea9ceee14e0635a6
refs/heads/master
2021-01-23T06:34:40.951954
2017-06-01T07:40:55
2017-06-01T07:40:55
93,030,045
0
0
null
null
null
null
UTF-8
Java
false
false
1,716
java
package arkanoid; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.Pane; public class Desk { private Pane panel; private Ball ball; private static final int DELAY = 1; private ImageView imv_b,imv_t; private Image image; private static final int WIDTH = 24; private static final int LENGTH = 120; private double x,h; private double y,v; private double dx = 10; public Desk(Pane p){ x = 340; h = 340; panel = p; imv_b = new ImageView(); imv_t = new ImageView(); image = new Image(getClass().getResourceAsStream("desk2.png")); imv_b.setImage(image); imv_t.setImage(image); panel.getChildren().add(imv_b); panel.getChildren().add(imv_t); imv_b.setX(340); imv_b.setY(575); imv_t.setX(340); imv_t.setY(10); } public void moveRightButtom(double maxX) { x += dx; if(x+LENGTH >= maxX){ x = maxX-LENGTH; } imv_b.setX(x); } public void moveLeftButtom(double maxX) { x -= dx; if(x <= 0){ x = 0; } imv_b.setX(x); } public void moveRightTop(double maxX) { h += dx; if(h+LENGTH >= maxX){ h = maxX-LENGTH; } imv_t.setX(h); } public void moveLeftTop(double maxX) { h -= dx; if(h <= 0){ h = 0; } imv_t.setX(h); } public double getX(){return x;} public double getH(){return h;} public double getWidth(){return WIDTH;} public double getLength(){return LENGTH;} }
63b9db74b2f83c81c869740553a2eeff3456e681
4237dd7e7bf749c37caaa9f828aa094d2c4ca4d8
/src/main/java/fst/sir/biblio/dao/TypeAdherentDao.java
ef6b7657166b0a9edd241e869bc9a97cf1bedc13
[]
no_license
ai-elabdellaoui/gestion_biblio_v3
1099e10327b255fb64b9f64adffc12f0935e9c0e
a67baf4e5d072c955a1d26e80f6b01e623af600c
refs/heads/master
2021-04-08T18:07:28.840936
2020-03-20T21:19:43
2020-03-20T21:19:43
248,798,131
0
0
null
null
null
null
UTF-8
Java
false
false
434
java
package fst.sir.biblio.dao; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import fst.sir.biblio.bean.Adherent; import fst.sir.biblio.bean.TypeAdherent; @Repository public interface TypeAdherentDao extends JpaRepository<TypeAdherent, Long> { List<Adherent> findByProfession(String profession); int deleteByProfession(String profession); }
939cfeb1a17652040d4ff1dc5ca26d037159b439
f92acf0e8a24a78c31ff5e26c87930462c4343da
/src/main/java/rpc/protocol/RpcDecoder.java
831c194eba8be95226e007ed5ef8a66c8b5e7e48
[]
no_license
zhangzd911/test
377183a810a0b6bf19e74d0a6d4b9bf9e228aa19
9223b7bddfcdc59c7990abf6470137ad29fc5d27
refs/heads/master
2023-07-18T11:21:11.391339
2021-08-31T06:29:13
2021-08-31T06:29:13
397,918,966
0
0
null
null
null
null
UTF-8
Java
false
false
1,502
java
package rpc.protocol; /* * @author zzd * ่งฃ็ ๅ™จ๏ผˆๅฐ†ๆŽฅๆ”ถ็š„ๆ•ฐๆฎ่ฝฌๆขๆˆๅฎžไฝ“็ฑป๏ผ‰ */ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.ByteToMessageDecoder; import java.util.List; public class RpcDecoder extends ByteToMessageDecoder { //็›ฎๆ ‡ๅฏน่ฑก็ฑปๅž‹่ฟ›่กŒ่งฃ็  private Class<?> target; public RpcDecoder(Class target) { this.target = target; } @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { if (in.readableBytes() < 4) { //ไธๅคŸ้•ฟๅบฆไธขๅผƒ return; } in.markReaderIndex(); //ๆ ‡่ฎฐไธ€ไธ‹ๅฝ“ๅ‰็š„readIndex็š„ไฝ็ฝฎ int dataLength = in.readInt(); // ่ฏปๅ–ไผ ้€่ฟ‡ๆฅ็š„ๆถˆๆฏ็š„้•ฟๅบฆใ€‚ByteBuf ็š„readInt()ๆ–นๆณ•ไผš่ฎฉไป–็š„readIndexๅขžๅŠ 4 if (in.readableBytes() < dataLength) { //่ฏปๅˆฐ็š„ๆถˆๆฏไฝ“้•ฟๅบฆๅฆ‚ๆžœๅฐไบŽๆˆ‘ไปฌไผ ้€่ฟ‡ๆฅ็š„ๆถˆๆฏ้•ฟๅบฆ๏ผŒๅˆ™resetReaderIndex. ่ฟ™ไธช้…ๅˆmarkReaderIndexไฝฟ็”จ็š„ใ€‚ๆŠŠreadIndex้‡็ฝฎๅˆฐmark็š„ๅœฐๆ–น in.resetReaderIndex(); return; } byte[] data = new byte[dataLength]; in.readBytes(data); Object obj = JSON.parseObject(data, target); //ๅฐ†byteๆ•ฐๆฎ่ฝฌๅŒ–ไธบๆˆ‘ไปฌ้œ€่ฆ็š„ๅฏน่ฑก System.out.println("ๆŽฅๅ—ๆ•ฐๆฎ๏ผš" + JSONObject.toJSONString(obj)); out.add(obj); } }
c1994c7e28a19da92f843d4df92761b6205d32c9
9f1b1a7c9249f2c45efc70823a6923cb2876d7b1
/android/app/src/main/java/com/sample/MainApplication.java
5be8cdbfe2a8b11441b9888e71549a65eaa3b389
[]
no_license
curlyCoder15/sample
a1f7c7a400dd8ff8f678f502ff7e38522aae02ec
3e8670bf06f7e4dbc411f47728b3fe5dced63564
refs/heads/master
2022-12-13T12:07:03.188196
2020-01-30T15:03:44
2020-01-30T15:03:44
237,234,605
0
0
null
null
null
null
UTF-8
Java
false
false
2,207
java
package com.sample; import android.app.Application; import com.facebook.react.ReactApplication; import com.horcrux.svg.SvgPackage; import com.reactnativecommunity.netinfo.NetInfoPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import com.sample.generated.BasePackageList; import com.swmansion.reanimated.ReanimatedPackage; import com.swmansion.rnscreens.RNScreensPackage; import com.swmansion.gesturehandler.react.RNGestureHandlerPackage; import org.unimodules.adapters.react.ReactAdapterPackage; import org.unimodules.adapters.react.ModuleRegistryAdapter; import org.unimodules.adapters.react.ReactModuleRegistryProvider; import org.unimodules.core.interfaces.Package; import org.unimodules.core.interfaces.SingletonModule; import expo.modules.constants.ConstantsPackage; import expo.modules.permissions.PermissionsPackage; import expo.modules.filesystem.FileSystemPackage; import java.util.Arrays; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider( new BasePackageList().getPackageList(), Arrays.<SingletonModule>asList() ); private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new SvgPackage(), new NetInfoPackage(), new ReanimatedPackage(), new RNGestureHandlerPackage(), new RNScreensPackage(), new ModuleRegistryAdapter(mModuleRegistryProvider) ); } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); } }
5de76e0f8cf6041bf38263979c7d6d795258648f
6763bdfff63683265c50bd4b7e511030f5dca318
/app/src/main/java/com/ls/fragmentation/demo/ui/view/BottomBarTab.java
19664c9eee9985fabe215cfbd805c696165abf6d
[]
no_license
liushuai95/Fragmentation
25a1da86e30f9257b04500da44fad51f17687c6c
091ceb0175592209724daa3016b48624efdbeb28
refs/heads/master
2020-12-07T15:11:24.482471
2020-01-15T09:03:52
2020-01-15T09:03:52
232,743,561
0
0
null
null
null
null
UTF-8
Java
false
false
5,811
java
package com.ls.fragmentation.demo.ui.view; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.AttributeSet; import android.util.TypedValue; import android.view.Gravity; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.DrawableRes; import androidx.core.content.ContextCompat; import com.ls.fragmentation.R; /** * Created by YoKeyword on 16/6/3. */ public class BottomBarTab extends FrameLayout { private ImageView mIcon; private TextView mTvTitle; private Context mContext; private int mTabPosition = -1; private TextView mTvUnreadCount; public BottomBarTab(Context context, @DrawableRes int icon, CharSequence title) { this(context, null, icon, title); } public BottomBarTab(Context context, AttributeSet attrs, int icon, CharSequence title) { this(context, attrs, 0, icon, title); } public BottomBarTab(Context context, AttributeSet attrs, int defStyleAttr, int icon, CharSequence title) { super(context, attrs, defStyleAttr); init(context, icon, title); } private void init(Context context, int icon, CharSequence title) { mContext = context; TypedArray typedArray = context.obtainStyledAttributes(new int[]{R.attr.selectableItemBackgroundBorderless}); Drawable drawable = typedArray.getDrawable(0); setBackgroundDrawable(drawable); typedArray.recycle(); LinearLayout lLContainer = new LinearLayout(context); lLContainer.setOrientation(LinearLayout.VERTICAL); lLContainer.setGravity(Gravity.CENTER); LayoutParams paramsContainer = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); paramsContainer.gravity = Gravity.CENTER; lLContainer.setLayoutParams(paramsContainer); mIcon = new ImageView(context); int size = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 27, getResources().getDisplayMetrics()); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(size, size); mIcon.setImageResource(icon); mIcon.setLayoutParams(params); mIcon.setColorFilter(ContextCompat.getColor(context, R.color.tab_unselect)); lLContainer.addView(mIcon); mTvTitle = new TextView(context); mTvTitle.setText(title); LinearLayout.LayoutParams paramsTv = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); paramsTv.topMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics()); mTvTitle.setTextSize(10); mTvTitle.setTextColor(ContextCompat.getColor(context, R.color.tab_unselect)); mTvTitle.setLayoutParams(paramsTv); lLContainer.addView(mTvTitle); addView(lLContainer); int min = dip2px(context, 20); int padding = dip2px(context, 5); mTvUnreadCount = new TextView(context); mTvUnreadCount.setBackgroundResource(R.drawable.bg_msg_bubble); mTvUnreadCount.setMinWidth(min); mTvUnreadCount.setTextColor(Color.WHITE); mTvUnreadCount.setPadding(padding, 0, padding, 0); mTvUnreadCount.setGravity(Gravity.CENTER); FrameLayout.LayoutParams tvUnReadParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, min); tvUnReadParams.gravity = Gravity.CENTER; tvUnReadParams.leftMargin = dip2px(context, 17); tvUnReadParams.bottomMargin = dip2px(context, 14); mTvUnreadCount.setLayoutParams(tvUnReadParams); mTvUnreadCount.setVisibility(GONE); addView(mTvUnreadCount); } @Override public void setSelected(boolean selected) { super.setSelected(selected); if (selected) { mIcon.setColorFilter(ContextCompat.getColor(mContext, R.color.colorPrimary)); mTvTitle.setTextColor(ContextCompat.getColor(mContext, R.color.colorPrimary)); } else { mIcon.setColorFilter(ContextCompat.getColor(mContext, R.color.tab_unselect)); mTvTitle.setTextColor(ContextCompat.getColor(mContext, R.color.tab_unselect)); } } public void setTabPosition(int position) { mTabPosition = position; if (position == 0) { setSelected(true); } } public int getTabPosition() { return mTabPosition; } /** * ่ฎพ็ฝฎๆœช่ฏปๆ•ฐ้‡ */ public void setUnreadCount(int num) { if (num <= 0) { mTvUnreadCount.setText(String.valueOf(0)); mTvUnreadCount.setVisibility(GONE); } else { mTvUnreadCount.setVisibility(VISIBLE); if (num > 99) { mTvUnreadCount.setText("99+"); } else { mTvUnreadCount.setText(String.valueOf(num)); } } } /** * ่Žทๅ–ๅฝ“ๅ‰ๆœช่ฏปๆ•ฐ้‡ */ public int getUnreadCount() { int count = 0; if (TextUtils.isEmpty(mTvUnreadCount.getText())) { return count; } if (mTvUnreadCount.getText().toString().equals("99+")) { return 99; } try { count = Integer.valueOf(mTvUnreadCount.getText().toString()); } catch (Exception ignored) { } return count; } private int dip2px(Context context, float dp) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics()); } }
da1e34fe87feabf710d2025f868ffb866a510e3f
1ab603cf59051477e9b05c05bbc1d60401cd9b2e
/src/test/java/com/ZAP_Selenium/ZapSecurityTest.java
2f77228cd7936eb260f1174f26089fe0ef2c3a20
[]
no_license
rajakumarks/zapintegrationwithselenium
64becf7272e6c8020b7eabf5463be51331cc4c99
6e0341b3382c72bd1bb673d8879c6abd0fed87bb
refs/heads/master
2022-12-29T09:14:01.685385
2020-07-21T19:16:07
2020-07-21T19:16:07
280,187,510
0
0
null
2020-10-13T23:47:25
2020-07-16T15:18:47
Java
UTF-8
Java
false
false
11,333
java
package com.ZAP_Selenium; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.IsEqual.equalTo; import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; import org.junit.*; import org.openqa.selenium.Proxy; import org.openqa.selenium.WebDriver; import org.zaproxy.clientapi.core.Alert; import com.ZAP_Selenium_BrowserDriver.BrowserDriverFactory; import com.ZAP_Selenium.WebSiteNavigation; import net.continuumsecurity.proxy.ScanningProxy; import net.continuumsecurity.proxy.Spider; import net.continuumsecurity.proxy.ZAProxyScanner; public class ZapSecurityTest { /* * Provide details about ZAP Proxy */ static Logger log = Logger.getLogger(ZapSecurityTest.class.getName()); private static final String ZAP_PROXYHOST = "localhost"; private static final int ZAP_PROXYPORT = 8098; private static final String ZAP_APIKEY = null; // Provide Chrome driver path //private static final String BROWSER_DRIVER_PATH = "C:\\chromedriver.exe"; private static final String BROWSER_DRIVER_PATH = "/Users/user/chromedriver"; private final static String MEDIUM = "MEDIUM"; private final static String HIGH = "HIGH"; private ScanningProxy zapScanner; private Spider zapSpider; private WebDriver driver; private WebSiteNavigation siteNavigation; private AlphaNavigation alpha; // Provide scan policy names private final static String[] policyNames = {"directory-browsing","cross-site-scripting", "sql-injection","path-traversal","remote-file-inclusion", "server-side-include","script-active-scan-rules", "server-side-code-injection","external-redirect", "crlf-injection"}; int currentScanID; // Create ZAP proxy by specifying proxy host and proxy port private static Proxy createZapProxyConfiguration() { Proxy proxy = new Proxy(); proxy.setHttpProxy(ZAP_PROXYHOST + ":" + ZAP_PROXYPORT); proxy.setSslProxy(ZAP_PROXYHOST + ":" + ZAP_PROXYPORT); return proxy; } /* * Method to configure ZAP scanner, API client and perform User Registration */ @Before public void setUp() throws Exception { // Configure ZAP Scanner zapScanner = new ZAProxyScanner(ZAP_PROXYHOST, ZAP_PROXYPORT, ZAP_APIKEY); // Start new session zapScanner.clear(); log.info("Started a new session: Scanner"); // Create ZAP API client zapSpider=(Spider) zapScanner; log.info("Created client to ZAP API"); // Create driver object driver = BrowserDriverFactory.createChromeDriver(createZapProxyConfiguration(), BROWSER_DRIVER_PATH); //driver = BrowserDriverFactory.createChromeDriver(BROWSER_DRIVER_PATH); siteNavigation = new WebSiteNavigation(driver); // First test the "Register a new user" siteNavigation.registerNewUser(); //alpha = new AlphaNavigation(driver); //alpha.registerNewUser(); } /* * Method to close the driver connection */ @After public void tearDown() { driver.quit(); } // ZAP Operations -- filterAlerts, setAlert_AttackStrength, activateZapPolicy, spiderwithZAP, scanWithZAP // --------------------------------------------------------------------------------------------------------- /* * Method to filter the generated alerts based on Risk and Confidence */ private List<Alert> filterAlerts(List<Alert> alerts) { List<Alert> filteredAlerts = new ArrayList<Alert>(); for (Alert alert : alerts) { // Filtering based on Risk: High and Confidence: Not Low if (alert.getRisk().equals(Alert.Risk.High) && alert.getConfidence() != Alert.Confidence.Low) filteredAlerts.add(alert); } return filteredAlerts; } /* * Method to specify the strength for the ZAP Scanner as High, Medium, or Low */ public void setAlert_AttackStrength() { for (String ZapPolicyName : policyNames) { String ids = activateZapPolicy(ZapPolicyName); for (String id : ids.split(",")) { zapScanner.setScannerAlertThreshold(id,MEDIUM); zapScanner.setScannerAttackStrength(id,HIGH); } } } /* * Method to configure the ZAP Scanner for specified security policies and enable the scanner */ private String activateZapPolicy(String policyName) { String scannerIds = null; // Compare the security policies and specify scannerIds (these scannerIds are standard) switch (policyName.toLowerCase()) { case "directory-browsing": scannerIds = "0"; break; case "cross-site-scripting": scannerIds = "40012,40014,40016,40017"; break; case "sql-injection": scannerIds = "40018"; break; case "path-traversal": scannerIds = "6"; break; case "remote-file-inclusion": scannerIds = "7"; break; case "server-side-include": scannerIds = "40009"; break; case "script-active-scan-rules": scannerIds = "50000"; break; case "server-side-code-injection": scannerIds = "90019"; break; case "remote-os-command-injection": scannerIds = "90020"; break; case "external-redirect": scannerIds = "20019"; break; case "crlf-injection": scannerIds = "40003"; break; case "source-code-disclosure": scannerIds = "42,10045,20017"; break; case "shell-shock": scannerIds = "10048"; break; case "remote-code-execution": scannerIds = "20018"; break; case "ldap-injection": scannerIds = "40015"; break; case "xpath-injection": scannerIds = "90021"; break; case "xml-external-entity": scannerIds = "90023"; break; case "padding-oracle": scannerIds = "90024"; break; case "el-injection": scannerIds = "90025"; break; case "insecure-http-methods": scannerIds = "90028"; break; case "parameter-pollution": scannerIds = "20014"; break; default : throw new RuntimeException("No policy found for: "+policyName); } zapScanner.setEnableScanners(scannerIds, true); return scannerIds; } /* * Method to configure spider settings, execute ZAP spider, log the progress and found URLs */ public void spiderWithZap() { log.info("Spidering started"); // Configure spider settings zapSpider.excludeFromSpider(WebSiteNavigation.LOGOUT_URL); zapSpider.setThreadCount(5); zapSpider.setMaxDepth(5); zapSpider.setPostForms(false); // Execute the ZAP spider zapSpider.spider(WebSiteNavigation.BASE_URL); int currentSpiderID = zapSpider.getLastSpiderScanId(); int progressPercent = 0; while (progressPercent < 100) { progressPercent = zapSpider.getSpiderProgress(currentSpiderID); log.info("Spider is " + progressPercent + "% complete."); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } // Log the found URLs after spider for (String url : zapSpider.getSpiderResults(currentSpiderID)) { log.info("Found URL after spider: "+url); } log.info("Spidering ended"); } /* * Method to execute scan and log the progress */ public void scanWithZap() { log.info("Scanning started"); // Execute the ZAP scanner zapScanner.scan(WebSiteNavigation.BASE_URL); int currentScanId = zapScanner.getLastScannerScanId(); int progressPercent = 0; while (progressPercent < 100) { progressPercent = zapScanner.getScanProgress(currentScanId); log.info("Scan is " + progressPercent + "% complete."); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } log.info("Scanning ended"); } // Test methods -- testVulnerabilitiesBeforeLogin, testVulnerabilitiesAfterLogin // --------------------------------------------------------------------------------------------------------- /* * Test method containing test steps like navigateBeforeLogin, spiderWithZAP, * setAlert_AttackStrength, scanWithZAP, filterAlerts, and * log the found alerts and assert the count of alerts */ @Test public void testVulnerabilitiesBeforeLogin() { siteNavigation.navigateBeforeLogin(); // Using ZAP Spider log.info("Started spidering"); spiderWithZap(); log.info("Ended spidering"); // Setting alert and attack setAlert_AttackStrength(); zapScanner.setEnablePassiveScan(true); // Using ZAP Scanner log.info("Started scanning"); scanWithZap(); log.info("Ended scanning"); List<Alert> generatedAlerts = filterAlerts(zapScanner.getAlerts()); for (Alert alert : generatedAlerts) { log.info("Alert: "+alert.getAlert()+" at URL: "+alert.getUrl()+" Parameter: "+alert.getParam()+" CWE ID: "+alert.getCweId()); } assertThat(generatedAlerts.size(), equalTo(0)); } /* * Test method containing test steps like loginAsUser, navigateAfterLogin, * spiderWithZAP, setAlert_AttackStrength, scanWithZAP, filterAlerts, and * log the found alerts and assert the count of alerts */ @Test public void testVulnerabilitiesAfterLogin() { siteNavigation.loginAsUser(); siteNavigation.navigateAfterLogin(); // Using ZAP Spider log.info("Started spidering"); spiderWithZap(); log.info("Ended spidering"); // Setting alert and attack setAlert_AttackStrength(); zapScanner.setEnablePassiveScan(true); // Using ZAP Scanner log.info("Started scanning"); scanWithZap(); log.info("Ended scanning"); List<Alert> generatedAlerts = filterAlerts(zapScanner.getAlerts()); for (Alert alert : generatedAlerts) { log.info("Alert: "+alert.getAlert()+" at URL: "+alert.getUrl()+" Parameter: "+alert.getParam()+" CWE ID: "+alert.getCweId()); } assertThat(generatedAlerts.size(), equalTo(0)); } }
3cd0f793a1940bea65fca3780cd00d04d0c58aef
dd828509ecc90ca77997e8b6a1276c559140d025
/b2c/b2c-upload/src/main/java/com/mr/controller/UploadController.java
c365d6f3deb4b033effb639a166d9c6d0aaafdb6
[]
no_license
wanghaizhou123/MR1
8a011452e7ea262d8c1da4ede46ba669b172394c
72bc26b83815368f031f77a35be71ac9341bfafc
refs/heads/master
2022-12-13T07:48:41.399392
2020-09-04T12:59:53
2020-09-04T12:59:53
292,847,140
0
0
null
null
null
null
UTF-8
Java
false
false
867
java
package com.mr.controller; import com.mr.service.UploadService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; @RestController @RequestMapping(value = "upload") public class UploadController { @Autowired private UploadService service; @PostMapping("image") public ResponseEntity<String> upload(@RequestParam("file")MultipartFile file) throws IOException { String url= service.uploadImg(file); return ResponseEntity.ok(url); } }
29e2d9d5d2a794c8e1873a0ad3c1d478d4dbb39f
16e18d1e56d0b6790614e8a372c72c9b015ba0f5
/Q63.java
f1bdc6d40169a84e2742a80abe9f517a98dd7b55
[]
no_license
subhamrajput/CoreJava-Assignment
0fe026f567dd7d2e29ef9600cb8cb00535aeaf81
34f2d4c1238cb555a08144aaf84748aa62105ab5
refs/heads/master
2022-12-26T00:25:32.887356
2020-10-06T17:22:36
2020-10-06T17:22:36
296,423,440
0
0
null
null
null
null
UTF-8
Java
false
false
514
java
package p3; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; public class Q63 { public static void main(String[] args) throws IOException { FileInputStream f=new FileInputStream("E:\\core java\\dir\\abc.txt"); DataInputStream f2=new DataInputStream(f); int count=0; while(f2.available()>0) { if((char)f2.read()=='T' || (char)f2.read()=='t') { count++; } } System.out.println("Number of T or t in file is "+count); } }
ceb17f5a3f94ed890031a6bab1271e486ffa9e79
c7b1bc125a37c688f8a6832b733ededfcd06f426
/src/main/java/com/github/rimevel/rimesroofs/setup/Registry.java
a343941e0e2967d30ea95bb8a8ba136ad4df8d6f
[ "MIT" ]
permissive
Rimevel/RimesRoofs
0f24913499ddd1e8ad0bf124c928675c6f8cb1ea
d77817d634ca0bb379e21f05ee722aab11276dec
refs/heads/main
2023-08-07T18:19:06.278529
2021-09-26T23:18:32
2021-09-26T23:18:32
410,684,142
0
0
null
null
null
null
UTF-8
Java
false
false
3,103
java
package com.github.rimevel.rimesroofs.setup; import com.github.rimevel.rimesroofs.Rimesroofs; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.tags.BlockTags; import net.minecraft.tags.ITag; import net.minecraft.util.ResourceLocation; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import java.util.function.Supplier; public class Registry { public static void register() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); Items.ITEMS.register(modEventBus); Blocks.BLOCKS.register(modEventBus); } public static final class Items { public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Rimesroofs.MOD_ID); /*--Items--*/ /*--Registration methods--*/ private static <T extends Item> RegistryObject<T> register(String name, Supplier<T> item) { return ITEMS.register(name, item); } } public static final class Blocks { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Rimesroofs.MOD_ID); /*--Blocks--*/ //Oak Roof public static final RegistryObject<Block> ROOF_OAK = register("roof_oak", () -> { return new Block(AbstractBlock.Properties.of(Material.WOOD).strength(2, 2).harvestLevel(0).sound(SoundType.WOOD)); }); /*--Registration methods--*/ private static <T extends Block> RegistryObject<T> registerNoItem(String name, Supplier<T> block) { return BLOCKS.register(name, block); } private static <T extends Block> RegistryObject<T> register(String name, Supplier<T> block) { RegistryObject<T> obj = registerNoItem(name, block); Items.ITEMS.register(name, () -> { return new BlockItem(obj.get(), new Item.Properties().tab(ItemGroup.TAB_BUILDING_BLOCKS)); }); return obj; } } public static final class Tags { public static final class Blocks { /*--Tags--*/ public static final ITag.INamedTag<Block> ROOF_COMPATIBLE = mod("mod_compatible"); /*--Registration methods--*/ private static ITag.INamedTag<Block> forge(String path) { return BlockTags.bind(new ResourceLocation("forge", path).toString()); } private static ITag.INamedTag<Block> mod(String path) { return BlockTags.bind(new ResourceLocation(Rimesroofs.MOD_ID, path).toString()); } } public static final class Items { } } }
ce229f34468975811ba2f745a6d6d3cdd59cc3d9
2717854f82f867b983d0551de1cf147cd7cb7bc1
/app/mef/presenters/replies/ComputerReply.java
a5dfc5a8e5bafff6f5d8f17bf07d93513fc4b96c
[]
no_license
ianrae/mcomputer
20687d8154adb89000fd45428763d76106f1c95e
717b5084bf797777ce460cc326982d8609c30fd4
refs/heads/master
2021-01-01T19:11:20.038979
2013-10-27T14:51:09
2013-10-27T14:51:09
13,455,416
1
0
null
null
null
null
UTF-8
Java
false
false
497
java
//THIS FILE HAS BEEN AUTO-GENERATED. DO NOT MODIFY. package mef.presenters.replies; import java.util.List; import java.util.Map; import mef.entities.Computer; import mef.presenters.MyPage; import org.mef.framework.replies.Reply; import com.avaje.ebean.Page; public class ComputerReply extends Reply { // public List<Computer> _allL; public Page<Computer> page; public Computer _entity; //for New and Create public Map<String,String> _options; public ComputerReply() { } }
e59d8ba5b406defff89246e6b3541994ba25b092
5cc2ecc12777c9aa23eeba2fefa93b6bbe372d59
/javapro/src/FlowLayoutTest.java
9de1cb31e054b841502eca72fc90174b2e243215
[]
no_license
oneso123456789/project
bbffaabbc3547a7a6e369543419c55b4f5017751
3096d17604b4d15746e71de6c72e444054aaf0df
refs/heads/master
2020-03-22T17:21:19.891954
2018-02-20T08:29:36
2018-02-20T08:29:36
null
0
0
null
null
null
null
UHC
Java
false
false
1,369
java
import java.awt.Button; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.Panel; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class FlowLayoutTest { private Frame f; private Button b1, b2, b3, b4, b5; public FlowLayoutTest() { // ํ”„๋ ˆ์ž„ ๊ฐ์ฒด ์ƒ์„ฑ f = new Frame("FlowLayout"); // ๋‹ค์„ฏ ๊ฐœ์˜ ๋ฒ„ํŠผ ๊ฐ์ฒด๋“ค์„ ์ƒ์„ฑ b1 = new Button("Button1"); b2 = new Button("Button2"); b3 = new Button("Button3"); b4 = new Button("Button4"); b5 = new Button("Button5"); // ์œˆ๋„์šฐ ์ข…๋ฃŒ ์ด๋ฒคํŠธ f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); // Panel์„ ์ƒ์„ฑํ•œ ํ›„, ๋ฒ„ํŠผ๋“ค์„ Panel์— ๋ถ™์ž„ // Panel p = new Panel(); // p.add(b1); // p.add(b2); // p.add(b3); // p.add(b4); // p.add(b5); // ํ”„๋ ˆ์ž„์˜ ๋ฐฐ์น˜๊ด€๋ฆฌ์ž๋ฅผ BorderLayout๊ด€๋ฆฌ์ž์—์„œ // FlowLayout๊ด€๋ฆฌ์ž๋กœ ๋ณ€๊ฒฝํ•˜๋ผ๋Š” ์˜๋ฏธ f.setLayout(new FlowLayout()); // Panel์„ Frame์˜ Center์— ๋ถ™์ž„ f.add(b1); f.add(b2); f.add(b3); f.add(b4); f.add(b5); // Frame์˜ ์‚ฌ์ด์ฆˆ๋ฅผ ๊ฒฐ์ •ํ•˜๊ณ  ํ™”๋ฉด์— ์ถœ๋ ฅํ•จ f.setSize(400, 100); f.setVisible(true); } public static void main(String[] args) { FlowLayoutTest ft = new FlowLayoutTest(); } }
b687b9c3db50538008807b0c8e42bc0aa872d0fe
79595075622ded0bf43023f716389f61d8e96e94
/app/src/main/java/com/google/android/mms/pdu/AcknowledgeInd.java
b43a94891a9ee311acfa74efa51e89ce50e79712
[]
no_license
dstmath/OppoR15
96f1f7bb4d9cfad47609316debc55095edcd6b56
b9a4da845af251213d7b4c1b35db3e2415290c96
refs/heads/master
2020-03-24T16:52:14.198588
2019-05-27T02:24:53
2019-05-27T02:24:53
142,840,716
7
4
null
null
null
null
UTF-8
Java
false
false
863
java
package com.google.android.mms.pdu; import com.google.android.mms.InvalidHeaderValueException; public class AcknowledgeInd extends GenericPdu { public AcknowledgeInd(int mmsVersion, byte[] transactionId) throws InvalidHeaderValueException { setMessageType(133); setMmsVersion(mmsVersion); setTransactionId(transactionId); } AcknowledgeInd(PduHeaders headers) { super(headers); } public int getReportAllowed() { return this.mPduHeaders.getOctet(145); } public void setReportAllowed(int value) throws InvalidHeaderValueException { this.mPduHeaders.setOctet(value, 145); } public byte[] getTransactionId() { return this.mPduHeaders.getTextString(152); } public void setTransactionId(byte[] value) { this.mPduHeaders.setTextString(value, 152); } }
5a71bae10cfba828837028cc428abda0763c1a4b
c4a1ee5a470679125680d0e524eca17491187019
/web-service/src/main/java/com/jgermaine/fyp/rest/util/StringUtil.java
c0300f765529b91cb503a5a799a26e7bb8f0332b
[]
no_license
JasonGermaine/Council-Alert
c4fdbf94410c046a36265263f12b32e3c023f97d
9939e160adca6f059d2e18e91ee8d1f8ce2f2847
refs/heads/master
2016-09-06T17:31:24.352985
2015-04-27T15:30:39
2015-04-27T15:30:39
24,409,975
0
1
null
null
null
null
UTF-8
Java
false
false
287
java
package com.jgermaine.fyp.rest.util; public final class StringUtil { /** * Determines whether a string is not null and not empty * * @param value * @return isValid */ public static boolean isNotNullOrEmpty(String value) { return value != null && !value.isEmpty(); } }
ea84c1f72857c07b4f427f197e65dd563d100887
1c8cbb51dc485cfe0bb8515a3e7a8b6b34769e61
/app/src/main/java/apptribus/com/tribus/activities/chat_tribu/mvp/ChatTribuView.java
bac14a87eb4fbeea1098c58e8dd17e8dc14b29b9
[]
no_license
djeane/tribus
f8992249ed4409f9f8a94b7eab4a2a18baf9a7b8
e819db0e093159da7547464135e8d76162e40735
refs/heads/main
2023-01-31T07:36:30.429111
2020-12-12T19:38:28
2020-12-12T19:38:28
320,908,312
0
0
null
null
null
null
UTF-8
Java
false
false
7,174
java
package apptribus.com.tribus.activities.chat_tribu.mvp; import android.annotation.SuppressLint; import android.net.Uri; import android.support.annotation.NonNull; import android.support.constraint.ConstraintLayout; import android.support.design.widget.AppBarLayout; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.AppCompatImageView; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; import com.google.android.flexbox.FlexboxLayout; import com.jakewharton.rxbinding.view.RxView; import com.jakewharton.rxbinding.widget.RxTextView; import java.util.ArrayList; import apptribus.com.tribus.R; import apptribus.com.tribus.util.NpaLinearLayoutManager; import butterknife.BindView; import butterknife.ButterKnife; import hani.momanii.supernova_emoji_library.Helper.EmojiconEditText; import rx.Observable; import static apptribus.com.tribus.util.Constantes.FROM_NOTIFICATION; import static apptribus.com.tribus.util.Constantes.LINK_INTO_MESSAGE; import static apptribus.com.tribus.util.Constantes.TOPIC_KEY; import static apptribus.com.tribus.util.Constantes.TOPIC_NAME; import static apptribus.com.tribus.util.Constantes.TRIBU_KEY; import static apptribus.com.tribus.util.Constantes.TRIBU_NAME; import static apptribus.com.tribus.util.Constantes.TRIBU_UNIQUE_NAME; @SuppressLint("ViewConstructor") public class ChatTribuView extends FrameLayout { @BindView(R.id.relative_chat_tribu) RelativeLayout mRelativeChatTribu; @BindView(R.id.appBarLayout) AppBarLayout mAppBar; @BindView(R.id.toolbar_chat_tribu) Toolbar mToolbarChat; @BindView(R.id.arrow_back) ImageView mBtnArrowBack; @BindView(R.id.tv_topic) TextView mTvTopic; @BindView(R.id.tv_name_tribu) TextView mTvTribuName; @BindView(R.id.rv_chat) public RecyclerView mRvChat; @BindView(R.id.constraint_edit) ConstraintLayout mConstraintEdit; @BindView(R.id.et_chat) EmojiconEditText mEtChat; @BindView(R.id.fab_send) FloatingActionButton mFabSend; @BindView(R.id.flex_icons_chat) FlexboxLayout mFlexIconsChat; @BindView(R.id.iv_docs) ImageView mIvDocs; //@BindView(R.id.iv_localization) //ImageView mIvLocation; //@BindView(R.id.iv_contacts) //ImageView mIvContacts; @BindView(R.id.iv_voice) ImageView mIvVoice; @BindView(R.id.iv_camera) ImageView mIvCamera; @BindView(R.id.iv_gallery) ImageView mIvGallery; //TO REPLY MESSAGE @BindView(R.id.relative_reply_message) RelativeLayout mRelativeReplyMessage; @BindView(R.id.tv_reply_username) TextView mTvReplyUsername; @BindView(R.id.tv_reply_message) TextView mTvReplyMessage; @BindView(R.id.iv_close_reply) ImageView mIvCloseReplay; @BindView(R.id.progressbar_top) public ProgressBar mProgressBarTop; public String mTribuUniqueName; public String mTribuKey; public String mTopicKey; public String mTopicName; public String mTribuName; public LinearLayoutManager mLayoutManager; //TO SAVE AND SHOW VIDEO public Uri mVideoUri; public String mVideoPath; //TO SAVE AND SHOW VIDEO public Uri mImageUri; public String mImagePath; public AppCompatActivity mContext; public String fromNotification; public String mLink; public ChatTribuView(@NonNull AppCompatActivity activity) { super(activity); mContext = activity; inflate(activity, R.layout.activity_chat_tribu, this); ButterKnife.bind(this); mTribuUniqueName = activity.getIntent().getStringExtra(TRIBU_UNIQUE_NAME); mTopicKey = activity.getIntent().getStringExtra(TOPIC_KEY); mTribuKey = activity.getIntent().getStringExtra(TRIBU_KEY); mTopicName = activity.getIntent().getStringExtra(TOPIC_NAME); mTribuName = activity.getIntent().getStringExtra(TRIBU_NAME); fromNotification = activity.getIntent().getStringExtra(FROM_NOTIFICATION); mLink = activity.getIntent().getStringExtra(LINK_INTO_MESSAGE); //TO SAVE AND SHOW VIDEO mVideoUri = activity.getIntent().getData(); mVideoPath = activity.getIntent().getExtras().getString("video_path"); //TO SAVE AND SHOW IMAGE mImageUri = activity.getIntent().getData(); mImagePath = activity.getIntent().getExtras().getString("image_path"); //SET RECYCLER VIEW mLayoutManager = new LinearLayoutManager(getContext()); mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); mLayoutManager.setReverseLayout(true); mRvChat.setLayoutManager(mLayoutManager); setOverflowButtonColor(activity, getResources().getColor(R.color.colorIcons)); } public static void setOverflowButtonColor(final AppCompatActivity activity, final int color) { //final String overflowDescription = activity.getString(R.string.abc_action_menu_overflow_description); final String overflowDescription = activity.getString(R.string.arrow_back); final ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView(); final ViewTreeObserver viewTreeObserver = decorView.getViewTreeObserver(); viewTreeObserver.addOnGlobalLayoutListener(() -> { final ArrayList<View> outViews = new ArrayList<>(); decorView.findViewsWithText(outViews, overflowDescription, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION); if (outViews.isEmpty()) { return; } AppCompatImageView overflow = (AppCompatImageView) outViews.get(0); overflow.setColorFilter(color); }); } public Observable<Void> observeClickBtnVoiceRecord(){ return RxView.clicks(mIvVoice); } public Observable<CharSequence> observeETChat(){ return RxTextView.textChanges(mEtChat); } public Observable<Void> observeBtnArrowBack(){ return RxView.clicks(mBtnArrowBack); } public Observable<Void> observeBtnSend(){ return RxView.clicks(mFabSend); } public Observable<Void> observeIbCamera(){ return RxView.clicks(mIvCamera); } public Observable<Void> observeIbShare(){ return RxView.clicks(mIvGallery); } public Observable<Void> observeIbDocs(){ return RxView.clicks(mIvDocs); } /*public Observable<Void> observeIbLocation(){ return RxView.clicks(mIvLocation); } public Observable<Void> observeIbContacts(){ return RxView.clicks(mIvContacts); }*/ public Observable<Void> observeToolbarClicks(){ return RxView.clicks(mToolbarChat); } public Observable<Void> observeIvCloseReplay(){ return RxView.clicks(mIvCloseReplay); } }
6cacb11aa69e2034a7d7bb71fc4ebe1286d6ba03
9620f456d1702d2252726c068f77ef3accca5f85
/CommonSearch/fragments/SearchGlobalReultFragment.java
3091d141b6be97633d83096e718b9a0cda6176a7
[]
no_license
pankajkamlegate6/moneyCProject
408b0993996d868781b6d3d5d550fbedf61ec693
ab03a2757db49830d33374a6bcc0c5c3a562a75d
refs/heads/master
2021-01-10T05:23:28.533720
2016-02-26T07:35:39
2016-02-26T07:35:39
52,585,523
0
0
null
null
null
null
UTF-8
Java
false
false
41,181
java
package com.moneycontrol.handheld.CommonSearch.fragments; import java.util.ArrayList; import android.content.Context; import android.content.Intent; import android.content.res.Resources.NotFoundException; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.text.Html; import android.text.Html.ImageGetter; import android.text.Spannable; import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextPaint; import android.text.TextUtils; import android.text.style.ClickableSpan; import android.text.style.ImageSpan; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.AbsListView.OnScrollListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener; import com.handmark.pulltorefresh.library.PullToRefreshListView; import com.moneycontrol.handheld.AppData; import com.moneycontrol.handheld.BaseActivity; import com.divum.MoneyControl.R; import com.moneycontrol.handheld.constant.AppConstants; import com.moneycontrol.handheld.entity.market.SearchData; import com.moneycontrol.handheld.entity.search.SearchMessageData; import com.moneycontrol.handheld.fragments.StockDetailFragment; import com.moneycontrol.handheld.massages.fragments.BaseFragement; import com.moneycontrol.handheld.massages.fragments.MessageTopicDetail; import com.moneycontrol.handheld.massages.fragments.SearchMessageFragment; import com.moneycontrol.handheld.massages.fragments.SearchMessageReultFragment.Search_home_Adapter; import com.moneycontrol.handheld.parser.ParseCall; import com.moneycontrol.handheld.util.Utility; public class SearchGlobalReultFragment extends BaseFragement implements StockDetailFragment.OnCategoryClicked { private View viewInflated; private LinearLayout llSpinner; private String spinnerItems[]; private PullToRefreshListView list = null; private ArrayList<SearchData> resultsseachData = null; private ArrayList<SearchData> tempData = new ArrayList<SearchData>(); private Search_home_Adapter adapter; private String htmlwhiteOrangeString = "<font color=#CCCCCC><b>%s</b></font> <font color=#FF9933>%s</font>"; private String msg_type_html = "<font color=#FFFFFF><b>"; private String category_type_html = "<font color=#999999><b>"; private String htmlString = "<font size='6' color=#FFFFFF><b></b>"; private String htmlString1 = "<font size='6' color=#FFFFFF><b></b>"; private String htmlString2 = "<font size='6' color=#999999><b></b>"; private String valhtmlString = "<font size='6' color=#FFFFFF><b>%s</b></font><font color=#999999>%s</font><font color=#999999>%s</font>"; private String news_side_drawablehtml = "<img src=\"icon_search.png\" align=\"justify\"/>"; private String smallside_drawablehtml = "<img src=\"latest11.png\" align=\"justify\"/>"; private String valhtmltwoString = "<font size='6' color=#FFFFFF><b>%s</b></font><font color=#999999>%s</font>"; private String no_match_drawablehtml = "<img src=\"exclamation.png\" align=\"justify\"/>"; private static final int REQUEST_CODE = 1234; private TextView no_recordFoundtxt = null; private String search_word = ""; private String screen_name = ""; private String screenID = ""; private String base_url = ""; private SearchMessageData searchMessageObj = new SearchMessageData(); private Handler handler = null; private boolean pulltorefresh = false; private Handler myHandler = new Handler(); public boolean isPagination = false; private int currentPageMessages = 0; private boolean isProcessingNetworkThread = false; boolean noLoaderwhilePull; private RelativeLayout progressBarr; private int postion = 0; @Override public void onSaveInstanceState(Bundle outState) { // TODO Auto-generated method stub super.onSaveInstanceState(outState); outState.putSerializable("SaveData", tempData); outState.putString("UNIQUE_ID", screenID); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { postion = getArguments().getInt("Position"); tag = "" + postion; super.onCreateView(inflater, container, savedInstanceState); viewInflated = inflater.inflate(R.layout.search_result_blank_layout, container, false); return viewInflated; } @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); } @Override public void onViewCreated(View view, Bundle savedInstanceState) { // TODO Auto-generated method stub super.onViewCreated(view, savedInstanceState); // if (savedInstanceState != null) { // if (saveBundle == null) { // saveBundle = savedInstanceState; // } // } if (saveBundle != null) { tempData = (ArrayList<SearchData>) saveBundle .getSerializable("SaveData"); screenID = saveBundle.getString("UNIQUE_ID"); } else { search_word = getArguments().getString("KEY"); searchMessageObj = (SearchMessageData) getArguments() .getSerializable("Object"); tempData = (ArrayList<SearchData>) getArguments().getSerializable( "list"); screenID = getArguments().getString("UNIQUE_ID"); screen_name = getArguments().getString("ScreenName"); base_url = getArguments().getString(AppConstants.SERVER_URL); } isPagination = true; initViews(); } public void sendResult(String arg1, String arg3, int arg2) { Intent i = new Intent(); Bundle informacion = new Bundle(); informacion.putString("arg1", arg1); informacion.putInt("arg2", arg2); informacion.putString("arg3", arg3); i.putExtras(informacion); if (resultsseachData != null) { Fragment frag = getTargetFragment(); if (frag != null) { frag.onActivityResult(getTargetRequestCode(), 1, i); } else { Fragment bfrag = ((BaseActivity) getActivity()) .getCurrentfragment("GlobalSearchFragment"); bfrag.onActivityResult(getTargetRequestCode(), 1, i); } } } private void initViews() { // list = (ListView) viewInflated.findViewById(R.id.getQuote_list1); // tempData = resultsseachData; list = (PullToRefreshListView) viewInflated .findViewById(R.id.getQuote_list1); progressBarr = (RelativeLayout) viewInflated .findViewById(R.id.progressBarr); dismissProgressLoader(); list.setOnRefreshListener(new OnRefreshListener<ListView>() { @Override public void onRefresh(PullToRefreshBase<ListView> refreshView) { // doGetNews(false); noLoaderwhilePull = true; pulltorefresh = true; currentPageMessages = 0; isProcessingNetworkThread = true; doRequest(); } }); list.setOnScrollListener(new OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { if (tempData.size() > 1) { if (view.getLastVisiblePosition() > (tempData.size() - 1) && !isProcessingNetworkThread && isPagination) { try { isProcessingNetworkThread = true; currentPageMessages++; doRequest(); // (++currentPageMessages); } catch (Exception e) { e.printStackTrace(); isProcessingNetworkThread = false; } } } } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { // TODO Auto-generated method stub } }); list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { // TODO Auto-generated method stub Utility.getInstance().hideKeyBoard(getActivity()); int pos = position - 1; try { if (screenID.equalsIgnoreCase("1")) { if (pos > -1) if (tempData.get(pos) != null && tempData.get(pos).getCategory_id() != null && tempData.get(pos).getType() .equalsIgnoreCase("searchCatgory")) { if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("1")) { sendResult(screen_name, tempData.get(pos) .getCategory(), 1); } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("2")) { sendResult(screen_name, tempData.get(pos) .getCategory(), 2); } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("3")) { sendResult(screen_name, tempData.get(pos) .getCategory_id(), 3); } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("4")) { sendResult(screen_name, tempData.get(pos) .getCategory(), 4); } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("5")) { sendResult(screen_name, tempData.get(pos) .getCategory(), 5); } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("6")) { sendResult(screen_name, tempData.get(pos) .getCategory(), 6); } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("7")) { sendResult(screen_name, tempData.get(pos) .getCategory(), 7); } } } } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { if (tempData != null && tempData.get(pos) != null && tempData.get(pos).getId() != null && (!tempData.get(pos).getId() .equalsIgnoreCase("null")) && (!tempData.get(pos).getId() .equalsIgnoreCase("item"))) { try { if (TextUtils.isEmpty(tempData.get(pos) .getExpiry_date_d())) { tempData.get(pos).setExpiry_date_d("null"); } } catch (Exception e) { // TODO Auto-generated catch block tempData.get(pos).setExpiry_date_d("null"); e.printStackTrace(); } try { if (TextUtils.isEmpty(tempData.get(pos) .getInstrument())) { tempData.get(pos).setInstrument("null"); } } catch (Exception e) { // TODO Auto-generated catch block tempData.get(pos).setInstrument("null"); e.printStackTrace(); } String name = tempData.get(pos).getShortname() + "@" + tempData.get(pos).getId() + "@" + tempData.get(pos).getCategory_id() + "@" + tempData.get(pos).getEx() + "@" + tempData.get(pos).getExpiry_date() + "@" + tempData.get(pos).getExpiry_date_d() + "@" + tempData.get(pos).getInstrument() + "@" + Utility.getInstance().getSELECTED_LANGUAGE(); Utility.getInstance().addLastCommonSearch(name, getActivity()); if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("1")) { showStockDetails(tempData.get(pos)); } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("2")) { showMutualFundskDetails(tempData.get(pos)); } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("3")) { showCommodityDetails(tempData.get(pos)); } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("4")) { showFutureDetails(tempData.get(pos)); // } } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("5")) { } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("6")) { } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("7")) { } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("8")) { // boarder lunchBoarderScreen(tempData.get(pos).getId()); } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("9")) { // topic launchTopicScreen(tempData.get(pos).getTopicid(), tempData.get(pos).getCategory_id(), "GlobalSearchFragment"); } else if (tempData.get(pos).getCategory_id() .equalsIgnoreCase("10")) { // boarder lunchIndicesDeatilsScreen(tempData.get(pos)); } } } catch (Exception e) { e.printStackTrace(); } } }); no_recordFoundtxt = (TextView) viewInflated .findViewById(R.id.no_recordFound); // AddData(); if (saveBundle != null) { // myHandler.post(updateRunnable); AddData(); } else { doRequest(); } } public void doRequest() { if (isCompataible11()) { new NetworkTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { new NetworkTask().execute(); } } public void AddData() { try { list.setVisibility(View.VISIBLE); if (tempData.size() > 0) { try { if (tempData.get(0).getId() != null) { // do nothing } else { tempData.get(0).setId("null"); } } catch (Exception e) { // TODO Auto-generated catch block tempData.get(0).setId("null"); e.printStackTrace(); } } if (tempData.size() > 0) { try { if (!tempData.get(0).getId().equalsIgnoreCase("null")) { adapter = new Search_home_Adapter(tempData, getActivity(), false); list.getRefreshableView().setAdapter(adapter); adapter.notifyDataSetChanged(); list.onRefreshComplete(); pulltorefresh = false; } else { list.setVisibility(View.GONE); } } catch (Exception e) { // TODO Auto-generated catch block list.setVisibility(View.GONE); e.printStackTrace(); } } else { list.setVisibility(View.GONE); } list.onRefreshComplete(); if (tempData != null && tempData.size() > 0 && tempData.get(0).getId().equalsIgnoreCase("null") && (!tempData.get(0).getId().equalsIgnoreCase("item"))) { no_recordFoundtxt.setText(getActivity().getResources() .getString(R.string.no_record_found)); no_recordFoundtxt.setVisibility(View.VISIBLE); list.setVisibility(View.GONE); } else { if (tempData == null || (tempData != null && tempData.size() == 0)) { no_recordFoundtxt.setText(getActivity().getResources() .getString(R.string.no_record_found)); no_recordFoundtxt.setVisibility(View.VISIBLE); list.setVisibility(View.GONE); } } isProcessingNetworkThread = false; } catch (Exception e) { e.printStackTrace(); } } public class Search_home_Adapter extends BaseAdapter { private LayoutInflater inflate = null; private ArrayList<SearchData> items = null; private final Context context; private boolean isSettings = false; // private Context context = null; public Search_home_Adapter(ArrayList<SearchData> item, Context con, boolean isSetting) { inflate = (LayoutInflater) con .getSystemService(Context.LAYOUT_INFLATER_SERVICE); // context = con; items = item; context = con; isSettings = isSetting; } @Override public int getCount() { return items.size(); } @Override public Object getItem(int arg0) { return items.get(arg0); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; SearchData searchObj = items.get(position); if (convertView == null) { LayoutInflater inflater = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate( R.layout.search_message_item_layout, null); holder = new ViewHolder(); holder.heading = (TextView) convertView .findViewById(R.id.search_item_name); holder.marketmovers_item_name_ll = (LinearLayout) convertView .findViewById(R.id.search_item_name_ll); Utility.getInstance().setTypeface(holder.heading, context.getApplicationContext()); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } try { if (screenID.equalsIgnoreCase("1")) { if (items.get(position).getType() .equalsIgnoreCase("header")) { holder.heading.setText(Html.fromHtml(msg_type_html + items.get(position).getCategory() + "</b></font>")); holder.marketmovers_item_name_ll .setBackgroundColor(Color.BLACK); } else if (items.get(position).getType() .equalsIgnoreCase("searchCatgory")) { holder.heading .setText(Html.fromHtml(String.format( htmlwhiteOrangeString, items.get(position).getCategory(), "(" + items.get(position) .getMsg_counts() + ")"))); holder.marketmovers_item_name_ll .setBackgroundColor(Color.TRANSPARENT); } else if (items.get(position).getType() .equalsIgnoreCase("serachOBJ")) { String str = createString(items.get(position), items .get(position).getCategory_id()); Spanned htmlSpan = null; if (items.get(position) != null) { String categoryName = Utility.getInstance() .toTitleCase( items.get(position).getCategory()); if (items.get(position).getCategory_id() .equalsIgnoreCase("4") || items.get(position).getCategory_id() .equalsIgnoreCase("3")) { if (str.length() > 0) { htmlSpan = Html.fromHtml(String.format( valhtmlString, items.get(position) .getShortname() + " " + items.get(position) .getExpiry_date_d() + "&nbsp" + "&nbsp" + "&nbsp", categoryName + "<br>", str, "")); } else { htmlSpan = Html.fromHtml(String.format( valhtmlString, items.get(position) .getShortname() + " " + items.get(position) .getExpiry_date_d() + "&nbsp" + "&nbsp" + "&nbsp", categoryName + "<br>", "", "")); } Drawable d = getResources().getDrawable( R.drawable.latest2); d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); SpannableString spantxt = new SpannableString( htmlSpan); int index = spantxt.toString().indexOf( categoryName); if (index != -1) { ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE); spantxt.setSpan(span, index - 1, index, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); holder.heading .setText(addClickablePart( getActivity(), spantxt, search_word)); holder.heading .setLinkTextColor(getActivity() .getResources().getColor( R.color.orange)); } } else { if (str.length() > 0) { // htmlSpan = Html.fromHtml(String.format( // valhtmlString, items.get(position) // .getShortname() // + "&nbsp" // + "&nbsp" + "&nbsp", // categoryName, str, "")); htmlSpan = Html.fromHtml(String.format( valhtmlString, items.get(position) .getShortname() + "&nbsp" + "&nbsp" + "&nbsp", categoryName + "<br>", str, "")); } else { htmlSpan = Html.fromHtml(String.format( valhtmlString, items.get(position) .getShortname() + "&nbsp" + "&nbsp" + "&nbsp", categoryName, "")); } Drawable d = getResources().getDrawable( R.drawable.latest2); d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); SpannableString spantxt = new SpannableString( htmlSpan); int index = spantxt.toString().indexOf( categoryName); if (index != -1) { ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE); spantxt.setSpan(span, index - 1, index, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); holder.heading .setText(addClickablePart( getActivity(), spantxt, search_word)); holder.heading .setLinkTextColor(getActivity() .getResources().getColor( R.color.orange)); } } } holder.marketmovers_item_name_ll .setBackgroundColor(Color.parseColor("#000000")); } } else if (screenID.equalsIgnoreCase("2") || screenID.equalsIgnoreCase("3") || screenID.equalsIgnoreCase("4") || screenID.equalsIgnoreCase("5")) { if (items.get(position).getType() .equalsIgnoreCase("header")) { holder.heading.setText(Html.fromHtml(msg_type_html + items.get(position).getCategory() + "</b></font>" + msg_type_html + items.get(position).getMsg_counts())); holder.marketmovers_item_name_ll .setBackgroundColor(Color.parseColor("#343434")); } else if (items.get(position).getType() .equalsIgnoreCase("nomatch_found")) { holder.heading.setText(Html.fromHtml("" + no_match_drawablehtml + "" + msg_type_html + '"' + "NO Matches" + '"' + "</b></font>" + category_type_html + "-" + items.get(position).getCategory() + "</b></font>", exclationimgGetter, null)); } else if (items.get(position).getType() .equalsIgnoreCase("searchCatgory")) { // holder.heading.setText(Html.fromHtml( // "" + news_side_drawablehtml + "" + msg_type_html // + '"' + search_word + '"' + "</b></font>" // + category_type_html // + items.get(position).getCategory() // + "</b></font>", imgGetter, null)); // holder.marketmovers_item_name_ll.setBackgroundColor(Color // .parseColor("#FF9933")); } else if (items.get(position).getType() .equalsIgnoreCase("serachOBJ")) { String str = createString(items.get(position), items .get(position).getCategory_id()); Spanned htmlSpan = null; if (items.get(position) != null) { String categoryName = Utility.getInstance() .toTitleCase( items.get(position).getCategory()); if (items.get(position).getCategory_id() .equalsIgnoreCase("4") || items.get(position).getCategory_id() .equalsIgnoreCase("3")) { if (str.length() > 0) { htmlSpan = Html.fromHtml(String.format( valhtmlString, items.get(position) .getShortname() + " " + items.get(position) .getExpiry_date_d() + "&nbsp" + "&nbsp" + "&nbsp", categoryName + "<br>", str, "")); } else { htmlSpan = Html.fromHtml(String.format( valhtmlString, items.get(position) .getShortname() + " " + items.get(position) .getExpiry_date_d() + "&nbsp" + "&nbsp" + "&nbsp", categoryName + "<br>", "", "")); } Drawable d = getResources().getDrawable( R.drawable.latest2); d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); SpannableString spantxt = new SpannableString( htmlSpan); int index = spantxt.toString().indexOf( categoryName); if (index != -1 && index > 1) { ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE); spantxt.setSpan(span, index - 1, index, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); holder.heading .setText(addClickablePart( getActivity(), spantxt, search_word)); holder.heading .setLinkTextColor(getActivity() .getResources().getColor( R.color.orange)); } } else { if (str.length() > 0) { // htmlSpan = Html.fromHtml(String.format( // valhtmlString, items.get(position) // .getShortname() // + "&nbsp" // + "&nbsp" + "&nbsp", // categoryName, str, "")); htmlSpan = Html.fromHtml(String.format( valhtmlString, items.get(position) .getShortname() + "&nbsp" + "&nbsp" + "&nbsp", categoryName + "<br>", str, "")); } else { htmlSpan = Html .fromHtml(String.format( valhtmltwoString, items .get(position) .getShortname() + "&nbsp" + "&nbsp" + "&nbsp", categoryName, "")); } Drawable d = getResources().getDrawable( R.drawable.latest2); d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); SpannableString spantxt = new SpannableString( htmlSpan); int index = spantxt.toString().indexOf( categoryName); if (index != -1 && index > 1) { ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE); spantxt.setSpan(span, index - 1, index, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); holder.heading .setText(addClickablePart( getActivity(), spantxt, search_word)); holder.heading .setLinkTextColor(getActivity() .getResources().getColor( R.color.orange)); } } } holder.marketmovers_item_name_ll .setBackgroundColor(getActivity() .getResources().getColor( R.color.black_transparency)); } } } catch (NotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } return convertView; } class ViewHolder { public TextView heading; public LinearLayout marketmovers_item_name_ll; } } public String createString(SearchData searchData, String id) { Log.i("createStringid = ", id); String resultString = ""; String resultString1 = ""; String resultString2 = ""; String resultString3 = ""; String resultString4 = ""; String resultString5 = ""; if (!id.equalsIgnoreCase("4") && !id.equalsIgnoreCase("3")) { if (searchData.getIsinid() != null && searchData.getIsinid().toString().length() > 0) { resultString1 = "" + " " + searchData.getIsinid(); } else { resultString1 = ""; } if (searchData.getNseid() != null && searchData.getNseid().toString().length() > 0) { if (resultString1.trim().length() == 0) { resultString2 = "" + " " + searchData.getNseid(); } else { resultString2 = "," + " " + searchData.getNseid(); } } else { resultString2 = ""; } if (searchData.getBseid() != null && searchData.getBseid().toString().length() > 0) { if (resultString2.trim().length() == 0) { resultString3 = "" + " " + searchData.getBseid(); } else { resultString3 = "," + " " + searchData.getBseid(); } } else { resultString3 = ""; } } else { if (searchData.getIsinid() != null && searchData.getIsinid().toString().length() > 0) { resultString1 = "" + " " + searchData.getIsinid(); } else { resultString1 = ""; } if (searchData.getNseid() != null && searchData.getNseid().toString().length() > 0) { if (resultString1.trim().length() == 0) { resultString2 = "" + " " + searchData.getNseid(); } else { resultString2 = "," + " " + searchData.getNseid(); } } else { resultString2 = ""; } if (searchData.getBseid() != null && searchData.getBseid().toString().length() > 0) { if (resultString2.trim().length() == 0) { resultString3 = "" + " " + searchData.getBseid(); } else { resultString3 = "," + " " + searchData.getBseid(); } } else { resultString3 = ""; } if (searchData.getSymbol_name() != null && searchData.getSymbol_name().toString().length() > 0) { if (resultString3.trim().length() == 0) { resultString4 = searchData.getSymbol_name(); } else { resultString4 = "," + " " + searchData.getSymbol_name(); } } else { resultString4 = ""; } if (searchData.getEx() != null) { if (resultString4.trim().length() == 0) { if (searchData.getEx().equalsIgnoreCase("N")) { resultString5 = "NSE"; } else if (searchData.getEx().equalsIgnoreCase("B")) { resultString5 = "BSE"; } } else { if (searchData.getEx().equalsIgnoreCase("N")) { resultString5 = "," + " " + "NSE"; } else if (searchData.getEx().equalsIgnoreCase("B")) { resultString5 = "," + " " + "BSE"; } } } } resultString = resultString1 + resultString2 + resultString3 + resultString4 + resultString5; return resultString; } public void loadrelatedPage(int id) { if (screen_name.equalsIgnoreCase("Stocks")) { if (resultsseachData != null) { Bundle bundle = new Bundle(); bundle.putString(AppConstants.TOPIC_ID, resultsseachData .get(id).getTopicid()); Log.i("Topic id = ", "" + resultsseachData.get(id).getTopicid()); MessageTopicDetail topicDetailFragment = new MessageTopicDetail(); topicDetailFragment.setArguments(bundle); } // // ((BaseActivity) getActivity()) // .launchNavigateFragement(topicDetailFragment); } else { Intent i = new Intent(); Bundle informacion = new Bundle(); // informacion.putString("value", // resultsseachData.get(id).getCategory()); informacion.putInt("value", id); i.putExtras(informacion); if (resultsseachData != null) { Fragment f = getTargetFragment(); if (f != null) { if (f instanceof SearchMessageFragment) { f.onActivityResult(getTargetRequestCode(), 2, i); } } } } } private ImageGetter imgGetter = new ImageGetter() { public Drawable getDrawable(String source) { Drawable drawable = null; drawable = getResources().getDrawable(R.drawable.icon_search); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); return drawable; } }; private ImageGetter exclationimgGetter = new ImageGetter() { public Drawable getDrawable(String source) { Drawable drawable = null; drawable = getResources().getDrawable(R.drawable.exclamation); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); return drawable; } }; @Override public void isNSEClicked(boolean isNSESelected, int pagerPosition) { // TODO Auto-generated method stub } private SpannableStringBuilder addClickablePart( final FragmentActivity mContext, Spanned charSequence, String trailing) { SpannableStringBuilder ssb = new SpannableStringBuilder(charSequence); int idx1 = charSequence.toString().toLowerCase() .indexOf(trailing.toLowerCase().trim()); int idx2 = 0; if (idx1 != -1) { idx2 = idx1 + trailing.length(); ssb.setSpan(new ClickSpan(false), idx1, idx2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } return ssb; } private class ClickSpan extends ClickableSpan { public ClickSpan(boolean usertag) { // TODO Auto-generated constructor stub this.usertag = usertag; } boolean usertag = false; @Override public void onClick(View widget) { // Toast.makeText(mContext, intValue, Toast.LENGTH_SHORT).show(); } @Override public void updateDrawState(TextPaint ds) { // TODO Auto-generated method stub super.updateDrawState(ds); ds.setUnderlineText(false); } } @Override public void onRefresh() { // TODO Auto-generated method stub } // For Refresh Loading Data private class NetworkTask extends AsyncTask<Integer, Void, Bundle> { // private CustomProgressDialog progressDialog = null; private ProgressBar progressBar = null; private boolean showProgressBar = false; public NetworkTask() { // TODO Auto-generated constructor stub } public NetworkTask(boolean showProgressBar) { // TODO Auto-generated constructor stub this.showProgressBar = showProgressBar; } @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); if (!pulltorefresh) { if (noLoaderwhilePull == false) { startProgressLoader(); } } } @Override protected Bundle doInBackground(Integer... params) { // int pageNo = params[0]; Bundle bundle = new Bundle(); SearchMessageData searchObj = null; final AppData MainController = AppData.getInstance(); if (!MainController.hasConnection()) { ((getActivity())).runOnUiThread(new Runnable() { @Override public void run() { Utility.getInstance().showAlertDialog( getActivity(), getActivity().getResources().getString( R.string.no_internet), null); } }); return null; } else { try { searchObj = ParseCall.getInstance() .getallNewSerachDataWithoutSuggestions( getActivity(), currentPageMessages, base_url, ""); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (searchObj != null) { bundle.putSerializable("obj", searchObj); } return bundle; } @Override protected void onPostExecute(Bundle result) { super.onPostExecute(result); noLoaderwhilePull = false; dismissProgressLoader(); if (result != null) { searchMessageObj = (SearchMessageData) result .getSerializable("obj"); if (searchMessageObj != null) { myHandler.post(updateRunnable); } } } } private void startProgressLoader() { // TODO Auto-generated method stub // if(pageNo[0]==0||pageNo[1]==0){ if (getUserVisibleHint()) { progressBarr.setVisibility(View.VISIBLE); } } private void dismissProgressLoader() { // TODO Auto-generated method stub progressBarr.setVisibility(View.GONE); } final Runnable updateRunnable = new Runnable() { public void run() { try { // call the activity method that updates the UI if (isAdded()) { if (searchMessageObj != null) { no_recordFoundtxt.setVisibility(View.GONE); if (resultsseachData != null) { if (resultsseachData.size() > 0) resultsseachData.clear(); } resultsseachData = searchMessageObj.getSerachMsglist(); if (resultsseachData != null) { if (screenID.equalsIgnoreCase("1")) { String a = searchMessageObj .getPoppularCategories(); String name[] = a.split(","); ArrayList<SearchData> TMPsseachData = new ArrayList<SearchData>(); SearchData headerobj = null; if (name.length > 1) { for (int i = 0; i < name.length; i++) { if (i == 0) { headerobj = new SearchData(); headerobj.setType("header"); headerobj.setId("item"); headerobj.setCategory(name[0]); // headerobj.setPlaceid(0); } else if (i > 0) { SearchData obj = new SearchData(); obj.setId("item"); String b = name[i]; if (b.contains("&")) { String splitarr[] = b .split("&"); ArrayList<String> fields = new ArrayList<String>(); if (splitarr.length > 1) { fields.add(splitarr[0]); fields.add(splitarr[1]); } else { fields.add(splitarr[0]); fields.add("0"); } String str = fields.get(0); String[] splitids = str .split("@"); if (splitids.length > 0) { obj.setType("searchCatgory"); obj.setCategory(splitids[0]); obj.setCategory_id(splitids[1]); obj.setMsg_counts(fields .get(1)); } else { obj.setType("searchCatgory"); obj.setCategory(splitids[0]); obj.setCategory_id("0"); obj.setMsg_counts(fields .get(1)); } } else { obj.setType("searchCatgory"); obj.setCategory(name[i]); obj.setCategory_id("0"); obj.setMsg_counts("0"); } TMPsseachData.add(i - 1, obj); } if (i == name.length - 1) { TMPsseachData.add(i, headerobj); } } } try { if (!resultsseachData.get(0).getId() .equalsIgnoreCase("null")) { TMPsseachData.addAll(resultsseachData); resultsseachData.clear(); resultsseachData.addAll(TMPsseachData); } else if (TMPsseachData.size() > 0 && resultsseachData.get(0).getId() .equalsIgnoreCase("null") && currentPageMessages == 0) { // TMPsseachData.addAll(resultsseachData); resultsseachData.clear(); resultsseachData.addAll(TMPsseachData); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } if (currentPageMessages != 0) { if (resultsseachData != null && resultsseachData.size() > 0) { if (!resultsseachData.get(0).getId() .equalsIgnoreCase("null")) { isPagination = true; } else { isPagination = false; } } else { isPagination = false; } if (resultsseachData != null && resultsseachData.size() > 0) { if (!resultsseachData.get(0).getId() .equalsIgnoreCase("null")) { tempData.addAll(resultsseachData); } } adapter.notifyDataSetChanged(); list.onRefreshComplete(); pulltorefresh = false; } else { if (tempData != null) { tempData.clear(); } else { tempData = new ArrayList<SearchData>(); } if (resultsseachData != null && resultsseachData.size() > 0) { // if (!resultsseachData.get(0).getId() // .equalsIgnoreCase("null")) { // // } tempData.addAll(resultsseachData); } try { adapter = new Search_home_Adapter(tempData, getActivity(), false); list.getRefreshableView().setAdapter(adapter); adapter.notifyDataSetChanged(); list.onRefreshComplete(); pulltorefresh = false; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (tempData != null && tempData.size() > 0) { } else { if (tempData != null && tempData.size() == 0) { try { no_recordFoundtxt.setText(getActivity() .getResources().getString( R.string.no_record_found)); no_recordFoundtxt .setVisibility(View.VISIBLE); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { no_recordFoundtxt.setVisibility(View.GONE); } } isProcessingNetworkThread = false; } } } catch (Exception e) { } } }; }
d4e8bf974162975452fe4d224e1b1a58e6b5c43d
9a64467fa78cda23bb2bfcc09d0c6c547eeb42ff
/JFileSysLib/src/jfilesyslib/exceptions/NotAFileException.java
4774275d1d9947ab0943ab65608233fc30b89f6b
[]
no_license
MarcMil/JFileSysLib
ee4feb0505846c83043a16ac3cf5abeea53addd9
616d573ac99fb9d12cd9880251b683dbcf02b047
refs/heads/master
2021-01-18T14:18:30.036456
2013-08-26T14:13:48
2013-08-26T14:13:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
314
java
package jfilesyslib.exceptions; /** * May be thrown if the given path is a file/symbolic link to a directory/symbolic link to a directory, * e.g. if openFile("/") is called * @author Marc Miltenberger */ public class NotAFileException extends Exception { private static final long serialVersionUID = 0; }
6291a91955d5ab300f281d0f6c6da74d9bef5958
3d256f83092d1d55473239656478516efba97f4b
/AssetManagement-Asset-Service/src/main/java/com/cg/AssetManagementAssetServiceApplication.java
8b4f2ba332862a0da1ab921fae47c91e4fbd41ef
[]
no_license
adityasovani/Sprint-2-Bakcend
4d92e161ea1604fc4f7568cc6e41296579bc9a9b
561ba5861b7b13778d6de8f36e9f62332fedd2a4
refs/heads/master
2022-08-24T10:58:31.375931
2020-05-14T05:16:09
2020-05-14T05:16:09
263,820,834
0
0
null
null
null
null
UTF-8
Java
false
false
436
java
package com.cg; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @SpringBootApplication @EnableDiscoveryClient public class AssetManagementAssetServiceApplication { public static void main(String[] args) { SpringApplication.run(AssetManagementAssetServiceApplication.class, args); } }
e07fe718292a8f7915db0e11d343c2ae820ed38e
f567c98cb401fc7f6ad2439cd80c9bcb45e84ce9
/src/main/java/com/alipay/api/response/AlipayMerchantMrchsurpActivitysignupCreateResponse.java
c7f00fa3e7316e5b601824590ad89aa04e55395b
[ "Apache-2.0" ]
permissive
XuYingJie-cmd/alipay-sdk-java-all
0887fa02f857dac538e6ea7a72d4d9279edbe0f3
dd18a679f7543a65f8eba2467afa0b88e8ae5446
refs/heads/master
2023-07-15T23:01:02.139231
2021-09-06T07:57:09
2021-09-06T07:57:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
769
java
package com.alipay.api.response; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.AlipayResponse; /** * ALIPAY API: alipay.merchant.mrchsurp.activitysignup.create response. * * @author auto create * @since 1.0, 2021-06-25 14:02:36 */ public class AlipayMerchantMrchsurpActivitysignupCreateResponse extends AlipayResponse { private static final long serialVersionUID = 2854488781815619481L; /** * ๆŠฅๅๆˆๅŠŸๅŽ่ฟ”ๅ›žๆŠฅๅ่ฎฐๅฝ•ID๏ผŒๆŠฅๅๅคฑ่ดฅๆ— ่ฏฅๅญ—ๆฎต */ @ApiField("signup_record_id") private String signupRecordId; public void setSignupRecordId(String signupRecordId) { this.signupRecordId = signupRecordId; } public String getSignupRecordId( ) { return this.signupRecordId; } }
d7108c2d3e3d88085043c43e5c83ddb1e9f44d83
3d38c7198eaf456523daa6fabfa5b969a0fe0be1
/src/searchSorting/HeapSortDemo.java
185f2b92ca7ae7c6e62c309d00d8b95c02a5948d
[]
no_license
deepikakaushal39/SearchAndSorting
f16887f8d751bae73c30c486634339204a9f17a0
ef11e3ebe037ef5f96e36f12871b52913c096466
refs/heads/master
2020-03-25T21:59:46.134078
2018-08-09T20:26:01
2018-08-09T20:26:01
144,200,005
0
0
null
null
null
null
UTF-8
Java
false
false
1,643
java
package searchSorting; import java.io.IOException; public class HeapSortDemo { public static void main(String[] args) throws IOException { int[] a={45,32,67,23,101,350,200,6,100}; HeapSort h=new HeapSort(a.length); h.Build_Heap(a); for(int i=0;i<a.length;i++) System.out.println("this: "+a[i]); h.HeapIncreaseKey(a, 2, 670); System.out.println("extract: "+h.ExtractMax(a)); for(int i=0;i<a.length;i++) System.out.println(a[i]); h.HeapSorting(a); for(int i=0;i<a.length;i++) System.out.println("sorted: "+a[i]); } } class HeapSort{ int heap_Size; public HeapSort(int size) { heap_Size=size; } public void Max_Heapify(int[] a, int i){ int largest=i,j; j=0; int left=largest*2+1; int right=largest*2+2; if(left<heap_Size){ if(a[left]>a[largest]){ largest=left; j=1; } } if(right<heap_Size){ if(a[right]>a[largest]){ largest=right; j=1; } } if(j==1){ int temp=a[largest]; a[largest]=a[i]; a[i]=temp; Max_Heapify(a, largest); } } public void Build_Heap(int[] a){ int n=a.length; for(int i=(int) Math.floor(n/2)-1;i>=0;i--){ Max_Heapify(a, i); } } public int ExtractMax(int[] a){ int max=a[0]; a[0]=a[a.length-1]; heap_Size--; Max_Heapify(a, 0); return max; } public void HeapIncreaseKey(int[] a, int i, int key){ if(key<a[i]) return; a[i]=key; while(i>0 && a[i/2]<a[i]){ a[i]=a[i/2]; a[i/2]=key; i=i/2; } } public void HeapSorting(int[] a){ Build_Heap(a); for(int i=a.length-1;i>=1;i--){ int max=a[0]; a[0]=a[i]; a[i]=max; heap_Size--; Max_Heapify(a, 0); } } }
fa91582891de6f047604298e88d545e60e865f06
3b71c2ea427ab132de0c31b81c8e97c4f276afa5
/src/main/java/com/elliott/hs/cards/tier1/demon/FiendishServant.java
36c5bed5d7e80e15de08e5e38042bb415786f05f
[]
no_license
telliott88/hs_model
7f32d57ef467597304cfe0ca86c2ea99f9027111
a1d55faf9ac5f202308f9d89245c480f7924ed55
refs/heads/master
2022-12-02T23:14:18.817772
2020-08-19T04:07:18
2020-08-19T04:07:18
288,607,975
0
0
null
null
null
null
UTF-8
Java
false
false
351
java
package com.elliott.hs.cards.tier1.demon; import com.elliott.hs.model.CardImpl; import com.elliott.hs.model.Tribe; public class FiendishServant extends CardImpl { private FiendishServant() { super("Fiendish Servant", 2, 1, 1, Tribe.DEMON); } public static FiendishServant get() { return new FiendishServant(); } }
fd52e9de9cdd26e6abc4d628b791ef4ac7e0b49c
99b764800912e393d63086b564c579562f4e2fef
/projects/plugins/data_providers/mongodb-datasource-provider/src/main/java/edu/emory/cci/bindaas/datasource/provider/mongodb/outputformat/IFormatHandler.java
9a8f1965385413b4c43819a91b33b6dd88547a0b
[ "BSD-3-Clause" ]
permissive
sharmalab/bindaas
81af369323dd34b5efc8d60b47c72b043f8f5584
0d3b0af877caae73e784789a41fa6e658204557c
refs/heads/master
2023-02-18T13:31:20.216968
2023-02-07T22:49:22
2023-02-07T22:49:22
93,875,289
5
12
BSD-3-Clause
2023-02-07T22:49:24
2017-06-09T16:01:07
Java
UTF-8
Java
false
false
728
java
package edu.emory.cci.bindaas.datasource.provider.mongodb.outputformat; import com.mongodb.DBCursor; import edu.emory.cci.bindaas.datasource.provider.mongodb.model.OutputFormat; import edu.emory.cci.bindaas.datasource.provider.mongodb.model.OutputFormatProps; import edu.emory.cci.bindaas.framework.model.QueryResult; public interface IFormatHandler { public QueryResult format(OutputFormatProps outputFormatProps,DBCursor cursor , OnFinishHandler finishHandler) throws Exception; public OutputFormat getOutputFormat(); public void validate(OutputFormatProps outputFormatProps) throws Exception; public static interface OnFinishHandler { public void finish() throws Exception ; public boolean isFinished(); } }
c9711ef28438f20b27a79a833029b2ead10571ec
f4c1c206ea37088b26f226864fffee00d0967f7b
/standardstream/src/main/java/com/carnivalmobile/stream/standard/TileStreamActivity.java
d9b68d44d59a326c6adae6addca2977705f46171
[]
no_license
madamkirsty/MessagesfromTheQueen
692edbe0d532e770912faf0f54be5fb37b2df057
87fdc2dc8f221f613bce09be689738812593cdff
refs/heads/master
2021-06-25T01:16:48.806728
2017-09-11T09:31:53
2017-09-11T09:31:53
103,117,038
0
0
null
null
null
null
UTF-8
Java
false
false
12,918
java
package com.carnivalmobile.stream.standard; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; import android.support.v7.widget.Toolbar; import android.text.Html; import android.text.TextUtils; import android.text.format.DateUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.carnival.sdk.Carnival; import com.carnival.sdk.Message; import com.carnival.sdk.MessageActivity; import com.carnivalmobile.adapter.CarnivalAdapter; import com.carnivalmobile.stream.standard.databinding.TileHeroBinding; import com.carnivalmobile.view.CarnivalLoadingView; import com.squareup.picasso.Picasso; import java.util.ArrayList; public class TileStreamActivity extends AppCompatActivity { private static final String TAG = TileStreamActivity.class.getSimpleName(); private static final String BUNDLE_MESSAGES = "com.carnival.NativeStreamActivity.messages"; private RecyclerView mRecyclerView; private TileAdapter mAdapter; private int mShortAnimationDuration; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_single_column); final CarnivalLoadingView loadingLayout = (CarnivalLoadingView) findViewById(R.id.loading_layout); //Get support v7 Toolbar and set as the active ActionBar Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime); mRecyclerView = (RecyclerView) findViewById(R.id.stream_recycler_view); StaggeredGridLayoutManager gridLayoutManager = new StaggeredGridLayoutManager(getColumnCount(), StaggeredGridLayoutManager.VERTICAL); mRecyclerView.setLayoutManager(gridLayoutManager); /* * When reloading after configuration change, load messages * from the saved bundle rather than re-downloading. */ if (savedInstanceState != null && savedInstanceState.containsKey(BUNDLE_MESSAGES)) { ArrayList<Message> messages = savedInstanceState.getParcelableArrayList(BUNDLE_MESSAGES); if (messages == null || messages.size() < 1) { loadingLayout.setFeedbackText(getString(R.string.no_messages)); loadingLayout.stop(); } else { mAdapter = new TileAdapter(this, messages); loadingLayout.setVisibility(View.GONE); mRecyclerView.setVisibility(View.VISIBLE); } } else { mAdapter = new TileAdapter(this); Carnival.getMessages(new Carnival.MessagesHandler() { @Override public void onSuccess(final ArrayList<Message> messages) { mAdapter.setMessages(messages); if (messages.size() < 1) { TileStreamActivity.this.runOnUiThread(new Runnable() { @Override public void run() { loadingLayout.setFeedbackText(getString(R.string.no_messages)); loadingLayout.stop(); crossfadeViews(mRecyclerView, loadingLayout); } }); } else { TileStreamActivity.this.runOnUiThread(new Runnable() { @Override public void run() { mAdapter.notifyItemRangeInserted(0, messages.size() - 1); crossfadeViews(loadingLayout, mRecyclerView); } }); } } @Override public void onFailure(Error error) { Log.e(TAG, "getMessages(): " + error.getLocalizedMessage()); TileStreamActivity.this.runOnUiThread(new Runnable() { @Override public void run() { loadingLayout.setFeedbackText(getString(R.string.get_message_failed)); loadingLayout.stop(); crossfadeViews(mRecyclerView, loadingLayout); } }); } }); } mRecyclerView.setAdapter(mAdapter); } @Override protected void onSaveInstanceState(Bundle outState) { //Save Messages to outState bundle to prevent re-downloading on configuration change. if (mAdapter != null) { //Only save if we actually have some messages. ArrayList<Message> messages = mAdapter.getMessages(); if (messages != null && messages.size() > 0) { outState.putParcelableArrayList(BUNDLE_MESSAGES, mAdapter.getMessages()); } } super.onSaveInstanceState(outState); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Respond to the action bar's Up/Home button case android.R.id.home: finish(); return true; } return super.onOptionsItemSelected(item); } /** * Used by the StaggeredGridLayoutManager to set the number of * columns to display based on device rotation. * @return 1 column for portrait and 2 for landscape. */ private int getColumnCount() { return 1; } private void crossfadeViews(final View disappearing, final View appearing) { if (appearing.getVisibility() != View.VISIBLE) { // Set the content view to 0% opacity but visible, so that it is visible // (but fully transparent) during the animation. appearing.setAlpha(0f); appearing.setVisibility(View.VISIBLE); // Animate the content view to 100% opacity, and clear any animation // listener set on the view. appearing.animate() .alpha(1f) .setDuration(mShortAnimationDuration) .setListener(null); } if (disappearing.getVisibility() != View.GONE) { // Animate the loading view to 0% opacity. After the animation ends, // set its visibility to GONE as an optimization step (it won't // participate in layout passes, etc.) disappearing.animate() .alpha(0f) .setDuration(mShortAnimationDuration) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { disappearing.setVisibility(View.GONE); } }); } } private class TileAdapter extends CarnivalAdapter<CardViewHolder> { public TileAdapter(Context context) { super(context); } public TileAdapter(Context context, ArrayList<Message> messages) { super(context, messages); } @Override public CardViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(getApplicationContext()); if (viewType == R.layout.tile_hero) { TileHeroBinding binding = TileHeroBinding.inflate(layoutInflater); return new CardViewHolder(binding); } return null; } @Override public void onBindViewHolder(CardViewHolder holder, int position, Message message) { CharSequence relativeTime = DateUtils.getRelativeTimeSpanString(message.getCreatedAt().getTime(), System.currentTimeMillis(), DateUtils.DAY_IN_MILLIS); ImageView mediaImageView = null; View unreadIndicator = null; TextView typeTextView = null; TextView contentTextView = null; if (holder.mHeroBinding != null) { TileHeroBinding binding = holder.mHeroBinding; binding.setMessage(message); binding.setRelativeTime(relativeTime.toString()); //Set the Message's ID to the button view's tag so that the button knows which message to open. binding.button.setTag(message.getMessageID()); mediaImageView = binding.mediaImageView; unreadIndicator = binding.unreadIndicatorView; typeTextView = binding.typeTextView; contentTextView = binding.contentTextView; } if (typeTextView != null) { formatTypeTextView(message, typeTextView); } if (contentTextView != null) { if (TextUtils.isEmpty(message.getText())) { contentTextView.setVisibility(View.GONE); } else { contentTextView.setVisibility(View.VISIBLE); contentTextView.setText(Html.fromHtml(message.getHtmlText())); } } if (unreadIndicator != null) { unreadIndicator.setVisibility(message.isRead() ? View.GONE : View.VISIBLE); } if (mediaImageView != null) { mediaImageView.setImageDrawable(null); if (!TextUtils.isEmpty(message.getImageURL())) { mediaImageView.setVisibility(View.VISIBLE); Picasso.with(getApplicationContext()).load(message.getImageURL()).into(mediaImageView); } else { mediaImageView.setVisibility(View.GONE); } } } private void formatTypeTextView(Message message, TextView typeTextView) { if (Message.TYPE_VIDEO.equals(message.getType())) { typeTextView.setText(R.string.video); typeTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_meta_video, 0, 0, 0); } else if (Message.TYPE_LINK.equals(message.getType())) { typeTextView.setText(R.string.link); typeTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_meta_link, 0, 0, 0); } else if (Message.TYPE_IMAGE.equals(message.getType())) { typeTextView.setText(R.string.image); typeTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_meta_camera, 0, 0, 0); } else if (Message.TYPE_FAKE_CALL_MESSAGE.equals(message.getType())) { typeTextView.setText(R.string.call); typeTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_meta_text, 0, 0, 0); } else { typeTextView.setText(R.string.text); typeTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_meta_text, 0, 0, 0); } } @Override public int getItemViewType(int position) { return R.layout.tile_hero; } } /** * CardViewHolder is just a wrapper around the TileCompactBinding that holds all the information regarding each item's view. */ private class CardViewHolder extends RecyclerView.ViewHolder { TileHeroBinding mHeroBinding; public CardViewHolder(TileHeroBinding binding) { super(binding.getRoot()); mHeroBinding = binding; setOnClick(mHeroBinding.button); } //When item is tapped, get Message's ID from the view tag and open the Message detail. private void setOnClick(Button button) { button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(getApplicationContext(), MessageActivity.class); String messageId = (String) v.getTag(); i.putExtra(Carnival.EXTRA_MESSAGE_ID, messageId); startActivity(i); } }); } } }
7ce64dcc544e18133b8f2da4c553f6b509318f29
6075481cce7472fb57399ecd707e01f4310b7c9b
/Stacks/Evaluate Reverse Polish Notation.java
aa2ff576936b5bbaa88ba3b900ee489b54997500
[]
no_license
AjayBhat29/DSA-Java
e01b26e4d66e47f5e14478b4006066cf9a06eb15
3bd182cb07aa9dd3c986dd41ff133e1f4ea0e81f
refs/heads/master
2023-06-27T00:25:09.576703
2021-08-05T06:00:16
2021-08-05T06:00:16
294,727,862
1
0
null
null
null
null
UTF-8
Java
false
false
2,124
java
/* Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, and /. Each operand may be an integer or another expression. Note that division between two integers should truncate toward zero. It is guaranteed that the given RPN expression is always valid. That means the expression would always evaluate to a result, and there will not be any division by zero operation. Example 1: Input: tokens = ["2","1","+","3","*"] Output: 9 Explanation: ((2 + 1) * 3) = 9 Example 2: Input: tokens = ["4","13","5","/","+"] Output: 6 Explanation: (4 + (13 / 5)) = 6 Example 3: Input: tokens = ["10","6","9","3","+","-11","*","/","*","17","+","5","+"] Output: 22 Explanation: ((10 * (6 / ((9 + 3) * -11))) + 17) + 5 = ((10 * (6 / (12 * -11))) + 17) + 5 = ((10 * (6 / -132)) + 17) + 5 = ((10 * 0) + 17) + 5 = (0 + 17) + 5 = 17 + 5 = 22 Constraints: 1 <= tokens.length <= 104 tokens[i] is either an operator: "+", "-", "*", or "/", or an integer in the range [-200, 200]. */ class Solution { public int evalRPN(String[] tokens) { int n=tokens.length; LinkedList<Integer> stack=new LinkedList<>(); for(int i=0;i<n;i++) { String s=tokens[i]; int len=s.length(); if(len==1) { char ch=s.charAt(0); if(Character.isDigit(ch)) stack.addFirst(Character.getNumericValue(ch)); else { int a=stack.removeFirst(); int b=stack.removeFirst(); int result=0; if(ch=='+') result=b+a; else if(ch=='-') result=b-a; else if(ch=='*') result=b*a; else result=b/a; stack.addFirst(result); } } else { int x=Integer.parseInt(s); stack.addFirst(x); } } return stack.pop(); } }
700d5fb053e906d8670be8f343da5d20e077d213
96d5eaa65cd05ff657e3ee1941dcff0080d7c646
/src/main/java/net/mcreator/breadpack/item/TacoItem.java
fd1e7de45d67c96196824d8d958c59f9af0e6cfa
[]
no_license
nate-moo/Breadpack
1e2522470e840ed00e676e0cca11bab9aad60159
37aa467b392fd210ef1e5606b92a6bd04ff2c6ad
refs/heads/master
2021-05-22T21:02:08.364431
2020-04-05T01:16:14
2020-04-05T01:16:14
253,094,395
1
0
null
null
null
null
UTF-8
Java
false
false
1,081
java
package net.mcreator.breadpack.item; import net.minecraftforge.registries.ObjectHolder; import net.minecraft.item.UseAction; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemGroup; import net.minecraft.item.Item; import net.minecraft.item.Food; import net.mcreator.breadpack.BreadpackElements; @BreadpackElements.ModElement.Tag public class TacoItem extends BreadpackElements.ModElement { @ObjectHolder("breadpack:taco") public static final Item block = null; public TacoItem(BreadpackElements instance) { super(instance, 1); } @Override public void initElements() { elements.items.add(() -> new FoodItemCustom()); } public static class FoodItemCustom extends Item { public FoodItemCustom() { super(new Item.Properties().group(ItemGroup.FOOD).maxStackSize(64).food((new Food.Builder()).hunger(5).saturation(0.5f).build())); setRegistryName("taco"); } @Override public int getUseDuration(ItemStack stack) { return 64; } @Override public UseAction getUseAction(ItemStack par1ItemStack) { return UseAction.EAT; } } }
aa25a4bed57e028f4e6ae1a3914de7d895c9e612
7ab15db23079fb2bf33e7639fcd616ba25ea572f
/app/src/main/java/com/meetutech/baosteel/widget/video/RecordedButton.java
a3d0bffd398e51b28d8c0f4369e243ab25fcbbd0
[]
no_license
gmgw0909/baosteel-android
08d54ae9d3e15d3076afc403f5ddaeae0d967fe7
37744d76c088f90b40c53a2027ea3db8c6a3ea79
refs/heads/master
2023-08-28T03:19:57.853771
2021-11-02T03:23:04
2021-11-02T03:23:04
326,561,413
0
0
null
null
null
null
UTF-8
Java
false
false
11,718
java
package com.meetutech.baosteel.widget.video; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.RectF; import android.os.Handler; import android.os.Message; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import java.util.ArrayList; import java.util.List; import com.meetutech.baosteel.R; public class RecordedButton extends View { private int measuredWidth = -1; private Paint paint; private int colorGray; private float radius1; private float radius2; private float zoom = 0.8f;//ๅˆๅง‹ๅŒ–็ผฉๆ”พๆฏ”ไพ‹ private int dp5; private Paint paintProgress; private int colorBlue; /** ๅฝ“ๅ‰่ฟ›ๅบฆ ไปฅ่ง’ๅบฆไธบๅ•ไฝ */ private float girthPro; private RectF oval; private int max; private OnGestureListener onGestureListener; private int animTime = 150; private float downX; private float downY; /** buttonๆ˜ฏๅฆๅค„ไบŽๆ‰“ๅผ€็Šถๆ€ */ private boolean isOpenMode = true; private List<Float> splitList = new ArrayList<>(); private Paint paintSplit; private boolean isDeleteMode; private Paint paintDelete; private ValueAnimator buttonAnim; private float progress; private boolean isResponseLongTouch = true; private float rawX = -1; private float rawY = -1; public RecordedButton(Context context) { super(context); init(); } public RecordedButton(Context context, AttributeSet attrs) { super(context, attrs); init(); } public RecordedButton(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } private void init() { dp5 = (int) getResources().getDimension(R.dimen.dp6); colorGray = getResources().getColor(R.color.video_gray); colorBlue = getResources().getColor(R.color.blue); paint = new Paint(); paint.setAntiAlias(true); paintProgress = new Paint(); paintProgress.setAntiAlias(true); paintProgress.setColor(colorBlue); paintProgress.setStrokeWidth(dp5); paintProgress.setStyle(Paint.Style.STROKE); paintSplit = new Paint(); paintSplit.setAntiAlias(true); paintSplit.setColor(Color.WHITE); paintSplit.setStrokeWidth(dp5); paintSplit.setStyle(Paint.Style.STROKE); paintDelete = new Paint(); paintDelete.setAntiAlias(true); paintDelete.setColor(Color.RED); paintDelete.setStrokeWidth(dp5); paintDelete.setStyle(Paint.Style.STROKE); //่ฎพ็ฝฎ็ป˜ๅˆถๅคงๅฐ oval = new RectF(); } /** * ่ฎพ็ฝฎๆ˜ฏๅฆๅ“ๅบ”้•ฟๆŒ‰ไบ‹ไปถ * @param isResponseLongTouch */ public void setResponseLongTouch(boolean isResponseLongTouch){ this.isResponseLongTouch = isResponseLongTouch; } public int getSplitCount() { return splitList.size(); } public float getCurrentPro(){ return progress; } public interface OnGestureListener { void onLongClick(); void onClick(); void onLift(); void onOver(); } public void setOnGestureListener(OnGestureListener onGestureListener){ this.onGestureListener = onGestureListener; } private Handler myHandler = new Handler(){ @Override public void handleMessage(Message msg) { if(onGestureListener != null) { startAnim(0, 1-zoom); isOpenMode = true; onGestureListener.onLongClick(); } } }; private float firstX; private float firstY; private boolean cleanResponse;//ๆธ…้™คๆ‰€ๆœ‰ๅ“ๅบ” @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (isResponseLongTouch) myHandler.sendEmptyMessageDelayed(0, animTime); firstX = downX = event.getRawX(); firstY = downY = event.getRawY(); break; case MotionEvent.ACTION_MOVE: float moveX = event.getRawX(); float moveY = event.getRawY(); if (Math.abs(moveX - firstX) > dp5 || Math.abs(moveY - firstY) > dp5) { if (myHandler.hasMessages(0)) { cleanResponse = true; myHandler.removeMessages(0); } } float slideX = moveX - downX; float slideY = moveY - downY; //่ทŸ้šๆ‰‹ๆŒ‡็งปๅŠจ setX(getX() + slideX); setY(getY() + slideY); downX = moveX; downY = moveY; break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: float upX = event.getRawX(); float upY = event.getRawY(); if (!cleanResponse){ if (isResponseLongTouch && !myHandler.hasMessages(0)) { if (isOpenMode) { if (onGestureListener != null) onGestureListener.onLift(); closeButton(); } } else { myHandler.removeMessages(0); if (Math.abs(upX - firstX) < dp5 && Math.abs(upY - firstY) < dp5) { if (onGestureListener != null) onGestureListener.onClick(); } } } cleanResponse = false; if(upX != firstX || upY != firstY){//ๅ›žๅˆฐๅŽŸๅๆ ‡ startMoveAnim(); } break; } return true; } private void startMoveAnim(){ final float slideX = rawX-getX(); final float slideY = rawY-getY(); final float rX = getX(); final float rY = getY(); ValueAnimator va = ValueAnimator.ofFloat(0, 1).setDuration(50); va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float value = (float) animation.getAnimatedValue(); setX(rX+slideX*value); setY(rY+slideY*value); } }); va.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if(Math.abs(slideX) > Math.abs(slideY)){ jitterAnim(slideX/5, true); }else{ jitterAnim(slideY/5, false); } } }); va.start(); } boolean flag; private void jitterAnim(float slide, final boolean isX){ ValueAnimator va = ValueAnimator.ofFloat(slide, 0).setDuration(100); va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float value = (float) animation.getAnimatedValue(); if(flag){ value = -value; } if(isX){ setX(rawX+value); }else{ setY(rawY+value); } flag = !flag; } }); va.start(); } public void closeButton(){ if(isOpenMode) { isOpenMode = false; startAnim(1-zoom, 0); } } private void startAnim(float start, float end){ if(buttonAnim == null || !buttonAnim.isRunning()) { buttonAnim = ValueAnimator.ofFloat(start, end).setDuration(animTime); buttonAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float value = (float) animation.getAnimatedValue(); radius1 = measuredWidth * (zoom + value) / 2; radius2 = measuredWidth * (zoom - value) / 2 - dp5; value = 1 - zoom - value; oval.left = measuredWidth * value / 2 + dp5 / 2; oval.top = measuredWidth * value / 2 + dp5 / 2; oval.right = measuredWidth * (1 - value / 2) - dp5 / 2; oval.bottom = measuredWidth * (1 - value / 2) - dp5 / 2; invalidate(); } }); buttonAnim.start(); } } public void setMax(int max){ this.max = max; } /** * ่ฎพ็ฝฎ่ฟ›ๅบฆ */ public void setProgress(float progress){ this.progress = progress; float ratio = progress/max; girthPro = 365*ratio; invalidate(); if(ratio >= 1){ if(onGestureListener != null) onGestureListener.onOver(); } } /** * ่ฎพ็ฝฎๆฎต็‚น */ public void setSplit(){ splitList.add(girthPro); invalidate(); } /** * ๅˆ ้™คๆœ€ๅŽไธ€ไธชๆฎต็‚น */ public void deleteSplit(){ if(isDeleteMode && splitList.size() > 0){ splitList.remove(splitList.size()-1); isDeleteMode = false; invalidate(); } } /** * ๆธ…้™คๆ–ญ็‚น */ public void cleanSplit(){ if(splitList.size() > 0) { splitList.clear(); invalidate(); } } /** * ่ฎพ็ฝฎๅˆ ้™คๆจกๅผ */ public void setDeleteMode(boolean isDeleteMode){ this.isDeleteMode = isDeleteMode; invalidate(); } /** * ๆ˜ฏๅฆๆญฃๅœจๅˆ ้™คๆจกๅผ */ public boolean isDeleteMode(){ return isDeleteMode; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); if(measuredWidth == -1) { measuredWidth = getMeasuredWidth(); radius1 = measuredWidth* zoom /2; radius2 = measuredWidth* zoom /2 - dp5; oval.left = dp5/2; oval.top = dp5/2; oval.right = measuredWidth-dp5/2; oval.bottom = measuredWidth-dp5/2; } } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if(rawX == -1) { rawX = getX(); rawY = getY(); } } @Override protected void onDraw(Canvas canvas) { //็ป˜ๅˆถๅค–ๅœˆ paint.setColor(colorGray); canvas.drawCircle(measuredWidth/2, measuredWidth/2, radius1, paint); //็ป˜ๅˆถๅ†…ๅœˆ paint.setColor(Color.WHITE); canvas.drawCircle(measuredWidth/2, measuredWidth/2, radius2, paint); //็ป˜ๅˆถ่ฟ›ๅบฆ canvas.drawArc(oval, 270, girthPro, false, paintProgress); //็ป˜ๅˆถๆฎต็‚น for (int x=0; x<splitList.size(); x++){ if(x != 0) canvas.drawArc(oval, 270+splitList.get(x), 1, false, paintSplit); } //็ป˜ๅˆถๅˆ ้™คๆจกๅผ็š„ๆฎต่ฝ if(isDeleteMode && splitList.size()>0){ float split = splitList.get(splitList.size() - 1); canvas.drawArc(oval, 270+split, girthPro -split, false, paintDelete); } } }
ee106bc76c7f5176d4f7695ecee1279735353c72
67f6fdd5f57ac9d652410100e3500adc3d5a0cf3
/shop_service/shop_search_service/src/main/java/com/qf/service/impl/SearchServiceImpl.java
b4185c36cc30ef93921bf117383f092ab252976a
[]
no_license
yingyunzhizi/shop_pom_1901
cf44dddbd7768322ebd9720a32417bc83ad33726
c145c4921f20ed72286cd78c9b76ceefbf336bd2
refs/heads/master
2022-06-30T18:35:50.075596
2019-06-05T16:43:01
2019-06-05T16:43:01
189,129,917
0
0
null
2022-06-17T02:12:39
2019-05-29T01:39:07
JavaScript
UTF-8
Java
false
false
5,282
java
package com.qf.service.impl; import com.alibaba.dubbo.config.annotation.Service; import com.qf.ISearchService; import com.qf.entity.Goods; import com.qf.entity.Page; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocumentList; import org.apache.solr.common.SolrInputDocument; import org.springframework.beans.factory.annotation.Autowired; import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * @version 1.0 * @data 5/22/2019 20:57 * @user yingyunzhizi */ @Service public class SearchServiceImpl implements ISearchService { @Autowired private SolrClient solrClient; @Override public Page<Goods> queryByKeyWord(String keyword,Page<Goods> page) { SolrQuery solrQuery; if (keyword==null||keyword.trim().equals("")){ solrQuery = new SolrQuery("*.*"); }else { solrQuery = new SolrQuery("gname:" + keyword + " || ginfo:" + keyword); } //่ฎพ็ฝฎ้ซ˜ไบฎ solrQuery.setHighlight(true);//ๅผ€ๅฏ้ซ˜ไบฎ solrQuery.setHighlightSimplePre("<font color='red'>");//่ฎพ็ฝฎๅ‰็ผ€ solrQuery.setHighlightSimplePost("</font>");//่ฎพ็ฝฎๅŽ็ผ€ solrQuery.addHighlightField("gname"); //้ซ˜ไบฎ็š„ๆŠ˜ๅ  solrQuery.setHighlightFragsize(5);//่ฟ™ไธชๆ˜ฏ่ฎพ็ฝฎ้ซ˜ไบฎๆŠ˜ๅ ๅŽๆฏๆฌกๆ˜พ็คบ็š„้•ฟๅบฆ solrQuery.setHighlightSnippets(3);//่ฟ™ไธชๆ˜ฏ่ฎพ็ฝฎ้ซ˜ไบฎๆŠ˜ๅ ็š„ๆฌกๆ•ฐ //่ฎพ็ฝฎๅˆ†้กตๅ‚ๆ•ฐ solrQuery.setStart((page.getCurrentPage()-1)*(page.getPageSize())); int pageSize = page.getPageSize(); solrQuery.setRows(pageSize); //ๆ‰ง่กŒๆŸฅ่ฏข List<Goods> goodsList = new ArrayList<>(); try { QueryResponse query = solrClient.query(solrQuery); //้€š่ฟ‡QueryResponseๅฏน่ฑก่Žทๅ–ๆ™ฎ้€š็š„ๆœ็ดข็ป“ๆžœ SolrDocumentList results = query.getResults(); //eg:{"1";{"gname},["ไผ ้Ÿณ<font>ๆ‰‹ๆœบ"]}} //้€š่ฟ‡queryResponseๅฏน่ฑก่Žทๅ–้ซ˜ไบฎ็š„ๆœ็ดข็ป“ๆžœ Map<String, Map<String, List<String>>> highlighting = query.getHighlighting(); //่ฎพ็ฝฎๅˆ†้กตๅ‚ๆ•ฐ,solrๅบ“ไธญๆŸฅๅ‡บๆฅ็š„ๆ˜ฏobject็ฑปๅž‹็š„่Žทๅพ—ๆ€ปๆกๆ•ฐๅ’Œๆ€ป้กต็  int totalCount = Integer.parseInt(results.getNumFound()+""); if (totalCount % pageSize==0){ page.setTotalPage(totalCount/pageSize); }else { page.setTotalPage((totalCount/pageSize)+1); } page.setTotalCount(totalCount); for (SolrDocument result : results) { Goods goods = new Goods(); goods.setId(Integer.parseInt(result.get("id")+"")); goods.setGname(result.get("gname")+""); goods.setGinfo(result.get("ginfo")+""); BigDecimal bigDecimal = BigDecimal.valueOf((float)result.get("gprice")); goods.setGprice(bigDecimal); goods.setGsave(Integer.parseInt(result.get("gsave")+"")); goods.setGimages(result.get("gimages")+""); //ๅˆคๆ–ญๅฝ“ๅ‰ๅ•†ๅ“ๆ˜ฏๅฆๅญ˜ๅœจ้ซ˜ไบฎ if (highlighting.containsKey(goods.getId()+"")){ //ๅฝ“ๅ‰ๅ•†ๅ“ๅญ˜ๅœจ้ซ˜ไบฎ Map<String, List<String>> stringListMap = highlighting.get(goods.getId() + ""); //่Žทๅพ—้ซ˜ไบฎ็š„ๅญ—ๆฎต List<String> gname = stringListMap.get("gname"); if (gname!=null){ goods.setGname(gname.get(0)); } } goodsList.add(goods); } page.setList(goodsList); } catch (SolrServerException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return page; } /** * ๅฐ†ๅ•†ๅ“ๆ•ฐๆฎไฟๅญ˜ๅˆฐ็ดขๅผ•ๅบ“ไธญ * @param goods * @return */ @Override public int addGoodsToSearch(Goods goods) { /*SolrInputDocument sd = new SolrInputDocument(); sd.addField("id",goods.getId()+""); sd.addField("gname",goods.getGname()); sd.addField("ginfo",goods.getGinfo()); sd.addField("gprice",goods.getGprice().floatValue()); sd.addField("gsave",goods.getGsave()); sd.addField("gimages",goods.getGimages()); try { solrClient.add(sd); solrClient.commit(); return 1; } catch (SolrServerException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }*/ return 0; } @Override public void delGoodsFromSearch(Integer id) { SolrInputDocument sd = new SolrInputDocument(); try { solrClient.deleteById(id+""); solrClient.commit(); } catch (SolrServerException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
47142ecc92493963da37d276e7af320a0b13c6ed
05bdac6855e8334f0c86df37dd085aa838026a72
/src/main/java/com/hyx/dp/sum/MinCoinSum.java
ca50f43018ac9e7388fdf203ace26fd9d66ec039
[]
no_license
hangyuxin/algorithm
904ae9ec06635af6a43e9180c153dfa736c10a8f
bd98f94cb3925d26e02708a4cf123247f64699b0
refs/heads/master
2022-11-27T22:32:37.315718
2020-07-18T13:44:57
2020-07-18T13:45:14
267,520,854
1
0
null
null
null
null
UTF-8
Java
false
false
1,326
java
package com.hyx.dp.sum; import java.util.Arrays; /** * ๆœ€ๅฐ‘ๆŽ็กฌๅธ * ้—ฎ๏ผš็ป™ๅฎšไธ€ไธช็กฌๅธ้‡‘้ขๆ•ฐ็ป„a๏ผŒไธ€ไธช็‰ฉๅ“้‡‘้ขn๏ผŒๆฑ‚ๆœ€ๅฐ‘้œ€่ฆ่Šฑๅคšๅฐ‘ไธช็กฌๅธๆ‰ๅฏไปฅไนฐไธ‹่ฟ™ไธช็‰ฉๅ“ * * @author sq * @date 2020/07/13 */ public class MinCoinSum { /** * ๆฑ‚ๆœ€ๅฐ‘้œ€่ฆๆŽๅคšๅฐ‘็กฌๅธ * * @param arrays * ็กฌๅธๆ•ฐ็ป„ * @param num * ๆ€ป้‡‘้ข * @return ๆœ€ๅฐ‘้œ€่ฆๅคšๅฐ‘๏ผŒๅฆ‚ๆžœๆ— ๆณ•ไป˜ๆฌพ่ฟ”ๅ›ž-1 */ public int get(final int[] arrays, final int num) { if (arrays == null || arrays.length == 0 || num < 0) { return -1; } int max = num + 1; final int[] dps = new int[max]; Arrays.fill(dps, max); dps[0] = 0; for (int i = 1; i <= num; i++) { for (int j = 0, jSize = arrays.length; j < jSize; j++) { if (arrays[j] <= i) { dps[i] = Math.min(dps[i], dps[i - arrays[j]] + 1); } } } return dps[num] > num ? -1 : dps[num]; } public static void main(String[] args) { final MinCoinSum minCoinSum = new MinCoinSum(); System.out.println(minCoinSum.get(new int[] {1, 2, 5}, 11)); System.out.println(minCoinSum.get(new int[] {2}, 5)); } }
d19e6586cd4f19a7a4896037424a48b61362ca8f
6596a5d687d337e488c379dde50042806b7fa7bf
/assistive31/src/main/java/info/earntalktime/at/utils/ATItem.java
63641f0242d1fed67cd0518f1ac053b3affba2c5
[]
no_license
AndroVijay/Wily6
269b60201ad8fe59fb759d33a09ff722f34afceb
a6cabad3470acbac8aacc61a3e11ea5d40135e24
refs/heads/master
2020-04-23T19:35:53.830287
2019-02-19T05:19:41
2019-02-19T05:19:41
171,409,995
0
0
null
null
null
null
UTF-8
Java
false
false
1,087
java
package info.earntalktime.at.utils; public class ATItem { private int itemId; private String itemName = ""; private String itemActionName = ""; private String packageName = ""; private int status = 0; public int getItemId() { return itemId; } public void setItemId(int itemId) { this.itemId = itemId; } public String getItemName() { return itemName; } public void setItemName(String itemName) { this.itemName = itemName; } public String getItemActionName() { return itemActionName; } public void setItemActionName(String itemActionName) { this.itemActionName = itemActionName; } public String getPackageName() { return packageName; } public void setPackageName(String packageName) { this.packageName = packageName; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } @Override public String toString() { return "ATItem [itemId=" + itemId + ", itemName=" + itemName + ", itemActionName=" + itemActionName + ", packageName=" + packageName + ", status=" + status + "]"; } }
c9dadd6f9dcb49d46453d677b4bf5f7a3833cd15
ef50e50e0b61db62d0476b5b7df3d5f5044a16a9
/Dynamic_Programming/zurikela/java/ivanbessonov.java
a339524d9bc698ba88e743c148b3e259e0cc648e
[]
no_license
saketrule/Research_Project-HackerRank_CheckStyle
09fd6ef3a067926c754af693b13566cc55fe16ae
4334bcbc4620fb94fd3d63034a320756e7233ded
refs/heads/master
2021-01-22T13:03:08.055929
2017-09-12T12:11:19
2017-09-12T12:11:19
102,361,527
0
1
null
null
null
null
UTF-8
Java
false
false
4,820
java
import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class Solution { public static void main(String[] args) { int Q = readInt(); char[] buffer = new char[1]; List<MySet> mySets = new ArrayList<>(); for (int q = 0; q < Q; q++) { readWord(buffer); switch (buffer[0]) { case 'A': { mySets.add(new MySet(mySets.size(), readInt())); break; } case 'B': { int x = readInt() - 1, y = readInt() - 1; MySet X = mySets.get(x); MySet Y = mySets.get(y); X.links.add(Y); Y.links.add(X); break; } case 'C': { int x = readInt() - 1; mergeComponent(mySets, x); break; } } } int size = mySets.size(); for (int i = 0; i < size; i++) { MySet X = mySets.get(i); if (X != null) mergeComponent(mySets, i); } int result = 0; for (int i = size, size2 = mySets.size(); i < size2; i++) { result += mySets.get(i).nodes; } System.out.println(result); } private static void mergeComponent(List<MySet> mySets, int x) { MySet X = mySets.get(x); Set<MySet> component = X.getComponent(); for (MySet set : component) mySets.set(set.index, null); // nullify all these sets mySets.add(new MySet(mySets.size(), getNodes(component, new HashSet<MySet>()))); } static class MySet { final int index; final int nodes; final int independant; List<MySet> links = new ArrayList<>(); public MySet(int index, int nodes) { this(index, nodes, nodes); } public MySet(int index, int nodes, int independant) { this.index = index; this.nodes = nodes; this.independant = independant; } public Set<MySet> getComponent() { Set<MySet> c = new HashSet<>(); getComponent(c); return c; } private void getComponent(Set<MySet> c) { if (!c.contains(this)) { c.add(this); for (MySet set : links) { set.getComponent(c); } } } @Override public String toString() { return "node " + index; } } static int getNodes(Set<MySet> component, Set<MySet> removed) { if (component.size() == 0) return 0; if (component.size() == 1) { return component.iterator().next().nodes; } MySet mySet = component.iterator().next(); component.remove(mySet); removed.add(mySet); int nodes = getNodes(component, removed); int sizeBefore = component.size(); component.removeAll(mySet.links); if (component.size() == sizeBefore) { component.add(mySet); removed.remove(mySet); return mySet.nodes + nodes; } Set<MySet> newRemoved = new HashSet<>(mySet.links); newRemoved.addAll(removed); nodes = Math.max(nodes, mySet.nodes + getNodes(component, newRemoved)); for (MySet link : mySet.links) { if (!removed.contains(link)) component.add(link); } component.add(mySet); removed.remove(mySet); return nodes; } static InputStream in = System.in; static int readInt() { try { int c = in.read(); while (c <= 32) { c = in.read(); } boolean minus = false; if (c == '-') { minus = true; c = in.read(); } int result = (c - '0'); c = in.read(); while (c >= '0') { result = result * 10 + (c - '0'); c = in.read(); } return minus ? -result : result; } catch (IOException e) { return -1; // should not happen } } static String readWord(char[] buffer) { try { int c = in.read(); while (c <= 32) { c = in.read(); } int length = 0; while (c > 32) { buffer[length] = (char) c; c = in.read(); length++; } return "";//String.valueOf(buffer, 0, length); } catch (IOException ex) { return null; // should not happen } } }
94db49edb7f5bd9bc0f263dbc55461f3f4619bfe
716cfbecd3464ad92a466cad6cea6ab643a47517
/src/br/com/senac/bo/EnderecoBO.java
7b1953aa46bebf0786be3edd67d43860763661c7
[]
no_license
heltonmatiazi/projetoSenacWeb
bf5e1514e6933b149b94c6e3226b332e9b103346
5fda9e0d85fa087640e84d28e413930068fa53e9
refs/heads/master
2021-01-19T04:47:55.991716
2016-11-29T15:24:19
2016-11-29T15:24:19
69,103,168
1
0
null
2016-11-29T15:24:20
2016-09-24T13:13:51
Java
UTF-8
Java
false
false
1,575
java
package br.com.senac.bo; import br.com.senac.dao.EnderecoDAO; import java.sql.SQLException; import br.com.senac.model.Endereco; public class EnderecoBO { /* public void inserir(Endereco e){ try{ EnderecoDAO enderecodao=new EnderecoDAO(); enderecodao.inserir(e); } catch (SQLException excp){ System.out.println("Erro ao inserir Endereco " + excp.getMessage()); excp.printStackTrace(); } }*/ // // public void alterar(Endereco e){ // // try{ // EnderecoDAO enderecodao=new EnderecoDAO(); // EstadoBO estadobo=new EstadoBO; // // enderecodao.alterar(e); // estadobo.alterar(e.getEstado()); // // } catch (SQLException excp){ // System.out.println("Erro ao alterar Endereco " + excp.getMessage()); // excp.printStackTrace(); // } // } // public void excluir(int id){ // // try{ // EnderecoDAO enderecodao=new EnderecoDAO(); // EstadoBO estadobo=new EstadoBO; // // estadobo.excluir(getEnderecoById(id).getEstado().getId()); // enderecodao.excluir(id); // // } catch (SQLException excp){ // System.out.println("Erro ao excluir Endereco " + excp.getMessage()); // excp.printStackTrace(); // } // } // // public Endereco getEnderecoById(int id){ // // Endereco endereco=null; // // try{ // EnderecoDAO dao=new EnderecoDAO(); // endereco=dao.getEnderecoById(); // // }catch(SQLException excp){ // System.out.println("Erro ao listar Endereรงo. " + excp.getMessage()); // excp.printStackTrace(); // } // // return endereco; // } }
4971e295f5956c5509088b655316450688bc2907
4486c433ae5d15954471658f5a042aebeffef588
/app/src/main/java/com/symbel/orienteeringquiz/fragment/FragmentClasificacionClubes.java
6f5f6169d3d06e09052e71d4a16d7dce12bf4d26
[ "Apache-2.0" ]
permissive
EstefaniaGilVaquero/OrienteeringQuizAndroid
15090c6a7e61afb2228c059ba1a726dbf2e9b81c
2d12b9856707d1d03cb6d3965b2222d0e96ea403
refs/heads/master
2021-05-20T17:54:34.930533
2018-05-05T22:30:06
2018-05-05T22:30:06
60,066,195
0
0
null
null
null
null
UTF-8
Java
false
false
7,343
java
package com.symbel.orienteeringquiz.fragment; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; import com.symbel.orienteeringquiz.R; import com.symbel.orienteeringquiz.adapter.AdapterClasificacion; import com.symbel.orienteeringquiz.model.Clasificacion; import com.symbel.orienteeringquiz.utils.Constants; import com.symbel.orienteeringquiz.utils.Utilidades; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import dmax.dialog.SpotsDialog; public class FragmentClasificacionClubes extends Fragment { private Activity activity; private View viewroot; private RecyclerView rvClasifClub; private SpotsDialog dialog; private ArrayList<Clasificacion> listaClasifClubes, listaClasifUsers; private AdapterClasificacion adapter; public FragmentClasificacionClubes() { } private class GetClasifClubThread extends AsyncTask<Integer, Integer, Integer> { @Override protected Integer doInBackground(Integer... params) { try { getClasifClubes(); } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(final Integer integer) { super.onPostExecute(integer); } } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); activity = getActivity(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { viewroot = inflater.inflate(R.layout.fragment_clasificacion_clubes, container, false); return viewroot; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); try { // 1. get a reference to recyclerView rvClasifClub = (RecyclerView) viewroot.findViewById(R.id.rvClasifClub); // 2. set layoutManger LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()); rvClasifClub.setLayoutManager(linearLayoutManager); // 3. set item animator to DefaultAnimator rvClasifClub.setItemAnimator(new DefaultItemAnimator()); // LOAD DATA reload(); } catch (Exception e) { e.printStackTrace(); } } private void getClasifClubes() { ParseQuery<ParseObject> query = ParseQuery.getQuery(Constants.CLASIFICACION); query.orderByAscending("club"); query.findInBackground(new FindCallback<ParseObject>() { public void done(List<ParseObject> objects, ParseException e) { try { if (e == null) { //CLASIF ORDENADA POR CLUBES orderByClub(objects); } else { Utilidades.showSnackbar(activity.getCurrentFocus(), e.getMessage()); } } catch (Exception f) { f.printStackTrace(); } } }); } private void orderByClub(List<ParseObject> objects) { listaClasifUsers = new ArrayList<>(); for (int i = 0; i < objects.size(); i++) { ParseObject object = objects.get(i); //CREO NUEVO OBJETO CLASIF Y DESPUES DESCARGO IMAGEN final Clasificacion clasifUser = new Clasificacion(); clasifUser.setNombreUsuario(object.getString("nombreUsuario")); clasifUser.setClub(object.getString("club")); clasifUser.setPuntuacion(object.getInt("puntuacion")); listaClasifUsers.add(clasifUser); } // SORT THIS LIST BY CLUB Collections.sort(listaClasifUsers, new Comparator<Clasificacion>() { public int compare(Clasificacion s1, Clasificacion s2) { return s1.getClub().compareToIgnoreCase(s2.getClub()); } }); String currentClub = ""; int currentClubPunt = 0; listaClasifClubes = new ArrayList<>(); //AGRUPAR LISTA DE USUARIOS POR CLUB, SUMANDO SUS PUNTUACIONES for (int i = 0; i < listaClasifUsers.size(); i++) { Clasificacion clasifUser = listaClasifUsers.get(i); String clubUsuario = clasifUser.getClub().toUpperCase().trim(); currentClub = currentClub.toUpperCase().trim(); if (clubUsuario.contentEquals(currentClub)) { currentClubPunt = currentClubPunt + clasifUser.getPuntuacion(); } else { Clasificacion clasifClub = new Clasificacion(); if (!currentClub.isEmpty()) { clasifClub.setClub(currentClub); clasifClub.setPuntuacion(currentClubPunt); listaClasifClubes.add(clasifClub); } currentClub = clubUsuario; currentClubPunt = clasifUser.getPuntuacion(); } if (i == listaClasifUsers.size() - 1) { Clasificacion clasifClub = new Clasificacion(); clasifClub.setClub(currentClub); clasifClub.setPuntuacion(currentClubPunt); listaClasifClubes.add(clasifClub); } } // SORT THIS LIST BY PUNT Collections.sort(listaClasifClubes, new Comparator<Clasificacion>() { public int compare(Clasificacion s1, Clasificacion s2) { return s2.getPuntuacion() - s1.getPuntuacion(); } }); //PINTAMOS pintar(); } private void pintar() { // Si hay adapter, recargamos if (adapter != null) { adapter.notifyItemRangeInserted(adapter.getItemCount(), listaClasifClubes.size() - 1); adapter.notifyDataSetChanged(); } else { // Si la lista no estรก vacรญa, la pintamos if (listaClasifClubes != null) { if (listaClasifClubes.size() > 0) { // 4. create and set adapter adapter = new AdapterClasificacion(listaClasifClubes, activity); adapter.notifyDataSetChanged(); rvClasifClub.setAdapter(adapter); } } } } private void reload() { try { listaClasifClubes = null; adapter = null; cargarClasifClub(); } catch (Exception e) { e.printStackTrace(); } } private void cargarClasifClub() { try { new GetClasifClubThread().execute(); } catch (Exception e) { e.printStackTrace(); } } }
9e0fdb1dec0cde709e65c3387316a56af860b74c
08c5675ad0985859d12386ca3be0b1a84cc80a56
/src/main/java/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java
c38f8467fe2d5e741e8eb6dcaba7c701aefe8616
[]
no_license
ytempest/jdk1.8-analysis
1e5ff386ed6849ea120f66ca14f1769a9603d5a7
73f029efce2b0c5eaf8fe08ee8e70136dcee14f7
refs/heads/master
2023-03-18T04:37:52.530208
2021-03-09T02:51:16
2021-03-09T02:51:16
345,863,779
0
0
null
null
null
null
UTF-8
Java
false
false
2,496
java
package org.omg.PortableServer.POAPackage; /** * org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from c:/re/workspace/8-2-build-windows-amd64-cygwin/jdk8u60/4407/corba/src/share/classes/org/omg/PortableServer/poa.idl * Tuesday, August 4, 2015 11:07:54 AM PDT */ abstract public class ServantNotActiveHelper { private static String _id = "IDL:omg.org/PortableServer/POA/ServantNotActive:1.0"; public static void insert(org.omg.CORBA.Any a, org.omg.PortableServer.POAPackage.ServantNotActive that) { org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); a.type(type()); write(out, that); a.read_value(out.create_input_stream(), type()); } public static org.omg.PortableServer.POAPackage.ServantNotActive extract(org.omg.CORBA.Any a) { return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; synchronized public static org.omg.CORBA.TypeCode type() { if (__typeCode == null) { synchronized (org.omg.CORBA.TypeCode.class) { if (__typeCode == null) { if (__active) { return org.omg.CORBA.ORB.init().create_recursive_tc(_id); } __active = true; org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[0]; org.omg.CORBA.TypeCode _tcOf_members0 = null; __typeCode = org.omg.CORBA.ORB.init().create_exception_tc(org.omg.PortableServer.POAPackage.ServantNotActiveHelper.id(), "ServantNotActive", _members0); __active = false; } } } return __typeCode; } public static String id() { return _id; } public static org.omg.PortableServer.POAPackage.ServantNotActive read(org.omg.CORBA.portable.InputStream istream) { org.omg.PortableServer.POAPackage.ServantNotActive value = new org.omg.PortableServer.POAPackage.ServantNotActive(); // read and discard the repository ID istream.read_string(); return value; } public static void write(org.omg.CORBA.portable.OutputStream ostream, org.omg.PortableServer.POAPackage.ServantNotActive value) { // write the repository ID ostream.write_string(id()); } }
7a6478a39e571f74cb522b797b8c9d73a72f9c90
ea3648110899f7c34c98fb3650cc2fd3d8a16170
/main/java/dqmIII/blocks/decorate/render/DqmTileEntityRenderYajirusikiiro2.java
c8368b09840d0e6fc65d2bfa1e2ae9609f88b463
[]
no_license
azelDqm/MC1.7.10_DQMIIINext
51392175b412bd7fa977b9663060bb169980928e
af65ee394fe42103655a3ef8ba052765d2934fd0
refs/heads/master
2021-01-25T05:22:11.733236
2015-03-24T15:23:55
2015-03-24T15:23:55
29,433,818
0
0
null
null
null
null
UTF-8
Java
false
false
1,529
java
package dqmIII.blocks.decorate.render; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import dqmIII.blocks.decorate.model.DqmModelYajirusi2; import dqmIII.blocks.decorate.tileEntity.DqmTileEntityYajirusikiiro2; @SideOnly(Side.CLIENT) public class DqmTileEntityRenderYajirusikiiro2 extends TileEntitySpecialRenderer { private DqmModelYajirusi2 model = new DqmModelYajirusi2(); public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) { DqmTileEntityYajirusikiiro2 var9 = (DqmTileEntityYajirusikiiro2)var1; GL11.glPushMatrix(); GL11.glTranslatef((float)var2 + 0.5F, (float)var4 + 2.0F, (float)var6 + 0.5F); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); if (var9.getBlockMetadata() == 1) { GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); } if (var9.getBlockMetadata() == 2) { GL11.glRotatef(-180.0F, 0.0F, 1.0F, 0.0F); } if (var9.getBlockMetadata() == 3) { GL11.glRotatef(270.0F, 0.0F, 1.0F, 0.0F); } this.bindTexture(new ResourceLocation("dqm:textures/model/Ykiiro.png")); GL11.glPushMatrix(); this.model.modelRender(0.0625F); GL11.glPopMatrix(); GL11.glPopMatrix(); } }
07dd57453051f8ccf21afbf2673efd580313b0b7
03fe8e768605af0e5c4614c3780731d2637170e4
/CreditsScene.java
430a2ecdbf58644cf35cc9093d787df34f68d6fc
[]
no_license
uday2000/PvZ-2019-AP-Project
b3271f76fcb008496faf11167152e1317f9dceb2
33a96479a5f73d55a5ad0bca3db09f19bd0c4f26
refs/heads/master
2022-03-14T21:28:22.194834
2019-12-02T06:30:02
2019-12-02T06:30:02
214,791,593
0
0
null
null
null
null
UTF-8
Java
false
false
1,427
java
import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.stage.StageStyle; public class CreditsScene { private int panewidth = 1408; private int paneheight = 896; private Scene prevScene; private MusicController MC; public void setmc(MusicController mc) { MC = mc;} @FXML private ImageView backButtonImage; private Image backPressed = new Image(getClass().getResourceAsStream("assets\\sprites\\buttons\\BackButtonPressed.png")); private Image backReleased = new Image(getClass().getResourceAsStream("assets\\sprites\\buttons\\BackButtonReleased.png")); @FXML private void backPress() throws InterruptedException { backButtonImage.setImage(backPressed); } @FXML private void backRelease() { backButtonImage.setImage(backReleased); } public void backClick(MouseEvent _mouseEvent) throws Exception{ MC.playsfx("button"); Stage _stage = (Stage)((Node)_mouseEvent.getSource()).getScene().getWindow(); _stage.setScene(prevScene); } void setPrevScene(Scene _scene) { prevScene = _scene; } }
7cee93117c49851dac1bdf39b0c996ba01254905
304cd489a6eddea6436fa03105ae918693a476e1
/70. Climbing Stairs.java
e01e9ca5189c336db7295b1d428752051144cbef
[]
no_license
maxsidorov/leetcode
d45a86bb63e7012941d84415f55cec3bf4254e38
a98f78944bbf8f2df30301936f2bf78925b38336
refs/heads/master
2021-05-26T09:23:27.359980
2020-06-08T16:05:33
2020-06-08T16:05:33
128,077,141
0
0
null
null
null
null
UTF-8
Java
false
false
291
java
class Solution { public int climbStairs(int n) { if (n == 1 || n == 2) return n; int a = 1; int b = 2; int c = 0; for (int i = 3; i <= n; i++) { c = a + b; a = b; b = c; } return c; } }
e38fd432c93dbe176a964233aa868f592ee239d2
94cb0894acc5a87c7aa7bc1ded7fd249fbf32597
/java-1/src/main/java/net/m14m/ardecha/input/StringableFile.java
496f4c08ba612982903eed4ac884d590dec84767
[]
no_license
moss/architectural-design-challenge
52ff479e16063e57939a645c123e83286997a159
dbfc0e5be89fe9f2cdf843c904f7103df29d6f1d
refs/heads/master
2021-01-19T10:42:20.312473
2012-12-22T17:43:29
2012-12-22T17:43:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
725
java
package net.m14m.ardecha.input; import java.io.*; public class StringableFile { private File file; public StringableFile(File file) { this.file = file; } public String read() throws FileNotFoundException { FileReader fileReader = new FileReader(file); return copyReaderToString(fileReader); } private String copyReaderToString(FileReader fileReader) { try { StringBuilder builder = new StringBuilder(); while (fileReader.ready()) builder.appendCodePoint(fileReader.read()); fileReader.close(); return builder.toString(); } catch (IOException e) { throw new RuntimeException(e); } } }
5b5c542fc3ea117f944dd7fea5b588dbb3d5429e
0fb241fb9a49ffde60f851ffde64c02fdb171301
/widgets/src/main/java/com/qylk/code/widgets/localService.java
4cba4ebed2183420ba4dc9f26bd79ada1d964491
[]
no_license
qylk/code-lib
0bfb0448035bc785c922a5bac8ef8f67c8f82b19
cb19966a8d4080c25c0d053af3e84549256f6778
refs/heads/master
2021-01-17T05:20:49.357658
2015-05-01T16:19:30
2015-05-01T16:19:30
34,909,017
0
0
null
null
null
null
UTF-8
Java
false
false
1,936
java
package com.qylk.code.widgets; import android.app.Service; import android.content.Context; import android.content.Intent; import android.graphics.PixelFormat; import android.os.IBinder; import android.view.View; import android.view.WindowManager; import android.widget.TextView; public class localService extends Service { private WindowManager mWm; private final WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(); private View mContentView; private boolean isShowing = false; @Override public IBinder onBind(Intent intent) { return null; } @Override public void onCreate() { super.onCreate(); mContentView = createGenericView(); mWm = (WindowManager) getSystemService(Context.WINDOW_SERVICE); } private View createGenericView() { TextView tv = new TextView(this); tv.setTextSize(40); tv.setText("Window 123"); return tv; } private void showWindow(int windowflags) { final WindowManager.LayoutParams params = mParams; params.height = WindowManager.LayoutParams.WRAP_CONTENT; params.width = WindowManager.LayoutParams.WRAP_CONTENT; params.flags = windowflags; params.format = PixelFormat.TRANSLUCENT; params.type = WindowManager.LayoutParams.TYPE_PHONE; params.setTitle("window"); if (isShowing) mWm.removeView(mContentView); mWm.addView(mContentView, params); isShowing = true; } @Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null && intent.getExtras() != null) { int windowflags = intent.getExtras().getInt("flags"); windowflags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; windowflags |= WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE; showWindow(windowflags); } return super.onStartCommand(intent, flags, startId); } @Override public void onDestroy() { mWm.removeView(mContentView); super.onDestroy(); } }
ff2728852d3b3a52405cfebecd59e1e0a8701ba6
e41fdad3fbd95509f5d34deb485538e0a77780b3
/lowerupper.java
0f8b80e0fa779f20631f7bee7910e91af3bf5a5f
[]
no_license
siri134/milestone1
cdab93ab98aacc939b09d7f2a44668dbdc0d0dc4
6d6fad0db9ac7dab8dba016a27d58c07380a7d9e
refs/heads/master
2022-11-11T09:17:42.922127
2020-07-01T04:02:09
2020-07-01T04:02:09
274,296,228
0
0
null
null
null
null
UTF-8
Java
false
false
590
java
package com.wipro.flowcontrolstatements; public class lowerupper{ static void convertOpposite(StringBuffer str) { int ln = str.length(); for (int i=0; i<ln; i++) { Character c = str.charAt(i); if (Character.isLowerCase(c)) str.replace(i, i+1, Character.toUpperCase(c)+""); else str.replace(i, i+1, Character.toLowerCase(c)+""); } } public static void main(String[] args) { StringBuffer str = new StringBuffer("a"); convertOpposite(str); System.out.println(str); } }