text
stringlengths
10
2.72M
package UI.Recieves.PreView; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Cursor; import java.awt.Font; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.text.SimpleDateFormat; import java.util.Date; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import DataInfo.EmailMessage; import DataInfo.EnumType; import Util.Email.PathManager; public class PreViewReceivedUI extends JPanel implements MouseListener { /** * JButton */ // 收邮件按钮 private JButton receivedBtn; /** * JPanel */ // 邮件内容正文可直接放入这里显示 private JLabel toJLabel; private JLabel fromJLabel; private JLabel subjectJLabel; private JLabel sendDateJLabel; /** * Variables */ boolean isRead; int msgNumIdx; private String to; private String from; private String subject; private Date sendDate; private CallBack callBack; private EmailMessage message; private static final int rows = 4; private static final int cols = 1; /** * * @param isRead * @param to * @param from * @param subject * @param sendDate */ public PreViewReceivedUI(boolean isRead, int msgNumIdx, String to, String from, String subject, Date sendDate, CallBack callBack) { this.isRead = isRead; this.msgNumIdx = msgNumIdx; this.to = to; this.from = from; this.subject = subject; this.sendDate = sendDate; this.callBack = callBack; setLayout(new BorderLayout()); initNorm(); initCompsListener(); setVisible(true); } public PreViewReceivedUI(EmailMessage message, CallBack callBack) { this.message = message; this.isRead = message.getReceivedHasSeen(); this.msgNumIdx = message.getReceivedIdx(); this.to = message.getToStr(); this.from = message.getFromStr(); this.subject = message.getSubject(); this.sendDate = message.getSendDate(); this.callBack = callBack; setLayout(new BorderLayout()); initNorm(); initCompsListener(); setVisible(true); } private void initNorm() { // rows, cols GridLayout grid = new GridLayout(rows, cols); JPanel jp = new JPanel(); jp.setLayout(grid); // to toJLabel = new JLabel(" 收邮件人: " + to); toJLabel.setBackground(Color.WHITE); jp.add(toJLabel); // from fromJLabel = new JLabel(" 发邮件人: " + from); jp.add(fromJLabel); // subject subjectJLabel = new JLabel(" 主题: " +subject); jp.add(subjectJLabel); // sendDate SimpleDateFormat formerDateFormat = new SimpleDateFormat( "yyyy-MM-dd HH-mm-ss"); sendDateJLabel = new JLabel(" 接收时间: " + formerDateFormat.format(sendDate)); jp.add(sendDateJLabel); // add(jp, BorderLayout.WEST); // 继续查看邮件按钮 receivedBtn = new JButton(EnumType.MoreReadEmailBtnTitle + "(" + msgNumIdx + ")", new ImageIcon( PathManager.getIconsResourcePath() + EnumType.SeeEmailIcon)); add(receivedBtn, BorderLayout.EAST); } public void initCompsListener() { receivedBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PreViewReceivedUI.this.callBack.call(message); } }); toJLabel.addMouseListener(this); fromJLabel.addMouseListener(this); subjectJLabel.addMouseListener(this); sendDateJLabel.addMouseListener(this); } /** * {@link MouseListener} */ @Override public void mouseClicked(MouseEvent e) { PreViewReceivedUI.this.callBack.call(message); } @Override public void mouseEntered(MouseEvent e) { // JLabel tempJLabel = (JLabel)e.getSource(); tempJLabel.setForeground(Color.RED); // tempJLabel.setBackground(Color.yellow); tempJLabel.setFont(tempJLabel.getFont().deriveFont(Font.BOLD)); tempJLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } @Override public void mouseExited(MouseEvent e) { // JLabel tempJLabel = (JLabel)e.getSource(); tempJLabel.setForeground(Color.BLACK); tempJLabel.setFont(tempJLabel.getFont().deriveFont(Font.PLAIN)); tempJLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } /** * CallBack */ public interface CallBack{ public void call(EmailMessage msg); } }
package vo.WebPromotionVO; import util.WebPromotionType; import java.util.ArrayList; /** * Created by Qin Liu on 2016/12/8. */ /** * levelList 0等级及其对应信用值、折扣列表 * @author Qin Liu */ public class WebLevelPromotionVO extends WebPromotionVO { public WebPromotionType webPromotionType = WebPromotionType.Level; ArrayList<LevelVO> levelList; public WebLevelPromotionVO(ArrayList<LevelVO> levelList) { this.levelList = levelList; } public ArrayList<LevelVO> getLevelList() { return levelList; } }
package com.shihang.myframe.manager; import android.util.SparseArray; public class FmManager { public interface FMVisibleStatus{ void visible(boolean isVisible); } public static int mVisibleWeb = -1; private static int visibleHasCode; private static SparseArray<FMVisibleStatus> fmStatus = new SparseArray<FMVisibleStatus>(); public static void addFmStatus(int hasCode,FMVisibleStatus visibleListener){ fmStatus.put(hasCode,visibleListener); } public static void removeFmStatus(int hasCode){ fmStatus.remove(hasCode); } public static int getVisibleHasCode(){ return visibleHasCode; } public static void fmVisible(int hasCode){ if(hasCode == visibleHasCode){ return; } FMVisibleStatus listener = fmStatus.get(visibleHasCode); if(listener != null){ listener.visible(false); } visibleHasCode = hasCode; listener = fmStatus.get(visibleHasCode); if(listener != null){ listener.visible(true); } } public static void fmVisible(int hasCode, int visibleWeb){ mVisibleWeb = visibleWeb; FMVisibleStatus listener = fmStatus.get(visibleHasCode); if(listener != null){ listener.visible(false); } visibleHasCode = hasCode; listener = fmStatus.get(visibleHasCode); if(listener != null){ listener.visible(true); } } }
package ar.gob.ambiente.servicios.especiesforestales.rest; import ar.gob.ambiente.servicios.especiesforestales.annotation.Secured; import ar.gob.ambiente.servicios.especiesforestales.entidades.Familia; import ar.gob.ambiente.servicios.especiesforestales.entidades.Genero; import ar.gob.ambiente.servicios.especiesforestales.facades.FamiliaFacade; import ar.gob.ambiente.servicios.especiesforestales.facades.GeneroFacade; import java.util.List; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; /** * Servicio que implementa los métodos expuestos por la API REST para la entidad Familia * Solo forestales para consulta y consumo de SACVeFor * @author rincostante */ @Stateless @Path("svf_familias") public class FamiliaFacadeSvfREST { @EJB private FamiliaFacade familiaFacade; @EJB private GeneroFacade generoFacade; /** * @api {get} /svf_familias/:id Ver una Familia * @apiExample {curl} Ejemplo de uso: * curl -X GET -d /especiesVegetales/rest/svf_familias/2 -H "authorization: xXyYvWzZ" * @apiVersion 1.0.0 * @apiName GetFamilia * @apiGroup Familias * @apiHeader {String} Authorization Token recibido al autenticar el usuario * @apiHeaderExample {json} Ejemplo de header: * { * "Authorization": "xXyYvWzZ" * } * @apiParam {Long} id Identificador único de la Familia * @apiDescription Método para obtener una Familia existente según el id remitido. * Obtiene la familia mediante el método local find(id) * @apiSuccess {ar.gob.ambiente.sacvefor.servicios.especies.Familia} Familia Detalle de la familia registrada. * @apiSuccessExample Respuesta exitosa: * HTTP/1.1 200 OK * { * { * "id": "2", * "nombre": "Andreaeaceae", * "subFamilia": "", * "esSacvefor": "true" * } * } * @apiError FamiliaNotFound No existe familia registrada con ese id. * @apiErrorExample Respuesta de error: * HTTP/1.1 400 Not Found * { * "error": "No hay familia registrada con el id recibido" * } */ @GET @Path("{id}") @Secured @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Familia find(@PathParam("id") Long id) { return familiaFacade.find(id); } /** * @api {get} /svf_familias Ver todas las Familias * @apiExample {curl} Ejemplo de uso: * curl -X GET -d /especiesVegetales/rest/svf_familias -H "authorization: xXyYvWzZ" * @apiVersion 1.0.0 * @apiName GetFamilias * @apiGroup Familias * @apiHeader {String} Authorization Token recibido al autenticar el usuario * @apiHeaderExample {json} Ejemplo de header: * { * "Authorization": "xXyYvWzZ" * } * @apiDescription Método para obtener un listado de las Familias existentes. * Obtiene las familias mediante el método local findAll() * @apiSuccess {ar.gob.ambiente.sacvefor.servicios.especies.Familia} Familias Listado con todas las Familias registradas. * @apiSuccessExample Respuesta exitosa: * HTTP/1.1 200 OK * { * "familias": [ * {"id": "2", * "nombre": "Andreaeaceae", * "subFamilia": "", * "esSacvefor": "true"}, * {"id": "3", * "nombre": "Andreaeobryaceae", * "subFamilia": "", * "esSacvefor": "true"} * ] * } * @apiError FamiliasNotFound No existen familias registradas. * @apiErrorExample Respuesta de error: * HTTP/1.1 400 Not Found * { * "error": "No hay Familias registradas" * } */ @GET @Secured @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public List<Familia> findAll() { return familiaFacade.getSvfActivas(); } /** * @api {get} /svf_familias/:id/generos Ver los Géneros de una Familia * @apiExample {curl} Ejemplo de uso: * curl -X GET -d /especiesVegetales/rest/svf_familias/2/generos -H "authorization: xXyYvWzZ" * @apiVersion 1.0.0 * @apiName GetGeneros * @apiGroup Familias * @apiHeader {String} Authorization Token recibido al autenticar el usuario * @apiHeaderExample {json} Ejemplo de header: * { * "Authorization": "xXyYvWzZ" * } * @apiParam {Long} id Identificador único de la Familia * @apiDescription Método para obtener los Géneros asociados a una Familia existente según el id remitido. * Obtiene los géneros mediante el método local getSvfGenerosXIdFamilia(id) * @apiSuccess {ar.gob.ambiente.sacvefor.servicios.especies.Genero} Genero Listado de los Géneros registrados vinculados a la Familia cuyo id se recibió. * @apiSuccessExample Respuesta exitosa: * HTTP/1.1 200 OK * { * "generos": [ * {"id": "2", * "nombre": "Andreaea", * "familia": * { * "id": "1", * "nombre": "Andreaeaceae", * "subFamilia": "", * "esSacvefor": "true" * }, * "esSacvefor": "true"} * ] * } * @apiError GenerosNotFound No existen géneros registrados vinculados a la id de la familia. * * @apiErrorExample Respuesta de error: * HTTP/1.1 400 Not Found * { * "error": "No hay géneros registrados vinculados al id de la familia recibido." * } */ @GET @Path("{id}/generos") @Secured @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public List<Genero> findByFamilia(@PathParam("id") Long id) { return generoFacade.getSvfGenerosXIdFamilia(id); } @GET @Path("{from}/{to}") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public List<Familia> findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) { return familiaFacade.findRange(new int[]{from, to}); } @GET @Path("count") @Produces(MediaType.TEXT_PLAIN) public String countREST() { return String.valueOf(familiaFacade.count()); } }
package com.ti.bean; public class UserBean { private String user_id,user_pwd,user_name,user_sex,user_email,user_rank; public String getUser_id() { return user_id; } public void setUser_id(String user_id) { this.user_id = user_id; } public String getUser_pwd() { return user_pwd; } public void setUser_pwd(String user_pwd) { this.user_pwd = user_pwd; } public String getUser_name() { return user_name; } public void setUser_name(String user_name) { this.user_name = user_name; } public String getUser_email() { return user_email; } public void setUser_email(String user_email) { this.user_email = user_email; } public String getUser_rank() { return user_rank; } public void setUser_rank(String user_rank) { this.user_rank = user_rank; } public String getUser_sex() { return user_sex; } public void setUser_sex(String user_sex) { this.user_sex = user_sex; } }
package com.containers.controller; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; import javax.servlet.http.HttpServletRequest; import org.springframework.core.io.InputStreamSource; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.io.InputStream; @Controller @RequestMapping("/sendMail") public class SendEmailController { private JavaMailSender mailSender; public SendEmailController(JavaMailSender mailSender) { this.mailSender = mailSender; } @RequestMapping(method = RequestMethod.POST) public String doSendEmail(HttpServletRequest request, MultipartFile attachFile) { String emailTo = request.getParameter("emailTo"); String subject = request.getParameter("subject"); String message = request.getParameter("message"); System.out.println("To: " + emailTo); System.out.println("Subject: " + subject); System.out.println("Message: " + message); System.out.println("Attach: " + attachFile.getOriginalFilename()); String attachName = attachFile.getOriginalFilename(); MimeMessage mimeMessage = mailSender.createMimeMessage(); try { MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true, "UTF-8"); helper.setTo(emailTo); helper.setSubject(subject); helper.setText(message); if ((attachName != null) && (!attachName.equals(""))) { helper.addAttachment(attachName, new InputStreamSource() { @Override public InputStream getInputStream() throws IOException { return attachFile.getInputStream(); } }); } } catch (MessagingException e) { e.printStackTrace(); } mailSender.send(mimeMessage); return "ResultSendMail"; } }
package com.quickdoodle.trainer.datahandler; import java.util.ArrayList; import java.util.Collections; import java.util.stream.IntStream; public class Dataset { private ArrayList<Doodle> train; private ArrayList<Doodle> test; private int[] trainQuantities; private int[] testQuantites; private float ratio; private String[] labelNames; private int capacity; private int classSize; public Dataset(String[] classes, int capacity, float ratio) { this.capacity = capacity; this.ratio = ratio; this.classSize = classes.length; train = new ArrayList<>(); test = new ArrayList<>(); trainQuantities = new int[classes.length]; testQuantites = new int[classes.length]; labelNames = new String[classes.length]; for(int i = 0; i < classes.length; i++) { Batch batch = new Batch(classes[i], capacity, classes.length); trainQuantities[i] = (int) (batch.getSize() * ratio); testQuantites[i] = batch.getSize() - trainQuantities[i]; train.addAll(batch.getDoodles().subList(0, trainQuantities[i])); test.addAll(batch.getDoodles().subList(trainQuantities[i], batch.getSize())); labelNames[i] = batch.getLabelName(); } Collections.shuffle(train); } public ArrayList<Doodle> getTrainDatas() { return train; } public ArrayList<Doodle> getTestDatas() { return test; } public String evaluate() { StringBuilder eval = new StringBuilder(); int trainSizeSum = IntStream.of(trainQuantities).sum(); int testSizeSum = IntStream.of(testQuantites).sum(); eval.append("Dataset Created\n"); eval.append("Total Capacity: " +capacity * labelNames.length +"\n"); eval.append("Dataset Ratio : " +ratio +"\n"); eval.append("Train Dataset : " +trainSizeSum +"\n"); eval.append("Test Dataset : " +testSizeSum +"\n"); eval.append("Total Dataset : " +(trainSizeSum + testSizeSum)+"\n"); eval.append("===================================\n"); eval.append("Doodle Name Train Test \n"); eval.append("===================================\n"); float trainSize = (float) Math.floor(capacity * ratio); float testSize = capacity - trainSize; for(int i = 0; i < labelNames.length; i++) { eval.append(String.format("%-13s %3.2f%% %3.2f%% \n", labelNames[i], (trainQuantities[i] / trainSize) * 100, (testQuantites[i] / testSize) * 100)); } return eval.toString(); } public int getTrainDataSize() { return IntStream.of(trainQuantities).sum(); } public int getTestDataSize() { return IntStream.of(testQuantites).sum(); } public int getTestQuantity(int index) { return this.testQuantites[index]; } public String getLabelName(int index) { return labelNames[index]; } public int getClassSize() { return classSize; } }
package net.nowtryz.mcutils.api.listener; import org.bukkit.event.Listener; import org.bukkit.plugin.PluginManager; public interface EventListener extends Listener { /** * Registers this listener to the Bukkit's {@link PluginManager} */ void register(); /** * Unregisters this listener to the Bukkit's {@link PluginManager} */ void unregister(); /** * Check if the listener has been registered to the Bukkit's {@link PluginManager} * @return true if it is the case */ boolean isRegistered(); }
package com.qa.stepDefinition; import com.qa.base.TestBase; import com.qa.pages.CartPage; import cucumber.api.java.After; import cucumber.api.java.en.And; import cucumber.api.java.en.Then; public class CartSteps extends TestBase { CartPage cart; public CartSteps() { super(); } @Then("^User removes the added headphones from cart page$") public void removeHeadphones() { cart = new CartPage(); cart.removeHeadphone(); } @And("^user reduces the quantity of \"(.*)\" to \"(.*)\"$") public void reduceCount(String product, String quantity) { cart = new CartPage(); cart.reduceQuantity(product, quantity); } @Then("^User proceeds to checkout$") public void proceedForCheckout() { cart = new CartPage(); cart.checkout(); } @After public void tearDown() { driver.quit(); } }
package com.meehoo.biz.core.basic.ro.bos; import lombok.Getter; import lombok.Setter; import java.util.List; /** * Created by wangjian on 2017-12-12. */ @Getter @Setter public class IdListRO { /** * 一组域模型对象id */ private List<String> idList; }
package cn.sau.one.po; import java.util.Date; public class User { private Integer userId; private String userEmail; private String userPassword; private String userNikename; private Date userTime; private Integer userStatus; public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public String getUserEmail() { return userEmail; } public void setUserEmail(String userEmail) { this.userEmail = userEmail == null ? null : userEmail.trim(); } public String getUserPassword() { return userPassword; } public void setUserPassword(String userPassword) { this.userPassword = userPassword == null ? null : userPassword.trim(); } public String getUserNikename() { return userNikename; } public void setUserNikename(String userNikename) { this.userNikename = userNikename == null ? null : userNikename.trim(); } public Date getUserTime() { return userTime; } public void setUserTime(Date userTime) { this.userTime = userTime; } public Integer getUserStatus() { return userStatus; } public void setUserStatus(Integer userStatus) { this.userStatus = userStatus; } }
package com.outerpack.entity.pojo; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; @NoArgsConstructor @AllArgsConstructor @Data public class Manager implements Serializable { // man_id int primary key auto_increment @ApiModelProperty(value = "管理员ID号",example = "1") private Integer manId; // man_name varchar(32) @ApiModelProperty(value = "管理员姓名",example = "My-cong") private String manName; // man_gender int @ApiModelProperty(value = "管理员性别",example = "1") //1表示男,0表示女 private Integer manGender; // man_age int @ApiModelProperty(value = "管理员年龄",example = "28") private Integer manAge; // man_dep int @ApiModelProperty(value = "管理员部门",example = "人力部") private Integer manDep; // man_UID varchar(32) @ApiModelProperty(value = "管理员的UID",example = "adads12346894") private String manUID; // man_mail varchar(32) @ApiModelProperty(value = "管理员的邮箱",example = "1111111@qq.com") private String manMail; // man_address varchar(32) @ApiModelProperty(value = "管理员的住址",example = "广大") private String manAddress; // man_phone varchar(32) @ApiModelProperty(value = "管理员的手机号",example = "11111111110") private String manPhone; // man_position varchar(32) @ApiModelProperty(value = "管理员的岗位",example = "人力部") private String manPosition; // man_username varchar(32) @ApiModelProperty(value = "管理员的用户账号",example = "admin") private String manUsername; // man_password varchar(32) @ApiModelProperty(value = "管理员的密码",example = "123456") private String manPassword; // man_workYear int @ApiModelProperty(value = "管理员的工作经验",example = "10") private Integer manWorkYear; // man_head varchar(100) @ApiModelProperty(value = "管理员的头像") private String manHead; }
package com.zxt.compplatform.workflow.dao.impl; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.synchrobit.synchroflow.api.bean.SynchroFLOWBean; import com.synchrobit.synchroflow.api.bean.WorkitemBean; import com.synchrobit.synchroflow.enactmentservice.exception.DBException; import com.zxt.compplatform.workflow.dao.Daibanfl3WorkFlowDao; public class Daibanfl3WorkFlowDaoImpl implements Daibanfl3WorkFlowDao { public List findAppid(String userId) { SynchroFLOWBean sf = new SynchroFLOWBean(); StringBuffer sb = new StringBuffer(); sb.append("'-1'"); Map mp=new HashMap(); List l=new ArrayList(); try { List works = sf.getWorkitemListByUserId(userId); for (int i = 0; i < works.size(); i++) { WorkitemBean wib = (WorkitemBean) works.get(i); Object[][] obj = wib.getArgs(); for (int i1 = 0; i1 < obj.length; i1++) { for (int i2 = 0; i2 < obj[i1].length-1; i2++) { if (obj[i1][i2].equals("APP_ID")&&obj[i1][i2+1]!=null) { int i3 = i2 + 1; Object obj1=obj[i1][i3]; if(null!=obj[i1][i3] && !"".equals(obj[i1][i3]+"")){ mp.put(obj[i1][i3],new Integer(wib.getWorkitemId())); sb.append(","); sb.append("'"+(String) obj[i1][i3]+"'"); } } } } } } catch (DBException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } l.add(sb.toString()); l.add(mp); return l; } }
/** * This class is generated by jOOQ */ package schema.tables.records; import java.sql.Timestamp; import javax.annotation.Generated; import org.jooq.Field; import org.jooq.Record1; import org.jooq.Record8; import org.jooq.Row8; import org.jooq.impl.UpdatableRecordImpl; import schema.tables.BookmarksBookmark; /** * This class is generated by jOOQ. */ @Generated( value = { "http://www.jooq.org", "jOOQ version:3.8.4" }, comments = "This class is generated by jOOQ" ) @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class BookmarksBookmarkRecord extends UpdatableRecordImpl<BookmarksBookmarkRecord> implements Record8<Integer, Timestamp, Timestamp, String, String, String, Integer, Integer> { private static final long serialVersionUID = 1492664677; /** * Setter for <code>bitnami_edx.bookmarks_bookmark.id</code>. */ public void setId(Integer value) { set(0, value); } /** * Getter for <code>bitnami_edx.bookmarks_bookmark.id</code>. */ public Integer getId() { return (Integer) get(0); } /** * Setter for <code>bitnami_edx.bookmarks_bookmark.created</code>. */ public void setCreated(Timestamp value) { set(1, value); } /** * Getter for <code>bitnami_edx.bookmarks_bookmark.created</code>. */ public Timestamp getCreated() { return (Timestamp) get(1); } /** * Setter for <code>bitnami_edx.bookmarks_bookmark.modified</code>. */ public void setModified(Timestamp value) { set(2, value); } /** * Getter for <code>bitnami_edx.bookmarks_bookmark.modified</code>. */ public Timestamp getModified() { return (Timestamp) get(2); } /** * Setter for <code>bitnami_edx.bookmarks_bookmark.course_key</code>. */ public void setCourseKey(String value) { set(3, value); } /** * Getter for <code>bitnami_edx.bookmarks_bookmark.course_key</code>. */ public String getCourseKey() { return (String) get(3); } /** * Setter for <code>bitnami_edx.bookmarks_bookmark.usage_key</code>. */ public void setUsageKey(String value) { set(4, value); } /** * Getter for <code>bitnami_edx.bookmarks_bookmark.usage_key</code>. */ public String getUsageKey() { return (String) get(4); } /** * Setter for <code>bitnami_edx.bookmarks_bookmark.path</code>. */ public void setPath(String value) { set(5, value); } /** * Getter for <code>bitnami_edx.bookmarks_bookmark.path</code>. */ public String getPath() { return (String) get(5); } /** * Setter for <code>bitnami_edx.bookmarks_bookmark.user_id</code>. */ public void setUserId(Integer value) { set(6, value); } /** * Getter for <code>bitnami_edx.bookmarks_bookmark.user_id</code>. */ public Integer getUserId() { return (Integer) get(6); } /** * Setter for <code>bitnami_edx.bookmarks_bookmark.xblock_cache_id</code>. */ public void setXblockCacheId(Integer value) { set(7, value); } /** * Getter for <code>bitnami_edx.bookmarks_bookmark.xblock_cache_id</code>. */ public Integer getXblockCacheId() { return (Integer) get(7); } // ------------------------------------------------------------------------- // Primary key information // ------------------------------------------------------------------------- /** * {@inheritDoc} */ @Override public Record1<Integer> key() { return (Record1) super.key(); } // ------------------------------------------------------------------------- // Record8 type implementation // ------------------------------------------------------------------------- /** * {@inheritDoc} */ @Override public Row8<Integer, Timestamp, Timestamp, String, String, String, Integer, Integer> fieldsRow() { return (Row8) super.fieldsRow(); } /** * {@inheritDoc} */ @Override public Row8<Integer, Timestamp, Timestamp, String, String, String, Integer, Integer> valuesRow() { return (Row8) super.valuesRow(); } /** * {@inheritDoc} */ @Override public Field<Integer> field1() { return BookmarksBookmark.BOOKMARKS_BOOKMARK.ID; } /** * {@inheritDoc} */ @Override public Field<Timestamp> field2() { return BookmarksBookmark.BOOKMARKS_BOOKMARK.CREATED; } /** * {@inheritDoc} */ @Override public Field<Timestamp> field3() { return BookmarksBookmark.BOOKMARKS_BOOKMARK.MODIFIED; } /** * {@inheritDoc} */ @Override public Field<String> field4() { return BookmarksBookmark.BOOKMARKS_BOOKMARK.COURSE_KEY; } /** * {@inheritDoc} */ @Override public Field<String> field5() { return BookmarksBookmark.BOOKMARKS_BOOKMARK.USAGE_KEY; } /** * {@inheritDoc} */ @Override public Field<String> field6() { return BookmarksBookmark.BOOKMARKS_BOOKMARK.PATH; } /** * {@inheritDoc} */ @Override public Field<Integer> field7() { return BookmarksBookmark.BOOKMARKS_BOOKMARK.USER_ID; } /** * {@inheritDoc} */ @Override public Field<Integer> field8() { return BookmarksBookmark.BOOKMARKS_BOOKMARK.XBLOCK_CACHE_ID; } /** * {@inheritDoc} */ @Override public Integer value1() { return getId(); } /** * {@inheritDoc} */ @Override public Timestamp value2() { return getCreated(); } /** * {@inheritDoc} */ @Override public Timestamp value3() { return getModified(); } /** * {@inheritDoc} */ @Override public String value4() { return getCourseKey(); } /** * {@inheritDoc} */ @Override public String value5() { return getUsageKey(); } /** * {@inheritDoc} */ @Override public String value6() { return getPath(); } /** * {@inheritDoc} */ @Override public Integer value7() { return getUserId(); } /** * {@inheritDoc} */ @Override public Integer value8() { return getXblockCacheId(); } /** * {@inheritDoc} */ @Override public BookmarksBookmarkRecord value1(Integer value) { setId(value); return this; } /** * {@inheritDoc} */ @Override public BookmarksBookmarkRecord value2(Timestamp value) { setCreated(value); return this; } /** * {@inheritDoc} */ @Override public BookmarksBookmarkRecord value3(Timestamp value) { setModified(value); return this; } /** * {@inheritDoc} */ @Override public BookmarksBookmarkRecord value4(String value) { setCourseKey(value); return this; } /** * {@inheritDoc} */ @Override public BookmarksBookmarkRecord value5(String value) { setUsageKey(value); return this; } /** * {@inheritDoc} */ @Override public BookmarksBookmarkRecord value6(String value) { setPath(value); return this; } /** * {@inheritDoc} */ @Override public BookmarksBookmarkRecord value7(Integer value) { setUserId(value); return this; } /** * {@inheritDoc} */ @Override public BookmarksBookmarkRecord value8(Integer value) { setXblockCacheId(value); return this; } /** * {@inheritDoc} */ @Override public BookmarksBookmarkRecord values(Integer value1, Timestamp value2, Timestamp value3, String value4, String value5, String value6, Integer value7, Integer value8) { value1(value1); value2(value2); value3(value3); value4(value4); value5(value5); value6(value6); value7(value7); value8(value8); return this; } // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- /** * Create a detached BookmarksBookmarkRecord */ public BookmarksBookmarkRecord() { super(BookmarksBookmark.BOOKMARKS_BOOKMARK); } /** * Create a detached, initialised BookmarksBookmarkRecord */ public BookmarksBookmarkRecord(Integer id, Timestamp created, Timestamp modified, String courseKey, String usageKey, String path, Integer userId, Integer xblockCacheId) { super(BookmarksBookmark.BOOKMARKS_BOOKMARK); set(0, id); set(1, created); set(2, modified); set(3, courseKey); set(4, usageKey); set(5, path); set(6, userId); set(7, xblockCacheId); } }
package matching; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; /** * Created by zachschlesinger on 5/8/17. */ public class intersect { private static Collection out; // TODO: write this algorithm to account for finding overlap between specific sizes public static void main(String[] args) { ArrayList vals = new ArrayList(); int[] arr1 = {1,2,3,4}; int[] arr2 = {1,2,3,4}; int[] arr3 = {1,2,3,4}; int[] arr4 = {1,2,3,4}; int[] arr5 = {1,2,3,4}; vals.add(arr1); vals.add(arr2); vals.add(arr3); vals.add(arr4); vals.add(arr5); int i = vals.size(); out = arrToList((int[]) vals.get(i - 1)); helper(vals, i - 1); System.out.println(out.toString()); } public static void helper(ArrayList vals, int num) { if (num == 1) { out = intersectMethod(arrToList((int[]) vals.get(num)), arrToList((int[]) vals.get(num-1))); } else { while (num >= 2) { out = intersectMethod(arrToList((int[]) vals.get(num - 1)), out); out = intersectMethod(arrToList((int[]) vals.get(num - 2)), out); num--; } } } public static <T> Collection<T> intersectMethod(Collection<? extends T> a, Collection<? extends T> b) { Collection<T> result = new ArrayList<T>(); for (T t : a) { if (b.remove(t)) { result.add(t); } } return result; } public static List arrToList(int[] arr) { List list = new ArrayList<Integer>(); for (int i = 0; i < arr.length; i++) { list.add(arr[i]); } return list; } }
package org.bk.aws.messaging; import java.util.HashMap; import java.util.Map; import java.util.Objects; /** * Represents a message as it flows through the system. * The body itself is immutable but the headers around it can potentially change. * The purpose is to store information like: * * start time that the message has come into the system and carry this * * message headers from sqs/sns * context as the message travels through the system. * * @param <T> represents the type of body */ public class ContentMessage<T> { private final Map<String, Object> headers; private final T body; public static final String CREATED_TIMESTAMP = "CREATED_TIMESTAMP"; public ContentMessage(T body) { this.body = body; this.headers = new HashMap<>(); this.headers.put(CREATED_TIMESTAMP, System.nanoTime()); } public ContentMessage(T body, Map<String, Object> headers) { this(body); this.headers.putAll(headers); } public ContentMessage addHeader(String key, Object value) { this.headers.put(key, value); return this; } public T getBody() { return body; } public <V> V getHeader(String key) { return (V) this.headers.get(key); } public <V> ContentMessage<V> withNewBody(V newBody) { return new ContentMessage<>(newBody, this.headers); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ContentMessage)) { return false; } ContentMessage<?> message = (ContentMessage<?>) o; return Objects.equals(headers, message.headers) && Objects.equals(body, message.body); } @Override public int hashCode() { return Objects.hash(headers, body); } @Override public String toString() { return "ContentMessage{" + "headers=" + headers + ", body=" + body + '}'; } }
package com.bofsoft.laio.customerservice.DataClass.Order; public class ProTimeData { public String ProDate; // 培训日期 public int ProTimes; // 可购买学时数 }
package scenario_villa; import java.io.Serializable; import core.Ambiente; import core.CoreInputControl; import core.Stanza; @SuppressWarnings("serial") class CameraAriannaSud extends Ambiente implements Stanza, Serializable { private String bozzettiRegex = ".*(guarda|esamina|analizza)(\\s)+((i)(\\s+))?(bozzetti|disegni|abiti|vestiti).*"; protected CameraAriannaSud() { this.nomeAmbiente = "Camera di Arianna (Lato Sud)"; this.setCoords(1, 1, 4); } @Override public void decodifica(String comando) { if(comando.matches(bozzettiRegex)) { System.out.println("\nSono dei bozzetti di abiti da sera. Si vede il tocco di una stilista alle prime armi\n"); } else { CoreInputControl.getInstance().mancatoMatch(); } } @Override public void guarda() { System.out.println("\nSei nella camera da letto di Arianna, la figlia di Alfieri. Ci sono tanti bozzetti di abiti anche qui\n"); } @Override public void vaiSud() { System.out.println("\nI bozzetti di abiti sono appesi per tutta la parete\n"); } @Override public void vaiOvest() { System.out.println("\nI bozzetti di abiti sono appesi per tutta la parete\n"); } }
package org.kuali.ole.deliver.form; import org.kuali.ole.deliver.bo.FeeType; import org.kuali.ole.deliver.bo.OlePatronDocument; import org.kuali.ole.deliver.bo.PatronBillPayment; import org.kuali.rice.krad.web.form.DocumentFormBase; import java.math.BigDecimal; import java.util.List; /** * Created with IntelliJ IDEA. * User: ? * Date: 10/17/12 * Time: 9:46 PM * To change this template use File | Settings | File Templates. */ public class PatronBillForm extends DocumentFormBase { private String patronId; private String paymentMethod; private BigDecimal paymentAmount; private String message; private String freeTextNote; private OlePatronDocument olePatronDocument; private String billWisePayment = "default"; private boolean printFlag = true; private List<FeeType> feeTypes; private List<PatronBillPayment> patronBillPaymentList; private boolean printBillReview; private String forgiveNote; private String errorNote; private BigDecimal grandTotal = new BigDecimal("0"); private BigDecimal patronAmount; private String olePatronId; private boolean doubleSubmit; public BigDecimal getGrandTotal() { return grandTotal; } public void setGrandTotal(BigDecimal grandTotal) { this.grandTotal = grandTotal; } public String getBillWisePayment() { return billWisePayment; } public void setBillWisePayment(String billWisePayment) { this.billWisePayment = billWisePayment; } public List<FeeType> getFeeTypes() { return feeTypes; } public void setFeeTypes(List<FeeType> feeTypes) { this.feeTypes = feeTypes; } public String getPatronId() { return patronId; } public void setPatronId(String patronId) { this.patronId = patronId; } public String getPaymentMethod() { return paymentMethod; } public void setPaymentMethod(String paymentMethod) { this.paymentMethod = paymentMethod; } public BigDecimal getPaymentAmount() { return paymentAmount; } public void setPaymentAmount(BigDecimal paymentAmount) { this.paymentAmount = paymentAmount; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getFreeTextNote() { return freeTextNote; } public void setFreeTextNote(String freeTextNote) { this.freeTextNote = freeTextNote; } public OlePatronDocument getOlePatronDocument() { return olePatronDocument; } public void setOlePatronDocument(OlePatronDocument olePatronDocument) { this.olePatronDocument = olePatronDocument; } public List<PatronBillPayment> getPatronBillPaymentList() { return patronBillPaymentList; } public void setPatronBillPaymentList(List<PatronBillPayment> patronBillPaymentList) { this.patronBillPaymentList = patronBillPaymentList; } public boolean isPrintFlag() { return printFlag; } public void setPrintFlag(boolean printFlag) { this.printFlag = printFlag; } public boolean isPrintBillReview() { return printBillReview; } public void setPrintBillReview(boolean printBillReview) { this.printBillReview = printBillReview; } public String getForgiveNote() { return forgiveNote; } public void setForgiveNote(String forgiveNote) { this.forgiveNote = forgiveNote; } public String getErrorNote() { return errorNote; } public void setErrorNote(String errorNote) { this.errorNote = errorNote; } public BigDecimal getPatronAmount() { return patronAmount; } public void setPatronAmount(BigDecimal patronAmount) { this.patronAmount = patronAmount; } public String getOlePatronId() { return olePatronId; } public void setOlePatronId(String olePatronId) { this.olePatronId = olePatronId; } public boolean isDoubleSubmit() { return doubleSubmit; } public void setDoubleSubmit(boolean doubleSubmit) { this.doubleSubmit = doubleSubmit; } }
package com.application.swplanetsapi.web.controller; import com.application.swplanetsapi.domain.facade.PlanetFacade; import com.application.swplanetsapi.web.dto.internal.GenericResponse; import com.application.swplanetsapi.web.dto.internal.PlanetRequest; import com.application.swplanetsapi.web.dto.internal.PlanetResponse; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.web.WebAppConfiguration; import java.util.List; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.*; @RunWith(MockitoJUnitRunner.class) @WebAppConfiguration public class PlanetControllerTest { @InjectMocks private PlanetController controller; @Mock private PlanetFacade facade; private static String TATOOINE_ID = "1dasd151d11da5s"; private static String TATOOINE= "TATOOINE"; private static final Integer TATOOINE_APPEARS = 7; private static final String CLIMATE_TEMPERATE = "temperate"; private static final String TERRAIN_MOUNTAIN = "grasslands, mountains"; private PlanetRequest tatooineReq; @Before public void setup() { MockitoAnnotations.initMocks(this); controller = new PlanetController(facade); tatooineReq = PlanetRequest.builder() .name(TATOOINE) .climate(CLIMATE_TEMPERATE) .terrain(TERRAIN_MOUNTAIN).build(); } @Test public void testActionFindById() { doReturn(mock(PlanetResponse.class)).when(facade).findById(TATOOINE_ID); ResponseEntity response = controller.findById(TATOOINE_ID); verify(facade).findById(TATOOINE_ID); assertEquals(HttpStatus.OK, response.getStatusCode()); } @Test public void testActionFindAll() { doReturn(mock(List.class)).when(facade).findAll(); ResponseEntity response = controller.find(null); verify(facade).findAll(); assertEquals(HttpStatus.OK, response.getStatusCode()); } @Test public void testActionFindByName() { doReturn(mock(PlanetResponse.class)).when(facade).findByName(TATOOINE); ResponseEntity response = controller.find(TATOOINE); verify(facade).findByName(TATOOINE); assertEquals(HttpStatus.OK, response.getStatusCode()); } @Test public void testActionDeleteById() { doReturn(mock(GenericResponse.class)).when(facade).delete(TATOOINE_ID); ResponseEntity response = controller.delete(TATOOINE_ID); verify(facade).delete(TATOOINE_ID); assertEquals(HttpStatus.OK, response.getStatusCode()); } @Test public void testActionUpdate() { doReturn(mock(PlanetResponse.class)).when(facade).update(TATOOINE_ID, tatooineReq); ResponseEntity response = controller.update(TATOOINE_ID, tatooineReq); verify(facade).update(TATOOINE_ID, tatooineReq); assertEquals(HttpStatus.OK, response.getStatusCode()); } @Test public void testActionCreate() { doReturn(mock(PlanetResponse.class)).when(facade).create(tatooineReq); ResponseEntity response = controller.create(tatooineReq); verify(facade).create(tatooineReq); assertEquals(HttpStatus.CREATED, response.getStatusCode()); } }
package com.nfet.icare.controller; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.nfet.icare.pojo.Company; import com.nfet.icare.pojo.SNSUserInfo; import com.nfet.icare.pojo.Ticket; import com.nfet.icare.pojo.User; import com.nfet.icare.pojo.WechatInfo; import com.nfet.icare.pojo.WechatOauth2Token; import com.nfet.icare.pojo.WxUser; import com.nfet.icare.service.CompanyServiceImpl; import com.nfet.icare.service.TicketServiceImpl; import com.nfet.icare.service.UserServiceImpl; import com.nfet.icare.service.WxUserServiceImpl; import com.nfet.icare.service.ZoneServiceImpl; import com.nfet.icare.util.Oauth2Util; /** * 微信用户信息获取(openid,headimg...) * * @author mark * */ @Controller @RequestMapping("/wechat") public class AuthController { private Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired WechatInfo wechatInfo; @Autowired private WxUserServiceImpl wxUserServiceImpl; @Autowired private UserServiceImpl userServiceImpl; @Autowired private CompanyServiceImpl companyServiceImpl; @Autowired private TicketServiceImpl ticketServiceImpl; @Autowired private ZoneServiceImpl zoneServiceImpl; @RequestMapping(value = "oauth/{opt}", method = RequestMethod.GET) public String oauthController(@RequestParam(value = "code", required = true) String code, @RequestParam(value = "state", required = true) String state, Model model, HttpServletRequest request, @PathVariable String opt, RedirectAttributes attr) { WechatOauth2Token weixinOauth2Token = null; String accessToken = null; HttpSession session = request.getSession(); logger.info("opt is " + opt); logger.info("Code=============" + code + "==========state=======" + state); // 用户同意授权 if (!"authdeny".equals(code)) { // 获取网页授权access_token,第一次访问绑定到会话上,如果刷新页面不再使用code if (session.getAttribute("weixinOauth2Token") == null) { logger.info("not session"); weixinOauth2Token = Oauth2Util.getOauth2AccessToken(code, wechatInfo.getAppid(), wechatInfo.getSecret()); session.setAttribute("weixinOauth2Token", weixinOauth2Token); } else { logger.info("session"); weixinOauth2Token = (WechatOauth2Token) session.getAttribute("weixinOauth2Token"); } // 网页授权接口访问凭证 accessToken = weixinOauth2Token.getAccessToken(); // 用户标识 String openId = weixinOauth2Token.getOpenId(); logger.info("openId is:" + openId); if (session.getAttribute("snsUserInfo") == null) { // 获取用户信息 SNSUserInfo snsUserInfo = Oauth2Util.getSNSUserInfo(accessToken, openId); logger.info("snsUserInfo is:" + snsUserInfo); session.setAttribute("snsUserInfo", snsUserInfo); // 设置要传递的参数 model.addAttribute("snsUserInfo", snsUserInfo); model.addAttribute("state", state); } if (!isRegisterUser(openId, session)) { logger.info("not register user,openid is:" + openId); return "registerpage"; } else { if (request.getParameter("deviceType") != null) { attr.addAttribute("type", request.getParameter("deviceType")); return "redirect:/deviceList"; } else if ("wxjs".equals(opt)) { attr.addAttribute("type", "1"); return "redirect:/wxjs/scan"; } else { return opt; } } } else { return "404"; } } /** * 判断用户是否已经注册 * * @param openId * @return */ private boolean isRegisterUser(String openId, HttpSession session) { WxUser wxUser = wxUserServiceImpl.queryWxUser(openId); if (wxUser == null) {// 未找到、没有注册 return false; } else { // 已注册、将用户信息存入session Map<String, Object> ticketMap = new HashMap<>(); Map<String, Object> zoneMap = new HashMap<>(); User user = userServiceImpl.checkUserPhone(wxUser.getPhone()); Company company = companyServiceImpl.queryCompanyInfo(user.getCompanyId()); // 保存区域 if (company.getProvinceId() != 0) { zoneMap.put("province", zoneServiceImpl.queryProvinceName(company.getProvinceId())); } if (company.getCityId() != 0) { zoneMap.put("city", zoneServiceImpl.quertCityName(company.getCityId())); } if (company.getAreaId() != 0) { zoneMap.put("area", zoneServiceImpl.queryAreaName(company.getAreaId())); } session.setAttribute("zone", zoneMap); // 优惠券数量 ticketMap.put("userNo", user.getUserNo()); ticketMap.put("type", 1); List<Ticket> ticketList = ticketServiceImpl.ticketList(ticketMap); int ticketCount = 0; for (Ticket ticket : ticketList) { if (ticket.getStatus() == 0) { ticketCount++; } } session.setAttribute("ticketCount", ticketCount); session.setAttribute("user", user); session.setAttribute("company", company); return true; } } }
package com.eveena.instantfix; import java.nio.charset.Charset; public class ByteFixFiller implements IFiller<ByteFixMessage> { private static final Charset CHARSET = Charset.forName("ISO-8859-1"); public static final byte[] beginString = "8".getBytes(CHARSET); public static final byte[] checkSum = "10".getBytes(CHARSET); public static final byte[] senderCompID = "49".getBytes(CHARSET); public static final byte[] targetCompID = "56".getBytes(CHARSET); public static final byte[] msgType = "35".getBytes(CHARSET); public static final byte[] msgSeqNum = "34".getBytes(CHARSET); public static final byte[] clOrdID = "11".getBytes(CHARSET); public static final byte[] origClOrdID = "41".getBytes(CHARSET); public void fill(ByteFixMessage msg, PairDataReader data) { if (data.headerEquals(senderCompID)) msg.setSenderCompID(data.readByteString()); else if (data.headerEquals(targetCompID)) msg.setTargetCompID(data.readByteString()); else if (data.headerEquals(msgSeqNum)) msg.setMsgSeqNum(data.readByteString()); else if (data.headerEquals(msgType)) msg.setMsgType(data.readByteString()); else if (data.headerEquals(beginString)) msg.setBeginString(data.readByteString()); else if (data.headerEquals(checkSum)) msg.setCheckSum(data.readByteString()); else if (data.headerEquals(clOrdID)) msg.setClOrdID(data.readByteString()); else if (data.headerEquals(origClOrdID)) msg.setOrigClOrdID(data.readByteString()); } public ByteFixMessage newObj() { return new ByteFixMessage(); } }
/** * Created by lichenxi on 2017/11/12. * Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: Assume we are dealing with an environment which could only hold integers within the 32-bit signed integer range. For the purpose of this problem, assume that your function returns 0 when the reversed integer overflows. 输入123 输出321 反转一下 -123输入 输入-321 如果是120 反转后就是21 0要忽略 123求余 得到3 3*10+2=32 32*10+1=321 ok得到 120 题目提到了溢出问题 只能把数保持在一个integer的整数范围内 也就是我们要保证反转之后 数字要保持在integer范围内 我为什么要把int转成long类型 这个问题 不要问我 */ public class ReverseInteger { public int reverse(int x) { long temp=x; long result=0; while (temp!=0){ result=result*10+temp%10; temp=temp/10; } if (result>Integer.MAX_VALUE|| result<Integer.MIN_VALUE){ result=0; } return (int)result; } }
package com.zxt.compplatform.formengine.util; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.xml.DomDriver; import com.zxt.compplatform.workflow.entity.WorkFlowDataStauts; public class WorkFlowDataStautsXmlUtil { private static final Logger log = Logger.getLogger(WorkFlowDataStautsXmlUtil.class); public static String workFlowDataStautsToXml( WorkFlowDataStauts workFlowDataStauts) { XStream stream = new XStream(); try { stream.alias("workFlowDataStauts", WorkFlowDataStauts.class); return stream.toXML(workFlowDataStauts); } catch (Exception e) { return ""; } } public static WorkFlowDataStauts xmlToWorkFlowDataStauts(String xml) { WorkFlowDataStauts workFlowDataStauts = null; XStream stream = new XStream(new DomDriver()); try { stream.alias("workFlowDataStauts", WorkFlowDataStauts.class); workFlowDataStauts = (WorkFlowDataStauts) stream.fromXML(xml); } catch (Exception e) { // TODO Auto-generated catch block //log.error("工作流字段配置出错..."); return null; } return workFlowDataStauts; } public static List transferListWorkFlowStauts(List list) { String mid = "-1"; String status = "-1"; Map map = null; WorkFlowDataStauts workFlowDataStauts = null; for (int i = 0; i < list.size(); i++) { map = (Map) list.get(i); if (map.get("ENV_DATAMETER") != null) { workFlowDataStauts = xmlToWorkFlowDataStauts(map.get( "ENV_DATAMETER").toString()); if (workFlowDataStauts==null) { continue; } ((Map) list.get(i)).put("eng_envmid", workFlowDataStauts.getMid()); ((Map) list.get(i)).put("eng_envstatus", workFlowDataStauts .getToTransferDefStautsValue()); } } return list; } }
package net.maizegenetics.analysis.gbs; import java.util.Arrays; import net.maizegenetics.dna.BaseEncoder; /** * Container class for storing information on GBS barcodes. * * @author Ed Buckler */ public class Barcode implements Comparable<Barcode> { /**Barcode sequence */ String barcodeS; /**Overhang sequence from the restriction enzyme */ String[] overhangS; /**Taxon (sample) name */ String taxaName; /**Flowcell name */ String flowcell; /**Flowcell lane name */ String lane; /**Barcode encoded in 2-bit long*/ long[] barOverLong; /**Length of barcode plus overhang*/ int barOverLength; /**Length of barcode*/ int barLength; /** * Constructor creating a barcode * @param barcodeS barcode sequence * @param overhangSunsort overhang sequence array unsorted (array size is 1 for * non-degerate restriction enzymes, degenerate enzymes >1) * @param taxa name of taxon (sample) * @param flowcell name of the flowcell * @param lane name of the lane */ public Barcode(String barcodeS, String[] overhangSunsort, String taxa, String flowcell, String lane) { this.barcodeS = barcodeS; Arrays.sort(overhangSunsort); this.overhangS = overhangSunsort; this.flowcell = flowcell; this.lane = lane; this.taxaName = taxa; barOverLong = new long[overhangS.length]; for (int i = 0; i < overhangS.length; i++) { barOverLong[i] = BaseEncoder.getLongFromSeq(barcodeS + overhangS[i]); } barOverLength = barcodeS.length() + overhangS[0].length(); barLength = barcodeS.length(); } /** * Return the minimum sequence divergence between a query sequence and * barcode with its overhang * @param queryLong query sequence encoded in 2-bit long * @param maxDivCheck maximum divergence to search upto * @return minimum divergence between barcode and query */ public int compareSequence(long queryLong, int maxDivCheck) { int div = barOverLength; for (long targetLong : barOverLong) { int c = BaseEncoder.seqDifferencesForSubset(targetLong, queryLong, barOverLength, maxDivCheck); if (c < div) { div = c; } } return div; } @Override public int compareTo(Barcode anotherBarcode) { if (this.barOverLong[0] < anotherBarcode.barOverLong[0]) { return -1; } if (this.barOverLong[0] > anotherBarcode.barOverLong[0]) { return 1; } return 0; } public String getTaxaName() { return taxaName; } }
package cn.itheima.methodPractice; public class GetSum { /* 3、定义一个方法getNumSum,功能是计算1到100所有整数和,并打印输出。 在main方法中调用getNumSum方法。(无参数无返回值) */ public static void main(String[] args) { getNumSum(); } private static void getNumSum() { int sum = 0; for (int i = 1; i <= 100; i++) { sum += i; } } }
package com.example.umarramadhana.atp; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.example.umarramadhana.atp.network.AccountClient; import com.example.umarramadhana.atp.pojo.Account; public class MainActivity extends AppCompatActivity { private EditText mNamaEditText; private EditText mEmailEditText; private EditText mNoKtpEditText; private EditText mAddressEditText; private EditText mNoHpEditText; private EditText mUsernameEditText; private EditText mPasswordEditText; private EditText mAddSaldoEditText; private Button mAddAccountButton; private Button mAddSaldoButton; private AccountClient accountClient = new AccountClient(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initLayoutObject(); initButtonListener(); } private void initButtonListener() { mAddAccountButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String accountName = mNamaEditText.getText().toString(); String accountEmail = mEmailEditText.getText().toString(); String accountNoKtp = mNoKtpEditText.getText().toString(); String accountAddress = mAddressEditText.getText().toString(); String accountNoHp = mNoHpEditText.getText().toString(); String accountUsername = mUsernameEditText.getText().toString(); String accountPassword = mPasswordEditText.getText().toString(); Account account = new Account(accountName, accountEmail, accountNoKtp, accountAddress, accountNoHp, accountUsername, accountPassword); accountClient.addAccount(account); Toast.makeText(getApplicationContext(), "Selamat Menggunakan Aplikasi ATP", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(MainActivity.this, Login.class); startActivity(intent); } }); } private void initLayoutObject() { mAddAccountButton = (Button) findViewById(R.id.btn_add_account); mNamaEditText= (EditText) findViewById(R.id.et_nama); mEmailEditText = (EditText) findViewById(R.id.et_email); mNoKtpEditText = (EditText) findViewById(R.id.et_no_ktp); mAddressEditText = (EditText) findViewById(R.id.et_address); mNoHpEditText = (EditText) findViewById(R.id.et_no_hp); mUsernameEditText = (EditText) findViewById(R.id.et_username); mPasswordEditText = (EditText) findViewById(R.id.et_password); } }
package com.noturaun.posapp.entity; public class Outlet { Integer id; String name; String address; String phone; public Outlet() { } public Outlet(Integer id, String name, String address, String phone) { this.id = id; this.name = name; this.address = address; this.phone = phone; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } }
package classes; import java.util.ArrayList; import java.util.List; public class WordChecker { private List<String> ValidWords; private static EngDictionary Dictionary; public WordChecker() { ValidWords = new ArrayList<String>(); Dictionary = EngDictionary.getDictInstance(); } public void handle(String word) { if (word.length() >= 3 && !ValidWords.contains(word) && Dictionary.contains(word)) { ValidWords.add(word); } } public void ShowWords() { for (String word : ValidWords) { System.out.println(word); } } }
/** *Questa è la classe CaricaLibreria, dove si ha la possibilità di convertire e * salvare la libreria da Java a JSON * * Della libreria Json.simple (https://code.google.com/archive/p/json-simple/downloads -->json-simple-1.1.1.jar) abbiamo importato: * @see org.json.simple.JSONArray * @see org.json.simple.JSONObject * @see org.json.simple.parser.JSONParser * @see org.json.simple.parser.ParseException * per operare con oggetti e array JSON * * @see java.io.FileReader * @see java.io.FileNotFoundException * @see java.io.IOException * per l'utilizzo del file * * @see java.util.Vector * per utilizzare un vettore. * * @author Genovese Tommaso, Bruno Luca, Cuniberti Andrea, Bagnis Gabriele * @version 2.2 */ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Vector; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; public class LibreriaJson { static Vector<Libro> libreria; /** * E' il metodo costruttore, lo utilizziamo solo per inizializzare il vector */ public LibreriaJson(){ libreria = new Vector<Libro>(); } /** * Il metodo caricaLibreria si occupa di leggere il file json e di trovare le eventuali eccezioni che si possono presentare * @param nomeFile e' il nome del file che passiamo al metodo, in modo che lo possa aprire */ public void caricaLibreria(String nomeFile){ JSONParser jsonParser = new JSONParser(); try (FileReader reader = new FileReader(nomeFile)) { //Read JSON file Object obj = jsonParser.parse(reader); JSONArray listaLibri = (JSONArray) obj; //System.out.println(listaLibri); listaLibri.forEach( lib -> parseOgbjectLibro( (JSONObject) lib ) ); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } } /** * Il metodo statico parseObjectLibro aggiunge al vettore "libreria" i dati di un libro (autore(nome e cognome), titolo, pagine del libro * @param l e' un parametro di tipo JSONObject, che contiene tutte le informazioni di un libro * @see Libro */ private static void parseOgbjectLibro(JSONObject l) { String nomeAutore; String cognomeAutore; String titolo; int pagineLibro; JSONObject libro = (JSONObject) l.get("libro"); JSONObject autore = (JSONObject) libro.get("autore"); nomeAutore = (String) autore.get("nome"); cognomeAutore = (String) autore.get("cognome"); titolo = (String) libro.get("titolo"); pagineLibro =Integer.parseInt((String) libro.get("numero pagine")); libreria.add(new Libro(titolo, new Autore(nomeAutore,cognomeAutore), pagineLibro)); } /** * Il metodo toString stampa una stringa out che contiene tutti gli elementi della libreria (tutti i dati di ogni libro) * @return out */ @Override public String toString() { String out = ""; for (int i =0; i<libreria.size();i++){ out += libreria.elementAt(i).toString() + "\n"; } return out; } }
package com.esum.comp.batch.schedule; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.esum.comp.batch.BatchConfig; import com.esum.comp.batch.table.BatchInfoRecord; import com.esum.comp.batch.table.BatchInfoTable; import com.esum.framework.FrameworkSystemVariables; import com.esum.framework.core.component.ComponentException; import com.esum.framework.core.component.listener.LegacyListener; import com.esum.framework.core.component.table.InfoTableManager; import com.esum.framework.core.exception.SystemException; public class BatchLegacyListener extends LegacyListener { private Logger log = LoggerFactory.getLogger(BatchLegacyListener.class); private List<BatchInfoRecord> infoList; private Hashtable<String, BatchCronScheduler> batchCronList = new Hashtable<String, BatchCronScheduler>(); private String nodeId; public BatchLegacyListener() throws SystemException { nodeId = System.getProperty(FrameworkSystemVariables.NODE_ID); BatchInfoTable batchInfoTable = (BatchInfoTable)InfoTableManager.getInstance().getInfoTable(BatchConfig.BATCH_CONFIG_ID); infoList = batchInfoTable.getBatchInfoList(); } @Override protected void startupLegacy() throws SystemException { traceId = "[" + getComponentId() + "][" + nodeId + "] "; Iterator<BatchInfoRecord> i = infoList.iterator(); log.info(traceId+"Batch starting. nodeId : "+nodeId); while(i.hasNext()){ BatchInfoRecord info = (BatchInfoRecord)i.next(); if(!info.isUseFlag()) continue; String interfaceId = info.getInterfaceId(); log.debug(traceId+"Starting Batch listener. interfaceId : "+interfaceId); try { List<String> nodeList = info.getNodeList(); log.debug(traceId+"["+interfaceId+"] startup. nodeList : " + nodeList); if (info.containsNodeId(nodeId)) { BatchCronScheduler listener = new BatchCronScheduler(info); listener.startup(); batchCronList.put(interfaceId, listener); log.info(traceId+"["+interfaceId+"] Batch listener started."); } } catch (Exception e) { log.error(traceId+"["+interfaceId+"] Batch listener starting error.", e); // throw new ComponentException(BatchCode.ERROR_UNDEFINED, "startupLegacy()", e.getMessage(), e); // 다른 배치에 영향 받지 않도록 함. continue; } } log.info(traceId + batchCronList.size() + " Batch Listener started."); } public void reload(String[] reloadIds) throws SystemException { log.debug(traceId+"BatchCronScheduler reload called. reload id : "+reloadIds[0]); if (batchCronList.containsKey(reloadIds[0])) { BatchCronScheduler listener = (BatchCronScheduler)batchCronList.get(reloadIds[0]); listener.shutdown(); batchCronList.remove(reloadIds[0]); listener = null; log.info(traceId+"Batch has shutdowned."); } BatchInfoTable batchInfoTable = (BatchInfoTable)InfoTableManager.getInstance().getInfoTable(BatchConfig.BATCH_CONFIG_ID); BatchInfoRecord batchInfo = null; try{ batchInfo = (BatchInfoRecord)batchInfoTable.getInfoRecord(reloadIds); }catch(ComponentException e){ log.info(traceId+"Batch id not found.", e); return; } if (batchInfo != null && batchInfo.isUseFlag()) { String interfaceId = batchInfo.getInterfaceId(); List<String> nodeList = batchInfo.getNodeList(); log.debug(traceId+"["+interfaceId+"] reload. nodeList : " + nodeList); if (batchInfo.containsNodeId(nodeId)) { try { BatchCronScheduler handler = new BatchCronScheduler(batchInfo); handler.startup(); batchCronList.put(interfaceId, handler); log.info(traceId+"["+interfaceId+"] BatchCronScheduler after reloading info table restarted."); } catch (Exception e) { log.error(traceId+"["+interfaceId+"] BatchCronScheduler reload starting error.", e); throw new ComponentException(e.toString()); } } } } protected void shutdownLegacy() throws SystemException { Enumeration<String> e = batchCronList.keys(); while(e.hasMoreElements()) { String key = e.nextElement(); BatchCronScheduler listener = batchCronList.get(key); listener.shutdown(); } batchCronList.clear(); } }
package com.esum.framework.core.management.mbean.notify; import java.util.Map; import org.apache.ibatis.session.SqlSession; import com.esum.framework.jdbc.JdbcSqlSessionFactory; import com.esum.framework.jdbc.JdbcSqlSessionFactoryManager; public class NotifyCreator { public boolean insertNotify(Map<String, String> message) throws Exception { JdbcSqlSessionFactory sessionFactory = null; SqlSession session = null; try { sessionFactory = JdbcSqlSessionFactoryManager.getInstance().createDefaultSqlSessionFactory(); session = sessionFactory.openSession(false); session.insert("xtrus.sqlmap.notifyMessage.insertNotifyMessage", message); session.commit(); return true; } catch (Exception e){ if(session!=null) session.rollback(); throw e; } finally { if(session!=null) session.close(); session = null; } } }
/* */ package com.cza.service.dto; /* */ /* */ public class TSkuStock /* */ { /* */ private Long sid; /* */ private Long number; /* */ private Long stock; /* */ /* */ public Long getSid() /* */ { /* 32 */ return this.sid; /* */ } /* */ /* */ public void setSid(Long sid) /* */ { /* 40 */ this.sid = sid; /* */ } /* */ /* */ public Long getNumber() /* */ { /* 48 */ return this.number; /* */ } /* */ /* */ public void setNumber(Long number) /* */ { /* 56 */ this.number = number; /* */ } /* */ /* */ public Long getStock() /* */ { /* 64 */ return this.stock; /* */ } /* */ /* */ public void setStock(Long stock) /* */ { /* 72 */ this.stock = stock; /* */ } /* */ /* */ public String toString() /* */ { /* 85 */ return "TSkuStock [sid=" + this.sid + ", number=" + this.number + ", stock=" + this.stock + "]"; /* */ } /* */ } /* Location: C:\Users\Administrator.SKY-20141119XLJ\Downloads\rpc-server-0.0.1-SNAPSHOT.jar * Qualified Name: com.cza.service.dto.TSkuStock * JD-Core Version: 0.6.2 */
package com.zeal.smartdo.home.presenter; import com.zeal.smartdo.base.BasePresenter; import com.zeal.smartdo.base.SmartDoManager; import com.zeal.smartdo.contract.AddTodoContact; import com.zeal.smartdo.home.contract.UpdateContract; import com.zeal.smartdo.home.model.Todo; import com.zeal.smartdo.home.model.TodoModel; import com.zeal.smartdo.home.model.UpdateTodoModel; import java.util.List; /** * Created by liaowj on 2017/4/12. */ public class UpdateTodoPresenter extends BasePresenter<UpdateContract.View> implements UpdateContract.Presenter { private UpdateTodoModel mModel; public UpdateTodoPresenter() { this.mModel = new UpdateTodoModel(); } @Override public void update(final Todo todo) { checkViewAttached(); getMvpView().showLoading("正在更改中..."); new SmartDoManager<Todo>()// .create(new SmartDoManager.EmitterCallback() { @Override public void getEmitDatas(List datas) throws Exception { datas.add(mModel.updateTodo(todo)); } })// .switchThread()// .deliveryResult(new SmartDoManager.ConsumerCallback<Todo>() { @Override public void onReceive(Todo data) { super.onReceive(data); getMvpView().hideLoading(); getMvpView().showError("更改成功"); getMvpView().finishCurrent(); } @Override public void onError(Throwable t) { super.onError(t); getMvpView().hideLoading(); getMvpView().showError("更改出错" + t.toString()); } }); } @Override public void showView(Todo todo) { getMvpView().setContent(todo.content); getMvpView().setDate(todo.date); getMvpView().setTitle(todo.title); } }
import com.google.gson.Gson; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.Reader; import java.util.Collections; import java.util.List; public class LerJSON { public static void main( String[] args ) throws FileNotFoundException{ //Reader reader = new FileReader(new File(ClassLoader.getSystemResource("C:\\Users\\Desenvolvimento\\Documents\\got-houses\\got-houses\\houses.json").getFile())); Gson gson = new Gson(); Houses houses = gson.fromJson(new FileReader("C:\\Users\\Desenvolvimento\\Documents\\got-houses\\got-houses\\houses.json"), Houses.class); System.out.print("\n houses: "); /* for(House house : houses.getHouses()){ if(house.getName() == "Starks"){ System.out.println("\n\n\n TESTE TESTEEEE\n\n\n"); Collections.sort(house.getPeople()); } }*/ for(House house : houses.getHouses()){ System.out.println("\n---------------------------------------" + "\nName: " + house.getName() + "\ndescription: " + house.getWikiSuffix() + "\nPeoples: "); if(house.getName().equals("Starks")){ Collections.sort(house.getPeople()); } for(People people : house.getPeople()){ System.out.println("\n---------------------------------------" + "\nName: " + people.getName() + "\nDescription: " + people.getDescription() + "\nImageSuffix: " + people.getImageSuffix() + "\nWikiSuffix: " + people.getWikiSuffix()); } } } }
package modnlp.tc.dstruct; import java.util.Vector; import java.util.Enumeration; /** * Store text as an array of booleans, its id and categories (also as a vector) * * @author Saturnino Luz &#60;luzs@acm.org&#62; * @version <font size=-1>$Id: NewsItemAsBooleanVector.java,v 1.1 2005/08/20 12:48:30 druid Exp $</font> * @see */ public class NewsItemAsBooleanVector { private Vector categs = null; private String id = null; private boolean[] tvect; public NewsItemAsBooleanVector (Vector categs, boolean[] tvect, String id) { super(); this.id = id; this.categs = categs; this.tvect = tvect; } public void addCategory (String topic) { categs.add(topic); } public Enumeration getCategories () { return categs.elements(); } public Vector getCategVector () { return categs; } public boolean[] getBooleanTextArray () { return tvect; } /** * Get the value of id. * @return value of id. */ public String getId() { return id; } /** * Set the value of id. * @param v Value to assign to id. */ public void setId(String v) { this.id = v; } }
package com.volunteeride.volunteeride; import android.os.Bundle; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import com.volunteeride.volunteeride.registerfragments.FragmentBoth; import com.volunteeride.volunteeride.registerfragments.FragmentRideSeeker; import com.volunteeride.volunteeride.registerfragments.FragmentVolunteer; public class RegisterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // Setup the viewPager ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager); MyPagerAdapter pagerAdapter = new MyPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(pagerAdapter); // Setup the Tabs TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); // By using this method the tabs will be populated according to viewPager's count and // with the name from the pagerAdapter getPageTitle() tabLayout.setTabsFromPagerAdapter(pagerAdapter); // This method ensures that tab selection events update the ViewPager and page changes update the selected tab. tabLayout.setupWithViewPager(viewPager); } private class MyPagerAdapter extends FragmentStatePagerAdapter { private String tabTitles[] = new String[]{"Ride Seeker", "Volunteer", "Both"}; public MyPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int pos) { switch(pos) { case 0: return FragmentRideSeeker.newInstance(); case 1: return FragmentVolunteer.newInstance(); case 2: return FragmentBoth.newInstance(); default: return FragmentRideSeeker.newInstance(); } } @Override public int getCount() { return 3; } @Override public CharSequence getPageTitle(int position) { return tabTitles[position]; } } }
package ur.ur_flow.coupon; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.ambit.city_guide.R; import java.util.HashMap; import lib.hyxen.flow.supportv4.HxNavigationFragment; import ur.api_ur.api_data_obj.poi.URPoiObj; import ur.ga.URGAManager; import ur.ui_component.URNavigationFragment; import ur.ui_component.URTabPageIndicator; import ur.ur_flow.coupon.obj.OnNextListener; /** * Created by redjack on 15/9/23. */ public class CouponTypeFragment extends URNavigationFragment { ViewPager viewPager; URTabPageIndicator tabPageIndicator; FragmentPagerAdapter fAdapter; URPoiObj assignedPoi; public static CouponTypeFragment initial(URPoiObj assignedPoi) { CouponTypeFragment f = new CouponTypeFragment(); f.assignedPoi = assignedPoi; return f; } @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View mainView = inflater.inflate(R.layout.ur_f_coupon_type, null); fAdapter = new CouponTypeFragmentAdapter(getActivity(), getChildFragmentManager()); viewPager = (ViewPager) mainView.findViewById(R.id.f_ur_coupon_list_viewPager); viewPager.setAdapter(fAdapter); viewPager.setOnPageChangeListener(onPageChangeListener); tabPageIndicator = (URTabPageIndicator) mainView.findViewById(R.id.f_ur_coupon_tab_indicator); tabPageIndicator.setViewPager(viewPager); setTitle(getString(R.string.ur_f_coupon_type_title)); if (assignedPoi != null) setSubtitle(assignedPoi.poi_name); // setBackBtn(true,null); setBackBtn(true); URGAManager.sendScreenName(getActivity(), getString(R.string.ur_f_coupon_type_title) + (assignedPoi != null ? "-" + assignedPoi.poi_name : "")); return mainView; } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void onResume() { super.onResume(); CouponOwnListFragment f = (CouponOwnListFragment) fAdapter.getItem(1); if (f != null) f.reloadCoupons(); } private ViewPager.OnPageChangeListener onPageChangeListener = new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {} @Override public void onPageSelected(int position) { tabPageIndicator.selectTab(position); if (position == 1) { CouponOwnListFragment f = (CouponOwnListFragment) fAdapter.getItem(position); f.reloadCoupons(); } } @Override public void onPageScrollStateChanged(int state) {} }; public class CouponTypeFragmentAdapter extends FragmentPagerAdapter implements OnNextListener { HashMap<Integer, Fragment> map = new HashMap<>(); String[] titles; public CouponTypeFragmentAdapter(Context context, FragmentManager fm) { super(fm); titles = new String[] { context.getString(R.string.ur_f_coupon_type_text_not_get), context.getString(R.string.ur_f_coupon_type_text_got) }; } @Override public CharSequence getPageTitle(int position) { return titles[position]; } @Override public Fragment getItem(int position) { Fragment f = map.get(position); if (f == null) { if (position == 0) f = CouponListFragment.initial(assignedPoi, this); else f = CouponOwnListFragment.initial(assignedPoi, this); map.put(position, f); } return f; } @Override public int getCount() { return 2; } @Override public void onNextFragmentNeedShow(HxNavigationFragment fragment) { push(fragment); } } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (assignedPoi != null) URGAManager.sendScreenName(getActivity(),getString(R.string.ga_coupon)+assignedPoi.poi_name); } }
/* * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://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.springframework.web.socket.config; import java.util.Arrays; import java.util.List; import org.w3c.dom.Element; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.ConstructorArgumentValues; import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.parsing.BeanComponentDefinition; import org.springframework.beans.factory.parsing.CompositeComponentDefinition; import org.springframework.beans.factory.support.ManagedList; import org.springframework.beans.factory.support.ManagedMap; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.factory.xml.BeanDefinitionParser; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.lang.Nullable; import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; import org.springframework.util.xml.DomUtils; import org.springframework.web.socket.server.support.OriginHandshakeInterceptor; import org.springframework.web.socket.server.support.WebSocketHandlerMapping; import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler; import org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler; /** * Parses the configuration for the {@code <websocket:handlers/>} namespace element. * Registers a Spring MVC {@code SimpleUrlHandlerMapping} to map HTTP WebSocket * handshake (or SockJS) requests to * {@link org.springframework.web.socket.WebSocketHandler WebSocketHandlers}. * * @author Brian Clozel * @author Rossen Stoyanchev * @since 4.0 */ class HandlersBeanDefinitionParser implements BeanDefinitionParser { private static final String SOCK_JS_SCHEDULER_NAME = "SockJsScheduler"; private static final int DEFAULT_MAPPING_ORDER = 1; @Override @Nullable public BeanDefinition parse(Element element, ParserContext context) { Object source = context.extractSource(element); CompositeComponentDefinition compDefinition = new CompositeComponentDefinition(element.getTagName(), source); context.pushContainingComponent(compDefinition); String orderAttribute = element.getAttribute("order"); int order = orderAttribute.isEmpty() ? DEFAULT_MAPPING_ORDER : Integer.parseInt(orderAttribute); RootBeanDefinition handlerMappingDef = new RootBeanDefinition(WebSocketHandlerMapping.class); handlerMappingDef.setSource(source); handlerMappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); handlerMappingDef.getPropertyValues().add("order", order); String handlerMappingName = context.getReaderContext().registerWithGeneratedName(handlerMappingDef); RuntimeBeanReference sockJsService = WebSocketNamespaceUtils.registerSockJsService( element, SOCK_JS_SCHEDULER_NAME, context, source); HandlerMappingStrategy strategy; if (sockJsService != null) { strategy = new SockJsHandlerMappingStrategy(sockJsService); } else { RuntimeBeanReference handler = WebSocketNamespaceUtils.registerHandshakeHandler(element, context, source); Element interceptElem = DomUtils.getChildElementByTagName(element, "handshake-interceptors"); ManagedList<Object> interceptors = WebSocketNamespaceUtils.parseBeanSubElements(interceptElem, context); String allowedOrigins = element.getAttribute("allowed-origins"); List<String> origins = Arrays.asList(StringUtils.tokenizeToStringArray(allowedOrigins, ",")); String allowedOriginPatterns = element.getAttribute("allowed-origin-patterns"); List<String> originPatterns = Arrays.asList(StringUtils.tokenizeToStringArray(allowedOriginPatterns, ",")); OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(origins); if (!ObjectUtils.isEmpty(originPatterns)) { interceptor.setAllowedOriginPatterns(originPatterns); } interceptors.add(interceptor); strategy = new WebSocketHandlerMappingStrategy(handler, interceptors); } ManagedMap<String, Object> urlMap = new ManagedMap<>(); urlMap.setSource(source); for (Element mappingElement : DomUtils.getChildElementsByTagName(element, "mapping")) { strategy.addMapping(mappingElement, urlMap, context); } handlerMappingDef.getPropertyValues().add("urlMap", urlMap); context.registerComponent(new BeanComponentDefinition(handlerMappingDef, handlerMappingName)); context.popAndRegisterContainingComponent(); return null; } private interface HandlerMappingStrategy { void addMapping(Element mappingElement, ManagedMap<String, Object> map, ParserContext context); } private static class WebSocketHandlerMappingStrategy implements HandlerMappingStrategy { private final RuntimeBeanReference handshakeHandlerReference; private final ManagedList<?> interceptorsList; public WebSocketHandlerMappingStrategy(RuntimeBeanReference handshakeHandler, ManagedList<?> interceptors) { this.handshakeHandlerReference = handshakeHandler; this.interceptorsList = interceptors; } @Override public void addMapping(Element element, ManagedMap<String, Object> urlMap, ParserContext context) { String pathAttribute = element.getAttribute("path"); String[] mappings = StringUtils.tokenizeToStringArray(pathAttribute, ","); RuntimeBeanReference handlerReference = new RuntimeBeanReference(element.getAttribute("handler")); ConstructorArgumentValues cargs = new ConstructorArgumentValues(); cargs.addIndexedArgumentValue(0, handlerReference); cargs.addIndexedArgumentValue(1, this.handshakeHandlerReference); RootBeanDefinition requestHandlerDef = new RootBeanDefinition(WebSocketHttpRequestHandler.class, cargs, null); requestHandlerDef.setSource(context.extractSource(element)); requestHandlerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); requestHandlerDef.getPropertyValues().add("handshakeInterceptors", this.interceptorsList); String requestHandlerName = context.getReaderContext().registerWithGeneratedName(requestHandlerDef); RuntimeBeanReference requestHandlerRef = new RuntimeBeanReference(requestHandlerName); for (String mapping : mappings) { urlMap.put(mapping, requestHandlerRef); } } } private static class SockJsHandlerMappingStrategy implements HandlerMappingStrategy { private final RuntimeBeanReference sockJsService; public SockJsHandlerMappingStrategy(RuntimeBeanReference sockJsService) { this.sockJsService = sockJsService; } @Override public void addMapping(Element element, ManagedMap<String, Object> urlMap, ParserContext context) { String pathAttribute = element.getAttribute("path"); String[] mappings = StringUtils.tokenizeToStringArray(pathAttribute, ","); RuntimeBeanReference handlerReference = new RuntimeBeanReference(element.getAttribute("handler")); ConstructorArgumentValues cargs = new ConstructorArgumentValues(); cargs.addIndexedArgumentValue(0, this.sockJsService, "SockJsService"); cargs.addIndexedArgumentValue(1, handlerReference, "WebSocketHandler"); RootBeanDefinition requestHandlerDef = new RootBeanDefinition(SockJsHttpRequestHandler.class, cargs, null); requestHandlerDef.setSource(context.extractSource(element)); requestHandlerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); String requestHandlerName = context.getReaderContext().registerWithGeneratedName(requestHandlerDef); RuntimeBeanReference requestHandlerRef = new RuntimeBeanReference(requestHandlerName); for (String mapping : mappings) { String pathPattern = (mapping.endsWith("/") ? mapping + "**" : mapping + "/**"); urlMap.put(pathPattern, requestHandlerRef); } } } }
package com.jxtb.test.service; import com.jxtb.test.entity.Test; import java.util.List; /** * Created with IntelliJ IDEA. * User: Administrator * Date: 17-1-20 * Time: 下午12:06 * To change this template use File | Settings | File Templates. */ public interface IMyBatisService { public List<Test> getAllUser(); public int addBook(Test test); public int deleteBook(Test test); public int updateBook(Test test); }
package br.com.alura.gerenciador.servlet; import jakarta.servlet.RequestDispatcher; import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @WebServlet("/listaEmpresa") public class listaEmpresasServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { Banco banco = new Banco(); List<Empresa> lista = banco.getEmpresas(); req.setAttribute("empresas", lista); //chamar o JSP RequestDispatcher rd = req.getRequestDispatcher("/listaEmpresas.jsp"); //passar o objeto para o JSP rd.forward(req, resp); } }
package com.blank038.kitpvp.manager; import cn.nukkit.utils.Config; import com.blank038.kitpvp.KitPvp; import java.io.File; public class ShopManager { private KitPvp main; public ShopManager(KitPvp kitPvp) { this.main = kitPvp; } public void init() { // 开始判断文件是否存在 File shop = new File(main.getDataFolder(), "shop.yml"); if (!shop.exists()) main.saveResource(shop.getName()); // 读取配置 Config shopConfig = new Config(shop); } }
package practice; import java.util.Scanner; public class AgeCheck { public static void main(String[] args) { // WAP to check whether the given age is major(>=18) or minor // Note: if the given age is <0 then display "Invalid Age" Scanner s = new Scanner(System.in); System.out.println("Enter your age: "); int age = s.nextInt(); if (age >= 18) { System.out.println("Major"); } else if (age >= 0) { System.out.println("Minor"); } else { System.out.println("Invalid Age"); } s.close(); } }
package com.example.daou.myapplication; /** * Created by daou on 2017-03-13. */ public class Movie { private String movieImg; public Movie(String movieImg) { this.movieImg = movieImg; } public String getMovieImg() { return movieImg; } }
package com.alibaba.druid.bvt.log; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.security.PrivilegedAction; import java.sql.Connection; import java.util.Enumeration; import java.util.HashSet; import java.util.Set; import junit.framework.TestCase; import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.proxy.DruidDriver; import com.alibaba.druid.util.Utils; import com.alibaba.druid.util.JdbcUtils; public class LoggerTest extends TestCase { private static java.security.ProtectionDomain DOMAIN; private ClassLoader contextClassLoader; private DruidDataSource dataSource; static { DOMAIN = (java.security.ProtectionDomain) java.security.AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { return TestLoader.class.getProtectionDomain(); } }); } public static class TestLoader extends ClassLoader { private ClassLoader loader; private Set<String> definedSet = new HashSet<String>(); public TestLoader() { super(null); loader = DruidDriver.class.getClassLoader(); } public URL getResource(String name) { return loader.getResource(name); } public Enumeration<URL> getResources(String name) throws IOException { return loader.getResources(name); } public Class<?> loadClass(String name) throws ClassNotFoundException { if (name.startsWith("java")) { return loader.loadClass(name); } if (definedSet.contains(name)) { return super.loadClass(name); } String resourceName = name.replace('.', '/') + ".class"; InputStream is = loader.getResourceAsStream(resourceName); if (is == null) { throw new ClassNotFoundException(); } try { byte[] bytes = Utils.readByteArray(is); this.defineClass(name, bytes, 0, bytes.length, DOMAIN); definedSet.add(name); } catch (IOException e) { throw new ClassNotFoundException(e.getMessage(), e); } try { is.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Class<?> clazz = super.loadClass(name); return clazz; } } public void test_log() throws Exception { TestLoader classLoader = new TestLoader(); Thread.currentThread().setContextClassLoader(classLoader); dataSource = new DruidDataSource(); dataSource.setFilters("log"); dataSource.setUrl("jdbc:mock:xx"); Connection conn = dataSource.getConnection(); conn.close(); } @Override protected void setUp() throws Exception { contextClassLoader = Thread.currentThread().getContextClassLoader(); } @Override protected void tearDown() throws Exception { Thread.currentThread().setContextClassLoader(contextClassLoader); JdbcUtils.close(dataSource); } }
package net.phedny.android.pivpn; import java.io.BufferedReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by mark on 05/07/14. */ public class InterfaceParser { public static Interface[] parse(BufferedReader reader) throws IOException { List<Interface> interfaces = new ArrayList<Interface>(); Interface iface = new Interface(); while (true) { String line = reader.readLine(); if (line == null) { return interfaces.toArray(new Interface[interfaces.size()]); } if (line.length() == 0) { interfaces.add(iface); iface = new Interface(); } matchInterfaceLine(iface, line); matchAddressLine(iface, line); matchStateLine(iface, line); matchRxLine(iface, line); matchTxLine(iface, line); matchStatsLine(iface, line); matchBytesLine(iface, line); } } private static final Pattern INTERFACE_LINE = Pattern.compile("([^ ]*) *Link encap:([-A-Za-z ]+)(?: HWaddr ([0-9a-f:]+))? *"); private static void matchInterfaceLine(Interface iface, String line) { Matcher matcher = INTERFACE_LINE.matcher(line); if (matcher.matches()) { iface.setName(matcher.group(1)); iface.setEncapsulation(matcher.group(2)); iface.setHardwareAddress(matcher.group(3)); } } private static final Pattern ADDRESS_LINE = Pattern.compile(" *inet addr:([0-9.]+)(?: P-t-P:([0-9.]+))?(?: Bcast:([0-9.]+))?(?: Mask:([0-9.]+))?"); private static void matchAddressLine(Interface iface, String line) { Matcher matcher = ADDRESS_LINE.matcher(line); if (matcher.matches()) { iface.setInetAddress(matcher.group(1)); iface.setInetPeerAddress(matcher.group(2)); iface.setInetBroadcastAddress(matcher.group(3)); iface.setInetNetmask(matcher.group(4)); } } private static final Pattern STATE_LINE = Pattern.compile(" *(UP )?(LOOPBACK )?(POINTOPOINT )?(BROADCAST )?(RUNNING )?(MULTICAST )? MTU:(\\d+) Metric:(\\d+)"); private static void matchStateLine(Interface iface, String line) { Matcher matcher = STATE_LINE.matcher(line); if (matcher.matches()) { iface.setUp(matcher.group(1) != null); iface.setLoopback(matcher.group(2) != null); iface.setPointToPoint(matcher.group(3) != null); iface.setBroadcast(matcher.group(4) != null); iface.setRunning(matcher.group(5) != null); iface.setMulticast(matcher.group(6) != null); iface.setMtu(Integer.parseInt(matcher.group(7))); iface.setMetric(Integer.parseInt(matcher.group(8))); } } private static final Pattern RX_LINE = Pattern.compile(" *RX packets:(\\d+) errors:(\\d+) dropped:(\\d+) overruns:(\\d+) frame:(\\d+)"); private static void matchRxLine(Interface iface, String line) { Matcher matcher = RX_LINE.matcher(line); if (matcher.matches()) { iface.setRxPackets(Long.parseLong(matcher.group(1))); iface.setRxErrors(Long.parseLong(matcher.group(2))); iface.setRxDropped(Long.parseLong(matcher.group(3))); iface.setRxOverruns(Long.parseLong(matcher.group(4))); iface.setRxFrame(Long.parseLong(matcher.group(5))); } } private static final Pattern TX_LINE = Pattern.compile(" *TX packets:(\\d+) errors:(\\d+) dropped:(\\d+) overruns:(\\d+) carrier:(\\d+)"); private static void matchTxLine(Interface iface, String line) { Matcher matcher = TX_LINE.matcher(line); if (matcher.matches()) { iface.setTxPackets(Long.parseLong(matcher.group(1))); iface.setTxErrors(Long.parseLong(matcher.group(2))); iface.setTxDropped(Long.parseLong(matcher.group(3))); iface.setTxOverruns(Long.parseLong(matcher.group(4))); iface.setTxCarrier(Long.parseLong(matcher.group(5))); } } private static final Pattern STATS_LINE = Pattern.compile(" *collisions:(\\d+) txqueuelen:(\\d+)"); private static void matchStatsLine(Interface iface, String line) { Matcher matcher = STATS_LINE.matcher(line); if (matcher.matches()) { iface.setCollisions(Long.parseLong(matcher.group(1))); iface.setTxQueueLen(Long.parseLong(matcher.group(2))); } } private static final Pattern BYTES_LINE = Pattern.compile(" *RX bytes:(\\d+) \\(\\d+\\.\\d (?:[KMG]i?)?B\\) TX bytes:(\\d+) \\(\\d+\\.\\d (?:[KMG]i?)?B\\)"); private static void matchBytesLine(Interface iface, String line) { Matcher matcher = BYTES_LINE.matcher(line); if (matcher.matches()) { iface.setRxBytes(Long.parseLong(matcher.group(1))); iface.setTxBytes(Long.parseLong(matcher.group(2))); } } }
package com.netcracker.folktaxi; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; //import static java.lang.System.out; /** * Hello world! * */ public class Main { public static void main( String[] args ) { //System.out.println( "Hello FolkTaxi!" ); try { Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/folktaxi", "", "" ); //PreparedStatement stmt = con.prepareStatement(" SELECT current_database();"); PreparedStatement stmt = con.prepareStatement(" SELECT 'Hello FolkTaxi!'"); ResultSet rs = stmt.executeQuery(); while (rs.next()) System.out.println(rs.getString(1)); con.close(); } catch (Exception e) { System.out.println(e); } } }
/** * Copyright (C), 1995-2018, XXX有限公司 * FileName: User * Author: wens. * Date: 2018/5/31 下午4:24 * Description: 用户 * History: * <author> <time> <version> <desc> * 作者姓名 修改时间 版本号 描述 */ package com.phantom.domain; import org.hibernate.annotations.GeneratorType; import org.hibernate.annotations.GenericGenerator; import org.springframework.context.annotation.Bean; import javax.persistence.*; /** * 〈一句话功能简述〉<br> * 〈用户〉 * * @author wens. * @create 2018/5/31 * @since 1.0.0 */ @Entity @Table(name = "phantom_user") public class User { @Id @GeneratedValue(generator = "phantom_llh_seq") @GenericGenerator(name = "phantom_llh_seq", strategy = "native") private long id; @Column(nullable = false) private String name; private Integer age; private String birthDay; public User() { } public User(String name, Integer age) { this.name = name; this.age = age; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public String getBirthDay() { return birthDay; } public void setBirthDay(String birthDay) { this.birthDay = birthDay; } }
package com.lenovohit.hwe.pay.support.alipay.model.result; import com.alipay.api.response.AlipayTradeAppPayResponse; import com.lenovohit.hwe.pay.support.alipay.model.TradeStatus; /** * Created by liuyangkly on 15/8/27. */ public class AlipayTradeAppPayResult implements AbsAlipayTradeResult { private TradeStatus tradeStatus; private AlipayTradeAppPayResponse response; public AlipayTradeAppPayResult(AlipayTradeAppPayResponse response) { this.response = response; } public void setTradeStatus(TradeStatus tradeStatus) { this.tradeStatus = tradeStatus; } public void setResponse(AlipayTradeAppPayResponse response) { this.response = response; } public TradeStatus getTradeStatus() { return tradeStatus; } public AlipayTradeAppPayResponse getResponse() { return response; } @Override public boolean isTradeSuccess() { return response != null && TradeStatus.SUCCESS.equals(tradeStatus); } }
package com.hackerrank.programs; public class KangarooJump { private static int times = 1; private static int currentLimit = 10; private static int maxLimit = 10000; private static int lastLimit = 0; static String kangaroo(int x1, int v1, int x2, int v2) { if ((currentLimit * times) % maxLimit == 0) return "NO"; int maxCount = (currentLimit * times) % maxLimit; int num1 = calculateNumber(x1, v1, maxCount); int num2 = calculateNumber(x2, v2, maxCount); if (num1 >= num2) { while (lastLimit <= maxCount) { if (num1 == num2) return "YES"; num1 = calculateNumber(x1, v1, lastLimit); num2 = calculateNumber(x2, v2, lastLimit); lastLimit++; } } times++; return kangaroo(x1, v1, x2, v2); } private static int calculateNumber(int x1, int v1, int times) { return (v1 * times) + x1; } public static void main(String[] args) { System.out.println(kangaroo(4602, 8519, 7585, 8362)); } }
package com.tonyzanyar.knowledge; import android.app.LoaderManager; import android.content.CursorLoader; import android.content.Intent; import android.content.Loader; import android.database.Cursor; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import com.tonyzanyar.knowledge.data.MyAdapter; import static com.tonyzanyar.knowledge.data.Contract.COLUMN_CONTENT; import static com.tonyzanyar.knowledge.data.Contract.COLUMN_NUM; import static com.tonyzanyar.knowledge.data.Contract.COLUMN_TOPIC; import static com.tonyzanyar.knowledge.data.Contract.CONTENT_URI; import static com.tonyzanyar.knowledge.data.Contract.KEY_WORD; import static com.tonyzanyar.knowledge.data.Contract.MAX_NUM; import static com.tonyzanyar.knowledge.data.Contract.MIN_NUM; /** * @author zhangxin */ public class SearchActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor>{ private ListView list; private MyAdapter myAdapter; private static final int LOAD=2; private String keyGot; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); Intent intent1=getIntent(); keyGot=intent1.getStringExtra(KEY_WORD); if (TextUtils.isEmpty(keyGot)){ keyGot="商用车分类"; } list= (ListView) findViewById(R.id.list_search); myAdapter=new MyAdapter(this,null); list.setAdapter(myAdapter); getLoaderManager().initLoader(LOAD,null,SearchActivity.this); list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { Intent intent=new Intent(SearchActivity.this,TopicActivity.class); intent.putExtra(MIN_NUM,(int)l); intent.putExtra(MAX_NUM,(int)l); startActivity(intent); } }); } @Override public Loader<Cursor> onCreateLoader(int i, Bundle bundle) { String []columns={COLUMN_NUM,COLUMN_TOPIC}; String like="'%"+keyGot+"%'"; String selection=COLUMN_TOPIC+" lIKE "+like+" OR "+COLUMN_CONTENT+" lIKE "+like; return new CursorLoader(this,CONTENT_URI,columns,selection,null,COLUMN_NUM); } @Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { myAdapter.swapCursor(cursor); } @Override public void onLoaderReset(Loader<Cursor> loader) { myAdapter.swapCursor(null); } }
/* * Copyright © 2018 www.noark.xyz All Rights Reserved. * * 感谢您选择Noark框架,希望我们的努力能为您提供一个简单、易用、稳定的服务器端框架 ! * 除非符合Noark许可协议,否则不得使用该文件,您可以下载许可协议文件: * * http://www.noark.xyz/LICENSE * * 1.未经许可,任何公司及个人不得以任何方式或理由对本框架进行修改、使用和传播; * 2.禁止在本项目或任何子项目的基础上发展任何派生版本、修改版本或第三方版本; * 3.无论你对源代码做出任何修改和改进,版权都归Noark研发团队所有,我们保留所有权利; * 4.凡侵犯Noark版权等知识产权的,必依法追究其法律责任,特此郑重法律声明! */ package xyz.noark.core.lang; import org.junit.Test; import static org.junit.Assert.assertEquals; /** * 括号配置解析测试 * * @author 小流氓[176543888@qq.com] * @since 3.4 */ public class BracketParserTest { @Test public void testReadString() { BracketParser p = new BracketParser("[2020][*][11,12,15-19][w1,w3-w5][12:00-13:00]"); assertEquals("2020", p.readString()); assertEquals("*", p.readString()); assertEquals("11,12,15-19", p.readString()); assertEquals("w1,w3-w5", p.readString()); assertEquals("12:00-13:00", p.readString()); } }
package io.github.yizhiru.thulac4j.process; import io.github.yizhiru.thulac4j.model.CwsModel; import io.github.yizhiru.thulac4j.model.POC; /** * Viterbi 解码. */ public final class Decoder { /** * Null previous label. */ private static final int NULL_PREVIOUS_LABEL = -5; /** * Initial score. */ private static final int INITIAL_SCORE = 0; /** * Initial previous label. */ private static final int INITIAL_PREVIOUS_LABEL = -1; private static class Alpha { /** * Score. */ private int score; /** * Previous Label. */ private int preLabel; public Alpha() { score = INITIAL_SCORE; preLabel = NULL_PREVIOUS_LABEL; } @Override public String toString() { return score + ", " + preLabel; } } /** * Viterbi算法解码 * * @param cwsModel 训练模型 * @param cleanedSentence 规则处理后的句子Label 类 * @param previousTrans 前向转移label * @return 最优路径对应的labels */ public static int[] viterbiDecode( CwsModel cwsModel, Ruler.CleanedSentence cleanedSentence, int[][] previousTrans) { int len = cleanedSentence.length(); // 最优路径对应的label int[] bestPath = new int[len]; int labelSize = cwsModel.labelSize; int optimalLastScore = Integer.MIN_VALUE; int optimalLastLabel = 2; Alpha alpha; // 记录在位置i时类别为y的最优路径 // [current index][current Label] -> Alpha(score, preLabel) Alpha[][] pathTabular = new Alpha[len][]; for (int i = 0; i < len; i++) { pathTabular[i] = new Alpha[labelSize]; for (int j = 0; j < labelSize; j++) { pathTabular[i][j] = new Alpha(); } } char[] chars = cleanedSentence.insertBoundary(); POC[] pocs = cleanedSentence.getSentencePoc(); // DP求解 for (int i = 0; i < len; i++) { int[] labelIndices = cwsModel.allowTabular[pocs[i].ordinal()]; int[] weights = cwsModel.evaluateCharWeights(chars[i], chars[i + 1], chars[i + 2], chars[i + 3], chars[i + 4], labelIndices); for (int labelIndex : labelIndices) { alpha = pathTabular[i][labelIndex]; if (i == 0) { alpha.preLabel = INITIAL_PREVIOUS_LABEL; } else { int[] preLabels = previousTrans[labelIndex]; for (int pre : preLabels) { if (pathTabular[i - 1][pre].preLabel == NULL_PREVIOUS_LABEL) { continue; } int score = pathTabular[i - 1][pre].score + cwsModel.llWeights[pre * cwsModel.labelSize + labelIndex]; if (alpha.preLabel == NULL_PREVIOUS_LABEL || score > alpha.score) { alpha.score = score; alpha.preLabel = pre; } } } alpha.score += weights[labelIndex]; if (i == len - 1 && optimalLastScore < alpha.score) { optimalLastScore = alpha.score; optimalLastLabel = labelIndex; } } } // 尾节点的最优label alpha = pathTabular[len - 1][optimalLastLabel]; bestPath[len - 1] = optimalLastLabel; // 回溯最优路径,保留label到数组 for (int i = len - 2; i >= 0; i--) { bestPath[i] = alpha.preLabel; alpha = pathTabular[i][alpha.preLabel]; } return bestPath; } }
import java.util.Scanner; public class StringNotes { public static void main(String[] args) { // String message = "Hello"; // System.out.println(message); // Hello // // message = message + " World!"; // System.out.println(message); // Hello World! // // Scanner scanner = new Scanner(System.in); // System.out.print("Continue? [Y/N] "); // String userInput = scanner.next(); // System.out.println(userInput); // DON'T DO THIS // if ("I am a string" == "I am a string") { // System.out.println("Strings are equal"); // } // DO THIS INSTEAD // if ("I am a string".equals("I am a string")) { // System.out.println("Strings are equal"); // } // String one = "2"; // String two = "2"; // System.out.println(one.equals(two)); // true // String greeting = "Howdy"; // System.out.println(greeting.equalsIgnoreCase("HOWDY")); // true // START WITH // String title = "Dr. Dolittle"; // boolean isADoctor = title.toLowerCase().startsWith("dr"); // System.out.println(isADoctor); // ENDWITH(STRING SUFFIX) // String travisParkAddress = "311 E Travis St, San Antonio, TX 78205"; //// String codeupZip = '78205'; // boolean codeupZip = travisParkAddress.endsWith("78205"); // System.out.println(codeupZip); // CharAt() // boolean firstLetterCap = false; // String word = "Test"; // // char firstletter = word.charAt(0); // // if (firstletter == Character.toUpperCase(firstletter)) { // firstLetterCap = true; // } // // System.out.println(firstLetterCap); // INDEXOF // String cat = "cat"; // System.out.println(cat.indexOf("at")); // 1 // lastIndexOf // String good = "Good"; // System.out.println(good.lastIndexOf("o")); // 2 // // String longWord = "Thisisthelongestwordever"; // System.out.println(longWord.length()); //.replace(char oldChar, char newChar) // String search = "Tiny cats looking cute."; // String parsedSearch = search.replace("cats", "dogs"); // System.out.println(search); // System.out.println(parsedSearch); //.substring(int beginIndex[, int endIndex]) // String name = "Stephen Ray Guedea"; // String firstName = name.substring(0, name.indexOf(" ")); // System.out.println(firstName); // String middleName = name.substring(firstName.length() + 1); // System.out.println(middleName); // String lastName = name.substring(name.lastIndexOf(" ") + 1); // System.out.println(lastName); // .toLowerCase() .toUpperCase() // String hello = "hELlo"; // System.out.println(hello.toLowerCase()); // System.out.println(hello.toUpperCase()); //.trim() // String input = " bob smith \n\n "; // String trimmedInput = input.trim(); // System.out.println(trimmedInput); // System.out.println("|" + input + "|"); // String word1 = "Test"; // String pigLatinWord = word1 // .trim() // .toLowerCase() // .substring(1) // .concat(word1.substring(0, 1).toLowerCase()) // .concat("ay"); // System.out.println(pigLatinWord); } }
package org.squonk.execution.steps.impl; import org.apache.camel.CamelContext; import org.squonk.dataset.Dataset; import org.squonk.dataset.DatasetMetadata; import org.squonk.execution.steps.AbstractStep; import org.squonk.execution.steps.StepDefinitionConstants; import org.squonk.execution.variable.VariableManager; import org.squonk.reader.SDFReader; import org.squonk.types.MoleculeObject; import org.squonk.types.io.JsonHandler; import org.squonk.util.IOUtils; import java.io.IOException; import java.io.InputStream; import java.util.Collections; import java.util.logging.Logger; import java.util.stream.Stream; /** * Reads a structure and generates a {@link MoleculeObject} of the correspondign format. * The structure is passed as an * {@link InputStream} (can be gzipped). * * @author timbo */ public class StructureReaderStep extends AbstractStep { private static final Logger LOG = Logger.getLogger(StructureReaderStep.class.getName()); /** * Expected variable name for the input */ private static final String VAR_FILE_INPUT = StepDefinitionConstants.VARIABLE_FILE_INPUT; private static final String OPT_FILE_INPUT = StepDefinitionConstants.StructureUpload.OPTION_FILE_FORMAT; /** * Variable name for the MoleculeObjectDataset output */ private static final String VAR_DATASET_OUTPUT = StepDefinitionConstants.VARIABLE_OUTPUT_DATASET; @Override public void execute(VariableManager varman, CamelContext context) throws Exception { LOG.info("execute StructureReaderStep"); statusMessage = "Reading structure"; String format = (String)options.get(OPT_FILE_INPUT); if (format == null || format.isEmpty()) { throw new IllegalStateException("File format must be specified using option " + OPT_FILE_INPUT); } String filename = fetchMappedInput(VAR_FILE_INPUT, String.class, varman); if ("automatic".equalsIgnoreCase(format)) { format = guessFileFormat(filename); } try (InputStream is = fetchMappedInput(VAR_FILE_INPUT, InputStream.class, varman)) { LOG.fine("Fetched input for: " + filename); boolean gzipped = filename.toLowerCase().endsWith(".gz"); String mol = IOUtils.convertStreamToString(gzipped ? IOUtils.getGunzippedInputStream(is) : is); MoleculeObject mo = new MoleculeObject(mol, format); DatasetMetadata meta = new DatasetMetadata(MoleculeObject.class); meta.setSize(1); Dataset results = new Dataset(MoleculeObject.class, Collections.singletonList(mo), meta); LOG.fine("Writing output"); createMappedOutput(VAR_DATASET_OUTPUT, Dataset.class, results, varman); statusMessage = "Structure read as " + format; } } private String guessFileFormat(String filename) { if (filename.toLowerCase().endsWith("mol") || filename.toLowerCase().endsWith("mol.gz")) { return "mol"; } else if (filename.toLowerCase().endsWith("pdb") || filename.toLowerCase().endsWith("pdb.gz")) { return "pdb"; } else { throw new IllegalStateException("Cannot determine file format. Expected mol or pdb"); } } }
import java.io.PrintWriter; /** * The Class Open. */ public class Open extends Command { /** * Instantiates a new open. * * @param manager the manager */ public Open(Manager manager) { super("open", 1, manager); } @Override public void process(String[] input, PrintWriter writer) { int accountId = Integer.parseInt(input[0]); if (manager.createAccount(accountId)) { writer.println("Opened account " + accountId); } else { writer.println("Failed to open account " + accountId + ", the account might already exist"); } } @Override public String help() { return "Open <account no>"; } }
package edu.rutgers.MOST.presentation; import java.awt.Dimension; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.util.ArrayList; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import edu.rutgers.MOST.config.LocalConfig; import edu.rutgers.MOST.data.TextReactionsModelReader; public class ReactionColumnNameInterface extends JDialog { /** * */ private static final long serialVersionUID = 1L; public JComboBox<String> cbKnockout = new JComboBox<String>(); public JComboBox<String> cbFluxValue = new JComboBox<String>(); public JComboBox<String> cbReactionAbbreviation = new JComboBox<String>(); public JComboBox<String> cbReactionName = new JComboBox<String>(); public JComboBox<String> cbReactionEquation = new JComboBox<String>(); public JComboBox<String> cbReversible = new JComboBox<String>(); public JComboBox<String> cbLowerBound = new JComboBox<String>(); public JComboBox<String> cbUpperBound = new JComboBox<String>(); public JComboBox<String> cbBiologicalObjective = new JComboBox<String>(); public JComboBox<String> cbSyntheticObjective = new JComboBox<String>(); public JComboBox<String> cbGeneAssociation = new JComboBox<String>(); public JComboBox<String> cbProteinAssociation = new JComboBox<String>(); public JComboBox<String> cbSubsystem = new JComboBox<String>(); public JComboBox<String> cbProteinClass = new JComboBox<String>(); public JButton okButton = new JButton(" OK "); public JButton cancelButton = new JButton(" Cancel "); public JButton prevRowButton = new JButton("Previous Row"); public JButton nextRowButton = new JButton(" Next Row "); public JLabel rowLabel = new JLabel(); private static ArrayList<String> columnNamesFromFile; public static ArrayList<String> getColumnNamesFromFile() { return columnNamesFromFile; } public void setColumnNamesFromFile(ArrayList<String> columnNamesFromFile) { ReactionColumnNameInterface.columnNamesFromFile = columnNamesFromFile; } public ReactionColumnNameInterface(ArrayList<String> columnNamesFromFile) { prevRowButton.setEnabled(false); LocalConfig.getInstance().setReactionsNextRowCorrection(0); rowLabel.setText(" row " + (LocalConfig.getInstance().getReactionsNextRowCorrection() + 1)); final ArrayList<Image> icons = new ArrayList<Image>(); icons.add(new ImageIcon("etc/most16.jpg").getImage()); icons.add(new ImageIcon("etc/most32.jpg").getImage()); getRootPane().setDefaultButton(okButton); setColumnNamesFromFile(columnNamesFromFile); setTitle(ColumnInterfaceConstants.REACTIONS_COLUMN_NAME_INTERFACE_TITLE); setDefaultCloseOperation(DISPOSE_ON_CLOSE); //setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); cbReactionAbbreviation.setEditable(true); cbKnockout.setEditable(true); cbFluxValue.setEditable(true); cbReactionName.setEditable(true); cbReactionEquation.setEditable(true); cbReversible.setEditable(true); cbLowerBound.setEditable(true); cbUpperBound.setEditable(true); cbBiologicalObjective.setEditable(true); cbSyntheticObjective.setEditable(true); cbGeneAssociation.setEditable(true); cbProteinAssociation.setEditable(true); cbSubsystem.setEditable(true); cbProteinClass.setEditable(true); cbReactionAbbreviation.setPreferredSize(new Dimension(250, 25)); cbReactionAbbreviation.setMaximumSize(new Dimension(250, 25)); cbReactionAbbreviation.setMinimumSize(new Dimension(250, 25)); cbKnockout.setPreferredSize(new Dimension(250, 25)); cbKnockout.setMaximumSize(new Dimension(250, 25)); cbKnockout.setMinimumSize(new Dimension(250, 25)); cbFluxValue.setPreferredSize(new Dimension(250, 25)); cbFluxValue.setMaximumSize(new Dimension(250, 25)); cbFluxValue.setMinimumSize(new Dimension(250, 25)); cbReactionName.setPreferredSize(new Dimension(250, 25)); cbReactionName.setMaximumSize(new Dimension(250, 25)); cbReactionName.setMinimumSize(new Dimension(250, 25)); cbReactionEquation.setPreferredSize(new Dimension(250, 25)); cbReactionEquation.setMaximumSize(new Dimension(250, 25)); cbReactionEquation.setMinimumSize(new Dimension(250, 25)); cbReversible.setPreferredSize(new Dimension(250, 25)); cbReversible.setMaximumSize(new Dimension(250, 25)); cbReversible.setMinimumSize(new Dimension(250, 25)); cbLowerBound.setPreferredSize(new Dimension(250, 25)); cbLowerBound.setMaximumSize(new Dimension(250, 25)); cbLowerBound.setMinimumSize(new Dimension(250, 25)); cbUpperBound.setPreferredSize(new Dimension(250, 25)); cbUpperBound.setMaximumSize(new Dimension(250, 25)); cbUpperBound.setMinimumSize(new Dimension(250, 25)); cbBiologicalObjective.setPreferredSize(new Dimension(250, 25)); cbBiologicalObjective.setMaximumSize(new Dimension(250, 25)); cbBiologicalObjective.setMinimumSize(new Dimension(250, 25)); cbSyntheticObjective.setPreferredSize(new Dimension(250, 25)); cbSyntheticObjective.setMaximumSize(new Dimension(250, 25)); cbSyntheticObjective.setMinimumSize(new Dimension(250, 25)); cbGeneAssociation.setPreferredSize(new Dimension(250, 25)); cbGeneAssociation.setMaximumSize(new Dimension(250, 25)); cbGeneAssociation.setMinimumSize(new Dimension(250, 25)); cbProteinAssociation.setPreferredSize(new Dimension(250, 25)); cbProteinAssociation.setMaximumSize(new Dimension(250, 25)); cbProteinAssociation.setMinimumSize(new Dimension(250, 25)); cbSubsystem.setPreferredSize(new Dimension(250, 25)); cbSubsystem.setMaximumSize(new Dimension(250, 25)); cbSubsystem.setMinimumSize(new Dimension(250, 25)); cbProteinClass.setPreferredSize(new Dimension(250, 25)); cbProteinClass.setMaximumSize(new Dimension(250, 25)); cbProteinClass.setMinimumSize(new Dimension(250, 25)); populateNamesFromFileBoxes(columnNamesFromFile); //box layout Box vb = Box.createVerticalBox(); Box hbLabels = Box.createHorizontalBox(); Box hbTop = Box.createHorizontalBox(); Box hbKnockoutLabel = Box.createHorizontalBox(); Box hbKnockout = Box.createHorizontalBox(); Box hbFluxValueLabel = Box.createHorizontalBox(); Box hbFluxValue = Box.createHorizontalBox(); Box hbReactionAbbreviationLabel = Box.createHorizontalBox(); Box hbReactionAbbreviation = Box.createHorizontalBox(); Box hbReactionNameLabel = Box.createHorizontalBox(); Box hbReactionName = Box.createHorizontalBox(); Box hbReactionEquationLabel = Box.createHorizontalBox(); Box hbReactionEquation = Box.createHorizontalBox(); Box hbReversibleLabel = Box.createHorizontalBox(); Box hbReversible = Box.createHorizontalBox(); Box hbLowerBoundLabel = Box.createHorizontalBox(); Box hbLowerBound = Box.createHorizontalBox(); Box hbUpperBoundLabel = Box.createHorizontalBox(); Box hbUpperBound = Box.createHorizontalBox(); Box hbBiologicalObjectiveLabel = Box.createHorizontalBox(); Box hbBiologicalObjective = Box.createHorizontalBox(); Box hbSyntheticObjectiveLabel = Box.createHorizontalBox(); Box hbSyntheticObjective = Box.createHorizontalBox(); Box hbGeneAssociationLabel = Box.createHorizontalBox(); Box hbGeneAssociation = Box.createHorizontalBox(); Box hbProteinAssociationLabel = Box.createHorizontalBox(); Box hbProteinAssociation = Box.createHorizontalBox(); Box hbSubsystemLabel = Box.createHorizontalBox(); Box hbSubsystem = Box.createHorizontalBox(); Box hbProteinClassLabel = Box.createHorizontalBox(); Box hbProteinClass = Box.createHorizontalBox(); Box vbLabels = Box.createVerticalBox(); Box vbCombos = Box.createVerticalBox(); Box hbLabeledCombos = Box.createHorizontalBox(); Box hbRequiredLabel = Box.createHorizontalBox(); Box hbButton = Box.createHorizontalBox(); //top label JLabel topLabel = new JLabel(); topLabel.setText(ColumnInterfaceConstants.REACTIONS_TOP_LABEL); topLabel.setSize(new Dimension(300, 30)); //top, left, bottom. right topLabel.setBorder(BorderFactory.createEmptyBorder(20,30,20,200)); topLabel.setAlignmentX(LEFT_ALIGNMENT); hbTop.add(topLabel); hbTop.setAlignmentX(LEFT_ALIGNMENT); hbLabels.add(hbTop); //knockout Label and combo JLabel knockoutLabel = new JLabel(); knockoutLabel.setText(ColumnInterfaceConstants.KO_LABEL); knockoutLabel.setPreferredSize(new Dimension(250, 25)); knockoutLabel.setMaximumSize(new Dimension(250, 25)); knockoutLabel.setMinimumSize(new Dimension(250, 25)); knockoutLabel.setBorder(BorderFactory.createEmptyBorder(10,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); knockoutLabel.setAlignmentX(LEFT_ALIGNMENT); //knockoutLabel.setAlignmentY(TOP_ALIGNMENT); JPanel panelKnockoutLabel = new JPanel(); panelKnockoutLabel.setLayout(new BoxLayout(panelKnockoutLabel, BoxLayout.X_AXIS)); panelKnockoutLabel.add(knockoutLabel); panelKnockoutLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbKnockoutLabel.add(panelKnockoutLabel); hbKnockoutLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelKnockout = new JPanel(); panelKnockout.setLayout(new BoxLayout(panelKnockout, BoxLayout.X_AXIS)); panelKnockout.add(cbKnockout); panelKnockout.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelKnockout.setAlignmentX(RIGHT_ALIGNMENT); hbKnockout.add(panelKnockout); hbKnockout.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbKnockoutLabel); JLabel blankLabel2 = new JLabel(""); vbLabels.add(blankLabel2); vbCombos.add(hbKnockout); //flux value label and combo JLabel fluxValueLabel = new JLabel(); fluxValueLabel.setText(ColumnInterfaceConstants.FLUX_VALUE_LABEL); fluxValueLabel.setPreferredSize(new Dimension(250, 25)); fluxValueLabel.setMaximumSize(new Dimension(250, 25)); fluxValueLabel.setMinimumSize(new Dimension(250, 25)); fluxValueLabel.setBorder(BorderFactory.createEmptyBorder(ColumnInterfaceConstants.LABEL_TOP_BORDER_SIZE,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); fluxValueLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelFluxValueLabel = new JPanel(); panelFluxValueLabel.setLayout(new BoxLayout(panelFluxValueLabel, BoxLayout.X_AXIS)); panelFluxValueLabel.add(fluxValueLabel); panelFluxValueLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbFluxValueLabel.add(panelFluxValueLabel); hbFluxValueLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelFluxValue = new JPanel(); panelFluxValue.setLayout(new BoxLayout(panelFluxValue, BoxLayout.X_AXIS)); panelFluxValue.add(cbFluxValue); panelFluxValue.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelFluxValue.setAlignmentX(RIGHT_ALIGNMENT); hbFluxValue.add(panelFluxValue); hbFluxValue.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbFluxValueLabel); JLabel blankLabel3 = new JLabel(""); vbLabels.add(blankLabel3); vbCombos.add(hbFluxValue); //reaction abbreviation label and combo JLabel reactionAbbreviationLabel = new JLabel(); reactionAbbreviationLabel.setText(ColumnInterfaceConstants.REACTION_ABBREVIATION_LABEL); reactionAbbreviationLabel.setPreferredSize(new Dimension(250, 25)); reactionAbbreviationLabel.setMaximumSize(new Dimension(250, 25)); reactionAbbreviationLabel.setMinimumSize(new Dimension(250, 25)); reactionAbbreviationLabel.setBorder(BorderFactory.createEmptyBorder(ColumnInterfaceConstants.LABEL_TOP_BORDER_SIZE,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); reactionAbbreviationLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelReactionAbbreviationLabel = new JPanel(); panelReactionAbbreviationLabel.setLayout(new BoxLayout(panelReactionAbbreviationLabel, BoxLayout.X_AXIS)); panelReactionAbbreviationLabel.add(reactionAbbreviationLabel); panelReactionAbbreviationLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbReactionAbbreviationLabel.add(panelReactionAbbreviationLabel); hbReactionAbbreviationLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelReactionAbbreviation = new JPanel(); panelReactionAbbreviation.setLayout(new BoxLayout(panelReactionAbbreviation, BoxLayout.X_AXIS)); panelReactionAbbreviation.add(cbReactionAbbreviation); panelReactionAbbreviation.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelReactionAbbreviation.setAlignmentX(RIGHT_ALIGNMENT); hbReactionAbbreviation.add(panelReactionAbbreviation); hbReactionAbbreviation.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbReactionAbbreviationLabel); JLabel blankLabel1 = new JLabel(""); vbLabels.add(blankLabel1); vbCombos.add(hbReactionAbbreviation); //reaction name label and combo JLabel reactionNameLabel = new JLabel(); reactionNameLabel.setText(ColumnInterfaceConstants.REACTION_NAME_LABEL); reactionNameLabel.setPreferredSize(new Dimension(250, 25)); reactionNameLabel.setMaximumSize(new Dimension(250, 25)); reactionNameLabel.setMinimumSize(new Dimension(250, 25)); reactionNameLabel.setBorder(BorderFactory.createEmptyBorder(ColumnInterfaceConstants.LABEL_TOP_BORDER_SIZE,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); reactionNameLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelReactionNameLabel = new JPanel(); panelReactionNameLabel.setLayout(new BoxLayout(panelReactionNameLabel, BoxLayout.X_AXIS)); panelReactionNameLabel.add(reactionNameLabel); panelReactionNameLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbReactionNameLabel.add(panelReactionNameLabel); hbReactionNameLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelReactionName = new JPanel(); panelReactionName.setLayout(new BoxLayout(panelReactionName, BoxLayout.X_AXIS)); panelReactionName.add(cbReactionName); panelReactionName.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelReactionName.setAlignmentX(RIGHT_ALIGNMENT); hbReactionName.add(panelReactionName); hbReactionName.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbReactionNameLabel); JLabel blankLabel4 = new JLabel(""); vbLabels.add(blankLabel4); vbCombos.add(hbReactionName); //reaction equation label and combo JLabel reactionEquationLabel = new JLabel(); reactionEquationLabel.setText(ColumnInterfaceConstants.REACTION_EQUATION_LABEL); reactionEquationLabel.setPreferredSize(new Dimension(250, 25)); reactionEquationLabel.setMaximumSize(new Dimension(250, 25)); reactionEquationLabel.setMinimumSize(new Dimension(250, 25)); reactionEquationLabel.setBorder(BorderFactory.createEmptyBorder(ColumnInterfaceConstants.LABEL_TOP_BORDER_SIZE,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); reactionEquationLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelReactionEquationLabel = new JPanel(); panelReactionEquationLabel.setLayout(new BoxLayout(panelReactionEquationLabel, BoxLayout.X_AXIS)); panelReactionEquationLabel.add(reactionEquationLabel); panelReactionEquationLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbReactionEquationLabel.add(panelReactionEquationLabel); hbReactionEquationLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelReactionEquation = new JPanel(); panelReactionEquation.setLayout(new BoxLayout(panelReactionEquation, BoxLayout.X_AXIS)); panelReactionEquation.add(cbReactionEquation); panelReactionEquation.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelReactionEquation.setAlignmentX(RIGHT_ALIGNMENT); hbReactionEquation.add(panelReactionEquation); hbReactionEquation.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbReactionEquationLabel); JLabel blankLabel5 = new JLabel(""); vbLabels.add(blankLabel5); vbCombos.add(hbReactionEquation); //reversible label and combo JLabel reversibleLabel = new JLabel(); reversibleLabel.setText(ColumnInterfaceConstants.REVERSIBLE_LABEL); reversibleLabel.setPreferredSize(new Dimension(250, 25)); reversibleLabel.setMaximumSize(new Dimension(250, 25)); reversibleLabel.setMinimumSize(new Dimension(250, 25)); reversibleLabel.setBorder(BorderFactory.createEmptyBorder(ColumnInterfaceConstants.LABEL_TOP_BORDER_SIZE,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); reversibleLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelReversibleLabel = new JPanel(); panelReversibleLabel.setLayout(new BoxLayout(panelReversibleLabel, BoxLayout.X_AXIS)); panelReversibleLabel.add(reversibleLabel); panelReversibleLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbReversibleLabel.add(panelReversibleLabel); hbReversibleLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelReversible = new JPanel(); panelReversible.setLayout(new BoxLayout(panelReversible, BoxLayout.X_AXIS)); panelReversible.add(cbReversible); panelReversible.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelReversible.setAlignmentX(RIGHT_ALIGNMENT); hbReversible.add(panelReversible); hbReversible.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbReversibleLabel); JLabel blankLabel6 = new JLabel(""); vbLabels.add(blankLabel6); vbCombos.add(hbReversible); //lower bound label and combo JLabel lowerBoundLabel = new JLabel(); lowerBoundLabel.setText(ColumnInterfaceConstants.LOWER_BOUND_LABEL); lowerBoundLabel.setPreferredSize(new Dimension(250, 25)); lowerBoundLabel.setMaximumSize(new Dimension(250, 25)); lowerBoundLabel.setMinimumSize(new Dimension(250, 25)); lowerBoundLabel.setBorder(BorderFactory.createEmptyBorder(ColumnInterfaceConstants.LABEL_TOP_BORDER_SIZE,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); lowerBoundLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelLowerBoundLabel = new JPanel(); panelLowerBoundLabel.setLayout(new BoxLayout(panelLowerBoundLabel, BoxLayout.X_AXIS)); panelLowerBoundLabel.add(lowerBoundLabel); panelLowerBoundLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbLowerBoundLabel.add(panelLowerBoundLabel); hbLowerBoundLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelLowerBound = new JPanel(); panelLowerBound.setLayout(new BoxLayout(panelLowerBound, BoxLayout.X_AXIS)); panelLowerBound.add(cbLowerBound); panelLowerBound.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelLowerBound.setAlignmentX(RIGHT_ALIGNMENT); hbLowerBound.add(panelLowerBound); hbLowerBound.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbLowerBoundLabel); JLabel blankLabel7 = new JLabel(""); vbLabels.add(blankLabel7); vbCombos.add(hbLowerBound); //upper bound label and combo JLabel upperBoundLabel = new JLabel(); upperBoundLabel.setText(ColumnInterfaceConstants.UPPER_BOUND_LABEL); upperBoundLabel.setPreferredSize(new Dimension(250, 25)); upperBoundLabel.setMaximumSize(new Dimension(250, 25)); upperBoundLabel.setMinimumSize(new Dimension(250, 25)); upperBoundLabel.setBorder(BorderFactory.createEmptyBorder(ColumnInterfaceConstants.LABEL_TOP_BORDER_SIZE,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); upperBoundLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelUpperBoundLabel = new JPanel(); panelUpperBoundLabel.setLayout(new BoxLayout(panelUpperBoundLabel, BoxLayout.X_AXIS)); panelUpperBoundLabel.add(upperBoundLabel); panelUpperBoundLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbUpperBoundLabel.add(panelUpperBoundLabel); hbUpperBoundLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelUpperBound = new JPanel(); panelUpperBound.setLayout(new BoxLayout(panelUpperBound, BoxLayout.X_AXIS)); panelUpperBound.add(cbUpperBound); panelUpperBound.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelUpperBound.setAlignmentX(RIGHT_ALIGNMENT); hbUpperBound.add(panelUpperBound); hbUpperBound.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbUpperBoundLabel); JLabel blankLabel8 = new JLabel(""); vbLabels.add(blankLabel8); vbCombos.add(hbUpperBound); //biological objective label and combo JLabel biologicalObjectiveLabel = new JLabel(); biologicalObjectiveLabel.setText(ColumnInterfaceConstants.BIOLOGICAL_OBJECTIVE_LABEL); biologicalObjectiveLabel.setPreferredSize(new Dimension(250, 25)); biologicalObjectiveLabel.setMaximumSize(new Dimension(250, 25)); biologicalObjectiveLabel.setMinimumSize(new Dimension(250, 25)); biologicalObjectiveLabel.setBorder(BorderFactory.createEmptyBorder(ColumnInterfaceConstants.LABEL_TOP_BORDER_SIZE,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); biologicalObjectiveLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelBiologicalObjectiveLabel = new JPanel(); panelBiologicalObjectiveLabel.setLayout(new BoxLayout(panelBiologicalObjectiveLabel, BoxLayout.X_AXIS)); panelBiologicalObjectiveLabel.add(biologicalObjectiveLabel); panelBiologicalObjectiveLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbBiologicalObjectiveLabel.add(panelBiologicalObjectiveLabel); hbBiologicalObjectiveLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelBiologicalObjective = new JPanel(); panelBiologicalObjective.setLayout(new BoxLayout(panelBiologicalObjective, BoxLayout.X_AXIS)); panelBiologicalObjective.add(cbBiologicalObjective); panelBiologicalObjective.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelBiologicalObjective.setAlignmentX(RIGHT_ALIGNMENT); hbBiologicalObjective.add(panelBiologicalObjective); hbBiologicalObjective.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbBiologicalObjectiveLabel); JLabel blankLabel9 = new JLabel(""); vbLabels.add(blankLabel9); vbCombos.add(hbBiologicalObjective); //synthetic objective label and combo JLabel syntheticObjectiveLabel = new JLabel(); syntheticObjectiveLabel.setText(ColumnInterfaceConstants.SYNTHETIC_OBJECTIVE_LABEL); syntheticObjectiveLabel.setPreferredSize(new Dimension(250, 25)); syntheticObjectiveLabel.setMaximumSize(new Dimension(250, 25)); syntheticObjectiveLabel.setMinimumSize(new Dimension(250, 25)); syntheticObjectiveLabel.setBorder(BorderFactory.createEmptyBorder(ColumnInterfaceConstants.LABEL_TOP_BORDER_SIZE,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); syntheticObjectiveLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelSyntheticObjectiveLabel = new JPanel(); panelSyntheticObjectiveLabel.setLayout(new BoxLayout(panelSyntheticObjectiveLabel, BoxLayout.X_AXIS)); panelSyntheticObjectiveLabel.add(syntheticObjectiveLabel); panelSyntheticObjectiveLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbSyntheticObjectiveLabel.add(panelSyntheticObjectiveLabel); hbSyntheticObjectiveLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelSyntheticObjective = new JPanel(); panelSyntheticObjective.setLayout(new BoxLayout(panelSyntheticObjective, BoxLayout.X_AXIS)); panelSyntheticObjective.add(cbSyntheticObjective); panelSyntheticObjective.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelSyntheticObjective.setAlignmentX(RIGHT_ALIGNMENT); hbSyntheticObjective.add(panelSyntheticObjective); hbSyntheticObjective.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbSyntheticObjectiveLabel); JLabel blankLabel10 = new JLabel(""); vbLabels.add(blankLabel10); vbCombos.add(hbSyntheticObjective); //gene association label and combo JLabel geneAssociationLabel = new JLabel(); geneAssociationLabel.setText(ColumnInterfaceConstants.GENE_ASSOCIATION_LABEL); geneAssociationLabel.setPreferredSize(new Dimension(250, 25)); geneAssociationLabel.setMaximumSize(new Dimension(250, 25)); geneAssociationLabel.setMinimumSize(new Dimension(250, 25)); geneAssociationLabel.setBorder(BorderFactory.createEmptyBorder(ColumnInterfaceConstants.LABEL_TOP_BORDER_SIZE,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); geneAssociationLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelGeneAssociationLabel = new JPanel(); panelGeneAssociationLabel.setLayout(new BoxLayout(panelGeneAssociationLabel, BoxLayout.X_AXIS)); panelGeneAssociationLabel.add(geneAssociationLabel); panelGeneAssociationLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbGeneAssociationLabel.add(panelGeneAssociationLabel); hbGeneAssociationLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelGeneAssociation = new JPanel(); panelGeneAssociation.setLayout(new BoxLayout(panelGeneAssociation, BoxLayout.X_AXIS)); panelGeneAssociation.add(cbGeneAssociation); panelGeneAssociation.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelGeneAssociation.setAlignmentX(RIGHT_ALIGNMENT); hbGeneAssociation.add(panelGeneAssociation); hbGeneAssociation.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbGeneAssociationLabel); JLabel blankLabel11 = new JLabel(""); vbLabels.add(blankLabel11); vbCombos.add(hbGeneAssociation); //protein association label and combo JLabel proteinAssociationLabel = new JLabel(); proteinAssociationLabel.setText(ColumnInterfaceConstants.PROTEIN_ASSOCIATION_LABEL); proteinAssociationLabel.setPreferredSize(new Dimension(250, 25)); proteinAssociationLabel.setMaximumSize(new Dimension(250, 25)); proteinAssociationLabel.setMinimumSize(new Dimension(250, 25)); proteinAssociationLabel.setBorder(BorderFactory.createEmptyBorder(ColumnInterfaceConstants.LABEL_TOP_BORDER_SIZE,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); proteinAssociationLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelProteinAssociationLabel = new JPanel(); panelProteinAssociationLabel.setLayout(new BoxLayout(panelProteinAssociationLabel, BoxLayout.X_AXIS)); panelProteinAssociationLabel.add(proteinAssociationLabel); panelProteinAssociationLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbProteinAssociationLabel.add(panelProteinAssociationLabel); hbProteinAssociationLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelProteinAssociation = new JPanel(); panelProteinAssociation.setLayout(new BoxLayout(panelProteinAssociation, BoxLayout.X_AXIS)); panelProteinAssociation.add(cbProteinAssociation); panelProteinAssociation.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelProteinAssociation.setAlignmentX(RIGHT_ALIGNMENT); hbProteinAssociation.add(panelProteinAssociation); hbProteinAssociation.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbProteinAssociationLabel); JLabel blankLabel12 = new JLabel(""); vbLabels.add(blankLabel12); vbCombos.add(hbProteinAssociation); //subsystem label and combo JLabel subsystemLabel = new JLabel(); subsystemLabel.setText(ColumnInterfaceConstants.SUBSYSTEM_LABEL); subsystemLabel.setPreferredSize(new Dimension(250, 25)); subsystemLabel.setMaximumSize(new Dimension(250, 25)); subsystemLabel.setMinimumSize(new Dimension(250, 25)); subsystemLabel.setBorder(BorderFactory.createEmptyBorder(ColumnInterfaceConstants.LABEL_TOP_BORDER_SIZE,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); subsystemLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelSubsystemLabel = new JPanel(); panelSubsystemLabel.setLayout(new BoxLayout(panelSubsystemLabel, BoxLayout.X_AXIS)); panelSubsystemLabel.add(subsystemLabel); panelSubsystemLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbSubsystemLabel.add(panelSubsystemLabel); hbSubsystemLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelSubsystem = new JPanel(); panelSubsystem.setLayout(new BoxLayout(panelSubsystem, BoxLayout.X_AXIS)); panelSubsystem.add(cbSubsystem); panelSubsystem.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelSubsystem.setAlignmentX(RIGHT_ALIGNMENT); hbSubsystem.add(panelSubsystem); hbSubsystem.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbSubsystemLabel); JLabel blankLabel13 = new JLabel(""); vbLabels.add(blankLabel13); vbCombos.add(hbSubsystem); //protein class label and combo JLabel proteinClassLabel = new JLabel(); proteinClassLabel.setText(ColumnInterfaceConstants.PROTEIN_CLASS_LABEL); proteinClassLabel.setPreferredSize(new Dimension(250, 25)); proteinClassLabel.setMaximumSize(new Dimension(250, 25)); proteinClassLabel.setMinimumSize(new Dimension(250, 25)); proteinClassLabel.setBorder(BorderFactory.createEmptyBorder(ColumnInterfaceConstants.LABEL_TOP_BORDER_SIZE,0,ColumnInterfaceConstants.LABEL_BOTTOM_BORDER_SIZE,10)); proteinClassLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelProteinClassLabel = new JPanel(); panelProteinClassLabel.setLayout(new BoxLayout(panelProteinClassLabel, BoxLayout.X_AXIS)); panelProteinClassLabel.add(proteinClassLabel); panelProteinClassLabel.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); hbProteinClassLabel.add(panelProteinClassLabel); hbProteinClassLabel.setAlignmentX(LEFT_ALIGNMENT); JPanel panelProteinClass = new JPanel(); panelProteinClass.setLayout(new BoxLayout(panelProteinClass, BoxLayout.X_AXIS)); panelProteinClass.add(cbProteinClass); panelProteinClass.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); panelProteinClass.setAlignmentX(RIGHT_ALIGNMENT); hbProteinClass.add(panelProteinClass); hbProteinClass.setAlignmentX(RIGHT_ALIGNMENT); vbLabels.add(hbProteinClassLabel); JLabel blankLabel14 = new JLabel(""); vbLabels.add(blankLabel14); vbCombos.add(hbProteinClass); JLabel required = new JLabel(ColumnInterfaceConstants.REQUIRED_LABEL); hbRequiredLabel.add(required); okButton.setMnemonic(KeyEvent.VK_O); JLabel blank = new JLabel(" "); cancelButton.setMnemonic(KeyEvent.VK_C); JLabel blank1 = new JLabel(" "); prevRowButton.setMnemonic(KeyEvent.VK_P); JLabel blank2 = new JLabel(" "); nextRowButton.setMnemonic(KeyEvent.VK_N); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.add(okButton); buttonPanel.add(blank); buttonPanel.add(cancelButton); buttonPanel.add(blank1); buttonPanel.add(prevRowButton); buttonPanel.add(blank2); buttonPanel.add(nextRowButton); buttonPanel.add(rowLabel); buttonPanel.setBorder(BorderFactory.createEmptyBorder(10,20,20,20)); hbButton.add(buttonPanel); vb.add(hbLabels); hbLabeledCombos.add(vbLabels); hbLabeledCombos.add(vbCombos); vb.add(hbLabeledCombos); vb.add(hbRequiredLabel); vb.add(hbButton); add(vb); ActionListener okButtonActionListener = new ActionListener() { public void actionPerformed(ActionEvent prodActionEvent) { /* if (cbReactionAbbreviation.getSelectedIndex() == -1 || cbReactionEquation.getSelectedIndex() == -1) { JOptionPane.showMessageDialog(null, ColumnInterfaceConstants.BLANK_REACTION_FIELDS_ERROR_MESSAGE, ColumnInterfaceConstants.BLANK_REACTION_FIELDS_ERROR_TITLE, JOptionPane.ERROR_MESSAGE); } else if (cbReactionAbbreviation.getSelectedItem().toString().toLowerCase().equals(GraphicalInterfaceConstants.METAB_ABBREVIATION_NOT_FILTER[0]) || cbReactionAbbreviation.getSelectedItem().toString().toLowerCase().equals(GraphicalInterfaceConstants.METAB_ABBREVIATION_NOT_FILTER[1]) || cbReactionAbbreviation.getSelectedItem().toString().toLowerCase().equals(GraphicalInterfaceConstants.METAB_ABBREVIATION_NOT_FILTER[2])) { JOptionPane.showMessageDialog(null, "Invalid name for Reaction Abbreviation column.", "Column Name Error", JOptionPane.ERROR_MESSAGE); } else { ArrayList<String> metaColumnNames = new ArrayList<String>(); ArrayList<Integer> usedIndices = new ArrayList<Integer>(); ArrayList<Integer> metaColumnIndexList = new ArrayList<Integer>(); if (getColumnNamesFromFile().contains(cbReactionAbbreviation.getSelectedItem())) { LocalConfig.getInstance().setReactionAbbreviationColumnIndex(getColumnNamesFromFile().indexOf(cbReactionAbbreviation.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbReactionAbbreviation.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbKnockout.getSelectedItem())) { LocalConfig.getInstance().setKnockoutColumnIndex(getColumnNamesFromFile().indexOf(cbKnockout.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbKnockout.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbFluxValue.getSelectedItem())) { LocalConfig.getInstance().setFluxValueColumnIndex(getColumnNamesFromFile().indexOf(cbFluxValue.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbFluxValue.getSelectedItem())); } if (cbReactionName.getSelectedIndex() == -1) { LocalConfig.getInstance().getHiddenReactionsColumns().add(GraphicalInterfaceConstants.REACTION_NAME_COLUMN); } else if (getColumnNamesFromFile().contains(cbReactionName.getSelectedItem())) { LocalConfig.getInstance().setReactionNameColumnIndex(getColumnNamesFromFile().indexOf(cbReactionName.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbReactionName.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbReactionEquation.getSelectedItem())) { LocalConfig.getInstance().setReactionEquationColumnIndex(getColumnNamesFromFile().indexOf(cbReactionEquation.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbReactionEquation.getSelectedItem())); } if (cbReversible.getSelectedIndex() == -1) { LocalConfig.getInstance().getHiddenReactionsColumns().add(GraphicalInterfaceConstants.REVERSIBLE_COLUMN); } else if (getColumnNamesFromFile().contains(cbReversible.getSelectedItem())) { LocalConfig.getInstance().setReversibleColumnIndex(getColumnNamesFromFile().indexOf(cbReversible.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbReversible.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbLowerBound.getSelectedItem())) { LocalConfig.getInstance().setLowerBoundColumnIndex(getColumnNamesFromFile().indexOf(cbLowerBound.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbLowerBound.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbUpperBound.getSelectedItem())) { LocalConfig.getInstance().setUpperBoundColumnIndex(getColumnNamesFromFile().indexOf(cbUpperBound.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbUpperBound.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbBiologicalObjective.getSelectedItem())) { LocalConfig.getInstance().setBiologicalObjectiveColumnIndex(getColumnNamesFromFile().indexOf(cbBiologicalObjective.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbBiologicalObjective.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbSyntheticObjective.getSelectedItem())) { LocalConfig.getInstance().setSyntheticObjectiveColumnIndex(getColumnNamesFromFile().indexOf(cbSyntheticObjective.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbSyntheticObjective.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbGeneAssociation.getSelectedItem())) { LocalConfig.getInstance().setGeneAssociationColumnIndex(getColumnNamesFromFile().indexOf(cbGeneAssociation.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbGeneAssociation.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbProteinAssociation.getSelectedItem())) { LocalConfig.getInstance().setProteinAssociationColumnIndex(getColumnNamesFromFile().indexOf(cbProteinAssociation.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbProteinAssociation.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbSubsystem.getSelectedItem())) { LocalConfig.getInstance().setSubsystemColumnIndex(getColumnNamesFromFile().indexOf(cbSubsystem.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbSubsystem.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbProteinClass.getSelectedItem())) { LocalConfig.getInstance().setProteinClassColumnIndex(getColumnNamesFromFile().indexOf(cbProteinClass.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbProteinClass.getSelectedItem())); } for (int i = 0; i < getColumnNamesFromFile().size(); i++) { if (!usedIndices.contains(i)) { metaColumnNames.add(getColumnNamesFromFile().get(i)); metaColumnIndexList.add(getColumnNamesFromFile().indexOf(getColumnNamesFromFile().get(i))); } } LocalConfig.getInstance().setReactionsMetaColumnIndexList(metaColumnIndexList); setVisible(false); dispose(); } */ } }; okButton.addActionListener(okButtonActionListener); ActionListener cancelButtonActionListener = new ActionListener() { public void actionPerformed(ActionEvent prodActionEvent) { setVisible(false); dispose(); } }; cancelButton.addActionListener(cancelButtonActionListener); ActionListener prevRowButtonActionListener = new ActionListener() { public void actionPerformed(ActionEvent prodActionEvent) { TextReactionsModelReader reader = new TextReactionsModelReader(); int correction = LocalConfig.getInstance().getReactionsNextRowCorrection(); if (correction > 0) { LocalConfig.getInstance().setReactionsNextRowCorrection(correction - 1); rowLabel.setText(" row " + (LocalConfig.getInstance().getReactionsNextRowCorrection() + 1)); ArrayList<String> newColumnNamesFromFile = reader.columnNamesFromFile(LocalConfig.getInstance().getReactionsCSVFile(), LocalConfig.getInstance().getReactionsNextRowCorrection()); setColumnNamesFromFile(newColumnNamesFromFile); populateNamesFromFileBoxes(newColumnNamesFromFile); } else { prevRowButton.setEnabled(false); } nextRowButton.setEnabled(true); } }; prevRowButton.addActionListener(prevRowButtonActionListener); ActionListener nextRowButtonActionListener = new ActionListener() { public void actionPerformed(ActionEvent prodActionEvent) { TextReactionsModelReader reader = new TextReactionsModelReader(); int correction = LocalConfig.getInstance().getReactionsNextRowCorrection(); if ((correction + 1) < reader.numberOfLines(LocalConfig.getInstance().getReactionsCSVFile())) { LocalConfig.getInstance().setReactionsNextRowCorrection(correction + 1); rowLabel.setText(" row " + (LocalConfig.getInstance().getReactionsNextRowCorrection() + 1)); ArrayList<String> newColumnNamesFromFile = reader.columnNamesFromFile(LocalConfig.getInstance().getReactionsCSVFile(), LocalConfig.getInstance().getReactionsNextRowCorrection()); setColumnNamesFromFile(newColumnNamesFromFile); populateNamesFromFileBoxes(newColumnNamesFromFile); } else { nextRowButton.setEnabled(false); } prevRowButton.setEnabled(true); } }; nextRowButton.addActionListener(nextRowButtonActionListener); } public void populateNamesFromFileBoxes(ArrayList<String> columnNamesFromFile) { LocalConfig.getInstance().setReactionAbbreviationColumnIndex(-1); LocalConfig.getInstance().setKnockoutColumnIndex(-1); LocalConfig.getInstance().setFluxValueColumnIndex(-1); LocalConfig.getInstance().setReactionNameColumnIndex(-1); LocalConfig.getInstance().setReactionEquationColumnIndex(-1); LocalConfig.getInstance().setReactionEquationNamesColumnIndex(-1); LocalConfig.getInstance().setReversibleColumnIndex(-1); LocalConfig.getInstance().setLowerBoundColumnIndex(-1); LocalConfig.getInstance().setUpperBoundColumnIndex(-1); LocalConfig.getInstance().setBiologicalObjectiveColumnIndex(-1); LocalConfig.getInstance().setSyntheticObjectiveColumnIndex(-1); LocalConfig.getInstance().setGeneAssociationColumnIndex(-1); LocalConfig.getInstance().setProteinAssociationColumnIndex(-1); LocalConfig.getInstance().setSubsystemColumnIndex(-1); LocalConfig.getInstance().setProteinClassColumnIndex(-1); cbReactionAbbreviation.removeAllItems(); cbKnockout.removeAllItems(); cbFluxValue.removeAllItems(); cbReactionName.removeAllItems(); cbReactionEquation.removeAllItems(); cbReversible.removeAllItems(); cbLowerBound.removeAllItems(); cbUpperBound.removeAllItems(); cbBiologicalObjective.removeAllItems(); cbSyntheticObjective.removeAllItems(); cbGeneAssociation.removeAllItems(); cbProteinAssociation.removeAllItems(); cbSubsystem.removeAllItems(); cbProteinClass.removeAllItems(); //add all column names to from file comboboxes for (int c = 0; c < columnNamesFromFile.size(); c++) { cbReactionAbbreviation.addItem(columnNamesFromFile.get(c)); cbKnockout.addItem(columnNamesFromFile.get(c)); cbFluxValue.addItem(columnNamesFromFile.get(c)); cbReactionName.addItem(columnNamesFromFile.get(c)); cbReactionEquation.addItem(columnNamesFromFile.get(c)); cbReversible.addItem(columnNamesFromFile.get(c)); cbLowerBound.addItem(columnNamesFromFile.get(c)); cbUpperBound.addItem(columnNamesFromFile.get(c)); cbBiologicalObjective.addItem(columnNamesFromFile.get(c)); cbSyntheticObjective.addItem(columnNamesFromFile.get(c)); cbGeneAssociation.addItem(columnNamesFromFile.get(c)); cbProteinAssociation.addItem(columnNamesFromFile.get(c)); cbSubsystem.addItem(columnNamesFromFile.get(c)); cbProteinClass.addItem(columnNamesFromFile.get(c)); } cbReactionAbbreviation.setSelectedIndex(-1); cbKnockout.setSelectedIndex(-1); cbFluxValue.setSelectedIndex(-1); cbReactionName.setSelectedIndex(-1); cbReactionEquation.setSelectedIndex(-1); cbReversible.setSelectedIndex(-1); cbLowerBound.setSelectedIndex(-1); cbUpperBound.setSelectedIndex(-1); cbBiologicalObjective.setSelectedIndex(-1); cbSyntheticObjective.setSelectedIndex(-1); cbGeneAssociation.setSelectedIndex(-1); cbProteinAssociation.setSelectedIndex(-1); cbSubsystem.setSelectedIndex(-1); cbProteinClass.setSelectedIndex(-1); for (int c = 0; c < columnNamesFromFile.size(); c++) { //filters to match column names from file to required column names in table if((columnNamesFromFile.get(c).toLowerCase()).compareTo(GraphicalInterfaceConstants.KNOCKOUT_COLUMN_FILTER[0]) == 0 || (columnNamesFromFile.get(c).toLowerCase()).compareTo(GraphicalInterfaceConstants.KNOCKOUT_COLUMN_FILTER[1]) == 0) { cbKnockout.setSelectedIndex(c); LocalConfig.getInstance().setKnockoutColumnIndex(c); } else if((columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.FLUX_VALUE_COLUMN_FILTER[0])) { cbFluxValue.setSelectedIndex(c); LocalConfig.getInstance().setFluxValueColumnIndex(c); } else if(((columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.ABBREVIATION_COLUMN_FILTER[0]) || (columnNamesFromFile.get(c).toLowerCase()).compareTo(GraphicalInterfaceConstants.ABBREVIATION_COLUMN_FILTER[1]) == 0) && !(columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.ABBREVIATION_COLUMN_NOT_FILTER[0])) { cbReactionAbbreviation.setSelectedIndex(c); LocalConfig.getInstance().setReactionAbbreviationColumnIndex(c); } else if((columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.NAME_COLUMN_FILTER[0]) && !(columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.NAME_COLUMN_NOT_FILTER[0])) { cbReactionName.setSelectedIndex(c); LocalConfig.getInstance().setReactionNameColumnIndex(c); } else if(((columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.EQUATION_COLUMN_FILTER[0]) || (columnNamesFromFile.get(c).toLowerCase()).equals(GraphicalInterfaceConstants.EQUATION_COLUMN_FILTER[1])) && !(columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.EQUATION_COLUMN_NOT_FILTER[0])) { cbReactionEquation.setSelectedIndex(c); LocalConfig.getInstance().setReactionEquationColumnIndex(c); } else if((columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.REVERSIBLE_COLUMN_FILTER[0])) { cbReversible.setSelectedIndex(c); LocalConfig.getInstance().setReversibleColumnIndex(c); } else if((columnNamesFromFile.get(c).toLowerCase()).compareTo(GraphicalInterfaceConstants.LOWER_BOUND_FILTER[0]) == 0 || (columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.LOWER_BOUND_FILTER[1])) { cbLowerBound.setSelectedIndex(c); LocalConfig.getInstance().setLowerBoundColumnIndex(c); } else if((columnNamesFromFile.get(c).toLowerCase()).compareTo(GraphicalInterfaceConstants.UPPER_BOUND_FILTER[0]) == 0 || (columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.UPPER_BOUND_FILTER[1])) { cbUpperBound.setSelectedIndex(c); LocalConfig.getInstance().setUpperBoundColumnIndex(c); } else if((columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.BIOLOGICAL_OBJECTIVE_FILTER[0]) && !(columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.BIOLOGICAL_OBJECTIVE_NOT_FILTER[0])) { cbBiologicalObjective.setSelectedIndex(c); LocalConfig.getInstance().setBiologicalObjectiveColumnIndex(c); } else if((columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.SYNTHETIC_OBJECTIVE_FILTER[0]) && !(columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.SYNTHETIC_OBJECTIVE_NOT_FILTER[0])) { cbSyntheticObjective.setSelectedIndex(c); LocalConfig.getInstance().setSyntheticObjectiveColumnIndex(c); } else if((columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.GENE_ASSOCIATION_COLUMN_FILTER[0]) && (columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.GENE_ASSOCIATION_COLUMN_FILTER[1])) { cbGeneAssociation.setSelectedIndex(c); LocalConfig.getInstance().setGeneAssociationColumnIndex(c); } else if((columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.PROTEIN_ASSOCIATION_COLUMN_FILTER[0]) && (columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.PROTEIN_ASSOCIATION_COLUMN_FILTER[1])) { cbProteinAssociation.setSelectedIndex(c); LocalConfig.getInstance().setProteinAssociationColumnIndex(c); } else if(((columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.SUBSYSTEM_COLUMN_FILTER[0]))) { cbSubsystem.setSelectedIndex(c); LocalConfig.getInstance().setSubsystemColumnIndex(c); } else if((columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.PROTEIN_CLASS_COLUMN_FILTER[0]) && (columnNamesFromFile.get(c).toLowerCase()).contains(GraphicalInterfaceConstants.PROTEIN_CLASS_COLUMN_FILTER[1])) { cbProteinClass.setSelectedIndex(c); LocalConfig.getInstance().setProteinClassColumnIndex(c); } } /* //csv files written by TextReactionWriter will have KO and fluxValue as col 1 and 2 if((columnNamesFromFile.get(0).toLowerCase()).compareTo(GraphicalInterfaceConstants.KNOCKOUT_COLUMN_FILTER[0]) == 0 || (columnNamesFromFile.get(0).toLowerCase()).compareTo(GraphicalInterfaceConstants.KNOCKOUT_COLUMN_FILTER[1]) == 0) { cbReactionAbbreviation.setSelectedIndex(2); LocalConfig.getInstance().setReactionAbbreviationColumnIndex(2); cbReactionName.setSelectedIndex(3); LocalConfig.getInstance().setReactionNameColumnIndex(3); cbReactionEquation.setSelectedIndex(4); LocalConfig.getInstance().setReactionEquationColumnIndex(4); } else { //first two columns are recommended to be column 1 and 2: abbreviation (id), and name cbReactionAbbreviation.setSelectedIndex(0); LocalConfig.getInstance().setReactionAbbreviationColumnIndex(0); cbReactionName.setSelectedIndex(1); LocalConfig.getInstance().setReactionNameColumnIndex(1); cbReactionEquation.setSelectedIndex(2); LocalConfig.getInstance().setReactionEquationColumnIndex(2); } */ } public void getColumnIndices() { if (cbReactionAbbreviation.getSelectedIndex() == -1 || cbReactionEquation.getSelectedIndex() == -1) { JOptionPane.showMessageDialog(null, ColumnInterfaceConstants.BLANK_REACTION_FIELDS_ERROR_MESSAGE, ColumnInterfaceConstants.BLANK_REACTION_FIELDS_ERROR_TITLE, JOptionPane.ERROR_MESSAGE); } else if (cbReactionAbbreviation.getSelectedItem().toString().toLowerCase().equals(GraphicalInterfaceConstants.METAB_ABBREVIATION_NOT_FILTER[0]) || cbReactionAbbreviation.getSelectedItem().toString().toLowerCase().equals(GraphicalInterfaceConstants.METAB_ABBREVIATION_NOT_FILTER[1]) || cbReactionAbbreviation.getSelectedItem().toString().toLowerCase().equals(GraphicalInterfaceConstants.METAB_ABBREVIATION_NOT_FILTER[2])) { JOptionPane.showMessageDialog(null, "Invalid name for Reaction Abbreviation column.", "Column Name Error", JOptionPane.ERROR_MESSAGE); } else { ArrayList<String> metaColumnNames = new ArrayList<String>(); ArrayList<Integer> usedIndices = new ArrayList<Integer>(); ArrayList<Integer> metaColumnIndexList = new ArrayList<Integer>(); if (getColumnNamesFromFile().contains(cbReactionAbbreviation.getSelectedItem())) { LocalConfig.getInstance().setReactionAbbreviationColumnIndex(getColumnNamesFromFile().indexOf(cbReactionAbbreviation.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbReactionAbbreviation.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbKnockout.getSelectedItem())) { LocalConfig.getInstance().setKnockoutColumnIndex(getColumnNamesFromFile().indexOf(cbKnockout.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbKnockout.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbFluxValue.getSelectedItem())) { LocalConfig.getInstance().setFluxValueColumnIndex(getColumnNamesFromFile().indexOf(cbFluxValue.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbFluxValue.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbReactionName.getSelectedItem())) { LocalConfig.getInstance().setReactionNameColumnIndex(getColumnNamesFromFile().indexOf(cbReactionName.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbReactionName.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbReactionEquation.getSelectedItem())) { LocalConfig.getInstance().setReactionEquationColumnIndex(getColumnNamesFromFile().indexOf(cbReactionEquation.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbReactionEquation.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbReversible.getSelectedItem())) { LocalConfig.getInstance().setReversibleColumnIndex(getColumnNamesFromFile().indexOf(cbReversible.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbReversible.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbLowerBound.getSelectedItem())) { LocalConfig.getInstance().setLowerBoundColumnIndex(getColumnNamesFromFile().indexOf(cbLowerBound.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbLowerBound.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbUpperBound.getSelectedItem())) { LocalConfig.getInstance().setUpperBoundColumnIndex(getColumnNamesFromFile().indexOf(cbUpperBound.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbUpperBound.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbBiologicalObjective.getSelectedItem())) { LocalConfig.getInstance().setBiologicalObjectiveColumnIndex(getColumnNamesFromFile().indexOf(cbBiologicalObjective.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbBiologicalObjective.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbSyntheticObjective.getSelectedItem())) { LocalConfig.getInstance().setSyntheticObjectiveColumnIndex(getColumnNamesFromFile().indexOf(cbSyntheticObjective.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbSyntheticObjective.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbGeneAssociation.getSelectedItem())) { LocalConfig.getInstance().setGeneAssociationColumnIndex(getColumnNamesFromFile().indexOf(cbGeneAssociation.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbGeneAssociation.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbProteinAssociation.getSelectedItem())) { LocalConfig.getInstance().setProteinAssociationColumnIndex(getColumnNamesFromFile().indexOf(cbProteinAssociation.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbProteinAssociation.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbSubsystem.getSelectedItem())) { LocalConfig.getInstance().setSubsystemColumnIndex(getColumnNamesFromFile().indexOf(cbSubsystem.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbSubsystem.getSelectedItem())); } if (getColumnNamesFromFile().contains(cbProteinClass.getSelectedItem())) { LocalConfig.getInstance().setProteinClassColumnIndex(getColumnNamesFromFile().indexOf(cbProteinClass.getSelectedItem())); usedIndices.add(getColumnNamesFromFile().indexOf(cbProteinClass.getSelectedItem())); } for (int i = 0; i < getColumnNamesFromFile().size(); i++) { if (!usedIndices.contains(i) && !getColumnNamesFromFile().get(i).equals(GraphicalInterfaceConstants.REACTIONS_COLUMN_IGNORE_LIST[0])) { metaColumnNames.add(getColumnNamesFromFile().get(i)); metaColumnIndexList.add(getColumnNamesFromFile().indexOf(getColumnNamesFromFile().get(i))); } } LocalConfig.getInstance().setReactionsMetaColumnNames(metaColumnNames); LocalConfig.getInstance().setReactionsMetaColumnIndexList(metaColumnIndexList); } } public static void main(String[] args) throws Exception { //based on code from http:stackoverflow.com/questions/6403821/how-to-add-an-image-to-a-jframe-title-bar final ArrayList<Image> icons = new ArrayList<Image>(); icons.add(new ImageIcon("etc/most16.jpg").getImage()); icons.add(new ImageIcon("etc/most32.jpg").getImage()); ArrayList<String> list = new ArrayList<String>(); list.add("test"); list.add("test"); list.add("test"); ReactionColumnNameInterface frame = new ReactionColumnNameInterface(list); frame.setIconImages(icons); //frame.setSize(600, 510); frame.setSize(600, 650); frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package nsbmstudentenrollmentsystem; import java.sql.*; import javax.swing.JOptionPane; /** * * @author Achintha */ public class subject extends javax.swing.JFrame { /** * Creates new form subject */ public subject() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel2 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); code = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); subject = new javax.swing.JTextField(); lecturer = new javax.swing.JTextField(); instructor = new javax.swing.JTextField(); credit = new javax.swing.JTextField(); jButton2 = new javax.swing.JButton(); jLabel2.setText("jLabel2"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Subjects"); setBackground(new java.awt.Color(255, 255, 255)); jPanel1.setBackground(new java.awt.Color(255, 255, 255)); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Subjects", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 3, 24), new java.awt.Color(0, 51, 255))); // NOI18N jLabel1.setFont(new java.awt.Font("Calibri", 3, 14)); // NOI18N jLabel1.setForeground(new java.awt.Color(51, 102, 255)); jLabel1.setText("Subject Code :"); code.setFont(new java.awt.Font("Calibri", 3, 12)); // NOI18N code.setForeground(new java.awt.Color(102, 102, 102)); jButton1.setBackground(new java.awt.Color(255, 255, 255)); jButton1.setFont(new java.awt.Font("Calibri", 3, 12)); // NOI18N jButton1.setForeground(new java.awt.Color(51, 102, 255)); jButton1.setText("Search"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jLabel3.setFont(new java.awt.Font("Calibri", 3, 14)); // NOI18N jLabel3.setForeground(new java.awt.Color(51, 102, 255)); jLabel3.setText("Subject :"); jLabel4.setFont(new java.awt.Font("Calibri", 3, 14)); // NOI18N jLabel4.setForeground(new java.awt.Color(51, 102, 255)); jLabel4.setText("Lecturer :"); jLabel5.setFont(new java.awt.Font("Calibri", 3, 14)); // NOI18N jLabel5.setForeground(new java.awt.Color(51, 102, 255)); jLabel5.setText("Instructor :"); jLabel6.setFont(new java.awt.Font("Calibri", 3, 14)); // NOI18N jLabel6.setForeground(new java.awt.Color(51, 102, 255)); jLabel6.setText("Credits :"); subject.setFont(new java.awt.Font("Calibri", 3, 12)); // NOI18N subject.setForeground(new java.awt.Color(102, 102, 102)); lecturer.setFont(new java.awt.Font("Calibri", 3, 12)); // NOI18N lecturer.setForeground(new java.awt.Color(102, 102, 102)); instructor.setFont(new java.awt.Font("Calibri", 3, 12)); // NOI18N instructor.setForeground(new java.awt.Color(102, 102, 102)); credit.setFont(new java.awt.Font("Calibri", 3, 12)); // NOI18N credit.setForeground(new java.awt.Color(102, 102, 102)); jButton2.setBackground(new java.awt.Color(255, 255, 255)); jButton2.setFont(new java.awt.Font("Calibri", 3, 12)); // NOI18N jButton2.setForeground(new java.awt.Color(51, 102, 255)); jButton2.setText("OK"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(code, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(39, 39, 39) .addComponent(jButton1)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(subject)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lecturer)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(instructor)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(credit)))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(159, 159, 159) .addComponent(jButton2))) .addContainerGap(47, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(code) .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(55, 55, 55) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE) .addComponent(subject)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE) .addComponent(lecturer)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE) .addComponent(instructor)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE) .addComponent(credit)) .addGap(66, 66, 66) .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(83, 83, 83)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed NewOptionAdmin oa = new NewOptionAdmin(); oa.setVisible(true); dispose(); }//GEN-LAST:event_jButton2ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed DBOperation dbops = new DBOperation(); ResultSet rs = null; String sub = "subject_name"; String lec = "lec_name"; String ins = "ins_name"; String cre = "credit"; rs = dbops.find(code.getText()); try{ if(rs.next()){ subject.setText(rs.getString(sub)); lecturer.setText(rs.getString(lec)); instructor.setText(rs.getString(ins)); credit.setText(rs.getString(cre)); } else JOptionPane.showMessageDialog(null, "No data for this ID"); }catch(Exception e){System.out.println(e);} }//GEN-LAST:event_jButton1ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(subject.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(subject.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(subject.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(subject.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new subject().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField code; private javax.swing.JTextField credit; private javax.swing.JTextField instructor; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JPanel jPanel1; private javax.swing.JTextField lecturer; private javax.swing.JTextField subject; // End of variables declaration//GEN-END:variables }
package com.kc.springmicroservice.employeeservice.dao; import org.springframework.data.repository.PagingAndSortingRepository; import com.kc.springmicroservice.employeeservice.dao.model.Employee; public interface EmployeeRepository extends PagingAndSortingRepository<Employee, Long> { }
package com.example.mydemo; import com.example.demo.MyBean; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.junit4.SpringRunner; @MySpringBootTestAnnotation @RunWith(SpringRunner.class) public class DemoApplicationTests { @Autowired private MyBean myBean; @Test public void contextLoads() { } }
package com.tripper.db.entities; import androidx.room.ColumnInfo; import androidx.room.Entity; import androidx.room.PrimaryKey; import androidx.room.TypeConverters; import com.tripper.db.converters.CalendarTypeConverter; import java.util.Calendar; @Entity(tableName = "day") public class Day { @PrimaryKey(autoGenerate = true) public long id; @ColumnInfo(name="date") @TypeConverters({CalendarTypeConverter.class}) public Calendar date; @ColumnInfo(name="trip_id") public long tripId; @ColumnInfo(name="location_name") public String locationName; @ColumnInfo(name="location_lat") public String locationLat; @ColumnInfo(name="location_lon") public String locationLon; }
package com.example.Muitos_Para_Muitos.Models; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.fasterxml.jackson.annotation.ObjectIdGenerators; @Entity @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id") public class Student implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(name = "name") private String name; @Column(name = "email") private String email; @Column(name = "password") private String password; @ManyToMany @JoinTable(name="student_subject", joinColumns = {@JoinColumn(name = "studentId")}, inverseJoinColumns = {@JoinColumn( name = "subjectId" )}) private List<Subject> subjectList = new ArrayList<>(); public Student() { } public Student(Long id, String name, String email, String password, List<Subject> subjectList) { super(); this.id = id; this.name = name; this.email = email; this.password = password; this.subjectList = subjectList; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public void setPassword(String password) { this.password = password; } public String getPassword() { return password; } public List<Subject> getSubjectList() { return subjectList; } public void setSubjectList(List<Subject> subjectList) { this.subjectList = subjectList; } @Override public int hashCode() { return Objects.hash(email, id, name, subjectList); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Student other = (Student) obj; return Objects.equals(email, other.email) && Objects.equals(id, other.id) && Objects.equals(name, other.name) && Objects.equals(subjectList, other.subjectList); } @Override public String toString() { return "Student [id=" + id + ", name=" + name + ", email=" + email + ", subjectList=" + subjectList + "]"; } }
package com.denali.app.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import java.util.concurrent.ThreadPoolExecutor; /** * @Author : sen * Created by IDEA on 2019-12-08. */ @Configuration public class AppWebConfigure { /** * 注册异步线程池 */ @Bean("appAsyncThreadPool") public ThreadPoolTaskExecutor asyncThreadPoolTaskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(5); executor.setMaxPoolSize(20); executor.setQueueCapacity(50); executor.setKeepAliveSeconds(30); executor.setThreadNamePrefix("App-Async-Thread"); executor.setWaitForTasksToCompleteOnShutdown(true); executor.setAwaitTerminationSeconds(60); executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); executor.initialize(); return executor; } }
package com.proxiad.games.extranet.enums; import lombok.AllArgsConstructor; import lombok.Getter; @AllArgsConstructor @Getter public enum SexeEnum { MALE(1), FEMALE(2); private int code; }
package com.ut.healthelink.service; import java.io.InputStream; import java.util.List; import javax.servlet.http.HttpServletRequest; import com.ut.healthelink.model.custom.LogoInfo; import com.ut.healthelink.model.custom.LookUpTable; import com.ut.healthelink.model.custom.TableData; import com.ut.healthelink.model.lutables.lu_Counties; import com.ut.healthelink.model.lutables.lu_GeneralHealthStatuses; import com.ut.healthelink.model.lutables.lu_GeneralHealths; import com.ut.healthelink.model.lutables.lu_Immunizations; import com.ut.healthelink.model.lutables.lu_Manufacturers; import com.ut.healthelink.model.lutables.lu_MedicalConditions; import com.ut.healthelink.model.lutables.lu_Medications; import com.ut.healthelink.model.lutables.lu_Procedures; import com.ut.healthelink.model.lutables.lu_ProcessStatus; import com.ut.healthelink.model.lutables.lu_Tests; import com.ut.healthelink.model.Macros; import com.ut.healthelink.model.MoveFilesLog; import com.ut.healthelink.model.mainHL7Details; import com.ut.healthelink.model.mainHL7Elements; import com.ut.healthelink.model.mainHL7Segments; /** * 1. sysAdminManager should handle the adding, deleting and modifying lu_ table items 2. It should * * @author gchan * */ public interface sysAdminManager { /** * about 90% of our tables fall into the standard table category, which is id, displayText, description, status and isCustom) * */ List<LookUpTable> getTableList(String searchTerm); Integer findTotalLookUpTable(); LookUpTable getTableInfo(String urlId); List<TableData> getDataList(String utTableName, String searchTerm); Integer findTotalDataRows(String utTableName); boolean deleteDataItem(String utTableName, int id); TableData getTableData(Integer id, String utTableName); void createTableDataHibernate(TableData tableData, String utTableName); boolean updateTableData(TableData tableData, String utTableName); List<Macros> getMarcoList(String searchTerm); Long findTotalMacroRows(); Long findtotalHL7Entries(); Long findtotalNewsArticles(); String addWildCardSearch(String searchTerm); String addWildCardLUSearch(String searchTerm); boolean deleteMacro(int id); void createMacro(Macros macro); boolean updateMacro(Macros macro); void createCounty(lu_Counties luc); lu_Counties getCountyById(int id); void updateCounty(lu_Counties luc); void createGeneralHealth(lu_GeneralHealths lu); lu_GeneralHealths getGeneralHealthById(int id); void updateGeneralHealth(lu_GeneralHealths lu); void createGeneralHealthStatus(lu_GeneralHealthStatuses lu); lu_GeneralHealthStatuses getGeneralHealthStatusById(int id); void updateGeneralHealthStatus(lu_GeneralHealthStatuses lu); void createImmunization(lu_Immunizations lu); lu_Immunizations getImmunizationById(int id); void updateImmunization(lu_Immunizations lu); void createManufacturer(lu_Manufacturers lu); lu_Manufacturers getManufacturerById(int id); void updateManufacturer(lu_Manufacturers lu); void createMedicalCondition(lu_MedicalConditions lu); lu_MedicalConditions getMedicalConditionById(int id); void updateMedicalCondition(lu_MedicalConditions lu); void createMedication(lu_Medications lu); lu_Medications getMedicationById(int id); void updateMedication(lu_Medications lu); void createProcedure(lu_Procedures lu); lu_Procedures getProcedureById(int id); void updateProcedure(lu_Procedures lu); void createTest(lu_Tests lu); lu_Tests getTestById(int id); void updateTest(lu_Tests lu); void createProcessStatus(lu_ProcessStatus lu); lu_ProcessStatus getProcessStatusById(int id) throws Exception; void updateProcessStatus(lu_ProcessStatus lu); boolean logoExists(String fileName); LogoInfo getLogoInfo(); boolean updateLogoInfo(LogoInfo logoDetails); boolean writeFile(String path, InputStream inputStream, String directory); void copyFELogo(HttpServletRequest request, LogoInfo logoInfo); void copyBELogo(HttpServletRequest request, LogoInfo logoInfo); String getBowlinkLogoPath(); String getDeployedPath(HttpServletRequest request); String getFrontEndLogoPath(); String getBackEndLogoPath(); List<mainHL7Details> getHL7List() throws Exception; mainHL7Details getHL7Details(int hl7Id) throws Exception; List<mainHL7Segments> getHL7Segments(int hl7Id); List<mainHL7Elements> getHL7Elements(int hl7Id, int segmentId); int createHL7(mainHL7Details details); void updateHL7Details(mainHL7Details details); void updateHL7Segments(mainHL7Segments segment); void updateHL7Elements(mainHL7Elements element); int saveHL7Segment(mainHL7Segments newSegment); int saveHL7Element(mainHL7Elements newElement); List<lu_ProcessStatus> getAllProcessStatus() throws Exception; List<lu_ProcessStatus> getAllHistoryFormProcessStatus() throws Exception; Long findTotalUsers() throws Exception; List <MoveFilesLog> getMoveFilesLog (Integer statusId) throws Exception; void deleteMoveFilesLog(MoveFilesLog moveFilesLog) throws Exception; }
package com.example.listviewperformance; import java.util.ArrayList; import java.util.Random; public class Course { String name; String teachername; int lecture; public String getName() { return name; } public String getTeachername() { return teachername; } public int getLecture() { return lecture; } public static final String[] teachers = { "Sanjeev", "Sunil", "Dileep", "Ravi", "Abhishek", "Kunal" }; public static final String[] courseName = { "Android","C++","Java", "JS", "Python","Web Dev" }; public Course(String name, String teachername, int lecture) { this.name = name; this.teachername = teachername; this.lecture = lecture; } public static ArrayList<Course> generateNRandomCourses(int n){ ArrayList<Course> courses = new ArrayList<>(); Random r= new Random(); for(int i=0;i<n;i++){ Course course = new Course( teachers[r.nextInt(6)], courseName[r.nextInt(6)], 10+r.nextInt(10) ); courses.add(course); } return courses; } }
package com.self.modules.blog.dao; import com.self.modules.blog.entity.Blog; /** * BlogDao class * * @author SuYiyi * @date 2018/03/17 */ public interface BlogDao { public void save(Blog blog); public void update(Blog blog); public void delete(Blog blog); public Blog getById(Blog blog); }
package com.json.startup.service; import com.json.startup.model.Customer; public interface customerService { public boolean persistCustomer(Customer customer); }
package com.sss.anhlt2.demobindserviceusingbinder; import android.app.Service; import android.content.Intent; import android.media.MediaPlayer; import android.os.Binder; import android.os.IBinder; import android.support.annotation.Nullable; /** * Created by viettel on 04/09/2016. */ public class MusicService extends Service { private IBinder mBinder = new LocalBinder(); private MediaPlayer mMediaPlayer; public class LocalBinder extends Binder { MusicService getService() { return MusicService.this; } } @Nullable @Override public IBinder onBind(Intent intent) { return mBinder; } /** * * 2 callback onUnbind and onDestroy will stop service when call unbindService */ // @Override // public boolean onUnbind(Intent intent) { // stopMusic(); // return super.onUnbind(intent); // } // // @Override // public void onDestroy() { // stopMusic(); // super.onDestroy(); // } public void startMusic() { mMediaPlayer = MediaPlayer.create(this, R.raw.mai_mai_1_tinh_yeu); mMediaPlayer.start(); } public void stopMusic() { if (mMediaPlayer != null) { mMediaPlayer.stop(); } } }
package view.root_frame; import javax.swing.*; class Welcome { JPanel rootMainPanel; private JLabel welcomeLabel; }
package com.gmail.filoghost.holographicdisplays.api.line; public interface TextLine extends TouchableLine { /** * Returns the current text of this TextLine. * * @return the current text of this line. */ public String getText(); /** * Sets the text of this TextLine. * * @param text the new text of this line. */ public void setText(String text); }
package com.test.automation.common.framework; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class XlsData { private Workbook workbook; private XSSFWorkbook workbk; public XlsData() { } /** * Opens an xls workbook * * @param filename */ public Workbook openWorkbook(String filename) { try { // System.out.println(new URI(filename)); File f = new File(filename); // InputStream f = new FileInputStream(filename); return workbook = Workbook.getWorkbook(f); } catch (BiffException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } catch (IOException e) { // TODO Auto-generated catch block // System.out.println("The file not found: " + e.getMessage()); return null; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } } /** * Opens an xls workbook * * @param stream */ public Workbook openWorkbook(InputStream stream) { try { // System.out.println(new URI(filename)); // File f = new File(filename); // InputStream f = new FileInputStream(filename); return workbook = Workbook.getWorkbook(stream); } catch (BiffException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } catch (IOException e) { // TODO Auto-generated catch block // System.out.println("The file not found: " + e.getMessage()); return null; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } } // public String[][] parseXLSSheet(String filename, int sheetNumber) public String[][] parseXLSSheet(String filename, String sheetName) { openWorkbook(filename); // Sheet sheet = workbook.getSheet(sheetNumber); Sheet sheet = workbook.getSheet(sheetName); int rows = sheet.getRows(); int cols = sheet.getColumns(); String[][] data = new String[rows][cols]; // for each row for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { // We are commenting this line to get right row count // and ignoring null row values // data[row][col] = sheet.getCell(col,row).getContents(); if (sheet.getCell(col, row).getContents().trim().length() >= 1 && sheet.getCell(col, row).getContents() != null) { data[row][col] = sheet.getCell(col, row).getContents(); } } } closeWorkbook(); return data; } /** * * @param filename * @param sheetName * @return */ public List<Map<String, String>> getTestEnvironmentDetails(String sRunApplicationType) { try { int ZERO = 0; // Columns defined in ConfigurationFile.xls in EnvData Sheet int ENV_APPLICATION_TYPE = 1; int ENV_TEST_ENVIRONMENT = 2; int ENV_EXECUTION_STATUS = 3; int ENV_LOGIN_ID = 4; int ENV_PASSWORD = 5; int ENV_APP_ADDRESS = 6; // Columns defined in ConfigurationFile.xls in AppLinks Sheet int APP_TEST_ENVIRONMENT = 0; int APP_APP_ADDRESS = 1; String sExpString = "YES"; List<Map<String, String>> table = new ArrayList<Map<String, String>>(); HashMap<String, String> rowMap = null; List<String> firstRow = new ArrayList<String>(); XlsData xlsdata = new XlsData(); String[][] envdata; String[][] appdata = null; String[][] retdata = null; retdata = new String[1][7]; String sFileName = "C:\\navymutual\\trunk\\resources\\ConfigurationFile.xls"; String sEnvSheetName = "EnvData"; String sAppSheetName = "AppLinks"; envdata = parseXLSSheet(sFileName, sEnvSheetName); appdata = parseXLSSheet(sFileName, sAppSheetName); if (envdata.length != appdata.length) { System.out.println( "Please define Test Config details all environments between EnvData and AppLinks data sheets. The number of rows should be the same."); return (null); } int iFound = 0; int iDataRow = 0; for (int row = 1; row < envdata.length; row++) { if (envdata[row][ENV_APPLICATION_TYPE].equalsIgnoreCase(sRunApplicationType)) { if (envdata[row][ENV_EXECUTION_STATUS].equalsIgnoreCase(sExpString)) { iFound++; iDataRow = row; } } } if (iFound == ZERO) { System.out.println("No Environment is configured for " + sRunApplicationType + " execution in Test Configuration file."); return (null); } else if (iFound > 1) { System.out.println("Please set 'YES' for only one Test environment..."); return (null); } else { if (!envdata[iDataRow][ENV_TEST_ENVIRONMENT] .equalsIgnoreCase(appdata[iDataRow][APP_TEST_ENVIRONMENT])) { System.out.println( "Environment Name does not match. Please maintain the same order of environments between EnvData and AppLinks Sheets..."); return (null); } else { rowMap = new HashMap<String, String>(); rowMap.put(envdata[ZERO][ENV_TEST_ENVIRONMENT], envdata[iDataRow][ENV_TEST_ENVIRONMENT]); rowMap.put(envdata[ZERO][ENV_EXECUTION_STATUS], envdata[iDataRow][ENV_EXECUTION_STATUS]); rowMap.put(envdata[ZERO][ENV_LOGIN_ID], envdata[iDataRow][ENV_LOGIN_ID]); rowMap.put(envdata[ZERO][ENV_PASSWORD], envdata[iDataRow][ENV_PASSWORD]); rowMap.put(appdata[ZERO][APP_APP_ADDRESS], appdata[iDataRow][APP_APP_ADDRESS]); table.add(rowMap); return table; } } } catch (Exception e) { System.out.println("getTestEnvironmentDetails failed..."); return (null); // TODO Auto-generated catch block } } // public String[][] parseXLSSheet(InputStream stream, int sheetNumber) public String[][] parseXLSSheet(InputStream stream, String sheetName) { openWorkbook(stream); // Sheet sheet = workbook.getSheet(sheetNumber); Sheet sheet = workbook.getSheet(sheetName); int rows = sheet.getRows(); int cols = sheet.getColumns(); String[][] data = new String[rows][cols]; // for each row for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { // We are commenting this line to get right row count // and ignoring null row values // data[row][col] = sheet.getCell(col,row).getContents(); if (sheet.getCell(col, row).getContents().trim().length() >= 1 && sheet.getCell(col, row).getContents() != null) { data[row][col] = sheet.getCell(col, row).getContents(); } } } closeWorkbook(); return data; } /** * Closes the workbook */ public void closeWorkbook() { workbook.close(); } /** * Opens an xlsx workbook * * @param stream */ public XSSFWorkbook openWorkbk(String filename) { try { //System.out.println(new URI(filename)); File f = new File(filename); FileInputStream file = new FileInputStream(f); // Get the workbook instance for XLS file workbk = new XSSFWorkbook(file); System.out.println("workbk : "+workbk); return workbk; } catch (IOException e) { // TODO Auto-generated catch block // System.out.println("The file not found: " + e.getMessage()); return null; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } } public List<Map<String, String>> parseXLSXSheetByCol(String filename, String sheetName) { // XSSFWorkbook wk = openWorkbk(filename); openWorkbk(filename); XSSFSheet sheet = workbk.getSheet(sheetName); XSSFRow row = null; List<Map<String, String>> table = new ArrayList<Map<String, String>>(); HashMap<String, String> rowMap = null; List<String> firstRow = new ArrayList<String>(); int i = 0; for (int colnum = sheet.getRow(i).getFirstCellNum() + 1; colnum < sheet.getRow(i).getLastCellNum(); colnum++) { if (sheet.getRow(colnum) != null) { rowMap = new HashMap<String, String>(); int j = 0; for (int rownum = sheet.getFirstRowNum() + 1; rownum <= sheet.getLastRowNum(); rownum++) { row = sheet.getRow(rownum); if (colnum == row.getFirstCellNum() + 1) { if (sheet.getRow(rownum).getCell(colnum).getStringCellValue() != null && sheet.getRow(rownum).getCell(colnum).getStringCellValue().length() != 0) { firstRow.add(sheet.getRow(rownum).getCell(colnum).getStringCellValue()); } } else { try { if (sheet.getRow(rownum).getCell(colnum).getStringCellValue() != null && sheet.getRow(rownum).getCell(colnum).getStringCellValue().length() > 0) { rowMap.put(firstRow.get(j), sheet.getRow(rownum).getCell(colnum).getStringCellValue()); j++; } } catch (Exception e) { } } } } if (colnum != sheet.getRow(i).getFirstCellNum() + 1) table.add(rowMap); i++; } System.out.println(table.size()); return table; } public List<Map<String, String>> parseXLSXSheetTypeByRow(String filename, String sheetName) { openWorkbk(filename); // System.out.println("Inside parseXLSXSheet"); XSSFSheet sheet = workbk.getSheet(sheetName); XSSFRow row = null; XSSFCell cell = null; List<Map<String, String>> table = new ArrayList<Map<String, String>>(); HashMap<String, String> rowMap = null; List<String> firstRow = new ArrayList<String>(); int i = 0; for (int rownum = sheet.getFirstRowNum(); rownum <= sheet.getLastRowNum(); rownum++) { row = sheet.getRow(rownum); if (row != null) { rowMap = new HashMap<String, String>(); int j = 0; for (int cellnum = row.getFirstCellNum(); cellnum < row.getLastCellNum(); cellnum++) { cell = row.getCell(cellnum); /* * if(cell.getStringCellValue() == null || * cell.getRawValue() == null){ continue; }else{ */ if (rownum == sheet.getFirstRowNum()) { firstRow.add(cell.getStringCellValue()); } else { try { if (cell.getStringCellValue().length() > 0) { rowMap.put(firstRow.get(j), cell.getStringCellValue()); } } catch (Exception e) { } } j++; } } if (rownum != sheet.getFirstRowNum()) table.add(rowMap); i++; } return table; } }
public class IceCream extends DessertItem { double icecreamCost; public IceCream() { // TODO Auto-generated constructor stub } public IceCream(double cost) { this.icecreamCost = cost; } @Override public double itemCost() { return this.icecreamCost; } }
package com.dokyme.alg4.sorting.application; import edu.princeton.cs.algs4.StdOut; import edu.princeton.cs.algs4.StdRandom; import static com.dokyme.alg4.sorting.basic.Example.*; /** * Created by intellij IDEA.But customed by hand of Dokyme. * * @author dokym * @date 2018/5/27-12:30 * Description: */ public class Select { public static Comparable select(Comparable[] a, int k) { StdRandom.shuffle(a); return select(a, k, 0, a.length - 1); } public static Comparable select(Comparable[] a, int k, int lo, int hi) { int mid = partion(a, lo, hi); if (mid < k) { return select(a, k, mid + 1, hi); } else if (mid > k) { return select(a, k, lo, mid - 1); } else { return a[k]; } } public static int partion(Comparable[] a, int lo, int hi) { Comparable v = a[lo]; int i = lo, j = hi + 1; while (true) { while (less(a[++i], v)) { if (i == hi) { break; } } while (less(v, a[--j])) ; if (i >= j) { break; } exch(a, i, j); } exch(a, lo, j); return j; } public static void main(String[] args) { Integer[] a = new Integer[1000]; for (int i = 0; i < 1000; i++) { a[i] = i; } StdOut.println(select(a, 500)); } }
package dev.tsnanh.vku.views.my_vku.teacher_evaluation; import androidx.lifecycle.LiveData; import androidx.lifecycle.ViewModel; import java.util.List; import dev.tsnanh.vku.domain.entities.Resource; import dev.tsnanh.vku.domain.entities.Teacher; import dev.tsnanh.vku.domain.usecases.RetrieveTeachersUseCase; import dev.tsnanh.vku.utils.SecretConstants; import kotlin.Lazy; import static org.koin.java.KoinJavaComponent.inject; public class TeacherEvaluationViewModel extends ViewModel { private Lazy<RetrieveTeachersUseCase> useCase = inject(RetrieveTeachersUseCase.class); public LiveData<Resource<List<Teacher>>> teachers = useCase.getValue().getTeachersLiveData(SecretConstants.TEACHERS_URL); }
package fr.aresrpg.tofumanchou.domain.event.group; import fr.aresrpg.commons.domain.event.Event; import fr.aresrpg.commons.domain.event.EventBus; import fr.aresrpg.dofus.structures.PartyErrorReason; import fr.aresrpg.tofumanchou.domain.data.Account; /** * * @since */ public class GroupCreateErrorEvent implements Event<GroupCreateErrorEvent> { private static final EventBus<GroupCreateErrorEvent> BUS = new EventBus<>(GroupCreateErrorEvent.class); private Account client; private PartyErrorReason reason; /** * @param client * @param reason */ public GroupCreateErrorEvent(Account client, PartyErrorReason reason) { this.client = client; this.reason = reason; } /** * @return the reason */ public PartyErrorReason getReason() { return reason; } /** * @param reason * the reason to set */ public void setReason(PartyErrorReason reason) { this.reason = reason; } /** * @param client * the client to set */ public void setClient(Account client) { this.client = client; } /** * @return the client */ public Account getClient() { return client; } @Override public EventBus<GroupCreateErrorEvent> getBus() { return BUS; } @Override public boolean isAsynchronous() { return false; } }
package com.corejava.collection; import java.util.HashMap; import java.util.Map; import java.util.Set; public class ConvertMapToSet { public static void main(String[] args) { Map<Integer,String> map=new HashMap<>(); map.put(1, "Ashutosh"); map.put(2, "Ramesh"); map.put(3, "Vinay"); Set<Map.Entry<Integer,String>> entrySet=map.entrySet(); for(Map.Entry<Integer, String> entry:entrySet) { System.out.println("keys:"+entry.getKey()); System.out.println("values:"+entry.getValue()); } } }
/* * 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 metodos; import java.util.Scanner; //import static metodos.Ej1.sumador; /** * * @author mati */ public class Ej2 { public static void main (String args[]) { double radio; Scanner intro = new Scanner(System.in); System.out.println("Introduzca un numero:"); radio = intro.nextDouble (); System.out.println("area es:" + area(radio)); System.out.println("longitud es:" + log(radio)); } public static double area (double x){ double suma=0; suma= Math.PI*(x*x); return suma; } public static double log (double x){ double suma=0; suma=Math.PI*x*2; return suma; } }
package com.software.accountservice.service; import java.math.BigInteger; /** * 用户账户服务层接口定义 */ public interface AccountService { /** * 根据用户id获取账户余额 * @param userId * @return */ BigInteger getUserBalanceByUserId(Integer userId); /** * 根据用户id,增加用户余额 * @param userId * @param amount */ void updateUserBalanceByUserId(Integer userId,BigInteger amount); }
package edu.duke.ra.core.result; import java.util.ArrayList; import java.util.List; import org.json.JSONObject; import edu.duke.ra.core.RAException; public class QuitQueryResult extends QueryResult { private static final String quitMessage = "Bye!\n\n"; private final String query; public QuitQueryResult(String query){ this.query = query; makeResult(); } @Override protected String makeQuery() { return query; } @Override protected JSONObject makeData() { JSONObject quitData = new JSONObject(); quitData.put(dataTextKey, quitMessage); return quitData; } @Override protected List<RAException> makeErrors() { return new ArrayList<>(); } @Override protected boolean makeQuit() { return true; } }
/** * This class is generated by jOOQ */ package schema.tables.records; import javax.annotation.Generated; import org.jooq.Field; import org.jooq.Record1; import org.jooq.Record3; import org.jooq.Row3; import org.jooq.impl.UpdatableRecordImpl; import schema.tables.BulkEmailCourseauthorization; /** * This class is generated by jOOQ. */ @Generated( value = { "http://www.jooq.org", "jOOQ version:3.8.4" }, comments = "This class is generated by jOOQ" ) @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class BulkEmailCourseauthorizationRecord extends UpdatableRecordImpl<BulkEmailCourseauthorizationRecord> implements Record3<Integer, String, Byte> { private static final long serialVersionUID = 1836964688; /** * Setter for <code>bitnami_edx.bulk_email_courseauthorization.id</code>. */ public void setId(Integer value) { set(0, value); } /** * Getter for <code>bitnami_edx.bulk_email_courseauthorization.id</code>. */ public Integer getId() { return (Integer) get(0); } /** * Setter for <code>bitnami_edx.bulk_email_courseauthorization.course_id</code>. */ public void setCourseId(String value) { set(1, value); } /** * Getter for <code>bitnami_edx.bulk_email_courseauthorization.course_id</code>. */ public String getCourseId() { return (String) get(1); } /** * Setter for <code>bitnami_edx.bulk_email_courseauthorization.email_enabled</code>. */ public void setEmailEnabled(Byte value) { set(2, value); } /** * Getter for <code>bitnami_edx.bulk_email_courseauthorization.email_enabled</code>. */ public Byte getEmailEnabled() { return (Byte) get(2); } // ------------------------------------------------------------------------- // Primary key information // ------------------------------------------------------------------------- /** * {@inheritDoc} */ @Override public Record1<Integer> key() { return (Record1) super.key(); } // ------------------------------------------------------------------------- // Record3 type implementation // ------------------------------------------------------------------------- /** * {@inheritDoc} */ @Override public Row3<Integer, String, Byte> fieldsRow() { return (Row3) super.fieldsRow(); } /** * {@inheritDoc} */ @Override public Row3<Integer, String, Byte> valuesRow() { return (Row3) super.valuesRow(); } /** * {@inheritDoc} */ @Override public Field<Integer> field1() { return BulkEmailCourseauthorization.BULK_EMAIL_COURSEAUTHORIZATION.ID; } /** * {@inheritDoc} */ @Override public Field<String> field2() { return BulkEmailCourseauthorization.BULK_EMAIL_COURSEAUTHORIZATION.COURSE_ID; } /** * {@inheritDoc} */ @Override public Field<Byte> field3() { return BulkEmailCourseauthorization.BULK_EMAIL_COURSEAUTHORIZATION.EMAIL_ENABLED; } /** * {@inheritDoc} */ @Override public Integer value1() { return getId(); } /** * {@inheritDoc} */ @Override public String value2() { return getCourseId(); } /** * {@inheritDoc} */ @Override public Byte value3() { return getEmailEnabled(); } /** * {@inheritDoc} */ @Override public BulkEmailCourseauthorizationRecord value1(Integer value) { setId(value); return this; } /** * {@inheritDoc} */ @Override public BulkEmailCourseauthorizationRecord value2(String value) { setCourseId(value); return this; } /** * {@inheritDoc} */ @Override public BulkEmailCourseauthorizationRecord value3(Byte value) { setEmailEnabled(value); return this; } /** * {@inheritDoc} */ @Override public BulkEmailCourseauthorizationRecord values(Integer value1, String value2, Byte value3) { value1(value1); value2(value2); value3(value3); return this; } // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- /** * Create a detached BulkEmailCourseauthorizationRecord */ public BulkEmailCourseauthorizationRecord() { super(BulkEmailCourseauthorization.BULK_EMAIL_COURSEAUTHORIZATION); } /** * Create a detached, initialised BulkEmailCourseauthorizationRecord */ public BulkEmailCourseauthorizationRecord(Integer id, String courseId, Byte emailEnabled) { super(BulkEmailCourseauthorization.BULK_EMAIL_COURSEAUTHORIZATION); set(0, id); set(1, courseId); set(2, emailEnabled); } }
package mf.fssq.mf_part_one; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.GridView; import android.widget.ImageView; import android.widget.TextView; import net.sqlcipher.Cursor; import net.sqlcipher.database.SQLiteDatabase; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import mf.fssq.mf_part_one.entity.Compare; import mf.fssq.mf_part_one.entity.ListRecord; import mf.fssq.mf_part_one.util.DetectAdapter; import mf.fssq.mf_part_one.util.DiaryDatabaseHelper; import mf.fssq.mf_part_one.util.MyAdapter; public class AchievementActivity extends AppCompatActivity { private GridView mGridview; private ImageView back; private List<ListRecord> date_list = new ArrayList<>(); private TextView sum,con; //region 开启沉浸模式 @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (hasFocus) { View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_achievement); initId(); initDateBase(); initListener(); initData(); } private void initData() { String sumtext="累计记录: "+date_list.size()+"天"; sum.setText(sumtext); if (date_list.size()==0){ con.setText("连续记录: 0天"); }else { int max=1; int temp=1; for (int i=1;i<date_list.size();i++) { Compare compare1=parting(date_list.get(i).getTitle()); int date1=compare1.getDate(); int month1=compare1.getMonth(); int year1=compare1.getYear(); Calendar calendar1=Calendar.getInstance(); calendar1.clear(); calendar1.set(year1,month1-1,date1); Log.w("compare","calendar1"+" "+year1+" "+month1+" "+date1); long millis1=calendar1.getTimeInMillis(); Log.w("compare"," millis1:"+millis1); Compare compare2=parting(date_list.get(i-1).getTitle()); int date2=compare2.getDate(); int month2=compare2.getMonth(); int year2=compare2.getYear(); Calendar calendar2=Calendar.getInstance(); calendar2.clear(); calendar2.set(year2,month2-1,date2); Log.w("compare","calendar2"+" "+year2+" "+month2+" "+date2); long millis2=calendar2.getTimeInMillis(); Log.w("compare"," millis2:"+millis2); if ((millis1-millis2)<=86400000){ temp++; }else { if (temp>max){ max=temp; } temp=1; } } int x=max>temp?max:temp; String context="连续记录: "+x+"天"; con.setText(context); } } private Compare parting(String str){ String []title=str.split("\\."); int month=0; int date=Integer.parseInt(title[0]); switch (title[1]){ case "January":month= 1;break; case "February":month= 2;break; case "March":month= 3;break; case "April":month= 4;break; case "May":month= 5;break; case "June":month= 6;break; case "July":month= 7;break; case "August":month= 8;break; case "September":month= 9;break; case "October":month= 10;break; case "November":month= 11;break; case "December":month= 12;break; } int year=Integer.parseInt(title[2]); return new Compare(date,month,year); } private void initListener() { back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } private void initId() { mGridview = findViewById(R.id.main_gridview); back=findViewById(R.id.back); sum=findViewById(R.id.sum); con=findViewById(R.id.con); } private void initDateBase() { //SQLCipher初始化时需要初始化库 SQLiteDatabase.loadLibs(this); //打开或创建数据库 DiaryDatabaseHelper mDiaryDatabaseHelper = new DiaryDatabaseHelper(this, "Diary.db", null, 1); SQLiteDatabase db = mDiaryDatabaseHelper.getReadableDatabase("token"); Cursor cursor = db.rawQuery("select title,week from Diary", null); //扫描数据库 while (cursor.moveToNext()) { Log.w("init", "数据库不为空,开始查询数据"); String title = cursor.getString(cursor.getColumnIndex("title")); String week = cursor.getString(cursor.getColumnIndex("week")); //创建一个Dairy对象存储一条数据 ListRecord listRecord = new ListRecord(title, week); date_list.add(listRecord); Log.w("init", "dairy存储形式" + date_list.toString()); } //关闭数据库 db.close(); MyAdapter mAdapter = new DetectAdapter(this, date_list); mGridview.setAdapter(mAdapter); } }
package com.axibase.tsd.api.model.sql; import java.util.Objects; public class ColumnMetaData implements Comparable<ColumnMetaData> { private String name; private Integer columnIndex; private String table; private String dataType; private String propertyUrl; private String titles; public ColumnMetaData(String name, Integer columnIndex) { this.name = name; this.columnIndex = columnIndex; } public Integer getColumnIndex() { return columnIndex; } private void setColumnIndex(Integer columnIndex) { this.columnIndex = columnIndex; } public String getName() { return name; } public String getTitles() { return titles; } public void setTitles(String titles) { this.titles = titles; } public String getPropertyUrl() { return propertyUrl; } public void setPropertyUrl(String propertyUrl) { this.propertyUrl = propertyUrl; } public String getDataType() { return dataType; } public void setDataType(String dataType) { this.dataType = dataType; } public String getTable() { return table; } public void setTable(String table) { this.table = table; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ColumnMetaData)) return false; ColumnMetaData that = (ColumnMetaData) o; return Objects.equals(getName(), that.getName()) && Objects.equals(getColumnIndex(), that.getColumnIndex()) && Objects.equals(getTable(), that.getTable()) && Objects.equals(getDataType(), that.getDataType()) && Objects.equals(getPropertyUrl(), that.getPropertyUrl()) && Objects.equals(getTitles(), that.getTitles()); } @Override public int hashCode() { return Objects.hash(getName(), getColumnIndex(), getTable(), getDataType(), getPropertyUrl(), getTitles()); } @Override public int compareTo(ColumnMetaData o) { return this.columnIndex.compareTo(o.getColumnIndex()); } }
package com.busycount.gaussianblur; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; public class MainActivity extends AppCompatActivity implements View.OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public void onClick(View v) { int id = v.getId(); switch (id) { case R.id.main_btn_blur1: Blur1Activity.actionStart(this); break; case R.id.main_btn_blur2: break; default: break; } } }
package th.ku.emailtemplate; public class MissingValueException extends Exception { }
package homework4; import java.awt.Color; import java.awt.Font; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import javax.swing.JFrame; import javax.swing.JLabel; public class Clock { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("Timer: Gustavo Magalhães Pereira"); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); JLabel label = new JLabel(); label.setFont(new Font("Monospaced", Font.PLAIN,100)); label.setForeground(Color.BLACK); label.setBackground(new Color(1.f, 1.f, 1.f)); label.setOpaque(true); DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); long lastTime = 0, currTime; Calendar cal; while (true) { currTime = System.currentTimeMillis(); if (currTime - lastTime > 1000) { lastTime = currTime; cal = Calendar.getInstance(); label.setText(dateFormat.format(cal.getTime())) ; frame.add(label); frame.pack(); } } } }
package io.nuls.base.api.provider.dex; import io.nuls.base.api.provider.BaseRpcService; import io.nuls.base.api.provider.Provider; import io.nuls.base.api.provider.Result; import io.nuls.base.api.provider.dex.facode.CoinTradingReq; import io.nuls.base.api.provider.dex.facode.DexQueryReq; import io.nuls.base.api.provider.dex.facode.EditTradingReq; import io.nuls.core.rpc.model.ModuleE; import java.util.Map; import java.util.function.Function; @Provider(Provider.ProviderType.RPC) public class DexProviderForRpc extends BaseRpcService implements DexProvider { @Override protected <T, R> Result<T> call(String method, Object req, Function<R, Result> callback) { return callRpc(ModuleE.DX.abbr, method, req, callback); } @Override public Result<String> createTrading(CoinTradingReq req) { return callReturnString("dx_createCoinTradingTx", req, "txHash"); } @Override public Result<String> editTrading(EditTradingReq req) { return callReturnString("dx_editCoinTradingTx", req, "txHash"); } @Override public Result<Map> getTrading(DexQueryReq req) { return callResutlMap("dx_getCoinTrading", req); } }
package com.innovaciones.reporte.util; import javax.persistence.AttributeConverter; public class InicioGarantiaConverter implements AttributeConverter<InicioGarantia, Integer> { @Override public Integer convertToDatabaseColumn(InicioGarantia inicioGarantia) { switch (inicioGarantia) { case EGRESO: return 0; case INSTALACION: return 1; case FECHA_PERSONALIZADA: return 2; default: throw new IllegalArgumentException("Unknown " + inicioGarantia); } } @Override public InicioGarantia convertToEntityAttribute(Integer integer) { switch (integer) { case 0: return InicioGarantia.EGRESO; case 1: return InicioGarantia.INSTALACION; case 2: return InicioGarantia.FECHA_PERSONALIZADA; default: throw new IllegalArgumentException("Unknown " + integer); } } }
//Vladimir Ventura // 0030144 // CIS252 - Data Structures // Problem Set 6: Array Queue (Book's Implementation) // // For this Queue implementation, I took some references from Stack Overflow (which suggested to use a weak typing method of Generics; // make an array of true Objects, and on each return of the Generic, cast the object to return to the Generic itself) and from the book // (I took the book's implementation of the ArrayQueue). I followed this answer because the ArrayList from the Java Utilities package // follows a similar approach as well. The post on Stack Overflow also included an annotation that looked like a method that was // being passed a string. This is the @SuppressWarnings annotation, with "unchecked" as argument. As a result, whenever the objects are // to be returned as their original Generic type, this unchecked warning shows up; the annotation is there to avoid this warning showing up. // // The book's implementation of the ArrayQueue made it so the rotation was circular, so for the sorting it was challenging to get my head to think // this way. Besides this, there's nothing interesting here.*// public class ArrayQueue<E extends Comparable<E>> implements QueueInterface<E>{ private Object[] queueArray; // Array holding queue elements private static final int DEFAULT_SIZE = 10; private int maxSize; // Maximum size of queue private int front; // Index of front element private int rear; // Index of r3ear element ArrayQueue(int size) { maxSize = size + 1; // One extra space is allocated rear = 0; front = 1; queueArray = new Object[maxSize]; // Create queueArray } ArrayQueue() { this(DEFAULT_SIZE); } // Reinitialize public void clear() { rear = 0; front = 1; } // Put "it" in queue public boolean enqueue(E it) { if (((rear+2) % maxSize) == front) return false; // Full rear = (rear+1) % maxSize; // Circular increment queueArray[rear] = it; return true; } // Remove and return front value @SuppressWarnings("unchecked") public E dequeue() { if(length() == 0) return null; Object it = queueArray[front]; front = (front+1) % maxSize; // Circular increment return (E)it; } // Return front value @SuppressWarnings("unchecked") public E frontValue() { if (length() == 0) return null; return (E)queueArray[front]; } // Return queue size public int length() { return ((rear+maxSize) - front + 1) % maxSize; } //Tell if the queue is empty or not public boolean isEmpty() { return front - rear == 1; } @Override public void swapFront() { Object temporal = queueArray[front]; queueArray[front] = queueArray[(front + 1) % maxSize]; queueArray[(front + 1) % maxSize] = temporal; } @Override public void swapBack() { Object temporal = queueArray[rear]; queueArray[rear] = queueArray[(rear - 1) % maxSize]; queueArray[(rear - 1) % maxSize] = temporal; } @Override public int count() { int temporal = front % maxSize; int counter = 1; while (temporal != rear % maxSize){ temporal++; counter++; } return counter; } @Override public void remove(int index) { //Because of how the circular movement of this array queue works, the very first index is not assigned to. //Therefore, the index should be shifted forward if (queueArray[0] == null) index = (index + 1) % maxSize; else index = index % maxSize; if (index >= 0 && index <= length()){ queueArray[index] = null; } int temporal = index; while (temporal % maxSize != rear % maxSize){ Object holder = queueArray[temporal % maxSize]; queueArray[temporal % maxSize] = queueArray[(temporal + 1) % maxSize]; queueArray[(temporal + 1) % maxSize] = holder; temporal++; } rear--; } @SuppressWarnings("unchecked") public void sortLowToHigh() { for (int x = 0; x < length(); x++){ for (int y = front; y < (length() - x); y++){ if (((E)queueArray[(y+1) % maxSize]).compareTo(((E)queueArray[y % maxSize])) < 0){ Object temporal = queueArray[(y+1) % maxSize]; queueArray[(y+1) % maxSize] = queueArray[y % maxSize]; queueArray[y % maxSize] = temporal; } } } } @SuppressWarnings("unchecked") public void sortHighToLow() { boolean change = false; for (int x = front % maxSize; x < length() + 1; x++){ int maximumIndex = x; for (int y = (x + 1) % maxSize; y < length() + 1; y++){ if (((E)queueArray[maximumIndex]).compareTo((E)queueArray[y]) < 0){ maximumIndex = y; change = true; } } if (change){ Object temporal = queueArray[maximumIndex]; queueArray[maximumIndex] = queueArray[x]; queueArray[x] = temporal; } change = false; } } @Override public String toString(){ StringBuilder message = new StringBuilder().append("Array Queue {\n"); for (int x = front; x != rear + 1; x++){ message.append("\t").append(queueArray[x % maxSize]).append("\n"); } message.append("}"); return message.toString(); } }
package views.formdata; import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.databind.JsonNode; import play.data.validation.ValidationError; import play.i18n.Messages; import play.libs.ws.*; import scala.reflect.internal.Trees.This; import play.libs.F.Promise; import play.libs.F.Function; public class LoginForm { Logger logger = LoggerFactory.getLogger(This.class); public String email; public String password; public boolean authenticate(){ // Promise<JsonNode> adminLoginService = WS.url("http://localhost:8088/birivarmi/birivarmiapp/app/v1/admin/").setContentType("application/x-www-form-urlencoded").post(String.format("email=%s&password=%s", "korayparlar@hotmail.com", "KORAY")) // .map(response -> { return response.asJson();}); Promise<JsonNode> adminLoginService2 = WS.url("http://localhost:8088/birivarmi/birivarmiapp/app/v1/admin/").setContentType("application/x-www-form-urlencoded").post(String.format("email=%s&password=%s", this.email, this.password)) .map(new Function<WSResponse, JsonNode>() { public JsonNode apply(WSResponse response) { JsonNode json = response.asJson(); if(json!=null){ JsonNode jsonId = json.get("id"); if(jsonId!=null){ Long id = jsonId.longValue(); logger.debug(String.format("Email: %s; Id:%d", email, id)); }else{ } }else{ } return json; } }); return true; } // public List<ValidationError> validate() { // // List<ValidationError> errors = new ArrayList<ValidationError>(); // // if (!authenticate(email, password)) { // // errors.add(new ValidationError("error", "Invalid user or password")); // return errors; // }else{ // return null; // } // // } public String validate() { if (!authenticate()) { return Messages.get("errors.invalidUserOrPassword"); }else{ return null; } } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
package com.orengesunshine.todowithapi; import android.app.Activity; import android.app.Application; import com.orengesunshine.todowithapi.component.AppComponent; import com.orengesunshine.todowithapi.component.DaggerAppComponent; import com.orengesunshine.todowithapi.modules.AppContextModule; import com.orengesunshine.todowithapi.service.TodoClient; import javax.inject.Inject; public class ToDoApp extends Application { AppComponent component; @Inject TodoClient todoClient; @Override public void onCreate() { super.onCreate(); component = DaggerAppComponent.builder() // .appContextModule(new AppContextModule(this)) .build(); todoClient = component.getTodoClient(); // component.getTodoClient(); // component.injectApplication(this); } // public AppComponent getComponent(){ // return component; // } public static ToDoApp getTodoApp(Activity activity){ return (ToDoApp)activity.getApplication(); } // public TodoClient getTodoClient(){ // return todoClient; // } }
/** @author manoharchitoda */ package game; import java.util.HashSet; import java.util.Random; public class DeckOfCards { private Card deck[]; private final int NUMBER_OF_CARDS = 56; private int currentCard; private Random rand; public DeckOfCards() { //Instantiate necessary vars String faces[] = {"2","3","4","5","6", "7","8","9","10","11","12", "13","14"}; String suit[] = {"4","3","2","1"}; this.deck = new Card[NUMBER_OF_CARDS]; this.rand = new Random(); this.currentCard = 0; //Fill the deck with cards for (int i = 0; i < 52; i++) { this.deck[i] = new Card(faces[i%13],suit[i/13]); } //Fill the deck with penalty cards for (int i = 52; i < 56; i++) { this.deck[i] = new Card("-1","-1"); } } /** *@param c is the index of the card to move the current card to */ public void setCurrentCard(int c){ this.currentCard = c; } //Shuffle the deck by swapping cards public void shuffle() { HashSet<Integer> usedRandoms = new HashSet<Integer>(); this.currentCard = 0; int i= 0; while (i < deck.length) { int another = this.rand.nextInt(NUMBER_OF_CARDS); if(!usedRandoms.contains(another)) { Card temp = this.deck[i]; this.deck[i] = this.deck[another]; this.deck[another] = temp; i++; usedRandoms.add(another); } } } //Deal a card public Card deal() { if(this.currentCard < deck.length){ System.out.println(this.deck[this.currentCard]); return this.deck[this.currentCard++]; } else return null; } }
package tr.com.ogedik.integration.services.jira; import org.springframework.stereotype.Service; import tr.com.ogedik.commons.rest.request.client.HttpRestClient; import tr.com.ogedik.commons.rest.request.client.helper.RequestURLDetails; import tr.com.ogedik.commons.rest.request.model.JiraConfigurationProperties; import tr.com.ogedik.commons.rest.response.BoardsResponse; import tr.com.ogedik.commons.rest.response.RestResponse; import tr.com.ogedik.commons.rest.response.SprintResponse; import tr.com.ogedik.commons.rest.response.model.JQLSearchResult; import tr.com.ogedik.commons.rest.response.model.Sprint; import tr.com.ogedik.commons.util.MapUtils; import tr.com.ogedik.commons.validator.MandatoryFieldValidator; import tr.com.ogedik.integration.constants.JiraRestConstants; import tr.com.ogedik.integration.services.configuration.ConfigurationIntegrationService; import tr.com.ogedik.integration.util.IntegrationUtil; /* * @author enes.erciyes */ @Service public class JiraAgileService { private final ConfigurationIntegrationService configurationService; public static final String WORKLOG = "worklog"; public static final String SPRINT = "sprint"; public JiraAgileService(ConfigurationIntegrationService configurationService) { this.configurationService = configurationService; } public JQLSearchResult getIssuesInASprintSearchResult(String sprintCode, String fields) { JiraConfigurationProperties properties = configurationService.getJiraConfigurationProperties(); MandatoryFieldValidator.getInstance().validate(properties); RequestURLDetails requestURLDetails = new RequestURLDetails( properties.getBaseURL(), JiraRestConstants.EndPoint.SPRINT_ISSUES(sprintCode), MapUtils.of("fields", fields)); RestResponse<JQLSearchResult> searchResponse = HttpRestClient.doGet( requestURLDetails, IntegrationUtil.initJiraHeaders(properties), JQLSearchResult.class); return searchResponse.getBody(); } public BoardsResponse getAllBoards() { JiraConfigurationProperties properties = configurationService.getJiraConfigurationProperties(); MandatoryFieldValidator.getInstance().validate(properties); RequestURLDetails requestURLDetails = new RequestURLDetails(properties.getBaseURL(), JiraRestConstants.EndPoint.BOARDS, null); RestResponse<BoardsResponse> boardsResponse = HttpRestClient.doGet( requestURLDetails, IntegrationUtil.initJiraHeaders(properties), BoardsResponse.class); return boardsResponse.getBody(); } public SprintResponse getSprintsInABoard(String boardId) { JiraConfigurationProperties properties = configurationService.getJiraConfigurationProperties(); MandatoryFieldValidator.getInstance().validate(properties); RequestURLDetails requestURLDetails = new RequestURLDetails( properties.getBaseURL(), JiraRestConstants.EndPoint.SPRINTS(boardId), null); RestResponse<SprintResponse> sprintResponse = HttpRestClient.doGet( requestURLDetails, IntegrationUtil.initJiraHeaders(properties), SprintResponse.class); return sprintResponse.getBody(); } public Sprint getSprint(String sprintCode) { JiraConfigurationProperties properties = configurationService.getJiraConfigurationProperties(); MandatoryFieldValidator.getInstance().validate(properties); RequestURLDetails requestURLDetails = new RequestURLDetails( properties.getBaseURL(), JiraRestConstants.EndPoint.SPRINT(sprintCode), null); RestResponse<Sprint> sprint = HttpRestClient.doGet( requestURLDetails, IntegrationUtil.initJiraHeaders(properties), Sprint.class); return sprint.getBody(); } }
import java.util.Scanner; public class SimpleNumbers { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter number : "); int num = in.nextInt(); int i; boolean Simple = false; System.out.println("2 is simple number"); for(i = 2; i <= num; i++) { if(i%2 == 0) continue; for(int j = 2; j < i; j++) { if(i%j != 0) Simple = true; else { Simple = false; break; } } if(Simple) System.out.println(i + " is simple number"); } } }
package pl.edu.pw.mini.taio.omino.core; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; class CutTest { @Test public void cutWithNonNeighbouringPixelsShouldThrowException() { // given: Pixel A = new Pixel(1, 2); Pixel B = new Pixel(2, 3); // when: // then: assertThatThrownBy(() -> new Cut(new Pixel(A), new Pixel(B))).isInstanceOf(IllegalArgumentException.class); } @Test public void cutsWithSamePixelsShouldBeEqual() { // given: Pixel A = new Pixel(1, 2); Pixel B = new Pixel(1, 3); Cut C = new Cut(new Pixel(A), new Pixel(B)); Cut D = new Cut(new Pixel(A), new Pixel(B)); // when: boolean equals = C.equals(D); // then: assertThat(equals).isEqualTo(true); } @Test public void cutsWithSamePixelsReorderedShouldBeEqual() { // given: Pixel A = new Pixel(1, 2); Pixel B = new Pixel(1, 3); Cut C = new Cut(new Pixel(A), new Pixel(B)); Cut D = new Cut(new Pixel(B), new Pixel(A)); // when: boolean equals = C.equals(D); // then: assertThat(equals).isEqualTo(true); } }
package com.khurmainsutrya13gmail.pesankop1; import android.annotation.SuppressLint; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { TextView ddaftar; EditText nama; RadioGroup pil; CheckBox krim, coklat, vanila; Button simpan; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ddaftar = findViewById(R.id.ddaftar); nama = findViewById(R.id.editText); pil = findViewById(R.id.pilihan); krim = findViewById(R.id.checkBox); coklat = findViewById(R.id.checkBox2); vanila = findViewById(R.id.checkBox3); simpan = findViewById(R.id.button); simpan.setOnClickListener(new View.OnClickListener() { @SuppressLint("SetTextI18n") @Override public void onClick(View v) { String inputnama = String.valueOf(nama.getText().toString()); int pilihan = pil.getCheckedRadioButtonId(); RadioButton pil = findViewById(pilihan); String inputpilihan = String.valueOf(pil.getText().toString()); if (!krim.isChecked() && !coklat.isChecked() && !vanila.isChecked()) { Toast.makeText(getApplicationContext(), "Topping Belum Dipilih", Toast.LENGTH_SHORT).show(); } else { String a = ""; if (krim.isChecked()) a += "Krim "; String b = ""; if (coklat.isChecked()) b += "Coklat "; String c = ""; if (vanila.isChecked()) { c += "Vanila "; } ddaftar.setText("\n" + "NAMA\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: " + inputnama + "\n\n" + "PILIHAN\t\t\t\t\t\t\t\t\t\t\t\t\t\t: " + inputpilihan + "\n\n" + "TAMBAHKAN TOPPING\t: " + a + "" + b + "" + c); } } }); } }
public class hierrical extends Nepal { public static void main(String[]args) { province1 p1= new province1(); p1.mounteverest(); bagmati b1= new bagmati(); b1.kathmandu(); gandaki g1=new gandaki(); g1.beautiful(); Nepal n1= new Nepal(); n1.country(); } }
/* * 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 translation; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintStream; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketAddress; /** * * @author joernneumeyer */ public class SRLPClient { private Socket socket = new Socket(); private OutputStream outStream; private InputStream inStream; private BufferedReader reader; private PrintStream writer; public void connect(SocketAddress addr) throws IOException { this.socket.connect(addr); this.outStream = this.socket.getOutputStream(); this.inStream = this.socket.getInputStream(); this.reader = new BufferedReader(new InputStreamReader(this.inStream)); this.writer = new PrintStream(this.outStream); } public void close() throws IOException { this.socket.close(); } /*public SRLPServerResponse sendRequest(String request) throws IOException { this.writer.print(request); this.writer.flush(); String response = ""; while (this.inStream.available() == -1) ; while (this.inStream.available() > -1) { response += this.reader.readLine(); } return SRLPServerResponse.fromString(response); }*/ public String sendRequest(String request) throws IOException { if (!request.endsWith("\r\n")) { request += "\r\n"; } this.writer.print(request); this.writer.flush(); String response = ""; String line; while ((line = this.reader.readLine()) != null) { response += line.concat("\r\n"); } return response.length() >= 2 ? response.substring(0, response.length() - 2) : ""; } public static void main(String[] args) { if (args.length == 0) { System.out.println("Call SRLPClient as follows: <clientpath> <method> [parameters]"); return; } if (!args[0].equals("GET") && args.length == 1) { System.out.println("Call SRLPClient as follows: <clientpath> <method> <parameters>"); return; } SRLPClient client = new SRLPClient(); try { client.connect(new InetSocketAddress("127.0.0.1", 12345)); } catch (IOException ex) { System.out.println("Could not connect to the local server!"); return; } String request = String.join(" ", args); try { String response = client.sendRequest(request); System.out.println(response); client.close(); } catch (IOException ex) { System.out.println("[Error] Error while sending request to the server!"); } } }
package com.shichuang.mobileworkingticket.activity; import android.os.Bundle; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import com.lzy.okgo.OkGo; import com.lzy.okgo.model.Response; import com.lzy.okgo.request.base.Request; import com.shichuang.mobileworkingticket.R; import com.shichuang.mobileworkingticket.adapter.AssignTeamMembersAdapter; import com.shichuang.mobileworkingticket.common.Constants; import com.shichuang.mobileworkingticket.common.NewsCallback; import com.shichuang.mobileworkingticket.common.TokenCache; import com.shichuang.mobileworkingticket.entify.AMBaseDto; import com.shichuang.mobileworkingticket.entify.ChooseTeamMember; import com.shichuang.mobileworkingticket.entify.Empty; import com.shichuang.mobileworkingticket.widget.RxTitleBar; import com.shichuang.open.base.BaseActivity; import com.shichuang.open.tool.RxActivityTool; import java.util.List; /** * 分配组员 * Created by Administrator on 2018/3/26. */ public class AssignTeamMembersActivity extends BaseActivity { private SwipeRefreshLayout mSwipeRefreshLayout; private RecyclerView mRecyclerView; private AssignTeamMembersAdapter mAdapter; private String ticketId; private int nowProcessId; @Override public int getLayoutId() { return R.layout.activity_assign_team_members; } @Override public void initView(Bundle savedInstanceState, View view) { ticketId = getIntent().getStringExtra("ticketId"); nowProcessId = getIntent().getIntExtra("nowProcessId", 0); mSwipeRefreshLayout = view.findViewById(R.id.swipe_refresh_layout); mRecyclerView = view.findViewById(R.id.recycler_view); mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext)); mAdapter = new AssignTeamMembersAdapter(); mAdapter.setPreLoadNumber(2); mRecyclerView.setAdapter(mAdapter); } @Override public void initEvent() { mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { refresh(); } }); ((RxTitleBar) findViewById(R.id.title_bar)).setTitleBarClickListener(new RxTitleBar.TitleBarClickListener() { @Override public void onRightClick() { if (mAdapter != null) { List<ChooseTeamMember.ChooseTeamMemberModel> mList = mAdapter.getData(); StringBuffer sbSelectedMember = new StringBuffer(); for (int i = 0; i < mList.size(); i++) { if (mList.get(i).isSelect()) { sbSelectedMember.append(mList.get(i).getId() + ","); } } if (sbSelectedMember.length() > 0) { // 去掉最后一个逗号 sbSelectedMember.deleteCharAt(sbSelectedMember.length() - 1); distributionTeamMember(sbSelectedMember.toString()); } else { showToast("请选择分配人员"); } } } }); } @Override public void initData() { refresh(); } private void refresh() { mSwipeRefreshLayout.setRefreshing(true); getTeamMembersData(); } private void getTeamMembersData() { OkGo.<AMBaseDto<ChooseTeamMember>>get(Constants.chooseTeamMemberUrl) .tag(mContext) .params("token", TokenCache.getToken(mContext)) .params("ticket_ids", ticketId) .execute(new NewsCallback<AMBaseDto<ChooseTeamMember>>() { @Override public void onStart(Request<AMBaseDto<ChooseTeamMember>, ? extends Request> request) { super.onStart(request); } @Override public void onSuccess(final Response<AMBaseDto<ChooseTeamMember>> response) { if (response.body().code == 0 && response.body().data != null && response.body().data.getMemberRows() != null) { setData(response.body().data.getMemberRows()); } else { showToast(response.body().msg); } } @Override public void onError(Response<AMBaseDto<ChooseTeamMember>> response) { super.onError(response); } @Override public void onFinish() { super.onFinish(); mSwipeRefreshLayout.setRefreshing(false); } }); } private void setData(List<ChooseTeamMember.ChooseTeamMemberModel> memberRows) { mAdapter.replaceData(memberRows); } private void distributionTeamMember(String members) { OkGo.<AMBaseDto<Empty>>post(Constants.distributionTeamMemberUrl) .tag(mContext) .params("token", TokenCache.getToken(mContext)) .params("ticket_ids", ticketId) .params("user_ids", members) .params("now_process_id", nowProcessId) .execute(new NewsCallback<AMBaseDto<Empty>>() { @Override public void onStart(Request<AMBaseDto<Empty>, ? extends Request> request) { super.onStart(request); showLoading(); } @Override public void onSuccess(final Response<AMBaseDto<Empty>> response) { showToast(response.body().msg); dismissLoading(); if (response.body().code == 0) { setResult(RESULT_OK); RxActivityTool.finish(mContext); } } @Override public void onError(Response<AMBaseDto<Empty>> response) { super.onError(response); dismissLoading(); } @Override public void onFinish() { super.onFinish(); } }); } }
package ar.edu.unju.fi.repository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import ar.edu.unju.fi.Merlos3367Tp5Application; import ar.edu.unju.fi.model.Usuario; /** * * @author Damian Merlos * Clase IUsuarioImp que implementara los metodos de la interface IUsuario. */ @Repository("usuarioImp") public class UsuarioImp implements IUsuario { @Autowired private Usuario usuario; public static Logger LOG = LoggerFactory.getLogger(Merlos3367Tp5Application.class); @Override public void Guardar() { // TODO Auto-generated method stub LOG.info("El usuario fue guardado: " + usuario.getApellidoUsuario() + ", " + usuario.getNombreUsuario()); } @Override public Usuario mostrar() { // TODO Auto-generated method stub return null; } @Override public void elminiar() { // TODO Auto-generated method stub } @Override public Usuario modificar() { // TODO Auto-generated method stub return null; } }