text
stringlengths
10
2.72M
/* * Copyright (C) 2020 Dominik Schadow, dominikschadow@gmail.com * * This file is part of the Java Security project. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.dominikschadow.javasecurity.tink; import com.google.common.io.BaseEncoding; import com.google.crypto.tink.CleartextKeysetHandle; import com.google.crypto.tink.JsonKeysetWriter; import com.google.crypto.tink.KeysetHandle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; /** * Google Tink utils for this demo project. * * @author Dominik Schadow */ public class TinkUtils { private static final Logger log = LoggerFactory.getLogger(TinkUtils.class); public static final String AWS_MASTER_KEY_URI = "aws-kms://arn:aws:kms:eu-central-1:776241929911:key/cce9ce6d-526c-44ca-9189-45c54b90f070"; public static void printKeyset(String type, KeysetHandle keysetHandle) { try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { CleartextKeysetHandle.write(keysetHandle, JsonKeysetWriter.withOutputStream(outputStream)); log.info("{}: {}", type, new String(outputStream.toByteArray())); } catch (IOException ex) { log.error("Failed to write keyset", ex); } } public static void printSymmetricEncryptionData(KeysetHandle keysetHandle, String initialText, byte[] cipherText, byte[] plainText) { log.info("initial text: {}", initialText); log.info("cipher text: {}", BaseEncoding.base16().encode(cipherText)); log.info("plain text: {}", new String(plainText, StandardCharsets.UTF_8)); printKeyset("keyset data", keysetHandle); } public static void printHybridEncryptionData(KeysetHandle privateKeysetHandle, KeysetHandle publicKeysetHandle, String initialText, byte[] cipherText, byte[] plainText) { log.info("initial text: {}", initialText); log.info("cipher text: {}", BaseEncoding.base16().encode(cipherText)); log.info("plain text: {}", new String(plainText, StandardCharsets.UTF_8)); printKeyset("private key set data", privateKeysetHandle); printKeyset("public key set data", publicKeysetHandle); } public static void printMacData(KeysetHandle keysetHandle, String initialText, byte[] tag, boolean valid) { log.info("initial text: {}", initialText); log.info("MAC: {}", BaseEncoding.base16().encode(tag)); log.info("MAC is valid: {}", valid); printKeyset("keyset data", keysetHandle); } public static void printSignatureData(KeysetHandle privateKeysetHandle, KeysetHandle publicKeysetHandle, String initialText, byte[] signature, boolean valid) { log.info("initial text: {}", initialText); log.info("signature: {}", BaseEncoding.base16().encode(signature)); log.info("signature is valid: {}", valid); printKeyset("private key set data", privateKeysetHandle); printKeyset("public key set data", publicKeysetHandle); } }
package com.ahmetkizilay.yatlib4j.users; import com.ahmetkizilay.yatlib4j.oauthhelper.OAuthHolder; public class ShowUser { private static final String BASE_URL = "https://api.twitter.com/1.1/users/show.json"; private static final String HTTP_METHOD = "GET"; public static ShowUser.Response sendRequest(ShowUser.Parameters params, OAuthHolder oauthHolder) { throw new UnsupportedOperationException(); } public static class Response { } public static class Parameters { } }
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.mapreduce.test.system; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.MRConfig; import org.apache.hadoop.test.system.AbstractDaemonClient; import org.apache.hadoop.test.system.DaemonProtocol; import org.apache.hadoop.test.system.process.RemoteProcess; /** * Base class for JobTracker and TaskTracker clients. */ public abstract class MRDaemonClient<PROXY extends DaemonProtocol> extends AbstractDaemonClient<PROXY>{ public MRDaemonClient(Configuration conf, RemoteProcess process) throws IOException { super(conf, process); } public String[] getMapredLocalDirs() throws IOException { return getProxy().getDaemonConf().getStrings(MRConfig.LOCAL_DIR); } public String getLogDir() throws IOException { return getProcessInfo().getSystemProperties().get("hadoop.log.dir"); } }
package Minigame; /** * * @author Amy * */ public class Controller extends Circle{ private float accelerationX, accelerationY; private final float MAX_ACCELERATION = 20; public Controller() { super(); accelerationX = 0; accelerationY = 0; } public Controller(float velocityX, float velocityY, int xDirection, int yDirection, float centerX, float centerY, float radius) { super(velocityX, velocityY, xDirection, yDirection, centerX, centerY, radius); accelerationX = 0; accelerationY = 0; } public void changeLocation(float x, float y) { setCenterX(getCenterX() + x); setCenterY(getCenterY() + y); } public void chooseAccelerationX() { accelerationX = (float)(Math.random() * MAX_ACCELERATION); } public void chooseAccelerationY() { accelerationY = (float)(Math.random() * MAX_ACCELERATION); } public float getAccelerationX() { return accelerationX; } public float getAccelerationY() { return accelerationY; } public void setAccelerationX(float accelerationX) { this.accelerationX = accelerationX; } public void setAccelerationY(float accelerationY) { this.accelerationY = accelerationY; } }
public class Digit { int value; Digit next; Digit prev; public Digit(int v) { value = v; } public int getValue() { return value; } public void setValue(int v) { value = v; } public Digit getNext() { return next; } public void setNext(Digit n) { next = n; } public Digit getPrev() { return prev; } public void setPrev(Digit p) { prev = p; } }
package com.youthchina.service.user; import com.fasterxml.jackson.databind.ObjectMapper; import com.youthchina.domain.zhongyang.JwtAuthentication; import com.youthchina.domain.zhongyang.User; import com.youthchina.dto.Response; import com.youthchina.dto.security.UserDTO; import com.youthchina.exception.zhongyang.exception.ForbiddenException; import com.youthchina.exception.zhongyang.exception.InternalStatusCode; import com.youthchina.exception.zhongyang.exception.NotFoundException; import io.jsonwebtoken.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Service; import javax.annotation.Nonnull; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.sql.Timestamp; import java.util.Calendar; import java.util.Date; /** * Created by zhongyangwu on 11/11/18. */ @Service public class JwtServiceImpl implements JwtService { @Value("${security.token.expirationtime}") private String EXPRIATIONTIME; @Value("${security.token.key}") private String SECRET; @Value("${security.token.prefix}") private String TOKEN_PREFIX; @Value("${security.token.header}") private String HEADER; @Value("${security.register.token.key}") private String REGISTER_SECRET; @Value("${security.register.token.expirationtime}") private String REGISTER_EXPRIATIONTIME; @Autowired private UserService userService; private ObjectMapper objectMapper; @Autowired public JwtServiceImpl(ObjectMapper objectMapper) { this.objectMapper = objectMapper; } /** * Add authentication in header and user body for login request. * * @param response the response * @param user the user */ @Override public void addAuthentication(HttpServletResponse response, User user) throws IOException { response.setHeader("Content-Type", "application/json;charset=utf8"); Integer id = user.getId(); String token = this.getAuthenticationToken(id); response.addHeader(HEADER, TOKEN_PREFIX + " " + token); String responseBody = objectMapper.writeValueAsString(new Response(new UserDTO(user))); response.getWriter().write(responseBody); } /** * Get token by user id * * @param userId id of authenticated user * @return token */ @Override public String getAuthenticationToken(Integer userId) { return Jwts.builder(). setSubject(userId.toString()). setExpiration(new Date(System.currentTimeMillis() + Long.valueOf(EXPRIATIONTIME))) .signWith(SignatureAlgorithm.HS512, SECRET) .compact(); } /** * Gets authentication. * * @param servletRequest the servlet request * @return the authentication */ @Override public Authentication getAuthentication(HttpServletRequest servletRequest) throws ExpiredJwtException, UnsupportedJwtException, MalformedJwtException, SignatureException { String token = servletRequest.getHeader(HEADER); if (token != null) { Integer id = null; boolean needRenew = false; Date expireTime = null; try { Jws<Claims> jwtClaim = Jwts.parser().setSigningKey(SECRET).parseClaimsJws(token.replace(TOKEN_PREFIX, "")); expireTime = jwtClaim.getBody().getExpiration(); id = Integer.valueOf(jwtClaim.getBody().getSubject()); if (expireTime.before(new Timestamp(Calendar.getInstance().getTimeInMillis() + 15 * 100))) { // if the expired time is within 15min from now. // renew token needRenew = true; } } catch (IllegalArgumentException ignored) { } User user = null; try { user = userService.get(id); } catch (NotFoundException e) { return null; //cannot auth } return new JwtAuthentication(user, true, needRenew); } return null; } @Override public String encodeRegisterToken(@Nonnull User user) { return Jwts.builder(). setSubject(user.getId().toString()). setExpiration(new Date(System.currentTimeMillis() + Long.valueOf(REGISTER_EXPRIATIONTIME))) .signWith(SignatureAlgorithm.HS512, REGISTER_SECRET) .compact(); } @Override public Integer decodeRegisterToken(String token) throws ForbiddenException { try { Jws<Claims> jwtClaim = Jwts.parser().setSigningKey(REGISTER_SECRET).parseClaimsJws(token); Date expireTime = jwtClaim.getBody().getExpiration(); Integer id = Integer.valueOf(jwtClaim.getBody().getSubject()); if (expireTime.before(new Timestamp(Calendar.getInstance().getTimeInMillis()))) { //if expire throw new ForbiddenException(InternalStatusCode.EXPIRED); } return id; } catch (ForbiddenException ex) { throw ex; } catch (Exception ex) { throw new ForbiddenException(InternalStatusCode.ACCESS_DENY); } } }
package babylanguage.babyapp.practicelanguagecommon; import android.graphics.drawable.Drawable; import android.util.Log; import android.view.DragEvent; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import com.google.android.flexbox.FlexboxLayout; import babylanguage.babyapp.appscommon.services.AndroidHelper; public class DragListener implements View.OnDragListener { private final String TAG = "DragListener"; WordsGameActivity context; int enteredDropShapeResource = R.drawable.entered_dropshape; int normaldropShapeResource = R.drawable.normal_dropshape; Drawable enterShape; Drawable normalShape; int direction = View.LAYOUT_DIRECTION_LTR; WordGameHelper gameHelper; boolean inContainer = false; // float initialx; // float initialy; // float lastx; // float lasty; public DragListener(WordsGameActivity context, int enteredDropShape, int normaldropShape, int direction, WordGameHelper gameHelper){ this.context = context; this.initShapes(enteredDropShape, normaldropShape); this.direction = direction; this.gameHelper = gameHelper; } private void initShapes(int enteredDropShape, int normaldropShape){ if(enteredDropShape < 0){ enteredDropShape = enteredDropShapeResource; } if(normaldropShape < 0){ normaldropShape = normaldropShapeResource; } enterShape = context.getResources().getDrawable(enteredDropShape); normalShape = context.getResources().getDrawable(normaldropShape); } @Override public boolean onDrag(View v, DragEvent event) { View view = (View) event.getLocalState(); if(view == null) return true; switch (event.getAction()) { case DragEvent.ACTION_DRAG_STARTED: break; case DragEvent.ACTION_DRAG_ENTERED: inContainer = true; v.setBackgroundDrawable(enterShape); break; case DragEvent.ACTION_DRAG_EXITED: inContainer = false; FlexboxLayout container = (FlexboxLayout) v; View dropPlaceholder = gameHelper.getContainerDropPalceholder(container); if(dropPlaceholder != null) { dropPlaceholder.setVisibility(View.GONE); } else{ Log.d(this.TAG, "[app][ACTION_DRAG_EXITED]: Drop is null"); } v.setBackgroundDrawable(normalShape); break; case DragEvent.ACTION_DROP: // if(this.checkIfClick(view)){ // this.gameHelper.changeContainer(view); // } // else{ container = (FlexboxLayout) v; dropPlaceholder = gameHelper.getContainerDropPalceholder(container); if(dropPlaceholder != null) { dropPlaceholder.setVisibility(View.GONE); } else{ Log.d(this.TAG, "[app][ACTION_DROP]: Drop is null"); } int insetIndex = calculateDropIndex(container, event); // boolean changeDrop = this.shouldMoveDrop(container, insetIndex); // if(changeDrop){ // // } this.gameHelper.moveToContainer(view, container, insetIndex); //} view.setVisibility(View.VISIBLE); Log.d(this.TAG, "[app][ACTION_DROP]: Drop index = " + insetIndex); break; case DragEvent.ACTION_DRAG_ENDED: //this.checkIfClick(view); v.setBackgroundDrawable(normalShape); view.setVisibility(View.VISIBLE); final Animation anim = AnimationUtils.loadAnimation(this.context, R.anim.drop_word_anim); view.startAnimation(anim); this.gameHelper.removeSelectedBorderFromWord(view); //this.gameHelper.clearPlaceHolderText(this.context.getCurrentAnswersLayoutDropPlaceHolder()); //this.gameHelper.clearPlaceHolderText(this.context.getAnswersLayoutDropPlaceHolder()); Log.d(this.TAG, "[app][ACTION_DRAG_ENDED]"); case DragEvent.ACTION_DRAG_LOCATION: if(inContainer){ float curx = event.getX(); float cury = event.getY(); if(curx == 0 && cury == 0) break; container = (FlexboxLayout) v; insetIndex = calculateDropIndex(container, event); dropPlaceholder = gameHelper.getContainerDropPalceholder(container); ViewGroup dropParent = ((ViewGroup)dropPlaceholder.getParent()); if(dropPlaceholder != null){ //this.gameHelper.setPlaceHolderText(dropPlaceholder, view); //boolean changeDrop = this.shouldMoveDrop(container, insetIndex);//dropIndex != insetIndex || dropIndex != (insetIndex - 1); int dropIndex = dropParent.indexOfChild(dropPlaceholder); boolean changeDrop = dropIndex != insetIndex || dropIndex != (insetIndex - 1); Log.d(this.TAG, "[app][ACTION_DRAG_LOCATION] changeDrop = " + changeDrop + "[drop index = " + dropIndex + ", insert index = " + insetIndex + "]"); if(changeDrop){ dropParent.removeView(dropPlaceholder); if(dropIndex < insetIndex){ if(container.getChildCount() < insetIndex){ container.addView(dropPlaceholder); } else{ container.addView(dropPlaceholder, insetIndex - 1); } } else{ container.addView(dropPlaceholder, insetIndex); } } dropPlaceholder.setVisibility(View.VISIBLE); } else{ Log.d(this.TAG, "[app][ACTION_DRAG_LOCATION]: Drop is null"); } // int indexOfChild = container.indexOfChild(view); // if(indexOfChild != insetIndex - 1){ // this.gameHelper.moveToContainer(view, container, insetIndex); // } } break; // System.out.println("===============> LOCATION: x = " + lastx + ", y = " + lasty); default: break; } return true; } // private boolean checkIfClick(View view){ // WordGameSingleModelModel model = (WordGameSingleModelModel)view.getTag(); // if(model != null){ // double distance = MathHelper.distanceBetweenPoints(initialx, lastx, initialy, lasty); // System.out.println("===============> distance = " + distance); // if(distance < 150){ // return true; // } // } // return false; // } private int calculateDropIndex(FlexboxLayout container, DragEvent event){ int lastLowerX = 0; float x = event.getX(); float y = event.getY(); Log.d(this.TAG, "[app][calculateDropIndex]: pos x = " + x + ", pos y = " + y); // check if lower then all elements, if so put as the last element if(container.getChildCount() > 0){ View lastChild = container.getChildAt(container.getChildCount()-1); float lastChildY = lastChild.getY(); float childHeight = lastChild.getHeight(); boolean lowerThanAllElems = lastChildY + childHeight < y; if(lowerThanAllElems){ lastLowerX = container.getChildCount(); Log.d(this.TAG, "[app][calculateDropIndex]: Drop index = " + lastLowerX); return lastLowerX; } } float prevY = 0; for(int i = 0; i < container.getChildCount(); i++){ View child = container.getChildAt(i); WordGameSingleModelModel model = (WordGameSingleModelModel)child.getTag(); float childY = child.getY(); boolean childTopIsUpper = childY < y; float childX = child.getX(); boolean childBefore = this.direction == View.LAYOUT_DIRECTION_LTR ? childX < x : (childX + 50) > x; boolean newLine = (prevY + AndroidHelper.convertDpToPixel(20, this.context)) < childY; //Log.d(this.TAG, "[app][calculateDropIndex]: i = " + i + ": x = " + x + ", childX = " + childX + "(" + (model != null ? model.wordText : "drop") + ")"); if(childTopIsUpper){ if(childBefore){ lastLowerX = i + 1; } else if(newLine){ lastLowerX = i; } } else{ break; } Log.d(this.TAG, "[app][calculateDropIndex]: i = " + i + ": index = " + lastLowerX + ", newLine = " + newLine + ", childTopIsUpper = " + childTopIsUpper + ", childBefore = " + childBefore + ", childX = " + childX + ", childY = " + childY + " (" + (model != null ? model.wordText : "drop") + ")"); prevY = childY; // if(childTopIsUpper && childBefore){ // lastLowerX = i + 1; // } // // // // if child top is lower: // if(!childTopIsUpper){ // break; // } } if(lastLowerX > 0){ View child = lastLowerX > 0 ? container.getChildAt(lastLowerX) : null; if(child != null){ float childX = child.getX(); WordGameSingleModelModel model = (WordGameSingleModelModel)child.getTag(); Log.d(this.TAG, "[app][calculateDropIndex]: drop before: x = " + x + ", childX = " + childX + "(" + (model != null ? model.wordText : "drop") + ")"); } } else{ Log.d(this.TAG, "[app][calculateDropIndex]: drop first"); } Log.d(this.TAG, "[app][calculateDropIndex]: Drop index = " + lastLowerX); return lastLowerX; } private String getDragEventString(int eventType){ switch (eventType){ case DragEvent.ACTION_DRAG_ENDED : return "ACTION_DRAG_ENDED"; case DragEvent.ACTION_DRAG_ENTERED: return "ACTION_DRAG_ENTERED"; case DragEvent.ACTION_DRAG_EXITED: return "ACTION_DRAG_EXITED"; case DragEvent.ACTION_DRAG_LOCATION: return "ACTION_DRAG_LOCATION"; case DragEvent.ACTION_DRAG_STARTED: return "ACTION_DRAG_STARTED"; case DragEvent.ACTION_DROP: return "ACTION_DROP"; } return ""; } }
/* * 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 vasylts.blackjack.user; import vasylts.blackjack.user.databaseworker.jdbcworker.DatabaseWorkerUserJdbc; import vasylts.blackjack.user.wallet.IWallet; import vasylts.blackjack.user.wallet.JdbcWallet; /** * * @author VasylcTS */ public class JdbcUser extends FakeUser { public JdbcUser(Long id, String login, String password, JdbcWallet wallet) { super(id, login, password, wallet); } @Override public void changePassword(String newPassword) { try { DatabaseWorkerUserJdbc worker = new DatabaseWorkerUserJdbc(); if (worker.changeUserPassword(super.getId(), newPassword)) { super.changePassword(newPassword); } } catch (Exception e) { throw new RuntimeException(e); } } }
package engine.input; import engine.gui.MenuItem; /** * * @author Anselme FRANÇOIS * */ public class OnReleasedEvent extends Mouse2DEvent{ int button_released; public OnReleasedEvent(MenuItem emitter, int button, int x, int y, int dx, int dy) { super(emitter, x, y, dx, dy); button_released = button; } public int getButtonReleased(){ return button_released; } @Override public EventType getType() { return EventType.MOUSE_RELEASE; } }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.clerezza.sparql.query.impl; import org.apache.clerezza.sparql.query.SelectQuery; import org.apache.clerezza.sparql.query.Variable; import java.util.ArrayList; import java.util.List; /** * * @author hasan */ public class SimpleSelectQuery extends SimpleQueryWithSolutionModifier implements SelectQuery { private boolean distinct; private boolean reduced; private boolean selectAll; private List<Variable> variables = new ArrayList<Variable>(); @Override public boolean isDistinct() { return distinct; } @Override public boolean isReduced() { return reduced; } @Override public boolean isSelectAll() { return selectAll; } @Override public List<Variable> getSelection() { return variables; } public void setDistinct() { distinct = true; } public void setReduced() { reduced = true; } public void setSelectAll() { assert variables.isEmpty(); selectAll = true; } public void addSelection(Variable var) { variables.add(var); } @Override public String toString() { return (new SimpleStringQuerySerializer()).serialize(this); } }
/* * 文 件 名: Operator.java * 描 述: Operator.java * 时 间: 2013-6-17 */ package com.babyshow.operator.bean; import java.util.Date; /** * <一句话功能简述> <功能详细描述> * * @author ztc * @version [BABYSHOW V1R1C1, 2013-6-17] */ public class Operator { private Integer id; /** * 操作员code */ private String operatorCode; /** * 登录名 */ private String loginName; /** * 密码 */ private String password; /** * 用户状态 */ private String status; /** * 最后登录时间 */ private Date lastActTime; /** * 获取 loginName * * @return 返回 loginName */ public String getLoginName() { return loginName; } /** * 设置 loginName * * @param 对loginName进行赋值 */ public void setLoginName(String loginName) { this.loginName = loginName; } /** * 获取 password * * @return 返回 password */ public String getPassword() { return password; } /** * 设置 password * * @param 对password进行赋值 */ public void setPassword(String password) { this.password = password; } /** * 获取 status * * @return 返回 status */ public String getStatus() { return status; } /** * 设置 status * * @param 对status进行赋值 */ public void setStatus(String status) { this.status = status; } /** * 获取 lastActTime * * @return 返回 lastActTime */ public Date getLastActTime() { return lastActTime; } /** * 设置 lastActTime * * @param 对lastActTime进行赋值 */ public void setLastActTime(Date lastActTime) { this.lastActTime = lastActTime; } /** * 获取 id * * @return 返回 id */ public Integer getId() { return id; } /** * 设置 id * * @param 对id进行赋值 */ public void setId(Integer id) { this.id = id; } /** * 获取 operatorCode * * @return 返回 operatorCode */ public String getOperatorCode() { return operatorCode; } /** * 设置 operatorCode * * @param 对operatorCode进行赋值 */ public void setOperatorCode(String operatorCode) { this.operatorCode = operatorCode; } }
import javax.swing.*; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; import java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; import javax.swing.border.*; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; import java.util.Arrays; public class NextConsultPanel { JPanel background; String medic; private JList consult_list; public JButton start_consult; private JPanel consult_panel; DefaultListModel d = new DefaultListModel(); String data_day; { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); data_day = getDateTime(); } public NextConsultPanel(JPanel cp) { this.background = cp; } public void setMedic(String m) { this.medic = m; createListModel(); } private String getDateTime() { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); return dateFormat.format(date); } public void createListModel() { System.out.println(data_day); System.out.println("medico logado(consultpanel):"+medic); ArrayList<Consulta> consultas_do_medico; Medico m = (Medico) Usuarios.buscaMedico(medic); System.out.println("medicobuscado:"+m.getName()); if(m != null) { consultas_do_medico = m.getConsultas(); ArrayList<Consulta> tmp = new ArrayList<Consulta>(); /** * Carrega as consultas do dia para o array tmp */ for(int i = 0; i < consultas_do_medico.size(); i++) { System.out.printf("esse fdp tem consulta no bolso: %s\n", consultas_do_medico.get(i).getDataConsultaStr()); if(consultas_do_medico.get(i).getDataConsultaStr().equals(data_day)) { System.out.println("add a data do dia"); tmp.add(consultas_do_medico.get(i)); } } Object out[] = new Object[tmp.size()]; for(int i = 0; i < tmp.size(); i++) { System.out.println("há consultas hoje"); if(tmp.get(i).getIsConsulted() == true) continue; String pacient = tmp.get(i).getPaciente(); String horario = tmp.get(i).getDataEHoraStr(); String str_final = String.format("Paciente:[%s], Horário:[%s]", pacient, horario); System.out.println(str_final); out[i] = str_final; d.addElement(out[i]); } } if(d.size() == 0) start_consult.setEnabled(false); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { consult_panel = new JPanel(); consult_panel.setLayout(new GridBagLayout()); consult_panel.setBorder(BorderFactory.createTitledBorder(null, "Consultas do dia", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, -1, -1, consult_panel.getFont()), new Color(-16777216))); final JScrollPane scrollPane1 = new JScrollPane(); GridBagConstraints gbc; gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.gridwidth = 2; gbc.fill = GridBagConstraints.BOTH; consult_panel.add(scrollPane1, gbc); consult_list = new JList(d); scrollPane1.setViewportView(consult_list); start_consult = new JButton(); start_consult.setText("Iniciar"); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.fill = GridBagConstraints.HORIZONTAL; consult_panel.add(start_consult, gbc); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridBagLayout()); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.fill = GridBagConstraints.BOTH; consult_panel.add(panel1, gbc); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridBagLayout()); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.fill = GridBagConstraints.BOTH; consult_panel.add(panel2, gbc); final JLabel label1 = new JLabel(); label1.setText("Próxima consulta"); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; consult_panel.add(label1, gbc); start_consult.addActionListener(new ConsultListener()); } /** * @noinspection ALL */ private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) { if (currentFont == null) return null; String resultName; if (fontName == null) { resultName = currentFont.getName(); } else { Font testFont = new Font(fontName, Font.PLAIN, 10); if (testFont.canDisplay('a') && testFont.canDisplay('1')) { resultName = fontName; } else { resultName = currentFont.getName(); } } return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize()); } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return consult_panel; } class ConsultListener implements ActionListener { @Override public void actionPerformed(ActionEvent ev) { start_consult.setEnabled(false); int val = consult_list.getSelectedIndex(); ConsultPanel cp = new ConsultPanel(background, start_consult, medic, d, val); background.add(cp.$$$getRootComponent$$$()); background.revalidate(); background.repaint(); } } }
package com.tencent.mm.plugin.card.ui; import android.annotation.SuppressLint; import android.content.Intent; import android.graphics.Rect; import android.graphics.Shader.TileMode; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Message; import android.text.TextUtils; import android.view.View; import android.view.View.OnClickListener; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.ListView; import android.widget.TextView; import com.tencent.mm.model.q; import com.tencent.mm.plugin.card.b.f; import com.tencent.mm.plugin.card.b.g.a; import com.tencent.mm.plugin.card.base.b; import com.tencent.mm.plugin.card.d.l; import com.tencent.mm.plugin.card.model.CardInfo; import com.tencent.mm.plugin.card.model.am; import com.tencent.mm.plugin.card.sharecard.model.ShareCardInfo; import com.tencent.mm.plugin.card.sharecard.ui.CardConsumeCodeUI; import com.tencent.mm.plugin.card.ui.a.g; import com.tencent.mm.plugin.card.ui.view.d; import com.tencent.mm.plugin.card.ui.view.i; import com.tencent.mm.plugin.card.ui.view.j; import com.tencent.mm.plugin.card.ui.view.k; import com.tencent.mm.plugin.card.ui.view.m; import com.tencent.mm.plugin.card.ui.view.u; import com.tencent.mm.plugin.card.ui.view.w; import com.tencent.mm.plugin.card.ui.view.y; import com.tencent.mm.plugin.card.ui.view.z; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.plugin.wxpay.a$k; import com.tencent.mm.pluginsdk.ui.applet.t; import com.tencent.mm.protocal.c.ax; import com.tencent.mm.protocal.c.la; import com.tencent.mm.protocal.c.pr; import com.tencent.mm.protocal.c.sd; import com.tencent.mm.sdk.b.c; import com.tencent.mm.sdk.platformtools.ad; import com.tencent.mm.sdk.platformtools.ag; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.ui.MMActivity; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @SuppressLint({"UseSparseArrays"}) public final class e implements a, n, MMActivity.a { ListView CU; private final String TAG = "MicroMsg.CardDetailUIContoller"; boolean bPd = false; LinearLayout bo; OnClickListener eZF = new 4(this); CardDetailBaseUI hBT; g hBU; i hBV; boolean hBW = false; i hBX; i hBY; com.tencent.mm.plugin.card.widget.g hBZ; com.tencent.mm.plugin.card.ui.view.g hCa; m hCb; i hCc; i hCd; i hCe; i hCf; i hCg; i hCh; i hCi; i hCj; d hCk; i hCl; j hCm; boolean hCn = true; f hCo; public String hCp = ""; public String hCq = ""; HashMap<Integer, String> hCr = new HashMap(); HashMap<String, String> hCs = new HashMap(); ArrayList<String> hCt = new ArrayList(); d hCu; a hCv; private ag hCw = new 3(this); c hCx = new 7(this); b htQ; List<com.tencent.mm.plugin.card.model.b> htU = new ArrayList(); ArrayList<la> htW; private View hyK; public int hzB = 0; String hzC = ""; String hzD = ""; public ArrayList<String> hzE = new ArrayList(); public ArrayList<String> hzF = new ArrayList(); static /* synthetic */ void a(e eVar) { Intent intent = new Intent(); if (eVar.htQ instanceof CardInfo) { intent.putExtra("key_card_info_data", (CardInfo) eVar.htQ); } else if (eVar.htQ instanceof ShareCardInfo) { intent.putExtra("key_card_info_data", (ShareCardInfo) eVar.htQ); } intent.putExtra("key_from_appbrand_type", eVar.hCv.hCB); intent.setClass(eVar.hBT, CardShopUI.class); eVar.hBT.startActivity(intent); h hVar = h.mEJ; Object[] objArr = new Object[9]; objArr[0] = "UsedStoresView"; objArr[1] = Integer.valueOf(eVar.htQ.awm().huV); objArr[2] = eVar.htQ.awr(); objArr[3] = eVar.htQ.awq(); objArr[4] = Integer.valueOf(0); objArr[5] = Integer.valueOf(eVar.hCv.hza); objArr[6] = eVar.hCv.hBD; objArr[7] = Integer.valueOf(eVar.htQ.awk() ? 1 : 0); objArr[8] = ""; hVar.h(11324, objArr); } public e(CardDetailBaseUI cardDetailBaseUI, View view) { this.hBT = cardDetailBaseUI; this.hyK = view; } public final void a(b bVar, a aVar, ArrayList<la> arrayList) { this.htQ = bVar; this.hCv = aVar; this.htW = arrayList; } public final View findViewById(int i) { return this.hyK.findViewById(i); } public final b ayu() { return this.htQ; } public final void d(b bVar) { if (bVar != null) { this.htQ = bVar; if (this.hCu != null) { this.hCu.d(bVar); } axM(); } } public final boolean ayv() { return this.hBW; } public final void ayw() { this.hBW = false; } public final MMActivity ayx() { return this.hBT; } public final OnClickListener ayy() { return this.eZF; } public final g ayz() { return this.hBU; } public final d ayA() { return this.hCu; } public final a ayB() { return this.hCv; } public final f ayC() { return this.hCo; } public final j ayD() { return this.hCm; } public final String getString(int i) { return this.hBT.getString(i); } public final void axM() { if (this.htQ == null) { x.e("MicroMsg.CardDetailUIContoller", "doUpdate fail, mCardInfo == null"); if (this.hCu != null) { this.hCu.ayr(); } } else if (this.htQ.awm() == null) { x.e("MicroMsg.CardDetailUIContoller", "doUpdate fail, mCardInfo.getCardTpInfo() == null"); if (this.hCu != null) { this.hCu.ayr(); } } else if (this.htQ.awn() == null) { x.e("MicroMsg.CardDetailUIContoller", "doUpdate fail, mCardInfo.getDataInfo() == null"); if (this.hCu != null) { this.hCu.ayr(); } } else if (this.htQ.avY()) { int i; x.i("MicroMsg.CardDetailUIContoller", "doUpdate()"); x.i("MicroMsg.CardDetailUIContoller", "doUpdate() showAcceptView:" + this.htQ.awm().roh); f fVar = this.hCo; b bVar = this.htQ; ArrayList arrayList = this.htW; int i2 = this.hCv.hop; fVar.htQ = bVar; fVar.htW = arrayList; fVar.hop = i2; boolean z = this.hBU == null ? false : this.htQ.avS() ? !(this.hBU instanceof com.tencent.mm.plugin.card.ui.a.h) : this.htQ.avT() ? !(this.hBU instanceof com.tencent.mm.plugin.card.ui.a.e) : this.htQ.avW() ? !(this.hBU instanceof com.tencent.mm.plugin.card.ui.a.b) : this.htQ.avU() ? !(this.hBU instanceof com.tencent.mm.plugin.card.ui.a.c) : this.htQ.avV() ? !(this.hBU instanceof com.tencent.mm.plugin.card.ui.a.f) : this.htQ.avX() ? !(this.hBU instanceof com.tencent.mm.plugin.card.ui.a.d) : !(this.hBU instanceof com.tencent.mm.plugin.card.ui.a.a); if (z) { this.hBU.release(); this.hBU = null; x.i("MicroMsg.CardDetailUIContoller", "updateShowLogic, need recreate show logic, card_type:%d", new Object[]{Integer.valueOf(this.htQ.awm().huV)}); } if (this.hBU == null) { x.i("MicroMsg.CardDetailUIContoller", "updateShowLogic, mCardShowLogic == null, card_type:%d", new Object[]{Integer.valueOf(this.htQ.awm().huV)}); x.i("MicroMsg.CardDetailUIContoller", "createShowLogic, card_type:%d", new Object[]{Integer.valueOf(this.htQ.awm().huV)}); if (!this.htQ.avS()) { switch (this.htQ.awm().huV) { case 0: this.hBU = new com.tencent.mm.plugin.card.ui.a.c(this.hBT); break; case 10: this.hBU = new com.tencent.mm.plugin.card.ui.a.e(this.hBT); break; case 11: this.hBU = new com.tencent.mm.plugin.card.ui.a.b(this.hBT); break; case 20: this.hBU = new com.tencent.mm.plugin.card.ui.a.f(this.hBT); break; case a$k.AppCompatTheme_actionModeSplitBackground /*30*/: this.hBU = new com.tencent.mm.plugin.card.ui.a.d(this.hBT); break; default: this.hBU = new com.tencent.mm.plugin.card.ui.a.a(this.hBT); break; } } this.hBU = new com.tencent.mm.plugin.card.ui.a.h(this.hBT); } x.i("MicroMsg.CardDetailUIContoller", "updateShowLogic, card_tye:%d", new Object[]{Integer.valueOf(this.htQ.awm().huV)}); this.hBU.a(this.htQ, this.hCv); this.hBU.azH(); x.i("MicroMsg.CardDetailUIContoller", ""); if (this.hBU.azp()) { this.hBT.setMMTitle(this.hCo.getTitle()); } else { this.hBT.setMMTitle(""); } if (this.htQ == null) { x.e("MicroMsg.CardDetailUIContoller", "updateWidget, mCardInfo is null"); } else { if (this.hBZ != null) { if (this.htQ.avT()) { if (!(this.hBZ instanceof com.tencent.mm.plugin.card.widget.e)) { View azX; z = true; if (z) { azX = this.hBZ.azX(); if (azX != null) { this.bo.removeView(azX); } this.bo.removeAllViews(); this.bo.invalidate(); this.hBZ.release(); this.hBZ = null; } if (this.hBZ == null) { if (this.htQ.avT()) { this.hBZ = new com.tencent.mm.plugin.card.widget.e(this.hBT); } else if (this.htQ.avW()) { this.hBZ = new com.tencent.mm.plugin.card.widget.c(this.hBT); } else if (this.htQ.avU()) { this.hBZ = new com.tencent.mm.plugin.card.widget.b(this.hBT); } else if (this.htQ.avV()) { this.hBZ = new com.tencent.mm.plugin.card.widget.f(this.hBT); } else if (this.htQ.avX()) { this.hBZ = new com.tencent.mm.plugin.card.widget.d(this.hBT); } else { this.hBZ = new com.tencent.mm.plugin.card.widget.b(this.hBT); } this.hBZ.k(this.htQ); azX = this.hBZ.azX(); if (azX != null) { LinearLayout linearLayout = this.bo; azX.setLayoutParams(new LayoutParams(-1, -2)); linearLayout.addView(azX); } this.bo.invalidate(); this.hBZ.setOnClickListener(this.eZF); v(false, false); } if (this.hBZ != null) { if (this.htQ.avV()) { ((com.tencent.mm.plugin.card.widget.f) this.hBZ).htW = this.htW; } this.hBZ.f(this.htQ); } } } else if (this.htQ.avW()) { if (!(this.hBZ instanceof com.tencent.mm.plugin.card.widget.c)) { z = true; if (z) { azX = this.hBZ.azX(); if (azX != null) { this.bo.removeView(azX); } this.bo.removeAllViews(); this.bo.invalidate(); this.hBZ.release(); this.hBZ = null; } if (this.hBZ == null) { if (this.htQ.avT()) { this.hBZ = new com.tencent.mm.plugin.card.widget.e(this.hBT); } else if (this.htQ.avW()) { this.hBZ = new com.tencent.mm.plugin.card.widget.c(this.hBT); } else if (this.htQ.avU()) { this.hBZ = new com.tencent.mm.plugin.card.widget.b(this.hBT); } else if (this.htQ.avV()) { this.hBZ = new com.tencent.mm.plugin.card.widget.f(this.hBT); } else if (this.htQ.avX()) { this.hBZ = new com.tencent.mm.plugin.card.widget.d(this.hBT); } else { this.hBZ = new com.tencent.mm.plugin.card.widget.b(this.hBT); } this.hBZ.k(this.htQ); azX = this.hBZ.azX(); if (azX != null) { LinearLayout linearLayout2 = this.bo; azX.setLayoutParams(new LayoutParams(-1, -2)); linearLayout2.addView(azX); } this.bo.invalidate(); this.hBZ.setOnClickListener(this.eZF); v(false, false); } if (this.hBZ != null) { if (this.htQ.avV()) { ((com.tencent.mm.plugin.card.widget.f) this.hBZ).htW = this.htW; } this.hBZ.f(this.htQ); } } } else if (this.htQ.avU()) { if (!(this.hBZ instanceof com.tencent.mm.plugin.card.widget.b)) { z = true; if (z) { azX = this.hBZ.azX(); if (azX != null) { this.bo.removeView(azX); } this.bo.removeAllViews(); this.bo.invalidate(); this.hBZ.release(); this.hBZ = null; } if (this.hBZ == null) { if (this.htQ.avT()) { this.hBZ = new com.tencent.mm.plugin.card.widget.e(this.hBT); } else if (this.htQ.avW()) { this.hBZ = new com.tencent.mm.plugin.card.widget.c(this.hBT); } else if (this.htQ.avU()) { this.hBZ = new com.tencent.mm.plugin.card.widget.b(this.hBT); } else if (this.htQ.avV()) { this.hBZ = new com.tencent.mm.plugin.card.widget.f(this.hBT); } else if (this.htQ.avX()) { this.hBZ = new com.tencent.mm.plugin.card.widget.d(this.hBT); } else { this.hBZ = new com.tencent.mm.plugin.card.widget.b(this.hBT); } this.hBZ.k(this.htQ); azX = this.hBZ.azX(); if (azX != null) { LinearLayout linearLayout22 = this.bo; azX.setLayoutParams(new LayoutParams(-1, -2)); linearLayout22.addView(azX); } this.bo.invalidate(); this.hBZ.setOnClickListener(this.eZF); v(false, false); } if (this.hBZ != null) { if (this.htQ.avV()) { ((com.tencent.mm.plugin.card.widget.f) this.hBZ).htW = this.htW; } this.hBZ.f(this.htQ); } } } else if (this.htQ.avV()) { if (!(this.hBZ instanceof com.tencent.mm.plugin.card.widget.f)) { z = true; if (z) { azX = this.hBZ.azX(); if (azX != null) { this.bo.removeView(azX); } this.bo.removeAllViews(); this.bo.invalidate(); this.hBZ.release(); this.hBZ = null; } if (this.hBZ == null) { if (this.htQ.avT()) { this.hBZ = new com.tencent.mm.plugin.card.widget.e(this.hBT); } else if (this.htQ.avW()) { this.hBZ = new com.tencent.mm.plugin.card.widget.c(this.hBT); } else if (this.htQ.avU()) { this.hBZ = new com.tencent.mm.plugin.card.widget.b(this.hBT); } else if (this.htQ.avV()) { this.hBZ = new com.tencent.mm.plugin.card.widget.f(this.hBT); } else if (this.htQ.avX()) { this.hBZ = new com.tencent.mm.plugin.card.widget.d(this.hBT); } else { this.hBZ = new com.tencent.mm.plugin.card.widget.b(this.hBT); } this.hBZ.k(this.htQ); azX = this.hBZ.azX(); if (azX != null) { LinearLayout linearLayout222 = this.bo; azX.setLayoutParams(new LayoutParams(-1, -2)); linearLayout222.addView(azX); } this.bo.invalidate(); this.hBZ.setOnClickListener(this.eZF); v(false, false); } if (this.hBZ != null) { if (this.htQ.avV()) { ((com.tencent.mm.plugin.card.widget.f) this.hBZ).htW = this.htW; } this.hBZ.f(this.htQ); } } } else if (this.htQ.avX() && !(this.hBZ instanceof com.tencent.mm.plugin.card.widget.d)) { z = true; if (z) { azX = this.hBZ.azX(); if (azX != null) { this.bo.removeView(azX); } this.bo.removeAllViews(); this.bo.invalidate(); this.hBZ.release(); this.hBZ = null; } if (this.hBZ == null) { if (this.htQ.avT()) { this.hBZ = new com.tencent.mm.plugin.card.widget.e(this.hBT); } else if (this.htQ.avW()) { this.hBZ = new com.tencent.mm.plugin.card.widget.c(this.hBT); } else if (this.htQ.avU()) { this.hBZ = new com.tencent.mm.plugin.card.widget.b(this.hBT); } else if (this.htQ.avV()) { this.hBZ = new com.tencent.mm.plugin.card.widget.f(this.hBT); } else if (this.htQ.avX()) { this.hBZ = new com.tencent.mm.plugin.card.widget.d(this.hBT); } else { this.hBZ = new com.tencent.mm.plugin.card.widget.b(this.hBT); } this.hBZ.k(this.htQ); azX = this.hBZ.azX(); if (azX != null) { LinearLayout linearLayout2222 = this.bo; azX.setLayoutParams(new LayoutParams(-1, -2)); linearLayout2222.addView(azX); } this.bo.invalidate(); this.hBZ.setOnClickListener(this.eZF); v(false, false); } if (this.hBZ != null) { if (this.htQ.avV()) { ((com.tencent.mm.plugin.card.widget.f) this.hBZ).htW = this.htW; } this.hBZ.f(this.htQ); } } } z = false; if (z) { azX = this.hBZ.azX(); if (azX != null) { this.bo.removeView(azX); } this.bo.removeAllViews(); this.bo.invalidate(); this.hBZ.release(); this.hBZ = null; } if (this.hBZ == null) { if (this.htQ.avT()) { this.hBZ = new com.tencent.mm.plugin.card.widget.e(this.hBT); } else if (this.htQ.avW()) { this.hBZ = new com.tencent.mm.plugin.card.widget.c(this.hBT); } else if (this.htQ.avU()) { this.hBZ = new com.tencent.mm.plugin.card.widget.b(this.hBT); } else if (this.htQ.avV()) { this.hBZ = new com.tencent.mm.plugin.card.widget.f(this.hBT); } else if (this.htQ.avX()) { this.hBZ = new com.tencent.mm.plugin.card.widget.d(this.hBT); } else { this.hBZ = new com.tencent.mm.plugin.card.widget.b(this.hBT); } this.hBZ.k(this.htQ); azX = this.hBZ.azX(); if (azX != null) { LinearLayout linearLayout22222 = this.bo; azX.setLayoutParams(new LayoutParams(-1, -2)); linearLayout22222.addView(azX); } this.bo.invalidate(); this.hBZ.setOnClickListener(this.eZF); v(false, false); } if (this.hBZ != null) { if (this.htQ.avV()) { ((com.tencent.mm.plugin.card.widget.f) this.hBZ).htW = this.htW; } this.hBZ.f(this.htQ); } } if (this.hBU.azq()) { x.i("MicroMsg.CardDetailUIContoller", "updateShareUsersInfoLayout()"); this.hBV.update(); } else { x.i("MicroMsg.CardDetailUIContoller", "don't updateShareUsersInfoLayout()"); this.hBV.azI(); } if (this.hBU.azh()) { if (this.hCl == null) { this.hCl = new com.tencent.mm.plugin.card.ui.view.b(); this.hCl.a(this); } x.i("MicroMsg.CardDetailUIContoller", "update CardAcceptView()"); this.hCl.update(); } else { x.i("MicroMsg.CardDetailUIContoller", "don't update CardAcceptView()"); if (this.hCl != null) { this.hCl.azI(); } } this.hBT.dQ(this.hBU.azl()); if (this.hBU.azm()) { this.hCr.clear(); this.hCt.clear(); if (this.htQ.awa()) { this.hCt.add(getString(com.tencent.mm.plugin.card.a.g.card_wv_alert_share_to_friend)); this.hCr.put(Integer.valueOf(0), "menu_func_share_friend"); this.hCt.add(getString(com.tencent.mm.plugin.card.a.g.card_wv_alert_share_timeline)); this.hCr.put(Integer.valueOf(1), "menu_func_share_timeline"); i = 2; } else { i = 0; } if (!TextUtils.isEmpty(this.htQ.awn().rng)) { this.hCt.add(getString(com.tencent.mm.plugin.card.a.g.card_menu_report)); this.hCr.put(Integer.valueOf(i), "menu_func_report"); i++; } nU(i); if (this.hCt.size() > 0) { this.hBT.dQ(true); } } if (this.hBU.azn()) { this.hCr.clear(); this.hCt.clear(); if (this.htQ.avR() && this.htQ.avZ()) { this.hCt.add(getString(com.tencent.mm.plugin.card.a.g.card_menu_gift_card)); this.hCr.put(Integer.valueOf(0), "menu_func_gift"); i = 1; } else { i = 0; } if (!TextUtils.isEmpty(this.htQ.awn().rng)) { this.hCt.add(getString(com.tencent.mm.plugin.card.a.g.card_menu_report)); this.hCr.put(Integer.valueOf(i), "menu_func_report"); i++; } if (this.htQ.avR()) { this.hCt.add(getString(com.tencent.mm.plugin.card.a.g.app_delete)); this.hCr.put(Integer.valueOf(i), "menu_func_delete"); i++; } else if (this.htQ.avS()) { String GF = q.GF(); String aws = this.htQ.aws(); if (GF == null || !GF.equals(aws)) { x.i("MicroMsg.CardDetailUIContoller", "the card is not belong mine"); } else { this.hCt.add(getString(com.tencent.mm.plugin.card.a.g.app_delete)); this.hCr.put(Integer.valueOf(i), "menu_func_delete_share_card"); i++; } } nU(i); if (this.hCt.size() > 0) { this.hBT.dQ(true); } } if (this.hBU.azo()) { this.hCr.clear(); this.hCt.clear(); if (TextUtils.isEmpty(this.htQ.awn().rng)) { i = 0; } else { this.hCt.add(getString(com.tencent.mm.plugin.card.a.g.card_menu_report)); this.hCr.put(Integer.valueOf(0), "menu_func_report"); i = 1; } nU(i); if (this.hCt.size() > 0) { this.hBT.dQ(true); } } if (this.hBZ != null && (this.hBZ instanceof com.tencent.mm.plugin.card.widget.b)) { ((com.tencent.mm.plugin.card.widget.b) this.hBZ).aAd(); } v(this.hBU.azj(), this.hBU.azk()); if (!this.htQ.avT() && this.hBU.azs()) { x.i("MicroMsg.CardDetailUIContoller", "update mFromUserView"); this.hBX.update(); } else if (this.htQ.avT() && this.hBU.azs()) { x.i("MicroMsg.CardDetailUIContoller", "update mAcceptHeaderLayout for username"); this.hBY.update(); } else if (this.hBU.azt()) { x.i("MicroMsg.CardDetailUIContoller", "update mAcceptHeaderLayout"); this.hBY.update(); } else { x.i("MicroMsg.CardDetailUIContoller", "don't update mFromUserView and mAcceptHeaderLayout"); this.hBY.azI(); this.hBX.azI(); } if (this.hBZ != null) { this.hBZ.dW(this.hBU.ayF()); } if (this.bPd) { x.i("MicroMsg.CardDetailUIContoller", "updateUIBackground onPause return"); } else { View findViewById; LayoutParams layoutParams; if (this.htQ.avR() && this.htQ.avT()) { this.hyK.findViewById(com.tencent.mm.plugin.card.a.d.card_detain_ui).setBackgroundColor(this.hBT.getResources().getColor(com.tencent.mm.plugin.card.a.a.card_bg_color)); com.tencent.mm.ui.statusbar.a.c(this.hyK, -1, true); this.hBT.G(-1, true); } else { i = l.xV(this.htQ.awm().dxh); this.hyK.findViewById(com.tencent.mm.plugin.card.a.d.card_detain_ui).setBackgroundColor(i); com.tencent.mm.ui.statusbar.a.c(this.hyK, i, true); this.hBT.G(i, false); } View findViewById2 = this.hyK.findViewById(com.tencent.mm.plugin.card.a.d.detail_first_container); View findViewById3 = this.hyK.findViewById(com.tencent.mm.plugin.card.a.d.header_view); View findViewById4 = this.hyK.findViewById(com.tencent.mm.plugin.card.a.d.detail_body_layout); if (this.htQ.avR() && this.hBU.azs()) { if (this.htQ.avU()) { findViewById2.setBackgroundResource(com.tencent.mm.plugin.card.a.c.card_white_sequare_top_bg); this.hyK.findViewById(com.tencent.mm.plugin.card.a.d.from_username_container).setBackgroundResource(com.tencent.mm.plugin.card.a.c.card_gray_sequare_bottom_bg); findViewById4.setBackgroundResource(0); } else if (this.htQ.avT()) { this.hyK.findViewById(com.tencent.mm.plugin.card.a.d.from_username_container).setBackgroundResource(0); findViewById4.setBackgroundColor(this.hBT.getResources().getColor(com.tencent.mm.plugin.card.a.a.card_bg_color)); } else if (this.htQ.avV()) { findViewById2.setBackgroundResource(com.tencent.mm.plugin.card.a.c.card_white_sequare_top_bg); this.hyK.findViewById(com.tencent.mm.plugin.card.a.d.from_username_container).setBackgroundResource(com.tencent.mm.plugin.card.a.c.card_gray_sequare_bottom_bg); findViewById4.setBackgroundResource(0); } else if (!this.htQ.avW() && this.htQ.avX()) { findViewById4.setBackgroundColor(this.hBT.getResources().getColor(com.tencent.mm.plugin.card.a.a.card_bg_color)); } } else if (this.htQ.avS()) { if (this.hBU.azq() && this.hBW) { findViewById2.setBackgroundResource(com.tencent.mm.plugin.card.a.c.card_white_sequare_top_bg); findViewById4.setBackgroundResource(0); } else if (!this.hBU.azq() || this.hBW) { findViewById2.setBackgroundResource(0); if (this.hBU.ayF()) { findViewById4.setBackgroundResource(com.tencent.mm.plugin.card.a.c.card_white_bottom_bg); } else { findViewById4.setBackgroundResource(com.tencent.mm.plugin.card.a.c.card_white_sequare_top_bg); } } else { findViewById2.setBackgroundResource(com.tencent.mm.plugin.card.a.c.card_white_bottom_bg); findViewById4.setBackgroundResource(0); } } else if (this.htQ.avU()) { findViewById2.setBackgroundResource(0); if (this.hBU.ayF()) { findViewById4.setBackgroundResource(com.tencent.mm.plugin.card.a.c.card_white_bottom_bg); } else { findViewById4.setBackgroundResource(com.tencent.mm.plugin.card.a.c.card_white_sequare_top_bg); } } else if (this.htQ.avV()) { findViewById2.setBackgroundResource(com.tencent.mm.plugin.card.a.c.card_widget_member_bg); findViewById4.setBackgroundResource(0); } else { findViewById2.setBackgroundResource(0); findViewById4.setBackgroundColor(this.hBT.getResources().getColor(com.tencent.mm.plugin.card.a.a.card_bg_color)); } if (this.htQ.avX()) { TextView textView = (TextView) this.hyK.findViewById(com.tencent.mm.plugin.card.a.d.bottom_wave); Drawable bitmapDrawable = new BitmapDrawable(com.tencent.mm.sdk.platformtools.c.CV(com.tencent.mm.plugin.card.a.c.card_wavy)); bitmapDrawable.setTileModeX(TileMode.REPEAT); textView.setBackgroundDrawable(bitmapDrawable); textView.setVisibility(0); } Rect rect = new Rect(0, 0, 0, 0); findViewById2.setPadding(rect.left, rect.top, rect.right, rect.bottom); findViewById2.invalidate(); findViewById4.setPadding(rect.left, rect.top, rect.right, rect.bottom); findViewById4.invalidate(); if (this.htQ.avS() && this.hBU.azq() && this.hBW) { findViewById = this.hyK.findViewById(com.tencent.mm.plugin.card.a.d.share_users_bottom_layout); findViewById.setPadding(rect.left, rect.top, rect.right, rect.bottom); findViewById.invalidate(); } if (this.htQ.avR() && this.hBU.azs()) { findViewById = this.hyK.findViewById(com.tencent.mm.plugin.card.a.d.from_username_container); rect.left = this.hBT.getResources().getDimensionPixelOffset(com.tencent.mm.plugin.card.a.b.LargePadding); rect.right = this.hBT.getResources().getDimensionPixelOffset(com.tencent.mm.plugin.card.a.b.LargePadding); findViewById.setPadding(rect.left, rect.top, rect.right, rect.bottom); findViewById.invalidate(); if (this.htQ.avV()) { findViewById = this.hyK.findViewById(com.tencent.mm.plugin.card.a.d.from_username_layout); layoutParams = (LayoutParams) findViewById.getLayoutParams(); int dimensionPixelSize = this.hBT.getResources().getDimensionPixelSize(com.tencent.mm.plugin.card.a.b.SmallPadding); layoutParams.rightMargin = dimensionPixelSize; layoutParams.leftMargin = dimensionPixelSize; findViewById.setLayoutParams(layoutParams); } } if (this.hBU.azs() || this.hBU.azq()) { if (this.hBZ != null && ((this.htQ.avR() && this.htQ.avU()) || this.htQ.avS())) { this.hBZ.oc(0); } } else if (this.hBZ != null && ((this.htQ.avR() && this.htQ.avU()) || this.htQ.avS())) { if (this.hBU.ayF()) { this.hBZ.oc(com.tencent.mm.plugin.card.a.c.card_white_top_bg); } else { this.hBZ.oc(com.tencent.mm.plugin.card.a.c.card_white_sequare_bottom_bg); } } if (this.hBZ != null && this.htQ.avR() && this.htQ.avT()) { this.hBZ.a(l.cm(l.xV(this.htQ.awm().dxh), this.hBT.getResources().getDimensionPixelOffset(com.tencent.mm.plugin.card.a.b.card_member_widget_bg_big_round_radius))); } if (this.htQ.avR() && this.htQ.avT()) { layoutParams = (LayoutParams) findViewById2.getLayoutParams(); layoutParams.bottomMargin = 0; layoutParams.topMargin = 0; layoutParams.rightMargin = 0; layoutParams.leftMargin = 0; if (TextUtils.isEmpty(this.htQ.awm().rnR)) { layoutParams.height = 0; layoutParams.weight = 1.0f; } else { layoutParams.weight = 0.0f; layoutParams.height = -2; } findViewById2.setLayoutParams(layoutParams); layoutParams = (LayoutParams) findViewById3.getLayoutParams(); int dimensionPixelSize2 = this.hBT.getResources().getDimensionPixelSize(com.tencent.mm.plugin.card.a.b.MiddlePadding); layoutParams.rightMargin = dimensionPixelSize2; layoutParams.leftMargin = dimensionPixelSize2; if (this.htQ.avT()) { layoutParams.topMargin = this.hBT.getResources().getDimensionPixelSize(com.tencent.mm.plugin.card.a.b.ListPadding); layoutParams.bottomMargin = this.hBT.getResources().getDimensionPixelSize(com.tencent.mm.plugin.card.a.b.LittlePadding); dimensionPixelSize2 = this.hBT.getResources().getDimensionPixelSize(com.tencent.mm.plugin.card.a.b.LargerPadding); layoutParams.rightMargin = dimensionPixelSize2; layoutParams.leftMargin = dimensionPixelSize2; } else { dimensionPixelSize2 = this.hBT.getResources().getDimensionPixelSize(com.tencent.mm.plugin.card.a.b.BiggerPadding); layoutParams.bottomMargin = dimensionPixelSize2; layoutParams.topMargin = dimensionPixelSize2; } findViewById3.setLayoutParams(layoutParams); layoutParams = (LayoutParams) findViewById4.getLayoutParams(); layoutParams.bottomMargin = 0; layoutParams.topMargin = 0; layoutParams.rightMargin = 0; layoutParams.leftMargin = 0; if (this.htQ.avT()) { layoutParams.bottomMargin = this.hBT.getResources().getDimensionPixelSize(com.tencent.mm.plugin.card.a.b.LargerPadding); } if (TextUtils.isEmpty(this.htQ.awm().rnR)) { layoutParams.height = 0; layoutParams.weight = 1.0f; } else { layoutParams.weight = 0.0f; layoutParams.height = -2; } findViewById4.setLayoutParams(layoutParams); if (!TextUtils.isEmpty(this.htQ.awm().rnR)) { findViewById2 = findViewById(com.tencent.mm.plugin.card.a.d.advertise_layout); layoutParams = (LayoutParams) findViewById2.getLayoutParams(); layoutParams.height = 0; layoutParams.weight = 1.0f; findViewById2.setLayoutParams(layoutParams); } } this.hyK.invalidate(); } if (this.hBU.azx()) { if (this.hCd == null) { this.hCd = new y(); this.hCd.a(this); } x.i("MicroMsg.CardDetailUIContoller", "update CardStatusView"); this.hCd.update(); } else { x.i("MicroMsg.CardDetailUIContoller", "don't update CardStatusView"); if (this.hCd != null) { this.hCd.azI(); } } if (this.hBU.azG()) { if (this.hCc == null) { this.hCc = new com.tencent.mm.plugin.card.ui.view.c(); this.hCc.a(this); } x.i("MicroMsg.CardDetailUIContoller", "update mAdtitleView()"); this.hCc.update(); } else { x.i("MicroMsg.CardDetailUIContoller", "don't update AdTitleView()"); if (this.hCc != null) { this.hCc.azI(); } } if (this.hBU.azy()) { if (this.hCe == null) { this.hCe = new k(); this.hCe.a(this); } x.i("MicroMsg.CardDetailUIContoller", "update mCardDetailFieldView()"); this.hCe.update(); } else { x.i("MicroMsg.CardDetailUIContoller", "don't update mCardDetailFieldView()"); if (this.hCe != null) { this.hCe.azI(); } } if (this.hBU.azz()) { if (this.hCf == null) { this.hCf = new w(); this.hCf.a(this); } x.i("MicroMsg.CardDetailUIContoller", "update CardSecondaryFieldView"); this.hCf.update(); } else { x.i("MicroMsg.CardDetailUIContoller", "don't update CardSecondaryFieldView"); if (this.hCf != null) { this.hCf.azI(); } } if (this.hBU.azA()) { if (this.hCg == null) { this.hCg = new com.tencent.mm.plugin.card.ui.view.l(); this.hCg.a(this); } x.i("MicroMsg.CardDetailUIContoller", "update CardDetailTableView"); this.hCg.update(); } else { x.i("MicroMsg.CardDetailUIContoller", "don't update CardDetailTableView"); if (this.hCg != null) { this.hCg.azI(); } } if (this.hBU.azB()) { if (this.hCh == null) { this.hCh = new z(); this.hCh.a(this); } x.i("MicroMsg.CardDetailUIContoller", "update CardThirdFieldView"); this.hCh.update(); } else { x.i("MicroMsg.CardDetailUIContoller", "don't update CardThirdFieldView"); if (this.hCh != null) { this.hCh.azI(); } } if (this.hBU.azD()) { if (this.hCi == null) { this.hCi = new com.tencent.mm.plugin.card.ui.view.e(); this.hCi.a(this); } x.i("MicroMsg.CardDetailUIContoller", "updateCardAnnoucementView"); this.hCi.update(); } else { x.i("MicroMsg.CardDetailUIContoller", "don't updateCardAnnoucementView"); if (this.hCi != null) { this.hCi.azI(); } } if (this.hBU.azC()) { if (this.hCj == null) { this.hCj = new u(); this.hCj.a(this); } x.i("MicroMsg.CardDetailUIContoller", "updateCardOperateFieldView"); this.hCj.update(); } else { x.i("MicroMsg.CardDetailUIContoller", "don't updateCardOperateFieldView"); if (this.hCj != null) { this.hCj.azI(); } } if (this.hBU.azu()) { com.tencent.mm.plugin.card.model.b bVar2; this.htU.clear(); List list = this.htU; f fVar2 = this.hCo; fVar2.htU.clear(); if (!(fVar2.htQ.awn().rno == null || bi.oW(fVar2.htQ.awn().rno.title))) { bVar2 = new com.tencent.mm.plugin.card.model.b(); bVar2.hvh = 1; bVar2.title = fVar2.htQ.awn().rno.title; bVar2.hyz = ""; bVar2.url = "card://jump_card_gift"; bVar2.lMY = fVar2.htQ.awn().rno.lMY; fVar2.htU.add(bVar2); } if (fVar2.htQ.awn().rmX != null && fVar2.htQ.awn().rmX.size() > 0) { Collection az = l.az(fVar2.htQ.awn().rmX); if (az != null) { ((com.tencent.mm.plugin.card.model.b) az.get(0)).hvi = false; fVar2.htU.addAll(az); } } if (((fVar2.hop == 6 && fVar2.htQ.awn().rnb <= 0) || l.ob(fVar2.hop)) && fVar2.htQ.awi() && fVar2.htQ.avR() && fVar2.htQ.avZ()) { bVar2 = new com.tencent.mm.plugin.card.model.b(); bVar2.hvh = 1; bVar2.title = ad.getContext().getString(com.tencent.mm.plugin.card.a.g.card_menu_gift_card); bVar2.hyz = ""; bVar2.url = "card://jump_gift"; fVar2.htU.add(bVar2); } if (!(fVar2.htQ.awn().status == 0 || fVar2.htQ.awn().status == 1)) { i = fVar2.htQ.awn().status; } if (fVar2.hop != 3 && fVar2.hop == 6) { i = fVar2.htQ.awn().rnb; } sd sdVar = fVar2.htQ.awm().rnY; if (fVar2.htQ.awn().rnh != null) { TextUtils.isEmpty(fVar2.htQ.awn().rnh.title); } com.tencent.mm.plugin.card.model.b bVar3 = new com.tencent.mm.plugin.card.model.b(); z = fVar2.htQ.avX() ? false : sdVar == null || sdVar.rvz == null || sdVar.rvz.size() <= 0 || TextUtils.isEmpty((CharSequence) sdVar.rvz.get(0)); bVar3.hvi = false; bVar3.hvh = 1; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(fVar2.getTitle()); stringBuilder.append(fVar2.getString(com.tencent.mm.plugin.card.a.g.card_detail_info)); bVar3.title = stringBuilder.toString(); bVar3.huX = ""; bVar3.hyz = ""; bVar3.url = "card://jump_detail"; if (z) { fVar2.htU.add(bVar3); } if (!fVar2.htQ.avV() || fVar2.htQ.awm().rnK <= 0) { la laVar; if (!fVar2.htQ.avT() || fVar2.htQ.awm().rnK <= 0) { if (fVar2.htQ.awm().rnK > 0) { x.e("MicroMsg.CardDetailDataMgr", "shop_count:" + fVar2.htQ.awm().rnK); if (fVar2.htQ.awm().rnK > 0 && fVar2.htW != null && fVar2.htW.size() > 0) { laVar = (la) fVar2.htW.get(0); if (laVar != null && laVar.rnu < 50000.0f) { bVar3 = new com.tencent.mm.plugin.card.model.b(); bVar3.hvh = 2; bVar3.title = laVar.name; bVar3.huX = fVar2.gKS.getString(com.tencent.mm.plugin.card.a.g.card_shop_distance_address, new Object[]{l.f(fVar2.gKS, laVar.rnu), laVar.dRH}); bVar3.hyz = ""; bVar3.url = "card://jump_shop"; bVar3.hvl = laVar.hvl; bVar3.dxh = fVar2.htQ.awm().dxh; fVar2.htU.add(bVar3); } else if (laVar != null) { x.e("MicroMsg.CardDetailDataMgr", "distance:" + laVar.rnu); } } } } if (fVar2.htQ.awm().rnK > 0 && fVar2.htW == null) { bVar2 = new com.tencent.mm.plugin.card.model.b(); bVar2.hvh = 1; if (TextUtils.isEmpty(fVar2.htQ.awm().roj)) { bVar2.title = fVar2.getString(com.tencent.mm.plugin.card.a.g.card_adapted_stores); } else { bVar2.title = fVar2.htQ.awm().roj; } bVar2.huX = ""; bVar2.hyz = ""; bVar2.url = "card://jump_shop_list"; fVar2.htU.add(bVar2); } else if (fVar2.htQ.awm().rnK > 0 && fVar2.htW != null && fVar2.htW.size() > 0) { bVar3 = new com.tencent.mm.plugin.card.model.b(); bVar3.hvh = 1; laVar = (la) fVar2.htW.get(0); if (!TextUtils.isEmpty(fVar2.htQ.awm().roj)) { bVar3.title = fVar2.htQ.awm().roj; } else if (fVar2.htQ.avT() || laVar.rnu >= 5000.0f) { bVar3.title = fVar2.getString(com.tencent.mm.plugin.card.a.g.card_adapted_stores); } else if (fVar2.htQ.awm().rnK == 1 || fVar2.htW.size() == 1) { x.i("MicroMsg.CardDetailDataMgr", "shop_count is 1 or mShopList size is 1"); } else { bVar3.title = fVar2.getString(com.tencent.mm.plugin.card.a.g.card_check_more_adapted_stores); } if (!fVar2.htQ.avT() || laVar.rnu >= 2000.0f) { bVar3.huX = ""; } else if (fVar2.htQ.awm().rnK > 1 || (fVar2.htW != null && fVar2.htW.size() > 1)) { bVar3.huX = fVar2.gKS.getString(com.tencent.mm.plugin.card.a.g.card_membership_most_nearby_shop, new Object[]{l.f(fVar2.gKS, laVar.rnu)}); } else { bVar3.huX = l.f(fVar2.gKS, laVar.rnu); } bVar3.hyz = ""; bVar3.url = "card://jump_shop_list"; fVar2.htU.add(bVar3); } } if (!((fVar2.htQ.avX() && fVar2.htQ.awn().status == 3) || TextUtils.isEmpty(fVar2.htQ.awm().rnD))) { fVar2.htU.add(fVar2.awL()); } list.addAll(fVar2.htU); m mVar = this.hCb; Collection collection = this.htU; mVar.htU.clear(); mVar.htU.addAll(collection); this.hCb.hGT = this.htQ.avX(); this.hCb.notifyDataSetChanged(); } else { x.i("MicroMsg.CardDetailUIContoller", "card is membership or share card or general coupon, not accept, don't updateCellData()"); } if (this.hBU.azv()) { this.htQ.a(this.htQ.awn()); l.j(this.htQ); if (this.hBU.azw()) { if (this.hCa == null) { if (this.htQ.awm().rol != null && this.htQ.awm().rol.rwc) { this.hCa = new m(); com.tencent.mm.plugin.card.b.g axy = am.axy(); if (axy.htB == null) { axy.htB = new ArrayList(); } if (this != null) { axy.htB.add(new WeakReference(this)); } } else if (this.htQ.awm().huV == 10) { this.hCa = new com.tencent.mm.plugin.card.ui.view.q(); } else { this.hCa = new j(); } this.hCa.a(this); this.hCa.update(); } else if (this.hCa.h(this.htQ)) { this.hCa.d(this.htQ); this.hCa.update(); } } else if (this.hCa != null) { this.hCa.azI(); } if (this.hBZ != null) { this.hBZ.dV(true); } } else { x.e("MicroMsg.CardDetailUIContoller", "don't update CardCodeView"); if (this.hCa != null) { this.hCa.azI(); } if (this.hBZ != null) { this.hBZ.dV(false); } } if (this.hBU.azE()) { x.i("MicroMsg.CardDetailUIContoller", "update CardAdvertiseView"); this.hCk.update(); } else { x.i("MicroMsg.CardDetailUIContoller", "don't update CardAdvertiseView"); this.hCk.azI(); } this.hCm.htQ = this.htQ; } else { x.e("MicroMsg.CardDetailUIContoller", "doUpdate fail, not support card type :%d", new Object[]{Integer.valueOf(this.htQ.awm().huV)}); if (TextUtils.isEmpty(this.htQ.awm().rnM)) { com.tencent.mm.ui.base.h.a(this.hBT, getString(com.tencent.mm.plugin.card.a.g.card_not_support_card_type), null, false, new 2(this)); return; } com.tencent.mm.plugin.card.d.b.a(this.hBT, this.htQ.awm().rnM, 0); if (this.hCu != null) { this.hCu.ayr(); } } } public final void c(com.tencent.mm.plugin.card.d.c cVar) { x.i("MicroMsg.CardDetailUIContoller", "onGetCodeSuccess! do update code view!"); Message obtain = Message.obtain(); c cVar2 = new c((byte) 0); cVar2.hCH = b.hCC; cVar2.hCI = cVar; obtain.obj = cVar2; this.hCw.sendMessage(obtain); } public final void V(int i, String str) { String string; x.e("MicroMsg.CardDetailUIContoller", "onGetCodeFail! errCode = %d, errMsg=%s", new Object[]{Integer.valueOf(i), str}); Message obtain = Message.obtain(); c cVar = new c((byte) 0); cVar.hCH = b.hCF; cVar.errCode = i; if (i == -1) { string = getString(com.tencent.mm.plugin.card.a.g.card_get_code_network_connet_failure); } else if (i == 2) { string = getString(com.tencent.mm.plugin.card.a.g.card_code_cannot_get); } else { string = getString(com.tencent.mm.plugin.card.a.g.card_get_code_failure); } cVar.Yy = string; obtain.obj = cVar; this.hCw.sendMessage(obtain); } public final void awM() { x.i("MicroMsg.CardDetailUIContoller", "on show TimeExpired! do update refresh code view!"); Message obtain = Message.obtain(); c cVar = new c((byte) 0); cVar.hCH = b.hCD; obtain.obj = cVar; this.hCw.sendMessage(obtain); } public final void b(com.tencent.mm.plugin.card.d.c cVar) { x.i("MicroMsg.CardDetailUIContoller", "on onReceiveCodeUnavailable! do update refresh code view!"); Message obtain = Message.obtain(); c cVar2 = new c((byte) 0); cVar2.hCH = b.hCE; cVar2.hCI = cVar; obtain.obj = cVar2; this.hCw.sendMessage(obtain); } public final void a(boolean z, com.tencent.mm.plugin.card.b.j.b bVar, boolean z2) { int i = 1; h hVar; Object[] objArr; if (z) { pr prVar = this.htQ.awn().rnk; h hVar2; Object[] objArr2; if (this.htQ.awf()) { com.tencent.mm.plugin.card.d.b.a(this.hBT, bVar.huK, bVar.huL, z2, this.htQ); h.mEJ.h(11941, new Object[]{Integer.valueOf(17), this.htQ.awq(), this.htQ.awr(), "", this.htQ.awn().rnk.title}); return; } else if (prVar != null && !TextUtils.isEmpty(prVar.rnv) && !TextUtils.isEmpty(prVar.rnw)) { com.tencent.mm.plugin.card.d.b.a(this.htQ.awq(), prVar, this.hCv.hza, this.hCv.hCB); hVar2 = h.mEJ; objArr2 = new Object[5]; objArr2[0] = Integer.valueOf(6); objArr2[1] = this.htQ.awq(); objArr2[2] = this.htQ.awr(); objArr2[3] = ""; objArr2[4] = prVar.title != null ? prVar.title : ""; hVar2.h(11941, objArr2); return; } else if (prVar == null || TextUtils.isEmpty(prVar.url)) { hVar = h.mEJ; objArr = new Object[9]; objArr[0] = "CardConsumedCodeUI"; objArr[1] = Integer.valueOf(this.htQ.awm().huV); objArr[2] = this.htQ.awr(); objArr[3] = this.htQ.awq(); objArr[4] = Integer.valueOf(0); objArr[5] = Integer.valueOf(this.hCv.hza); objArr[6] = this.hCv.hBD; if (!this.htQ.awk()) { i = 0; } objArr[7] = Integer.valueOf(i); objArr[8] = ""; hVar.h(11324, objArr); xI(bVar.huH); return; } else { com.tencent.mm.plugin.card.d.b.a(this.hBT, l.x(prVar.url, prVar.roL), 1); hVar2 = h.mEJ; objArr2 = new Object[5]; objArr2[0] = Integer.valueOf(6); objArr2[1] = this.htQ.awq(); objArr2[2] = this.htQ.awr(); objArr2[3] = ""; objArr2[4] = prVar.title != null ? prVar.title : ""; hVar2.h(11941, objArr2); return; } } hVar = h.mEJ; objArr = new Object[9]; objArr[0] = "CardConsumedCodeUI"; objArr[1] = Integer.valueOf(this.htQ.awm().huV); objArr[2] = this.htQ.awr(); objArr[3] = this.htQ.awq(); objArr[4] = Integer.valueOf(0); objArr[5] = Integer.valueOf(this.hCv.hza); objArr[6] = this.hCv.hBD; if (!this.htQ.awk()) { i = 0; } objArr[7] = Integer.valueOf(i); objArr[8] = ""; hVar.h(11324, objArr); xI(bVar.huH); } private void v(boolean z, boolean z2) { if (this.hBZ != null) { this.hBZ.v(z, z2); } } private void nU(int i) { LinkedList linkedList = this.htQ.awn().rni; if (linkedList != null) { this.hCs.clear(); int i2 = 0; while (true) { int i3 = i2; if (i3 < linkedList.size()) { ax axVar = (ax) linkedList.get(i3); if (!(bi.oW(axVar.text) || bi.oW(axVar.url))) { this.hCt.add(axVar.text); this.hCr.put(Integer.valueOf(i), axVar.text); this.hCs.put(axVar.text, axVar.url); i++; } i2 = i3 + 1; } else { return; } } } } public final void b(int i, int i2, Intent intent) { switch (i) { case 0: case 1: case 4: if (i2 == -1) { this.hCp = intent.getStringExtra("Select_Conv_User"); String str = this.hCp; if (this.htQ.awm() == null) { x.e("MicroMsg.CardDetailUIContoller", "showGiftConfirmDialog mCardInfo.getCardTpInfo() == null"); return; } StringBuilder stringBuilder = new StringBuilder(); if (i == 0) { if (TextUtils.isEmpty(this.htQ.awo().sli)) { stringBuilder.append(getString(com.tencent.mm.plugin.card.a.g.sns_post_to)); } else { stringBuilder.append(this.htQ.awo().sli); } } else if (i == 1) { stringBuilder.append(getString(com.tencent.mm.plugin.card.a.g.card_share_to) + this.hCo.getTitle()); } else if (i == 4) { stringBuilder.append(getString(com.tencent.mm.plugin.card.a.g.card_recommend_to) + this.hCo.getTitle()); } t.a.qJO.a(this.hBT.mController, stringBuilder.toString(), this.htQ.awm().huW, this.htQ.awm().title + "\n" + this.htQ.awm().hwh, true, this.hBT.getResources().getString(com.tencent.mm.plugin.card.a.g.app_send), new 6(this, i, str)); return; } return; case 2: if (i2 == -1) { this.hzB = intent.getIntExtra("Ktag_range_index", 0); x.i("MicroMsg.CardDetailUIContoller", "mPrivateSelelct : %d", new Object[]{Integer.valueOf(this.hzB)}); if (this.hzB >= 2) { this.hzC = intent.getStringExtra("Klabel_name_list"); this.hzD = intent.getStringExtra("Kother_user_name_list"); x.d("MicroMsg.CardDetailUIContoller", "mPrivateSelect : %d, names : %s", new Object[]{Integer.valueOf(this.hzB), this.hzC}); if (TextUtils.isEmpty(this.hzC) && TextUtils.isEmpty(this.hzD)) { x.e("MicroMsg.CardDetailUIContoller", "mLabelNameList by getIntent is empty"); return; } List asList = Arrays.asList(this.hzC.split(",")); this.hzF = l.aB(asList); this.hzE = l.aA(asList); if (this.hzD != null && this.hzD.length() > 0) { this.hzE.addAll(Arrays.asList(this.hzD.split(","))); } if (this.hzF != null) { x.i("MicroMsg.CardDetailUIContoller", "mPrivateIdsList size is " + this.hzF.size()); } if (this.hzE != null) { x.i("MicroMsg.CardDetailUIContoller", "mPrivateNamesList size is " + this.hzE.size()); Iterator it = this.hzE.iterator(); while (it.hasNext()) { x.d("MicroMsg.CardDetailUIContoller", "username : %s", new Object[]{(String) it.next()}); } } if (this.hzB == 2) { this.hCk.xL(this.hBT.getString(com.tencent.mm.plugin.card.a.g.card_share_card_private_setting_share, new Object[]{axO()})); return; } else if (this.hzB == 3) { this.hCk.xL(this.hBT.getString(com.tencent.mm.plugin.card.a.g.card_share_card_private_setting_not_share, new Object[]{axO()})); return; } else { this.hCk.xL(this.hBT.getString(com.tencent.mm.plugin.card.a.g.card_share_card_private_setting)); return; } } this.hCk.xL(this.hBT.getString(com.tencent.mm.plugin.card.a.g.card_share_card_private_setting)); return; } return; case 3: if (this.hCu != null) { this.hCu.ayt(); return; } return; default: return; } } private String axO() { if (!TextUtils.isEmpty(this.hzC) && !TextUtils.isEmpty(this.hzD)) { return this.hzC + "," + l.xZ(this.hzD); } if (!TextUtils.isEmpty(this.hzC)) { return this.hzC; } if (TextUtils.isEmpty(this.hzD)) { return ""; } return l.xZ(this.hzD); } private void xI(String str) { Intent intent = new Intent(); if (this.htQ instanceof CardInfo) { intent.putExtra("key_card_info_data", (CardInfo) this.htQ); } else if (this.htQ instanceof ShareCardInfo) { intent.putExtra("key_card_info_data", (ShareCardInfo) this.htQ); } intent.setClass(this.hBT, CardConsumeCodeUI.class); intent.putExtra("key_from_scene", this.hCv.hop); intent.putExtra("key_previous_scene", this.hCv.hza); intent.putExtra("key_mark_user", str); intent.putExtra("key_from_appbrand_type", this.hCv.hCB); this.hBT.startActivityForResult(intent, 3); this.hBT.geJ = this; } public final int ayE() { if (this.hCo == null) { return 0; } f fVar = this.hCo; if (fVar.htV == null ? false : fVar.htV.hvk) { return 1; } return 0; } public final boolean ayF() { return this.hBU == null ? false : this.hBU.ayF(); } }
/* First created by JCasGen Sun Sep 14 16:28:38 EDT 2014 */ import org.apache.uima.jcas.JCas; import org.apache.uima.jcas.JCasRegistry; import org.apache.uima.cas.impl.CASImpl; import org.apache.uima.cas.impl.FSGenerator; import org.apache.uima.cas.FeatureStructure; import org.apache.uima.cas.impl.TypeImpl; import org.apache.uima.cas.Type; import org.apache.uima.cas.impl.FeatureImpl; import org.apache.uima.cas.Feature; import org.apache.uima.jcas.tcas.Annotation_Type; /** * Updated by JCasGen Wed Sep 17 14:20:01 EDT 2014 * * @generated */ public class GeneMention_Type extends Annotation_Type { /** * @generated * @return the generator for this type */ @Override protected FSGenerator getFSGenerator() { return fsGenerator; } /** @generated */ private final FSGenerator fsGenerator = new FSGenerator() { public FeatureStructure createFS(int addr, CASImpl cas) { if (GeneMention_Type.this.useExistingInstance) { // Return eq fs instance if already created FeatureStructure fs = GeneMention_Type.this.jcas.getJfsFromCaddr(addr); if (null == fs) { fs = new GeneMention(addr, GeneMention_Type.this); GeneMention_Type.this.jcas.putJfsFromCaddr(addr, fs); return fs; } return fs; } else return new GeneMention(addr, GeneMention_Type.this); } }; /** @generated */ @SuppressWarnings("hiding") public final static int typeIndexID = GeneMention.typeIndexID; /** * @generated * @modifiable */ @SuppressWarnings("hiding") public final static boolean featOkTst = JCasRegistry.getFeatOkTst("GeneMention"); /** @generated */ final Feature casFeat_sentenceId; /** @generated */ final int casFeatCode_sentenceId; /** * @generated * @param addr * low level Feature Structure reference * @return the feature value */ public String getSentenceId(int addr) { if (featOkTst && casFeat_sentenceId == null) jcas.throwFeatMissing("sentenceId", "GeneMention"); return ll_cas.ll_getStringValue(addr, casFeatCode_sentenceId); } /** * @generated * @param addr * low level Feature Structure reference * @param v * value to set */ public void setSentenceId(int addr, String v) { if (featOkTst && casFeat_sentenceId == null) jcas.throwFeatMissing("sentenceId", "GeneMention"); ll_cas.ll_setStringValue(addr, casFeatCode_sentenceId, v); } /** @generated */ final Feature casFeat_mentionBegin; /** @generated */ final int casFeatCode_mentionBegin; /** * @generated * @param addr * low level Feature Structure reference * @return the feature value */ public int getMentionBegin(int addr) { if (featOkTst && casFeat_mentionBegin == null) jcas.throwFeatMissing("mentionBegin", "GeneMention"); return ll_cas.ll_getIntValue(addr, casFeatCode_mentionBegin); } /** * @generated * @param addr * low level Feature Structure reference * @param v * value to set */ public void setMentionBegin(int addr, int v) { if (featOkTst && casFeat_mentionBegin == null) jcas.throwFeatMissing("mentionBegin", "GeneMention"); ll_cas.ll_setIntValue(addr, casFeatCode_mentionBegin, v); } /** @generated */ final Feature casFeat_mentionEnd; /** @generated */ final int casFeatCode_mentionEnd; /** * @generated * @param addr * low level Feature Structure reference * @return the feature value */ public int getMentionEnd(int addr) { if (featOkTst && casFeat_mentionEnd == null) jcas.throwFeatMissing("mentionEnd", "GeneMention"); return ll_cas.ll_getIntValue(addr, casFeatCode_mentionEnd); } /** * @generated * @param addr * low level Feature Structure reference * @param v * value to set */ public void setMentionEnd(int addr, int v) { if (featOkTst && casFeat_mentionEnd == null) jcas.throwFeatMissing("mentionEnd", "GeneMention"); ll_cas.ll_setIntValue(addr, casFeatCode_mentionEnd, v); } /** @generated */ final Feature casFeat_mentionText; /** @generated */ final int casFeatCode_mentionText; /** * @generated * @param addr * low level Feature Structure reference * @return the feature value */ public String getMentionText(int addr) { if (featOkTst && casFeat_mentionText == null) jcas.throwFeatMissing("mentionText", "GeneMention"); return ll_cas.ll_getStringValue(addr, casFeatCode_mentionText); } /** * @generated * @param addr * low level Feature Structure reference * @param v * value to set */ public void setMentionText(int addr, String v) { if (featOkTst && casFeat_mentionText == null) jcas.throwFeatMissing("mentionText", "GeneMention"); ll_cas.ll_setStringValue(addr, casFeatCode_mentionText, v); } /** * initialize variables to correspond with Cas Type and Features * * @generated * @param jcas * JCas * @param casType * Type */ public GeneMention_Type(JCas jcas, Type casType) { super(jcas, casType); casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator()); casFeat_sentenceId = jcas.getRequiredFeatureDE(casType, "sentenceId", "uima.cas.String", featOkTst); casFeatCode_sentenceId = (null == casFeat_sentenceId) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl) casFeat_sentenceId).getCode(); casFeat_mentionBegin = jcas.getRequiredFeatureDE(casType, "mentionBegin", "uima.cas.Integer", featOkTst); casFeatCode_mentionBegin = (null == casFeat_mentionBegin) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl) casFeat_mentionBegin).getCode(); casFeat_mentionEnd = jcas.getRequiredFeatureDE(casType, "mentionEnd", "uima.cas.Integer", featOkTst); casFeatCode_mentionEnd = (null == casFeat_mentionEnd) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl) casFeat_mentionEnd).getCode(); casFeat_mentionText = jcas.getRequiredFeatureDE(casType, "mentionText", "uima.cas.String", featOkTst); casFeatCode_mentionText = (null == casFeat_mentionText) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl) casFeat_mentionText).getCode(); } }
package principal.pasajero.gcm; import com.google.gson.Gson; import android.app.IntentService; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.media.RingtoneManager; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.NotificationCompat; import android.support.v4.app.TaskStackBuilder; import principal.base.entidades.usuarios.Chofer; import principal.base.utils.Constantes; import principal.pasajero.R; import principal.pasajero.activities.MainActivity; import principal.pasajero.activities.SolicitarActivity; import principal.pasajero.activities.ViajeActivity; public class GcmIntentService extends IntentService { public static final int NOTIFICATION_ID = 1; public GcmIntentService() { super("GcmIntentService"); } @Override protected void onHandleIntent(Intent intent) { Bundle extras = intent.getExtras(); if (!extras.isEmpty()) { String tipo = extras.getString("tipo"); switch (tipo) { case Constantes.TipoGCM.CHOFER_ASIGNADO: String choferJson = extras.getString("object"); Chofer chofer = new Gson().fromJson(choferJson, Chofer.class); notificar("RapiTaxi - Chofer asignado.", chofer.getNombre() + " " + chofer.getApellido(), ViajeActivity.class); break; case Constantes.TipoGCM.VIAJE_CANCELADO: notificar("RapiTaxi", "El viaje ha sido cancelado.", SolicitarActivity.class); break; case Constantes.TipoGCM.VIAJE_FINALIZADO: notificar ("RapiTaxi", "El viaje ha finalizado.", SolicitarActivity.class); break; case Constantes.TipoGCM.SIN_CHOFER: notificar ("RapiTaxi", "No hay choferes para su viaje. Intentelo de nuevo.", SolicitarActivity.class); break; } } // Release the wake lock provided by the WakefulBroadcastReceiver. ReceptorLocal.completeWakefulIntent(intent); } private void notificar (String titulo, String mensaje, Class<?> actividad) { Uri sonido = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(titulo) .setContentText(mensaje) .setSound(sonido) .setAutoCancel(true); Intent resultIntent = new Intent(this, actividad); resultIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); resultIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); stackBuilder.addParentStack(MainActivity.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent( 0, PendingIntent.FLAG_CANCEL_CURRENT); mBuilder.setContentIntent(resultPendingIntent); NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(1, mBuilder.build()); } }
package com.qunchuang.carmall.graphql; import graphql.ExecutionResult; import graphql.language.OperationDefinition; import graphql.language.Type; import graphql.schema.GraphQLType; import org.springframework.lang.Nullable; import javax.transaction.Transactional; import java.util.Map; public interface IGraphQLExecutor { GraphQLType getGraphQLType(Type type); OperationDefinition getOperationDefinition(String query); @Transactional ExecutionResult execute(String query, @Nullable Map<String, Object> arguments); /** * 获取类型映射信息 */ IGraphQlTypeMapper getGraphQlTypeMapper(); }
package scratch.user; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.validation.ConstraintViolationException; import static org.junit.Assert.assertEquals; import static scratch.user.test.UserConstants.user; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = UserPersistenceTest.class) @Configuration @EnableAutoConfiguration @ComponentScan public class UserPersistenceTest { @Autowired private Users users; @Test public void I_can_persist_a_user() { final User expected = user(); final Id id = users.create(expected); final Long userId = id.getId(); final User actual = users.retrieve(userId); expected.setId(userId); expected.getAddress().setId(actual.getAddress().getId()); assertEquals("the persisted user should be correct.", expected, actual); } @Test(expected = ConstraintViolationException.class) public void I_cannot_persist_an_invalid_user() { final User user = user(); user.setEmail(null); users.create(user); } @Test(expected = DataIntegrityViolationException.class) public void I_cannot_persist_a_user_with_an_existing_email() { final User user = user(); users.create(user); users.create(user); } }
package pl.piomin.services.organization.repository; import com.mongodb.MongoClient; import com.mongodb.client.MongoCollection; import io.micronaut.context.annotation.Property; import org.bson.codecs.configuration.CodecRegistries; import org.bson.codecs.configuration.CodecRegistry; import org.bson.codecs.pojo.PojoCodecProvider; import pl.piomin.services.organization.model.Organization; import javax.inject.Inject; import javax.inject.Singleton; import java.util.ArrayList; import java.util.List; @Singleton public class OrganizationRepository { @Property(name = "mongodb.database") private String mongodbDatabase; @Property(name = "mongodb.collection") private String mongodbCollection; private MongoClient mongoClient; OrganizationRepository(MongoClient mongoClient) { this.mongoClient = mongoClient; } public Organization add(Organization organization) { organization.setId(repository().countDocuments() + 1); repository().insertOne(organization); return organization; } public Organization findById(Long id) { return repository().find().first(); } public List<Organization> findAll() { final List<Organization> organizations = new ArrayList<>(); repository() .find() .iterator() .forEachRemaining(organizations::add); return organizations; } private MongoCollection<Organization> repository() { CodecRegistry pojoCodecRegistry = CodecRegistries.fromRegistries(MongoClient.getDefaultCodecRegistry(), CodecRegistries.fromProviders(PojoCodecProvider.builder().automatic(true).build())); return mongoClient.getDatabase(mongodbDatabase).withCodecRegistry(pojoCodecRegistry) .getCollection(mongodbCollection, Organization.class); } }
package net.hingyi.sqlExecutor.pool; import java.sql.Connection; import java.sql.SQLException; import java.util.Hashtable; /** * 数据连接池管理器 * * @author guanzhenxing * @since 2014年3月22日 下午4:52:14 */ public class ConnectionPoolManager { private static ConnectionPoolManager connectionPoolManager; // 连接池存放 private Hashtable<String, ConnectionPool> pools; // 总的连接数 private static int clients; private ConnectionPoolManager() { connectionPoolManager = this; pools = new Hashtable<String, ConnectionPool>(); init(); } private void init() { for (int i = 0; i < InitPoolConfig.poolConfigList.size(); i++) { PoolConfig pc = InitPoolConfig.poolConfigList.get(i); ConnectionPool pool = new ConnectionPool(pc); if (pool != null) { pools.put(pc.getPoolName(), pool); } } } /** * 获得连接池管理器实例 * * @return */ public static synchronized ConnectionPoolManager getInstance() { if (null == connectionPoolManager) { connectionPoolManager = new ConnectionPoolManager(); } clients++; return connectionPoolManager; } /** * 获得连接池 * * @return */ public ConnectionPool getPool(String poolName) { return pools.get(poolName); } /** * 获得数据库链接 * * @return */ public Connection getConnection(String poolName) { Connection conn = null; conn = getPool(poolName).getConnection(); return conn; } /** * 释放连接 */ public void releaseConnection(String poolName, Connection conn) { try { ConnectionPool pool = getPool(poolName); if (null != null) { pool.releaseConnection(conn); } } catch (SQLException e) { e.printStackTrace(); } } /** * 清空连接池 * * @param poolName */ public void destory(String poolName) { ConnectionPool pool = getPool(poolName); if (null != null) { pool.destroy(); } } /** * 获得连接数 * @return */ public static int getClients() { return clients; } }
/** * OpenKM, Open Document Management System (http://www.openkm.com) * Copyright (c) 2006-2015 Paco Avila & Josep Llort * * No bytes were intentionally harmed during the development of this application. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package com.openkm.servlet.admin; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.openkm.core.AccessDeniedException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.gson.Gson; import com.openkm.api.OKMRepository; import com.openkm.core.DatabaseException; import com.openkm.core.PathNotFoundException; import com.openkm.core.RepositoryException; import com.openkm.dao.AutomationDAO; import com.openkm.dao.bean.AutomationAction; import com.openkm.dao.bean.AutomationMetadata; import com.openkm.dao.bean.AutomationRule; import com.openkm.dao.bean.AutomationValidation; import com.openkm.util.UserActivity; import com.openkm.util.WebUtils; /** * Automation servlet */ public class AutomationServlet extends BaseServlet { private static final long serialVersionUID = 1L; private static Logger log = LoggerFactory.getLogger(AutomationServlet.class); private static String ats[] = { AutomationRule.AT_PRE, AutomationRule.AT_POST }; private static final Map<String, String> events = new LinkedHashMap<String, String>() { private static final long serialVersionUID = 1L; { put(AutomationRule.EVENT_DOCUMENT_CREATE, "Document creation"); put(AutomationRule.EVENT_DOCUMENT_UPDATE, "Document update"); put(AutomationRule.EVENT_DOCUMENT_MOVE, "Document move"); put(AutomationRule.EVENT_FOLDER_CREATE, "Folder creation"); put(AutomationRule.EVENT_MAIL_CREATE, "Mail creation"); put(AutomationRule.EVENT_PROPERTY_GROUP_ADD, "Add property group"); put(AutomationRule.EVENT_PROPERTY_GROUP_SET, "Set property group"); put(AutomationRule.EVENT_TEXT_EXTRACTOR, "Text extraction"); put(AutomationRule.EVENT_CONVERSION_PDF, "Convert to PDF"); put(AutomationRule.EVENT_CONVERSION_SWF, "Convert to SWF"); } }; public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { log.debug("doGet({}, {})", request, response); request.setCharacterEncoding("UTF-8"); String action = WebUtils.getString(request, "action"); String userId = request.getRemoteUser(); updateSessionManager(request); try { if (action.equals("ruleList")) { ruleList(userId, request, response); } else if (action.equals("definitionList")) { definitionList(userId, request, response); } else if (action.equals("getMetadata")) { getMetadata(userId, request, response); } else if (action.equals("create")) { create(userId, request, response); } else if (action.equals("edit")) { edit(userId, request, response); } else if (action.equals("delete")) { delete(userId, request, response); } else if (action.equals("loadMetadataForm")) { loadMetadataForm(userId, request, response); } else if (action.equals("createAction")) { createAction(userId, request, response); } else if (action.equals("deleteAction")) { deleteAction(userId, request, response); } else if (action.equals("editAction")) { editAction(userId, request, response); } else if (action.equals("createValidation")) { createValidation(userId, request, response); } else if (action.equals("deleteValidation")) { deleteValidation(userId, request, response); } else if (action.equals("editValidation")) { editValidation(userId, request, response); } if (action.equals("") || WebUtils.getBoolean(request, "persist")) { ruleList(userId, request, response); } else if (action.equals("createAction") || action.equals("createValidation") || action.equals("deleteAction") || action.equals("editAction") || action.equals("deleteValidation") || action.equals("editValidation")) { definitionList(userId, request, response); } } catch (DatabaseException e) { log.error(e.getMessage(), e); sendErrorRedirect(request, response, e); } catch (AccessDeniedException e) { log.error(e.getMessage(), e); sendErrorRedirect(request, response, e); } catch (PathNotFoundException e) { log.error(e.getMessage(), e); sendErrorRedirect(request, response, e); } catch (RepositoryException e) { log.error(e.getMessage(), e); sendErrorRedirect(request, response, e); } } /** * List rules */ private void ruleList(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException { log.debug("ruleList({}, {}, {})", new Object[] { userId, request, response }); ServletContext sc = getServletContext(); sc.setAttribute("automationRules", AutomationDAO.getInstance().findAll()); sc.setAttribute("events", events); sc.getRequestDispatcher("/admin/automation_rule_list.jsp").forward(request, response); // Activity log UserActivity.log(userId, "ADMIN_AUTOMATION_LIST", null, null, null); log.debug("ruleList: void"); } /** * List rules */ private void definitionList(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException, AccessDeniedException, PathNotFoundException, RepositoryException { log.debug("definitionList({}, {}, {})", new Object[] { userId, request, response }); ServletContext sc = getServletContext(); long arId = WebUtils.getLong(request, "ar_id"); AutomationRule aRule = AutomationDAO.getInstance().findByPk(arId); for (AutomationValidation av : aRule.getValidations()) { for (int i = 0; i < av.getParams().size(); i++) { av.getParams().set(i, convertToHumanValue(av.getParams().get(i), av.getType(), i)); } } for (AutomationAction aa : aRule.getActions()) { for (int i = 0; i < aa.getParams().size(); i++) { aa.getParams().set(i, convertToHumanValue(aa.getParams().get(i), aa.getType(), i)); } } sc.setAttribute("ar", aRule); sc.setAttribute("metadaActions", AutomationDAO.getInstance().findMetadataActionsByAt(aRule.getAt())); sc.setAttribute("metadaValidations", AutomationDAO.getInstance().findMetadataValidationsByAt(aRule.getAt())); sc.getRequestDispatcher("/admin/automation_definition_list.jsp").forward(request, response); // Activity log UserActivity.log(userId, "ADMIN_AUTOMATION_GET_DEFINITION_LIST", null, null, null); log.debug("definitionList: void"); } /** * getMetadataAction */ private void getMetadata(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException { long amId = WebUtils.getLong(request, "amId"); Gson son = new Gson(); AutomationMetadata am = AutomationDAO.getInstance().findMetadataByPk(amId); String json = son.toJson(am); PrintWriter writer = response.getWriter(); writer.print(json); writer.flush(); // Activity log UserActivity.log(userId, "ADMIN_AUTOMATION_GET_METADATA", Long.toString(amId), null, am.getName()); } /** * New automation */ private void create(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException { log.debug("create({}, {}, {})", new Object[] { userId, request, response }); if (WebUtils.getBoolean(request, "persist")) { AutomationRule ar = new AutomationRule(); ar.setName(WebUtils.getString(request, "ar_name")); ar.setOrder(WebUtils.getInt(request, "ar_order")); ar.setExclusive(WebUtils.getBoolean(request, "ar_exclusive")); ar.setActive(WebUtils.getBoolean(request, "ar_active")); ar.setAt(WebUtils.getString(request, "ar_at")); ar.setEvent(WebUtils.getString(request, "ar_event")); AutomationDAO.getInstance().create(ar); // Activity log UserActivity.log(userId, "ADMIN_AUTOMATION_CREATE", Long.toString(ar.getId()), null, ar.toString()); } else { ServletContext sc = getServletContext(); AutomationRule ar = new AutomationRule(); sc.setAttribute("action", WebUtils.getString(request, "action")); sc.setAttribute("persist", true); sc.setAttribute("ar", ar); sc.setAttribute("ats", ats); sc.setAttribute("events", events); sc.getRequestDispatcher("/admin/automation_rule_edit.jsp").forward(request, response); } log.debug("create: void"); } /** * New metadata action * @throws RepositoryException * @throws PathNotFoundException */ private void createAction(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException, AccessDeniedException, PathNotFoundException, RepositoryException { long arId = WebUtils.getLong(request, "ar_id"); AutomationAction aa = new AutomationAction(); aa.setType(WebUtils.getLong(request, "am_id")); aa.setOrder(WebUtils.getInt(request, "am_order")); aa.setActive(WebUtils.getBoolean(request, "am_active")); List<String> params = new ArrayList<String>(); String am_param00 = WebUtils.getString(request, "am_param00"); String am_param01 = WebUtils.getString(request, "am_param01"); if (!am_param00.equals("")) { am_param00 = convertToInternalValue(am_param00, aa.getType(), 0); } if (!am_param01.equals("")) { am_param01 = convertToInternalValue(am_param01, aa.getType(), 1); } params.add(am_param00); params.add(am_param01); aa.setParams(params); AutomationDAO.getInstance().createAction(aa); AutomationRule ar = AutomationDAO.getInstance().findByPk(arId); ar.getActions().add(aa); AutomationDAO.getInstance().update(ar); // Activity log UserActivity.log(userId, "ADMIN_AUTOMATION_ADD_ACTION", Long.toString(ar.getId()), null, ar.toString()); } /** * Delete action */ private void deleteAction(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException { long aaId = WebUtils.getLong(request, "aa_id"); long arId = WebUtils.getLong(request, "ar_id"); AutomationRule ar = AutomationDAO.getInstance().findByPk(arId); for (AutomationAction action : ar.getActions()) { if (action.getId() == aaId) { ar.getActions().remove(action); break; } } AutomationDAO.getInstance().update(ar); AutomationDAO.getInstance().deleteAction(aaId); // Activity log UserActivity.log(userId, "ADMIN_AUTOMATION_DELETE_ACTION", Long.toString(ar.getId()), null, ar.toString()); } /** * Edit action * @throws RepositoryException * @throws PathNotFoundException */ private void editAction(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException, AccessDeniedException, PathNotFoundException, RepositoryException { long aaId = WebUtils.getLong(request, "aa_id"); AutomationAction aa = AutomationDAO.getInstance().findActionByPk(aaId); aa.setOrder(WebUtils.getInt(request, "am_order")); aa.setActive(WebUtils.getBoolean(request, "am_active")); List<String> params = new ArrayList<String>(); String am_param00 = WebUtils.getString(request, "am_param00"); String am_param01 = WebUtils.getString(request, "am_param01"); if (!am_param00.equals("")) { am_param00 = convertToInternalValue(am_param00, aa.getType(), 0); } if (!am_param01.equals("")) { am_param01 = convertToInternalValue(am_param01, aa.getType(), 1); } params.add(am_param00); params.add(am_param01); aa.setParams(params); AutomationDAO.getInstance().updateAction(aa); // Activity log UserActivity.log(userId, "ADMIN_AUTOMATION_ EDIT_ACTION", Long.toString(aa.getId()), null, aa.toString()); } /** * Edit validation */ private void editValidation(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException, AccessDeniedException, PathNotFoundException, RepositoryException { long avId = WebUtils.getLong(request, "av_id"); AutomationValidation av = AutomationDAO.getInstance().findValidationByPk(avId); av.setOrder(WebUtils.getInt(request, "am_order")); av.setActive(WebUtils.getBoolean(request, "am_active")); List<String> params = new ArrayList<String>(); String am_param00 = WebUtils.getString(request, "am_param00"); String am_param01 = WebUtils.getString(request, "am_param01"); if (!am_param00.equals("")) { am_param00 = convertToInternalValue(am_param00, av.getType(), 0); } if (!am_param01.equals("")) { am_param01 = convertToInternalValue(am_param01, av.getType(), 1); } params.add(am_param00); params.add(am_param01); av.setParams(params); AutomationDAO.getInstance().updateValidation(av); // Activity log UserActivity.log(userId, "ADMIN_AUTOMATION_ EDIT_VALIDATION", Long.toString(av.getId()), null, av.toString()); } /** * New metadata validation */ private void createValidation(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException, AccessDeniedException, PathNotFoundException, RepositoryException { long arId = WebUtils.getLong(request, "ar_id"); AutomationValidation av = new AutomationValidation(); av.setType(WebUtils.getLong(request, "am_id")); av.setOrder(WebUtils.getInt(request, "am_order")); av.setActive(WebUtils.getBoolean(request, "am_active")); List<String> params = new ArrayList<String>(); String am_param00 = WebUtils.getString(request, "am_param00"); String am_param01 = WebUtils.getString(request, "am_param01"); if (!am_param00.equals("")) { am_param00 = convertToInternalValue(am_param00, av.getType(), 0); } if (!am_param01.equals("")) { am_param01 = convertToInternalValue(am_param01, av.getType(), 1); } params.add(am_param00); params.add(am_param01); av.setParams(params); AutomationDAO.getInstance().createValidation(av); AutomationRule ar = AutomationDAO.getInstance().findByPk(arId); ar.getValidations().add(av); AutomationDAO.getInstance().update(ar); // Activity log UserActivity.log(userId, "ADMIN_AUTOMATION_ADD_VALIDATION", Long.toString(ar.getId()), null, ar.toString()); } /** * Delete validation */ private void deleteValidation(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException { long avId = WebUtils.getLong(request, "av_id"); long arId = WebUtils.getLong(request, "ar_id"); AutomationRule ar = AutomationDAO.getInstance().findByPk(arId); for (AutomationValidation validation : ar.getValidations()) { if (validation.getId() == avId) { ar.getValidations().remove(validation); break; } } AutomationDAO.getInstance().update(ar); AutomationDAO.getInstance().deleteValidation(avId); // Activity log UserActivity.log(userId, "ADMIN_AUTOMATION_DELETE_VALIDATION", Long.toString(ar.getId()), null, ar.toString()); } /** * Edit automation */ private void edit(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException { log.debug("edit({}, {}, {})", new Object[] { userId, request, response }); if (WebUtils.getBoolean(request, "persist")) { long arId = WebUtils.getLong(request, "ar_id"); AutomationRule ar = AutomationDAO.getInstance().findByPk(arId); ar.setName(WebUtils.getString(request, "ar_name")); ar.setOrder(WebUtils.getInt(request, "ar_order")); ar.setExclusive(WebUtils.getBoolean(request, "ar_exclusive")); ar.setActive(WebUtils.getBoolean(request, "ar_active")); ar.setEvent(WebUtils.getString(request, "ar_event")); AutomationDAO.getInstance().update(ar); // Activity log UserActivity.log(userId, "ADMIN_AUTOMATION_EDIT", Long.toString(ar.getId()), null, ar.toString()); } else { ServletContext sc = getServletContext(); long arId = WebUtils.getLong(request, "ar_id"); sc.setAttribute("action", WebUtils.getString(request, "action")); sc.setAttribute("persist", true); sc.setAttribute("ar", AutomationDAO.getInstance().findByPk(arId)); sc.setAttribute("ats", ats); sc.setAttribute("events", events); sc.getRequestDispatcher("/admin/automation_rule_edit.jsp").forward(request, response); } log.debug("edit: void"); } /** * Load Metadata form */ private void loadMetadataForm(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException, AccessDeniedException, PathNotFoundException, RepositoryException { ServletContext sc = getServletContext(); String action = WebUtils.getString(request, "newAction"); sc.setAttribute("action", action); sc.setAttribute("ar_id", WebUtils.getString(request, "ar_id")); long amId = WebUtils.getLong(request, "am_id"); sc.setAttribute("am_id", amId); if (action.equals("createAction") || action.equals("createValidation")) { sc.setAttribute("am", AutomationDAO.getInstance().findMetadataByPk(amId)); sc.setAttribute("aa_id", ""); sc.setAttribute("av_id", ""); sc.setAttribute("am_order", "0"); sc.setAttribute("am_param00", ""); sc.setAttribute("am_param01", ""); } else if (action.equals("deleteAction") || action.equals("editAction")) { long aaId = WebUtils.getLong(request, "aa_id"); sc.setAttribute("aa_id", aaId); sc.setAttribute("av_id", ""); AutomationMetadata am = AutomationDAO.getInstance().findMetadataByPk(amId); AutomationAction aa = AutomationDAO.getInstance().findActionByPk(aaId); for (int i = 0; i < aa.getParams().size(); i++) { switch (i) { case 0: if (aa.getParams().get(0)!=null && !aa.getParams().get(0).equals("")) { sc.setAttribute("am_param00", convertToHumanValue(aa.getParams().get(0), aa.getType(), 0)); } else { sc.setAttribute("am_param00", ""); } break; case 1: if (aa.getParams().get(1)!=null && !aa.getParams().get(1).equals("")) { sc.setAttribute("am_param01", convertToHumanValue(aa.getParams().get(1), aa.getType(), 1)); } else { sc.setAttribute("am_param01", ""); } break; } } sc.setAttribute("am_order", String.valueOf(aa.getOrder())); am.setActive(aa.isActive()); sc.setAttribute("am", am); } else if (action.equals("deleteValidation") || action.equals("editValidation")) { long avId = WebUtils.getLong(request, "av_id"); sc.setAttribute("aa_id", ""); sc.setAttribute("av_id", avId); AutomationMetadata am = AutomationDAO.getInstance().findMetadataByPk(amId); AutomationValidation av = AutomationDAO.getInstance().findValidationByPk(avId); for (int i = 0; i < av.getParams().size(); i++) { switch (i) { case 0: if (av.getParams().get(0)!=null && !av.getParams().get(0).equals("")) { sc.setAttribute("am_param00", convertToHumanValue(av.getParams().get(0), av.getType(), 0)); } else { sc.setAttribute("am_param00", ""); } break; case 1: if (av.getParams().get(1)!=null && !av.getParams().get(1).equals("")) { sc.setAttribute("am_param01", convertToHumanValue(av.getParams().get(1), av.getType(), 1)); } else { sc.setAttribute("am_param01", ""); } break; } } sc.setAttribute("am_order", String.valueOf(av.getOrder())); am.setActive(av.isActive()); sc.setAttribute("am", am); } sc.getRequestDispatcher("/admin/automation_definition_form.jsp").forward(request, response); } /** * Delete automation */ private void delete(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException { log.debug("delete({}, {}, {})", new Object[] { userId, request, response }); if (WebUtils.getBoolean(request, "persist")) { long arId = WebUtils.getLong(request, "ar_id"); AutomationDAO.getInstance().delete(arId); // Activity log UserActivity.log(userId, "ADMIN_AUTOMATION_DELETE", Long.toString(arId), null, null); } else { ServletContext sc = getServletContext(); long arId = WebUtils.getLong(request, "ar_id"); sc.setAttribute("action", WebUtils.getString(request, "action")); sc.setAttribute("persist", true); sc.setAttribute("ar", AutomationDAO.getInstance().findByPk(arId)); sc.setAttribute("ats", ats); sc.setAttribute("events", events); sc.getRequestDispatcher("/admin/automation_rule_edit.jsp").forward(request, response); } log.debug("edit: void"); } /** * convertToInternalValue */ private String convertToInternalValue(String value, long amId, int param) throws DatabaseException, AccessDeniedException, PathNotFoundException, RepositoryException { AutomationMetadata am = AutomationDAO.getInstance().findMetadataByPk(amId); // Convert folder path to UUID if (value!=null && !value.equals("")) { switch (param) { case 0: if (AutomationMetadata.SOURCE_FOLDER.equals(am.getSource00())) { value = OKMRepository.getInstance().getNodeUuid(null, value); } case 1: if (AutomationMetadata.SOURCE_FOLDER.equals(am.getSource01())) { value = OKMRepository.getInstance().getNodeUuid(null, value); } } } return value; } /** * convertToHumanValue */ private String convertToHumanValue(String value, long amId, int param) throws DatabaseException, AccessDeniedException, PathNotFoundException, RepositoryException { AutomationMetadata am = AutomationDAO.getInstance().findMetadataByPk(amId); // Convert folder path to UUID if (value!=null && !value.equals("")) { switch (param) { case 0: if (AutomationMetadata.SOURCE_FOLDER.equals(am.getSource00())) { value = OKMRepository.getInstance().getNodePath(null, value); } case 1: if (AutomationMetadata.SOURCE_FOLDER.equals(am.getSource01())) { value = OKMRepository.getInstance().getNodePath(null, value); } } } return value; } }
package com.timesheet.service; import java.io.Serializable; import java.util.List; /** * Created by Vitaliy, Yan on 15.04.15. */ public interface GenericService<T, ID extends Serializable> { List<T> findAll(); T findById(ID id); T save(T entity); void delete(T entity); }
package com.lera.vehicle.reservation.service.customer; public interface PassportService { }
package com.syzible.dublinnotifier.ui; /** * Created by ed on 20/02/2017. */ public interface OnFilterSelection { void onStopIdSelected(String stopId); }
package com.bobby.huarongroad; import java.util.ArrayList; import java.util.List; public class HuarongRoadGame extends AbsSearchGame<HuarongRoadStep>{ private HuarongRoadStep initStep; public HuarongRoadGame(HuarongRoadStep initStep) { this.initStep = initStep; } @Override public SearchItem<HuarongRoadStep> initItem() { return new SearchItem<HuarongRoadStep>(null, initStep, "开始"); } @Override public List<SearchItem<HuarongRoadStep>> next(SearchItem<HuarongRoadStep> item) { List<HuarongRoadStep> nextSteps = item.getValue().nextSteps(); List<SearchItem<HuarongRoadStep>> result = new ArrayList<SearchItem<HuarongRoadStep>>(); for (HuarongRoadStep step : nextSteps) { SearchItem<HuarongRoadStep> searchItem = new SearchItem<HuarongRoadStep>(item, step, step.getDesc()); result.add(searchItem); } return result; } @Override public boolean isSuccess(SearchItem<HuarongRoadStep> item) { return item.getValue().isSuccess(); } public static void main(String[] args) { SearchItem<HuarongRoadStep> item = new HuarongRoadGame(new HuarongRoadStep()).searchBest(); System.err.println(item); } }
package Lowestancestor; public class Solution { public TreeNode lowestCommonAncestor(TreeNode root,TreeNode one, TreeNode two) { // Write your solution here. if(root == null){ return null; } if(root == one || root == two){ return root; } TreeNode left = lowestCommonAncestor(root.left, one, two); TreeNode right = lowestCommonAncestor(root.right, one, two); if(left != null && right !=null){ return root; } return left == null? right:left; } }
package com.yuorfei.service; import com.yuorfei.bean.Article; import com.yuorfei.dao.ArticleDao; import com.yuorfei.util.RequestUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; import java.util.UUID; /** * 文章服务类 * Created by hxy on 2015/9/19. */ @Service public class ArticleService { private static final Log log = LogFactory.getLog(ArticleService.class); @Autowired private ArticleDao articleDao; public static final String IMAGE_ACTION_NAME = "uploadImage"; public static final String IMAGE_FILE_NAME = "file"; public static final long IMAGE_MAX_SIZE = 2048000; public static final String IMAGE_URL_PREFIX = "/upload/article/img/"; public boolean add(RequestUtil requestUtil) throws Exception{ if (!requestUtil.isAdmin()) { return false; } String title = requestUtil.param("title",""); String content = requestUtil.param("content",""); String keyword = requestUtil.param("keyword",""); String label = requestUtil.param("label",""); if( title.length()<1 ){ throw new Exception("标题太短"); } if( content.length()<1 ){ throw new Exception("内容太短"); } Timestamp timestamp = new Timestamp( System.currentTimeMillis() ); Article article = new Article(); article.setContent(content); article.setTitle(title); article.setCreate_time( timestamp ); article.setUpdate_time(timestamp); article.setFormat_content(content); article.setVisible(Article.VISIBLE_YES); article.setKeyword(keyword); article.setLabel(label); long articleId = articleDao.add(article); return articleId > 0; } /** * 删除文章 * @param requestUtil 请求 * @return boolean * @throws Exception */ public boolean delete(RequestUtil requestUtil) throws Exception { if (!requestUtil.isAdmin()) { return false; } long articleId = requestUtil.param("id", 0); return articleId > 0 && articleDao.delete(articleId); } /** * 查找 * @param articleId id * @return article */ public Article find(long articleId){ if( articleId<=0 ){ return null; } return articleDao.find(articleId); } /** * 查找最新的文章的id * @return long */ public long findRecentArticleId(){ return articleDao.findRecentArticleId(); } /** * 更新article * @param requestUtil 请求 * @return boolean * @throws Exception */ public boolean update(RequestUtil requestUtil) throws Exception{ if( !requestUtil.isAdmin() ){ return false; } long articleId = requestUtil.param("id",0); if( articleId<1 ){ return false; } Article article = articleDao.find(articleId); if( article==null ){ return false; } String title = requestUtil.param("title",""); String content = requestUtil.param("content",""); String keyword = requestUtil.param("keyword",""); String label = requestUtil.param("label",""); if( title.length()<1 ){ throw new Exception("标题太短"); } if( content.length()<1 ){ throw new Exception("内容太短"); } Timestamp timestamp = new Timestamp( System.currentTimeMillis() ); article.setContent(content); article.setTitle(title); article.setUpdate_time(timestamp); article.setFormat_content(content); article.setKeyword(keyword); article.setLabel(label); long result = articleDao.update(article); return result > 0; } /** * 统计所有的文章数 * @return long */ public long count(){ return articleDao.count(); } /** * 分页列出文章 * @param pageIndex 页码 * @param pageSize 页数 * @return list */ public List<Article> listByPage(int pageIndex,int pageSize){ if( pageIndex<=0 ){ pageIndex = 1; } return articleDao.listByPage(pageIndex, pageSize); } /** * 初始化ueditor配置 * @return string */ public HashMap<String,Object> initUeConfig(){ HashMap<String,Object> hashMap = new HashMap<String,Object>(); hashMap.put("imageActionName",IMAGE_ACTION_NAME); hashMap.put("imageMaxSize",IMAGE_MAX_SIZE); hashMap.put("imageFieldName",IMAGE_FILE_NAME); hashMap.put("imageUrlPrefix",IMAGE_URL_PREFIX); return hashMap; } /** * 图片上传 * @param requestUtil 请求 * @param file 文件 * @return json 数据 */ public HashMap<String,Object> uploadImage(RequestUtil requestUtil,MultipartFile file){ if (!requestUtil.isAdmin()) { return null; } HashMap<String,Object> hashMap = new HashMap<String, Object>(); if ( !file.isEmpty() ) { // 文件保存路径 UUID uuid = UUID.randomUUID(); String fileName = uuid.toString()+file.getOriginalFilename(); String filePath = requestUtil.getRequest().getSession().getServletContext().getRealPath("/") + "upload/article/img/"; File targetFile = new File(filePath, fileName); if( !targetFile.exists() ){ boolean result = targetFile.mkdirs(); if( !result ){ log.info("mkdir the path is fail"); hashMap.put("original",null); hashMap.put("name",null); hashMap.put("url",null); hashMap.put("state","mkdir the path is fail"); return hashMap; } } //保存 try { file.transferTo(targetFile); hashMap.put("original",fileName); hashMap.put("name",fileName); hashMap.put("url",fileName); hashMap.put("state","SUCCESS"); return hashMap; } catch (Exception e) { e.printStackTrace(); hashMap.put("original",fileName); hashMap.put("name",fileName); hashMap.put("url",null); hashMap.put("state","EXCEPTION"); return hashMap; } }else{ log.info("the file is empty"); hashMap.put("original",null); hashMap.put("name",null); hashMap.put("url",null); hashMap.put("state","the file is empty"); return hashMap; } } }
package com.example.todolist.Main; import android.content.Context; import android.content.SharedPreferences; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; import com.example.todolist.Model.Entities.Groups; import com.example.todolist.Model.Entities.Tasks; import com.example.todolist.Model.Repositories.GroupsRepository; import com.example.todolist.R; import com.example.todolist.Utils.ScheduleNotification; import com.example.todolist.Utils.SharedPreference; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; import java.util.List; import javax.inject.Inject; import io.reactivex.Completable; import io.reactivex.CompletableObserver; import io.reactivex.Single; import io.reactivex.disposables.Disposable; import io.reactivex.schedulers.Schedulers; public class GroupsViewModel extends ViewModel { // private MutableLiveData<String> error = new MutableLiveData<>(); // private Disposable disposable; @Inject public GroupsRepository groupsRepository; @Inject public ScheduleNotification scheduleNotification; @Inject public SharedPreference sharedPreference; @Inject public GroupsViewModel(GroupsRepository groupsRepository) { this.groupsRepository = groupsRepository; } public Completable sync(){ return groupsRepository.refreshGroups(); } public Single<Boolean> isInternetWorking() { return Single.fromCallable(() -> { try { // Connect to Google DNS to check for connection int timeoutMs = 1500; Socket socket = new Socket(); InetSocketAddress socketAddress = new InetSocketAddress("8.8.8.8", 53); socket.connect(socketAddress, timeoutMs); socket.close(); return true; } catch (IOException e) { return false; } }); } public void setScheduleNotification(String title, String content, int iconId, long delay, boolean repeat, int taskId, boolean cancelAlarm){ scheduleNotification.createNotificationChannel(); scheduleNotification.scheduleNotification(scheduleNotification.getNotification(iconId, title, content), delay, repeat, taskId, cancelAlarm); } public LiveData<List<Groups>> getGroupsToday() { return groupsRepository.getGroupsToday(); } public Completable updateTask(Tasks tasks){ return groupsRepository.updateTask(tasks); } public Completable updateTask2(List<Tasks> tasks){ return groupsRepository.updateTask2(tasks); } public LiveData<List<Tasks>> getTasks(int gpId){ return groupsRepository.getTasks(gpId); } public LiveData<List<Groups>> getGroupsWeek() { return groupsRepository.getGroupsWeek(); } public LiveData<List<Groups>> getGroupsMonth() { return groupsRepository.getGroupsMonth(); } // public LiveData<String> getError() { // return error; // } public Boolean saveDataSharedPreferences(String key, String value) { return sharedPreference.save(key, value); } public String getDataSharedPreferences(String key) { return sharedPreference.get(key); } public Completable updateGroup(Groups groups){ return groupsRepository.updateGroup(groups); } @Override protected void onCleared() { super.onCleared(); // disposable.dispose(); } }
package mg.egg.eggc.compiler.egg.java; import mg.egg.eggc.runtime.libjava.*; import mg.egg.eggc.compiler.libegg.base.*; import mg.egg.eggc.compiler.libegg.java.*; import mg.egg.eggc.compiler.libegg.egg.*; import mg.egg.eggc.compiler.libegg.mig.*; import mg.egg.eggc.compiler.libegg.latex.*; import mg.egg.eggc.compiler.libegg.type.*; import mg.egg.eggc.runtime.libjava.lex.*; import java.util.*; import mg.egg.eggc.runtime.libjava.lex.*; import mg.egg.eggc.runtime.libjava.*; import mg.egg.eggc.runtime.libjava.messages.*; import mg.egg.eggc.runtime.libjava.problem.IProblem; import java.util.Vector; import java.util.List; import java.util.ArrayList; public class S_OPMUL_LACTION implements IDstNode { LEX_LACTION scanner; S_OPMUL_LACTION() { } S_OPMUL_LACTION(LEX_LACTION scanner, boolean eval) { this.scanner = scanner; this.att_eval = eval; offset = 0; length = 0; this.att_scanner = scanner; } int [] sync= new int[0]; boolean att_eval; String att_nom; LEX_LACTION att_scanner; private void regle69() throws Exception { //declaration T_LACTION x_2 = new T_LACTION(scanner ) ; //appel x_2.analyser(LEX_LACTION.token_t_mult); addChild(x_2); if (att_eval) action_gen_69(); offset =x_2.getOffset(); length =x_2.getOffset() + x_2.getLength() - offset; } private void regle68() throws Exception { //declaration T_LACTION x_2 = new T_LACTION(scanner ) ; //appel x_2.analyser(LEX_LACTION.token_t_et); addChild(x_2); if (att_eval) action_gen_68(); offset =x_2.getOffset(); length =x_2.getOffset() + x_2.getLength() - offset; } private void regle72() throws Exception { //declaration T_LACTION x_2 = new T_LACTION(scanner ) ; //appel x_2.analyser(LEX_LACTION.token_t_d_div); addChild(x_2); if (att_eval) action_gen_72(); offset =x_2.getOffset(); length =x_2.getOffset() + x_2.getLength() - offset; } private void regle71() throws Exception { //declaration T_LACTION x_2 = new T_LACTION(scanner ) ; //appel x_2.analyser(LEX_LACTION.token_t_d_mult); addChild(x_2); if (att_eval) action_gen_71(); offset =x_2.getOffset(); length =x_2.getOffset() + x_2.getLength() - offset; } private void regle70() throws Exception { //declaration T_LACTION x_2 = new T_LACTION(scanner ) ; //appel x_2.analyser(LEX_LACTION.token_t_div); addChild(x_2); if (att_eval) action_gen_70(); offset =x_2.getOffset(); length =x_2.getOffset() + x_2.getLength() - offset; } private void action_gen_69() throws Exception { try { // instructions this.att_nom="*"; }catch(RuntimeException e) { att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "LACTION", "#gen","OPMUL -> t_mult #gen ;"}); } } private void action_gen_68() throws Exception { try { // instructions this.att_nom="and"; }catch(RuntimeException e) { att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "LACTION", "#gen","OPMUL -> t_et #gen ;"}); } } private void action_gen_71() throws Exception { try { // instructions this.att_nom="*."; }catch(RuntimeException e) { att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "LACTION", "#gen","OPMUL -> t_d_mult #gen ;"}); } } private void action_gen_70() throws Exception { try { // instructions this.att_nom="/"; }catch(RuntimeException e) { att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "LACTION", "#gen","OPMUL -> t_div #gen ;"}); } } private void action_gen_72() throws Exception { try { // instructions this.att_nom="/."; }catch(RuntimeException e) { att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "LACTION", "#gen","OPMUL -> t_d_div #gen ;"}); } } public void analyser () throws Exception { scanner.lit ( 1 ) ; switch ( scanner.fenetre[0].code ) { case LEX_LACTION.token_t_et : // 59 regle68 () ; break ; case LEX_LACTION.token_t_mult : // 53 regle69 () ; break ; case LEX_LACTION.token_t_div : // 54 regle70 () ; break ; case LEX_LACTION.token_t_d_mult : // 57 regle71 () ; break ; case LEX_LACTION.token_t_d_div : // 58 regle72 () ; break ; default : scanner._interrompre(IProblem.Syntax, scanner.getBeginLine(), ILACTIONMessages.id_LACTION_unexpected_token,LACTIONMessages.LACTION_unexpected_token,new String[]{scanner.fenetre[0].getNom()}); } } private IDstNode parent; public void setParent( IDstNode p){parent = p;} public IDstNode getParent(){return parent;} private List<IDstNode> children = null ; public void addChild(IDstNode node){ if (children == null) { children = new ArrayList<IDstNode>() ;} children.add(node); node.setParent(this); } public List<IDstNode> getChildren(){return children;} public boolean isLeaf(){return children == null;} public void accept(IDstVisitor visitor) { boolean visitChildren = visitor.visit(this); if (visitChildren && children != null){ for(IDstNode node : children){ node.accept(visitor); } } visitor.endVisit(this); } private int offset; private int length; public int getOffset(){return offset;} public void setOffset(int o){offset = o;} public int getLength(){return length;} public void setLength(int l){length = l;} private boolean malformed = false; public void setMalformed(){malformed = true;} public boolean isMalformed(){return malformed;} }
package com.jvmless.threecardgame.infra.domain.moves; import com.jvmless.threecardgame.domain.shuffle.Cards; import com.jvmless.threecardgame.domain.shuffle.CardsRepository; import com.jvmless.threecardgame.domain.shuffle.MongoCardsRepository; public class MongoCardsRespositoryAdapter implements CardsRepository { private final MongoCardsRepository mongoCardsRepository; public MongoCardsRespositoryAdapter(MongoCardsRepository mongoCardsRepository) { this.mongoCardsRepository = mongoCardsRepository; } @Override public void save(Cards cards) { mongoCardsRepository.save(cards); } }
package com.tencent.mm.plugin.brandservice.ui; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import com.tencent.mm.kernel.g; import com.tencent.mm.plugin.brandservice.b.d; class ReceiveTemplateMsgMgrUI$2 implements OnCancelListener { final /* synthetic */ ReceiveTemplateMsgMgrUI hpP; final /* synthetic */ d hpQ; ReceiveTemplateMsgMgrUI$2(ReceiveTemplateMsgMgrUI receiveTemplateMsgMgrUI, d dVar) { this.hpP = receiveTemplateMsgMgrUI; this.hpQ = dVar; } public final void onCancel(DialogInterface dialogInterface) { g.DF().c(this.hpQ); } }
package net.minecraft.network.status.server; import java.io.IOException; import net.minecraft.network.INetHandler; import net.minecraft.network.Packet; import net.minecraft.network.PacketBuffer; import net.minecraft.network.status.INetHandlerStatusClient; public class SPacketPong implements Packet<INetHandlerStatusClient> { private long clientTime; public SPacketPong() {} public SPacketPong(long clientTimeIn) { this.clientTime = clientTimeIn; } public void readPacketData(PacketBuffer buf) throws IOException { this.clientTime = buf.readLong(); } public void writePacketData(PacketBuffer buf) throws IOException { buf.writeLong(this.clientTime); } public void processPacket(INetHandlerStatusClient handler) { handler.handlePong(this); } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\minecraft\network\status\server\SPacketPong.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
package dev.borowiecki.practices.day3.phonecompany; public class LandingPhoneNumber implements PhoneNumber { private int bill = 0; @Override public int currentMonthBill() { return bill; } @Override public void callTo(PhoneNumber number, int time) { if (number instanceof LandingPhoneNumber) { bill += time; } else { bill += time * 2; } } }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Author: Stefan Irimescu * */ package sparksoniq.jsoniq.runtime.iterator.quantifiers; import sparksoniq.exceptions.IteratorFlowException; import sparksoniq.jsoniq.item.Item; import sparksoniq.jsoniq.runtime.iterator.LocalRuntimeIterator; import sparksoniq.jsoniq.runtime.iterator.RuntimeIterator; import sparksoniq.jsoniq.runtime.metadata.IteratorMetadata; import sparksoniq.semantics.DynamicContext; import sparksoniq.semantics.types.SequenceType; import java.util.ArrayList; import java.util.List; public class QuantifiedExpressionVarIterator extends LocalRuntimeIterator { public String getVariableReference() { return _variableReference; } public QuantifiedExpressionVarIterator(String variableReference, SequenceType sequenceType, RuntimeIterator expression, IteratorMetadata iteratorMetadata) { super(null, iteratorMetadata); this._children.add(expression); this._variableReference = variableReference; this._sequenceType = sequenceType; } @Override public void reset(DynamicContext context){ super.reset(context); this.result = null; } @Override public Item next() { if(result == null){ RuntimeIterator expression = this._children.get(0); result = new ArrayList<>(); expression.open(_currentDynamicContext); while (expression.hasNext()) result.add(expression.next()); expression.close(); currentResultIndex = 0; } if(currentResultIndex > result.size() -1) throw new IteratorFlowException(RuntimeIterator.FLOW_EXCEPTION_MESSAGE + " Quantified Expr Var", getMetadata()); if(currentResultIndex == result.size() -1) this._hasNext = false; return result.get(currentResultIndex++); } private List<Item> result = null; private int currentResultIndex; private final String _variableReference; private final SequenceType _sequenceType; }
package commandline.command; import commandline.annotation.CliCommand; import commandline.argument.ArgumentDefinition; import commandline.argument.ArgumentDefinitionList; import commandline.exception.ArgumentNullException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.Iterator; public class CommandDefinition implements Comparable<CommandDefinition>, Iterable<ArgumentDefinition> { @NotNull private final String name; @NotNull private final String description; @NotNull private final ExecutableCommand commandToExecute; @NotNull private final ArgumentDefinitionList arguments; public CommandDefinition(@NotNull CliCommand commandAnnotation, @NotNull ExecutableCommand commandToExecute) { this(commandAnnotation.name(), commandAnnotation.description(), commandToExecute); } public CommandDefinition(@NotNull String name, @NotNull String description, @NotNull ExecutableCommand commandToExecute) { super(); String editName; //commandToExecute can be null if (name == null) { throw new ArgumentNullException(); } editName = name.trim(); if (editName.isEmpty()) { throw new CommandLineException( "The command definition could not been created, because the passed name doesn't contain any character."); } if (description == null) { throw new ArgumentNullException(); } if (commandToExecute == null) { throw new ArgumentNullException(); } this.name = editName; this.description = description; this.arguments = new ArgumentDefinitionList(); this.commandToExecute = commandToExecute; } @NotNull public String getName() { return this.name; } @NotNull public String getDescription() { return this.description; } @NotNull public ExecutableCommand getCommandToExecute() { return this.commandToExecute; } public boolean isArgumentsInjectionEnabled() { CommandDefinitionReader reader; boolean hasCommandDefinition; reader = new CommandDefinitionReader(); hasCommandDefinition = reader.hasCommandDefinition(getCommandToExecute()); return hasCommandDefinition; } @NotNull private ArgumentDefinitionList getArguments() { return this.arguments; } public int getArgumentSize() { return getArguments().getSize(); } public void addArgumentDefinition(@NotNull ArgumentDefinition argument) { getArguments().add(argument); } public void clearArgumentDefinitions() { getArguments().clear(); } public boolean containsArgumentDefinition(@NotNull ArgumentDefinition argument) { return getArguments().contains(argument); } public boolean containsArgumentDefinition(@NotNull String argumentLongName) { return getArguments().contains(argumentLongName); } @Nullable public ArgumentDefinition getArgumentDefinition(@NotNull String argumentLongName) { return getArguments().get(argumentLongName); } @Nullable public ArgumentDefinition removeArgumentDefinition(@NotNull String argumentLongName) { return getArguments().remove(argumentLongName); } @Nullable public ArgumentDefinition removeArgumentDefinition(@NotNull ArgumentDefinition definition) { return getArguments().remove(definition); } public boolean isEmpty() { return getArguments().isEmpty(); } @NotNull public Collection<ArgumentDefinition> getArgumentDefinitionCollection() { return getArguments().getCollection(); } public void addAllArgumentDefinitions(@NotNull Collection<ArgumentDefinition> arguments) { getArguments().addAll(arguments); } @NotNull @Override public Iterator<ArgumentDefinition> iterator() { return getArguments().iterator(); } @Override public int compareTo(@NotNull CommandDefinition command) { return getName().compareTo(command.getName()); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CommandDefinition)) { return false; } CommandDefinition that = (CommandDefinition) o; if (!this.arguments.equals(that.arguments)) { return false; } if (!this.commandToExecute.equals(that.commandToExecute)) { return false; } if (!this.description.equals(that.description)) { return false; } if (!this.name.equals(that.name)) { return false; } return true; } @Override public int hashCode() { int result = this.name.hashCode(); result = 31 * result + this.description.hashCode(); result = 31 * result + this.commandToExecute.hashCode(); result = 31 * result + this.arguments.hashCode(); return result; } @Override public String toString() { return "CommandDefinition{" + "name='" + this.name + '\'' + ", description='" + this.description + '\'' + ", commandToExecute=" + this.commandToExecute + ", arguments=" + this.arguments + '}'; } @NotNull public static CommandDefinition createMock() { return new CommandDefinition("test-command", "This is a description.", new MockExecutableCommand()); } }
package com.appium.pageObject.objects; import io.appium.java_client.MobileElement; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.iOSFindBy; /** * Created by syamsasi on 07/02/17. */ public class HomePageObject { @AndroidFindBy(accessibility = "ReferenceApp") public MobileElement menuButton; @iOSFindBy(accessibility = "Inputs") @AndroidFindBy(xpath = "//android.widget.TextView[@text='Input Controls']") public MobileElement inputControls; }
package org.cloudfoundry.samples.music.domain; import org.hibernate.annotations.GenericGenerator; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class Artist { @Id @Column(length = 255) private String name; public Artist() { } public Artist(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
package uno.card; import uno.Color; import uno.Game; public class SkipCard extends ColorCard { public SkipCard(Color color) { super(color); } public boolean canPlaceOn(Card other) { return getColor().equals(other.getColor()) || getClass().equals(other.getClass()); } public int orderNum() { return 10; } public void effect(Game game) { game.nextPlayer(); } @Override public String toString() { return getColor().toString() + " skip"; } }
package ua.www2000.yourcourses.dto; import lombok.*; @Getter @Setter @AllArgsConstructor @NoArgsConstructor @RequiredArgsConstructor @Builder @ToString public class UserDTO { @NonNull private String email; private String firstName; private String lastName; @NonNull private String password; }
package com.tencent.tencentmap.mapsdk.a; import android.view.animation.Interpolator; public class kl extends kk { private ox e; protected void a(float f, Interpolator interpolator) { float interpolation = interpolator.getInterpolation(f); if (this.d != null) { this.d.b(interpolation); } } public ox f() { return this.e; } }
package com.tencent.mm.plugin.sns; import com.tencent.mm.g.a.ob; import com.tencent.mm.sdk.platformtools.al.a; class d$1 implements a { final /* synthetic */ d nhe; d$1(d dVar) { this.nhe = dVar; } public final boolean vD() { ob obVar = new ob(); obVar.bYX.bRc = null; com.tencent.mm.sdk.b.a.sFg.m(obVar); return false; } }
package com.yqwl.dao; import java.math.BigInteger; import java.util.List; import org.apache.ibatis.annotations.Param; import com.yqwl.pojo.Trade; /** * * @ClassName: TradeMapper * @description 行业的查询,新增,删除等方法 * * @author dujiawei * @createDate 2019年6月9日 */ public interface TradeMapper { /** * @Title: listTrade * @description (后台)分页查询所有的行业 * @param @param beginPageIndex * @param @param limit * @return List<Trade> * @author dujiawei * @createDate 2019年6月9日 */ List<Trade> listTrade(@Param("beginPageIndex")Integer beginPageIndex,@Param("limit")Integer limit); /** * @Title: countTrade * @description 所有行业的数量 * @return int * @author dujiawei * @createDate 2019年6月9日 */ public int countTrade(); /** * @Title: saveTrade * @description (后台)增加一条行业 * @param @param trade * @return int * @author dujiawei * @createDate 2019年6月9日 */ public int saveTrade(Trade trade); /** * @Title: removeTrade * @description (后台)删除一条行业 * @param @param id * @return int * @author dujiawei * @createDate 2019年6月9日 */ public int removeTrade(@Param("id") BigInteger id); /** * @Title: getTradeById * @description (后台)通过id查询对应的行业 * @param @param trade * @return Trade * @author dujiawei * @createDate 2019年6月9日 */ public Trade getTradeById(Trade trade); /** * @Title: showAllTrade * @description (前台)显示所有的行业 * @return List<Trade> * @author dujiawei * @createDate 2019年6月9日 */ public List<Trade> showAllTrade(); }
package com.junadefrizlar.Question_2; public class Aeroplane implements Refuel { private String engineType; private int numberOfEngines; private int engineCapacity; private Vehicle vehicle; public Aeroplane(String engineType, int numberOfEngines, int engineCapacity, Vehicle vehicle) { this.engineType = engineType; this.numberOfEngines = numberOfEngines; this.engineCapacity = engineCapacity; this.vehicle = vehicle; } public String getEngineType() { return engineType; } public void setEngineType(String engineType) { this.engineType = engineType; } public int getNumberOfEngines() { return numberOfEngines; } public void setNumberOfEngines(int numberOfEngines) { this.numberOfEngines = numberOfEngines; } public int getEngineCapacity() { return engineCapacity; } public void setEngineCapacity(int engineCapacity) { this.engineCapacity = engineCapacity; } public Vehicle getVehicle() { return vehicle; } public void setVehicle(Vehicle vehicle) { this.vehicle = vehicle; } @Override public String toString() { return "Aeroplane{" + "engineType='" + engineType + '\'' + ", numberOfEngines=" + numberOfEngines + ", engineCapacity=" + engineCapacity + ", vehicle=" + vehicle + '}'; } @Override public int refuelVehicle(int numberOfEngines, int engineCapacity) { return numberOfEngines * engineCapacity; } }
package com.example.atos.myapplication.controller; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.example.atos.myapplication.R; import com.example.atos.myapplication.customclasses.BaseActivity; import com.example.atos.myapplication.global.Constants; import com.example.atos.myapplication.customclasses.ProgressDialogue; import com.example.atos.myapplication.global.Utils; import com.example.atos.myapplication.handler.GetServiceCallHandler; import com.example.atos.myapplication.interfaces.CallBackInterface; public class GetRequestActivity extends BaseActivity implements CallBackInterface { EditText responseEditTxt = null; ProgressDialogue obj; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_get_request); obj = new ProgressDialogue(this); Button btnAccess = (Button) findViewById(R.id.requestPostbtn); final EditText requestEditTxt = (EditText) findViewById(R.id.requestEditText); this.responseEditTxt = (EditText) findViewById(R.id.responseEditText); btnAccess.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { obj.showProgressDialog(); responseEditTxt.setVisibility(View.GONE); if (Utils.isNetworkConnected(GetRequestActivity.this)) { GetServiceCallHandler handler = new GetServiceCallHandler(GetRequestActivity.this); handler.loginService(Constants.getLoginSampleURL + "/" + "test" + "/" + "test"); } else { showToast("Network not available!!!"); } } }); } @Override public void callBack(String response) { responseEditTxt.setText(response); responseEditTxt.setVisibility(View.VISIBLE); obj.stopProgressDialog(); } public void failedWithErrorMessage(String errorMessage){ obj.stopProgressDialog(); showToast(errorMessage); } }
package interviews.amazon.oa1; import java.util.Comparator; import java.util.PriorityQueue; import common.Process; public class ShortestJobFirst { public float schedule(int[] req, int[] dur) { if (req.length * dur.length == 0 || req.length != dur.length) return 0; PriorityQueue<Process> queue = new PriorityQueue<>(new Comparator<Process>() { @Override public int compare(Process arg0, Process arg1) { if(arg0.arrTime == arg1.arrTime) return arg0.exeTime - arg1.exeTime; return arg0.arrTime - arg1.arrTime; } }); int index = 0, waitTime = 0, curTime = 0; while(!queue.isEmpty() || index < req.length) { if(queue.isEmpty()) { queue.offer(new Process(req[index], dur[index])); curTime = req[index++]; } else { Process process = queue.poll(); waitTime += process.arrTime - curTime; curTime += process.exeTime; for (int i = index; i < dur.length; i++) { if(req[i] > curTime) break; queue.offer(new Process(req[i], dur[i])); } } } return waitTime / req.length; } /*public float schedule(int[] req, int[] dur) { if (req == null || dur == null || req.length != dur.length) return 0; int index = 0, length = req.length; int waitTime = 0, curTime = 0; PriorityQueue<Process> pq = new PriorityQueue<Process>(new Comparator<Process>() { public int compare(Process p1, Process p2) { if (p1.exeTime == p2.exeTime) return p1.arrTime - p2.arrTime; return p1.exeTime - p2.exeTime; } }); while (!pq.isEmpty() || index < length) { if (!pq.isEmpty()) { Process cur = pq.poll(); waitTime += curTime - cur.arrTime; curTime += cur.exeTime; while (index < length && curTime >= req[index]) pq.offer(new Process(req[index], dur[index++])); } else { pq.offer(new Process(req[index], dur[index])); curTime = req[index++]; } } return (float) waitTime / length; }*/ }
package com.tencent.mm.plugin.freewifi.model; import android.net.wifi.ScanResult; import java.util.Comparator; class h$2 implements Comparator<ScanResult> { final /* synthetic */ h jkc; h$2(h hVar) { this.jkc = hVar; } public final /* bridge */ /* synthetic */ int compare(Object obj, Object obj2) { ScanResult scanResult = (ScanResult) obj; ScanResult scanResult2 = (ScanResult) obj2; if (scanResult.level < scanResult2.level) { return 1; } return scanResult.level == scanResult2.level ? 0 : -1; } }
package oop.Exercise03Test; import oop.Exercise03.QueueNumber; import org.junit.Test; import static org.junit.Assert.*; public class QueueNumberTest { @Test public void test_QueueNumber() { QueueNumber queue = new QueueNumber(); assertTrue(queue.isEmpty()); assertEquals(queue.offer(3),true); assertEquals(queue.size(),1); assertEquals(queue.peek(),3); assertEquals(queue.poll(),3); assertTrue(queue.isEmpty()); assertEquals(queue.size(),0); assertEquals(queue.poll(),0); for (int i = 1; i < 100; i++) queue.offer(i); assertFalse(queue.offer(100)); assertEquals(queue.size(), 99); assertEquals(queue.poll(),1); } }
package com.mineskies.antibot.listener; import com.mineskies.antibot.AntiBot; import com.mineskies.antibot.Constants; import com.mineskies.antibot.inventory.CaptchaInventory; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.Inventory; public class PlayerListener implements Listener { @EventHandler public void onJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); if (AntiBot.getInstance().isCaptchaEnabled() && !AntiBot.getInstance().getCompleted().contains(player.getUniqueId())) { Bukkit.getScheduler().runTaskLater(AntiBot.getInstance(), new Runnable() { @Override public void run() { new CaptchaInventory().launchFor(player); } }, 20L); } } @EventHandler public void onQuit(PlayerQuitEvent event) { Player player = event.getPlayer(); //--- Remove player when they leave. if (AntiBot.getInstance().isCaptchaEnabled() && AntiBot.getInstance().getCompleted().contains(player.getUniqueId())) { AntiBot.getInstance().getCompleted().remove(player.getUniqueId()); } } @EventHandler public void onMove(PlayerMoveEvent event) { Player player = event.getPlayer(); if (AntiBot.getInstance().isCaptchaEnabled() && !AntiBot.getInstance().getCompleted().contains(player.getUniqueId())) { new CaptchaInventory().launchFor(player); event.setCancelled(true); } } @EventHandler public void onAsyncChat(AsyncPlayerChatEvent event) { Player player = event.getPlayer(); if (AntiBot.getInstance().isCaptchaEnabled() && !AntiBot.getInstance().getCompleted().contains(player.getUniqueId())) { event.setCancelled(true); } } @EventHandler public void onInventoryClose(InventoryCloseEvent event) { if (event.getPlayer() instanceof Player) { Player player = (Player) event.getPlayer(); Inventory inventory = event.getInventory(); if (inventory != null && inventory.getTitle() != null && inventory.getTitle().equals(Constants.INVENTORY_TITLE)) { if (AntiBot.getInstance().isCaptchaEnabled() && !AntiBot.getInstance().getCompleted().contains(player.getUniqueId())) { player.kickPlayer(Constants.KICK_MESSAGE); } } } } }
package ex1; public class MainApp { public static void main(String[] args) { ContBancar contBancar = new ContBancar(0); Depunere depunere = new Depunere(contBancar); Extragere extragere = new Extragere(contBancar); depunere.start(); extragere.start(); } }
package com.ai.slp.order.monitor; import java.sql.Timestamp; import java.util.Map; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ai.opt.base.exception.BusinessException; import com.ai.opt.sdk.components.mcs.MCSClientFactory; import com.ai.opt.sdk.util.DateUtil; import com.ai.paas.ipaas.mcs.interfaces.ICacheClient; import com.ai.slp.order.constants.MonitorCoonstants; import com.ai.slp.order.constants.OrdRuleConstants; import com.ai.slp.order.dao.mapper.bo.OrdRule; import com.ai.slp.order.service.atom.interfaces.IOrdRuleAtomSV; import com.ai.slp.order.util.DateCycleUtil; import com.alibaba.fastjson.JSON; @Service public class MonitorService { private static final Logger log = LoggerFactory.getLogger(MonitorService.class); @Autowired private IOrdRuleAtomSV ordRuleAtomSV; /** * 下单前缓存预警服务 * * @author zhangzd * @ApiDocMethod * @ApiCode */ public void beforSubmitOrder(String ipAddress,String userId){ // //查询用户规则信息 OrdRule ordRuleUser = this.ordRuleAtomSV.getOrdRule(OrdRuleConstants.BUY_EMPLOYEE_MONITOR_ID); //查询购买Ip规则信息 OrdRule ordRuleIp = this.ordRuleAtomSV.getOrdRule(OrdRuleConstants.BUY_IP_MONITOR_ID); //订单总量规则信息 OrdRule ordRuleAll = this.ordRuleAtomSV.getOrdRule(OrdRuleConstants.TIME_MONITOR_ID); // Map<String,Object> userCycleDate = DateCycleUtil.getCycleDate(ordRuleUser.getTimeType(), -ordRuleUser.getMonitorTime()); Map<String,Object> ipCycleDate = DateCycleUtil.getCycleDate(ordRuleIp.getTimeType(), -ordRuleIp.getMonitorTime()); Map<String,Object> allCycleDate = DateCycleUtil.getCycleDate(ordRuleAll.getTimeType(), -ordRuleAll.getMonitorTime()); // ICacheClient cacheClient = MCSClientFactory.getCacheClient(MonitorCoonstants.MONITOR_CACHE_NAMESPACE); // Set<String> userSet = cacheClient.zrevrangeByScore(userId, userCycleDate.get("startTime").toString(), userCycleDate.get("endTime").toString()); Set<String> ipSet = cacheClient.zrevrangeByScore(ipAddress, ipCycleDate.get("startTime").toString(), ipCycleDate.get("endTime").toString()); Set<String> orderAllSet = cacheClient.zrevrangeByScore("order_all", allCycleDate.get("startTime").toString(), allCycleDate.get("endTime").toString()); //用户预警提示 if(userSet.size() >= ordRuleUser.getOrderSum() ){ throw new BusinessException("999999","当前用户["+userId+"]下,"+ordRuleUser.getMonitorTime()+DateCycleUtil.dateTypeMap.get(ordRuleUser.getTimeType())+"内,已达到"+ordRuleUser.getOrderSum()+"单预警"); } //ip预警提示 if(ipSet.size() >= ordRuleIp.getOrderSum() ){ throw new BusinessException("999999","当前ip["+ipAddress+"]下,"+ordRuleIp.getMonitorTime()+DateCycleUtil.dateTypeMap.get(ordRuleIp.getTimeType())+"内,已达到"+ordRuleIp.getOrderSum()+"单预警"); } //订单总量预警提示 if(orderAllSet.size() >= ordRuleAll.getOrderSum() ){ throw new BusinessException("999999","订单总量,"+ordRuleAll.getMonitorTime()+DateCycleUtil.dateTypeMap.get(ordRuleAll.getTimeType())+"内,已达到"+ordRuleAll.getOrderSum()+"单预警"); } log.info("当前用户下订单数量:"+userSet.size()); log.info("当前用户下订单Json:"+JSON.toJSONString(userSet)); // log.info("当前ip下订单数量:"+ipSet.size()); log.info("当前ip下订单Json:"+JSON.toJSONString(ipSet)); // log.info("订单总量下订单数量:"+orderAllSet.size()); log.info("当前订单总量下订单Json:"+JSON.toJSONString(orderAllSet)); } /** * 下单后缓存清空服务 * * @author zhangzd * @ApiDocMethod * @ApiCode */ public void afterSubmitOrder(String ipAddress,String userId){ String timeStr = "20000101000000"; // ICacheClient cacheClient = MCSClientFactory.getCacheClient(MonitorCoonstants.MONITOR_CACHE_NAMESPACE); // long millisTime = DateUtil.getSysDate().getTime();//毫秒 long time = millisTime/1000;//秒 //1、添加用户规则下的预警信息 cacheClient.zadd(userId, time, userId+"_"+millisTime);//用户有序集合 //2、添加ip规则下的预警信息 cacheClient.zadd(ipAddress, time, ipAddress+"_"+millisTime);//地址有序集合 //3、添加订单总量集合预警信息 cacheClient.zadd("order_all", time, "order_all_"+millisTime);//订单总量 //查询用户规则信息 OrdRule ordRuleUser = this.ordRuleAtomSV.getOrdRule(OrdRuleConstants.BUY_EMPLOYEE_MONITOR_ID); //查询购买Ip规则信息 OrdRule ordRuleIp = this.ordRuleAtomSV.getOrdRule(OrdRuleConstants.BUY_IP_MONITOR_ID); //订单总量规则信息 OrdRule ordRuleAll = this.ordRuleAtomSV.getOrdRule(OrdRuleConstants.TIME_MONITOR_ID); // Map<String,Object> userCycleDate = DateCycleUtil.getCycleDate(ordRuleUser.getTimeType(), -ordRuleUser.getMonitorTime()); Map<String,Object> ipCycleDate = DateCycleUtil.getCycleDate(ordRuleIp.getTimeType(), -ordRuleIp.getMonitorTime()); Map<String,Object> allCycleDate = DateCycleUtil.getCycleDate(ordRuleAll.getTimeType(), -ordRuleAll.getMonitorTime()); long start = DateCycleUtil.strToDate(timeStr).getTime()/1000; //1、删除用户规则下的预警信息 long userDelCount = cacheClient.zremrangeByScore(userId, String.valueOf(start),userCycleDate.get("endTime").toString()); log.info("用户规则下--开始时间:"+String.valueOf(start)+" 和结束时间:"+userCycleDate.get("endTime").toString()); log.info("根据规则删除当前用户下的信息条数:"+userDelCount); //2、删除ip规则下的预警信息 long ipDelCount = cacheClient.zremrangeByScore(ipAddress, String.valueOf(start),ipCycleDate.get("endTime").toString()); log.info("Ip规则下--开始时间:"+String.valueOf(start)+" 和结束时间:"+ipCycleDate.get("endTime").toString()); log.info("根据规则删除当前Ip下的信息条数:"+ipDelCount); //3、删除订单总量规则下的预警信息 long allDelCount = cacheClient.zremrangeByScore("order_all", String.valueOf(start),allCycleDate.get("endTime").toString()); log.info("订单总量规则下--开始时间:"+String.valueOf(start)+" 和结束时间:"+allCycleDate.get("endTime").toString()); log.info("根据规则删除订单总量下的信息条数:"+allDelCount); } public static void main(String args[]){ Timestamp timestamp = DateUtil.getSysDate(); // System.out.println("timestamp to string:"+timestamp.toString()); long millis = DateUtil.getCurrentTimeMillis(); System.out.println("millis:"+millis); String currentTime = DateUtil.getCurrentTime(); System.out.println("currentTime:"+currentTime); Timestamp scurrtest = new Timestamp(System.currentTimeMillis()); System.out.println("scurrtest = "+scurrtest); long sqlLastTime = scurrtest.getTime();// 直接转换成long System.out.println("sqlLastTime = "+sqlLastTime); //毫秒数 System.out.println("sqlLastTime/1000 = "+sqlLastTime/1000); } }
package com.sports.service; public interface IService {}
import java.io.*; import java.util.*; //Definition for a binary tree node. class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } /** * 110. Balanced Binary Tree * 这题虽然简单,但是还是复习一下平衡二叉树的知识好 */ class Solution { private boolean isBalanced = true; private int dfs(TreeNode root) { if (root == null || !isBalanced) // 已失衡剪枝 return 0; int l = dfs(root.left); int r = dfs(root.right); if (Math.abs(l - r) > 1) isBalanced = false; return l > r ? l + 1 : r + 1; } public boolean isBalanced(TreeNode root) { dfs(root); return isBalanced; } public TreeNode createTree(String[] nums) { if (nums == null) return null; List<TreeNode> nodes = new ArrayList<>(); for (int i = 0; i < nums.length; i++) { TreeNode t = null; if (!"null".equals(nums[i])) t = new TreeNode(Integer.parseInt(nums[i])); nodes.add(t); if (i != 0) { TreeNode parent = nodes.get((i - 1) / 2); if (parent == null) continue; if (i % 2 == 0) parent.right = t; else parent.left = t; } } return nodes.get(0); } public static void main(String[] args) throws IOException { Solution s = new Solution(); File f = new File("input.txt"); Scanner scan = new Scanner(f); while (scan.hasNext()) { String[] nums = scan.nextLine().split(","); System.out.println(s.isBalanced(s.createTree(nums))); } scan.close(); } }
package com.tony.edu.netty.jio; import java.io.IOException; import java.io.InputStream; import java.net.ServerSocket; import java.net.Socket; public class TonySocketServer { public static void main(String[] args) throws IOException, Exception { // server --- jvm ===操作系统 申请端口 ServerSocket serverSocket = new ServerSocket(9999); // 获取新连接 while (true) { final Socket accept = serverSocket.accept(); // accept.getOutputStream().write("推送实例"); InputStream inputStream = accept.getInputStream(); while (true) { // 接下来,为了完善业务,一堆的代码要去写 --0--- 拆包粘包 byte[] request = new byte[1024]; int read = inputStream.read(request); if (read == -1) { break; } // 得到请求内容,解析,得到发送对象和发送内容() String content = new String(request); // 可能是一次完整的数据包, 也可能是多个数据包,甚至是不完整的数据 // 每次读取到的数据,不能够保证是一条完整的信息 // System.out.println(content); // TODO 收到数据根据 协议 去解析数据 String roomId = content.substring(0, 10); String msg = content.replace(roomId, ""); RoomMsg roomMsg = new RoomMsg(); roomMsg.roomId = roomId; roomMsg.msg = msg; System.out.println(roomMsg); } } } } class RoomMsg{ String roomId; String msg; @Override public String toString() { return "RoomMsg{" + "roomId='" + roomId + '\'' + ", msg='" + msg + '\'' + '}'; } }
/* * 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 wickersoft.root; import syn.root.user.Mark; import java.io.File; import java.text.SimpleDateFormat; import java.time.Instant; import java.util.Date; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.inventory.EquipmentSlot; import syn.root.user.InventoryProvider; import syn.root.user.UserData; import syn.root.user.UserDataProvider; /** * * @author Dennis */ public class WatcherPlayer implements Listener { private static final WatcherPlayer INSTANCE = new WatcherPlayer(); private static final SimpleDateFormat DEATH_INVENTORY_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss"); public static WatcherPlayer instance() { return INSTANCE; } private WatcherPlayer() { } @EventHandler public void onBlockBreak(BlockBreakEvent evt) { UserData data = UserDataProvider.getOrCreateUser(evt.getPlayer()); if (data.isFrozen() && !evt.getPlayer().hasPermission("root.freeze.bypass")) { evt.setCancelled(true); return; } if (!evt.isCancelled() && evt.getBlock().getY() <= 16 && evt.getBlock().getType() == Material.DIAMOND_ORE && !evt.getPlayer().hasPermission("root.notify.xray.bypass")) { long xrayTest = data.testXrayWarnTime(); if (xrayTest < Storage.XRAY_WARN_TIME) { long minutes = xrayTest / 60000; long seconds = (xrayTest / 1000) % 60; Bukkit.broadcast(ChatColor.RED + "Player " + evt.getPlayer().getName() + " has mined 20 Diamond Ore in " + minutes + " minutes and " + seconds + " seconds!", "root.notify.xray"); data.resetXrayWarnTime(); } } } @EventHandler public void onBlockPlace(BlockPlaceEvent evt) { UserData data = UserDataProvider.getOrCreateUser(evt.getPlayer()); if (data.isFrozen() && !evt.getPlayer().hasPermission("root.freeze.bypass")) { evt.setCancelled(true); } } @EventHandler public void onPlayerAttack(EntityDamageByEntityEvent evt) { if (evt.getDamager().getType() != EntityType.PLAYER) { return; } Player player = (Player) evt.getDamager(); if (UserDataProvider.getOrCreateUser(player).isFrozen() && !player.hasPermission("root.freeze.bypass")) { evt.setCancelled(true); } } @EventHandler public void onPlayerDeath(PlayerDeathEvent evt) { long currentMillis = System.currentTimeMillis(); File[] allInventoryFiles = InventoryProvider.getInventoryFiles(evt.getEntity().getUniqueId()); for (File file : allInventoryFiles) { if (file.getName().startsWith("_death_") && currentMillis - file.lastModified() > Storage.MAX_DEATH_INV_AGE_MILLIS) { file.delete(); // Clean up old death inventories } } String deathInventoryName = "_death_" + DEATH_INVENTORY_DATE_FORMAT.format(Date.from(Instant.ofEpochMilli(currentMillis))); File deathInventoryFile = InventoryProvider.getInventoryFile(evt.getEntity(), deathInventoryName); InventoryProvider.saveInventory(evt.getEntity(), deathInventoryFile); } @EventHandler public void onPlayerInteract(PlayerInteractEvent evt) { if (UserDataProvider.getOrCreateUser(evt.getPlayer()).isFrozen() && !evt.getPlayer().hasPermission("root.freeze.bypass")) { evt.setCancelled(true); } } @EventHandler public void onPlayerInteract(PlayerInteractEntityEvent evt) { if (UserDataProvider.getOrCreateUser(evt.getPlayer()).isFrozen() && !evt.getPlayer().hasPermission("root.freeze.bypass")) { evt.setCancelled(true); } } @EventHandler(priority = EventPriority.HIGHEST) public void onPreLogin(PlayerLoginEvent evt) { if (evt.getResult() != PlayerLoginEvent.Result.ALLOWED) { String kickMessage = evt.getKickMessage(); kickMessage += "\n\n"; kickMessage += Storage.BAN_APPEAL_MESSAGE; evt.setKickMessage(kickMessage); } } @EventHandler public void onJoin(PlayerJoinEvent evt) { String ip = evt.getPlayer().getAddress().getAddress().getHostAddress(); UserData data = UserDataProvider.getOrCreateUser(evt.getPlayer()); data.setName(evt.getPlayer().getName()); data.setIp(ip); if (Storage.WARN_IPS.containsKey(ip) && !evt.getPlayer().getName().equals(Storage.WARN_IPS.get(ip))) { Bukkit.broadcast(ChatColor.RED + "Player " + evt.getPlayer().getName() + "\'s IP matches with " + Storage.WARN_IPS.get(ip) + "!", "root.notify.iprec"); } for (Mark mark : data.getMarks()) { if (mark.getPriority() > 0) { Bukkit.broadcast(ChatColor.RED + "Player " + evt.getPlayer().getName() + " has Marks! " + ChatColor.GRAY + ChatColor.ITALIC + "[/mark " + data.getName() + "]", "root.notify.mark"); } } new TaskGeoQuery(data, false, (geoData) -> { String geoLocation = (String) geoData.getOrDefault("geoplugin_countryName", "GeoQuery Error"); String preciseGeoLocation = (String) geoData.getOrDefault("geoplugin_city", "Unknown") + ", " + (String) geoData.getOrDefault("geoplugin_regionName", "Unknown") + ", " + geoLocation; geoLocation = org.apache.commons.lang3.StringEscapeUtils.unescapeHtml4(geoLocation); preciseGeoLocation = org.apache.commons.lang3.StringEscapeUtils.unescapeHtml4(preciseGeoLocation); String timezone = (String) geoData.getOrDefault("maps_timezone", "GeoQuery Error"); data.setGeoLocation(geoLocation); data.setPreciseGeoLocation(preciseGeoLocation); data.setTimezone(timezone); if (!evt.getPlayer().hasPlayedBefore()) { Bukkit.broadcast(ChatColor.BLUE + data.getName() + ChatColor.GRAY + ": " + ChatColor.BLUE + ip + ChatColor.GRAY + " / " + ChatColor.BLUE + geoLocation, "root.notify.firstjoin"); } }).runTaskAsynchronously(Root.instance()); } @EventHandler public void onPlayerMove(PlayerMoveEvent evt) { if (UserDataProvider.getOrCreateUser(evt.getPlayer()).isFrozen() && !evt.getPlayer().hasPermission("root.freeze.bypass")) { evt.setCancelled(true); } } @EventHandler public void onItemPickup(EntityPickupItemEvent evt) { if (!(evt.getEntity() instanceof Player)) { return; } Player player = (Player) evt.getEntity(); if (UserDataProvider.getOrCreateUser(player).isFrozen() && !player.hasPermission("root.freeze.bypass")) { evt.setCancelled(true); } else if (!Util.canPlayerHoldVolatileItem(player, evt.getItem().getItemStack()) || SpecialItemUtil.isCursedSword(evt.getItem().getItemStack())) { evt.setCancelled(true); evt.getItem().remove(); } } @EventHandler public void onKick(PlayerKickEvent evt) { if (evt.getReason().equals("Flying is not enabled on this server")) { Block block = evt.getPlayer().getLocation().getBlock(); int altitude = 0; while (block.getY() > 0 && block.getType() == Material.AIR) { block = block.getRelative(BlockFace.DOWN); altitude++; } block = evt.getPlayer().getLocation().getBlock(); Bukkit.broadcast(ChatColor.RED + evt.getPlayer().getName() + " was kicked for flying! Altitiude: " + altitude + " (" + block.getX() + " " + block.getY() + " " + block.getZ() + ")", "root.notify.flykick"); } if (evt.getReason().equals("disconnect.spam") && evt.getPlayer().hasPermission("root.chat.nodisconnectspam")) { evt.setCancelled(true); } } @EventHandler public void onQuit(PlayerQuitEvent evt) { if (evt.getPlayer().hasMetadata("root.task.launch")) { TaskLaunchPlayer launcher = (TaskLaunchPlayer) evt.getPlayer().getMetadata("root.task.launch").get(0).value(); launcher.cancel(); } UserData data = UserDataProvider.getOrCreateUser(evt.getPlayer()); } @EventHandler public void onPlayerTeleport(PlayerTeleportEvent evt) { if (evt.getPlayer().hasMetadata("root.task.launch")) { TaskLaunchPlayer launcher = (TaskLaunchPlayer) evt.getPlayer().getMetadata("root.task.launch").get(0).value(); launcher.cancel(); } if (UserDataProvider.getOrCreateUser(evt.getPlayer()).isFrozen() && !evt.getPlayer().hasPermission("root.freeze.bypass")) { evt.setCancelled(true); } } }
package com.linroid.leetcode.happyNumber; import java.util.HashMap; import java.util.Map; /** * Created by linroid on 4/24/15. * @link https://leetcode.com/problems/happy-number/ */ public class Solution { public boolean isHappy(int n) { Map<Integer, Void> map = new HashMap<>(); while (true) { n = sumSquare(n); if(n == 1){ return true; } if(map.containsKey(n)){ return false; } map.put(n, null); } } private int sumSquare(int n) { System.out.print(n); int r = 0; while (n>0) { r += (n%10) * (n%10); n = n /10; } System.out.println(" => "+r); return r; } public static void main(String[] args) { Solution solution = new Solution(); System.out.println(solution.isHappy(19)); } }
package org.trivee.fb2pdf; import com.itextpdf.text.BaseColor; import com.itextpdf.text.Image; import com.itextpdf.text.Rectangle; import java.awt.Color; import java.awt.Toolkit; import java.awt.image.FilteredImageSource; import java.awt.image.ImageFilter; import java.awt.image.ImageProducer; import java.awt.image.RGBImageFilter; import java.io.File; import java.io.IOException; import java.net.URLDecoder; /** * * @author vzeltser */ public class Utilities { public static String getValidatedFileName(String filename) throws IOException { File file = new File(filename); if (file.exists()) { return filename; } file = new File(getBaseDir() + "/" + filename); String fullFilename = file.getCanonicalPath(); if (!file.exists()) { throw new IOException(String.format("File not found [%s or %s]", filename, fullFilename)); } return fullFilename; } public static String getBaseDir() throws IOException { String libPath = URLDecoder.decode(new File(Utilities.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent(), "UTF-8"); return (new File(libPath)).getParent(); } public static BaseColor getColor(String c) { return new BaseColor(Color.decode(c).getRGB()); } public static void rescaleImage(Image image, float zoomFactor, float wSpace, float hSpace, Rectangle pageSize, float dpi) { float scaleWidth = pageSize.getWidth() - wSpace; float scaleHeight = pageSize.getHeight() - hSpace; float imgWidth = image.getWidth() / dpi * 72 * zoomFactor; float imgHeight = image.getHeight() / dpi * 72 * zoomFactor; if ((imgWidth <= scaleWidth) && (imgHeight <= scaleHeight)) { scaleWidth = imgWidth; scaleHeight = imgHeight; } image.scaleToFit(scaleWidth, scaleHeight); } public static java.awt.Image makeGrayTransparent(byte[] imageData) { Toolkit toolkit = Toolkit.getDefaultToolkit(); java.awt.Image img = toolkit.createImage(imageData); ImageFilter filter = new RGBImageFilter() { public final int filterRGB(int x, int y, int rgb) { int r = (rgb & 0xFF0000) >> 16; int g = (rgb & 0xFF00) >> 8; int b = rgb & 0xFF; if (r == g && g == b) { return ((0xFF - r) << 24) & 0xFF000000; } return rgb; } }; ImageProducer ip = new FilteredImageSource(img.getSource(), filter); return toolkit.createImage(ip); } }
package org.murinrad.android.musicmultiply.decoder.impl; import android.annotation.TargetApi; import android.content.Context; import android.content.res.AssetFileDescriptor; import android.media.AudioFormat; import android.media.AudioManager; import android.media.AudioTrack; import android.media.MediaCodec; import android.media.MediaExtractor; import android.media.MediaFormat; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.util.Log; import org.murinrad.android.musicmultiply.MainActivity; import org.murinrad.android.musicmultiply.decoder.SoundSystemToPCMDecoder; import org.murinrad.android.musicmultiply.decoder.events.MusicPlaybackEventDispatcher; import org.murinrad.android.musicmultiply.decoder.events.OnDataSentListener; import org.murinrad.android.musicmultiply.networking.qos.QosMessageHandler; import java.io.IOException; import java.net.InetAddress; import java.nio.ByteBuffer; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.atomic.AtomicInteger; /** * Created by Radovan Murin on 8.3.2015. */ public class MP3ToPCMSender extends SoundSystemToPCMDecoder implements QosMessageHandler { private static final String LOG_TAG = "Sandbox"; protected MediaExtractor extractor; protected MediaCodec mediaCodec; protected AudioTrack audioTrack; protected Boolean doStop = false; String sourceURI; BufferedSender buffer; private int currentDelay = 0; private int delayThreshHold = 25; private Context context; @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public MP3ToPCMSender(String source,Context ctx) throws IOException { this.sourceURI = source; this.context = ctx; extractor = new MediaExtractor(); if(source.startsWith("content://")) { AssetFileDescriptor fd = ctx.getContentResolver().openAssetFileDescriptor(Uri.parse(source),"r"); extractor.setDataSource(fd.getFileDescriptor()); } else { extractor.setDataSource(source); } buffer = new BufferedSender(512); } public void play() { DecodeOperation decoder = new DecodeOperation(); decoder.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); buffer.start(); notifyOnStart(); } public void stop() { doStop = true; buffer.stop(); if (audioTrack != null) { audioTrack.flush(); audioTrack.release(); audioTrack = null; } notifyOnStop(); } @Override public void pause() { if(!isPaused()) { audioTrack.pause(); } else { audioTrack.play(); } } @TargetApi(Build.VERSION_CODES.JELLY_BEAN) private void decode() throws IOException { ByteBuffer[] codecInputBuffers; ByteBuffer[] codecOutputBuffers; MediaFormat mf = extractor.getTrackFormat(0); String mime = mf.getString(MediaFormat.KEY_MIME); mediaCodec = MediaCodec.createDecoderByType(mime); mediaCodec.configure(mf, null, null, 0); mediaCodec.start(); codecInputBuffers = mediaCodec.getInputBuffers(); codecOutputBuffers = mediaCodec.getOutputBuffers(); int sampleRate = mf.getInteger(MediaFormat.KEY_SAMPLE_RATE); audioTrack = new AudioTrack( AudioManager.STREAM_MUSIC, sampleRate, AudioFormat.CHANNEL_OUT_STEREO, AudioFormat.ENCODING_PCM_16BIT, AudioTrack.getMinBufferSize( sampleRate, AudioFormat.CHANNEL_OUT_STEREO, AudioFormat.ENCODING_PCM_16BIT ), AudioTrack.MODE_STREAM ); // start playing, we will feed you later audioTrack.play(); extractor.selectTrack(0); final long kTimeOutUs = 10000; MediaCodec.BufferInfo info = new MediaCodec.BufferInfo(); boolean sawInputEOS = false; boolean sawOutputEOS = false; int noOutputCounter = 0; int noOutputCounterLimit = 50; int inputBufIndex = 0; while (!sawOutputEOS && noOutputCounter < noOutputCounterLimit && !doStop) { // Log.i(LOG_TAG, "loop "); noOutputCounter++; if (!sawInputEOS) { inputBufIndex = mediaCodec.dequeueInputBuffer(kTimeOutUs); // Log.d(LOG_TAG, " bufIndexCheck " + bufIndexCheck); if (inputBufIndex >= 0) { ByteBuffer dstBuf = codecInputBuffers[inputBufIndex]; int sampleSize = extractor.readSampleData(dstBuf, 0 /* offset */); long presentationTimeUs = 0; if (sampleSize < 0) { Log.d(LOG_TAG, "saw input EOS."); sawInputEOS = true; sampleSize = 0; } else { presentationTimeUs = extractor.getSampleTime(); } // can throw illegal state exception (???) mediaCodec.queueInputBuffer(inputBufIndex, 0 /* offset */, sampleSize, presentationTimeUs, sawInputEOS ? MediaCodec.BUFFER_FLAG_END_OF_STREAM : 0); if (!sawInputEOS) { extractor.advance(); } } else { Log.e(LOG_TAG, "inputBufIndex " + inputBufIndex); } } int res = mediaCodec.dequeueOutputBuffer(info, kTimeOutUs); if (res >= 0) { // Log.d(LOG_TAG, "got frame, size " + info.size + "/" + info.presentationTimeUs); if (info.size > 0) { noOutputCounter = 0; } int outputBufIndex = res; ByteBuffer buf = codecOutputBuffers[outputBufIndex]; final byte[] chunk = new byte[info.size]; buf.get(chunk); buf.clear(); if (chunk.length > 0) { buffer.put(chunk); } mediaCodec.releaseOutputBuffer(outputBufIndex, false /* render */); if ((info.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) { Log.d(LOG_TAG, "saw output EOS."); sawOutputEOS = true; } while (isPaused && !doStop) { // a very crude way to implement a performPause button } } else if (res == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) { codecOutputBuffers = mediaCodec.getOutputBuffers(); Log.d(LOG_TAG, "output buffers have changed."); } else if (res == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) { MediaFormat oformat = mediaCodec.getOutputFormat(); Log.d(LOG_TAG, "output format has changed to " + oformat); } else { Log.d(LOG_TAG, "dequeueOutputBuffer returned " + res); } } Log.d(LOG_TAG, "stopping..."); if (mediaCodec != null) { mediaCodec.stop(); mediaCodec.release(); mediaCodec = null; } doStop = true; MusicPlaybackEventDispatcher.notifyMusicStop(); } @Override public void onSlowDownRequest() { //do nothing } @Override public void onRequestRetransmission(int startPacketID) { //do nothing } @Override public void onDelayRequest(final int delayMs) { if (Math.abs(delayMs - currentDelay) < delayThreshHold) { Log.i(MainActivity.APP_TAG, "Delay request ignored as delta is too small"); return; } else if (delayMs - currentDelay >= delayThreshHold) { currentDelay = delayMs; Thread t = new Thread(new Runnable() { @Override public void run() { audioTrack.pause(); try { Thread.sleep(delayMs); } catch (InterruptedException e) { e.printStackTrace(); } audioTrack.play(); Log.i(MainActivity.APP_TAG, String.format("Music playback paused for %s ms to compensate delay", delayMs)); } }); t.start(); } else { Log.w(MainActivity.APP_TAG, "Music playback is behind the client... "); } } @Override public void onPacketResentRequest(InetAddress address, int packetID) { //do nothing } private class BufferedSender implements Runnable { BlockingQueue<byte[]> queue; int bufferSize; int INIT_QUEUE_SIZE = 1024; Thread runner; AtomicInteger dataIn = new AtomicInteger(0); BufferedSender(int buffSize) { this.bufferSize = buffSize; queue = new ArrayBlockingQueue<byte[]>(INIT_QUEUE_SIZE); } void start() { if (runner != null) runner.interrupt(); runner = new Thread(this); runner.start(); } void stop() { runner.interrupt(); } @Override public void run() { boolean active = false; byte[] data; try { while (!Thread.interrupted()) { if (active || dataIn.get() > bufferSize) { active = true; data = queue.take(); audioTrack.write(data, 0, data.length); for (OnDataSentListener l : onDataSendListeners) { l.dataSent(data); } dataIn.addAndGet(data.length * -1); } else if (dataIn.get() == 0) { active = false; //Log.i(MainActivity.APP_TAG, "Buffering..."); } } } catch (InterruptedException ex) { Log.i(MainActivity.APP_TAG, "Buffer thread interrupted"); } } void put(byte[] data) { try { while (queue.remainingCapacity() == 0) { Thread.sleep(5); //ugly. I know if (doStop) { throw new InterruptedException(""); } } queue.add(data); dataIn.addAndGet(data.length); } catch (InterruptedException e) { } } } private class DecodeOperation extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... values) { try { decode(); } catch (Exception e) { Log.e("Sandbox", "FATAL ERROR OCCURRED", e); } return null; } @Override protected void onPreExecute() { } @Override protected void onProgressUpdate(Void... values) { } } }
package com.mx.profuturo.bolsa.model.service.candidates.dto; import java.io.Serializable; public class SimpleListOtherVacancyRequestBean implements Serializable { }
package net.lotrek.dynarec.execute; import javax.swing.JPanel; import net.lotrek.dynarec.devices.DirectoryDevice; import net.lotrek.dynarec.devices.MemorySpaceDevice; public abstract class Processor { protected MemorySpaceDevice[] devices; protected byte[] memory; private int lastAllocationOffset; private volatile boolean devicesInitialized; private Runnable peripheralRunnable = () -> { for (MemorySpaceDevice memorySpaceDevice : devices) memorySpaceDevice.initializeDevice(); devicesInitialized = true; while(!Thread.currentThread().isInterrupted()) for (MemorySpaceDevice memorySpaceDevice : devices) memorySpaceDevice.executeDeviceCycle(); for (MemorySpaceDevice memorySpaceDevice : devices) { memorySpaceDevice.disposeDevice(); } }; private Thread peripheralThread = new Thread(peripheralRunnable); public Processor(int memorySize, byte[] biosImage, MemorySpaceDevice...memorySpaceDevices) { memory = new byte[memorySize]; devices = new MemorySpaceDevice[1 + memorySpaceDevices.length];//memorySpaceDevices; System.arraycopy(memorySpaceDevices, 0, devices, 1, memorySpaceDevices.length); devices[0] = new DirectoryDevice(); for (MemorySpaceDevice memorySpaceDevice : devices) { memorySpaceDevice.setOccupationAddr(memorySize - (lastAllocationOffset += memorySpaceDevice.getOccupationLength())); memorySpaceDevice.setProcessor(this); } System.arraycopy(biosImage, 0, memory, 0, biosImage.length); } public byte[] getMemory() { return memory; } public int getMemorySize() { return memory.length; } public int getAvailableMemory() { return getMemorySize() - lastAllocationOffset; } public final boolean startProcessor() { if(devices.length > 0) { peripheralThread.start(); while(!devicesInitialized); } boolean toReturn = executeImpl(); try { peripheralThread.interrupt(); peripheralThread.join(); } catch (InterruptedException e) { e.printStackTrace(); } return toReturn; } public final void terminateProcessor(boolean shouldReboot) { terminateImpl(shouldReboot); } public final int getMemoryDeviceCount() { return devices.length; } public final MemorySpaceDevice getMemoryDevice(int id) { return devices[id]; } protected abstract void terminateImpl(boolean shouldReboot); protected abstract boolean executeImpl(); public abstract void interrupt(int index, long...parameters); public abstract void startDebugPane(); public abstract JPanel getPanelForDevice(MemorySpaceDevice dev); }
package in.ac.iiitd.kunal.todo_list; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import java.util.UUID; public class TaskFragments extends Fragment { private static final String ARG_TASK_ID = "task_id"; private Task mTask; private EditText mTitleField; private EditText mDescriptionField; private DatabaseHandler db; public static TaskFragments newInstance(UUID crimeId) { Bundle args = new Bundle(); args.putSerializable(ARG_TASK_ID, crimeId); TaskFragments fragment = new TaskFragments(); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); UUID taskId = (UUID) getArguments().getSerializable(ARG_TASK_ID); mTask = TaskLab.get(getActivity()).getTask(taskId); db = new DatabaseHandler(getActivity()); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.activity_task_fragments, container, false); mTitleField = (EditText) v.findViewById(R.id.task_title); mDescriptionField=(EditText)v.findViewById(R.id.task_description); mTitleField.setText(mTask.getmTitle()); mDescriptionField.setText(mTask.getmDescription()); mTitleField.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { mTask.setmTitle(s.toString()); db.updateInfo(mTask.getmId().toString(),mTask); } @Override public void afterTextChanged(Editable s) { } }); mDescriptionField.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { mTask.setmDescription(s.toString()); db.updateInfo(mTask.getmId().toString(),mTask); } @Override public void afterTextChanged(Editable s) { } }); return v; } }
public class Assignment5 { public static void main(String[] args) { String[] arr = {"test","okay","what"}; System.out.println(arr[1]); } }
package converter.Entity2Dto; import converter.Dto2Entity.AnimalI18nDto2AnimalI18nEntityConverter; import dao.AnimalDao; import dao.CategoryDao; import dao.LocaleDao; import dto.AnimalAjaxDto; import dto.AnimalDtoByte; import entity.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.convert.converter.Converter; import org.springframework.stereotype.Component; @Component public class AnimalAjaxEntity2AnimalDtoByteConverter implements Converter<AnimalAjaxDto, AnimalDtoByte> { @Autowired AnimalDao animalDao; @Autowired LocaleDao localeDao; @Autowired CategoryDao categoryDao; @Autowired AnimalI18nDto2AnimalI18nEntityConverter animalI18nDto2AnimalI18nEntityConverter; @Override public AnimalDtoByte convert(AnimalAjaxDto animalAjaxDto) { AnimalI18n animalI18n = animalI18nDto2AnimalI18nEntityConverter.convert(animalAjaxDto); Animal animal = animalDao.read(animalAjaxDto.getIdAnimals()); Locale locale = localeDao.read(animalAjaxDto.getAnimalI18nLocaleDto()); animalI18n.setLocaleAnimalI18n(locale); AnimalDtoByte animalDtoByte = new AnimalDtoByte(); animalDtoByte.setIdAnimal(animal.getAnimalId()); animalDtoByte.setNameAnimal(animalI18n.getNameAnimalI18n()); animalDtoByte.setImageAnimal(animal.getAnimalImage()); animalDtoByte.setAudioAnimal(animal.getAnimalAudio()); Category category = categoryDao.read(animal.getCategoryAnimal().getCategoryId()); CategoryI18n categoryI18n = new CategoryI18n(); categoryI18n.setI18nCategoryId(category.getCategoryId()); categoryI18n.setLocaleCategoryI18n(locale); animalDtoByte.setCategoryId(category.getCategoryId()); animalDtoByte.setNameCategory(categoryI18n.getNameCategoryI18n()); animalDtoByte.setLogoCategory(category.getLogo()); return animalDtoByte; } }
package loadbalance; public class InstanceLoad{ private int numReq; //number of consecutive minutes in 100 % private final int MAX; private long timeElapsed; private long freedomtime; private String addr; private String instanceID; public InstanceLoad(String add, String id) { this.numReq = 0; this.MAX = 3; this.timeElapsed = -1; this.freedomtime = 60000000000l; this.addr = add; this.instanceID = id; } public void addRequest() { ++numReq; } public void removeRequest() { --numReq; if(numReq==0) { timeElapsed = System.nanoTime(); } } public boolean isFull() { return numReq==MAX; } public boolean isFreeLongEnough() { if(numReq==0 && timeElapsed!=-1) { long actual = System.nanoTime(); if(actual-timeElapsed>=freedomtime) { return true; } } return false; } public String getAddress() { return addr; } public String getInstanceID() { return instanceID; } @Override public boolean equals(Object obj) { if (obj == null) return false; if (!(obj instanceof InstanceLoad)) { return false; } if (obj == this) { return true; } return this.addr.equals( ((InstanceLoad)obj).getAddress()); } @Override public int hashCode() { return Integer.parseInt(addr); } }
package com.zilker.taxi.bean; public class CabModelDetail { private String licencePlate; private String modelName; private String modelDescription; private int numSeats; public CabModelDetail() { } public CabModelDetail(String licencePlate, String modelName, String modelDescription, int numSeats) { super(); this.licencePlate = licencePlate; this.modelName = modelName; this.modelDescription = modelDescription; this.numSeats = numSeats; } public String getLicencePlate() { return licencePlate; } public void setLicencePlate(String licencePlate) { this.licencePlate = licencePlate; } public String getModelName() { return modelName; } public void setModelName(String modelName) { this.modelName = modelName; } public String getModelDescription() { return modelDescription; } public void setModelDescription(String modelDescription) { this.modelDescription = modelDescription; } public int getNumSeats() { return numSeats; } public void setNumSeats(int numSeats) { this.numSeats = numSeats; } }
package handlers; import java.io.File; import java.io.FileWriter; import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; public class ActionHandler implements IActionHandler { public Object[] listFiles(String path) { ArrayList<String> filesList = new ArrayList<String>(); File[] files = new File(path).listFiles(); for (File file : files) { if (file.isDirectory()) { filesList.add(file.getName() + File.separator); } else { filesList.add(file.getName()); } } return (Object[]) filesList.toArray(); } public String readFile(String path) throws FileNotFoundException { Scanner sc = new Scanner(new File(path)); String content = sc.useDelimiter("\\Z").next(); sc.close(); return content; } public Boolean writeFile(String path, String data, Boolean append) throws IOException { File file = new File(path); if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getName(), append); BufferedWriter bw = new BufferedWriter(fw); bw.write(data); bw.close(); return true; } }
/* * 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 labunoprogra; import java.util.ArrayList; import java.util.List; /** * * @author daniela */ public class operacionesData { private List listaUno; private List listaDos; private List listaTres; private List listaCuatro; private List listaCinco; public operacionesData() { this.listaUno = new ArrayList(); this.listaDos = new ArrayList(); this.listaTres = new ArrayList(); this.listaCuatro = new ArrayList(); this.listaCinco = new ArrayList(); } public void llenaListas(){ listaUno.add(1,"pera"); listaUno.add(2, "manzana"); listaUno.add(3,"limon"); listaUno.add(4, "melon"); listaUno.add(5, "naranja"); listaDos.add(1,"pera"); listaDos.add(2, "melon"); listaDos.add(3,"naranja"); listaDos.add(4, "limon"); listaDos.add(5, "manzana"); listaTres.add(1,"melon"); listaTres.add(2, "manzana"); listaTres.add(3,"naranja"); listaTres.add(4, "limon"); listaTres.add(5, "pera"); listaCuatro.add(1,"melon"); listaCuatro.add(2, "manzana"); listaCuatro.add(3,"naranja"); listaCuatro.add(4, "limon"); listaCuatro.add(5, "pera"); listaCinco.add(1,"melon"); listaCinco.add(2, "manzana"); listaCinco.add(3,"naranja"); listaCinco.add(4, "limon"); listaCinco.add(5, "pera"); listaUno.add(listaDos); listaDos.add(listaTres); listaTres.add(listaCuatro); listaCuatro.add(listaCinco); } public String sumar (String frutaUno, String frutaDos){ String resultado; List temp = new ArrayList(); return resultado; } }
package com.tencent.mm.plugin.downloader.model; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable.Creator; public class FileDownloadTaskInfo implements Parcelable { public static Creator<FileDownloadTaskInfo> CREATOR = new 1(); public String appId; public String bKg; public int bPG; public long gTK; public long icq; public boolean icr; public boolean ics; public long id; public String path; public int status; public String url; /* synthetic */ FileDownloadTaskInfo(Parcel parcel, byte b) { this(parcel); } public int describeContents() { return 0; } public void writeToParcel(Parcel parcel, int i) { parcel.writeLong(this.id); parcel.writeString(this.url); parcel.writeInt(this.status); parcel.writeString(this.path); parcel.writeString(this.bKg); parcel.writeString(this.appId); parcel.writeLong(this.icq); parcel.writeLong(this.gTK); parcel.writeByte((byte) (this.icr ? 1 : 0)); parcel.writeInt(this.bPG); } public FileDownloadTaskInfo() { this.id = -1; this.url = ""; this.status = 0; this.path = ""; this.bKg = ""; this.appId = ""; this.icq = 0; this.gTK = 0; this.icr = false; this.bPG = 2; this.ics = false; } private FileDownloadTaskInfo(Parcel parcel) { boolean z = true; this.id = -1; this.url = ""; this.status = 0; this.path = ""; this.bKg = ""; this.appId = ""; this.icq = 0; this.gTK = 0; this.icr = false; this.bPG = 2; this.ics = false; this.id = parcel.readLong(); this.url = parcel.readString(); this.status = parcel.readInt(); this.path = parcel.readString(); this.bKg = parcel.readString(); this.appId = parcel.readString(); this.icq = parcel.readLong(); this.gTK = parcel.readLong(); if (parcel.readByte() != (byte) 1) { z = false; } this.icr = z; this.bPG = parcel.readInt(); } }
package unlinked; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; public class Driver { @SuppressWarnings("unchecked") public static void main (String args[]) { //int j; //unlinkedTrips is an ArrayList that holds the entire csv file ArrayList<UnlinkedTrip> unlinkedTrips = new ArrayList<UnlinkedTrip>(); //read the csv file in: unlinkedTrips = CsvFileReader.unlinkedTripCsvFileToArrayList("UNLINKED_Public.csv"); //confirm that there are the same number of entries in unlinkedTrips array list as there are rows in the csv file: System.out.println("There are " + unlinkedTrips.size() + " Records in the unlinkedTrips ArrayList"); //Print out some data to be confident that everything is where it should be in the unlinkedTrips array list: System.out.println("HCITY_MCD for entry 188199 is " + unlinkedTrips.get(188198).getHCITY_MCD() + ""); //autoSegments is an ArrayList that holds only the trips and the associated attributes we are interested in for our study ArrayList<AutoTripSegment> autoSegments = new ArrayList<AutoTripSegment>(); //Start filling the autoSegments ArrayList: for (int i = 0; i < unlinkedTrips.size(); i++) { /* We are only interested only in drivers of automobiles (ULTMODE = 5) * this prevents duplicate tours appearing in our data (each trip segment only has 1 driver) * Since we are interested in seeing how individual vehicles behave throughout the day it is more useful * to look at the driving patterns of the vehicles themselves to see if they are capable of meeting the demands * of what would be required of it if it were an electric vehicle. * * Later on, we could possibly look at the number of occupants and * how DTPURP_AGG = 4 (Escorting) (ie - driving people around) * affects the demands of the tour to be met by an electric vehicle */ if(unlinkedTrips.get(i).getULTMODE().equals("5")) { AutoTripSegment autoSegment = new AutoTripSegment(unlinkedTrips.get(i)); autoSegments.add(autoSegment); } } //Print out how many auto trip segments we are left with: System.out.println("There are " + autoSegments.size() + " auto trip segments in the autoSegments ArrayList"); //household is an ArrayList of AutoTripSegments such that all AutoTripSegments that belong to household all have the same household identifier (SAMPN) ArrayList<AutoTripSegment> household = new ArrayList<AutoTripSegment>(); //householdCollection is a general arrayList that is used to hold ArrayLists of AutoTripSegments that all belong to the same household ArrayList <ArrayList<AutoTripSegment>> householdCollection = new ArrayList <ArrayList<AutoTripSegment>> (); //hhCount is a tester variable, just making sure we have the right number of households being made int hhCount = 0; //Loop goes as long as there are autoSegments to be compiled into households for(int i = 0; i < autoSegments.size(); i++) { if ((i == autoSegments.size() - 1) || !(autoSegments.get(i).getSAMPN().equals(autoSegments.get(i+1).getSAMPN())) ) { //Add the last trip to this household household.add(autoSegments.get(i)); //Add the completed household to householdCollection householdCollection.add(household); //reset the household ArrayList to be empty for the next household household = new ArrayList<AutoTripSegment>(); hhCount++; } else { //add this trip to the current household household.add(autoSegments.get(i)); //go to the next element } } //Some statements to confirm our calculations thus far: boolean multHH = false; int multHHs = 0; System.out.println("There are " + hhCount + " households in the autoSegments array list"); System.out.println("There are " + householdCollection.size() + " households in the householdCollection array list"); for (int i = 0; i < householdCollection.size(); i++) { for(int j = 0; j < ((ArrayList<AutoTripSegment>) householdCollection.get(i)).size()-1; j++) { if(!((ArrayList<AutoTripSegment>) householdCollection.get(i)).get(j).getSAMPN().equals(((ArrayList<AutoTripSegment>) householdCollection.get(i)).get(j+1).getSAMPN())) multHH = true; } if (multHH == true) { multHHs++; } } System.out.println("There are " + multHHs + " Households that have more than one SAMPN in the autoTourCollection ArrayList. THIS MUST BE 0" + "\n"); //for now householdCollection is an ArrayList that holds collections of AutoTripSegments that share a common SAMPN (household identifier) //We find out how many tours the household made then we sort those tours by VEHNO (vehicle number for that household) //We make an Auto class based on the collection of tours made by each unique vehicle (identified by their VEHNO) //autoTourAttrib will be the ArrayList we pass to the constructor ArrayList<AutoTripSegment> autoTourAttrib = new ArrayList<AutoTripSegment>(); //autoTourCollection will be the ArrayList that holds the tours as they are completed ArrayList <AutoTour> autoTourCollection = new ArrayList<AutoTour>(); //Declare an AutoTour object with a null ArrayList AutoTour at = new AutoTour(autoTourAttrib); //we need to pull out the tours from every house hold, so we will make a for loop to process every household in the householdCollection for (int i = 0; i < householdCollection.size(); i++) { //get the household and loop through the collection of trips contained within ArrayList<AutoTripSegment> curHH = new ArrayList <AutoTripSegment>(); curHH = (ArrayList<AutoTripSegment>) householdCollection.get(i); autoTourAttrib = new ArrayList<AutoTripSegment>(); boolean firstTripOfHH = true; //make a loop that keeps going as long as there are more trips in curHH for (int j = 0; j < curHH.size(); j++) { //get the LTRIPNO from the current trip segment. if it is == 1, the autoTourAttrib arraylist we have been adding to is complete //we might want to change this to be curLtripNo != (prevLtripNo += 1) because as shown in the data, if someone walks to their car //as their first trip of the tour they are on, the first trip of the autotour might not have linked trip no = 1 int curLTripNo = Integer.parseInt(curHH.get(j).getLTRIPNO()); if(curLTripNo == 1 && firstTripOfHH == false) { at = new AutoTour(autoTourAttrib); autoTourCollection.add(at); autoTourAttrib = new ArrayList<AutoTripSegment>(); //add the current trip to the autoTourAttrib arraylist for the tour we are constructing autoTourAttrib.add(curHH.get(j)); } else { autoTourAttrib.add(curHH.get(j)); firstTripOfHH = false; } } //the autoTourAttrib list coming out of the while loop still needs to be made into a tour at = new AutoTour(autoTourAttrib); autoTourCollection.add(at); } System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-1)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-2)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-3)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-4)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-5)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-6)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-7)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-900)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-901)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-902)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-1785)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-1786)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-1788)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-2522)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-2523)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-2524)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-2525)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-20099)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-20100)).toString()); System.out.println(((AutoTour) autoTourCollection.get(autoTourCollection.size()-20101)).toString()); //Display count data before trimming: StaticMethods.displayAutoTourCollectionData(autoTourCollection); //Take out of our collection any tours with bad data (trim the data) StaticMethods.trimAutoTourCollectionData(autoTourCollection); //Display count data after trimming: StaticMethods.displayAutoTourCollectionData(autoTourCollection); //automobileAttrib is the arraylist consisting of auto tours passed to the automobile constructor //every tour in automobileAttrib must have household number the same, as well as vehicle number the same ArrayList <AutoTour> automobileAttrib = new ArrayList<AutoTour> (); // Once all tours from the same hh/using the same vehicle have been added to automobileAttrib, // create the automobile object and add it to the automobile collection // We will be done filling automobile collection when there are no more tours left to make into vehicles ArrayList <Automobile> automobileCollection = new ArrayList<Automobile>(); ArrayList<AutoTour> autoToursByHousehold = new ArrayList <AutoTour> (); for(int i = 0; i < autoTourCollection.size(); i++) { if ((i == autoTourCollection.size() - 1) || !(autoTourCollection.get(i).getTrips().get(0).getSAMPN().equals(autoTourCollection.get(i+1).getTrips().get(0).getSAMPN())) ) { autoToursByHousehold.add(autoTourCollection.get(i)); //The entries will be sorted by vehicle number, so we can just go in order til the next one is not the current one Collections.sort(autoToursByHousehold, new AutoTourComparator()); //get the vehicles out here/now for(int j = 0; j < autoToursByHousehold.size(); j++) { if ((j == autoToursByHousehold.size() - 1) || !(autoToursByHousehold.get(j).getTrips().get(0).getVEHNO().equals(autoToursByHousehold.get(j+1).getTrips().get(0).getVEHNO())) ) { automobileAttrib.add(autoToursByHousehold.get(j)); Automobile newAutomobile = new Automobile(automobileAttrib); automobileCollection.add(newAutomobile); automobileAttrib = new ArrayList<AutoTour> (); } else { automobileAttrib.add(autoToursByHousehold.get(j)); } } //start a new household autoToursByHousehold = new ArrayList <AutoTour>(); } else { //add this trip to the current household autoToursByHousehold.add(autoTourCollection.get(i)); } } System.out.println("There are: " + automobileCollection.size() + " automobiles in the automobileCollection ArrayList."); // Now read in from the vehicle .csv file and count how many vehicles there are such that they are automobiles, and they were used // This number should be very close to the number of automobiles there are in automobileCollection { ArrayList<Vehicle> vehicles = new ArrayList<Vehicle>(); vehicles = CsvFileReader.vehicleCsvFileToArrayList("VEH_Public.csv"); StaticMethods.trimVehicleArrayListToUsedAutomobiles(vehicles); System.out.println("There are " + vehicles.size() + " automobiles that were used in the vehicles.csv file.") ; } System.out.println("\nNo charging throughout day: "); StaticMethods.computeRemainingRangeOfAutomobiles(automobileCollection); System.out.println("If we allow charging during the day at home only, using slow charging (10 hours from no charge to max charge, 1 mile/15 min):"); for(int i = 0; i < automobileCollection.size(); i++) { automobileCollection.get(i).resetAutomobileRange(); } for(int i = 0; i < automobileCollection.size(); i++) { ArrayList<AutoTour> thisAuto = automobileCollection.get(i).getTours(); if (thisAuto.size() > 1) { for(int j = 0; j < thisAuto.size() - 1; j++) { int numTrips = thisAuto.get(j).getTrips().size(); if(thisAuto.get(j).getTrips().get(numTrips - 1).getDHOME().equals("1")) { double actDur = Double.parseDouble(thisAuto.get(j).getTrips().get(numTrips - 1).getACTDUR()); double thisTourMiles = thisAuto.get(j).totalTourMiles(); double increasedRange = Math.min(thisTourMiles, actDur/15); automobileCollection.get(i).setAutomobileRange(automobileCollection.get(i).getAutomobileRange() + increasedRange ); } } } } StaticMethods.computeRemainingRangeOfAutomobiles(automobileCollection); System.out.println("If we allow charging during the day at home only, using fast charging (4 hours from no charge to max charge, 1 mile/6 min):"); for(int i = 0; i < automobileCollection.size(); i++) { automobileCollection.get(i).resetAutomobileRange(); } for(int i = 0; i < automobileCollection.size(); i++) { ArrayList<AutoTour> thisAuto = automobileCollection.get(i).getTours(); if (thisAuto.size() > 1) { for(int j = 0; j < thisAuto.size() - 1; j++) { int numTrips = thisAuto.get(j).getTrips().size(); if(thisAuto.get(j).getTrips().get(numTrips - 1).getDHOME().equals("1")) { double actDur = Double.parseDouble(thisAuto.get(j).getTrips().get(numTrips - 1).getACTDUR()); double thisTourMiles = thisAuto.get(j).totalTourMiles(); double increasedRange = Math.min(thisTourMiles, actDur/6); automobileCollection.get(i).setAutomobileRange(automobileCollection.get(i).getAutomobileRange() + increasedRange ); } } } } StaticMethods.computeRemainingRangeOfAutomobiles(automobileCollection); //If we let cars charge while on a tour when the destination is home, work, , System.out.println("End of testing!!!"); } }
package app0513.paint; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class PhotoShop extends JFrame{ JPanel p_north; JButton bt_eraser; Color[] colorArray= {Color.red,Color.orange,Color.yellow,Color.green,Color.blue,Color.gray,Color.pink}; MyCanvas can; public PhotoShop() { //생성 p_north=new JPanel(); bt_eraser=new JButton("지우기"); can=new MyCanvas(); for(int i=0; i<colorArray.length; i++) { ColorBox colorBox=new ColorBox(colorArray[i]); p_north.add(colorBox); } //스타일 p_north.setPreferredSize(new Dimension(700,50)); //조립 p_north.add(bt_eraser); add(p_north,BorderLayout.NORTH); add(can); //보여주기 setBounds(1000,100,700,600); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(String[] args) { new PhotoShop(); } }
/* * 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 DOMIC; import java.awt.FileDialog; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.MutableTreeNode; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; /** * * @author Сергей */ public class DomicTestCreator extends javax.swing.JFrame { public DefaultListModel listModel = new DefaultListModel(); protected DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(); public DefaultTreeModel treeModel = new DefaultTreeModel(rootNode); public MyCellRenderer renderer = new MyCellRenderer(); public ArrayList<QuestionBlock> questionBlocks = new ArrayList<>(); public String FilePatch; public int QuestionBlockIndex = 1; // public int QuestionIndex=0; public DomicTestCreator() { initComponents(); //this.jTree1.setShowsRootHandles(true); AnswerList.setLayoutOrientation(JList.VERTICAL); AnswerList.setModel(listModel); QuestionTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); // this.editable(false); // Корневой узел rootNode = new DefaultMutableTreeNode("Тест"); for (int i = 1; i < 2; i++) { // Содержимое корневого узла DefaultMutableTreeNode folder = new DefaultMutableTreeNode("Блок вопросов " + i); rootNode.add(folder); // Содержимое папок корневого узла DefaultMutableTreeNode leaf = new DefaultMutableTreeNode("вопрос " + i); leaf.setAllowsChildren(false); folder.add(leaf); } treeModel = new DefaultTreeModel(rootNode, true); QuestionTree.setModel(treeModel); //jLabel4.setText(null); this.questionBlocks.add(new QuestionBlock()); Question question = new Question(null); question.addAnswer(false, null); this.questionBlocks.get(0).questions.add(new Question(null)); } /** * 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() { jMenuItem2 = new javax.swing.JMenuItem(); TestLabel = new javax.swing.JLabel(); HelpLabel = new javax.swing.JLabel(); ButtonSave = new javax.swing.JButton(); QuestionAreaScroll = new javax.swing.JScrollPane(); QuestionArea = new javax.swing.JTextArea(); AnswerListScroll = new javax.swing.JScrollPane(); AnswerList = new javax.swing.JList(); AnswerField = new javax.swing.JTextField(); QuestionTreeScroll = new javax.swing.JScrollPane(); QuestionTree = new javax.swing.JTree(); Footer = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); AddQuestionBlockButton = new javax.swing.JButton(); AddQuestionButton = new javax.swing.JButton(); AddAnswerButton = new javax.swing.JButton(); Menu = new javax.swing.JMenuBar(); MenuFile = new javax.swing.JMenu(); MenuFileOpenFile = new javax.swing.JMenuItem(); TestMenu = new javax.swing.JMenuItem(); jSeparator2 = new javax.swing.JPopupMenu.Separator(); jMenuItem1 = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); jMenuItem2.setText("jMenuItem2"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); TestLabel.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N TestLabel.setText("<html><p align=\"center\">Новый тест</p></html>"); HelpLabel.setText("<html><p align=\"center\">Для создание нового напишите текст его содержания в текстовое поле, выберите необходимое количество правильных вариантов ответа, для перехода к созданию следующего вопроса нажмите \"Далее\", по окончанию работы нажмите \"Готово\"</p> </html>"); HelpLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); ButtonSave.setText("Далее"); ButtonSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ButtonSaveActionPerformed(evt); } }); QuestionArea.setColumns(20); QuestionArea.setRows(5); QuestionAreaScroll.setViewportView(QuestionArea); AnswerList.setCellRenderer(renderer); AnswerList.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { AnswerListKeyReleased(evt); } }); AnswerListScroll.setViewportView(AnswerList); AnswerField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AnswerFieldActionPerformed(evt); } }); AnswerField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { AnswerFieldKeyReleased(evt); } }); javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("Тест"); javax.swing.tree.DefaultMutableTreeNode treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Блок вопросов №1"); javax.swing.tree.DefaultMutableTreeNode treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("Воопрос 1"); treeNode2.add(treeNode3); treeNode1.add(treeNode2); QuestionTree.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1)); QuestionTree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() { public void valueChanged(javax.swing.event.TreeSelectionEvent evt) { QuestionTreeValueChanged(evt); } }); QuestionTree.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { QuestionTreeKeyReleased(evt); } }); QuestionTreeScroll.setViewportView(QuestionTree); javax.swing.GroupLayout FooterLayout = new javax.swing.GroupLayout(Footer); Footer.setLayout(FooterLayout); FooterLayout.setHorizontalGroup( FooterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(FooterLayout.createSequentialGroup() .addContainerGap() .addComponent(jLabel3) .addGap(50, 50, 50) .addComponent(jLabel4) .addGap(50, 50, 50) .addComponent(jLabel5) .addGap(50, 50, 50) .addComponent(jLabel6) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); FooterLayout.setVerticalGroup( FooterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, FooterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)) ); AddQuestionBlockButton.setText("Добавить Блок вопросов"); AddQuestionBlockButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AddQuestionBlockButtonActionPerformed(evt); } }); AddQuestionButton.setText("Добавить вопрос"); AddQuestionButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AddQuestionButtonActionPerformed(evt); } }); AddAnswerButton.setText("Добавить"); AddAnswerButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AddAnswerButtonActionPerformed(evt); } }); MenuFile.setText("Файл"); MenuFileOpenFile.setText("Открыть тест"); MenuFileOpenFile.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { MenuFileOpenFileActionPerformed(evt); } }); MenuFile.add(MenuFileOpenFile); TestMenu.setText("TestButton"); TestMenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { TestMenuActionPerformed(evt); } }); MenuFile.add(TestMenu); MenuFile.add(jSeparator2); jMenuItem1.setText("Сохранить"); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); MenuFile.add(jMenuItem1); Menu.add(MenuFile); jMenu2.setText("Edit"); Menu.add(jMenu2); setJMenuBar(Menu); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(30, 30, 30) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(TestLabel, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(HelpLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 1043, Short.MAX_VALUE)) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(QuestionTreeScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE) .addComponent(AddQuestionBlockButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(AddQuestionButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(15, 15, 15) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(AnswerField, javax.swing.GroupLayout.PREFERRED_SIZE, 617, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(ButtonSave, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(AnswerListScroll, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) .addComponent(QuestionAreaScroll))) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(AddAnswerButton, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addGap(30, 30, 30)) .addComponent(Footer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(TestLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(HelpLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(50, 50, 50) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(QuestionAreaScroll, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(AnswerField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(ButtonSave)) .addComponent(AnswerListScroll, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addComponent(QuestionTreeScroll, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(AddQuestionBlockButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(AddQuestionButton) .addComponent(AddAnswerButton)))) .addGap(20, 20, 20) .addComponent(Footer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void ButtonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonSaveActionPerformed Question question = new Question(QuestionArea.getText()); for (int i = 0; i < listModel.getSize(); i++) { String text = String.valueOf(listModel.getElementAt(i)); boolean correct = AnswerList.isSelectedIndex(i); question.addAnswer(correct, text); } this.questionBlocks.get(QuestionTree.getModel().getIndexOfChild( QuestionTree.getSelectionPath().getParentPath().getParentPath().getLastPathComponent(), QuestionTree.getSelectionPath().getParentPath().getLastPathComponent())) .addQuestion( QuestionTree.getModel().getIndexOfChild( QuestionTree.getSelectionPath().getParentPath().getLastPathComponent(), QuestionTree.getSelectionPath().getLastPathComponent()), question); this.jLabel3.setText("Question save"); }//GEN-LAST:event_ButtonSaveActionPerformed private void AddQuestionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddQuestionButtonActionPerformed DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) QuestionTree.getLastSelectedPathComponent(); if (selectedNode == null) { return; } DefaultMutableTreeNode parent = (DefaultMutableTreeNode) selectedNode; if (parent == null) { return; } if ("Тест".equals(String.valueOf(QuestionTree.getSelectionPath().getLastPathComponent()))) { return; } DefaultMutableTreeNode newNode = new DefaultMutableTreeNode("Вопрос " + (treeModel.getChildCount(QuestionTree.getSelectionPath().getLastPathComponent()) + 1)); newNode.setAllowsChildren(false); int selectedIndex = parent.getIndex(selectedNode); treeModel.insertNodeInto(newNode, parent, selectedIndex + treeModel.getChildCount(parent) + 1); // Отображение нового узла. TreeNode[] nodes = treeModel.getPathToRoot(newNode); TreePath path = new TreePath(nodes); QuestionTree.scrollPathToVisible(path); // try { this.questionBlocks.get( QuestionTree.getModel().getIndexOfChild( QuestionTree.getSelectionPath().getParentPath().getLastPathComponent(), QuestionTree.getSelectionPath().getLastPathComponent() ) ).questions.add(new Question(null)); } catch (NullPointerException e) { System.out.println("null point exeption"); } }//GEN-LAST:event_AddQuestionButtonActionPerformed private void AddQuestionBlockButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddQuestionBlockButtonActionPerformed DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) QuestionTree.getLastSelectedPathComponent(); if (selectedNode == null) { return; } DefaultMutableTreeNode parent = (DefaultMutableTreeNode) selectedNode; if (parent == null) { return; } try { if ("Тест".equals(String.valueOf(QuestionTree.getSelectionPath().getParentPath().getLastPathComponent()))) { return; } } catch (NullPointerException e) { System.out.println(e.getMessage()); } DefaultMutableTreeNode newNode = new DefaultMutableTreeNode("Блок вопросов " + (treeModel.getChildCount(QuestionTree.getSelectionPath().getLastPathComponent()) + 1)); DefaultMutableTreeNode newLeaf = new DefaultMutableTreeNode("Вопрос 1"); newLeaf.setAllowsChildren(false); int selectedIndex = parent.getIndex(selectedNode); treeModel.insertNodeInto(newNode, parent, selectedIndex + treeModel.getChildCount(parent) + 1); treeModel.insertNodeInto(newLeaf, newNode, selectedIndex + 1); // Отображение нового узла. TreeNode[] nodes = treeModel.getPathToRoot(newNode); TreePath path = new TreePath(nodes); QuestionTree.scrollPathToVisible(path); System.out.println(parent); System.out.println(selectedIndex); // try { this.questionBlocks.add(new QuestionBlock()); Question question = new Question(null); question.addAnswer(false, null); this.questionBlocks.get(QuestionBlockIndex).questions.add(question); QuestionBlockIndex++; } catch (NullPointerException e) { System.out.println("null point exeption"); } }//GEN-LAST:event_AddQuestionBlockButtonActionPerformed private void AnswerFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AnswerFieldActionPerformed }//GEN-LAST:event_AnswerFieldActionPerformed private void AddAnswerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddAnswerButtonActionPerformed if (!AnswerField.getText().equals("")) { listModel.addElement(AnswerField.getText()); AnswerField.setText(null); } else { JOptionPane.showMessageDialog(this, "Нельзя добавлять пустой ответ", "Ошибка", JOptionPane.WARNING_MESSAGE); } }//GEN-LAST:event_AddAnswerButtonActionPerformed private void QuestionTreeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_QuestionTreeValueChanged //this.editable(false); try { if ("Тест".equals(String.valueOf(QuestionTree.getSelectionPath().getParentPath().getParentPath().getLastPathComponent()))) { // this.editable(true); } } catch (NullPointerException e) { System.out.println(e.getMessage()); } this.QuestionArea.setText(""); this.listModel.clear(); this.jLabel3.setText(null); try { int QuestionBlockIndex = QuestionTree.getModel().getIndexOfChild( QuestionTree.getSelectionPath().getParentPath().getParentPath().getLastPathComponent(), QuestionTree.getSelectionPath().getParentPath().getLastPathComponent()); int QuestionIndex = QuestionTree.getModel().getIndexOfChild( QuestionTree.getSelectionPath().getParentPath().getLastPathComponent(), QuestionTree.getSelectionPath().getLastPathComponent()); if (this.questionBlocks.get(QuestionBlockIndex).getQuestionName(QuestionIndex) != null) { this.QuestionArea.setText(this.questionBlocks.get(QuestionBlockIndex).getQuestionName(QuestionIndex)); for (int i = 0; this.questionBlocks.get(QuestionBlockIndex).questions.get(QuestionIndex).answers.size() > i; i++) { } for (int i = 0; i < this.questionBlocks.get(QuestionBlockIndex).questions.get(QuestionIndex).answers.size(); i++) { this.listModel.addElement(questionBlocks.get(QuestionBlockIndex).getAnswerText(QuestionIndex, i)); if (questionBlocks.get(QuestionBlockIndex).getAnswerCorrect(QuestionIndex, i) == true) { this.AnswerList.setSelectionInterval(i, 2); } } } } catch (NullPointerException e) { System.out.println("NULL POINT"); } }//GEN-LAST:event_QuestionTreeValueChanged private void MenuFileOpenFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuFileOpenFileActionPerformed this.rootNode.removeAllChildren(); treeModel.reload(); final JFileChooser fileChooser = new JFileChooser(); int returnVal = fileChooser.showOpenDialog(this); this.FilePatch = fileChooser.getSelectedFile().getAbsolutePath(); GeneratePerl gp = new GeneratePerl(); try { gp.GeneratePerl(fileChooser.getSelectedFile()); } catch (IOException ex) { Logger.getLogger(DomicTestCreator.class.getName()).log(Level.SEVERE, null, ex); } EncodeJson ej = new EncodeJson(String.valueOf(gp.getJson())); this.questionBlocks = ej.questionBlocks; // Корневой узел rootNode = new DefaultMutableTreeNode("Тест"); for (int i = 0; i < this.questionBlocks.size(); i++) { // Содержимое корневого узла DefaultMutableTreeNode folder = new DefaultMutableTreeNode("Блок вопросов " + (i + 1)); rootNode.add(folder); for (int j = 0; j < this.questionBlocks.get(i).questions.size(); j++) { // Содержимое папок корневого узла DefaultMutableTreeNode leaf = new DefaultMutableTreeNode("вопрос " + (j + 1)); leaf.setAllowsChildren(false); folder.add(leaf); } } treeModel = new DefaultTreeModel(rootNode, true); QuestionTree.setModel(treeModel); }//GEN-LAST:event_MenuFileOpenFileActionPerformed private void TestMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TestMenuActionPerformed Object parent = QuestionTree.getSelectionPath().getParentPath().getParentPath().getLastPathComponent(); Object child = QuestionTree.getSelectionPath().getParentPath().getLastPathComponent(); //DecodePerl gP = new DecodePerl(this.questionBlocks); //System.out.println(child); //System.out.println(parent); System.out.println(QuestionTree.getModel().getIndexOfChild(parent, child)); //System.out.println(treeModel.getChildCount(parent)); // количество элементов в выбранном узле //System.out.println(jTree1.getSelectionPath().getLastPathComponent());// последний выбранный компонент //System.out.println(jTree1.getSelectionPath().getParentPath().getLastPathComponent());//родитель выбранного компонента //System.out.println(jTree1.getSelectionPath());// массив пути выбранного компонента //System.out.println(jTree1.getLeadSelectionRow()); //System.out.println(jTree1.getSelectionPath().getParentPath().getParentPath().getLastPathComponent());//родитель выбранного компонента //Answer answer = new Answer("test",true); //System.out.println(answer.getAnswerText()); //Question question = new Question("Test questions"); //question.addAnswer(true, "test answer"); //System.out.println(question.getAnswerText(0)); //System.out.println(questionBlocks.get(0).getAnswerText(0, 0)); }//GEN-LAST:event_TestMenuActionPerformed private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed DecodePerl decodePerl = new DecodePerl(this.questionBlocks); System.out.println(decodePerl.getPrint()); FileDialog fDialog = new FileDialog(this, "Save as...", FileDialog.SAVE); fDialog.setVisible(true); String path = fDialog.getDirectory() + fDialog.getFile(); File f = new File(path); try { f.createNewFile(); FileWriter fw = new FileWriter(f.getAbsolutePath()); fw.write(decodePerl.getPrint().toString()); fw.close(); jLabel4.setText("Test is saved"); } catch (IOException ex) { jLabel4.setText("Test is not saved"); } if (fDialog.getFile() == null) { jLabel4.setText("Test is not saved"); } }//GEN-LAST:event_jMenuItem1ActionPerformed private void QuestionTreeKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_QuestionTreeKeyReleased if (evt.getKeyText(evt.getKeyCode()) == "Delete") { TreePath currentSelection = QuestionTree.getSelectionPath(); if (currentSelection != null) { DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) (currentSelection .getLastPathComponent()); MutableTreeNode parent = (MutableTreeNode) (currentNode.getParent()); if (parent != null) { treeModel.removeNodeFromParent(currentNode); return; } } } }//GEN-LAST:event_QuestionTreeKeyReleased private void AnswerListKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_AnswerListKeyReleased if (evt.getKeyText(evt.getKeyCode()) == "Delete") { listModel.remove(AnswerList.getSelectedIndex()); } if (evt.getKeyText(evt.getKeyCode()) == "Enter") { Question question = new Question(QuestionArea.getText()); for (int i = 0; i < listModel.getSize(); i++) { String text = String.valueOf(listModel.getElementAt(i)); boolean correct = AnswerList.isSelectedIndex(i); question.addAnswer(correct, text); } this.questionBlocks.get(QuestionTree.getModel().getIndexOfChild( QuestionTree.getSelectionPath().getParentPath().getParentPath().getLastPathComponent(), QuestionTree.getSelectionPath().getParentPath().getLastPathComponent())) .addQuestion( QuestionTree.getModel().getIndexOfChild( QuestionTree.getSelectionPath().getParentPath().getLastPathComponent(), QuestionTree.getSelectionPath().getLastPathComponent()), question); this.jLabel3.setText("save"); } }//GEN-LAST:event_AnswerListKeyReleased private void AnswerFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_AnswerFieldKeyReleased if (evt.getKeyText(evt.getKeyCode()) == "Enter") { if (!AnswerField.getText().equals("")) { listModel.addElement(AnswerField.getText()); AnswerField.setText(null); } else { JOptionPane.showMessageDialog(this, "Нельзя добавлять пустой ответ", "Ошибка", JOptionPane.WARNING_MESSAGE); } } }//GEN-LAST:event_AnswerFieldKeyReleased public static void main(String args[]) { } public void editable(boolean val) { this.AddAnswerButton.setEnabled(val); this.ButtonSave.setEnabled(val); this.AddQuestionBlockButton.setEnabled(val); this.AddQuestionButton.setEnabled(val); this.QuestionArea.setEnabled(val); this.AnswerField.setEnabled(val); this.AnswerList.setEnabled(val); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton AddAnswerButton; private javax.swing.JButton AddQuestionBlockButton; private javax.swing.JButton AddQuestionButton; private javax.swing.JTextField AnswerField; private javax.swing.JList AnswerList; private javax.swing.JScrollPane AnswerListScroll; private javax.swing.JButton ButtonSave; private javax.swing.JPanel Footer; private javax.swing.JLabel HelpLabel; private javax.swing.JMenuBar Menu; private javax.swing.JMenu MenuFile; private javax.swing.JMenuItem MenuFileOpenFile; private javax.swing.JTextArea QuestionArea; private javax.swing.JScrollPane QuestionAreaScroll; private javax.swing.JTree QuestionTree; private javax.swing.JScrollPane QuestionTreeScroll; private javax.swing.JLabel TestLabel; private javax.swing.JMenuItem TestMenu; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JMenu jMenu2; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jMenuItem2; private javax.swing.JPopupMenu.Separator jSeparator2; // End of variables declaration//GEN-END:variables }
package com.ybh.front.model; import java.util.ArrayList; import java.util.List; public class OtherProductlistExample { /** * This field was generated by MyBatis Generator. * This field corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ protected String orderByClause; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ protected boolean distinct; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ protected List<Criteria> oredCriteria; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public OtherProductlistExample() { oredCriteria = new ArrayList<Criteria>(); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public String getOrderByClause() { return orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public void setDistinct(boolean distinct) { this.distinct = distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public boolean isDistinct() { return distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public List<Criteria> getOredCriteria() { return oredCriteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public void or(Criteria criteria) { oredCriteria.add(criteria); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Integer value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Integer value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Integer value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Integer value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Integer value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Integer value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Integer> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Integer> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Integer value1, Integer value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Integer value1, Integer value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andOthertypeIsNull() { addCriterion("Othertype is null"); return (Criteria) this; } public Criteria andOthertypeIsNotNull() { addCriterion("Othertype is not null"); return (Criteria) this; } public Criteria andOthertypeEqualTo(String value) { addCriterion("Othertype =", value, "othertype"); return (Criteria) this; } public Criteria andOthertypeNotEqualTo(String value) { addCriterion("Othertype <>", value, "othertype"); return (Criteria) this; } public Criteria andOthertypeGreaterThan(String value) { addCriterion("Othertype >", value, "othertype"); return (Criteria) this; } public Criteria andOthertypeGreaterThanOrEqualTo(String value) { addCriterion("Othertype >=", value, "othertype"); return (Criteria) this; } public Criteria andOthertypeLessThan(String value) { addCriterion("Othertype <", value, "othertype"); return (Criteria) this; } public Criteria andOthertypeLessThanOrEqualTo(String value) { addCriterion("Othertype <=", value, "othertype"); return (Criteria) this; } public Criteria andOthertypeLike(String value) { addCriterion("Othertype like", value, "othertype"); return (Criteria) this; } public Criteria andOthertypeNotLike(String value) { addCriterion("Othertype not like", value, "othertype"); return (Criteria) this; } public Criteria andOthertypeIn(List<String> values) { addCriterion("Othertype in", values, "othertype"); return (Criteria) this; } public Criteria andOthertypeNotIn(List<String> values) { addCriterion("Othertype not in", values, "othertype"); return (Criteria) this; } public Criteria andOthertypeBetween(String value1, String value2) { addCriterion("Othertype between", value1, value2, "othertype"); return (Criteria) this; } public Criteria andOthertypeNotBetween(String value1, String value2) { addCriterion("Othertype not between", value1, value2, "othertype"); return (Criteria) this; } public Criteria andOthercountIsNull() { addCriterion("Othercount is null"); return (Criteria) this; } public Criteria andOthercountIsNotNull() { addCriterion("Othercount is not null"); return (Criteria) this; } public Criteria andOthercountEqualTo(Integer value) { addCriterion("Othercount =", value, "othercount"); return (Criteria) this; } public Criteria andOthercountNotEqualTo(Integer value) { addCriterion("Othercount <>", value, "othercount"); return (Criteria) this; } public Criteria andOthercountGreaterThan(Integer value) { addCriterion("Othercount >", value, "othercount"); return (Criteria) this; } public Criteria andOthercountGreaterThanOrEqualTo(Integer value) { addCriterion("Othercount >=", value, "othercount"); return (Criteria) this; } public Criteria andOthercountLessThan(Integer value) { addCriterion("Othercount <", value, "othercount"); return (Criteria) this; } public Criteria andOthercountLessThanOrEqualTo(Integer value) { addCriterion("Othercount <=", value, "othercount"); return (Criteria) this; } public Criteria andOthercountIn(List<Integer> values) { addCriterion("Othercount in", values, "othercount"); return (Criteria) this; } public Criteria andOthercountNotIn(List<Integer> values) { addCriterion("Othercount not in", values, "othercount"); return (Criteria) this; } public Criteria andOthercountBetween(Integer value1, Integer value2) { addCriterion("Othercount between", value1, value2, "othercount"); return (Criteria) this; } public Criteria andOthercountNotBetween(Integer value1, Integer value2) { addCriterion("Othercount not between", value1, value2, "othercount"); return (Criteria) this; } public Criteria andUsermoneyIsNull() { addCriterion("usermoney is null"); return (Criteria) this; } public Criteria andUsermoneyIsNotNull() { addCriterion("usermoney is not null"); return (Criteria) this; } public Criteria andUsermoneyEqualTo(Double value) { addCriterion("usermoney =", value, "usermoney"); return (Criteria) this; } public Criteria andUsermoneyNotEqualTo(Double value) { addCriterion("usermoney <>", value, "usermoney"); return (Criteria) this; } public Criteria andUsermoneyGreaterThan(Double value) { addCriterion("usermoney >", value, "usermoney"); return (Criteria) this; } public Criteria andUsermoneyGreaterThanOrEqualTo(Double value) { addCriterion("usermoney >=", value, "usermoney"); return (Criteria) this; } public Criteria andUsermoneyLessThan(Double value) { addCriterion("usermoney <", value, "usermoney"); return (Criteria) this; } public Criteria andUsermoneyLessThanOrEqualTo(Double value) { addCriterion("usermoney <=", value, "usermoney"); return (Criteria) this; } public Criteria andUsermoneyIn(List<Double> values) { addCriterion("usermoney in", values, "usermoney"); return (Criteria) this; } public Criteria andUsermoneyNotIn(List<Double> values) { addCriterion("usermoney not in", values, "usermoney"); return (Criteria) this; } public Criteria andUsermoneyBetween(Double value1, Double value2) { addCriterion("usermoney between", value1, value2, "usermoney"); return (Criteria) this; } public Criteria andUsermoneyNotBetween(Double value1, Double value2) { addCriterion("usermoney not between", value1, value2, "usermoney"); return (Criteria) this; } public Criteria andMaxsendIsNull() { addCriterion("maxsend is null"); return (Criteria) this; } public Criteria andMaxsendIsNotNull() { addCriterion("maxsend is not null"); return (Criteria) this; } public Criteria andMaxsendEqualTo(Integer value) { addCriterion("maxsend =", value, "maxsend"); return (Criteria) this; } public Criteria andMaxsendNotEqualTo(Integer value) { addCriterion("maxsend <>", value, "maxsend"); return (Criteria) this; } public Criteria andMaxsendGreaterThan(Integer value) { addCriterion("maxsend >", value, "maxsend"); return (Criteria) this; } public Criteria andMaxsendGreaterThanOrEqualTo(Integer value) { addCriterion("maxsend >=", value, "maxsend"); return (Criteria) this; } public Criteria andMaxsendLessThan(Integer value) { addCriterion("maxsend <", value, "maxsend"); return (Criteria) this; } public Criteria andMaxsendLessThanOrEqualTo(Integer value) { addCriterion("maxsend <=", value, "maxsend"); return (Criteria) this; } public Criteria andMaxsendIn(List<Integer> values) { addCriterion("maxsend in", values, "maxsend"); return (Criteria) this; } public Criteria andMaxsendNotIn(List<Integer> values) { addCriterion("maxsend not in", values, "maxsend"); return (Criteria) this; } public Criteria andMaxsendBetween(Integer value1, Integer value2) { addCriterion("maxsend between", value1, value2, "maxsend"); return (Criteria) this; } public Criteria andMaxsendNotBetween(Integer value1, Integer value2) { addCriterion("maxsend not between", value1, value2, "maxsend"); return (Criteria) this; } public Criteria andUserspacelimtIsNull() { addCriterion("userspacelimt is null"); return (Criteria) this; } public Criteria andUserspacelimtIsNotNull() { addCriterion("userspacelimt is not null"); return (Criteria) this; } public Criteria andUserspacelimtEqualTo(Integer value) { addCriterion("userspacelimt =", value, "userspacelimt"); return (Criteria) this; } public Criteria andUserspacelimtNotEqualTo(Integer value) { addCriterion("userspacelimt <>", value, "userspacelimt"); return (Criteria) this; } public Criteria andUserspacelimtGreaterThan(Integer value) { addCriterion("userspacelimt >", value, "userspacelimt"); return (Criteria) this; } public Criteria andUserspacelimtGreaterThanOrEqualTo(Integer value) { addCriterion("userspacelimt >=", value, "userspacelimt"); return (Criteria) this; } public Criteria andUserspacelimtLessThan(Integer value) { addCriterion("userspacelimt <", value, "userspacelimt"); return (Criteria) this; } public Criteria andUserspacelimtLessThanOrEqualTo(Integer value) { addCriterion("userspacelimt <=", value, "userspacelimt"); return (Criteria) this; } public Criteria andUserspacelimtIn(List<Integer> values) { addCriterion("userspacelimt in", values, "userspacelimt"); return (Criteria) this; } public Criteria andUserspacelimtNotIn(List<Integer> values) { addCriterion("userspacelimt not in", values, "userspacelimt"); return (Criteria) this; } public Criteria andUserspacelimtBetween(Integer value1, Integer value2) { addCriterion("userspacelimt between", value1, value2, "userspacelimt"); return (Criteria) this; } public Criteria andUserspacelimtNotBetween(Integer value1, Integer value2) { addCriterion("userspacelimt not between", value1, value2, "userspacelimt"); return (Criteria) this; } public Criteria andDomainspacelimtIsNull() { addCriterion("domainspacelimt is null"); return (Criteria) this; } public Criteria andDomainspacelimtIsNotNull() { addCriterion("domainspacelimt is not null"); return (Criteria) this; } public Criteria andDomainspacelimtEqualTo(Integer value) { addCriterion("domainspacelimt =", value, "domainspacelimt"); return (Criteria) this; } public Criteria andDomainspacelimtNotEqualTo(Integer value) { addCriterion("domainspacelimt <>", value, "domainspacelimt"); return (Criteria) this; } public Criteria andDomainspacelimtGreaterThan(Integer value) { addCriterion("domainspacelimt >", value, "domainspacelimt"); return (Criteria) this; } public Criteria andDomainspacelimtGreaterThanOrEqualTo(Integer value) { addCriterion("domainspacelimt >=", value, "domainspacelimt"); return (Criteria) this; } public Criteria andDomainspacelimtLessThan(Integer value) { addCriterion("domainspacelimt <", value, "domainspacelimt"); return (Criteria) this; } public Criteria andDomainspacelimtLessThanOrEqualTo(Integer value) { addCriterion("domainspacelimt <=", value, "domainspacelimt"); return (Criteria) this; } public Criteria andDomainspacelimtIn(List<Integer> values) { addCriterion("domainspacelimt in", values, "domainspacelimt"); return (Criteria) this; } public Criteria andDomainspacelimtNotIn(List<Integer> values) { addCriterion("domainspacelimt not in", values, "domainspacelimt"); return (Criteria) this; } public Criteria andDomainspacelimtBetween(Integer value1, Integer value2) { addCriterion("domainspacelimt between", value1, value2, "domainspacelimt"); return (Criteria) this; } public Criteria andDomainspacelimtNotBetween(Integer value1, Integer value2) { addCriterion("domainspacelimt not between", value1, value2, "domainspacelimt"); return (Criteria) this; } public Criteria andServerlistidIsNull() { addCriterion("ServerlistID is null"); return (Criteria) this; } public Criteria andServerlistidIsNotNull() { addCriterion("ServerlistID is not null"); return (Criteria) this; } public Criteria andServerlistidEqualTo(Integer value) { addCriterion("ServerlistID =", value, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidNotEqualTo(Integer value) { addCriterion("ServerlistID <>", value, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidGreaterThan(Integer value) { addCriterion("ServerlistID >", value, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidGreaterThanOrEqualTo(Integer value) { addCriterion("ServerlistID >=", value, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidLessThan(Integer value) { addCriterion("ServerlistID <", value, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidLessThanOrEqualTo(Integer value) { addCriterion("ServerlistID <=", value, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidIn(List<Integer> values) { addCriterion("ServerlistID in", values, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidNotIn(List<Integer> values) { addCriterion("ServerlistID not in", values, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidBetween(Integer value1, Integer value2) { addCriterion("ServerlistID between", value1, value2, "serverlistid"); return (Criteria) this; } public Criteria andServerlistidNotBetween(Integer value1, Integer value2) { addCriterion("ServerlistID not between", value1, value2, "serverlistid"); return (Criteria) this; } public Criteria andIsbyhostIsNull() { addCriterion("isbyhost is null"); return (Criteria) this; } public Criteria andIsbyhostIsNotNull() { addCriterion("isbyhost is not null"); return (Criteria) this; } public Criteria andIsbyhostEqualTo(String value) { addCriterion("isbyhost =", value, "isbyhost"); return (Criteria) this; } public Criteria andIsbyhostNotEqualTo(String value) { addCriterion("isbyhost <>", value, "isbyhost"); return (Criteria) this; } public Criteria andIsbyhostGreaterThan(String value) { addCriterion("isbyhost >", value, "isbyhost"); return (Criteria) this; } public Criteria andIsbyhostGreaterThanOrEqualTo(String value) { addCriterion("isbyhost >=", value, "isbyhost"); return (Criteria) this; } public Criteria andIsbyhostLessThan(String value) { addCriterion("isbyhost <", value, "isbyhost"); return (Criteria) this; } public Criteria andIsbyhostLessThanOrEqualTo(String value) { addCriterion("isbyhost <=", value, "isbyhost"); return (Criteria) this; } public Criteria andIsbyhostLike(String value) { addCriterion("isbyhost like", value, "isbyhost"); return (Criteria) this; } public Criteria andIsbyhostNotLike(String value) { addCriterion("isbyhost not like", value, "isbyhost"); return (Criteria) this; } public Criteria andIsbyhostIn(List<String> values) { addCriterion("isbyhost in", values, "isbyhost"); return (Criteria) this; } public Criteria andIsbyhostNotIn(List<String> values) { addCriterion("isbyhost not in", values, "isbyhost"); return (Criteria) this; } public Criteria andIsbyhostBetween(String value1, String value2) { addCriterion("isbyhost between", value1, value2, "isbyhost"); return (Criteria) this; } public Criteria andIsbyhostNotBetween(String value1, String value2) { addCriterion("isbyhost not between", value1, value2, "isbyhost"); return (Criteria) this; } public Criteria andHosttypeIsNull() { addCriterion("Hosttype is null"); return (Criteria) this; } public Criteria andHosttypeIsNotNull() { addCriterion("Hosttype is not null"); return (Criteria) this; } public Criteria andHosttypeEqualTo(String value) { addCriterion("Hosttype =", value, "hosttype"); return (Criteria) this; } public Criteria andHosttypeNotEqualTo(String value) { addCriterion("Hosttype <>", value, "hosttype"); return (Criteria) this; } public Criteria andHosttypeGreaterThan(String value) { addCriterion("Hosttype >", value, "hosttype"); return (Criteria) this; } public Criteria andHosttypeGreaterThanOrEqualTo(String value) { addCriterion("Hosttype >=", value, "hosttype"); return (Criteria) this; } public Criteria andHosttypeLessThan(String value) { addCriterion("Hosttype <", value, "hosttype"); return (Criteria) this; } public Criteria andHosttypeLessThanOrEqualTo(String value) { addCriterion("Hosttype <=", value, "hosttype"); return (Criteria) this; } public Criteria andHosttypeLike(String value) { addCriterion("Hosttype like", value, "hosttype"); return (Criteria) this; } public Criteria andHosttypeNotLike(String value) { addCriterion("Hosttype not like", value, "hosttype"); return (Criteria) this; } public Criteria andHosttypeIn(List<String> values) { addCriterion("Hosttype in", values, "hosttype"); return (Criteria) this; } public Criteria andHosttypeNotIn(List<String> values) { addCriterion("Hosttype not in", values, "hosttype"); return (Criteria) this; } public Criteria andHosttypeBetween(String value1, String value2) { addCriterion("Hosttype between", value1, value2, "hosttype"); return (Criteria) this; } public Criteria andHosttypeNotBetween(String value1, String value2) { addCriterion("Hosttype not between", value1, value2, "hosttype"); return (Criteria) this; } public Criteria andCantestIsNull() { addCriterion("cantest is null"); return (Criteria) this; } public Criteria andCantestIsNotNull() { addCriterion("cantest is not null"); return (Criteria) this; } public Criteria andCantestEqualTo(String value) { addCriterion("cantest =", value, "cantest"); return (Criteria) this; } public Criteria andCantestNotEqualTo(String value) { addCriterion("cantest <>", value, "cantest"); return (Criteria) this; } public Criteria andCantestGreaterThan(String value) { addCriterion("cantest >", value, "cantest"); return (Criteria) this; } public Criteria andCantestGreaterThanOrEqualTo(String value) { addCriterion("cantest >=", value, "cantest"); return (Criteria) this; } public Criteria andCantestLessThan(String value) { addCriterion("cantest <", value, "cantest"); return (Criteria) this; } public Criteria andCantestLessThanOrEqualTo(String value) { addCriterion("cantest <=", value, "cantest"); return (Criteria) this; } public Criteria andCantestLike(String value) { addCriterion("cantest like", value, "cantest"); return (Criteria) this; } public Criteria andCantestNotLike(String value) { addCriterion("cantest not like", value, "cantest"); return (Criteria) this; } public Criteria andCantestIn(List<String> values) { addCriterion("cantest in", values, "cantest"); return (Criteria) this; } public Criteria andCantestNotIn(List<String> values) { addCriterion("cantest not in", values, "cantest"); return (Criteria) this; } public Criteria andCantestBetween(String value1, String value2) { addCriterion("cantest between", value1, value2, "cantest"); return (Criteria) this; } public Criteria andCantestNotBetween(String value1, String value2) { addCriterion("cantest not between", value1, value2, "cantest"); return (Criteria) this; } public Criteria andCanmonthIsNull() { addCriterion("canmonth is null"); return (Criteria) this; } public Criteria andCanmonthIsNotNull() { addCriterion("canmonth is not null"); return (Criteria) this; } public Criteria andCanmonthEqualTo(String value) { addCriterion("canmonth =", value, "canmonth"); return (Criteria) this; } public Criteria andCanmonthNotEqualTo(String value) { addCriterion("canmonth <>", value, "canmonth"); return (Criteria) this; } public Criteria andCanmonthGreaterThan(String value) { addCriterion("canmonth >", value, "canmonth"); return (Criteria) this; } public Criteria andCanmonthGreaterThanOrEqualTo(String value) { addCriterion("canmonth >=", value, "canmonth"); return (Criteria) this; } public Criteria andCanmonthLessThan(String value) { addCriterion("canmonth <", value, "canmonth"); return (Criteria) this; } public Criteria andCanmonthLessThanOrEqualTo(String value) { addCriterion("canmonth <=", value, "canmonth"); return (Criteria) this; } public Criteria andCanmonthLike(String value) { addCriterion("canmonth like", value, "canmonth"); return (Criteria) this; } public Criteria andCanmonthNotLike(String value) { addCriterion("canmonth not like", value, "canmonth"); return (Criteria) this; } public Criteria andCanmonthIn(List<String> values) { addCriterion("canmonth in", values, "canmonth"); return (Criteria) this; } public Criteria andCanmonthNotIn(List<String> values) { addCriterion("canmonth not in", values, "canmonth"); return (Criteria) this; } public Criteria andCanmonthBetween(String value1, String value2) { addCriterion("canmonth between", value1, value2, "canmonth"); return (Criteria) this; } public Criteria andCanmonthNotBetween(String value1, String value2) { addCriterion("canmonth not between", value1, value2, "canmonth"); return (Criteria) this; } public Criteria andCanhalfyearIsNull() { addCriterion("canhalfyear is null"); return (Criteria) this; } public Criteria andCanhalfyearIsNotNull() { addCriterion("canhalfyear is not null"); return (Criteria) this; } public Criteria andCanhalfyearEqualTo(String value) { addCriterion("canhalfyear =", value, "canhalfyear"); return (Criteria) this; } public Criteria andCanhalfyearNotEqualTo(String value) { addCriterion("canhalfyear <>", value, "canhalfyear"); return (Criteria) this; } public Criteria andCanhalfyearGreaterThan(String value) { addCriterion("canhalfyear >", value, "canhalfyear"); return (Criteria) this; } public Criteria andCanhalfyearGreaterThanOrEqualTo(String value) { addCriterion("canhalfyear >=", value, "canhalfyear"); return (Criteria) this; } public Criteria andCanhalfyearLessThan(String value) { addCriterion("canhalfyear <", value, "canhalfyear"); return (Criteria) this; } public Criteria andCanhalfyearLessThanOrEqualTo(String value) { addCriterion("canhalfyear <=", value, "canhalfyear"); return (Criteria) this; } public Criteria andCanhalfyearLike(String value) { addCriterion("canhalfyear like", value, "canhalfyear"); return (Criteria) this; } public Criteria andCanhalfyearNotLike(String value) { addCriterion("canhalfyear not like", value, "canhalfyear"); return (Criteria) this; } public Criteria andCanhalfyearIn(List<String> values) { addCriterion("canhalfyear in", values, "canhalfyear"); return (Criteria) this; } public Criteria andCanhalfyearNotIn(List<String> values) { addCriterion("canhalfyear not in", values, "canhalfyear"); return (Criteria) this; } public Criteria andCanhalfyearBetween(String value1, String value2) { addCriterion("canhalfyear between", value1, value2, "canhalfyear"); return (Criteria) this; } public Criteria andCanhalfyearNotBetween(String value1, String value2) { addCriterion("canhalfyear not between", value1, value2, "canhalfyear"); return (Criteria) this; } public Criteria andDomainmustsameIsNull() { addCriterion("domainmustsame is null"); return (Criteria) this; } public Criteria andDomainmustsameIsNotNull() { addCriterion("domainmustsame is not null"); return (Criteria) this; } public Criteria andDomainmustsameEqualTo(String value) { addCriterion("domainmustsame =", value, "domainmustsame"); return (Criteria) this; } public Criteria andDomainmustsameNotEqualTo(String value) { addCriterion("domainmustsame <>", value, "domainmustsame"); return (Criteria) this; } public Criteria andDomainmustsameGreaterThan(String value) { addCriterion("domainmustsame >", value, "domainmustsame"); return (Criteria) this; } public Criteria andDomainmustsameGreaterThanOrEqualTo(String value) { addCriterion("domainmustsame >=", value, "domainmustsame"); return (Criteria) this; } public Criteria andDomainmustsameLessThan(String value) { addCriterion("domainmustsame <", value, "domainmustsame"); return (Criteria) this; } public Criteria andDomainmustsameLessThanOrEqualTo(String value) { addCriterion("domainmustsame <=", value, "domainmustsame"); return (Criteria) this; } public Criteria andDomainmustsameLike(String value) { addCriterion("domainmustsame like", value, "domainmustsame"); return (Criteria) this; } public Criteria andDomainmustsameNotLike(String value) { addCriterion("domainmustsame not like", value, "domainmustsame"); return (Criteria) this; } public Criteria andDomainmustsameIn(List<String> values) { addCriterion("domainmustsame in", values, "domainmustsame"); return (Criteria) this; } public Criteria andDomainmustsameNotIn(List<String> values) { addCriterion("domainmustsame not in", values, "domainmustsame"); return (Criteria) this; } public Criteria andDomainmustsameBetween(String value1, String value2) { addCriterion("domainmustsame between", value1, value2, "domainmustsame"); return (Criteria) this; } public Criteria andDomainmustsameNotBetween(String value1, String value2) { addCriterion("domainmustsame not between", value1, value2, "domainmustsame"); return (Criteria) this; } public Criteria andEmailstatusIsNull() { addCriterion("emailstatus is null"); return (Criteria) this; } public Criteria andEmailstatusIsNotNull() { addCriterion("emailstatus is not null"); return (Criteria) this; } public Criteria andEmailstatusEqualTo(String value) { addCriterion("emailstatus =", value, "emailstatus"); return (Criteria) this; } public Criteria andEmailstatusNotEqualTo(String value) { addCriterion("emailstatus <>", value, "emailstatus"); return (Criteria) this; } public Criteria andEmailstatusGreaterThan(String value) { addCriterion("emailstatus >", value, "emailstatus"); return (Criteria) this; } public Criteria andEmailstatusGreaterThanOrEqualTo(String value) { addCriterion("emailstatus >=", value, "emailstatus"); return (Criteria) this; } public Criteria andEmailstatusLessThan(String value) { addCriterion("emailstatus <", value, "emailstatus"); return (Criteria) this; } public Criteria andEmailstatusLessThanOrEqualTo(String value) { addCriterion("emailstatus <=", value, "emailstatus"); return (Criteria) this; } public Criteria andEmailstatusLike(String value) { addCriterion("emailstatus like", value, "emailstatus"); return (Criteria) this; } public Criteria andEmailstatusNotLike(String value) { addCriterion("emailstatus not like", value, "emailstatus"); return (Criteria) this; } public Criteria andEmailstatusIn(List<String> values) { addCriterion("emailstatus in", values, "emailstatus"); return (Criteria) this; } public Criteria andEmailstatusNotIn(List<String> values) { addCriterion("emailstatus not in", values, "emailstatus"); return (Criteria) this; } public Criteria andEmailstatusBetween(String value1, String value2) { addCriterion("emailstatus between", value1, value2, "emailstatus"); return (Criteria) this; } public Criteria andEmailstatusNotBetween(String value1, String value2) { addCriterion("emailstatus not between", value1, value2, "emailstatus"); return (Criteria) this; } public Criteria andAgent1IsNull() { addCriterion("agent1 is null"); return (Criteria) this; } public Criteria andAgent1IsNotNull() { addCriterion("agent1 is not null"); return (Criteria) this; } public Criteria andAgent1EqualTo(String value) { addCriterion("agent1 =", value, "agent1"); return (Criteria) this; } public Criteria andAgent1NotEqualTo(String value) { addCriterion("agent1 <>", value, "agent1"); return (Criteria) this; } public Criteria andAgent1GreaterThan(String value) { addCriterion("agent1 >", value, "agent1"); return (Criteria) this; } public Criteria andAgent1GreaterThanOrEqualTo(String value) { addCriterion("agent1 >=", value, "agent1"); return (Criteria) this; } public Criteria andAgent1LessThan(String value) { addCriterion("agent1 <", value, "agent1"); return (Criteria) this; } public Criteria andAgent1LessThanOrEqualTo(String value) { addCriterion("agent1 <=", value, "agent1"); return (Criteria) this; } public Criteria andAgent1Like(String value) { addCriterion("agent1 like", value, "agent1"); return (Criteria) this; } public Criteria andAgent1NotLike(String value) { addCriterion("agent1 not like", value, "agent1"); return (Criteria) this; } public Criteria andAgent1In(List<String> values) { addCriterion("agent1 in", values, "agent1"); return (Criteria) this; } public Criteria andAgent1NotIn(List<String> values) { addCriterion("agent1 not in", values, "agent1"); return (Criteria) this; } public Criteria andAgent1Between(String value1, String value2) { addCriterion("agent1 between", value1, value2, "agent1"); return (Criteria) this; } public Criteria andAgent1NotBetween(String value1, String value2) { addCriterion("agent1 not between", value1, value2, "agent1"); return (Criteria) this; } public Criteria andAgent2IsNull() { addCriterion("agent2 is null"); return (Criteria) this; } public Criteria andAgent2IsNotNull() { addCriterion("agent2 is not null"); return (Criteria) this; } public Criteria andAgent2EqualTo(String value) { addCriterion("agent2 =", value, "agent2"); return (Criteria) this; } public Criteria andAgent2NotEqualTo(String value) { addCriterion("agent2 <>", value, "agent2"); return (Criteria) this; } public Criteria andAgent2GreaterThan(String value) { addCriterion("agent2 >", value, "agent2"); return (Criteria) this; } public Criteria andAgent2GreaterThanOrEqualTo(String value) { addCriterion("agent2 >=", value, "agent2"); return (Criteria) this; } public Criteria andAgent2LessThan(String value) { addCriterion("agent2 <", value, "agent2"); return (Criteria) this; } public Criteria andAgent2LessThanOrEqualTo(String value) { addCriterion("agent2 <=", value, "agent2"); return (Criteria) this; } public Criteria andAgent2Like(String value) { addCriterion("agent2 like", value, "agent2"); return (Criteria) this; } public Criteria andAgent2NotLike(String value) { addCriterion("agent2 not like", value, "agent2"); return (Criteria) this; } public Criteria andAgent2In(List<String> values) { addCriterion("agent2 in", values, "agent2"); return (Criteria) this; } public Criteria andAgent2NotIn(List<String> values) { addCriterion("agent2 not in", values, "agent2"); return (Criteria) this; } public Criteria andAgent2Between(String value1, String value2) { addCriterion("agent2 between", value1, value2, "agent2"); return (Criteria) this; } public Criteria andAgent2NotBetween(String value1, String value2) { addCriterion("agent2 not between", value1, value2, "agent2"); return (Criteria) this; } public Criteria andCanbyenduserIsNull() { addCriterion("canbyenduser is null"); return (Criteria) this; } public Criteria andCanbyenduserIsNotNull() { addCriterion("canbyenduser is not null"); return (Criteria) this; } public Criteria andCanbyenduserEqualTo(String value) { addCriterion("canbyenduser =", value, "canbyenduser"); return (Criteria) this; } public Criteria andCanbyenduserNotEqualTo(String value) { addCriterion("canbyenduser <>", value, "canbyenduser"); return (Criteria) this; } public Criteria andCanbyenduserGreaterThan(String value) { addCriterion("canbyenduser >", value, "canbyenduser"); return (Criteria) this; } public Criteria andCanbyenduserGreaterThanOrEqualTo(String value) { addCriterion("canbyenduser >=", value, "canbyenduser"); return (Criteria) this; } public Criteria andCanbyenduserLessThan(String value) { addCriterion("canbyenduser <", value, "canbyenduser"); return (Criteria) this; } public Criteria andCanbyenduserLessThanOrEqualTo(String value) { addCriterion("canbyenduser <=", value, "canbyenduser"); return (Criteria) this; } public Criteria andCanbyenduserLike(String value) { addCriterion("canbyenduser like", value, "canbyenduser"); return (Criteria) this; } public Criteria andCanbyenduserNotLike(String value) { addCriterion("canbyenduser not like", value, "canbyenduser"); return (Criteria) this; } public Criteria andCanbyenduserIn(List<String> values) { addCriterion("canbyenduser in", values, "canbyenduser"); return (Criteria) this; } public Criteria andCanbyenduserNotIn(List<String> values) { addCriterion("canbyenduser not in", values, "canbyenduser"); return (Criteria) this; } public Criteria andCanbyenduserBetween(String value1, String value2) { addCriterion("canbyenduser between", value1, value2, "canbyenduser"); return (Criteria) this; } public Criteria andCanbyenduserNotBetween(String value1, String value2) { addCriterion("canbyenduser not between", value1, value2, "canbyenduser"); return (Criteria) this; } public Criteria andCanbyagnenduserIsNull() { addCriterion("canbyagnenduser is null"); return (Criteria) this; } public Criteria andCanbyagnenduserIsNotNull() { addCriterion("canbyagnenduser is not null"); return (Criteria) this; } public Criteria andCanbyagnenduserEqualTo(String value) { addCriterion("canbyagnenduser =", value, "canbyagnenduser"); return (Criteria) this; } public Criteria andCanbyagnenduserNotEqualTo(String value) { addCriterion("canbyagnenduser <>", value, "canbyagnenduser"); return (Criteria) this; } public Criteria andCanbyagnenduserGreaterThan(String value) { addCriterion("canbyagnenduser >", value, "canbyagnenduser"); return (Criteria) this; } public Criteria andCanbyagnenduserGreaterThanOrEqualTo(String value) { addCriterion("canbyagnenduser >=", value, "canbyagnenduser"); return (Criteria) this; } public Criteria andCanbyagnenduserLessThan(String value) { addCriterion("canbyagnenduser <", value, "canbyagnenduser"); return (Criteria) this; } public Criteria andCanbyagnenduserLessThanOrEqualTo(String value) { addCriterion("canbyagnenduser <=", value, "canbyagnenduser"); return (Criteria) this; } public Criteria andCanbyagnenduserLike(String value) { addCriterion("canbyagnenduser like", value, "canbyagnenduser"); return (Criteria) this; } public Criteria andCanbyagnenduserNotLike(String value) { addCriterion("canbyagnenduser not like", value, "canbyagnenduser"); return (Criteria) this; } public Criteria andCanbyagnenduserIn(List<String> values) { addCriterion("canbyagnenduser in", values, "canbyagnenduser"); return (Criteria) this; } public Criteria andCanbyagnenduserNotIn(List<String> values) { addCriterion("canbyagnenduser not in", values, "canbyagnenduser"); return (Criteria) this; } public Criteria andCanbyagnenduserBetween(String value1, String value2) { addCriterion("canbyagnenduser between", value1, value2, "canbyagnenduser"); return (Criteria) this; } public Criteria andCanbyagnenduserNotBetween(String value1, String value2) { addCriterion("canbyagnenduser not between", value1, value2, "canbyagnenduser"); return (Criteria) this; } public Criteria andCanbyagnIsNull() { addCriterion("canbyagn is null"); return (Criteria) this; } public Criteria andCanbyagnIsNotNull() { addCriterion("canbyagn is not null"); return (Criteria) this; } public Criteria andCanbyagnEqualTo(String value) { addCriterion("canbyagn =", value, "canbyagn"); return (Criteria) this; } public Criteria andCanbyagnNotEqualTo(String value) { addCriterion("canbyagn <>", value, "canbyagn"); return (Criteria) this; } public Criteria andCanbyagnGreaterThan(String value) { addCriterion("canbyagn >", value, "canbyagn"); return (Criteria) this; } public Criteria andCanbyagnGreaterThanOrEqualTo(String value) { addCriterion("canbyagn >=", value, "canbyagn"); return (Criteria) this; } public Criteria andCanbyagnLessThan(String value) { addCriterion("canbyagn <", value, "canbyagn"); return (Criteria) this; } public Criteria andCanbyagnLessThanOrEqualTo(String value) { addCriterion("canbyagn <=", value, "canbyagn"); return (Criteria) this; } public Criteria andCanbyagnLike(String value) { addCriterion("canbyagn like", value, "canbyagn"); return (Criteria) this; } public Criteria andCanbyagnNotLike(String value) { addCriterion("canbyagn not like", value, "canbyagn"); return (Criteria) this; } public Criteria andCanbyagnIn(List<String> values) { addCriterion("canbyagn in", values, "canbyagn"); return (Criteria) this; } public Criteria andCanbyagnNotIn(List<String> values) { addCriterion("canbyagn not in", values, "canbyagn"); return (Criteria) this; } public Criteria andCanbyagnBetween(String value1, String value2) { addCriterion("canbyagn between", value1, value2, "canbyagn"); return (Criteria) this; } public Criteria andCanbyagnNotBetween(String value1, String value2) { addCriterion("canbyagn not between", value1, value2, "canbyagn"); return (Criteria) this; } public Criteria andOrderbyidIsNull() { addCriterion("orderbyid is null"); return (Criteria) this; } public Criteria andOrderbyidIsNotNull() { addCriterion("orderbyid is not null"); return (Criteria) this; } public Criteria andOrderbyidEqualTo(Integer value) { addCriterion("orderbyid =", value, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidNotEqualTo(Integer value) { addCriterion("orderbyid <>", value, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidGreaterThan(Integer value) { addCriterion("orderbyid >", value, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidGreaterThanOrEqualTo(Integer value) { addCriterion("orderbyid >=", value, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidLessThan(Integer value) { addCriterion("orderbyid <", value, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidLessThanOrEqualTo(Integer value) { addCriterion("orderbyid <=", value, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidIn(List<Integer> values) { addCriterion("orderbyid in", values, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidNotIn(List<Integer> values) { addCriterion("orderbyid not in", values, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidBetween(Integer value1, Integer value2) { addCriterion("orderbyid between", value1, value2, "orderbyid"); return (Criteria) this; } public Criteria andOrderbyidNotBetween(Integer value1, Integer value2) { addCriterion("orderbyid not between", value1, value2, "orderbyid"); return (Criteria) this; } public Criteria andCanshowyearIsNull() { addCriterion("canshowyear is null"); return (Criteria) this; } public Criteria andCanshowyearIsNotNull() { addCriterion("canshowyear is not null"); return (Criteria) this; } public Criteria andCanshowyearEqualTo(String value) { addCriterion("canshowyear =", value, "canshowyear"); return (Criteria) this; } public Criteria andCanshowyearNotEqualTo(String value) { addCriterion("canshowyear <>", value, "canshowyear"); return (Criteria) this; } public Criteria andCanshowyearGreaterThan(String value) { addCriterion("canshowyear >", value, "canshowyear"); return (Criteria) this; } public Criteria andCanshowyearGreaterThanOrEqualTo(String value) { addCriterion("canshowyear >=", value, "canshowyear"); return (Criteria) this; } public Criteria andCanshowyearLessThan(String value) { addCriterion("canshowyear <", value, "canshowyear"); return (Criteria) this; } public Criteria andCanshowyearLessThanOrEqualTo(String value) { addCriterion("canshowyear <=", value, "canshowyear"); return (Criteria) this; } public Criteria andCanshowyearLike(String value) { addCriterion("canshowyear like", value, "canshowyear"); return (Criteria) this; } public Criteria andCanshowyearNotLike(String value) { addCriterion("canshowyear not like", value, "canshowyear"); return (Criteria) this; } public Criteria andCanshowyearIn(List<String> values) { addCriterion("canshowyear in", values, "canshowyear"); return (Criteria) this; } public Criteria andCanshowyearNotIn(List<String> values) { addCriterion("canshowyear not in", values, "canshowyear"); return (Criteria) this; } public Criteria andCanshowyearBetween(String value1, String value2) { addCriterion("canshowyear between", value1, value2, "canshowyear"); return (Criteria) this; } public Criteria andCanshowyearNotBetween(String value1, String value2) { addCriterion("canshowyear not between", value1, value2, "canshowyear"); return (Criteria) this; } public Criteria andTypeidIsNull() { addCriterion("typeid is null"); return (Criteria) this; } public Criteria andTypeidIsNotNull() { addCriterion("typeid is not null"); return (Criteria) this; } public Criteria andTypeidEqualTo(Integer value) { addCriterion("typeid =", value, "typeid"); return (Criteria) this; } public Criteria andTypeidNotEqualTo(Integer value) { addCriterion("typeid <>", value, "typeid"); return (Criteria) this; } public Criteria andTypeidGreaterThan(Integer value) { addCriterion("typeid >", value, "typeid"); return (Criteria) this; } public Criteria andTypeidGreaterThanOrEqualTo(Integer value) { addCriterion("typeid >=", value, "typeid"); return (Criteria) this; } public Criteria andTypeidLessThan(Integer value) { addCriterion("typeid <", value, "typeid"); return (Criteria) this; } public Criteria andTypeidLessThanOrEqualTo(Integer value) { addCriterion("typeid <=", value, "typeid"); return (Criteria) this; } public Criteria andTypeidIn(List<Integer> values) { addCriterion("typeid in", values, "typeid"); return (Criteria) this; } public Criteria andTypeidNotIn(List<Integer> values) { addCriterion("typeid not in", values, "typeid"); return (Criteria) this; } public Criteria andTypeidBetween(Integer value1, Integer value2) { addCriterion("typeid between", value1, value2, "typeid"); return (Criteria) this; } public Criteria andTypeidNotBetween(Integer value1, Integer value2) { addCriterion("typeid not between", value1, value2, "typeid"); return (Criteria) this; } public Criteria andCanseasonIsNull() { addCriterion("canseason is null"); return (Criteria) this; } public Criteria andCanseasonIsNotNull() { addCriterion("canseason is not null"); return (Criteria) this; } public Criteria andCanseasonEqualTo(String value) { addCriterion("canseason =", value, "canseason"); return (Criteria) this; } public Criteria andCanseasonNotEqualTo(String value) { addCriterion("canseason <>", value, "canseason"); return (Criteria) this; } public Criteria andCanseasonGreaterThan(String value) { addCriterion("canseason >", value, "canseason"); return (Criteria) this; } public Criteria andCanseasonGreaterThanOrEqualTo(String value) { addCriterion("canseason >=", value, "canseason"); return (Criteria) this; } public Criteria andCanseasonLessThan(String value) { addCriterion("canseason <", value, "canseason"); return (Criteria) this; } public Criteria andCanseasonLessThanOrEqualTo(String value) { addCriterion("canseason <=", value, "canseason"); return (Criteria) this; } public Criteria andCanseasonLike(String value) { addCriterion("canseason like", value, "canseason"); return (Criteria) this; } public Criteria andCanseasonNotLike(String value) { addCriterion("canseason not like", value, "canseason"); return (Criteria) this; } public Criteria andCanseasonIn(List<String> values) { addCriterion("canseason in", values, "canseason"); return (Criteria) this; } public Criteria andCanseasonNotIn(List<String> values) { addCriterion("canseason not in", values, "canseason"); return (Criteria) this; } public Criteria andCanseasonBetween(String value1, String value2) { addCriterion("canseason between", value1, value2, "canseason"); return (Criteria) this; } public Criteria andCanseasonNotBetween(String value1, String value2) { addCriterion("canseason not between", value1, value2, "canseason"); return (Criteria) this; } public Criteria andUpdatebytypeidIsNull() { addCriterion("updatebytypeid is null"); return (Criteria) this; } public Criteria andUpdatebytypeidIsNotNull() { addCriterion("updatebytypeid is not null"); return (Criteria) this; } public Criteria andUpdatebytypeidEqualTo(String value) { addCriterion("updatebytypeid =", value, "updatebytypeid"); return (Criteria) this; } public Criteria andUpdatebytypeidNotEqualTo(String value) { addCriterion("updatebytypeid <>", value, "updatebytypeid"); return (Criteria) this; } public Criteria andUpdatebytypeidGreaterThan(String value) { addCriterion("updatebytypeid >", value, "updatebytypeid"); return (Criteria) this; } public Criteria andUpdatebytypeidGreaterThanOrEqualTo(String value) { addCriterion("updatebytypeid >=", value, "updatebytypeid"); return (Criteria) this; } public Criteria andUpdatebytypeidLessThan(String value) { addCriterion("updatebytypeid <", value, "updatebytypeid"); return (Criteria) this; } public Criteria andUpdatebytypeidLessThanOrEqualTo(String value) { addCriterion("updatebytypeid <=", value, "updatebytypeid"); return (Criteria) this; } public Criteria andUpdatebytypeidLike(String value) { addCriterion("updatebytypeid like", value, "updatebytypeid"); return (Criteria) this; } public Criteria andUpdatebytypeidNotLike(String value) { addCriterion("updatebytypeid not like", value, "updatebytypeid"); return (Criteria) this; } public Criteria andUpdatebytypeidIn(List<String> values) { addCriterion("updatebytypeid in", values, "updatebytypeid"); return (Criteria) this; } public Criteria andUpdatebytypeidNotIn(List<String> values) { addCriterion("updatebytypeid not in", values, "updatebytypeid"); return (Criteria) this; } public Criteria andUpdatebytypeidBetween(String value1, String value2) { addCriterion("updatebytypeid between", value1, value2, "updatebytypeid"); return (Criteria) this; } public Criteria andUpdatebytypeidNotBetween(String value1, String value2) { addCriterion("updatebytypeid not between", value1, value2, "updatebytypeid"); return (Criteria) this; } public Criteria andPayMonthIsNull() { addCriterion("PAY_Month is null"); return (Criteria) this; } public Criteria andPayMonthIsNotNull() { addCriterion("PAY_Month is not null"); return (Criteria) this; } public Criteria andPayMonthEqualTo(String value) { addCriterion("PAY_Month =", value, "payMonth"); return (Criteria) this; } public Criteria andPayMonthNotEqualTo(String value) { addCriterion("PAY_Month <>", value, "payMonth"); return (Criteria) this; } public Criteria andPayMonthGreaterThan(String value) { addCriterion("PAY_Month >", value, "payMonth"); return (Criteria) this; } public Criteria andPayMonthGreaterThanOrEqualTo(String value) { addCriterion("PAY_Month >=", value, "payMonth"); return (Criteria) this; } public Criteria andPayMonthLessThan(String value) { addCriterion("PAY_Month <", value, "payMonth"); return (Criteria) this; } public Criteria andPayMonthLessThanOrEqualTo(String value) { addCriterion("PAY_Month <=", value, "payMonth"); return (Criteria) this; } public Criteria andPayMonthLike(String value) { addCriterion("PAY_Month like", value, "payMonth"); return (Criteria) this; } public Criteria andPayMonthNotLike(String value) { addCriterion("PAY_Month not like", value, "payMonth"); return (Criteria) this; } public Criteria andPayMonthIn(List<String> values) { addCriterion("PAY_Month in", values, "payMonth"); return (Criteria) this; } public Criteria andPayMonthNotIn(List<String> values) { addCriterion("PAY_Month not in", values, "payMonth"); return (Criteria) this; } public Criteria andPayMonthBetween(String value1, String value2) { addCriterion("PAY_Month between", value1, value2, "payMonth"); return (Criteria) this; } public Criteria andPayMonthNotBetween(String value1, String value2) { addCriterion("PAY_Month not between", value1, value2, "payMonth"); return (Criteria) this; } public Criteria andPaySeasonIsNull() { addCriterion("PAY_Season is null"); return (Criteria) this; } public Criteria andPaySeasonIsNotNull() { addCriterion("PAY_Season is not null"); return (Criteria) this; } public Criteria andPaySeasonEqualTo(String value) { addCriterion("PAY_Season =", value, "paySeason"); return (Criteria) this; } public Criteria andPaySeasonNotEqualTo(String value) { addCriterion("PAY_Season <>", value, "paySeason"); return (Criteria) this; } public Criteria andPaySeasonGreaterThan(String value) { addCriterion("PAY_Season >", value, "paySeason"); return (Criteria) this; } public Criteria andPaySeasonGreaterThanOrEqualTo(String value) { addCriterion("PAY_Season >=", value, "paySeason"); return (Criteria) this; } public Criteria andPaySeasonLessThan(String value) { addCriterion("PAY_Season <", value, "paySeason"); return (Criteria) this; } public Criteria andPaySeasonLessThanOrEqualTo(String value) { addCriterion("PAY_Season <=", value, "paySeason"); return (Criteria) this; } public Criteria andPaySeasonLike(String value) { addCriterion("PAY_Season like", value, "paySeason"); return (Criteria) this; } public Criteria andPaySeasonNotLike(String value) { addCriterion("PAY_Season not like", value, "paySeason"); return (Criteria) this; } public Criteria andPaySeasonIn(List<String> values) { addCriterion("PAY_Season in", values, "paySeason"); return (Criteria) this; } public Criteria andPaySeasonNotIn(List<String> values) { addCriterion("PAY_Season not in", values, "paySeason"); return (Criteria) this; } public Criteria andPaySeasonBetween(String value1, String value2) { addCriterion("PAY_Season between", value1, value2, "paySeason"); return (Criteria) this; } public Criteria andPaySeasonNotBetween(String value1, String value2) { addCriterion("PAY_Season not between", value1, value2, "paySeason"); return (Criteria) this; } public Criteria andPayHalfyearIsNull() { addCriterion("PAY_halfyear is null"); return (Criteria) this; } public Criteria andPayHalfyearIsNotNull() { addCriterion("PAY_halfyear is not null"); return (Criteria) this; } public Criteria andPayHalfyearEqualTo(String value) { addCriterion("PAY_halfyear =", value, "payHalfyear"); return (Criteria) this; } public Criteria andPayHalfyearNotEqualTo(String value) { addCriterion("PAY_halfyear <>", value, "payHalfyear"); return (Criteria) this; } public Criteria andPayHalfyearGreaterThan(String value) { addCriterion("PAY_halfyear >", value, "payHalfyear"); return (Criteria) this; } public Criteria andPayHalfyearGreaterThanOrEqualTo(String value) { addCriterion("PAY_halfyear >=", value, "payHalfyear"); return (Criteria) this; } public Criteria andPayHalfyearLessThan(String value) { addCriterion("PAY_halfyear <", value, "payHalfyear"); return (Criteria) this; } public Criteria andPayHalfyearLessThanOrEqualTo(String value) { addCriterion("PAY_halfyear <=", value, "payHalfyear"); return (Criteria) this; } public Criteria andPayHalfyearLike(String value) { addCriterion("PAY_halfyear like", value, "payHalfyear"); return (Criteria) this; } public Criteria andPayHalfyearNotLike(String value) { addCriterion("PAY_halfyear not like", value, "payHalfyear"); return (Criteria) this; } public Criteria andPayHalfyearIn(List<String> values) { addCriterion("PAY_halfyear in", values, "payHalfyear"); return (Criteria) this; } public Criteria andPayHalfyearNotIn(List<String> values) { addCriterion("PAY_halfyear not in", values, "payHalfyear"); return (Criteria) this; } public Criteria andPayHalfyearBetween(String value1, String value2) { addCriterion("PAY_halfyear between", value1, value2, "payHalfyear"); return (Criteria) this; } public Criteria andPayHalfyearNotBetween(String value1, String value2) { addCriterion("PAY_halfyear not between", value1, value2, "payHalfyear"); return (Criteria) this; } public Criteria andPayNextyearIsNull() { addCriterion("PAY_Nextyear is null"); return (Criteria) this; } public Criteria andPayNextyearIsNotNull() { addCriterion("PAY_Nextyear is not null"); return (Criteria) this; } public Criteria andPayNextyearEqualTo(String value) { addCriterion("PAY_Nextyear =", value, "payNextyear"); return (Criteria) this; } public Criteria andPayNextyearNotEqualTo(String value) { addCriterion("PAY_Nextyear <>", value, "payNextyear"); return (Criteria) this; } public Criteria andPayNextyearGreaterThan(String value) { addCriterion("PAY_Nextyear >", value, "payNextyear"); return (Criteria) this; } public Criteria andPayNextyearGreaterThanOrEqualTo(String value) { addCriterion("PAY_Nextyear >=", value, "payNextyear"); return (Criteria) this; } public Criteria andPayNextyearLessThan(String value) { addCriterion("PAY_Nextyear <", value, "payNextyear"); return (Criteria) this; } public Criteria andPayNextyearLessThanOrEqualTo(String value) { addCriterion("PAY_Nextyear <=", value, "payNextyear"); return (Criteria) this; } public Criteria andPayNextyearLike(String value) { addCriterion("PAY_Nextyear like", value, "payNextyear"); return (Criteria) this; } public Criteria andPayNextyearNotLike(String value) { addCriterion("PAY_Nextyear not like", value, "payNextyear"); return (Criteria) this; } public Criteria andPayNextyearIn(List<String> values) { addCriterion("PAY_Nextyear in", values, "payNextyear"); return (Criteria) this; } public Criteria andPayNextyearNotIn(List<String> values) { addCriterion("PAY_Nextyear not in", values, "payNextyear"); return (Criteria) this; } public Criteria andPayNextyearBetween(String value1, String value2) { addCriterion("PAY_Nextyear between", value1, value2, "payNextyear"); return (Criteria) this; } public Criteria andPayNextyearNotBetween(String value1, String value2) { addCriterion("PAY_Nextyear not between", value1, value2, "payNextyear"); return (Criteria) this; } public Criteria andPay2yearIsNull() { addCriterion("PAY_2year is null"); return (Criteria) this; } public Criteria andPay2yearIsNotNull() { addCriterion("PAY_2year is not null"); return (Criteria) this; } public Criteria andPay2yearEqualTo(String value) { addCriterion("PAY_2year =", value, "pay2year"); return (Criteria) this; } public Criteria andPay2yearNotEqualTo(String value) { addCriterion("PAY_2year <>", value, "pay2year"); return (Criteria) this; } public Criteria andPay2yearGreaterThan(String value) { addCriterion("PAY_2year >", value, "pay2year"); return (Criteria) this; } public Criteria andPay2yearGreaterThanOrEqualTo(String value) { addCriterion("PAY_2year >=", value, "pay2year"); return (Criteria) this; } public Criteria andPay2yearLessThan(String value) { addCriterion("PAY_2year <", value, "pay2year"); return (Criteria) this; } public Criteria andPay2yearLessThanOrEqualTo(String value) { addCriterion("PAY_2year <=", value, "pay2year"); return (Criteria) this; } public Criteria andPay2yearLike(String value) { addCriterion("PAY_2year like", value, "pay2year"); return (Criteria) this; } public Criteria andPay2yearNotLike(String value) { addCriterion("PAY_2year not like", value, "pay2year"); return (Criteria) this; } public Criteria andPay2yearIn(List<String> values) { addCriterion("PAY_2year in", values, "pay2year"); return (Criteria) this; } public Criteria andPay2yearNotIn(List<String> values) { addCriterion("PAY_2year not in", values, "pay2year"); return (Criteria) this; } public Criteria andPay2yearBetween(String value1, String value2) { addCriterion("PAY_2year between", value1, value2, "pay2year"); return (Criteria) this; } public Criteria andPay2yearNotBetween(String value1, String value2) { addCriterion("PAY_2year not between", value1, value2, "pay2year"); return (Criteria) this; } public Criteria andPay3yearIsNull() { addCriterion("PAY_3year is null"); return (Criteria) this; } public Criteria andPay3yearIsNotNull() { addCriterion("PAY_3year is not null"); return (Criteria) this; } public Criteria andPay3yearEqualTo(String value) { addCriterion("PAY_3year =", value, "pay3year"); return (Criteria) this; } public Criteria andPay3yearNotEqualTo(String value) { addCriterion("PAY_3year <>", value, "pay3year"); return (Criteria) this; } public Criteria andPay3yearGreaterThan(String value) { addCriterion("PAY_3year >", value, "pay3year"); return (Criteria) this; } public Criteria andPay3yearGreaterThanOrEqualTo(String value) { addCriterion("PAY_3year >=", value, "pay3year"); return (Criteria) this; } public Criteria andPay3yearLessThan(String value) { addCriterion("PAY_3year <", value, "pay3year"); return (Criteria) this; } public Criteria andPay3yearLessThanOrEqualTo(String value) { addCriterion("PAY_3year <=", value, "pay3year"); return (Criteria) this; } public Criteria andPay3yearLike(String value) { addCriterion("PAY_3year like", value, "pay3year"); return (Criteria) this; } public Criteria andPay3yearNotLike(String value) { addCriterion("PAY_3year not like", value, "pay3year"); return (Criteria) this; } public Criteria andPay3yearIn(List<String> values) { addCriterion("PAY_3year in", values, "pay3year"); return (Criteria) this; } public Criteria andPay3yearNotIn(List<String> values) { addCriterion("PAY_3year not in", values, "pay3year"); return (Criteria) this; } public Criteria andPay3yearBetween(String value1, String value2) { addCriterion("PAY_3year between", value1, value2, "pay3year"); return (Criteria) this; } public Criteria andPay3yearNotBetween(String value1, String value2) { addCriterion("PAY_3year not between", value1, value2, "pay3year"); return (Criteria) this; } public Criteria andPay4yearIsNull() { addCriterion("PAY_4year is null"); return (Criteria) this; } public Criteria andPay4yearIsNotNull() { addCriterion("PAY_4year is not null"); return (Criteria) this; } public Criteria andPay4yearEqualTo(String value) { addCriterion("PAY_4year =", value, "pay4year"); return (Criteria) this; } public Criteria andPay4yearNotEqualTo(String value) { addCriterion("PAY_4year <>", value, "pay4year"); return (Criteria) this; } public Criteria andPay4yearGreaterThan(String value) { addCriterion("PAY_4year >", value, "pay4year"); return (Criteria) this; } public Criteria andPay4yearGreaterThanOrEqualTo(String value) { addCriterion("PAY_4year >=", value, "pay4year"); return (Criteria) this; } public Criteria andPay4yearLessThan(String value) { addCriterion("PAY_4year <", value, "pay4year"); return (Criteria) this; } public Criteria andPay4yearLessThanOrEqualTo(String value) { addCriterion("PAY_4year <=", value, "pay4year"); return (Criteria) this; } public Criteria andPay4yearLike(String value) { addCriterion("PAY_4year like", value, "pay4year"); return (Criteria) this; } public Criteria andPay4yearNotLike(String value) { addCriterion("PAY_4year not like", value, "pay4year"); return (Criteria) this; } public Criteria andPay4yearIn(List<String> values) { addCriterion("PAY_4year in", values, "pay4year"); return (Criteria) this; } public Criteria andPay4yearNotIn(List<String> values) { addCriterion("PAY_4year not in", values, "pay4year"); return (Criteria) this; } public Criteria andPay4yearBetween(String value1, String value2) { addCriterion("PAY_4year between", value1, value2, "pay4year"); return (Criteria) this; } public Criteria andPay4yearNotBetween(String value1, String value2) { addCriterion("PAY_4year not between", value1, value2, "pay4year"); return (Criteria) this; } public Criteria andPay5yearIsNull() { addCriterion("PAY_5year is null"); return (Criteria) this; } public Criteria andPay5yearIsNotNull() { addCriterion("PAY_5year is not null"); return (Criteria) this; } public Criteria andPay5yearEqualTo(String value) { addCriterion("PAY_5year =", value, "pay5year"); return (Criteria) this; } public Criteria andPay5yearNotEqualTo(String value) { addCriterion("PAY_5year <>", value, "pay5year"); return (Criteria) this; } public Criteria andPay5yearGreaterThan(String value) { addCriterion("PAY_5year >", value, "pay5year"); return (Criteria) this; } public Criteria andPay5yearGreaterThanOrEqualTo(String value) { addCriterion("PAY_5year >=", value, "pay5year"); return (Criteria) this; } public Criteria andPay5yearLessThan(String value) { addCriterion("PAY_5year <", value, "pay5year"); return (Criteria) this; } public Criteria andPay5yearLessThanOrEqualTo(String value) { addCriterion("PAY_5year <=", value, "pay5year"); return (Criteria) this; } public Criteria andPay5yearLike(String value) { addCriterion("PAY_5year like", value, "pay5year"); return (Criteria) this; } public Criteria andPay5yearNotLike(String value) { addCriterion("PAY_5year not like", value, "pay5year"); return (Criteria) this; } public Criteria andPay5yearIn(List<String> values) { addCriterion("PAY_5year in", values, "pay5year"); return (Criteria) this; } public Criteria andPay5yearNotIn(List<String> values) { addCriterion("PAY_5year not in", values, "pay5year"); return (Criteria) this; } public Criteria andPay5yearBetween(String value1, String value2) { addCriterion("PAY_5year between", value1, value2, "pay5year"); return (Criteria) this; } public Criteria andPay5yearNotBetween(String value1, String value2) { addCriterion("PAY_5year not between", value1, value2, "pay5year"); return (Criteria) this; } public Criteria andOnlyusebyagnIsNull() { addCriterion("onlyusebyagn is null"); return (Criteria) this; } public Criteria andOnlyusebyagnIsNotNull() { addCriterion("onlyusebyagn is not null"); return (Criteria) this; } public Criteria andOnlyusebyagnEqualTo(String value) { addCriterion("onlyusebyagn =", value, "onlyusebyagn"); return (Criteria) this; } public Criteria andOnlyusebyagnNotEqualTo(String value) { addCriterion("onlyusebyagn <>", value, "onlyusebyagn"); return (Criteria) this; } public Criteria andOnlyusebyagnGreaterThan(String value) { addCriterion("onlyusebyagn >", value, "onlyusebyagn"); return (Criteria) this; } public Criteria andOnlyusebyagnGreaterThanOrEqualTo(String value) { addCriterion("onlyusebyagn >=", value, "onlyusebyagn"); return (Criteria) this; } public Criteria andOnlyusebyagnLessThan(String value) { addCriterion("onlyusebyagn <", value, "onlyusebyagn"); return (Criteria) this; } public Criteria andOnlyusebyagnLessThanOrEqualTo(String value) { addCriterion("onlyusebyagn <=", value, "onlyusebyagn"); return (Criteria) this; } public Criteria andOnlyusebyagnLike(String value) { addCriterion("onlyusebyagn like", value, "onlyusebyagn"); return (Criteria) this; } public Criteria andOnlyusebyagnNotLike(String value) { addCriterion("onlyusebyagn not like", value, "onlyusebyagn"); return (Criteria) this; } public Criteria andOnlyusebyagnIn(List<String> values) { addCriterion("onlyusebyagn in", values, "onlyusebyagn"); return (Criteria) this; } public Criteria andOnlyusebyagnNotIn(List<String> values) { addCriterion("onlyusebyagn not in", values, "onlyusebyagn"); return (Criteria) this; } public Criteria andOnlyusebyagnBetween(String value1, String value2) { addCriterion("onlyusebyagn between", value1, value2, "onlyusebyagn"); return (Criteria) this; } public Criteria andOnlyusebyagnNotBetween(String value1, String value2) { addCriterion("onlyusebyagn not between", value1, value2, "onlyusebyagn"); return (Criteria) this; } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated do_not_delete_during_merge Fri May 11 11:16:07 CST 2018 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table FreeHost_OtherProductlist * * @mbg.generated Fri May 11 11:16:07 CST 2018 */ public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
package com.bluejnr.wiretransfer.pattern.state.impl; import com.bluejnr.wiretransfer.model.domain.WireTransferVO; import com.bluejnr.wiretransfer.pattern.state.WireTransferState; import com.bluejnr.wiretransfer.pattern.strategy.WireTransferStrategy; public class ReviewDataWrongWireTransfer extends WireTransferState { public ReviewDataWrongWireTransfer(WireTransferVO wireTransferVO) { super(wireTransferVO); } @Override public void process() { wireTransferVO.setWireTransferState(new ConfirmedPaymentWireTransfer(wireTransferVO)); } @Override public String toString() { return WireTransferStrategy .REVIEW_DATA_WRONG .name(); } }
package com.yekong.rxmobile.ui; import android.os.Bundle; import android.support.annotation.Nullable; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.SearchView; import com.jakewharton.rxbinding.view.RxView; import com.jakewharton.rxbinding.widget.RxSearchView; import com.trello.rxlifecycle.components.RxFragment; import com.yekong.rxmobile.R; import com.yekong.rxmobile.model.DoubanUser; import com.yekong.rxmobile.model.DoubanUserSearch; import com.yekong.rxmobile.retrofit.DoubanService; import com.yekong.rxmobile.rx.RxAction; import com.yekong.rxmobile.rx.RxBus; import com.yekong.rxmobile.rx.RxEvent; import com.yekong.rxmobile.util.Logger; import com.yekong.rxmobile.view.DoubanUserViewHolder; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; import retrofit.GsonConverterFactory; import retrofit.Retrofit; import retrofit.RxJavaCallAdapterFactory; import rx.Observable; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action0; import rx.functions.Action1; import rx.functions.Func1; import rx.functions.Func2; import rx.functions.FuncN; import rx.schedulers.Schedulers; import uk.co.ribot.easyadapter.EasyAdapter; public class DoubanUserSearchFragment extends RxFragment { private static final String TAG = "DoubanUserSearchFragment"; private static final String ARG_QUERY = "ARG_QUERY"; static final int NUM_ITEMS = 3; SearchView mSearchView; ProgressBar mProgressBar; Button mRefreshAllButton; ListView mListView; EasyAdapter<DoubanUser> mEasyAdapter; Observable<Void> mRefreshClickStream; Observable<String> mSearchTextStream; Observable<List<DoubanUser>> mResponseStream; List<Observable<Void>> mCloseClickStreams = new ArrayList<>(NUM_ITEMS); List<Observable<DoubanUser>> mSuggestionStreams = new ArrayList<>(NUM_ITEMS); List<DoubanUser> mDoubanUsers = new ArrayList<>(NUM_ITEMS); private String mQuery; public DoubanUserSearchFragment() { // Required empty public constructor } public static DoubanUserSearchFragment newInstance(String query) { DoubanUserSearchFragment fragment = new DoubanUserSearchFragment(); Bundle args = new Bundle(); args.putString(ARG_QUERY, query); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mQuery = getArguments().getString(ARG_QUERY); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_douban_user_search, container, false); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); initView(view); initData(); initRx(); Logger.d("baoyibao", "onViewCreated"); } private void initView(View view) { mSearchView = (SearchView) view.findViewById(R.id.search_user); mProgressBar = (ProgressBar) view.findViewById(R.id.progress); mRefreshAllButton = (Button) view.findViewById(R.id.refreshAll); mListView = (ListView) view.findViewById(R.id.listView); mSearchView.requestFocus(); mProgressBar.setIndeterminate(true); mProgressBar.setVisibility(View.GONE); } private void initData() { mDoubanUsers.clear(); for (int i = 0; i < NUM_ITEMS; i++) { mDoubanUsers.add(DoubanUser.EMPTY); } mQuery = "夏"; mEasyAdapter = new EasyAdapter<>(getActivity(), DoubanUserViewHolder.class, mDoubanUsers); mListView.setAdapter(mEasyAdapter); mSearchView.setQuery(mQuery, true); } private void initRx() { initSearchTextStream(); initRefreshClickStream(); initCloseClickStream(); initResponseStream(); initSuggestionStream(); initProgressStream(); subscribeSuggestionStreams(); } private void initSearchTextStream() { // Subscribe the query text changes on the main thread just to make sure, // or when later interacted with other observables subscribing on non main thread, // exception will be thrown mSearchTextStream = RxSearchView.queryTextChanges(mSearchView) .debounce(500, TimeUnit.MILLISECONDS) .map(new Func1<CharSequence, String>() { @Override public String call(CharSequence charSequence) { return charSequence.toString().trim(); } }) .filter(new Func1<String, Boolean>() { @Override public Boolean call(String s) { return !TextUtils.isEmpty(s); } }) .distinctUntilChanged() .subscribeOn(AndroidSchedulers.mainThread()) .share(); // Observe on the main thread when touching the UI mSearchTextStream .compose(this.<String>bindToLifecycle()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<String>() { @Override public void call(String s) { mProgressBar.setVisibility(View.VISIBLE); RxBus.singleton().send(RxAction.create(RxEvent.USER_ITEM_SEARCH, s)); } }); } private void initRefreshClickStream() { // Subscribe the clicks on the main thread just to make sure, // or when later interacted with other observables subscribing on non main thread, // exception will be thrown mRefreshClickStream = RxView.clicks(mRefreshAllButton) .startWith((Void) null) .throttleFirst(500, TimeUnit.MILLISECONDS) .subscribeOn(AndroidSchedulers.mainThread()) .share(); } private void initCloseClickStream() { mCloseClickStreams.clear(); for (int i = 0; i < NUM_ITEMS; i++) { mCloseClickStreams.add(createCloseClickStream(i)); } } private void initSuggestionStream() { mSuggestionStreams.clear(); for (int i = 0; i < NUM_ITEMS; i++) { mSuggestionStreams.add(createSuggestionStream(i)); } } private void initProgressStream() { Observable.amb( // Show the progress view either refresh or search Observable.combineLatest( mRefreshClickStream, mSearchTextStream, new Func2<Void, String, Boolean>() { @Override public Boolean call(Void aVoid, String s) { return true; } }), // Hide the progress view when response is available mResponseStream.map(new Func1<List<DoubanUser>, Boolean>() { @Override public Boolean call(List<DoubanUser> doubanUsers) { return false; } })) // Observe on the main thread when touching UI .observeOn(AndroidSchedulers.mainThread()) .compose(this.<Boolean>bindToLifecycle()) .subscribe(new Action1<Boolean>() { @Override public void call(Boolean flag) { mProgressBar.setVisibility(flag ? View.VISIBLE : View.GONE); } }); } private void initResponseStream() { mResponseStream = Observable.combineLatest( // Observe the refresh or search on the non main thread, // or NetworkOnMainThreadException will be thrown mRefreshClickStream.observeOn(Schedulers.io()), mSearchTextStream.observeOn(Schedulers.io()), new Func2<Void, String, Observable<DoubanUserSearch>>() { @Override public Observable<DoubanUserSearch> call(Void aVoid, String query) { int start = (int) Math.floor(Math.random() * 1000); return new Retrofit.Builder() .baseUrl(DoubanService.BASE_URL) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build() .create(DoubanService.class) .searchUsers(query, 100, start); } }) .flatMap(new Func1<Observable<DoubanUserSearch>, Observable<DoubanUserSearch>>() { @Override public Observable<DoubanUserSearch> call(Observable<DoubanUserSearch> doubanUserSearchObservable) { return doubanUserSearchObservable; } }) .map(new Func1<DoubanUserSearch, List<DoubanUser>>() { @Override public List<DoubanUser> call(DoubanUserSearch doubanUserSearch) { return doubanUserSearch.users; } }) .doOnNext(new Action1<List<DoubanUser>>() { @Override public void call(List<DoubanUser> doubanUsers) { Logger.d(TAG, "Response douban users with size: " + doubanUsers.size()); Logger.d(TAG, "Thread: " + Thread.currentThread()); } }) .doOnError(new Action1<Throwable>() { @Override public void call(Throwable throwable) { Logger.d(TAG, "Request douban users error", throwable); } }) .share(); } private void subscribeSuggestionStreams() { Observable.combineLatest(mSuggestionStreams, new FuncN<List<DoubanUser>>() { @Override public List<DoubanUser> call(Object... users) { List<DoubanUser> doubanUsers = new ArrayList<>(users.length); for (Object user : users) { doubanUsers.add((DoubanUser) user); } Logger.d(TAG, "combine users " + Thread.currentThread()); return doubanUsers; } }) .compose(this.<List<DoubanUser>>bindToLifecycle()) // Observe on main thread when touching UI .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<List<DoubanUser>>() { @Override public void call(List<DoubanUser> doubanUsers) { mEasyAdapter.setItems(doubanUsers); mProgressBar.setVisibility(View.GONE); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { Logger.d(TAG, "Suggest users error", throwable); } }); } private Observable<Void> createCloseClickStream(final int position) { return RxBus.singleton().<Integer>toActionObservable(RxEvent.USER_ITEM_REFRESH) .filter(new Func1<Integer, Boolean>() { @Override public Boolean call(Integer integer) { return integer == position; } }) .throttleFirst(500, TimeUnit.MILLISECONDS) .map(new Func1<Object, Void>() { @Override public Void call(Object o) { return null; } }) .startWith((Void) null); } private Observable<DoubanUser> createSuggestionStream(final int position) { return Observable.combineLatest( mCloseClickStreams.get(position), mResponseStream, new Func2<Void, List<DoubanUser>, DoubanUser>() { @Override public DoubanUser call(Void aVoid, List<DoubanUser> users) { if (users.isEmpty()) { return DoubanUser.EMPTY; } int randomIndex = (int) Math.floor(Math.random() * users.size()); DoubanUser user = users.get(randomIndex); return user; } }) .doOnSubscribe(new Action0() { @Override public void call() { Logger.d(TAG, "Suggestion stream subscribe: " + position); } }) .doOnUnsubscribe(new Action0() { @Override public void call() { Logger.d(TAG, "Suggestion stream unsubscribe: " + position); } }); } }
package org.terasoluna.gfw.examples.rest.domain.service; import javax.inject.Inject; import org.dozer.Mapper; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.terasoluna.gfw.common.exception.ResourceNotFoundException; import org.terasoluna.gfw.examples.common.domain.model.Member; import org.terasoluna.gfw.examples.common.domain.repository.MemberRepository; import org.terasoluna.gfw.examples.common.domain.repository.MemberSearchCriteria; @Transactional @Service public class MemberServiceImpl implements MemberService { @Inject MemberRepository memberRepository; @Inject Mapper beanMapper; @Override public Page<Member> searchMembers(MemberSearchCriteria criteria, Pageable pageable) { return memberRepository.findAll(pageable); } @Override public Member getMember(String memberId) { final Member member = memberRepository.findOne(memberId); if (member == null) { throw new ResourceNotFoundException("Member is not found. memberId [" + memberId + "]."); } return member; } @Override public Member createMember(Member newMember) { memberRepository.save(newMember); return newMember; } @Override public Member updateMember(String memberId, Member newMember) { final Member member = getMember(memberId); beanMapper.map(newMember, member); memberRepository.save(member); return member; } @Override public void deleteMember(String memberId) { final Member member = memberRepository.findOne(memberId); if (member != null) { memberRepository.delete(member); } } }
package com.hand6.health.common;/** * Created by Administrator on 2019/7/6. */ import java.math.BigDecimal; /** * @author xxxx * @description * @date 2019/7/6 */ public class ConstantUtil { //性别 public static final String MAN="MAN"; public static final String WOMAN="WOMAN"; //运动记录状态 public static final String ACHIEVE = "ACHIEVE"; // 达标 public static final String NOT_ACHIEVE = "NOT_ACHIEVE"; // 未达标 //运动类型 public static final String RUN = "RUN"; // 跑步 public static final String WALK = "WALK"; // 步行 public static final String RIDE = "RIDE"; // 骑行 public static final String OTHER = "OTHER"; // 其它 //定时器用途 public static final String MOTION_SUMMARY="MOTION_SUMMARY";//运动统计 public static final String FILE_CLEAN="FILE_CLEAN";//运动统计 public static final BigDecimal ZERO=new BigDecimal(0); public static final BigDecimal TIME_CONVERSION=new BigDecimal(60); }
package ua.nure.timoshenko.summaryTask4.web.command.all; import org.apache.log4j.Logger; import ua.nure.timoshenko.summaryTask4.Path; import ua.nure.timoshenko.summaryTask4.db.DBManager; import ua.nure.timoshenko.summaryTask4.db.bean.CartProductBean; import ua.nure.timoshenko.summaryTask4.web.command.Command; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; import java.util.List; /** * Add to cart command. * * @author L.Timoshenko */ public class AddToCartCommand extends Command { private static final long serialVersionUID = -3379162513526017164L; private static final Logger LOG = Logger.getLogger(AddToCartCommand.class); @Override public String execute(HttpServletRequest request, HttpServletResponse response) throws IOException { LOG.debug("Commands starts"); DBManager manager = DBManager.getInstance(); boolean flag = false; HttpSession session = request.getSession(); @SuppressWarnings("unchecked") List<CartProductBean> list = (List<CartProductBean>) session .getAttribute("cartList"); // get all id String[] itemId = request.getParameterValues("itemId"); // get cart product bean if (itemId != null) { int[] itemIds = new int[itemId.length]; for (int i = 0; i < itemIds.length; i++) { itemIds[i] = Integer.parseInt(itemId[i]); } List<CartProductBean> cartProductBeans = manager .getCartBeanByProductId(itemIds); if (!(list == null)) { cartProductBeans.addAll(list); } LOG.trace("Found in DB: cartList --> " + cartProductBeans); session.setAttribute("cartList", cartProductBeans); LOG.trace("Set the request attribute: products --> " + cartProductBeans); } // error handler String errorMessage; String forward = Path.PAGE_ERROR_PAGE; if (flag) { errorMessage = "Selected item is not available."; request.setAttribute("errorMessage", errorMessage); LOG.error("errorMessage --> " + errorMessage); return forward; } LOG.debug("Command finished"); response.sendRedirect(Path.PAGE_CART); return null; } }
package com.teamcqr.chocolatequestrepoured.objects.entity.ai.target; import java.util.List; import com.google.common.base.Predicate; import com.teamcqr.chocolatequestrepoured.objects.entity.bases.AbstractEntityCQR; import com.teamcqr.chocolatequestrepoured.objects.items.staves.ItemStaffHealing; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.util.EntitySelectors; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.EnumDifficulty; public class EntityAICQRNearestAttackTarget extends EntityAIBase { protected final AbstractEntityCQR entity; protected final Predicate<EntityLivingBase> predicate; protected final TargetUtil.Sorter sorter; protected EntityLivingBase attackTarget; public EntityAICQRNearestAttackTarget(AbstractEntityCQR entity) { this.entity = entity; this.predicate = new Predicate<EntityLivingBase>() { @Override public boolean apply(EntityLivingBase input) { if (!TargetUtil.PREDICATE_ATTACK_TARGET.apply(input)) { return false; } if (!EntitySelectors.IS_ALIVE.apply(input)) { return false; } return EntityAICQRNearestAttackTarget.this.isSuitableTarget(input); } }; this.sorter = new TargetUtil.Sorter(entity); this.setMutexBits(1); } @Override public boolean shouldExecute() { if (this.entity.world.getDifficulty() == EnumDifficulty.PEACEFUL) { return false; } if (this.entity.ticksExisted % 4 == 0 && this.entity.getAttackTarget() == null) { AxisAlignedBB aabb = this.entity.getEntityBoundingBox().grow(32.0D); List<EntityLivingBase> possibleTargets = this.entity.world.getEntitiesWithinAABB(EntityLivingBase.class, aabb, this.predicate); if (!possibleTargets.isEmpty()) { this.attackTarget = TargetUtil.getNearestEntity(this.entity, possibleTargets); return true; } } return false; } @Override public void startExecuting() { this.entity.setAttackTarget(this.attackTarget); } private boolean isSuitableTarget(EntityLivingBase possibleTarget) { if (possibleTarget == this.entity) { return false; } if (this.entity.getHeldItemMainhand().getItem() instanceof ItemStaffHealing) { if (!this.entity.getFaction().isAlly(possibleTarget)) { return false; } if (!this.entity.getEntitySenses().canSee(possibleTarget)) { return false; } if (!this.entity.isInSightRange(possibleTarget)) { return false; } return possibleTarget.getHealth() < possibleTarget.getMaxHealth(); } if (!this.entity.getFaction().isEnemy(possibleTarget)) { return false; } if (!this.entity.getEntitySenses().canSee(possibleTarget)) { return false; } if (this.entity.isInAttackReach(possibleTarget)) { return true; } if (this.entity.isEntityInFieldOfView(possibleTarget)) { return this.entity.isInSightRange(possibleTarget); } return !possibleTarget.isSneaking() && this.entity.getDistance(possibleTarget) < 12.0D; } }
package com.tencent.mm.plugin.setting.ui.setting; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.text.Spannable.Factory; import android.text.TextUtils; import android.text.style.ForegroundColorSpan; import android.view.View; import android.view.View.OnClickListener; import android.widget.LinearLayout; import android.widget.TextView; import com.tencent.mm.bg.d; import com.tencent.mm.kernel.g; import com.tencent.mm.model.q; import com.tencent.mm.model.y; import com.tencent.mm.plugin.account.a.j; import com.tencent.mm.plugin.messenger.foundation.a.i; import com.tencent.mm.plugin.setting.a.k; import com.tencent.mm.plugin.setting.b; import com.tencent.mm.plugin.sns.b.n; import com.tencent.mm.protocal.c.bqd; import com.tencent.mm.protocal.c.xt; import com.tencent.mm.sdk.platformtools.ag; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.w; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.storage.aa; import com.tencent.mm.ui.base.preference.CheckBoxPreference; import com.tencent.mm.ui.base.preference.IconPreference; import com.tencent.mm.ui.base.preference.MMPreference; import com.tencent.mm.ui.base.preference.Preference; import com.tencent.mm.ui.base.preference.a; import com.tencent.mm.ui.base.preference.f; import com.tencent.mm.ui.base.preference.h; import com.tencent.mm.ui.e.e; import com.tencent.mm.ui.widget.a.c; import java.util.HashMap; import java.util.Map.Entry; public class SettingsPrivacyUI extends MMPreference { private String cXR = ""; private HashMap<Integer, Integer> eGU = new HashMap(); private f eOE; boolean hLI = false; private boolean mRv = false; private boolean mTp = true; private boolean mTq = false; private boolean mTr = false; private boolean mTs = false; private boolean mTt = true; private int mTu = e.thv; private int status; public final h a(SharedPreferences sharedPreferences) { return new a(this, sharedPreferences); } public final int Ys() { return k.settings_about_privacy; } public void onCreate(Bundle bundle) { boolean z = true; super.onCreate(bundle); this.eOE = this.tCL; this.status = q.GJ(); this.cXR = q.GF(); this.mTt = bi.a((Boolean) g.Ei().DT().get(68384, null), true); this.mTu = getIntent().getIntExtra("enter_scene", e.thv); x.d("MicroMsg.SettingPrivacy", "sns Notify " + this.mTt); initView(); com.tencent.mm.plugin.report.service.h.mEJ.h(14098, new Object[]{Integer.valueOf(9)}); if (this.mTu == e.thw || this.mTu == e.thx) { bqd bqd = new bqd(); if (n.nky != null) { bqd = n.nky.Lv(this.cXR); } if (bqd != null) { boolean z2; int i = bqd.sod; this.mTq = (i & 512) > 0; if ((i & 1024) > 0) { z2 = true; } else { z2 = false; } this.mTr = z2; if ((i & 2048) <= 0) { z = false; } this.mTs = z; } btT(); } } protected void onResume() { super.onResume(); this.status = q.GJ(); btU(); if (!this.hLI) { String stringExtra = getIntent().getStringExtra("need_matte_high_light_item"); if (!bi.oW(stringExtra)) { int aab = this.eOE.aab(stringExtra); setSelection(aab - 3); new ag().postDelayed(new 1(this, aab), 10); } this.hLI = true; } } public void onPause() { super.onPause(); g.Ei().DT().set(7, Integer.valueOf(this.status)); for (Entry entry : this.eGU.entrySet()) { int intValue = ((Integer) entry.getKey()).intValue(); int intValue2 = ((Integer) entry.getValue()).intValue(); xt xtVar = new xt(); xtVar.rDz = intValue; xtVar.rDA = intValue2; ((i) g.l(i.class)).FQ().b(new com.tencent.mm.plugin.messenger.foundation.a.a.h.a(23, xtVar)); x.d("MicroMsg.SettingPrivacy", "switch " + intValue + " " + intValue2); } this.eGU.clear(); } public void onDestroy() { super.onDestroy(); } public final boolean a(f fVar, Preference preference) { boolean z = true; boolean z2 = false; String str = preference.mKey; x.i("MicroMsg.SettingPrivacy", str + " item has been clicked!"); if (str.equals("settings_need_verify")) { return d(((CheckBoxPreference) fVar.ZZ("settings_need_verify")).isChecked(), 32, 4); } if (str.equals("settings_recommend_mobilefriends_to_me")) { boolean z3; if (((CheckBoxPreference) fVar.ZZ("settings_recommend_mobilefriends_to_me")).isChecked()) { z3 = false; } else { z3 = true; } return d(z3, 256, 7); } else if (str.equals("settings_about_blacklist")) { com.tencent.mm.model.x xVar = y.if(getString(com.tencent.mm.plugin.setting.a.i.group_blacklist)); Intent intent = new Intent(); intent.putExtra("filter_type", xVar.getType()); intent.putExtra("titile", getString(com.tencent.mm.plugin.setting.a.i.settings_private_blacklist)); intent.putExtra("list_attr", 32768); b.ezn.h(this, intent); return true; } else { Intent intent2; if (str.equals("timline_outside_permiss")) { intent2 = new Intent(); intent2.putExtra("k_sns_tag_id", 4); intent2.putExtra("k_sns_from_settings_about_sns", 1); d.b((Context) this, "sns", ".ui.SnsBlackDetailUI", intent2); } else if (str.equals("edit_timeline_group")) { d.A(this, "sns", ".ui.SnsTagPartlyUI"); } else if (str.equals("timeline_black_permiss")) { intent2 = new Intent(); intent2.putExtra("k_sns_tag_id", 5); intent2.putExtra("k_sns_from_settings_about_sns", 2); intent2.putExtra("k_tag_detail_sns_block_scene", 8); d.b((Context) this, "sns", ".ui.SnsTagDetailUI", intent2); } else if (str.equals("timeline_stranger_show")) { if (this.mRv) { z = false; } this.mRv = z; if (n.nky != null) { n.nky.aQ(this.cXR, this.mRv); } if (n.nky != null) { bqd aR = n.nky.aR(this.cXR, this.mRv); n.nky.a(this.cXR, aR); if (aR == null) { x.e("MicroMsg.SettingPrivacy", "userinfo in null !"); return false; } x.d("MicroMsg.SettingPrivacy", "dancy userinfo " + aR.toString()); ((i) g.l(i.class)).FQ().b(new com.tencent.mm.plugin.messenger.foundation.a.a.h.a(51, aR)); } } else if (str.equals("settings_find_google_contact")) { if (!((CheckBoxPreference) fVar.ZZ("settings_find_google_contact")).isChecked()) { z2 = true; } d(z2, 1048576, 29); return true; } else if (str.equals("settings_add_me_way")) { startActivity(new Intent(this, SettingsAddMeUI.class)); return true; } else if (str.equals("timeline_recent_show_select")) { btT(); } else if (str.equals("settings_sns_notify")) { this.mTt = !this.mTt; if (this.mTt) { com.tencent.mm.plugin.report.service.h.mEJ.h(14098, new Object[]{Integer.valueOf(3)}); } else { com.tencent.mm.plugin.report.service.h.mEJ.h(14098, new Object[]{Integer.valueOf(4)}); } g.Ei().DT().set(68384, Boolean.valueOf(this.mTt)); btU(); return true; } else if (str.equals("settings_unfamiliar_contact")) { startActivity(new Intent(this, UnfamiliarContactUI.class)); } else if (str.equals("settings_privacy_agreements")) { str = g.Ei().DT().get(274436, "").toString(); if (bi.oW(str)) { str = w.chO(); } com.tencent.mm.platformtools.a.b(this, getString(j.license_read_url, new Object[]{w.chP(), str, "setting", Integer.valueOf(0), Integer.valueOf(0)}), 0, false); } else if (str.equals("settings_auth_manage")) { startActivity(new Intent(this, SettingsManageAuthUI.class)); } return false; } } private void btT() { bqd Lv; bqd bqd = new bqd(); if (n.nky != null) { Lv = n.nky.Lv(this.cXR); } else { Lv = bqd; } if (Lv == null) { x.e("MicroMsg.SettingPrivacy", "userinfo is null"); return; } int intValue = ((Integer) g.Ei().DT().get(aa.a.sWj, Integer.valueOf(0))).intValue(); if (intValue > ((Integer) g.Ei().DT().get(aa.a.sWk, Integer.valueOf(0))).intValue()) { g.Ei().DT().a(aa.a.sWk, Integer.valueOf(intValue)); btU(); } c.a aVar = new c.a(this.mController.tml); aVar.Gu(com.tencent.mm.plugin.setting.a.i.app_cancel); aVar.Gq(com.tencent.mm.plugin.setting.a.i.contact_info_feedsapp_recent_select); View inflate = View.inflate(this.mController.tml, com.tencent.mm.plugin.setting.a.g.mm_alert_switch, null); LinearLayout linearLayout = (LinearLayout) inflate.findViewById(com.tencent.mm.plugin.setting.a.f.switcher_container); 2 2 = new 2(this, linearLayout); int i = Lv.sod; a(linearLayout, com.tencent.mm.plugin.setting.a.i.contact_info_feedsapp_recent_select_half_year, 1, this.mTq, 2); a(linearLayout, com.tencent.mm.plugin.setting.a.i.contact_info_feedsapp_recent_select_three_day, 0, this.mTr, 2); int i2 = com.tencent.mm.plugin.setting.a.i.contact_info_feedsapp_recent_select_all; boolean z = (this.mTq || this.mTr) ? false : true; a(linearLayout, i2, 2, z, 2); aVar.dR(inflate); c anj = aVar.anj(); linearLayout.setTag(anj); anj.show(); addDialog(anj); } private void a(LinearLayout linearLayout, int i, int i2, boolean z, OnClickListener onClickListener) { TextView textView = (TextView) View.inflate(this.mController.tml, com.tencent.mm.plugin.setting.a.g.radio_btn_item, null); textView.setText(i); textView.setTag(Integer.valueOf(i2)); linearLayout.addView(textView); textView.setOnClickListener(onClickListener); if (z) { textView.setCompoundDrawablesWithIntrinsicBounds(com.tencent.mm.plugin.setting.a.h.radio_on, 0, 0, 0); } } protected final void initView() { boolean z = false; setMMTitle(com.tencent.mm.plugin.setting.a.i.settings_about_privacy); setBackBtn(new 3(this)); x.v("MicroMsg.SettingPrivacy", "init function status: " + Integer.toBinaryString(this.status)); CheckBoxPreference checkBoxPreference = (CheckBoxPreference) this.eOE.ZZ("settings_need_verify"); checkBoxPreference.tDr = false; checkBoxPreference.qpJ = uL(32); String str = (String) g.Ei().DT().get(6, null); CheckBoxPreference checkBoxPreference2 = (CheckBoxPreference) this.eOE.ZZ("settings_recommend_mobilefriends_to_me"); checkBoxPreference2.tDr = false; if (str == null || str.length() <= 0) { this.eOE.c(checkBoxPreference2); } else { checkBoxPreference2.qpJ = !uL(256); } checkBoxPreference = (CheckBoxPreference) this.eOE.ZZ("settings_find_google_contact"); checkBoxPreference.tDr = false; if (!uL(1048576)) { z = true; } checkBoxPreference.qpJ = z; String str2 = (String) g.Ei().DT().get(208903, null); if (!bi.fU(this) || TextUtils.isEmpty(str2)) { this.eOE.c(checkBoxPreference); } if (!(((Boolean) g.Ei().DT().get(335873, Boolean.valueOf(true))).booleanValue() && n.nkA.bwW())) { this.eOE.bw("edit_timeline_group", true); } this.eOE.bw("settings_unfamiliar_contact", true); Preference ZZ = this.eOE.ZZ("settings_privacy_agreements"); str2 = getString(com.tencent.mm.plugin.setting.a.i.privacy_detail); CharSequence newSpannable = Factory.getInstance().newSpannable(getString(com.tencent.mm.plugin.setting.a.i.privacy_detail_tip) + str2); newSpannable.setSpan(new ForegroundColorSpan(getResources().getColor(com.tencent.mm.plugin.setting.a.c.link_color)), newSpannable.length() - str2.length(), newSpannable.length(), 33); ZZ.setTitle(newSpannable); this.eOE.notifyDataSetChanged(); } private boolean uL(int i) { return (this.status & i) != 0; } private boolean d(boolean z, int i, int i2) { x.d("MicroMsg.SettingPrivacy", "switch change : open = " + z + " item value = " + i + " functionId = " + i2); if (z) { this.status |= i; } else { this.status &= i ^ -1; } this.eGU.put(Integer.valueOf(i2), Integer.valueOf(z ? 1 : 2)); return true; } private void btU() { bqd bqd = new bqd(); if (n.nky != null) { bqd = n.nky.Lv(this.cXR); } if (bqd == null) { x.e("MicroMsg.SettingPrivacy", "userinfo is null"); return; } boolean z; int i = bqd.sod; CheckBoxPreference checkBoxPreference = (CheckBoxPreference) this.eOE.ZZ("timeline_stranger_show"); if (checkBoxPreference != null) { checkBoxPreference.tDr = false; this.mRv = (i & 1) > 0; if (this.mRv) { checkBoxPreference.qpJ = false; } else { checkBoxPreference.qpJ = true; } } IconPreference iconPreference = (IconPreference) this.eOE.ZZ("timeline_recent_show_select"); if (iconPreference != null) { boolean z2; iconPreference.tDr = false; if ((i & 512) > 0) { z2 = true; } else { z2 = false; } this.mTq = z2; if ((i & 1024) > 0) { z2 = true; } else { z2 = false; } this.mTr = z2; if ((i & 2048) > 0) { z2 = true; } else { z2 = false; } this.mTs = z2; if (this.mTq) { iconPreference.setSummary(com.tencent.mm.plugin.setting.a.i.contact_info_feedsapp_recent_select_half_year); } else if (this.mTr) { iconPreference.setSummary(com.tencent.mm.plugin.setting.a.i.contact_info_feedsapp_recent_select_three_day); } else { iconPreference.setSummary(com.tencent.mm.plugin.setting.a.i.contact_info_feedsapp_recent_select_all); } x.i("MicroMsg.SettingPrivacy", "willShowRecentRedCodeId %d, currentRecentRedCodeId %d", new Object[]{Integer.valueOf(((Integer) g.Ei().DT().get(aa.a.sWj, Integer.valueOf(0))).intValue()), Integer.valueOf(((Integer) g.Ei().DT().get(aa.a.sWk, Integer.valueOf(0))).intValue())}); if (((Integer) g.Ei().DT().get(aa.a.sWj, Integer.valueOf(0))).intValue() > ((Integer) g.Ei().DT().get(aa.a.sWk, Integer.valueOf(0))).intValue()) { iconPreference.Et(0); } else { iconPreference.Et(8); } } if (d.QS("sns") && (q.GQ() & 32768) == 0) { z = true; } else { z = false; } this.mTp = z; String str = "MicroMsg.SettingPrivacy"; StringBuilder append = new StringBuilder("isSnsOpenEntrance ").append(this.mTp).append(", install ").append(d.QS("sns")).append(", flag "); if ((q.GQ() & 32768) == 0) { z = true; } else { z = false; } x.i(str, append.append(z).toString()); if (this.mTp) { this.eOE.bw("settings_sns_notify", false); } else { this.eOE.bw("settings_sns_notify", true); } if (this.mTp) { checkBoxPreference = (CheckBoxPreference) this.eOE.ZZ("settings_sns_notify"); if (checkBoxPreference != null) { checkBoxPreference.tDr = false; this.mTt = bi.a((Boolean) g.Ei().DT().get(68384, null), true); if (this.mTt) { checkBoxPreference.qpJ = true; } else { checkBoxPreference.qpJ = false; } } } this.eOE.notifyDataSetChanged(); } }
/** * Copyright (c) 2016, 指端科技. */ package com.rofour.baseball.dao.manager.bean; import java.io.Serializable; /** * @ClassName: DutyBean * @Description: 管理中心 职务 * @author 高振 * @date 2016年3月27日 下午4:50:50 * */ public class DutyBean implements Serializable { private static final long serialVersionUID = -4675266529072440648L; /** * 编码 */ private Long dutyId; /** * 名称 */ private String dutyName; /** * 级别 */ private String rankNo; /** * 是否删除 */ private Byte beDeleted; public DutyBean(Long dutyId, String dutyName, String rankNo, Byte beDeleted) { this.dutyId = dutyId; this.dutyName = dutyName; this.rankNo = rankNo; this.beDeleted = beDeleted; } public DutyBean() { super(); } public Long getDutyId() { return dutyId; } public void setDutyId(Long dutyId) { this.dutyId = dutyId; } public String getDutyName() { return dutyName; } public void setDutyName(String dutyName) { this.dutyName = dutyName == null ? null : dutyName.trim(); } public String getRankNo() { return rankNo; } public void setRankNo(String rankNo) { this.rankNo = rankNo; } public Byte getBeDeleted() { return beDeleted; } public void setBeDeleted(Byte beDeleted) { this.beDeleted = beDeleted; } }
/* Copyright (c) 2008-2019. Fundwit All Rights Reserved. */ package com.fundwit.sys.shikra.exception; public class EmailSendException extends RuntimeException { public EmailSendException(String message, Throwable cause) { super(message, cause); } }
package com.kaldin.common.userName.action; import java.io.PrintWriter; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.codehaus.jackson.map.ObjectMapper; import com.kaldin.common.userName.dao.CandidateDao; public class CandidateGroupAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String result = "success"; int companyid = ((Integer) request.getSession().getAttribute( "CompanyId")).intValue(); Integer groupId=Integer.parseInt(request.getParameter("groupId")); ObjectMapper mapperObj = new ObjectMapper(); CandidateDao candidateDao = new CandidateDao(); List<?> userList = candidateDao.getUsers(groupId); request.setAttribute("userList", userList); PrintWriter out = response.getWriter(); out.print(mapperObj.writeValueAsString(userList)); return null; } }
package com.ericlam.mc.minigames.core.exception.arena.create; public class NoMoreLocationException extends WarpException { public NoMoreLocationException(String warp) { super(warp); } }
package com.tencent.mm.ui.chatting.g; import android.content.pm.PackageInfo; import android.view.View; import com.tencent.mm.model.au; import com.tencent.mm.model.c; import com.tencent.mm.pluginsdk.model.app.p; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.storage.bd; import com.tencent.mm.ui.chatting.a.b.b; import com.tencent.mm.ui.chatting.a.b.e; import com.tencent.mm.ui.tools.k; import com.tencent.mm.y.g$a; class f$2 implements e { final /* synthetic */ f tYA; f$2(f fVar) { this.tYA = fVar; } public final void a(int i, b bVar) { au.HU(); bd dW = c.FT().dW(bVar.bJC); g$a gp = g$a.gp(dW.field_content); String B = p.B(gp.url, "message"); String B2 = p.B(gp.dwn, "message"); PackageInfo packageInfo = f.getPackageInfo(this.tYA.mContext, gp.appId); this.tYA.a(B, B2, packageInfo == null ? null : packageInfo.versionName, packageInfo == null ? 0 : packageInfo.versionCode, gp.appId, dW.field_msgId, dW.field_msgSvrId, dW); } public final void a(View view, int i, b bVar) { x.i("MicroMsg.MusicHistoryListPresenter", "[onItemLongClick] position:%s", new Object[]{Integer.valueOf(i)}); new k(view.getContext()).b(view, new 1(this), new 2(this, bVar)); } }
package pro.eddiecache.core.memory; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import pro.eddiecache.core.CacheStatus; import pro.eddiecache.core.control.ContextCache; import pro.eddiecache.core.memory.util.MemoryElementDescriptor; import pro.eddiecache.core.model.ICacheElement; import pro.eddiecache.core.model.IContextCacheAttributes; import pro.eddiecache.core.stats.IStatElement; import pro.eddiecache.core.stats.IStats; import pro.eddiecache.core.stats.StatElement; import pro.eddiecache.core.stats.Stats; public abstract class AbstractMemoryCache<K, V> implements IMemoryCache<K, V> { private static final Log log = LogFactory.getLog(AbstractMemoryCache.class); private IContextCacheAttributes cacheAttributes; private ContextCache<K, V> cache; private CacheStatus status; protected int chunkSize; protected final Lock lock = new ReentrantLock(); protected Map<K, MemoryElementDescriptor<K, V>> map; protected AtomicLong hitCnt; protected AtomicLong missCnt; protected AtomicLong putCnt; @Override public void initialize(ContextCache<K, V> hub) { hitCnt = new AtomicLong(0); missCnt = new AtomicLong(0); putCnt = new AtomicLong(0); this.cacheAttributes = hub.getCacheAttributes(); this.chunkSize = cacheAttributes.getSpoolChunkSize(); this.cache = hub; this.map = createMap(); this.status = CacheStatus.ALIVE; } public abstract Map<K, MemoryElementDescriptor<K, V>> createMap(); @Override public abstract boolean remove(K key) throws IOException; @Override public abstract ICacheElement<K, V> get(K key) throws IOException; @Override public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys) throws IOException { Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>(); if (keys != null && !keys.isEmpty()) { for (K key : keys) { ICacheElement<K, V> element = get(key); if (element != null) { elements.put(key, element); } } } return elements; } @Override public ICacheElement<K, V> getQuiet(K key) throws IOException { ICacheElement<K, V> ce = null; MemoryElementDescriptor<K, V> me = map.get(key); if (me != null) { if (log.isDebugEnabled()) { log.debug(getCacheName() + ": MemoryCache quiet hit for " + key); } ce = me.getCacheElement(); } else if (log.isDebugEnabled()) { log.debug(getCacheName() + ": MemoryCache quiet miss for " + key); } return ce; } @Override public abstract void update(ICacheElement<K, V> ce) throws IOException; @Override public abstract Set<K> getKeySet(); @Override public void removeAll() throws IOException { map.clear(); } @Override public void dispose() throws IOException { removeAll(); hitCnt.set(0); missCnt.set(0); putCnt.set(0); log.info("Memory Cache dispose called."); } @Override public IStats getStatistics() { IStats stats = new Stats(); stats.setTypeName("Abstract Memory Cache"); ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>(); stats.setStatElements(elems); elems.add(new StatElement<AtomicLong>("Put Count", putCnt)); elems.add(new StatElement<AtomicLong>("Hit Count", hitCnt)); elems.add(new StatElement<AtomicLong>("Miss Count", missCnt)); elems.add(new StatElement<Integer>("Map Size", Integer.valueOf(getSize()))); return stats; } @Override public int getSize() { return this.map.size(); } public CacheStatus getStatus() { return this.status; } public String getCacheName() { String attributeCacheName = this.cacheAttributes.getCacheName(); if (attributeCacheName != null) { return attributeCacheName; } return cache.getCacheName(); } @Override public void waterfal(ICacheElement<K, V> ce) { this.cache.spoolToDisk(ce); } public void mapProbe() { log.debug("mapProbe"); for (Map.Entry<K, MemoryElementDescriptor<K, V>> e : map.entrySet()) { MemoryElementDescriptor<K, V> me = e.getValue(); log.debug("mapProbe> key=" + e.getKey() + ", val=" + me.getCacheElement().getVal()); } } @Override public IContextCacheAttributes getCacheAttributes() { return this.cacheAttributes; } @Override public void setCacheAttributes(IContextCacheAttributes cattr) { this.cacheAttributes = cattr; } @Override public ContextCache<K, V> getContextCache() { return this.cache; } }
package com.jandir.dalip.ponginfinityfinal; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Rect; import java.util.Random; /** * Created by dalip on 2017-07-06. */ public class Debuff { private int x; private int y; private int size; private Bitmap bitmap; private Player player; private int type; private Rect detectCol; public Debuff (Context context, int screenX, int screenY, Player player, int x, int y){ this.x = x; this.y = y; Random generator = new Random(); int temp = generator.nextInt(13); size = screenX / 10; if (temp < 3){ type = 1; bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.shrink); } else if (temp >= 3 && temp <= 5 && player.getDivHeight() < 2.0){ type = 2; bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.moveup); } else if (temp >= 6 && temp <= 8){ type = 3; bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.speedup); } else if (temp >= 9 && temp <= 11){ type = 4; bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.plus1); } else { type = 5; bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.plus3); } bitmap = Bitmap.createScaledBitmap(bitmap, size, size, true); this.player = player; detectCol = new Rect(x, y, x+size, y+size); } public boolean hit (){ remove(); if (type == 1){ player.decSize(); } else if (type == 2){ player.incHeight(); } else if (type == 3){ return true; } else if (type == 4){ player.increaseScore(); } else if (type == 5){ player.increaseScore(); player.increaseScore(); player.increaseScore(); } return false; } public void remove () { x = -500; y = -500; detectCol.left = x; detectCol.top = y; detectCol.right = x + size; detectCol.bottom = y + size; } public int getX () { return x; } public int getY () { return y; } public Bitmap getBitmap () { return bitmap; } public Rect getDetectCol () { return detectCol; } }
/* * 文 件 名: UserStatusRequest.java * 描 述: UserStatusRequest.java * 时 间: 2013-6-18 */ package com.babyshow.rest.userstatus; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import com.babyshow.rest.RestRequest; /** * <一句话功能简述> * * @author ztc * @version [BABYSHOW V1R1C1, 2013-6-18] */ public class UserStatusRequest extends RestRequest { /** * 设备ID */ @NotNull(message = "{user.deviceid.null}") @Size(min = 1, max = 64, message = "{user.deviceid.length}") private String device_id; /** * 获取 device_id * * @return 返回 device_id */ public String getDevice_id() { return device_id; } /** * 设置 device_id * * @param 对device_id进行赋值 */ public void setDevice_id(String device_id) { this.device_id = device_id; } }
package com.agileengine.test.gallery.utils; import com.agileengine.test.gallery.service.dto.Token; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Component; @Component public class ImageGalleryIntegrationUtil { public HttpHeaders getHeaderParams(Token token){ HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", "Bearer " + token.getToken()); return headers; } }
package com.tencent.mm.plugin.appbrand.app; import com.tencent.mm.bt.h.d; import com.tencent.mm.y.a.c; class e$3 implements d { final /* synthetic */ e ffn; e$3(e eVar) { this.ffn = eVar; } public final String[] xb() { return c.dzV; } }
/** * Copyright (c) 2011 Baidu.com, Inc. All Rights Reserved */ package com.baidu.api.store; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; import java.util.Arrays; import java.util.List; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.baidu.api.BaiduOAuthToken; import com.baidu.api.domain.Session; /** 通过Cookie实现对token信息和User信息的存储 * * @author chenhetong(chenhetong@baidu.com) */ public final class BaiduCookieStore extends BaiduStore { private HttpServletRequest request; private HttpServletResponse response; private static List<String> supportedKeys = Arrays.asList("state", "code", "session"); /** 创建Cookie Store的存储类 * * @param clientId * 应用id * @param request * HttpServletRequest对象,用于获取cookie对象 * @param response * HttpServletResponse对象,用于添加cookie对象 */ public BaiduCookieStore(String clientId, HttpServletRequest request, HttpServletResponse response) { super(clientId); this.request = request; this.response = response; } public HttpServletRequest getRequest() { return request; } public HttpServletResponse getResponse() { return response; } /** 如果cookie对象为空,或者cookie中不含有该属性返回空 */ @Override public Session getSession() { String key = sanitizeVariableName("session"); Cookie[] cookies = request.getCookies(); if (cookies == null) { return null; } for (Cookie ck : cookies) { if (key.equals(ck.getName())) { String val = ""; try { val = URLDecoder.decode(ck.getValue(), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return new Session(val); } } return null; } @Override public boolean setSession(Session session) { String key = sanitizeVariableName("session"); String value = session.toJSONString(); try { value = URLEncoder.encode(value, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } Cookie ck = new Cookie(key, value); ck.setPath("/"); BaiduOAuthToken token = session.getToken(); if (null != token && token.getExpiresIn() != 0) { ck.setMaxAge(token.getExpiresIn()); } else { ck.setMaxAge(3600 * 24); } response.addCookie(ck); return true; } @Override /** * 如果cookie对象为空,或cookie中不含有该属性返回空 */ public String getState() { return getCookieAsString("state"); } @Override public boolean setState(String state) { return setCookie("state", state); } /** 如果cookie对象为空,或cookie中不含有该属性返回空 */ @Override public String getCode() { return getCookieAsString("code"); } @Override public boolean setCode(String code) { return setCookie("code", code); } @Override public boolean remove(String key) { if (!isVariableNameValid(key)) { return false; } String name = sanitizeVariableName(key); Cookie[] cookies = request.getCookies(); for (Cookie cookie : cookies) { if (cookie.getName().equals(name)) { cookie.setValue(null); cookie.setPath("/"); cookie.setMaxAge(0); response.addCookie(cookie); } } return true; } @Override public boolean removeAll() { remove("code"); remove("state"); remove("session"); return true; } private String getCookieAsString(String key) { String name = sanitizeVariableName(key); Cookie[] cookies = request.getCookies(); if (cookies == null) { return null; } for (Cookie ck : cookies) { if (name.equals(ck.getName())) { String value = ck.getValue(); if (value == null) { return null; } try { value = URLDecoder.decode(value, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return value; } } return null; } private boolean setCookie(String key, String value) { if (!isVariableNameValid(key)) { return false; } String name = sanitizeVariableName(key); try { value = URLEncoder.encode(value, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } Cookie ck = new Cookie(name, value); ck.setPath("/"); ck.setMaxAge(3600 * 24); response.addCookie(ck); return true; } private boolean isVariableNameValid(String key) { if (supportedKeys.contains(key)) { return true; } return false; } private String sanitizeVariableName(String key) { StringBuffer sb = new StringBuffer(64); sb.append("bds_").append(clientId).append("_").append(key); return sb.toString(); } }
package br.com.unopar.delivery.model; import java.io.Serializable; import javax.persistence.AttributeOverride; import javax.persistence.AttributeOverrides; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @Entity public class PedidoProduto implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId @AttributeOverrides( { @AttributeOverride(name = "idPedido", column = @Column(name = "idPedido", nullable = false)), @AttributeOverride(name = "idProduto", column = @Column(name = "idProduto", nullable = false)) }) private PedidoProdutoPK id; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "idPedido", nullable = false, insertable = false, updatable = false) private Pedido pedido; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "idProduto", nullable = false, insertable = false, updatable = false) private Produto produto; private Integer quantidade; public PedidoProduto() { this.id = new PedidoProdutoPK(); } /*public PedidoProduto(Pedido pedido, Produto produto) { this.id.setIdPedido(pedido.getId()); this.id.setIdProduto(produto.getId()); this.pedido = pedido; this.produto = produto; }*/ public Integer getQuantidade() { return quantidade; } public void setQuantidade(Integer quantidade) { this.quantidade = quantidade; } public PedidoProdutoPK getId() { return id; } public void setId(PedidoProdutoPK id) { this.id = id; } public Pedido getPedido() { return pedido; } public void setPedido(Pedido pedido) { this.pedido = pedido; this.id.setIdPedido(pedido.getId()); } public Produto getProduto() { return produto; } public void setProduto(Produto produto) { this.produto = produto; this.id.setIdProduto(produto.getId()); } }
package net.asurovenko.netexam.network; import net.asurovenko.netexam.network.models.AddedExam; import net.asurovenko.netexam.network.models.Answers; import net.asurovenko.netexam.network.models.AvailableExams; import net.asurovenko.netexam.network.models.CompletedExams; import net.asurovenko.netexam.network.models.Exam; import net.asurovenko.netexam.network.models.ExamReadyForm; import net.asurovenko.netexam.network.models.ExamResults; import net.asurovenko.netexam.network.models.ExamTime; import net.asurovenko.netexam.network.models.Exams; import net.asurovenko.netexam.network.models.Login; import net.asurovenko.netexam.network.models.Questions; import net.asurovenko.netexam.network.models.Results; import net.asurovenko.netexam.network.models.StudentRegister; import net.asurovenko.netexam.network.models.TeacherRegister; import net.asurovenko.netexam.network.models.User; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import rx.Observable; public interface NetExamApi { @POST("/api/student/") Observable<User> registerStudent(@Body StudentRegister register); @POST("/api/teacher/") Observable<User> registerTeacher(@Body TeacherRegister register); @POST("/api/session/") Observable<User> login(@Body Login login); @GET("/api/exams/") Observable<AvailableExams> getAvailableExams(@Header("token") String token); @GET("/api/exams/{number}/questions/") Observable<Questions> getQuestions(@Header("token") String token, @Path("number") long examNumber); @GET("/api/exams/{number}/") Observable<ExamTime> getExamTime(@Header("token") String token, @Path("number") long examNumber); @DELETE("/api/session/") Observable<ResponseBody> logout(@Header("token") String token); @POST("/api/exams/{number}/solutions/") Observable<Results> sendAnswers(@Header("token") String token, @Path("number") long examNumber, @Body Answers answers); @GET("/api/exams/solutions/") Observable<CompletedExams> getCompletedExams(@Header("token") String token); @GET("/api/exams/") Observable<Exams> getExams(@Header("token") String token); @POST("/api/exams/") Observable<Exam> addExam(@Header("token") String token, @Body AddedExam addedExam); @GET("/api/exams/{number}/students/") Observable<ExamResults> getExamResults(@Header("token") String token, @Path("number") int examNumber); @POST("/api/exams/{number}/questions/") Observable<Questions> sendQuestions(@Header("token") String token, @Path("number") int examNumber, @Body Questions questions); @PUT("/api/exams/{number}/state/") Observable<ResponseBody> sendStateExamReady(@Header("token") String token, @Path("number") int examNumber, @Body ExamReadyForm examReadyForm); }
package com.example.rockypzhang.buglydemo; import android.app.Activity; import android.os.Bundle; import android.view.View; import com.tencent.bugly.crashreport.CrashReport; public class Main2Activity extends Activity { NativeCrashJni nativeCrashJni; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); nativeCrashJni = NativeCrashJni.getInstance(); } public void crash(View view){ // CrashReport.testNativeCrash(); nativeCrashJni.createNativeCrash(); } public void javacrash(View view){ CrashReport.testJavaCrash(); } public void anr(View view){ CrashReport.testANRCrash(); } }
package com.espendwise.manta.web.forms; import com.espendwise.manta.spi.Initializable; import com.espendwise.manta.spi.Resetable; import com.espendwise.manta.util.Constants; import com.espendwise.manta.util.validation.Validation; import com.espendwise.manta.web.validator.UserAccountFilterFormValidator; @Validation(UserAccountFilterFormValidator.class) public class UserAccountFilterForm extends WebForm implements Resetable, Initializable { private Long userId; private String accountId; private String accountName; private String accountNameFilterType = Constants.FILTER_TYPE.START_WITH; private Boolean associateAllAccounts; private Boolean associateAllSites; private Boolean showConfiguredOnly; private Boolean showInactive; private boolean init; public UserAccountFilterForm() { super(); } public UserAccountFilterForm(Long userId) { super(); this.userId = userId; } public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public Boolean getShowInactive() { return showInactive; } public void setShowInactive(Boolean showInactive) { this.showInactive = showInactive; } public String getAccountId() { return accountId; } public void setAccountId(String accountId) { this.accountId = accountId; } public String getAccountNameFilterType() { return accountNameFilterType; } public void setAccountNameFilterType(String accountNameFilterType) { this.accountNameFilterType = accountNameFilterType; } public String getAccountName() { return accountName; } public void setAccountName(String accountName) { this.accountName = accountName; } public boolean isInit() { return init; } public void setInit(boolean init) { this.init = init; } public Boolean getShowConfiguredOnly() { return showConfiguredOnly; } public void setShowConfiguredOnly(Boolean showConfiguredOnly) { this.showConfiguredOnly = showConfiguredOnly; } public Boolean getAssociateAllAccounts() { return associateAllAccounts; } public void setAssociateAllAccounts(Boolean associateAllAccounts) { this.associateAllAccounts = associateAllAccounts; } public Boolean getAssociateAllSites() { return associateAllSites; } public void setAssociateAllSites(Boolean associateAllSites) { this.associateAllSites = associateAllSites; } @Override public void initialize() { reset(); this.accountNameFilterType = Constants.FILTER_TYPE.START_WITH; this.init = true; } @Override public boolean isInitialized() { return this.init; } @Override public void reset() { this.accountId = null; this.accountName = null; this.accountNameFilterType = Constants.FILTER_TYPE.START_WITH; this.associateAllAccounts = false; this.associateAllSites = false; this.showConfiguredOnly = false; this.showInactive = false; } }
package slepec.hra.planek.prostor.vec; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Set; /** * S vyjimkou osoby je vse v prostoru nejaka vec! Kazda vec ma prehled o vsech * vecech v ni obsazenych * * @author Pavel Jurca, xjurp20@vse.cz * @version 2 */ public class Vec implements IVec { private String nazev; private String popis; private int vaha; private boolean schranka; private int vyziva; //nutricni hodnota veci (potravy) private boolean jez; private boolean pij; private java.util.Set<Vec> veci; /** * * @param nazev oznaceni veci * @param popis vysvetlivka, k cemu tato vec slouzi * @param vaha v gramech * @param schranka true, pokud muze dana vec obsahovat dalsi veci */ public Vec(String nazev, String popis, int vaha) { this.nazev = nazev; this.popis = popis; this.vaha = vaha; schranka = false; //defaultne vec nemuze obsahovat dalsi vec jez = false; pij = false; vyziva = 0; if (this.vaha < 0) { this.vaha = 0; } veci = new HashSet<>(); } /** * Konstruktor veci jako potravy * * @param nazev * @param popis * @param vaha * @param jez true, pokud to lze jist * @param pij true, pokud to lze pit * @param vyziva nutricni hodnota potravy (muze byt i zaporna) */ public Vec(String nazev, String popis, int vaha, boolean jez, boolean pij, int vyziva) { this(nazev, popis, vaha); this.vyziva = vyziva; this.jez = jez; this.pij = pij; } public Vec(String nazev, String popis, int vaha, boolean schranka) { this(nazev, popis, vaha); this.schranka = schranka; } @Override public boolean pridej(Vec... veci) { if (null == veci || schranka == false) { return false; } int vel = this.veci.size(); for (Vec v : veci) { //nelze pridat vec se stejnym nazvem if (v != null && !v.equals(this) && !v.hasVec(nazev)) { vaha += v.getVaha(); //vaha pri pridavani musi narustat this.veci.add(v); } } if (vel == this.veci.size()) { return false; } return true; } @Override public Vec odeber(String nazevVeci) { Iterator<Vec> iter; ArrayList<Vec> uroven = new ArrayList<>(); Set<Vec> checked = new HashSet<>(); //uz prohledane uzly uroven.add(this); urovne: while (!uroven.isEmpty()) {//prochazeni do hloubky //prave zkoumana vec iter = uroven.get(uroven.size() - 1).veci.iterator(); while (iter.hasNext()) { Vec vec = iter.next(); if (vec.toString().equalsIgnoreCase(nazevVeci)) { iter.remove(); //vaha veci (schranky) pri odebirani musi klesat for (int i = 1; i <= uroven.size(); i++) { uroven.get(uroven.size() - i).vaha -= vec.getVaha(); } return vec; } if (!checked.contains(vec) && vec.getVnitrek().size() > 0) { checked.add(vec); uroven.add(vec); continue urovne; } checked.add(vec); //mnozina nepovoli duplicity, takze ok! } uroven.remove(uroven.size() - 1); } return null; } @Override public boolean hasVec(String nazevVeci) { if (selectVec(nazevVeci) != null) { return true; } else { return false; } } @Override public Vec selectVec(String nazevVeci) { Iterator<Vec> iter; ArrayList<Set<Vec>> urovne = new ArrayList<>(); urovne.add(new HashSet<>(this.getVnitrek())); urovne: //prochazeni stromu do hloubky while (!urovne.isEmpty()) { iter = urovne.get(urovne.size() - 1).iterator(); while (iter.hasNext()) { Vec vec = iter.next(); if (vec.toString().equalsIgnoreCase(nazevVeci)) { return vec; } if (vec.getVnitrek().size() > 0) { iter.remove(); urovne.add(new HashSet<>(vec.getVnitrek())); continue urovne; } iter.remove(); } urovne.remove(urovne.size() - 1); } return null; } /** * * @param nazevVeci * @return unmodifiable Set veci, ktere obsahuje tato vec */ @Override public Set<Vec> getVnitrek() { return Collections.unmodifiableSet(veci); } /** * <strong>Zformatovany seznam veci</strong> * * @return zformatovany seznam veci */ @Override public String getSeznamVeci() { String seznam = ""; Iterator<Vec> iter; ArrayList<Set<Vec>> urovne = new ArrayList<>(); urovne.add(new HashSet<>(this.getVnitrek())); urovne: //prochazeni stromu do hloubky while (!urovne.isEmpty()) { iter = urovne.get(urovne.size() - 1).iterator(); while (iter.hasNext()) { Vec vec = iter.next(); if (vec.getVnitrek().size() > 0) { iter.remove(); urovne.add(new HashSet<>(vec.getVnitrek())); seznam += ", " + vec + "("; continue urovne; } iter.remove(); seznam += ", " + vec; } if (urovne.size() > 1) { seznam += ")"; } urovne.remove(urovne.size() - 1); } seznam = seznam.replaceFirst("^,\\s", ""); return seznam.replaceAll("\\(,\\s", "("); } @Override public String getPopis() { return popis; } @Override public int getVaha() { return vaha; } @Override public boolean isSchranka() { return schranka; } @Override public boolean isJidlo() { return jez; } @Override public boolean isPiti() { return pij; } /** * Vyzivova (nutricni) hodnota veci * * @return */ @Override public int getNutriCislo() { return vyziva; } @Override public boolean equals(Object o) { if (o instanceof Vec) { Vec vec = (Vec) o; return nazev.equalsIgnoreCase(vec.toString()); } return false; } @Override public int hashCode() { return nazev.hashCode(); } @Override public String toString() { return nazev; } }
package com.tencent.mm.plugin.ipcall.a.f; import com.tencent.mm.model.au; import com.tencent.mm.plugin.ipcall.a.a.a; import com.tencent.mm.plugin.ipcall.a.a.c; import com.tencent.mm.plugin.ipcall.a.d.i; import com.tencent.mm.sdk.platformtools.x; public final class d extends a { public final int[] aXB() { return new int[]{991}; } public final int Mw() { return 1; } public final void aXC() { } public final void onDestroy() { } public final void b(c cVar) { if (cVar != null) { if (cVar.kpr == 0) { cVar.kpr = (int) System.currentTimeMillis(); } au.DF().a(new i(cVar.bZR, cVar.kpQ, cVar.kpr, cVar.kps, cVar.kpt), 0); x.d("MicroMsg.IPCallInviteService", "start invite, toUsername: %s, toPhoneNumber: %s, inviteid: %d", new Object[]{cVar.bZR, cVar.kpQ, Integer.valueOf(cVar.kpr)}); } } }
package pl.lua.aws.core.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import pl.lua.aws.core.model.PokerPlayerEntity; @Repository public interface PokerPlayerRepository extends JpaRepository<PokerPlayerEntity,Long> { }
package com.imwj.tmall.dao; import com.imwj.tmall.pojo.Category; import org.springframework.data.jpa.repository.JpaRepository; /** * @author langao_q * @create 2019-11-19 10:36 * 类别dao操作 */ public interface CategoryDAO extends JpaRepository<Category, Integer> { }
package L2.task2; public class Sportsman { private String name; private boolean hasRecord; private boolean hasTeam; public Sportsman(String name, boolean hasRecord, boolean hasTeam) { this.name = name; this.hasRecord = hasRecord; this.hasTeam = hasTeam; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public boolean isHasRecord() { return hasRecord; } public void setHasRecord(boolean hasRecord) { this.hasRecord = hasRecord; } public boolean isHasTeam() { return hasTeam; } public void setHasTeam(boolean hasTeam) { this.hasTeam = hasTeam; } @Override public boolean equals(Object o) { if (o instanceof Sportsman) { if (this.hasRecord == ((Sportsman) o).isHasRecord() && this.hasTeam == ((Sportsman) o).isHasTeam()) { return true; } else { return false; } } return false; } }
package org.jozif; import java.util.ArrayList; import java.util.List; public class Problem4 { /** * 有两个大小为 m 和 n 的排序数组 nums1 和 nums2 。 * <p> * 请找出两个排序数组的中位数并且总的运行时间复杂度为 O(log (m+n)) 。 * <p> * 示例 1: * <p> * nums1 = [1, 3] * nums2 = [2] * <p> * 中位数是 2.0 * <p> * <p> * 示例 2: * <p> * nums1 = [1, 2] * nums2 = [3, 4] * <p> * 中位数是 (2 + 3)/2 = 2.5 */ public double findMedianSortedArrays(int[] nums1, int[] nums2) { int totalSize = nums1.length + nums2.length; int[] nums3 = new int[totalSize / 2 + 1]; for (int i = 0, j = 0, k = 0; k < nums3.length; ++k) { if (i < nums1.length && j < nums2.length) { nums3[k] = Math.min(nums1[i], nums2[j]); if (nums3[k] == nums1[i]) { i += 1; } else { j += 1; } } else if (i < nums1.length && !(j < nums2.length)) { nums3[k] = nums1[i]; i += 1; // } else if (!(i < nums1.length) && j < nums2.length) { } else { nums3[k] = nums2[j]; j += 1; } } if (totalSize % 2 == 1) { //奇数 return nums3[nums3.length-1]; } else { //偶数 return (nums3[nums3.length-2] + nums3[nums3.length -1]) / 2.0; } } }
package persistencia; import java.util.List; import presentacion.Jugador; public interface IDAOAbandonos { public void anyadirAbandonoSinMostrar(Jugador [] jugadores,int idPartida,int idJugador); public List<Integer> abandonosNoMostrados(int idJugador,int idPartida); public void cambiarAbandonoAMostrado(int idJugador,int idPartida,int idJugadorAbandona); }
package demo9.ingredients.chicago; import demo9.ingredients.Cheese; public class MozzarellaCheese implements Cheese { }