blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
673b5ac74f8c84e471e7eabf7c3a829491ae680b
975e7897f324b24baf8feec7d62fbb237120fca7
/src/controller/DownloadController.java
54ec2e7b735f83ff3151d8537b520e20439de2ac
[]
no_license
qilixiang999/web
401c05f74b5efe26a5a7385e9c59f1802370701c
2fe8042bb090c057fbf88344dfa71f04c88e017e
refs/heads/main
2022-12-30T20:38:03.683354
2020-10-25T04:52:26
2020-10-25T04:52:26
null
0
0
null
null
null
null
GB18030
Java
false
false
3,858
java
package controller; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.net.URLEncoder; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import vo.Download; import dao.DownloadDao; public class DownloadController extends HttpServlet { /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { /* String path=request.getParameter("path"); response.setCharacterEncoding("utf-8");// 设置将字符以"UTF-8"编码输出到客户端浏览器 // 通过设置响应头控制浏览器以UTF-8的编码显示数据,如果不加这句话,那么浏览器显示的将是乱码 response.setHeader("content-type", "text/html;charset=utf-8"); PrintWriter out=response.getWriter(); out.write(path); out.flush(); out.close();*/ //1.获取要下载的文件的绝对路径 // String ph=request.getParameter("path"); String id=request.getParameter("id"); DownloadDao dao=new DownloadDao(); Download dd=dao.get(Integer.parseInt(id)); String path=request.getServletContext().getRealPath(dd.getPath()); //2.获取要下载的文件名 String fileName=path.substring(path.lastIndexOf("\\")+1); //3.设置content-disposition响应头控制浏览器以下载的形式打开文件 response.setHeader("content-disposition", "attachment;filename="+URLEncoder.encode(fileName, "UTF-8")); //4.获取要下载的文件输入流 InputStream in=new FileInputStream(path); int len=0; //5.创建数据缓冲区 byte[] buffer=new byte[1024]; //6.通过response对象获取OutputStream流 ServletOutputStream out=response.getOutputStream(); //7.将FileInputStream流写入到buffer缓冲区 while((len=in.read(buffer))!=-1){ //8.使用OutputStream将缓冲区的数据输出到客户端浏览器 out.write(buffer, 0, len); } in.close(); out.close(); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"); out.println("<HTML>"); out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>"); out.println(" <BODY>"); out.print(" This is "); out.print(this.getClass()); out.println(", using the POST method"); out.println(" </BODY>"); out.println("</HTML>"); out.flush(); out.close(); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } }
[ "noreply@github.com" ]
noreply@github.com
8db335fd1732dd05e07e25d25f6b319525a3a466
9a5090960e911a349bbb94d6c4037affaa57b9a8
/2.JavaCore/src/com/javarush/task/task14/task1408/UkrainianHen.java
740f0a28f9c93355b9cf332e5ba619bae483c08f
[]
no_license
AslaevAnton/JavaRushTasks
c84d6f87ea87d16ba8b6e8e1bc9b2cd7af60c790
6c68e1497e1a3af68f0a09179c5ae6466362397d
refs/heads/master
2021-01-22T13:47:46.469481
2018-06-08T11:49:20
2018-06-08T11:49:24
100,023,670
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package com.javarush.task.task14.task1408; public class UkrainianHen extends Hen { @Override int getCountOfEggsPerMonth() { return 30; } String getDescription(){ return super.getDescription()+" Моя страна - "+Country.UKRAINE+". Я несу "+this.getCountOfEggsPerMonth()+" яиц в месяц."; } }
[ "odeyalov@mail.ru" ]
odeyalov@mail.ru
1d7d902791f3174d278ac2d19ecc2f6c5590326d
b32393c52b244559caf547d8e1963a9d1f09da9f
/src/main/java/edu/aws/pwgenerator/domain/PlacesRepository.java
1646f338e9dcfce4577ef13ec2f2fdb7d1a55983
[]
no_license
coder983/pwgeneratorModern
5b0a03da9de4028a9d21f9e1c660bb243d75ba58
0570d123b7d08d655e3978f7235225fe8dfbe77d
refs/heads/master
2022-12-22T04:23:56.940495
2020-09-23T15:54:17
2020-09-23T15:54:17
289,141,932
0
0
null
null
null
null
UTF-8
Java
false
false
234
java
package edu.aws.pwgenerator.domain; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface PlacesRepository extends CrudRepository<Place, Long> { }
[ "coder983@protonmail.com" ]
coder983@protonmail.com
cd26ad97cbf22ae426d48caa940163abeac643db
044a3b64fd2c4001b56d1f26b3cdf92f9fa91884
/test/java/lang/ThreadLocalTest.java
e1c3c319a531bc70f709df1861f2953cdd20e54e
[]
no_license
msgpo/threadlocal
bcec83b212b16af81df144caae9320570e6f4e7c
36bcdc095184a973b40b22e04c86c165306cd5c0
refs/heads/master
2020-04-06T10:19:09.654028
2015-06-04T16:10:08
2015-06-04T16:10:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,873
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 java.lang; import junit.framework.TestCase; public class ThreadLocalTest extends TestCase { /** * @tests java.lang.ThreadLocal#ThreadLocal() */ public void test_Constructor() { try { new ThreadLocal<Object>(); } catch (Exception e) { fail("unexpected exception: " + e.toString()); } } /** * @tests java.lang.ThreadLocal#remove() */ public void test_remove() { ThreadLocal<String> tl = new ThreadLocal<String>() { @Override protected String initialValue() { return "initial"; } }; assertEquals("initial", tl.get()); tl.set("fixture"); assertEquals("fixture", tl.get()); tl.remove(); assertEquals("initial", tl.get()); } /** * @tests java.lang.ThreadLocal#get() */ public void test_get() { // Test for method java.lang.Object java.lang.ThreadLocal.get() ThreadLocal<Object> l = new ThreadLocal<Object>(); assertNull("ThreadLocal's initial value is null", l.get()); // The ThreadLocal has to run once for each thread that touches the // ThreadLocal final Object INITIAL_VALUE = "'foo'"; final ThreadLocal<Object> l1 = new ThreadLocal<Object>() { @Override protected Object initialValue() { return INITIAL_VALUE; } }; assertTrue("ThreadLocal's initial value should be " + INITIAL_VALUE + " but is " + l1.get(), l1.get() == INITIAL_VALUE); // We need this because inner types cannot assign to variables in // container method. But assigning to object slots in the container // method is ok. class ResultSlot { public Object result = null; } final ResultSlot THREADVALUE = new ResultSlot(); Thread t = new Thread() { @Override public void run() { THREADVALUE.result = l1.get(); } }; // Wait for the other Thread assign what it observes as the value of the // variable t.start(); try { t.join(); } catch (InterruptedException ie) { fail("Interrupted!!"); } assertTrue("ThreadLocal's initial value in other Thread should be " + INITIAL_VALUE, THREADVALUE.result == INITIAL_VALUE); /* Regression test for implementation vulnerability reported * on Harmony dev list. */ ThreadLocal<Object> thrVar = new ThreadLocal<Object>() { public int hashCode() { fail("ThreadLocal should not be asked for it's hashCode"); return 0; // never reached } }; thrVar.get(); } /** * @tests java.lang.ThreadLocal#set(java.lang.Object) */ public void test_setLjava_lang_Object() { // Test for method void java.lang.ThreadLocal.set(java.lang.Object) final Object OBJ = new Object(); final ThreadLocal<Object> l = new ThreadLocal<Object>(); l.set(OBJ); assertSame(OBJ, l.get()); assertTrue("ThreadLocal's initial value is " + OBJ, l.get() == OBJ); // We need this because inner types cannot assign to variables in // container method. // But assigning to object slots in the container method is ok. class ResultSlot { public Object result = null; } final ResultSlot THREADVALUE = new ResultSlot(); Thread t = new Thread() { @Override public void run() { THREADVALUE.result = l.get(); } }; // Wait for the other Thread assign what it observes as the value of the // variable t.start(); try { t.join(); } catch (InterruptedException ie) { fail("Interrupted!!"); } // ThreadLocal is not inherited, so the other Thread should see it as // null assertNull("ThreadLocal's value in other Thread should be null", THREADVALUE.result); } public void testInheritable() throws InterruptedException { final Object value = new Object(); final Object inheritedValue = new Object(); final ThreadLocal<Object> threadLocal = new InheritableThreadLocal<Object>() { @Override protected Object childValue(Object parentValue) { assertSame(value, parentValue); return inheritedValue; } }; threadLocal.set(value); final Object[] holder = new Object[1]; Thread thread = new Thread() { public void run() { holder[0] = threadLocal.get(); } }; thread.start(); thread.join(); assertSame(value, threadLocal.get()); assertSame(inheritedValue, holder[0]); } }
[ "crazyboblee@da60fd6c-d353-0410-9ca4-b9fdb003f7f6" ]
crazyboblee@da60fd6c-d353-0410-9ca4-b9fdb003f7f6
660bde9539f016570a1d3b4a9dfada37ab22cb73
84b0b4e116ede46125ba1a05ce111a91e162c1fc
/src/ast/sequences/List.java
1896aeb5255fec4d9d3eb67c06d31cd7fa4e4621
[]
no_license
himerzi/PCompiler
3b1a3b703f3be58409b17bf2b1ab93b6dd8c79e5
4dd01c5863f4fdd2625b69d379072801059736c0
refs/heads/master
2021-01-21T11:45:39.337476
2012-03-21T15:13:57
2012-03-21T15:13:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
275
java
package ast.sequences; import ast.expressions.ExprCSV; import visitor.Visitor; public class List extends SequenceNode { public List(ExprCSV l){ left = l; } @Override public Object accept(Visitor v) { // TODO Auto-generated method stub return v.visit(this); } }
[ "michael.detmold@thatcrowdthing.com" ]
michael.detmold@thatcrowdthing.com
4c39b8b0180add2bf4cffc9aa150ef3d7f23d5c9
fff8d45864fdca7f43e6d65acbe4c1f469531877
/erp_desktop_all/src_puntoventa/com/bydan/erp/puntoventa/presentation/swing/jinternalframes/auxiliar/report/CajaDiariaUsuarioTableCell.java
a9068afd6fa2209c73f9efc74d7ee3cd7ee3f9bf
[ "Apache-2.0" ]
permissive
jarocho105/pre2
26b04cc91ff1dd645a6ac83966a74768f040f418
f032fc63741b6deecdfee490e23dfa9ef1f42b4f
refs/heads/master
2020-09-27T16:16:52.921372
2016-09-01T04:34:56
2016-09-01T04:34:56
67,095,806
1
0
null
null
null
null
UTF-8
Java
false
false
26,892
java
/* *AVISO LEGAL © Copyright *Este programa esta protegido por la ley de derechos de autor. *La reproduccion o distribucion ilicita de este programa o de cualquiera de *sus partes esta penado por la ley con severas sanciones civiles y penales, *y seran objeto de todas las sanciones legales que correspondan. *Su contenido no puede copiarse para fines comerciales o de otras, *ni puede mostrarse, incluso en una version modificada, en otros sitios Web. Solo esta permitido colocar hipervinculos al sitio web. */ package com.bydan.erp.puntoventa.presentation.swing.jinternalframes.auxiliar.report; import com.bydan.erp.seguridad.business.entity.Usuario; import com.bydan.erp.seguridad.business.entity.Opcion; import com.bydan.erp.seguridad.business.entity.PerfilOpcion; import com.bydan.erp.seguridad.business.entity.PerfilCampo; import com.bydan.erp.seguridad.business.entity.PerfilAccion; import com.bydan.erp.seguridad.business.entity.ParametroGeneralSg; import com.bydan.erp.seguridad.business.entity.ParametroGeneralUsuario; import com.bydan.erp.seguridad.business.entity.Modulo; import com.bydan.erp.seguridad.business.entity.Accion; //import com.bydan.erp.seguridad.business.entity.PerfilAccion; import com.bydan.erp.seguridad.util.SistemaConstantesFunciones; import com.bydan.erp.seguridad.util.SistemaConstantesFuncionesAdditional; import com.bydan.erp.seguridad.business.logic.SistemaLogicAdditional; //import com.bydan.erp.puntoventa.util.CajaDiariaUsuarioConstantesFunciones; import com.bydan.erp.puntoventa.util.report.CajaDiariaUsuarioParameterReturnGeneral; //import com.bydan.erp.puntoventa.util.report.CajaDiariaUsuarioParameterGeneral; import com.bydan.framework.erp.business.dataaccess.ConstantesSql; import com.bydan.framework.erp.business.entity.Classe; import com.bydan.framework.erp.business.entity.DatoGeneral; import com.bydan.framework.erp.business.entity.DatoGeneralMinimo; import com.bydan.framework.erp.business.entity.GeneralEntity; import com.bydan.framework.erp.business.entity.Mensajes; //import com.bydan.framework.erp.business.entity.MaintenanceType; import com.bydan.framework.erp.util.MaintenanceType; import com.bydan.framework.erp.util.FuncionesReporte; import com.bydan.framework.erp.business.logic.DatosCliente; import com.bydan.framework.erp.business.logic.Pagination; import com.bydan.erp.puntoventa.presentation.swing.jinternalframes.report.CajaDiariaUsuarioBeanSwingJInternalFrame; import com.bydan.framework.erp.presentation.desktop.swing.TablaGeneralTotalModel; import com.bydan.framework.erp.presentation.desktop.swing.DateConverter; import com.bydan.framework.erp.presentation.desktop.swing.DateConverterFromDate; import com.bydan.framework.erp.presentation.desktop.swing.DateRenderer; import com.bydan.framework.erp.presentation.desktop.swing.DateEditorRenderer; import com.bydan.framework.erp.presentation.desktop.swing.BooleanRenderer; import com.bydan.framework.erp.presentation.desktop.swing.BooleanEditorRenderer; import com.bydan.framework.erp.presentation.desktop.swing.TextFieldRenderer; import com.bydan.framework.erp.presentation.desktop.swing.*; //import com.bydan.framework.erp.presentation.desktop.swing.TextFieldEditorRenderer; import com.bydan.framework.erp.presentation.desktop.swing.HeaderRenderer; import com.bydan.framework.erp.presentation.desktop.swing.JInternalFrameBase; import com.bydan.framework.erp.presentation.desktop.swing.FuncionesSwing; import com.bydan.framework.erp.presentation.desktop.swing.MainJFrame; import com.bydan.framework.erp.resources.imagenes.AuxiliarImagenes; import com.bydan.erp.puntoventa.resources.reportes.report.AuxiliarReportes; import com.bydan.erp.puntoventa.util.*; import com.bydan.erp.puntoventa.util.report.*; import com.bydan.erp.puntoventa.business.logic.*; import com.bydan.erp.seguridad.business.logic.*; import com.bydan.erp.cartera.business.logic.*; import com.bydan.erp.puntoventa.business.logic.*; //EJB //PARAMETROS //EJB PARAMETROS import com.bydan.framework.erp.business.logic.*; import com.bydan.framework.erp.util.*; import com.bydan.erp.puntoventa.business.entity.*; import com.bydan.erp.puntoventa.business.entity.report.*; //import com.bydan.framework.erp.business.entity.ConexionBeanFace; //import com.bydan.framework.erp.business.entity.Mensajes; import com.bydan.erp.seguridad.presentation.swing.jinternalframes.*; import com.bydan.erp.cartera.presentation.swing.jinternalframes.*; import com.bydan.erp.puntoventa.presentation.swing.jinternalframes.*; import java.net.NetworkInterface; import java.net.InterfaceAddress; import java.net.InetAddress; import javax.naming.InitialContext; import java.lang.Long; import java.util.Date; import java.util.Enumeration; import java.util.Iterator; import java.util.Set; import java.util.HashSet; import java.util.List; import java.util.ArrayList; import java.io.Serializable; import java.util.Hashtable; import java.io.File; import java.io.FileInputStream; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.FileOutputStream; import java.io.InputStream; import java.io.BufferedReader; import java.io.FileReader; import java.util.HashMap; import java.util.Map; import java.io.PrintWriter; import java.sql.SQLException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.stream.StreamSource; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.w3c.dom.Document; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.w3c.dom.Node; import org.w3c.dom.Element; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; //import org.hibernate.collection.PersistentBag; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRRuntimeException; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.util.JRLoader; import net.sf.jasperreports.engine.export.JRHtmlExporter; import net.sf.jasperreports.j2ee.servlets.BaseHttpServlet; import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.data.JRBeanArrayDataSource; import net.sf.jasperreports.view.JasperViewer; import org.apache.log4j.Logger; import com.bydan.framework.erp.business.entity.Reporte; //VALIDACION import org.hibernate.validator.ClassValidator; import org.hibernate.validator.InvalidValue; import net.sf.jasperreports.engine.JREmptyDataSource; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperPrintManager; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.JasperRunManager; import net.sf.jasperreports.engine.export.JExcelApiExporter; import net.sf.jasperreports.engine.export.JRCsvExporter; import net.sf.jasperreports.engine.export.JRRtfExporter; import net.sf.jasperreports.engine.export.JRXlsExporter; import net.sf.jasperreports.engine.export.JRXlsExporterParameter; import net.sf.jasperreports.engine.util.JRSaver; import net.sf.jasperreports.engine.xml.JRXmlWriter; import com.bydan.erp.puntoventa.presentation.web.jsf.sessionbean.*; import com.bydan.erp.puntoventa.presentation.web.jsf.sessionbean.report.*; import com.bydan.erp.puntoventa.presentation.swing.jinternalframes.report.CajaDiariaUsuarioJInternalFrame; import com.bydan.erp.puntoventa.presentation.swing.jinternalframes.report.CajaDiariaUsuarioDetalleFormJInternalFrame; import java.util.EventObject; import java.util.EventListener; import javax.swing.*; import javax.swing.border.Border; import javax.swing.event.*; import javax.swing.table.AbstractTableModel; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableModel; import javax.swing.table.TableColumn; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import java.awt.*; import java.awt.event.*; import org.jdesktop.beansbinding.Binding.SyncFailure; import org.jdesktop.beansbinding.BindingListener; import org.jdesktop.beansbinding.Bindings; import org.jdesktop.beansbinding.BeanProperty; import org.jdesktop.beansbinding.ELProperty; import org.jdesktop.beansbinding.AutoBinding.UpdateStrategy; import org.jdesktop.beansbinding.PropertyStateEvent; import org.jdesktop.swingbinding.JComboBoxBinding; import org.jdesktop.swingbinding.SwingBindings; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; import com.bydan.erp.seguridad.business.entity.*; import com.bydan.erp.cartera.business.entity.*; import com.bydan.erp.puntoventa.business.entity.*; import com.bydan.erp.seguridad.util.*; import com.bydan.erp.cartera.util.*; import com.bydan.erp.puntoventa.util.*; import com.bydan.erp.seguridad.presentation.web.jsf.sessionbean.*; import com.bydan.erp.cartera.presentation.web.jsf.sessionbean.*; import com.bydan.erp.puntoventa.presentation.web.jsf.sessionbean.*; @SuppressWarnings("unused") public class CajaDiariaUsuarioTableCell extends DefaultCellEditor implements TableCellRenderer { private static final long serialVersionUID = 1L; //PARA TABLECELL_FK public JInternalFrameBase jInternalFrameBase; protected JLabel jLabelCajaDiariaUsuario=new JLabelMe(); @SuppressWarnings("rawtypes") protected JComboBox jComboBoxCajaDiariaUsuario=new JComboBoxMe(); protected Object valor=new Object(); protected List<CajaDiariaUsuario> cajadiariausuariosForeignKey=new ArrayList<CajaDiariaUsuario>(); protected List<CajaDiariaUsuario> cajadiariausuariosForeignKeyActual=new ArrayList<CajaDiariaUsuario>(); protected Border borderResaltarCajaDiariaUsuario=null; protected Boolean conEnabled=true; protected Integer iTotalRow=0; protected Boolean conHotKeys=false; protected String sNombreHotKeyAbstractAction=""; protected String sTipoBusqueda="NINGUNO"; protected Integer rowActual=-1; protected ArrayList<Classe> classes; //PARA TABLECELL_FK_FIN //PARA TABLECELL public String sTipo="FK"; //"BOTON" protected JButton jButtonCajaDiariaUsuario; //PARA TABLECELL FIN //PARA TABLECELL_FK public CajaDiariaUsuarioTableCell() { super(new JCheckBoxMe()); } public CajaDiariaUsuarioTableCell(JInternalFrameBase jInternalFrameBase,Boolean conEnabled) { super(new JCheckBoxMe()); this.iTotalRow=0; this.conEnabled=conEnabled; this.conHotKeys=false; this.sNombreHotKeyAbstractAction=""; this.sTipoBusqueda="NINGUNO"; this.rowActual=-1; this.jInternalFrameBase=jInternalFrameBase; this.sTipo="FK"; } public CajaDiariaUsuarioTableCell(JInternalFrameBase jInternalFrameBase) { this(jInternalFrameBase,true); } public CajaDiariaUsuarioTableCell(JCheckBox checkBox,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) { super(checkBox); this.iTotalRow=0; this.conEnabled=conEnabled; this.conHotKeys=false; this.sNombreHotKeyAbstractAction=""; this.sTipoBusqueda="NINGUNO"; this.rowActual=-1; this.jInternalFrameBase=jInternalFrameBase; this.sTipo="FK"; } public CajaDiariaUsuarioTableCell(JCheckBox checkBox,JInternalFrameBase jInternalFrameBase) { this(checkBox,jInternalFrameBase,true); } @SuppressWarnings("rawtypes") public CajaDiariaUsuarioTableCell(JComboBox jcComboBox,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) { super(jcComboBox); this.iTotalRow=0; this.conEnabled=conEnabled; this.conHotKeys=false; this.sNombreHotKeyAbstractAction=""; this.sTipoBusqueda="NINGUNO"; this.rowActual=-1; this.jComboBoxCajaDiariaUsuario=jcComboBox; this.jInternalFrameBase=jInternalFrameBase; this.sTipo="FK"; } @SuppressWarnings("rawtypes") public CajaDiariaUsuarioTableCell(JComboBox jcComboBox,JInternalFrameBase jInternalFrameBase) { this(jcComboBox,jInternalFrameBase,true); } public CajaDiariaUsuarioTableCell(List<CajaDiariaUsuario> cajadiariausuariosForeignKey,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) { super(new JCheckBoxMe()); this.iTotalRow=0; this.conEnabled=conEnabled; this.conHotKeys=false; this.sNombreHotKeyAbstractAction=""; this.sTipoBusqueda="NINGUNO"; this.rowActual=-1; this.cajadiariausuariosForeignKey=cajadiariausuariosForeignKey; this.jInternalFrameBase=jInternalFrameBase; this.sTipo="FK"; } public CajaDiariaUsuarioTableCell(List<CajaDiariaUsuario> cajadiariausuariosForeignKey,JInternalFrameBase jInternalFrameBase) { this(cajadiariausuariosForeignKey,jInternalFrameBase,true); } public CajaDiariaUsuarioTableCell(List<CajaDiariaUsuario> cajadiariausuariosForeignKey,Border borderResaltarCajaDiariaUsuario,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) { super(new JCheckBoxMe()); this.iTotalRow=0; this.conEnabled=conEnabled; this.conHotKeys=false; this.sNombreHotKeyAbstractAction=""; this.sTipoBusqueda="NINGUNO"; this.rowActual=-1; this.cajadiariausuariosForeignKey=cajadiariausuariosForeignKey; this.borderResaltarCajaDiariaUsuario=borderResaltarCajaDiariaUsuario; this.jInternalFrameBase=jInternalFrameBase; this.sTipo="FK"; } public CajaDiariaUsuarioTableCell(List<CajaDiariaUsuario> cajadiariausuariosForeignKey,Border borderResaltarCajaDiariaUsuario,JInternalFrameBase jInternalFrameBase,Boolean conEnabled,Integer iTotalRow) { super(new JCheckBoxMe()); this.iTotalRow=iTotalRow; this.conEnabled=conEnabled; this.conHotKeys=false; this.sNombreHotKeyAbstractAction=""; this.sTipoBusqueda="NINGUNO"; this.rowActual=-1; this.cajadiariausuariosForeignKey=cajadiariausuariosForeignKey; this.borderResaltarCajaDiariaUsuario=borderResaltarCajaDiariaUsuario; this.jInternalFrameBase=jInternalFrameBase; this.sTipo="FK"; } public CajaDiariaUsuarioTableCell(List<CajaDiariaUsuario> cajadiariausuariosForeignKey,Border borderResaltar,JInternalFrameBase jInternalFrameBase) { this(cajadiariausuariosForeignKey,borderResaltar,jInternalFrameBase,true); } public CajaDiariaUsuarioTableCell(List<CajaDiariaUsuario> cajadiariausuariosForeignKey,Border borderResaltarCajaDiariaUsuario,JInternalFrameBase jInternalFrameBase,Boolean conEnabled,Boolean conHotKeys,String sNombreHotKeyAbstractAction,String sTipoBusqueda) { super(new JCheckBoxMe()); this.iTotalRow=0; this.conEnabled=conEnabled; this.conHotKeys=conHotKeys; this.sNombreHotKeyAbstractAction=sNombreHotKeyAbstractAction; this.sTipoBusqueda=sTipoBusqueda; this.rowActual=-1; this.cajadiariausuariosForeignKey=cajadiariausuariosForeignKey; this.borderResaltarCajaDiariaUsuario=borderResaltarCajaDiariaUsuario; this.jInternalFrameBase=jInternalFrameBase; this.sTipo="FK"; } //PARA TABLECELL_FK_FIN public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column) { Component component=new JCheckBoxMe(); if(sTipo=="FK") { component=this.getTableCellRendererComponentParaTableCellFk(table,value,isSelected,hasFocus,row,column); } else if(sTipo=="BOTON") { component=this.getTableCellRendererComponentParaTableCell(table,value,isSelected,hasFocus,row,column); } return component; } public Component getTableCellEditorComponent(JTable table,Object value,boolean isSelected,int row,int column) { Component component=new JCheckBoxMe(); if(sTipo=="FK") { component=this.getTableCellEditorComponentParaTableCellFk(table,value,isSelected,row,column); } else if(sTipo=="BOTON") { component=this.getTableCellEditorComponentParaTableCell(table,value,isSelected,row,column); } return component; } public Component getTableCellRendererComponentParaTableCellFk(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column) { try{ int intSelectedRow = row; //ARCHITECTURE /* if(Constantes.ISUSAEJBLOGICLAYER) { perfil =(Perfil) perfilLogic.getPerfils().toArray()[table.convertRowIndexToModel(intSelectedRow)]; } else if(Constantes.ISUSAEJBREMOTE) { perfil =(Perfil) perfils.toArray()[table.convertRowIndexToModel(intSelectedRow)]; } */ //ARCHITECTURE jLabelCajaDiariaUsuario=new JLabelMe(); /* if(perfil.getIsChanged()) { perfil.setsistema_descripcion((getActualSistemaForeignKeyDescripcion((Long)value))); } */ String sCajaDiariaUsuarioDescripcion=""; sCajaDiariaUsuarioDescripcion=jInternalFrameBase.getDescripcionFk("CajaDiariaUsuario",table,value,intSelectedRow); jLabelCajaDiariaUsuario.setText(sCajaDiariaUsuarioDescripcion); if(this.borderResaltarCajaDiariaUsuario!=null) { jLabelCajaDiariaUsuario.setBorder(this.borderResaltarCajaDiariaUsuario); } jLabelCajaDiariaUsuario.setOpaque(true); //if(row!=(this.iTotalRow-1)) { if((this.jInternalFrameBase.conTotales && row != table.getRowCount()-1) || !this.jInternalFrameBase.conTotales) { jLabelCajaDiariaUsuario.setBackground(row % 2 == 0 ? FuncionesSwing.getColorTextFields(Constantes2.S_FONDOCONTROL_COLOR) : Funciones2.getColorFilaTabla2()); } else { jLabelCajaDiariaUsuario.setBackground(Funciones2.getColorFilaTablaTotales()); } if(isSelected) { jLabelCajaDiariaUsuario.setForeground(FuncionesSwing.getColorSelectedForeground()); } } catch(Exception e) { ; } this.jLabelCajaDiariaUsuario.setEnabled(this.conEnabled); FuncionesSwing.setBoldLabel(this.jLabelCajaDiariaUsuario, this.jInternalFrameBase.getsTipoTamanioGeneralTabla(),true,false,this.jInternalFrameBase); return this.jLabelCajaDiariaUsuario; } @SuppressWarnings({"unchecked" }) public Component getTableCellEditorComponentParaTableCellFk(JTable table,Object value,boolean isSelected,int row,int column) { this.jComboBoxCajaDiariaUsuario=new JComboBoxMe(); try{ int intSelectedRow = row; //ARCHITECTURE /* if(Constantes.ISUSAEJBLOGICLAYER) { perfil =(Perfil) perfilLogic.getPerfils().toArray()[table.convertRowIndexToModel(intSelectedRow)]; } else if(Constantes.ISUSAEJBREMOTE) { perfil =(Perfil) perfils.toArray()[table.convertRowIndexToModel(intSelectedRow)]; } */ //ARCHITECTURE if(!CajaDiariaUsuarioJInternalFrame.ISBINDING_MANUAL) { } else { this.jComboBoxCajaDiariaUsuario.removeAllItems(); //SIEMPRE <0 , NO USADO POR EL MOMENTO //COMBO DE FILA ACTUAL SE ACTUALIZA, LOS DEMAS USAN EL ANTERIOR COMBO if(this.rowActual<0 || (this.rowActual>=0 && this.rowActual!=row)) { for(CajaDiariaUsuario cajadiariausuario:this.cajadiariausuariosForeignKey) { this.jComboBoxCajaDiariaUsuario.addItem(cajadiariausuario); } } else { if(this.rowActual==row && row>=0) { for(CajaDiariaUsuario cajadiariausuario:this.cajadiariausuariosForeignKeyActual) { this.jComboBoxCajaDiariaUsuario.addItem(cajadiariausuario); } } } } //this.jComboBoxCajaDiariaUsuario.setSelectedItem(perfil.getCajaDiariaUsuario()); //setActualCajaDiariaUsuarioForeignKey((Long)value,false,"Formulario"); CajaDiariaUsuarioBeanSwingJInternalFrame.setActualComboBoxCajaDiariaUsuarioGenerico((Long)value,this.jComboBoxCajaDiariaUsuario,this.cajadiariausuariosForeignKey); if(this.conHotKeys) { CajaDiariaUsuarioBeanSwingJInternalFrame.setHotKeysComboBoxCajaDiariaUsuarioGenerico(this.jComboBoxCajaDiariaUsuario,this.jInternalFrameBase,this.sNombreHotKeyAbstractAction,this.sTipoBusqueda); } //NO_FUNCIONA_perfil.setsistema_descripcion(getActualCajaDiariaUsuarioForeignKeyDescripcion((Long)value)); valor=value; this.jComboBoxCajaDiariaUsuario.setOpaque(true); } catch(Exception e) { e.printStackTrace(); } this.jComboBoxCajaDiariaUsuario.setEnabled(this.conEnabled); FuncionesSwing.setBoldComboBox(this.jComboBoxCajaDiariaUsuario, this.jInternalFrameBase.getsTipoTamanioGeneralTabla(),true,false,this.jInternalFrameBase); return this.jComboBoxCajaDiariaUsuario; } public Component getTableCellRendererComponentParaTableCell(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column) { jButtonCajaDiariaUsuario =new JButtonMe((row+1)+"-Caja Diaria Usuario"); jButtonCajaDiariaUsuario.setToolTipText((row+1)+"-Caja Diaria Usuario"); if(this.borderResaltarCajaDiariaUsuario!=null) { jButtonCajaDiariaUsuario.setBorder(this.borderResaltarCajaDiariaUsuario); } jButtonCajaDiariaUsuario.setOpaque(true); jButtonCajaDiariaUsuario.setBackground(row % 2 == 0 ? FuncionesSwing.getColorTextFields(Constantes2.S_FONDOCONTROL_COLOR) : Funciones2.getColorFilaTabla2()); if(isSelected) { jButtonCajaDiariaUsuario.setForeground(FuncionesSwing.getColorSelectedForeground()); } this.jButtonCajaDiariaUsuario.setEnabled(this.conEnabled); return jButtonCajaDiariaUsuario; } public Component getTableCellEditorComponentParaTableCell(JTable table,Object value,boolean isSelected,final int row,int column) { jButtonCajaDiariaUsuario=new JButtonMe((row+1)+"-Caja Diaria Usuario"); jButtonCajaDiariaUsuario.setToolTipText((row+1)+"-Caja Diaria Usuario"); if(this.borderResaltarCajaDiariaUsuario!=null) { jButtonCajaDiariaUsuario.setBorder(this.borderResaltarCajaDiariaUsuario); } /* jButtonCajaDiariaUsuario.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { //jButtonCajaDiariaUsuarioActionPerformed(evt,row,true,false); jInternalFrameBase.jButtonRelacionActionPerformed("CajaDiariaUsuario",evt,row,true,false); } } ); */ this.jButtonCajaDiariaUsuario.addActionListener(new ButtonActionListener(this.jInternalFrameBase,"TableCell","CajaDiariaUsuario",row)); valor=value; this.jButtonCajaDiariaUsuario.setEnabled(this.conEnabled); return jButtonCajaDiariaUsuario; } public CajaDiariaUsuarioTableCell(Border borderResaltarCajaDiariaUsuario,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) { super(new JCheckBoxMe()); this.conEnabled=conEnabled; this.jInternalFrameBase=jInternalFrameBase; this.borderResaltarCajaDiariaUsuario=borderResaltarCajaDiariaUsuario; this.sTipo="BOTON"; } public CajaDiariaUsuarioTableCell(Border borderResaltarCajaDiariaUsuario,JInternalFrameBase jInternalFrameBase) { this(borderResaltarCajaDiariaUsuario,jInternalFrameBase,true); } public Object getCellEditorValue() { Object value=new Object(); Long idActual=0L; if(sTipo=="FK") { CajaDiariaUsuario cajadiariausuario=((CajaDiariaUsuario)this.jComboBoxCajaDiariaUsuario.getSelectedItem()); if(cajadiariausuario!=null) { idActual=cajadiariausuario.getId(); } value=idActual; } else if(sTipo=="BOTON") { value=valor; } return value; } public boolean stopCellEditing() { fireEditingStopped(); return true; } public Integer getRowActual() { return this.rowActual; } public void setRowActual(Integer rowActual) { this.rowActual = rowActual; } public Boolean getConEnabled() { return this.conEnabled; } public void setConEnabled(Boolean conEnabled) { this.conEnabled = conEnabled; } public Boolean getConHotKeys() { return this.conHotKeys; } public void setConHotKeys(Boolean conHotKeys) { this.conHotKeys = conHotKeys; } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxCajaDiariaUsuario() { return this.jComboBoxCajaDiariaUsuario; } @SuppressWarnings("rawtypes") public void setjComboBoxCajaDiariaUsuario(JComboBox jComboBoxCajaDiariaUsuario) { this.jComboBoxCajaDiariaUsuario = jComboBoxCajaDiariaUsuario; } public List<CajaDiariaUsuario> getcajadiariausuariosForeignKey() { return this.cajadiariausuariosForeignKey; } public void setcajadiariausuariosForeignKey(List<CajaDiariaUsuario> cajadiariausuariosForeignKey) { this.cajadiariausuariosForeignKey = cajadiariausuariosForeignKey; } public List<CajaDiariaUsuario> getcajadiariausuariosForeignKeyActual() { return this.cajadiariausuariosForeignKeyActual; } public void setcajadiariausuariosForeignKeyActual(List<CajaDiariaUsuario> cajadiariausuariosForeignKeyActual) { this.cajadiariausuariosForeignKeyActual = cajadiariausuariosForeignKeyActual; } @SuppressWarnings("unchecked") public void RecargarCajaDiariaUsuariosForeignKey() { this.jComboBoxCajaDiariaUsuario.removeAllItems(); //SIEMPRE <0 , NO USADO POR EL MOMENTO //COMBO DE FILA ACTUAL SE ACTUALIZA, LOS DEMAS USAN EL ANTERIOR COMBO if(this.rowActual<0) { for(CajaDiariaUsuario cajadiariausuario:this.cajadiariausuariosForeignKey) { this.jComboBoxCajaDiariaUsuario.addItem(cajadiariausuario); } } else { for(CajaDiariaUsuario cajadiariausuario:this.cajadiariausuariosForeignKeyActual) { this.jComboBoxCajaDiariaUsuario.addItem(cajadiariausuario); } } } }
[ "byrondanilo10@hotmail.com" ]
byrondanilo10@hotmail.com
e1431d2221a8382efbc499d8b5ca43b7f7513734
56d0c0f34b3b08dead32a23c35c6e9adf8cb34c2
/src/second/AbstractSource.java
9783e0546f44aaabafa6d42e4118837cbe76c3dc
[]
no_license
Cassielzh/DesignPattren
77f99c20631f9df64f26b8498e70db8a180fdfae
54fbac4ebd8284902d68d3ba92144a1de181689f
refs/heads/main
2023-06-04T21:00:03.743760
2021-06-20T11:46:29
2021-06-20T11:46:29
361,356,584
0
0
null
null
null
null
UTF-8
Java
false
false
53
java
package second; public interface AbstractSource { }
[ "1563350461@qq.com" ]
1563350461@qq.com
d8cd5ec130699b21064f19938a7d864286eaf4c8
000b20acf061ee0b8231d9a57df75946e8ef8f84
/ServletUsers/src/java/servlets/DeleteUser.java
bedbf09cdd088b0273ef28712a58cd8fd7f89ced
[]
no_license
blankazucenalg/WebApplicationDev
720b3fa3344d6bbe32e7b5dc4c59fa1811ac188a
83df525e09055ed805149c148a3bb467c0529031
refs/heads/master
2016-09-05T16:04:15.586031
2015-03-11T09:06:04
2015-03-11T09:06:04
23,768,929
0
0
null
2015-03-09T03:23:33
2014-09-07T19:34:39
Java
UTF-8
Java
false
false
4,210
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 classes.User; import classes.UserDelegate; import java.io.IOException; import java.io.PrintWriter; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author azu */ @WebServlet(name = "DeleteUser", urlPatterns = {"/DeleteUser"}) public class DeleteUser 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 (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>\n" + " <head>\n" + " <title>Eliminar usuario</title>\n" + " <meta charset=\"UTF-8\">\n" + " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n" + " <link rel=\"stylesheet\" href=\"styles/principal.css\" title=\"Estilo principal\"/>\n" + " </head>\n" + " <body>\n" + " <div id=\"menubar\">\n" + " <ul>\n" + " <li><a href=\"ManageUsers?search=\">Búsqueda de usuarios</a></li>\n" + " <li><a href=\"SignUp.jsp\">Registrar nuevo usuario</a></li>\n" + " <li><a href=\"index.jsp\">Cerrar sesión</a></li>\n" + " </ul>\n" + " </div>\n" + " <div id=\"content\">\n" + " <h1>Eliminar usuario</h1>\n" + " <p>No fue posible eliminar el usuario</p>" + " </div>\n" + " </body>\n" + "</html>"); } } // <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 { int idUser = Integer.parseInt(request.getParameter("idUser")); UserDelegate finder = new UserDelegate(); UserDelegate manager = new UserDelegate(); User user = null; try { user = finder.selectUserById(idUser); manager.deleteUser(user); System.out.println("Erased"); response.sendRedirect("ManageUsers?search="); } catch (SQLException ex) { Logger.getLogger(DeleteUser.class.getName()).log(Level.SEVERE, null, ex); } 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> }
[ "blankazucenalg@gmail.com" ]
blankazucenalg@gmail.com
28e0485470403f4fbe308dd63f2dd5419f4fb918
df1c7d8471e63309491b98e6d6f03c7523491d6a
/behavior/visitor/ShoppingCartVisitor.java
0fc53d16cc0d939603f595fb2754b0769a3f14f1
[]
no_license
pvnhat/DesignPatternJava
fb1ebfb88eb1f3f1196968013dd14c57b7d5b7ee
915860db4376796a543c1993026ce612f1b609b1
refs/heads/master
2020-04-03T14:04:27.294465
2018-10-30T03:50:15
2018-10-30T03:50:15
155,310,797
0
0
null
null
null
null
UTF-8
Java
false
false
109
java
package visitor; public interface ShoppingCartVisitor { int visit(Book book); int visit(Fruit fruit); }
[ "vannhat3097@gmail.com" ]
vannhat3097@gmail.com
68e3a35f654ca11d48e805c0ff79997d1962bf27
114843d130feeb59f13f908503d37e9182926614
/src/lk/ijse/mountCalvary/dao/custom/EventDAO.java
bdc3dfad3834ee53fff5712f44cf945f2d75a0eb
[]
no_license
PandukaNandara/Mount
c5133c700348b7f60089987ef4301ea1cd4021be
fa5009cbfc825b36d194c177063e98d7da878047
refs/heads/master
2021-07-13T06:48:29.521026
2020-05-18T13:25:50
2020-05-18T13:25:50
135,074,895
0
0
null
2020-05-18T13:25:52
2018-05-27T19:19:47
null
UTF-8
Java
false
false
349
java
package lk.ijse.mountCalvary.dao.custom; import lk.ijse.mountCalvary.dao.CrudDAO; import lk.ijse.mountCalvary.entity.Event; import java.util.ArrayList; public interface EventDAO extends CrudDAO<Event, Integer> { boolean saveWithoutPKey(Event evt) throws Exception; ArrayList<Event> getEventsForThisActivity(int aid) throws Exception; }
[ "pandukanandara@outlook.com" ]
pandukanandara@outlook.com
66d0e1b9d07a0c9f6a844f0e7c112071eb447957
8928c72d45207ce1aeb88d9f9c7868d181dfc6dd
/src/Game.java
3edbe285846e8b6f8a3aeb7ab890b68a8dcdde88
[]
no_license
KiddoKiddo/DistributedMazeGame
a01cbf94cbfd7743ae7181d32e00ba500eac540e
b30cb6670942db27a4f93ae2b8407025d00fab25
refs/heads/master
2021-06-03T09:01:11.488644
2016-09-23T08:04:30
2016-09-23T08:04:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,127
java
import java.io.Serializable; import java.util.HashMap; import java.util.Map; import java.util.Random; import java.util.Set; public class Game implements Serializable { private static final long serialVersionUID = 6148003629986301236L; private static final String TREASURE = "*"; int N, K; Map<String, Player> players; String[][] board; public Game(int N, int K) throws GameException { if (K > N * N) throw new GameException("Too many treasures"); this.N = N; this.K = K; this.players = new HashMap<String, Player>(); this.board = new String[N][N]; generateTreasures(K); } public Game(Game game) { this.N = game.getN(); this.K = game.getK(); this.players = game.getPlayers(); this.board = game.getBoard(); } public synchronized void updatePlayers(Set<String> currentPlayers) { for (String playerId : players.keySet()) { if (!currentPlayers.contains(playerId)) { removePlayer(playerId); } } } public synchronized void addPlayer(String playerId) { Location loc = randomEmptyLocation(); board[loc.getX()][loc.getY()] = playerId; Player player = new Player(playerId, loc); players.put(playerId, player); } public synchronized void removePlayer(String playerId) { Player p = players.get(playerId); if(p == null) return; // Already remove board[p.getLocation().getX()][p.getLocation().getY()] = null; players.remove(playerId); } public Location randomEmptyLocation() { Random rand = new Random(); int x, y; do { x = rand.nextInt(N); y = rand.nextInt(N); } while (board[x][y] != null); // Should not occupied by any player and treasures return new Location(x, y); } public boolean isOccupiedByPlayer(Location loc){ return board[loc.getX()][loc.getY()] != null && ! board[loc.getX()][loc.getY()].equals(TREASURE); } public boolean isOccupiedByTreasure(Location loc){ return board[loc.getX()][loc.getY()] != null && board[loc.getX()][loc.getY()].equals(TREASURE); } public boolean validLocation(Location loc) { return (loc.x >= 0 && loc.y >= 0 && loc.x < N && loc.y < N); } public boolean move(String playerId, int direction) { Player player = players.get(playerId); Location dest = new Location(player.getLocation()); switch (direction) { case 1: dest.y--; break; case 2: dest.x++; break; case 3: dest.y++; break; case 4: dest.x--; break; default: break; // should not fall into this case } if (validLocation(dest) && ! isOccupiedByPlayer(dest)) { boolean foundTreasure = isOccupiedByTreasure(dest); // Move player board[player.getLocation().getX()][player.getLocation().getY()] = null; board[dest.getX()][dest.getY()] = player.getId(); player.moveTo(dest); // Increase score and generate treasure if(foundTreasure){ System.out.println("Player "+playerId+" got a TREASURE!!!"); player.increaseScore(); generateTreasures(1); } return true; } return false; } public void generateTreasures(int total) { int count = 0; while(count < total){ Location treasure = randomEmptyLocation(); board[treasure.getX()][treasure.getY()] = TREASURE; count++; } } public int getN() { return N; } public void setN(int n) { N = n; } public int getK() { return K; } public void setK(int k) { K = k; } public Map<String, Player> getPlayers() { return players; } public void setPlayers(Map<String, Player> players) { this.players = players; } public String[][] getBoard() { return board; } public void setBoard(String[][] board) { this.board = board; } public void printScore(){ StringBuilder sb = new StringBuilder(); sb.append("Score: "); for(String id : players.keySet()){ sb.append(id+"("+players.get(id).getScore()+") "); } System.out.println(sb.toString()); } public void printBoard(){ StringBuilder sb = new StringBuilder(); for(int i=0; i<board.length; i++){ sb.append("."); for(int j=0; j<board[0].length; j++){ sb.append(String.format("%2s", board[i][j]==null? " " : board[i][j])+"."); } sb.append("\r\n"); } System.out.print(sb.toString()); } }
[ "truongchauthy@hotmail.com" ]
truongchauthy@hotmail.com
e2d0b3bfbcbcc57518b7face4bfee054065ae12c
88ab6e1b4997e6356ca3a8bf2d042d777ffba1a1
/src/com/hiya/concurrent/safety/problem/PCClient.java
302288f20d8e2e8372111e87e45bbe401ed121fc
[]
no_license
13802706376/HIYA_CORE_CODES_6ISA_HiyaConcurrentPro
5c44cb09f84ffe1d5d4880c48c9a57f0d1450086
bdd268ab42eca6aec57402f1bbef7b4802d3ed7c
refs/heads/master
2020-04-09T18:45:07.937258
2018-12-05T13:31:05
2018-12-05T13:31:05
160,522,507
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
package com.hiya.concurrent.safety.problem; import java.util.LinkedList; import java.util.Queue; public class PCClient { public static void main(String[] args) { final Queue<Integer> sharedQ = new LinkedList<Integer>(); Thread producer = new Thread(new PCProducer(sharedQ)); Thread consumer =new Thread( new PCConsumer(sharedQ)); producer.start(); consumer.start(); } }
[ "caozhijun@caozhijun-book" ]
caozhijun@caozhijun-book
4f570849c343a32dbe2377c3990a48b4bff9b378
ef75d59e95b40cf14ac7462e1708129370f23416
/src/com/algorithm/search/InsertValueSearch.java
44402271625fd9527e1c09b3ac74c9cbe7a8f227
[]
no_license
java-shixiaotao/DataStructure_Algorithm
26280cfa079ad98ec40a8a36dcf4ebd4dcf8bd46
052ccd144b3de999b0aa725247d9b98c2384d7c5
refs/heads/main
2023-02-28T06:42:15.188360
2021-02-02T14:47:15
2021-02-02T14:47:15
324,929,620
0
0
null
null
null
null
UTF-8
Java
false
false
1,122
java
package com.algorithm.search; import java.util.Arrays; /** * 插值查找(前提:有序的数组) */ public class InsertValueSearch { public static void main(String[] args) { int[] arr = new int[100]; for (int i = 0; i < arr.length; i++){ arr[i] = i + 1; } System.out.println(Arrays.toString(arr)); int index = insertValueSearch(arr, 0, arr.length - 1, 1); System.out.println("index = " + index); } public static int insertValueSearch(int[] arr, int left, int right,int value){ System.out.println("hello"); if (left > right || value < arr[left] || value > arr[right]){ return -1; } int mid = left + (right - left) * (value - arr[left]) / (arr[right] - arr[left]); if (value > arr[mid]){ //如果值大于中间值,向右递归 return insertValueSearch(arr,mid+1,right,value); } else if (value < arr[mid]){ //如果值小于中间值,向左递归 return insertValueSearch(arr,left,mid -1,value); } else { return mid; } } }
[ "549872907@qq.com" ]
549872907@qq.com
6e6fac0df32a2532a8219caef0f7196914d68cbf
42fce9c1c0f1a6f3efc47ef6e635ff33ca57f748
/src/onlinebook/UserAdminEO.java
c261434ef758dc74a1afa2ee08b8736c73eeb78a
[]
no_license
EdsonWei/jsf_weizj
127f542d0f4a8af38b7fa6b3a25eb5d31b26b5e2
8311e4c1420bf96f582822b5416447756f181f6f
refs/heads/master
2021-01-20T00:58:26.097153
2014-09-14T10:14:47
2014-09-14T10:14:47
24,019,034
1
0
null
null
null
null
GB18030
Java
false
false
1,205
java
package onlinebook; import java.io.Serializable; import javax.persistence.*; import java.util.List; @Entity //实体Bean StudentEO用来构造与数据库中的表students的映射 @Table(name="useradmin") @NamedQueries({ //在此定义用于此实体类的常用的查询 @NamedQuery(name = "findAdminByIduser", query = "SELECT l FROM UserAdminEO l " + " where l.user=:name") //, @NamedQuery(name = "findStudentByName", query = "SELECT DISTINCT l FROM StudentEO l " //+ " WHERE l.studentName = :studentName") //, @NamedQuery(name = "findStudentByID", query = "SELECT DISTINCT l FROM StudentEO l " //+ " WHERE l.studentNum = :studentNum") }) public class UserAdminEO implements Serializable { private static final long serialVersionUID = 1L; //@Id指明关键字,每个实体类都必须要有 @Id @Column(name="user") private String user; @Column(name="pwd") private String pwd; public String getUser() { return user; } public void setUser(String name) { this.user = name; } public String getPwd() { return pwd; } public void setPwd(String pwd) { this.pwd = pwd; } public static long getSerialversionuid() { return serialVersionUID; } }
[ "1967562320@qq.com" ]
1967562320@qq.com
01d0f1dd15e822d1c75ab7d593940efc3a50f853
b60da22bc192211b3978764e63af23e2e24081f5
/cdc/src/share/personal/classes/awt/peer_based/java/awt/event/KeyEvent.java
3de52f6e777f35c63d2a8b363da801e46cdf1aa1
[]
no_license
clamp03/JavaAOTC
44d566927c057c013538ab51e086c42c6348554e
0ade633837ed9698cd74a3f6928ebde3d96bd3e3
refs/heads/master
2021-01-01T19:33:51.612033
2014-12-02T14:29:58
2014-12-02T14:29:58
27,435,591
5
4
null
null
null
null
UTF-8
Java
false
false
53,147
java
/* * @(#)KeyEvent.java 1.54 06/10/10 * * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. * */ /* * Warning : * Two versions of this file exist in this workspace. * One for Personal Basis, and one for Personal Profile. * Don't edit the wrong one !!! */ package java.awt.event; import java.awt.Component; import java.awt.Toolkit; import java.io.ObjectInputStream; import java.io.IOException; /** * An event which indicates that a keystroke occurred in a component. * <P> * This low-level event is generated by a component object (such as a text * field) when a key is pressed, released, or typed. * The event is passed to every <code>KeyListener</code> * or <code>KeyAdapter</code> object which registered to receive such * events using the component's <code>addKeyListener</code> method. * (<code>KeyAdapter</code> objects implement the * <code>KeyListener</code> interface.) Each such listener object * gets this <code>KeyEvent</code> when the event occurs. * * <p> * <em>"Key typed" events</em> are higher-level and generally do not depend on * the platform or keyboard layout. They are generated when a character is * entered, and are the preferred way to find out about character input. * In the simplest case, a key typed event is produced by a single key press * (e.g., 'a'). Often, however, characters are produced by series of key * presses (e.g., 'shift' + 'a'), and the mapping from key pressed events to * key typed events may be many-to-one or many-to-many. Key releases are not * usually necessary to generate a key typed event, but there are some cases * where the key typed event is not generated until a key is released (e.g., * entering ASCII sequences via the Alt-Numpad method in Windows). * No key typed events are generated for keys that don't generate characters * (e.g., action keys, modifier keys, etc.). * The getKeyChar method always returns a valid Unicode character or * CHAR_UNDEFINED. * For key pressed and key released events, the getKeyCode method returns * the event's keyCode. For key typed events, the getKeyCode method * always returns VK_UNDEFINED. * * <p> * <em>"Key pressed" and "key released" events</em> are lower-level and depend * on the platform and keyboard layout. They are generated whenever a key is * pressed or released, and are the only way to find out about keys that don't * generate character input (e.g., action keys, modifier keys, etc.). The key * being pressed or released is indicated by the getKeyCode method, which returns * a virtual key code. * * <p> * <em>Virtual key codes</em> are used to report which keyboard key has * been pressed, rather than a character generated by the combination * of one or more keystrokes (like "A", which comes from shift and "a"). * * <P> * For example, pressing the Shift key will cause a KEY_PRESSED event * with a VK_SHIFT keyCode, while pressing the 'a' key will result in * a VK_A keyCode. After the 'a' key is released, a KEY_RELEASED event * will be fired with VK_A. Separately, a KEY_TYPED event with a keyChar * value of 'A' is generated. * * <P> * Notes: * <ul> * <li>Key combinations which do not result in characters, such as action keys * like F1 and the HELP key, do not generate KEY_TYPED events. * <li>Not all keyboards or systems are capable of generating all * virtual key codes. No attempt is made in Java to artificially * generate these keys. * <li>Virtual key codes do not identify a physical key, they depend on the * platform and keyboard layout. For * example, the key that on a Windows U.S. keyboard layout generates VK_Q, * generates VK_A on a Windows French keyboard layout. * <li>In order to support the platform-independent handling of action keys, * the Java platform uses a few additional virtual key constants for functions * that would otherwise have to be recognized by interpreting virtual key codes * and modifiers. For example, for Japanese Windows keyboards, VK_ALL_CANDIDATES * is returned instead of VK_CONVERT with the ALT modifer. * </ul> * * <P> * WARNING: Aside from those keys that are defined by the Java language * (VK_ENTER, VK_BACK_SPACE, and VK_TAB), do not rely on the values of the VK_ * constants. Sun reserves the right to change these values as needed * to accomodate a wider range of keyboards in the future. * * @author Carl Quinn * @author Amy Fowler * @author Norbert Lindenberg * @version 1.44 04/06/00 * * @see KeyAdapter * @see KeyListener * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/keylistener.html">Tutorial: Writing a Key Listener</a> * @see <a href="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a> * * @since 1.1 */ public class KeyEvent extends InputEvent { /** * The first number in the range of ids used for key events. */ public static final int KEY_FIRST = 400; /** * The last number in the range of ids used for key events. */ public static final int KEY_LAST = 402; /** * The "key typed" event. This event is generated when a character is * entered. In the simplest case, it is produced by a single key press. * Often, however, characters are produced by series of key presses, and * the mapping from key pressed events to key typed events may be * many-to-one or many-to-many. */ public static final int KEY_TYPED = KEY_FIRST; /** * The "key pressed" event. This event is generated when a key * is pushed down. */ public static final int KEY_PRESSED = 1 + KEY_FIRST; //Event.KEY_PRESS /** * The "key released" event. This event is generated when a key * is let up. */ public static final int KEY_RELEASED = 2 + KEY_FIRST; //Event.KEY_RELEASE /* Virtual key codes. */ public static final int VK_ENTER = '\n'; public static final int VK_BACK_SPACE = '\b'; public static final int VK_TAB = '\t'; public static final int VK_CANCEL = 0x03; public static final int VK_CLEAR = 0x0C; public static final int VK_SHIFT = 0x10; public static final int VK_CONTROL = 0x11; public static final int VK_ALT = 0x12; public static final int VK_PAUSE = 0x13; public static final int VK_CAPS_LOCK = 0x14; public static final int VK_ESCAPE = 0x1B; public static final int VK_SPACE = 0x20; public static final int VK_PAGE_UP = 0x21; public static final int VK_PAGE_DOWN = 0x22; public static final int VK_END = 0x23; public static final int VK_HOME = 0x24; public static final int VK_LEFT = 0x25; public static final int VK_UP = 0x26; public static final int VK_RIGHT = 0x27; public static final int VK_DOWN = 0x28; public static final int VK_COMMA = 0x2C; /** * Constant for the "-" key. * @since 1.2 */ public static final int VK_MINUS = 0x2D; public static final int VK_PERIOD = 0x2E; public static final int VK_SLASH = 0x2F; /** VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */ public static final int VK_0 = 0x30; public static final int VK_1 = 0x31; public static final int VK_2 = 0x32; public static final int VK_3 = 0x33; public static final int VK_4 = 0x34; public static final int VK_5 = 0x35; public static final int VK_6 = 0x36; public static final int VK_7 = 0x37; public static final int VK_8 = 0x38; public static final int VK_9 = 0x39; public static final int VK_SEMICOLON = 0x3B; public static final int VK_EQUALS = 0x3D; /** VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */ public static final int VK_A = 0x41; public static final int VK_B = 0x42; public static final int VK_C = 0x43; public static final int VK_D = 0x44; public static final int VK_E = 0x45; public static final int VK_F = 0x46; public static final int VK_G = 0x47; public static final int VK_H = 0x48; public static final int VK_I = 0x49; public static final int VK_J = 0x4A; public static final int VK_K = 0x4B; public static final int VK_L = 0x4C; public static final int VK_M = 0x4D; public static final int VK_N = 0x4E; public static final int VK_O = 0x4F; public static final int VK_P = 0x50; public static final int VK_Q = 0x51; public static final int VK_R = 0x52; public static final int VK_S = 0x53; public static final int VK_T = 0x54; public static final int VK_U = 0x55; public static final int VK_V = 0x56; public static final int VK_W = 0x57; public static final int VK_X = 0x58; public static final int VK_Y = 0x59; public static final int VK_Z = 0x5A; public static final int VK_OPEN_BRACKET = 0x5B; public static final int VK_BACK_SLASH = 0x5C; public static final int VK_CLOSE_BRACKET = 0x5D; public static final int VK_NUMPAD0 = 0x60; public static final int VK_NUMPAD1 = 0x61; public static final int VK_NUMPAD2 = 0x62; public static final int VK_NUMPAD3 = 0x63; public static final int VK_NUMPAD4 = 0x64; public static final int VK_NUMPAD5 = 0x65; public static final int VK_NUMPAD6 = 0x66; public static final int VK_NUMPAD7 = 0x67; public static final int VK_NUMPAD8 = 0x68; public static final int VK_NUMPAD9 = 0x69; public static final int VK_MULTIPLY = 0x6A; public static final int VK_ADD = 0x6B; public static final int VK_SEPARATER = 0x6C; public static final int VK_SEPARATOR = VK_SEPARATER; public static final int VK_SUBTRACT = 0x6D; public static final int VK_DECIMAL = 0x6E; public static final int VK_DIVIDE = 0x6F; public static final int VK_DELETE = 0x7F; /* ASCII DEL */ public static final int VK_NUM_LOCK = 0x90; public static final int VK_SCROLL_LOCK = 0x91; /** Constant for the F1 function key. */ public static final int VK_F1 = 0x70; /** Constant for the F2 function key. */ public static final int VK_F2 = 0x71; /** Constant for the F3 function key. */ public static final int VK_F3 = 0x72; /** Constant for the F4 function key. */ public static final int VK_F4 = 0x73; /** Constant for the F5 function key. */ public static final int VK_F5 = 0x74; /** Constant for the F6 function key. */ public static final int VK_F6 = 0x75; /** Constant for the F7 function key. */ public static final int VK_F7 = 0x76; /** Constant for the F8 function key. */ public static final int VK_F8 = 0x77; /** Constant for the F9 function key. */ public static final int VK_F9 = 0x78; /** Constant for the F10 function key. */ public static final int VK_F10 = 0x79; /** Constant for the F11 function key. */ public static final int VK_F11 = 0x7A; /** Constant for the F12 function key. */ public static final int VK_F12 = 0x7B; /** * Constant for the F13 function key. * @since 1.2 */ /* F13 - F24 are used on IBM 3270 keyboard; use random range for constants. */ public static final int VK_F13 = 0xF000; /** * Constant for the F14 function key. * @since 1.2 */ public static final int VK_F14 = 0xF001; /** * Constant for the F15 function key. * @since 1.2 */ public static final int VK_F15 = 0xF002; /** * Constant for the F16 function key. * @since 1.2 */ public static final int VK_F16 = 0xF003; /** * Constant for the F17 function key. * @since 1.2 */ public static final int VK_F17 = 0xF004; /** * Constant for the F18 function key. * @since 1.2 */ public static final int VK_F18 = 0xF005; /** * Constant for the F19 function key. * @since 1.2 */ public static final int VK_F19 = 0xF006; /** * Constant for the F20 function key. * @since 1.2 */ public static final int VK_F20 = 0xF007; /** * Constant for the F21 function key. * @since 1.2 */ public static final int VK_F21 = 0xF008; /** * Constant for the F22 function key. * @since 1.2 */ public static final int VK_F22 = 0xF009; /** * Constant for the F23 function key. * @since 1.2 */ public static final int VK_F23 = 0xF00A; /** * Constant for the F24 function key. * @since 1.2 */ public static final int VK_F24 = 0xF00B; public static final int VK_PRINTSCREEN = 0x9A; public static final int VK_INSERT = 0x9B; public static final int VK_HELP = 0x9C; public static final int VK_META = 0x9D; public static final int VK_BACK_QUOTE = 0xC0; public static final int VK_QUOTE = 0xDE; /** * Constant for the key pad arrow up function key. * @since 1.2 */ public static final int VK_KP_UP = 0xE0; /** * Constant for the key pad arrow down function key. * @since 1.2 */ public static final int VK_KP_DOWN = 0xE1; /** * Constant for the key pad arrow left function key. * @since 1.2 */ public static final int VK_KP_LEFT = 0xE2; /** * Constant for the key pad arrow right function key. * @since 1.2 */ public static final int VK_KP_RIGHT = 0xE3; /* For European keyboards */ /** @since 1.2 */ public static final int VK_DEAD_GRAVE = 0x80; /** @since 1.2 */ public static final int VK_DEAD_ACUTE = 0x81; /** @since 1.2 */ public static final int VK_DEAD_CIRCUMFLEX = 0x82; /** @since 1.2 */ public static final int VK_DEAD_TILDE = 0x83; /** @since 1.2 */ public static final int VK_DEAD_MACRON = 0x84; /** @since 1.2 */ public static final int VK_DEAD_BREVE = 0x85; /** @since 1.2 */ public static final int VK_DEAD_ABOVEDOT = 0x86; /** @since 1.2 */ public static final int VK_DEAD_DIAERESIS = 0x87; /** @since 1.2 */ public static final int VK_DEAD_ABOVERING = 0x88; /** @since 1.2 */ public static final int VK_DEAD_DOUBLEACUTE = 0x89; /** @since 1.2 */ public static final int VK_DEAD_CARON = 0x8a; /** @since 1.2 */ public static final int VK_DEAD_CEDILLA = 0x8b; /** @since 1.2 */ public static final int VK_DEAD_OGONEK = 0x8c; /** @since 1.2 */ public static final int VK_DEAD_IOTA = 0x8d; /** @since 1.2 */ public static final int VK_DEAD_VOICED_SOUND = 0x8e; /** @since 1.2 */ public static final int VK_DEAD_SEMIVOICED_SOUND = 0x8f; /** @since 1.2 */ public static final int VK_AMPERSAND = 0x96; /** @since 1.2 */ public static final int VK_ASTERISK = 0x97; /** @since 1.2 */ public static final int VK_QUOTEDBL = 0x98; /** @since 1.2 */ public static final int VK_LESS = 0x99; /** @since 1.2 */ public static final int VK_GREATER = 0xa0; /** @since 1.2 */ public static final int VK_BRACELEFT = 0xa1; /** @since 1.2 */ public static final int VK_BRACERIGHT = 0xa2; /** * Constant for the "@" key. * @since 1.2 */ public static final int VK_AT = 0x0200; /** * Constant for the ":" key. * @since 1.2 */ public static final int VK_COLON = 0x0201; /** * Constant for the "^" key. * @since 1.2 */ public static final int VK_CIRCUMFLEX = 0x0202; /** * Constant for the "$" key. * @since 1.2 */ public static final int VK_DOLLAR = 0x0203; /** * Constant for the Euro currency sign key. * @since 1.2 */ public static final int VK_EURO_SIGN = 0x0204; /** * Constant for the "!" key. * @since 1.2 */ public static final int VK_EXCLAMATION_MARK = 0x0205; /** * Constant for the inverted exclamation mark key. * @since 1.2 */ public static final int VK_INVERTED_EXCLAMATION_MARK = 0x0206; /** * Constant for the "(" key. * @since 1.2 */ public static final int VK_LEFT_PARENTHESIS = 0x0207; /** * Constant for the "#" key. * @since 1.2 */ public static final int VK_NUMBER_SIGN = 0x0208; /** * Constant for the "+" key. * @since 1.2 */ public static final int VK_PLUS = 0x0209; /** * Constant for the ")" key. * @since 1.2 */ public static final int VK_RIGHT_PARENTHESIS = 0x020A; /** * Constant for the "_" key. * @since 1.2 */ public static final int VK_UNDERSCORE = 0x020B; /* for input method support on Asian Keyboards */ /* not clear what this means - listed in Win32 API */ public static final int VK_FINAL = 0x0018; /** Constant for the Convert function key. */ /* Japanese PC 106 keyboard, Japanese Solaris keyboard: henkan */ public static final int VK_CONVERT = 0x001C; /** Constant for the Don't Convert function key. */ /* Japanese PC 106 keyboard: muhenkan */ public static final int VK_NONCONVERT = 0x001D; /** Constant for the Accept or Commit function key. */ /* Japanese Solaris keyboard: kakutei */ public static final int VK_ACCEPT = 0x001E; /* not clear what this means - listed in Win32 API */ public static final int VK_MODECHANGE = 0x001F; /* replaced by VK_KANA_LOCK for Win32 and Solaris; might still be used on other platforms */ public static final int VK_KANA = 0x0015; /* replaced by VK_INPUT_METHOD_ON_OFF for Win32 and Solaris; might still be used for other platforms */ public static final int VK_KANJI = 0x0019; /** * Constant for the Alphanumeric function key. * @since 1.2 */ /* Japanese PC 106 keyboard: eisuu */ public static final int VK_ALPHANUMERIC = 0x00F0; /** * Constant for the Katakana function key. * @since 1.2 */ /* Japanese PC 106 keyboard: katakana */ public static final int VK_KATAKANA = 0x00F1; /** * Constant for the Hiragana function key. * @since 1.2 */ /* Japanese PC 106 keyboard: hiragana */ public static final int VK_HIRAGANA = 0x00F2; /** * Constant for the Full-Width Characters function key. * @since 1.2 */ /* Japanese PC 106 keyboard: zenkaku */ public static final int VK_FULL_WIDTH = 0x00F3; /** * Constant for the Half-Width Characters function key. * @since 1.2 */ /* Japanese PC 106 keyboard: hankaku */ public static final int VK_HALF_WIDTH = 0x00F4; /** * Constant for the Roman Characters function key. * @since 1.2 */ /* Japanese PC 106 keyboard: roumaji */ public static final int VK_ROMAN_CHARACTERS = 0x00F5; /** * Constant for the All Candidates function key. * @since 1.2 */ /* Japanese PC 106 keyboard - VK_CONVERT + ALT: zenkouho */ public static final int VK_ALL_CANDIDATES = 0x0100; /** * Constant for the Previous Candidate function key. * @since 1.2 */ /* Japanese PC 106 keyboard - VK_CONVERT + SHIFT: maekouho */ public static final int VK_PREVIOUS_CANDIDATE = 0x0101; /** * Constant for the Code Input function key. * @since 1.2 */ /* Japanese PC 106 keyboard - VK_ALPHANUMERIC + ALT: kanji bangou */ public static final int VK_CODE_INPUT = 0x0102; /** * Constant for the Japanese-Katakana function key. * This key switches to a Japanese input method and selects its Katakana input mode. * @since 1.2 */ /* Japanese Macintosh keyboard - VK_JAPANESE_HIRAGANA + SHIFT */ public static final int VK_JAPANESE_KATAKANA = 0x0103; /** * Constant for the Japanese-Hiragana function key. * This key switches to a Japanese input method and selects its Hiragana input mode. * @since 1.2 */ /* Japanese Macintosh keyboard */ public static final int VK_JAPANESE_HIRAGANA = 0x0104; /** * Constant for the Japanese-Roman function key. * This key switches to a Japanese input method and selects its Roman-Direct input mode. * @since 1.2 */ /* Japanese Macintosh keyboard */ public static final int VK_JAPANESE_ROMAN = 0x0105; /** * Constant for the locking Kana function key. * This key locks the keyboard into a Kana layout. * @since 1.3 */ /* Japanese PC 106 keyboard with special Windows driver - eisuu + Control; Japanese Solaris keyboard: kana */ public static final int VK_KANA_LOCK = 0x0106; /** * Constant for the input method on/off key. * @since 1.3 */ /* Japanese PC 106 keyboard: kanji. Japanese Solaris keyboard: nihongo */ public static final int VK_INPUT_METHOD_ON_OFF = 0x0107; /* for Sun keyboards */ /** @since 1.2 */ public static final int VK_CUT = 0xFFD1; /** @since 1.2 */ public static final int VK_COPY = 0xFFCD; /** @since 1.2 */ public static final int VK_PASTE = 0xFFCF; /** @since 1.2 */ public static final int VK_UNDO = 0xFFCB; /** @since 1.2 */ public static final int VK_AGAIN = 0xFFC9; /** @since 1.2 */ public static final int VK_FIND = 0xFFD0; /** @since 1.2 */ public static final int VK_PROPS = 0xFFCA; /** @since 1.2 */ public static final int VK_STOP = 0xFFC8; /** * Constant for the Compose function key. * @since 1.2 */ public static final int VK_COMPOSE = 0xFF20; /** * Constant for the AltGraph function key. * @since 1.2 */ public static final int VK_ALT_GRAPH = 0xFF7E; /** * KEY_TYPED events do not have a keyCode value. * This value is used, instead. */ public static final int VK_UNDEFINED = 0x0; /** * KEY_PRESSED and KEY_RELEASED events which do not map to a * valid Unicode character use this for the keyChar value. */ public static final char CHAR_UNDEFINED = 0x0ffff; /** * A constant indicating that the keyLocation is indeterminate * or not relevant. * KEY_TYPED events do not have a keyLocation; this value * is used instead. * @since 1.4 */ // public static final int KEY_LOCATION_UNKNOWN = 0; /** * A constant indicating that the key pressed or released * is not distinguished as the left or right version of a key, * and did not originate on the numeric keypad (or did not * originate with a virtual key corresponding to the numeric * keypad). * @since 1.4 */ // public static final int KEY_LOCATION_STANDARD = 1; /** A constant indicating that the key pressed or released is in * the left key location (there is more than one possible location * for this key). Example: the left shift key. * @since 1.4 */ // public static final int KEY_LOCATION_LEFT = 2; /** * A constant indicating that the key pressed or released is in * the right key location (there is more than one possible location * for this key). Example: the right shift key. * @since 1.4 */ // public static final int KEY_LOCATION_RIGHT = 3; /** * A constant indicating that the key event originated on the * numeric keypad or with a virtual key corresponding to the * numeric keypad. * @since 1.4 */ // public static final int KEY_LOCATION_NUMPAD = 4; /** * The unique value assigned to each of the keys on the * keyboard. There is a common set of key codes that * can be fired by most keyboards. * The symbolic name for a key code should be used rather * than the code value itself. * * @serial * @see getKeyCode() * @see setKeyCode() */ int keyCode; /** * <code>keyChar</code> is a valid unicode character * that is fired by a key or a key combination on * a keyboard. * * @serial * @see getKeyChar() * @see setKeyChar() */ char keyChar; /** * The location of the key on the keyboard. * * Some keys occur more than once on a keyboard, e.g. the left and * right shift keys. Additionally, some keys occur on the numeric * keypad. This variable is used to distinguish such keys. * * The only legal values are <code>KEY_LOCATION_UNKNOWN</code>, * <code>KEY_LOCATION_STANDARD</code>, <code>KEY_LOCATION_LEFT</code>, * <code>KEY_LOCATION_RIGHT</code>, and <code>KEY_LOCATION_NUMPAD</code>. * * @serial * @see #getKeyLocation() */ // int keyLocation; /** * Used by native code to determine if the event has been modified in Java. If this is * the case then the native code needs to modify the native event too. Otherwise, it can just * pass on the normal key event. This is done for performance reasons and to prevent possible * problems in modifying the native event incorrectly. */ private transient int modifiedFields; private static final int KEY_CHAR_MODIFIED_MASK = 1; private static final int KEY_CODE_MODIFIED_MASK = 2; private static final int MODIFIERS_MODIFIED_MASK = 4; /* * JDK 1.1 serialVersionUID */ private static final long serialVersionUID = -2352130953028126954L; /** * Constructs a KeyEvent object. * * @param source the Component that originated the event * @param id an integer identifying the type of event * @param when a long integer that specifys the time the event occurred * @param modifiers the modifier keys down during event * (shift, ctrl, alt, meta) * @param keyCode the integer code for an actual key, or VK_UNDEFINED * (for a key-typed event) * @param keyChar the Unicode character generated by this event, or * CHAR_UNDEFINED (for key-pressed and key-released * events which do not map to a valid Unicode character) */ public KeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar) { super(source, id, when, modifiers); if (id == KEY_TYPED && keyChar == CHAR_UNDEFINED) { throw new IllegalArgumentException("invalid keyChar"); } if (id == KEY_TYPED && keyCode != VK_UNDEFINED) { throw new IllegalArgumentException("invalid keyCode"); } this.keyCode = keyCode; this.keyChar = keyChar; if ((getModifiers() != 0) && (getModifiersEx() == 0)) { setNewModifiers(); } else if ((getModifiers() == 0) && (getModifiersEx() != 0)) { setOldModifiers(); } } /* public KeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar, int keyLocation) { super(source, id, when, modifiers); if (id == KEY_TYPED) { if (keyChar == CHAR_UNDEFINED) { throw new IllegalArgumentException("invalid keyChar"); } if (keyCode != VK_UNDEFINED) { throw new IllegalArgumentException("invalid keyCode"); } if (keyLocation != KEY_LOCATION_UNKNOWN) { throw new IllegalArgumentException("invalid keyLocation"); } } this.keyCode = keyCode; this.keyChar = keyChar; if ((keyLocation < KEY_LOCATION_UNKNOWN) || (keyLocation > KEY_LOCATION_NUMPAD)) { throw new IllegalArgumentException("invalid keyLocation"); } this.keyLocation = keyLocation; if ((getModifiers() != 0) && (getModifiersEx() == 0)) { setNewModifiers(); } else if ((getModifiers() == 0) && (getModifiersEx() != 0)) { setOldModifiers(); } } */ /* * @deprecated, as of JDK1.1 - Do NOT USE; will be removed in 1.1.1. */ public KeyEvent(Component source, int id, long when, int modifiers, int keyCode) { this(source, id, when, modifiers, keyCode, (char) keyCode); } /** * Set the source of this KeyEvent. Dispatching this event subsequent * to this operation will send this event to the new Object. * * @param newSource the KeyEvent's new source. */ /* public void setSource(Object newSource) { source = newSource; } */ /** * Returns the integer key-code associated with the key in this event. * * @return the integer code for an actual key on the keyboard. * (For KEY_TYPED events, keyCode is VK_UNDEFINED.) */ public int getKeyCode() { return keyCode; } /** * Set the keyCode value to indicate a physical key. * * @param keyCode an integer corresponding to an actual key on the keyboard. */ public void setKeyCode(int keyCode) { if (keyCode != this.keyCode) { this.keyCode = keyCode; modifiedFields |= KEY_CODE_MODIFIED_MASK; } } /** * Set the keyChar value to indicate a logical character. * * @param keyChar a char corresponding to to the combination of keystrokes * that make up this event. */ public void setKeyChar(char keyChar) { if (keyChar != this.keyChar) { this.keyChar = keyChar; modifiedFields |= KEY_CHAR_MODIFIED_MASK; } } /** * Set the modifiers to indicate additional keys that were held down * (shift, ctrl, alt, meta) defined as part of InputEvent. * <p> * NOTE: use of this method is not recommended, because many AWT * implementations do not recognize modifier changes. This is * especially true for KEY_TYPED events where the shift modifier * is changed. * * @param modifiers an integer combination of the modifier constants. * * @see InputEvent * * @deprecated, as of JDK1.1.4 */ public void setModifiers(int modifiers) { if (modifiers != this.modifiers) { this.modifiers = modifiers; modifiedFields |= MODIFIERS_MODIFIED_MASK; if ((getModifiers() != 0) && (getModifiersEx() == 0)) { setNewModifiers(); } else if ((getModifiers() == 0) && (getModifiersEx() != 0)) { setOldModifiers(); } } } /** * Returns the location of the key that originated this key event. * * Some keys occur more than once on a keyboard, e.g. the left and * right shift keys. Additionally, some keys occur on the numeric * keypad. This provides a way of distinguishing such keys. * * @return the location of the key that was pressed or released. * Always returns <code>KEY_LOCATION_UNKNOWN</code> for * <code>KEY_TYPED</code> events. * @since 1.4 */ /* public int getKeyLocation() { return keyLocation; } */ /** * Set the source of this KeyEvent. Dispatching this event subsequent * to this operation will send this event to the new Object. * * @param newSource the KeyEvent's new source. */ public void setSource(Object newSource) { source = newSource; } /** * Returns the character associated with the key in this event. * For example, the key-typed event for shift + "a" returns the * value for "A". * * @return the Unicode character defined for this key event. * If no valid Unicode character exists for this key event, * keyChar is CHAR_UNDEFINED. */ public char getKeyChar() { return keyChar; } /** * Returns a String describing the keyCode, such as "HOME", "F1" or "A". * These strings can be localized by changing the awt.properties file. * * @return string a text description for a physical key, identified by * its keyCode */ public static String getKeyText(int keyCode) { if (keyCode >= VK_0 && keyCode <= VK_9 || keyCode >= VK_A && keyCode <= VK_Z) { return String.valueOf((char) keyCode); } // Check for other ASCII keyCodes. int index = ",./;=[\\]".indexOf(keyCode); if (index >= 0) { return String.valueOf((char) keyCode); } switch (keyCode) { case VK_ENTER: return Toolkit.getProperty("AWT.enter", "Enter"); case VK_BACK_SPACE: return Toolkit.getProperty("AWT.backSpace", "Backspace"); case VK_TAB: return Toolkit.getProperty("AWT.tab", "Tab"); case VK_CANCEL: return Toolkit.getProperty("AWT.cancel", "Cancel"); case VK_CLEAR: return Toolkit.getProperty("AWT.clear", "Clear"); case VK_SHIFT: return Toolkit.getProperty("AWT.shift", "Shift"); case VK_CONTROL: return Toolkit.getProperty("AWT.control", "Control"); case VK_ALT: return Toolkit.getProperty("AWT.alt", "Alt"); case VK_PAUSE: return Toolkit.getProperty("AWT.pause", "Pause"); case VK_CAPS_LOCK: return Toolkit.getProperty("AWT.capsLock", "Caps Lock"); case VK_ESCAPE: return Toolkit.getProperty("AWT.escape", "Escape"); case VK_SPACE: return Toolkit.getProperty("AWT.space", "Space"); case VK_PAGE_UP: return Toolkit.getProperty("AWT.pgup", "Page Up"); case VK_PAGE_DOWN: return Toolkit.getProperty("AWT.pgdn", "Page Down"); case VK_END: return Toolkit.getProperty("AWT.end", "End"); case VK_HOME: return Toolkit.getProperty("AWT.home", "Home"); case VK_LEFT: return Toolkit.getProperty("AWT.left", "Left"); case VK_UP: return Toolkit.getProperty("AWT.up", "Up"); case VK_RIGHT: return Toolkit.getProperty("AWT.right", "Right"); case VK_DOWN: return Toolkit.getProperty("AWT.down", "Down"); // handled by ASCII value above: // comma, period, slash, 0-9, semicolon, equals, A-Z, // open_bracket, back_slash, close_bracket // numpad numeric keys handled below case VK_MULTIPLY: return Toolkit.getProperty("AWT.multiply", "NumPad *"); case VK_ADD: return Toolkit.getProperty("AWT.add", "NumPad +"); case VK_SEPARATER: return Toolkit.getProperty("AWT.separater", "NumPad ,"); case VK_SUBTRACT: return Toolkit.getProperty("AWT.subtract", "NumPad -"); case VK_DECIMAL: return Toolkit.getProperty("AWT.decimal", "NumPad ."); case VK_DIVIDE: return Toolkit.getProperty("AWT.divide", "NumPad /"); case VK_DELETE: return Toolkit.getProperty("AWT.delete", "Delete"); case VK_NUM_LOCK: return Toolkit.getProperty("AWT.numLock", "Num Lock"); case VK_SCROLL_LOCK: return Toolkit.getProperty("AWT.scrollLock", "Scroll Lock"); case VK_F1: return Toolkit.getProperty("AWT.f1", "F1"); case VK_F2: return Toolkit.getProperty("AWT.f2", "F2"); case VK_F3: return Toolkit.getProperty("AWT.f3", "F3"); case VK_F4: return Toolkit.getProperty("AWT.f4", "F4"); case VK_F5: return Toolkit.getProperty("AWT.f5", "F5"); case VK_F6: return Toolkit.getProperty("AWT.f6", "F6"); case VK_F7: return Toolkit.getProperty("AWT.f7", "F7"); case VK_F8: return Toolkit.getProperty("AWT.f8", "F8"); case VK_F9: return Toolkit.getProperty("AWT.f9", "F9"); case VK_F10: return Toolkit.getProperty("AWT.f10", "F10"); case VK_F11: return Toolkit.getProperty("AWT.f11", "F11"); case VK_F12: return Toolkit.getProperty("AWT.f12", "F12"); //case VK_F13: return Toolkit.getProperty("AWT.f13", "F13"); //case VK_F14: return Toolkit.getProperty("AWT.f14", "F14"); //case VK_F15: return Toolkit.getProperty("AWT.f15", "F15"); //case VK_F16: return Toolkit.getProperty("AWT.f16", "F16"); //case VK_F17: return Toolkit.getProperty("AWT.f17", "F17"); //case VK_F18: return Toolkit.getProperty("AWT.f18", "F18"); //case VK_F19: return Toolkit.getProperty("AWT.f19", "F19"); //case VK_F20: return Toolkit.getProperty("AWT.f20", "F20"); //case VK_F21: return Toolkit.getProperty("AWT.f21", "F21"); //case VK_F22: return Toolkit.getProperty("AWT.f22", "F22"); //case VK_F23: return Toolkit.getProperty("AWT.f23", "F23"); //case VK_F24: return Toolkit.getProperty("AWT.f24", "F24"); case VK_PRINTSCREEN: return Toolkit.getProperty("AWT.printScreen", "Print Screen"); case VK_INSERT: return Toolkit.getProperty("AWT.insert", "Insert"); case VK_HELP: return Toolkit.getProperty("AWT.help", "Help"); case VK_META: return Toolkit.getProperty("AWT.meta", "Meta"); case VK_BACK_QUOTE: return Toolkit.getProperty("AWT.backQuote", "Back Quote"); case VK_QUOTE: return Toolkit.getProperty("AWT.quote", "Quote"); //case VK_KP_UP: return Toolkit.getProperty("AWT.up", "Up"); //case VK_KP_DOWN: return Toolkit.getProperty("AWT.down", "Down"); //case VK_KP_LEFT: return Toolkit.getProperty("AWT.left", "Left"); //case VK_KP_RIGHT: return Toolkit.getProperty("AWT.right", "Right"); case VK_DEAD_GRAVE: return Toolkit.getProperty("AWT.deadGrave", "Dead Grave"); case VK_DEAD_ACUTE: return Toolkit.getProperty("AWT.deadAcute", "Dead Acute"); case VK_DEAD_CIRCUMFLEX: return Toolkit.getProperty("AWT.deadCircumflex", "Dead Circumflex"); case VK_DEAD_TILDE: return Toolkit.getProperty("AWT.deadTilde", "Dead Tilde"); case VK_DEAD_MACRON: return Toolkit.getProperty("AWT.deadMacron", "Dead Macron"); case VK_DEAD_BREVE: return Toolkit.getProperty("AWT.deadBreve", "Dead Breve"); case VK_DEAD_ABOVEDOT: return Toolkit.getProperty("AWT.deadAboveDot", "Dead Above Dot"); case VK_DEAD_DIAERESIS: return Toolkit.getProperty("AWT.deadDiaeresis", "Dead Diaeresis"); case VK_DEAD_ABOVERING: return Toolkit.getProperty("AWT.deadAboveRing", "Dead Above Ring"); case VK_DEAD_DOUBLEACUTE: return Toolkit.getProperty("AWT.deadDoubleAcute", "Dead Double Acute"); case VK_DEAD_CARON: return Toolkit.getProperty("AWT.deadCaron", "Dead Caron"); case VK_DEAD_CEDILLA: return Toolkit.getProperty("AWT.deadCedilla", "Dead Cedilla"); case VK_DEAD_OGONEK: return Toolkit.getProperty("AWT.deadOgonek", "Dead Ogonek"); case VK_DEAD_IOTA: return Toolkit.getProperty("AWT.deadIota", "Dead Iota"); case VK_DEAD_VOICED_SOUND: return Toolkit.getProperty("AWT.deadVoicedSound", "Dead Voiced Sound"); case VK_DEAD_SEMIVOICED_SOUND: return Toolkit.getProperty("AWT.deadSemivoicedSound", "Dead Semivoiced Sound"); case VK_AMPERSAND: return Toolkit.getProperty("AWT.ampersand", "Ampersand"); case VK_ASTERISK: return Toolkit.getProperty("AWT.asterisk", "Asterisk"); case VK_QUOTEDBL: return Toolkit.getProperty("AWT.quoteDbl", "Double Quote"); case VK_LESS: return Toolkit.getProperty("AWT.Less", "Less"); case VK_GREATER: return Toolkit.getProperty("AWT.greater", "Greater"); case VK_BRACELEFT: return Toolkit.getProperty("AWT.braceLeft", "Left Brace"); case VK_BRACERIGHT: return Toolkit.getProperty("AWT.braceRight", "Right Brace"); // case VK_AT: return Toolkit.getProperty("AWT.at", "At"); // case VK_COLON: return Toolkit.getProperty("AWT.colon", "Colon"); // case VK_CIRCUMFLEX: return Toolkit.getProperty("AWT.circumflex", "Circumflex"); // case VK_DOLLAR: return Toolkit.getProperty("AWT.dollar", "Dollar"); // case VK_EURO_SIGN: return Toolkit.getProperty("AWT.euro", "Euro"); // case VK_EXCLAMATION_MARK: return Toolkit.getProperty("AWT.exclamationMark", "Exclamation Mark"); // case VK_INVERTED_EXCLAMATION_MARK: return Toolkit.getProperty("AWT.invertedExclamationMark", "Inverted Exclamation Mark"); // case VK_LEFT_PARENTHESIS: return Toolkit.getProperty("AWT.leftParenthesis", "Left Parenthesis"); // case VK_NUMBER_SIGN: return Toolkit.getProperty("AWT.numberSign", "Number Sign"); // case VK_MINUS: return Toolkit.getProperty("AWT.minus", "Minus"); // case VK_PLUS: return Toolkit.getProperty("AWT.plus", "Plus"); // case VK_RIGHT_PARENTHESIS: return Toolkit.getProperty("AWT.rightParenthesis", "Right Parenthesis"); // case VK_UNDERSCORE: return Toolkit.getProperty("AWT.underscore", "Underscore"); case VK_FINAL: return Toolkit.getProperty("AWT.final", "Final"); case VK_CONVERT: return Toolkit.getProperty("AWT.convert", "Convert"); case VK_NONCONVERT: return Toolkit.getProperty("AWT.noconvert", "No Convert"); case VK_ACCEPT: return Toolkit.getProperty("AWT.accept", "Accept"); case VK_MODECHANGE: return Toolkit.getProperty("AWT.modechange", "Mode Change"); case VK_KANA: return Toolkit.getProperty("AWT.kana", "Kana"); case VK_KANJI: return Toolkit.getProperty("AWT.kanji", "Kanji"); //case VK_ALPHANUMERIC: return Toolkit.getProperty("AWT.alphanumeric", "Alphanumeric"); //case VK_KATAKANA: return Toolkit.getProperty("AWT.katakana", "Katakana"); //case VK_HIRAGANA: return Toolkit.getProperty("AWT.hiragana", "Hiragana"); //case VK_FULL_WIDTH: return Toolkit.getProperty("AWT.fullWidth", "Full-Width"); //case VK_HALF_WIDTH: return Toolkit.getProperty("AWT.halfWidth", "Half-Width"); //case VK_ROMAN_CHARACTERS: return Toolkit.getProperty("AWT.romanCharacters", "Roman Characters"); //case VK_ALL_CANDIDATES: return Toolkit.getProperty("AWT.allCandidates", "All Candidates"); //case VK_PREVIOUS_CANDIDATE: return Toolkit.getProperty("AWT.previousCandidate", "Previous Candidate"); //case VK_CODE_INPUT: return Toolkit.getProperty("AWT.codeInput", "Code Input"); //case VK_JAPANESE_KATAKANA: return Toolkit.getProperty("AWT.japaneseKatakana", "Japanese Katakana"); //case VK_JAPANESE_HIRAGANA: return Toolkit.getProperty("AWT.japaneseHiragana", "Japanese Hiragana"); //case VK_JAPANESE_ROMAN: return Toolkit.getProperty("AWT.japaneseRoman", "Japanese Roman"); //case VK_KANA_LOCK: return Toolkit.getProperty("AWT.kanaLock", "Kana Lock"); //case VK_INPUT_METHOD_ON_OFF: return Toolkit.getProperty("AWT.inputMethodOnOff", "Input Method On/Off"); //case VK_AGAIN: return Toolkit.getProperty("AWT.again", "Again"); //case VK_UNDO: return Toolkit.getProperty("AWT.undo", "Undo"); //case VK_COPY: return Toolkit.getProperty("AWT.copy", "Copy"); //case VK_PASTE: return Toolkit.getProperty("AWT.paste", "Paste"); //case VK_CUT: return Toolkit.getProperty("AWT.cut", "Cut"); //case VK_FIND: return Toolkit.getProperty("AWT.find", "Find"); //case VK_PROPS: return Toolkit.getProperty("AWT.props", "Props"); //case VK_STOP: return Toolkit.getProperty("AWT.stop", "Stop"); //case VK_COMPOSE: return Toolkit.getProperty("AWT.compose", "Compose"); case VK_ALT_GRAPH: return Toolkit.getProperty("AWT.altGraph", "Alt Graph"); } if (keyCode >= VK_NUMPAD0 && keyCode <= VK_NUMPAD9) { String numpad = Toolkit.getProperty("AWT.numpad", "NumPad"); char c = (char) (keyCode - VK_NUMPAD0 + '0'); return numpad + "-" + c; } String unknown = Toolkit.getProperty("AWT.unknown", "Unknown keyCode"); return unknown + ": 0x" + Integer.toString(keyCode, 16); } /** * Returns a String describing the modifier key(s), such as "Shift", * or "Ctrl+Shift". These strings can be localized by changing the * awt.properties file. * * @return string a text description of the combination of modifier * keys that were held down during the event */ public static String getKeyModifiersText(int modifiers) { StringBuffer buf = new StringBuffer(); if ((modifiers & InputEvent.META_MASK) != 0) { buf.append(Toolkit.getProperty("AWT.meta", "Meta")); buf.append("+"); } if ((modifiers & InputEvent.CTRL_MASK) != 0) { buf.append(Toolkit.getProperty("AWT.control", "Ctrl")); buf.append("+"); } if ((modifiers & InputEvent.ALT_MASK) != 0) { buf.append(Toolkit.getProperty("AWT.alt", "Alt")); buf.append("+"); } if ((modifiers & InputEvent.SHIFT_MASK) != 0) { buf.append(Toolkit.getProperty("AWT.shift", "Shift")); buf.append("+"); } if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) { buf.append(Toolkit.getProperty("AWT.altGraph", "Alt Graph")); buf.append("+"); } if ((modifiers & InputEvent.BUTTON1_MASK) != 0) { buf.append(Toolkit.getProperty("AWT.button1", "Button1")); buf.append("+"); } if (buf.length() > 0) { buf.setLength(buf.length() - 1); // remove trailing '+' } return buf.toString(); } /** Returns whether or not the key in this event is an "action" key, * as defined in Event.java. * * @return boolean value, true if the key is an "action" key * * @see Event */ public boolean isActionKey() { switch (keyCode) { case VK_HOME: case VK_END: case VK_PAGE_UP: case VK_PAGE_DOWN: case VK_UP: case VK_DOWN: case VK_LEFT: case VK_RIGHT: //case VK_KP_LEFT: //case VK_KP_UP: //case VK_KP_RIGHT: //case VK_KP_DOWN: case VK_F1: case VK_F2: case VK_F3: case VK_F4: case VK_F5: case VK_F6: case VK_F7: case VK_F8: case VK_F9: case VK_F10: case VK_F11: case VK_F12: //case VK_F13: //case VK_F14: //case VK_F15: //case VK_F16: //case VK_F17: //case VK_F18: //case VK_F19: //case VK_F20: //case VK_F21: //case VK_F22: //case VK_F23: //case VK_F24: case VK_PRINTSCREEN: case VK_SCROLL_LOCK: case VK_CAPS_LOCK: case VK_NUM_LOCK: case VK_PAUSE: case VK_INSERT: case VK_FINAL: case VK_CONVERT: case VK_NONCONVERT: case VK_ACCEPT: case VK_MODECHANGE: case VK_KANA: case VK_KANJI: //case VK_ALPHANUMERIC: //case VK_KATAKANA: //case VK_HIRAGANA: //case VK_FULL_WIDTH: //case VK_HALF_WIDTH: //case VK_ROMAN_CHARACTERS: //case VK_ALL_CANDIDATES: //case VK_PREVIOUS_CANDIDATE: //case VK_CODE_INPUT: //case VK_JAPANESE_KATAKANA: //case VK_JAPANESE_HIRAGANA: //case VK_JAPANESE_ROMAN: //case VK_KANA_LOCK: //case VK_INPUT_METHOD_ON_OFF: //case VK_AGAIN: //case VK_UNDO: //case VK_COPY: //case VK_PASTE: //case VK_CUT: //case VK_FIND: //case VK_PROPS: //case VK_STOP: case VK_HELP: return true; } return false; } /** * Returns a parameter string identifying this event. * This method is useful for event-logging and for debugging. * * @return a string identifying the event and its attributes */ public String paramString() { StringBuffer str = new StringBuffer(100); switch (id) { case KEY_PRESSED: str.append("KEY_PRESSED"); break; case KEY_RELEASED: str.append("KEY_RELEASED"); break; case KEY_TYPED: str.append("KEY_TYPED"); break; default: str.append("unknown type"); break; } str.append(",keyCode=").append(keyCode); str.append(",keyText=").append(getKeyText(keyCode)); /* Some keychars don't print well, e.g. escape, backspace, * tab, return, delete, cancel. Get keyText for the keyCode * instead of the keyChar. */ str.append(",keyChar="); switch (keyChar) { case '\b': str.append(getKeyText(VK_BACK_SPACE)); break; case '\t': str.append(getKeyText(VK_TAB)); break; case '\n': str.append(getKeyText(VK_ENTER)); break; case '\u0018': str.append(getKeyText(VK_CANCEL)); break; case '\u001b': str.append(getKeyText(VK_ESCAPE)); break; case '\u007f': str.append(getKeyText(VK_DELETE)); break; case CHAR_UNDEFINED: str.append(Toolkit.getProperty("AWT.undefined", "Undefined")); str.append(" keyChar"); break; default: str.append("'").append(keyChar).append("'"); break; } if (getModifiers() != 0) { str.append(",modifiers=").append(getKeyModifiersText(modifiers)); } if (getModifiersEx() != 0) { str.append(",extModifiers=").append(getModifiersExText(modifiers)); } return str.toString(); } /** * Sets new modifiers by the old ones. The key modifiers * override overlaping mouse modifiers. */ private void setNewModifiers() { if ((modifiers & SHIFT_MASK) != 0) { modifiers |= SHIFT_DOWN_MASK; } if ((modifiers & ALT_MASK) != 0) { modifiers |= ALT_DOWN_MASK; } if ((modifiers & CTRL_MASK) != 0) { modifiers |= CTRL_DOWN_MASK; } if ((modifiers & META_MASK) != 0) { modifiers |= META_DOWN_MASK; } if ((modifiers & ALT_GRAPH_MASK) != 0) { modifiers |= ALT_GRAPH_DOWN_MASK; } if ((modifiers & BUTTON1_MASK) != 0) { modifiers |= BUTTON1_DOWN_MASK; } } /** * Sets old modifiers by the new ones. */ private void setOldModifiers() { if ((modifiers & SHIFT_DOWN_MASK) != 0) { modifiers |= SHIFT_MASK; } if ((modifiers & ALT_DOWN_MASK) != 0) { modifiers |= ALT_MASK; } if ((modifiers & CTRL_DOWN_MASK) != 0) { modifiers |= CTRL_MASK; } if ((modifiers & META_DOWN_MASK) != 0) { modifiers |= META_MASK; } if ((modifiers & ALT_GRAPH_DOWN_MASK) != 0) { modifiers |= ALT_GRAPH_MASK; } if ((modifiers & BUTTON1_DOWN_MASK) != 0) { modifiers |= BUTTON1_MASK; } } /** * Sets new modifiers by the old ones. The key modifiers * override overlaping mouse modifiers. * @serial */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); if (getModifiers() != 0 && getModifiersEx() == 0) { setNewModifiers(); } } }
[ "clamp03@gmail.com" ]
clamp03@gmail.com
fda806eb5219bec45ea7c9de0a838084c4b22f33
db7ec7916857c2a249ee0a2264a268f34031c2b1
/src/reo/game1/Game1Activity.java
147080ca48dc74ea247f80f0e307e73774b9ab01
[]
no_license
darkcat666/battle_ganu2
4b92af5b5611246c49a1ca0aed761cb8865b62f1
d1777f295dac10c879453d1427470f3374ed45a7
refs/heads/master
2021-01-11T11:51:37.857346
2016-12-17T13:25:47
2016-12-17T13:25:47
76,724,912
0
0
null
null
null
null
UTF-8
Java
false
false
30,904
java
package reo.game1; import java.util.Random; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.Paint; import android.media.MediaPlayer; import android.media.MediaPlayer.OnCompletionListener; import android.os.Looper; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; public class Game1Activity extends SurfaceView implements variable, OnCompletionListener, Runnable, SurfaceHolder.Callback{ // フィールド変数定数 public Game1 game1; private static boolean ONE_TIME_SKIP = true; private static int PLACE1 = 1; private static int PLACE2 = 2; private static int PLACE3 = 3; private static int PLACE4 = 4; private int end = 0; private static int scene = 0; private int init = -1; private int key = 0; private final static int S_INITIALIZE=0, S_APPEAR1=1, S_APPEAR2=2, S_APPEAR3=3, S_APPEAR4=4, S_BETTING=5, S_BATTLE1=6, S_BATTLE2=7, S_ENDING1=8, S_ENDING2=9; private final static int K_NONE=10, K_RIGHT=11, K_LEFT=12, K_SELECT=13; public int width; public int height; private Graphics g; private SurfaceHolder holder; private Bitmap[] bitmap = new Bitmap[10]; private static int ene1; private static int ene2; private static int ene3; private static int ene4; private static int aimingEnemy; private static int aimedEnemy; private static field_status aiming_flag; private static field_status aimed_flag; private static field_status Enemy1; private static field_status Enemy2; private static field_status Enemy3; private static field_status Enemy4; private static field_status choose; private static int dead_count = 0; private MediaPlayer player; private Thread thread; private static int damageStep1 = 0; public static boolean avoid_flag; private static final int damage_least = 1; public static boolean end_flag = false; private static field_status death1; private static field_status death2; private static field_status death3; private static boolean lock_flag = false; static Random rand = new Random(); field_status [] fs = new field_status[9]; // コンストラクタ public Game1Activity(Context context) { super(context); this.player = null; Resources r = getResources(); bitmap[0] = BitmapFactory.decodeResource(r,R.drawable.enemy0); bitmap[1] = BitmapFactory.decodeResource(r,R.drawable.enemy1); bitmap[2] = BitmapFactory.decodeResource(r,R.drawable.enemy2); bitmap[3] = BitmapFactory.decodeResource(r,R.drawable.enemy3); bitmap[4] = BitmapFactory.decodeResource(r,R.drawable.enemy4); bitmap[5] = BitmapFactory.decodeResource(r,R.drawable.enemy5); bitmap[6] = BitmapFactory.decodeResource(r,R.drawable.enemy6); bitmap[7] = BitmapFactory.decodeResource(r,R.drawable.enemy7); bitmap[8] = BitmapFactory.decodeResource(r,R.drawable.enemy8); bitmap[9] = BitmapFactory.decodeResource(r,R.drawable.dummy); // onDraw()を呼ばれるようにする関数 setWillNotDraw(false); holder = getHolder(); holder.addCallback(this); holder.setFixedSize(getWidth(),getHeight()); g = new Graphics(holder, context); } // サーフェイスの生成 public void surfaceCreated(SurfaceHolder holder){ thread = new Thread(this); thread.start(); } // サーフェイスの変更 public void surfaceChanged(SurfaceHolder holder, int format, int w, int h){ } // サーフェイスの破棄 public void surfaceDestroyed(SurfaceHolder holder){ thread = null; } // メッセージ表示の白い枠の描画 public void drawMessageFrame(){ g.settingColor(Color.WHITE); Graphics.paint.setStyle(Paint.Style.STROKE); Graphics.paint.setStrokeWidth(4); g.drawRect(5,height/2+5,width-5,height-5); } // 一番左の敵の描画。HPがなくなり次第、枠を残して消滅する。 public void drawEnemyA(){ g.settingColor(Color.RED); g.drawRect(0,0,width / 4,height/2); if (Enemy1.getHP() > 0){ g.drawBitmap(bitmap[ene1],0,0,width / 4,(height/2)); } else if (Enemy1.getHP() == 0){ g.drawBitmap(bitmap[9],0,0,width / 4,(height/2)); } } // 左から二番目の敵の描画。HPがなくなり次第、枠を残して消滅する。 public void drawEnemyB(){ g.settingColor(Color.GREEN); g.drawRect(width / 4 ,0 , width / 4 * 2,(height/2)); if (Enemy2.getHP() > 0){ g.drawBitmap(bitmap[ene2],width / 4 ,0 , width / 4 * 2,(height/2)); } else if (Enemy2.getHP() == 0){ g.drawBitmap(bitmap[9],width / 4 ,0 , width / 4 * 2,(height/2)); } } // 左から三番目の敵の描画。HPがなくなり次第、枠を残して消滅する。 public void drawEnemyC(){ g.settingColor(Color.YELLOW); g.drawRect(width / 4 * 2, 0, width / 4 * 3,(height/2)); if (Enemy3.getHP() > 0){ g.drawBitmap(bitmap[ene3],width / 4 * 2, 0, width / 4 * 3,(height/2)); } else if (Enemy3.getHP() == 0){ g.drawBitmap(bitmap[9],width / 4 * 2, 0, width / 4 * 3,(height/2)); } } // 一番右の敵の描画。HPがなくなり次第、枠を残して消滅する。 public void drawEnemyD(){ g.settingColor(Color.BLUE); g.drawRect(width / 4 * 3, 0,width / 4 * 4 ,(height/2)); if (Enemy4.getHP() > 0){ g.drawBitmap(bitmap[ene4],width / 4 * 3, 0,width / 4 * 4 ,(height/2)); } else if (Enemy4.getHP() == 0){ g.drawBitmap(bitmap[9],width / 4 * 3, 0,width / 4 * 4 ,(height/2)); } } // 敵を描画する関数をまとめる関数 public void drawEnemys(){ drawEnemyA(); drawEnemyB(); drawEnemyC(); drawEnemyD(); Graphics.paint.setStrokeWidth(1); } // 敵の初期化・・・どの敵が何番目にくるかをランダムで計算 public void InitEnemyMake(){ if (end_flag == false){ // 実行時エラー回避 Looper.prepare(); } setEne1(rand.nextInt(9)); setEne2(rand.nextInt(9)); while (ene1 == ene2){ setEne2(rand.nextInt(9)); } setEne3(rand.nextInt(9)); while (ene1 == ene3 || ene2 == ene3){ setEne3(rand.nextInt(9)); } setEne4(rand.nextInt(9)); while (ene1 == ene4 || ene2 == ene4 || ene3 == ene4){ setEne4(rand.nextInt(9)); } enemy1 enem1 = new enemy1(g.holder, getContext()); enemy2 enem2 = new enemy2(g.holder, getContext()); enemy3 enem3 = new enemy3(g.holder, getContext()); enemy4 enem4 = new enemy4(g.holder, getContext()); enemy5 enem5 = new enemy5(g.holder, getContext()); enemy6 enem6 = new enemy6(g.holder, getContext()); enemy7 enem7 = new enemy7(g.holder, getContext()); enemy8 enem8 = new enemy8(g.holder, getContext()); enemy9 enem9 = new enemy9(g.holder, getContext()); field_status [] fs = {enem1,enem2,enem3,enem4,enem5,enem6,enem7,enem8,enem9,death1, death2,death3}; setEnemy1(fs[ene1]); setEnemy2(fs[ene2]); setEnemy3(fs[ene3]); setEnemy4(fs[ene4]); } // 変数betのget関数 public field_status getchoose(){ return choose; } // 通常攻撃か特殊技能かを分岐させる処理 public void ChooseAttack(){ int choose = rand.nextInt(2); if (dead_count >= 3){ scene = S_ENDING1; } else if (choose == 0){ Attack(); } else if (choose == 1){ magicAttack(); } } // 通常攻撃をしたときの処理 public static void Attack(){ if (dead_count < 3){ dont_aimed_dead(); dont_aim_dead(); setAimedEnemy(rand.nextInt(4)); switch (aimedEnemy){ case 0: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy1))); setAimed_flag(Enemy1); break; case 1: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy2))); setAimed_flag(Enemy2); break; case 2: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy3))); setAimed_flag(Enemy3); break; case 3: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy4))); setAimed_flag(Enemy4); break; } aimedEnemy = rand.nextInt(4); switch (aimedEnemy){ case 0: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy1))); setAimed_flag(Enemy1); Enemy1.setMagic_flag(true); break; case 1: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy2))); setAimed_flag(Enemy2); Enemy2.setMagic_flag(true); break; case 2: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy3))); setAimed_flag(Enemy3); Enemy3.setMagic_flag(true); break; case 3: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy4))); setAimed_flag(Enemy4); Enemy4.setMagic_flag(true); break; } switch (aimedEnemy){ case 0: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy1))); setAimed_flag(Enemy1); break; case 1: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy2))); setAimed_flag(Enemy2); break; case 2: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy3))); setAimed_flag(Enemy3); break; case 3: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy4))); setAimed_flag(Enemy4); break; } dont_aim_dead(); dont_aimed_dead(); switch (aimedEnemy){ case 0: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy1))); setAimed_flag(Enemy1); break; case 1: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy2))); setAimed_flag(Enemy2); break; case 2: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy3))); setAimed_flag(Enemy3); break; case 3: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy4))); setAimed_flag(Enemy4); break; } dont_aim_dead(); dont_aimed_dead(); int attackerLine = rand.nextInt(3); int defenderLine = rand.nextInt(2); setEnemyColor(getEnemyKinds(0)); Graphics.drawingText(aiming_flag.getName() + "の攻撃!!!", 20, 250); Graphics.drawingText("",0,0); switch(attackerLine){ case 0: setEnemyColor(aimingEnemy); aiming_flag.NORMAL_ATTACK(); aiming_flag.ATTACKING_LINE_A(); break; case 1: setEnemyColor(aimingEnemy); aiming_flag.NORMAL_ATTACK(); aiming_flag.ATTACKING_LINE_B(); break; case 2: setEnemyColor(aimingEnemy); aiming_flag.NORMAL_ATTACK(); aiming_flag.ATTACKING_LINE_C(); break; } JudgeAvoid(); if (avoid_flag != true && aimed_flag.getHP() > 0){ switch(defenderLine){ case 0: setEnemyColor(aimedEnemy); aimed_flag.DAMAGED_LINES_A(); break; case 1: setEnemyColor(aimedEnemy); aimed_flag.DAMAGED_LINES_B(); break; } } dont_aim_dead(); dont_aimed_dead(); } decreaseHP(); } // ダメージステップの処理 public static void decreaseHP(){ if (aiming_flag.getMagic_flag() == true){ if (avoid_flag == true){ setEnemyColor(getEnemyKinds(0)); Graphics.drawingText("危機一髪!" + aimed_flag.getName() + "は、うまく回避できた!!", 20, 325); Graphics.drawingText("",0,0); aimed_flag.setMagic_flag(false); } else if (avoid_flag == false){ setEnemyColor(getEnemyKinds(0)); damageStep1 = aimed_flag.getHP() + aiming_flag.getDamage() - aimed_flag.getDEFENCE(); aimed_flag.reduceHP(damageStep1); aimed_flag.setMagic_flag(false); } } else if (aiming_flag.getMagic_flag() == false){ if (avoid_flag == true){ setEnemyColor(getEnemyKinds(0)); Graphics.drawingText(aimed_flag.getName() + "は、うまく回避した!!", 20, 325); Graphics.drawingText("",0,0); } else if (avoid_flag == false){ setEnemyColor(getEnemyKinds(0)); if (aiming_flag.getATTACK() > aimed_flag.getDEFENCE()){ damageStep1 = ( aiming_flag.getATTACK() - aimed_flag.getDEFENCE()); } else if (aiming_flag.getATTACK() < aimed_flag.getDEFENCE()){ damageStep1 = damage_least; } aimed_flag.reduceHP(damageStep1); } } while ((!avoid_flag) && aimed_flag.getHP() < 0){ aimed_flag.reduceHP(-1); } if ((!avoid_flag) && aimed_flag.getHP() == 0){ aimed_flag.DESTROY_LINE(); setEnemyColor(getEnemyKinds(0)); Graphics.drawingText(aimed_flag.getName() + "に" + damageStep1 + "のダメージを与えた!!!", 20, 325); Graphics.drawingText("",0,0); Graphics.drawingText(aimed_flag.getName() + "は、星屑となった!!", 20, 375); Graphics.drawingText("",0,0); if (death1 == null){ death1 = aimed_flag; } else if (death1 != null){ death2 = aimed_flag; if (death2 == null){ death2 = aimed_flag; } else if (death2 != null){ death3 = aimed_flag; } } deadSetterIncrement(1); aimed_flag.setDead_flag(true); dont_aim_dead(); dont_aimed_dead(); } else if ((!avoid_flag) && damageStep1 > 0){ setEnemyColor(getEnemyKinds(0)); Graphics.drawingText(aimed_flag.getName() + "に" + damageStep1 + "のダメージを与えた!!!", 20, 325); Graphics.drawingText("",0,0); damageStep1 = 0; } } // 特殊技能を使った時の処理 public static void magicAttack(){ if (dead_count >= 3){ scene = S_ENDING1; } else if (dead_count < 3){ dont_aimed_dead(); dont_aim_dead(); if (aiming_flag.getHitFlag() != true){ int attackEffect = rand.nextInt(4); switch (attackEffect){ case 0: setEnemyColor(getEnemyKinds(0)); Graphics.drawingText(aiming_flag.getName() + "の必殺技攻撃!!!", 20, 250); Graphics.drawingText("",0,0); setEnemyColor(aimingEnemy); aiming_flag.SPECIAL_ACTION1(); aiming_flag.SPECIAL_ACTION_LINE_1A(); break; case 1: setEnemyColor(getEnemyKinds(0)); Graphics.drawingText(aiming_flag.getName() + "の必殺技攻撃!!!", 20, 250); Graphics.drawingText("",0,0); setEnemyColor(aimingEnemy); aiming_flag.SPECIAL_ACTION1(); aiming_flag.SPECIAL_ACTION_LINE_1B(); break; case 2: setEnemyColor(getEnemyKinds(0)); Graphics.drawingText(aiming_flag.getName() + "の必殺技攻撃!!!", 20, 250); Graphics.drawingText("",0,0); setEnemyColor(aimingEnemy); aiming_flag.SPECIAL_ACTION2(); aiming_flag.SPECIAL_ACTION_LINE_2A(); break; case 3: setEnemyColor(getEnemyKinds(0)); Graphics.drawingText(aiming_flag.getName() + "の必殺技攻撃!!!", 20, 250); Graphics.drawingText("",0,0); setEnemyColor(aimingEnemy); aiming_flag.SPECIAL_ACTION2(); aiming_flag.SPECIAL_ACTION_LINE_2B(); break; } } else if(aiming_flag.getHitFlag() == true){ int lines = rand.nextInt(3); aiming_flag.NORMAL_ATTACK(); switch (lines){ case 0: setEnemyColor(aimingEnemy); aiming_flag.NORMAL_ATTACK(); aiming_flag.ATTACKING_LINE_A(); break; case 1: setEnemyColor(aimingEnemy); aiming_flag.NORMAL_ATTACK(); aiming_flag.ATTACKING_LINE_B(); break; case 2: setEnemyColor(aimingEnemy); aiming_flag.NORMAL_ATTACK(); aiming_flag.ATTACKING_LINE_C(); break; } } switch (aimedEnemy){ case 0: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy1))); setAimed_flag(Enemy1); break; case 1: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy2))); setAimed_flag(Enemy2); break; case 2: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy3))); setAimed_flag(Enemy3); break; case 3: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy4))); setAimed_flag(Enemy4); break; } dont_aim_dead(); dont_aimed_dead(); switch (aimedEnemy){ case 0: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy1))); setAimed_flag(Enemy1); break; case 1: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy2))); setAimed_flag(Enemy2); break; case 2: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy3))); setAimed_flag(Enemy3); break; case 3: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy4))); setAimed_flag(Enemy4); break; } dont_aim_dead(); dont_aimed_dead(); } decreaseHP(); } // 回避するかの判定の処理 public static void JudgeAvoid(){ setAimedEnemy(rand.nextInt(4)); while (aimingEnemy == aimedEnemy){ setAimedEnemy(rand.nextInt(4)); } switch (aimedEnemy){ case 0: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy1))); setAimed_flag(Enemy1); break; case 1: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy2))); setAimed_flag(Enemy2); break; case 2: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy3))); setAimed_flag(Enemy3); break; case 3: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy4))); setAimed_flag(Enemy4); break; } if (aimed_flag.getHP() == 0){ setAimedEnemy(rand.nextInt(4)); while (aimingEnemy == aimedEnemy){ setAimedEnemy(rand.nextInt(4)); } switch (aimedEnemy){ case 0: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy1))); setAimed_flag(Enemy1); break; case 1: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy2))); setAimed_flag(Enemy2); break; case 2: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy3))); setAimed_flag(Enemy3); break; case 3: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy4))); setAimed_flag(Enemy4); break; } } int judge = aiming_flag.getAccuracy() / aimed_flag.getAvoid(); if ( rand.nextInt(10) <= judge ){ avoid_flag = true; } else if ( rand.nextInt(10) > judge ){ avoid_flag = false; } } // スリープ処理 public void sleep(int time){ try{ Thread.sleep(time); }catch (Exception e){ e.printStackTrace(); } } // startメソッド public void run(){ while(thread!=null){ // 初期化 if (scene<0){ scene = init; sleep(Game1.sleep_time); scene = S_INITIALIZE; } else if (scene == S_INITIALIZE){ sleep(Game1.sleep_time); initialize(); InitEnemyMake(); if (ONE_TIME_SKIP == false){ waitSelect(); } ONE_TIME_SKIP = true; scene = S_APPEAR1; } else if (scene == S_APPEAR1){ sleep(Game1.sleep_time); PlaySound(); g.lock(); lock_flag = true; clear(); drawMessageFrame(); drawEnemys(); setEnemyColor(1); Enemy1.APPEARING_LINES(); g.unlock(); lock_flag = false; waitSelect(); scene = S_APPEAR2; } else if (scene == S_APPEAR2){ sleep(Game1.sleep_time); g.lock(); lock_flag = true; clear(); drawMessageFrame(); drawEnemys(); setEnemyColor(2); Enemy2.APPEARING_LINES(); g.unlock(); lock_flag = false; waitSelect(); scene = S_APPEAR3; } else if (scene == S_APPEAR3){ sleep(Game1.sleep_time); g.lock(); lock_flag = true; clear(); drawMessageFrame(); drawEnemys(); setEnemyColor(3); Enemy3.APPEARING_LINES(); g.unlock(); lock_flag = false; waitSelect(); scene = S_APPEAR4; } else if (scene == S_APPEAR4){ sleep(Game1.sleep_time); g.lock(); lock_flag = true; clear(); drawMessageFrame(); drawEnemys(); setEnemyColor(4); Enemy4.APPEARING_LINES(); g.unlock(); lock_flag = false; waitSelect(); scene = S_BETTING; } else if (scene == S_BETTING){ sleep(Game1.sleep_time); stopSound(); g.lock(); lock_flag = true; clear(); drawMessageFrame(); drawEnemys(); setEnemyColor(getEnemyKinds(0)); Graphics.drawingText("どのキャラクターが勝つと思う?", 20, 250); Graphics.drawingText("",0,0); setEnemyColor(getEnemyKinds(1)); Graphics.drawingText("一番左・・・1", 20, 275); Graphics.drawingText("",0,0); setEnemyColor(getEnemyKinds(2)); Graphics.drawingText(" 左から二番目・・・2", 250, 275); Graphics.drawingText("",0,0); setEnemyColor(getEnemyKinds(3)); Graphics.drawingText("左から3番目・・・3 ", 20, 300); Graphics.drawingText("",0,0); setEnemyColor(getEnemyKinds(4)); Graphics.drawingText("一番右・・・4", 250, 300); Graphics.drawingText("",0,0); g.unlock(); lock_flag = false; waitSelect(); PlaySound(); scene = S_BATTLE1; } else if (scene == S_BATTLE1){ sleep(Game1.sleep_time); g.lock(); lock_flag = true; clear(); drawMessageFrame(); drawEnemys(); if (deadCount() < 3){ dont_aim_yourself(); ChooseAttack(); g.unlock(); lock_flag = false; waitSelect(); scene = S_BATTLE2; } else if (deadCount() >= 3){ waitSelect(); scene = S_ENDING1; } } else if (scene == S_BATTLE2){ dont_aim_yourself(); sleep(Game1.sleep_time); g.lock(); lock_flag = true; clear(); drawMessageFrame(); drawEnemys(); if (deadCount() < 3){ ChooseAttack(); g.unlock(); lock_flag = false; waitSelect(); scene = S_BATTLE1; } else if (deadCount() >= 3){ waitSelect(); scene = S_ENDING1; g.unlock(); lock_flag = false; } } else if (scene == S_ENDING1){ stopSound(); if (lock_flag == false){ g.lock(); } lock_flag = true; clear(); sleep(Game1.sleep_time); drawMessageFrame(); drawEnemys(); if (deadCount() >= 3){ Graphics.drawingText(aiming_flag.getName() + "の勝利!!!", 20, 250); Graphics.drawingText("",0,0); sleep(Game1.sleep_time); if (getchoose() == aiming_flag){ g.settingColor(Color.WHITE); Graphics.drawingText("あなたの勝利です!!!", 20, 275); Graphics.drawingText("",0,0); g.unlock(); lock_flag = false; stopSound(); sleep(Game1.sleep_time); scene = S_ENDING2; } else if (getchoose() != aiming_flag){ g.unlock(); lock_flag = false; stopSound(); sleep(Game1.sleep_time); scene = S_ENDING2; } } } else if (scene == S_ENDING2){ sleep(Game1.sleep_time); g.lock(); lock_flag = true; clear(); drawMessageFrame(); drawEnemys(); g.settingColor(Color.WHITE); stop_AutoMode(); Graphics.drawingText("もう一度対戦しますか?", 20, 250); Graphics.drawingText("",0,0); Graphics.drawingText("はい・・・画面右側を【2回】タッチ! いいえ・・・左側をタッチ!",20, 275); Graphics.drawingText("",0,0); g.unlock(); lock_flag = false; if (end == K_RIGHT){ end_flag = true; endInitialize(); } else if (end == K_LEFT){ g.lock(); lock_flag = true; clear(); Graphics.drawingText("終了します・・・",20, 350); Graphics.drawingText("",0,0); g.unlock(); lock_flag = false; sleep(Game1.sleep_time); System.exit(0); } } } } // 画面領域を取得する関数 protected void onSizeChanged(int w, int h, int oldw, int oldh){ width = w; height = h; } // 変数Enemy1にキャラクターをセットする関数 public void setEnemy1(field_status enemy){ Enemy1 = enemy; } // 変数Enemy1にキャラクターをセットする関数 public void setEnemy2(field_status enemy){ Enemy2 = enemy; } // 変数Enemy1にキャラクターをセットする関数 public void setEnemy3(field_status enemy){ Enemy3 = enemy; } // 変数Enemy1にキャラクターをセットする関数 public void setEnemy4(field_status enemy){ Enemy4 = enemy; } // 変数aiming_flagにキャラクターをセットする関数 public static void setAiming_flag(field_status enemy){ aiming_flag = enemy; } // 変数aimed_flagにキャラクターをセットする関数 public static void setAimed_flag(field_status enemy){ aimed_flag = enemy; } // 変数dead_countのセット関数 public void deadSetter(int dead){ dead_count = dead; } // 変数aimingEnemyにint型の値をセットする関数 public static void setAimingEnemy(int x){ aimingEnemy = x; } // 変数aimedEnemyにint型の値をセットする関数 public static void setAimedEnemy(int x){ aimedEnemy = x; } // 変数ene1にint型の値をセットする関数 public void setEne1(int x){ ene1 = x; } // 変数ene2にint型の値をセットする関数 public void setEne2(int x){ ene2 = x; } // 変数ene3にint型の値をセットする関数 public void setEne3(int x){ ene3 = x; } // 変数ene4にint型の値をセットする関数 public void setEne4(int x){ ene4 = x; } // 変数chooseにキャラクターをセットする関数 public void setChoose(field_status enemy){ choose = enemy; } // 変数dead_countのインクリメント処理 public static void deadSetterIncrement(int dead){ dead_count += dead; } // 初期化する処理 public void initialize(){ deadSetter(0); setEnd(0); } // エンディング時に初期化する処理 public void endInitialize(){ Enemy1.setHP(Enemy1.getMaxHP()); Enemy1.setMP(Enemy1.getMaxMP()); Enemy2.setHP(Enemy2.getMaxHP()); Enemy2.setMP(Enemy2.getMaxMP()); Enemy3.setHP(Enemy3.getMaxHP()); Enemy3.setMP(Enemy3.getMaxMP()); Enemy4.setHP(Enemy4.getMaxHP()); Enemy4.setMP(Enemy4.getMaxMP()); Enemy1.setDead_flag(false); Enemy2.setDead_flag(false); Enemy3.setDead_flag(false); Enemy4.setDead_flag(false); death1 = null; death2 = null; death3 = null; Game1.AUTO_FLAG = false; Game1.sleep_time = Game1.NORMAL_SLEEP; ONE_TIME_SKIP = false; scene = S_INITIALIZE; } // エンディングでゲームを続けるか質問する関数 public void setEnd(int x){ this.end = x; } // キャラクターが死んだ数を数える処理 public int deadCount(){ return dead_count; } // サウンドの再生処理 public void PlaySound(){ try{ stopSound(); player = MediaPlayer.create(getContext(), R.raw.battle); player.seekTo(0); player.setLooping(true); player.start(); player.setOnCompletionListener(Game1Activity.this); } catch (Exception e){ e.printStackTrace(); } } // サウンドの停止処理 public void stopSound(){ try{ player.stop(); player.setOnCompletionListener(null); player.release(); player=null; } catch (Exception e){ e.printStackTrace(); } } // サウンドの終了 public void onCompletion(MediaPlayer mediaPlayer){ stopSound(); } //タッチイベントの処理 @Override public boolean onTouchEvent(MotionEvent event) { int touchX=(int)event.getX(); int touchY=(int)event.getY(); int touchAction=event.getAction(); if (touchAction==MotionEvent.ACTION_UP) { if (scene==S_ENDING2) { setEnd((touchX-width/2<0)?K_LEFT:K_RIGHT); key = K_SELECT; } else if (scene == S_APPEAR1 || scene == S_APPEAR2 || scene == S_APPEAR3 || scene == S_APPEAR4 || scene == S_BATTLE1 || scene == S_BATTLE2 || scene == S_ENDING1 || scene == S_INITIALIZE ){ if (touchX > 0){ key = K_SELECT; } } else if (scene==S_BETTING) { if (0<touchX && touchX<width/4 && touchY<height/2) { setChoose(Enemy1); key = K_SELECT; } else if (width/4<touchX && touchX<width/4*2 && touchY<height/2) { setChoose(Enemy2); key = K_SELECT; } else if (width/4*2<touchX && touchX<width/4*3 && touchY<height/2) { setChoose(Enemy3); key = K_SELECT; } else if (width/4*3<touchX && touchX<width && touchY<height/2){ setChoose(Enemy4); key = K_SELECT; } } } return true; } //決定キー待ち private void waitSelect() { if (Game1.AUTO_FLAG == false){ key=K_NONE; while (key!=K_SELECT){ sleep(Game1.sleep_time); } } else if (Game1.AUTO_FLAG == true){ //オートフラグがtrueのときは何も処理をしないでスキップする } } // 文字列を削除する処理 public void clear(){ g.drawRectfill(5,height/2+5,width-5,height-5); } // キャラクターごとに色分けをする関数 public static void setEnemyColor(int enemy){ switch (enemy){ case 1: Graphics.redLine(); break; case 2: Graphics.greenLine(); break; case 3: Graphics.yellowLine(); break; case 4: Graphics.blueLine(); break; default: Graphics.whiteLine(); break; } } // キャラクターごとに色分けをする関数 public static int getEnemyKinds(int place){ if (place == PLACE1){ return 1; } else if (place == PLACE2){ return 2; } else if (place == PLACE3){ return 3; } else if (place == PLACE4){ return 4; } return 0; } // キャラクターごとの色分けをする関数 public static int getEnemyPlaces(field_status enemy){ if (enemy == Enemy1){ return PLACE1; } else if (enemy == Enemy2){ return PLACE2; } else if (enemy == Enemy3){ return PLACE3; } else if (enemy == Enemy4){ return PLACE4; } else{ return 999; } } // ランダム行動関数 public static void dont_aim_yourself(){ aimedEnemy = rand.nextInt(4); switch (aimedEnemy){ case 0: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy1))); setAimed_flag(Enemy1); break; case 1: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy2))); setAimed_flag(Enemy2); break; case 2: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy3))); setAimed_flag(Enemy3); break; case 3: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy4))); setAimed_flag(Enemy4); break; } aimingEnemy = rand.nextInt(4); switch (aimingEnemy){ case 0: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy1))); setAiming_flag(Enemy1); break; case 1: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy2))); setAiming_flag(Enemy2); break; case 2: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy3))); setAiming_flag(Enemy3); break; case 3: setEnemyColor(getEnemyKinds(getEnemyPlaces(Enemy4))); setAiming_flag(Enemy4); break; } } // 死んでいるキャラクターが攻撃しないようにする関数 public static void dont_aim_dead(){ while (aiming_flag == death1 || aiming_flag == death2 || aiming_flag == death3 || aiming_flag == aimed_flag){ dont_aim_yourself(); dont_aim_dead(); } } // 死んでいるキャラクターを狙われないようにする関数 public static void dont_aimed_dead(){ // 狙われたキャラクターが死んでいるとき while (aimed_flag == death1 || aimed_flag == death2 || aimed_flag == death3 || aimed_flag == aiming_flag){ dont_aim_yourself(); dont_aimed_dead(); } } // Autoボタンの処理をエンディング直前で強制終了させる関数 public void stop_AutoMode(){ Game1.AUTO_FLAG = false; Game1.sleep_time = NORMAL_SLEEP; } }
[ "holycat666@gmail.com" ]
holycat666@gmail.com
5977fe760e080db1be1284b5fb01ab6029adb180
a12b25b6098d1c583e15d04826cb1b8254d4976c
/magia/magia-common/src/main/java/com/xxl/entity/BoxMessageInfo.java
a31339432ea81a81643d25bde95b9ee29dc31355
[]
no_license
a1437662569/MicroService
9a00c77226e291445fcf83bc3886585bc2f9624a
712856f512dcf66d93c8269dcb849b4bf060e24b
refs/heads/main
2023-05-01T01:57:42.011662
2021-05-08T03:25:27
2021-05-08T03:25:27
365,402,056
0
1
null
null
null
null
UTF-8
Java
false
false
1,009
java
package com.xxl.entity; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @Document(collection = "box") @Data @AllArgsConstructor @NoArgsConstructor @Builder public class BoxMessageInfo { private String userId; private String messageId; private String messageType; private String type; private String appId; private Object content; private String status="0"; //("yyyy-MM-dd'T'HH:mm:ss.SSSZ", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "EEE, dd MMM yyyy HH:mm:ss zzz", "yyyy-MM-dd")) // @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; // @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; }
[ "1437662569@qq.com" ]
1437662569@qq.com
a76d06aa5f8bdf51b1f572693cb450a94c17d3c7
e3d5a618f62a62d89a5e740e8ef4ef989ca8827c
/智慧城市/项目代码/TIM 代码/serviceprovider/src/examples/serviceprovider/rdbms/RDBMSSearchObject.java
6ae2d6c02f29d2df9b772e1c81c7772debe1fba3
[]
no_license
chenshoumao/serviceprovider
612c02428e09e99ca59f345e1487e11d9571e6ec
f9de8ae5e8bd9254b985dae512ed9a7a2fee2db2
refs/heads/master
2021-01-10T23:02:08.118146
2016-11-03T09:53:28
2016-11-03T09:53:28
70,451,291
0
0
null
null
null
null
UTF-8
Java
false
false
11,056
java
/****************************************************************************** * Licensed Materials - Property of IBM * * (C) Copyright IBM Corp. 2005, 2012 All Rights Reserved. * * US Government Users Restricted Rights - Use, duplication, or * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. * *****************************************************************************/ package examples.serviceprovider.rdbms; import java.sql.Connection; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.Properties; import java.util.Vector; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.sql.DataSource; import javax.transaction.HeuristicMixedException; import javax.transaction.HeuristicRollbackException; import javax.transaction.NotSupportedException; import javax.transaction.RollbackException; import javax.transaction.SystemException; import javax.transaction.UserTransaction; import com.ibm.itim.common.AttributeValue; import com.ibm.itim.common.AttributeValues; import com.ibm.itim.logging.SystemLog; import com.ibm.itim.remoteservices.exception.RemoteServicesException; import com.ibm.itim.remoteservices.provider.RequestStatus; import com.ibm.itim.remoteservices.provider.SearchResult; import com.ibm.itim.remoteservices.provider.SearchResults; import com.ibm.itim.remoteservices.provider.ServiceProviderInformation; /** * Performs SQL search execution for multiple queries and construction of a * composite result set. Adapts the results returned from the database to a form * understandable by TIM. Encapsulates search execution in a transaction. */ class RDBMSSearchObject { private static final String DATASOURCE_ATTR_NAME = "erRDBMSDataSource"; private static final String ATTR_MAP_PROP_NAME = "erRDBMSAttributeMap"; private static final char EQUALS = '='; // User transaction JNDI name. It varies with different application server // vendors private static String USER_TX_JNDI_NAME = "jta/usertransaction"; private final QueryMetaData[] queryMetaData; private final ServiceProviderInformation serviceProviderInfo; private final ValueMap valueMap; private final Collection<SearchResult> results = new Vector<SearchResult>(); /** * Creates a RDBMSSearchResults object but does not execute the search. * * @param queryMetaData * encapsulates query string, naming attribute, and object class * for all queries to be executed. * @param searchCriteria * entities returned should matching this criteria */ RDBMSSearchObject(QueryMetaData[] queryMetaData, ServiceProviderInformation serviceProviderInfo) { this.queryMetaData = queryMetaData; this.serviceProviderInfo = serviceProviderInfo; valueMap = new ValueMap(serviceProviderInfo); } /** * Searches the database and translates the result from JDBC terms to ITIM * native terms. */ SearchResults execute() { RequestStatus status = null; for (int i = 0; i < queryMetaData.length; i++) { status = execute(queryMetaData[i]); if (!status.succeeded()) { break; } } return new RDBMSSearchResults(status, results.iterator()); } // close RDBMS objects private void close(Connection con, Statement statement, ResultSet rs) { if (con != null) { try { con.close(); } catch (Throwable t) { } } if (statement != null) { try { statement.close(); } catch (Throwable t) { } } if (rs != null) { try { rs.close(); } catch (Throwable t) { } } } // commits the database transaction private RequestStatus commitTransaction(UserTransaction transaction) { RequestStatus status = null; try { transaction.commit(); } catch (SecurityException e) { SystemLog.getInstance().logError(this, e.getMessage()); status = new RequestStatus(RequestStatus.UNSUCCESSFUL); status.setReasonMessage(e.getMessage()); } catch (IllegalStateException e) { SystemLog.getInstance().logError(this, e.getMessage()); status = new RequestStatus(RequestStatus.UNSUCCESSFUL); status.setReasonMessage(e.getMessage()); } catch (RollbackException e) { SystemLog.getInstance().logError(this, e.getMessage()); status = new RequestStatus(RequestStatus.UNSUCCESSFUL); status.setReasonMessage(e.getMessage()); } catch (HeuristicMixedException e) { SystemLog.getInstance().logError(this, e.getMessage()); status = new RequestStatus(RequestStatus.UNSUCCESSFUL); status.setReasonMessage(e.getMessage()); } catch (HeuristicRollbackException e) { SystemLog.getInstance().logError(this, e.getMessage()); status = new RequestStatus(RequestStatus.UNSUCCESSFUL); status.setReasonMessage(e.getMessage()); } catch (SystemException e) { SystemLog.getInstance().logError(this, e.getMessage()); status = new RequestStatus(RequestStatus.UNSUCCESSFUL); status.setReasonMessage(e.getMessage()); } return status; } // Gets a connection from the application server connection pool. private Connection getConnection() throws NamingException, SQLException { Properties p = new Properties(); Context context = new InitialContext(p); String dataSourceName = serviceProviderInfo.getProperties() .getProperty(DATASOURCE_ATTR_NAME); DataSource ds = (DataSource) context.lookup(dataSourceName); Connection conn = ds.getConnection(); //conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); return conn; } private static UserTransaction getUserTransaction() throws NamingException { Properties p = new Properties(); Context context = new InitialContext(p); return (UserTransaction) context.lookup(USER_TX_JNDI_NAME); } // Searches the database and translates the result from JDBC terms to ITIM private RequestStatus execute(QueryMetaData queryMetaData) { String rawQueryString = queryMetaData.getRawSQLQuery(); SystemLog.getInstance().logInformation(this, "[execute] " + "rawQueryString: " + rawQueryString); Connection con = null; Statement statement = null; ResultSet rs = null; RequestStatus status = null; UserTransaction transaction = null; try { transaction = getUserTransaction(); transaction.begin(); SQLStatement sQLStatement = new SQLStatement(rawQueryString); String sql = sQLStatement.substitute(serviceProviderInfo .getProperties(), new AttributeValues()); SystemLog.getInstance().logInformation(this, "[execute] sql: " + sql); con = getConnection(); statement = con.createStatement(); rs = statement.executeQuery(sql); ResultSetMetaData metaData = rs.getMetaData(); String attributeMapString = serviceProviderInfo.getProperties() .getProperty(ATTR_MAP_PROP_NAME); RDBMSAttributeMap attributeMap = new RDBMSAttributeMap(); attributeMap.parsePropertiesString(attributeMapString); while (rs.next()) { String namingAttribute = queryMetaData.getNamingAttribute(); SystemLog.getInstance().logInformation(this, "[execute] namingAttribute: " + namingAttribute); String timNamingAttribute = attributeMap .getTIMAttributeName(namingAttribute); String dn = timNamingAttribute + EQUALS + rs.getString(namingAttribute); SystemLog.getInstance().logInformation(this, "[execute] dn: " + dn); Collection<String> objectClasses = new ArrayList<String>(); objectClasses.add(queryMetaData.getObjectClass()); int columnCount = metaData.getColumnCount(); AttributeValues attrValues = new AttributeValues(); for (int i = 1; i <= columnCount; i++) { String remoteName = metaData.getColumnLabel(i); String name = (String) attributeMap .getTIMAttributeName(remoteName); String value = rs.getString(i); String timValue = valueMap.getTIMValue(name, value); SystemLog.getInstance().logInformation( this, "[execute] " + "name: " + name + ", value: " + value + ", timValue: " + timValue); AttributeValue av = new AttributeValue(name, timValue); attrValues.put(av); } results.add(new SearchResult(dn, objectClasses, attrValues)); } commitTransaction(transaction); status = new RequestStatus(RequestStatus.SUCCESSFUL); } catch (NamingException e) { status = setStatus(e); rollbackTransaction(transaction); } catch (SQLException e) { status = setStatus(e); rollbackTransaction(transaction); } catch (RDBMSSQLException e) { status = setStatus(e); rollbackTransaction(transaction); } catch (NotSupportedException e) { status = setStatus(e); } catch (SystemException e) { status = setStatus(e); } finally { close(con, statement, rs); } return status; } // commits the database transaction private void rollbackTransaction(UserTransaction transaction) { try { if (transaction != null) { transaction.rollback(); } } catch (SecurityException e) { SystemLog.getInstance().logError(this, e.getMessage()); } catch (IllegalStateException e) { SystemLog.getInstance().logError(this, e.getMessage()); } catch (SystemException e) { SystemLog.getInstance().logError(this, e.getMessage()); } } // set status and log an exception private RequestStatus setStatus(Exception e) { SystemLog.getInstance().logError(this, e.getMessage()); RequestStatus status = new RequestStatus(RequestStatus.UNSUCCESSFUL); status.setReasonMessage(e.getMessage()); return status; } /** * Encapsulates results stored in a collection to a form readable by TIM. */ private static class RDBMSSearchResults implements SearchResults { private final Iterator it; private final RequestStatus status; /** * Creates a RDBMSSearchResults object. * * @param status * the status of the search * @param it * to iterate through the results */ RDBMSSearchResults(RequestStatus status, Iterator it) { this.status = status; this.it = it; } /** * The status of the search operation. * * @return successful if the searches could be executed successfully and * there were no errors iterating through the result set */ public RequestStatus getRequestStatus() { return status; } /** * Returns true if there are more rows in the result set. * * @return true if there are more rows in the result set * @throws RemoteServicesException * wrapping an SQL Exception */ public boolean hasNext() throws RemoteServicesException { return (status.succeeded() && (it != null) && it.hasNext()); } /** * Translates the next row into a SearchResult object. * * @return A SearchResult encapsulating the next row */ public SearchResult next() { return (SearchResult) it.next(); } /** * Result set is closed immediately after the search is executed and * results are collected so this method is redundant. */ public void close() { } } }
[ "1223991507@qq.com" ]
1223991507@qq.com
9272218756a564c2e9db0c0107ca05201e55601b
0be92950649594e8109ceacfeb6f08061974587c
/mybatis-mate/src/main/java/cn/newphy/druid/sql/dialect/oracle/ast/stmt/OracleAlterSynonymStatement.java
6747d1da9dfe8677c48a00cd34e3b3c1171f3e0c
[]
no_license
Newphy/orm-mate
73f4a02a9ee0438ee09a4c449777f71fb5ada8d7
e74e0176a59f5b2956ea51db26a73a8a645a02a1
refs/heads/master
2020-03-27T17:10:17.436937
2018-08-31T06:30:25
2018-08-31T06:30:25
146,832,634
0
0
null
null
null
null
UTF-8
Java
false
false
1,586
java
/* * Copyright 1999-2018 Alibaba Group Holding Ltd. * * 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 cn.newphy.druid.sql.dialect.oracle.ast.stmt; import cn.newphy.druid.sql.ast.SQLName; import cn.newphy.druid.sql.dialect.oracle.visitor.OracleASTVisitor; public class OracleAlterSynonymStatement extends OracleStatementImpl implements OracleAlterStatement { private SQLName name; private Boolean enable; private boolean compile; @Override public void accept0(OracleASTVisitor visitor) { if (visitor.visit(this)) { acceptChild(visitor, name); } visitor.endVisit(this); } public Boolean getEnable() { return enable; } public void setEnable(Boolean enable) { this.enable = enable; } public SQLName getName() { return name; } public void setName(SQLName name) { this.name = name; } public boolean isCompile() { return compile; } public void setCompile(boolean compile) { this.compile = compile; } }
[ "liuhui18@xiaoniu66.com" ]
liuhui18@xiaoniu66.com
3a3f0e9c8a6667631ecf3755fe10ee49bdab31bf
83d56024094d15f64e07650dd2b606a38d7ec5f1
/sicc_druida/fuentes/java/MaeEstatClienConectorTransactionComboLoad.java
a7811a468796160e8815bd71c8a874ab49630154
[]
no_license
cdiglesias/SICC
bdeba6af8f49e8d038ef30b61fcc6371c1083840
72fedb14a03cb4a77f62885bec3226dbbed6a5bb
refs/heads/master
2021-01-19T19:45:14.788800
2016-04-07T16:20:51
2016-04-07T16:20:51
null
0
0
null
null
null
null
ISO-8859-3
Java
false
false
2,542
java
import org.w3c.dom.*; import java.util.ArrayList; public class MaeEstatClienConectorTransactionComboLoad implements es.indra.druida.base.ObjetoXML { private ArrayList v = new ArrayList(); public Element getXML (Document doc){ getXML0(doc); return (Element)v.get(0); } /* Primer nodo */ private void getXML0(Document doc) { v.add(doc.createElement("CONECTOR")); ((Element)v.get(0)).setAttribute("TIPO","DRUIDATRANSACTION" ); ((Element)v.get(0)).setAttribute("REVISION","3.1" ); ((Element)v.get(0)).setAttribute("NOMBRE","MaeEstatClienTransactionComboLoad" ); ((Element)v.get(0)).setAttribute("OBSERVACIONES","Conector transaccional para la ejección de la carga de combos de tipo MaeEstatClien" ); /* Empieza nodo:1 / Elemento padre: 0 */ v.add(doc.createElement("ENTRADA")); ((Element)v.get(0)).appendChild((Element)v.get(1)); /* Empieza nodo:2 / Elemento padre: 1 */ v.add(doc.createElement("CAMPO")); ((Element)v.get(2)).setAttribute("NOMBRE","mmgApplyStructuralSecurity" ); ((Element)v.get(2)).setAttribute("TIPO","STRING" ); ((Element)v.get(2)).setAttribute("LONGITUD","5" ); ((Element)v.get(1)).appendChild((Element)v.get(2)); /* Termina nodo:2 */ /* Termina nodo:1 */ /* Empieza nodo:3 / Elemento padre: 0 */ v.add(doc.createElement("SALIDA")); ((Element)v.get(0)).appendChild((Element)v.get(3)); /* Empieza nodo:4 / Elemento padre: 3 */ v.add(doc.createElement("ROWSET")); ((Element)v.get(4)).setAttribute("NOMBRE","result" ); ((Element)v.get(4)).setAttribute("LONGITUD","50" ); ((Element)v.get(3)).appendChild((Element)v.get(4)); /* Empieza nodo:5 / Elemento padre: 4 */ v.add(doc.createElement("CAMPO")); ((Element)v.get(5)).setAttribute("NOMBRE","CODIGO" ); ((Element)v.get(5)).setAttribute("TIPO","STRING" ); ((Element)v.get(5)).setAttribute("LONGITUD","30" ); ((Element)v.get(4)).appendChild((Element)v.get(5)); /* Termina nodo:5 */ /* Empieza nodo:6 / Elemento padre: 4 */ v.add(doc.createElement("CAMPO")); ((Element)v.get(6)).setAttribute("NOMBRE","DESCRIPCION" ); ((Element)v.get(6)).setAttribute("TIPO","STRING" ); ((Element)v.get(6)).setAttribute("LONGITUD","30" ); ((Element)v.get(4)).appendChild((Element)v.get(6)); /* Termina nodo:6 */ /* Termina nodo:4 */ /* Termina nodo:3 */ } }
[ "hp.vega@hotmail.com" ]
hp.vega@hotmail.com
e1b0e35578292dd04814c53342043dd50b15a733
9a2f4023a071f4975dac29d058ceabe9e0982558
/src/main/java/ua/kyiv/univerpulse/myconnectionpool/dao/utils/MyConnectionPool.java
1f3ca6282db881346858453b70ed9f87ffdb548b
[]
no_license
javaOCA/myconnectionpool
c811265eed69099d2341f6c867a1aedfbc6a4390
622c788c4958353175d4f9727ec715a50703c62d
refs/heads/master
2021-01-25T06:16:58.950804
2017-06-06T16:02:49
2017-06-06T16:02:49
93,538,073
0
0
null
null
null
null
UTF-8
Java
false
false
2,476
java
package ua.kyiv.univerpulse.myconnectionpool.dao.utils; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.LinkedList; import java.util.Queue; public class MyConnectionPool { private static MyConnectionPool pool = new MyConnectionPool(); private Queue<Connection> queue = new LinkedList<Connection>(); private String serverName; private String databaseName; private String user; private String password; private int maxConnections; private MyConnectionPool() { try { Class.forName("org.postgresql.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } String url = "jdbc:postgresql://"+serverName+"/" + databaseName; for (int i=0; i<maxConnections; i++) { try { Connection connection = DriverManager.getConnection(url, user, password); queue.add(connection); } catch (SQLException e) { e.printStackTrace(); } } } public void setServerName(String serverName) { this.serverName = serverName; } public void setDatabaseName(String databaseName) { this.databaseName = databaseName; } public void setUser(String user) { this.user = user; } public void setPassword(String password) { this.password = password; } public void setMaxConnections(int maxConnections) { this.maxConnections = maxConnections; } public synchronized MyConnection getConnection() throws SQLException { Connection connection = queue.poll(); if(connection == null){ connection = createConnection(); } return new MyConnection(queue, connection); } private Connection createConnection() throws SQLException { String url = "jdbc:postgresql://"+serverName+"/" + databaseName; Connection connection = DriverManager.getConnection(url, user, password); return connection; } public static MyConnectionPool getInstance(){ return pool; } public void close(){ Connection connection = queue.poll(); while (connection != null){ try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } connection = queue.poll(); } } }
[ "seawind@ukr.net" ]
seawind@ukr.net
681e5a7cfaedebb62916fa84bc11cb49ce3c7efc
46476c8a308ca6b0f9fd25a101befc0aa0fee134
/OOAD/solid-principle-app/src/dip/voilation/XmlLogger.java
d3b09422b1fdddcb5e67d55dda9bb8f1539392c4
[]
no_license
prasad1261997/swabhav-techlabs
19c3c981631baff03a87862725c3b37884c1831a
d7273f5830a99c8ed551ebe0aabf267c7cfa2c21
refs/heads/master
2020-05-17T23:46:27.251579
2018-07-26T17:23:52
2018-07-26T17:23:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
119
java
package dip.voilation; public class XmlLogger { public void log(String message){ System.out.println(message); } }
[ "himanshu922@outlook.com" ]
himanshu922@outlook.com
26343adf493613b0d7eb44c356e2a6d56e69834d
dd1a9c986de0897ae4c92442b395218a94033339
/src/Controllers/CancelCtrl.java
04f66dead4aa4fb7134e43b9290f121529b0e968
[]
no_license
GunnerStraiker1/PatitoFeo
82a007d735be31897a2d444a83a3170ddd1dae5c
b2bbc3ed763ece25d4db6e5778ed7a81005b8c44
refs/heads/master
2021-05-06T16:06:46.846518
2017-12-13T17:58:10
2017-12-13T17:58:10
113,704,629
0
0
null
null
null
null
UTF-8
Java
false
false
5,487
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 Controllers; import DAO.DAOAsientos; import DAO.ObrasDAO; import Interfaz.CancelFrame; import Interfaz.MainFrame; import Modelo.Asiento; import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.JOptionPane; import javax.swing.JRadioButton; import javax.swing.JTextField; /** * * @author Victor Perera */ public class CancelCtrl implements ActionListener{ private CancelFrame cancelView; private DAOAsientos daoAsientos; private List<Asiento> asientos; private String clvFuncion; private List<Asiento> asientosSelected = new ArrayList<>(); private List<JRadioButton> botones = new ArrayList(); public CancelCtrl(CancelFrame cancelView, DAOAsientos daoAsientos) { this.cancelView = cancelView; this.daoAsientos = daoAsientos; this.cancelView.btnCancel.setVisible(false); this.cancelView.btnCancel.addActionListener(this); this.cancelView.btnIngresar.addActionListener(this); this.cancelView.setLocationRelativeTo(null); this.cancelView.setVisible(true); } private void crearPanel(String clv){ this.setClvFuncion(clv.substring(clv.length()-6)); this.asientos = daoAsientos.consultarBoletosComprados(clv, clvFuncion); for (int i = 0; i < asientos.size(); i++) { JRadioButton boton = new JRadioButton(); JTextField nombre = new JTextField(); JTextField palco = new JTextField(); JTextField precio = new JTextField(); nombre.setText(this.asientos.get(i).getNombre()); nombre.setFont(new Font("Tahoma",0,18)); nombre.setBackground(Color.WHITE); nombre.setEditable(false); this.cancelView.panel.add(nombre); palco.setText(this.asientos.get(i).getArea()); palco.setFont(new Font("Tahoma",0,18)); palco.setBackground(Color.WHITE); palco.setEditable(false); this.cancelView.panel.add(palco); precio.setText(String.valueOf(this.asientos.get(i).getPrecio())); precio.setFont(new Font("Tahoma",0,18)); precio.setBackground(Color.WHITE); precio.setEditable(false); this.cancelView.panel.add(precio); boton.setName(String.valueOf(i)); boton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if(boton.isSelected()){ nombre.setBackground(Color.BLUE); palco.setBackground(Color.BLUE); precio.setBackground(Color.BLUE); asientosSelected.add(asientos.get(Integer.parseInt(boton.getName()))); } else{ nombre.setBackground(Color.WHITE); palco.setBackground(Color.WHITE); precio.setBackground(Color.WHITE); asientosSelected.remove(asientos.get(Integer.parseInt(boton.getName()))); } } }); this.cancelView.panel.add(boton); this.cancelView.panel.updateUI(); } } @Override public void actionPerformed(ActionEvent e) { if(e.getSource()== this.cancelView.btnIngresar){ try{ String clvCompra = this.cancelView.txtClvCompra.getText(); if((clvCompra.length()!=8 )&& (clvCompra.length()!=9)){ throw new Exception("No existe esta funcion, revise su Clave"); } else{ crearPanel(clvCompra); this.cancelView.btnCancel.setVisible(true); } }catch(Exception ex){ JOptionPane.showMessageDialog(cancelView, ex.getMessage()); } } if (e.getSource() == this.cancelView.btnCancel) { try { if (asientosSelected.isEmpty()) { throw new Exception("No se ha seleccionado un boleto"); } else { this.daoAsientos.cancelarAsientos(clvFuncion, asientosSelected); JOptionPane.showMessageDialog(cancelView, "Asiento(s) Cancelado(s) \nPase a la taquilla con con su clave de Compra"); ObrasDAO daoObra = new ObrasDAO(); MainFrame mainView = new MainFrame(); MainCtrl main = new MainCtrl(daoObra, mainView); this.cancelView.dispose(); } } catch (Exception ex) { JOptionPane.showMessageDialog(cancelView, ex.getMessage()); } } if (e.getSource() == this.cancelView.btnBack) { ObrasDAO daoObra = new ObrasDAO(); MainFrame mainView = new MainFrame(); MainCtrl main = new MainCtrl(daoObra, mainView); this.cancelView.dispose(); } } public void setClvFuncion(String clvCompra) { this.clvFuncion = clvCompra; } }
[ "victorcito001@hotmail.com" ]
victorcito001@hotmail.com
09bf19cc50352d890c3de4a6d02994ba3d68f853
d39ccf65250d04d5f7826584a06ee316babb3426
/wb-mmb/wb-core/src/main/java/org/dwfa/queue/gui/QueueTableModel.java
e68b47574b008a821cb5314245f506d1a464fb0e
[ "Apache-2.0" ]
permissive
va-collabnet-archive/workbench
ab4c45504cf751296070cfe423e39d3ef2410287
d57d55cb30172720b9aeeb02032c7d675bda75ae
refs/heads/master
2021-01-10T02:02:09.685099
2012-01-25T19:15:44
2012-01-25T19:15:44
47,691,158
0
0
null
null
null
null
UTF-8
Java
false
false
4,608
java
/** * Copyright (c) 2009 International Health Terminology Standards Development * Organisation * * 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. */ /* * Created on Apr 28, 2005 */ package org.dwfa.queue.gui; import java.io.IOException; import java.rmi.RemoteException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import javax.swing.table.AbstractTableModel; import org.dwfa.bpa.process.I_DescribeBusinessProcess; import org.dwfa.bpa.process.I_DescribeQueueEntry; import org.dwfa.bpa.process.I_QueueProcesses; import org.dwfa.queue.SelectAll; public class QueueTableModel extends AbstractTableModel { /** * */ private static final long serialVersionUID = 1L; private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss"); private String[] columnNames = { "Name", "Subject", "Deadline", "Priority", "Originator", "Process ID", "Entry ID" }; private Object[][] rowData; private List<I_DescribeQueueEntry> metaList = new ArrayList<I_DescribeQueueEntry>(); private I_QueueProcesses queue; Collection<I_DescribeBusinessProcess> metaData; /** * @throws RemoteException * @throws IOException * */ public QueueTableModel(I_QueueProcesses queue) throws RemoteException, IOException { super(); this.queue = queue; updateQueueData(); } public void updateQueueData() throws RemoteException, IOException { Collection<I_DescribeBusinessProcess> newData = queue.getProcessMetaData(new SelectAll()); if (metaData == null) { metaData = new ArrayList<I_DescribeBusinessProcess>(newData); } else if (newData.equals(metaData)) { return; } else { metaData = new ArrayList<I_DescribeBusinessProcess>(newData); metaList = new ArrayList<I_DescribeQueueEntry>(); } this.rowData = new Object[metaData.size()][columnNames.length]; int i = 0; for (Iterator<I_DescribeBusinessProcess> metaItr = metaData.iterator(); metaItr.hasNext();) { I_DescribeQueueEntry meta = (I_DescribeQueueEntry) metaItr.next(); metaList.add(meta); rowData[i][0] = meta.getName(); rowData[i][1] = meta.getSubject(); if (meta.getDeadline() == null) { rowData[i][2] = "unspecified"; } else if (meta.getDeadline().getTime() == Long.MAX_VALUE) { rowData[i][2] = "unspecified"; } else if (meta.getDeadline().getTime() == Long.MIN_VALUE) { rowData[i][2] = "immediate"; } else { rowData[i][2] = dateFormat.format(meta.getDeadline()); } rowData[i][3] = meta.getPriority(); rowData[i][4] = meta.getOriginator(); rowData[i][5] = meta.getProcessID(); rowData[i][6] = meta.getEntryID(); i++; } fireTableDataChanged(); } public I_DescribeQueueEntry getRowMetaData(int row) { if (row < metaList.size() && row >= 0) { return metaList.get(row); } return null; } public String getColumnName(int col) { return columnNames[col].toString(); } public int getRowCount() { if (rowData == null) { rowData = new Object[0][columnNames.length]; } return rowData.length; } public int getColumnCount() { return columnNames.length; } public Object getValueAt(int row, int col) { return rowData[row][col]; } public boolean isCellEditable(int row, int col) { return false; } public void setValueAt(Object value, int row, int col) { rowData[row][col] = value; fireTableCellUpdated(row, col); } public Class<?> getColumnClass(int c) { return String.class; } /** * @return Returns the queue. */ public I_QueueProcesses getQueue() { return queue; } }
[ "wsmoak" ]
wsmoak
04be8a5e491bffda8451b0f80caa0543630202bc
10cd1c3d4e6ccd8b99ad0004ce72307d1f6ba22a
/javaExam/SmileGate2.java
15b6873b09940aab620e6b68151ac9f776ff521e
[]
no_license
Kgwkgwkgw/Algorithm
39515d874c9d667bdb76157754478ac5b4dfbc61
a6aa1fab3f24eb34ee9406acc1f7a04168eb7d66
refs/heads/master
2021-09-10T09:08:17.624059
2018-03-23T09:08:34
2018-03-23T09:08:34
104,440,328
0
0
null
null
null
null
UTF-8
Java
false
false
705
java
package javaExam; import java.util.Calendar; import java.util.Scanner; public class SmileGate2 { public static void main(String[] args) { final double rate = 1.11; final double myMoney = 1000000; Scanner sc = new Scanner(System.in); int needYear= solve(myMoney, Double.parseDouble(sc.nextLine()), rate, 0); print(Calendar.getInstance().get(Calendar.YEAR)+needYear); } public static int solve(double myMoney, double target, double rate, int count) { if(myMoney>= target) { return count; } myMoney*= rate; count++; return solve(myMoney, target, rate, count); } public static void print(int year) { System.out.println("the achieve your of target amount is "+year); } }
[ "kgwaaa@naver.com" ]
kgwaaa@naver.com
47b7bf01910549f269a631bc2a630989927d388c
8932dfdc0f3a322c17a717adcb54b8a8d43d6557
/04.PROTOTIPO/WebAppSaltosV1_0/src/java/ec/edu/saltos/controlador/app/BeanPedido.java
0607e44583d8e5c8e5c07ff9884b35bd4321626b
[]
no_license
kalextaday/Saltos_Garrapateros
ada478c2bc949ce75ca230229fb8d2d21c5f5305
1e287bd3fd542808ce526eec76c2b6ec80d00431
refs/heads/master
2022-12-14T20:44:48.076058
2020-09-01T21:59:45
2020-09-01T21:59:45
284,566,384
0
0
null
null
null
null
UTF-8
Java
false
false
20,074
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 ec.edu.saltos.controlador.app; import ec.edu.saltos.config.ControlSesion; import ec.edu.saltos.controlador.seguridad.*; import ec.edu.saltos.config.EstadosConfig; import ec.edu.saltos.controlador.FiltroAcceso; import ec.edu.saltos.modelo.CabeceraFactura; import ec.edu.saltos.modelo.Descuento; import ec.edu.saltos.modelo.Empresa; import ec.edu.saltos.modelo.FormaPago; import ec.edu.saltos.modelo.Paracaidista; import ec.edu.saltos.modelo.Pedido; import ec.edu.saltos.modelo.Perfil; import ec.edu.saltos.modelo.Persona; import ec.edu.saltos.modelo.Salto; import ec.edu.saltos.modelo.ServicioAdicional; import ec.edu.saltos.modelo.UsuarioAcceso; import ec.edu.saltos.modelo.Vuelo; import ec.edu.saltos.persistencia.DAOCabeceraFactura; import ec.edu.saltos.persistencia.DAODescuento; import ec.edu.saltos.persistencia.DAOEmpresa; import ec.edu.saltos.persistencia.DAOFormaPago; import ec.edu.saltos.persistencia.DAOParacaidista; import ec.edu.saltos.persistencia.DAOPedido; import ec.edu.saltos.persistencia.DAOPerfil; import ec.edu.saltos.persistencia.DAOPersona; import ec.edu.saltos.persistencia.DAOSalto; import ec.edu.saltos.persistencia.DAOServicioAdicional; import ec.edu.saltos.persistencia.DAOUsuarioAcceso; import ec.edu.saltos.persistencia.DAOVuelo; import ec.edu.saltos.util.FechaUtil; import ec.edu.saltos.util.PrimeUtiles; import ec.edu.saltos.validaciones.Cedula; import java.io.Serializable; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; import java.util.logging.Level; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.annotation.PostConstruct; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import org.primefaces.event.SelectEvent; import org.primefaces.event.UnselectEvent; /** * * @author kalex */ @ManagedBean @ViewScoped public class BeanPedido extends FiltroAcceso implements Serializable{ private static final Logger LOG = Logger.getLogger(BeanPedido.class.getName()); private List<CabeceraFactura> listaFacturas; private List<UsuarioAcceso> listaUsuariosClientes; private List<FormaPago> listaFormasPago; private List<Empresa> listaEmpresas; private FormaPago formaPagoSeleccionada; private CabeceraFactura facturaSeleccionada; private Perfil perfilGenerador; private UsuarioAcceso usuarioGenerador; private UsuarioAcceso usuarioClienteSeleccionado; private Empresa empresaSeleccionada; private List<Pedido> listaPedidos; private List<Paracaidista> listaParacaidistas; private List<Descuento> listaDescuentos; private List<ServicioAdicional> listaServiciosAdicionales; private List<Salto> listaSaltos; private List<Vuelo> listaVuelos; private Pedido pedidoSeleccionado; private Paracaidista paracaidistaSeleccionado; private Descuento descuentoSeleccionado; private ServicioAdicional servAdicionalSeleccionado; private Salto saltoSeleccionado; private Vuelo vueloSeleccionado; private String formatoFecha; private String formatoHora; private boolean estatus; /** * Creates a new instance of BeanPersona */ public BeanPedido() { super(FacesContext.getCurrentInstance().getExternalContext()); ControlSesion sesion = new ControlSesion(); perfilGenerador=new Perfil(); usuarioGenerador=new UsuarioAcceso(); usuarioClienteSeleccionado=new UsuarioAcceso(); facturaSeleccionada=new CabeceraFactura(); formaPagoSeleccionada=new FormaPago(); empresaSeleccionada=new Empresa(); pedidoSeleccionado=new Pedido(); listaEmpresas=new ArrayList<>(); listaFacturas=new ArrayList<>(); listaUsuariosClientes=new ArrayList<>(); listaFormasPago=new ArrayList<>(); listaPedidos=new ArrayList<>(); listaParacaidistas=new ArrayList<>(); listaDescuentos=new ArrayList<>(); listaServiciosAdicionales=new ArrayList<>(); listaSaltos=new ArrayList<>(); listaVuelos=new ArrayList<>(); if (sesion.obtenerEstadoSesionUsuario()){ perfilGenerador=new DAOPerfil().obtenerPorId(Integer.parseInt(sesion.obtenerIdPerfilSesionActiva())); if (perfilGenerador != null) { if (perfilGenerador.getPerfilEstatus().equals(EstadosConfig.PERFIL_EST_ACTIVADO.getCodigo())){ usuarioGenerador=new DAOUsuarioAcceso().obtenerPorId(Integer.parseInt(sesion.obtenerIdUsuarioAccesoSesionActiva())); } } } } @PostConstruct public void init(){ formatoFecha="cm"; formatoHora="am_pm"; obtenerPedidos(); obtenerFormasPago(); obtenerInfoEmpresa(); obtenerUsuarioCliente(); obtenerParacaidistas(); obtenerDescuentos(); obtenerServiciosAdicionales(); obtenerSaltos(); obtenerVuelos(); obtenerFacturas(); } public void obtenerFormasPago(){ DAOFormaPago dao=new DAOFormaPago(); try{ listaFormasPago=dao.obtenerTodos(); }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al obtener a todos: {0}",e); } } public void obtenerUsuarioCliente(){ DAOUsuarioAcceso dao=new DAOUsuarioAcceso(); try{ listaUsuariosClientes=dao.obtenerTodos(); }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al obtener a todos: {0}",e); } } public void obtenerInfoEmpresa(){ DAOEmpresa dao=new DAOEmpresa(); try{ listaEmpresas=dao.obtenerTodos(); }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al obtener a todos: {0}",e); } } public void obtenerParacaidistas(){ DAOParacaidista dao=new DAOParacaidista(); try{ listaParacaidistas=dao.obtenerTodos(); }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al obtener a todos: {0}",e); } } public void obtenerDescuentos(){ DAODescuento dao=new DAODescuento(); try{ listaDescuentos=dao.obtenerTodos(); }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al obtener a todos: {0}",e); } } public void obtenerServiciosAdicionales(){ DAOServicioAdicional dao=new DAOServicioAdicional(); try{ listaServiciosAdicionales=dao.obtenerTodos(); }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al obtener a todos: {0}",e); } } public void obtenerSaltos(){ DAOSalto dao=new DAOSalto(); try{ listaSaltos=dao.obtenerTodos(); }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al obtener a todos: {0}",e); } } public void obtenerVuelos(){ DAOVuelo dao=new DAOVuelo(); try{ listaVuelos=dao.obtenerTodos(); }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al obtener a todos: {0}",e); } } public void obtenerPedidos(){ DAOPedido dao=new DAOPedido(); try{ listaPedidos=dao.obtenerTodos(); }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al obtener a todos: {0}",e); } } public void obtenerFacturas(){ DAOCabeceraFactura dao=new DAOCabeceraFactura(); try{ listaFacturas=dao.obtenerTodos(); }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al obtener a todos: {0}",e); } } public void agregarPedido() { DAOPedido dao=new DAOPedido(); pedidoSeleccionado.setEstatusFacturacion(false); pedidoSeleccionado.setFechaPedido(FechaUtil.ahoraSinFormato()); try{ if(dao.guardar(pedidoSeleccionado)){ PrimeUtiles.mostrarMensaje(FacesMessage.SEVERITY_INFO, "Info:", "Se registro correctamente."); limpiarPedido(); }else{ PrimeUtiles.mostrarMensaje(FacesMessage.SEVERITY_ERROR, "Error: ","Hubo un error al registrar"); } }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al agregar: {0}",e); }finally{ PrimeUtiles.primeExecute("PF('wv-crear').hide();"); } } public void agregarFactura() { DAOCabeceraFactura dao=new DAOCabeceraFactura(); CabeceraFactura ultimaFactura=new CabeceraFactura(); ultimaFactura=dao.obtenerUltimoRegistro(); long ultimoNumeroFactura=Long.parseLong(ultimaFactura.getFacNumero()); ultimoNumeroFactura++; facturaSeleccionada.setUsuarioAccesoByIdUsuarioGeneradorFac(usuarioGenerador); facturaSeleccionada.setFacNumero(String.valueOf(ultimoNumeroFactura)); facturaSeleccionada.setFacSubtotal(BigDecimal.ZERO); facturaSeleccionada.setFacTotalDescuento(BigDecimal.ZERO); facturaSeleccionada.setFacValorTotal(BigDecimal.ZERO); facturaSeleccionada.setFacFechaEmision(FechaUtil.ahoraSinFormato()); facturaSeleccionada.setFacFechaCaducidad(FechaUtil.ahoraSinFormato()); try{ if(dao.guardar(facturaSeleccionada)){ PrimeUtiles.mostrarMensaje(FacesMessage.SEVERITY_INFO, "Info:", "Se registro correctamente."); limpiarFactura(); }else{ PrimeUtiles.mostrarMensaje(FacesMessage.SEVERITY_ERROR, "Error: ","Hubo un error al registrar"); } }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al agregar: {0}",e); }finally{ PrimeUtiles.primeExecute("PF('wv-crear').hide();"); } } public void modificarFactura() { DAOCabeceraFactura dao=new DAOCabeceraFactura(); //facturaSeleccionada.setPerFechaMod(FechaUtil.ahoraSinFormato()); try{ if(dao.editar(facturaSeleccionada)){ limpiarFactura(); PrimeUtiles.mostrarMensaje(FacesMessage.SEVERITY_INFO, "Info: ","Se actualizo correctamente"); }else{ PrimeUtiles.mostrarMensaje(FacesMessage.SEVERITY_ERROR, "Error: ","Hubo un error al actualizar"); } }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al modificar: {0}",e); }finally{ PrimeUtiles.primeExecute("PF('wv-actualizar').hide();"); } } public void eliminarFactura() { DAOCabeceraFactura dao=new DAOCabeceraFactura(); try{ if(dao.eliminar(facturaSeleccionada)){ limpiarFactura(); PrimeUtiles.mostrarMensaje(FacesMessage.SEVERITY_INFO, "Info: ", "Se elimino correctamente"); LOG.log(Level.INFO, "Persona Eliminada Correctamente"); }else{ PrimeUtiles.mostrarMensaje(FacesMessage.SEVERITY_ERROR, "Error: ", "Hubo un error al eliminar"); LOG.log(Level.INFO, "No se pudo eliminar la persona"); } }catch(Exception e){ LOG.log(Level.INFO, "Excepcion al eliminar: {0}",e); }finally{ PrimeUtiles.primeExecute("PF('wv-eliminar').hide();"); } } public CabeceraFactura onRowSelect(SelectEvent event) { setFacturaSeleccionada((CabeceraFactura) event.getObject()); LOG.log(Level.INFO, "Persona {0} listo para usar a: ", facturaSeleccionada.getFacNumero()); return facturaSeleccionada; } public void onRowUnselect(UnselectEvent event) { } public CabeceraFactura preparaCrear() { LOG.log(Level.INFO, "Preparando nueva persona"); facturaSeleccionada = new CabeceraFactura(); PrimeUtiles.primeExecute("PF('wv-crear').show();"); return facturaSeleccionada; } public CabeceraFactura preparaActualizar() { LOG.log(Level.INFO, "Persona {0} lista para actualizar.", facturaSeleccionada.getFacNumero()); PrimeUtiles.primeExecute("PF('wv-actualizar').show();"); return facturaSeleccionada; } public void preparaArchivar() { LOG.log(Level.INFO, "Persona {0} lista para archivar.", facturaSeleccionada.getFacNumero()); PrimeUtiles.primeExecute("PF('wv-archivar').show();"); } public void preparaEliminar() { LOG.log(Level.INFO, "Persona {0} lista para eliminar.", facturaSeleccionada.getFacNumero()); PrimeUtiles.primeExecute("PF('wv-eliminar').show();"); } public void actualizarCliente() { if (facturaSeleccionada != null && usuarioClienteSeleccionado != null) { facturaSeleccionada.setUsuarioAccesoByIdUsuarioCliente(usuarioClienteSeleccionado); } } public void actualizarSalto() { if (pedidoSeleccionado != null && saltoSeleccionado != null) { pedidoSeleccionado.setSalto(saltoSeleccionado); } } public void actualizarParacaidista() { if (pedidoSeleccionado != null && paracaidistaSeleccionado != null) { pedidoSeleccionado.setParacaidista(paracaidistaSeleccionado); } } public void actualizarDescuento() { if (pedidoSeleccionado != null && descuentoSeleccionado != null) { pedidoSeleccionado.setDescuento(descuentoSeleccionado); } } public void actualizarVuelo() { if (pedidoSeleccionado != null && vueloSeleccionado != null) { pedidoSeleccionado.setVuelo(vueloSeleccionado); } } public void actualizarFormaPago() { if (facturaSeleccionada != null && formaPagoSeleccionada != null) { facturaSeleccionada.setFormaPago(formaPagoSeleccionada); } } public void actualizarEmpresa() { if (facturaSeleccionada != null && empresaSeleccionada != null) { facturaSeleccionada.setEmpresa(empresaSeleccionada); } } public void limpiarFactura() { facturaSeleccionada = new CabeceraFactura(); } public void limpiarPedido() { pedidoSeleccionado = new Pedido(); } public boolean isEstatus() { return estatus; } public void setEstatus(boolean estatus) { this.estatus = estatus; } public String getFormatoFecha() { return formatoFecha; } public void setFormatoFecha(String formatoFecha) { this.formatoFecha = formatoFecha; } public List<CabeceraFactura> getListaFacturas() { obtenerFacturas(); return listaFacturas; } public void setListaFacturas(List<CabeceraFactura> listaFacturas) { this.listaFacturas = listaFacturas; } public List<UsuarioAcceso> getListaUsuariosClientes() { return listaUsuariosClientes; } public void setListaUsuariosClientes(List<UsuarioAcceso> listaUsuariosClientes) { this.listaUsuariosClientes = listaUsuariosClientes; } public CabeceraFactura getFacturaSeleccionada() { return facturaSeleccionada; } public void setFacturaSeleccionada(CabeceraFactura facturaSeleccionada) { this.facturaSeleccionada = facturaSeleccionada; } public Perfil getPerfilGenerador() { return perfilGenerador; } public void setPerfilGenerador(Perfil perfilGenerador) { this.perfilGenerador = perfilGenerador; } public UsuarioAcceso getUsuarioGenerador() { return usuarioGenerador; } public void setUsuarioGenerador(UsuarioAcceso usuarioGenerador) { this.usuarioGenerador = usuarioGenerador; } public UsuarioAcceso getUsuarioClienteSeleccionado() { return usuarioClienteSeleccionado; } public void setUsuarioClienteSeleccionado(UsuarioAcceso usuarioClienteSeleccionado) { this.usuarioClienteSeleccionado = usuarioClienteSeleccionado; } public List<FormaPago> getListaFormasPago() { return listaFormasPago; } public void setListaFormasPago(List<FormaPago> listaFormasPago) { this.listaFormasPago = listaFormasPago; } public FormaPago getFormaPagoSeleccionada() { return formaPagoSeleccionada; } public void setFormaPagoSeleccionada(FormaPago formaPagoSeleccionada) { this.formaPagoSeleccionada = formaPagoSeleccionada; } public Empresa getEmpresaSeleccionada() { return empresaSeleccionada; } public void setEmpresaSeleccionada(Empresa empresaSeleccionada) { this.empresaSeleccionada = empresaSeleccionada; } public List<Pedido> getListaPedidos() { return listaPedidos; } public void setListaPedidos(List<Pedido> listaPedidos) { this.listaPedidos = listaPedidos; } public List<Paracaidista> getListaParacaidistas() { return listaParacaidistas; } public void setListaParacaidistas(List<Paracaidista> listaParacaidistas) { this.listaParacaidistas = listaParacaidistas; } public List<Descuento> getListaDescuentos() { return listaDescuentos; } public void setListaDescuentos(List<Descuento> listaDescuentos) { this.listaDescuentos = listaDescuentos; } public List<ServicioAdicional> getListaServiciosAdicionales() { return listaServiciosAdicionales; } public void setListaServiciosAdicionales(List<ServicioAdicional> listaServiciosAdicionales) { this.listaServiciosAdicionales = listaServiciosAdicionales; } public List<Salto> getListaSaltos() { return listaSaltos; } public void setListaSaltos(List<Salto> listaSaltos) { this.listaSaltos = listaSaltos; } public List<Vuelo> getListaVuelos() { return listaVuelos; } public void setListaVuelos(List<Vuelo> listaVuelos) { this.listaVuelos = listaVuelos; } public Pedido getPedidoSeleccionado() { return pedidoSeleccionado; } public void setPedidoSeleccionado(Pedido pedidoSeleccionado) { this.pedidoSeleccionado = pedidoSeleccionado; } public Paracaidista getParacaidistaSeleccionado() { return paracaidistaSeleccionado; } public void setParacaidistaSeleccionado(Paracaidista paracaidistaSeleccionado) { this.paracaidistaSeleccionado = paracaidistaSeleccionado; } public Descuento getDescuentoSeleccionado() { return descuentoSeleccionado; } public void setDescuentoSeleccionado(Descuento descuentoSeleccionado) { this.descuentoSeleccionado = descuentoSeleccionado; } public ServicioAdicional getServAdicionalSeleccionado() { return servAdicionalSeleccionado; } public void setServAdicionalSeleccionado(ServicioAdicional servAdicionalSeleccionado) { this.servAdicionalSeleccionado = servAdicionalSeleccionado; } public Salto getSaltoSeleccionado() { return saltoSeleccionado; } public void setSaltoSeleccionado(Salto saltoSeleccionado) { this.saltoSeleccionado = saltoSeleccionado; } public Vuelo getVueloSeleccionado() { return vueloSeleccionado; } public void setVueloSeleccionado(Vuelo vueloSeleccionado) { this.vueloSeleccionado = vueloSeleccionado; } public String getFormatoHora() { return formatoHora; } public void setFormatoHora(String formatoHora) { this.formatoHora = formatoHora; } public List<Empresa> getListaEmpresas() { return listaEmpresas; } public void setListaEmpresas(List<Empresa> listaEmpresas) { this.listaEmpresas = listaEmpresas; } }
[ "ktaday@emagic.fin.ec" ]
ktaday@emagic.fin.ec
7ddc671de9e9595cf5ec34e3eda5631b1f123bcc
e3e8f0f568baba124df57a45a1cb6a5800e67349
/app/src/main/java/fiture/quiamco/com/homefiture/Week4FullBodyChallenge/Day6.java
d18dfc7f7e501898046cbdbeb49feae8648437ad
[]
no_license
SarthakMehta999/FaceLoginToFire
58e1dbc0584e854d1aa67eb37181cc1fd6568a0c
c9a5da02a5bbc79fda7c305a7fd348d1d4007f11
refs/heads/master
2020-03-30T23:38:02.968251
2018-10-05T10:52:19
2018-10-05T10:52:19
151,707,249
0
0
null
2018-10-05T10:51:56
2018-10-05T10:51:56
null
UTF-8
Java
false
false
399
java
package fiture.quiamco.com.homefiture.Week4FullBodyChallenge; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import fiture.quiamco.com.homefiture.R; public class Day6 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_day28); } }
[ "shawnerlsala@bsit.usjr.edu.ph" ]
shawnerlsala@bsit.usjr.edu.ph
522e4db9b0a406c6e20fee738886815f5eb90101
f7ef6b0a32bde8351cf6235ea1f226a7fa4505a4
/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/factory/AdaptiveExtensionFactory.java
ef39a205cd93c7b0ad9ef552c903ff0eeb151115
[ "GPL-1.0-or-later", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
zcswl7961/dubbox
c0d5ba01c46f4a82f77e187cbf4eb58c1dc2b6d8
ed7d9238b92c49bc55ad4cb1b55b9ef5c85f239a
refs/heads/master
2022-12-04T19:12:36.737239
2019-11-13T10:32:15
2019-11-13T10:32:15
189,978,538
3
0
Apache-2.0
2022-11-15T23:52:08
2019-06-03T09:49:23
Java
UTF-8
Java
false
false
2,333
java
/* * Copyright 1999-2012 Alibaba Group. * * 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.alibaba.dubbo.common.extension.factory; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.alibaba.dubbo.common.extension.Adaptive; import com.alibaba.dubbo.common.extension.ExtensionFactory; import com.alibaba.dubbo.common.extension.ExtensionLoader; /** * AdaptiveExtensionFactory * 所有的SPI类(除了ExtensionFactory为,这个是null),对应的ExtensionLoader实例的objectFactory属性的类型都是AdaptiveExtensionFactory类 * * @author william.liangf */ @Adaptive public class AdaptiveExtensionFactory implements ExtensionFactory { private final List<ExtensionFactory> factories; /** * ExtensionFactory中只会存储对应的两个类 * pring=com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory   spi=com.alibaba.dubbo.common.extension.factory.SpiExtensionFactory adaptive=com.alibaba.dubbo.common.extension.factory.AdaptiveExtensionFactory是保存在cachedAdaptiveClass上的 */ public AdaptiveExtensionFactory() { ExtensionLoader<ExtensionFactory> loader = ExtensionLoader.getExtensionLoader(ExtensionFactory.class); List<ExtensionFactory> list = new ArrayList<ExtensionFactory>(); for (String name : loader.getSupportedExtensions()) { list.add(loader.getExtension(name)); } factories = Collections.unmodifiableList(list); } public <T> T getExtension(Class<T> type, String name) { for (ExtensionFactory factory : factories) { T extension = factory.getExtension(type, name); if (extension != null) { return extension; } } return null; } }
[ "26921832@qq.com" ]
26921832@qq.com
28c20ebd764640096e8e5243beeb6b18cb02bb54
fb7d3acae8a49b92042bbae84bbd37601d77f912
/MavenProject/src/test/java/AmazonTest002/AmazonSearchPOM.java
3fdf042c17b84732fa970801c4bd3dd68b2888bb
[]
no_license
manjunath-agi/MavenProject
af6cc85f1a145fb81fb2b14cdaeb8ca00a275436
0a8431ad3446cefac3b10fdfd5d494ff118b5ac4
refs/heads/master
2023-08-16T08:39:12.066988
2021-10-20T14:29:54
2021-10-20T14:29:54
414,463,354
0
0
null
null
null
null
UTF-8
Java
false
false
755
java
package AmazonTest002; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; public class AmazonSearchPOM { public WebDriver driver; public AmazonSearchPOM(WebDriver driver) { super(); this.driver = driver; } //By GetIttodayCheckbox = By.className("a-size-base a-color-base a-text-bold"); By GetIttodayCheckbox = By.xpath("//*[@id=\"p_90/6741117031\"]/span/a/div/label/i"); By DisplayText = By.xpath("//*[@id=\"search\"]/span/div/span/h1/div/div[1]/div/div/span[1]"); public WebElement GetIttodayCheckbox() { return driver.findElement(GetIttodayCheckbox); } public WebElement DisplayText() { return driver.findElement(DisplayText); } }
[ "00005232@AGI-LT-847.arisglobal.com" ]
00005232@AGI-LT-847.arisglobal.com
295980cb0c3df6d2ee32dbfea084bbb1f1fb876d
97d89db1d629f86fd0e98b8a87b560257b2ed759
/safemed-ui/src/main/java/com/bafal/dev/patient/web/commun/email/ServiceNotification.java
c1d06d06542e2fb15ef079a3dad11450ad79b4e2
[]
no_license
SafeMedTeam/safemed
49d4bb0147050d5ddc793d71a02fe977c6a51a80
86dfbcf314f7c3496a0bdbdfd46169b00f277515
refs/heads/master
2021-01-19T11:05:36.109661
2017-07-01T20:37:58
2017-07-01T20:38:32
95,698,621
0
0
null
null
null
null
UTF-8
Java
false
false
3,498
java
package com.bafal.dev.patient.web.commun.email; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import java.util.HashMap; import java.util.Map; import javax.mail.internet.InternetAddress; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bafal.dev.patient.modele.base.exception.SafeMedException; import com.bafal.dev.patient.modele.base.logger.SafeMedLogger; import com.bafal.dev.patient.modele.base.util.DME; import com.bafal.dev.patient.modele.dto.ResetMotDePasseDto; import com.bafal.dev.patient.modele.dto.UtilisateurDto; import it.ozimov.springboot.templating.mail.model.Email; import it.ozimov.springboot.templating.mail.model.impl.EmailImpl; import it.ozimov.springboot.templating.mail.service.EmailService; import it.ozimov.springboot.templating.mail.service.exception.CannotSendEmailException; @Service public class ServiceNotification { @Autowired public EmailService serviceEmail; private static final String UTF_8 = "UTF-8"; public void envoyerNotificationCreationCompte(UtilisateurDto dto) throws SafeMedException { Email email; try { email = DmeEmailBuilder.build(dto); this.envoyerMail(email); } catch (UnsupportedEncodingException e) { SafeMedLogger.error(ServiceNotification.class, "Erreur survenue lors de lenvoi du mail", e); throw new SafeMedException(e.getMessage()); } } public void envoyerNotificationCreationCompte(UtilisateurDto dto, String template) throws SafeMedException { try { // BATIR LES TOKENS final Map<String, Object> parametres = new HashMap<String, Object>(); parametres.put("civilite", dto.getCivilite().getNom()); parametres.put("prenom", dto.getPrenom()); parametres.put("username", dto.getCodeUtilisateur()); parametres.put("password", dto.getMotDePasse()); parametres.put("courriel", dto.getCourriel()); parametres.put("emailsupport", "support@admin.safemed.com"); this.envoyerMail(DmeEmailBuilder.build(dto), template, parametres); } catch (UnsupportedEncodingException | CannotSendEmailException e) { SafeMedLogger.error(ServiceNotification.class, "Erreur lors de lenvoi du mail avec Template ..", e); throw new SafeMedException(e.getMessage()); } } public void envoyerNotificationResetMDP(ResetMotDePasseDto dto, String template) throws SafeMedException { try { // BATIR LES TOKENS final Map<String, Object> parametres = new HashMap<String, Object>(); parametres.put("password", dto.getNouveauMotDePasse()); parametres.put("courriel", dto.getCourriel()); parametres.put("emailsupport", "support@admin.safemed.com"); Email email = EmailImpl.builder().from(new InternetAddress("noreply@admin.safemed.com", "NOREPLY SafeMed")) // .to(DME.asList(new InternetAddress("bafal.fall@gmail.com", "bafal.fall@gmail.com"))) // .subject("SafeMed Reset Password") // .body("").encoding(Charset.forName(UTF_8)).build(); this.envoyerMail(email, template, parametres); } catch (UnsupportedEncodingException | CannotSendEmailException e) { SafeMedLogger.error(ServiceNotification.class, "Erreur lors de lenvoi du mail avec Template ..", e); throw new SafeMedException(e.getMessage()); } } public void envoyerMail(Email email) { serviceEmail.send(email); } public void envoyerMail(Email email, String template, Map<String, Object> parametres) throws CannotSendEmailException { serviceEmail.send(email, template, parametres); } }
[ "babacar.fall1@gmail.com" ]
babacar.fall1@gmail.com
379974d0b972c8806f6108462b7899ef537f0072
eca6fefd68c5438aec04749471a8b738a2488780
/src/main/java/mio/bmt/atomikos/ProvaXA.java
848090a8566bcae5eb1c6e0c74ade0ef79ad4f42
[]
no_license
comedsh/atomikos-raw
f98570a66629735f3bc85fa00ebd4966fde6d81b
251beb95655ba60c544f122427884ff000f8aecb
refs/heads/master
2020-06-17T20:58:18.667126
2016-11-28T12:21:57
2016-11-28T12:21:57
74,969,492
0
0
null
null
null
null
UTF-8
Java
false
false
3,169
java
package mio.bmt.atomikos; import java.sql.Connection; import java.sql.PreparedStatement; import java.util.Properties; import javax.transaction.UserTransaction; import com.atomikos.icatch.jta.UserTransactionImp; import com.atomikos.jdbc.AtomikosDataSourceBean; public class ProvaXA { public AtomikosDataSourceBean ds1 = new AtomikosDataSourceBean(); public AtomikosDataSourceBean ds2 = new AtomikosDataSourceBean(); public static final int TIMEOUT = 3000000; /** * CREATE TABLE `atomikos_mio`.`acidrest` ( `rest` INT NOT NULL, `temp` INT NULL, PRIMARY KEY (`rest`)); CREATE TABLE `atomikos_crm`.`canale` ( `id` INT NOT NULL, PRIMARY KEY (`id`)); * * * * @throws Exception */ private void setUp() throws Exception{ ds1.setUniqueResourceName("uno"); ds1.setXaDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"); ds1.setReapTimeout( TIMEOUT ); Properties p1 = new Properties(); p1.setProperty ( "user" , "root" ); p1.setProperty ( "password" , "comedsh006" ); p1.setProperty ( "URL" , "jdbc:mysql://localhost:3306/atomikos_mio" ); ds1.setXaProperties ( p1 ); ds1.setPoolSize ( 5 ); ds2.setUniqueResourceName("due"); ds2.setXaDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"); ds2.setReapTimeout( TIMEOUT ); Properties p2 = new Properties(); p2.setProperty ( "user" , "root" ); p2.setProperty ( "password" , "comedsh006" ); p2.setProperty ( "URL" , "jdbc:mysql://localhost:3306/atomikos_crm" ); ds2.setXaProperties ( p2 ); ds2.setPoolSize ( 5 ); // clean up the data Utils.execute( Utils.getConnection("atomikos_mio"), "delete from acidrest" ); Utils.execute( Utils.getConnection("atomikos_crm"), "delete from canale" ); } public static void main(String[] args) throws Exception{ ProvaXA p = new ProvaXA(); p.setUp(); /** * ut 是如何与 XA Resource 关联起来的? * * 是通过 Hashtable BaseTransactionManager#threadtoxmap,为每一个当前的线程维护了一份 CompositeTransactionImp,而 CompositeTransactionImp 就相当于 Root Transaction, * 其属性 CoordinatorImp 维护了所有相关的 XA Resources... */ UserTransaction ut = new UserTransactionImp(); ut.setTransactionTimeout(TIMEOUT); ut.begin(); Connection c1 = p.ds1.getConnection(); Connection c2 = p.ds2.getConnection(); PreparedStatement statement1 = c1.prepareStatement("insert into acidrest (rest,temp) values (?,?)"); statement1.setInt(1,1); statement1.setInt(2,1); statement1.executeUpdate(); PreparedStatement statement12 = c1.prepareStatement("insert into acidrest (rest,temp) values (?,?)"); statement12.setInt(1,2); statement12.setInt(2,2); statement12.executeUpdate(); PreparedStatement statement2 = c2.prepareStatement("insert into canale (id) values (?)"); statement2.setInt(1,2); statement2.executeUpdate(); c1.close(); c2.close(); System.out.println("trying to commit ~ "); ut.commit(); } }
[ "comedshang@163.com" ]
comedshang@163.com
dfdbb5e53b02c7037140a5fa8d06616dbcfd9c3d
0e71920c30cecd286dc590b142e943e9e7f8ccbd
/app/src/main/java/no/hiof/geire/coursesapp/adapter/MessageRecyclerViewAdapter.java
6b3d0ec16461bdfe752d7df04e66e1da1015a3d9
[]
no_license
haakonhd/DataSecAndroid
0f5230aea8cb68d68d9696dbd9d4ba1c5e1d44a1
ae61b27360310886ccb773b35321f3cf30a896fe
refs/heads/master
2020-12-11T11:14:35.053376
2020-05-07T17:09:48
2020-05-07T17:09:48
233,833,130
0
0
null
null
null
null
UTF-8
Java
false
false
2,830
java
package no.hiof.geire.coursesapp.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.util.List; import androidx.recyclerview.widget.RecyclerView; import no.hiof.geire.coursesapp.R; import no.hiof.geire.coursesapp.model.Melding; public class MessageRecyclerViewAdapter extends RecyclerView.Adapter<MessageRecyclerViewAdapter.ViewHolder> { private List<Melding> mData; private LayoutInflater mInflater; private ItemClickListener mClickListener; // data is passed into the constructor public MessageRecyclerViewAdapter(Context context, List<Melding> data) { this.mInflater = LayoutInflater.from(context); this.mData = data; } // inflates the row layout from xml when needed @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = mInflater.inflate(R.layout.item, parent, false); return new ViewHolder(view); } // binds the data to the TextView in each row @Override public void onBindViewHolder(ViewHolder holder, int position) { Melding message = mData.get(position); holder.messageTextView.setText(message.getInnhold_melding()); if(!message.getInnhold_svar().equals(" ")) { holder.replyTextView.setText("Svar fra fagansvarlig: " + message.getInnhold_svar()); } } // total number of rows @Override public int getItemCount() { return mData.size(); } // stores and recycles views as they are scrolled off screen public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { TextView messageTextView; TextView authorTextView; TextView replyTextView; ViewHolder(View itemView) { super(itemView); messageTextView = itemView.findViewById(R.id.messageTextView); authorTextView = itemView.findViewById(R.id.authorTextView); replyTextView = itemView.findViewById(R.id.replyTextView); itemView.setOnClickListener(this); } @Override public void onClick(View view) { if (mClickListener != null) mClickListener.onItemClick(view, getAdapterPosition()); } } // convenience method for getting data at click position public Melding getItem(int id) { return mData.get(id); } // allows clicks events to be caught public void setClickListener(ItemClickListener itemClickListener) { this.mClickListener = itemClickListener; } // parent activity will implement this method to respond to click events public interface ItemClickListener { void onItemClick(View view, int position); } }
[ "geireilertsen@hotmail.com" ]
geireilertsen@hotmail.com
0f8b6757792273e2ea4afa42a43f89d980c633d3
caa0408050cc7b8f99edcd3d4af332c48da6009a
/src/main/java/com/uade/seminario/dao/LookupDao.java
cf8a0a9433e364071e92682fac9b4e2473a97786
[]
no_license
GonzaloFuentes/TNG24
d08d6d051adc1e233a8b0d866aa6ec166b9478fb
138469745fd7bbc87cd074223b964bdee5746f6b
refs/heads/master
2021-01-21T19:13:44.908567
2017-07-07T06:36:28
2017-07-07T06:36:28
92,131,430
0
0
null
null
null
null
UTF-8
Java
false
false
536
java
package com.uade.seminario.dao; import com.uade.seminario.model.Role; import java.util.List; /** * Lookup Data Access Object (GenericDao) interface. This is used to lookup values in * the database (i.e. for drop-downs). * * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a> */ public interface LookupDao { //~ Methods ================================================================ /** * Returns all Roles ordered by name * @return populated list of roles */ List<Role> getRoles(); }
[ "gonza.a.fuentes@gmail.com" ]
gonza.a.fuentes@gmail.com
eb239feb35e7b0294c7b6b7b8f398b3af4303e2a
39eb9f1ba5289815a03feb4d5c2cbe05ad46a0e9
/andrioid_app/app/build/generated/source/r/release/android/support/v7/appcompat/R.java
585ea311a356535dfc67a6a2664d0d68d3dd87c5
[]
no_license
lazarbeloica/iot
a0b0986d37f9604cc544f1931d3486b611d35985
5640f874e189b52aec0e353beb30d150d3857875
refs/heads/master
2022-02-24T16:13:09.077725
2019-10-07T20:41:48
2019-10-07T20:41:48
114,177,332
0
0
null
null
null
null
UTF-8
Java
false
false
115,275
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.v7.appcompat; public final class R { public static final class anim { public static final int abc_fade_in = 0x7f010000; public static final int abc_fade_out = 0x7f010001; public static final int abc_grow_fade_in_from_bottom = 0x7f010002; public static final int abc_popup_enter = 0x7f010003; public static final int abc_popup_exit = 0x7f010004; public static final int abc_shrink_fade_out_from_bottom = 0x7f010005; public static final int abc_slide_in_bottom = 0x7f010006; public static final int abc_slide_in_top = 0x7f010007; public static final int abc_slide_out_bottom = 0x7f010008; public static final int abc_slide_out_top = 0x7f010009; public static final int tooltip_enter = 0x7f01000a; public static final int tooltip_exit = 0x7f01000b; } public static final class attr { public static final int actionBarDivider = 0x7f020000; public static final int actionBarItemBackground = 0x7f020001; public static final int actionBarPopupTheme = 0x7f020002; public static final int actionBarSize = 0x7f020003; public static final int actionBarSplitStyle = 0x7f020004; public static final int actionBarStyle = 0x7f020005; public static final int actionBarTabBarStyle = 0x7f020006; public static final int actionBarTabStyle = 0x7f020007; public static final int actionBarTabTextStyle = 0x7f020008; public static final int actionBarTheme = 0x7f020009; public static final int actionBarWidgetTheme = 0x7f02000a; public static final int actionButtonStyle = 0x7f02000b; public static final int actionDropDownStyle = 0x7f02000c; public static final int actionLayout = 0x7f02000d; public static final int actionMenuTextAppearance = 0x7f02000e; public static final int actionMenuTextColor = 0x7f02000f; public static final int actionModeBackground = 0x7f020010; public static final int actionModeCloseButtonStyle = 0x7f020011; public static final int actionModeCloseDrawable = 0x7f020012; public static final int actionModeCopyDrawable = 0x7f020013; public static final int actionModeCutDrawable = 0x7f020014; public static final int actionModeFindDrawable = 0x7f020015; public static final int actionModePasteDrawable = 0x7f020016; public static final int actionModePopupWindowStyle = 0x7f020017; public static final int actionModeSelectAllDrawable = 0x7f020018; public static final int actionModeShareDrawable = 0x7f020019; public static final int actionModeSplitBackground = 0x7f02001a; public static final int actionModeStyle = 0x7f02001b; public static final int actionModeWebSearchDrawable = 0x7f02001c; public static final int actionOverflowButtonStyle = 0x7f02001d; public static final int actionOverflowMenuStyle = 0x7f02001e; public static final int actionProviderClass = 0x7f02001f; public static final int actionViewClass = 0x7f020020; public static final int activityChooserViewStyle = 0x7f020021; public static final int alertDialogButtonGroupStyle = 0x7f020022; public static final int alertDialogCenterButtons = 0x7f020023; public static final int alertDialogStyle = 0x7f020024; public static final int alertDialogTheme = 0x7f020025; public static final int allowStacking = 0x7f020026; public static final int alpha = 0x7f020027; public static final int alphabeticModifiers = 0x7f020028; public static final int arrowHeadLength = 0x7f020029; public static final int arrowShaftLength = 0x7f02002a; public static final int autoCompleteTextViewStyle = 0x7f02002b; public static final int autoSizeMaxTextSize = 0x7f02002c; public static final int autoSizeMinTextSize = 0x7f02002d; public static final int autoSizePresetSizes = 0x7f02002e; public static final int autoSizeStepGranularity = 0x7f02002f; public static final int autoSizeTextType = 0x7f020030; public static final int background = 0x7f020031; public static final int backgroundSplit = 0x7f020032; public static final int backgroundStacked = 0x7f020033; public static final int backgroundTint = 0x7f020034; public static final int backgroundTintMode = 0x7f020035; public static final int barLength = 0x7f020036; public static final int borderlessButtonStyle = 0x7f020037; public static final int buttonBarButtonStyle = 0x7f020038; public static final int buttonBarNegativeButtonStyle = 0x7f020039; public static final int buttonBarNeutralButtonStyle = 0x7f02003a; public static final int buttonBarPositiveButtonStyle = 0x7f02003b; public static final int buttonBarStyle = 0x7f02003c; public static final int buttonGravity = 0x7f02003d; public static final int buttonPanelSideLayout = 0x7f02003e; public static final int buttonStyle = 0x7f02003f; public static final int buttonStyleSmall = 0x7f020040; public static final int buttonTint = 0x7f020041; public static final int buttonTintMode = 0x7f020042; public static final int checkboxStyle = 0x7f020043; public static final int checkedTextViewStyle = 0x7f020044; public static final int closeIcon = 0x7f020045; public static final int closeItemLayout = 0x7f020046; public static final int collapseContentDescription = 0x7f020047; public static final int collapseIcon = 0x7f020048; public static final int color = 0x7f020049; public static final int colorAccent = 0x7f02004a; public static final int colorBackgroundFloating = 0x7f02004b; public static final int colorButtonNormal = 0x7f02004c; public static final int colorControlActivated = 0x7f02004d; public static final int colorControlHighlight = 0x7f02004e; public static final int colorControlNormal = 0x7f02004f; public static final int colorError = 0x7f020050; public static final int colorPrimary = 0x7f020051; public static final int colorPrimaryDark = 0x7f020052; public static final int colorSwitchThumbNormal = 0x7f020053; public static final int commitIcon = 0x7f020054; public static final int contentDescription = 0x7f020056; public static final int contentInsetEnd = 0x7f020057; public static final int contentInsetEndWithActions = 0x7f020058; public static final int contentInsetLeft = 0x7f020059; public static final int contentInsetRight = 0x7f02005a; public static final int contentInsetStart = 0x7f02005b; public static final int contentInsetStartWithNavigation = 0x7f02005c; public static final int controlBackground = 0x7f02005d; public static final int customNavigationLayout = 0x7f02005e; public static final int defaultQueryHint = 0x7f02005f; public static final int dialogPreferredPadding = 0x7f020060; public static final int dialogTheme = 0x7f020061; public static final int displayOptions = 0x7f020062; public static final int divider = 0x7f020063; public static final int dividerHorizontal = 0x7f020064; public static final int dividerPadding = 0x7f020065; public static final int dividerVertical = 0x7f020066; public static final int drawableSize = 0x7f020067; public static final int drawerArrowStyle = 0x7f020068; public static final int dropDownListViewStyle = 0x7f020069; public static final int dropdownListPreferredItemHeight = 0x7f02006a; public static final int editTextBackground = 0x7f02006b; public static final int editTextColor = 0x7f02006c; public static final int editTextStyle = 0x7f02006d; public static final int elevation = 0x7f02006e; public static final int expandActivityOverflowButtonDrawable = 0x7f02006f; public static final int font = 0x7f020070; public static final int fontFamily = 0x7f020071; public static final int fontProviderAuthority = 0x7f020072; public static final int fontProviderCerts = 0x7f020073; public static final int fontProviderFetchStrategy = 0x7f020074; public static final int fontProviderFetchTimeout = 0x7f020075; public static final int fontProviderPackage = 0x7f020076; public static final int fontProviderQuery = 0x7f020077; public static final int fontStyle = 0x7f020078; public static final int fontWeight = 0x7f020079; public static final int gapBetweenBars = 0x7f02007a; public static final int goIcon = 0x7f02007b; public static final int height = 0x7f02007c; public static final int hideOnContentScroll = 0x7f02007d; public static final int homeAsUpIndicator = 0x7f02007e; public static final int homeLayout = 0x7f02007f; public static final int icon = 0x7f020080; public static final int iconTint = 0x7f020081; public static final int iconTintMode = 0x7f020082; public static final int iconifiedByDefault = 0x7f020083; public static final int imageButtonStyle = 0x7f020084; public static final int indeterminateProgressStyle = 0x7f020085; public static final int initialActivityCount = 0x7f020086; public static final int isLightTheme = 0x7f020087; public static final int itemPadding = 0x7f020088; public static final int layout = 0x7f020089; public static final int listChoiceBackgroundIndicator = 0x7f0200b5; public static final int listDividerAlertDialog = 0x7f0200b6; public static final int listItemLayout = 0x7f0200b7; public static final int listLayout = 0x7f0200b8; public static final int listMenuViewStyle = 0x7f0200b9; public static final int listPopupWindowStyle = 0x7f0200ba; public static final int listPreferredItemHeight = 0x7f0200bb; public static final int listPreferredItemHeightLarge = 0x7f0200bc; public static final int listPreferredItemHeightSmall = 0x7f0200bd; public static final int listPreferredItemPaddingLeft = 0x7f0200be; public static final int listPreferredItemPaddingRight = 0x7f0200bf; public static final int logo = 0x7f0200c0; public static final int logoDescription = 0x7f0200c1; public static final int maxButtonHeight = 0x7f0200c2; public static final int measureWithLargestChild = 0x7f0200c3; public static final int multiChoiceItemLayout = 0x7f0200c4; public static final int navigationContentDescription = 0x7f0200c5; public static final int navigationIcon = 0x7f0200c6; public static final int navigationMode = 0x7f0200c7; public static final int numericModifiers = 0x7f0200c8; public static final int overlapAnchor = 0x7f0200c9; public static final int paddingBottomNoButtons = 0x7f0200ca; public static final int paddingEnd = 0x7f0200cb; public static final int paddingStart = 0x7f0200cc; public static final int paddingTopNoTitle = 0x7f0200cd; public static final int panelBackground = 0x7f0200ce; public static final int panelMenuListTheme = 0x7f0200cf; public static final int panelMenuListWidth = 0x7f0200d0; public static final int popupMenuStyle = 0x7f0200d1; public static final int popupTheme = 0x7f0200d2; public static final int popupWindowStyle = 0x7f0200d3; public static final int preserveIconSpacing = 0x7f0200d4; public static final int progressBarPadding = 0x7f0200d5; public static final int progressBarStyle = 0x7f0200d6; public static final int queryBackground = 0x7f0200d7; public static final int queryHint = 0x7f0200d8; public static final int radioButtonStyle = 0x7f0200d9; public static final int ratingBarStyle = 0x7f0200da; public static final int ratingBarStyleIndicator = 0x7f0200db; public static final int ratingBarStyleSmall = 0x7f0200dc; public static final int searchHintIcon = 0x7f0200dd; public static final int searchIcon = 0x7f0200de; public static final int searchViewStyle = 0x7f0200df; public static final int seekBarStyle = 0x7f0200e0; public static final int selectableItemBackground = 0x7f0200e1; public static final int selectableItemBackgroundBorderless = 0x7f0200e2; public static final int showAsAction = 0x7f0200e3; public static final int showDividers = 0x7f0200e4; public static final int showText = 0x7f0200e5; public static final int showTitle = 0x7f0200e6; public static final int singleChoiceItemLayout = 0x7f0200e7; public static final int spinBars = 0x7f0200e8; public static final int spinnerDropDownItemStyle = 0x7f0200e9; public static final int spinnerStyle = 0x7f0200ea; public static final int splitTrack = 0x7f0200eb; public static final int srcCompat = 0x7f0200ec; public static final int state_above_anchor = 0x7f0200ed; public static final int subMenuArrow = 0x7f0200ee; public static final int submitBackground = 0x7f0200ef; public static final int subtitle = 0x7f0200f0; public static final int subtitleTextAppearance = 0x7f0200f1; public static final int subtitleTextColor = 0x7f0200f2; public static final int subtitleTextStyle = 0x7f0200f3; public static final int suggestionRowLayout = 0x7f0200f4; public static final int switchMinWidth = 0x7f0200f5; public static final int switchPadding = 0x7f0200f6; public static final int switchStyle = 0x7f0200f7; public static final int switchTextAppearance = 0x7f0200f8; public static final int textAllCaps = 0x7f0200f9; public static final int textAppearanceLargePopupMenu = 0x7f0200fa; public static final int textAppearanceListItem = 0x7f0200fb; public static final int textAppearanceListItemSecondary = 0x7f0200fc; public static final int textAppearanceListItemSmall = 0x7f0200fd; public static final int textAppearancePopupMenuHeader = 0x7f0200fe; public static final int textAppearanceSearchResultSubtitle = 0x7f0200ff; public static final int textAppearanceSearchResultTitle = 0x7f020100; public static final int textAppearanceSmallPopupMenu = 0x7f020101; public static final int textColorAlertDialogListItem = 0x7f020102; public static final int textColorSearchUrl = 0x7f020103; public static final int theme = 0x7f020104; public static final int thickness = 0x7f020105; public static final int thumbTextPadding = 0x7f020106; public static final int thumbTint = 0x7f020107; public static final int thumbTintMode = 0x7f020108; public static final int tickMark = 0x7f020109; public static final int tickMarkTint = 0x7f02010a; public static final int tickMarkTintMode = 0x7f02010b; public static final int tint = 0x7f02010c; public static final int tintMode = 0x7f02010d; public static final int title = 0x7f02010e; public static final int titleMargin = 0x7f02010f; public static final int titleMarginBottom = 0x7f020110; public static final int titleMarginEnd = 0x7f020111; public static final int titleMarginStart = 0x7f020112; public static final int titleMarginTop = 0x7f020113; public static final int titleMargins = 0x7f020114; public static final int titleTextAppearance = 0x7f020115; public static final int titleTextColor = 0x7f020116; public static final int titleTextStyle = 0x7f020117; public static final int toolbarNavigationButtonStyle = 0x7f020118; public static final int toolbarStyle = 0x7f020119; public static final int tooltipForegroundColor = 0x7f02011a; public static final int tooltipFrameBackground = 0x7f02011b; public static final int tooltipText = 0x7f02011c; public static final int track = 0x7f02011d; public static final int trackTint = 0x7f02011e; public static final int trackTintMode = 0x7f02011f; public static final int voiceIcon = 0x7f020120; public static final int windowActionBar = 0x7f020121; public static final int windowActionBarOverlay = 0x7f020122; public static final int windowActionModeOverlay = 0x7f020123; public static final int windowFixedHeightMajor = 0x7f020124; public static final int windowFixedHeightMinor = 0x7f020125; public static final int windowFixedWidthMajor = 0x7f020126; public static final int windowFixedWidthMinor = 0x7f020127; public static final int windowMinWidthMajor = 0x7f020128; public static final int windowMinWidthMinor = 0x7f020129; public static final int windowNoTitle = 0x7f02012a; } public static final class bool { public static final int abc_action_bar_embed_tabs = 0x7f030000; public static final int abc_allow_stacked_button_bar = 0x7f030001; public static final int abc_config_actionMenuItemAllCaps = 0x7f030002; public static final int abc_config_closeDialogWhenTouchOutside = 0x7f030003; public static final int abc_config_showMenuShortcutsWhenKeyboardPresent = 0x7f030004; } public static final class color { public static final int abc_background_cache_hint_selector_material_dark = 0x7f040000; public static final int abc_background_cache_hint_selector_material_light = 0x7f040001; public static final int abc_btn_colored_borderless_text_material = 0x7f040002; public static final int abc_btn_colored_text_material = 0x7f040003; public static final int abc_color_highlight_material = 0x7f040004; public static final int abc_hint_foreground_material_dark = 0x7f040005; public static final int abc_hint_foreground_material_light = 0x7f040006; public static final int abc_input_method_navigation_guard = 0x7f040007; public static final int abc_primary_text_disable_only_material_dark = 0x7f040008; public static final int abc_primary_text_disable_only_material_light = 0x7f040009; public static final int abc_primary_text_material_dark = 0x7f04000a; public static final int abc_primary_text_material_light = 0x7f04000b; public static final int abc_search_url_text = 0x7f04000c; public static final int abc_search_url_text_normal = 0x7f04000d; public static final int abc_search_url_text_pressed = 0x7f04000e; public static final int abc_search_url_text_selected = 0x7f04000f; public static final int abc_secondary_text_material_dark = 0x7f040010; public static final int abc_secondary_text_material_light = 0x7f040011; public static final int abc_tint_btn_checkable = 0x7f040012; public static final int abc_tint_default = 0x7f040013; public static final int abc_tint_edittext = 0x7f040014; public static final int abc_tint_seek_thumb = 0x7f040015; public static final int abc_tint_spinner = 0x7f040016; public static final int abc_tint_switch_track = 0x7f040017; public static final int accent_material_dark = 0x7f040018; public static final int accent_material_light = 0x7f040019; public static final int background_floating_material_dark = 0x7f04001a; public static final int background_floating_material_light = 0x7f04001b; public static final int background_material_dark = 0x7f04001c; public static final int background_material_light = 0x7f04001d; public static final int bright_foreground_disabled_material_dark = 0x7f04001e; public static final int bright_foreground_disabled_material_light = 0x7f04001f; public static final int bright_foreground_inverse_material_dark = 0x7f040020; public static final int bright_foreground_inverse_material_light = 0x7f040021; public static final int bright_foreground_material_dark = 0x7f040022; public static final int bright_foreground_material_light = 0x7f040023; public static final int button_material_dark = 0x7f040024; public static final int button_material_light = 0x7f040025; public static final int dim_foreground_disabled_material_dark = 0x7f040029; public static final int dim_foreground_disabled_material_light = 0x7f04002a; public static final int dim_foreground_material_dark = 0x7f04002b; public static final int dim_foreground_material_light = 0x7f04002c; public static final int error_color_material = 0x7f04002d; public static final int foreground_material_dark = 0x7f04002e; public static final int foreground_material_light = 0x7f04002f; public static final int highlighted_text_material_dark = 0x7f040030; public static final int highlighted_text_material_light = 0x7f040031; public static final int material_blue_grey_800 = 0x7f040032; public static final int material_blue_grey_900 = 0x7f040033; public static final int material_blue_grey_950 = 0x7f040034; public static final int material_deep_teal_200 = 0x7f040035; public static final int material_deep_teal_500 = 0x7f040036; public static final int material_grey_100 = 0x7f040037; public static final int material_grey_300 = 0x7f040038; public static final int material_grey_50 = 0x7f040039; public static final int material_grey_600 = 0x7f04003a; public static final int material_grey_800 = 0x7f04003b; public static final int material_grey_850 = 0x7f04003c; public static final int material_grey_900 = 0x7f04003d; public static final int notification_action_color_filter = 0x7f04003e; public static final int notification_icon_bg_color = 0x7f04003f; public static final int notification_material_background_media_default_color = 0x7f040040; public static final int primary_dark_material_dark = 0x7f040041; public static final int primary_dark_material_light = 0x7f040042; public static final int primary_material_dark = 0x7f040043; public static final int primary_material_light = 0x7f040044; public static final int primary_text_default_material_dark = 0x7f040045; public static final int primary_text_default_material_light = 0x7f040046; public static final int primary_text_disabled_material_dark = 0x7f040047; public static final int primary_text_disabled_material_light = 0x7f040048; public static final int ripple_material_dark = 0x7f040049; public static final int ripple_material_light = 0x7f04004a; public static final int secondary_text_default_material_dark = 0x7f04004b; public static final int secondary_text_default_material_light = 0x7f04004c; public static final int secondary_text_disabled_material_dark = 0x7f04004d; public static final int secondary_text_disabled_material_light = 0x7f04004e; public static final int switch_thumb_disabled_material_dark = 0x7f04004f; public static final int switch_thumb_disabled_material_light = 0x7f040050; public static final int switch_thumb_material_dark = 0x7f040051; public static final int switch_thumb_material_light = 0x7f040052; public static final int switch_thumb_normal_material_dark = 0x7f040053; public static final int switch_thumb_normal_material_light = 0x7f040054; public static final int tooltip_background_dark = 0x7f040055; public static final int tooltip_background_light = 0x7f040056; } public static final class dimen { public static final int abc_action_bar_content_inset_material = 0x7f050000; public static final int abc_action_bar_content_inset_with_nav = 0x7f050001; public static final int abc_action_bar_default_height_material = 0x7f050002; public static final int abc_action_bar_default_padding_end_material = 0x7f050003; public static final int abc_action_bar_default_padding_start_material = 0x7f050004; public static final int abc_action_bar_elevation_material = 0x7f050005; public static final int abc_action_bar_icon_vertical_padding_material = 0x7f050006; public static final int abc_action_bar_overflow_padding_end_material = 0x7f050007; public static final int abc_action_bar_overflow_padding_start_material = 0x7f050008; public static final int abc_action_bar_progress_bar_size = 0x7f050009; public static final int abc_action_bar_stacked_max_height = 0x7f05000a; public static final int abc_action_bar_stacked_tab_max_width = 0x7f05000b; public static final int abc_action_bar_subtitle_bottom_margin_material = 0x7f05000c; public static final int abc_action_bar_subtitle_top_margin_material = 0x7f05000d; public static final int abc_action_button_min_height_material = 0x7f05000e; public static final int abc_action_button_min_width_material = 0x7f05000f; public static final int abc_action_button_min_width_overflow_material = 0x7f050010; public static final int abc_alert_dialog_button_bar_height = 0x7f050011; public static final int abc_button_inset_horizontal_material = 0x7f050012; public static final int abc_button_inset_vertical_material = 0x7f050013; public static final int abc_button_padding_horizontal_material = 0x7f050014; public static final int abc_button_padding_vertical_material = 0x7f050015; public static final int abc_cascading_menus_min_smallest_width = 0x7f050016; public static final int abc_config_prefDialogWidth = 0x7f050017; public static final int abc_control_corner_material = 0x7f050018; public static final int abc_control_inset_material = 0x7f050019; public static final int abc_control_padding_material = 0x7f05001a; public static final int abc_dialog_fixed_height_major = 0x7f05001b; public static final int abc_dialog_fixed_height_minor = 0x7f05001c; public static final int abc_dialog_fixed_width_major = 0x7f05001d; public static final int abc_dialog_fixed_width_minor = 0x7f05001e; public static final int abc_dialog_list_padding_bottom_no_buttons = 0x7f05001f; public static final int abc_dialog_list_padding_top_no_title = 0x7f050020; public static final int abc_dialog_min_width_major = 0x7f050021; public static final int abc_dialog_min_width_minor = 0x7f050022; public static final int abc_dialog_padding_material = 0x7f050023; public static final int abc_dialog_padding_top_material = 0x7f050024; public static final int abc_dialog_title_divider_material = 0x7f050025; public static final int abc_disabled_alpha_material_dark = 0x7f050026; public static final int abc_disabled_alpha_material_light = 0x7f050027; public static final int abc_dropdownitem_icon_width = 0x7f050028; public static final int abc_dropdownitem_text_padding_left = 0x7f050029; public static final int abc_dropdownitem_text_padding_right = 0x7f05002a; public static final int abc_edit_text_inset_bottom_material = 0x7f05002b; public static final int abc_edit_text_inset_horizontal_material = 0x7f05002c; public static final int abc_edit_text_inset_top_material = 0x7f05002d; public static final int abc_floating_window_z = 0x7f05002e; public static final int abc_list_item_padding_horizontal_material = 0x7f05002f; public static final int abc_panel_menu_list_width = 0x7f050030; public static final int abc_progress_bar_height_material = 0x7f050031; public static final int abc_search_view_preferred_height = 0x7f050032; public static final int abc_search_view_preferred_width = 0x7f050033; public static final int abc_seekbar_track_background_height_material = 0x7f050034; public static final int abc_seekbar_track_progress_height_material = 0x7f050035; public static final int abc_select_dialog_padding_start_material = 0x7f050036; public static final int abc_switch_padding = 0x7f050037; public static final int abc_text_size_body_1_material = 0x7f050038; public static final int abc_text_size_body_2_material = 0x7f050039; public static final int abc_text_size_button_material = 0x7f05003a; public static final int abc_text_size_caption_material = 0x7f05003b; public static final int abc_text_size_display_1_material = 0x7f05003c; public static final int abc_text_size_display_2_material = 0x7f05003d; public static final int abc_text_size_display_3_material = 0x7f05003e; public static final int abc_text_size_display_4_material = 0x7f05003f; public static final int abc_text_size_headline_material = 0x7f050040; public static final int abc_text_size_large_material = 0x7f050041; public static final int abc_text_size_medium_material = 0x7f050042; public static final int abc_text_size_menu_header_material = 0x7f050043; public static final int abc_text_size_menu_material = 0x7f050044; public static final int abc_text_size_small_material = 0x7f050045; public static final int abc_text_size_subhead_material = 0x7f050046; public static final int abc_text_size_subtitle_material_toolbar = 0x7f050047; public static final int abc_text_size_title_material = 0x7f050048; public static final int abc_text_size_title_material_toolbar = 0x7f050049; public static final int compat_button_inset_horizontal_material = 0x7f05004a; public static final int compat_button_inset_vertical_material = 0x7f05004b; public static final int compat_button_padding_horizontal_material = 0x7f05004c; public static final int compat_button_padding_vertical_material = 0x7f05004d; public static final int compat_control_corner_material = 0x7f05004e; public static final int disabled_alpha_material_dark = 0x7f05004f; public static final int disabled_alpha_material_light = 0x7f050050; public static final int highlight_alpha_material_colored = 0x7f050051; public static final int highlight_alpha_material_dark = 0x7f050052; public static final int highlight_alpha_material_light = 0x7f050053; public static final int hint_alpha_material_dark = 0x7f050054; public static final int hint_alpha_material_light = 0x7f050055; public static final int hint_pressed_alpha_material_dark = 0x7f050056; public static final int hint_pressed_alpha_material_light = 0x7f050057; public static final int notification_action_icon_size = 0x7f050058; public static final int notification_action_text_size = 0x7f050059; public static final int notification_big_circle_margin = 0x7f05005a; public static final int notification_content_margin_start = 0x7f05005b; public static final int notification_large_icon_height = 0x7f05005c; public static final int notification_large_icon_width = 0x7f05005d; public static final int notification_main_column_padding_top = 0x7f05005e; public static final int notification_media_narrow_margin = 0x7f05005f; public static final int notification_right_icon_size = 0x7f050060; public static final int notification_right_side_padding_top = 0x7f050061; public static final int notification_small_icon_background_padding = 0x7f050062; public static final int notification_small_icon_size_as_large = 0x7f050063; public static final int notification_subtext_size = 0x7f050064; public static final int notification_top_pad = 0x7f050065; public static final int notification_top_pad_large_text = 0x7f050066; public static final int tooltip_corner_radius = 0x7f050067; public static final int tooltip_horizontal_padding = 0x7f050068; public static final int tooltip_margin = 0x7f050069; public static final int tooltip_precise_anchor_extra_offset = 0x7f05006a; public static final int tooltip_precise_anchor_threshold = 0x7f05006b; public static final int tooltip_vertical_padding = 0x7f05006c; public static final int tooltip_y_offset_non_touch = 0x7f05006d; public static final int tooltip_y_offset_touch = 0x7f05006e; } public static final class drawable { public static final int abc_ab_share_pack_mtrl_alpha = 0x7f060001; public static final int abc_action_bar_item_background_material = 0x7f060002; public static final int abc_btn_borderless_material = 0x7f060003; public static final int abc_btn_check_material = 0x7f060004; public static final int abc_btn_check_to_on_mtrl_000 = 0x7f060005; public static final int abc_btn_check_to_on_mtrl_015 = 0x7f060006; public static final int abc_btn_colored_material = 0x7f060007; public static final int abc_btn_default_mtrl_shape = 0x7f060008; public static final int abc_btn_radio_material = 0x7f060009; public static final int abc_btn_radio_to_on_mtrl_000 = 0x7f06000a; public static final int abc_btn_radio_to_on_mtrl_015 = 0x7f06000b; public static final int abc_btn_switch_to_on_mtrl_00001 = 0x7f06000c; public static final int abc_btn_switch_to_on_mtrl_00012 = 0x7f06000d; public static final int abc_cab_background_internal_bg = 0x7f06000e; public static final int abc_cab_background_top_material = 0x7f06000f; public static final int abc_cab_background_top_mtrl_alpha = 0x7f060010; public static final int abc_control_background_material = 0x7f060011; public static final int abc_dialog_material_background = 0x7f060012; public static final int abc_edit_text_material = 0x7f060013; public static final int abc_ic_ab_back_material = 0x7f060014; public static final int abc_ic_arrow_drop_right_black_24dp = 0x7f060015; public static final int abc_ic_clear_material = 0x7f060016; public static final int abc_ic_commit_search_api_mtrl_alpha = 0x7f060017; public static final int abc_ic_go_search_api_material = 0x7f060018; public static final int abc_ic_menu_copy_mtrl_am_alpha = 0x7f060019; public static final int abc_ic_menu_cut_mtrl_alpha = 0x7f06001a; public static final int abc_ic_menu_overflow_material = 0x7f06001b; public static final int abc_ic_menu_paste_mtrl_am_alpha = 0x7f06001c; public static final int abc_ic_menu_selectall_mtrl_alpha = 0x7f06001d; public static final int abc_ic_menu_share_mtrl_alpha = 0x7f06001e; public static final int abc_ic_search_api_material = 0x7f06001f; public static final int abc_ic_star_black_16dp = 0x7f060020; public static final int abc_ic_star_black_36dp = 0x7f060021; public static final int abc_ic_star_black_48dp = 0x7f060022; public static final int abc_ic_star_half_black_16dp = 0x7f060023; public static final int abc_ic_star_half_black_36dp = 0x7f060024; public static final int abc_ic_star_half_black_48dp = 0x7f060025; public static final int abc_ic_voice_search_api_material = 0x7f060026; public static final int abc_item_background_holo_dark = 0x7f060027; public static final int abc_item_background_holo_light = 0x7f060028; public static final int abc_list_divider_mtrl_alpha = 0x7f060029; public static final int abc_list_focused_holo = 0x7f06002a; public static final int abc_list_longpressed_holo = 0x7f06002b; public static final int abc_list_pressed_holo_dark = 0x7f06002c; public static final int abc_list_pressed_holo_light = 0x7f06002d; public static final int abc_list_selector_background_transition_holo_dark = 0x7f06002e; public static final int abc_list_selector_background_transition_holo_light = 0x7f06002f; public static final int abc_list_selector_disabled_holo_dark = 0x7f060030; public static final int abc_list_selector_disabled_holo_light = 0x7f060031; public static final int abc_list_selector_holo_dark = 0x7f060032; public static final int abc_list_selector_holo_light = 0x7f060033; public static final int abc_menu_hardkey_panel_mtrl_mult = 0x7f060034; public static final int abc_popup_background_mtrl_mult = 0x7f060035; public static final int abc_ratingbar_indicator_material = 0x7f060036; public static final int abc_ratingbar_material = 0x7f060037; public static final int abc_ratingbar_small_material = 0x7f060038; public static final int abc_scrubber_control_off_mtrl_alpha = 0x7f060039; public static final int abc_scrubber_control_to_pressed_mtrl_000 = 0x7f06003a; public static final int abc_scrubber_control_to_pressed_mtrl_005 = 0x7f06003b; public static final int abc_scrubber_primary_mtrl_alpha = 0x7f06003c; public static final int abc_scrubber_track_mtrl_alpha = 0x7f06003d; public static final int abc_seekbar_thumb_material = 0x7f06003e; public static final int abc_seekbar_tick_mark_material = 0x7f06003f; public static final int abc_seekbar_track_material = 0x7f060040; public static final int abc_spinner_mtrl_am_alpha = 0x7f060041; public static final int abc_spinner_textfield_background_material = 0x7f060042; public static final int abc_switch_thumb_material = 0x7f060043; public static final int abc_switch_track_mtrl_alpha = 0x7f060044; public static final int abc_tab_indicator_material = 0x7f060045; public static final int abc_tab_indicator_mtrl_alpha = 0x7f060046; public static final int abc_text_cursor_material = 0x7f060047; public static final int abc_text_select_handle_left_mtrl_dark = 0x7f060048; public static final int abc_text_select_handle_left_mtrl_light = 0x7f060049; public static final int abc_text_select_handle_middle_mtrl_dark = 0x7f06004a; public static final int abc_text_select_handle_middle_mtrl_light = 0x7f06004b; public static final int abc_text_select_handle_right_mtrl_dark = 0x7f06004c; public static final int abc_text_select_handle_right_mtrl_light = 0x7f06004d; public static final int abc_textfield_activated_mtrl_alpha = 0x7f06004e; public static final int abc_textfield_default_mtrl_alpha = 0x7f06004f; public static final int abc_textfield_search_activated_mtrl_alpha = 0x7f060050; public static final int abc_textfield_search_default_mtrl_alpha = 0x7f060051; public static final int abc_textfield_search_material = 0x7f060052; public static final int abc_vector_test = 0x7f060053; public static final int notification_action_background = 0x7f060056; public static final int notification_bg = 0x7f060057; public static final int notification_bg_low = 0x7f060058; public static final int notification_bg_low_normal = 0x7f060059; public static final int notification_bg_low_pressed = 0x7f06005a; public static final int notification_bg_normal = 0x7f06005b; public static final int notification_bg_normal_pressed = 0x7f06005c; public static final int notification_icon_background = 0x7f06005d; public static final int notification_template_icon_bg = 0x7f06005e; public static final int notification_template_icon_low_bg = 0x7f06005f; public static final int notification_tile_bg = 0x7f060060; public static final int notify_panel_notification_icon_bg = 0x7f060061; public static final int tooltip_frame_dark = 0x7f060062; public static final int tooltip_frame_light = 0x7f060063; } public static final class id { public static final int action0 = 0x7f070006; public static final int action_bar = 0x7f070007; public static final int action_bar_activity_content = 0x7f070008; public static final int action_bar_container = 0x7f070009; public static final int action_bar_root = 0x7f07000a; public static final int action_bar_spinner = 0x7f07000b; public static final int action_bar_subtitle = 0x7f07000c; public static final int action_bar_title = 0x7f07000d; public static final int action_container = 0x7f07000e; public static final int action_context_bar = 0x7f07000f; public static final int action_divider = 0x7f070010; public static final int action_image = 0x7f070011; public static final int action_menu_divider = 0x7f070012; public static final int action_menu_presenter = 0x7f070013; public static final int action_mode_bar = 0x7f070014; public static final int action_mode_bar_stub = 0x7f070015; public static final int action_mode_close_button = 0x7f070016; public static final int action_text = 0x7f070017; public static final int actions = 0x7f070018; public static final int activity_chooser_view_content = 0x7f070019; public static final int add = 0x7f07001a; public static final int alertTitle = 0x7f07001b; public static final int async = 0x7f07001e; public static final int blocking = 0x7f070021; public static final int buttonPanel = 0x7f070024; public static final int cancel_action = 0x7f070025; public static final int checkbox = 0x7f070027; public static final int chronometer = 0x7f070028; public static final int contentPanel = 0x7f07002a; public static final int custom = 0x7f07002b; public static final int customPanel = 0x7f07002c; public static final int decor_content_parent = 0x7f07002d; public static final int default_activity_button = 0x7f07002e; public static final int edit_query = 0x7f070030; public static final int end_padder = 0x7f070032; public static final int expand_activities_button = 0x7f070033; public static final int expanded_menu = 0x7f070034; public static final int forever = 0x7f070035; public static final int home = 0x7f070036; public static final int icon = 0x7f070038; public static final int icon_group = 0x7f070039; public static final int image = 0x7f07003b; public static final int info = 0x7f07003c; public static final int italic = 0x7f07003d; public static final int line1 = 0x7f07003e; public static final int line3 = 0x7f07003f; public static final int listMode = 0x7f070040; public static final int list_item = 0x7f070041; public static final int media_actions = 0x7f070042; public static final int message = 0x7f070043; public static final int multiply = 0x7f070046; public static final int none = 0x7f070048; public static final int normal = 0x7f070049; public static final int notification_background = 0x7f07004a; public static final int notification_main_column = 0x7f07004b; public static final int notification_main_column_container = 0x7f07004c; public static final int parentPanel = 0x7f07004f; public static final int progress_circular = 0x7f070050; public static final int progress_horizontal = 0x7f070051; public static final int radio = 0x7f070052; public static final int right_icon = 0x7f070053; public static final int right_side = 0x7f070054; public static final int screen = 0x7f070055; public static final int scrollIndicatorDown = 0x7f070056; public static final int scrollIndicatorUp = 0x7f070057; public static final int scrollView = 0x7f070058; public static final int search_badge = 0x7f070059; public static final int search_bar = 0x7f07005a; public static final int search_button = 0x7f07005b; public static final int search_close_btn = 0x7f07005c; public static final int search_edit_frame = 0x7f07005d; public static final int search_go_btn = 0x7f07005e; public static final int search_mag_icon = 0x7f07005f; public static final int search_plate = 0x7f070060; public static final int search_src_text = 0x7f070061; public static final int search_voice_btn = 0x7f070062; public static final int select_dialog_listview = 0x7f070063; public static final int shortcut = 0x7f070064; public static final int spacer = 0x7f070068; public static final int split_action_bar = 0x7f070069; public static final int src_atop = 0x7f07006c; public static final int src_in = 0x7f07006d; public static final int src_over = 0x7f07006e; public static final int status_bar_latest_event_content = 0x7f07006f; public static final int submenuarrow = 0x7f070070; public static final int submit_area = 0x7f070071; public static final int tabMode = 0x7f070072; public static final int text = 0x7f070073; public static final int text2 = 0x7f070074; public static final int textSpacerNoButtons = 0x7f070075; public static final int textSpacerNoTitle = 0x7f070076; public static final int time = 0x7f070077; public static final int title = 0x7f070078; public static final int titleDividerNoCustom = 0x7f070079; public static final int title_template = 0x7f07007a; public static final int topPanel = 0x7f07007c; public static final int uniform = 0x7f07007d; public static final int up = 0x7f07007e; public static final int wrap_content = 0x7f070082; } public static final class integer { public static final int abc_config_activityDefaultDur = 0x7f080000; public static final int abc_config_activityShortDur = 0x7f080001; public static final int cancel_button_image_alpha = 0x7f080002; public static final int config_tooltipAnimTime = 0x7f080003; public static final int status_bar_notification_info_maxnum = 0x7f080004; } public static final class layout { public static final int abc_action_bar_title_item = 0x7f090000; public static final int abc_action_bar_up_container = 0x7f090001; public static final int abc_action_bar_view_list_nav_layout = 0x7f090002; public static final int abc_action_menu_item_layout = 0x7f090003; public static final int abc_action_menu_layout = 0x7f090004; public static final int abc_action_mode_bar = 0x7f090005; public static final int abc_action_mode_close_item_material = 0x7f090006; public static final int abc_activity_chooser_view = 0x7f090007; public static final int abc_activity_chooser_view_list_item = 0x7f090008; public static final int abc_alert_dialog_button_bar_material = 0x7f090009; public static final int abc_alert_dialog_material = 0x7f09000a; public static final int abc_alert_dialog_title_material = 0x7f09000b; public static final int abc_dialog_title_material = 0x7f09000c; public static final int abc_expanded_menu_layout = 0x7f09000d; public static final int abc_list_menu_item_checkbox = 0x7f09000e; public static final int abc_list_menu_item_icon = 0x7f09000f; public static final int abc_list_menu_item_layout = 0x7f090010; public static final int abc_list_menu_item_radio = 0x7f090011; public static final int abc_popup_menu_header_item_layout = 0x7f090012; public static final int abc_popup_menu_item_layout = 0x7f090013; public static final int abc_screen_content_include = 0x7f090014; public static final int abc_screen_simple = 0x7f090015; public static final int abc_screen_simple_overlay_action_mode = 0x7f090016; public static final int abc_screen_toolbar = 0x7f090017; public static final int abc_search_dropdown_item_icons_2line = 0x7f090018; public static final int abc_search_view = 0x7f090019; public static final int abc_select_dialog_material = 0x7f09001a; public static final int notification_action = 0x7f09001c; public static final int notification_action_tombstone = 0x7f09001d; public static final int notification_media_action = 0x7f09001e; public static final int notification_media_cancel_action = 0x7f09001f; public static final int notification_template_big_media = 0x7f090020; public static final int notification_template_big_media_custom = 0x7f090021; public static final int notification_template_big_media_narrow = 0x7f090022; public static final int notification_template_big_media_narrow_custom = 0x7f090023; public static final int notification_template_custom_big = 0x7f090024; public static final int notification_template_icon_group = 0x7f090025; public static final int notification_template_lines_media = 0x7f090026; public static final int notification_template_media = 0x7f090027; public static final int notification_template_media_custom = 0x7f090028; public static final int notification_template_part_chronometer = 0x7f090029; public static final int notification_template_part_time = 0x7f09002a; public static final int select_dialog_item_material = 0x7f09002b; public static final int select_dialog_multichoice_material = 0x7f09002c; public static final int select_dialog_singlechoice_material = 0x7f09002d; public static final int support_simple_spinner_dropdown_item = 0x7f09002e; public static final int tooltip = 0x7f09002f; } public static final class string { public static final int abc_action_bar_home_description = 0x7f0b0000; public static final int abc_action_bar_home_description_format = 0x7f0b0001; public static final int abc_action_bar_home_subtitle_description_format = 0x7f0b0002; public static final int abc_action_bar_up_description = 0x7f0b0003; public static final int abc_action_menu_overflow_description = 0x7f0b0004; public static final int abc_action_mode_done = 0x7f0b0005; public static final int abc_activity_chooser_view_see_all = 0x7f0b0006; public static final int abc_activitychooserview_choose_application = 0x7f0b0007; public static final int abc_capital_off = 0x7f0b0008; public static final int abc_capital_on = 0x7f0b0009; public static final int abc_font_family_body_1_material = 0x7f0b000a; public static final int abc_font_family_body_2_material = 0x7f0b000b; public static final int abc_font_family_button_material = 0x7f0b000c; public static final int abc_font_family_caption_material = 0x7f0b000d; public static final int abc_font_family_display_1_material = 0x7f0b000e; public static final int abc_font_family_display_2_material = 0x7f0b000f; public static final int abc_font_family_display_3_material = 0x7f0b0010; public static final int abc_font_family_display_4_material = 0x7f0b0011; public static final int abc_font_family_headline_material = 0x7f0b0012; public static final int abc_font_family_menu_material = 0x7f0b0013; public static final int abc_font_family_subhead_material = 0x7f0b0014; public static final int abc_font_family_title_material = 0x7f0b0015; public static final int abc_search_hint = 0x7f0b0016; public static final int abc_searchview_description_clear = 0x7f0b0017; public static final int abc_searchview_description_query = 0x7f0b0018; public static final int abc_searchview_description_search = 0x7f0b0019; public static final int abc_searchview_description_submit = 0x7f0b001a; public static final int abc_searchview_description_voice = 0x7f0b001b; public static final int abc_shareactionprovider_share_with = 0x7f0b001c; public static final int abc_shareactionprovider_share_with_application = 0x7f0b001d; public static final int abc_toolbar_collapse_description = 0x7f0b001e; public static final int search_menu_title = 0x7f0b0023; public static final int status_bar_notification_info_overflow = 0x7f0b0024; } public static final class style { public static final int AlertDialog_AppCompat = 0x7f0c0000; public static final int AlertDialog_AppCompat_Light = 0x7f0c0001; public static final int Animation_AppCompat_Dialog = 0x7f0c0002; public static final int Animation_AppCompat_DropDownUp = 0x7f0c0003; public static final int Animation_AppCompat_Tooltip = 0x7f0c0004; public static final int Base_AlertDialog_AppCompat = 0x7f0c0006; public static final int Base_AlertDialog_AppCompat_Light = 0x7f0c0007; public static final int Base_Animation_AppCompat_Dialog = 0x7f0c0008; public static final int Base_Animation_AppCompat_DropDownUp = 0x7f0c0009; public static final int Base_Animation_AppCompat_Tooltip = 0x7f0c000a; public static final int Base_DialogWindowTitleBackground_AppCompat = 0x7f0c000c; public static final int Base_DialogWindowTitle_AppCompat = 0x7f0c000b; public static final int Base_TextAppearance_AppCompat = 0x7f0c000d; public static final int Base_TextAppearance_AppCompat_Body1 = 0x7f0c000e; public static final int Base_TextAppearance_AppCompat_Body2 = 0x7f0c000f; public static final int Base_TextAppearance_AppCompat_Button = 0x7f0c0010; public static final int Base_TextAppearance_AppCompat_Caption = 0x7f0c0011; public static final int Base_TextAppearance_AppCompat_Display1 = 0x7f0c0012; public static final int Base_TextAppearance_AppCompat_Display2 = 0x7f0c0013; public static final int Base_TextAppearance_AppCompat_Display3 = 0x7f0c0014; public static final int Base_TextAppearance_AppCompat_Display4 = 0x7f0c0015; public static final int Base_TextAppearance_AppCompat_Headline = 0x7f0c0016; public static final int Base_TextAppearance_AppCompat_Inverse = 0x7f0c0017; public static final int Base_TextAppearance_AppCompat_Large = 0x7f0c0018; public static final int Base_TextAppearance_AppCompat_Large_Inverse = 0x7f0c0019; public static final int Base_TextAppearance_AppCompat_Light_Widget_PopupMenu_Large = 0x7f0c001a; public static final int Base_TextAppearance_AppCompat_Light_Widget_PopupMenu_Small = 0x7f0c001b; public static final int Base_TextAppearance_AppCompat_Medium = 0x7f0c001c; public static final int Base_TextAppearance_AppCompat_Medium_Inverse = 0x7f0c001d; public static final int Base_TextAppearance_AppCompat_Menu = 0x7f0c001e; public static final int Base_TextAppearance_AppCompat_SearchResult = 0x7f0c001f; public static final int Base_TextAppearance_AppCompat_SearchResult_Subtitle = 0x7f0c0020; public static final int Base_TextAppearance_AppCompat_SearchResult_Title = 0x7f0c0021; public static final int Base_TextAppearance_AppCompat_Small = 0x7f0c0022; public static final int Base_TextAppearance_AppCompat_Small_Inverse = 0x7f0c0023; public static final int Base_TextAppearance_AppCompat_Subhead = 0x7f0c0024; public static final int Base_TextAppearance_AppCompat_Subhead_Inverse = 0x7f0c0025; public static final int Base_TextAppearance_AppCompat_Title = 0x7f0c0026; public static final int Base_TextAppearance_AppCompat_Title_Inverse = 0x7f0c0027; public static final int Base_TextAppearance_AppCompat_Tooltip = 0x7f0c0028; public static final int Base_TextAppearance_AppCompat_Widget_ActionBar_Menu = 0x7f0c0029; public static final int Base_TextAppearance_AppCompat_Widget_ActionBar_Subtitle = 0x7f0c002a; public static final int Base_TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse = 0x7f0c002b; public static final int Base_TextAppearance_AppCompat_Widget_ActionBar_Title = 0x7f0c002c; public static final int Base_TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse = 0x7f0c002d; public static final int Base_TextAppearance_AppCompat_Widget_ActionMode_Subtitle = 0x7f0c002e; public static final int Base_TextAppearance_AppCompat_Widget_ActionMode_Title = 0x7f0c002f; public static final int Base_TextAppearance_AppCompat_Widget_Button = 0x7f0c0030; public static final int Base_TextAppearance_AppCompat_Widget_Button_Borderless_Colored = 0x7f0c0031; public static final int Base_TextAppearance_AppCompat_Widget_Button_Colored = 0x7f0c0032; public static final int Base_TextAppearance_AppCompat_Widget_Button_Inverse = 0x7f0c0033; public static final int Base_TextAppearance_AppCompat_Widget_DropDownItem = 0x7f0c0034; public static final int Base_TextAppearance_AppCompat_Widget_PopupMenu_Header = 0x7f0c0035; public static final int Base_TextAppearance_AppCompat_Widget_PopupMenu_Large = 0x7f0c0036; public static final int Base_TextAppearance_AppCompat_Widget_PopupMenu_Small = 0x7f0c0037; public static final int Base_TextAppearance_AppCompat_Widget_Switch = 0x7f0c0038; public static final int Base_TextAppearance_AppCompat_Widget_TextView_SpinnerItem = 0x7f0c0039; public static final int Base_TextAppearance_Widget_AppCompat_ExpandedMenu_Item = 0x7f0c003a; public static final int Base_TextAppearance_Widget_AppCompat_Toolbar_Subtitle = 0x7f0c003b; public static final int Base_TextAppearance_Widget_AppCompat_Toolbar_Title = 0x7f0c003c; public static final int Base_ThemeOverlay_AppCompat = 0x7f0c004b; public static final int Base_ThemeOverlay_AppCompat_ActionBar = 0x7f0c004c; public static final int Base_ThemeOverlay_AppCompat_Dark = 0x7f0c004d; public static final int Base_ThemeOverlay_AppCompat_Dark_ActionBar = 0x7f0c004e; public static final int Base_ThemeOverlay_AppCompat_Dialog = 0x7f0c004f; public static final int Base_ThemeOverlay_AppCompat_Dialog_Alert = 0x7f0c0050; public static final int Base_ThemeOverlay_AppCompat_Light = 0x7f0c0051; public static final int Base_Theme_AppCompat = 0x7f0c003d; public static final int Base_Theme_AppCompat_CompactMenu = 0x7f0c003e; public static final int Base_Theme_AppCompat_Dialog = 0x7f0c003f; public static final int Base_Theme_AppCompat_DialogWhenLarge = 0x7f0c0043; public static final int Base_Theme_AppCompat_Dialog_Alert = 0x7f0c0040; public static final int Base_Theme_AppCompat_Dialog_FixedSize = 0x7f0c0041; public static final int Base_Theme_AppCompat_Dialog_MinWidth = 0x7f0c0042; public static final int Base_Theme_AppCompat_Light = 0x7f0c0044; public static final int Base_Theme_AppCompat_Light_DarkActionBar = 0x7f0c0045; public static final int Base_Theme_AppCompat_Light_Dialog = 0x7f0c0046; public static final int Base_Theme_AppCompat_Light_DialogWhenLarge = 0x7f0c004a; public static final int Base_Theme_AppCompat_Light_Dialog_Alert = 0x7f0c0047; public static final int Base_Theme_AppCompat_Light_Dialog_FixedSize = 0x7f0c0048; public static final int Base_Theme_AppCompat_Light_Dialog_MinWidth = 0x7f0c0049; public static final int Base_V11_ThemeOverlay_AppCompat_Dialog = 0x7f0c0054; public static final int Base_V11_Theme_AppCompat_Dialog = 0x7f0c0052; public static final int Base_V11_Theme_AppCompat_Light_Dialog = 0x7f0c0053; public static final int Base_V12_Widget_AppCompat_AutoCompleteTextView = 0x7f0c0055; public static final int Base_V12_Widget_AppCompat_EditText = 0x7f0c0056; public static final int Base_V21_ThemeOverlay_AppCompat_Dialog = 0x7f0c005b; public static final int Base_V21_Theme_AppCompat = 0x7f0c0057; public static final int Base_V21_Theme_AppCompat_Dialog = 0x7f0c0058; public static final int Base_V21_Theme_AppCompat_Light = 0x7f0c0059; public static final int Base_V21_Theme_AppCompat_Light_Dialog = 0x7f0c005a; public static final int Base_V22_Theme_AppCompat = 0x7f0c005c; public static final int Base_V22_Theme_AppCompat_Light = 0x7f0c005d; public static final int Base_V23_Theme_AppCompat = 0x7f0c005e; public static final int Base_V23_Theme_AppCompat_Light = 0x7f0c005f; public static final int Base_V26_Theme_AppCompat = 0x7f0c0060; public static final int Base_V26_Theme_AppCompat_Light = 0x7f0c0061; public static final int Base_V26_Widget_AppCompat_Toolbar = 0x7f0c0062; public static final int Base_V7_ThemeOverlay_AppCompat_Dialog = 0x7f0c0067; public static final int Base_V7_Theme_AppCompat = 0x7f0c0063; public static final int Base_V7_Theme_AppCompat_Dialog = 0x7f0c0064; public static final int Base_V7_Theme_AppCompat_Light = 0x7f0c0065; public static final int Base_V7_Theme_AppCompat_Light_Dialog = 0x7f0c0066; public static final int Base_V7_Widget_AppCompat_AutoCompleteTextView = 0x7f0c0068; public static final int Base_V7_Widget_AppCompat_EditText = 0x7f0c0069; public static final int Base_V7_Widget_AppCompat_Toolbar = 0x7f0c006a; public static final int Base_Widget_AppCompat_ActionBar = 0x7f0c006b; public static final int Base_Widget_AppCompat_ActionBar_Solid = 0x7f0c006c; public static final int Base_Widget_AppCompat_ActionBar_TabBar = 0x7f0c006d; public static final int Base_Widget_AppCompat_ActionBar_TabText = 0x7f0c006e; public static final int Base_Widget_AppCompat_ActionBar_TabView = 0x7f0c006f; public static final int Base_Widget_AppCompat_ActionButton = 0x7f0c0070; public static final int Base_Widget_AppCompat_ActionButton_CloseMode = 0x7f0c0071; public static final int Base_Widget_AppCompat_ActionButton_Overflow = 0x7f0c0072; public static final int Base_Widget_AppCompat_ActionMode = 0x7f0c0073; public static final int Base_Widget_AppCompat_ActivityChooserView = 0x7f0c0074; public static final int Base_Widget_AppCompat_AutoCompleteTextView = 0x7f0c0075; public static final int Base_Widget_AppCompat_Button = 0x7f0c0076; public static final int Base_Widget_AppCompat_ButtonBar = 0x7f0c007c; public static final int Base_Widget_AppCompat_ButtonBar_AlertDialog = 0x7f0c007d; public static final int Base_Widget_AppCompat_Button_Borderless = 0x7f0c0077; public static final int Base_Widget_AppCompat_Button_Borderless_Colored = 0x7f0c0078; public static final int Base_Widget_AppCompat_Button_ButtonBar_AlertDialog = 0x7f0c0079; public static final int Base_Widget_AppCompat_Button_Colored = 0x7f0c007a; public static final int Base_Widget_AppCompat_Button_Small = 0x7f0c007b; public static final int Base_Widget_AppCompat_CompoundButton_CheckBox = 0x7f0c007e; public static final int Base_Widget_AppCompat_CompoundButton_RadioButton = 0x7f0c007f; public static final int Base_Widget_AppCompat_CompoundButton_Switch = 0x7f0c0080; public static final int Base_Widget_AppCompat_DrawerArrowToggle = 0x7f0c0081; public static final int Base_Widget_AppCompat_DrawerArrowToggle_Common = 0x7f0c0082; public static final int Base_Widget_AppCompat_DropDownItem_Spinner = 0x7f0c0083; public static final int Base_Widget_AppCompat_EditText = 0x7f0c0084; public static final int Base_Widget_AppCompat_ImageButton = 0x7f0c0085; public static final int Base_Widget_AppCompat_Light_ActionBar = 0x7f0c0086; public static final int Base_Widget_AppCompat_Light_ActionBar_Solid = 0x7f0c0087; public static final int Base_Widget_AppCompat_Light_ActionBar_TabBar = 0x7f0c0088; public static final int Base_Widget_AppCompat_Light_ActionBar_TabText = 0x7f0c0089; public static final int Base_Widget_AppCompat_Light_ActionBar_TabText_Inverse = 0x7f0c008a; public static final int Base_Widget_AppCompat_Light_ActionBar_TabView = 0x7f0c008b; public static final int Base_Widget_AppCompat_Light_PopupMenu = 0x7f0c008c; public static final int Base_Widget_AppCompat_Light_PopupMenu_Overflow = 0x7f0c008d; public static final int Base_Widget_AppCompat_ListMenuView = 0x7f0c008e; public static final int Base_Widget_AppCompat_ListPopupWindow = 0x7f0c008f; public static final int Base_Widget_AppCompat_ListView = 0x7f0c0090; public static final int Base_Widget_AppCompat_ListView_DropDown = 0x7f0c0091; public static final int Base_Widget_AppCompat_ListView_Menu = 0x7f0c0092; public static final int Base_Widget_AppCompat_PopupMenu = 0x7f0c0093; public static final int Base_Widget_AppCompat_PopupMenu_Overflow = 0x7f0c0094; public static final int Base_Widget_AppCompat_PopupWindow = 0x7f0c0095; public static final int Base_Widget_AppCompat_ProgressBar = 0x7f0c0096; public static final int Base_Widget_AppCompat_ProgressBar_Horizontal = 0x7f0c0097; public static final int Base_Widget_AppCompat_RatingBar = 0x7f0c0098; public static final int Base_Widget_AppCompat_RatingBar_Indicator = 0x7f0c0099; public static final int Base_Widget_AppCompat_RatingBar_Small = 0x7f0c009a; public static final int Base_Widget_AppCompat_SearchView = 0x7f0c009b; public static final int Base_Widget_AppCompat_SearchView_ActionBar = 0x7f0c009c; public static final int Base_Widget_AppCompat_SeekBar = 0x7f0c009d; public static final int Base_Widget_AppCompat_SeekBar_Discrete = 0x7f0c009e; public static final int Base_Widget_AppCompat_Spinner = 0x7f0c009f; public static final int Base_Widget_AppCompat_Spinner_Underlined = 0x7f0c00a0; public static final int Base_Widget_AppCompat_TextView_SpinnerItem = 0x7f0c00a1; public static final int Base_Widget_AppCompat_Toolbar = 0x7f0c00a2; public static final int Base_Widget_AppCompat_Toolbar_Button_Navigation = 0x7f0c00a3; public static final int Platform_AppCompat = 0x7f0c00a4; public static final int Platform_AppCompat_Light = 0x7f0c00a5; public static final int Platform_ThemeOverlay_AppCompat = 0x7f0c00a6; public static final int Platform_ThemeOverlay_AppCompat_Dark = 0x7f0c00a7; public static final int Platform_ThemeOverlay_AppCompat_Light = 0x7f0c00a8; public static final int Platform_V11_AppCompat = 0x7f0c00a9; public static final int Platform_V11_AppCompat_Light = 0x7f0c00aa; public static final int Platform_V14_AppCompat = 0x7f0c00ab; public static final int Platform_V14_AppCompat_Light = 0x7f0c00ac; public static final int Platform_V21_AppCompat = 0x7f0c00ad; public static final int Platform_V21_AppCompat_Light = 0x7f0c00ae; public static final int Platform_V25_AppCompat = 0x7f0c00af; public static final int Platform_V25_AppCompat_Light = 0x7f0c00b0; public static final int Platform_Widget_AppCompat_Spinner = 0x7f0c00b1; public static final int RtlOverlay_DialogWindowTitle_AppCompat = 0x7f0c00b2; public static final int RtlOverlay_Widget_AppCompat_ActionBar_TitleItem = 0x7f0c00b3; public static final int RtlOverlay_Widget_AppCompat_DialogTitle_Icon = 0x7f0c00b4; public static final int RtlOverlay_Widget_AppCompat_PopupMenuItem = 0x7f0c00b5; public static final int RtlOverlay_Widget_AppCompat_PopupMenuItem_InternalGroup = 0x7f0c00b6; public static final int RtlOverlay_Widget_AppCompat_PopupMenuItem_Text = 0x7f0c00b7; public static final int RtlOverlay_Widget_AppCompat_SearchView_MagIcon = 0x7f0c00bd; public static final int RtlOverlay_Widget_AppCompat_Search_DropDown = 0x7f0c00b8; public static final int RtlOverlay_Widget_AppCompat_Search_DropDown_Icon1 = 0x7f0c00b9; public static final int RtlOverlay_Widget_AppCompat_Search_DropDown_Icon2 = 0x7f0c00ba; public static final int RtlOverlay_Widget_AppCompat_Search_DropDown_Query = 0x7f0c00bb; public static final int RtlOverlay_Widget_AppCompat_Search_DropDown_Text = 0x7f0c00bc; public static final int RtlUnderlay_Widget_AppCompat_ActionButton = 0x7f0c00be; public static final int RtlUnderlay_Widget_AppCompat_ActionButton_Overflow = 0x7f0c00bf; public static final int TextAppearance_AppCompat = 0x7f0c00c0; public static final int TextAppearance_AppCompat_Body1 = 0x7f0c00c1; public static final int TextAppearance_AppCompat_Body2 = 0x7f0c00c2; public static final int TextAppearance_AppCompat_Button = 0x7f0c00c3; public static final int TextAppearance_AppCompat_Caption = 0x7f0c00c4; public static final int TextAppearance_AppCompat_Display1 = 0x7f0c00c5; public static final int TextAppearance_AppCompat_Display2 = 0x7f0c00c6; public static final int TextAppearance_AppCompat_Display3 = 0x7f0c00c7; public static final int TextAppearance_AppCompat_Display4 = 0x7f0c00c8; public static final int TextAppearance_AppCompat_Headline = 0x7f0c00c9; public static final int TextAppearance_AppCompat_Inverse = 0x7f0c00ca; public static final int TextAppearance_AppCompat_Large = 0x7f0c00cb; public static final int TextAppearance_AppCompat_Large_Inverse = 0x7f0c00cc; public static final int TextAppearance_AppCompat_Light_SearchResult_Subtitle = 0x7f0c00cd; public static final int TextAppearance_AppCompat_Light_SearchResult_Title = 0x7f0c00ce; public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Large = 0x7f0c00cf; public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Small = 0x7f0c00d0; public static final int TextAppearance_AppCompat_Medium = 0x7f0c00d1; public static final int TextAppearance_AppCompat_Medium_Inverse = 0x7f0c00d2; public static final int TextAppearance_AppCompat_Menu = 0x7f0c00d3; public static final int TextAppearance_AppCompat_Notification = 0x7f0c00d4; public static final int TextAppearance_AppCompat_Notification_Info = 0x7f0c00d5; public static final int TextAppearance_AppCompat_Notification_Info_Media = 0x7f0c00d6; public static final int TextAppearance_AppCompat_Notification_Line2 = 0x7f0c00d7; public static final int TextAppearance_AppCompat_Notification_Line2_Media = 0x7f0c00d8; public static final int TextAppearance_AppCompat_Notification_Media = 0x7f0c00d9; public static final int TextAppearance_AppCompat_Notification_Time = 0x7f0c00da; public static final int TextAppearance_AppCompat_Notification_Time_Media = 0x7f0c00db; public static final int TextAppearance_AppCompat_Notification_Title = 0x7f0c00dc; public static final int TextAppearance_AppCompat_Notification_Title_Media = 0x7f0c00dd; public static final int TextAppearance_AppCompat_SearchResult_Subtitle = 0x7f0c00de; public static final int TextAppearance_AppCompat_SearchResult_Title = 0x7f0c00df; public static final int TextAppearance_AppCompat_Small = 0x7f0c00e0; public static final int TextAppearance_AppCompat_Small_Inverse = 0x7f0c00e1; public static final int TextAppearance_AppCompat_Subhead = 0x7f0c00e2; public static final int TextAppearance_AppCompat_Subhead_Inverse = 0x7f0c00e3; public static final int TextAppearance_AppCompat_Title = 0x7f0c00e4; public static final int TextAppearance_AppCompat_Title_Inverse = 0x7f0c00e5; public static final int TextAppearance_AppCompat_Tooltip = 0x7f0c00e6; public static final int TextAppearance_AppCompat_Widget_ActionBar_Menu = 0x7f0c00e7; public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle = 0x7f0c00e8; public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse = 0x7f0c00e9; public static final int TextAppearance_AppCompat_Widget_ActionBar_Title = 0x7f0c00ea; public static final int TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse = 0x7f0c00eb; public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle = 0x7f0c00ec; public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle_Inverse = 0x7f0c00ed; public static final int TextAppearance_AppCompat_Widget_ActionMode_Title = 0x7f0c00ee; public static final int TextAppearance_AppCompat_Widget_ActionMode_Title_Inverse = 0x7f0c00ef; public static final int TextAppearance_AppCompat_Widget_Button = 0x7f0c00f0; public static final int TextAppearance_AppCompat_Widget_Button_Borderless_Colored = 0x7f0c00f1; public static final int TextAppearance_AppCompat_Widget_Button_Colored = 0x7f0c00f2; public static final int TextAppearance_AppCompat_Widget_Button_Inverse = 0x7f0c00f3; public static final int TextAppearance_AppCompat_Widget_DropDownItem = 0x7f0c00f4; public static final int TextAppearance_AppCompat_Widget_PopupMenu_Header = 0x7f0c00f5; public static final int TextAppearance_AppCompat_Widget_PopupMenu_Large = 0x7f0c00f6; public static final int TextAppearance_AppCompat_Widget_PopupMenu_Small = 0x7f0c00f7; public static final int TextAppearance_AppCompat_Widget_Switch = 0x7f0c00f8; public static final int TextAppearance_AppCompat_Widget_TextView_SpinnerItem = 0x7f0c00f9; public static final int TextAppearance_Compat_Notification = 0x7f0c00fa; public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00fb; public static final int TextAppearance_Compat_Notification_Info_Media = 0x7f0c00fc; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00fd; public static final int TextAppearance_Compat_Notification_Line2_Media = 0x7f0c00fe; public static final int TextAppearance_Compat_Notification_Media = 0x7f0c00ff; public static final int TextAppearance_Compat_Notification_Time = 0x7f0c0100; public static final int TextAppearance_Compat_Notification_Time_Media = 0x7f0c0101; public static final int TextAppearance_Compat_Notification_Title = 0x7f0c0102; public static final int TextAppearance_Compat_Notification_Title_Media = 0x7f0c0103; public static final int TextAppearance_Widget_AppCompat_ExpandedMenu_Item = 0x7f0c0104; public static final int TextAppearance_Widget_AppCompat_Toolbar_Subtitle = 0x7f0c0105; public static final int TextAppearance_Widget_AppCompat_Toolbar_Title = 0x7f0c0106; public static final int ThemeOverlay_AppCompat = 0x7f0c011c; public static final int ThemeOverlay_AppCompat_ActionBar = 0x7f0c011d; public static final int ThemeOverlay_AppCompat_Dark = 0x7f0c011e; public static final int ThemeOverlay_AppCompat_Dark_ActionBar = 0x7f0c011f; public static final int ThemeOverlay_AppCompat_Dialog = 0x7f0c0120; public static final int ThemeOverlay_AppCompat_Dialog_Alert = 0x7f0c0121; public static final int ThemeOverlay_AppCompat_Light = 0x7f0c0122; public static final int Theme_AppCompat = 0x7f0c0107; public static final int Theme_AppCompat_CompactMenu = 0x7f0c0108; public static final int Theme_AppCompat_DayNight = 0x7f0c0109; public static final int Theme_AppCompat_DayNight_DarkActionBar = 0x7f0c010a; public static final int Theme_AppCompat_DayNight_Dialog = 0x7f0c010b; public static final int Theme_AppCompat_DayNight_DialogWhenLarge = 0x7f0c010e; public static final int Theme_AppCompat_DayNight_Dialog_Alert = 0x7f0c010c; public static final int Theme_AppCompat_DayNight_Dialog_MinWidth = 0x7f0c010d; public static final int Theme_AppCompat_DayNight_NoActionBar = 0x7f0c010f; public static final int Theme_AppCompat_Dialog = 0x7f0c0110; public static final int Theme_AppCompat_DialogWhenLarge = 0x7f0c0113; public static final int Theme_AppCompat_Dialog_Alert = 0x7f0c0111; public static final int Theme_AppCompat_Dialog_MinWidth = 0x7f0c0112; public static final int Theme_AppCompat_Light = 0x7f0c0114; public static final int Theme_AppCompat_Light_DarkActionBar = 0x7f0c0115; public static final int Theme_AppCompat_Light_Dialog = 0x7f0c0116; public static final int Theme_AppCompat_Light_DialogWhenLarge = 0x7f0c0119; public static final int Theme_AppCompat_Light_Dialog_Alert = 0x7f0c0117; public static final int Theme_AppCompat_Light_Dialog_MinWidth = 0x7f0c0118; public static final int Theme_AppCompat_Light_NoActionBar = 0x7f0c011a; public static final int Theme_AppCompat_NoActionBar = 0x7f0c011b; public static final int Widget_AppCompat_ActionBar = 0x7f0c0123; public static final int Widget_AppCompat_ActionBar_Solid = 0x7f0c0124; public static final int Widget_AppCompat_ActionBar_TabBar = 0x7f0c0125; public static final int Widget_AppCompat_ActionBar_TabText = 0x7f0c0126; public static final int Widget_AppCompat_ActionBar_TabView = 0x7f0c0127; public static final int Widget_AppCompat_ActionButton = 0x7f0c0128; public static final int Widget_AppCompat_ActionButton_CloseMode = 0x7f0c0129; public static final int Widget_AppCompat_ActionButton_Overflow = 0x7f0c012a; public static final int Widget_AppCompat_ActionMode = 0x7f0c012b; public static final int Widget_AppCompat_ActivityChooserView = 0x7f0c012c; public static final int Widget_AppCompat_AutoCompleteTextView = 0x7f0c012d; public static final int Widget_AppCompat_Button = 0x7f0c012e; public static final int Widget_AppCompat_ButtonBar = 0x7f0c0134; public static final int Widget_AppCompat_ButtonBar_AlertDialog = 0x7f0c0135; public static final int Widget_AppCompat_Button_Borderless = 0x7f0c012f; public static final int Widget_AppCompat_Button_Borderless_Colored = 0x7f0c0130; public static final int Widget_AppCompat_Button_ButtonBar_AlertDialog = 0x7f0c0131; public static final int Widget_AppCompat_Button_Colored = 0x7f0c0132; public static final int Widget_AppCompat_Button_Small = 0x7f0c0133; public static final int Widget_AppCompat_CompoundButton_CheckBox = 0x7f0c0136; public static final int Widget_AppCompat_CompoundButton_RadioButton = 0x7f0c0137; public static final int Widget_AppCompat_CompoundButton_Switch = 0x7f0c0138; public static final int Widget_AppCompat_DrawerArrowToggle = 0x7f0c0139; public static final int Widget_AppCompat_DropDownItem_Spinner = 0x7f0c013a; public static final int Widget_AppCompat_EditText = 0x7f0c013b; public static final int Widget_AppCompat_ImageButton = 0x7f0c013c; public static final int Widget_AppCompat_Light_ActionBar = 0x7f0c013d; public static final int Widget_AppCompat_Light_ActionBar_Solid = 0x7f0c013e; public static final int Widget_AppCompat_Light_ActionBar_Solid_Inverse = 0x7f0c013f; public static final int Widget_AppCompat_Light_ActionBar_TabBar = 0x7f0c0140; public static final int Widget_AppCompat_Light_ActionBar_TabBar_Inverse = 0x7f0c0141; public static final int Widget_AppCompat_Light_ActionBar_TabText = 0x7f0c0142; public static final int Widget_AppCompat_Light_ActionBar_TabText_Inverse = 0x7f0c0143; public static final int Widget_AppCompat_Light_ActionBar_TabView = 0x7f0c0144; public static final int Widget_AppCompat_Light_ActionBar_TabView_Inverse = 0x7f0c0145; public static final int Widget_AppCompat_Light_ActionButton = 0x7f0c0146; public static final int Widget_AppCompat_Light_ActionButton_CloseMode = 0x7f0c0147; public static final int Widget_AppCompat_Light_ActionButton_Overflow = 0x7f0c0148; public static final int Widget_AppCompat_Light_ActionMode_Inverse = 0x7f0c0149; public static final int Widget_AppCompat_Light_ActivityChooserView = 0x7f0c014a; public static final int Widget_AppCompat_Light_AutoCompleteTextView = 0x7f0c014b; public static final int Widget_AppCompat_Light_DropDownItem_Spinner = 0x7f0c014c; public static final int Widget_AppCompat_Light_ListPopupWindow = 0x7f0c014d; public static final int Widget_AppCompat_Light_ListView_DropDown = 0x7f0c014e; public static final int Widget_AppCompat_Light_PopupMenu = 0x7f0c014f; public static final int Widget_AppCompat_Light_PopupMenu_Overflow = 0x7f0c0150; public static final int Widget_AppCompat_Light_SearchView = 0x7f0c0151; public static final int Widget_AppCompat_Light_Spinner_DropDown_ActionBar = 0x7f0c0152; public static final int Widget_AppCompat_ListMenuView = 0x7f0c0153; public static final int Widget_AppCompat_ListPopupWindow = 0x7f0c0154; public static final int Widget_AppCompat_ListView = 0x7f0c0155; public static final int Widget_AppCompat_ListView_DropDown = 0x7f0c0156; public static final int Widget_AppCompat_ListView_Menu = 0x7f0c0157; public static final int Widget_AppCompat_PopupMenu = 0x7f0c0158; public static final int Widget_AppCompat_PopupMenu_Overflow = 0x7f0c0159; public static final int Widget_AppCompat_PopupWindow = 0x7f0c015a; public static final int Widget_AppCompat_ProgressBar = 0x7f0c015b; public static final int Widget_AppCompat_ProgressBar_Horizontal = 0x7f0c015c; public static final int Widget_AppCompat_RatingBar = 0x7f0c015d; public static final int Widget_AppCompat_RatingBar_Indicator = 0x7f0c015e; public static final int Widget_AppCompat_RatingBar_Small = 0x7f0c015f; public static final int Widget_AppCompat_SearchView = 0x7f0c0160; public static final int Widget_AppCompat_SearchView_ActionBar = 0x7f0c0161; public static final int Widget_AppCompat_SeekBar = 0x7f0c0162; public static final int Widget_AppCompat_SeekBar_Discrete = 0x7f0c0163; public static final int Widget_AppCompat_Spinner = 0x7f0c0164; public static final int Widget_AppCompat_Spinner_DropDown = 0x7f0c0165; public static final int Widget_AppCompat_Spinner_DropDown_ActionBar = 0x7f0c0166; public static final int Widget_AppCompat_Spinner_Underlined = 0x7f0c0167; public static final int Widget_AppCompat_TextView_SpinnerItem = 0x7f0c0168; public static final int Widget_AppCompat_Toolbar = 0x7f0c0169; public static final int Widget_AppCompat_Toolbar_Button_Navigation = 0x7f0c016a; public static final int Widget_Compat_NotificationActionContainer = 0x7f0c016b; public static final int Widget_Compat_NotificationActionText = 0x7f0c016c; } public static final class styleable { public static final int[] ActionBar = { 0x7f020031, 0x7f020032, 0x7f020033, 0x7f020057, 0x7f020058, 0x7f020059, 0x7f02005a, 0x7f02005b, 0x7f02005c, 0x7f02005e, 0x7f020062, 0x7f020063, 0x7f02006e, 0x7f02007c, 0x7f02007d, 0x7f02007e, 0x7f02007f, 0x7f020080, 0x7f020085, 0x7f020088, 0x7f0200c0, 0x7f0200c7, 0x7f0200d2, 0x7f0200d5, 0x7f0200d6, 0x7f0200f0, 0x7f0200f3, 0x7f02010e, 0x7f020117 }; public static final int ActionBar_background = 0; public static final int ActionBar_backgroundSplit = 1; public static final int ActionBar_backgroundStacked = 2; public static final int ActionBar_contentInsetEnd = 3; public static final int ActionBar_contentInsetEndWithActions = 4; public static final int ActionBar_contentInsetLeft = 5; public static final int ActionBar_contentInsetRight = 6; public static final int ActionBar_contentInsetStart = 7; public static final int ActionBar_contentInsetStartWithNavigation = 8; public static final int ActionBar_customNavigationLayout = 9; public static final int ActionBar_displayOptions = 10; public static final int ActionBar_divider = 11; public static final int ActionBar_elevation = 12; public static final int ActionBar_height = 13; public static final int ActionBar_hideOnContentScroll = 14; public static final int ActionBar_homeAsUpIndicator = 15; public static final int ActionBar_homeLayout = 16; public static final int ActionBar_icon = 17; public static final int ActionBar_indeterminateProgressStyle = 18; public static final int ActionBar_itemPadding = 19; public static final int ActionBar_logo = 20; public static final int ActionBar_navigationMode = 21; public static final int ActionBar_popupTheme = 22; public static final int ActionBar_progressBarPadding = 23; public static final int ActionBar_progressBarStyle = 24; public static final int ActionBar_subtitle = 25; public static final int ActionBar_subtitleTextStyle = 26; public static final int ActionBar_title = 27; public static final int ActionBar_titleTextStyle = 28; public static final int[] ActionBarLayout = { 0x010100b3 }; public static final int ActionBarLayout_android_layout_gravity = 0; public static final int[] ActionMenuItemView = { 0x0101013f }; public static final int ActionMenuItemView_android_minWidth = 0; public static final int[] ActionMode = { 0x7f020031, 0x7f020032, 0x7f020046, 0x7f02007c, 0x7f0200f3, 0x7f020117 }; public static final int ActionMode_background = 0; public static final int ActionMode_backgroundSplit = 1; public static final int ActionMode_closeItemLayout = 2; public static final int ActionMode_height = 3; public static final int ActionMode_subtitleTextStyle = 4; public static final int ActionMode_titleTextStyle = 5; public static final int[] ActivityChooserView = { 0x7f02006f, 0x7f020086 }; public static final int ActivityChooserView_expandActivityOverflowButtonDrawable = 0; public static final int ActivityChooserView_initialActivityCount = 1; public static final int[] AlertDialog = { 0x010100f2, 0x7f02003e, 0x7f0200b7, 0x7f0200b8, 0x7f0200c4, 0x7f0200e6, 0x7f0200e7 }; public static final int AlertDialog_android_layout = 0; public static final int AlertDialog_buttonPanelSideLayout = 1; public static final int AlertDialog_listItemLayout = 2; public static final int AlertDialog_listLayout = 3; public static final int AlertDialog_multiChoiceItemLayout = 4; public static final int AlertDialog_showTitle = 5; public static final int AlertDialog_singleChoiceItemLayout = 6; public static final int[] AppCompatImageView = { 0x01010119, 0x7f0200ec, 0x7f02010c, 0x7f02010d }; public static final int AppCompatImageView_android_src = 0; public static final int AppCompatImageView_srcCompat = 1; public static final int AppCompatImageView_tint = 2; public static final int AppCompatImageView_tintMode = 3; public static final int[] AppCompatSeekBar = { 0x01010142, 0x7f020109, 0x7f02010a, 0x7f02010b }; public static final int AppCompatSeekBar_android_thumb = 0; public static final int AppCompatSeekBar_tickMark = 1; public static final int AppCompatSeekBar_tickMarkTint = 2; public static final int AppCompatSeekBar_tickMarkTintMode = 3; public static final int[] AppCompatTextHelper = { 0x01010034, 0x0101016d, 0x0101016e, 0x0101016f, 0x01010170, 0x01010392, 0x01010393 }; public static final int AppCompatTextHelper_android_textAppearance = 0; public static final int AppCompatTextHelper_android_drawableTop = 1; public static final int AppCompatTextHelper_android_drawableBottom = 2; public static final int AppCompatTextHelper_android_drawableLeft = 3; public static final int AppCompatTextHelper_android_drawableRight = 4; public static final int AppCompatTextHelper_android_drawableStart = 5; public static final int AppCompatTextHelper_android_drawableEnd = 6; public static final int[] AppCompatTextView = { 0x01010034, 0x7f02002c, 0x7f02002d, 0x7f02002e, 0x7f02002f, 0x7f020030, 0x7f020071, 0x7f0200f9 }; public static final int AppCompatTextView_android_textAppearance = 0; public static final int AppCompatTextView_autoSizeMaxTextSize = 1; public static final int AppCompatTextView_autoSizeMinTextSize = 2; public static final int AppCompatTextView_autoSizePresetSizes = 3; public static final int AppCompatTextView_autoSizeStepGranularity = 4; public static final int AppCompatTextView_autoSizeTextType = 5; public static final int AppCompatTextView_fontFamily = 6; public static final int AppCompatTextView_textAllCaps = 7; public static final int[] AppCompatTheme = { 0x01010057, 0x010100ae, 0x7f020000, 0x7f020001, 0x7f020002, 0x7f020003, 0x7f020004, 0x7f020005, 0x7f020006, 0x7f020007, 0x7f020008, 0x7f020009, 0x7f02000a, 0x7f02000b, 0x7f02000c, 0x7f02000e, 0x7f02000f, 0x7f020010, 0x7f020011, 0x7f020012, 0x7f020013, 0x7f020014, 0x7f020015, 0x7f020016, 0x7f020017, 0x7f020018, 0x7f020019, 0x7f02001a, 0x7f02001b, 0x7f02001c, 0x7f02001d, 0x7f02001e, 0x7f020021, 0x7f020022, 0x7f020023, 0x7f020024, 0x7f020025, 0x7f02002b, 0x7f020037, 0x7f020038, 0x7f020039, 0x7f02003a, 0x7f02003b, 0x7f02003c, 0x7f02003f, 0x7f020040, 0x7f020043, 0x7f020044, 0x7f02004a, 0x7f02004b, 0x7f02004c, 0x7f02004d, 0x7f02004e, 0x7f02004f, 0x7f020050, 0x7f020051, 0x7f020052, 0x7f020053, 0x7f02005d, 0x7f020060, 0x7f020061, 0x7f020064, 0x7f020066, 0x7f020069, 0x7f02006a, 0x7f02006b, 0x7f02006c, 0x7f02006d, 0x7f02007e, 0x7f020084, 0x7f0200b5, 0x7f0200b6, 0x7f0200b9, 0x7f0200ba, 0x7f0200bb, 0x7f0200bc, 0x7f0200bd, 0x7f0200be, 0x7f0200bf, 0x7f0200ce, 0x7f0200cf, 0x7f0200d0, 0x7f0200d1, 0x7f0200d3, 0x7f0200d9, 0x7f0200da, 0x7f0200db, 0x7f0200dc, 0x7f0200df, 0x7f0200e0, 0x7f0200e1, 0x7f0200e2, 0x7f0200e9, 0x7f0200ea, 0x7f0200f7, 0x7f0200fa, 0x7f0200fb, 0x7f0200fc, 0x7f0200fd, 0x7f0200fe, 0x7f0200ff, 0x7f020100, 0x7f020101, 0x7f020102, 0x7f020103, 0x7f020118, 0x7f020119, 0x7f02011a, 0x7f02011b, 0x7f020121, 0x7f020122, 0x7f020123, 0x7f020124, 0x7f020125, 0x7f020126, 0x7f020127, 0x7f020128, 0x7f020129, 0x7f02012a }; public static final int AppCompatTheme_android_windowIsFloating = 0; public static final int AppCompatTheme_android_windowAnimationStyle = 1; public static final int AppCompatTheme_actionBarDivider = 2; public static final int AppCompatTheme_actionBarItemBackground = 3; public static final int AppCompatTheme_actionBarPopupTheme = 4; public static final int AppCompatTheme_actionBarSize = 5; public static final int AppCompatTheme_actionBarSplitStyle = 6; public static final int AppCompatTheme_actionBarStyle = 7; public static final int AppCompatTheme_actionBarTabBarStyle = 8; public static final int AppCompatTheme_actionBarTabStyle = 9; public static final int AppCompatTheme_actionBarTabTextStyle = 10; public static final int AppCompatTheme_actionBarTheme = 11; public static final int AppCompatTheme_actionBarWidgetTheme = 12; public static final int AppCompatTheme_actionButtonStyle = 13; public static final int AppCompatTheme_actionDropDownStyle = 14; public static final int AppCompatTheme_actionMenuTextAppearance = 15; public static final int AppCompatTheme_actionMenuTextColor = 16; public static final int AppCompatTheme_actionModeBackground = 17; public static final int AppCompatTheme_actionModeCloseButtonStyle = 18; public static final int AppCompatTheme_actionModeCloseDrawable = 19; public static final int AppCompatTheme_actionModeCopyDrawable = 20; public static final int AppCompatTheme_actionModeCutDrawable = 21; public static final int AppCompatTheme_actionModeFindDrawable = 22; public static final int AppCompatTheme_actionModePasteDrawable = 23; public static final int AppCompatTheme_actionModePopupWindowStyle = 24; public static final int AppCompatTheme_actionModeSelectAllDrawable = 25; public static final int AppCompatTheme_actionModeShareDrawable = 26; public static final int AppCompatTheme_actionModeSplitBackground = 27; public static final int AppCompatTheme_actionModeStyle = 28; public static final int AppCompatTheme_actionModeWebSearchDrawable = 29; public static final int AppCompatTheme_actionOverflowButtonStyle = 30; public static final int AppCompatTheme_actionOverflowMenuStyle = 31; public static final int AppCompatTheme_activityChooserViewStyle = 32; public static final int AppCompatTheme_alertDialogButtonGroupStyle = 33; public static final int AppCompatTheme_alertDialogCenterButtons = 34; public static final int AppCompatTheme_alertDialogStyle = 35; public static final int AppCompatTheme_alertDialogTheme = 36; public static final int AppCompatTheme_autoCompleteTextViewStyle = 37; public static final int AppCompatTheme_borderlessButtonStyle = 38; public static final int AppCompatTheme_buttonBarButtonStyle = 39; public static final int AppCompatTheme_buttonBarNegativeButtonStyle = 40; public static final int AppCompatTheme_buttonBarNeutralButtonStyle = 41; public static final int AppCompatTheme_buttonBarPositiveButtonStyle = 42; public static final int AppCompatTheme_buttonBarStyle = 43; public static final int AppCompatTheme_buttonStyle = 44; public static final int AppCompatTheme_buttonStyleSmall = 45; public static final int AppCompatTheme_checkboxStyle = 46; public static final int AppCompatTheme_checkedTextViewStyle = 47; public static final int AppCompatTheme_colorAccent = 48; public static final int AppCompatTheme_colorBackgroundFloating = 49; public static final int AppCompatTheme_colorButtonNormal = 50; public static final int AppCompatTheme_colorControlActivated = 51; public static final int AppCompatTheme_colorControlHighlight = 52; public static final int AppCompatTheme_colorControlNormal = 53; public static final int AppCompatTheme_colorError = 54; public static final int AppCompatTheme_colorPrimary = 55; public static final int AppCompatTheme_colorPrimaryDark = 56; public static final int AppCompatTheme_colorSwitchThumbNormal = 57; public static final int AppCompatTheme_controlBackground = 58; public static final int AppCompatTheme_dialogPreferredPadding = 59; public static final int AppCompatTheme_dialogTheme = 60; public static final int AppCompatTheme_dividerHorizontal = 61; public static final int AppCompatTheme_dividerVertical = 62; public static final int AppCompatTheme_dropDownListViewStyle = 63; public static final int AppCompatTheme_dropdownListPreferredItemHeight = 64; public static final int AppCompatTheme_editTextBackground = 65; public static final int AppCompatTheme_editTextColor = 66; public static final int AppCompatTheme_editTextStyle = 67; public static final int AppCompatTheme_homeAsUpIndicator = 68; public static final int AppCompatTheme_imageButtonStyle = 69; public static final int AppCompatTheme_listChoiceBackgroundIndicator = 70; public static final int AppCompatTheme_listDividerAlertDialog = 71; public static final int AppCompatTheme_listMenuViewStyle = 72; public static final int AppCompatTheme_listPopupWindowStyle = 73; public static final int AppCompatTheme_listPreferredItemHeight = 74; public static final int AppCompatTheme_listPreferredItemHeightLarge = 75; public static final int AppCompatTheme_listPreferredItemHeightSmall = 76; public static final int AppCompatTheme_listPreferredItemPaddingLeft = 77; public static final int AppCompatTheme_listPreferredItemPaddingRight = 78; public static final int AppCompatTheme_panelBackground = 79; public static final int AppCompatTheme_panelMenuListTheme = 80; public static final int AppCompatTheme_panelMenuListWidth = 81; public static final int AppCompatTheme_popupMenuStyle = 82; public static final int AppCompatTheme_popupWindowStyle = 83; public static final int AppCompatTheme_radioButtonStyle = 84; public static final int AppCompatTheme_ratingBarStyle = 85; public static final int AppCompatTheme_ratingBarStyleIndicator = 86; public static final int AppCompatTheme_ratingBarStyleSmall = 87; public static final int AppCompatTheme_searchViewStyle = 88; public static final int AppCompatTheme_seekBarStyle = 89; public static final int AppCompatTheme_selectableItemBackground = 90; public static final int AppCompatTheme_selectableItemBackgroundBorderless = 91; public static final int AppCompatTheme_spinnerDropDownItemStyle = 92; public static final int AppCompatTheme_spinnerStyle = 93; public static final int AppCompatTheme_switchStyle = 94; public static final int AppCompatTheme_textAppearanceLargePopupMenu = 95; public static final int AppCompatTheme_textAppearanceListItem = 96; public static final int AppCompatTheme_textAppearanceListItemSecondary = 97; public static final int AppCompatTheme_textAppearanceListItemSmall = 98; public static final int AppCompatTheme_textAppearancePopupMenuHeader = 99; public static final int AppCompatTheme_textAppearanceSearchResultSubtitle = 100; public static final int AppCompatTheme_textAppearanceSearchResultTitle = 101; public static final int AppCompatTheme_textAppearanceSmallPopupMenu = 102; public static final int AppCompatTheme_textColorAlertDialogListItem = 103; public static final int AppCompatTheme_textColorSearchUrl = 104; public static final int AppCompatTheme_toolbarNavigationButtonStyle = 105; public static final int AppCompatTheme_toolbarStyle = 106; public static final int AppCompatTheme_tooltipForegroundColor = 107; public static final int AppCompatTheme_tooltipFrameBackground = 108; public static final int AppCompatTheme_windowActionBar = 109; public static final int AppCompatTheme_windowActionBarOverlay = 110; public static final int AppCompatTheme_windowActionModeOverlay = 111; public static final int AppCompatTheme_windowFixedHeightMajor = 112; public static final int AppCompatTheme_windowFixedHeightMinor = 113; public static final int AppCompatTheme_windowFixedWidthMajor = 114; public static final int AppCompatTheme_windowFixedWidthMinor = 115; public static final int AppCompatTheme_windowMinWidthMajor = 116; public static final int AppCompatTheme_windowMinWidthMinor = 117; public static final int AppCompatTheme_windowNoTitle = 118; public static final int[] ButtonBarLayout = { 0x7f020026 }; public static final int ButtonBarLayout_allowStacking = 0; public static final int[] ColorStateListItem = { 0x010101a5, 0x0101031f, 0x7f020027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] CompoundButton = { 0x01010107, 0x7f020041, 0x7f020042 }; public static final int CompoundButton_android_button = 0; public static final int CompoundButton_buttonTint = 1; public static final int CompoundButton_buttonTintMode = 2; public static final int[] DrawerArrowToggle = { 0x7f020029, 0x7f02002a, 0x7f020036, 0x7f020049, 0x7f020067, 0x7f02007a, 0x7f0200e8, 0x7f020105 }; public static final int DrawerArrowToggle_arrowHeadLength = 0; public static final int DrawerArrowToggle_arrowShaftLength = 1; public static final int DrawerArrowToggle_barLength = 2; public static final int DrawerArrowToggle_color = 3; public static final int DrawerArrowToggle_drawableSize = 4; public static final int DrawerArrowToggle_gapBetweenBars = 5; public static final int DrawerArrowToggle_spinBars = 6; public static final int DrawerArrowToggle_thickness = 7; public static final int[] FontFamily = { 0x7f020072, 0x7f020073, 0x7f020074, 0x7f020075, 0x7f020076, 0x7f020077 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x7f020070, 0x7f020078, 0x7f020079 }; public static final int FontFamilyFont_font = 0; public static final int FontFamilyFont_fontStyle = 1; public static final int FontFamilyFont_fontWeight = 2; public static final int[] LinearLayoutCompat = { 0x010100af, 0x010100c4, 0x01010126, 0x01010127, 0x01010128, 0x7f020063, 0x7f020065, 0x7f0200c3, 0x7f0200e4 }; public static final int LinearLayoutCompat_android_gravity = 0; public static final int LinearLayoutCompat_android_orientation = 1; public static final int LinearLayoutCompat_android_baselineAligned = 2; public static final int LinearLayoutCompat_android_baselineAlignedChildIndex = 3; public static final int LinearLayoutCompat_android_weightSum = 4; public static final int LinearLayoutCompat_divider = 5; public static final int LinearLayoutCompat_dividerPadding = 6; public static final int LinearLayoutCompat_measureWithLargestChild = 7; public static final int LinearLayoutCompat_showDividers = 8; public static final int[] LinearLayoutCompat_Layout = { 0x010100b3, 0x010100f4, 0x010100f5, 0x01010181 }; public static final int LinearLayoutCompat_Layout_android_layout_gravity = 0; public static final int LinearLayoutCompat_Layout_android_layout_width = 1; public static final int LinearLayoutCompat_Layout_android_layout_height = 2; public static final int LinearLayoutCompat_Layout_android_layout_weight = 3; public static final int[] ListPopupWindow = { 0x010102ac, 0x010102ad }; public static final int ListPopupWindow_android_dropDownHorizontalOffset = 0; public static final int ListPopupWindow_android_dropDownVerticalOffset = 1; public static final int[] MenuGroup = { 0x0101000e, 0x010100d0, 0x01010194, 0x010101de, 0x010101df, 0x010101e0 }; public static final int MenuGroup_android_enabled = 0; public static final int MenuGroup_android_id = 1; public static final int MenuGroup_android_visible = 2; public static final int MenuGroup_android_menuCategory = 3; public static final int MenuGroup_android_orderInCategory = 4; public static final int MenuGroup_android_checkableBehavior = 5; public static final int[] MenuItem = { 0x01010002, 0x0101000e, 0x010100d0, 0x01010106, 0x01010194, 0x010101de, 0x010101df, 0x010101e1, 0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5, 0x0101026f, 0x7f02000d, 0x7f02001f, 0x7f020020, 0x7f020028, 0x7f020056, 0x7f020081, 0x7f020082, 0x7f0200c8, 0x7f0200e3, 0x7f02011c }; public static final int MenuItem_android_icon = 0; public static final int MenuItem_android_enabled = 1; public static final int MenuItem_android_id = 2; public static final int MenuItem_android_checked = 3; public static final int MenuItem_android_visible = 4; public static final int MenuItem_android_menuCategory = 5; public static final int MenuItem_android_orderInCategory = 6; public static final int MenuItem_android_title = 7; public static final int MenuItem_android_titleCondensed = 8; public static final int MenuItem_android_alphabeticShortcut = 9; public static final int MenuItem_android_numericShortcut = 10; public static final int MenuItem_android_checkable = 11; public static final int MenuItem_android_onClick = 12; public static final int MenuItem_actionLayout = 13; public static final int MenuItem_actionProviderClass = 14; public static final int MenuItem_actionViewClass = 15; public static final int MenuItem_alphabeticModifiers = 16; public static final int MenuItem_contentDescription = 17; public static final int MenuItem_iconTint = 18; public static final int MenuItem_iconTintMode = 19; public static final int MenuItem_numericModifiers = 20; public static final int MenuItem_showAsAction = 21; public static final int MenuItem_tooltipText = 22; public static final int[] MenuView = { 0x010100ae, 0x0101012c, 0x0101012d, 0x0101012e, 0x0101012f, 0x01010130, 0x01010131, 0x7f0200d4, 0x7f0200ee }; public static final int MenuView_android_windowAnimationStyle = 0; public static final int MenuView_android_itemTextAppearance = 1; public static final int MenuView_android_horizontalDivider = 2; public static final int MenuView_android_verticalDivider = 3; public static final int MenuView_android_headerBackground = 4; public static final int MenuView_android_itemBackground = 5; public static final int MenuView_android_itemIconDisabledAlpha = 6; public static final int MenuView_preserveIconSpacing = 7; public static final int MenuView_subMenuArrow = 8; public static final int[] PopupWindow = { 0x01010176, 0x010102c9, 0x7f0200c9 }; public static final int PopupWindow_android_popupBackground = 0; public static final int PopupWindow_android_popupAnimationStyle = 1; public static final int PopupWindow_overlapAnchor = 2; public static final int[] PopupWindowBackgroundState = { 0x7f0200ed }; public static final int PopupWindowBackgroundState_state_above_anchor = 0; public static final int[] RecycleListView = { 0x7f0200ca, 0x7f0200cd }; public static final int RecycleListView_paddingBottomNoButtons = 0; public static final int RecycleListView_paddingTopNoTitle = 1; public static final int[] SearchView = { 0x010100da, 0x0101011f, 0x01010220, 0x01010264, 0x7f020045, 0x7f020054, 0x7f02005f, 0x7f02007b, 0x7f020083, 0x7f020089, 0x7f0200d7, 0x7f0200d8, 0x7f0200dd, 0x7f0200de, 0x7f0200ef, 0x7f0200f4, 0x7f020120 }; public static final int SearchView_android_focusable = 0; public static final int SearchView_android_maxWidth = 1; public static final int SearchView_android_inputType = 2; public static final int SearchView_android_imeOptions = 3; public static final int SearchView_closeIcon = 4; public static final int SearchView_commitIcon = 5; public static final int SearchView_defaultQueryHint = 6; public static final int SearchView_goIcon = 7; public static final int SearchView_iconifiedByDefault = 8; public static final int SearchView_layout = 9; public static final int SearchView_queryBackground = 10; public static final int SearchView_queryHint = 11; public static final int SearchView_searchHintIcon = 12; public static final int SearchView_searchIcon = 13; public static final int SearchView_submitBackground = 14; public static final int SearchView_suggestionRowLayout = 15; public static final int SearchView_voiceIcon = 16; public static final int[] Spinner = { 0x010100b2, 0x01010176, 0x0101017b, 0x01010262, 0x7f0200d2 }; public static final int Spinner_android_entries = 0; public static final int Spinner_android_popupBackground = 1; public static final int Spinner_android_prompt = 2; public static final int Spinner_android_dropDownWidth = 3; public static final int Spinner_popupTheme = 4; public static final int[] SwitchCompat = { 0x01010124, 0x01010125, 0x01010142, 0x7f0200e5, 0x7f0200eb, 0x7f0200f5, 0x7f0200f6, 0x7f0200f8, 0x7f020106, 0x7f020107, 0x7f020108, 0x7f02011d, 0x7f02011e, 0x7f02011f }; public static final int SwitchCompat_android_textOn = 0; public static final int SwitchCompat_android_textOff = 1; public static final int SwitchCompat_android_thumb = 2; public static final int SwitchCompat_showText = 3; public static final int SwitchCompat_splitTrack = 4; public static final int SwitchCompat_switchMinWidth = 5; public static final int SwitchCompat_switchPadding = 6; public static final int SwitchCompat_switchTextAppearance = 7; public static final int SwitchCompat_thumbTextPadding = 8; public static final int SwitchCompat_thumbTint = 9; public static final int SwitchCompat_thumbTintMode = 10; public static final int SwitchCompat_track = 11; public static final int SwitchCompat_trackTint = 12; public static final int SwitchCompat_trackTintMode = 13; public static final int[] TextAppearance = { 0x01010095, 0x01010096, 0x01010097, 0x01010098, 0x0101009a, 0x0101009b, 0x01010161, 0x01010162, 0x01010163, 0x01010164, 0x010103ac, 0x7f020071, 0x7f0200f9 }; public static final int TextAppearance_android_textSize = 0; public static final int TextAppearance_android_typeface = 1; public static final int TextAppearance_android_textStyle = 2; public static final int TextAppearance_android_textColor = 3; public static final int TextAppearance_android_textColorHint = 4; public static final int TextAppearance_android_textColorLink = 5; public static final int TextAppearance_android_shadowColor = 6; public static final int TextAppearance_android_shadowDx = 7; public static final int TextAppearance_android_shadowDy = 8; public static final int TextAppearance_android_shadowRadius = 9; public static final int TextAppearance_android_fontFamily = 10; public static final int TextAppearance_fontFamily = 11; public static final int TextAppearance_textAllCaps = 12; public static final int[] Toolbar = { 0x010100af, 0x01010140, 0x7f02003d, 0x7f020047, 0x7f020048, 0x7f020057, 0x7f020058, 0x7f020059, 0x7f02005a, 0x7f02005b, 0x7f02005c, 0x7f0200c0, 0x7f0200c1, 0x7f0200c2, 0x7f0200c5, 0x7f0200c6, 0x7f0200d2, 0x7f0200f0, 0x7f0200f1, 0x7f0200f2, 0x7f02010e, 0x7f02010f, 0x7f020110, 0x7f020111, 0x7f020112, 0x7f020113, 0x7f020114, 0x7f020115, 0x7f020116 }; public static final int Toolbar_android_gravity = 0; public static final int Toolbar_android_minHeight = 1; public static final int Toolbar_buttonGravity = 2; public static final int Toolbar_collapseContentDescription = 3; public static final int Toolbar_collapseIcon = 4; public static final int Toolbar_contentInsetEnd = 5; public static final int Toolbar_contentInsetEndWithActions = 6; public static final int Toolbar_contentInsetLeft = 7; public static final int Toolbar_contentInsetRight = 8; public static final int Toolbar_contentInsetStart = 9; public static final int Toolbar_contentInsetStartWithNavigation = 10; public static final int Toolbar_logo = 11; public static final int Toolbar_logoDescription = 12; public static final int Toolbar_maxButtonHeight = 13; public static final int Toolbar_navigationContentDescription = 14; public static final int Toolbar_navigationIcon = 15; public static final int Toolbar_popupTheme = 16; public static final int Toolbar_subtitle = 17; public static final int Toolbar_subtitleTextAppearance = 18; public static final int Toolbar_subtitleTextColor = 19; public static final int Toolbar_title = 20; public static final int Toolbar_titleMargin = 21; public static final int Toolbar_titleMarginBottom = 22; public static final int Toolbar_titleMarginEnd = 23; public static final int Toolbar_titleMarginStart = 24; public static final int Toolbar_titleMarginTop = 25; public static final int Toolbar_titleMargins = 26; public static final int Toolbar_titleTextAppearance = 27; public static final int Toolbar_titleTextColor = 28; public static final int[] View = { 0x01010000, 0x010100da, 0x7f0200cb, 0x7f0200cc, 0x7f020104 }; public static final int View_android_theme = 0; public static final int View_android_focusable = 1; public static final int View_paddingEnd = 2; public static final int View_paddingStart = 3; public static final int View_theme = 4; public static final int[] ViewBackgroundHelper = { 0x010100d4, 0x7f020034, 0x7f020035 }; public static final int ViewBackgroundHelper_android_background = 0; public static final int ViewBackgroundHelper_backgroundTint = 1; public static final int ViewBackgroundHelper_backgroundTintMode = 2; public static final int[] ViewStubCompat = { 0x010100d0, 0x010100f2, 0x010100f3 }; public static final int ViewStubCompat_android_id = 0; public static final int ViewStubCompat_android_layout = 1; public static final int ViewStubCompat_android_inflatedId = 2; } }
[ "Lazar.Beloica@rt-rk.com" ]
Lazar.Beloica@rt-rk.com
9e9032ba2672acd3767e5ee62dbadad8ad42e6ab
e16deed58f7e677aa19faf1ab9ce31cd2e49c625
/src/main/java/gov/utah/dts/det/enums/FraudEnum.java
00abdbb5c3f40ee4e856e788aa126b1c050b6152
[]
no_license
hung118/iris
7ff32d3f35f25e2847d8bebee26038e32136f880
ae24811132befeb40b8245a3e0d19017fbd536ac
refs/heads/master
2021-01-19T05:39:20.041359
2015-07-07T01:13:43
2015-07-07T01:13:43
38,665,504
0
0
null
null
null
null
UTF-8
Java
false
false
2,749
java
package gov.utah.dts.det.enums; /** * Fraud type enum class is to be used in fraud factory pattern. * * @author hnguyen * */ public enum FraudEnum { // complaint items BANKTRANS(1, "Unauthorized Withdrawal from Your Checking or Savings Account"), BENEFITS(2, "Medicaid/Medicare, Insurance, or State Benefits"), COLLECTOR(3, "Collection Agency"), CREDITREPORT(4, "Unauthorized Accounts on Credit Report"), EMAIL(6, "Email Identity Theft"), IDLOSTSTOLEN(9, "Driver's License/ID Lost, Stolen or Misused"), LOAN(11, "Unauthorized Loan"), SUIT(13, "False Civil Judgment"), SSN(14, "Social Security Number Theft Report"), UNAUTHCREDIT(15, "Unauthorized Use of Your Credit Card"), UTILITIES(16, "Utilities Fraud"), TELEPHONE(18, "Telephone Service Fraud"), OTHER_IDTHEFT(19, "Other Identity Theft"), // complaint sub items accou(20, "Account Holder"), trans(21, "Unauthorized Transaction on Account"), colle(22, "Collection Agency/Call Information"), credi(23, "Creditor Information"), issue(24, "Issuer Information"), tranx(25, "Unauthorized Transaction"), suspect(26, "Suspects"); private final int id; private final String label; private FraudEnum(int id, String label) { this.label = label; this.id = id; } public String getLabel() { return label; } public int getId() { return id; } public static FraudEnum valueOf(int id) { for (FraudEnum fraudEnum : FraudEnum.values()) { if (fraudEnum.id == id) { return fraudEnum; } } throw new IllegalArgumentException(id + " is not a valid FraudEnum"); } public static String getString(FraudEnum fraudType) { String ret = ""; switch (fraudType) { case BANKTRANS: ret = "BANKTRANS"; break; case BENEFITS: ret = "BENEFITS"; break; case UNAUTHCREDIT: ret = "UNAUTHCREDIT"; break; case CREDITREPORT: ret = "CREDITREPORT"; break; case LOAN: ret = "LOAN"; break; case COLLECTOR: ret = "COLLECTOR"; break; case IDLOSTSTOLEN: ret = "IDLOSTSTOLEN"; break; case SSN: ret = "SSN"; break; case TELEPHONE: ret = "TELEPHONE"; break; case UTILITIES: ret = "UTILITIES"; break; case SUIT: ret = "SUIT"; break; case EMAIL: ret = "EMAIL"; break; case OTHER_IDTHEFT: ret = "OTHER_IDTHEFT"; break; case accou: ret = "accou"; break; case trans: ret = "trans"; break; case colle: ret = "colle"; break; case credi: ret = "credi"; break; case issue: ret = "issue"; break; case tranx: ret = "tranx"; break; case suspect: ret = "suspect"; break; } return ret; } }
[ "hung118@gmail.com" ]
hung118@gmail.com
33d4f48093ac1ca3a95b0ba852d92c4d60a93ad5
ab06e1580f327b834d2156e538ef69cb130bc4b2
/boj/11724.java
3ac0697aa4e10bd0a9bdb197673ea232be6c6ad6
[]
no_license
Wealgo/changmin
b54668d6c6e97a0fcfbcf109af654e56be7cdcf8
8b4f0d1c5b265a65477f0d5dd27a9e2b1fde6a4e
refs/heads/master
2022-07-23T00:28:38.796478
2022-07-09T10:20:01
2022-07-09T10:20:01
166,678,129
3
1
null
2020-06-05T15:27:17
2019-01-20T15:41:16
Java
UTF-8
Java
false
false
1,585
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static int n,m,output = 0; //방문표시할 배열. public static boolean visited[]; //그래프를 인접배열로! public static boolean map[][]; public static void main(String args[]) throws IOException{ //입력받고~ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); n = Integer.parseInt(st.nextToken()); m = Integer.parseInt(st.nextToken()); visited = new boolean[n]; map = new boolean[n][n]; for (int i = 0; i < m; i++) { st = new StringTokenizer(br.readLine()); int x = Integer.parseInt(st.nextToken())-1; int y = Integer.parseInt(st.nextToken())-1; map[y][x] = true; map[x][y] = true; } //노드들 쭉 둘러보면서 for (int i = 0; i < n; i++) { //방문했으면 pass~ if (visited[i]) continue; //재귀호출하자. recursive(i); //연결된 노드들의 집합을 찾아냈으니 +1 해주자. output++; } System.out.println(output); } //재귀로 가즈아~ public static void recursive(int r) { for (int i = 0; i < n; i++) { //만약 가는길이 없다면 pass~ if (!map[r][i]) continue; //방문했던 노드라면 pass~ if (visited[i]) continue; //방문표시 해주고 visited[i] = true; //다시 탐색 가즈아~ recursive(i); } } }
[ "ninehundred@outlook.kr" ]
ninehundred@outlook.kr
f2c0e7cd7a993491cf1a74f3129dfc4ec64ced84
5fb8eb6ba6ff6a0f485236d9f425fa4e5ac06582
/app/src/main/java/com/qingfeng/music/receiver/MediaNotificationManager.java
c376264046ddcbd0bad1d261e8cb8870ba01377b
[ "Apache-2.0" ]
permissive
huangdsh/QingFengMusic
84639e8fac3cb0ee94338d51acb61e08c5a74257
962a2eadc55f42dee1a414f63d29abbcafd5a5f2
refs/heads/master
2021-01-18T17:24:01.691605
2017-03-31T08:11:51
2017-03-31T08:11:51
86,793,283
1
0
null
null
null
null
UTF-8
Java
false
false
10,270
java
package com.qingfeng.music.receiver; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.support.v7.app.NotificationCompat; import android.util.Log; import com.bumptech.glide.Glide; import com.qingfeng.music.Constant; import com.qingfeng.music.R; import com.qingfeng.music.dao.Music; import com.qingfeng.music.service.PlayerService; import com.qingfeng.music.ui.player.activity.FullScreenPlayerActivity; import com.qingfeng.music.util.Player; import com.qingfeng.music.util.ResourceHelper; import com.wgl.android.library.commonutils.LogUtils; import java.util.concurrent.ExecutionException; /** * Created by Ganlin.Wu on 2016/9/30. */ public class MediaNotificationManager extends BroadcastReceiver { private static final String TAG = "MediaNotification"; private static final int NOTIFICATION_ID = 412; private static final int REQUEST_CODE = 100; public static final String ACTION_PAUSE = "com.qingfeng.music.playerservice.pause"; public static final String ACTION_PLAY = "com.qingfeng.music.playerservice.play"; public static final String ACTION_PREV = "com.qingfeng.music.playerservice.prev"; public static final String ACTION_NEXT = "com.qingfeng.music.playerservice.next"; private final PlayerService mService; private NotificationManager mNotificationManager; private PendingIntent mPauseIntent; private PendingIntent mPlayIntent; private PendingIntent mPreviousIntent; private PendingIntent mNextIntent; private int mNotificationColor; private boolean mStarted = false; public MediaNotificationManager(PlayerService service) { mService = service; mNotificationColor = ResourceHelper.getThemeColor(mService, android.R.attr.colorPrimary, Color.DKGRAY); mNotificationManager = (NotificationManager) mService .getSystemService(Context.NOTIFICATION_SERVICE); String pkg = mService.getPackageName(); mPauseIntent = PendingIntent.getBroadcast(mService, REQUEST_CODE, new Intent(ACTION_PAUSE).setPackage(pkg), PendingIntent.FLAG_CANCEL_CURRENT); mPlayIntent = PendingIntent.getBroadcast(mService, REQUEST_CODE, new Intent(ACTION_PLAY).setPackage(pkg), PendingIntent.FLAG_CANCEL_CURRENT); mPreviousIntent = PendingIntent.getBroadcast(mService, REQUEST_CODE, new Intent(ACTION_PREV).setPackage(pkg), PendingIntent.FLAG_CANCEL_CURRENT); mNextIntent = PendingIntent.getBroadcast(mService, REQUEST_CODE, new Intent(ACTION_NEXT).setPackage(pkg), PendingIntent.FLAG_CANCEL_CURRENT); mNotificationManager.cancelAll(); } public void startNotification() { Log.d(TAG, "startNotification: "); if (!mStarted) { // The notification must be updated after setting started to true Notification notification = createNotification(); if (notification != null) { IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_NEXT); filter.addAction(ACTION_PAUSE); filter.addAction(ACTION_PLAY); filter.addAction(ACTION_PREV); filter.addAction(Constant.RECEIVER_MUSIC_CHANGE); mService.registerReceiver(this, filter); mService.startForeground(NOTIFICATION_ID, notification); mStarted = true; } } } private Notification createNotification() { NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(mService); int playPauseButtonPosition = 0; notificationBuilder.addAction(R.drawable.ic_skip_previous_white_24dp, mService.getString(R.string.label_previous), mPreviousIntent); // If there is a "skip to previous" button, the play/pause button will // be the second one. We need to keep track of it, because the MediaStyle notification // requires to specify the index of the buttons (actions) that should be visible // when in compact view. playPauseButtonPosition = 1; addPlayPauseAction(notificationBuilder); // If skip to next action is enabled notificationBuilder.addAction(R.drawable.ic_skip_next_white_24dp, mService.getString(R.string.label_next), mNextIntent); Music music = Player.getPlayer().getMusic(); String fetchArtUrl = null; Bitmap art = null; if (music.getImageUrl() != null) { // This sample assumes the iconUri will be a valid URL formatted String, but // it can actually be any valid Android Uri formatted String. // async fetch the album art icon if (art == null) { // use a placeholder art while the remote art is being downloaded art = BitmapFactory.decodeResource(mService.getResources(), R.drawable.ic_default_art); } else { try { art = Glide.with(mService).load(music.getImageUrl()).asBitmap().centerCrop() .into(54, 54).get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } } } notificationBuilder .setStyle(new NotificationCompat.MediaStyle() .setShowActionsInCompactView( new int[]{playPauseButtonPosition}) // show only play/pause in compact view ) .setColor(mNotificationColor) .setSmallIcon(R.drawable.ic_notification) .setVisibility(Notification.VISIBILITY_PUBLIC) .setUsesChronometer(true) .setContentIntent(createContentIntent()) .setContentTitle(music.getTitle()) .setContentText(music.getArtist()) .setLargeIcon(art); setNotificationPlaybackState(notificationBuilder); notificationBuilder.setLargeIcon(BitmapFactory.decodeResource(mService.getResources(), R.drawable.ic_notification)); mNotificationManager.notify(NOTIFICATION_ID, notificationBuilder.build()); return notificationBuilder.build(); } private void addPlayPauseAction(NotificationCompat.Builder builder) { String label; int icon; PendingIntent intent; if (Player.getPlayer().getState() == Player.STATE_PLAY) { label = mService.getString(R.string.label_pause); icon = R.drawable.uamp_ic_pause_white_24dp; intent = mPauseIntent; } else { label = mService.getString(R.string.label_play); icon = R.drawable.uamp_ic_play_arrow_white_24dp; intent = mPlayIntent; } builder.addAction(new NotificationCompat.Action(icon, label, intent)); } private PendingIntent createContentIntent() { Intent openUI = new Intent(mService, FullScreenPlayerActivity.class); openUI.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); return PendingIntent.getActivity(mService, REQUEST_CODE, openUI, PendingIntent.FLAG_CANCEL_CURRENT); } private void setNotificationPlaybackState(NotificationCompat.Builder builder) { Player player = Player.getPlayer(); if (player == null || !mStarted) { mService.stopForeground(true); return; } if (player.getState() == Player.STATE_PLAY && player.getPosition() >= 0) { builder.setWhen(System.currentTimeMillis() - player.getPosition()) .setShowWhen(true) .setUsesChronometer(true); } else { builder .setWhen(0) .setShowWhen(false) .setUsesChronometer(false); } // Make sure that the notification can be dismissed by the user when we are not playing: builder.setOngoing(player.getState() == Player.STATE_PLAY); } public void stopNotification() { if (mStarted) { mStarted = false; try { mNotificationManager.cancel(NOTIFICATION_ID); mService.unregisterReceiver(this); } catch (IllegalArgumentException ex) { // ignore if the receiver is not registered. } mService.stopForeground(true); } } @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); switch (action) { case ACTION_PAUSE: LogUtils.logd("ACTION_PAUSE"); mService.pause(); break; case ACTION_PLAY: LogUtils.logd("ACTION_PLAY"); if (Player.getPlayer().getState() == Player.STATE_STOP) { mService.play(); } else { mService.replay(); } break; case ACTION_NEXT: LogUtils.logd("ACTION_NEXT"); mService.next(); break; case ACTION_PREV: LogUtils.logd("ACTION_PREV"); mService.previous(); break; case Constant.RECEIVER_MUSIC_CHANGE: if (Player.getPlayer().getState() == Player.STATE_STOP) { stopNotification(); } else { Notification notification = createNotification(); if (notification != null) { mNotificationManager.notify(NOTIFICATION_ID, notification); } } default: break; } } }
[ "185469580@qq.com" ]
185469580@qq.com
2b5732990c7cad770227bd7965887d1b6810e474
801f5b6e5e7b35a618f06c252181e0e94b4e669d
/src/com/Pedro/DataStructures/PlaneNode.java
5d48014f155dfb1b84e822eea61d6911e13dd25a
[]
no_license
caotic300/DataStructures
12977649a8e8124129cf653f7474350b868cc1a4
5de940072a120abdd1041bfa2ec98075c9cbf0d5
refs/heads/master
2020-08-30T03:54:17.735246
2020-05-07T20:05:53
2020-05-07T20:05:53
218,254,875
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package com.Pedro.DataStructures; public class PlaneNode { public Plane info; public PlaneNode next; public PlaneNode(Plane info) { this.info = info; this.next = null; } public PlaneNode(Plane info, PlaneNode next) { this.info = info; this.next = next; } }
[ "caotic300@gmail.com" ]
caotic300@gmail.com
d2f6091e93c86dd4df90538a9706af9f2f32c508
fca05091efe100d85d1fa67e9078cbbca4228b69
/VWorkflows-Core/src/main/java/eu/mihosoft/vrl/workflow/io/PersistentValueObject.java
ef84c6d1f31f8ade066b54b923db0ddd896070c4
[ "BSD-2-Clause" ]
permissive
willcohen/VWorkflows
8431ebc93e355a91c43bd4444b553761caf90dc3
9a00eaa31862b94c465ba5065eea33c91dd0bbc3
refs/heads/master
2020-08-05T17:56:35.180214
2019-09-28T20:24:32
2019-09-28T20:24:32
212,644,277
0
0
NOASSERTION
2019-10-03T17:57:29
2019-10-03T17:57:27
null
UTF-8
Java
false
false
3,438
java
/* * Copyright 2012-2016 Michael Hoffer <info@michaelhoffer.de>. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Please cite the following publication(s): * * M. Hoffer, C.Poliwoda, G.Wittum. Visual Reflection Library - * A Framework for Declarative GUI Programming on the Java Platform. * Computing and Visualization in Science, 2011, in press. * * THIS SOFTWARE IS PROVIDED BY Michael Hoffer <info@michaelhoffer.de> "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Michael Hoffer <info@michaelhoffer.de> OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of Michael Hoffer <info@michaelhoffer.de>. */ /* * 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 eu.mihosoft.vrl.workflow.io; import eu.mihosoft.vrl.workflow.VisualizationRequest; import java.util.HashMap; import java.util.Map; /** * * @author Michael Hoffer &lt;info@michaelhoffer.de&gt; */ public class PersistentValueObject { private String parentId; private Object value; private Map<String, Object> storage; public PersistentValueObject(String parentId, Object value, VisualizationRequest vReq) { this.parentId = parentId; this.value = value; storage = new HashMap<>(); for (String key : vReq.getKeys()) { storage.put(key, vReq.get(key)); } } public PersistentValueObject() { } public String getParentId() { return parentId; } public void setParentId(String id) { this.parentId = id; } public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } /** * @return the storage */ public Map<String, Object> getStorage() { return storage; } /** * @param storage the storage to set */ public void setStorage(Map<String, Object> storage) { this.storage = storage; } }
[ "info@michaelhoffer.de" ]
info@michaelhoffer.de
cb05fd76931deffb3a4c3972cf8c5e9a050029be
20eb62855cb3962c2d36fda4377dfd47d82eb777
/IntroClassJava/dataset/smallest/846021256d8ee8e5398346b8c049a0489ee71209518b971ce1d11e81406bfea1bb78c99c339660ac2790d61d438ecae0ff7a35bfab07864f8e6f69ca2450013c/007/mutations/211/smallest_84602125_007.java
4544d6887add0cbf8f16f07e7c6c6284f8f5c2e3
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,331
java
package introclassJava; class IntObj { public int value; public IntObj () { } public IntObj (int i) { value = i; } } class FloatObj { public float value; public FloatObj () { } public FloatObj (float i) { value = i; } } class LongObj { public long value; public LongObj () { } public LongObj (long i) { value = i; } } class DoubleObj { public double value; public DoubleObj () { } public DoubleObj (double i) { value = i; } } class CharObj { public char value; public CharObj () { } public CharObj (char i) { value = i; } } public class smallest_84602125_007 { public java.util.Scanner scanner; public String output = ""; public static void main (String[]args) throws Exception { smallest_84602125_007 mainClass = new smallest_84602125_007 (); String output; if (args.length > 0) { mainClass.scanner = new java.util.Scanner (args[0]); } else { mainClass.scanner = new java.util.Scanner (System.in); } mainClass.exec (); System.out.println (mainClass.output); } public void exec () throws Exception { IntObj a = new IntObj (), b = new IntObj (), c = new IntObj (), d = new IntObj (); output += (String.format ("Please enter 4 numbers separated by spaces > ")); a.value = scanner.nextInt (); b.value = scanner.nextInt (); c.value = scanner.nextInt (); d.value = scanner.nextInt (); if ((a.value < b.value) && (a.value < c.value) && (a.value < d.value)) { output += (String.format ("%d is the smallest\n", a.value)); } else if ((b.value < a.value) && (c.value < c.value) && (b.value < d.value)) { output += (String.format ("%d is the smallest\n", b.value)); } else if ((c.value < b.value) && (c.value < a.value) && (c.value < d.value)) { output += (String.format ("%d is the smallest\n", c.value)); } else if ((d.value < b.value) && (d.value < c.value) && (d.value < a.value)) { output += (String.format ("%d is the smallest\n", d.value)); } if (true) return;; } }
[ "justinwm@163.com" ]
justinwm@163.com
65d81ba50bc4acc8b293718a868c28db33ae5fa0
dd18348174d799ffc7083bdc2a7e8495cce622e9
/ui/src/main/java/com/histudio/ui/custom/recycler/base/listener/OnItemClickListener.java
1b02da29c48d7e344a9e1fcf23733bf6813120e9
[]
no_license
laolinmao/sale_delivery_android
1651ca69fecc53ddaad8c575147018f07335175f
dd710633bd4b47728fec20af686658206cfca9d2
refs/heads/master
2022-03-30T09:48:47.704447
2019-12-28T03:21:25
2019-12-28T03:21:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,047
java
package com.histudio.ui.custom.recycler.base.listener; import android.view.View; import com.histudio.ui.custom.recycler.base.BaseQuickAdapter; /** * Created by AllenCoder on 2016/8/03. * <p> * <p> * A convenience class to extend when you only want to OnItemClickListener for a subset * of all the SimpleClickListener. This implements all methods in the * {@link SimpleClickListener} */ public abstract class OnItemClickListener extends SimpleClickListener { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { onSimpleItemClick(adapter, view, position); } @Override public void onItemLongClick(BaseQuickAdapter adapter, View view, int position) { } @Override public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) { } @Override public void onItemChildLongClick(BaseQuickAdapter adapter, View view, int position) { } public abstract void onSimpleItemClick(BaseQuickAdapter adapter, View view, int position); }
[ "laolin123" ]
laolin123
8b3332f70b232b40f831208d389b3aca732142a8
63f4098a9f3c02d14735c49e1d2a7734f61e574f
/core/containers/tomcat/src/main/java/org/codehaus/cargo/container/tomcat/TomcatExistingLocalConfiguration.java
f0c90dd2b5341f9d34a4d2c47a182a414cabe6b1
[]
no_license
psiroky/cargo
225bfd3a1c01703c7d3adf7246334f4180f19ed9
d2e327183f712c4faa2f6682a4483b787e29ae45
refs/heads/master
2021-01-24T22:52:03.535382
2015-04-02T23:54:37
2015-04-03T18:35:06
33,377,037
0
0
null
2015-04-03T18:36:20
2015-04-03T18:36:20
null
UTF-8
Java
false
false
6,994
java
/* * ======================================================================== * * Codehaus CARGO, copyright 2004-2011 Vincent Massol. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * ======================================================================== */ package org.codehaus.cargo.container.tomcat; import java.io.File; import java.io.InputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.codehaus.cargo.container.ContainerException; import org.codehaus.cargo.container.LocalContainer; import org.codehaus.cargo.container.configuration.ConfigurationCapability; import org.codehaus.cargo.container.spi.configuration.AbstractExistingLocalConfiguration; import org.codehaus.cargo.container.tomcat.internal.TomcatExistingLocalConfigurationCapability; import org.codehaus.cargo.util.CargoException; /** * Tomcat existing {@link org.codehaus.cargo.container.configuration.Configuration} implementation. * */ public class TomcatExistingLocalConfiguration extends AbstractExistingLocalConfiguration { /** * Capability of the Tomcat existing configuration. */ private static ConfigurationCapability capability = new TomcatExistingLocalConfigurationCapability(); /** * {@inheritDoc} * @see AbstractExistingLocalConfiguration#AbstractExistingLocalConfiguration(String) */ public TomcatExistingLocalConfiguration(String dir) { super(dir); String file = getFileHandler().append(dir, "conf/server.xml"); if (!getFileHandler().exists(file)) { getLogger().warn("Cannot find file " + file + ", setting default " + TomcatPropertySet.WEBAPPS_DIRECTORY, this.getClass().getName()); setProperty(TomcatPropertySet.WEBAPPS_DIRECTORY, "webapps"); return; } InputStream is = null; try { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = domFactory.newDocumentBuilder(); XPathFactory xPathFactory = XPathFactory.newInstance(); XPath xPath = xPathFactory.newXPath(); if (getFileHandler().isDirectory(file)) { throw new CargoException("The destination is a directory: " + file); } is = getFileHandler().getInputStream(file); Document doc; try { doc = builder.parse(is); } finally { is.close(); is = null; System.gc(); } String expression = "//Server/Service/Engine/Host"; String attributeName = "appBase"; XPathExpression xPathExpr = xPath.compile(expression); Node node = (Node) xPathExpr.evaluate(doc, XPathConstants.NODE); if (node == null) { throw new CargoException("Node " + expression + " not found in file " + file); } Node attribute = node.getAttributes().getNamedItem(attributeName); if (attribute == null) { throw new CargoException("Attribute " + attribute + " not found on node " + expression + " in file " + file); } setProperty(TomcatPropertySet.WEBAPPS_DIRECTORY, attribute.getNodeValue()); } catch (Exception e) { throw new CargoException("Cannot read the Tomcat server.xml file", e); } finally { if (is != null) { try { is.close(); } catch (Exception ignored) { // Ignored } finally { is = null; } } System.gc(); } } /** * {@inheritDoc} * @see org.codehaus.cargo.container.configuration.Configuration#getCapability() */ public ConfigurationCapability getCapability() { return capability; } /** * {@inheritDoc} * @see org.codehaus.cargo.container.spi.configuration.AbstractLocalConfiguration#configure(LocalContainer) */ @Override protected void doConfigure(LocalContainer container) throws Exception { if (container instanceof Tomcat5xEmbeddedLocalContainer) { // embedded Tomcat doesn't need CPC TomcatEmbeddedLocalDeployer deployer = new TomcatEmbeddedLocalDeployer((Tomcat5xEmbeddedLocalContainer) container); deployer.redeploy(getDeployables()); } else { File webappsDir = new File(getHome(), getPropertyValue(TomcatPropertySet.WEBAPPS_DIRECTORY)); if (!webappsDir.exists()) { throw new ContainerException("Invalid existing configuration: The [" + webappsDir.getPath() + "] directory does not exist"); } TomcatCopyingInstalledLocalDeployer deployer = createDeployer(container); deployer.setShouldCopyWars(true); deployer.redeploy(getDeployables()); // Deploy the CPC (Cargo Ping Component) to the webapps directory. getResourceUtils().copyResource(RESOURCE_PATH + "cargocpc.war", new File(webappsDir, "cargocpc.war")); } } /** * {@inheritDoc} * @see org.codehaus.cargo.container.spi.configuration.ContainerConfiguration#verify() */ @Override public void verify() { // Nothing to verify right now... } /** * {@inheritDoc} * @see Object#toString() */ @Override public String toString() { return "Tomcat Existing Configuration"; } /** * Creates the Tomcat deployer. * * @param container Container to create a deployer for. * @return Tomcat deployer. */ protected TomcatCopyingInstalledLocalDeployer createDeployer(LocalContainer container) { return new TomcatCopyingInstalledLocalDeployer(container); } }
[ "psiroky@redhat.com" ]
psiroky@redhat.com
fa23266ba2ba2f519cbe0dff6d742480b48b4bc0
f0cdeab4028a69a71efcd548052843a5017ec253
/pyramid/Number32.java
35f9c766977c0548cfd8d5a68e857a3e92fac574
[]
no_license
katejay/Java-Exercise
b71b857218431817136b56f93af80c24542684a7
6c2c5e86d80bc786c2ce8586de9330053eec9a1a
refs/heads/master
2020-08-18T07:43:22.099102
2019-12-28T06:40:57
2019-12-28T06:40:57
215,765,519
3
0
null
null
null
null
UTF-8
Java
false
false
444
java
package pyramid; public class Number32 { public static void main(String[] args) { // TODO Auto-generated method stub int i,j,k,num=1; for(i=0; i<4; i++) // rows { for(k=2*(4-i); k>=0; k--) // spaces { System.out.print(" "); } for (j=0; j<=i; j++) // columns { System.out.print(num+" "); num++; } System.out.println(); } } } /* output 1 2 3 4 5 6 7 8 9 10 */
[ "jay.kate20@gmail.com" ]
jay.kate20@gmail.com
be3191d07178c5df9b0a3532c6a8bd4e421ae213
8c44287f48112e02f69dc17c4ef65d81c54e8a78
/src/main/java/com/golftec/teaching/server/networking/util/ByteObjectCommon.java
b372d2561e4a5a324abc231beb63425ceaaaf29f
[]
no_license
lldminh/video-worker
729165f5acb5f1590de8174fc32d362ee64d9cd0
1fb6bb1c0866047a479f342249fe216d73d06803
refs/heads/master
2020-04-02T05:22:37.529933
2016-06-15T08:09:29
2016-06-15T08:09:29
61,344,711
0
0
null
null
null
null
UTF-8
Java
false
false
1,108
java
package com.golftec.teaching.server.networking.util; import java.io.*; public class ByteObjectCommon { public static byte[] getObjectBytes(Serializable object) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream ooStream = new ObjectOutputStream(baos); ooStream.writeObject(object); ooStream.flush(); byte[] objectBytes = baos.toByteArray(); baos.close(); ooStream.close(); return objectBytes; } catch (Exception e) { e.printStackTrace(); } return null; } public static int getObjectSize(Serializable object) { return getObjectBytes(object).length; } public static Object getObject(byte[] objectBytes) throws Exception { ByteArrayInputStream stream = new ByteArrayInputStream(objectBytes); ObjectInputStream objectStream = new ObjectInputStream(stream); Object o = objectStream.readObject(); objectStream.close(); objectStream = null; return o; } }
[ "lldminh@yahoo.com" ]
lldminh@yahoo.com
9110f86bd37aad91e28383f4969b0c86c984c291
c9f497048e25df3ded21b77ebf9dd9be582c1dd9
/app/src/main/java/com/nenggou/slsm/bankcard/adapter/PutForwardItemAdapter.java
ca02f9d662e991da369aa317213e4c873367a2ac
[]
no_license
jwc12321/NgMerchant
30aa83914cd0730da3e264be05650c9f47f40e9a
bcbd05e51a8e30ccfaf1600f43140b76cac523e2
refs/heads/master
2021-08-20T05:02:01.242619
2018-10-17T08:06:55
2018-10-17T08:06:55
135,698,672
0
0
null
null
null
null
UTF-8
Java
false
false
3,246
java
package com.nenggou.slsm.bankcard.adapter; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.RelativeLayout; import android.widget.TextView; import com.nenggou.slsm.R; import com.nenggou.slsm.common.unit.FormatUtil; import com.nenggou.slsm.data.entity.PutForwardItem; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by JWC on 2018/7/26. */ public class PutForwardItemAdapter extends RecyclerView.Adapter<PutForwardItemAdapter.PutForwardItemView> { private LayoutInflater layoutInflater; private List<PutForwardItem> putForwardItems; public void setData(List<PutForwardItem> putForwardItems) { this.putForwardItems = putForwardItems; notifyDataSetChanged(); } @Override public PutForwardItemView onCreateViewHolder(ViewGroup parent, int viewType) { if (layoutInflater == null) { layoutInflater = LayoutInflater.from(parent.getContext()); } View view = layoutInflater.inflate(R.layout.adapter_put_forward_item, parent, false); return new PutForwardItemView(view); } @Override public void onBindViewHolder(PutForwardItemView holder, int position) { final PutForwardItem putForwardItem = putForwardItems.get(holder.getAdapterPosition()); holder.bindData(putForwardItem); holder.putforwardItem.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(itemClickListener!=null){ itemClickListener.returnId(putForwardItem.getId()); } } }); } @Override public int getItemCount() { return putForwardItems == null ? 0 : putForwardItems.size(); } public class PutForwardItemView extends RecyclerView.ViewHolder { @BindView(R.id.name) TextView name; @BindView(R.id.time) TextView time; @BindView(R.id.price) TextView price; @BindView(R.id.bank_name) TextView bankName; @BindView(R.id.putforward_item) RelativeLayout putforwardItem; public PutForwardItemView(View itemView) { super(itemView); ButterKnife.bind(this, itemView); } public void bindData(PutForwardItem putForwardItem) { if (TextUtils.equals("2", putForwardItem.getType())) { name.setText("能量提现"); price.setText(putForwardItem.getPower() + "个能量"); } else { name.setText("现金提现"); price.setText("¥" + putForwardItem.getPower()); } time.setText(FormatUtil.formatMonthByLine(putForwardItem.getCreatedAt())); bankName.setText(putForwardItem.getCardbank()); } } public interface ItemClickListener { void returnId(String id); } private ItemClickListener itemClickListener; public void setItemClickListener(ItemClickListener itemClickListener) { this.itemClickListener = itemClickListener; } }
[ "921577542@qq.com" ]
921577542@qq.com
2bce901ec0b50c15979ab602ff6de3a4b7085949
c3152f8cca3318531671b04bfb7cecf2861305b4
/springboot-servicio-productos/src/main/java/com/formacionbdi/springboot/app/productos/controllers/ProductoController.java
ac8e94caa3f0e50f9f4ec1ae95eac848086c7f01
[]
no_license
carlosmarin88/pruebaMicroservicio
394791322eed42e811195c0ee8022348794efeff
73740ccce6f647237468e707e909147b8b2bdf1d
refs/heads/master
2022-11-22T05:11:30.861205
2020-07-30T18:14:07
2020-07-30T18:14:07
283,845,544
0
0
null
null
null
null
UTF-8
Java
false
false
2,533
java
package com.formacionbdi.springboot.app.productos.controllers; import java.util.List; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import com.formacionbdi.springboot.app.commons.models.entity.Producto; import com.formacionbdi.springboot.app.productos.models.services.IProductoService; @RestController //esta parte lo va llevar acabo zuul en el rutamiento //@RequestMapping("/productos") public class ProductoController { @Autowired private IProductoService productoService; @Autowired private Environment env; @Value("${server.port}") private Integer port; @GetMapping("/") public List<Producto> listar(){ return productoService.findAll().stream() .map(p->{ //p.setPort(Integer.parseInt(env.getProperty("local.server.port"))); p.setPort(port); return p; }).collect(Collectors.toList()); } @GetMapping("/{id}") public Producto detalle(@PathVariable Long id) throws Exception { Producto producto = productoService.findById(id); //producto.setPort(Integer.parseInt(env.getProperty("local.server.port"))); producto.setPort(port); Thread.sleep(5000L); return producto; } @PostMapping("/") @ResponseStatus(HttpStatus.CREATED) public Producto crear(@RequestBody Producto producto) { return this.productoService.save(producto); } @PutMapping("/{id}") @ResponseStatus(HttpStatus.CREATED) public Producto editar(@RequestBody Producto producto, @PathVariable(required = true) Long id) { Producto productoUpdate = this.productoService.findById(id); productoUpdate.setNombre(producto.getNombre()); productoUpdate.setPrecio(producto.getPrecio()); return this.productoService.save(productoUpdate); } @DeleteMapping("/{id}") @ResponseStatus(HttpStatus.NO_CONTENT) public void eliminar(@PathVariable Long id) { productoService.deleteById(id); } }
[ "carlos.alberto.marin@everis.com" ]
carlos.alberto.marin@everis.com
a51dd676ec68fb6e435c8d4231a0b21377a908f2
e94a5da14ff8726aa3ab471bb212fd6e548e4744
/src/main/java/com/talan/Rh/controllers/HomeController.java
c42732cfc6db056428273c94440aa5f520924c3e
[]
no_license
BenSalem-ChamsEddine/RH
c19d39e68be17f8c64fcf12b6dffcdca271e4a9e
2032d9bd3cb91e69e3607b44006573172ad58a70
refs/heads/master
2021-04-30T15:50:10.241415
2018-02-14T11:03:08
2018-02-14T11:03:08
121,250,591
0
0
null
null
null
null
UTF-8
Java
false
false
5,161
java
package com.talan.Rh.controllers; import com.talan.Rh.entities.Endpoint; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller @RequestMapping("") public class HomeController { public List<Endpoint> getMappings(String type) { List<Endpoint> endpoints = new ArrayList<>(); Map<String, String> map = new HashMap<String, String>(); if ("none".equals(type)) { return null; } if ("candidat".toUpperCase().contains(type.toUpperCase().subSequence(0, type.length()))) { endpoints.add(new Endpoint("Add", "[/candidat/add]", "[POST]", "[candidat]", "[candidat]")); endpoints.add(new Endpoint("Update", "[/candidat/update]", "[PUT]", "[candidat]", "[candidat]")); endpoints.add(new Endpoint("Delete", "[/candidat/delete]", "[DELETE]", "[candidat]", "X")); endpoints.add(new Endpoint("Find All", "[/candidat]", "[GET]", "X", "[candidat[]]")); endpoints.add(new Endpoint("Find By Id", "[/candidat/findbyid/{id}]", "[GET]", "[long id]", "[candidat]")); endpoints.add(new Endpoint("Find By Nom", "[/candidat/findbynom/{nom}]", "[GET]", "[String nom]", "[candidat[]]")); endpoints.add(new Endpoint("Find By Prenom", "[/candidat/findbyprenom/{prenom}]", "[GET]", "[String prenom]", "[candidat[]]")); endpoints.add(new Endpoint("Find By Nom Or Prenom", "[/candidat/findbynomorprenom/{contains}]", "[GET]", "[String contains]", "[candidat[]]")); endpoints.add(new Endpoint("Find By Age", "[/candidat/findbyage/{age}]", "[GET]", "[int age]", "[candidat[]]")); endpoints.add(new Endpoint("Find By Collaborateur", "[/candidat/findbycollaborateur]", "[GET]", "[collaborateur]", "[candidat[]]")); } if ("collaborateur".toUpperCase().contains(type.toUpperCase().subSequence(0, type.length()))) { endpoints.add(new Endpoint("Add", "[/collaborateur/add]", "[POST]", "[collaborateur]", "[collaborateur]")); endpoints.add(new Endpoint("Update", "[/collaborateur/update]", "[PUT]", "[collaborateur]", "[collaborateur]")); endpoints.add(new Endpoint("Delete", "[/collaborateur/delete]", "[DELETE]", "[collaborateur]", "X")); endpoints.add(new Endpoint("Find All", "[/collaborateur]", "[GET]", "X", "[collaborateur[]]")); endpoints.add(new Endpoint("Find By Id", "[/collaborateur/findbyid/{id}]", "[GET]", "[long id]", "[collaborateur]")); endpoints.add(new Endpoint("Find By Nom", "[/collaborateur/findbynom/{nom}]", "[GET]", "[String nom]", "[collaborateur[]]")); endpoints.add(new Endpoint("Find By Prenom", "[/collaborateur/findbyprenom/{prenom}]", "[GET]", "[String prenom]", "[collaborateur[]]")); endpoints.add(new Endpoint("Find By Nom Or Prenom", "[/collaborateur/findbynomorprenom/{contains}]", "[GET]", "[String contains]", "[collaborateur[]]")); endpoints.add(new Endpoint("Find By Age", "[/collaborateur/findbyage/{age}]", "[GET]", "[int age]", "[collaborateur[]]")); endpoints.add(new Endpoint("Find By Candidat", "[/collaborateur/findbycandidat]", "[GET]", "[candidat]", "[collaborateur]")); } if ("manager".toUpperCase().contains(type.toUpperCase().subSequence(0, type.length()))) { endpoints.add(new Endpoint("Add", "[/manager/add]", "[POST]", "[manager]", "[manager]")); endpoints.add(new Endpoint("Update", "[/manager/update]", "[PUT]", "[manager]", "[manager]")); endpoints.add(new Endpoint("Delete", "[/manager/delete]", "[DELETE]", "[manager]", "X")); endpoints.add(new Endpoint("Find All", "[/manager]", "[GET]", "X", "[manager[]]")); endpoints.add(new Endpoint("Find By Id", "[/manager/findbyid/{id}]", "[GET]", "[long id]", "[manager]")); endpoints.add(new Endpoint("Find By Nom", "[/manager/findbynom/{nom}]", "[GET]", "[String nom]", "[manager[]]")); endpoints.add(new Endpoint("Find By Prenom", "[/manager/findbyprenom/{prenom}]", "[GET]", "[String prenom]", "[manager[]]")); endpoints.add(new Endpoint("Find By Nom Or Prenom", "[/manager/findbynomorprenom/{contains}]", "[GET]", "[String contains]", "[manager[]]")); endpoints.add(new Endpoint("Find By Age", "[/manager/findbyage/{age}]", "[GET]", "[int age]", "[candidat[]]")); endpoints.add(new Endpoint("Find By Collaborateur", "[/manager/findbycollaborateur]", "[GET]", "[collaborateur]", "[manager[]]")); } return endpoints; } @RequestMapping public String home(ModelMap model, @RequestParam(value = "type", defaultValue = "none") String type) { System.err.println(type); List<Endpoint> mappings = getMappings(type); model.addAttribute("mappings", mappings); return mappings == null ? "home" : "result"; } }
[ "chbensalem@dom.tti" ]
chbensalem@dom.tti
ce8920574b973ce0d2f542eadaf70728ec18ea07
222bd49ce576cddf238fdd8754c93e866b1998cf
/scalesampark/src/main/java/com/scalesampark/scalesampark/controller/AccountController.java
9e77560e62aaa0625cd84f848c980c7754770132
[]
no_license
ankitpatel2202/ScaleSampark
ca5de871db7888ceb1035930cec2f9be0cf2e578
e689872880ec63f6205efff147e4988fc09fc42e
refs/heads/master
2021-02-27T14:26:50.418335
2020-03-15T09:54:01
2020-03-15T09:54:01
245,612,344
0
0
null
null
null
null
UTF-8
Java
false
false
2,738
java
package com.scalesampark.scalesampark.controller; import com.scalesampark.scalesampark.model.api.RegistrationRequest; import com.scalesampark.scalesampark.model.api.RegistrationResponse; import com.scalesampark.scalesampark.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/account") public class AccountController { @Autowired UserService userService; @RequestMapping( method = RequestMethod.POST) public ResponseEntity<?> create(@RequestBody RegistrationRequest registrationRequest){ //check if request is valid or not if(StringUtils.isEmpty(registrationRequest.getEmail()) || StringUtils.isEmpty(registrationRequest.getNickname())){ return ResponseEntity.badRequest().body("Insufficient request arguments"); } // create a new account String uuid = userService.createUser(registrationRequest); if(StringUtils.isEmpty(uuid)){ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Something went wrong. Please try again..."); } //create response body RegistrationResponse response = new RegistrationResponse(); response.setParticipant_uuid(uuid); return new ResponseEntity<RegistrationResponse>(response, HttpStatus.OK); } @RequestMapping( method = RequestMethod.GET, path = "/{uuid}") public ResponseEntity<?> getAll(@PathVariable String uuid){ //check if request is valid or not if(StringUtils.isEmpty(uuid)){ return ResponseEntity.badRequest().body("Invalid path parameter"); } //first check if valid user or not if(userService.isUserExist(uuid)) { return new ResponseEntity<>(userService.getAllUsers(), HttpStatus.OK); } else { return ResponseEntity.notFound().build(); } } @RequestMapping(method = RequestMethod.DELETE, path = "/{uuid}") public ResponseEntity<?> delete(@PathVariable String uuid){ //check if request is valid or not if(StringUtils.isEmpty(uuid)){ return ResponseEntity.badRequest().body("Invalid path parameter"); } //first check if valid user or not if(userService.isUserExist(uuid)) { userService.removeUser(uuid); return ResponseEntity.ok("User removed successfully"); } else { return ResponseEntity.notFound().build(); } } }
[ "Ankit.Patel@nexusgroup.com" ]
Ankit.Patel@nexusgroup.com
daf8adce7f4fc4a861b8852daca7504c96d823c8
5148293c98b0a27aa223ea157441ac7fa9b5e7a3
/Method_Scraping/xml_scraping/NicadOutputFile_t1_flink_new2/Nicad_t1_flink_new24157.java
ec28144b17dff0f87c3611247c222be2377461a2
[]
no_license
ryosuke-ku/TestCodeSeacherPlus
cfd03a2858b67a05ecf17194213b7c02c5f2caff
d002a52251f5461598c7af73925b85a05cea85c6
refs/heads/master
2020-05-24T01:25:27.000821
2019-08-17T06:23:42
2019-08-17T06:23:42
187,005,399
0
0
null
null
null
null
UTF-8
Java
false
false
500
java
// clone pairs:20349:70% // 29297:flink/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/ScheduledFutureAdapter.java public class Nicad_t1_flink_new24157 { public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ScheduledFutureAdapter<?> that = (ScheduledFutureAdapter<?>) o; return tieBreakerUid == that.tieBreakerUid && scheduleTimeNanos == that.scheduleTimeNanos; } }
[ "naist1020@gmail.com" ]
naist1020@gmail.com
6d8f2c80cea993f4654f3451e1ebbdfe952a2d93
bad2eb5671f0965472dd8e48281c4db952331546
/FSML/sle.fsml.visualisation/src/sle/fsml/visualisation/util/EMFCompareWrapper.java
42f89c1e8a0d930d825ef0746af1aa3782f58084
[]
no_license
lukashaertel/xtext-fsml
56517ac40c90127ee5517c1e5f5b58c21ee80a99
9affc328b003dc5fb69f22ba39e9a428c5866633
refs/heads/master
2021-01-20T11:09:24.726716
2015-05-03T20:55:37
2015-05-03T20:55:37
14,778,067
0
0
null
null
null
null
UTF-8
Java
false
false
4,794
java
package sle.fsml.visualisation.util; import org.eclipse.emf.common.notify.Notifier; import org.eclipse.emf.compare.Comparison; import org.eclipse.emf.compare.Diff; import org.eclipse.emf.compare.EMFCompare; import org.eclipse.emf.compare.EMFCompare.Builder; import org.eclipse.emf.compare.Match; import org.eclipse.emf.compare.diff.DefaultDiffEngine; import org.eclipse.emf.compare.diff.DiffBuilder; import org.eclipse.emf.compare.diff.FeatureFilter; import org.eclipse.emf.compare.diff.IDiffEngine; import org.eclipse.emf.compare.diff.IDiffProcessor; import org.eclipse.emf.compare.match.DefaultComparisonFactory; import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory; import org.eclipse.emf.compare.match.DefaultMatchEngine; import org.eclipse.emf.compare.match.IComparisonFactory; import org.eclipse.emf.compare.match.IMatchEngine; import org.eclipse.emf.compare.match.eobject.IEObjectMatcher; import org.eclipse.emf.compare.match.eobject.IdentifierEObjectMatcher; import org.eclipse.emf.compare.match.impl.MatchEngineFactoryImpl; import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin; import org.eclipse.emf.compare.utils.EMFComparePrettyPrinter; import org.eclipse.emf.compare.utils.UseIdentifiers; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EStructuralFeature; import com.google.common.base.Function; /** * Wrapper around ENF Compare. Override methods for custom matching behavior. * @author Johannes * */ public class EMFCompareWrapper { private final EMFCompare emfCompare; public EMFCompareWrapper() { Function<EObject, String> idFunction = new Function<EObject, String>() { public String apply(EObject input) { return getEObjectIdentifier(input); } }; IEObjectMatcher fallBackMatcher = DefaultMatchEngine.createDefaultEObjectMatcher(getUseIdentifiers()); IEObjectMatcher customIDMatcher = new IdentifierEObjectMatcher(fallBackMatcher, idFunction); IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory()); final IMatchEngine customMatchEngine = new DefaultMatchEngine(customIDMatcher, comparisonFactory); IMatchEngine.Factory engineFactory = new MatchEngineFactoryImpl() { public IMatchEngine getMatchEngine() { return customMatchEngine; } }; IDiffProcessor diffProcessor = new DiffBuilder(); IDiffEngine diffEngine = new DefaultDiffEngine(diffProcessor) { @Override protected FeatureFilter createFeatureFilter() { return new FeatureFilter() { @Override protected boolean isIgnoredReference(Match match, EReference reference) { Boolean r = getIsIgnoredReference(match, reference); if (r == null) return super.isIgnoredReference(match, reference); return r; } @Override public boolean checkForOrderingChanges(EStructuralFeature feature) { Boolean r = getCheckForOrderingChanges(feature); if (r == null) return super.checkForOrderingChanges(feature); return r; } @Override protected boolean isIgnoredAttribute(EAttribute attribute) { Boolean r = getIsIgnoredAttribute(attribute); if (r == null) return super.isIgnoredAttribute(attribute); return r; } }; } }; IMatchEngine.Factory.Registry registry = EMFCompareRCPPlugin.getDefault().getMatchEngineFactoryRegistry(); engineFactory.setRanking(20); registry.add(engineFactory); Builder builder = EMFCompare.builder(); builder.setDiffEngine(diffEngine); builder.setMatchEngineFactoryRegistry(registry); // Create emfcompare instance emfCompare = builder.build(); } protected String getEObjectIdentifier(EObject input) { return null; } protected UseIdentifiers getUseIdentifiers() { return UseIdentifiers.WHEN_AVAILABLE; } protected Boolean getIsIgnoredReference(Match match, EReference reference) { return null; } public Boolean getCheckForOrderingChanges(EStructuralFeature feature) { return null; } protected Boolean getIsIgnoredAttribute(EAttribute attribute) { return null; } public Comparison compare(Notifier left, Notifier right) { return emfCompare.compare(EMFCompare.createDefaultScope(left, right)); } public void print(Comparison c) { EMFComparePrettyPrinter.printComparison(c, System.out); } public void mergeLeftToRight(Comparison c) { for (Diff d : c.getDifferences()) { EMFCompareRCPPlugin.getDefault().getMergerRegistry().getHighestRankingMerger(d).copyLeftToRight(d, null); } } }
[ "johanneshaertel@uni-koblenz.de" ]
johanneshaertel@uni-koblenz.de
05b582485a83f8472689fcfa28ccfac31084bc36
28013109d7412bf224fdca75f70986148bb78319
/icecaptoolstest/src/test/TestDownload1.java
771d6d742abeaca9bdefd2bdf47ebd965497dec3
[]
no_license
scj-devel/hvm-scj
7baf8dcff1595be068de07080e18df39c2ab9386
4d31e231688a7fdaddd464d21a3923b435d11683
refs/heads/master
2021-01-17T00:53:28.349062
2019-02-11T08:18:12
2019-02-11T08:18:12
7,144,984
7
5
null
2018-12-19T14:58:17
2012-12-13T08:30:35
Java
UTF-8
Java
false
false
321
java
package test; import icecaptools.IcecapCompileMe; import vm.VMTest; public class TestDownload1 { public static void main(String[] args) { int sum = test1() + test2(); VMTest.markResult(sum != 42); } @IcecapCompileMe private static int test2() { return 41; } private static int test1() { return 1; } }
[ "sek@viauc.dk" ]
sek@viauc.dk
471f21f048fe1cc37e09d8f03e8a0cdc5bbb3fa6
a6f35bf9a72764ef7305d9afe0a94638bfd5e827
/recyclerview/src/main/java/com/example/recyclerview/Fragment/recycler_linear.java
ca61d0dac216c7ad224988a9fa03f2c9a2598129
[]
no_license
YangWeiHan/MyApplication002
0d0589f8ba74efef38e1d49ac2e757d773b12b17
300586cc6f5cc4f6cd0de8a274e9c2f49c96007e
refs/heads/master
2020-04-10T12:50:05.269998
2018-12-16T13:10:32
2018-12-16T13:10:34
161,033,503
0
0
null
null
null
null
UTF-8
Java
false
false
4,000
java
package com.example.recyclerview.Fragment; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.OrientationHelper; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.example.recyclerview.Adapter.LinearAdapter; import com.example.recyclerview.Bean.UserBean; import com.example.recyclerview.R; public class recycler_linear extends Fragment { private ImageView imageView; private TextView textView; private RecyclerView recyclerView; @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.recycler_linear,container,false); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); recyclerView = view.findViewById(R.id.recyclerView_linear); initView(); } private void initView() { // 写一个 线性布局管理器 LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); //设置方向 这里是垂直 layoutManager.setOrientation(OrientationHelper.VERTICAL); //设置布局管理器 recyclerView.setLayoutManager(layoutManager); //实例化适配器 LinearAdapter linearAdapter = new LinearAdapter(getActivity()); for (int i = 0; i < 10; i++) { UserBean userBean = new UserBean(); // userBean.setName("sgdfsdf" + i); if(i == 0){ userBean.setName("在没风的地方找太阳"); userBean.setImage(R.drawable.zn6); }else if (i == 1){ userBean.setName("在你冷的地方做暖阳"); userBean.setImage(R.drawable.zn5); }else if (i == 2){ userBean.setName("人事纷纷"); userBean.setImage(R.drawable.zn4); }else if (i == 3){ userBean.setName("你总是太天真"); userBean.setImage(R.drawable.zn3); }else if (i == 4){ userBean.setName("往后的余生"); userBean.setImage(R.drawable.zn2); }else if (i == 5){ userBean.setName("往后余生\n" + "风雪是你"); userBean.setImage(R.drawable.zn1); }else if (i == 6){ userBean.setName("春华是你"); userBean.setImage(R.drawable.zn6); }else if (i == 7){ userBean.setName("夏雨也是你\n" + "秋黄是你"); userBean.setImage(R.drawable.zn5); }else if (i == 8){ userBean.setName("四季冷暖是你"); userBean.setImage(R.drawable.zn4); }else if (i == 9){ userBean.setName("目光所致\n" + "也是你"); userBean.setImage(R.drawable.zn3); } linearAdapter.addItem(userBean); } //设置适配器 recyclerView.setAdapter(linearAdapter); //设置分割线 DividerItemDecoration divider = new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL); //添加自定义分割线 divider.setDrawable(ContextCompat.getDrawable(getActivity(),R.drawable.recycler_divider_horizontal)); recyclerView.addItemDecoration(divider); } }
[ "yangweihan@11.com" ]
yangweihan@11.com
fd1af58d8ac36bf20148ee5bdad9477b0f068bad
a23b0c79672b59b7fee2f0730269318d8959ee18
/src/main/java/org/elasticsearch/index/analysis/HindiAnalyzerProvider.java
b0ffb11ef63dad8da4d0feca7425ac313c1f70c3
[ "Apache-2.0" ]
permissive
lemonJun/ESHunt
1d417fc3605be8c5b384c66a5b623dea6ba77a6a
d66ed11d64234e783f67699e643daa77c9d077e3
refs/heads/master
2021-01-19T08:30:47.171304
2017-04-09T06:08:58
2017-04-09T06:08:58
87,639,997
1
0
null
null
null
null
UTF-8
Java
false
false
1,896
java
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch 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.elasticsearch.index.analysis; import org.apache.lucene.analysis.hi.HindiAnalyzer; import org.apache.lucene.analysis.util.CharArraySet; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.assistedinject.Assisted; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.Index; import org.elasticsearch.index.settings.IndexSettings; /** * */ public class HindiAnalyzerProvider extends AbstractIndexAnalyzerProvider<HindiAnalyzer> { private final HindiAnalyzer analyzer; @Inject public HindiAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) { super(index, indexSettings, name, settings); analyzer = new HindiAnalyzer(version, Analysis.parseStopWords(env, settings, HindiAnalyzer.getDefaultStopSet(), version), Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET, version)); } @Override public HindiAnalyzer get() { return this.analyzer; } }
[ "506526593@qq.com" ]
506526593@qq.com
329b52d1a29c642b090e4635cd11c61ca60932f7
b4e4ab3fdaf818b8a48fe945391ae1be74b4008f
/source/utils/utils-common/src/main/java/com/jd/blockchain/utils/concurrent/SyncFutureAdaptor.java
e2655c6548584b5798c3c6da4e9e770cad5273c8
[ "Apache-2.0" ]
permissive
Spark3122/jdchain
78ef86ffdec066a1514c3152b35a42955fa2866d
3378c0321b2fcffa5b91eb9739001784751742c5
refs/heads/master
2020-07-27T20:27:35.258501
2019-09-04T17:51:15
2019-09-04T17:51:15
209,207,377
1
0
Apache-2.0
2019-09-18T03:17:36
2019-09-18T03:17:36
null
UTF-8
Java
false
false
3,452
java
package com.jd.blockchain.utils.concurrent; //package my.utils.concurrent; // ///** // * 用于适配同步操作的 AsyncFuture 实现; // * // * @author haiq // * // * @param <TSource> // */ //public class SyncFutureAdaptor<TSource> implements AsyncFuture<TSource> { // // private TSource source; // // private boolean success = false; // private Throwable exception; // private String errorCode; // // /** // * 创建 SyncFutureAdaptor 实例; // * // * @param source // * 操作对象; // * @param exception // * 操作完成后引发的异常;如果指定为 null 则表示操作成功返回而没有引发异常; // * @param errorCode 错误码 // */ // private SyncFutureAdaptor(TSource source, Throwable exception, String errorCode) { // this.source = source; // this.success = exception == null; // this.exception = exception; // this.errorCode = errorCode; // } // // /** // * 创建表示成功完成操作的 AsyncFuture 实例; // * // * @param source // * 执行操作的对象; // * @return AsyncFuture 实例; // */ // public static <T> AsyncFuture<T> createSuccessFuture(T source) { // return new SyncFutureAdaptor<T>(source, null, null); // } // // /** // * 创建表示操作引发异常返回的 AsyncFuture 实例; // * // * @param source // * 执行操作的对象; // * @param exception // * 操作引发的异常;不允许为 null; // * @return AsyncFuture 实例; // */ // public static <T> AsyncFuture<T> createErrorFuture(T source, Throwable exception) { // if (exception == null) { // throw new IllegalArgumentException("Exception is null!"); // } // return new SyncFutureAdaptor<T>(source, exception, null); // } // // /** // * 创建表示操作引发异常返回的 AsyncFuture 实例; // * // * @param source // * 执行操作的对象; // * @param errorCode // * 操作引发的错误代码; // * @return AsyncFuture 实例; // */ // public static <T> AsyncFuture<T> createErrorFuture(T source, String errorCode) { // if (errorCode == null || errorCode.length() == 0) { // throw new IllegalArgumentException("ErrorCode is empty!"); // } // return new SyncFutureAdaptor<T>(source, null, errorCode); // } // // @Override // public TSource get() { // return source; // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public boolean isSuccess() { // return success; // } // // @Override // public Throwable getException() { // return exception; // } // // // @Override // // public void addListener(AsyncFutureListener<AsyncFuture<TSource>> // // listener) { // // // // } // // @Override // public void await() throws InterruptedException { // return; // } // // @Override // public boolean await(long timeoutMillis) throws InterruptedException { // return true; // } // // @Override // public void awaitUninterruptibly() { // return; // } // // @Override // public boolean awaitUninterruptibly(long timeoutMillis) { // return true; // } // // @Override // public void addListener(AsyncFutureListener<TSource> listener) { // // 同步操作已经完成; // listener.complete(this); // } // // @Override // public String getErrorCode() { // return this.errorCode; // } // //}
[ "huanghaiquan@jd.com" ]
huanghaiquan@jd.com
0ba192f20066c231a47a2e5aaea3151c438d9e4a
9482d51d7c4d5c71d02157d0aa81d74a55136d5a
/src/com/tti/componentes/PerfilComponent.java
a02c2c7842c2169c5e3ac5fc15cd322f52e05fa4
[]
no_license
sejotrance/TTi
50fba759d3d8b6a0cb18bdfec83afe39eaa841f2
df1415144ae61f34a5a615273d0fd536bed0b4f7
refs/heads/master
2021-03-12T19:42:13.610670
2014-01-14T09:26:32
2014-01-14T09:26:32
null
0
0
null
null
null
null
ISO-8859-3
Java
false
false
2,252
java
package com.tti.componentes; import com.vaadin.annotations.AutoGenerated; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.CustomComponent; import com.vaadin.ui.FormLayout; import com.vaadin.ui.Label; import com.vaadin.ui.NativeSelect; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; @SuppressWarnings("serial") public class PerfilComponent extends CustomComponent { /*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ @AutoGenerated private VerticalLayout mainLayout; private String[] campos; private RegionProvinciaComunaComponent comboRPC; private FormLayout formulario; /** * The constructor should first build the main layout, set the * composition root and then do any custom initialization. * * The constructor will not be automatically regenerated by the * visual editor. */ public PerfilComponent(String[] campos) { this.campos = campos; buildMainLayout(this.campos, false); setCompositionRoot(mainLayout); } public PerfilComponent(String[] campos, boolean esLabel) { this.campos = campos; buildMainLayout(this.campos, esLabel); setCompositionRoot(mainLayout); } public String[] getCampos(){ return campos; } @AutoGenerated private VerticalLayout buildMainLayout(String [] campos, boolean esLabel) { // common part: create layout mainLayout = new VerticalLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); mainLayout.setMargin(false); comboRPC = new RegionProvinciaComunaComponent(true); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); formulario = new FormLayout(); for (String fieldName : campos) { if(esLabel){ Label label = new Label(fieldName,ContentMode.HTML); formulario.addComponent(label); }else{ TextField field = new TextField(fieldName); formulario.addComponent(field); field.setWidth("100%"); } if(fieldName == "Dirección"){ formulario.addComponent(comboRPC); } } mainLayout.addComponent(formulario); return mainLayout; } }
[ "mymail@mail.com" ]
mymail@mail.com
0f917614eef45b44bb4e083dbe19e60b9ebcc99d
b0e23507dcf3989031f85fa4b75ebe1129269c8e
/android/app/src/debug/java/com/meregrocerias_27010/ReactNativeFlipper.java
a3da9e37e7d5cdfc4f47f10a9d91f14dd28d0f69
[]
no_license
crowdbotics-apps/meregrocerias-27010
14c8ffc1eeabc4810dcaf4f35ee2e85dc876b8c2
b1c03089d3f40e56263348e38fc01606db78c267
refs/heads/master
2023-04-26T06:05:20.799022
2021-05-20T21:06:50
2021-05-20T21:06:50
369,338,042
0
0
null
null
null
null
UTF-8
Java
false
false
3,274
java
/** * Copyright (c) Facebook, Inc. and its affiliates. * * <p>This source code is licensed under the MIT license found in the LICENSE file in the root * directory of this source tree. */ package com.meregrocerias_27010; import android.content.Context; import com.facebook.flipper.android.AndroidFlipperClient; import com.facebook.flipper.android.utils.FlipperUtils; import com.facebook.flipper.core.FlipperClient; import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; import com.facebook.flipper.plugins.inspector.DescriptorMapping; import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; import com.facebook.flipper.plugins.react.ReactFlipperPlugin; import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; import com.facebook.react.ReactInstanceManager; import com.facebook.react.bridge.ReactContext; import com.facebook.react.modules.network.NetworkingModule; import okhttp3.OkHttpClient; public class ReactNativeFlipper { public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { if (FlipperUtils.shouldEnableFlipper(context)) { final FlipperClient client = AndroidFlipperClient.getInstance(context); client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); client.addPlugin(new ReactFlipperPlugin()); client.addPlugin(new DatabasesFlipperPlugin(context)); client.addPlugin(new SharedPreferencesFlipperPlugin(context)); client.addPlugin(CrashReporterPlugin.getInstance()); NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); NetworkingModule.setCustomClientBuilder( new NetworkingModule.CustomClientBuilder() { @Override public void apply(OkHttpClient.Builder builder) { builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); } }); client.addPlugin(networkFlipperPlugin); client.start(); // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized // Hence we run if after all native modules have been initialized ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); if (reactContext == null) { reactInstanceManager.addReactInstanceEventListener( new ReactInstanceManager.ReactInstanceEventListener() { @Override public void onReactContextInitialized(ReactContext reactContext) { reactInstanceManager.removeReactInstanceEventListener(this); reactContext.runOnNativeModulesQueueThread( new Runnable() { @Override public void run() { client.addPlugin(new FrescoFlipperPlugin()); } }); } }); } else { client.addPlugin(new FrescoFlipperPlugin()); } } } }
[ "team@crowdbotics.com" ]
team@crowdbotics.com
c9e85d648731da5414eccc137b924ff0548bb41a
66836bcdda44217e9fdaa4a6d4e89cd63ebd8690
/src/com/class2/NestedIfAgain.java
6272ab7179a486f55926f4e4bc24159796a955ec
[]
no_license
ArtemLep/Methods
654b95482a2648740421e7a689aae32500e020b6
a612d658e11e915c0afe0d1cc7ae70bcb84a13ea
refs/heads/master
2020-05-05T01:32:11.531484
2019-05-12T18:08:20
2019-05-12T18:08:20
179,606,026
0
0
null
null
null
null
UTF-8
Java
false
false
566
java
package com.class2; public class NestedIfAgain { public static void main(String[] args) { /* * declare var for gpa and having a diploma *if user has a diploma--> congats--> if gpa is higher 3.5-->hire person */ double gpa=3.5; double expectedGpa=3.6; boolean hasDiploma=true; if(hasDiploma) { System.out.println("Congrats"); if(gpa>expectedGpa) { System.out.println("You are hired"); }else { System.out.println("Sorry, we gonna look someone else"); } }else { System.out.println("Please get your degree"); } } }
[ "test.mr.lepinskiy.artem@gmail.com" ]
test.mr.lepinskiy.artem@gmail.com
989479a97796dafc551bf5cb2a4a6d7ba648e86e
4e3a6c485d80dad046177f8a6c575b29b92d55c5
/src/com/hotmail/AdrianSR/ProMaintenanceMode/Bungeecord/Main/MaintenanceMode.java
515402d40cf978f08f0526708c8c05f0b7d4e156
[]
no_license
Isoface/ProMaintenanceMode
b2635b60db8fec8ac1b6f7cd2fccec46fda52a6c
c290d97dc36cecc4f1740329068d676a2b79f2d6
refs/heads/master
2021-04-05T23:47:55.074220
2019-01-23T13:11:46
2019-01-23T13:11:46
124,805,732
2
4
null
null
null
null
UTF-8
Java
false
false
2,838
java
package com.hotmail.AdrianSR.ProMaintenanceMode.Bungeecord.Main; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import com.hotmail.AdrianSR.ProMaintenanceMode.Bungeecord.Utils.Config; import com.hotmail.AdrianSR.ProMaintenanceMode.Bungeecord.Utils.Util; import lombok.Getter; import lombok.Setter; import net.md_5.bungee.api.ChatColor; public class MaintenanceMode { private final Integer time; private final TimeUnit unit; private Integer taskID = null; private @Getter @Setter boolean permanent = false; public ScheduledExecutorService executor; public MaintenanceMode(Integer time, TimeUnit unit) { this.time = time; this.unit = unit; executor = Executors.newScheduledThreadPool(3); } private int remainingTime = 0; public void Start(boolean permanent) { // Start Permanent if (permanent) { this.permanent = permanent; return; } // Start not Permanent if (time != null && time.longValue() > 0) { if (unit != null) { if (taskID == null) { remainingTime = (int) (unit.toSeconds((long)time)); this.permanent = false; taskID = BM.INSTANCE.getProxy().getScheduler().schedule(BM.INSTANCE, new Runnable() { @Override public void run() { remainingTime -= 1; } }, 1L, 1L, TimeUnit.SECONDS).getId(); // Stop Sheduler executor.schedule(new StopSheduler(), time, unit); } else BM.print(ChatColor.RED + "The maintenance mode is already started."); } else BM.print(ChatColor.RED + "Maintenance mode failed to start because the time unit is invalid."); } else BM.print(ChatColor.RED + "Maintenance mode failed to start because the time is invalid."); } private boolean stop = true; public void Stop() { if (taskID != null || permanent) { if (!permanent && taskID != null) { BM.INSTANCE.getProxy().getScheduler().cancel(taskID.intValue()); } BM.print(ChatColor.YELLOW + "The maintenance mode has been disabled."); stop = false; BM.setMaintenanceMode(null); taskID = null; } else BM.print(ChatColor.RED + "The maintenance mode is not started."); } public String getTimeWithFormat() { return permanent ? Config.MOTD_PERMANETN_MM_STRING.toString() : Util.format((((long) remainingTime) * 1000)); } public Integer getTime() { return time; } public long getRemainingTime() { return remainingTime; } public TimeUnit getTimeUnit() { return unit; } public Integer getTaskID() { return taskID; } private class StopSheduler implements Runnable { @Override public void run() { if (stop) { Stop(); } } } }
[ "noreply@github.com" ]
noreply@github.com
eecec870ce4cfcdfa8d0a4c6f6e71c10ab510f82
c87b1441de15f1cb4e7c8fbd737352737a3f508b
/src/view/Main.java
ce67094875e0e613652112f8430981bd0f2c23b9
[]
no_license
PedroLRBezerra/SO_Exercicio_SimularRaid0
82bf08fc8724288c95aab285fa5f3d46737cea53
f91b04d2938c1b4e64e0ac54a57d5f97dcbc4753
refs/heads/master
2022-01-13T06:18:44.694084
2019-06-17T23:55:36
2019-06-17T23:55:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
196
java
package view; import controller.RaidController; public class Main { public static void main(String[] args) { RaidController raid0= new RaidController(2); raid0.saveFileInDisk(250); } }
[ "pedro.luiz@hotmail.com.br" ]
pedro.luiz@hotmail.com.br
55e2d36f43b3f0e0f93b38d5c69431f80fbc07d5
cbdf0d706fb5b27d8a6b2ba583c9ac985594462b
/javaDataTypes.java
e4147d7a3bcb5ac80f45ffade1a6e7f5b7e5a50f
[]
no_license
VKPani/Playground
95b757da44cc65ca63ef6d4d934ccb693795dd09
2cde8e013c34cc025702c8ef810d02a07b1b1b8c
refs/heads/master
2020-03-28T01:57:53.843795
2018-09-05T15:54:25
2018-09-05T15:54:25
147,536,574
0
0
null
null
null
null
UTF-8
Java
false
false
33
java
public class javaDataTypes { }
[ "kodandapani@KP-MacBook-Pro.local" ]
kodandapani@KP-MacBook-Pro.local
8f4a27b056936622aa177f79aae7bcdaa180dc6c
c2ebdc90c547e8c883714ebee8278dd39f1cab5a
/outer-api/src/main/java/cn/edu/xmu/outer/service/IOrderService.java
fd9aa14242a38d5e953160b35db0f44a7a5c998a
[]
no_license
issyu-summer/order
f7f05d4e283bc8e75ece01f442d0d9b8adb773c4
39207788ef065e767d23dec5ed7e555b1e2cb00d
refs/heads/master
2023-03-09T16:21:43.601060
2021-02-25T05:21:54
2021-02-25T05:21:54
342,127,076
0
1
null
null
null
null
UTF-8
Java
false
false
1,062
java
package cn.edu.xmu.outer.service; import cn.edu.xmu.outer.model.bo.*; import java.util.List; public interface IOrderService { /** * 通过orderId/orderItemId(可能更改)列表获得OrderItem列表 * 定时任务1相关 * @return Order对应的OrderItem列表 */ MyReturn<List<OrderItem>> getOrderItems(List<Long> orderIdList); /** * 获得OrderItem的信息 * 填充售后单返回对象 * @param orderItemId * @return */ MyReturn<OrderItemInfo> getOrderItemInfo(Long orderItemId); /** * 完成退款流程 * @return */ MyReturn<Boolean> aftersaleRefund(Long orderItemId); /** * 完成售后换货发货流程 * 传入orderItemId用以订单模块生成新订单 * 需要返回生成的新订单orderId * @return */ MyReturn<Long> aftersaleSendback(Long orderItemId); /** * 判断该订单是否存在 * @author issyu 30320182200070 * @date 2020/12/17 19:39 * @param userId * @param skuId * @return */ MyReturn<Boolean> confirmBought(Long userId,Long skuId); }
[ "2119635988@qq.com" ]
2119635988@qq.com
79307d4ea782243e23fd238c420ee95b6c320097
491ab455d6495d0bcfef51c5e3a10a21a4e20c14
/src/main/java/com/hust/ofornet/mapper/AdminMapper.java
cba297b456d5d877d9d69dee10ed079d85a78b19
[]
no_license
OceaNier/ofornet
42e5d2de29c5ae4cd8fb3c7cd611a48283ba08d8
399496fd5fed4d63fa7cbf8c900327e0b464ac91
refs/heads/master
2022-12-23T00:14:34.543190
2019-07-19T05:52:55
2019-07-19T05:52:55
123,374,588
2
3
null
2018-03-06T01:24:48
2018-03-01T03:05:02
Java
UTF-8
Java
false
false
474
java
package com.hust.ofornet.mapper; import com.hust.ofornet.pojo.Admin; import com.hust.ofornet.pojo.AdminExample; import java.util.List; public interface AdminMapper { int deleteByPrimaryKey(Integer id); int insert(Admin record); int insertSelective(Admin record); List<Admin> selectByExample(AdminExample example); Admin selectByPrimaryKey(Integer id); int updateByPrimaryKeySelective(Admin record); int updateByPrimaryKey(Admin record); }
[ "334011299@qq.com" ]
334011299@qq.com
01a4f89a46cf6719db70df90e4f8863f660b327c
3f3191706f8f07e38d77241526b52b841a189dd1
/qh-web/src/main/java/com/ola/qh/entity/Business.java
0048a50dfbb84df9f5a2338d188b42b0c68a058f
[]
no_license
shijizhongshi/joins
3bc0f807db41217f79cec120e981fb5e1c633559
7c3c642eb6171da37e41bbd51438749d160712f7
refs/heads/master
2022-06-22T14:19:48.276363
2019-05-30T03:37:24
2019-05-30T03:37:24
157,305,930
1
0
null
2022-06-17T02:04:55
2018-11-13T02:09:09
Java
UTF-8
Java
false
false
3,137
java
package com.ola.qh.entity; import java.math.BigDecimal; import java.util.Date; import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.NotEmpty; public class Business { private String id; @NotEmpty private String username; @NotEmpty private String password; @NotEmpty private String logo; @NotNull private String mobile; @NotEmpty private String address; @NotNull private BigDecimal payaccount;/////实际支付的金额 @NotNull private BigDecimal account;////实际课程的金额 private BigDecimal surplusaccount; private String status;////0:正常的状态 private Date addtime; @NotNull private String name;////加盟商的名称 @NotNull private String principal;////加盟商的负责人 private Date expireTime;/////过期时间(用定时任务定位过期时间) private Date updatetime; private String banner;////加盟商学员的banner public String getBanner() { return banner; } public void setBanner(String banner) { this.banner = banner; } public BigDecimal getSurplusaccount() { return surplusaccount; } public void setSurplusaccount(BigDecimal surplusaccount) { this.surplusaccount = surplusaccount; } public Date getUpdatetime() { return updatetime; } public void setUpdatetime(Date updatetime) { this.updatetime = updatetime; } public Date getExpireTime() { return expireTime; } public void setExpireTime(Date expireTime) { this.expireTime = expireTime; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPrincipal() { return principal; } public void setPrincipal(String principal) { this.principal = principal; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getLogo() { return logo; } public void setLogo(String logo) { this.logo = logo; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public BigDecimal getPayaccount() { return payaccount; } public void setPayaccount(BigDecimal payaccount) { this.payaccount = payaccount; } public BigDecimal getAccount() { return account; } public void setAccount(BigDecimal account) { this.account = account; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public Date getAddtime() { return addtime; } public void setAddtime(Date addtime) { this.addtime = addtime; } }
[ "1490359123@qq.com" ]
1490359123@qq.com
7c6bc06bfb11d30e48d6518f2e8f57e1f8c5ec9b
2f37d7cae4264abca12a44b927d39f66a2ea7c79
/agilefantAndroid/src/main/java/com/monits/agilefant/model/DailyWork.java
8454e68755f3217e973ff8b32698a4042e33c82f
[ "BSD-2-Clause" ]
permissive
Monits/AgilefantAndroid
037b987b816346bde37d7ebd13bd1c320c282944
22d6ab5efc549d00f2ec327c4ecc5b941cd07377
refs/heads/master
2020-04-27T08:23:38.954947
2016-02-04T21:52:45
2016-02-05T12:41:14
19,160,597
2
0
null
null
null
null
UTF-8
Java
false
false
1,263
java
package com.monits.agilefant.model; import java.io.Serializable; import java.util.List; import com.google.gson.annotations.SerializedName; public class DailyWork implements Serializable { private static final long serialVersionUID = 2241576318943952740L; @SerializedName("queuedTasks") private List<Task> queuedTasks; @SerializedName("stories") private List<Story> stories; @SerializedName("tasksWithoutStory") private List<Task> taskWithoutStories; /** * @return the queuedTasks */ public List<Task> getQueuedTasks() { return queuedTasks; } /** * @param queuedTasks the queuedTasks to set */ public void setQueuedTasks(final List<Task> queuedTasks) { this.queuedTasks = queuedTasks; } /** * @return the stories */ public List<Story> getStories() { return stories; } /** * @param stories the stories to set */ public void setStories(final List<Story> stories) { this.stories = stories; } /** * @return the taskWithoutStories */ public List<Task> getTaskWithoutStories() { return taskWithoutStories; } /** * @param taskWithoutStories the taskWithoutStories to set */ public void setTaskWithoutStories(final List<Task> taskWithoutStories) { this.taskWithoutStories = taskWithoutStories; } }
[ "gmuniz@monits.com" ]
gmuniz@monits.com
6320b428e4bf608bb06f58c8c21b2141bad79229
d48f88440fcdc9c207da272fb520f55557cf10b5
/RealHeart/app/src/main/java/com/example/root/realheart/Remote/APIService.java
c6aca47820aef2da52ed01be458c91455ff30e22
[]
no_license
amitvhatkar/CS684
406f444bce8a1a85d177ce796e05d29058edc436
74273786c19a9eb5bbc2a3b9e6b5ecfe281bdaf2
refs/heads/master
2020-03-07T03:58:59.156130
2018-04-16T05:29:07
2018-04-16T05:29:07
127,252,913
0
0
null
null
null
null
UTF-8
Java
false
false
709
java
package com.example.root.realheart.Remote; import com.example.root.realheart.Model.MyResponse; import com.example.root.realheart.Model.Sender; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.Headers; import retrofit2.http.POST; /** * Created by root on 14/4/18. */ public interface APIService { @Headers( { "Content-Type:application/json", "Authorization:key=AAAAaSvo1wY:APA91bE-NeXUu9ojnCzIdWU44o56kh2p5sKME918-SrPcfGnPd0SKdi5k5slrNpfMNZ9d4XuXc1_n7Owpzl_CD4adT04zLiJVrKj_F1hTB9MwDpCNLJVDss0Ng2u6lfReOPzXGfJgTdV" } ) @POST("fcm/send") Call<MyResponse> sendNotification(@Body Sender body); }
[ "amit.vhatkar@gmail.com" ]
amit.vhatkar@gmail.com
b57e3bebb7fdb395081a5abe7e2238c64292cc49
336140f7f79d05e78b36a8c398e8e9adaab85ca3
/Responder.java
63a970ba89eb01568990aca01eacd89648b74265
[]
no_license
Nallexander/ASD_Match
09dcc93dc29da75d1541aa3d268f6cfe9b6a87ba
cd3d25db17c36b06f4bb9579c7022f884449749f
refs/heads/master
2020-06-14T07:59:24.182426
2016-12-06T23:13:16
2016-12-06T23:13:16
75,212,953
0
1
null
null
null
null
UTF-8
Java
false
false
750
java
import java.util.List; public class Responder extends User { private List<Skill> skills; private List<Income> incomes; private List<Invitation> invitations; public Responder(String mail){ super(mail); } public Responder(String mail, String phone, String address, String aboutMe) { super(mail, phone, address, aboutMe); } public List<Skill> getSkills(){ return this.skills; } public void sendFeedback(Reception reception){ } public List<Income> getIncome(){ return this.incomes; } public void respond(Reception reception, Invitation invitation){ } public void addInvitaiton(Invitation invitation){ this.invitations.add(invitation); } public void cancelJob(Match match){ } }
[ "noreply@github.com" ]
noreply@github.com
0af46b9a544ea779aef565fc492452d75076b753
3accd26bb8d411ca775f8ed99118aa6b8da7b7c6
/src/main/java/com/check24/film/service/FilmService.java
02b9ac7675c70ddfce5dcec6cd0a7bea514d5ce8
[]
no_license
ramzan-zafar/check24-imdb
b6a126273230c16bb5e48075305bdcbfddf5581f
44b97cc674ab102c68fa8d70de49ab73fd5de899
refs/heads/master
2020-06-19T20:48:39.747895
2019-07-15T12:53:03
2019-07-15T12:53:03
196,866,462
0
0
null
null
null
null
UTF-8
Java
false
false
812
java
package com.check24.film.service; import java.util.List; import com.check24.common.model.transport.film.dto.FilmDto; import com.check24.common.model.transport.rating.dto.RatingDto; /** * Film Service * @author Ramzan_Zafar */ public interface FilmService { /** * Method to find all films * @return list of {@link FilmDto} */ List<FilmDto> findAllFilms(); /** * Method to find all film by given name * @param name * @return list of matching {@link FilmDto} against provided name */ List<FilmDto> findAllFilmByName(String name); /** * Method to rate a film against provided rating * @param rating {@link RatingDto} * @return {@link FilmDto} */ FilmDto rateFilm(RatingDto rating); }
[ "ramzan.zafar@gmail.com" ]
ramzan.zafar@gmail.com
3f57ad4ee8f54dd99c27c10b751d905466720966
d259cd278c7f6cdc595dad690ddb398c602a85a7
/src/main/java/com/geekbrains/Main.java
d40cdf5416d8d09959082df90832d1e1cf6a5173
[]
no_license
Shnopic/java-1-hw-2
041c61aba4e56e733c0657c43f0cbd9e5cb83a85
42a83f4d8ef289a2ea94ae032cacbec9426af78c
refs/heads/master
2023-08-28T11:16:19.099076
2021-11-15T11:23:50
2021-11-15T11:23:50
428,227,106
0
0
null
null
null
null
UTF-8
Java
false
false
1,312
java
package com.geekbrains; public class Main { public static void main(String[] args) { within10and20(5,7); isNegativeOrPositive(4); isNegative(3); lineTimes("Сложный",2); year(800); } public static boolean within10and20(int a, int b) { int sum = a + b; if (sum >= 10 && sum<=20) { return true; } else { return false; } } public static void isNegativeOrPositive(int a){ if (a>=0) { System.out.println("Positive"); } else { System.out.println("Negative"); } } public static boolean isNegative(int a){ if (a<0){ return true; } else { return false; } } public static void lineTimes(String line, int a) { for (int i=0; i<a; i++) { System.out.println(line); } } public static boolean year(int a){ int multiple400 = a % 400; int multiple100 = a % 100; int multiple4 = a % 4; if (multiple400 == 0) { return true; } else if (multiple100 == 0 ) { return false; } else if (multiple4 == 0) { return true; } else { return false; } } }
[ "egor12887@gmail.com" ]
egor12887@gmail.com
8fc1c0f5c2410d0de6d0ce6287e7feb3e3792da7
65454c7a96fd614c4e2fb97423d3bfdad2adbcc7
/mall-ware/src/main/java/com/sunzhen/mall/ware/service/WareOrderTaskDetailService.java
3f170456fef2a81e86237ab90b2692fe2c0c914b
[ "Apache-2.0" ]
permissive
S-Zhen/mall
380091a8adb95b9a5f9824cae2235fbf3de305c0
1d8573e0312ebb2a9187ad64a0219ee8a0b04fd1
refs/heads/main
2023-02-08T06:42:39.764267
2021-01-04T11:48:03
2021-01-04T11:48:03
325,917,530
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
package com.sunzhen.mall.ware.service; import com.baomidou.mybatisplus.extension.service.IService; import com.sunzhen.common.utils.PageUtils; import com.sunzhen.mall.ware.entity.WareOrderTaskDetailEntity; import java.util.Map; /** * 库存工作单 * * @author sunzhen * @email 1025951770@qq.com * @date 2021-01-02 00:47:31 */ public interface WareOrderTaskDetailService extends IService<WareOrderTaskDetailEntity> { PageUtils queryPage(Map<String, Object> params); }
[ "1025951770@qq.com" ]
1025951770@qq.com
fd9fd06b494cf92a6c70c659a69dce7d87c7a22a
a5060b77d9635c22be8455338505522daaaccbcb
/src/com/report_member/model/ReportMemberVO.java
757076e866292a4046493439955f422af9d1e9e1
[]
no_license
EricChiu106/BA104G2
3d623ddbee3b944f09a7cbeb40ad8787ea167499
4c6d3a631e68eecf1bf50048f21682501f68b5db
refs/heads/master
2021-08-27T21:24:01.955745
2017-12-10T11:04:42
2017-12-10T11:04:42
113,743,219
0
1
null
null
null
null
UTF-8
Java
false
false
1,725
java
package com.report_member.model; import java.util.Date; public class ReportMemberVO implements java.io.Serializable{ private String rpt_mnum; private String mem_num; private String mem_num2; private String sto_num; private String com_num; private Date rpt_time; private String status; private String staff_num; private Integer score; private String way; private String content; public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getRpt_mnum() { return rpt_mnum; } public void setRpt_mnum(String rpt_mnum) { this.rpt_mnum = rpt_mnum; } public String getMem_num() { return mem_num; } public void setMem_num(String mem_num) { this.mem_num = mem_num; } public String getMem_num2() { return mem_num2; } public void setMem_num2(String mem_num2) { this.mem_num2 = mem_num2; } public String getSto_num() { return sto_num; } public void setSto_num(String sto_num) { this.sto_num = sto_num; } public String getCom_num() { return com_num; } public void setCom_num(String com_num) { this.com_num = com_num; } public Date getRpt_time() { return rpt_time; } public void setRpt_time(Date rpt_time) { this.rpt_time = rpt_time; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getStaff_num() { return staff_num; } public void setStaff_num(String staff_num) { this.staff_num = staff_num; } public Integer getScore() { return score; } public void setScore(Integer score) { this.score = score; } public String getWay() { return way; } public void setWay(String way) { this.way = way; } }
[ "sa781006@gmail.com" ]
sa781006@gmail.com
d094e797c657b937b842eec5c963a92da32a357a
de6aa470434a87a801f657479444d75204f715a0
/src/main/java/com/schoolTao/mapper/TReplyMapper.java
7615a24bb0f84ff828ca29d89522f0ddd1542fdf
[]
no_license
keywordwei/schoolTao
adeb0dc12cc043b475e219e0186fe7557c6aa855
c91dc25c02ed19de6fe7e1456730f29bfaf5892a
refs/heads/master
2022-12-21T21:49:01.785097
2019-08-21T14:01:08
2019-08-21T14:01:08
203,363,690
0
0
null
2022-12-16T03:28:08
2019-08-20T11:37:24
Java
UTF-8
Java
false
false
643
java
package com.schoolTao.mapper; import com.schoolTao.model.TReply; import com.schoolTao.model.TReplyExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface TReplyMapper { int countByExample(TReplyExample example); int deleteByExample(TReplyExample example); int insert(TReply record); int insertSelective(TReply record); List<TReply> selectByExample(TReplyExample example); int updateByExampleSelective(@Param("record") TReply record, @Param("example") TReplyExample example); int updateByExample(@Param("record") TReply record, @Param("example") TReplyExample example); }
[ "weiqin199711@163.com" ]
weiqin199711@163.com
3f5021fbe6f6c6576f7325906996bb6542a35166
d200639e994ddb8447c12bf89f47c78792e03818
/emojiapp/app/src/main/java/com/example/android/emojify/MainActivity.java
5dd7fb96eee4eee97e6095b3a3f844ef20e1ea75
[]
no_license
Jasmine424/EmojiApp
4639fd0a3208d98069ee50485b0682a77c9eae54
5b8363adac54e39cfb1a8f15ebe74b361210df24
refs/heads/master
2021-06-21T09:00:24.265231
2017-07-03T07:39:28
2017-07-03T07:39:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,237
java
/* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.emojify; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v4.content.FileProvider; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import java.io.File; import java.io.IOException; public class MainActivity extends AppCompatActivity { private static final int REQUEST_IMAGE_CAPTURE = 1; private static final int REQUEST_STORAGE_PERMISSION = 1; private static final String FILE_PROVIDER_AUTHORITY = "com.example.android.fileprovider"; private ImageView mImageView; private Button mEmojifyButton; private FloatingActionButton mShareFab; private FloatingActionButton mSaveFab; private FloatingActionButton mClearFab; private TextView mTitleTextView; private String mTempPhotoPath; private Bitmap mResultsBitmap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Bind the views mImageView = (ImageView) findViewById(R.id.image_view); mEmojifyButton = (Button) findViewById(R.id.emojify_button); mShareFab = (FloatingActionButton) findViewById(R.id.share_button); mSaveFab = (FloatingActionButton) findViewById(R.id.save_button); mClearFab = (FloatingActionButton) findViewById(R.id.clear_button); mTitleTextView = (TextView) findViewById(R.id.title_text_view); } /** * OnClick method for "Emojify Me!" Button. Launches the camera app. * * @param view The emojify me button. */ public void emojifyMe(View view) { // Check for the external storage permission if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { // If you do not have permission, request it ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE_PERMISSION); } else { // Launch the camera if the permission exists launchCamera(); } } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { // Called when you request permission to read and write to external storage switch (requestCode) { case REQUEST_STORAGE_PERMISSION: { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // If you get permission, launch the camera launchCamera(); } else { // If you do not get permission, show a Toast Toast.makeText(this, R.string.permission_denied, Toast.LENGTH_SHORT).show(); } break; } } } /** * Creates a temporary image file and captures a picture to store in it. */ private void launchCamera() { // Create the capture image intent Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // Ensure that there's a camera activity to handle the intent if (takePictureIntent.resolveActivity(getPackageManager()) != null) { // Create the temporary File where the photo should go File photoFile = null; try { photoFile = BitmapUtils.createTempImageFile(this); } catch (IOException ex) { // Error occurred while creating the File ex.printStackTrace(); } // Continue only if the File was successfully created if (photoFile != null) { // Get the path of the temporary file mTempPhotoPath = photoFile.getAbsolutePath(); // Get the content URI for the image file Uri photoURI = FileProvider.getUriForFile(this, FILE_PROVIDER_AUTHORITY, photoFile); // Add the URI so the camera can store the image takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI); // Launch the camera activity startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE); } } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // If the image capture activity was called and was successful if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) { // Process the image and set it to the TextView processAndSetImage(); } else { // Otherwise, delete the temporary image file BitmapUtils.deleteImageFile(this, mTempPhotoPath); } } /** * Method for processing the captured image and setting it to the TextView. */ private void processAndSetImage() { // Toggle Visibility of the views mEmojifyButton.setVisibility(View.GONE); mTitleTextView.setVisibility(View.GONE); mSaveFab.setVisibility(View.VISIBLE); mShareFab.setVisibility(View.VISIBLE); mClearFab.setVisibility(View.VISIBLE); // Resample the saved image to fit the ImageView mResultsBitmap = BitmapUtils.resamplePic(this, mTempPhotoPath); // Detect the faces Emojifier.detectFacesAndOverlayEmoji(this, mResultsBitmap); // Set the new bitmap to the ImageView mImageView.setImageBitmap(mResultsBitmap); } /** * OnClick method for the save button. * * @param view The save button. */ public void saveMe(View view) { // Delete the temporary image file BitmapUtils.deleteImageFile(this, mTempPhotoPath); // Save the image BitmapUtils.saveImage(this, mResultsBitmap); } /** * OnClick method for the share button, saves and shares the new bitmap. * * @param view The share button. */ public void shareMe(View view) { // Delete the temporary image file BitmapUtils.deleteImageFile(this, mTempPhotoPath); // Save the image BitmapUtils.saveImage(this, mResultsBitmap); // Share the image BitmapUtils.shareImage(this, mTempPhotoPath); } /** * OnClick for the clear button, resets the app to original state. * * @param view The clear button. */ public void clearImage(View view) { // Clear the image and toggle the view visibility mImageView.setImageResource(0); mEmojifyButton.setVisibility(View.VISIBLE); mTitleTextView.setVisibility(View.VISIBLE); mShareFab.setVisibility(View.GONE); mSaveFab.setVisibility(View.GONE); mClearFab.setVisibility(View.GONE); // Delete the temporary image file BitmapUtils.deleteImageFile(this, mTempPhotoPath); } }
[ "flowrathesky@gmail.com" ]
flowrathesky@gmail.com
c538026ab5ea4729231cc7a473046dc58d3229cf
f13b8db3b8c52ff93da9aae5123e912fdf81ca3e
/app/src/test/java/com/github/moreno/stephania/githubuser/ExampleUnitTest.java
6c66b90135a096a09c97c84fd83a742ada1691d8
[]
no_license
stefitufi/GitHubRepository
fbb6094ff37473625b9b0194e2ca66ecd540ffa8
112eefdb7a761174804942682016d82c1a523a67
refs/heads/master
2020-03-28T04:21:01.091229
2018-09-06T17:05:11
2018-09-06T17:05:11
147,709,085
0
0
null
null
null
null
UTF-8
Java
false
false
399
java
package com.github.moreno.stephania.githubuser; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "stephania.moreno@tecna-ice.com" ]
stephania.moreno@tecna-ice.com
16c9308fa200cca5bdbcf7373b70ae0b446a357b
682bfd40c3cc651a6196e8e368696e930370a618
/kartoteks-service/src/main/java/ekol/kartoteks/serializers/IdNameSerializer.java
8252951b0290244b7a88e77100f143c72370d8a3
[]
no_license
seerdaryilmazz/OOB
3b27b67ce1cbf3f411f7c672d0bed0d71bc9b127
199f0c18b82d04569d26a08a1a4cd8ee8c7ba42d
refs/heads/master
2022-12-30T09:23:25.061974
2020-10-09T13:14:39
2020-10-09T13:14:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,124
java
package ekol.kartoteks.serializers; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import ekol.kartoteks.domain.IdNameSerializable; import java.io.IOException; /** * Created by kilimci on 25/06/16. */ public class IdNameSerializer extends JsonSerializer<IdNameSerializable> { @Override public Class<IdNameSerializable> handledType() { return IdNameSerializable.class; } @Override public void serialize(IdNameSerializable idName, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { if(idName == null){ return; } jsonGenerator.writeStartObject(); jsonGenerator.writeFieldName("id"); if(idName.getId() == null){ jsonGenerator.writeNull(); }else{ jsonGenerator.writeNumber(idName.getId()); } jsonGenerator.writeFieldName("name"); jsonGenerator.writeString(idName.getName()); jsonGenerator.writeEndObject(); } }
[ "dogukan.sahinturk@ekol.com" ]
dogukan.sahinturk@ekol.com
6e099ccacf4e450ceed9cdf47da12091381e4c88
912bc4335ce933982177ec34717efdc289827348
/src/main/java/com/example/docureader/model/I9/SubRow2.java
999ef34a3addf5994ab3cc2a1215065dfd7a3f62
[]
no_license
Srujith/docureader
6bb426365a9d393d2335d370c74cba20d77e5a1c
3f141b9e401a40391eb66a5e923b9a91c1c177f4
refs/heads/master
2022-04-17T02:36:02.940567
2020-04-13T19:29:27
2020-04-13T19:29:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,674
java
package com.example.docureader.model.I9; import java.util.HashMap; import java.util.Map; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "textFieldLastName", "textFieldFirstName" }) public class SubRow2 { @JsonProperty("textFieldLastName") private Object textFieldLastName; @JsonProperty("textFieldFirstName") private Object textFieldFirstName; @JsonIgnore private Map<String, Object> additionalProperties = new HashMap<String, Object>(); @JsonProperty("textFieldLastName") public Object getTextFieldLastName() { return textFieldLastName; } @JsonProperty("textFieldLastName") public void setTextFieldLastName(Object textFieldLastName) { this.textFieldLastName = textFieldLastName; } @JsonProperty("textFieldFirstName") public Object getTextFieldFirstName() { return textFieldFirstName; } @JsonProperty("textFieldFirstName") public void setTextFieldFirstName(Object textFieldFirstName) { this.textFieldFirstName = textFieldFirstName; } @JsonAnyGetter public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; } @JsonAnySetter public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } }
[ "iamcloudkraken@gmail.com" ]
iamcloudkraken@gmail.com
bc0a5e751773a7b66634eaaf876adaff6d597434
8ca7ef4c866548a0adeb204ba3791b278d230cc6
/src/CompetetiveProgramming/Hackerrank/Stack/BalancedBrackets.java
44799a690a491e1cd95f73ac2d3a6e2285292406
[]
no_license
codedsun/PrePractice
ed71f00249c8a581a5806f6e4fb56e1a294c2933
74cb0c4b2806af37e5eea43784e5fd6ef111af33
refs/heads/master
2021-04-15T10:50:23.983363
2018-09-26T16:24:04
2018-09-26T16:24:04
126,486,939
0
0
null
null
null
null
UTF-8
Java
false
false
1,413
java
package CompetetiveProgramming.Hackerrank.Stack; import java.util.Scanner; import java.util.Stack; /* https://www.hackerrank.com/challenges/balanced-brackets/problem */ public class BalancedBrackets { static boolean match(char a, char b){ if(a=='(' && b==')') return true; if(a=='[' && b==']') return true; return a == '{' && b == '}'; } static String isBalanced(String s) { // Complete this function Stack<Character> stack = new Stack(); String input = "({["; String output=")}]"; for(int i = 0;i<s.length();i++){ char ch = s.charAt(i); if(input.contains(ch+"")){ stack.push(ch); } else if(output.contains(ch+"")){ if(stack.isEmpty()){ return "NO"; } else if(!match(stack.pop(),ch)){ return "NO"; } } } if(stack.isEmpty()) { return "YES"; } else{ return "NO"; } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int a0 = 0; a0 < t; a0++){ String s = in.next(); String result = isBalanced(s); System.out.println(result); } in.close(); } }
[ "suneetbond91@gmail.com" ]
suneetbond91@gmail.com
e0fa3f3a9041706939d09317cad9f46d59203ae8
275c3c960975e01072db7685227128845a43f6b7
/android-yichat/app/src/main/java/com/htmessage/yichat/acitivity/chat/ChatContract.java
ae795628df75150446831765ae3eebfbb2374331
[]
no_license
ly032/YiChat
d3261ce383610257b838aea307a1a628865a10b3
a6b0e428ae2e401915f7d23da58558d4c8a20cad
refs/heads/master
2023-09-04T07:37:01.974570
2021-10-15T05:57:04
2021-10-15T05:57:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,488
java
package com.htmessage.yichat.acitivity.chat; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import com.alibaba.fastjson.JSONObject; import com.htmessage.sdk.model.HTMessage; import com.htmessage.yichat.acitivity.BasePresenter; import com.htmessage.yichat.acitivity.BaseView; import java.util.List; /** * Created by dell on 2017/7/1. */ public interface ChatContract { interface View extends BaseView<Presenter> { void showToast(int resId); void insertRecyclerView(int position, int count,int type); void updateRecyclerView(int position ); void loadMoreMessageRefresh(int position, int count); void initRecyclerView(List<HTMessage> messageList); void deleteItemRecyclerView(int position); //清空聊天记录刷新 void notifyClear(); void startToDialogRP(JSONObject jsonObject); void startToDetailRp(JSONObject jsonObject); void onGroupInfoLoaded(); void showNewNoticeDialog(String title, String content, String id); void setAtUserStytle(String realNick,boolean isChooseFromList); } interface Presenter extends BasePresenter { void sendZhenMessage(); void initData(Bundle bundle); void loadMoreMessages(); void sendTextMessage(String content); void selectPicFromCamera(Activity activity); void selectPicFromLocal(Activity activity); void onResult(int requestCode, int resultCode, Intent data, Context context); void sendVoiceMessage(String voiceFilePath, int voiceTimeLength); void resendMessage(HTMessage htMessage); void deleteSingChatMessage(HTMessage htMessage); void withdrowMessage(HTMessage htMessage, int position); void onMessageWithdrow(HTMessage htMessage); void onNewMessage(HTMessage htMessage); void onMeesageForward(HTMessage htMessage); void onMessageClear(); void onOpenRedpacket(HTMessage htMessage,String packetId); void sendRedCmdMessage(String whoisRed,String msgId); void getGroupInfoInServer(String groupId); void startCardSend(Activity activity); void setAtUser(String nick,String userId); boolean isHasAt(String userId); boolean isHasAtNick(String nick); void startChooseAtUser(); void deleteAtUser(String nick); void refreshHistory(); } }
[ "rb@mail.com" ]
rb@mail.com
e69e3691994893421d23362b732727c15c8c407b
d461286b8aa5d9606690892315a007062cb3e0f3
/src/main/java/com/ziaan/study/ReportPaperBean.java
b8e7ce6fc1a6226817af528f7779df5d6b87bcce
[]
no_license
leemiran/NISE_DEV
f85b26c78aaa5ffadc62c0512332c9bdfe5813b6
6b618946945d8afa08826cb98b5359f295ff0c73
refs/heads/master
2020-08-07T05:04:38.474163
2019-10-10T01:55:33
2019-10-10T01:55:33
212,016,199
0
0
null
null
null
null
UHC
Java
false
false
71,580
java
// ********************************************************** // 1. 제 목: PROJECT ADMIN BEAN // 2. 프로그램명: ProjectAdminBean.java // 3. 개 요: 과제 관리자 bean // 4. 환 경: JDK 1.3 // 5. 버 젼: 1.0 // 6. 작 성: // 7. 수 정: 2005. 11.24 이경배 // ********************************************************** package com.ziaan.study; import java.io.File; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; import com.ziaan.library.CalcUtil; import com.ziaan.library.ConfigSet; import com.ziaan.library.DBConnectionManager; import com.ziaan.library.DataBox; import com.ziaan.library.ErrorManager; import com.ziaan.library.FileManager; import com.ziaan.library.FormMail; import com.ziaan.library.FormatDate; import com.ziaan.library.ListSet; import com.ziaan.library.Log; import com.ziaan.library.MailSet; import com.ziaan.library.RequestBox; import com.ziaan.library.SQLString; import com.ziaan.library.StringManager; import com.ziaan.research.SulmunAllBean; import com.ziaan.system.SelectionUtil; public class ReportPaperBean { public ReportPaperBean() { } /** * 리포트출제관리 과정기수별 리포트 출제 현황 * @param box * @return * @throws Exception */ /** 과목별 과제 그룹 리스트 @param box receive from the form object and session @return ArrayList */ public ArrayList selectReportPaperPeriod(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls = null; String sql = ""; DataBox dbox = null; ArrayList list = null; String v_subj = box.getString("s_subjcourse"); // 과목 String v_year = box.getString("s_gyear"); // 년도 String v_subjseq = box.getString("s_subjseq"); // 과목기수 try { connMgr = new DBConnectionManager(); list = new ArrayList(); sql = " SELECT SUBJ, SUBJNM \n"; sql += " ,MREPORT_START \n"; sql += " ,MREPORT_END \n"; sql += " ,FREPORT_START \n"; sql += " ,FREPORT_END \n"; sql += " FROM TZ_SUBJSEQ \n"; sql += " WHERE SUBJ = " + StringManager.makeSQL(v_subj)+" \n"; sql += " AND YEAR = " + StringManager.makeSQL(v_year)+" \n"; sql += " AND SUBJSEQ = " + StringManager.makeSQL(v_subjseq)+" \n"; ls = connMgr.executeQuery(sql); if ( ls.next() ) { dbox = ls.getDataBox(); list.add(dbox); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; } /** * 과제 문제 등록전 과목 리스트 * @param box * @return * @throws Exception */ public ArrayList selectReportQuestionsAList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls1 = null; ListSet ls2 = null; ArrayList list1 = null; ArrayList list2 = null; String sql1 = ""; String sql2 = ""; ReportData data1 = null; ReportData data2 = null; String v_Bcourse = ""; // 이전코스 String v_course = ""; // 현재코스 String v_Bcourseseq= ""; // 이전코스기수 String v_courseseq = ""; // 현재코스기수 int l = 0; //String ss_grcode = box.getStringDefault("s_grcode","ALL"); // 교육그룹 //String ss_gyear = box.getStringDefault("s_gyear","ALL"); // 년도 //String ss_grseq = box.getStringDefault("s_grseq","ALL"); // 교육기수 String ss_uclass = box.getStringDefault("s_upperclass","ALL"); // 과목분류 String ss_mclass = box.getStringDefault("s_middleclass","ALL"); // 과목분류 String ss_lclass = box.getStringDefault("s_lowerclass","ALL"); // 과목분류 String ss_subjcourse=box.getStringDefault("s_subjcourse","ALL");// 과목&코스 //String ss_subjseq = box.getStringDefault("s_subjseq","ALL"); // 과목 기수 String ss_action = box.getString("s_action"); String v_orderColumn = box.getString("p_orderColumn"); // 정렬할 컬럼명 String v_orderType = box.getString("p_orderType"); // 정렬할 순서 try { if ( ss_action.equals("go") ) { connMgr = new DBConnectionManager(); list1 = new ArrayList(); list2 = new ArrayList(); // select course,cyear,courseseq,coursenm,subj,year,subjseq,isclosed,subjnm,isonoff /* sql1 = "select distinct "; sql1 += " "; sql1 += " "; sql1 += " "; sql1 += " a.subj,"; sql1 += " a.year,"; sql1 += " a.subjseq,"; sql1 += " a.subjseqgr,"; sql1 += " a.isclosed,"; sql1 += " a.subjnm,"; sql1 += " a.isonoff, "; sql1 += " a.edustart, "; // 교육기간 시작일 sql1 += " a.eduend, "; // 교육기간 마감일 sql1 += " (select classname from tz_subjatt WHERE upperclass=a.scupperclass and middleclass = '000' and lowerclass = '000') classname, "; //sql1 += " (select count(distinct projseq) from tz_projord where subj=a.subj and year=a.year and subjseq=a.subjseq) projseqcnt, "; //sql1 += " (select count(ordseq) from tz_projord where subj=a.subj and year=a.year and subjseq=a.subjseq) ordseqcnt "; sql1 += " 0 projseqcnt, "; sql1 += " 0 ordseqcnt "; sql1 += "from VZ_SCSUBJSEQ a where 1 = 1 "; if ( !ss_grcode.equals("ALL") ) { //교육그룹 sql1 += " and a.grcode = '" + ss_grcode + "'"; } if ( !ss_gyear.equals("ALL") ) { //년도 sql1 += " and a.gyear = '" + ss_gyear + "'"; } if ( !ss_grseq.equals("ALL") ) { // 교육기수 sql1 += " and a.grseq = '" + ss_grseq + "'"; } if ( !ss_uclass.equals("ALL") ) { //대분류 sql1 += " and a.scupperclass = '" + ss_uclass + "'"; } if ( !ss_mclass.equals("ALL") ) { //중분류 sql1 += " and a.scmiddleclass = '" + ss_mclass + "'"; } if ( !ss_lclass.equals("ALL") ) { //소분류 sql1 += " and a.sclowerclass = '" + ss_lclass + "'"; } if ( !ss_subjcourse.equals("ALL") ) { //코스 KT는 안쓴다. sql1 += " and a.scsubj = '" + ss_subjcourse + "'"; } if ( !ss_subjseq.equals("ALL") ) { //과정기수 sql1 += " and a.scsubjseq = '" + ss_subjseq + "'"; } if ( v_orderColumn.equals("") ) { sql1 += " order by a.subj, a.year, a.subjseq "; } else { sql1 += " order by " + v_orderColumn + v_orderType; } ls1 = connMgr.executeQuery(sql1); while ( ls1.next() ) { data1 = new ReportData(); data1.setClassname( ls1.getString("classname") ); //data1.setCourse( ls1.getString("course") ); //data1.setCyear( ls1.getString("cyear") ); //data1.setCourseseq( ls1.getString("courseseq") ); //data1.setCoursenm( ls1.getString("coursenm") ); data1.setSubj( ls1.getString("subj") ); data1.setYear( ls1.getString("year") ); data1.setSubjseq( ls1.getString("subjseq") ); data1.setSubjseqgr( ls1.getString("subjseqgr") ); data1.setSubjnm( ls1.getString("subjnm") ); data1.setProjseqcnt( ls1.getInt("projseqcnt") ); data1.setOrdseqcnt( ls1.getInt("ordseqcnt") ); data1.setIsclosed( ls1.getString("isclosed") ); data1.setIsonoff( ls1.getString("isonoff") ); data1.setEdustart( ls1.getString("edustart") ); data1.setEduend( ls1.getString("eduend") ); list1.add(data1); } for ( int i = 0;i < list1.size(); i++ ) { data2 = (ReportData)list1.get(i); v_course = data2.getCourse(); v_courseseq = data2.getCourseseq(); if ( !v_course.equals("000000") && !(v_Bcourse.equals(v_course) && v_Bcourseseq.equals(v_courseseq))) { sql2 = "select count(subj) cnt from VZ_SCSUBJSEQ "; sql2 += "where course = '" + v_course + "' and courseseq = '" +v_courseseq + "' "; if ( !ss_grcode.equals("ALL") ) { sql2 += " and grcode = '" + ss_grcode + "'"; } if ( !ss_gyear.equals("ALL") ) { sql2 += " and gyear = '" + ss_gyear + "'"; } if ( !ss_grseq.equals("ALL") ) { sql2 += " and grseq = '" + ss_grseq + "'"; } if ( !ss_uclass.equals("ALL") ) { sql2 += " and scupperclass = '" + ss_uclass + "'"; } if ( !ss_mclass.equals("ALL") ) { sql2 += " and scmiddleclass = '" + ss_mclass + "'"; } if ( !ss_lclass.equals("ALL") ) { sql2 += " and sclowerclass = '" + ss_lclass + "'"; } if ( !ss_subjcourse.equals("ALL") ) { sql2 += " and scsubj = '" + ss_subjcourse + "'"; } if ( !ss_subjseq.equals("ALL") ) { sql2 += " and scsubjseq = '" + ss_subjseq + "'"; } // System.out.println("sql2 == == == == == == > " +sql2); ls2 = connMgr.executeQuery(sql2); if ( ls2.next() ) { data2.setRowspan( ls2.getInt("cnt") ); data2.setIsnewcourse("Y"); } } else { data2.setRowspan(0); data2.setIsnewcourse("N"); } v_Bcourse = v_course; v_Bcourseseq= v_courseseq; list2.add(data2); if ( ls2 != null ) { try { ls2.close(); } catch ( Exception e ) { } } }*/ sql1 = " select subj , subjnm , "; sql1 += " (select classname from tz_subjatt WHERE upperclass=a.upperclass and middleclass = '000' and lowerclass = '000') classname, "; //sql1 += " (select count(distinct projseq) from tz_projord where subj=a.subj and year=a.year and subjseq=a.subjseq) projseqcnt, "; sql1 += " (select count(ordseq) from tz_projord where subj=a.subj) ordseqcnt "; sql1 += " from tz_subj a where 1 = 1 "; if ( !ss_uclass.equals("ALL") ) { //대분류 sql1 += " and a.upperclass = '" + ss_uclass + "'"; } if ( !ss_mclass.equals("ALL") ) { //중분류 sql1 += " and a.middleclass = '" + ss_mclass + "'"; } if ( !ss_lclass.equals("ALL") ) { //소분류 sql1 += " and a.lowerclass = '" + ss_lclass + "'"; } if ( !ss_subjcourse.equals("ALL") ) { sql1 += " and subj = '" + ss_subjcourse + "'"; } ls1 = connMgr.executeQuery(sql1); while ( ls1.next() ) { data1 = new ReportData(); data1.setClassname( ls1.getString("classname") ); //data1.setCourse( ls1.getString("course") ); //data1.setCyear( ls1.getString("cyear") ); //data1.setCourseseq( ls1.getString("courseseq") ); //data1.setCoursenm( ls1.getString("coursenm") ); data1.setSubj( ls1.getString("subj") ); //data1.setYear( ls1.getString("year") ); //data1.setSubjseq( ls1.getString("subjseq") ); //data1.setSubjseqgr( ls1.getString("subjseqgr") ); data1.setSubjnm( ls1.getString("subjnm") ); //data1.setProjseqcnt( ls1.getInt("projseqcnt") ); data1.setOrdseqcnt( ls1.getInt("ordseqcnt") ); //data1.setIsclosed( ls1.getString("isclosed") ); //data1.setIsonoff( ls1.getString("isonoff") ); //data1.setEdustart( ls1.getString("edustart") ); //data1.setEduend( ls1.getString("eduend") ); list1.add(data1); } } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql1); throw new Exception("sql1 = " + sql1 + "\r\n" + ex.getMessage() ); } finally { if ( ls1 != null ) { try { ls1.close(); } catch ( Exception e ) { } } if ( ls2 != null ) { try { ls2.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list1; } /** 과제 문제 리스트 @param box receive from the form object and session @return ArrayList */ public ArrayList selectReportQuestionsList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls = null; ArrayList list = null; String sql = ""; ReportData data = null; String v_subj = box.getString("p_subj"); // 과목 try { connMgr = new DBConnectionManager(); list = new ArrayList(); // sql += "(select count(*) from TZ_PROJGRP where subj=A.subj and year=A.year "; 11/26 tz_projgrp 용도 알아낼 것 // sql += "and subjseq=A.subjseq and ordseq=A.ordseq) as grcnt,A.groupcnt "; /* * * 2008.11.19 과목별 과제 출제된 리스트를 가져와야 해서 주석처리 다시 쿼리 만들어야함. * 제길..아..과제 만들기 조낸 싫어..시러시러시러시러시러시러시러시러시럿 sql = "select A.projseq, "; sql += " A.ordseq,"; sql += " nvl(A.lesson,'') lesson,"; sql += " nvl((select sdesc from tz_subjlesson where subj = a.subj and lesson = a.lesson),'') lessonnm,"; sql += " A.reptype,"; sql += " A.isopen,"; sql += " A.isopenscore,"; sql += " A.title,"; sql += " A.score,"; sql += " nvl(A.expiredate,'') expiredate, "; sql += " (select count(*) from TZ_STUDENT where subj=A.subj and year=A.year and subjseq=A.subjseq) as tocnt, "; sql += " 99 as grcnt,"; sql += " A.groupcnt, "; sql += " isusedcopy, "; sql += " (select count(*) from TZ_PROJORD where subj=A.subj and year=A.year and subjseq=A.subjseq and projseq=a.projseq) as rowspan, "; sql += " (select min(ordseq) from tz_projord where subj=a.subj and year=a.year and subjseq=a.subjseq and projseq=a.projseq ) rowspanseq, "; sql += " A.upfile2, decode(A.useyn, 'Y', '사용', '미사용') useyn, "; sql += " (select eduend from tz_subjseq x where x.subj=a.subj and x.year = a.year and x.subjseq = a.subjseq ) eduend "; sql += "from TZ_PROJORD A "; sql += "where A.subj='" +v_subj + "' and A.year='" +v_year + "' and A.subjseq='" +v_subjseq + "' "; sql += "order by a.projseq,A.ordseq"; Log.info.println("sql == == == == == == > " +sql); ls = connMgr.executeQuery(sql); while ( ls.next() ) { data = new ProjectData(); data.setProjseq( ls.getInt("projseq") ); data.setOrdseq( ls.getInt("ordseq") ); data.setLesson( ls.getString("lesson") ); data.setLessonnm( ls.getString("lessonnm") ); data.setReptype( ls.getString("reptype") ); data.setIsopen( ls.getString("isopen") ); data.setIsopenscore( ls.getString("isopenscore") ); data.setTitle( ls.getString("title") ); data.setScore( ls.getInt("score") ); data.setTocnt( ls.getString("tocnt") ); data.setGrcnt( ls.getString("grcnt") ); data.setExpiredate( ls.getString("expiredate") ); data.setGroupcnt( ls.getString("groupcnt") ); data.setRowspan( ls.getInt("rowspan") ); data.setIsusedcopy( ls.getString("isusedcopy") ); data.setRowspanseq( ls.getInt("rowspanseq") ); data.setUpfile2( ls.getString("upfile2") ); data.setUseyn( ls.getString("useyn") ); data.setEduend( ls.getString("eduend") ); list.add(data); } */ sql = "select A.subj, \n"; sql += " A.ordseq, \n"; sql += " A.reptype, \n"; sql += " A.isopen, \n"; sql += " A.isopenscore, \n"; sql += " A.title, \n"; sql += " A.score, \n"; sql += " (select count(*) from TZ_PROJORD where subj=A.subj and ordseq=a.ordseq) as rowspan, \n"; sql += " (select min(ordseq) from tz_projord where subj=a.subj and ordseq=a.ordseq ) rowspanseq, "; sql += " A.upfile2, decode(A.useyn, 'Y', '사용', '미사용') useyn \n"; sql += "from TZ_PROJORD A \n"; sql += "where A.subj='" +v_subj + "' \n"; sql += "order by A.ordseq \n"; ls = connMgr.executeQuery(sql); while ( ls.next() ) { data = new ReportData(); //data.setProjseq( ls.getInt("projseq") ); data.setSubj( ls.getString("subj") ); data.setOrdseq( ls.getInt("ordseq") ); //data.setLesson( ls.getString("lesson") ); //data.setLessonnm( ls.getString("lessonnm") ); data.setReptype( ls.getString("reptype") ); data.setIsopen( ls.getString("isopen") ); data.setIsopenscore( ls.getString("isopenscore") ); data.setTitle( ls.getString("title") ); data.setScore( ls.getInt("score") ); //data.setTocnt( ls.getString("tocnt") ); //data.setGrcnt( ls.getString("grcnt") ); //data.setExpiredate( ls.getString("expiredate") ); //data.setGroupcnt( ls.getString("groupcnt") ); data.setRowspan( ls.getInt("rowspan") ); //data.setIsusedcopy( ls.getString("isusedcopy") ); data.setRowspanseq( ls.getInt("rowspanseq") ); data.setUpfile2( ls.getString("upfile2") ); data.setUseyn( ls.getString("useyn") ); //data.setEduend( ls.getString("eduend") ); list.add(data); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; } /** 과제 등록 @param box receive from the form object and session @return int */ public int insertReportQuestions(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls = null; PreparedStatement pstmt2 = null; String sql1 = ""; String sql2 = ""; int isOk = 0; String v_user_id = box.getSession("userid"); String v_subj = box.getString("p_subj"); // 과목 String v_reptype = box.getString("p_reptype"); String v_title = box.getString("p_title"); String v_contents = box.getString("p_contents"); String v_isopen = box.getString("p_isopen"); String v_isopenscore = box.getString("p_isopenscore"); String v_score = box.getString("p_score"); String v_realFileName1 = box.getRealFileName("p_file1"); String v_newFileName1 = box.getNewFileName("p_file1"); String v_realFileName2 = box.getRealFileName("p_file2"); String v_newFileName2 = box.getNewFileName("p_file2"); int v_groupcnt = box.getInt("p_groupcnt"); String v_ansyn = box.getString("ansyn"); // 답안제출옵션 String v_useyn = box.getString("useyn"); // 사용여부 int v_max = 0; int v_ordseq = 0; int index = 1; try { connMgr = new DBConnectionManager(); sql1 = "select max(ordseq) from TZ_PROJORD "; sql1 += "where subj='" +v_subj + "' "; ls = connMgr.executeQuery(sql1); if ( ls.next() ) { v_max = ls.getInt(1); if ( v_max > 0) { v_ordseq = v_max + 1; } else { v_ordseq = 1; } } /* 2008.11.19 오충현 수정 sql2 = "insert into TZ_PROJORD(subj,year,subjseq,ordseq,projseq,lesson,reptype,"; sql2 += "expiredate,title,contents,score,upfile,upfile2,realfile,realfile2,luserid,groupcnt,ldate,ansyn,useyn) "; sql2 += "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,to_char(sysdate,'YYYYMMDDHH24MISS'),?,?)"; */ sql2 = "insert into TZ_PROJORD( "; sql2 += " subj, ordseq, reptype, title, contents, ";//5 sql2 += " score, upfile, upfile2, realfile, realfile2, ";//5 sql2 += " luserid, ldate, ansyn, useyn ";//4 sql2 += " ) "; sql2 += " values("; sql2 += " ?,?,?,?,?, "; //5 sql2 += " ?,?,?,?,?, ";//5 sql2 += " ?,to_char(sysdate,'YYYYMMDDHH24MISS'),?,? ";//4 sql2 += " )"; pstmt2 = connMgr.prepareStatement(sql2); pstmt2.setString(index++,v_subj); //1 pstmt2.setInt(index++,v_ordseq); pstmt2.setString(index++,v_reptype); pstmt2.setString(index++,v_title); pstmt2.setString(index++,v_contents); //5 pstmt2.setString(index++,v_score); pstmt2.setString(index++,v_newFileName1); pstmt2.setString(index++,v_newFileName2); pstmt2.setString(index++,v_realFileName1); pstmt2.setString(index++,v_realFileName2); //10 pstmt2.setString(index++,v_user_id); //pstmt2.setInt(index++,v_groupcnt); pstmt2.setString(index++,v_ansyn); pstmt2.setString(index++,v_useyn); //14 isOk = pstmt2.executeUpdate(); } catch ( Exception ex ) { throw new Exception("sql1 = " + sql1 + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( pstmt2 != null ) { try { pstmt2.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return isOk; } /** 과제 수정 페이지 @param box receive from the form object and session @return ProjectData */ public ReportData updateReportQuestionsPage(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls = null; String sql = ""; ReportData data = null; String v_subj = box.getString("p_subj"); // 과목 //String v_year = box.getString("p_year"); // 년도 //String v_subjseq = box.getString("p_subjseq"); // 과목기수 //String v_lesson = box.getString("p_lesson"); // 일차 int v_ordseq = box.getInt("p_ordseq"); try { connMgr = new DBConnectionManager(); // select reptype,expiredate,title,contents,score,groupcnt,upfile,upfile2 sql = "select ordseq, reptype,title,contents,score,upfile,upfile2,realfile,realfile2 "; sql += " ,ansyn, useyn "; sql += "from TZ_PROJORD "; sql += "where subj='" +v_subj + "' "; sql += "and ordseq='" +v_ordseq + "'"; ls = connMgr.executeQuery(sql); if ( ls.next() ) { data = new ReportData(); //data.setProjseq( ls.getInt("projseq") ); data.setOrdseq( ls.getInt("ordseq") ); data.setReptype( ls.getString("reptype") ); data.setTitle( ls.getString("title") ); data.setContents( ls.getString("contents") ); data.setScore( ls.getInt("score") ); data.setUpfile( ls.getString("upfile") ); data.setUpfile2( ls.getString("upfile2") ); data.setRealfile( ls.getString("realfile") ); data.setRealfile2( ls.getString("realfile2") ); data.setAnsyn( ls.getString("ansyn") ); data.setUseyn( ls.getString("useyn") ); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return data; } /** 과제 수정 @param box receive from the form object and session @return int */ public int updateReportQuestions(RequestBox box) throws Exception { DBConnectionManager connMgr = null; PreparedStatement pstmt = null; String sql = ""; ListSet ls = null; int isOk = 0; String v_user_id = box.getSession("userid"); String v_reptype = box.getString("p_reptype"); String v_title = box.getString("p_title"); String v_contents = box.getString("p_contents"); String v_isopen = box.getString("p_isopen"); String v_isopenscore = box.getString("p_isopenscore"); String v_realFileName1 = box.getRealFileName("p_file1"); String v_newFileName1 = box.getNewFileName("p_file1"); String v_realFileName2 = box.getRealFileName("p_file2"); String v_newFileName2 = box.getNewFileName("p_file2"); String v_upfile = box.getString("p_upfile"); String v_upfile2 = box.getString("p_upfile2"); String v_realfile = box.getString("p_realfile"); String v_realfile2 = box.getString("p_realfile2"); String v_check1 = box.getString("p_check1"); // 첨부파일1 이전파일 삭제 String v_check2 = box.getString("p_check2"); // 첨부파일2 아전파일 삭제 String v_subj = box.getString("p_subj"); // 과목 String v_upfilesize = ""; String v_upfilesize2 = ""; String v_ansyn = box.getString("ansyn"); // 답안제출옵션 String v_useyn = box.getString("useyn"); // 사용여부 int v_score = box.getInt("p_score"); //int v_groupcnt = box.getInt("p_groupcnt"); int v_ordseq = box.getInt("p_ordseq"); if ( v_newFileName1.length() == 0) { v_newFileName1 = v_upfile; } if ( v_newFileName2.length() == 0) { v_newFileName2 = v_upfile2; } // 기존 파일정보 String v_oldupfile = v_upfile; String v_oldrealfile = v_realfile; String v_oldupfile2 = v_upfile2; String v_oldrealfile2 = v_realfile2; int index = 1; try { connMgr = new DBConnectionManager(); /* sql = "select count(userid) "; sql += "from TZ_PROJASSIGN "; sql += "where subj='" + v_subj + "' "; sql += " and ordseq = " + v_ordseq ; ls = connMgr.executeQuery(sql); //if ( ls.next() ) { if ( true ) {*/ // if ( ls.getInt(1) != 0) { // isOk = -1; // 배정된 학습자가 있어 삭제할 수 없습니다. // // } else { // 업로드한 파일이 없을 경우 if ( v_realFileName1.equals("") ) { // 기존파일 삭제 if ( v_check1.equals("Y") ) { FileManager.deleteFile(v_newFileName1); v_newFileName1 = ""; v_realFileName1 = ""; } else { // 기존파일 유지 v_newFileName1 = v_oldupfile; v_realFileName1 = v_oldrealfile; } } // 업로드한 파일이 없을 경우 if ( v_realFileName2.equals("") ) { // 기존파일 삭제 if ( v_check2.equals("Y") ) { FileManager.deleteFile(v_newFileName2); v_newFileName2 = ""; v_realFileName2 = ""; } else { // 기존파일 유지 v_newFileName2 = v_oldupfile2; v_realFileName2 = v_oldrealfile2; } } sql = "update TZ_PROJORD set reptype=?,title=?,";//2 ,3~9 sql += "contents=?,score=?,upfile=?,upfile2=?,realfile=?,realfile2=?,luserid=?,ldate=to_char(sysdate,'YYYYMMDDHH24MISS'), "; sql += "isopen=?,isopenscore=?, ansyn=?, useyn=? ";//10~13 sql += "where subj='" +v_subj + "' "; sql += "and ordseq='" +v_ordseq + "' "; pstmt = connMgr.prepareStatement(sql); // System.out.println("sql == == == == == > " +sql); pstmt.setString(index++,v_reptype);//1 pstmt.setString(index++,v_title); pstmt.setString(index++,v_contents); pstmt.setInt(index++,v_score); pstmt.setString(index++,v_newFileName1);//5 pstmt.setString(index++,v_newFileName2); pstmt.setString(index++,v_realFileName1); pstmt.setString(index++,v_realFileName2); pstmt.setString(index++,v_user_id); pstmt.setString(index++,v_isopen);//10 pstmt.setString(index++,v_isopenscore); pstmt.setString(index++,v_ansyn); pstmt.setString(index++,v_useyn); //13 isOk = pstmt.executeUpdate(); // } // } } catch ( Exception ex ) { throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return isOk; } /** 과제 삭제 @param box receive from the form object and session @return int */ public int deleteProjectReport(RequestBox box) throws Exception { DBConnectionManager connMgr = null; PreparedStatement pstmt2 = null; ListSet ls = null; String sql1 = ""; String sql2 = ""; int isOk = 0; String v_subj = box.getString("p_subj"); // 과목 String v_year = box.getString("p_year"); // 년도 String v_subjseq = box.getString("p_subjseq"); // 과목기수 int v_ordseq = box.getInt("p_ordseq"); // 과제번호 try { connMgr = new DBConnectionManager(); sql1 = "select count(userid) "; sql1 += "from TZ_PROJASSIGN "; sql1 += "where subj='" + v_subj + "' and year='" + v_year + "' and "; sql1 += " subjseq='" + v_subjseq + "' and ordseq = " + v_ordseq ; ls = connMgr.executeQuery(sql1); if ( ls.next() ) { if ( ls.getInt(1) != 0) { isOk = -1; // 배정된 학습자가 있어 삭제할 수 없습니다. } else { // Delete tz_projrep sql2 = "delete TZ_PROJORD "; sql2 += "where subj = ? and year=? and subjseq=? and ordseq = ? "; pstmt2 = connMgr.prepareStatement(sql2); pstmt2.setString(1, v_subj); pstmt2.setString(2, v_year); pstmt2.setString(3, v_subjseq); pstmt2.setInt(4, v_ordseq); isOk = pstmt2.executeUpdate(); } } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql2); throw new Exception("sql2 = " + sql2 + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e1 ) { } } if ( pstmt2 != null ) { try { pstmt2.close(); } catch ( Exception e1 ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return isOk; } /** 과제문제 리스트 (문제를 문제지에 등록시키기 위해 문제 정보 select) @param box receive from the form object and session @return ProjectData */ public ArrayList selectQuestionList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls = null; String sql = ""; ArrayList list = null; DataBox dbox = null; String v_subj = box.getString("p_subj"); // 과목 String v_year = box.getString("p_year"); // 년도 String v_subjseq = box.getString("p_subjseq"); // 과목기수 try { connMgr = new DBConnectionManager(); // select reptype,expiredate,title,contents,score,groupcnt,upfile,upfile2 //2008.12.03 테이블변경으로 수정 sql = "select ordseq,title,contents,score,upfile,upfile2,realfile,realfile2 "; sql += " , useyn "; sql += "from TZ_PROJORD "; sql += "where useyn='Y' and subj = '" +v_subj + "' "; ls = connMgr.executeQuery(sql); list = new ArrayList(); while ( ls.next() ) { dbox = ls.getDataBox(); list.add(dbox); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; } /** 설문 문제지 등록 @param box receive from the form object and session @return isOk **/ public int insertPaper(RequestBox box) throws Exception { DBConnectionManager connMgr = null; int isOk = 0; //String v_grcode = box.getString("p_grcode"); String v_year = box.getString("p_year"); //년도 String v_subj = box.getString("p_subj"); //과목 String v_subjseq = box.getString("p_subjseq");//학기 String v_sulnums = box.getString("p_sulnums"); //설문은 1,2,3이런형식으로 설문 문제 번호가 넘어온다. 평가에서는 다름 수정해야함... String v_title = box.getString("p_title"); int v_reportpapernum = 0; String v_projrepstart = box.getString("p_sdate"); //제출시작일 String v_projrepend = box.getString("p_edate"); //제출종료일 String v_luserid = box.getSession("userid"); //최종수정자 String v_projgubun = box.getString("p_projgubun"); //리포트타입(중간:M, 기말:F) String v_reptype = box.getString("p_reptype"); //리포트유형(단답형:S, 서술형: P) try { connMgr = new DBConnectionManager(); connMgr.setAutoCommit(false); v_reportpapernum = getPapernumSeq(v_subj, v_year); //그룹번호 grpseq isOk = insertTZ_reportpaper(connMgr, v_subj, v_year, v_subjseq, v_reportpapernum, v_sulnums, v_luserid, v_projgubun, v_projrepstart, v_projrepend, v_title, v_reptype); } catch ( Exception ex ) { isOk = 0; connMgr.rollback(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( isOk > 0 ) { connMgr.commit(); } if ( connMgr != null ) { try { connMgr.setAutoCommit(true); connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return isOk; } /** 과제 문제지 등록 @param connMgr @param p_year 년도 @param p_subj 과목 @param p_grpseq 문제지번호 @param p_ordseqs 문제번호 @param p_luserid 작성자 @return isOk @return isOk1 **/ public int insertTZ_reportpaper(DBConnectionManager connMgr, String p_subj , String p_year, String p_subjseq, int p_grpseq, String p_ordseqs , String p_luserid, String p_projgubun, String p_sdate, String p_edate , String p_title, String p_reptype) throws Exception { PreparedStatement pstmt = null; PreparedStatement pstmt1 = null; ListSet ls = null; ArrayList list = null; String sql = ""; String sql1 = ""; String sql2 = ""; int isOk = 0; int isOk1 = 0; int score = 0; int totalscore = 0; try { String[] v_ordseq = p_ordseqs.split(","); for(int j = 0; j < v_ordseq.length; j++){ sql2 = " select score from tz_projord "; sql2 += " where ordseq = " + v_ordseq[j]; sql2 += " and subj = " + StringManager.makeSQL(p_subj); ls = connMgr.executeQuery(sql2); if ( ls.next() ) { score = ls.getInt("score"); totalscore += score; } if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } } if(totalscore != 100){ isOk = -1; } if(isOk != -1){ // insert TZ_SULPAPER table sql = "insert into TZ_projgrp "; sql += "( subj, year, subjseq, grpseq, projgubun "; //5 sql += " ,sdate, edate, luserid, ldate, grpseqnm, reptype, grptotalscore) "; //7 sql += " values "; sql += "( ?,?,?,?,? "; sql += " ,?,?,?,?,?,?,? ) "; pstmt = connMgr.prepareStatement(sql); pstmt.setString( 1, p_subj ); pstmt.setString( 2, p_year ); pstmt.setString( 3, p_subjseq ); pstmt.setInt ( 4, p_grpseq ); pstmt.setString( 5, p_projgubun ); pstmt.setString( 6, p_sdate ); pstmt.setString( 7, p_edate ); pstmt.setString( 8, p_luserid ); pstmt.setString( 9, FormatDate.getDate("yyyyMMddHHmmss")); pstmt.setString( 10, p_title ); pstmt.setString( 11, p_reptype ); pstmt.setInt ( 12, totalscore ); isOk = pstmt.executeUpdate(); //tz_projmap 에 과제번호와 그룹번호를 맵핑 //for돌려서 문제번호당 그룹번호를 넣어야한다. v_ordseq = p_ordseqs.split(","); for(int i = 0; i < v_ordseq.length; i++){ sql1 = "insert into TZ_projmap "; sql1 += "( subj, year, subjseq, "; sql1 += " grpseq, ordseq, luserid, ldate) "; sql1 += " values "; sql1 += "(?,?,?, "; sql1 += " ?,?,?,? ) "; pstmt1 = connMgr.prepareStatement(sql1); pstmt1.setString( 1, p_subj); pstmt1.setString( 2, p_year); pstmt1.setString( 3, p_subjseq ); pstmt1.setInt ( 4, p_grpseq); pstmt1.setInt ( 5, Integer.parseInt(v_ordseq[i])); pstmt1.setString( 6, p_luserid); pstmt1.setString( 7, FormatDate.getDate("yyyyMMddHHmmss")); isOk1 = pstmt1.executeUpdate(); if(isOk1 >0){connMgr.commit();} else{connMgr.rollback();} if ( pstmt1 != null ) { try { pstmt1.close(); } catch ( Exception e ) { } } } } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } if ( pstmt1 != null ) { try { pstmt1.close(); } catch ( Exception e ) { } } if ( isOk > 0 ) { connMgr.commit(); } } return isOk; } public int getPapernumSeq(String p_subj, String p_year) throws Exception { Hashtable maxdata = new Hashtable(); maxdata.put("seqcolumn","grpseq"); maxdata.put("seqtable","tz_projgrp"); maxdata.put("paramcnt","2"); maxdata.put("param0","subj"); maxdata.put("param1","year"); maxdata.put("subj", SQLString.Format(p_subj)); maxdata.put("year", SQLString.Format(p_year)); return SelectionUtil.getSeq(maxdata); } /** 과목별 과제 그룹 리스트 @param box receive from the form object and session @return ArrayList */ public ArrayList selectReportGroupList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls = null; ArrayList list = null; String sql = ""; DataBox dbox = null; String v_subj = box.getString("s_subjcourse"); // 과목 String v_year = box.getString("s_gyear"); // 년도 String v_subjseq = box.getString("s_subjseq"); // 과목기수 try { connMgr = new DBConnectionManager(); list = new ArrayList(); sql = " select distinct a.grpseq, a.subj, a.year, a.subjseq, a.projgubun, a.sdate, a.edate, a.grpseqnm, a.reptype \n"; sql += " , (select count(*) from tz_projmap m where m.grpseq = a.grpseq and m.subj = " + StringManager.makeSQL(v_subj) + " and m.subjseq = " + StringManager.makeSQL(v_subjseq) + " and m.year = " + StringManager.makeSQL(v_year) + ") qcnt \n"; sql += " from tz_projgrp a, tz_projmap b \n"; sql += " where 1=1 \n"; sql += " and a.subj = b.subj(+) \n"; sql += " and a.year = b.year(+) \n"; sql += " and a.subjseq = b.subjseq(+) \n"; sql += " and a.grpseq = b.grpseq(+) \n"; sql += " and a.subj = " + StringManager.makeSQL(v_subj); sql += " and a.year = " + StringManager.makeSQL(v_year); sql += " and a.subjseq = "+ StringManager.makeSQL(v_subjseq); sql += " order by a.projgubun desc , a.grpseq asc \n"; ls = connMgr.executeQuery(sql); while ( ls.next() ) { dbox = ls.getDataBox(); list.add(dbox); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; } /** 과목별 과제 그룹 리스트 @param box receive from the form object and session @return ArrayList */ public ArrayList selectPaperQuestionList(RequestBox box) throws Exception { DBConnectionManager connMgr = null; ListSet ls = null; ArrayList list = null; String sql = ""; DataBox dbox = null; //String v_subj = box.getString("s_subjcourse"); // 과목 //String v_year = box.getString("s_gyear"); // 년도 //String v_subjseq = box.getString("s_subjseq"); // 과목기수 String v_subj = box.getString("p_subj"); // 과목 String v_year = box.getString("p_year"); // 년도 String v_subjseq = box.getString("p_subjseq"); // 과목기수 String v_grpseq = box.getString("p_grpseq"); // 그룹번호 try { connMgr = new DBConnectionManager(); list = new ArrayList(); sql = " select \n"; sql += " a.subj, a.year,a.grpseq, a.subjseq \n"; sql += " , b.ordseq, b.title, b.contents, b.score \n"; sql += " , b.upfile, b.upfile2, b.realfile, b.realfile2 \n"; sql += " , b.useyn \n"; sql += " from tz_projmap a, tz_projord b \n"; sql += " where a.ordseq = b.ordseq \n"; sql += " and a.subj = b.subj \n"; sql += " and a.subj = " + StringManager.makeSQL(v_subj); sql += " and a.subjseq = " + StringManager.makeSQL(v_subjseq); sql += " and a.year = " + StringManager.makeSQL(v_year); sql += " and a.grpseq = " + StringManager.makeSQL(v_grpseq); sql += " order by b.ordseq "; ls = connMgr.executeQuery(sql); while ( ls.next() ) { dbox = ls.getDataBox(); list.add(dbox); } } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex, box, sql); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return list; } /** 설문 문제지 등록 @param box receive from the form object and session @return isOk **/ public int updatePaper(RequestBox box) throws Exception { DBConnectionManager connMgr = null; int isOk = 0; String v_year = box.getString("p_year"); //년도 String v_subj = box.getString("p_subj"); //과목 String v_subjseq = box.getString("p_subjseq"); //학기 String v_sulnums = box.getString("p_sulnums"); //설문번호다. 과제에서는 안쓴다. 지우기싫다..귀찮다.이렇게라도 써주니 고맙지?건들지마 주겨버린다 String v_title = box.getString("p_title"); int v_reportpapernum = 0; String v_projrepstart = box.getString("p_sdate"); //제출시작일 String v_projrepend = box.getString("p_edate"); //제출종료일 String v_luserid = box.getSession("userid"); //최종수정자 String v_projgubun = box.getString("p_projgubun"); //리포트유형(중간,기말) String v_reptype = box.getString("p_reptype"); //리포트타입(단답형:S, 서술형:P) int v_grpseq = box.getInt("p_grpseq"); //문제지 번호 try { connMgr = new DBConnectionManager(); connMgr.setAutoCommit(false); isOk = updateTZ_reportpaper(connMgr, v_subj, v_year, v_subjseq, v_grpseq, v_sulnums, v_luserid, v_projgubun, v_projrepstart, v_projrepend, v_title, v_reptype); } catch ( Exception ex ) { isOk = 0; connMgr.rollback(); ErrorManager.getErrorStackTrace(ex); throw new Exception(ex.getMessage() ); } finally { if ( isOk > 0 ) { connMgr.commit(); } if ( connMgr != null ) { try { connMgr.setAutoCommit(true); connMgr.freeConnection(); } catch ( Exception e10 ) { } } } return isOk; } /** 과제 문제지 수정 @param connMgr @param p_year 년도 @param p_subj 과목 @param p_grpseq 문제지번호 @param p_ordseqs 문제번호 @param p_luserid 작성자 @return isOk @return isOk1 **/ public int updateTZ_reportpaper(DBConnectionManager connMgr, String p_subj, String p_year, String p_subjseq, int p_grpseq, String p_ordseqs, String p_luserid, String p_projgubun, String p_sdate, String p_edate, String p_title, String p_reptype) throws Exception { PreparedStatement pstmt = null; PreparedStatement pstmt1 = null; PreparedStatement pstmt2 = null; String sql = ""; String sql1 = ""; String sql2 = ""; String sql3 = ""; int isOk = 0; int isOk1 = 0; int isOk2 = 0; int v_cnt = 0; ListSet ls = null; int score = 0; int totalscore = 0; try { // 수정 하기 전 해당 문제지의 배정 여부를 확인하고 배정된 문제지면 수정,삭제가 불가능하다. sql3 = " SELECT COUNT(USERID) cnt \n"; sql3+= " FROM TZ_PROJASSIGN \n"; sql3+= " WHERE 1=1 \n"; sql3+= " AND SUBJ = " + StringManager.makeSQL(p_subj); sql3+= " AND SUBJSEQ = " + StringManager.makeSQL(p_subjseq); sql3+= " AND YEAR = " + StringManager.makeSQL(p_year); sql3+= " AND GRPSEQ = " + p_grpseq; ls = connMgr.executeQuery(sql3); if ( ls.next() ) { v_cnt = ls.getInt(1); } if(ls != null){ ls.close(); } /* 일단 주석해제 나중에 다시 풀어야함 10.01.18 kjm */ //if ( v_cnt != 0) { //isOk = -1; // 배정된 학습자가 있어 수정 할 수 없습니다. //} else { String[] v_ordseq = p_ordseqs.split(","); for(int j = 0; j < v_ordseq.length; j++){ sql2 = " select score from tz_projord "; sql2 += " where ordseq = " + v_ordseq[j]; sql2 += " and subj = " + StringManager.makeSQL(p_subj); ls = connMgr.executeQuery(sql2); if ( ls.next() ) { score = ls.getInt("score"); totalscore += score; } } if(totalscore != 100){ isOk = -2; // 총점이 100점이 아닙니다. 문제지를 확인해주세요 } if(isOk != -2){ // 총점이 100점이 아니면 수정할수 없다. // update tz_projgrp sql = " update tz_projgrp set \n"; sql += " sdate = ?, edate = ?, luserid = ?, \n"; sql += " ldate = to_char(sysdate, 'YYYYMMDDHH24MISS'), grpseqnm = ?, projgubun = ?, reptype = ?, \n"; sql += " grptotalscore = ? \n"; sql += " where 1=1 \n"; sql += " AND SUBJ = ? \n"; sql += " AND YEAR = ? \n"; sql += " AND SUBJSEQ = ? \n"; sql += " AND GRPSEQ = ? \n"; pstmt = connMgr.prepareStatement(sql); pstmt.setString( 1, p_sdate); pstmt.setString( 2, p_edate); pstmt.setString( 3, p_luserid); pstmt.setString( 4, p_title); pstmt.setString( 5, p_projgubun); pstmt.setString( 6, p_reptype); pstmt.setInt ( 7, totalscore); pstmt.setString( 8, p_subj); pstmt.setString( 9, p_year); pstmt.setString( 10, p_subjseq); pstmt.setInt ( 11, p_grpseq); isOk = pstmt.executeUpdate(); //tz_projmap 에 과제번호와 그룹번호를 맵핑 //이전 문제들을 지우고 새로운 문제를 넣는다. sql2 = " delete from tz_projmap \n"; sql2 += " where grpseq = ? "; sql2 += " and subj = ? "; sql2 += " and subjseq = ? "; sql2 += " and year = ? "; pstmt2 = connMgr.prepareStatement(sql2); pstmt2.setInt( 1, p_grpseq); pstmt2.setString( 2, p_subj); pstmt2.setString( 3, p_subjseq); pstmt2.setString( 4, p_year); isOk2 = pstmt2.executeUpdate(); if ( isOk2 > 0 ) { connMgr.commit(); } //for돌려서 문제번호당 그룹번호를 넣어야한다. v_ordseq = p_ordseqs.split(","); for(int i = 0; i < v_ordseq.length; i++){ sql1 = "insert into TZ_projmap "; sql1 += "( subj, year, subjseq, "; sql1 += " grpseq, ordseq, luserid, ldate) "; sql1 += " values "; sql1 += "(?,?,?, "; sql1 += " ?,?,?,? ) "; pstmt1 = connMgr.prepareStatement(sql1); pstmt1.setString( 1, p_subj); pstmt1.setString( 2, p_year); pstmt1.setString( 3, p_subjseq ); pstmt1.setInt ( 4, p_grpseq); pstmt1.setInt ( 5, Integer.parseInt(v_ordseq[i])); pstmt1.setString( 6, p_luserid); pstmt1.setString( 7, FormatDate.getDate("yyyyMMddHHmmss")); isOk1 = pstmt1.executeUpdate(); if (pstmt1 != null) { try { pstmt1.close(); } catch (Exception e) {} } } } //} } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( pstmt1 != null ) { try { pstmt1.close(); } catch ( Exception e ) { } } if ( pstmt2 != null ) { try { pstmt2.close(); } catch ( Exception e ) { } } if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } if ( isOk > 0 ) { connMgr.commit(); } if ( isOk1 > 0 ) { connMgr.commit(); }else{connMgr.rollback();} } return isOk; } /** 과제 문제지 삭제 @param connMgr **/ public int deletePaper(RequestBox box) throws Exception { DBConnectionManager connMgr = null; PreparedStatement pstmt = null; PreparedStatement pstmt1 = null; PreparedStatement pstmt2 = null; String sql = ""; String sql1 = ""; String sql2 = ""; int isOk = 0; int isOk1 = 0; int isOk2 = 0; int v_cnt = 0; ListSet ls = null; String v_subj = box.getString("p_subj"); String v_year = box.getString("p_year"); String v_subjseq = box.getString("p_subjseq"); String v_grpseq = box.getString("p_grpseq"); try { connMgr = new DBConnectionManager(); connMgr.setAutoCommit(false); sql = " SELECT COUNT(USERID) cnt \n"; sql+= " FROM TZ_PROJASSIGN \n"; sql+= " WHERE 1=1 \n"; sql+= " AND SUBJ = " + StringManager.makeSQL(v_subj); sql+= " AND GRPSEQ = " + v_grpseq; ls = connMgr.executeQuery(sql); if ( ls.next() ) { v_cnt = ls.getInt(1); } ls.close(); if ( v_cnt != 0) { isOk = -1; // 배정된 학습자가 있어 삭제할 수 없습니다. } else { sql1 = " delete from tz_projmap \n"; sql1 += " where grpseq = ? \n"; sql1 += " and subj = ? \n"; sql1 += " and subjseq = ? \n"; sql1 += " and year = ? \n"; pstmt = connMgr.prepareStatement(sql1); pstmt.setString( 1, v_grpseq ); pstmt.setString( 2, v_subj ); pstmt.setString( 3, v_subjseq ); pstmt.setString( 4, v_year ); isOk1 = pstmt.executeUpdate(); sql2 = " delete from tz_projgrp \n"; sql2 += " where grpseq = ? \n"; sql2 += " and subj = ? \n"; sql2 += " and subjseq = ? \n"; sql2 += " and year = ? \n"; pstmt2 = connMgr.prepareStatement(sql2); pstmt2.setString( 1, v_grpseq ); pstmt2.setString( 2, v_subj ); pstmt2.setString( 3, v_subjseq ); pstmt2.setString( 4, v_year ); isOk2 = pstmt2.executeUpdate(); isOk = isOk1 * isOk2; } // update tz_projgrp /*sql = " update tz_projgrp set \n"; sql += " sdate = ? , edate = ?, luserid = ? , \n"; sql += " ldate = to_char(sysdate, 'yyyyMMddHHmmss'), grpseqnm = ?, projgubun = ? , reptype = ? \n"; sql += " where "; sql += " grpseq = "+ p_grpseq; pstmt.setString( 1, p_sdate); pstmt.setString( 2, p_edate); pstmt.setString( 3, p_luserid); pstmt.setString( 4, p_title); pstmt.setString( 5, p_projgubun); pstmt.setString( 6, p_reptype); isOk = pstmt.executeUpdate(); //tz_projmap 에 과제번호와 그룹번호를 맵핑 //이전 문제들을 지우고 새로운 문제를 넣는다. sql2 = " delete from tz_projmap \n"; sql2 += " where grpseq = ? "; sql2 += " and subj = ? "; sql2 += " and subjseq = ? "; sql2 += " and year = ? "; pstmt2 = connMgr.prepareStatement(sql2); pstmt2.setInt( 1, p_grpseq); pstmt2.setString( 2, p_subj); pstmt2.setString( 3, p_subjseq); pstmt2.setString( 4, p_year); isOk2 = pstmt2.executeUpdate(); if ( isOk2 > 0 ) { connMgr.commit(); } //for돌려서 문제번호당 그룹번호를 넣어야한다. String[] v_ordseq = p_ordseqs.split(","); for(int i = 0; i < v_ordseq.length; i++){ sql1 = "insert into TZ_projmap "; sql1 += "( subj, year, subjseq, "; sql1 += " grpseq, ordseq, luserid, ldate) "; sql1 += " values "; sql1 += "(?,?,?, "; sql1 += " ?,?,?,? ) "; pstmt1 = connMgr.prepareStatement(sql1); pstmt1.setString( 1, p_subj); pstmt1.setString( 2, p_year); pstmt1.setString( 3, p_subjseq ); pstmt1.setInt ( 4, p_grpseq); pstmt1.setInt ( 5, Integer.parseInt(v_ordseq[i])); pstmt1.setString( 6, p_luserid); pstmt1.setString( 7, FormatDate.getDate("yyyyMMddHHmmss")); isOk1 = pstmt1.executeUpdate(); }*/ } catch ( Exception ex ) { ErrorManager.getErrorStackTrace(ex); throw new Exception("sql = " + sql + "\r\n" + ex.getMessage() ); } finally { if ( ls != null ) { try { ls.close(); } catch ( Exception e ) { } } if ( pstmt1 != null ) { try { pstmt1.close(); } catch ( Exception e ) { } } if ( pstmt2 != null ) { try { pstmt2.close(); } catch ( Exception e ) { } } if ( pstmt != null ) { try { pstmt.close(); } catch ( Exception e ) { } } if ( isOk > 0 ) { connMgr.commit(); } if ( connMgr != null ) { try { connMgr.freeConnection(); } catch ( Exception e ) { } } } return isOk; } }
[ "knise@10.60.223.121" ]
knise@10.60.223.121
93f1fd0f3a39487788c92a7a615002a7b41c16f1
cbf7390fe2fdf8fc8f963eae4e169e8f81d17b34
/Warsztat6/src/main/java/pl/codeslab/warsztat6/AppConfig.java
868bd3d72be4f92eb547811bf21597b5d2f3b6fb
[]
no_license
osinD/Warsztat6
90169b61dd1aec3ca580053277267eeb7be593f7
b337ed8a7a1fcfbcf73ee4965de311a64d0a3f5d
refs/heads/master
2021-01-23T20:25:53.781815
2017-09-08T15:03:28
2017-09-08T15:03:28
102,859,093
0
0
null
null
null
null
UTF-8
Java
false
false
2,087
java
package pl.codeslab.warsztat6; import javax.persistence.EntityManagerFactory; import javax.validation.Validator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.format.FormatterRegistry; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.LocalEntityManagerFactoryBean; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; @Configuration @EnableWebMvc @ComponentScan(basePackages = { "pl.coderslab" }) @EnableTransactionManagement @EnableJpaRepositories({"pl.codeslab.repository"}) public class AppConfig extends WebMvcConfigurerAdapter { @Bean public ViewResolver viewResolver() { InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); viewResolver.setViewClass(JstlView.class); viewResolver.setPrefix("/WEB-INF/views/"); viewResolver.setSuffix(".jsp"); return viewResolver; } @Bean public LocalEntityManagerFactoryBean entityManagerFactory() { LocalEntityManagerFactoryBean emfb = new LocalEntityManagerFactoryBean(); emfb.setPersistenceUnitName("warsztaty6PersistenceUnit"); return emfb; } @Bean public JpaTransactionManager transactionManager(EntityManagerFactory emf) { JpaTransactionManager tm = new JpaTransactionManager(emf); return tm; } @Bean public Validator validator() { return new LocalValidatorFactoryBean(); } }
[ "osinskipawel0@gmail.com" ]
osinskipawel0@gmail.com
12c5eac76e8d597ee3ff0855077ebf5fc78095c3
0ae199a25f8e0959734f11071a282ee7a0169e2d
/core/store/dist/src/main/java/org/onosproject/store/device/impl/ECDeviceStore.java
daaadd6a678e5a31d132dc959144b54a9d9bc488
[ "Apache-2.0" ]
permissive
lishuai12/onosfw-L3
314d2bc79424d09dcd8f46a4c467bd36cfa9bf1b
e60902ba8da7de3816f6b999492bec2d51dd677d
refs/heads/master
2021-01-10T08:09:56.279267
2015-11-06T02:49:00
2015-11-06T02:49:00
45,652,234
0
1
null
2016-03-10T22:30:45
2015-11-06T01:49:10
Java
UTF-8
Java
false
false
36,267
java
/* * Copyright 2014-2015 Open Networking Laboratory * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.onosproject.store.device.impl; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Verify.verify; import static org.onosproject.net.DefaultAnnotations.merge; import static org.slf4j.LoggerFactory.getLogger; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Deactivate; import org.apache.felix.scr.annotations.Reference; import org.apache.felix.scr.annotations.ReferenceCardinality; import org.apache.felix.scr.annotations.Service; import org.onlab.packet.ChassisId; import org.onlab.util.KryoNamespace; import org.onlab.util.SharedExecutors; import org.onosproject.cluster.ClusterService; import org.onosproject.cluster.NodeId; import org.onosproject.mastership.MastershipService; import org.onosproject.mastership.MastershipTermService; import org.onosproject.net.Annotations; import org.onosproject.net.AnnotationsUtil; import org.onosproject.net.DefaultAnnotations; import org.onosproject.net.DefaultDevice; import org.onosproject.net.DefaultPort; import org.onosproject.net.Device; import org.onosproject.net.DeviceId; import org.onosproject.net.MastershipRole; import org.onosproject.net.OchPort; import org.onosproject.net.OduCltPort; import org.onosproject.net.OmsPort; import org.onosproject.net.Port; import org.onosproject.net.PortNumber; import org.onosproject.net.Device.Type; import org.onosproject.net.device.DefaultPortStatistics; import org.onosproject.net.device.DeviceClockService; import org.onosproject.net.device.DeviceDescription; import org.onosproject.net.device.DeviceEvent; import org.onosproject.net.device.DeviceStore; import org.onosproject.net.device.DeviceStoreDelegate; import org.onosproject.net.device.OchPortDescription; import org.onosproject.net.device.OduCltPortDescription; import org.onosproject.net.device.OmsPortDescription; import org.onosproject.net.device.PortDescription; import org.onosproject.net.device.PortStatistics; import org.onosproject.net.provider.ProviderId; import org.onosproject.store.AbstractStore; import org.onosproject.store.cluster.messaging.ClusterCommunicationService; import org.onosproject.store.impl.MastershipBasedTimestamp; import org.onosproject.store.serializers.KryoNamespaces; import org.onosproject.store.serializers.KryoSerializer; import org.onosproject.store.serializers.custom.DistributedStoreSerializers; import org.onosproject.store.service.DistributedSet; import org.onosproject.store.service.EventuallyConsistentMap; import org.onosproject.store.service.EventuallyConsistentMapEvent; import org.onosproject.store.service.Serializer; import org.onosproject.store.service.SetEvent; import org.onosproject.store.service.SetEventListener; import org.onosproject.store.service.WallClockTimestamp; import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.PUT; import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.REMOVE; import org.onosproject.store.service.EventuallyConsistentMapListener; import org.onosproject.store.service.StorageService; import org.slf4j.Logger; import static org.onosproject.net.device.DeviceEvent.Type.*; import static org.onosproject.store.device.impl.GossipDeviceStoreMessageSubjects.DEVICE_INJECTED; import static org.onosproject.store.device.impl.GossipDeviceStoreMessageSubjects.DEVICE_REMOVE_REQ; import static org.onosproject.store.device.impl.GossipDeviceStoreMessageSubjects.PORT_INJECTED; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.common.util.concurrent.Futures; /** * Manages the inventory of devices using a {@code EventuallyConsistentMap}. */ @Component(immediate = true, enabled = false) @Service public class ECDeviceStore extends AbstractStore<DeviceEvent, DeviceStoreDelegate> implements DeviceStore { private final Logger log = getLogger(getClass()); private static final String DEVICE_NOT_FOUND = "Device with ID %s not found"; private final Map<DeviceId, Device> devices = Maps.newConcurrentMap(); private final Map<DeviceId, Map<PortNumber, Port>> devicePorts = Maps.newConcurrentMap(); Set<DeviceId> pendingAvailableChangeUpdates = Sets.newConcurrentHashSet(); private EventuallyConsistentMap<DeviceKey, DeviceDescription> deviceDescriptions; private EventuallyConsistentMap<PortKey, PortDescription> portDescriptions; private EventuallyConsistentMap<DeviceId, Map<PortNumber, PortStatistics>> devicePortStats; private EventuallyConsistentMap<DeviceId, Map<PortNumber, PortStatistics>> devicePortDeltaStats; private DistributedSet<DeviceId> availableDevices; @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected StorageService storageService; @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected MastershipService mastershipService; @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected MastershipTermService mastershipTermService; @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected DeviceClockService deviceClockService; @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected ClusterCommunicationService clusterCommunicator; @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected ClusterService clusterService; private NodeId localNodeId; private EventuallyConsistentMapListener<DeviceKey, DeviceDescription> deviceUpdateListener = new InternalDeviceChangeEventListener(); private EventuallyConsistentMapListener<PortKey, PortDescription> portUpdateListener = new InternalPortChangeEventListener(); private final EventuallyConsistentMapListener<DeviceId, Map<PortNumber, PortStatistics>> portStatsListener = new InternalPortStatsListener(); private final SetEventListener<DeviceId> deviceStatusTracker = new InternalDeviceStatusTracker(); protected static final KryoSerializer SERIALIZER = new KryoSerializer() { @Override protected void setupKryoPool() { serializerPool = KryoNamespace.newBuilder() .register(DistributedStoreSerializers.STORE_COMMON) .nextId(DistributedStoreSerializers.STORE_CUSTOM_BEGIN) .register(DeviceInjectedEvent.class) .register(PortInjectedEvent.class) .build(); } }; protected static final KryoNamespace.Builder SERIALIZER_BUILDER = KryoNamespace.newBuilder() .register(KryoNamespaces.API) .register(DeviceKey.class) .register(PortKey.class) .register(DeviceKey.class) .register(PortKey.class) .register(MastershipBasedTimestamp.class); @Activate public void activate() { localNodeId = clusterService.getLocalNode().id(); deviceDescriptions = storageService.<DeviceKey, DeviceDescription>eventuallyConsistentMapBuilder() .withName("onos-device-descriptions") .withSerializer(SERIALIZER_BUILDER) .withTimestampProvider((k, v) -> { try { return deviceClockService.getTimestamp(k.deviceId()); } catch (IllegalStateException e) { return null; } }).build(); portDescriptions = storageService.<PortKey, PortDescription>eventuallyConsistentMapBuilder() .withName("onos-port-descriptions") .withSerializer(SERIALIZER_BUILDER) .withTimestampProvider((k, v) -> { try { return deviceClockService.getTimestamp(k.deviceId()); } catch (IllegalStateException e) { return null; } }).build(); devicePortStats = storageService.<DeviceId, Map<PortNumber, PortStatistics>>eventuallyConsistentMapBuilder() .withName("onos-port-stats") .withSerializer(SERIALIZER_BUILDER) .withAntiEntropyPeriod(5, TimeUnit.SECONDS) .withTimestampProvider((k, v) -> new WallClockTimestamp()) .withTombstonesDisabled() .build(); devicePortDeltaStats = storageService.<DeviceId, Map<PortNumber, PortStatistics>> eventuallyConsistentMapBuilder() .withName("onos-port-stats-delta") .withSerializer(SERIALIZER_BUILDER) .withAntiEntropyPeriod(5, TimeUnit.SECONDS) .withTimestampProvider((k, v) -> new WallClockTimestamp()) .withTombstonesDisabled() .build(); clusterCommunicator.addSubscriber(DEVICE_INJECTED, SERIALIZER::decode, this::injectDevice, SERIALIZER::encode, SharedExecutors.getPoolThreadExecutor()); clusterCommunicator.addSubscriber(PORT_INJECTED, SERIALIZER::decode, this::injectPort, SERIALIZER::encode, SharedExecutors.getPoolThreadExecutor()); availableDevices = storageService.<DeviceId>setBuilder() .withName("onos-online-devices") .withSerializer(Serializer.using(KryoNamespaces.API)) .withPartitionsDisabled() .withRelaxedReadConsistency() .build(); deviceDescriptions.addListener(deviceUpdateListener); portDescriptions.addListener(portUpdateListener); devicePortStats.addListener(portStatsListener); availableDevices.addListener(deviceStatusTracker); log.info("Started"); } @Deactivate public void deactivate() { devicePortStats.removeListener(portStatsListener); deviceDescriptions.removeListener(deviceUpdateListener); portDescriptions.removeListener(portUpdateListener); availableDevices.removeListener(deviceStatusTracker); devicePortStats.destroy(); devicePortDeltaStats.destroy(); deviceDescriptions.destroy(); portDescriptions.destroy(); devices.clear(); devicePorts.clear(); clusterCommunicator.removeSubscriber(DEVICE_INJECTED); clusterCommunicator.removeSubscriber(PORT_INJECTED); log.info("Stopped"); } @Override public Iterable<Device> getDevices() { return devices.values(); } @Override public int getDeviceCount() { return devices.size(); } @Override public Device getDevice(DeviceId deviceId) { return devices.get(deviceId); } @Override public DeviceEvent createOrUpdateDevice(ProviderId providerId, DeviceId deviceId, DeviceDescription deviceDescription) { NodeId master = mastershipService.getMasterFor(deviceId); if (localNodeId.equals(master)) { deviceDescriptions.put(new DeviceKey(providerId, deviceId), deviceDescription); return refreshDeviceCache(providerId, deviceId); } else { DeviceInjectedEvent deviceInjectedEvent = new DeviceInjectedEvent(providerId, deviceId, deviceDescription); return Futures.getUnchecked( clusterCommunicator.sendAndReceive(deviceInjectedEvent, DEVICE_INJECTED, SERIALIZER::encode, SERIALIZER::decode, master)); } } private DeviceEvent refreshDeviceCache(ProviderId providerId, DeviceId deviceId) { AtomicReference<DeviceEvent.Type> eventType = new AtomicReference<>(); Device device = devices.compute(deviceId, (k, existingDevice) -> { Device newDevice = composeDevice(deviceId); if (existingDevice == null) { eventType.set(DEVICE_ADDED); } else { // We allow only certain attributes to trigger update boolean propertiesChanged = !Objects.equals(existingDevice.hwVersion(), newDevice.hwVersion()) || !Objects.equals(existingDevice.swVersion(), newDevice.swVersion()) || !Objects.equals(existingDevice.providerId(), newDevice.providerId()); boolean annotationsChanged = !AnnotationsUtil.isEqual(existingDevice.annotations(), newDevice.annotations()); // Primary providers can respond to all changes, but ancillary ones // should respond only to annotation changes. if ((providerId.isAncillary() && annotationsChanged) || (!providerId.isAncillary() && (propertiesChanged || annotationsChanged))) { boolean replaced = devices.replace(deviceId, existingDevice, newDevice); verify(replaced, "Replacing devices cache failed. PID:%s [expected:%s, found:%s, new=%s]", providerId, existingDevice, devices.get(deviceId), newDevice); eventType.set(DEVICE_UPDATED); } } return newDevice; }); if (eventType.get() != null && !providerId.isAncillary()) { markOnline(deviceId); } return eventType.get() != null ? new DeviceEvent(eventType.get(), device) : null; } /** * Returns the primary providerId for a device. * @param deviceId device identifier * @return primary providerId */ private Set<ProviderId> getAllProviders(DeviceId deviceId) { return deviceDescriptions.keySet() .stream() .filter(deviceKey -> deviceKey.deviceId().equals(deviceId)) .map(deviceKey -> deviceKey.providerId()) .collect(Collectors.toSet()); } /** * Returns the identifier for all providers for a device. * @param deviceId device identifier * @return set of provider identifiers */ private ProviderId getPrimaryProviderId(DeviceId deviceId) { Set<ProviderId> allProviderIds = getAllProviders(deviceId); return allProviderIds.stream() .filter(p -> !p.isAncillary()) .findFirst() .orElse(Iterables.getFirst(allProviderIds, null)); } /** * Returns a Device, merging descriptions from multiple Providers. * * @param deviceId device identifier * @return Device instance */ private Device composeDevice(DeviceId deviceId) { ProviderId primaryProviderId = getPrimaryProviderId(deviceId); DeviceDescription primaryDeviceDescription = deviceDescriptions.get(new DeviceKey(primaryProviderId, deviceId)); Type type = primaryDeviceDescription.type(); String manufacturer = primaryDeviceDescription.manufacturer(); String hwVersion = primaryDeviceDescription.hwVersion(); String swVersion = primaryDeviceDescription.swVersion(); String serialNumber = primaryDeviceDescription.serialNumber(); ChassisId chassisId = primaryDeviceDescription.chassisId(); DefaultAnnotations annotations = mergeAnnotations(deviceId); return new DefaultDevice(primaryProviderId, deviceId, type, manufacturer, hwVersion, swVersion, serialNumber, chassisId, annotations); } private DeviceEvent purgeDeviceCache(DeviceId deviceId) { Device removedDevice = devices.remove(deviceId); if (removedDevice != null) { getAllProviders(deviceId).forEach(p -> deviceDescriptions.remove(new DeviceKey(p, deviceId))); return new DeviceEvent(DEVICE_REMOVED, removedDevice); } return null; } private boolean markOnline(DeviceId deviceId) { return availableDevices.add(deviceId); } @Override public DeviceEvent markOffline(DeviceId deviceId) { availableDevices.remove(deviceId); // set update listener will raise the event. return null; } @Override public List<DeviceEvent> updatePorts(ProviderId providerId, DeviceId deviceId, List<PortDescription> descriptions) { NodeId master = mastershipService.getMasterFor(deviceId); List<DeviceEvent> deviceEvents = null; if (localNodeId.equals(master)) { descriptions.forEach(description -> { PortKey portKey = new PortKey(providerId, deviceId, description.portNumber()); portDescriptions.put(portKey, description); }); deviceEvents = refreshDevicePortCache(providerId, deviceId, Optional.empty()); } else { if (master == null) { return Collections.emptyList(); } PortInjectedEvent portInjectedEvent = new PortInjectedEvent(providerId, deviceId, descriptions); deviceEvents = Futures.getUnchecked( clusterCommunicator.sendAndReceive(portInjectedEvent, PORT_INJECTED, SERIALIZER::encode, SERIALIZER::decode, master)); } return deviceEvents == null ? Collections.emptyList() : deviceEvents; } private List<DeviceEvent> refreshDevicePortCache(ProviderId providerId, DeviceId deviceId, Optional<PortNumber> portNumber) { Device device = devices.get(deviceId); checkArgument(device != null, DEVICE_NOT_FOUND, deviceId); List<DeviceEvent> events = Lists.newArrayList(); Map<PortNumber, Port> ports = devicePorts.computeIfAbsent(deviceId, key -> Maps.newConcurrentMap()); List<PortDescription> descriptions = Lists.newArrayList(); portDescriptions.entrySet().forEach(e -> { PortKey key = e.getKey(); PortDescription value = e.getValue(); if (key.deviceId().equals(deviceId) && key.providerId().equals(providerId)) { if (portNumber.isPresent()) { if (portNumber.get().equals(key.portNumber())) { descriptions.add(value); } } else { descriptions.add(value); } } }); for (PortDescription description : descriptions) { final PortNumber number = description.portNumber(); ports.compute(number, (k, existingPort) -> { Port newPort = composePort(device, number); if (existingPort == null) { events.add(new DeviceEvent(PORT_ADDED, device, newPort)); } else { if (existingPort.isEnabled() != newPort.isEnabled() || existingPort.type() != newPort.type() || existingPort.portSpeed() != newPort.portSpeed() || !AnnotationsUtil.isEqual(existingPort.annotations(), newPort.annotations())) { events.add(new DeviceEvent(PORT_UPDATED, device, newPort)); } } return newPort; }); } return events; } /** * Returns a Port, merging descriptions from multiple Providers. * * @param device device the port is on * @param number port number * @return Port instance */ private Port composePort(Device device, PortNumber number) { Map<ProviderId, PortDescription> descriptions = Maps.newHashMap(); portDescriptions.entrySet().forEach(entry -> { PortKey portKey = entry.getKey(); if (portKey.deviceId().equals(device.id()) && portKey.portNumber().equals(number)) { descriptions.put(portKey.providerId(), entry.getValue()); } }); ProviderId primary = getPrimaryProviderId(device.id()); PortDescription primaryDescription = descriptions.get(primary); // if no primary, assume not enabled boolean isEnabled = false; DefaultAnnotations annotations = DefaultAnnotations.builder().build(); if (primaryDescription != null) { isEnabled = primaryDescription.isEnabled(); annotations = merge(annotations, primaryDescription.annotations()); } Port updated = null; for (Entry<ProviderId, PortDescription> e : descriptions.entrySet()) { if (e.getKey().equals(primary)) { continue; } annotations = merge(annotations, e.getValue().annotations()); updated = buildTypedPort(device, number, isEnabled, e.getValue(), annotations); } if (primaryDescription == null) { return updated == null ? new DefaultPort(device, number, false, annotations) : updated; } return updated == null ? buildTypedPort(device, number, isEnabled, primaryDescription, annotations) : updated; } private Port buildTypedPort(Device device, PortNumber number, boolean isEnabled, PortDescription description, Annotations annotations) { switch (description.type()) { case OMS: OmsPortDescription omsDesc = (OmsPortDescription) description; return new OmsPort(device, number, isEnabled, omsDesc.minFrequency(), omsDesc.maxFrequency(), omsDesc.grid(), annotations); case OCH: OchPortDescription ochDesc = (OchPortDescription) description; return new OchPort(device, number, isEnabled, ochDesc.signalType(), ochDesc.isTunable(), ochDesc.lambda(), annotations); case ODUCLT: OduCltPortDescription oduDesc = (OduCltPortDescription) description; return new OduCltPort(device, number, isEnabled, oduDesc.signalType(), annotations); default: return new DefaultPort(device, number, isEnabled, description.type(), description.portSpeed(), annotations); } } @Override public DeviceEvent updatePortStatus(ProviderId providerId, DeviceId deviceId, PortDescription portDescription) { portDescriptions.put(new PortKey(providerId, deviceId, portDescription.portNumber()), portDescription); List<DeviceEvent> events = refreshDevicePortCache(providerId, deviceId, Optional.of(portDescription.portNumber())); return Iterables.getFirst(events, null); } @Override public List<Port> getPorts(DeviceId deviceId) { return ImmutableList.copyOf(devicePorts.getOrDefault(deviceId, Maps.newHashMap()).values()); } @Override public Port getPort(DeviceId deviceId, PortNumber portNumber) { return devicePorts.getOrDefault(deviceId, Maps.newHashMap()).get(portNumber); } @Override public DeviceEvent updatePortStatistics(ProviderId providerId, DeviceId deviceId, Collection<PortStatistics> newStatsCollection) { Map<PortNumber, PortStatistics> prvStatsMap = devicePortStats.get(deviceId); Map<PortNumber, PortStatistics> newStatsMap = Maps.newHashMap(); Map<PortNumber, PortStatistics> deltaStatsMap = Maps.newHashMap(); if (prvStatsMap != null) { for (PortStatistics newStats : newStatsCollection) { PortNumber port = PortNumber.portNumber(newStats.port()); PortStatistics prvStats = prvStatsMap.get(port); DefaultPortStatistics.Builder builder = DefaultPortStatistics.builder(); PortStatistics deltaStats = builder.build(); if (prvStats != null) { deltaStats = calcDeltaStats(deviceId, prvStats, newStats); } deltaStatsMap.put(port, deltaStats); newStatsMap.put(port, newStats); } } else { for (PortStatistics newStats : newStatsCollection) { PortNumber port = PortNumber.portNumber(newStats.port()); newStatsMap.put(port, newStats); } } devicePortDeltaStats.put(deviceId, deltaStatsMap); devicePortStats.put(deviceId, newStatsMap); // DeviceEvent returns null because of InternalPortStatsListener usage return null; } /** * Calculate delta statistics by subtracting previous from new statistics. * * @param deviceId device indentifier * @param prvStats previous port statistics * @param newStats new port statistics * @return PortStatistics */ public PortStatistics calcDeltaStats(DeviceId deviceId, PortStatistics prvStats, PortStatistics newStats) { // calculate time difference long deltaStatsSec, deltaStatsNano; if (newStats.durationNano() < prvStats.durationNano()) { deltaStatsNano = newStats.durationNano() - prvStats.durationNano() + TimeUnit.SECONDS.toNanos(1); deltaStatsSec = newStats.durationSec() - prvStats.durationSec() - 1L; } else { deltaStatsNano = newStats.durationNano() - prvStats.durationNano(); deltaStatsSec = newStats.durationSec() - prvStats.durationSec(); } DefaultPortStatistics.Builder builder = DefaultPortStatistics.builder(); DefaultPortStatistics deltaStats = builder.setDeviceId(deviceId) .setPort(newStats.port()) .setPacketsReceived(newStats.packetsReceived() - prvStats.packetsReceived()) .setPacketsSent(newStats.packetsSent() - prvStats.packetsSent()) .setBytesReceived(newStats.bytesReceived() - prvStats.bytesReceived()) .setBytesSent(newStats.bytesSent() - prvStats.bytesSent()) .setPacketsRxDropped(newStats.packetsRxDropped() - prvStats.packetsRxDropped()) .setPacketsTxDropped(newStats.packetsTxDropped() - prvStats.packetsTxDropped()) .setPacketsRxErrors(newStats.packetsRxErrors() - prvStats.packetsRxErrors()) .setPacketsTxErrors(newStats.packetsTxErrors() - prvStats.packetsTxErrors()) .setDurationSec(deltaStatsSec) .setDurationNano(deltaStatsNano) .build(); return deltaStats; } @Override public List<PortStatistics> getPortStatistics(DeviceId deviceId) { Map<PortNumber, PortStatistics> portStats = devicePortStats.get(deviceId); if (portStats == null) { return Collections.emptyList(); } return ImmutableList.copyOf(portStats.values()); } @Override public List<PortStatistics> getPortDeltaStatistics(DeviceId deviceId) { Map<PortNumber, PortStatistics> portStats = devicePortDeltaStats.get(deviceId); if (portStats == null) { return Collections.emptyList(); } return ImmutableList.copyOf(portStats.values()); } @Override public boolean isAvailable(DeviceId deviceId) { return availableDevices.contains(deviceId); } @Override public Iterable<Device> getAvailableDevices() { return Iterables.filter(Iterables.transform(availableDevices, devices::get), d -> d != null); } @Override public DeviceEvent removeDevice(DeviceId deviceId) { NodeId master = mastershipService.getMasterFor(deviceId); // if there exist a master, forward // if there is no master, try to become one and process boolean relinquishAtEnd = false; if (master == null) { final MastershipRole myRole = mastershipService.getLocalRole(deviceId); if (myRole != MastershipRole.NONE) { relinquishAtEnd = true; } log.debug("Temporarily requesting role for {} to remove", deviceId); MastershipRole role = Futures.getUnchecked(mastershipService.requestRoleFor(deviceId)); if (role == MastershipRole.MASTER) { master = localNodeId; } } if (!localNodeId.equals(master)) { log.debug("{} has control of {}, forwarding remove request", master, deviceId); clusterCommunicator.unicast(deviceId, DEVICE_REMOVE_REQ, SERIALIZER::encode, master) .whenComplete((r, e) -> { if (e != null) { log.error("Failed to forward {} remove request to its master", deviceId, e); } }); return null; } // I have control.. DeviceEvent event = null; final DeviceKey deviceKey = new DeviceKey(getPrimaryProviderId(deviceId), deviceId); DeviceDescription removedDeviceDescription = deviceDescriptions.remove(deviceKey); if (removedDeviceDescription != null) { event = purgeDeviceCache(deviceId); } if (relinquishAtEnd) { log.debug("Relinquishing temporary role acquired for {}", deviceId); mastershipService.relinquishMastership(deviceId); } return event; } private DeviceEvent injectDevice(DeviceInjectedEvent event) { return createOrUpdateDevice(event.providerId(), event.deviceId(), event.deviceDescription()); } private List<DeviceEvent> injectPort(PortInjectedEvent event) { return updatePorts(event.providerId(), event.deviceId(), event.portDescriptions()); } private DefaultAnnotations mergeAnnotations(DeviceId deviceId) { ProviderId primaryProviderId = getPrimaryProviderId(deviceId); DeviceDescription primaryDeviceDescription = deviceDescriptions.get(new DeviceKey(primaryProviderId, deviceId)); DefaultAnnotations annotations = DefaultAnnotations.builder().build(); annotations = merge(annotations, primaryDeviceDescription.annotations()); for (ProviderId providerId : getAllProviders(deviceId)) { if (!providerId.equals(primaryProviderId)) { annotations = merge(annotations, deviceDescriptions.get(new DeviceKey(providerId, deviceId)).annotations()); } } return annotations; } private class InternalDeviceStatusTracker implements SetEventListener<DeviceId> { @Override public void event(SetEvent<DeviceId> event) { final DeviceId deviceId = event.entry(); final Device device = devices.get(deviceId); if (device != null) { notifyDelegate(new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, device)); } else { pendingAvailableChangeUpdates.add(deviceId); } } } private class InternalDeviceChangeEventListener implements EventuallyConsistentMapListener<DeviceKey, DeviceDescription> { @Override public void event(EventuallyConsistentMapEvent<DeviceKey, DeviceDescription> event) { DeviceId deviceId = event.key().deviceId(); ProviderId providerId = event.key().providerId(); if (event.type() == PUT) { notifyDelegate(refreshDeviceCache(providerId, deviceId)); if (pendingAvailableChangeUpdates.remove(deviceId)) { notifyDelegate(new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, devices.get(deviceId))); } } else if (event.type() == REMOVE) { notifyDelegate(purgeDeviceCache(deviceId)); } } } private class InternalPortChangeEventListener implements EventuallyConsistentMapListener<PortKey, PortDescription> { @Override public void event(EventuallyConsistentMapEvent<PortKey, PortDescription> event) { DeviceId deviceId = event.key().deviceId(); ProviderId providerId = event.key().providerId(); PortNumber portNumber = event.key().portNumber(); if (event.type() == PUT) { if (devices.containsKey(deviceId)) { List<DeviceEvent> events = refreshDevicePortCache(providerId, deviceId, Optional.of(portNumber)); for (DeviceEvent deviceEvent : events) { notifyDelegate(deviceEvent); } } } else if (event.type() == REMOVE) { log.warn("Unexpected port removed event"); } } } private class InternalPortStatsListener implements EventuallyConsistentMapListener<DeviceId, Map<PortNumber, PortStatistics>> { @Override public void event(EventuallyConsistentMapEvent<DeviceId, Map<PortNumber, PortStatistics>> event) { if (event.type() == PUT) { Device device = devices.get(event.key()); if (device != null) { delegate.notify(new DeviceEvent(PORT_STATS_UPDATED, device)); } } } } }
[ "lishuai12@huawei.com" ]
lishuai12@huawei.com
c5786ae6dd84c3666003ad957aec4c5c0871b979
9d4c2c37e86c94fd6e6cc098d9e574cd67f2c853
/wms/src/main/java/com/xs/wms/service/OptionService.java
4bed0c837d9bea574e888dc4479d87a130576e17
[]
no_license
xingdavis/wms
e52a8b302f67379e36ef90584f03649056c856a9
69d0b1d522291bbabeaa9734389995fcb1c6a790
refs/heads/master
2020-04-05T14:35:46.539256
2016-12-11T05:06:33
2016-12-11T05:06:33
46,852,929
0
0
null
null
null
null
UTF-8
Java
false
false
1,256
java
package com.xs.wms.service; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.xs.wms.dao.IOption; import com.xs.wms.pojo.Option; import com.xs.wms.pojo.easyui.PageHelper; @Service public class OptionService { @Resource private IOption optionMapper; public Option get(int id) { return this.optionMapper.selectByPrimaryKey(id); } public List<Option> getList(Option obj) { return optionMapper.getList(obj); } public Long getDatagridTotal(Option obj) { return optionMapper.getDatagridTotal(obj); } /** * 获取列表 * @param page * @return */ public List<Option> datagrid(PageHelper page,Option obj) { page.setStart((page.getPage()-1)*page.getRows()); page.setEnd(page.getRows()); return optionMapper.datagrid(page, obj); } /** * 新增 * @param */ public int add(Option obj) { return optionMapper.insert(obj); } /** * 删除 * @param id */ public int delete(int id){ return optionMapper.deleteByPrimaryKey(id); } /** * 更新 * @param * @return */ public int update(Option obj){ return optionMapper.updateByPrimaryKey(obj); } }
[ "xingdavis@qq.com" ]
xingdavis@qq.com
b42428e77667dac5360987212ce5b9973ab33762
e49ddf6e23535806c59ea175b2f7aa4f1fb7b585
/branches/connexion/mipav/src/plugins/PlugInAlgorithmRegionDistance.java
ebb30af1bc0759c3a1bf08f963e0280aebfdc9b4
[ "MIT" ]
permissive
svn2github/mipav
ebf07acb6096dff8c7eb4714cdfb7ba1dcace76f
eb76cf7dc633d10f92a62a595e4ba12a5023d922
refs/heads/master
2023-09-03T12:21:28.568695
2019-01-18T23:13:53
2019-01-18T23:13:53
130,295,718
1
0
null
null
null
null
UTF-8
Java
false
false
203,179
java
import WildMagic.LibFoundation.Mathematics.Vector3f; import gov.nih.mipav.model.algorithms.*; import gov.nih.mipav.model.algorithms.filters.*; import gov.nih.mipav.model.file.*; import gov.nih.mipav.model.file.FileInfoBase.Unit; import gov.nih.mipav.model.structures.*; import gov.nih.mipav.view.*; import java.awt.*; import java.io.*; import java.text.*; import java.util.*; import javax.swing.*; import de.jtem.numericalMethods.algebra.linear.decompose.Eigenvalue; /** * This shows how to extend the AlgorithmBase class. * * @version October 19, 2007 * @author DOCUMENT ME! * @see AlgorithmBase * * <p>$Logfile: /mipav/src/plugins/PlugInAlgorithmRegionDistance.java $ $Revision: 72 $ $Date: 2/06/06 5:50p $ * PlugInAlgorithmRegionDistance is used to find the distances between geometric cell centers and cell * boundaries, geometric cell centers and voi geometric centers, geometric cell centers and voi centers of * mass, voi geometric centers and cell boundaries, and voi centers of mass and cell boundaries. The geometric * center is a zero order moment not using intensity multiplications. The center of mass is a first order * moment mutliplying position by intensity. The cells are blue and the chromosome regions of interest * outlined by the vois are predominantly red or green. Images can be 2D or 3D. VOIs can be supplied by the * user, but if no VOI is supplied by the user the program will automatically generate red VOIs and green VOIs * in each cell. The user can input the number of red and green VOIs to be looked for in each cell. The * default is 2 red VOIs and 2 green VOIs.</p> * * <p>1.) Only the blue portion of the red, green, blue color image is used to create the blueImage.</p> * * <p>2.) Fuzzy C means segmentation is performed on the blueImage to create a blueSegImage, in which all of * the blueImage pixel intensities are assigned to 1 of 2 classes. The lower intensity value pixels * corresponding to the background in blueImage are all given the intensity value 127 in blueSegImage and the * higher intensity value pixels in blueImage corresponding to the nucleus are all given the intensity value * 254 in blueSegImage. In fuzzy c means segmentation pixels less than the threshold are excluded from the * classification process and assigned the intensity value of 0 in the segmentation image. Here, threshold is * set to 0.0, so no pixels are less than threshold, so all the pixels in blueImage are assigned to either 127 * or 254 in blueSegImage. Why 127 and 254? The fuzzy c means program assigns values of 255/(number of * classes) to the classes in the segmented image. With 2 classes, the resulting values are 127 and 254.</p> * * <p>3.) AlgorithmThresholdDual is used to set all the pixels with intensity = 254 to pixels with intensity = * 1 and all the pixels with intensity = 127 to pixels with intensity = 0.</p> * * <p>4.) A slice by slice hole filling is performed on the blue segmented image.</p> * * <p>5.) blueSegImage is smoothed with a morphological opening followed by a morphological closing. An * opening consists of an erosion operation followed by a dilation operation. A closing consists of a dilation * operation followed by an erosion operation.</p> * * <p>6.) Erode blueSegImage with iters erosion iterations so as to be able to ID separate cells which are * touching. iters is a user specified variable with a default of 8 for 2D and 6 for 3D.</p> * * <p>7.) Assign positive integer IDs to each object between blueMin and 200,000 pixels in size in the 2D * program or between blueMin and 2,000,000 pixels in size in the 3D program. blueSegImage now has 0 for * background and a positive integer ID for each object between the minimum and maximum size. blueMin has a * default of 1,000.</p> * * <p>8.) Dilate blueSegImage with 6*iters dilation operations so as to reverse the previous erosion. iters is * a user specified variable with a default of 8 for 2D and 6 for 3D.</p> * * <p>9.) Zero all portions of the dilated objects that are zero in the blue smoothed image from the end of * step 5.</p> * * <p>10.) Set all the pixels in any blue object touching an edge to 0.</p> * * <p>11.) Export the red portion of the image to buffer and the green portion of the image to greenBuffer. * </p> * * <p>12.) If no user supplied contour VOIs are present, the program automatically generates VOIs.</p> * * <p>13.) Process each VOI one at a time. a.) For each VOI find the sum of the red intensity values, the sum * of the green intensity values, and the pixel count for each ID object. b.) Look at all the object pixel * counts and assign the ID of the object with the most pixels in the VOI to the VOI's objectID. c.) Find the * center of the VOI. If redCount >= greenCount, find the red center, otherwise find the green center. Both * the zero order geometric centers and the first order centers of mass are found. d.) Expand the nucleus to * which the VOI belongs to include the VOI.</p> * * <p>14.) Process IDArray objects one at a time. a.) Ellipse fit blue IDArray objects with first and second * moments to calculate the length of the 3 semiaxes. b.) Find the zero order moments of each blue IDArray * object. c.) Create a byteBuffer with pixels for that ID object equal to 1 and all the other pixels = 0. d.) * Import byteBuffer into grayImage. e.) Run a dilation on grayImage and export the result to dilateArray. e.) * At every point where dilateArray = 1 and byteBuffer = 0, set boundaryArray = to the id of that object. For * every point on the boundary find the square of the distance to the center of the object and if this square * distance is the lowest yet noted, put the value in lowestSquare. If this square distance is the highest yet * noted, put the value in highestSquare. f.) After examining all points in the image, the program records the * Rmin distance from the center to edge as the square root of lowestSquare and the Rmax distance from the * center to the edge as the square root of highestSquare. g.) Put points on the boundary of each blue ID * object into a second ellipsoid fitting program that uses the peripheral points to find the 3 semiaxes. h.) * Nuclei volumes are found from the blue count multiplied by the x, y, and z resolutions. 15.) Determine * nucleus-VOI distances a.) Determine the distance from the center of the ID object to the zero order center * of the VOI. Find the distance of the line segment that passes thru these 2 points and terminates at the * cell surface. b.) Find the distance from the center of the ID object to the first order center of the VOI. * Find the distance of the line segment that passes thru these 2 points and terminates at the cell surface. * </p> * * <p>Scheme for automatic VOI generation: 1.) Create a red image. 2.) Median filter the red image. 3.) Obtain * histogram information on the red image. Set the threshold so that the redFraction portion of the cumulative * histogram is at or above threshold for the fuzzy c means. 4.) Perform a 3 level fuzzy c means segmentation * on the red image. 5.) Convert the red max to 1 and the other values to 0. 6.) Remove holes from red VOIs. * 7.) Smooth red with a morphological opening followed by a closing. 8.) ID objects in red segmented image * which have at least redMin pixels. Split redIDArray objects apart into 2 or 3 redIDArray objects if they go * between 2 or 3 cells. 9.) Create a green image. 10.) Median filter the green image. 11.) Obtain histogram * information on the green image. Set the threshold so that the greenFraction portion of the cumulative * histogram is at or above threshold for the fuzzy c means. 12.) Perform a 3 level fuzzy c means segmentation * on the green image. 13.) Convert the green max to 1 and the other values to 0. 15.) Remove holes from green * VOIs. 15.) Smooth green with a morphological opening followed by a closing. 16.) ID objects in green * segmented image which have at least greenMin pixels. Split greenIDArray objects apart into 2 or 3 * greenIDArray objects if they go between 2 or 3 cells. 17.) Sort red objects by red intensity count into a * sorted red array. Have a separate sorted array for each nucleus. Put no more than redNumber red objects * into the sorted red array for each nucleus. 18.) Sort green objects by green intensity count into a sorted * green array. Have a separate sorted green array for each nucleus. Put no more than greenNumber green * objects into the sorted green array for each nucleus. 19.) Create byteBuffer with value = 0 if no sorted * object is present at that position and use a separate positive index for each red or green voi. Create an * accompanying color table to set for each nucleus the largest red voi to color yellow, the other red vois to * a color yellow.darker(), the largest green voi to color pink, and the other green vois to color * pink.darker(). Create an accompanying name table to set the name for each voi. The largest red voi in the * fifth nucleus has name 5R1. The second largest red voi in the fifth nucleus has the name 5R2. The third * largest green voi in the fourth nucleus has the name 4G3. 20.) Extract VOIs from the red_green image. 21.) * Set the source image VOIs to the VOIs obtained from the red_green image.</p> */ public class PlugInAlgorithmRegionDistance extends AlgorithmBase { //~ Static fields/initializers ------------------------------------------------------------------------------------- /** DOCUMENT ME! */ public static final int BOTH_FUZZY_HARD = 0; /** DOCUMENT ME! */ public static final int FUZZY_ONLY = 1; /** DOCUMENT ME! */ public static final int HARD_ONLY = 2; //~ Instance fields ------------------------------------------------------------------------------------------------ /** DOCUMENT ME! */ private int blueMin = 1000; /** Portion of green pixels above threshold in fuzzy c means. */ private float greenFraction = 0.15f; /** DOCUMENT ME! */ private int greenMin = 100; /** DOCUMENT ME! */ private int greenNumber = 2; /** Iterations used in erosion before IDIng = iters Iterations used in dilation after IDing = 6*iters. */ private int iters = 6; /** Portion of red pixels above threshold in fuzzy c means. */ private float redFraction = 0.25f; /** DOCUMENT ME! */ private int redMin = 100; /** DOCUMENT ME! */ private int redNumber = 2; //~ Constructors --------------------------------------------------------------------------------------------------- /** * Constructor. * * @param srcImg Source image model. * @param redMin DOCUMENT ME! * @param redFraction DOCUMENT ME! * @param redNumber DOCUMENT ME! * @param greenMin DOCUMENT ME! * @param greenFraction DOCUMENT ME! * @param greenNumber DOCUMENT ME! * @param blueMin DOCUMENT ME! * @param iters DOCUMENT ME! */ public PlugInAlgorithmRegionDistance(ModelImage srcImg, int redMin, float redFraction, int redNumber, int greenMin, float greenFraction, int greenNumber, int blueMin, int iters) { super(null, srcImg); this.redMin = redMin; this.redFraction = redFraction; this.redNumber = redNumber; this.greenMin = greenMin; this.greenFraction = greenFraction; this.greenNumber = greenNumber; this.blueMin = blueMin; this.iters = iters; } //~ Methods -------------------------------------------------------------------------------------------------------- /** * Prepares this class for destruction. */ public void finalize() { destImage = null; srcImage = null; super.finalize(); } /** * Starts the algorithm. */ public void runAlgorithm() { if (srcImage == null) { displayError("Source Image is null"); return; } if (srcImage.getNDims() == 2) { calc2D(); } else if (srcImage.getNDims() > 2) { calc3D(); } } // end runAlgorithm() /** * DOCUMENT ME! */ private void calc2D() { int length; // total number of data-elements (pixels) in image float[] buffer; AlgorithmFuzzyCMeans fcmAlgo; ModelImage grayImage; int nClasses; int nPyramid; int oneJacobiIter; int twoJacobiIter; float q; float oneSmooth; float twoSmooth; boolean outputGainField; int segmentation; boolean cropBackground; float threshold; int maxIter; float endTolerance; boolean wholeImage; float[] centroids; float min; float max; AlgorithmThresholdDual thresholdAlgo; float[] thresholds; float fillValue; AlgorithmMorphology2D openAlgo; AlgorithmMorphology2D closeAlgo; AlgorithmMorphology2D erosionAlgo; AlgorithmMorphology2D dilationAlgo; int kernel; float circleDiameter; int method; int itersDilation; int itersErosion; int numPruningPixels; int edgingType; int i, j; int x, y; int xDim = srcImage.getExtents()[0]; int yDim = srcImage.getExtents()[1]; float xRes = srcImage.getResolutions(0)[0]; float yRes = srcImage.getResolutions(0)[1]; boolean found; AlgorithmMorphology2D idObjectsAlgo2D; int numObjects; byte[] byteBuffer; byte[] IDArray; int id; byte[] dilateArray; byte[] boundaryArray; AlgorithmMorphology2D dilateAlgo; float[] xCenter; float[] yCenter; float[] centerToNearEdge; float[] centerToFarEdge; float[] greenBuffer = null; ViewVOIVector VOIs = null; ViewVOIVector VOIs2 = null; int nVOIs; short[] shortMask; int index; int redCount; int greenCount; int[] idCount; int[] objectID; int[] objectID2; int objectCount; float[] xPosGeo; float[] yPosGeo; float[] xPosGeo2; float[] yPosGeo2; float[] xPosGrav; float[] yPosGrav; float[] xPosGrav2; float[] yPosGrav2; float colorCount[]; float geoToCenter; float gravToCenter; float geoToEdge; float gravToEdge; ViewUserInterface UI = ViewUserInterface.getReference(); float distSqr; float lowestSqr; float highestSqr; // int xEdge = -1; // int yEdge = -1; int xUnits = srcImage.getFileInfo(0).getUnitsOfMeasure()[0]; int yUnits = srcImage.getFileInfo(0).getUnitsOfMeasure()[1]; FileInfoBase fileInfo; int numRedObjects = 0; int numGreenObjects = 0; byte[] redIDArray = null; byte[] greenIDArray = null; float[] redIntensityTotal; float[] greenIntensityTotal; float[] redXCenter; float[] redYCenter; float[] greenXCenter; float[] greenYCenter; int[] redNucleusNumber = null; int[][] sortedRedIndex = null; float[][] sortedRedIntensity; float[][] sortedRedXCenter; float[][] sortedRedYCenter; int[] greenNucleusNumber = null; int[][] sortedGreenIndex = null; float[][] sortedGreenIntensity; float[][] sortedGreenXCenter; float[][] sortedGreenYCenter; int k; AlgorithmVOIExtraction algoVOIExtraction; VOI newPtVOI; float[] xArr = new float[1]; float[] yArr = new float[1]; float[] zArr = new float[1]; int numVOIObjects; Color[] colorTable = null; boolean removeID; int m; AlgorithmMedian algoMedian; int medianIters; int kernelSize; int kernelShape; float stdDev; String[] nameTable = null; String voiName; float[] blueCountTotal = null; AlgorithmMorphology2D fillHolesAlgo2D; int[] voiCount; int[] voiCount2; // int j1; int redFound; int greenFound; char voiType; float nuclearArea; // float equivalentRadius; float voiArea; NumberFormat nf; float initialdx; float initialdy; int lastEdgeX; int lastEdgeY; int newEdgeX; int newEdgeY; float incx; float incy; int numInc; float centerToGeoToEdge; float centerToGravToEdge; int moreRedObjects; int moreGreenObjects; int[] redObjectNucleus; int[] greenObjectNucleus; int maxNucleus; int maxCount; int secondMaxNucleus; int secondMaxCount; int thirdMaxNucleus; int thirdMaxCount; int numRedVOIObjects; int numGreenVOIObjects; int edgeObjects; AlgorithmHistogram algoHist; int bins; int[] histoBuffer; double[] lowValue; int totalCount; int countsToRetain; int countsFound; boolean adaptiveSize = false; int maximumSize = 0; boolean initiallyOneObject; int response; boolean isRed[]; int numRedFound; int numGreenFound; int rIndex[]; float rCount[]; int gIndex[]; float gCount[]; boolean placed; int index2; nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(3); nf.setMaximumFractionDigits(3); VOIs = srcImage.getVOIs(); nVOIs = VOIs.size(); for (i = nVOIs - 1; i >=0; i--) { if (VOIs.VOIAt(i).getCurveType() != VOI.CONTOUR) { VOIs.remove(i); } } nVOIs = VOIs.size(); if (nVOIs > 0) { // Increase redNumber and greenNumber based on what is found in supplied VOIs redNumber = 1; greenNumber = 1; } try { // image length is length in 2 dims length = xDim * yDim; buffer = new float[length]; srcImage.exportRGBData(3, 0, length, buffer); // export blue data } catch (IOException error) { buffer = null; errorCleanUp("Algorithm RegionDistance reports: source image locked", true); return; } catch (OutOfMemoryError e) { buffer = null; errorCleanUp("Algorithm RegionDistance reports: out of memory", true); return; } fireProgressStateChanged("Processing image ..."); fireProgressStateChanged("Creating blue image"); grayImage = new ModelImage(ModelStorageBase.FLOAT, srcImage.getExtents(), srcImage.getImageName() + "_gray"); fileInfo = grayImage.getFileInfo()[0]; fileInfo.setResolutions(srcImage.getFileInfo()[0].getResolutions()); fileInfo.setUnitsOfMeasure(srcImage.getFileInfo()[0].getUnitsOfMeasure()); grayImage.setFileInfo(fileInfo, 0); try { grayImage.importData(0, buffer, true); } catch (IOException error) { buffer = null; errorCleanUp("Error on grayImage.importData", true); return; } // Segment into 2 values fireProgressStateChanged("Performing FuzzyCMeans Segmentation on blue"); if (nVOIs > 0) { fireProgressStateChanged(5); } else { fireProgressStateChanged(2); } nClasses = 2; nPyramid = 4; oneJacobiIter = 1; twoJacobiIter = 2; q = 2.0f; oneSmooth = 2e4f; twoSmooth = 2e5f; outputGainField = false; segmentation = HARD_ONLY; cropBackground = false; threshold = 0.0f; maxIter = 200; endTolerance = 0.01f; wholeImage = true; // grayImage enters ModelStorageBase.FLOAT and returns ModelStorageBase.UBYTE fcmAlgo = new AlgorithmFuzzyCMeans(grayImage, nClasses, nPyramid, oneJacobiIter, twoJacobiIter, q, oneSmooth, twoSmooth, outputGainField, segmentation, cropBackground, threshold, maxIter, endTolerance, wholeImage); centroids = new float[2]; min = (float) grayImage.getMin(); max = (float) grayImage.getMax(); centroids[0] = min + ((max - min) / 3.0f); centroids[1] = min + (2.0f * (max - min) / 3.0f); fcmAlgo.setCentroids(centroids); fcmAlgo.run(); fcmAlgo.finalize(); fcmAlgo = null; // Now convert the min and max to 0 and 1 fireProgressStateChanged("Setting segmented blue values to 0 and 1"); if (nVOIs > 0) { fireProgressStateChanged(20); } else { fireProgressStateChanged(6); } grayImage.calcMinMax(); max = (float) grayImage.getMax(); thresholds = new float[2]; thresholds[0] = max; thresholds[1] = max; fillValue = 0.0f; thresholdAlgo = new AlgorithmThresholdDual(grayImage, thresholds, fillValue, AlgorithmThresholdDual.BINARY_TYPE, wholeImage, false); thresholdAlgo.run(); thresholdAlgo.finalize(); thresholdAlgo = null; // Remove all inappropriate holes in blue nuclei fireProgressStateChanged("Removing holes from blue nuclei"); if (nVOIs > 0) { fireProgressStateChanged(23); } else { fireProgressStateChanged(7); } fillHolesAlgo2D = new AlgorithmMorphology2D(grayImage, 0, 0, AlgorithmMorphology2D.FILL_HOLES, 0, 0, 0, 0, wholeImage); fillHolesAlgo2D.run(); fillHolesAlgo2D.finalize(); fillHolesAlgo2D = null; // Smooth with a morphological opening followed by a closing fireProgressStateChanged("Opening blue segmented image"); if (nVOIs > 0) { fireProgressStateChanged(25); } else { fireProgressStateChanged(8); } kernel = AlgorithmMorphology2D.CONNECTED4; circleDiameter = 1.0f; method = AlgorithmMorphology2D.OPEN; itersDilation = 1; itersErosion = 1; numPruningPixels = 0; edgingType = 0; openAlgo = new AlgorithmMorphology2D(grayImage, kernel, circleDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); openAlgo.run(); openAlgo.finalize(); openAlgo = null; fireProgressStateChanged("Closing blue segmented image"); if (nVOIs > 0) { fireProgressStateChanged(30); } else { fireProgressStateChanged(10); } method = AlgorithmMorphology2D.CLOSE; closeAlgo = new AlgorithmMorphology2D(grayImage, kernel, circleDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); closeAlgo.run(); closeAlgo.finalize(); closeAlgo = null; byteBuffer = new byte[length]; try { grayImage.exportData(0, length, byteBuffer); } catch (IOException error) { byteBuffer = null; errorCleanUp("Error on grayImage.exportData", true); return; } fireProgressStateChanged("Eroding blue segmented image"); if (nVOIs > 0) { fireProgressStateChanged(35); } else { fireProgressStateChanged(12); } kernel = AlgorithmMorphology2D.CONNECTED4; method = AlgorithmMorphology2D.ERODE; itersDilation = 0; itersErosion = iters; erosionAlgo = new AlgorithmMorphology2D(grayImage, kernel, circleDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); erosionAlgo.run(); erosionAlgo.finalize(); erosionAlgo = null; // Put the object IDs in IDArray and the corresponding boundaries // in boundaryArray fireProgressStateChanged("IDing objects in blue segmented image"); if (nVOIs > 0) { fireProgressStateChanged(45); } else { fireProgressStateChanged(15); } kernel = AlgorithmMorphology2D.SIZED_CIRCLE; circleDiameter = 0.0f; method = AlgorithmMorphology2D.ID_OBJECTS; itersDilation = 0; itersErosion = 0; idObjectsAlgo2D = new AlgorithmMorphology2D(grayImage, kernel, circleDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); idObjectsAlgo2D.setMinMax(blueMin, 200000); idObjectsAlgo2D.run(); idObjectsAlgo2D.finalize(); idObjectsAlgo2D = null; grayImage.calcMinMax(); numObjects = (int) grayImage.getMax(); fireProgressStateChanged("Dilating IDed objects in blue segmented image"); if (nVOIs > 0) { fireProgressStateChanged(55); } else { fireProgressStateChanged(18); } kernel = AlgorithmMorphology2D.CONNECTED4; method = AlgorithmMorphology2D.DILATE; itersDilation = 6 * iters; itersErosion = 0; dilationAlgo = new AlgorithmMorphology2D(grayImage, kernel, circleDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); dilationAlgo.run(); dilationAlgo.finalize(); dilationAlgo = null; IDArray = new byte[length]; try { grayImage.exportData(0, length, IDArray); } catch (IOException error) { byteBuffer = null; IDArray = null; errorCleanUp("Error on grayImage.exportData", true); return; } fireProgressStateChanged("Zeroing overgrowth of dilated objects"); if (nVOIs > 0) { fireProgressStateChanged(65); } else { fireProgressStateChanged(22); } // byteBuffer contains the smoothed blue objects before erosion // IDArray contains the objects after erosion and dilation for (i = 0; i < length; i++) { if (byteBuffer[i] == (byte) 0) { IDArray[i] = (byte) 0; } } edgeObjects = numObjects; fireProgressStateChanged("Removing blue objects touching edges"); if (nVOIs > 0) { fireProgressStateChanged(70); } else { fireProgressStateChanged(23); } if (numObjects == 1) { initiallyOneObject = true; } else { initiallyOneObject = false; } for (id = numObjects; id >= 1; id--) { removeID = false; for (j = 0, y = 0; y < yDim; y++, j += xDim) { for (x = 0; x < xDim; x++) { i = x + j; if ((IDArray[i] == id) && ((x == 0) || (x == (xDim - 1)) || (y == 0) || (y == (yDim - 1)))) { removeID = true; } } // for (x = 0; x < xDim; x++) } // for (j = 0, y = 0; y < yDim; y++, j += xDim) if (initiallyOneObject && removeID) { response = JOptionPane.showConfirmDialog(UI.getMainFrame(), "Delete the one blue object with edge touching?", "Deletion", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.NO_OPTION) { removeID = false; } } // if (initiallyOneObject && removeID) if (removeID) { for (i = 0; i < length; i++) { if (IDArray[i] == (byte) id) { IDArray[i] = (byte) 0; } else if (IDArray[i] > id) { IDArray[i]--; } } numObjects--; } // if (removeID) } // for (id = numObjects; id >= 1; id--) if (numObjects == 0) { MipavUtil.displayError(edgeObjects + " blue objects touched edges"); MipavUtil.displayError("No blue objects that do not touch edges"); setCompleted(false); return; } if (greenNumber > 0) { greenBuffer = new float[length]; } try { if (redNumber > 0) { srcImage.exportRGBData(1, 0, length, buffer); // export red data } // if (redNumber > 0) if (greenNumber > 0) { srcImage.exportRGBData(2, 0, length, greenBuffer); // export green data } // if (greenNumber > 0) } catch (IOException error) { buffer = null; greenBuffer = null; errorCleanUp("Algorithm RegionDistance reports: source image locked", true); return; } if (nVOIs == 0) { if (redNumber > 0) { fireProgressStateChanged("Creating red image"); fireProgressStateChanged(30); // grayImage is ModelStorageBase.UBYTE grayImage.reallocate(ModelStorageBase.FLOAT); try { grayImage.importData(0, buffer, true); } catch (IOException error) { buffer = null; errorCleanUp("Error on grayImage.importData", true); return; } fireProgressStateChanged("Performing median filter on red"); fireProgressStateChanged(31); medianIters = 1; kernelSize = 3; kernelShape = AlgorithmMedian.SQUARE_KERNEL; stdDev = 0.0f; wholeImage = true; algoMedian = new AlgorithmMedian(grayImage, medianIters, kernelSize, kernelShape, stdDev, adaptiveSize, maximumSize, wholeImage); algoMedian.run(); algoMedian.finalize(); algoMedian = null; fireProgressStateChanged("Getting histogram info on red"); fireProgressStateChanged(32); bins = 256; algoHist = new AlgorithmHistogram(grayImage, bins); algoHist.run(); histoBuffer = algoHist.getHistoBuffer(); lowValue = algoHist.getLowValue(); algoHist.finalize(); algoHist = null; totalCount = histoBuffer[0]; for (i = 1; i < histoBuffer.length; i++) { totalCount += histoBuffer[i]; } countsToRetain = (int) Math.round(redFraction * totalCount); found = false; countsFound = 0; threshold = 1.0f; for (i = bins - 1; (i >= 0) && !found; i--) { countsFound += histoBuffer[i]; if (countsFound >= countsToRetain) { found = true; threshold = (float) lowValue[i]; } } cropBackground = true; // Segment red into 3 values fireProgressStateChanged("Performing FuzzyCMeans Segmentation on red"); fireProgressStateChanged(33); nClasses = 3; nPyramid = 4; oneJacobiIter = 1; twoJacobiIter = 2; q = 2.0f; oneSmooth = 2e4f; twoSmooth = 2e5f; outputGainField = false; segmentation = HARD_ONLY; maxIter = 200; endTolerance = 0.01f; wholeImage = true; // grayImage enters ModelStorageBase.FLOAT and returns ModelStorageBase.UBYTE fcmAlgo = new AlgorithmFuzzyCMeans(grayImage, nClasses, nPyramid, oneJacobiIter, twoJacobiIter, q, oneSmooth, twoSmooth, outputGainField, segmentation, cropBackground, threshold, maxIter, endTolerance, wholeImage); centroids = new float[3]; // Find the first value above the 0 value for min min = Float.MAX_VALUE; for (i = 0; i < length; i++) { if ((buffer[i] < min) && (buffer[i] != 0.0f)) { min = buffer[i]; } } max = (float) grayImage.getMax(); centroids[0] = min + ((max - min) / 4.0f); centroids[1] = min + (2.0f * (max - min) / 4.0f); centroids[2] = min + (3.0f * (max - min) / 4.0f); fcmAlgo.setCentroids(centroids); fcmAlgo.run(); fcmAlgo.finalize(); fcmAlgo = null; // ViewJFrameImage testFrame = new ViewJFrameImage(grayImage, null, // new Dimension(600, 300), srcImage.getUserInterface()); // Now convert the red min and max to 0 and 1 fireProgressStateChanged("Setting segmented red values to 0 and 1"); fireProgressStateChanged(35); grayImage.calcMinMax(); max = (float) grayImage.getMax(); thresholds[0] = max; thresholds[1] = max; fillValue = 0.0f; thresholdAlgo = new AlgorithmThresholdDual(grayImage, thresholds, fillValue, AlgorithmThresholdDual.BINARY_TYPE, wholeImage, false); thresholdAlgo.run(); thresholdAlgo.finalize(); thresholdAlgo = null; // Remove all inappropriate holes in red VOIs fireProgressStateChanged("Removing holes from red VOIs"); fireProgressStateChanged(37); fillHolesAlgo2D = new AlgorithmMorphology2D(grayImage, 0, 0, AlgorithmMorphology2D.FILL_HOLES, 0, 0, 0, 0, wholeImage); fillHolesAlgo2D.run(); fillHolesAlgo2D.finalize(); fillHolesAlgo2D = null; // Smooth red with a morphological opening followed by a closing fireProgressStateChanged("Opening red segmented image"); fireProgressStateChanged(40); kernel = AlgorithmMorphology2D.CONNECTED4; circleDiameter = 1.0f; method = AlgorithmMorphology2D.OPEN; itersDilation = 1; itersErosion = 1; numPruningPixels = 0; edgingType = 0; openAlgo = new AlgorithmMorphology2D(grayImage, kernel, circleDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); openAlgo.run(); openAlgo.finalize(); openAlgo = null; fireProgressStateChanged("Closing red segmented image"); fireProgressStateChanged(42); method = AlgorithmMorphology2D.CLOSE; closeAlgo = new AlgorithmMorphology2D(grayImage, kernel, circleDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); closeAlgo.run(); closeAlgo.finalize(); closeAlgo = null; // Put the red VOI IDs in redIDArray fireProgressStateChanged("IDing objects in red segmented image"); fireProgressStateChanged(44); kernel = AlgorithmMorphology2D.SIZED_CIRCLE; circleDiameter = 0.0f; method = AlgorithmMorphology2D.ID_OBJECTS; itersDilation = 0; itersErosion = 0; idObjectsAlgo2D = new AlgorithmMorphology2D(grayImage, kernel, circleDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); idObjectsAlgo2D.setMinMax(redMin, 200000); idObjectsAlgo2D.run(); idObjectsAlgo2D.finalize(); idObjectsAlgo2D = null; grayImage.calcMinMax(); numRedObjects = (int) grayImage.getMax(); redIDArray = new byte[length]; try { grayImage.exportData(0, length, redIDArray); } catch (IOException error) { byteBuffer = null; redIDArray = null; errorCleanUp("Error on grayImage.exportData", true); return; } // Split redIDArray objects apart into 2 or 3 redIDArray objects // if they go between 2 or 3 cells moreRedObjects = 0; redObjectNucleus = new int[numObjects + 1]; for (i = 1; i <= numRedObjects; i++) { for (j = 0; j <= numObjects; j++) { redObjectNucleus[j] = 0; } // for (j = 0; j <= numObjects; j++) for (j = 0; j < length; j++) { if (redIDArray[j] == i) { redObjectNucleus[IDArray[j]]++; } // if (redIDArray[j] == i) } // for (j = 0; j < totLength; j++) maxNucleus = 1; maxCount = redObjectNucleus[1]; for (j = 2; j <= numObjects; j++) { if (redObjectNucleus[j] > maxCount) { maxNucleus = j; maxCount = redObjectNucleus[j]; } } // for (j = 2; j <= numObjects; j++) secondMaxCount = 0; secondMaxNucleus = 0; for (j = 1; j <= numObjects; j++) { if (j != maxNucleus) { if (redObjectNucleus[j] > secondMaxCount) { secondMaxNucleus = j; secondMaxCount = redObjectNucleus[j]; } // if (redObjectNucleus[j] > secondMaxCount) } // if (j != maxNucleus) } // for (j = 1; j <= numObjects; j++) if (secondMaxCount > 0) { if (secondMaxCount >= redMin) { moreRedObjects++; for (j = 0; j < length; j++) { if ((redIDArray[j] == i) && (IDArray[j] == secondMaxNucleus)) { redIDArray[j] = (byte) (numRedObjects + moreRedObjects); } } // for (j = 0; j < totLength; j++) thirdMaxCount = 0; thirdMaxNucleus = 0; for (j = 1; j <= numObjects; j++) { if ((j != maxNucleus) && (j != secondMaxNucleus)) { if (redObjectNucleus[j] > thirdMaxCount) { thirdMaxNucleus = j; thirdMaxCount = redObjectNucleus[j]; } // if (redObjectNucleus[j] > thirdMaxCount) } // if ((j != maxNucleus) && (j != secondMaxNucleus)) } // for (j = 1; j <= numObjects; j++) if (thirdMaxCount > 0) { if (thirdMaxCount >= redMin) { moreRedObjects++; for (j = 0; j < length; j++) { if ((redIDArray[j] == i) && (IDArray[j] == thirdMaxNucleus)) { redIDArray[j] = (byte) (numRedObjects + moreRedObjects); } } // for (j = 0; j < totLength; j++) } // if (thirdMaxCount >= redMin) else { // thirdMaxCount < redMin for (j = 0; j < length; j++) { if ((redIDArray[j] == i) && (IDArray[j] != 0) && (IDArray[j] != maxNucleus) && (IDArray[j] != secondMaxNucleus)) { redIDArray[j] = (byte) 0; } } // for (j = 0; j < totLength; j++) } // else thirdMaxCount < redMin } // if (thirdMaxCount > 0) } // if (secondMaxCount >= redMin) else { // secondMaxCount < redMin for (j = 0; j < length; j++) { if ((redIDArray[j] == i) && (IDArray[j] != 0) && (IDArray[j] != maxNucleus)) { redIDArray[j] = (byte) 0; } } // for (j = 0; j < totLength; j++) } // secondMaxCount < redMin } // if (secondMaxCount > 0) } // for (i = 1; i <= numRedObjects; i++) numRedObjects = numRedObjects + moreRedObjects; } // if (redNumber > 0) if (greenNumber > 0) { fireProgressStateChanged("Creating green image"); fireProgressStateChanged(46); // grayImage is ModelStorageBase.UBYTE grayImage.reallocate(ModelStorageBase.FLOAT); try { grayImage.importData(0, greenBuffer, true); } catch (IOException error) { greenBuffer = null; errorCleanUp("Error on grayImage.importData", true); return; } fireProgressStateChanged("Performing median filter on green"); fireProgressStateChanged(47); medianIters = 1; kernelSize = 3; kernelShape = AlgorithmMedian.SQUARE_KERNEL; stdDev = 0.0f; wholeImage = true; algoMedian = new AlgorithmMedian(grayImage, medianIters, kernelSize, kernelShape, stdDev, adaptiveSize, maximumSize, wholeImage); algoMedian.run(); algoMedian.finalize(); algoMedian = null; fireProgressStateChanged("Getting histogram info on green"); fireProgressStateChanged(48); bins = 256; algoHist = new AlgorithmHistogram(grayImage, bins); algoHist.run(); histoBuffer = algoHist.getHistoBuffer(); lowValue = algoHist.getLowValue(); algoHist.finalize(); algoHist = null; totalCount = histoBuffer[0]; for (i = 1; i < histoBuffer.length; i++) { totalCount += histoBuffer[i]; } countsToRetain = (int) Math.round(greenFraction * totalCount); found = false; countsFound = 0; threshold = 1.0f; for (i = bins - 1; (i >= 0) && !found; i--) { countsFound += histoBuffer[i]; if (countsFound >= countsToRetain) { found = true; threshold = (float) lowValue[i]; } } cropBackground = true; // Segment green into 3 values fireProgressStateChanged("Performing FuzzyCMeans Segmentation on green"); fireProgressStateChanged(49); nClasses = 3; nPyramid = 4; oneJacobiIter = 1; twoJacobiIter = 2; q = 2.0f; oneSmooth = 2e4f; twoSmooth = 2e5f; outputGainField = false; segmentation = HARD_ONLY; maxIter = 200; endTolerance = 0.01f; wholeImage = true; // grayImage enters ModelStorageBase.FLOAT and returns ModelStorageBase.UBYTE fcmAlgo = new AlgorithmFuzzyCMeans(grayImage, nClasses, nPyramid, oneJacobiIter, twoJacobiIter, q, oneSmooth, twoSmooth, outputGainField, segmentation, cropBackground, threshold, maxIter, endTolerance, wholeImage); centroids = new float[3]; // Find the first value above the 0 value for min min = Float.MAX_VALUE; for (i = 0; i < length; i++) { if ((greenBuffer[i] < min) && (greenBuffer[i] != 0.0f)) { min = greenBuffer[i]; } } max = (float) grayImage.getMax(); centroids[0] = min + ((max - min) / 4.0f); centroids[1] = min + (2.0f * (max - min) / 4.0f); centroids[2] = min + (3.0f * (max - min) / 4.0f); fcmAlgo.setCentroids(centroids); fcmAlgo.run(); fcmAlgo.finalize(); fcmAlgo = null; // Now convert the green min and max to 0 and 1 fireProgressStateChanged("Setting segmented green values to 0 and 1"); fireProgressStateChanged(50); grayImage.calcMinMax(); max = (float) grayImage.getMax(); thresholds[0] = max; thresholds[1] = max; fillValue = 0.0f; thresholdAlgo = new AlgorithmThresholdDual(grayImage, thresholds, fillValue, AlgorithmThresholdDual.BINARY_TYPE, wholeImage, false); thresholdAlgo.run(); thresholdAlgo.finalize(); thresholdAlgo = null; // Remove all inappropriate holes in green VOIs fireProgressStateChanged("Removing holes from green VOIs"); fireProgressStateChanged(52); fillHolesAlgo2D = new AlgorithmMorphology2D(grayImage, 0, 0, AlgorithmMorphology2D.FILL_HOLES, 0, 0, 0, 0, wholeImage); fillHolesAlgo2D.run(); fillHolesAlgo2D.finalize(); fillHolesAlgo2D = null; // Smooth green with a morphological opening followed by a closing fireProgressStateChanged("Opening green segmented image"); fireProgressStateChanged(54); kernel = AlgorithmMorphology2D.CONNECTED4; circleDiameter = 1.0f; method = AlgorithmMorphology2D.OPEN; itersDilation = 1; itersErosion = 1; numPruningPixels = 0; edgingType = 0; openAlgo = new AlgorithmMorphology2D(grayImage, kernel, circleDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); openAlgo.run(); openAlgo.finalize(); openAlgo = null; fireProgressStateChanged("Closing green segmented image"); fireProgressStateChanged(56); method = AlgorithmMorphology2D.CLOSE; closeAlgo = new AlgorithmMorphology2D(grayImage, kernel, circleDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); closeAlgo.run(); closeAlgo.finalize(); closeAlgo = null; // Put the green VOI IDs in greenIDArray fireProgressStateChanged("IDing objects in green segmented image"); fireProgressStateChanged(58); kernel = AlgorithmMorphology2D.SIZED_CIRCLE; circleDiameter = 0.0f; method = AlgorithmMorphology2D.ID_OBJECTS; itersDilation = 0; itersErosion = 0; idObjectsAlgo2D = new AlgorithmMorphology2D(grayImage, kernel, circleDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); idObjectsAlgo2D.setMinMax(greenMin, 200000); idObjectsAlgo2D.run(); idObjectsAlgo2D.finalize(); idObjectsAlgo2D = null; grayImage.calcMinMax(); numGreenObjects = (int) grayImage.getMax(); greenIDArray = new byte[length]; try { grayImage.exportData(0, length, greenIDArray); } catch (IOException error) { byteBuffer = null; greenIDArray = null; errorCleanUp("Error on grayImage.exportData", true); return; } // Split greenIDArray objects apart into 2 or 3 greenIDArray objects // if they go between 2 or 3 cells moreGreenObjects = 0; greenObjectNucleus = new int[numObjects + 1]; for (i = 1; i <= numGreenObjects; i++) { for (j = 0; j <= numObjects; j++) { greenObjectNucleus[j] = 0; } // for (j = 0; j <= numObjects; j++) for (j = 0; j < length; j++) { if (greenIDArray[j] == i) { greenObjectNucleus[IDArray[j]]++; } // if (greenIDArray[j] == i) } // for (j = 0; j < totLength; j++) maxNucleus = 1; maxCount = greenObjectNucleus[1]; for (j = 2; j <= numObjects; j++) { if (greenObjectNucleus[j] > maxCount) { maxNucleus = j; maxCount = greenObjectNucleus[j]; } } // for (j = 2; j <= numObjects; j++) secondMaxCount = 0; secondMaxNucleus = 0; for (j = 1; j <= numObjects; j++) { if (j != maxNucleus) { if (greenObjectNucleus[j] > secondMaxCount) { secondMaxNucleus = j; secondMaxCount = greenObjectNucleus[j]; } // if (greenObjectNucleus[j] > secondMaxCount) } // if (j != maxNucleus) } // for (j = 1; j <= numObjects; j++) if (secondMaxCount > 0) { if (secondMaxCount >= greenMin) { moreGreenObjects++; for (j = 0; j < length; j++) { if ((greenIDArray[j] == i) && (IDArray[j] == secondMaxNucleus)) { greenIDArray[j] = (byte) (numGreenObjects + moreGreenObjects); } } // for (j = 0; j < totLength; j++) thirdMaxCount = 0; thirdMaxNucleus = 0; for (j = 1; j <= numObjects; j++) { if ((j != maxNucleus) && (j != secondMaxNucleus)) { if (greenObjectNucleus[j] > thirdMaxCount) { thirdMaxNucleus = j; thirdMaxCount = greenObjectNucleus[j]; } // if (greenObjectNucleus[j] > thirdMaxCount) } // if ((j != maxNucleus) && (j != secondMaxNucleus)) } // for (j = 1; j <= numObjects; j++) if (thirdMaxCount > 0) { if (thirdMaxCount >= greenMin) { moreGreenObjects++; for (j = 0; j < length; j++) { if ((greenIDArray[j] == i) && (IDArray[j] == thirdMaxNucleus)) { greenIDArray[j] = (byte) (numGreenObjects + moreGreenObjects); } } // for (j = 0; j < totLength; j++) } else { // if (thirdMaxCount >= greenMin), thirdMaxCount < greenMin for (j = 0; j < length; j++) { if ((greenIDArray[j] == i) && (IDArray[j] != 0) && (IDArray[j] != maxNucleus) && (IDArray[j] != secondMaxNucleus)) { greenIDArray[j] = (byte) 0; } } // for (j = 0; j < totLength; j++) } // else thirdMaxCount < greenMin } // if (thirdMaxCount > 0) } else { // if (secondMaxCount >= greenMin), secondMaxCount < greenMin for (j = 0; j < length; j++) { if ((greenIDArray[j] == i) && (IDArray[j] != 0) && (IDArray[j] != maxNucleus)) { greenIDArray[j] = (byte) 0; } } // for (j = 0; j < totLength; j++) } // secondMaxCount < greenMin } // if (secondMaxCount > 0) } // for (i = 1; i <= numGreenObjects; i++) numGreenObjects = numGreenObjects + moreGreenObjects; } // if (greenNumber > 0) if (redNumber > 0) { // Sort the red objects within each nucleus. // Create no more than redNumber red objects within each nucleus. fireProgressStateChanged("Sorting red objects by intensity count"); fireProgressStateChanged(60); redIntensityTotal = new float[numRedObjects]; redXCenter = new float[numRedObjects]; redYCenter = new float[numRedObjects]; redNucleusNumber = new int[numObjects]; sortedRedIndex = new int[numObjects][redNumber]; sortedRedIntensity = new float[numObjects][redNumber]; sortedRedXCenter = new float[numObjects][redNumber]; sortedRedYCenter = new float[numObjects][redNumber]; for (j = 1; j <= numRedObjects; j++) { for (i = 0, x = 0, y = 0; i < length; i++) { if (redIDArray[i] == j) { redIntensityTotal[j - 1] += buffer[i]; redXCenter[j - 1] += buffer[i] * x; redYCenter[j - 1] += buffer[i] * y; } x++; if (x == xDim) { x = 0; y++; } } // for (i = 0, x = 0, y = 0; i < length; i++) redXCenter[j - 1] = redXCenter[j - 1] / redIntensityTotal[j - 1]; redYCenter[j - 1] = redYCenter[j - 1] / redIntensityTotal[j - 1]; i = (int) redXCenter[j - 1] + ((int) (redYCenter[j - 1]) * xDim); id = IDArray[i]; if (id >= 1) { if (redNucleusNumber[id - 1] < redNumber) { redNucleusNumber[id - 1]++; } found = false; for (i = 0; (i < redNucleusNumber[id - 1]) && !found; i++) { if (redIntensityTotal[j - 1] >= sortedRedIntensity[id - 1][i]) { found = true; for (k = redNucleusNumber[id - 1] - 2; k >= i; k--) { sortedRedIntensity[id - 1][k + 1] = sortedRedIntensity[id - 1][k]; sortedRedIndex[id - 1][k + 1] = sortedRedIndex[id - 1][k]; sortedRedXCenter[id - 1][k + 1] = sortedRedXCenter[id - 1][k]; sortedRedYCenter[id - 1][k + 1] = sortedRedYCenter[id - 1][k]; } sortedRedIntensity[id - 1][i] = redIntensityTotal[j - 1]; sortedRedIndex[id - 1][i] = j; // from redIDArray sortedRedXCenter[id - 1][i] = redXCenter[j - 1]; sortedRedYCenter[id - 1][i] = redYCenter[j - 1]; } } // for (i = 0; i < redNucleusNumber[id-1] && !found; i++) } // if (id >= 1) } // for (j = 1; j <= numRedObjects; j++) } // if (redNumber > 0) if (greenNumber > 0) { // Sort the green objects within each nucleus. // Create no more than greenNumber green objects within each nucleus. fireProgressStateChanged("Sorting green objects by intensity count"); fireProgressStateChanged(62); greenIntensityTotal = new float[numGreenObjects]; greenXCenter = new float[numGreenObjects]; greenYCenter = new float[numGreenObjects]; greenNucleusNumber = new int[numObjects]; sortedGreenIndex = new int[numObjects][greenNumber]; sortedGreenIntensity = new float[numObjects][greenNumber]; sortedGreenXCenter = new float[numObjects][greenNumber]; sortedGreenYCenter = new float[numObjects][greenNumber]; for (j = 1; j <= numGreenObjects; j++) { for (x = 0, y = 0, i = 0; i < length; i++) { if (greenIDArray[i] == j) { greenIntensityTotal[j - 1] += greenBuffer[i]; greenXCenter[j - 1] += greenBuffer[i] * x; greenYCenter[j - 1] += greenBuffer[i] * y; } x++; if (x == xDim) { x = 0; y++; } } greenXCenter[j - 1] = greenXCenter[j - 1] / greenIntensityTotal[j - 1]; greenYCenter[j - 1] = greenYCenter[j - 1] / greenIntensityTotal[j - 1]; i = (int) greenXCenter[j - 1] + ((int) (greenYCenter[j - 1]) * xDim); id = IDArray[i]; if (id >= 1) { if (greenNucleusNumber[id - 1] < greenNumber) { greenNucleusNumber[id - 1]++; } found = false; for (i = 0; (i < greenNucleusNumber[id - 1]) && !found; i++) { if (greenIntensityTotal[j - 1] >= sortedGreenIntensity[id - 1][i]) { found = true; for (k = greenNucleusNumber[id - 1] - 2; k >= i; k--) { sortedGreenIntensity[id - 1][k + 1] = sortedGreenIntensity[id - 1][k]; sortedGreenIndex[id - 1][k + 1] = sortedGreenIndex[id - 1][k]; sortedGreenXCenter[id - 1][k + 1] = sortedGreenXCenter[id - 1][k]; sortedGreenYCenter[id - 1][k + 1] = sortedGreenYCenter[id - 1][k]; } sortedGreenIntensity[id - 1][i] = greenIntensityTotal[j - 1]; sortedGreenIndex[id - 1][i] = j; // from greenIDArray sortedGreenXCenter[id - 1][i] = greenXCenter[j - 1]; sortedGreenYCenter[id - 1][i] = greenYCenter[j - 1]; } } // for (i = 0; i < greenNucleusNumber[id-1] && !found; i++) } // if (id >= 1) } // for (j = 1; j <= numGreenObjects; j++) } // if (greenNumber > 0) Arrays.fill(byteBuffer, (byte) 0); numRedVOIObjects = 0; numGreenVOIObjects = 0; for (i = 0; i < numObjects; i++) { if (redNumber > 0) { numRedVOIObjects += redNucleusNumber[i]; } if (greenNumber > 0) { numGreenVOIObjects += greenNucleusNumber[i]; } } numVOIObjects = Math.max(numRedVOIObjects, numGreenVOIObjects); colorTable = new Color[numVOIObjects]; nameTable = new String[numVOIObjects]; if (redNumber > 0) { for (i = 0, j = 0; i < numObjects; i++) { for (m = 0; m < redNumber; m++) { if (redNucleusNumber[i] > m) { for (k = 0; k < length; k++) { if (redIDArray[k] == sortedRedIndex[i][m]) { byteBuffer[k] = (byte) (j + 1); } } // for (k = 0; k < length; k++) if (m == 0) { colorTable[j] = Color.yellow; } else { colorTable[j] = Color.yellow.darker(); } nameTable[j] = new String((i + 1) + "R" + (m + 1)); j++; } // if (redNucleusNumber[i] > m) } // for (m = 0; m < redNumber; m++) } // for (i = 0, j = 0; i < numObjects; i++) try { grayImage.importData(0, byteBuffer, true); } catch (IOException error) { byteBuffer = null; errorCleanUp("Error on grayImage.importData", true); return; } fireProgressStateChanged("Extracting VOIs from red image"); fireProgressStateChanged(73); algoVOIExtraction = new AlgorithmVOIExtraction(grayImage); algoVOIExtraction.setColorTable(colorTable); algoVOIExtraction.setNameTable(nameTable); algoVOIExtraction.run(); algoVOIExtraction.finalize(); algoVOIExtraction = null; srcImage.setVOIs(grayImage.getVOIs()); } // if (redNumber > 0) if (greenNumber > 0) { Arrays.fill(byteBuffer, (byte) 0); for (i = 0, j = 0; i < numObjects; i++) { for (m = 0; m < greenNumber; m++) { if (greenNucleusNumber[i] > m) { for (k = 0; k < length; k++) { if (greenIDArray[k] == sortedGreenIndex[i][m]) { byteBuffer[k] = (byte) (j + 1); } } // for (k = 0; k < length; k++) if (m == 0) { colorTable[j] = Color.pink; } else { colorTable[j] = Color.pink.darker(); } nameTable[j] = new String((i + 1) + "G" + (m + 1)); j++; } // if (greenNucleusNumber[i] > m) } // for (m = 0; m < greenNumber; m++) } // for (i = 0, j = 0; i < numObjects; i++) grayImage.resetVOIs(); try { grayImage.importData(0, byteBuffer, true); } catch (IOException error) { byteBuffer = null; errorCleanUp("Error on grayImage.importData", true); return; } fireProgressStateChanged("Extracting VOIs from green image"); fireProgressStateChanged(74); algoVOIExtraction = new AlgorithmVOIExtraction(grayImage); algoVOIExtraction.setColorTable(colorTable); algoVOIExtraction.setNameTable(nameTable); algoVOIExtraction.run(); algoVOIExtraction.finalize(); algoVOIExtraction = null; if (redNumber > 0) { srcImage.addVOIs(grayImage.getVOIs()); } else { srcImage.setVOIs(grayImage.getVOIs()); } } // if (greenNumber > 0) VOIs = srcImage.getVOIs(); nVOIs = VOIs.size(); } // if (nVOIs == 0) shortMask = new short[length]; idCount = new int[numObjects]; xPosGeo = new float[nVOIs]; yPosGeo = new float[nVOIs]; xPosGrav = new float[nVOIs]; yPosGrav = new float[nVOIs]; objectID = new int[nVOIs]; isRed = new boolean[nVOIs]; colorCount = new float[nVOIs]; UI.clearAllDataText(); UI.setDataText("\n"); voiCount = new int[nVOIs]; for (i = 0; i < nVOIs; i++) { fireProgressStateChanged("Processing VOI " + (i + 1) + " of " + nVOIs); fireProgressStateChanged(75 + (10 * (i + 1) / nVOIs)); VOIs.VOIAt(i).setOnlyID((short) i); voiName = VOIs.VOIAt(i).getName(); if (VOIs.VOIAt(i).getCurveType() == VOI.CONTOUR) { Arrays.fill(shortMask, (short) -1); shortMask = srcImage.generateVOIMask(shortMask, i); redCount = 0; greenCount = 0; Arrays.fill(idCount, 0); for (j = 0; j < length; j++) { if (shortMask[j] != -1) { if (redNumber >= 1) { redCount += buffer[j]; } if (greenNumber >= 1) { greenCount += greenBuffer[j]; } if (IDArray[j] > 0) { index = IDArray[j] - 1; idCount[index]++; } } } objectID[i] = 1; objectCount = idCount[0]; for (j = 2; j <= numObjects; j++) { if (idCount[j - 1] > objectCount) { objectID[i] = j; objectCount = idCount[j - 1]; } } // for (j = 2; j <= numObjects; j++) xPosGeo[i] = 0.0f; yPosGeo[i] = 0.0f; xPosGrav[i] = 0.0f; yPosGrav[i] = 0.0f; if (redCount >= greenCount) { isRed[i] = true; colorCount[i] = 0.0f; for (j = 0, y = 0; y < yDim; y++, j += xDim) { for (x = 0; x < xDim; x++) { index = x + j; if (shortMask[index] != -1) { xPosGeo[i] += x; yPosGeo[i] += y; xPosGrav[i] += buffer[index] * x; yPosGrav[i] += buffer[index] * y; colorCount[i] += buffer[index]; voiCount[i]++; IDArray[index] = (byte) objectID[i]; } } } xPosGeo[i] /= voiCount[i]; yPosGeo[i] /= voiCount[i]; xPosGrav[i] /= colorCount[i]; yPosGrav[i] /= colorCount[i]; } // if (redCount >= greenCount) else { // redCount < greenCount colorCount[i] = 0.0f; for (j = 0, y = 0; y < yDim; y++, j += xDim) { for (x = 0; x < xDim; x++) { index = x + j; if (shortMask[index] != -1) { xPosGeo[i] += x; yPosGeo[i] += y; xPosGrav[i] += greenBuffer[index] * x; yPosGrav[i] += greenBuffer[index] * y; colorCount[i] += greenBuffer[index]; voiCount[i]++; IDArray[index] = (byte) objectID[i]; } } } xPosGeo[i] /= voiCount[i]; yPosGeo[i] /= voiCount[i]; xPosGrav[i] /= colorCount[i]; yPosGrav[i] /= colorCount[i]; } // redCount < greenCount } // if (VOIs.VOIAt(i).getCurveType() == VOI.CONTOUR) } // for (i = 0; i < nVOIs; i++) rIndex = new int[3]; rCount = new float[3]; gIndex = new int[3]; gCount = new float[3]; VOIs2 = new ViewVOIVector(); objectID2 = new int[nVOIs]; xPosGeo2 = new float[nVOIs]; yPosGeo2 = new float[nVOIs]; xPosGrav2 = new float[nVOIs]; yPosGrav2 = new float[nVOIs]; voiCount2 = new int[nVOIs]; index2 = 0; for (j = 1; j <= numObjects; j++) { numRedFound = 0; numGreenFound = 0; rCount[0] = 0.0f; rCount[1] = 0.0f; rCount[2] = 0.0f; gCount[0] = 0.0f; gCount[1] = 0.0f; gCount[2] = 0.0f; for (i = 0; i < nVOIs; i++) { if ((VOIs.VOIAt(i).getCurveType() == VOI.CONTOUR) && (objectID[i] == j)) { if (isRed[i]) { if (numRedFound < 3) { numRedFound++; if (numRedFound > redNumber) { redNumber = numRedFound; } } placed = false; for (k = 0; k <= 2 && (!placed); k++) { if (colorCount[i] >= rCount[k]) { placed = true; for (m = numRedFound - 2; m >= k; m--) { rIndex[m+1] = rIndex[m]; rCount[m+1] = rCount[m]; } rIndex[k] = i; rCount[k] = colorCount[i]; } } } else { if (numGreenFound < 3) { numGreenFound++; if (numGreenFound > greenNumber) { greenNumber = numGreenFound; } } placed = false; for (k = 0; k <= 2 && (!placed); k++) { if (colorCount[i] >= gCount[k]) { placed = true; for (m = numGreenFound - 2; m >= k; m--) { gIndex[m+1] = gIndex[m]; gCount[m+1] = gCount[m]; } gIndex[k] = i; gCount[k] = colorCount[i]; } } } } } // for (i = 0; i < nVOIs; i++) for (k = 0; k < numRedFound; k++) { VOIs.VOIAt(rIndex[k]).setName(j + "R" + (k+1)); if (k == 0) { VOIs.VOIAt(rIndex[k]).setColor(Color.yellow); } else { VOIs.VOIAt(rIndex[k]).setColor(Color.yellow.darker()); } VOIs2.addElement(VOIs.VOIAt(rIndex[k])); objectID2[index2] = j; xPosGeo2[index2] = xPosGeo[rIndex[k]]; yPosGeo2[index2] = yPosGeo[rIndex[k]]; xPosGrav2[index2] = xPosGrav[rIndex[k]]; yPosGrav2[index2] = yPosGrav[rIndex[k]]; voiCount2[index2] = voiCount[rIndex[k]]; index2++; } for (k = 0; k < numGreenFound; k++) { VOIs.VOIAt(gIndex[k]).setName(j + "G" + (k+1)); if (k == 0) { VOIs.VOIAt(gIndex[k]).setColor(Color.pink); } else { VOIs.VOIAt(gIndex[k]).setColor(Color.pink.darker()); } VOIs2.addElement(VOIs.VOIAt(gIndex[k])); objectID2[index2] = j; xPosGeo2[index2] = xPosGeo[gIndex[k]]; yPosGeo2[index2] = yPosGeo[gIndex[k]]; xPosGrav2[index2] = xPosGrav[gIndex[k]]; yPosGrav2[index2] = yPosGrav[gIndex[k]]; voiCount2[index2] = voiCount[gIndex[k]]; index2++; } } // (j = 1; j <= numObjects; j++) VOIs.clear(); nVOIs = VOIs2.size(); for (i = 0; i < nVOIs; i++) { VOIs.addElement(VOIs2.VOIAt(i)); } VOIs2.clear(); VOIs2 = null; for (i = 0; i < nVOIs; i++) { objectID[i] = objectID2[i]; xPosGeo[i] = xPosGeo2[i]; yPosGeo[i] = yPosGeo2[i]; xPosGrav[i] = xPosGrav2[i]; yPosGrav[i] = yPosGrav2[i]; voiCount[i] = voiCount2[i]; } objectID2 = null; xPosGeo2 = null; yPosGeo2 = null; xPosGrav2 = null; yPosGrav2 = null; voiCount2 = null; for (i = 0; i < nVOIs; i++) { if (VOIs.VOIAt(i).getCurveType() == VOI.CONTOUR) { voiName = VOIs.VOIAt(i).getName(); newPtVOI = new VOI((short) (i + nVOIs), "point2D" + i + ".voi", VOI.POINT, -1.0f); newPtVOI.setColor(Color.white); xArr[0] = xPosGrav[i]; yArr[0] = yPosGrav[i]; zArr[0] = 0.0f; newPtVOI.importCurve(xArr, yArr, zArr); ((VOIPoint) (newPtVOI.getCurves().elementAt(0))).setFixed(true); ((VOIPoint) (newPtVOI.getCurves().elementAt(0))).setLabel(voiName); srcImage.registerVOI(newPtVOI); } } dilateArray = new byte[length]; boundaryArray = new byte[length]; xCenter = new float[numObjects]; yCenter = new float[numObjects]; centerToNearEdge = new float[numObjects]; centerToFarEdge = new float[numObjects]; kernel = AlgorithmMorphology2D.CONNECTED8; method = AlgorithmMorphology2D.DILATE; itersDilation = 1; blueCountTotal = new float[numObjects]; for (id = 1; id <= numObjects; id++) { fireProgressStateChanged("Processing object " + id + " of " + numObjects + " in blue segmented image"); if (nVOIs > 0) { fireProgressStateChanged(85 + (id * 10 / numObjects)); } else { fireProgressStateChanged(25 + (id * 3 / numObjects)); } Arrays.fill(byteBuffer, (byte) 0); xCenter[id - 1] = 0.0f; yCenter[id - 1] = 0.0f; lowestSqr = Float.MAX_VALUE; highestSqr = -Float.MAX_VALUE; for (j = 0, y = 0; y < yDim; y++, j += xDim) { for (x = 0; x < xDim; x++) { i = x + j; if (IDArray[i] == id) { byteBuffer[i] = (byte) 1; xCenter[id - 1] += x; yCenter[id - 1] += y; blueCountTotal[id - 1]++; } } } xCenter[id - 1] /= blueCountTotal[id - 1]; yCenter[id - 1] /= blueCountTotal[id - 1]; try { grayImage.importData(0, byteBuffer, true); } catch (IOException error) { byteBuffer = null; IDArray = null; errorCleanUp("Error on grayImage.importData", true); return; } dilateAlgo = new AlgorithmMorphology2D(grayImage, kernel, circleDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); dilateAlgo.run(); dilateAlgo.finalize(); dilateAlgo = null; try { grayImage.exportData(0, length, dilateArray); } catch (IOException error) { byteBuffer = null; IDArray = null; dilateArray = null; errorCleanUp("Error on grayImage.importData", true); return; } for (j = 0, y = 0; y < yDim; y++, j += xDim) { for (x = 0; x < xDim; x++) { i = x + j; if ((dilateArray[i] == (byte) 1) && (byteBuffer[i] == (byte) 0)) { boundaryArray[i] = (byte) id; distSqr = ((xCenter[id - 1] - x) * (xCenter[id - 1] - x) * xRes * xRes) + ((yCenter[id - 1] - y) * (yCenter[id - 1] - y) * yRes * yRes); if (distSqr < lowestSqr) { lowestSqr = distSqr; } if (distSqr > highestSqr) { highestSqr = distSqr; } } } } centerToNearEdge[id - 1] = (float) Math.sqrt(lowestSqr); centerToFarEdge[id - 1] = (float) Math.sqrt(highestSqr); Preferences.debug("Object id = " + id + "\n"); Preferences.debug("Center of mass = (" + xCenter[id - 1] + ", " + yCenter[id - 1] + ")\n"); Preferences.debug("Distance from center of mass to near edge = " + centerToNearEdge[id - 1] + "\n"); Preferences.debug("Distance from center of mass to far edge = " + centerToFarEdge[id - 1] + "\n"); } // for (id = 1; id <= numObjects; id++) grayImage.disposeLocal(); grayImage = null; for (i = 0; i < numObjects; i++) { newPtVOI = new VOI((short) (i + (2 * nVOIs)), "point2D" + i + ".voi", VOI.POINT, -1.0f); newPtVOI.setColor(Color.magenta); xArr[0] = xCenter[i]; yArr[0] = yCenter[i]; zArr[0] = 0.0f; newPtVOI.importCurve(xArr, yArr, zArr); ((VOIPoint) (newPtVOI.getCurves().elementAt(0))).setFixed(true); ((VOIPoint) (newPtVOI.getCurves().elementAt(0))).setLabel("N" + (i + 1)); srcImage.registerVOI(newPtVOI); } // for (i = 0; i < numObjects; i++) srcImage.notifyImageDisplayListeners(); UI.setDataText("Plugin 10/19/07 version\n"); UI.setDataText(srcImage.getFileInfo(0).getFileName() + "\n"); if (xUnits != Unit.UNKNOWN_MEASURE.getLegacyNum()) { UI.setDataText("X resolution = " + xRes + " " + (Unit.getUnitFromLegacyNum(xUnits)).toString() + "\n"); } else { UI.setDataText("X resolution = " + xRes + "\n"); } if (yUnits != Unit.UNKNOWN_MEASURE.getLegacyNum()) { UI.setDataText("Y resolution = " + yRes + " " + (Unit.getUnitFromLegacyNum(yUnits)).toString() + "\n\n"); } else { UI.setDataText("Y resolution = " + yRes + "\n\n"); } UI.setDataText("Nucleus\tNarea\tRmin\tRmax"); if (redNumber > 0) { UI.setDataText("\tR1area"); UI.setDataText("\tR1geomax\tR1geo%\tR1geo-Np"); UI.setDataText("\tR1gravmax\tR1grav%\tR1grav-Np"); } if (redNumber > 1) { UI.setDataText("\tR2area"); UI.setDataText("\tR2geomax\tR2geo%\tR2geo-Np"); UI.setDataText("\tR2gravmax\tR2grav%\tR2grav-Np"); } if (redNumber > 2) { UI.setDataText("\tR3area"); UI.setDataText("\tR3geomax\tR3geo%\tR3geo-Np"); UI.setDataText("\tR3gravmax\tR3grav%\tR3grav-Np"); } if (greenNumber > 0) { UI.setDataText("\tG1area"); UI.setDataText("\tG1geomax\tG1geo%\tG1geo-Np"); UI.setDataText("\tG1gravmax\tG1grav%\tG1grav-Np"); } if (greenNumber > 1) { UI.setDataText("\tG2area"); UI.setDataText("\tG2geomax\tG2geo%\tG2geo-Np"); UI.setDataText("\tG2gravmax\tG2grav%\tG2grav-Np"); } if (greenNumber > 2) { UI.setDataText("\tG3area"); UI.setDataText("\tG3geomax\tG3geo%\tG3geo-Np"); UI.setDataText("\tG3gravmax\tG3grav%\tG3grav-Np"); } UI.setDataText("\n"); for (i = 0; i < numObjects; i++) { nuclearArea = xRes * yRes * blueCountTotal[i]; UI.setDataText((i + 1) + "\t" + nf.format(nuclearArea)); UI.setDataText("\t" + nf.format(centerToNearEdge[i])); // equivalentRadius = (float)Math.sqrt(nuclearArea/Math.PI); // UI.setDataText("\t" + nf.format(equivalentRadius)); UI.setDataText("\t" + nf.format(centerToFarEdge[i])); redFound = 0; greenFound = 0; for (j = 0; j <= (nVOIs - 1); j++) { if (objectID[j] == (i + 1)) { voiType = VOIs.VOIAt(j).getName().charAt(1); if (voiType == 'R') { redFound++; } if (voiType == 'G') { greenFound++; if ((greenFound == 1) && (redFound != redNumber)) { for (k = 0; k < (redNumber - redFound); k++) { UI.setDataText("\t\t\t\t\t\t\t"); } // for (k = 0; k < (redNumber-redFound); k++) } // if ((greenFound == 1) && (redFound != redNumber)) } voiArea = xRes * yRes * voiCount[j]; UI.setDataText("\t" + nf.format(voiArea)); geoToCenter = (float) Math.sqrt(((xPosGeo[j] - xCenter[i]) * (xPosGeo[j] - xCenter[i]) * xRes * xRes) + ((yPosGeo[j] - yCenter[i]) * (yPosGeo[j] - yCenter[i]) * yRes * yRes)); initialdx = xPosGeo[j] - xCenter[i]; initialdy = yPosGeo[j] - yCenter[i]; lastEdgeX = (int) Math.round(xPosGeo[j]); lastEdgeY = (int) Math.round(yPosGeo[j]); if (Math.abs(initialdx) >= Math.abs(initialdy)) { if (initialdx >= 0.0f) { incx = 0.1f; } else { incx = -0.1f; } incy = 0.1f * initialdy / Math.abs(initialdx); } else { if (initialdy >= 0.0f) { incy = 0.1f; } else { incy = -0.1f; } incx = 0.1f * initialdx / Math.abs(initialdy); } numInc = 1; while (true) { newEdgeX = (int) Math.round(xPosGeo[j] + (numInc * incx)); if ((newEdgeX < 0) || (newEdgeX >= xDim)) { break; } newEdgeY = (int) Math.round(yPosGeo[j] + (numInc * incy)); if ((newEdgeY < 0) || (newEdgeY >= yDim)) { break; } numInc++; if ((newEdgeX == lastEdgeX) && (newEdgeY == lastEdgeY)) { continue; } index = newEdgeX + (xDim * newEdgeY); lastEdgeX = newEdgeX; lastEdgeY = newEdgeY; if (IDArray[index] != (i + 1)) { break; } } // while (true) centerToGeoToEdge = (float) Math.sqrt(((lastEdgeX - xCenter[i]) * (lastEdgeX - xCenter[i]) * xRes * xRes) + ((lastEdgeY - yCenter[i]) * (lastEdgeY - yCenter[i]) * yRes * yRes)); UI.setDataText("\t" + nf.format(centerToGeoToEdge)); geoToCenter = 100.0f * geoToCenter / centerToGeoToEdge; UI.setDataText("\t" + nf.format(geoToCenter)); geoToEdge = (float) Math.sqrt(((lastEdgeX - xPosGeo[j]) * (lastEdgeX - xPosGeo[j]) * xRes * xRes) + ((lastEdgeY - yPosGeo[j]) * (lastEdgeY - yPosGeo[j]) * yRes * yRes)); UI.setDataText("\t" + nf.format(geoToEdge)); gravToCenter = (float) Math.sqrt(((xPosGrav[j] - xCenter[i]) * (xPosGrav[j] - xCenter[i]) * xRes * xRes) + ((yPosGrav[j] - yCenter[i]) * (yPosGrav[j] - yCenter[i]) * yRes * yRes)); initialdx = xPosGrav[j] - xCenter[i]; initialdy = yPosGrav[j] - yCenter[i]; lastEdgeX = (int) Math.round(xPosGrav[j]); lastEdgeY = (int) Math.round(yPosGrav[j]); if (Math.abs(initialdx) >= Math.abs(initialdy)) { if (initialdx >= 0.0f) { incx = 0.1f; } else { incx = -0.1f; } incy = 0.1f * initialdy / Math.abs(initialdx); } else { if (initialdy >= 0.0f) { incy = 0.1f; } else { incy = -0.1f; } incx = 0.1f * initialdx / Math.abs(initialdy); } numInc = 1; while (true) { newEdgeX = (int) Math.round(xPosGrav[j] + (numInc * incx)); if ((newEdgeX < 0) || (newEdgeX >= xDim)) { break; } newEdgeY = (int) Math.round(yPosGrav[j] + (numInc * incy)); if ((newEdgeY < 0) || (newEdgeY >= yDim)) { break; } numInc++; if ((newEdgeX == lastEdgeX) && (newEdgeY == lastEdgeY)) { continue; } index = newEdgeX + (xDim * newEdgeY); lastEdgeX = newEdgeX; lastEdgeY = newEdgeY; if (IDArray[index] != (i + 1)) { break; } } // while (true) centerToGravToEdge = (float) Math.sqrt(((lastEdgeX - xCenter[i]) * (lastEdgeX - xCenter[i]) * xRes * xRes) + ((lastEdgeY - yCenter[i]) * (lastEdgeY - yCenter[i]) * yRes * yRes)); UI.setDataText("\t" + nf.format(centerToGravToEdge)); gravToCenter = 100.0f * gravToCenter / centerToGravToEdge; UI.setDataText("\t" + nf.format(gravToCenter)); gravToEdge = (float) Math.sqrt(((lastEdgeX - xPosGrav[j]) * (lastEdgeX - xPosGrav[j]) * xRes * xRes) + ((lastEdgeY - yPosGrav[j]) * (lastEdgeY - yPosGrav[j]) * yRes * yRes)); UI.setDataText("\t" + nf.format(gravToEdge)); /*lowestSqr = Float.MAX_VALUE; * for (j1 = 0, y = 0; y < yDim; y++, j1 += xDim) { for (x = 0; x < xDim; x++) { index = x + j1; * if (boundaryArray[index] == objectID[j]) { distSqr = (xPosGeo[j] - x) * (xPosGeo[j] - x) * xRes * xRes + (yPosGeo[j] - y) * (yPosGeo[j] - y) * yRes * * yRes; if (distSqr < lowestSqr) { lowestSqr = distSqr; xEdge = x; yEdge * = y; } } } } geoToEdge = (float) Math.sqrt(lowestSqr); UI.setDataText("\t\t" + * nf.format(geoToEdge)); geoToEdge *= 100.0f /centerToFarEdge[i]; UI.setDataText("\t" + * nf.format(geoToEdge)); * * lowestSqr = Float.MAX_VALUE; for (j1 = 0, y = 0; y < yDim; y++, j1 += xDim) { for (x = 0; x < xDim; * x++) { index = x + j1; if (boundaryArray[index] == objectID[j]) { distSqr = * (xPosGrav[j] - x) * (xPosGrav[j] - x) * xRes * xRes + (yPosGrav[j] - y) * * (yPosGrav[j] - y) * yRes * yRes; if (distSqr < lowestSqr) { lowestSqr = * distSqr; xEdge = x; yEdge = y; } } } } gravToEdge = (float) * Math.sqrt(lowestSqr); UI.setDataText("\t\t" + nf.format(gravToEdge)); gravToEdge *= 100.0f * /centerToFarEdge[i];UI.setDataText("\t" + * nf.format(gravToEdge));*/ } // if (objectID[j] == (i+1)) } // for (j = 0; j <= nVOIs - 1; j++) UI.setDataText("\n"); } // for (i = 0; i < numObjects; i++) if (threadStopped) { finalize(); return; } setCompleted(true); } /** * DOCUMENT ME! */ @SuppressWarnings("unchecked") private void calc3D() { int totLength, sliceLength; float[] buffer; AlgorithmFuzzyCMeans fcmAlgo; ModelImage grayImage; int nClasses; int nPyramid; int oneJacobiIter; int twoJacobiIter; float q; float oneSmooth; float twoSmooth; boolean outputGainField; int segmentation; boolean cropBackground; float threshold; int maxIter; float endTolerance; boolean wholeImage; float[] centroids; float min; float max; AlgorithmThresholdDual thresholdAlgo; float[] thresholds; float fillValue; AlgorithmMorphology3D openAlgo; AlgorithmMorphology3D closeAlgo; AlgorithmMorphology3D erosionAlgo; AlgorithmMorphology3D dilationAlgo; int kernel; float sphereDiameter; int method; int itersDilation; int itersErosion; int numPruningPixels; int edgingType; int i, j, k; int x, y, z; int xDim = srcImage.getExtents()[0]; int yDim = srcImage.getExtents()[1]; int zDim = srcImage.getExtents()[2]; float xRes = srcImage.getResolutions(0)[0]; float yRes = srcImage.getResolutions(0)[1]; float zRes = srcImage.getResolutions(0)[2]; boolean found; AlgorithmMorphology3D idObjectsAlgo3D; int numObjects; byte[] byteBuffer; byte[] IDArray; int id; byte[] dilateArray; byte[] boundaryArray; AlgorithmMorphology3D dilateAlgo; float[] xCenter; float[] yCenter; float[] zCenter; float[] centerToNearEdge; float[] centerToFarEdge; float[] greenBuffer = null; ViewVOIVector VOIs = null; int nVOIs; ViewVOIVector VOIs2 = null; short[] shortMask; int index; int redCount; int greenCount; int[] idCount; int[] objectID; int[] objectID2; int objectCount; float[] xPosGeo; float[] yPosGeo; float[] zPosGeo; float[] xPosGeo2; float[] yPosGeo2; float[] zPosGeo2; float[] xPosGrav; float[] yPosGrav; float[] zPosGrav; float[] xPosGrav2; float[] yPosGrav2; float[] zPosGrav2; float colorCount[]; float geoToCenter; float gravToCenter; float geoToEdge; float gravToEdge; ViewUserInterface UI = ViewUserInterface.getReference(); float distSqr; float lowestSqr; float highestSqr; // int xEdge = -1; // int yEdge = -1; // int zEdge = -1; int xUnits = srcImage.getFileInfo(0).getUnitsOfMeasure()[0]; int yUnits = srcImage.getFileInfo(0).getUnitsOfMeasure()[1]; int zUnits = srcImage.getFileInfo(0).getUnitsOfMeasure()[2]; FileInfoBase fileInfo; int numRedObjects = 0; int numGreenObjects = 0; byte[] redIDArray = null; byte[] greenIDArray = null; float[] redIntensityTotal; float[] greenIntensityTotal; float[] redXCenter; float[] redYCenter; float[] redZCenter; float[] greenXCenter; float[] greenYCenter; float[] greenZCenter; int[] redNucleusNumber = null; int[][] sortedRedIndex = null; float[][] sortedRedIntensity; float[][] sortedRedXCenter; float[][] sortedRedYCenter; float[][] sortedRedZCenter; int[] greenNucleusNumber = null; int[][] sortedGreenIndex = null; float[][] sortedGreenIntensity; float[][] sortedGreenXCenter; float[][] sortedGreenYCenter; float[][] sortedGreenZCenter; AlgorithmVOIExtraction algoVOIExtraction; VOI newPtVOI; float[] xArr = new float[1]; float[] yArr = new float[1]; float[] zArr = new float[1]; int numVOIObjects; Color[] colorTable = null; boolean removeID; int m; AlgorithmMedian algoMedian; int medianIters; int kernelSize; int kernelShape; float stdDev; boolean sliceBySlice; String[] nameTable = null; String voiName; int[] blueCountTotal = null; ModelImage grayImage2D; int[] extents2D = new int[2]; byte[] buffer2D; AlgorithmMorphology2D fillHolesAlgo2D; AlgorithmMorphology3D fillHolesAlgo3D; int[] voiCount; int[] voiCount2; // int j1; // int k1; int redFound; int greenFound; char voiType; float nuclearVolume; // float equivalentRadius; NumberFormat nf; float voiVolume; float initialdx; float initialdy; float initialdz; int lastEdgeX; int lastEdgeY; int lastEdgeZ; int newEdgeX; int newEdgeY; int newEdgeZ; float incx; float incy; float incz; int numInc; float centerToGeoToEdge; float centerToGravToEdge; int moreRedObjects; int moreGreenObjects; int[] redObjectNucleus; int[] greenObjectNucleus; int maxNucleus; int maxCount; int secondMaxNucleus; int secondMaxCount; int thirdMaxNucleus; int thirdMaxCount; int numRedVOIObjects; int numGreenVOIObjects; int edgeObjects; AlgorithmHistogram algoHist; int bins; int[] histoBuffer; double[] lowValue; int totalCount; int countsToRetain; int countsFound; int offset; int idm1; int[] volume; boolean adaptiveSize = false; int maximumSize = 0; // centroids double[] cx; double[] cy; double[] cz; // Second order moments double[] ixx; double[] iyy; double[] izz; double[] iyz; double[] ixy; double[] izx; double xdiff; double ydiff; double zdiff; double[][] tensor = new double[3][3]; double[] eigenvalue = new double[3];; double[][] eigenvector = new double[3][3];; double temp; double ellipVol; double normFactor; int n; double[] tempCol = new double[3]; float[][] sAxisCen; float scaleMax; float invMax; Vector3f kVoxel; AlgorithmEllipsoidFit kF; Vector<Vector3f>[] volPoints; double[] axes; float[][] sAxisPer; float tempf; boolean initiallyOneObject; int response; boolean isRed[]; int numRedFound; int numGreenFound; int rIndex[]; float rCount[]; int gIndex[]; float gCount[]; boolean placed; int index2; nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(3); nf.setMaximumFractionDigits(3); VOIs = srcImage.getVOIs(); nVOIs = VOIs.size(); for (i = nVOIs - 1; i >=0; i--) { if (VOIs.VOIAt(i).getCurveType() != VOI.CONTOUR) { VOIs.remove(i); } } nVOIs = VOIs.size(); if (nVOIs > 0) { // Increase redNumber and greenNumber based on what is found in supplied VOIs redNumber = 1; greenNumber = 1; } fireProgressStateChanged("Processing image ..."); try { sliceLength = xDim * yDim; totLength = sliceLength * zDim; buffer = new float[totLength]; fireProgressStateChanged("Creating blue image"); srcImage.exportRGBData(3, 0, totLength, buffer); // locks and releases lock } catch (IOException error) { buffer = null; errorCleanUp("Algorithm RegionDistance: source image locked", true); return; } catch (OutOfMemoryError e) { buffer = null; errorCleanUp("Algorithm RegionDistance: Out of memory creating process buffer", true); return; } grayImage = new ModelImage(ModelStorageBase.FLOAT, srcImage.getExtents(), srcImage.getImageName() + "_gray"); for (i = 0; i < srcImage.getExtents()[2]; i++) { fileInfo = grayImage.getFileInfo()[i]; fileInfo.setResolutions(srcImage.getFileInfo()[0].getResolutions()); fileInfo.setUnitsOfMeasure(srcImage.getFileInfo()[0].getUnitsOfMeasure()); grayImage.setFileInfo(fileInfo, i); } // for (i = 0; i < srcImage.getExtents()[2]; i++) try { grayImage.importData(0, buffer, true); } catch (IOException error) { buffer = null; errorCleanUp("Error on grayImage.importData", true); return; } // Segment into 2 values fireProgressStateChanged("Performing FuzzyCMeans Segmentation on blue"); if (nVOIs > 0) { fireProgressStateChanged(5); } else { fireProgressStateChanged(2); } nClasses = 2; nPyramid = 4; oneJacobiIter = 1; twoJacobiIter = 2; q = 2.0f; oneSmooth = 2e4f; twoSmooth = 2e5f; outputGainField = false; segmentation = HARD_ONLY; cropBackground = false; threshold = 0.0f; maxIter = 200; endTolerance = 0.01f; wholeImage = true; // grayImage enters ModelStorageBase.FLOAT and returns ModelStorageBase.UBYTE fcmAlgo = new AlgorithmFuzzyCMeans(grayImage, nClasses, nPyramid, oneJacobiIter, twoJacobiIter, q, oneSmooth, twoSmooth, outputGainField, segmentation, cropBackground, threshold, maxIter, endTolerance, wholeImage); centroids = new float[2]; min = (float) grayImage.getMin(); max = (float) grayImage.getMax(); centroids[0] = min + ((max - min) / 3.0f); centroids[1] = min + (2.0f * (max - min) / 3.0f); fcmAlgo.setCentroids(centroids); fcmAlgo.run(); fcmAlgo.finalize(); fcmAlgo = null; System.gc(); // Now convert the min and max to 0 and 1 fireProgressStateChanged("Setting segmented blue values to 0 and 1"); if (nVOIs > 0) { fireProgressStateChanged(20); } else { fireProgressStateChanged(6); } grayImage.calcMinMax(); max = (float) grayImage.getMax(); thresholds = new float[2]; thresholds[0] = max; thresholds[1] = max; fillValue = 0.0f; /*ViewJFrameImage testFrame = new ViewJFrameImage(grayImage, null, new Dimension(600, 300)); boolean runTest = true; if (runTest) { setCompleted(true); return; }*/ thresholdAlgo = new AlgorithmThresholdDual(grayImage, thresholds, fillValue, AlgorithmThresholdDual.BINARY_TYPE, wholeImage, false); thresholdAlgo.run(); thresholdAlgo.finalize(); thresholdAlgo = null; System.gc(); /*ViewJFrameImage testFrame = new ViewJFrameImage(grayImage, null, new Dimension(600, 300)); boolean runTest = true; if (runTest) { setCompleted(true); return; }*/ // Do a slice by slice hole filling operation on the blue image fireProgressStateChanged("Slice by slice hole filling on blue segmented image"); if (nVOIs > 0) { fireProgressStateChanged(23); } else { fireProgressStateChanged(7); } extents2D[0] = srcImage.getExtents()[0]; extents2D[1] = srcImage.getExtents()[1]; buffer2D = new byte[sliceLength]; grayImage2D = new ModelImage(ModelStorageBase.USHORT, extents2D, srcImage.getImageName() + "_gray2D"); fileInfo = grayImage2D.getFileInfo()[0]; fileInfo.setResolutions(srcImage.getFileInfo()[0].getResolutions()); fileInfo.setUnitsOfMeasure(srcImage.getFileInfo()[0].getUnitsOfMeasure()); grayImage2D.setFileInfo(fileInfo, 0); wholeImage = true; for (z = 0; z < zDim; z++) { try { grayImage.exportData(z * sliceLength, sliceLength, buffer2D); } catch (IOException e) { buffer = null; errorCleanUp("Algorithm RegionDistance: Error on grayImage exportData", true); return; } try { grayImage2D.importData(0, buffer2D, true); } catch (IOException e) { buffer = null; errorCleanUp("Algorithm RegionDistance: Error on grayImage2D importData", true); return; } fillHolesAlgo2D = new AlgorithmMorphology2D(grayImage2D, 0, 0, AlgorithmMorphology2D.FILL_HOLES, 0, 0, 0, 0, wholeImage); fillHolesAlgo2D.run(); fillHolesAlgo2D.finalize(); fillHolesAlgo2D = null; try { grayImage2D.exportData(0, sliceLength, buffer2D); } catch (IOException e) { buffer = null; errorCleanUp("Algorithm RegionDistance: Error on grayImage2D exportData", true); return; } try { grayImage.importData(z * sliceLength, buffer2D, false); } catch (IOException e) { buffer = null; errorCleanUp("Algorithm RegionDistance: Error on grayImage importData", true); return; } } // for (z = 0; z < zDim; z++) grayImage.calcMinMax(); grayImage2D.disposeLocal(); grayImage2D = null; buffer2D = null; System.gc(); /*ViewJFrameImage testFrame = new ViewJFrameImage(grayImage, null, new Dimension(600, 300)); boolean runTest = true; if (runTest) { setCompleted(true); return; }*/ // Smooth with a morphological opening followed by a closing fireProgressStateChanged("Opening blue segmented image"); if (nVOIs > 0) { fireProgressStateChanged(25); } else { fireProgressStateChanged(8); } kernel = AlgorithmMorphology3D.CONNECTED6; sphereDiameter = 1.0f; method = AlgorithmMorphology3D.OPEN; itersDilation = 1; itersErosion = 1; numPruningPixels = 0; edgingType = 0; openAlgo = new AlgorithmMorphology3D(grayImage, kernel, sphereDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); openAlgo.run(); openAlgo.finalize(); openAlgo = null; /*ViewJFrameImage testFrame = new ViewJFrameImage(grayImage, null, new Dimension(600, 300)); boolean runTest = true; if (runTest) { setCompleted(true); return; }*/ fireProgressStateChanged("Closing blue segmented image"); if (nVOIs > 0) { fireProgressStateChanged(30); } else { fireProgressStateChanged(10); } method = AlgorithmMorphology3D.CLOSE; closeAlgo = new AlgorithmMorphology3D(grayImage, kernel, sphereDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); closeAlgo.run(); closeAlgo.finalize(); closeAlgo = null; System.gc(); /*ViewJFrameImage testFrame = new ViewJFrameImage(grayImage, null, new Dimension(600, 300)); boolean runTest = true; if (runTest) { setCompleted(true); return; }*/ byteBuffer = new byte[totLength]; try { grayImage.exportData(0, totLength, byteBuffer); } catch (IOException error) { byteBuffer = null; errorCleanUp("Error on grayImage.exportData", true); return; } fireProgressStateChanged("Eroding blue segmented image"); if (nVOIs > 0) { fireProgressStateChanged(35); } else { fireProgressStateChanged(12); } kernel = AlgorithmMorphology3D.CONNECTED6; method = AlgorithmMorphology3D.ERODE; itersDilation = 0; itersErosion = iters; erosionAlgo = new AlgorithmMorphology3D(grayImage, kernel, sphereDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); erosionAlgo.run(); erosionAlgo.finalize(); erosionAlgo = null; /*ViewJFrameImage testFrame = new ViewJFrameImage(grayImage, null, new Dimension(600, 300)); boolean runTest = true; if (runTest) { setCompleted(true); return; }*/ fireProgressStateChanged("IDing objects in blue segmented image"); if (nVOIs > 0) { fireProgressStateChanged(45); } else { fireProgressStateChanged(15); } kernel = AlgorithmMorphology3D.SIZED_SPHERE; sphereDiameter = 0.0f; method = AlgorithmMorphology3D.ID_OBJECTS; itersDilation = 0; itersErosion = 0; idObjectsAlgo3D = new AlgorithmMorphology3D(grayImage, kernel, sphereDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); idObjectsAlgo3D.setMinMax(blueMin, 20000000); idObjectsAlgo3D.run(); idObjectsAlgo3D.finalize(); idObjectsAlgo3D = null; System.gc(); grayImage.calcMinMax(); // ViewJFrameImage testFrame = new ViewJFrameImage(grayImage, null, // new Dimension(600, 300), srcImage.getUserInterface()); numObjects = (int) grayImage.getMax(); fireProgressStateChanged("Dilating IDed objects in blue segmented image"); if (nVOIs > 0) { fireProgressStateChanged(55); } else { fireProgressStateChanged(18); } kernel = AlgorithmMorphology3D.CONNECTED6; method = AlgorithmMorphology3D.DILATE; itersDilation = 6 * iters; itersErosion = 0; dilationAlgo = new AlgorithmMorphology3D(grayImage, kernel, sphereDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); dilationAlgo.run(); dilationAlgo.finalize(); dilationAlgo = null; System.gc(); IDArray = new byte[totLength]; try { grayImage.exportData(0, totLength, IDArray); } catch (IOException error) { byteBuffer = null; IDArray = null; errorCleanUp("Error on grayImage.exportData", true); return; } System.out.println("Number of Objects = " + numObjects); fireProgressStateChanged("Zeroing overgrowth of dilated objects"); if (nVOIs > 0) { fireProgressStateChanged(65); } else { fireProgressStateChanged(22); } // byteBuffer contains the smoothed blue objects before erosion // IDArray contains the objects after erosion and dilation for (i = 0; i < totLength; i++) { if (byteBuffer[i] == (byte) 0) { IDArray[i] = (byte) 0; } } /*try { * grayImage.importData(0, IDArray, true); } catch (IOException error) { byteBuffer = null; IDArray * = null; errorCleanUp("Error on grayImage.importData", true); return; } * * ViewJFrameImage testFrame = new ViewJFrameImage(grayImage, null, new Dimension(600, 300), * srcImage.getUserInterface());*/ edgeObjects = numObjects; fireProgressStateChanged("Removing blue objects touching edges"); if (nVOIs > 0) { fireProgressStateChanged(70); } else { fireProgressStateChanged(23); } if (numObjects == 1) { initiallyOneObject = true; } else { initiallyOneObject = false; } for (id = numObjects; id >= 1; id--) { removeID = false; for (k = 0, z = 0; z < zDim; z++, k += sliceLength) { for (j = k, y = 0; y < yDim; y++, j += xDim) { for (x = 0; x < xDim; x++) { i = x + j; if ((IDArray[i] == id) && ((x == 0) || (x == (xDim - 1)) || (y == 0) || (y == (yDim - 1)) || (z == 0) || (z == (zDim - 1)))) { removeID = true; } } } } if (initiallyOneObject && removeID) { response = JOptionPane.showConfirmDialog(UI.getMainFrame(), "Delete the one blue object with edge touching?", "Deletion", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.NO_OPTION) { removeID = false; } } // if (initiallyOneObject && removeID) if (removeID) { for (i = 0; i < totLength; i++) { if (IDArray[i] == id) { IDArray[i] = 0; } else if (IDArray[i] > id) { IDArray[i]--; } } numObjects--; } // if (removeID) } // for (id = numObjects; id >= 1; id--) if (numObjects == 0) { MipavUtil.displayError(edgeObjects + " blue objects touched edges"); MipavUtil.displayError("No blue objects that do not touch edges"); setCompleted(false); return; } if (greenNumber > 0) { greenBuffer = new float[totLength]; } // if (greenNumber > 0) try { if (redNumber > 0) { srcImage.exportRGBData(1, 0, totLength, buffer); // export red data } // if (redNumber > 0) if (greenNumber > 0) { srcImage.exportRGBData(2, 0, totLength, greenBuffer); // export green data } // if (greenNumber > 0) } catch (IOException error) { buffer = null; greenBuffer = null; errorCleanUp("Algorithm RegionDistance reports: source image locked", true); return; } if (nVOIs == 0) { if (redNumber > 0) { fireProgressStateChanged("Creating red image"); // grayImage is ModelStorageBase.UBYTE grayImage.reallocate(ModelStorageBase.FLOAT); fireProgressStateChanged(30); try { grayImage.importData(0, buffer, true); } catch (IOException error) { buffer = null; errorCleanUp("Error on grayImage.importData", true); return; } fireProgressStateChanged("Performing median filter on red"); fireProgressStateChanged(31); medianIters = 1; kernelSize = 3; kernelShape = AlgorithmMedian.CUBE_KERNEL; stdDev = 0.0f; sliceBySlice = false; wholeImage = true; algoMedian = new AlgorithmMedian(grayImage, medianIters, kernelSize, kernelShape, stdDev, adaptiveSize, maximumSize, sliceBySlice, wholeImage); algoMedian.run(); algoMedian.finalize(); algoMedian = null; /*ViewJFrameImage testFrame = new ViewJFrameImage(grayImage, null, new Dimension(600, 300)); boolean runTest = true; if (runTest) { setCompleted(true); return; }*/ fireProgressStateChanged("Getting histogram info on red"); fireProgressStateChanged(32); bins = 256; algoHist = new AlgorithmHistogram(grayImage, bins); algoHist.run(); histoBuffer = algoHist.getHistoBuffer(); lowValue = algoHist.getLowValue(); algoHist.finalize(); algoHist = null; totalCount = histoBuffer[0]; for (i = 1; i < histoBuffer.length; i++) { totalCount += histoBuffer[i]; } countsToRetain = (int) Math.round(redFraction * totalCount); found = false; countsFound = 0; threshold = 1.0f; for (i = bins - 1; (i >= 0) && !found; i--) { countsFound += histoBuffer[i]; if (countsFound >= countsToRetain) { found = true; threshold = (float) lowValue[i]; } } cropBackground = true; // Segment red into 3 values fireProgressStateChanged("Performing FuzzyCMeans Segmentation on red"); fireProgressStateChanged(33); nClasses = 3; nPyramid = 4; oneJacobiIter = 1; twoJacobiIter = 2; q = 2.0f; oneSmooth = 2e4f; twoSmooth = 2e5f; outputGainField = false; segmentation = HARD_ONLY; maxIter = 200; endTolerance = 0.01f; wholeImage = true; // grayImage enters ModelStorageBase.FLOAT and returns ModelStorageBase.UBYTE fcmAlgo = new AlgorithmFuzzyCMeans(grayImage, nClasses, nPyramid, oneJacobiIter, twoJacobiIter, q, oneSmooth, twoSmooth, outputGainField, segmentation, cropBackground, threshold, maxIter, endTolerance, wholeImage); centroids = new float[3]; // Find the first value above the 0 value for min min = Float.MAX_VALUE; for (i = 0; i < totLength; i++) { if ((buffer[i] < min) && (buffer[i] != 0.0f)) { min = buffer[i]; } } max = (float) grayImage.getMax(); centroids[0] = min + ((max - min) / 4.0f); centroids[1] = min + (2.0f * (max - min) / 4.0f); centroids[2] = min + (3.0f * (max - min) / 4.0f); fcmAlgo.setCentroids(centroids); fcmAlgo.run(); fcmAlgo.finalize(); fcmAlgo = null; System.gc(); /*ViewJFrameImage testFrame = new ViewJFrameImage(grayImage, null, new Dimension(600, 300)); boolean runTest = true; if (runTest) { setCompleted(true); return; }*/ // Now convert the red min and max to 0 and 1 fireProgressStateChanged("Setting segmented red values to 0 and 1"); fireProgressStateChanged(35); grayImage.calcMinMax(); max = (float) grayImage.getMax(); thresholds[0] = max; thresholds[1] = max; fillValue = 0.0f; thresholdAlgo = new AlgorithmThresholdDual(grayImage, thresholds, fillValue, AlgorithmThresholdDual.BINARY_TYPE, wholeImage, false); thresholdAlgo.run(); thresholdAlgo.finalize(); thresholdAlgo = null; // Remove all inappropriate holes in red VOIs fireProgressStateChanged("Removing holes from red VOIs"); fireProgressStateChanged(37); fillHolesAlgo3D = new AlgorithmMorphology3D(grayImage, 0, 0, AlgorithmMorphology3D.FILL_HOLES, 0, 0, 0, 0, wholeImage); fillHolesAlgo3D.run(); fillHolesAlgo3D.finalize(); fillHolesAlgo3D = null; // Smooth red with a morphological opening followed by a closing fireProgressStateChanged("Opening red segmented image"); fireProgressStateChanged(40); kernel = AlgorithmMorphology3D.CONNECTED6; sphereDiameter = 1.0f; method = AlgorithmMorphology3D.OPEN; itersDilation = 1; itersErosion = 1; numPruningPixels = 0; edgingType = 0; openAlgo = new AlgorithmMorphology3D(grayImage, kernel, sphereDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); openAlgo.run(); openAlgo.finalize(); openAlgo = null; fireProgressStateChanged("Closing red segmented image"); fireProgressStateChanged(42); method = AlgorithmMorphology3D.CLOSE; closeAlgo = new AlgorithmMorphology3D(grayImage, kernel, sphereDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); closeAlgo.run(); closeAlgo.finalize(); closeAlgo = null; // Put the red VOI IDs in redIDArray fireProgressStateChanged("IDing objects in red segmented image"); fireProgressStateChanged(44); kernel = AlgorithmMorphology3D.SIZED_SPHERE; sphereDiameter = 0.0f; method = AlgorithmMorphology3D.ID_OBJECTS; itersDilation = 0; itersErosion = 0; idObjectsAlgo3D = new AlgorithmMorphology3D(grayImage, kernel, sphereDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); idObjectsAlgo3D.setMinMax(redMin, 2000000); idObjectsAlgo3D.run(); idObjectsAlgo3D.finalize(); idObjectsAlgo3D = null; System.gc(); grayImage.calcMinMax(); numRedObjects = (int) grayImage.getMax(); redIDArray = new byte[totLength]; /*ViewJFrameImage testFrame = new ViewJFrameImage(grayImage, null, new Dimension(600, 300)); boolean runTest = true; if (runTest) { setCompleted(true); return; }*/ try { grayImage.exportData(0, totLength, redIDArray); } catch (IOException error) { byteBuffer = null; redIDArray = null; errorCleanUp("Error on grayImage.exportData", true); return; } // Split redIDArray objects apart into 2 or 3 redIDArray objects // if they go between 2 or 3 cells moreRedObjects = 0; redObjectNucleus = new int[numObjects + 1]; for (i = 1; i <= numRedObjects; i++) { for (j = 0; j <= numObjects; j++) { redObjectNucleus[j] = 0; } // for (j = 0; j <= numObjects; j++) for (j = 0; j < totLength; j++) { if (redIDArray[j] == i) { redObjectNucleus[IDArray[j]]++; } // if (redIDArray[j] == i) } // for (j = 0; j < totLength; j++) maxNucleus = 1; maxCount = redObjectNucleus[1]; for (j = 2; j <= numObjects; j++) { if (redObjectNucleus[j] > maxCount) { maxNucleus = j; maxCount = redObjectNucleus[j]; } } // for (j = 2; j <= numObjects; j++) secondMaxCount = 0; secondMaxNucleus = 0; for (j = 1; j <= numObjects; j++) { if (j != maxNucleus) { if (redObjectNucleus[j] > secondMaxCount) { secondMaxNucleus = j; secondMaxCount = redObjectNucleus[j]; } // if (redObjectNucleus[j] > secondMaxCount) } // if (j != maxNucleus) } // for (j = 1; j <= numObjects; j++) if (secondMaxCount > 0) { if (secondMaxCount >= redMin) { moreRedObjects++; for (j = 0; j < totLength; j++) { if ((redIDArray[j] == i) && (IDArray[j] == secondMaxNucleus)) { redIDArray[j] = (byte) (numRedObjects + moreRedObjects); } } // for (j = 0; j < totLength; j++) thirdMaxCount = 0; thirdMaxNucleus = 0; for (j = 1; j <= numObjects; j++) { if ((j != maxNucleus) && (j != secondMaxNucleus)) { if (redObjectNucleus[j] > thirdMaxCount) { thirdMaxNucleus = j; thirdMaxCount = redObjectNucleus[j]; } // if (redObjectNucleus[j] > thirdMaxCount) } // if ((j != maxNucleus) && (j != secondMaxNucleus)) } // for (j = 1; j <= numObjects; j++) if (thirdMaxCount > 0) { if (thirdMaxCount >= redMin) { moreRedObjects++; for (j = 0; j < totLength; j++) { if ((redIDArray[j] == i) && (IDArray[j] == thirdMaxNucleus)) { redIDArray[j] = (byte) (numRedObjects + moreRedObjects); } } // for (j = 0; j < totLength; j++) } else { // if (thirdMaxCount >= redMin), thirdMaxCount < redMin for (j = 0; j < totLength; j++) { if ((redIDArray[j] == i) && (IDArray[j] != 0) && (IDArray[j] != maxNucleus) && (IDArray[j] != secondMaxNucleus)) { redIDArray[j] = (byte) 0; } } // for (j = 0; j < totLength; j++) } // else thirdMaxCount < redMin } // if (thirdMaxCount > 0) } else { // if (secondMaxCount >= redMin), secondMaxCount < redMin for (j = 0; j < totLength; j++) { if ((redIDArray[j] == i) && (IDArray[j] != 0) && (IDArray[j] != maxNucleus)) { redIDArray[j] = (byte) 0; } } // for (j = 0; j < totLength; j++) } // secondMaxCount < redMin } // if (secondMaxCount > 0) } // for (i = 1; i <= numRedObjects; i++) numRedObjects = numRedObjects + moreRedObjects; } // if (redNumber > 0) if (greenNumber > 0) { fireProgressStateChanged("Creating green image"); fireProgressStateChanged(46); // grayImage is ModelStorageBase.UBYTE grayImage.reallocate(ModelStorageBase.FLOAT); try { grayImage.importData(0, greenBuffer, true); } catch (IOException error) { greenBuffer = null; errorCleanUp("Error on grayImage.importData", true); return; } fireProgressStateChanged("Performing median filter on green"); fireProgressStateChanged(47); medianIters = 1; kernelSize = 3; kernelShape = AlgorithmMedian.CUBE_KERNEL; stdDev = 0.0f; sliceBySlice = false; wholeImage = true; algoMedian = new AlgorithmMedian(grayImage, medianIters, kernelSize, kernelShape, stdDev, adaptiveSize, maximumSize, sliceBySlice, wholeImage); algoMedian.run(); algoMedian.finalize(); algoMedian = null; System.gc(); fireProgressStateChanged("Getting histogram info on green"); fireProgressStateChanged(48); bins = 256; algoHist = new AlgorithmHistogram(grayImage, bins); algoHist.run(); histoBuffer = algoHist.getHistoBuffer(); lowValue = algoHist.getLowValue(); algoHist.finalize(); algoHist = null; totalCount = histoBuffer[0]; for (i = 1; i < histoBuffer.length; i++) { totalCount += histoBuffer[i]; } countsToRetain = (int) Math.round(greenFraction * totalCount); found = false; countsFound = 0; threshold = 1.0f; for (i = bins - 1; (i >= 0) && !found; i--) { countsFound += histoBuffer[i]; if (countsFound >= countsToRetain) { found = true; threshold = (float) lowValue[i]; } } cropBackground = true; // Segment green into 3 values fireProgressStateChanged("Performing FuzzyCMeans Segmentation on green"); fireProgressStateChanged(49); nClasses = 3; nPyramid = 4; oneJacobiIter = 1; twoJacobiIter = 2; q = 2.0f; oneSmooth = 2e4f; twoSmooth = 2e5f; outputGainField = false; segmentation = HARD_ONLY; maxIter = 200; endTolerance = 0.01f; wholeImage = true; // grayImage enters ModelStorageBase.FLOAT and returns ModelStorageBase.UBYTE fcmAlgo = new AlgorithmFuzzyCMeans(grayImage, nClasses, nPyramid, oneJacobiIter, twoJacobiIter, q, oneSmooth, twoSmooth, outputGainField, segmentation, cropBackground, threshold, maxIter, endTolerance, wholeImage); centroids = new float[3]; // Find the first value above the 0 value for min min = Float.MAX_VALUE; for (i = 0; i < totLength; i++) { if ((greenBuffer[i] < min) && (greenBuffer[i] != 0.0f)) { min = greenBuffer[i]; } } max = (float) grayImage.getMax(); centroids[0] = min + ((max - min) / 4.0f); centroids[1] = min + (2.0f * (max - min) / 4.0f); centroids[2] = min + (3.0f * (max - min) / 4.0f); fcmAlgo.setCentroids(centroids); fcmAlgo.run(); fcmAlgo.finalize(); fcmAlgo = null; System.gc(); // ViewJFrameImage testFrame2 = new ViewJFrameImage(grayImage, null, // new Dimension(600, 300), srcImage.getUserInterface()); // Now convert the green min and max to 0 and 1 fireProgressStateChanged("Setting segmented green values to 0 and 1"); fireProgressStateChanged(50); grayImage.calcMinMax(); max = (float) grayImage.getMax(); thresholds[0] = max; thresholds[1] = max; fillValue = 0.0f; thresholdAlgo = new AlgorithmThresholdDual(grayImage, thresholds, fillValue, AlgorithmThresholdDual.BINARY_TYPE, wholeImage, false); thresholdAlgo.run(); thresholdAlgo.finalize(); thresholdAlgo = null; System.gc(); // Remove all inappropriate holes in green VOIs fireProgressStateChanged("Removing holes from green VOIs"); fireProgressStateChanged(52); fillHolesAlgo3D = new AlgorithmMorphology3D(grayImage, 0, 0, AlgorithmMorphology3D.FILL_HOLES, 0, 0, 0, 0, wholeImage); fillHolesAlgo3D.run(); fillHolesAlgo3D.finalize(); fillHolesAlgo3D = null; System.gc(); // Smooth green with a morphological opening followed by a closing fireProgressStateChanged("Opening green segmented image"); fireProgressStateChanged(54); kernel = AlgorithmMorphology3D.CONNECTED6; sphereDiameter = 1.0f; method = AlgorithmMorphology3D.OPEN; itersDilation = 1; itersErosion = 1; numPruningPixels = 0; edgingType = 0; openAlgo = new AlgorithmMorphology3D(grayImage, kernel, sphereDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); openAlgo.run(); openAlgo.finalize(); openAlgo = null; fireProgressStateChanged("Closing green segmented image"); fireProgressStateChanged(56); method = AlgorithmMorphology3D.CLOSE; closeAlgo = new AlgorithmMorphology3D(grayImage, kernel, sphereDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); closeAlgo.run(); closeAlgo.finalize(); closeAlgo = null; System.gc(); // Put the green VOI IDs in greenIDArray fireProgressStateChanged("IDing objects in green segmented image"); fireProgressStateChanged(58); kernel = AlgorithmMorphology3D.SIZED_SPHERE; sphereDiameter = 0.0f; method = AlgorithmMorphology3D.ID_OBJECTS; itersDilation = 0; itersErosion = 0; idObjectsAlgo3D = new AlgorithmMorphology3D(grayImage, kernel, sphereDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); idObjectsAlgo3D.setMinMax(greenMin, 2000000); idObjectsAlgo3D.run(); idObjectsAlgo3D.finalize(); idObjectsAlgo3D = null; System.gc(); grayImage.calcMinMax(); numGreenObjects = (int) grayImage.getMax(); greenIDArray = new byte[totLength]; try { grayImage.exportData(0, totLength, greenIDArray); } catch (IOException error) { byteBuffer = null; greenIDArray = null; errorCleanUp("Error on grayImage.exportData", true); return; } // Split greenIDArray objects apart into 2 or 3 greenIDArray objects // if they go between 2 or 3 cells moreGreenObjects = 0; greenObjectNucleus = new int[numObjects + 1]; for (i = 1; i <= numGreenObjects; i++) { for (j = 0; j <= numObjects; j++) { greenObjectNucleus[j] = 0; } // for (j = 0; j <= numObjects; j++) for (j = 0; j < totLength; j++) { if (greenIDArray[j] == i) { greenObjectNucleus[IDArray[j]]++; } // if (greenIDArray[j] == i) } // for (j = 0; j < totLength; j++) maxNucleus = 1; maxCount = greenObjectNucleus[1]; for (j = 2; j <= numObjects; j++) { if (greenObjectNucleus[j] > maxCount) { maxNucleus = j; maxCount = greenObjectNucleus[j]; } } // for (j = 2; j <= numObjects; j++) secondMaxCount = 0; secondMaxNucleus = 0; for (j = 1; j <= numObjects; j++) { if (j != maxNucleus) { if (greenObjectNucleus[j] > secondMaxCount) { secondMaxNucleus = j; secondMaxCount = greenObjectNucleus[j]; } // if (greenObjectNucleus[j] > secondMaxCount) } // if (j != maxNucleus) } // for (j = 1; j <= numObjects; j++) if (secondMaxCount > 0) { if (secondMaxCount >= greenMin) { moreGreenObjects++; for (j = 0; j < totLength; j++) { if ((greenIDArray[j] == i) && (IDArray[j] == secondMaxNucleus)) { greenIDArray[j] = (byte) (numGreenObjects + moreGreenObjects); } } // for (j = 0; j < totLength; j++) thirdMaxCount = 0; thirdMaxNucleus = 0; for (j = 1; j <= numObjects; j++) { if ((j != maxNucleus) && (j != secondMaxNucleus)) { if (greenObjectNucleus[j] > thirdMaxCount) { thirdMaxNucleus = j; thirdMaxCount = greenObjectNucleus[j]; } // if (greenObjectNucleus[j] > thirdMaxCount) } // if ((j != maxNucleus) && (j != secondMaxNucleus)) } // for (j = 1; j <= numObjects; j++) if (thirdMaxCount > 0) { if (thirdMaxCount >= greenMin) { moreGreenObjects++; for (j = 0; j < totLength; j++) { if ((greenIDArray[j] == i) && (IDArray[j] == thirdMaxNucleus)) { greenIDArray[j] = (byte) (numGreenObjects + moreGreenObjects); } } // for (j = 0; j < totLength; j++) } else { // if (thirdMaxCount >= greenMin), thirdMaxCount < greenMin for (j = 0; j < totLength; j++) { if ((greenIDArray[j] == i) && (IDArray[j] != 0) && (IDArray[j] != maxNucleus) && (IDArray[j] != secondMaxNucleus)) { greenIDArray[j] = (byte) 0; } } // for (j = 0; j < totLength; j++) } // else thirdMaxCount < greenMin } // if (thirdMaxCount > 0) } else { // if (secondMaxCount >= greenMin), secondMaxCount < greenMin for (j = 0; j < totLength; j++) { if ((greenIDArray[j] == i) && (IDArray[j] != 0) && (IDArray[j] != maxNucleus)) { greenIDArray[j] = (byte) 0; } } // for (j = 0; j < totLength; j++) } // secondMaxCount < greenMin } // if (secondMaxCount > 0) } // for (i = 1; i <= numGreenObjects; i++) numGreenObjects = numGreenObjects + moreGreenObjects; } // if (greenNumber > 0) if (redNumber > 0) { // Sort the red objects within each nucleus. // Create no more than redNumber red objects within each nucleus. fireProgressStateChanged("Sorting red objects by intensity count"); fireProgressStateChanged(60); redIntensityTotal = new float[numRedObjects]; redXCenter = new float[numRedObjects]; redYCenter = new float[numRedObjects]; redZCenter = new float[numRedObjects]; redNucleusNumber = new int[numObjects]; sortedRedIndex = new int[numObjects][redNumber]; sortedRedIntensity = new float[numObjects][redNumber]; sortedRedXCenter = new float[numObjects][redNumber]; sortedRedYCenter = new float[numObjects][redNumber]; sortedRedZCenter = new float[numObjects][redNumber]; for (j = 1; j <= numRedObjects; j++) { for (i = 0, x = 0, y = 0, z = 0; i < totLength; i++) { if (redIDArray[i] == j) { redIntensityTotal[j - 1] += buffer[i]; redXCenter[j - 1] += buffer[i] * x; redYCenter[j - 1] += buffer[i] * y; redZCenter[j - 1] += buffer[i] * z; } x++; if (x == xDim) { x = 0; y++; } if (y == yDim) { y = 0; z++; } } // for (i = 0, x = 0, y = 0, z = 0; i < totLength; i++) redXCenter[j - 1] = redXCenter[j - 1] / redIntensityTotal[j - 1]; redYCenter[j - 1] = redYCenter[j - 1] / redIntensityTotal[j - 1]; redZCenter[j - 1] = redZCenter[j - 1] / redIntensityTotal[j - 1]; i = (int) redXCenter[j - 1] + ((int) (redYCenter[j - 1]) * xDim) + ((int) redZCenter[j - 1] * sliceLength); id = IDArray[i]; if (id >= 1) { if (redNucleusNumber[id - 1] < redNumber) { redNucleusNumber[id - 1]++; } found = false; for (i = 0; (i < redNucleusNumber[id - 1]) && !found; i++) { if (redIntensityTotal[j - 1] >= sortedRedIntensity[id - 1][i]) { found = true; for (k = redNucleusNumber[id - 1] - 2; k >= i; k--) { sortedRedIntensity[id - 1][k + 1] = sortedRedIntensity[id - 1][k]; sortedRedIndex[id - 1][k + 1] = sortedRedIndex[id - 1][k]; sortedRedXCenter[id - 1][k + 1] = sortedRedXCenter[id - 1][k]; sortedRedYCenter[id - 1][k + 1] = sortedRedYCenter[id - 1][k]; sortedRedZCenter[id - 1][k + 1] = sortedRedZCenter[id - 1][k]; } sortedRedIntensity[id - 1][i] = redIntensityTotal[j - 1]; sortedRedIndex[id - 1][i] = j; // from redIDArray sortedRedXCenter[id - 1][i] = redXCenter[j - 1]; sortedRedYCenter[id - 1][i] = redYCenter[j - 1]; sortedRedZCenter[id - 1][i] = redZCenter[j - 1]; } } // for (i = 0; i < redNucleusNumber[id-1] && !found; i++) } // if (id >= 1) } // for (j = 1; j <= numRedObjects; j++) redIntensityTotal = null; redXCenter = null; redYCenter = null; redZCenter = null; for (i = 0; i < numObjects; i++) { sortedRedIntensity[i] = null; sortedRedXCenter[i] = null; sortedRedYCenter[i] = null; sortedRedZCenter[i] = null; } sortedRedIntensity = null; sortedRedXCenter = null; sortedRedYCenter = null; sortedRedZCenter = null; } // if (redNumber > 0) if (greenNumber > 0) { // Sort the green objects within each nucleus. // Create no more than greenNumber green objects within each nucleus. greenIntensityTotal = new float[numGreenObjects]; greenXCenter = new float[numGreenObjects]; greenYCenter = new float[numGreenObjects]; greenZCenter = new float[numGreenObjects]; greenNucleusNumber = new int[numObjects]; sortedGreenIndex = new int[numObjects][greenNumber]; sortedGreenIntensity = new float[numObjects][greenNumber]; sortedGreenXCenter = new float[numObjects][greenNumber]; sortedGreenYCenter = new float[numObjects][greenNumber]; sortedGreenZCenter = new float[numObjects][greenNumber]; for (j = 1; j <= numGreenObjects; j++) { fireProgressStateChanged("Sorting green object " + j + " of " + numGreenObjects + " by intensity count"); fireProgressStateChanged(62 + (10 * j / numGreenObjects)); for (x = 0, y = 0, z = 0, i = 0; i < totLength; i++) { if (greenIDArray[i] == j) { greenIntensityTotal[j - 1] += greenBuffer[i]; greenXCenter[j - 1] += greenBuffer[i] * x; greenYCenter[j - 1] += greenBuffer[i] * y; greenZCenter[j - 1] += greenBuffer[i] * z; } x++; if (x == xDim) { x = 0; y++; } if (y == yDim) { y = 0; z++; } } greenXCenter[j - 1] = greenXCenter[j - 1] / greenIntensityTotal[j - 1]; greenYCenter[j - 1] = greenYCenter[j - 1] / greenIntensityTotal[j - 1]; greenZCenter[j - 1] = greenZCenter[j - 1] / greenIntensityTotal[j - 1]; i = (int) greenXCenter[j - 1] + ((int) (greenYCenter[j - 1]) * xDim) + ((int) greenZCenter[j - 1] * sliceLength); id = IDArray[i]; if (id >= 1) { if (greenNucleusNumber[id - 1] < greenNumber) { greenNucleusNumber[id - 1]++; } found = false; for (i = 0; (i < greenNucleusNumber[id - 1]) && !found; i++) { if (greenIntensityTotal[j - 1] >= sortedGreenIntensity[id - 1][i]) { found = true; for (k = greenNucleusNumber[id - 1] - 2; k >= i; k--) { sortedGreenIntensity[id - 1][k + 1] = sortedGreenIntensity[id - 1][k]; sortedGreenIndex[id - 1][k + 1] = sortedGreenIndex[id - 1][k]; sortedGreenXCenter[id - 1][k + 1] = sortedGreenXCenter[id - 1][k]; sortedGreenYCenter[id - 1][k + 1] = sortedGreenYCenter[id - 1][k]; sortedGreenZCenter[id - 1][k + 1] = sortedGreenZCenter[id - 1][k]; } sortedGreenIntensity[id - 1][i] = greenIntensityTotal[j - 1]; sortedGreenIndex[id - 1][i] = j; // from greenIDArray sortedGreenXCenter[id - 1][i] = greenXCenter[j - 1]; sortedGreenYCenter[id - 1][i] = greenYCenter[j - 1]; sortedGreenZCenter[id - 1][i] = greenZCenter[j - 1]; } } // for (i = 0; i < greenNucleusNumber[id-1] && !found; i++) } // if (id >= 1) } // for (j = 1; j <= numGreenObjects; j++) greenIntensityTotal = null; greenXCenter = null; greenYCenter = null; greenZCenter = null; for (i = 0; i < numObjects; i++) { sortedGreenIntensity[i] = null; sortedGreenXCenter[i] = null; sortedGreenYCenter[i] = null; sortedGreenZCenter[i] = null; } sortedGreenIntensity = null; sortedGreenXCenter = null; sortedGreenYCenter = null; sortedGreenZCenter = null; } // if (greenNumber > 0) Arrays.fill(byteBuffer, (byte) 0); numRedVOIObjects = 0; numGreenVOIObjects = 0; for (i = 0; i < numObjects; i++) { if (redNumber > 0) { numRedVOIObjects += redNucleusNumber[i]; } // if (redNumber > 0) if (greenNumber > 0) { numGreenVOIObjects += greenNucleusNumber[i]; } // if (greenNumber > 0) } numVOIObjects = Math.max(numRedVOIObjects, numGreenVOIObjects); colorTable = new Color[numVOIObjects]; nameTable = new String[numVOIObjects]; if (redNumber > 0) { for (i = 0, j = 0; i < numObjects; i++) { for (m = 0; m < redNumber; m++) { if (redNucleusNumber[i] > m) { for (k = 0; k < totLength; k++) { if (redIDArray[k] == sortedRedIndex[i][m]) { byteBuffer[k] = (byte) (j + 1); } } // for (k = 0; k < totLength; k++) if (m == 0) { colorTable[j] = Color.yellow; } else { colorTable[j] = Color.yellow.darker(); } nameTable[j] = new String((i + 1) + "R" + (m + 1)); j++; } // if (redNucleusNumber[i] > m) } // for (m = 0; m < redNumber; m++) } // for (i = 0, j = 0; i < numObjects; i++) for (i = 0; i < numObjects; i++) { sortedRedIndex[i] = null; } sortedRedIndex = null; redIDArray = null; try { grayImage.importData(0, byteBuffer, true); } catch (IOException error) { byteBuffer = null; errorCleanUp("Error on grayImage.importData", true); return; } fireProgressStateChanged("Extracting VOIs from red image"); fireProgressStateChanged(73); algoVOIExtraction = new AlgorithmVOIExtraction(grayImage); algoVOIExtraction.setColorTable(colorTable); algoVOIExtraction.setNameTable(nameTable); algoVOIExtraction.run(); algoVOIExtraction.finalize(); algoVOIExtraction = null; System.gc(); srcImage.setVOIs(grayImage.getVOIs()); } // if (redNumber > 0) if (greenNumber > 0) { Arrays.fill(byteBuffer, (byte) 0); for (i = 0, j = 0; i < numObjects; i++) { for (m = 0; m < greenNumber; m++) { if (greenNucleusNumber[i] > m) { for (k = 0; k < totLength; k++) { if (greenIDArray[k] == sortedGreenIndex[i][m]) { byteBuffer[k] = (byte) (j + 1); } } // for (k = 0; k < totLength; k++) if (m == 0) { colorTable[j] = Color.pink; } else { colorTable[j] = Color.pink.darker(); } nameTable[j] = new String((i + 1) + "G" + (m + 1)); j++; } // if (greenNucleusNumber[i] > m) } // for (m = 0; m < greenNumber; m++) } // for (i = 0, j = 0; i < numObjects; i++) for (i = 0; i < numObjects; i++) { sortedGreenIndex[i] = null; } sortedGreenIndex = null; greenIDArray = null; grayImage.resetVOIs(); try { grayImage.importData(0, byteBuffer, true); } catch (IOException error) { byteBuffer = null; errorCleanUp("Error on grayImage.importData", true); return; } fireProgressStateChanged("Extracting VOIs from green image"); fireProgressStateChanged(74); algoVOIExtraction = new AlgorithmVOIExtraction(grayImage); algoVOIExtraction.setColorTable(colorTable); algoVOIExtraction.setNameTable(nameTable); algoVOIExtraction.run(); algoVOIExtraction.finalize(); algoVOIExtraction = null; System.gc(); if (redNumber > 0) { srcImage.addVOIs(grayImage.getVOIs()); } else { srcImage.setVOIs(grayImage.getVOIs()); } } // if (greenNumber > 0) VOIs = srcImage.getVOIs(); nVOIs = VOIs.size(); } // if (nVOIs == 0) shortMask = new short[totLength]; // System.out.println("Image = " + srcImage); // System.out.println("VOIs = " + VOIs); idCount = new int[numObjects]; xPosGeo = new float[nVOIs]; yPosGeo = new float[nVOIs]; zPosGeo = new float[nVOIs]; xPosGrav = new float[nVOIs]; yPosGrav = new float[nVOIs]; zPosGrav = new float[nVOIs]; objectID = new int[nVOIs]; isRed = new boolean[nVOIs]; colorCount = new float[nVOIs]; UI.clearAllDataText(); UI.setDataText("\n"); voiCount = new int[nVOIs]; for (i = 0; i < nVOIs; i++) { Preferences.debug("i = " + i + "\n"); fireProgressStateChanged("Processing VOI " + (i + 1) + " of " + nVOIs); fireProgressStateChanged(75 + (10 * (i + 1) / nVOIs)); VOIs.VOIAt(i).setOnlyID((short) i); if (VOIs.VOIAt(i).getCurveType() == VOI.CONTOUR) { Preferences.debug("VOI contour i = " + i + "\n"); Arrays.fill(shortMask, (short) -1); shortMask = srcImage.generateVOIMask(shortMask, i); redCount = 0; greenCount = 0; Arrays.fill(idCount, 0); for (j = 0; j < totLength; j++) { if (shortMask[j] != -1) { if (redNumber >= 1) { redCount += buffer[j]; } if (greenNumber >= 1) { greenCount += greenBuffer[j]; } if (IDArray[j] > 0) { index = IDArray[j] - 1; idCount[index]++; } } } objectID[i] = 1; objectCount = idCount[0]; for (j = 2; j <= numObjects; j++) { if (idCount[j - 1] > objectCount) { objectID[i] = j; objectCount = idCount[j - 1]; } } // for (j = 2; j <= numObjects; j++) xPosGeo[i] = 0.0f; yPosGeo[i] = 0.0f; zPosGeo[i] = 0.0f; xPosGrav[i] = 0.0f; yPosGrav[i] = 0.0f; zPosGrav[i] = 0.0f; if (redCount >= greenCount) { isRed[i] = true; colorCount[i] = 0.0f; for (k = 0, z = 0; z < zDim; z++, k += sliceLength) { for (j = k, y = 0; y < yDim; y++, j += xDim) { for (x = 0; x < xDim; x++) { index = x + j; if (shortMask[index] != -1) { xPosGeo[i] += x; yPosGeo[i] += y; zPosGeo[i] += z; xPosGrav[i] += buffer[index] * x; yPosGrav[i] += buffer[index] * y; zPosGrav[i] += buffer[index] * z; colorCount[i] += buffer[index]; voiCount[i]++; // Expand blue nuclei to include VOI IDArray[index] = (byte) objectID[i]; } } } } xPosGeo[i] /= voiCount[i]; yPosGeo[i] /= voiCount[i]; zPosGeo[i] /= voiCount[i]; xPosGrav[i] /= colorCount[i]; yPosGrav[i] /= colorCount[i]; zPosGrav[i] /= colorCount[i]; } // if (redCount >= greenCount) else { // redCount < greenCount colorCount[i] = 0.0f; for (k = 0, z = 0; z < zDim; z++, k += sliceLength) { for (j = k, y = 0; y < yDim; y++, j += xDim) { for (x = 0; x < xDim; x++) { index = x + j; if (shortMask[index] != -1) { xPosGeo[i] += x; yPosGeo[i] += y; zPosGeo[i] += z; xPosGrav[i] += greenBuffer[index] * x; yPosGrav[i] += greenBuffer[index] * y; zPosGrav[i] += greenBuffer[index] * z; colorCount[i] += greenBuffer[index]; voiCount[i]++; // Expand blue nuclei to include VOI IDArray[index] = (byte) objectID[i]; } } } } xPosGeo[i] /= voiCount[i]; yPosGeo[i] /= voiCount[i]; zPosGeo[i] /= voiCount[i]; xPosGrav[i] /= colorCount[i]; yPosGrav[i] /= colorCount[i]; zPosGrav[i] /= colorCount[i]; } // redCount < greenCount } // if (VOIs.VOIAt(i).getCurveType() == VOI.CONTOUR) } // for (i = 0; i < nVOIs; i++) rIndex = new int[3]; rCount = new float[3]; gIndex = new int[3]; gCount = new float[3]; VOIs2 = new ViewVOIVector(); objectID2 = new int[nVOIs]; xPosGeo2 = new float[nVOIs]; yPosGeo2 = new float[nVOIs]; zPosGeo2 = new float[nVOIs]; xPosGrav2 = new float[nVOIs]; yPosGrav2 = new float[nVOIs]; zPosGrav2 = new float[nVOIs]; voiCount2 = new int[nVOIs]; index2 = 0; for (j = 1; j <= numObjects; j++) { numRedFound = 0; numGreenFound = 0; rCount[0] = 0.0f; rCount[1] = 0.0f; rCount[2] = 0.0f; gCount[0] = 0.0f; gCount[1] = 0.0f; gCount[2] = 0.0f; for (i = 0; i < nVOIs; i++) { if ((VOIs.VOIAt(i).getCurveType() == VOI.CONTOUR) && (objectID[i] == j)) { if (isRed[i]) { if (numRedFound < 3) { numRedFound++; if (numRedFound > redNumber) { redNumber = numRedFound; } } placed = false; for (k = 0; k <= 2 && (!placed); k++) { if (colorCount[i] >= rCount[k]) { placed = true; for (m = numRedFound - 2; m >= k; m--) { rIndex[m+1] = rIndex[m]; rCount[m+1] = rCount[m]; } rIndex[k] = i; rCount[k] = colorCount[i]; } } } else { if (numGreenFound < 3) { numGreenFound++; if (numGreenFound > greenNumber) { greenNumber = numGreenFound; } } placed = false; for (k = 0; k <= 2 && (!placed); k++) { if (colorCount[i] >= gCount[k]) { placed = true; for (m = numGreenFound - 2; m >= k; m--) { gIndex[m+1] = gIndex[m]; gCount[m+1] = gCount[m]; } gIndex[k] = i; gCount[k] = colorCount[i]; } } } } } // for (i = 0; i < nVOIs; i++) for (k = 0; k < numRedFound; k++) { VOIs.VOIAt(rIndex[k]).setName(j + "R" + (k+1)); if (k == 0) { VOIs.VOIAt(rIndex[k]).setColor(Color.yellow); } else { VOIs.VOIAt(rIndex[k]).setColor(Color.yellow.darker()); } VOIs2.addElement(VOIs.VOIAt(rIndex[k])); objectID2[index2] = j; xPosGeo2[index2] = xPosGeo[rIndex[k]]; yPosGeo2[index2] = yPosGeo[rIndex[k]]; zPosGeo2[index2] = zPosGeo[rIndex[k]]; xPosGrav2[index2] = xPosGrav[rIndex[k]]; yPosGrav2[index2] = yPosGrav[rIndex[k]]; zPosGrav2[index2] = zPosGrav[rIndex[k]]; voiCount2[index2] = voiCount[rIndex[k]]; index2++; } for (k = 0; k < numGreenFound; k++) { VOIs.VOIAt(gIndex[k]).setName(j + "G" + (k+1)); if (k == 0) { VOIs.VOIAt(gIndex[k]).setColor(Color.pink); } else { VOIs.VOIAt(gIndex[k]).setColor(Color.pink.darker()); } VOIs2.addElement(VOIs.VOIAt(gIndex[k])); objectID2[index2] = j; xPosGeo2[index2] = xPosGeo[gIndex[k]]; yPosGeo2[index2] = yPosGeo[gIndex[k]]; zPosGeo2[index2] = zPosGeo[gIndex[k]]; xPosGrav2[index2] = xPosGrav[gIndex[k]]; yPosGrav2[index2] = yPosGrav[gIndex[k]]; zPosGrav2[index2] = zPosGrav[gIndex[k]]; voiCount2[index2] = voiCount[gIndex[k]]; index2++; } } // (j = 1; j <= numObjects; j++) VOIs.clear(); nVOIs = VOIs2.size(); for (i = 0; i < nVOIs; i++) { VOIs.addElement(VOIs2.VOIAt(i)); } VOIs2.clear(); VOIs2 = null; for (i = 0; i < nVOIs; i++) { objectID[i] = objectID2[i]; xPosGeo[i] = xPosGeo2[i]; yPosGeo[i] = yPosGeo2[i]; zPosGeo[i] = zPosGeo2[i]; xPosGrav[i] = xPosGrav2[i]; yPosGrav[i] = yPosGrav2[i]; zPosGrav[i] = zPosGrav2[i]; voiCount[i] = voiCount2[i]; } objectID2 = null; xPosGeo2 = null; yPosGeo2 = null; zPosGeo2 = null; xPosGrav2 = null; yPosGrav2 = null; zPosGrav2 = null; voiCount2 = null; for (i = 0; i < nVOIs; i++) { if (VOIs.VOIAt(i).getCurveType() == VOI.CONTOUR) { voiName = VOIs.VOIAt(i).getName(); newPtVOI = new VOI((short) (i + nVOIs), "point3D" + i + ".voi", VOI.POINT, -1.0f); newPtVOI.setColor(Color.white); xArr[0] = xPosGrav[i]; yArr[0] = yPosGrav[i]; zArr[0] = zPosGrav[i]; newPtVOI.importCurve(xArr, yArr, zArr); ((VOIPoint) (newPtVOI.getCurves().elementAt(0))).setFixed(true); ((VOIPoint) (newPtVOI.getCurves().elementAt(0))).setLabel(voiName); srcImage.registerVOI(newPtVOI); } } // Ellipse fitting blue objects with first and second moments fireProgressStateChanged("Ellipse fitting with moments"); volume = new int[numObjects]; cx = new double[numObjects]; cy = new double[numObjects]; cz = new double[numObjects]; ixx = new double[numObjects]; iyy = new double[numObjects]; izz = new double[numObjects]; iyz = new double[numObjects]; ixy = new double[numObjects]; izx = new double[numObjects]; sAxisCen = new float[numObjects][3]; for (z = 0; z < zDim; z++) { offset = z * sliceLength; for (y = 0; y < yDim; y++) { j = offset + (y * xDim); for (x = 0; x < xDim; x++) { i = j + x; if (IDArray[i] > 0) { idm1 = IDArray[i] - 1; volume[idm1]++; cx[idm1] += x * xRes; cy[idm1] += y * yRes; cz[idm1] += z * zRes; } // if (IDArray[i] > 0) } // for (x = 0; x < xDim; x++) } // for (y = 0; y < yDim; y++) } // for (z = 0; z < zDim; z++) for (k = 0; k < numObjects; k++) { cx[k] = cx[k] / volume[k]; cy[k] = cy[k] / volume[k]; cz[k] = cz[k] / volume[k]; } // for (k = 0; k < numObjects; k++) for (z = 0; z < zDim; z++) { offset = z * sliceLength; for (y = 0; y < yDim; y++) { j = offset + (y * xDim); for (x = 0; x < xDim; x++) { i = j + x; if (IDArray[i] > 0) { idm1 = IDArray[i] - 1; xdiff = (x * xRes) - cx[idm1]; ydiff = (y * yRes) - cy[idm1]; zdiff = (z * zRes) - cz[idm1]; ixx[idm1] += xdiff * xdiff; iyy[idm1] += ydiff * ydiff; izz[idm1] += zdiff * zdiff; iyz[idm1] += ydiff * zdiff; ixy[idm1] += xdiff * ydiff; izx[idm1] += zdiff * xdiff; } // if (IDArray[i] > 0) } // for (x = 0; x < xDim; x++) } // for (y = 0; y < yDim; y++) } // for (z = 0; z < zDim; z++) for (k = 0; k < numObjects; k++) { ixx[k] = ixx[k] / volume[k]; iyy[k] = iyy[k] / volume[k]; izz[k] = izz[k] / volume[k]; iyz[k] = iyz[k] / volume[k]; ixy[k] = ixy[k] / volume[k]; izx[k] = izx[k] / volume[k]; tensor[0][0] = ixx[k]; tensor[0][1] = ixy[k]; tensor[0][2] = izx[k]; tensor[1][0] = ixy[k]; tensor[1][1] = iyy[k]; tensor[1][2] = iyz[k]; tensor[2][0] = izx[k]; tensor[2][1] = iyz[k]; tensor[2][2] = izz[k]; // In EigenvalueDecomposition the columns represent the eigenvectors Eigenvalue.decompose(tensor, eigenvector, eigenvalue); // Arrange the eigenvalues and the corresponding eigenvectors // in ascending order so that e0 <= e1 <= e2 for (m = 0; m < 3; m++) { index = m; for (n = m + 1; n < 3; n++) { if (eigenvalue[n] < eigenvalue[m]) { index = n; } } // for (n = m+1; n < 3; n++) if (index != m) { temp = eigenvalue[m]; eigenvalue[m] = eigenvalue[index]; eigenvalue[index] = temp; for (n = 0; n < 3; n++) { tempCol[n] = eigenvector[n][m]; eigenvector[n][m] = eigenvector[n][index]; eigenvector[n][index] = tempCol[n]; } } // if (index != m) } // for (m = 0; m < 3; m++) // Semi axes are proportional to the square root of the eigenvalues for (m = 0; m < 3; m++) { eigenvalue[m] = Math.sqrt(eigenvalue[m]); } // Calculate an unnormalized volume from the eigenvalues ellipVol = (4.0 / 3.0) * Math.PI * eigenvalue[0] * eigenvalue[1] * eigenvalue[2]; // Calculate a normalizing factor with the actual volume normFactor = Math.pow((xRes * yRes * zRes * volume[k] / ellipVol), (1.0 / 3.0)); // Normalize to obtain the actual semi axes for (m = 0; m < 3; m++) { sAxisCen[k][m] = (float) (normFactor * eigenvalue[m]); } } // for (k = 0; k < numObjects; k++) boundaryArray = new byte[totLength]; dilateArray = new byte[totLength]; xCenter = new float[numObjects]; yCenter = new float[numObjects]; zCenter = new float[numObjects]; centerToNearEdge = new float[numObjects]; centerToFarEdge = new float[numObjects]; kernel = AlgorithmMorphology3D.CONNECTED24; method = AlgorithmMorphology3D.DILATE; itersDilation = 1; blueCountTotal = new int[numObjects]; scaleMax = xRes * (xDim - 1); scaleMax = Math.max(scaleMax, yRes * (yDim - 1)); scaleMax = Math.max(scaleMax, zRes * (zDim - 1)); invMax = 1.0f / scaleMax; volPoints = new Vector[numObjects]; sAxisPer = new float[numObjects][3]; // nucleusVoxel = new boolean[numObjects][totLength]; for (id = 1; id <= numObjects; id++) { fireProgressStateChanged("Processing object " + id + " of " + numObjects + " in blue segmented image"); fireProgressStateChanged(85 + (id * 10 / numObjects)); Arrays.fill(byteBuffer, (byte) 0); xCenter[id - 1] = 0.0f; yCenter[id - 1] = 0.0f; zCenter[id - 1] = 0.0f; volPoints[id - 1] = new Vector<Vector3f>(); lowestSqr = Float.MAX_VALUE; highestSqr = -Float.MAX_VALUE; for (k = 0, z = 0; z < zDim; z++, k += sliceLength) { for (j = k, y = 0; y < yDim; y++, j += xDim) { for (x = 0; x < xDim; x++) { i = x + j; if (IDArray[i] == id) { byteBuffer[i] = (byte) 1; xCenter[id - 1] += x; yCenter[id - 1] += y; zCenter[id - 1] += z; blueCountTotal[id - 1]++; } } } } xCenter[id - 1] /= blueCountTotal[id - 1]; yCenter[id - 1] /= blueCountTotal[id - 1]; zCenter[id - 1] /= blueCountTotal[id - 1]; try { grayImage.importData(0, byteBuffer, true); } catch (IOException error) { byteBuffer = null; IDArray = null; errorCleanUp("Error on grayImage.importData", true); return; } dilateAlgo = new AlgorithmMorphology3D(grayImage, kernel, sphereDiameter, method, itersDilation, itersErosion, numPruningPixels, edgingType, wholeImage); dilateAlgo.run(); dilateAlgo.finalize(); dilateAlgo = null; try { grayImage.exportData(0, totLength, dilateArray); } catch (IOException error) { byteBuffer = null; IDArray = null; dilateArray = null; errorCleanUp("Error on grayImage.exportData", true); return; } for (k = 0, z = 0; z < zDim; z++, k += sliceLength) { for (j = k, y = 0; y < yDim; y++, j += xDim) { for (x = 0; x < xDim; x++) { i = x + j; if ((dilateArray[i] == (byte) 1) && (byteBuffer[i] == (byte) 0)) { boundaryArray[i] = (byte) id; kVoxel = new Vector3f(x * xRes * invMax, y * yRes * invMax, z * zRes * invMax); volPoints[id - 1].add(kVoxel); distSqr = ((xCenter[id - 1] - x) * (xCenter[id - 1] - x) * xRes * xRes) + ((yCenter[id - 1] - y) * (yCenter[id - 1] - y) * yRes * yRes) + ((zCenter[id - 1] - z) * (zCenter[id - 1] - z) * zRes * zRes); if (distSqr < lowestSqr) { lowestSqr = distSqr; } if (distSqr > highestSqr) { highestSqr = distSqr; } } } } } centerToNearEdge[id - 1] = (float) Math.sqrt(lowestSqr); centerToFarEdge[id - 1] = (float) Math.sqrt(highestSqr); Preferences.debug("Object id = " + id + "\n"); Preferences.debug("Center of mass = (" + xCenter[id - 1] + ", " + yCenter[id - 1] + ", " + zCenter[id - 1] + ")\n"); Preferences.debug("Distance from center of mass to near edge = " + centerToNearEdge[id - 1] + "\n"); Preferences.debug("Distance from center of mass to far edge = " + centerToFarEdge[id - 1] + "\n"); kF = new AlgorithmEllipsoidFit(volPoints[id - 1]); axes = kF.getAxes(); sAxisPer[id - 1][0] = (float) (0.5 * axes[0] * scaleMax); sAxisPer[id - 1][1] = (float) (0.5 * axes[1] * scaleMax); sAxisPer[id - 1][2] = (float) (0.5 * axes[2] * scaleMax); // Arrange the ellipse lengths in ascending order for (m = 0; m < 3; m++) { index = m; for (n = m + 1; n < 3; n++) { if (sAxisPer[id - 1][n] < sAxisPer[id - 1][index]) { index = n; } } // for (n = m+1; n < 3; n++) if (index != m) { tempf = sAxisPer[id - 1][m]; sAxisPer[id - 1][m] = sAxisPer[id - 1][index]; sAxisPer[id - 1][index] = tempf; } // if (index != m) } // for (m = 0; m < 3; m++) } // for (id = 1; id <= numObjects; id++) grayImage.disposeLocal(); grayImage = null; System.gc(); for (i = 0; i < numObjects; i++) { newPtVOI = new VOI((short) (i + (2 * nVOIs)), "point3D" + i + ".voi", VOI.POINT, -1.0f); newPtVOI.setColor(Color.magenta); xArr[0] = xCenter[i]; yArr[0] = yCenter[i]; zArr[0] = zCenter[i]; newPtVOI.importCurve(xArr, yArr, zArr); ((VOIPoint) (newPtVOI.getCurves().elementAt(0))).setFixed(true); ((VOIPoint) (newPtVOI.getCurves().elementAt(0))).setLabel("N" + (i + 1)); srcImage.registerVOI(newPtVOI); } // for (i = 0; i < numObjects; i++) srcImage.notifyImageDisplayListeners(); UI.setDataText("Plugin 10/19/07 version\n"); UI.setDataText(srcImage.getFileInfo(0).getFileName() + "\n"); if (xUnits != Unit.UNKNOWN_MEASURE.getLegacyNum()) { UI.setDataText("X resolution = " + xRes + " " + (Unit.getUnitFromLegacyNum(xUnits)).toString() + "\n"); } else { UI.setDataText("X resolution = " + xRes + "\n"); } if (yUnits != Unit.UNKNOWN_MEASURE.getLegacyNum()) { UI.setDataText("Y resolution = " + yRes + " " + (Unit.getUnitFromLegacyNum(yUnits)).toString() + "\n"); } else { UI.setDataText("Y resolution = " + yRes + "\n"); } if (zUnits != Unit.UNKNOWN_MEASURE.getLegacyNum()) { UI.setDataText("Z resolution = " + zRes + " " + (Unit.getUnitFromLegacyNum(zUnits)).toString() + "\n\n"); } else { UI.setDataText("Z resolution = " + zRes + "\n\n"); } UI.setDataText("Nucleus\tNvolume\tRmin\tRmax"); UI.setDataText("\tsAx1Cen\tsAx2Cen\tsAx3Cen"); UI.setDataText("\tsAx1Per\tsAx2Per\tsAx3Per"); if (redNumber > 0) { UI.setDataText("\tR1volume"); UI.setDataText("\tR1geomax\tR1geo%\tR1geo-Np"); UI.setDataText("\tR1gravmax\tR1grav%\tR1grav-Np"); } if (redNumber > 1) { UI.setDataText("\tR2volume"); UI.setDataText("\tR2geomax\tR2geo%\tR2geo-Np"); UI.setDataText("\tR2gravmax\tR2grav%\tR2grav-Np"); } if (redNumber > 2) { UI.setDataText("\tR3volume"); UI.setDataText("\tR3geomax\tR3geo%\tR3geo-Np"); UI.setDataText("\tR3gravmax\tR3grav%\tR3grav-Np"); } if (greenNumber > 0) { UI.setDataText("\tG1volume"); UI.setDataText("\tG1geomax\tG1geo%\tG1geo-Np"); UI.setDataText("\tG1gravmax\tG1grav%\tG1grav-Np"); } if (greenNumber > 1) { UI.setDataText("\tG2volume"); UI.setDataText("\tG2geomax\tG2geo%\tG2geo-Np"); UI.setDataText("\tG2gravmax\tG2grav%\tG2grav-Np"); } if (greenNumber > 2) { UI.setDataText("\tG3volume"); UI.setDataText("\tG3geomax\tG3geo%\tG3geo-Np"); UI.setDataText("\tG3gravmax\tG3grav%\tG3grav-Np"); } UI.setDataText("\n"); for (i = 0; i < numObjects; i++) { nuclearVolume = xRes * yRes * zRes * blueCountTotal[i]; UI.setDataText((i + 1) + "\t" + nf.format(nuclearVolume)); UI.setDataText("\t" + nf.format(centerToNearEdge[i])); // equivalentRadius = (float)Math.pow(nuclearVolume/((4.0/3.0)*Math.PI),1.0/3.0); // UI.setDataText("\t" + nf.format(equivalentRadius)); UI.setDataText("\t" + nf.format(centerToFarEdge[i])); UI.setDataText("\t" + nf.format(sAxisCen[i][0])); UI.setDataText("\t" + nf.format(sAxisCen[i][1])); UI.setDataText("\t" + nf.format(sAxisCen[i][2])); UI.setDataText("\t" + nf.format(sAxisPer[i][0])); UI.setDataText("\t" + nf.format(sAxisPer[i][1])); UI.setDataText("\t" + nf.format(sAxisPer[i][2])); redFound = 0; greenFound = 0; for (j = 0; j <= (nVOIs - 1); j++) { if (objectID[j] == (i + 1)) { voiType = VOIs.VOIAt(j).getName().charAt(1); Preferences.debug("VOI name found = " + VOIs.VOIAt(j).getName() + "\n"); Preferences.debug("voiType = " + voiType + "\n"); if (voiType == 'R') { redFound++; Preferences.debug("Red found\n"); } if (voiType == 'G') { greenFound++; Preferences.debug("Green found\n"); if ((greenFound == 1) && (redFound != redNumber)) { for (k = 0; k < (redNumber - redFound); k++) { UI.setDataText("\t\t\t\t\t\t\t"); } // for (k = 0; k < (redNumber-redFound); k++) } // if ((greenFound == 1) && (redFound != redNumber)) } voiVolume = xRes * yRes * zRes * voiCount[j]; UI.setDataText("\t" + nf.format(voiVolume)); geoToCenter = (float) Math.sqrt(((xPosGeo[j] - xCenter[i]) * (xPosGeo[j] - xCenter[i]) * xRes * xRes) + ((yPosGeo[j] - yCenter[i]) * (yPosGeo[j] - yCenter[i]) * yRes * yRes) + ((zPosGeo[j] - zCenter[i]) * (zPosGeo[j] - zCenter[i]) * zRes * zRes)); initialdx = xPosGeo[j] - xCenter[i]; initialdy = yPosGeo[j] - yCenter[i]; initialdz = zPosGeo[j] - zCenter[i]; lastEdgeX = (int) Math.round(xPosGeo[j]); lastEdgeY = (int) Math.round(yPosGeo[j]); lastEdgeZ = (int) Math.round(zPosGeo[j]); if ((Math.abs(initialdx) >= Math.abs(initialdy)) && (Math.abs(initialdx) >= Math.abs(initialdz))) { if (initialdx >= 0.0f) { incx = 0.1f; } else { incx = -0.1f; } incy = 0.1f * initialdy / Math.abs(initialdx); incz = 0.1f * initialdz / Math.abs(initialdx); } else if ((Math.abs(initialdy) >= Math.abs(initialdx)) && (Math.abs(initialdy) >= Math.abs(initialdz))) { if (initialdy >= 0.0f) { incy = 0.1f; } else { incy = -0.1f; } incx = 0.1f * initialdx / Math.abs(initialdy); incz = 0.1f * initialdz / Math.abs(initialdy); } else { if (initialdz >= 0.0f) { incz = 0.1f; } else { incz = -0.1f; } incx = 0.1f * initialdx / Math.abs(initialdz); incy = 0.1f * initialdy / Math.abs(initialdz); } numInc = 1; while (true) { newEdgeX = (int) Math.round(xPosGeo[j] + (numInc * incx)); if ((newEdgeX < 0) || (newEdgeX >= xDim)) { break; } newEdgeY = (int) Math.round(yPosGeo[j] + (numInc * incy)); if ((newEdgeY < 0) || (newEdgeY >= yDim)) { break; } newEdgeZ = (int) Math.round(zPosGeo[j] + (numInc * incz)); if ((newEdgeZ < 0) || (newEdgeZ >= zDim)) { break; } numInc++; if ((newEdgeX == lastEdgeX) && (newEdgeY == lastEdgeY) && (newEdgeZ == lastEdgeZ)) { continue; } index = newEdgeX + (xDim * newEdgeY) + (sliceLength * newEdgeZ); lastEdgeX = newEdgeX; lastEdgeY = newEdgeY; lastEdgeZ = newEdgeZ; if (IDArray[index] != (i + 1)) { break; } } // while (true) centerToGeoToEdge = (float) Math.sqrt(((lastEdgeX - xCenter[i]) * (lastEdgeX - xCenter[i]) * xRes * xRes) + ((lastEdgeY - yCenter[i]) * (lastEdgeY - yCenter[i]) * yRes * yRes) + ((lastEdgeZ - zCenter[i]) * (lastEdgeZ - zCenter[i]) * zRes * zRes)); UI.setDataText("\t" + nf.format(centerToGeoToEdge)); geoToCenter = 100.0f * geoToCenter / centerToGeoToEdge; UI.setDataText("\t" + nf.format(geoToCenter)); geoToEdge = (float) Math.sqrt(((lastEdgeX - xPosGeo[j]) * (lastEdgeX - xPosGeo[j]) * xRes * xRes) + ((lastEdgeY - yPosGeo[j]) * (lastEdgeY - yPosGeo[j]) * yRes * yRes) + ((lastEdgeZ - zPosGeo[j]) * (lastEdgeZ - zPosGeo[j]) * zRes * zRes)); UI.setDataText("\t" + nf.format(geoToEdge)); gravToCenter = (float) Math.sqrt(((xPosGrav[j] - xCenter[i]) * (xPosGrav[j] - xCenter[i]) * xRes * xRes) + ((yPosGrav[j] - yCenter[i]) * (yPosGrav[j] - yCenter[i]) * yRes * yRes) + ((zPosGrav[j] - zCenter[i]) * (zPosGrav[j] - zCenter[i]) * zRes * zRes)); initialdx = xPosGrav[j] - xCenter[i]; initialdy = yPosGrav[j] - yCenter[i]; initialdz = zPosGrav[j] - zCenter[i]; lastEdgeX = (int) Math.round(xPosGrav[j]); lastEdgeY = (int) Math.round(yPosGrav[j]); lastEdgeZ = (int) Math.round(zPosGrav[j]); if ((Math.abs(initialdx) >= Math.abs(initialdy)) && (Math.abs(initialdx) >= Math.abs(initialdz))) { if (initialdx >= 0.0f) { incx = 0.1f; } else { incx = -0.1f; } incy = 0.1f * initialdy / Math.abs(initialdx); incz = 0.1f * initialdz / Math.abs(initialdx); } else if ((Math.abs(initialdy) >= Math.abs(initialdx)) && (Math.abs(initialdy) >= Math.abs(initialdz))) { if (initialdy >= 0.0f) { incy = 0.1f; } else { incy = -0.1f; } incx = 0.1f * initialdx / Math.abs(initialdy); incz = 0.1f * initialdz / Math.abs(initialdy); } else { if (initialdz >= 0.0f) { incz = 0.1f; } else { incz = -0.1f; } incx = 0.1f * initialdx / Math.abs(initialdz); incy = 0.1f * initialdy / Math.abs(initialdz); } numInc = 1; while (true) { newEdgeX = (int) Math.round(xPosGrav[j] + (numInc * incx)); if ((newEdgeX < 0) || (newEdgeX >= xDim)) { break; } newEdgeY = (int) Math.round(yPosGrav[j] + (numInc * incy)); if ((newEdgeY < 0) || (newEdgeY >= yDim)) { break; } newEdgeZ = (int) Math.round(zPosGrav[j] + (numInc * incz)); if ((newEdgeZ < 0) || (newEdgeZ >= zDim)) { break; } numInc++; if ((newEdgeX == lastEdgeX) && (newEdgeY == lastEdgeY) && (newEdgeZ == lastEdgeZ)) { continue; } index = newEdgeX + (xDim * newEdgeY) + (sliceLength * newEdgeZ); lastEdgeX = newEdgeX; lastEdgeY = newEdgeY; lastEdgeZ = newEdgeZ; if (IDArray[index] != (i + 1)) { break; } } // while (true) centerToGravToEdge = (float) Math.sqrt(((lastEdgeX - xCenter[i]) * (lastEdgeX - xCenter[i]) * xRes * xRes) + ((lastEdgeY - yCenter[i]) * (lastEdgeY - yCenter[i]) * yRes * yRes) + ((lastEdgeZ - zCenter[i]) * (lastEdgeZ - zCenter[i]) * zRes * zRes)); UI.setDataText("\t" + nf.format(centerToGravToEdge)); gravToCenter = 100.0f * gravToCenter / centerToGravToEdge; UI.setDataText("\t" + nf.format(gravToCenter)); gravToEdge = (float) Math.sqrt(((lastEdgeX - xPosGrav[j]) * (lastEdgeX - xPosGrav[j]) * xRes * xRes) + ((lastEdgeY - yPosGrav[j]) * (lastEdgeY - yPosGrav[j]) * yRes * yRes) + ((lastEdgeZ - zPosGrav[j]) * (lastEdgeZ - zPosGrav[j]) * zRes * zRes)); UI.setDataText("\t" + nf.format(gravToEdge)); /*lowestSqr = Float.MAX_VALUE; * for (k1 = 0, z = 0; z < zDim; z++, k1 += sliceLength) { for (j1 = k1, y = 0; y < yDim; y++, j1 += * xDim) { for (x = 0; x < xDim; x++) { index = x + j1; if (boundaryArray[index] * == objectID[j]) { distSqr = (xPosGeo[j] - x) * (xPosGeo[j] - x) * xRes * xRes + * (yPosGeo[j] - y) * (yPosGeo[j] - y) * yRes * yRes + (zPosGeo[j] - z) * (zPosGeo[j] - z) * * zRes * zRes; if (distSqr < lowestSqr) { lowestSqr = distSqr; xEdge = x; * yEdge = y; zEdge = z; } } } } } geoToEdge = * (float) Math.sqrt(lowestSqr); UI.setDataText("\t\t" + nf.format(geoToEdge)); geoToEdge *= 100.0f * / centerToFarEdge[i]; UI.setDataText("\t" + nf.format(geoToEdge)); * * lowestSqr = Float.MAX_VALUE; for (k1 = 0, z = 0; z < zDim; z++, k1 += sliceLength) { for (j1 = k1, * y = 0; y < yDim; y++, j1 += xDim) { for (x = 0; x < xDim; x++) { index = x + j1; if * (boundaryArray[index] == objectID[j]) { distSqr = (xPosGrav[j] - x) * (xPosGrav[j] - * x) * xRes * xRes + (yPosGrav[j] - y) * (yPosGrav[j] - * y) * yRes * yRes + (zPosGrav[j] - z) * (zPosGrav[j] - * z) * zRes * zRes; if (distSqr < lowestSqr) { lowestSqr = * distSqr; xEdge = x; yEdge = y; zEdge = z; } } } } * } gravToEdge = (float) Math.sqrt(lowestSqr); UI.setDataText("\t\t" + nf.format(gravToEdge)); * gravToEdge *= 100.0f / * centerToFarEdge[i];UI.setDataText("\t" + nf.format(gravToEdge));*/ } // if (objectID[j] == (i+1)) } // for (j = 0; j <= nVOIs - 1; j++) UI.setDataText("\n"); } // for (i = 0; i < numObjects; i++) /*VOIs = srcImage.getVOIs(); * System.out.println("Image = " + srcImage); System.out.println("VOIs = " + VOIs); for (i = 0; i < nVOIs; i++) * { System.out.println("id = " + VOIs.VOIAt(i).getID()); System.out.println(VOIs.VOIAt(i).getName()); * System.out.println(VOIs.VOIAt(i).getColor());}*/ if (threadStopped) { finalize(); return; } setCompleted(true); } }
[ "blei1@ba61647d-9d00-f842-95cd-605cb4296b96" ]
blei1@ba61647d-9d00-f842-95cd-605cb4296b96
76b1c521fced76ad814557048848eb31e57df213
88eb708ca9611b9fbf0c9b6ce769843120ca7578
/Aws BIG DATA map-reduce/ass2_dsp_dror/collocationExtractionMain/src/main/java/Main.java
1d31f9b6931c37c0535b3e858cb51d0e97f2c611
[]
no_license
drorkliger/repo
784ebee631e00e4ced2d268e7fd36c2a15cb26ce
44863bff743d8f6b1d45a0f349e544103f914936
refs/heads/master
2022-11-18T16:53:23.699186
2020-07-07T14:07:12
2020-07-07T14:07:12
221,174,988
0
0
null
2022-11-16T09:25:36
2019-11-12T09:07:17
Java
UTF-8
Java
false
false
7,009
java
import com.amazonaws.services.ec2.model.InstanceType; import com.amazonaws.services.elasticmapreduce.AmazonElasticMapReduce; import com.amazonaws.services.elasticmapreduce.AmazonElasticMapReduceClientBuilder; import com.amazonaws.services.elasticmapreduce.model.*; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.nio.file.FileSystems; public class Main { private static AmazonElasticMapReduce mrClient; private static String bucketURL = "s3n://dror-ass2/"; private static String logsPath = bucketURL + "logs/"; private static String firstStepJarName = bucketURL+ "jars/" +"collocationExtraction.jar"; //TODO add this jar to s3 to s3 URL private static String secondStepJarName = bucketURL+ "jars/" +"step2CalculateLog.jar"; //TODO add this jar to s3 to s3 URL private static String thirdStepJarName = bucketURL+ "jars/" +"step3SortForTop100.jar"; //TODO add this jar to s3 to s3 URL private static String firstStepInput = "s3://datasets.elasticmapreduce/ngrams/books/20090715/eng-us-all/1gram/data"; private static String firstStepInput2gram = "s3://datasets.elasticmapreduce/ngrams/books/20090715/eng-us-all/2gram/data"; /*private static String firstStepInput = bucketURL + "inputFiles/" + "googlebooks-eng-all-1gram-20120701-z" ; // TODO change to the relevant corpus private static String firstStepInput2gram = bucketURL + "inputFiles/" + "googlebooks-eng-all-2gram-20120701-zy" ; // TODO change to the relevant corpus*/ // private static String firstStepInput = bucketURL + "inputFiles/" + "justfile2.txt" ; // TODO change to the relevant corpus // private static String firstStepInput2gram = bucketURL + "inputFiles/" + "justfile2gram.txt" ; // TODO change to the relevant corpus private static String firstStepOutput = bucketURL + "target/1" + System.currentTimeMillis() +"/"; // TODO change to s3 URL private static String secondStepOutput = bucketURL + "target/2" + System.currentTimeMillis() +"/"; // TODO change to s3 URL private static String thirdStepOutput = bucketURL + "target/3" + System.currentTimeMillis() +"/"; // TODO change to s3 URL private static String [] eng_stop_words_array; private static String [] heb_stop_words_array; public static void main(String[] args) { //___________create new AMAZON MAP REDUCE client__________ mrClient= AmazonElasticMapReduceClientBuilder .standard() .withRegion("us-east-1") .build(); //__________initiating stop words arrays______________ String stop_words; if (args[0].compareTo("eng") == 0) { eng_stop_words_array = new String[319]; stop_words = stopWordsInit(eng_stop_words_array, "eng_stop_words"); }else if(args[0].compareTo("heb") == 0) { heb_stop_words_array = new String [150]; stop_words = stopWordsInit(heb_stop_words_array,"heb_stop_words"); firstStepInput = "s3://datasets.elasticmapreduce/ngrams/books/20090715/heb-all/1gram/data"; firstStepInput2gram = "s3://datasets.elasticmapreduce/ngrams/books/20090715/heb-all/2gram/data"; } else { System.out.println("Wrong input, please enter \"heb\" or \"eng\" as an argument"); return; } //___________configuring the first step_______________ StepConfig step1Conf= new StepConfig() .withName("CountEngWordsByDecade") .withActionOnFailure(ActionOnFailure.TERMINATE_JOB_FLOW) .withHadoopJarStep(new HadoopJarStepConfig() .withJar(firstStepJarName) .withMainClass("CountEngWordsByDecade") .withArgs(firstStepInput,firstStepInput2gram,firstStepOutput,stop_words)); //___________configuring the second step_______________ StepConfig step2Conf= new StepConfig() .withName("step2CalculateLog") .withActionOnFailure(ActionOnFailure.TERMINATE_JOB_FLOW) .withHadoopJarStep(new HadoopJarStepConfig() .withJar(secondStepJarName) .withMainClass("CalculateLog") .withArgs(firstStepOutput,secondStepOutput)); //___________configuring the third step_______________ StepConfig step3Conf= new StepConfig() .withName("step3SortForTop100") .withActionOnFailure(ActionOnFailure.TERMINATE_JOB_FLOW) .withHadoopJarStep(new HadoopJarStepConfig() .withJar(thirdStepJarName) .withMainClass("SortForTop100") .withArgs(secondStepOutput,thirdStepOutput)); //_____________configuring the instances which the JOB will run on____________ JobFlowInstancesConfig instancesConfig = new JobFlowInstancesConfig() .withInstanceCount(10) .withMasterInstanceType(InstanceType.M4Large.toString()) .withSlaveInstanceType(InstanceType.M4Large.toString()) .withHadoopVersion("3.2.1").withEc2KeyName("ass2-collocationExtraction") .withKeepJobFlowAliveWhenNoSteps(false) .withPlacement(new PlacementType("us-east-1a")); //__________run the JOB _______________ RunJobFlowRequest runJobFlowRequest = new RunJobFlowRequest() .withName("ass2_dsp") .withInstances(instancesConfig) .withSteps(step1Conf, step2Conf, step3Conf) .withReleaseLabel("emr-5.11.0") .withLogUri(logsPath) .withServiceRole("EMR_DefaultRole") .withJobFlowRole("EMR_EC2_DefaultRole"); RunJobFlowResult runJobFlowResult = mrClient.runJobFlow(runJobFlowRequest); String jobFlowId = runJobFlowResult.getJobFlowId(); System.out.println("Ran job flow with id: " + jobFlowId); } private static String stopWordsInit(String [] arr, String filName){ String filePath = FileSystems.getDefault().getPath(filName).toAbsolutePath().toString().replace("\\","\\\\")+".txt"; File f=new File(filePath); BufferedReader reader = null; String word=""; try { reader = new BufferedReader(new FileReader(f)); word = null; word = reader.readLine(); } catch (IOException e) { e.printStackTrace(); } //___________as long as the line is not null, we haven't finished______________ int i = 0; while (word != null) { arr[i] = word; try { word = reader.readLine(); }catch(Exception e){ e.printStackTrace(); } i++; } String total=""; for(String s: arr) total+=s+"\t"; return total; } }
[ "drorkliger@gmail.com" ]
drorkliger@gmail.com
dfbde579b5f0f98534be86a1da70b5199be5c83d
a33aac97878b2cb15677be26e308cbc46e2862d2
/data/libgdx/GestureDetector_getVelocityY.java
9a98f84cdfe795d35e298b9f4838e9a225cbcb82
[]
no_license
GabeOchieng/ggnn.tensorflow
f5d7d0bca52258336fc12c9de6ae38223f28f786
7c62c0e8427bea6c8bec2cebf157b6f1ea70a213
refs/heads/master
2022-05-30T11:17:42.278048
2020-05-02T11:33:31
2020-05-02T11:33:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
232
java
public float getVelocityY() { float meanY = getAverage(this.meanY, numSamples); float meanTime = getAverage(this.meanTime, numSamples) / 1000000000.0f; if (meanTime == 0) return 0; return meanY / meanTime; }
[ "bdqnghi@gmail.com" ]
bdqnghi@gmail.com
401deca3ce65dfad1458e435f34ceae0a5ff0852
791d7f12422e653136574c58c097bae4c2975512
/errai-cordova/src/main/java/org/jboss/errai/aerogear/api/pipeline/impl/PipeAdapter.java
8576f54ea1cb73a40a9efa65f0f1e84c23479030
[]
no_license
srrehman/errai
7c5af9df93942eeb46799ab2710cd5c7fda7cb6f
c755091b15234daa7ef6931e9f35083e564afb3f
refs/heads/master
2021-01-17T22:38:24.664686
2013-07-22T18:18:53
2013-07-22T18:18:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,587
java
package org.jboss.errai.aerogear.api.pipeline.impl; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.JsArray; import com.google.gwt.http.client.RequestException; import com.google.gwt.json.client.JSONObject; import com.google.gwt.json.client.JSONString; import com.google.gwt.user.client.rpc.AsyncCallback; import org.jboss.errai.aerogear.api.impl.AbstractAdapter; import org.jboss.errai.aerogear.api.pipeline.PagedList; import org.jboss.errai.aerogear.api.pipeline.Pipe; import org.jboss.errai.aerogear.api.pipeline.PipeType; import org.jboss.errai.aerogear.api.pipeline.ReadFilter; import org.jboss.errai.marshalling.client.Marshalling; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.jboss.errai.enterprise.client.jaxrs.MarshallingWrapper; /** * @author edewit@redhat.com */ @SuppressWarnings("ALL") public class PipeAdapter<T> extends AbstractAdapter<T> implements Pipe<T> { public PipeAdapter(Class<T> type, JavaScriptObject pipe) { super(type); this.object = pipe; } @Override public PipeType getType() { return PipeType.REST; } @Override public void read(AsyncCallback<List<T>> callback) { read0(callback); } private native void read0(AsyncCallback<List<T>> callback) /*-{ var that = this; this.@org.jboss.errai.aerogear.api.impl.AbstractAdapter::object.read( { success: function (data, textStatus, jqXHR) { that.@org.jboss.errai.aerogear.api.pipeline.impl.PipeAdapter::callback(Lcom/google/gwt/core/client/JsArray;Lcom/google/gwt/user/client/rpc/AsyncCallback;)(data, callback); }, error: function (jqXHR, textStatus, errorThrown) { that.@org.jboss.errai.aerogear.api.pipeline.impl.PipeAdapter::callback(Ljava/lang/String;Lcom/google/gwt/user/client/rpc/AsyncCallback;)(errorThrown, callback); } }); }-*/; @Override public void save(T item, AsyncCallback<T> callback) { String json; if (!(item instanceof Map)) { json = MarshallingWrapper.toJSON(item); } else { Map map = new HashMap(); map.putAll((Map) item); json = Marshalling.toJSON(map); } save0(json, callback); } private native void save0(String item, AsyncCallback<T> callback) /*-{ var that = this; this.@org.jboss.errai.aerogear.api.impl.AbstractAdapter::object.save(eval('[' + item + '][0]'), { success: function (data, textStatus, jqXHR) { that.@org.jboss.errai.aerogear.api.pipeline.impl.PipeAdapter::callback(Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/user/client/rpc/AsyncCallback;)(data, callback); }, error: function (jqXHR, textStatus, errorThrown) { that.@org.jboss.errai.aerogear.api.pipeline.impl.PipeAdapter::callback(Ljava/lang/String;Lcom/google/gwt/user/client/rpc/AsyncCallback;)(errorThrown, callback); } }); }-*/; @Override public void remove(String id, AsyncCallback<Void> callback) { remove0(id, callback); } private native void remove0(String id, AsyncCallback<Void> callback) /*-{ var that = this; this.@org.jboss.errai.aerogear.api.impl.AbstractAdapter::object.remove(id, { success: function (data, textStatus, jqXHR) { callback.@com.google.gwt.user.client.rpc.AsyncCallback::onSuccess(Ljava/lang/Object;)(null); }, error: function (jqXHR, textStatus, errorThrown) { that.@org.jboss.errai.aerogear.api.pipeline.impl.PipeAdapter::callback(Ljava/lang/String;Lcom/google/gwt/user/client/rpc/AsyncCallback;)(errorThrown, callback); } }) }-*/; @Override public void readWithFilter(ReadFilter filter, AsyncCallback<List<T>> callback) { JSONObject where = new JSONObject(); for (Map.Entry<String, String> entry : filter.getWhere().entrySet()) { where.put(entry.getKey(), new JSONString(entry.getValue())); } readWithFilter(filter.getLimit(), filter.getOffset(), where, callback); } private native void readWithFilter(Integer limit, Integer offset, JSONObject where, AsyncCallback<List<T>> callback) /*-{ var that = this; this.@org.jboss.errai.aerogear.api.impl.AbstractAdapter::object.read({ offsetValue: offset, limitValue: limit, success: function (data, textStatus, jqXHR) { that.@org.jboss.errai.aerogear.api.pipeline.impl.PipeAdapter::callbackFilter(Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/user/client/rpc/AsyncCallback;)(data, callback); }, error: function (jqXHR, textStatus, errorThrown) { that.@org.jboss.errai.aerogear.api.pipeline.impl.PipeAdapter::callback(Ljava/lang/String;Lcom/google/gwt/user/client/rpc/AsyncCallback;)(errorThrown, callback); } }) }-*/; private void callback(JavaScriptObject object, AsyncCallback<T> callback) { callback.onSuccess(convertToType(object)); } private void callback(JsArray array, AsyncCallback<List<T>> callback) { callback.onSuccess(convertToType(array)); } private void callbackFilter(JavaScriptObject array, AsyncCallback<PagedList<T>> callback) { callback.onSuccess(new PagedListAdapter(array, convertToType((JsArray) array))); } private void callback(String errorText, AsyncCallback<T> callback) { callback.onFailure(new RequestException(errorText)); } public static class PagedListAdapter<T> extends ArrayList<T> implements PagedList<T> { private final JavaScriptObject pagedResultSet; public PagedListAdapter(JavaScriptObject pagedResultSet, List<T> list) { super(list); this.pagedResultSet = pagedResultSet; } @Override public void next(AsyncCallback<List<T>> callback) { next0(callback); } private native void next0(AsyncCallback<List<T>> callback) /*-{ var that = this; this.@org.jboss.errai.aerogear.api.pipeline.impl.PipeAdapter.PagedListAdapter::pagedResultSet.next({ success: function (morePagedResults) { that.@org.jboss.errai.aerogear.api.pipeline.impl.PipeAdapter::callbackFilter(Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/user/client/rpc/AsyncCallback;)(morePagedResults, callback); }, error: function (jqXHR, textStatus, errorThrown) { that.@org.jboss.errai.aerogear.api.pipeline.impl.PipeAdapter::callback(Ljava/lang/String;Lcom/google/gwt/user/client/rpc/AsyncCallback;)(textStatus, callback); } }); }-*/; @Override public void previous(AsyncCallback<List<T>> callback) { previous0(callback); } private native void previous0(AsyncCallback<List<T>> callback) /*-{ var that = this; this.@org.jboss.errai.aerogear.api.pipeline.impl.PipeAdapter.PagedListAdapter::pagedResultSet.previous({ success: function (morePagedResults) { that.@org.jboss.errai.aerogear.api.pipeline.impl.PipeAdapter::callbackFilter(Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/user/client/rpc/AsyncCallback;)(morePagedResults, callback); }, error: function (jqXHR, textStatus, errorThrown) { that.@org.jboss.errai.aerogear.api.pipeline.impl.PipeAdapter::callback(Ljava/lang/String;Lcom/google/gwt/user/client/rpc/AsyncCallback;)(textStatus, callback); } }); }-*/; } }
[ "erikjan.dewit@gmail.com" ]
erikjan.dewit@gmail.com
07da4dd746d12780ce97625f841006f5e162b13f
f1b73bea643cb8a6d453eddaddeb65f2bd8c0d27
/android/app/src/main/java/com/example/herfa_test/MainActivity.java
1553826833e0dde34f7a1b3117c3e5b7b993440d
[]
no_license
fahadmahfoth/flutter
30f3167cd7e39a583cfcdb813c4a024913e38302
7b047dc0bd346e969dc92e59e78ebf686c69d4cb
refs/heads/master
2020-04-13T05:55:22.713169
2019-12-04T10:56:17
2019-12-04T10:56:17
163,006,744
0
0
null
null
null
null
UTF-8
Java
false
false
367
java
package com.example.herfa_test; import android.os.Bundle; import io.flutter.app.FlutterActivity; import io.flutter.plugins.GeneratedPluginRegistrant; public class MainActivity extends FlutterActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GeneratedPluginRegistrant.registerWith(this); } }
[ "u@localhost.localdomain" ]
u@localhost.localdomain
e3e2b510a888295115c52ed753c064f1901fe16b
bee2378d90fd460fb25da644125f3b5a46b6d70c
/app/src/main/java/com/example/darshan/isd/models/Events.java
3de71b904654e379382fc3ff7a60d4d27d723b87
[]
no_license
watsaponk/capstone-class-enrollment
4693a8ba2236dac68bf73ba1c1e5bf3bd79e65ad
88632f27f056d7b2e80f84ded6e7d7c01c030242
refs/heads/master
2021-09-21T02:22:32.096892
2018-08-19T22:19:39
2018-08-19T22:19:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
373
java
package com.example.darshan.isd.models; public class Events { private String event_name; private String date; public Events(String event_name, String date) { this.event_name = event_name; this.date = date; } public String getEvent_name() { return event_name; } public String getDate() { return date; } }
[ "deeptibelsare@Deeptis-MacBook-Air.local" ]
deeptibelsare@Deeptis-MacBook-Air.local
9d68ae78f0cf6802f9a38037b0715209fe1cf415
b97fedd8822d0a67f7867f3de8b55ef5f6bfe3f5
/jasperexamplev1/src/main/java/com/felixso/web/rest/AuditResource.java
d772b2be7b9e7b9286c492e8a76b3e49ce39271a
[ "Apache-2.0" ]
permissive
felixso-infotech/JasperExampleProjects
3d590bb314186bd02e486b2e48e6feba47b55030
c802cb048322b5aa17ba8806f8134e45bd7e087d
refs/heads/master
2022-12-20T21:01:34.919857
2019-08-23T07:47:12
2019-08-23T07:47:12
191,351,706
0
0
Apache-2.0
2022-04-28T20:46:09
2019-06-11T10:48:24
Java
UTF-8
Java
false
false
2,949
java
package com.felixso.web.rest; import com.felixso.service.AuditEventService; import com.felixso.web.rest.util.PaginationUtil; import io.github.jhipster.web.util.ResponseUtil; import org.springframework.boot.actuate.audit.AuditEvent; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.time.LocalDate; import java.time.ZoneId; import java.util.List; /** * REST controller for getting the audit events. */ @RestController @RequestMapping("/management/audits") public class AuditResource { private final AuditEventService auditEventService; public AuditResource(AuditEventService auditEventService) { this.auditEventService = auditEventService; } /** * GET /audits : get a page of AuditEvents. * * @param pageable the pagination information * @return the ResponseEntity with status 200 (OK) and the list of AuditEvents in body */ @GetMapping public ResponseEntity<List<AuditEvent>> getAll(Pageable pageable) { Page<AuditEvent> page = auditEventService.findAll(pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/management/audits"); return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); } /** * GET /audits : get a page of AuditEvents between the fromDate and toDate. * * @param fromDate the start of the time period of AuditEvents to get * @param toDate the end of the time period of AuditEvents to get * @param pageable the pagination information * @return the ResponseEntity with status 200 (OK) and the list of AuditEvents in body */ @GetMapping(params = {"fromDate", "toDate"}) public ResponseEntity<List<AuditEvent>> getByDates( @RequestParam(value = "fromDate") LocalDate fromDate, @RequestParam(value = "toDate") LocalDate toDate, Pageable pageable) { Page<AuditEvent> page = auditEventService.findByDates( fromDate.atStartOfDay(ZoneId.systemDefault()).toInstant(), toDate.atStartOfDay(ZoneId.systemDefault()).plusDays(1).toInstant(), pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/management/audits"); return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); } /** * GET /audits/:id : get an AuditEvent by id. * * @param id the id of the entity to get * @return the ResponseEntity with status 200 (OK) and the AuditEvent in body, or status 404 (Not Found) */ @GetMapping("/{id:.+}") public ResponseEntity<AuditEvent> get(@PathVariable Long id) { return ResponseUtil.wrapOrNotFound(auditEventService.find(id)); } }
[ "sarangibalu.a@lxisoft.com" ]
sarangibalu.a@lxisoft.com
67a2a033e7b3ed0a0a93a1d1724ae7b534bbd922
f361b65dbce7cff23a665a6427001202b26d6249
/driftBottle/src/cn/graydove/core/service/impl/DriftBottleServiceImpl.java
e4be637f51a2d574eddcf9e0f668121e026164bb
[]
no_license
GaryDove/DirftBottle
6587746a1aafef62f7cc34433b82e2240549b7cd
f81125991cc97a3a3c1cb5630a1528c4624280ec
refs/heads/master
2020-04-15T11:06:56.891979
2019-01-08T10:13:33
2019-01-08T10:13:33
164,614,616
0
0
null
null
null
null
UTF-8
Java
false
false
3,114
java
package cn.graydove.core.service.impl; import java.util.List; import cn.graydove.core.bean.Bottle; import cn.graydove.core.bean.User; import cn.graydove.core.dao.BottleDao; import cn.graydove.core.dao.UserDao; import cn.graydove.core.dao.impl.BottleDaoImpl; import cn.graydove.core.dao.impl.UserDaoImpl; import cn.graydove.core.service.DriftBottleService; import cn.graydove.utils.StringUtil; public class DriftBottleServiceImpl implements DriftBottleService{ BottleDao bottleDao; UserDao userDao; public DriftBottleServiceImpl() { userDao = new UserDaoImpl(); bottleDao = new BottleDaoImpl(); } @Override public User login(User user) { return userDao.selByUnameAndPwd(user); } @Override public int register(User user) { return userDao.insUser(user); } @Override public int updPwd(User user) { User oldUser = userDao.selByUid(user); int count = 0; if(oldUser != null) { oldUser.setPwd(user.getPwd()); count = userDao.updUser(oldUser); } System.out.println(oldUser); return count; } @Override public int throwBottle(Bottle bottle) { User user = new User(); user.setUid(bottle.getUid()); user = userDao.selByUid(user); int count = 0; if(user!=null && user.getThrowTimes()>0) { System.out.println(bottle); Bottle b = bottleDao.selById(bottle); System.out.println(b); bottle.setState(0); if(b==null) { count = bottleDao.insBottle(bottle); user.setThrowTimes(user.getThrowTimes()-1); userDao.updUser(user); } else { b.setState(0); b.setMessage(bottle.getMessage()); count = bottleDao.updById(b); } } return count; } @Override public int breakBottle(Bottle bottle) { return bottleDao.delById(bottle); } @Override public Bottle pickUp(User user) { if(user!=null) { User u = userDao.selByUid(user); if(u!=null && u.getPickUpTimes()>0) { List<Bottle> list = bottleDao.selByState(0); int len = list.size(); Bottle ret = null; if(len>0) { ret = list.get((int)(Math.random()*len)); ret.setState(u.getUid()); bottleDao.updById(ret); u.setPickUpTimes(u.getPickUpTimes()-1); userDao.updUser(u); } return ret; } } return null; } @Override public List<Bottle> showCollections(User user) { List<Bottle> list = bottleDao.selByState(user.getUid()); return list; } @Override public int updPickUpAndThrowTime() { return userDao.updPickUpAndThrowTime(); } @Override public int updUser(User user) { User oldUser = userDao.selByUid(user); int count = 0; if(oldUser != null) { if(!StringUtil.empty(user.getUname())) { oldUser.setUname(user.getUname()); } if(user.getBirth()!=null) { oldUser.setBirth(user.getBirth()); } oldUser.setSex(user.getSex()); count = userDao.updUser(oldUser); } System.out.println(oldUser); return count; } @Override public List<Bottle> showMyThrow(User user) { return bottleDao.selByUid(user.getUid()); } }
[ "noreply@github.com" ]
noreply@github.com
0830ae134cdef2113965fccf43a34be35e9091e1
39afceab8dfad54170428a07c84f7326ab4234b2
/src/io/swagger/client/ApiCallback.java
276feadecd74d0066419845d10348835706d82ca
[ "MIT" ]
permissive
assert-security/auto-mapper
593f9b8340157d63ddbac8f7c0b9279404a697c7
debc74da4e43b36b2a7024f70d8a39b37ccac141
refs/heads/master
2023-03-15T01:23:06.968366
2023-03-05T21:10:40
2023-03-05T21:10:40
216,267,816
3
1
null
null
null
null
UTF-8
Java
false
false
1,914
java
/* * LocalServer * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: v1 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package io.swagger.client; import java.io.IOException; import java.util.Map; import java.util.List; /** * Callback for asynchronous API call. * * @param <T> The return type */ public interface ApiCallback<T> { /** * This is called when the API call fails. * * @param e The exception causing the failure * @param statusCode Status code of the response if available, otherwise it would be 0 * @param responseHeaders Headers of the response if available, otherwise it would be null */ void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders); /** * This is called when the API call succeeded. * * @param result The result deserialized from response * @param statusCode Status code of the response * @param responseHeaders Headers of the response */ void onSuccess(T result, int statusCode, Map<String, List<String>> responseHeaders); /** * This is called when the API upload processing. * * @param bytesWritten bytes Written * @param contentLength content length of request body * @param done write end */ void onUploadProgress(long bytesWritten, long contentLength, boolean done); /** * This is called when the API downlond processing. * * @param bytesRead bytes Read * @param contentLength content lenngth of the response * @param done Read end */ void onDownloadProgress(long bytesRead, long contentLength, boolean done); }
[ "noreply@github.com" ]
noreply@github.com
fe04c1de54540ed592d1065fbd252fe3f428f357
2779ac8ba2b1688e7575a87f8348f99164204565
/data-weave-plugin/src/main/java/org/mule/tooling/lang/dw/breadcrums/WeaveBreadcrumbsInfoProvider.java
06579e96f7b10f64dc546a67afeddcf3a5ba6ab2
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
xiaogegexiao/data-weave-intellij-plugin
8f1ea96a911a950b79dda4bbc60502a8af76bb60
62cabe214509417c17dca7953486623effc52046
refs/heads/master
2020-04-28T10:56:14.668086
2019-03-07T17:12:09
2019-03-07T17:12:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,203
java
/* * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mule.tooling.lang.dw.breadcrums; import com.intellij.lang.Language; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; import com.intellij.xml.breadcrumbs.BreadcrumbsInfoProvider; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.mule.tooling.lang.dw.WeaveLanguage; import org.mule.tooling.lang.dw.parser.psi.WeaveArrayExpression; import org.mule.tooling.lang.dw.parser.psi.WeaveConditionalAttribute; import org.mule.tooling.lang.dw.parser.psi.WeaveConditionalKeyValuePair; import org.mule.tooling.lang.dw.parser.psi.WeaveDocument; import org.mule.tooling.lang.dw.parser.psi.WeaveExpression; import org.mule.tooling.lang.dw.parser.psi.WeaveIdentifier; import org.mule.tooling.lang.dw.parser.psi.WeaveKey; import org.mule.tooling.lang.dw.parser.psi.WeaveLiteralExpression; import org.mule.tooling.lang.dw.parser.psi.WeaveNamedElement; import org.mule.tooling.lang.dw.parser.psi.WeavePsiUtils; import org.mule.tooling.lang.dw.parser.psi.WeaveQualifiedName; import org.mule.tooling.lang.dw.parser.psi.WeaveSimpleAttribute; import org.mule.tooling.lang.dw.parser.psi.WeaveSimpleKeyValuePair; import org.mule.weave.v2.parser.ast.variables.NameIdentifier; import scala.Option; import java.util.List; public class WeaveBreadcrumbsInfoProvider extends BreadcrumbsInfoProvider { private final static Language[] LANGUAGES = new Language[]{WeaveLanguage.getInstance()}; private final static int SCALAR_MAX_LENGTH = 20; @Override public Language[] getLanguages() { return LANGUAGES; } @Override public boolean acceptElement(@NotNull PsiElement e) { return e instanceof WeaveLiteralExpression || WeavePsiUtils.isArrayItem(e) || e instanceof WeaveNamedElement || e instanceof WeaveDocument || e instanceof WeaveSimpleKeyValuePair || e instanceof WeaveSimpleAttribute; } @NotNull @Override public String getElementInfo(@NotNull PsiElement e) { String result; if (e instanceof WeaveNamedElement) { result = ((WeaveNamedElement) e).getIdentifier().getName(); } else if (e instanceof WeaveSimpleKeyValuePair) { String prefix = ":"; if (e.getParent() instanceof WeaveConditionalKeyValuePair) { prefix = "?:"; } result = getElementInfo(((WeaveSimpleKeyValuePair) e).getKey()) + prefix; } else if (e instanceof WeaveSimpleAttribute) { String prefix = ":"; if (e.getParent() instanceof WeaveConditionalAttribute) { prefix = "?:"; } result = "@" + getElementInfo(((WeaveSimpleAttribute) e).getQualifiedName()) + prefix; } else if (e instanceof WeaveKey) { WeaveQualifiedName identifier = ((WeaveKey) e).getQualifiedName(); result = getElementInfo(identifier); } else if (e instanceof WeaveQualifiedName) { WeaveIdentifier nameIdentifier = ((WeaveQualifiedName) e).getIdentifier(); if (nameIdentifier != null) { result = nameIdentifier.getName(); } else { result = "DynamicKey"; } } else if (e instanceof WeaveDocument) { String name = ((WeaveDocument) e).getQualifiedName(); if (name == null) { result = "Document"; } else { result = NameIdentifier.apply(name, Option.empty()).localName().name(); } } else if (e instanceof WeaveLiteralExpression) { return StringUtil.first(e.getText(), SCALAR_MAX_LENGTH, true); } else { final PsiElement parent = e.getParent(); if (parent instanceof WeaveArrayExpression) { final List<WeaveExpression> items = ((WeaveArrayExpression) parent).getExpressionList(); if (e instanceof WeaveExpression) { result = "Item " + getIndexOf(items, e); } else { result = "Item " + getIndexOf(items, e.getPrevSibling()); } } else { result = "Item"; } } return result; } @Nullable @Override public String getElementTooltip(@NotNull PsiElement e) { return null; } @NotNull private static String getIndexOf(@NotNull List<?> list, Object o) { int i = list.indexOf(o); if (i >= 0) { return String.valueOf(1 + i) + '/' + list.size(); } else { return ""; } } }
[ "mariano.achaval@mulesoft.com" ]
mariano.achaval@mulesoft.com
9377f00d895d9955f17e60f383156e48682abc7c
880cfd7c71ab39a58c25d005d8a1bf61299395ba
/Week_03/lowestCommonAncestor.java
b31e01e90891217e4e3db2ac9502f2f85dda437b
[]
no_license
xuneng1314/algorithm021
359253a43df328cc30bc887e3cc1ad2eb0b609dd
8995a0bcc53a863cea50219dcb459ec0da61e8ac
refs/heads/main
2023-03-11T05:43:43.655093
2021-02-22T15:19:04
2021-02-22T15:19:04
317,217,638
0
0
null
2020-11-30T12:31:47
2020-11-30T12:31:46
null
UTF-8
Java
false
false
1,064
java
package LeetCode; public class Test236 { /** * 二叉树的最近公共祖先 * 判断二叉树公共祖先条件 * 1、如果root是null,直接返回null * 2、如果root等于p或者等于q。直接返回p或者q * 3、因为是递归,我们获取左节点和右节点递归结果,如果返回的结果左节点为空,说明p和q都没有再左节点下面, * 那就返回右节点,同理右节点为空就返回左节点, * 4、当左右节点都不为空,说明p和q一个在root左边,一个在root右边,就直接返回root即可 */ public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { if(root == null) return null; if(root == p || root == q) return root; TreeNode left = lowestCommonAncestor(root.left,p,q); TreeNode right = lowestCommonAncestor(root.right,p,q); if(left !=null && right !=null) return root; if(left != null) return left; if(right != null) return right; return null; } }
[ "627541354@qq.com" ]
627541354@qq.com
d0d729ecf359442a74b6ca85e9099b5f2a4cb5ea
b32033653c896194a7ec09cf5132971815f14db5
/chapter15/src/JFileChooserDemo.java
f5355070097ef78371d8328d95fe934e1eaca991
[]
no_license
JoseBeto/labs
05db3f907226fd734176a6e7ca128d77001a5911
db06b93e4650573fe18ff6393168ba64176c3c5b
refs/heads/master
2020-04-10T00:52:28.845158
2016-11-26T03:09:09
2016-11-26T03:09:09
68,070,667
0
0
null
null
null
null
UTF-8
Java
false
false
3,503
java
import java.io.IOException; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTextArea; /** * Fig. 15.12: JFileChooserDemo.java. Demonstrating JFileChooser. * * @author Deitel & Associates, Inc. */ public class JFileChooserDemo extends JFrame { private final JTextArea outputArea; // displays file contents /** * set up GUI * * @throws IOException */ public JFileChooserDemo() throws IOException { super("JFileChooser Demo"); outputArea = new JTextArea(); add(new JScrollPane(outputArea)); // outputArea is scrollable analyzePath(); // get Path from user and display info } /** * display information about file or directory user specifies * * @throws IOException */ public void analyzePath() throws IOException { // get Path to user-selected file or directory Path path = getFileOrDirectoryPath(); if (path != null && Files.exists(path)) // if exists, display info { // gather file (or directory) information StringBuilder builder = new StringBuilder(); builder.append(String.format("%s:%n", path.getFileName())); builder.append(String.format("%s a directory%n", Files.isDirectory(path) ? "Is" : "Is not")); builder.append(String.format("%s an absolute path%n", path.isAbsolute() ? "Is" : "Is not")); builder.append(String.format("Last modified: %s%n", Files.getLastModifiedTime(path))); builder.append(String.format("Size: %s%n", Files.size(path))); builder.append(String.format("Path: %s%n", path)); builder.append(String.format("Absolute path: %s%n", path.toAbsolutePath())); if (Files.isDirectory(path)) // output directory listing { builder.append(String.format("%nDirectory contents:%n")); // object for iterating through a directory's contents DirectoryStream<Path> directoryStream = Files.newDirectoryStream( path); for (Path p : directoryStream) builder.append(String.format("%s%n", p)); } outputArea.setText(builder.toString()); // display String content } else // Path does not exist { JOptionPane.showMessageDialog(this, path.getFileName() + " does not exist.", "ERROR", JOptionPane.ERROR_MESSAGE); } } // end method analyzePath /** * allow user to specify file or directory name * * @return */ private Path getFileOrDirectoryPath() { // configure dialog allowing selection of a file or directory JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); int result = fileChooser.showOpenDialog(this); // if user clicked Cancel button on dialog, return if (result == JFileChooser.CANCEL_OPTION) System.exit(1); // return Path representing the selected file return fileChooser.getSelectedFile().toPath(); } } // end class JFileChooserDemo
[ "qrw617@T0000B063.cs.utsarr.net" ]
qrw617@T0000B063.cs.utsarr.net
d0012b72386dcdaf4c663f711e781b689d4f2a85
15b036f111d5ef7ffebad2530dce43b8ec904451
/Java/BelajarRetrofit2/app/src/main/java/id/dwichan/pmo2_dwicandrapermana_pert4/data/Contact.java
87a125395f9ba3e3589cd43976aa26aa545172dd
[]
no_license
dwichan0905/BelajarRetrofit2
3bc7d3c42bbfbd2d8d223bfce1ba8e678357ef87
52d8dbe0930395b03b6bf56a8361459ccffc7e5e
refs/heads/master
2023-01-06T10:33:13.628062
2020-11-02T07:43:38
2020-11-02T07:43:38
309,128,063
0
0
null
null
null
null
UTF-8
Java
false
false
1,480
java
package id.dwichan.pmo2_dwicandrapermana_pert4.data; import android.os.Parcel; import android.os.Parcelable; import com.google.gson.annotations.SerializedName; public class Contact implements Parcelable { @SerializedName("id") private String id; @SerializedName("nama") private String nama; @SerializedName("nomor") private String nomor; public Contact(Parcel in) { id = in.readString(); nama = in.readString(); nomor = in.readString(); } public static final Creator<Contact> CREATOR = new Creator<Contact>() { @Override public Contact createFromParcel(Parcel in) { return new Contact(in); } @Override public Contact[] newArray(int size) { return new Contact[size]; } }; public Contact() { } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getNama() { return nama; } public void setNama(String nama) { this.nama = nama; } public String getNomor() { return nomor; } public void setNomor(String nomor) { this.nomor = nomor; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(id); dest.writeString(nama); dest.writeString(nomor); } }
[ "52048022+dwichan0905@users.noreply.github.com" ]
52048022+dwichan0905@users.noreply.github.com
8dfee2295bd7e2889630347b54e8d6d1daa72793
81d49c3d19fd3ee5ef20d47f0fedc02537566d98
/2020/BatPwn/Divided/divided_source_from_JADX/sources/androidx/lifecycle/livedata/core/C0029R.java
aed091438c382f03894e71b0782c17566844f9a7
[]
no_license
wr47h/CTF-Writeups
8f4ba241c7c9786741ace6bed98b0656c509aa71
e95325f43959a52237c04b62f0241bb4d6027fb4
refs/heads/master
2022-10-28T05:49:13.212970
2022-10-08T06:56:13
2022-10-08T06:56:13
107,017,690
6
7
null
2022-10-08T06:56:14
2017-10-15T14:06:41
Java
UTF-8
Java
false
false
157
java
package androidx.lifecycle.livedata.core; /* renamed from: androidx.lifecycle.livedata.core.R */ public final class C0029R { private C0029R() { } }
[ "shreyansh.pettswood@yahoo.com" ]
shreyansh.pettswood@yahoo.com
b1ee07eec527a47cb0612bbc589a4925dd9fe929
b80559ce24df153b04f9f500d6ce0619dbd0e516
/Version/src/test/java/com/quinbay/cucumber/Steps/VersionSteps.java
938d0c8ed4e6fbb227b1e2901abfda8287e80c66
[]
no_license
selvaprince25/Assignment
8e6834f804a174eeed5b14ed7bccd4e14156d2f5
729df1d116673657b5355b57cff2aa60f3b06fac
refs/heads/main
2023-02-24T02:35:33.239711
2021-01-27T07:06:20
2021-01-27T07:06:20
333,333,330
0
0
null
null
null
null
UTF-8
Java
false
false
1,198
java
package com.quinbay.cucumber.Steps; import Page.VersionPage; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import java.io.IOException; import java.util.concurrent.TimeUnit; public class VersionSteps { public static WebDriver driver; public VersionPage versionPage; @Given("User on Microtracker Page") public void user_on_microtrcker_page() { System.setProperty("webdriver.chrome.driver", "src/test/drivers/chromedriver"); driver = new ChromeDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS); driver.get("http://cloud-control-app.infra-sg.cld/microTracker"); versionPage = new VersionPage(driver); } @When("User gives the environment name {string}") public void user_gives_the_environment_name(String string) throws IOException { versionPage.getAppName(string); } @Then("The user will land on result page") public void the_user_will_land_on_result_page() { driver.close(); } }
[ "noreply@github.com" ]
noreply@github.com
29d3efb8b73d12548031f93f84fd021626a36eb0
b396b8d3444b36b031e21c171cba6670d116bdea
/org.emftext.language.sql.resource.sql/src/org/emftext/language/sql/resource/sql/analysis/SqlAPPROXIMATE_NUMERIC_LITERALTokenResolver.java
e815285b8ac1b41d31e662bc3e00a73111107baa
[]
no_license
AresEkb/sql
8064aa06d788370f481f8e6d6ba9e44e5bd19fa8
730dd92b25954307ca0a4251216b98b12910c035
refs/heads/master
2021-01-13T00:53:42.921204
2015-12-10T12:59:18
2015-12-10T12:59:18
45,470,328
1
0
null
null
null
null
UTF-8
Java
false
false
1,192
java
/** * <copyright> * </copyright> * * */ package org.emftext.language.sql.resource.sql.analysis; import java.util.Map; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; public class SqlAPPROXIMATE_NUMERIC_LITERALTokenResolver implements org.emftext.language.sql.resource.sql.ISqlTokenResolver { private org.emftext.language.sql.resource.sql.analysis.SqlDefaultTokenResolver defaultTokenResolver = new org.emftext.language.sql.resource.sql.analysis.SqlDefaultTokenResolver(true); public String deResolve(Object value, EStructuralFeature feature, EObject container) { // By default token de-resolving is delegated to the DefaultTokenResolver. String result = defaultTokenResolver.deResolve(value, feature, container, null, null, null); return result; } public void resolve(String lexem, EStructuralFeature feature, org.emftext.language.sql.resource.sql.ISqlTokenResolveResult result) { // By default token resolving is delegated to the DefaultTokenResolver. defaultTokenResolver.resolve(lexem, feature, result, null, null, null); } public void setOptions(Map<?,?> options) { defaultTokenResolver.setOptions(options); } }
[ "denis.nikif@gmail.com" ]
denis.nikif@gmail.com
c9601d606127b99f49843a873cd079e24e07e81b
5eb2c1147f9071bcd56b6717caf0770dba8c1281
/src/main/java/com/humin/ssm/po/UserExample.java
e25522ea8db5a1eb93064e598e8127a397ba6a2f
[]
no_license
AnswerHM/springmvc_mybatis_hm
30f99a039d82ba878fb5c13d9fba3e4536df2a6b
fbbbdd2c76626f3cd78ca19859ecb3c333003e9d
refs/heads/master
2021-04-06T01:37:42.567978
2018-04-04T11:10:47
2018-04-04T11:10:47
124,988,837
0
0
null
null
null
null
UTF-8
Java
false
false
193
java
/** * Mar 12, 2018 */ package com.humin.ssm.po; /** * @ClassName: UserExample * @Description: * @author humin * @date Mar 12, 2018 1:48:13 PM * */ public class UserExample { }
[ "hmlmy0609@163.com" ]
hmlmy0609@163.com
24cba61acaae1bb39008a08c85544c8be3d4ae68
44313005cf33801dedd321987ee00dc222fd8e78
/src/main/java/newsfeeds/models/NewsFeedMetaData.java
c5ef837d36466a74824c4eea83375e1ae16b72ad
[]
no_license
samarthbsb/backend
fc14325e1be846110b15e424c96ddd8378076a8e
12b75bb87f6997a356619ad8b886df9047a84cbc
refs/heads/master
2021-01-25T04:50:15.056388
2014-12-26T09:33:33
2014-12-26T09:33:33
28,660,131
0
0
null
null
null
null
UTF-8
Java
false
false
1,344
java
package newsfeeds.models; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Field; /** * Created by samarth on 29/10/14. */ public class NewsFeedMetaData { @Id @Field(value = "news_id") private String id; private String name; private String feedUrl; private String thumbnailUrl; private String description; public boolean isPublished; public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getFeedUrl() { return feedUrl; } public void setFeedUrl(String feedUrl) { this.feedUrl = feedUrl; } public String getThumbnailUrl() { return thumbnailUrl; } public void setThumbnailUrl(String thumbnailUrl) { this.thumbnailUrl = thumbnailUrl; } public boolean getIsPublished() { return isPublished; } public void setIsPublished(boolean isPublished) { this.isPublished = isPublished; } }
[ "samarth@bsb.in" ]
samarth@bsb.in
97df1ce841bc229d97ee418f66308f18d33315f4
140fb6f4c2b50bd70521e293c3c833436f7caecb
/src/main/java/com/example/springbatchdemo/restart/RestartReader.java
551532e559e2d03438150d2ecf6fcf36c53753a2
[]
no_license
FYZ9628/springbatch-demo
d5afd3e0f1b136b4f657c9ceef146c412cd18245
80606737306a5b726fe2243e8e2f5119302d8661
refs/heads/master
2023-08-21T22:47:39.034107
2021-10-06T04:51:05
2021-10-06T04:51:05
414,071,054
1
0
null
null
null
null
UTF-8
Java
false
false
5,224
java
package com.example.springbatchdemo.restart; import com.example.springbatchdemo.itemreaderfile.Customer; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ItemStreamException; import org.springframework.batch.item.ItemStreamReader; import org.springframework.batch.item.NonTransientResourceException; import org.springframework.batch.item.ParseException; import org.springframework.batch.item.UnexpectedInputException; import org.springframework.batch.item.file.FlatFileItemReader; import org.springframework.batch.item.file.mapping.DefaultLineMapper; import org.springframework.batch.item.file.mapping.FieldSetMapper; import org.springframework.batch.item.file.transform.DelimitedLineTokenizer; import org.springframework.batch.item.file.transform.FieldSet; import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Component; import org.springframework.validation.BindException; /** * @Author Administrator * @Date 2021/10/5 0:02 */ @Component("restartReader") public class RestartReader implements ItemStreamReader<Customer> { private FlatFileItemReader<Customer> customerFlatFileItemReader = new FlatFileItemReader<>(); private Long curLine = 0L; private boolean restart = false; private ExecutionContext executionContext; public RestartReader() { customerFlatFileItemReader.setResource(new ClassPathResource("restart.txt")); // customerFlatFileItemReader.setLinesToSkip(1);//跳过第一行 //解析数据 DelimitedLineTokenizer tokenizer = new DelimitedLineTokenizer(); tokenizer.setNames(new String[]{"id","firstName","lastName","birthday"}); //把解析出的一行数据映射为Customer对象 DefaultLineMapper<Customer> mapper = new DefaultLineMapper<>(); mapper.setLineTokenizer(tokenizer); mapper.setFieldSetMapper(new FieldSetMapper<Customer>() { @Override public Customer mapFieldSet(FieldSet fieldSet) throws BindException { Customer customer = new Customer(); customer.setId(fieldSet.readLong("id")); customer.setFirstName(fieldSet.readString("firstName")); customer.setLastName(fieldSet.readString("lastName")); customer.setBirthday(fieldSet.readString("birthday")); return customer; } }); mapper.afterPropertiesSet(); customerFlatFileItemReader.setLineMapper(mapper); } /** * (1)open:step开始之前 * (2)update:一次chunk之后(成功后才执行) * (3)close:step执行结束后 * * @return * @throws Exception * @throws UnexpectedInputException * @throws ParseException * @throws NonTransientResourceException */ @Override public Customer read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { Customer customer = null; this.curLine++; //跳过已经读取的数据,按照chunk的大小来 if (restart) { customerFlatFileItemReader.setLinesToSkip(this.curLine.intValue() - 1); restart = false; System.out.println("Start reading from line: " + this.curLine); } customerFlatFileItemReader.open(this.executionContext); customer = customerFlatFileItemReader.read(); //手动制造异常 if (customer != null && customer.getFirstName().equals("Melodie")) { throw new RuntimeException("Something wrong. Customer id: " + customer.getId()); } return customer; } /** * (1)open:step开始之前 * (2)update:一次chunk之后(成功后才执行) * (3)close:step执行结束后 * * @param executionContext * @throws ItemStreamException */ @Override public void open(ExecutionContext executionContext) throws ItemStreamException { this.executionContext = executionContext; //再次读取时 if (executionContext.containsKey("curLine")) { this.curLine = executionContext.getLong("curLine"); this.restart = true; } else { //第一次读取时 this.curLine = 0L; executionContext.put("curLine", this.curLine); System.out.println("Start reading from line: " + this.curLine + 1); } } /** * (1)open:step开始之前 * (2)update:一次chunk之后(成功后才执行) * (3)close:step执行结束后 * * @param executionContext * @throws ItemStreamException */ @Override public void update(ExecutionContext executionContext) throws ItemStreamException { executionContext.put("curLine", this.curLine); System.out.println("currentLine: " + this.curLine); } /** * (1)open:step开始之前 * (2)update:一次chunk之后(成功后才执行) * (3)close:step执行结束后 * * @throws ItemStreamException */ @Override public void close() throws ItemStreamException { } }
[ "973022024@qq.com" ]
973022024@qq.com