text stringlengths 10 2.72M |
|---|
package org.suirui.drouter.common.app;
import com.suirui.drouter.core.ZRouter;
import org.suirui.drouter.common.base.BaseApplication;
/**
* 公共业务基础application
*
* @author cui.li by 2019/03/19
*/
public abstract class BaseCommonApplication extends BaseApplication {
/**
* 初始化路由和组件
*
*/
protected final void initRouterAndModule() {
ZRouter.init(this);
}
}
|
package com.example.ecommerce.ViewHolder;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.ecommerce.R;
import org.jetbrains.annotations.NotNull;
public class InvoiceViewHolder extends RecyclerView.ViewHolder{
public TextView customersID,deliveryMansID,invoiceFileNameID,invoiceDateTimeID;
public InvoiceViewHolder(@NonNull @NotNull View itemView) {
super(itemView);
customersID=itemView.findViewById(R.id.invoice_customer_id);
deliveryMansID=itemView.findViewById(R.id.invoice_delivery_mans_id);
invoiceFileNameID=itemView.findViewById(R.id.invoice_file_name_id);
invoiceDateTimeID=itemView.findViewById(R.id.invoice_date_time_id);
}
}
|
package com.tencent.mm.ui.fts.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
public class FTSMainUIHotWordLayout extends LinearLayout {
private TextView eCm = null;
protected OnClickListener jxn;
protected List<LinearLayout> jzM = null;
protected int utH = 2;
protected boolean utI = true;
public b utJ = null;
public FTSMainUIHotWordLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
initView();
}
public FTSMainUIHotWordLayout(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
initView();
}
private void initView() {
setOrientation(1);
this.jzM = new ArrayList();
}
public void setOnCellClickListener(OnClickListener onClickListener) {
this.jxn = onClickListener;
}
public String getSearchId() {
if (this.utJ == null || this.utJ.fuu == null) {
return "";
}
return this.utJ.fuu;
}
public void setVisibility(int i) {
if ((this.jzM.size() > 0 ? 1 : null) == null) {
i = 8;
}
super.setVisibility(i);
}
}
|
package customer.frame;
import javax.swing.JFrame;
@SuppressWarnings("serial")
public class BasicFrame extends JFrame {
public BasicFrame(String _title, int _width, int _height) {
setTitle(_title);
setSize(_width, _height);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
}
}
|
package com.github.stathvaille.marketimports.items.staticdataexport;
import lombok.Value;
import java.util.Map;
@Value
public class Groups {
private final Map<Long, Group> groups;
public Groups(Map<Long, Group> groups){
this.groups = groups;
}
}
|
package com.devmente.event.repeater.channel;
import io.vertx.core.json.JsonObject;
import rx.Single;
public interface ChannelService {
Single<Void> start();
Single<Void> subscribe(String channel);
Single<Void> unsubscribe(String channel);
Single<Void> publish(String channel, JsonObject message);
}
|
package core_java_Lab_o4;
public class CurrentAccount extends Account {
private Double overDraftLimit;
public CurrentAccount(String name, float age, long accNum, double balance,double overdraftLimit) {
super(name, age, accNum, balance);
this.overDraftLimit=overdraftLimit;
}
@Override
public String toString() {
return super.toString()+" CurrentAccount [overdraftLimit=" + overDraftLimit + "]";
}
@Override
public void withdraw(double bal) {
double overBalance=super.getBalance()+this.overDraftLimit;
if((overBalance - bal)<0)
{
System.out.println("Overdraft limit reached");
}
else
{
if(super.getBalance()<bal)
{
super.setBalance(0);
this.overDraftLimit = overBalance-bal;
}
else
{
super.setBalance(super.getBalance()-bal);
}
}
}
}
|
package cn.edu.sdjzu.xg.bysj.service;
import cn.edu.sdjzu.xg.bysj.domain.User;
import org.junit.Test;
import java.sql.SQLException;
import static org.junit.Assert.*;
public class UserServiceTest {
@Test
public void login() throws SQLException {
User user = new User("ssss","ssss",null,null);
UserService.getInstance().login(user);
}
} |
import tester.Tester;
interface IBook {
// calculates the days overdue of an IBook
int daysOverdue(int i);
// determines if this book is overdue
boolean isOverdue(int i);
public double computeFine(int today);
}
abstract class ABook implements IBook {
String title;
int dayTaken;
ABook(String title, int dayTaken) {
this.title = title;
this.dayTaken = dayTaken;
}
// calculates the default days over due of an ABook
public int daysOverdue(int today) {
return today - this.dayTaken - 14;
}
public boolean isOverdue(int today) {
return this.daysOverdue(today) > 0;
}
public double computeFine(int today) {
if (!this.isOverdue(today)) {
return 0;
}
else {
return (today - dayTaken) * 0.1;
}
}
}
class Book extends ABook {
String author;
Book(String title, String author, int dayTaken) {
super(title, dayTaken);
this.author = author;
}
}
class RefBook extends ABook {
RefBook(String title, int dayTaken) {
super(title, dayTaken);
}
// calculates days overdue for a refbook
public int daysOverdue(int today) {
return today - this.dayTaken - 2;
}
}
class AudioBook extends ABook {
String author;
AudioBook(String title, String author, int dayTaken) {
super(title, dayTaken);
this.author = author;
}
public double computeFine(int today) {
if (!this.isOverdue(today)) {
return 0;
}
else {
return (today - dayTaken) * 0.2;
}
}
}
class ExamplesBook {
IBook day0Book = new Book("day0 book", "An", 0);
IBook day0RefBook = new RefBook("day0 ref", 0);
IBook day0AudioBook = new AudioBook("day0 audio", "An", 0);
boolean testDaysOverdue(Tester t) {
return t.checkExpect(this.day0Book.daysOverdue(14), 0)
&& t.checkExpect(this.day0Book.daysOverdue(20), 6)
&& t.checkExpect(this.day0AudioBook.daysOverdue(4), -10)
&& t.checkExpect(this.day0RefBook.daysOverdue(4), 2)
&& t.checkExpect(this.day0RefBook.daysOverdue(2), 0)
&& t.checkExpect(this.day0RefBook.daysOverdue(1), -1);
}
boolean testIsOverdue(Tester t) {
return t.checkExpect(this.day0Book.isOverdue(14), false)
&& t.checkExpect(this.day0Book.isOverdue(20), true)
&& t.checkExpect(this.day0AudioBook.isOverdue(4), false)
&& t.checkExpect(this.day0RefBook.isOverdue(4), true)
&& t.checkExpect(this.day0RefBook.isOverdue(2), false)
&& t.checkExpect(this.day0RefBook.isOverdue(1), false);
}
} |
package com.legalzoom.api.test.client.service;
import java.net.URI;
import java.util.LinkedHashMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import org.springframework.beans.factory.annotation.Value;
import com.legalzoom.api.test.client.ResponseData;
import com.legalzoom.api.test.client.service.AbstractBaseServiceClient;
import com.legalzoom.api.test.dto.ContactDTO;
import com.legalzoom.api.test.dto.CreateCustomersContactCreateDTO;
import com.legalzoom.api.test.dto.CreateCustomersContactIdDTO;
import com.legalzoom.api.test.dto.CreatePasswordDTO;
import com.legalzoom.api.test.dto.CreatePasswordResetDTO;
import com.legalzoom.api.test.dto.CreateSecurityQuestionDTO;
import com.legalzoom.api.test.dto.CreateSecurityQuestionIdDTO;
import com.legalzoom.api.test.dto.CustomersDTO;
import com.legalzoom.api.test.dto.CreateCustomersDTO;
import com.legalzoom.api.test.dto.PasswordResetDTO;
import com.legalzoom.api.test.dto.CreatePasswordDTO;
import com.legalzoom.api.test.dto.CreatePasswordResetDTO;
import com.legalzoom.api.test.dto.PostPasswordDTO;
import com.legalzoom.api.test.dto.CreateSignInDTO;
import com.legalzoom.api.test.dto.RequestPasswordDTO;
import com.legalzoom.api.test.dto.ResetPasswordDTO;
import com.legalzoom.api.test.dto.SecurityQuestionIdDTO;
/**
* * Client to execute operations against LZ Account Service
hmaheshwari
Aug 12, 2015
9:30:00 PM
*/
public class CoreCustomersServiceClient extends AbstractBaseServiceClient {
private String coreCustomersApiKeyId;
@Value("${core.customers.service.name}")
private String coreCustomersServiceName;
@Value("${core.customers.signin.path}")
private String signInPath;
@Value("${core.customers.password.path}")
private String passwordPath;
@Value("${core.customers.passwordreset.path}")
private String passwordResetPath;
@Value("${core.customers.securityquestion.path}")
private String securityQuestionPath;
@Value("${core.customers.contacts.path}")
private String customersContactsPath;
@Value("${core.customers.history.path}")
private String customersHistoryPath;
@Value("${core.customers.create.path}")
private String customersCreatePath;
@Value("${core.customers.delete.path}")
private String customersDeletePath;
@Value("${core.customers.update.path}")
private String customersUpdatePath;
@Override
public URI getServiceURL() throws Exception {
return getServiceURL(Service.CoreCustomersService,coreCustomersServiceName);
}
public URI getServiceURL2() throws Exception {
return getServiceURL(Service.CoreCustomersService);
}
public CoreCustomersServiceClient()
{
}
public CoreCustomersServiceClient(String coreCustomersApiKeyId) {
this.coreCustomersApiKeyId = coreCustomersApiKeyId;
}
/**
* POST account login
* Requires a apiKeyId
*
* @return the response data
* @throws Exception
*/
public ResponseData loginAccount(CustomersDTO customers) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
LinkedHashMap<String, String> params = new LinkedHashMap<String, String>();
params.put("email", customers.getEmail());
params.put("password", customers.getPassword());
URI customersServiceURL = getServiceURL2();
responseData = lzClient.postFormParamsResponse(customersServiceURL, signInPath, params, coreCustomersApiKeyId);
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
public ResponseData createCustomers(CreateCustomersDTO createCustomers) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
URI customersServiceURL = getServiceURL();
responseData = lzClient.postJSONNoHeader(customersServiceURL, "", createCustomers);
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
public ResponseData createSignInAccount(CreateSignInDTO createSignIn) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
URI customersServiceURL = getServiceURL();
responseData = lzClient.postJSONNoHeader(customersServiceURL, signInPath, createSignIn);
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
public ResponseData postPassword(PostPasswordDTO postPassword) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
URI customersServiceURL = getServiceURL();
responseData = lzClient.postJSONNoHeader(customersServiceURL, passwordPath, postPassword);
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
public ResponseData passwordResetPost(PasswordResetDTO passwordReset) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
URI customersServiceURL = getServiceURL();
String passwordResetEndPoint = passwordPath + passwordResetPath;
responseData = lzClient.postJSONNoHeader(customersServiceURL, passwordResetEndPoint, passwordReset);
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
public ResponseData postSecurityQuestion(CreateSecurityQuestionDTO createSecurityQuestion) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
URI customersServiceURL = getServiceURL();
responseData = lzClient.postJSONNoHeader(customersServiceURL, securityQuestionPath, createSecurityQuestion);
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
public ResponseData postSecurityQuestion(CreateSecurityQuestionIdDTO createSecurityQuestionId) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
URI customersServiceURL = getServiceURL();
responseData = lzClient.postJSONNoHeader(customersServiceURL, securityQuestionPath, createSecurityQuestionId);
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
public ResponseData putSecurityQuestion(CreateSecurityQuestionDTO createSecurityQuestionId) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
URI customersServiceURL = getServiceURL();
responseData = lzClient.putJSON(customersServiceURL, securityQuestionPath, createSecurityQuestionId);
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
public ResponseData getSecurityQuestionWithId(String id) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
URI customersServiceURL = getServiceURL();
responseData = lzClient.getByIdNoHeader(customersServiceURL, securityQuestionPath, id, "");
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
public ResponseData getCustomersContactId(String customersContactId) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
URI customersServiceURL = getServiceURL();
// String customersContactURL = customersServiceURL + contactContactPath;
responseData = lzClient.getByIdNoHeader(customersServiceURL, customersContactsPath, customersContactId, "");
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
public ResponseData createCustomersContactCreate(CreateCustomersContactCreateDTO createccustomerscontactcreate) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
URI customersServiceURL = getServiceURL();
responseData = lzClient.postJSONNoHeader(customersServiceURL, customersCreatePath, createccustomerscontactcreate);
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
public ResponseData getCustomersById(String id) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
URI customersServiceURL = getServiceURL();
responseData = lzClient.getByIdNoHeader(customersServiceURL, id);
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
public ResponseData deleteContactCustomers(Integer id) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
URI customersServiceURL = getServiceURL();
responseData = lzClient.deleteByIdNoHeader(customersServiceURL, customersDeletePath, id);
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
public ResponseData customersContactUpdate(CreateCustomersContactCreateDTO createccustomerscontactcreate) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
URI customersServiceURL = getServiceURL();
responseData = lzClient.postJSONNoHeader(customersServiceURL, customersUpdatePath, createccustomerscontactcreate);
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
e.printStackTrace();
}
return responseData;
}
/*
public ResponseData loginAccount(AccountDTO account) throws Exception{
ResponseData responseData = null;
try {
//Note:Needed to change to LinkedHashMap to guarantee Order of the entry set
//email=xxx&password=yyy worked in API call, but password=yyy&email=xxx did not work
LinkedHashMap<String, String> params = new LinkedHashMap<String, String>();
params.put("email", account.getEmail());
params.put("password", account.getPassword());
URI accountServiceURL = getServiceURL();
//return responseData = lzClient.postFormParamsResponse(accountServiceURL, loginPath, params, accountApiKeyId);
return createResponseData(userId, null, getResponseStatus(), null, dspClient
.getResponseHeaders());
} catch (Exception e) {
// return createResponseData(null, null, getResponseStatus(), e.getMessage(), null);
return responseData.getErrorMessage();
}
}
*/
public String getCustomersServiceName() {
return coreCustomersServiceName;
}
public void setCustomersServiceName(String customersServiceName) {
this.coreCustomersServiceName = customersServiceName;
}
public String getCustomersCreatePath() {
return customersCreatePath;
}
public void setCustomersCreatePath(String customersCreatePath) {
this.customersCreatePath = customersCreatePath;
}
public String getSignInPath() {
return signInPath;
}
public void setSignInPath(String signInPath) {
this.signInPath = signInPath;
}
public String getPasswordPath() {
return passwordPath;
}
public void setPasswordPath(String passwordPath) {
this.passwordPath = passwordPath;
}
public String getPasswordResetPath() {
return passwordResetPath;
}
public void setPasswordResetPath(String passwordResetPath) {
this.passwordResetPath = passwordResetPath;
}
public String getSequrityQuestionIdPath() {
return securityQuestionPath;
}
public void setSequrityQuestionIdPath(String securityQuestionIdPath) {
this.securityQuestionPath = securityQuestionIdPath;
}
public String getContactDeletePath() {
return customersDeletePath;
}
public void setContactDeletePath(String contactDeletePath) {
this.customersDeletePath = contactDeletePath;
}
@Override
public void delete() {
// TODO Auto-generated method stub
}
public ResponseData createPassword(CreatePasswordDTO createPassword) {
// TODO Auto-generated method stub
return null;
}
public ResponseData createPasswordReset(CreatePasswordResetDTO createPasswordReset) {
// TODO Auto-generated method stub
return null;
}
public ResponseData createSecurityQuestionId(CreateSecurityQuestionIdDTO createSecurityQuestionId) {
// TODO Auto-generated method stub
return null;
}
}
|
package com.sdbarletta.salesforce.util;
import com.sforce.ws.tools.wsdlc;
public class Wsdl2Jar {
/**
* Use this program to build a Java jar from a Salesforce wsdl
* @param args
*/
public static void main(String[] args) {
args = new String[2];
// Build the metadata jar
//args[0] = "C:\\Users\\Sandy Barletta\\Desktop\\Exp\\HSAM\\metadata_ecmv1.wsdl";
//args[1] = "C:\\Users\\Sandy Barletta\\Desktop\\Exp\\HSAM\\metadata_26.jar";
// OR
// Build the partner jar
//args[0] = "C:\\Users\\Sandy Barletta\\Desktop\\Exp\\HSAM\\ecmv1_partner.wsdl";
//args[1] = "C:\\Users\\Sandy Barletta\\Desktop\\Exp\\HSAM\\partner_26.jar";
// OR
// Build the enterprise jar
//args[0] = "C:\\Users\\Sandy Barletta\\Desktop\\Exp\\HSAM\\ecmv1_enterprise.wsdl";
//args[1] = "C:\\Users\\Sandy Barletta\\Desktop\\Exp\\HSAM\\enterprise_26.jar";
try {
wsdlc.main(args);
System.out.println("Success");
} catch(Exception e) {
System.err.print(e.getMessage());
}
}
}
|
package pro.eddiecache.utils.access;
public interface CacheKitWorkerHelper<V>
{
boolean isFinished();
void setFinished(boolean isFinished);
V doWork() throws Exception;
}
|
package com.rc.portal.webapp.action;
import java.io.File;
import java.net.URLEncoder;
import java.sql.SQLException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;
import com.rc.app.framework.webapp.action.BaseAction;
import com.rc.commons.mail.Mail;
import com.rc.commons.util.InfoUtil;
import com.rc.dst.client.util.ClientSubmit;
import com.rc.portal.jms.MessageSender;
import com.rc.portal.memcache.MemCached;
import com.rc.portal.service.OpenSqlManage;
import com.rc.portal.service.TMemberBaseMessageExtManager;
import com.rc.portal.service.TMemberIntegralManager;
import com.rc.portal.service.TMemberManager;
import com.rc.portal.service.TMemberReceiverManager;
import com.rc.portal.service.TSysParameterManager;
import com.rc.portal.util.CodeUtil;
import com.rc.portal.util.CookieUtil;
import com.rc.portal.util.CustomDigestUtils;
import com.rc.portal.vo.TMember;
import com.rc.portal.vo.TMemberBaseMessageExt;
import com.rc.portal.vo.TMemberBaseMessageExtExample;
import com.rc.portal.vo.TMemberIntegral;
import com.rc.portal.vo.TMemberIntegralExample;
import com.rc.portal.webapp.util.JsonUtil;
/**
* 会员中心
* @author 刘天灵
*
*/
public class MemberProfileAction extends BaseAction{
private static final long serialVersionUID = 35345345341L;
private OpenSqlManage opensqlmanage;
private TMemberManager tmembermanager;
private TMemberBaseMessageExtManager tmemberbasemessageextmanager;
private TMemberIntegralManager tmemberintegralmanager;
private TMemberReceiverManager tmemberreceivermanager;
private TSysParameterManager tsysparametermanager;
private MessageSender topicMessageSender;
public TMemberBaseMessageExtManager getTmemberbasemessageextmanager() {
return tmemberbasemessageextmanager;
}
public void setTmemberbasemessageextmanager(
TMemberBaseMessageExtManager tmemberbasemessageextmanager) {
this.tmemberbasemessageextmanager = tmemberbasemessageextmanager;
}
public TSysParameterManager getTsysparametermanager() {
return tsysparametermanager;
}
public void setTsysparametermanager(TSysParameterManager tsysparametermanager) {
this.tsysparametermanager = tsysparametermanager;
}
public TMemberReceiverManager getTmemberreceivermanager() {
return tmemberreceivermanager;
}
public void setTmemberreceivermanager(
TMemberReceiverManager tmemberreceivermanager) {
this.tmemberreceivermanager = tmemberreceivermanager;
}
public TMemberIntegralManager getTmemberintegralmanager() {
return tmemberintegralmanager;
}
public void setTmemberintegralmanager(
TMemberIntegralManager tmemberintegralmanager) {
this.tmemberintegralmanager = tmemberintegralmanager;
}
public TMemberManager getTmembermanager() {
return tmembermanager;
}
public void setTmembermanager(TMemberManager tmembermanager) {
this.tmembermanager = tmembermanager;
}
private TMember tmember = new TMember();
public TMember getTmember() {
return tmember;
}
public void setTmember(TMember tmember) {
this.tmember = tmember;
}
public OpenSqlManage getOpensqlmanage() {
return opensqlmanage;
}
public void setOpensqlmanage(OpenSqlManage opensqlmanage) {
this.opensqlmanage = opensqlmanage;
}
public Object getModel() {
return null;
}
@Override
public void setModel(Object o) {
}
public MessageSender getTopicMessageSender() {
return topicMessageSender;
}
public void setTopicMessageSender(MessageSender topicMessageSender) {
this.topicMessageSender = topicMessageSender;
}
/**
*
* 个人资料(会员中心首页)
* @return
*/
public String index(){
//获取用户消费总额
this.getRequest().setAttribute("monetary",opensqlmanage.selectObjectByObject(this.getSession().getAttribute("member"), "t_order.select_member_consume"));
return "index";
}
/**
* 完善资料
* @return
*/
public String perfect() {
System.out.println("-----------------------");
return "perfect";
}
/**
*
* 完善个人资料(异步处理)
* @return
*/
public void editPerfect() throws Exception{
String [] fileNames = {"nickName","realName","sex","bloodType","drug","history","allergy"};
Map<String,Object> result = new HashMap<String,Object>();
//完善所得积分
int point = 0;
//TODO 有时间个改到service层
if(isValid(tmember, fileNames)){
TMember sessionMember = (TMember)this.getSession().getAttribute("member");
this.tmember.setId(sessionMember.getId());
//更新完成,重新设置回话对象
this.getSession().setAttribute("member",tmembermanager.selectByPrimaryKey(sessionMember.getId()));
//2完善用户名 (5积分)
if(StringUtils.isNotEmpty(tmember.getNickName())){
TMemberIntegralExample Example = new TMemberIntegralExample();
Example.createCriteria().andSourceEqualTo(2).andMemberIdEqualTo(sessionMember.getId());
int count = tmemberintegralmanager.countByExample(Example);
if(count == 0){
TMemberIntegral tmemberintegral = new TMemberIntegral();
tmemberintegral.setCreateDate(new Date());
tmemberintegral.setIntegral(5);
tmemberintegral.setMemberId(sessionMember.getId());
tmemberintegral.setSource(2);
tmemberintegralmanager.insertSelective(tmemberintegral);
point += 5 ;
Map<String, String> map = new HashMap<String, String>();
map.put("memberId", sessionMember.getId().toString());
map.put("jifen", ""+5);
map.put("version", "v7");
topicMessageSender.sendMapMessage(map);
}
CookieUtil.addCookie(getRequest(), getResponse(), "nickname", java.net.URLEncoder.encode(tmember.getNickName(), "utf-8"), 7*24*60*60, "/", "", false);
}else{
String nickname = CookieUtil.getCookie(getRequest(), "nickname");
if(nickname != null && !nickname.trim().equals("")){
CookieUtil.removeCookie(getRequest(), getResponse(), "nickname", "/", "");
}
}
//3完善真实姓名 (5积分)
if(StringUtils.isNotEmpty(tmember.getRealName())){
TMemberIntegralExample Example = new TMemberIntegralExample();
Example.createCriteria().andSourceEqualTo(3).andMemberIdEqualTo(sessionMember.getId());
int count = tmemberintegralmanager.countByExample(Example);
if(count == 0){
TMemberIntegral tmemberintegral = new TMemberIntegral();
tmemberintegral.setCreateDate(new Date());
tmemberintegral.setIntegral(5);
tmemberintegral.setMemberId(sessionMember.getId());
tmemberintegral.setSource(3);
tmemberintegralmanager.insertSelective(tmemberintegral);
point += 5 ;
Map<String, String> map = new HashMap<String, String>();
map.put("memberId", sessionMember.getId().toString());
map.put("jifen", ""+5);
map.put("version", "v7");
topicMessageSender.sendMapMessage(map);
}
}
//4完善性别 (5积分)
if(tmember.getSex()==1||tmember.getSex()==2){
TMemberIntegralExample Example = new TMemberIntegralExample();
Example.createCriteria().andSourceEqualTo(4).andMemberIdEqualTo(sessionMember.getId());
int count = tmemberintegralmanager.countByExample(Example);
if(count == 0){
TMemberIntegral tmemberintegral = new TMemberIntegral();
tmemberintegral.setCreateDate(new Date());
tmemberintegral.setIntegral(5);
tmemberintegral.setMemberId(sessionMember.getId());
tmemberintegral.setSource(4);
tmemberintegralmanager.insertSelective(tmemberintegral);
point += 5 ;
Map<String, String> map = new HashMap<String, String>();
map.put("memberId", sessionMember.getId().toString());
map.put("jifen", ""+5);
map.put("version", "v7");
topicMessageSender.sendMapMessage(map);
}
}
//5完善血型(5积分)
if(StringUtils.isNotEmpty(tmember.getBloodType())){
TMemberIntegralExample Example = new TMemberIntegralExample();
Example.createCriteria().andSourceEqualTo(5).andMemberIdEqualTo(sessionMember.getId());
int count = tmemberintegralmanager.countByExample(Example);
if(count == 0){
TMemberIntegral tmemberintegral = new TMemberIntegral();
tmemberintegral.setCreateDate(new Date());
tmemberintegral.setIntegral(5);
tmemberintegral.setMemberId(sessionMember.getId());
tmemberintegral.setSource(5);
tmemberintegralmanager.insertSelective(tmemberintegral);
point += 5 ;
Map<String, String> map = new HashMap<String, String>();
map.put("memberId", sessionMember.getId().toString());
map.put("jifen", ""+5);
map.put("version", "v7");
topicMessageSender.sendMapMessage(map);
}
}
//6完善会员病历(常用药、病史、过敏史)(50积分)
if(StringUtils.isNotEmpty(tmember.getDrug())&&StringUtils.isNotEmpty(tmember.getHistory())&&StringUtils.isNotEmpty(tmember.getAllergy())){
TMemberIntegralExample Example = new TMemberIntegralExample();
Example.createCriteria().andSourceEqualTo(6).andMemberIdEqualTo(sessionMember.getId());
int count = tmemberintegralmanager.countByExample(Example);
if(count == 0){
TMemberIntegral tmemberintegral = new TMemberIntegral();
tmemberintegral.setCreateDate(new Date());
tmemberintegral.setIntegral(50);
tmemberintegral.setMemberId(sessionMember.getId());
tmemberintegral.setSource(6);
tmemberintegralmanager.insertSelective(tmemberintegral);
point += 50 ;
Map<String, String> map = new HashMap<String, String>();
map.put("memberId", sessionMember.getId().toString());
map.put("jifen", ""+50);
map.put("version", "v7");
topicMessageSender.sendMapMessage(map);
}
}
this.tmembermanager.updateByPrimaryKeySelective(this.tmember);
this.getSession().setAttribute("member",tmembermanager.selectByPrimaryKey(sessionMember.getId()));
result.put("type", true);
result.put("point", point);
this.writeObjectToResponse(result, ContentType.application_json);
}else{
result.put("type", false);
result.put("point", point);
this.writeObjectToResponse(result, ContentType.application_json);
}
}
/**
* 用户头像
*/
public String headPortrait(){
return "upload_head_portrait";
}
private File head;
private String headFileName;
private String headContentType;
private String diskPath = InfoUtil.getInstance().getInfo("img", "images.public.head.path");
/**
* 上传头像
*/
public void uploadHeadPortrait(){
TMember sessionMember = (TMember)this.getSession().getAttribute("member");
String fileType= FilenameUtils.getExtension(headFileName);
try {
String basePath = this.getRequest().getSession().getServletContext().getRealPath("/");
if(checkFileType(fileType) && head.length() < 4*1024*1024){
String webPath = diskPath+"/"+UUID.randomUUID()+"."+fileType;
String fullName = basePath + webPath;
File uploadFile = new File(fullName);
FileUtils.copyFile(head, uploadFile);//上传图片
sessionMember.setHeadPortrait(webPath);
this.tmembermanager.updateByPrimaryKeySelective(sessionMember);
this.getSession().setAttribute("member", sessionMember);
this.writeObjectToResponse(URLEncoder.encode(webPath, "UTF-8"), ContentType.application_json);
}else{
this.writeObjectToResponse(0, ContentType.application_json);
}
} catch (Exception e) {
e.printStackTrace();
this.writeObjectToResponse(1, ContentType.application_json);
}
}
/**
* 上传头像
*/
public void uploadHeadPortrait_2(){
TMember sessionMember = (TMember)this.getSession().getAttribute("member");
String fileType= FilenameUtils.getExtension(headFileName);
try {
String basePath = this.getRequest().getSession().getServletContext().getRealPath("/");
if(checkFileType(fileType) && head.length() < 4*1024*1024){
String webPath = diskPath+"/"+UUID.randomUUID()+"."+fileType;
String fullName = basePath + webPath;
File uploadFile = new File(fullName);
FileUtils.copyFile(head, uploadFile);//上传图片
TMemberBaseMessageExtExample tbmee = new TMemberBaseMessageExtExample();
tbmee.createCriteria().andMemberIdEqualTo(sessionMember.getId());
if(tmemberbasemessageextmanager.countByExample(tbmee) > 0){
TMemberBaseMessageExt tMemberBaseMessageExt = new TMemberBaseMessageExt();
tMemberBaseMessageExt.setMemberId(sessionMember.getId());
tMemberBaseMessageExt.setHeadPortrait(webPath);
tmemberbasemessageextmanager.updateByPrimaryKeySelective(tMemberBaseMessageExt);
}else{
TMemberBaseMessageExt tMemberBaseMessageExt = new TMemberBaseMessageExt();
tMemberBaseMessageExt.setMemberId(sessionMember.getId());
tMemberBaseMessageExt.setHeadPortrait(webPath);
tmemberbasemessageextmanager.insertSelective(tMemberBaseMessageExt);
}
this.writeObjectToResponse(URLEncoder.encode(webPath, "UTF-8"), ContentType.application_json);
}else{
this.writeObjectToResponse(0, ContentType.application_json);
}
} catch (Exception e) {
e.printStackTrace();
this.writeObjectToResponse(1, ContentType.application_json);
}
}
public File getHead() {
return head;
}
public void setHead(File head) {
this.head = head;
}
public String getHeadFileName() {
return headFileName;
}
public void setHeadFileName(String headFileName) {
this.headFileName = headFileName;
}
public String getHeadContentType() {
return headContentType;
}
public void setHeadContentType(String headContentType) {
this.headContentType = headContentType;
}
/**
* 检查文件类型
* @param type
* @return
*/
public boolean checkFileType(String type){
boolean flag=false;
type = type.toLowerCase();
String[] arrType={"jpg","png","gif","jpeg"};
for(String s:arrType){
if(type.equals(s)){
return true;
}
}
return flag;
}
/**
* 编辑验证邮箱
*/
public String editEmail(){
return "edit_email";
}
/**
* 保存邮箱
* @throws SQLException
*/
public String saveEmail() throws SQLException{
String email = this.getRequest().getParameter("email");
String emailCheck = this.getRequest().getParameter("emailCheck");
String rand = this.getRequest().getParameter("rand");
String sessionRand = (String)this.getSession().getAttribute("rand");
String sessionEmailCheck = "";
Object memcacheValue = MemCached.getmcc().get("emailCheck");
if(memcacheValue!=null){
sessionEmailCheck = memcacheValue.toString();
}
this.getRequest().setAttribute("email", email);
if(StringUtils.isNotEmpty(email) && StringUtils.isNotEmpty(emailCheck) && emailCheck.equals(sessionEmailCheck) && StringUtils.isNotEmpty(rand)&& sessionRand.equalsIgnoreCase(rand)){
TMember member = (TMember)this.getSession().getAttribute("member");
member.setEmail(email);
member.setIsEmailCheck(1);
this.tmembermanager.updateByPrimaryKeySelective(member);
this.getSession().setAttribute("member", member);
this.getRequest().setAttribute("option", true);
}else{
this.getRequest().setAttribute("option", false);
}
return "edit_email_success";
}
private Mail mailSender;
public Mail getMailSender() {
return mailSender;
}
public void setMailSender(Mail mailSender) {
this.mailSender = mailSender;
}
/**
* 发送邮箱验证码
*/
public void sendEmailCheck(){
String email = this.getRequest().getParameter("email");
String randomUUID = CodeUtil.getVcode(6);
MemCached.getmcc().set("emailCheck", randomUUID, 60*1000);
System.out.println("短信验证码 session-key:mobileCheck value:"+email+"|"+randomUUID);
Map<Object,Object> contentMap = new HashMap<Object,Object>();
contentMap.put("randomUUID", randomUUID);
if(mailSender.send(email, "111医药馆-验证邮箱", contentMap, "sendCheckEmail.ftl")){
this.writeObjectToResponse(1, ContentType.application_json);
}else{
this.writeObjectToResponse(0, ContentType.application_json);
}
}
/**
* 发送手机验证码
* @throws Exception
*/
public void sendMobileCheck() throws Exception{
String mobile = this.getRequest().getParameter("mobile");
Map<String, String> mobilemap = new HashMap<String, String>();
mobilemap.put("mobile", mobile);
Long mobileCount = (Long) this.opensqlmanage.selectObjectByObject(mobilemap, "t_member.ibatorgenerated_selectByMobile");
if(mobileCount==0){
String numVcode = CodeUtil.getVcode(4);
//发送手机验证码
System.out.println("短信验证码 session-key:mobileCheck value:"+mobile+"|"+numVcode);
MemCached.getmcc().set("mobileCheck", mobile+"|"+numVcode, 60*1000);
Map<String, String> map = new HashMap<String, String>();
map.put("mobiles", mobile);
String smsContent = "您的手机验证码是:"+numVcode + " 要健康 要美丽 要时尚@111医药馆!";
map.put("smsContent", smsContent);
ClientSubmit.buildRequestBySMS(map,tsysparametermanager.getKeys("sms"));
this.writeObjectToResponse(1, ContentType.application_json);
}else{
this.writeObjectToResponse(2, ContentType.application_json);
}
}
/**
* 编辑验证手机
*/
public String editMobile(){
return "edit_mobile";
}
/**
* 保存验证手机
* @throws SQLException
*/
public String saveMobile() throws SQLException{
String mobile = this.getRequest().getParameter("mobile");
String mobileCheck = this.getRequest().getParameter("mobileCheck");
String rand = this.getRequest().getParameter("rand");
String sessionRand = (String)this.getSession().getAttribute("rand");
String sessionMobileCheck = "";
Object memcacheValue = MemCached.getmcc().get("mobileCheck");
if(memcacheValue!=null){
sessionMobileCheck = memcacheValue.toString();
}
this.getRequest().setAttribute("mobile", mobile);
if(StringUtils.isNotEmpty(mobile) && StringUtils.isNotEmpty(mobileCheck) && StringUtils.isNotEmpty(sessionMobileCheck) && sessionMobileCheck.equals(mobile+"|"+mobileCheck) && StringUtils.isNotEmpty(rand)&& sessionRand.equalsIgnoreCase(rand)){
this.getSession().removeAttribute("mobileCheck");
TMember member = (TMember)this.getSession().getAttribute("member");
member.setMobile(mobile);
member.setIsMobileCheck(1);
this.tmembermanager.updateByPrimaryKeySelective(member);
this.getSession().setAttribute("member", member);
this.getRequest().setAttribute("option", true);
}else{
this.getRequest().setAttribute("option", false);
}
return "edit_mobile_success";
}
/**
* 检查验证码是否正确
*/
public void randCheck(){
String rand = this.getRequest().getParameter("rand");
String sessionRand =(String) this.getSession().getAttribute("rand");
if(StringUtils.isNotEmpty(rand) && StringUtils.isNotEmpty(sessionRand) && rand.equalsIgnoreCase(sessionRand)){
this.writeObjectToResponse(1, ContentType.application_json);
}else{
this.writeObjectToResponse(0, ContentType.application_json);
}
}
/**
* 修改用户密码
*/
public String editPassword(){
return "edit_password";
}
/**
* 保存用户密码
*/
public String savePassword() throws Exception{
TMember sessionMember = (TMember)this.getSession().getAttribute("member");
String mobileCheck = this.getRequest().getParameter("mobileCheck");
String password = this.getRequest().getParameter("password");
String rePassword = this.getRequest().getParameter("rePassword");
String rand = this.getRequest().getParameter("rand");
String sessionRand = (String)this.getSession().getAttribute("rand");
String sessionMobileCheck = "";
Object memcahedValue = MemCached.getmcc().get("mobileCheck");
if(memcahedValue!=null){
sessionMobileCheck = memcahedValue.toString();
}
if(sessionMobileCheck.equals(sessionMember.getMobile()+"|"+mobileCheck) && password.matches("(?!(?:\\d*$))[A-Za-z0-9]{6,20}")&&password.equals(rePassword)&& StringUtils.isNotEmpty(rand)&& sessionRand.equalsIgnoreCase(rand)){
sessionMember.setPassword(CustomDigestUtils.md5Hex(password, sessionMember));
this.tmembermanager.updateByPrimaryKeySelective(sessionMember);
this.getRequest().setAttribute("option", true);
}else{
this.getRequest().setAttribute("option", false);
}
return "edit_password_success";
}
/**
* 异步获取会员信息
*/
public void ajaxMemberInfo() throws Exception{
TMember sessionMember = (TMember)this.getSession().getAttribute("member");
TMember selectByPrimaryKey = tmembermanager.selectByPrimaryKey(sessionMember.getId());
this.getSession().setAttribute("member", selectByPrimaryKey);
Map<String,Object> param = new HashMap<String,Object>();
Map map=new HashMap();
map.put("memberId", sessionMember.getId().toString());
String homePageConfigId = tsysparametermanager.getKeys("public_service_url");
Map result = JsonUtil.getData1(map, homePageConfigId+"getJifenOutline");
if(result.get("jifen")!=null){
if(selectByPrimaryKey.getIntegral()!=null){
Integer i=(Integer) selectByPrimaryKey.getIntegral();
Integer j=(Integer) result.get("jifen");
selectByPrimaryKey.setIntegral(i+j);
}
}
param.put("integral", selectByPrimaryKey.getIntegral());
param.put("nickName", selectByPrimaryKey.getNickName());
param.put("realName", selectByPrimaryKey.getRealName());
this.writeObjectToResponse(param, ContentType.application_json);
}
}
|
package com.ptut.projetptut_v1;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.ptut.projetptut_v1.Semantique.Tclassique;
import java.util.ArrayList;
public class TuileAdapter extends ArrayAdapter<Tclassique> {
private static class MyViewHolder {
private TextView img;
private TextView text;
}
public TuileAdapter(Context context, ArrayList<Tclassique> items) {
super(context,0, items);
}
public View getView(int position, View convertView, ViewGroup parent) {
/*ViewHolder viewHolder;
if (convertView == null) {
convertView = LayoutInflater.from(this.getContext()).inflate(R.layout.affichage_tuile, parent, false);
viewHolder = new ViewHolder();
viewHolder.img= convertView.findViewById(R.id.imgTuile);
viewHolder.text= convertView.findViewById(R.id.textTuile);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
Tclassique item = getItem(position);
if (item!= null) {
// My layout has only one TextView
// do whatever you want with your string and long
//viewHolder.img.setImageResource(R.drawable.ic_home);
viewHolder.img.setText(item.getidPanneau());
viewHolder.text.setText(item.getPhrase());
}*/
if(convertView == null){
convertView = LayoutInflater.from(getContext()).inflate(R.layout.affichage_tuile,parent, false);
}
MyViewHolder viewHolder = (MyViewHolder) convertView.getTag();
if(viewHolder == null){
viewHolder = new MyViewHolder();
viewHolder.img = (TextView) convertView.findViewById(R.id.imgTuile);
viewHolder.text = (TextView) convertView.findViewById(R.id.textTuile);
convertView.setTag(viewHolder);
}
//getItem(position) va récupérer l'item [position] de la List<Tweet> tweets
Tclassique tweet = getItem(position);
//il ne reste plus qu'à remplir notre vue
viewHolder.img.setText(tweet.getidTuile());
viewHolder.text.setText(tweet.getPhrase());
return convertView;
}
}
|
package net.minecraft.block;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockPressurePlate extends BlockBasePressurePlate {
public static final PropertyBool POWERED = PropertyBool.create("powered");
private final Sensitivity sensitivity;
protected BlockPressurePlate(Material materialIn, Sensitivity sensitivityIn) {
super(materialIn);
setDefaultState(this.blockState.getBaseState().withProperty((IProperty)POWERED, Boolean.valueOf(false)));
this.sensitivity = sensitivityIn;
}
protected int getRedstoneStrength(IBlockState state) {
return ((Boolean)state.getValue((IProperty)POWERED)).booleanValue() ? 15 : 0;
}
protected IBlockState setRedstoneStrength(IBlockState state, int strength) {
return state.withProperty((IProperty)POWERED, Boolean.valueOf((strength > 0)));
}
protected void playClickOnSound(World worldIn, BlockPos color) {
if (this.blockMaterial == Material.WOOD) {
worldIn.playSound(null, color, SoundEvents.BLOCK_WOOD_PRESSPLATE_CLICK_ON, SoundCategory.BLOCKS, 0.3F, 0.8F);
} else {
worldIn.playSound(null, color, SoundEvents.BLOCK_STONE_PRESSPLATE_CLICK_ON, SoundCategory.BLOCKS, 0.3F, 0.6F);
}
}
protected void playClickOffSound(World worldIn, BlockPos pos) {
if (this.blockMaterial == Material.WOOD) {
worldIn.playSound(null, pos, SoundEvents.BLOCK_WOOD_PRESSPLATE_CLICK_OFF, SoundCategory.BLOCKS, 0.3F, 0.7F);
} else {
worldIn.playSound(null, pos, SoundEvents.BLOCK_STONE_PRESSPLATE_CLICK_OFF, SoundCategory.BLOCKS, 0.3F, 0.5F);
}
}
protected int computeRedstoneStrength(World worldIn, BlockPos pos) {
List<? extends Entity> list;
AxisAlignedBB axisalignedbb = PRESSURE_AABB.offset(pos);
switch (this.sensitivity) {
case null:
list = worldIn.getEntitiesWithinAABBExcludingEntity(null, axisalignedbb);
break;
case MOBS:
list = worldIn.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
break;
default:
return 0;
}
if (!list.isEmpty())
for (Entity entity : list) {
if (!entity.doesEntityNotTriggerPressurePlate())
return 15;
}
return 0;
}
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty((IProperty)POWERED, Boolean.valueOf((meta == 1)));
}
public int getMetaFromState(IBlockState state) {
return ((Boolean)state.getValue((IProperty)POWERED)).booleanValue() ? 1 : 0;
}
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] { (IProperty)POWERED });
}
public enum Sensitivity {
EVERYTHING, MOBS;
}
}
/* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\minecraft\block\BlockPressurePlate.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ |
package multi.tenancy.core.context;
public interface MultiTenancyContextHolderStrategy {
public void clearContext();
public MultiTenancyContext getContext();
public void setContext(MultiTenancyContext context);
public MultiTenancyContext createEmptyContext();
}
|
package com.google.android.exoplayer2.source.b;
import android.net.Uri;
import android.os.Handler;
import android.os.SystemClock;
import android.text.TextUtils;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.c.f;
import com.google.android.exoplayer2.h.i;
import com.google.android.exoplayer2.h.r;
import com.google.android.exoplayer2.h.r.a;
import com.google.android.exoplayer2.h.r.c;
import com.google.android.exoplayer2.h.r.d;
import com.google.android.exoplayer2.i.q;
import com.google.android.exoplayer2.i.s;
import com.google.android.exoplayer2.i.t;
import com.google.android.exoplayer2.source.b.a.e;
import com.google.android.exoplayer2.source.g;
import com.google.android.exoplayer2.source.h;
import com.google.android.exoplayer2.source.h.b;
import com.google.android.exoplayer2.source.l;
import com.google.android.exoplayer2.source.m;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
final class j implements f, a<com.google.android.exoplayer2.source.a.a>, d, b, com.google.android.exoplayer2.source.j {
m acW;
final int aci;
boolean adE;
private final com.google.android.exoplayer2.h.b asl;
private final int atO;
final com.google.android.exoplayer2.source.a.a atP;
private final a aua;
final c aub;
private final Format auc;
final r aud = new r("Loader:HlsSampleStreamWrapper");
private final c.b aue = new c.b();
final LinkedList<f> auf = new LinkedList();
private final Runnable aug = new Runnable() {
public final void run() {
j.this.ld();
}
};
h[] auh = new h[0];
private int[] aui = new int[0];
boolean auj;
int auk;
Format aul;
int aum;
int aun;
private boolean auo;
boolean[] aup;
private boolean[] auq;
long aur;
private long aus;
boolean aut;
boolean auu;
boolean auv;
final Handler handler = new Handler();
boolean released;
public final /* synthetic */ void a(c cVar, long j, long j2) {
com.google.android.exoplayer2.source.a.a aVar = (com.google.android.exoplayer2.source.a.a) cVar;
c cVar2 = this.aub;
if (aVar instanceof c.a) {
c.a aVar2 = (c.a) aVar;
cVar2.atf = aVar2.data;
cVar2.a(aVar2.asJ.uri, aVar2.atm, aVar2.atn);
}
this.atP.a(aVar.asJ, aVar.type, this.aci, aVar.asK, aVar.asL, aVar.asM, aVar.asN, aVar.asO, j, j2, aVar.kP());
if (this.adE) {
this.aua.a(this);
return;
}
G(this.aur);
}
public j(int i, a aVar, c cVar, com.google.android.exoplayer2.h.b bVar, long j, Format format, int i2, com.google.android.exoplayer2.source.a.a aVar2) {
this.aci = i;
this.aua = aVar;
this.aub = cVar;
this.asl = bVar;
this.auc = format;
this.atO = i2;
this.atP = aVar2;
this.aur = j;
this.aus = j;
}
public final void la() {
if (!this.adE) {
G(this.aur);
}
}
public final boolean g(long j, boolean z) {
this.aur = j;
if (!(z || le())) {
boolean z2;
int length = this.auh.length;
int i = 0;
while (i < length) {
h hVar = this.auh[i];
hVar.rewind();
if (!hVar.e(j, false) && (this.auq[i] || !this.auo)) {
z2 = false;
break;
}
hVar.L(hVar.asn.kK());
i++;
}
z2 = true;
if (z2) {
return false;
}
}
this.aus = j;
this.auv = false;
this.auf.clear();
if (this.aud.iD()) {
this.aud.lY();
} else {
lc();
}
return true;
}
public final long kA() {
if (this.auv) {
return Long.MIN_VALUE;
}
if (le()) {
return this.aus;
}
long max;
long j = this.aur;
f fVar = (f) this.auf.getLast();
if (!fVar.atM) {
fVar = this.auf.size() > 1 ? (f) this.auf.get(this.auf.size() - 2) : null;
}
if (fVar != null) {
max = Math.max(j, fVar.asO);
} else {
max = j;
}
for (h hVar : this.auh) {
max = Math.max(max, hVar.asn.kI());
}
return max;
}
public final void lb() {
lc();
}
public final void ak(boolean z) {
this.aub.ate = z;
}
final void kC() {
this.aud.kC();
c cVar = this.aub;
if (cVar.atg != null) {
throw cVar.atg;
} else if (cVar.ath != null) {
cVar.atb.d(cVar.ath);
}
}
final void lc() {
for (h hVar : this.auh) {
boolean z = this.aut;
g gVar = hVar.asn;
gVar.length = 0;
gVar.asc = 0;
gVar.asd = 0;
gVar.ase = 0;
gVar.ash = true;
gVar.asf = Long.MIN_VALUE;
gVar.asg = Long.MIN_VALUE;
if (z) {
gVar.asj = null;
gVar.asi = true;
}
h.a aVar = hVar.asp;
if (aVar.asz) {
com.google.android.exoplayer2.h.a[] aVarArr = new com.google.android.exoplayer2.h.a[((hVar.asr.asz ? 1 : 0) + (((int) (hVar.asr.asy - aVar.asy)) / hVar.asm))];
for (int i = 0; i < aVarArr.length; i++) {
aVarArr[i] = aVar.asA;
aVar = aVar.kN();
}
hVar.asl.a(aVarArr);
}
hVar.asp = new h.a(0, hVar.asm);
hVar.asq = hVar.asp;
hVar.asr = hVar.asp;
hVar.anq = 0;
hVar.asl.lM();
}
this.aut = false;
}
public final boolean G(long j) {
if (this.auv || this.aud.iD()) {
return false;
}
f fVar;
int i;
Object obj;
boolean z;
com.google.android.exoplayer2.source.a.a aVar;
com.google.android.exoplayer2.source.b.a.a.a aVar2;
c cVar = this.aub;
if (this.auf.isEmpty()) {
fVar = null;
} else {
fVar = (f) this.auf.getLast();
}
if (this.aus != -9223372036854775807L) {
j = this.aus;
}
c.b bVar = this.aue;
if (fVar == null) {
i = -1;
} else {
i = cVar.atc.j(fVar.asK);
}
cVar.ath = null;
if (fVar != null) {
long j2;
if (cVar.ati) {
j2 = fVar.asO;
} else {
j2 = fVar.asN;
}
Math.max(0, j2 - j);
}
cVar.atl.kU();
int lI = cVar.atl.lI();
Object obj2;
if (i != lI) {
obj2 = 1;
} else {
obj2 = null;
}
com.google.android.exoplayer2.source.b.a.a.a aVar3 = cVar.ata[lI];
e.a aVar4 = (e.a) cVar.atb.avA.get(aVar3);
if (aVar4.avL != null) {
long elapsedRealtime = SystemClock.elapsedRealtime();
long max = Math.max(30000, com.google.android.exoplayer2.b.n(aVar4.avL.aet));
if (aVar4.avL.auM || aVar4.avL.auF == 2 || aVar4.avL.auF == 1 || max + aVar4.avM > elapsedRealtime) {
long j3;
obj = 1;
if (obj != null) {
bVar.atq = aVar3;
cVar.ath = aVar3;
} else {
int a;
int i2;
com.google.android.exoplayer2.source.b.a.b bVar2;
com.google.android.exoplayer2.source.b.a.a.a aVar5;
int i3;
com.google.android.exoplayer2.source.b.a.b c = cVar.atb.c(aVar3);
cVar.ati = c.auL;
if (fVar == null || obj2 != null) {
if (fVar != null) {
j = cVar.ati ? fVar.asO : fVar.asN;
}
if (c.auM || j < c.lf()) {
com.google.android.exoplayer2.source.b.a.b bVar3;
List list = c.auP;
Object valueOf = Long.valueOf(j - c.asN);
z = !cVar.atb.avH || fVar == null;
a = t.a(list, valueOf, z) + c.auJ;
if (a >= c.auJ || fVar == null) {
bVar3 = c;
i = lI;
} else {
com.google.android.exoplayer2.source.b.a.a.a aVar6 = cVar.ata[i];
bVar3 = cVar.atb.c(aVar6);
a = fVar.asQ + 1;
aVar3 = aVar6;
}
i2 = a;
bVar2 = bVar3;
aVar5 = aVar3;
i3 = i;
} else {
i2 = c.auJ + c.auP.size();
bVar2 = c;
aVar5 = aVar3;
i3 = lI;
}
} else {
i2 = fVar.asQ + 1;
bVar2 = c;
aVar5 = aVar3;
i3 = lI;
}
if (i2 < bVar2.auJ) {
cVar.atg = new com.google.android.exoplayer2.source.b();
} else {
a = i2 - bVar2.auJ;
if (a < bVar2.auP.size()) {
i iVar;
q qVar;
com.google.android.exoplayer2.source.b.a.b.a aVar7 = (com.google.android.exoplayer2.source.b.a.b.a) bVar2.auP.get(a);
if (aVar7.amj) {
Uri k = s.k(bVar2.auW, aVar7.auS);
if (!k.equals(cVar.atj)) {
bVar.ato = new c.a(cVar.asY, new i(k, (byte) 0), cVar.ata[i3].aep, cVar.atl.kW(), cVar.atl.kX(), cVar.atf, aVar7.auT);
} else if (!t.i(aVar7.auT, cVar.atk)) {
cVar.a(k, aVar7.auT, cVar.aiS);
}
} else {
cVar.atj = null;
cVar.aiS = null;
cVar.atk = null;
cVar.asU = null;
}
com.google.android.exoplayer2.source.b.a.b.a aVar8 = bVar2.auO;
if (aVar8 != null) {
iVar = new i(s.k(bVar2.auW, aVar8.url), aVar8.auU, aVar8.auV);
} else {
iVar = null;
}
j3 = bVar2.asN + aVar7.auR;
int i4 = bVar2.auI + aVar7.auQ;
k kVar = cVar.asZ;
q qVar2 = (q) kVar.aux.get(i4);
if (qVar2 == null) {
q qVar3 = new q(Long.MAX_VALUE);
kVar.aux.put(i4, qVar3);
} else {
qVar = qVar2;
}
bVar.ato = new f(cVar.asX, new i(s.k(bVar2.auW, aVar7.url), aVar7.auU, aVar7.auV), iVar, aVar5, cVar.atd, cVar.atl.kW(), cVar.atl.kX(), j3, j3 + aVar7.aet, i2, i4, cVar.ate, qVar, fVar, cVar.aiS, cVar.asU);
} else if (bVar2.auM) {
bVar.atp = true;
} else {
bVar.atq = aVar5;
cVar.ath = aVar5;
}
}
}
z = this.aue.atp;
aVar = this.aue.ato;
aVar2 = this.aue.atq;
this.aue.clear();
if (z) {
this.aus = -9223372036854775807L;
this.auv = true;
return true;
} else if (aVar == null) {
if (aVar2 != null) {
this.aua.a(aVar2);
}
return false;
} else {
if (aVar instanceof f) {
this.aus = -9223372036854775807L;
f fVar2 = (f) aVar;
fVar2.atL = this;
int i5 = fVar2.uid;
boolean z2 = fVar2.atC;
this.aum = i5;
for (h hVar : this.auh) {
hVar.asn.ask = i5;
}
if (z2) {
for (h hVar2 : this.auh) {
hVar2.asw = true;
}
}
this.auf.add(fVar2);
}
long a2 = this.aud.a(aVar, this, this.atO);
com.google.android.exoplayer2.source.a.a aVar9 = this.atP;
i iVar2 = aVar.asJ;
int i6 = aVar.type;
int i7 = this.aci;
Format format = aVar.asK;
int i8 = aVar.asL;
Object obj3 = aVar.asM;
max = aVar.asN;
j3 = aVar.asO;
if (aVar9.aru != null) {
aVar9.handler.post(new a$a$1(aVar9, iVar2, i6, i7, format, i8, obj3, max, j3, a2));
}
return true;
}
}
}
obj = null;
if (obj != null) {
int a3;
int i22;
com.google.android.exoplayer2.source.b.a.b bVar22;
com.google.android.exoplayer2.source.b.a.a.a aVar52;
int i32;
com.google.android.exoplayer2.source.b.a.b c2 = cVar.atb.c(aVar3);
cVar.ati = c2.auL;
if (fVar == null || obj2 != null) {
if (fVar != null) {
j = cVar.ati ? fVar.asO : fVar.asN;
}
if (c2.auM || j < c2.lf()) {
com.google.android.exoplayer2.source.b.a.b bVar32;
List list2 = c2.auP;
Object valueOf2 = Long.valueOf(j - c2.asN);
z = !cVar.atb.avH || fVar == null;
a3 = t.a(list2, valueOf2, z) + c2.auJ;
if (a3 >= c2.auJ || fVar == null) {
bVar32 = c2;
i = lI;
} else {
com.google.android.exoplayer2.source.b.a.a.a aVar62 = cVar.ata[i];
bVar32 = cVar.atb.c(aVar62);
a3 = fVar.asQ + 1;
aVar3 = aVar62;
}
i22 = a3;
bVar22 = bVar32;
aVar52 = aVar3;
i32 = i;
} else {
i22 = c2.auJ + c2.auP.size();
bVar22 = c2;
aVar52 = aVar3;
i32 = lI;
}
} else {
i22 = fVar.asQ + 1;
bVar22 = c2;
aVar52 = aVar3;
i32 = lI;
}
if (i22 < bVar22.auJ) {
cVar.atg = new com.google.android.exoplayer2.source.b();
} else {
a3 = i22 - bVar22.auJ;
if (a3 < bVar22.auP.size()) {
i iVar3;
q qVar4;
com.google.android.exoplayer2.source.b.a.b.a aVar72 = (com.google.android.exoplayer2.source.b.a.b.a) bVar22.auP.get(a3);
if (aVar72.amj) {
Uri k2 = s.k(bVar22.auW, aVar72.auS);
if (!k2.equals(cVar.atj)) {
bVar.ato = new c.a(cVar.asY, new i(k2, (byte) 0), cVar.ata[i32].aep, cVar.atl.kW(), cVar.atl.kX(), cVar.atf, aVar72.auT);
} else if (!t.i(aVar72.auT, cVar.atk)) {
cVar.a(k2, aVar72.auT, cVar.aiS);
}
} else {
cVar.atj = null;
cVar.aiS = null;
cVar.atk = null;
cVar.asU = null;
}
com.google.android.exoplayer2.source.b.a.b.a aVar82 = bVar22.auO;
if (aVar82 != null) {
iVar3 = new i(s.k(bVar22.auW, aVar82.url), aVar82.auU, aVar82.auV);
} else {
iVar3 = null;
}
j3 = bVar22.asN + aVar72.auR;
int i42 = bVar22.auI + aVar72.auQ;
k kVar2 = cVar.asZ;
q qVar22 = (q) kVar2.aux.get(i42);
if (qVar22 == null) {
q qVar32 = new q(Long.MAX_VALUE);
kVar2.aux.put(i42, qVar32);
} else {
qVar4 = qVar22;
}
bVar.ato = new f(cVar.asX, new i(s.k(bVar22.auW, aVar72.url), aVar72.auU, aVar72.auV), iVar3, aVar52, cVar.atd, cVar.atl.kW(), cVar.atl.kX(), j3, j3 + aVar72.aet, i22, i42, cVar.ate, qVar4, fVar, cVar.aiS, cVar.asU);
} else if (bVar22.auM) {
bVar.atp = true;
} else {
bVar.atq = aVar52;
cVar.ath = aVar52;
}
}
} else {
bVar.atq = aVar3;
cVar.ath = aVar3;
}
z = this.aue.atp;
aVar = this.aue.ato;
aVar2 = this.aue.atq;
this.aue.clear();
if (z) {
this.aus = -9223372036854775807L;
this.auv = true;
return true;
} else if (aVar == null) {
if (aVar2 != null) {
this.aua.a(aVar2);
}
return false;
} else {
if (aVar instanceof f) {
this.aus = -9223372036854775807L;
f fVar22 = (f) aVar;
fVar22.atL = this;
int i52 = fVar22.uid;
boolean z22 = fVar22.atC;
this.aum = i52;
for (h hVar3 : this.auh) {
hVar3.asn.ask = i52;
}
if (z22) {
for (h hVar22 : this.auh) {
hVar22.asw = true;
}
}
this.auf.add(fVar22);
}
long a22 = this.aud.a(aVar, this, this.atO);
com.google.android.exoplayer2.source.a.a aVar92 = this.atP;
i iVar22 = aVar.asJ;
int i62 = aVar.type;
int i72 = this.aci;
Format format2 = aVar.asK;
int i82 = aVar.asL;
Object obj32 = aVar.asM;
max = aVar.asN;
j3 = aVar.asO;
if (aVar92.aru != null) {
aVar92.handler.post(new a$a$1(aVar92, iVar22, i62, i72, format2, i82, obj32, max, j3, a22));
}
return true;
}
}
public final long kB() {
if (le()) {
return this.aus;
}
return this.auv ? Long.MIN_VALUE : ((f) this.auf.getLast()).asO;
}
/* renamed from: cL */
public final h cp(int i) {
int length = this.auh.length;
for (int i2 = 0; i2 < length; i2++) {
if (this.aui[i2] == i) {
return this.auh[i2];
}
}
h hVar = new h(this.asl);
hVar.asx = this;
this.aui = Arrays.copyOf(this.aui, length + 1);
this.aui[length] = i;
this.auh = (h[]) Arrays.copyOf(this.auh, length + 1);
this.auh[length] = hVar;
return hVar;
}
public final void jU() {
this.auj = true;
this.handler.post(this.aug);
}
public final void kO() {
this.handler.post(this.aug);
}
final void ld() {
if (!this.released && !this.adE && this.auj) {
h[] hVarArr = this.auh;
int length = hVarArr.length;
int i = 0;
while (i < length) {
if (hVarArr[i].asn.kH() != null) {
i++;
} else {
return;
}
}
int length2 = this.auh.length;
int i2 = 0;
i = -1;
boolean z = false;
while (i2 < length2) {
String str = this.auh[i2].asn.kH().adW;
boolean z2 = com.google.android.exoplayer2.i.g.au(str) ? true : com.google.android.exoplayer2.i.g.at(str) ? true : com.google.android.exoplayer2.i.g.av(str);
if (z2 > z) {
i = i2;
} else if (z2 != z || i == -1) {
z2 = z;
} else {
i = -1;
z2 = z;
}
i2++;
z = z2;
}
l lVar = this.aub.atc;
int i3 = lVar.length;
this.aun = -1;
this.aup = new boolean[length2];
this.auq = new boolean[length2];
l[] lVarArr = new l[length2];
for (int i4 = 0; i4 < length2; i4++) {
Format kH = this.auh[i4].asn.kH();
String str2 = kH.adW;
boolean z3 = com.google.android.exoplayer2.i.g.au(str2) || com.google.android.exoplayer2.i.g.at(str2);
this.auq[i4] = z3;
this.auo = z3 | this.auo;
if (i4 == i) {
Format[] formatArr = new Format[i3];
for (i2 = 0; i2 < i3; i2++) {
formatArr[i2] = a(lVar.asb[i2], kH);
}
lVarArr[i4] = new l(formatArr);
this.aun = i4;
} else {
Format format = (z && com.google.android.exoplayer2.i.g.at(kH.adW)) ? this.auc : null;
lVarArr[i4] = new l(a(format, kH));
}
}
this.acW = new m(lVarArr);
this.adE = true;
this.aua.iy();
}
}
final void q(int i, boolean z) {
int i2 = 1;
com.google.android.exoplayer2.i.a.ap(this.aup[i] != z);
this.aup[i] = z;
int i3 = this.auk;
if (!z) {
i2 = -1;
}
this.auk = i3 + i2;
}
private static Format a(Format format, Format format2) {
if (format == null) {
return format2;
}
String str = null;
int ax = com.google.android.exoplayer2.i.g.ax(format2.adW);
if (ax == 1) {
str = i(format.adT, 1);
} else if (ax == 2) {
str = i(format.adT, 2);
}
return new Format(format.id, format2.adV, format2.adW, str, format.bitrate, format2.adX, format.width, format.height, format2.aea, format2.aeb, format2.aec, format2.aee, format2.aed, format2.aef, format2.aeg, format2.sampleRate, format2.aeh, format2.aei, format2.aej, format.ael, format.aem, format2.aen, format2.aek, format2.adY, format2.adZ, format2.adU);
}
final boolean le() {
return this.aus != -9223372036854775807L;
}
private static String i(String str, int i) {
if (TextUtils.isEmpty(str)) {
return null;
}
String[] split = str.split("(\\s*,\\s*)|(\\s*$)");
StringBuilder stringBuilder = new StringBuilder();
for (String str2 : split) {
if (i == com.google.android.exoplayer2.i.g.ax(com.google.android.exoplayer2.i.g.aw(str2))) {
if (stringBuilder.length() > 0) {
stringBuilder.append(",");
}
stringBuilder.append(str2);
}
}
if (stringBuilder.length() > 0) {
return stringBuilder.toString();
}
return null;
}
}
|
package com.prokarma.reference.architecture.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Seatmap {
@SerializedName("staticUrl")
@Expose
public String staticUrl;
} |
package br.com.opensig.financeiro.server.cobranca;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import org.jboleto.Banco;
import br.com.opensig.core.client.UtilClient;
import br.com.opensig.core.client.controlador.filtro.ECompara;
import br.com.opensig.core.client.controlador.filtro.EJuncao;
import br.com.opensig.core.client.controlador.filtro.FiltroData;
import br.com.opensig.core.client.controlador.filtro.FiltroNumero;
import br.com.opensig.core.client.controlador.filtro.FiltroTexto;
import br.com.opensig.core.client.controlador.filtro.GrupoFiltro;
import br.com.opensig.core.client.controlador.filtro.IFiltro;
import br.com.opensig.core.server.CoreServiceImpl;
import br.com.opensig.core.server.UtilServer;
import br.com.opensig.core.shared.modelo.Lista;
import br.com.opensig.empresa.shared.modelo.EmpEndereco;
import br.com.opensig.empresa.shared.modelo.EmpEntidade;
import br.com.opensig.financeiro.client.servico.FinanceiroException;
import br.com.opensig.financeiro.shared.modelo.FinConta;
import br.com.opensig.financeiro.shared.modelo.FinRecebimento;
import br.com.opensig.financeiro.shared.modelo.FinRemessa;
import br.com.opensig.financeiro.shared.modelo.FinRetorno;
public class BancoBrasil extends ACobranca {
private Date hoje;
public BancoBrasil(FinConta conta) {
super(conta, Banco.BANCO_DO_BRASIL);
hoje = new Date();
}
public Boolean remessa(FinRemessa rem) throws FinanceiroException {
try {
StringBuffer sb = new StringBuffer();
// filtros
FiltroTexto ft = new FiltroTexto("finForma.finFormaDescricao", ECompara.IGUAL, auth.getConf().get("txtBoleto").toUpperCase());
FiltroTexto ft1 = new FiltroTexto("finRecebimentoStatus", ECompara.IGUAL, auth.getConf().get("txtAberto").toUpperCase());
FiltroData dt1 = new FiltroData("finRecebimentoCadastro", ECompara.MAIOR_IGUAL, rem.getFinRemessaDatade());
FiltroData dt2 = new FiltroData("finRecebimentoCadastro", ECompara.MENOR_IGUAL, rem.getFinRemessaDataate());
GrupoFiltro gf = new GrupoFiltro(EJuncao.E, new IFiltro[] { ft, ft1, dt1, dt2 });
// Recuperando os boletos
CoreServiceImpl<FinRecebimento> persistencia = new CoreServiceImpl<FinRecebimento>();
Lista<FinRecebimento> lista = persistencia.selecionar(new FinRecebimento(), 0, 0, gf, false);
double total = 0.00;
int regs = 1;
// Registro Header do arquivo
sb.append(getHeaderArquivo() + "\n");
// Registro Header de lote
sb.append(getHeaderLote() + "\n");
// Registro Detalhe
for (FinRecebimento fin : lista.getLista()) {
total += fin.getFinRecebimentoValor();
// Segmento P
sb.append(getSegmentoP(fin, regs) + "\n");
// Segmento Q
sb.append(getSegmentoQ(fin, regs) + "\n");
regs++;
}
regs--;
// Registro Trailer de lote
sb.append(getTrailerLote(regs) + "\n");
// Registro Trailer de arquivo
sb.append(getTrailerArquivo(regs));
if (regs > 0) {
rem.setFinRemessaCadastro(hoje);
rem.setFinRemessaQuantidade(regs);
rem.setFinRemessaValor(total);
rem.setFinRemessaArquivo(UtilServer.normaliza(sb.toString()));
// salvando
CoreServiceImpl<FinRemessa> persistencia2 = new CoreServiceImpl<FinRemessa>();
persistencia2.salvar(rem);
return true;
} else {
return false;
}
} catch (Exception e) {
UtilServer.LOG.error("Erro ao gerar a remessa", e);
throw new FinanceiroException(e.getMessage());
}
}
public String[][] retorno(FinRetorno ret) throws FinanceiroException {
// seta as variaveis
Collection<String[]> validos = new ArrayList<String[]>();
String[] linhas = ret.getFinRetornoArquivo().split("\n");
try {
// percorre as linhas, pulando os header e trailer
for (int i = 2; i < linhas.length - 2; i += 2) {
validos.add(getRecebimento(linhas[i], linhas[i + 1]));
}
} catch (Exception e) {
throw new FinanceiroException(e.getMessage());
}
// caso nenhum seja valido
if (validos.isEmpty()) {
UtilServer.LOG.debug("Erro ao gerar o retorno");
throw new FinanceiroException("Erro ao gerar o retorno");
}
return validos.toArray(new String[][] {});
}
private String getHeaderArquivo() {
StringBuffer sb = new StringBuffer();
try {
// CODIGO DO BANCO NA COMPENSACAO
sb.append(conta.getFinBanco().getFinBancoNumero());
// LOTE DE SERVICO
sb.append("0000");
// REGISTRO HEADER DE ARQUIVO
sb.append("0");
// USO EXCLUSIVO FEBRABAN/CNAB
sb.append(UtilServer.formataTexto("", " ", 9, true));
// TIPO DE INSCRICAO DA EMPRESA
sb.append("2");
// N DE INSCRICAO DA EMPRESA
String cnpj = conta.getEmpEmpresa().getEmpEntidade().getEmpEntidadeDocumento1().replaceAll("\\D", "");
sb.append(UtilServer.formataTexto(cnpj, "0", 14, false));
// CODIGO DO CONVENIO NO BANCO
String convenio = UtilServer.formataTexto(conta.getFinContaConvenio(), "0", 9, false);
String produto = "0014";
String carteira = conta.getFinContaCarteira();
String variacao = "019";
sb.append(UtilServer.formataTexto(convenio + produto + carteira + variacao, " ", 20, true));
// AGENCIA MANTENEDORA DA CONTA E DV
String agencia = conta.getFinContaAgencia().replaceAll("\\D", "");
sb.append(UtilServer.formataTexto(agencia, "0", 6, false));
// NUMERO DA CONTA CORRENTE
String cc = conta.getFinContaNumero().replaceAll("\\D", "");
sb.append(UtilServer.formataTexto(cc, "0", 13, false));
// DIGITO VERIFICADOR DA AG/CONTA
sb.append(" ");
// NOME DA EMPRESA
sb.append(limitaTamanho(conta.getEmpEmpresa().getEmpEntidade().getEmpEntidadeNome1(), 30));
// NOME DO BANCO
sb.append(limitaTamanho(conta.getFinBanco().getFinBancoDescricao(), 30));
// USO EXCLUSIVO FEBRABAN/CNAB
sb.append(UtilServer.formataTexto("", " ", 10, true));
// CODIGO REMESSA / RETORNO
sb.append("1");
// DATA DE GERACAO DO ARQUIVO
sb.append(UtilServer.formataData(hoje, "ddMMyyyy"));
// HORA DE GERACAO DO ARQUIVO
sb.append(UtilServer.formataData(hoje, "HHmmss"));
// N SEQUENCIAL DO ARQUIVO
sb.append("000001");
// N DA VERSAO DO LAYOUT DO ARQUIVO
sb.append("030");
// DENSIDADE DE GRAVACAO DO ARQUIVO
sb.append("00000");
// PARA USO RESERVADO DO BANCO
sb.append(UtilServer.formataTexto("", " ", 20, true));
// PARA USO RESERVADO DA EMPRESA
sb.append(UtilServer.formataTexto("", " ", 20, true));
// USO EXCLUSIVO FEBRABAN/CNAB
sb.append(UtilServer.formataTexto("", " ", 11, true));
// IDENTIFICACAO COBRANCA S/PAPEL
sb.append(" ");
// USO EXCLUSIVO DAS VANS
sb.append("000");
// TIPO DE SERVICO
sb.append(" ");
// CODIGOS DAS OCORRENCIAS
sb.append(UtilServer.formataTexto("", " ", 10, true));
} catch (Exception e) {
UtilServer.LOG.error("Erro ao gerar o headerArquivo", e);
}
return sb.toString();
}
private String getHeaderLote() {
StringBuffer sb = new StringBuffer();
try {
// CODIGO DO BANCO NA COMPENSACAO
sb.append(conta.getFinBanco().getFinBancoNumero());
// LOTE DE SERVICO
sb.append("0001");
// REGISTRO HEADER DO LOTE
sb.append("1");
// TIPO DE OPERACAO
sb.append("R");
// TIPO DE SERVICO
sb.append("01");
// FORMA DE LANCAMENTO
sb.append("00");
// N DA VERSAO DO LAYOUT DO LOTE
sb.append("020");
// USO EXCLUSIVO FEBRABAN/CNAB
sb.append(" ");
// TIPO DE INSCRICAO DA EMPRESA
sb.append("2");
// N DE INSCRICAO DA EMPRESA
String cnpj = conta.getEmpEmpresa().getEmpEntidade().getEmpEntidadeDocumento1().replaceAll("\\D", "");
sb.append(UtilServer.formataTexto(cnpj, "0", 15, false));
// CODIGO DO CONVENIO NO BANCO
String convenio = UtilServer.formataTexto(conta.getFinContaConvenio(), "0", 9, false);
String produto = "0014"; // cedente
String carteira = conta.getFinContaCarteira();
String variacao = "019";
sb.append(UtilServer.formataTexto(convenio + produto + carteira + variacao, " ", 20, true));
// AGENCIA MANTENEDORA DA CONTA E DV
String agencia = conta.getFinContaAgencia().replaceAll("\\D", "");
sb.append(UtilServer.formataTexto(agencia, "0", 6, false));
// NUMERO DA CONTA CORRENTE
String cc = conta.getFinContaNumero().replaceAll("\\D", "");
sb.append(UtilServer.formataTexto(cc, "0", 13, false));
// DIGITO VERIFICADOR DA AG/CONTA
sb.append(" ");
// NOME DA EMPRESA
sb.append(limitaTamanho(conta.getEmpEmpresa().getEmpEntidade().getEmpEntidadeNome1(), 30));
// MENSAGEM 1
sb.append(limitaTamanho(auth.getConf().get("boleto.instrucao1"), 40));
// MENSAGEM 2
sb.append(limitaTamanho(auth.getConf().get("boleto.instrucao2"), 40));
// NUMERO REMESSA/RETORNO
sb.append(UtilServer.formataTexto("", "0", 8, true));
// DATA DE GRAVACAO REMESSA/RETORNO
sb.append(UtilServer.formataData(hoje, "ddMMyyyy"));
// DATA DO CREDITO
sb.append(UtilServer.formataData(hoje, "ddMMyyyy"));
// USO EXCLUSIVO FEBRABAN/CNAB
sb.append(UtilServer.formataTexto("", " ", 33, true));
} catch (Exception e) {
UtilServer.LOG.error("Erro ao gerar o headerLote", e);
}
return sb.toString();
}
private String getSegmentoP(FinRecebimento bol, int reg) {
StringBuffer sb = new StringBuffer();
try {
// CODIGO DO BANCO NA COMPENSACAO
sb.append(conta.getFinBanco().getFinBancoNumero());
// LOTE DE SERVICO
sb.append("0001");
// REGISTRO DETALHE
sb.append("3");
// N SEQUENCIAL DO REG. NO LOTE
sb.append(UtilServer.formataTexto(reg + "", "0", 5, false));
// COD. SEGMENTO DO REG. DETALHE
sb.append("P");
// USO EXCLUSIVO FEBRABAN/CNAB
sb.append(" ");
// CODIGO DE MOVIMENTO
sb.append("01");
// AGENCIA MANTENEDORA DA CONTA E DV
String agencia = conta.getFinContaAgencia().replaceAll("\\D", "");
sb.append(UtilServer.formataTexto(agencia, "0", 6, false));
// NUMERO DA CONTA CORRENTE
String cc = conta.getFinContaNumero().replaceAll("\\D", "");
sb.append(UtilServer.formataTexto(cc, "0", 13, false));
// DIGITO VERIFICADOR DA AG/CONTA
sb.append(" ");
// IDENTIFICACAO DO TITULO NO BANCO
String convenio = UtilServer.formataTexto(conta.getFinContaConvenio(), "0", 7, false);
String sequencial = UtilServer.formataTexto(bol.getFinRecebimentoId() + "", "0", 10, false);
sb.append(convenio + sequencial + " ");
// CODIGO DA CARTEIRA
sb.append("7");
// FORMA DE CADASTRAMENTO DO TITULO
sb.append("1");
// TIPO DE DOCUMENTO
sb.append("1");
// IDENTIFICAO DA EMISSAO DO BLOQUETO
sb.append("2");
// IDENTIFICACAO DA DISTRIBUICAO
sb.append("2");
// NUMERO DO DOCUMENTO DE COBRANCA
sb.append(limitaTamanho(bol.getFinRecebimentoDocumento() + bol.getFinRecebimentoParcela(), 15));
// DATA DE VENCIMENTO DO TITULO
sb.append(UtilServer.formataData(bol.getFinRecebimentoVencimento(), "ddMMyyyy"));
// VALOR NOMINAL DO TITULO
String valor = UtilServer.formataNumero(bol.getFinRecebimentoValor(), 13, 2, false).replaceAll("\\D", "");
sb.append(valor);
// AGENCIA ENCARREGADA DA COBRANCA
sb.append("00000");
// DIGITO VERIFICADOR DA AGENCIA
sb.append(" ");
// ESPECIE DO TITULO
sb.append("02");
// IDENTIFICACAO DE TITULO ACEITO/NAO ACEITE
sb.append("N");
// DATA DA EMISSAO DO TITULO
sb.append(UtilServer.formataData(hoje, "ddMMyyyy"));
// CODIGO DO JUROS DE MORA
sb.append("1");
// DATA DO JUROS DE MORA
sb.append(UtilServer.formataData(bol.getFinRecebimentoVencimento(), "ddMMyyyy"));
// JUROS DE MORA POR DIA/TAXA
sb.append(UtilServer.formataTexto("500", "0", 15, false));
// CODIGO DO DESCONTO 1
sb.append("0");
// DATA DO DESCONTO 1
sb.append(UtilServer.formataTexto("", "0", 8, false));
// VALOR/PERCENTUAL A SER CONCEDIDO
sb.append(UtilServer.formataTexto("", "0", 15, false));
// VALOR DO IOF A SER RECOLHIDO
sb.append(UtilServer.formataTexto("", "0", 15, false));
// VALOR DO ABATIMENTO
sb.append(UtilServer.formataTexto("", "0", 15, false));
// IDENTIFICACAO DO TIT. NA EMPRESA
sb.append(UtilServer.formataTexto(bol.getFinRecebimentoId() + "", "0", 25, false));
// CODIGO PARA PROTESTO
sb.append("2");
// NUMERO DE DIAS PARA PROTESTO
sb.append("03");
// CODIGO PARA BAIXA/DEVOLUCAO
sb.append("0");
// NUMERO DE DIAS PARA BAIXA/DEVOLUCAO
sb.append("000");
// CODIGO DA MOEDA
sb.append("09");
// N. DO CONTR. DA OPERACAO D CRED
sb.append(UtilServer.formataTexto("", "0", 10, false));
// USO EXCLUSIVO FEBRABAN/CNAB
sb.append(" ");
} catch (Exception e) {
UtilServer.LOG.error("Erro ao gerar o segmentoP", e);
}
return sb.toString();
}
private String getSegmentoQ(FinRecebimento bol, int reg) {
StringBuffer sb = new StringBuffer();
EmpEntidade cedente = bol.getFinReceber().getEmpEntidade();
EmpEndereco ende = cedente.getEmpEnderecos().get(0);
try {
// CODIGO DO BANCO NA COMPENSACAO
sb.append(conta.getFinBanco().getFinBancoNumero());
// LOTE DE SERVICO
sb.append("0001");
// REGISTRO DETALHE
sb.append("3");
// N SEQUENCIAL DO REG. NO LOTE
sb.append(UtilServer.formataTexto(reg + "", "0", 5, false));
// COD. SEGMENTO DO REG. DETALHE
sb.append("Q");
// USO EXCLUSIVO FEBRABAN/CNAB
sb.append(" ");
// CODIGO DE MOVIMENTO
sb.append("01");
// TIPO DE INSCRICAO
sb.append("2");
// NUMERO DE INSCRICAO
String cnpj = cedente.getEmpEntidadeDocumento1().replaceAll("\\D", "");
sb.append(UtilServer.formataTexto(cnpj, "0", 15, false));
// NOME
sb.append(limitaTamanho(cedente.getEmpEntidadeNome1(), 40));
// ENDERECO
sb.append(limitaTamanho(ende.getEmpEnderecoLogradouro(), 40));
// BAIRRO
sb.append(limitaTamanho(ende.getEmpEnderecoBairro(), 15));
// CEP
sb.append(ende.getEmpEnderecoCep().substring(0, 5));
// SUFIXO DO CEP
sb.append(ende.getEmpEnderecoCep().substring(6, 9));
// CIDADE
sb.append(limitaTamanho(ende.getEmpMunicipio().getEmpMunicipioDescricao(), 15));
// UNIDADE DA FEDERACAO
sb.append(ende.getEmpMunicipio().getEmpEstado().getEmpEstadoSigla());
// TIPO DE INSCRICAO
sb.append("0");
// NUMERO DE INSCRICAO
sb.append(UtilServer.formataTexto("", "0", 15, false));
// NOME DO SACADOR/AVALISTA
sb.append(UtilServer.formataTexto("", " ", 40, true));
// COD. BCO CORRESP. NA COMPENSACA
sb.append("000");
// NOSSO NUM. NO BCO CORRESPONDENT
sb.append(UtilServer.formataTexto("", " ", 20, true));
// USO EXCLUSIVO FEBRABAN/CNAB
sb.append(UtilServer.formataTexto("", " ", 8, true));
} catch (Exception e) {
UtilServer.LOG.error("Erro ao gerar o segmentoQ", e);
}
return sb.toString();
}
private String getTrailerLote(int reg) {
StringBuffer sb = new StringBuffer();
try {
// CODIGO DO BANCO NA COMPENSACAO
sb.append(conta.getFinBanco().getFinBancoNumero());
// LOTE DE SERVICO
sb.append("0001");
// REGISTRO TRAILER DO LOTE
sb.append("5");
// USO EXCLUSIVO FEBRABAN/CNAB
sb.append(UtilServer.formataTexto("", " ", 9, true));
// QUANTIDADE DE REGISTROS DO LOTE
sb.append(UtilServer.formataTexto((reg * 2 + 2) + "", "0", 6, false));
// QUANTIDADE DE TIT. EM COBRANCA
sb.append(UtilServer.formataTexto("", "0", 6, false));
// VALOR TOT. DOS TIT. EM CARTEIRA
sb.append(UtilServer.formataTexto("", "0", 17, false));
// QUANTIDADE DE TIT. EM COBRANCA
sb.append(UtilServer.formataTexto("", "0", 6, false));
// VALOR TOT DOS TIT. EM CARTEIRAS
sb.append(UtilServer.formataTexto("", "0", 17, false));
// QUANTIDADE DE TIT. EM COBRANCA
sb.append(UtilServer.formataTexto("", "0", 6, false));
// VALOR TOT DOS TIT. EM CARTEIRAS
sb.append(UtilServer.formataTexto("", "0", 17, false));
// QUANTIDADE DE TIT. EM COBRANCA
sb.append(UtilServer.formataTexto("", "0", 6, false));
// VALOR TOT DOS TIT. EM CARTEIRAS
sb.append(UtilServer.formataTexto("", "0", 17, false));
// NUMERO DO AVISO DE LANCAMENTO
sb.append(UtilServer.formataTexto("", " ", 8, true));
// USO EXCLUSIVO FEBRABAN/CNAB
sb.append(UtilServer.formataTexto("", " ", 117, true));
} catch (Exception e) {
UtilServer.LOG.error("Erro ao gerar o trailerLote", e);
}
return sb.toString();
}
private String getTrailerArquivo(int reg) {
StringBuffer sb = new StringBuffer();
try {
// CODIGO DO BANCO NA COMPENSACAO
sb.append(conta.getFinBanco().getFinBancoNumero());
// LOTE DE SERVICO
sb.append("9999");
// REGISTRO TRAILER DE ARQUIVO
sb.append("9");
// USO EXCLUSIVO FEBRABAN/CNAB
sb.append(UtilServer.formataTexto("", " ", 9, true));
// QUANTID. DE LOTES DO ARQUIVO
sb.append(UtilServer.formataTexto("1", "0", 6, false));
// QUANTID. DE REGISTROS DO ARQUIVO
sb.append(UtilServer.formataTexto((reg * 2 + 4) + "", "0", 6, false));
// QTDADE DE CONTAS P/CONC.- LOTES
sb.append(UtilServer.formataTexto("1", "0", 6, false));
// USO EXCLUSIVO FEBRABAN/CNAB
sb.append(UtilServer.formataTexto("", " ", 205, true));
} catch (Exception e) {
UtilServer.LOG.error("Erro ao gerar o trailerArquivo", e);
}
return sb.toString();
}
private String[] getRecebimento(String seguimentoT, String seguimentoU) throws Exception {
int id;
double vl;
Date dtRealizado;
Date dtConciliado;
String status = "1";
// NUMERO DO DOCUMENTO DE COBRANCA
try {
String finRecebimentoId = seguimentoT.substring(58, 73);
id = Integer.valueOf(finRecebimentoId);
} catch (Exception e) {
id = 0;
status = "0";
}
// VALOR PAGO PELO SACADO
try {
String valor = seguimentoU.substring(78, 90) + "." + seguimentoU.substring(90, 92);
vl = Double.valueOf(valor);
} catch (Exception e) {
vl = 0.00;
status = "0";
}
// DATA DA OCORRENCIA
try {
String data = seguimentoU.substring(137, 145);
dtRealizado = new SimpleDateFormat("ddMMyyyy").parse(data);
} catch (Exception e) {
dtRealizado = null;
status = "0";
}
// DATA DO CREDITO
try {
String data = seguimentoU.substring(146, 153);
dtConciliado = new SimpleDateFormat("ddMMyyyy").parse(data);
} catch (Exception e) {
dtConciliado = null;
status = "0";
}
// busca o recebimento no sistema
try {
FiltroNumero fn = new FiltroNumero("finRecebimentoId", ECompara.IGUAL, id);
CoreServiceImpl<FinRecebimento> persiste = new CoreServiceImpl<FinRecebimento>();
FinRecebimento fin = persiste.selecionar(new FinRecebimento(), fn, false);
return new String[] { fin.getFinRecebimentoId() + "", fin.getFinReceber().getEmpEntidade().getEmpEntidadeNome1(), fin.getFinRecebimentoDocumento(), vl + "",
fin.getFinRecebimentoParcela(), UtilClient.getDataGrid(fin.getFinRecebimentoVencimento()), fin.getFinRecebimentoStatus(), UtilClient.getDataGrid(dtRealizado),
UtilClient.getDataGrid(dtConciliado), fin.getFinRecebimentoStatus().equalsIgnoreCase(auth.getConf().get("txtAberto")) ? "0" : status, fin.getFinRecebimentoObservacao(),
fin.getFinReceber().getFinConta().getFinContaId() + "" };
} catch (Exception e) {
UtilServer.LOG.error("Erro ao produrar o recebimento", e);
return new String[] { id + "", "", "", vl + "", "", "", "0", UtilClient.getDataGrid(dtRealizado), "-1", seguimentoT, "0" };
}
}
}
|
package io.optioanl;
import java.io.*;
import java.util.Random;
public class FileRandomNumber {
public static void main(String[] args) {
File file = new File("IO/randomNumber.txt");
try {
file.createNewFile();
FileWriter writer = new FileWriter(file);
FileReader reader = new FileReader(file);
BufferedReader buffRedear = new BufferedReader(reader);
int i = 0;
while (i <= 10) {
int x =(int) (Math.random() * 50);
writer.write(Integer.toString(x) + "\n");
++i;
}
writer.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
package com.kodilla.kodillacoursecalculatormk;
public class Functions {
static public boolean checkIfNumber(String text) {
if ( text == null ) {
return false;
}
for (char c : text.toCharArray()) {
if ( Character.isDigit(c) == false ) {
return false;
}
}
return true;
}
}
|
package editor;
import javafx.scene.Group;
import javafx.geometry.VPos;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.control.ScrollBar;
import javafx.geometry.Orientation;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import java.util.Iterator;
/** Text editor layout render engine. */
public class Render {
private int WINDOW_WIDTH;
private int WINDOW_HEIGHT;
private int MAX_LINE_WIDTH;
private Group root;
private Group textRoot;
private TextBuffer text;
private Cursor c;
private ScrollBar sb;
private int fontSize = 12;
private static String fontName = "Verdana";
private int spaceIndex;
// To set the cursor initial height
private Text autoHeight;
public Render(final Group root, final Group textRoot, TextBuffer text, int window_width, int window_height) {
WINDOW_WIDTH = window_width;
WINDOW_HEIGHT = window_height;
autoHeight = new Text();
autoHeight.setTextOrigin(VPos.TOP);
autoHeight.setFont(Font.font(fontName, fontSize));
this.root = root;
this.textRoot = textRoot;
this.text = text;
this.spaceIndex = -1;
// Initialize the cursor
c = new Cursor();
c.setX(5);
c.setY(0);
c.setHeight(autoHeight.getLayoutBounds().getHeight());
textRoot.getChildren().add(c);
// Scroll bar part
// Make a vertical scroll bar on the right side of the screen.
sb = new ScrollBar();
sb.setOrientation(Orientation.VERTICAL);
// Set the height of the scroll bar so that it fills the whole window.
int usableScreenWidth = (int) (WINDOW_WIDTH - Math.round(sb.getLayoutBounds().getWidth()));
sb.setLayoutX(usableScreenWidth);
sb.setPrefHeight(window_height);
// Set the range of the scroll bar.
sb.setMin(0);
sb.setMax(0);
root.getChildren().add(sb);
// Scroll bar listener
// When the scroll bar changes position, change the content display.
sb.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observableValue, Number oldValue, Number newValue) {
Text lastWord = text.getLast();
int height = (int) (lastWord.getY() + Math.round(lastWord.getLayoutBounds().getHeight()));
// When scroll bar runs to the end, the last line of file is also in the bottom of the window,
// therefore, the total movement is (height - window_height) pixels.
// In addition, scroll bar height is equal to window_height,
// so the portion movement in scroll bar is equal to the real shift pixels divided by (height - window_height).
int shift = (int) ((double) newValue * (height - getWindowHeight()) / (double) getWindowHeight());
// Change the content display
textRoot.setLayoutY(-shift);
}
});
}
public void renderAll() {
MAX_LINE_WIDTH = (int) (WINDOW_WIDTH - 10 - Math.round(sb.getLayoutBounds().getWidth()));
renderContent();
renderCursor();
renderScrollBar();
}
public void renderContent() {
// Initialization part
Iterator<Text> curTextIterator = text.iterator();
Iterator<Text> prevTextIterator = text.iterator();
Text curText, prevText;
spaceIndex = -1;
int size = text.size();
int xPos;
// Set the text position.
for (int i = 0; i < size; i+=1) {
curText = curTextIterator.next();
// Set the first character font size and font family.
curText.setTextOrigin(VPos.TOP);
curText.setFont(Font.font(fontName, fontSize));
if (i == 0) {
// Display the text in a window with a top and bottom margin of 0,
// and a left and right margin of 5 pixels.
xPos = 5;
prevText = curText;
// Record the first charcter in first line y's position.
text.recordLine(0, 0);
} else {
prevText = prevTextIterator.next();
xPos = (int) (prevText.getX() + Math.round(prevText.getLayoutBounds().getWidth()));
}
if (curText.getText().equals(" ")) {
spaceIndex = i;
}
// If we add new character (exclude carriage/return character) and causes current position x in line over the window_width range,
// then it will trigger wrapping line event.
if (xPos + Math.round(curText.getLayoutBounds().getWidth()) > MAX_LINE_WIDTH
&& !curText.getText().equals(System.getProperty("line.separator"))) {
wrapLine(curText, i);
}
else if (prevText.getText().equals(System.getProperty("line.separator"))) {
// If the previous text is Enter (c/r) character, then we move into the next line.
curText.setX(5);
if (prevText == curText) {
// If we add the Enter node in the first (current) text of file.
curText.setY(0);
} else {
// The Enter node boundary height is twice than normal text, so we set it as autoheight.
curText.setY(prevText.getY() + Math.round(autoHeight.getLayoutBounds().getHeight()));
}
text.recordLine((int) curText.getY(), i);
} else {
curText.setX(xPos);
if (prevText == curText) {
// If the first (previous) text is Enter node and we remove it,
// then we need update the current position node to be the first text position.
curText.setY(0);
} else {
curText.setY((int) prevText.getY());
}
}
}
}
public void renderScrollBar() {
Text lastWord = text.getLast();
int bottomHeight = (int) (lastWord.getY() + Math.round(lastWord.getLayoutBounds().getHeight()));
if (bottomHeight > WINDOW_HEIGHT) {
sb.setMax(WINDOW_HEIGHT);
int curHeight = (int) (c.getY() + Math.round(autoHeight.getLayoutBounds().getHeight()));
if (curHeight + textRoot.getLayoutY() > WINDOW_HEIGHT) {
sb.setValue((double) (curHeight - WINDOW_HEIGHT) * WINDOW_HEIGHT / (double) (bottomHeight - WINDOW_HEIGHT));
} else if (c.getY() + textRoot.getLayoutY() < 0) {
sb.setValue(c.getY() * WINDOW_HEIGHT / (double) (bottomHeight - WINDOW_HEIGHT));
}
} else {
sb.setMax(0);
sb.setValue(0);
}
}
public void renderCursor() {
int curPos = text.getCurrentPos();
// Set the cursor position.
// The cursor will cover the first vertical line of pixels in current node.
if (curPos > 0) {
Text curText = text.get(curPos);
Text prevText = text.get(curPos - 1);
int cursorX = (int) (prevText.getX() + Math.round(prevText.getLayoutBounds().getWidth()));
if (curPos != text.size()) {
c.setX(curText.getX());
c.setY(curText.getY());
} else {
// Due to the Enter (c/r) is used to add at the end of line,
// if it is appended at the end of file, then the cursor need to adjust its position.
if (prevText.getText().equals(System.getProperty("line.separator"))) {
c.setX(5);
c.setY(prevText.getY() + Math.round(autoHeight.getLayoutBounds().getHeight()));
} else {
c.setX(cursorX);
c.setY(prevText.getY());
}
}
// Set the cursor height same as the previous text.
if (!prevText.getText().equals(System.getProperty("line.separator"))) {
c.setHeight(Math.round(prevText.getLayoutBounds().getHeight()));
}
} else {
c.setX(5);
c.setY(0);
}
}
// When wrapping line events happen, there are three possible situations that will trigger event.
// 1. Adding character in long word.
// 2. Adding character.
// 3. Adding whitespace.
// Wrapping line method will rearrange the current node x, y position.
public void wrapLine(Text curText, int curPos) {
int prevPos = curPos -1;
Text prevText = text.get(prevPos);
// spaceText is used to compare to the prevText to check whether these two in the same line.
Text spaceText = text.get(spaceIndex);
if (spaceIndex == -1 || (spaceText.getY() < prevText.getY() && !prevText.getText().equals(" ") && !curText.getText().equals(" "))) {
// If the long word is as long as the window_width, then the line should break in the middle of the word.
// For two cases:
// 1. long word beginning at the start of file.
// 2. long word generating in the middle of file. The last whitespace and added character is in different line.
curText.setX(5);
curText.setY((int) (prevText.getY() + Math.round(curText.getLayoutBounds().getHeight())));
text.recordLine((int) curText.getY(), curPos);
} else if (spaceText.getY() == prevText.getY() && !prevText.getText().equals(" ") && !curText.getText().equals(" ")) {
// If the normal length word is not finished in a line, then need to move to the next line.
// The last whitespace and added character is in the same line.
int lastWordPosInLine = spaceIndex + 1;
Iterator<Text> curTextIterator = text.iterator(lastWordPosInLine);
Iterator<Text> prevTextIterator = text.iterator(lastWordPosInLine);
Text curChar, prevChar;
// Setting the word's remaining characters position.
for (int j = lastWordPosInLine; j <= curPos; j += 1) {
curChar = curTextIterator.next();
if (j == lastWordPosInLine) {
curChar.setX(5);
curChar.setY((int) (curChar.getY() + Math.round(curChar.getLayoutBounds().getHeight())));
text.recordLine((int) curChar.getY(), lastWordPosInLine);
} else {
prevChar = prevTextIterator.next();
curChar.setX((int) (prevChar.getX() + Math.round(prevChar.getLayoutBounds().getWidth())));
curChar.setY((int) prevChar.getY());
}
}
} else if (spaceIndex == curPos || (!prevText.getText().equals(" ") && curText.getText().equals(" "))) {
// If whitespace is added and cause the break line event, then stay at the same line.
// Two cases: char + whitespace, whitespace + whitespace
curText.setX((int) (prevText.getX() + Math.round(prevText.getLayoutBounds().getWidth())));
curText.setY((int) prevText.getY());
} else if (prevText.getText().equals(" ") && !curText.getText().equals(" ")) {
// If the whitespace is the last word at the end of line,
// and cause the break line event after adding the new word,
// then reallocate the new word in the next line.
// Case: whitespace + char
curText.setX(5);
curText.setY((int) (prevText.getY() + Math.round(curText.getLayoutBounds().getHeight())));
text.recordLine((int) curText.getY(), curPos);
}
}
public void updateFont(int newFontSize) {
fontSize = newFontSize;
autoHeight.setFont(Font.font(fontName, newFontSize));
}
public void updateWindowWidth(double width) {
updateWindowSize(width, -1);
}
public void updateWindowHeight(double height) {
updateWindowSize(-1, height);
}
public void updateWindowSize(double width, double height) {
if (width < 0) {
WINDOW_HEIGHT = (int) height;
sb.setPrefHeight(WINDOW_HEIGHT);
sb.setMin(0);
} else if (height < 0) {
WINDOW_WIDTH = (int) width;
int usableScreenWidth = (int) (WINDOW_WIDTH - Math.round(sb.getLayoutBounds().getWidth()));
sb.setLayoutX(usableScreenWidth);
}
renderAll();
}
public int getFontSize() {
return fontSize;
}
public Text getAutoHeight() {
return autoHeight;
}
public int getWindowHeight() {
return WINDOW_HEIGHT;
}
public int getContentWidth() {
return MAX_LINE_WIDTH;
}
public Cursor getCursor() {
return c;
}
}
|
package logic;
import javafx.application.Platform;
/**
* The Invoker class is a utility class that runs a {@link Runnable} in a later time.
*/
public class Invoker {
/**
* The {@link Runnable} to be run.
*/
private final Runnable runnable;
/**
* The constructor of the Invoker class. Sets the {@link #runnable} field.
* @param runnable The {@link Runnable} to be run.
*/
public Invoker(Runnable runnable) {
this.runnable = runnable;
}
/**
* Runs the {@link #runnable} after the given amount of time.
* @param millis The delay before running the {@link #runnable}.
*/
public void startIn(long millis) {
new Thread(() -> {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
e.printStackTrace();
}
Platform.runLater(runnable);
}).start();
}
}
|
package com.ybh.front.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/")
public class StaticPageController {
// @Autowired
// private UserService userService;
//
//
@RequestMapping("/index")
public String index() {
return "index";
}
}
|
package org.science4you.helpers;
public class SubNode {
private String id;
private String text;
private Boolean children;
// private String icon = "+";
private Object data = new Object();
private Object li_attr = new Object();
private Object a_attr = new Object();
private NodeType type;
public SubNode(String id, String text) {
this.id = id;
this.text = text;
}
public SubNode(String id, String text, NodeType type, Boolean children) {
this.id = id;
this.text = text;
this.type = type;
this.children = children;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
} |
package com.wuyan.masteryi.admin.service;
import com.wuyan.masteryi.admin.entity.GoodSpecs;
import com.wuyan.masteryi.admin.entity.Goods;
import java.util.List;
import java.util.Map;
/*
private Integer goodsId;
private String goodsName;
private String goodsInformation;
private Integer goodsCategoryId;
private String goodsCoverUrl;
private Integer collectNum;
private Integer sellNum;
private float lowPrice;
*/
public interface GoodsService {
Map<String, Object> getAllGoods();
Map<String, Object> getParentCategoryGoods(Integer parentId);
Map<String, Object> getChildCategoryGoods(Integer childId);
Map<String, Object> getAllSpecs(Integer []goods_id);
Map<String, Object> addGood(String goodsName, String goodsInformation, Integer goodsCategoryId,
String goodsCoverUrl, Integer collectNum, Integer sellNum,int [] specs,float primaryPrice);
Map<String, Object> addSpecs(Integer goodsId, int[] specs, Integer stock, float price);
Map<String, Object> changeStock(Integer newStock, Integer goodSpecsId);
Map<String, Object> changePrice(float newPrice, Integer goodSpecsId);
Map<String, Object> deleteSpecs(Integer goodSpecsId);
Map<String, Object> deleteGoods(Integer goodsId);
Map<String,Object> getSpecsDesc(int id);
Map<String,Object> getGoodTypes(int good_id);
Map<String,Object> getValuesByKey(int []key_id);
Map<String, Object> changeSpecs(int id, int []specs);
Map<String,Object> getGoodBySpecsId(int id);
}
|
package com.paleimitations.schoolsofmagic.common.data;
import com.paleimitations.schoolsofmagic.References;
import com.paleimitations.schoolsofmagic.client.data.SOMBlockStateProvider;
import com.paleimitations.schoolsofmagic.client.data.SOMItemModelProvider;
import com.paleimitations.schoolsofmagic.common.data.loottables.SOMLootTableProvider;
import net.minecraft.data.DataGenerator;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;
@Mod.EventBusSubscriber(modid = References.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class DataGenerators {
@SubscribeEvent
public static void gatherData(GatherDataEvent event) {
DataGenerator gen = event.getGenerator();
ExistingFileHelper fh = event.getExistingFileHelper();
gen.addProvider(new SOMBlockStateProvider(gen, fh));
gen.addProvider(new SOMItemModelProvider(gen, fh));
SOMBlockTagsProvider blocktags = new SOMBlockTagsProvider(gen, fh);
gen.addProvider(blocktags);
gen.addProvider(new SOMItemTagsProvider(gen, blocktags, fh));
gen.addProvider(new SOMRecipeProvider(gen));
gen.addProvider(new SOMLootTableProvider(gen));
gen.addProvider(new SOMAdvancementProvider(gen));
}
}
|
package com.tencent.mm.plugin.music.a;
import android.os.Looper;
import android.text.TextUtils;
import com.tencent.mm.g.a.t;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.z.a;
import com.tencent.mm.z.b;
import com.tencent.mm.z.c;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
public final class d {
private static d lwQ;
Object itk = new Object();
HashMap<String, f> lwA = new HashMap();
LinkedList<String> lwB = new LinkedList();
HashMap<String, f> lwC = new HashMap();
LinkedList<String> lwD = new LinkedList();
LinkedList<String> lwE = new LinkedList();
HashMap<String, String> lwF = new HashMap();
HashMap<String, LinkedList<String>> lwG = new HashMap();
HashMap<String, a> lwH = new HashMap();
private HashMap<String, c> lwI = new HashMap();
private LinkedList<String> lwJ = new LinkedList();
HashMap<String, Integer> lwK = new HashMap();
private LinkedList<String> lwL = new LinkedList();
boolean lwM = false;
private boolean lwN = false;
long lwO = 0;
private long lwP = 0;
private c lwR = new c() {
public final void onStart(String str) {
f HZ = d.this.HZ(str);
if (HZ == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "onStart player is null");
return;
}
d.this.e(str, HZ);
synchronized (d.this.itk) {
d.this.lwM = false;
}
ah.M(d.this.lwT);
}
public final void HT(String str) {
f HZ = d.this.HZ(str);
if (HZ == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "onPause player is null");
return;
}
d.this.b(str, HZ);
d.this.f(str, HZ);
d.a(d.this);
d.this.bhi();
}
public final void AW(String str) {
f HZ = d.this.HZ(str);
if (HZ == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "onStop player is null");
return;
}
d.this.b(str, HZ);
d.this.f(str, HZ);
d.a(d.this);
d.this.bhi();
}
public final void HU(String str) {
f HZ = d.this.HZ(str);
if (HZ == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "onComplete player is null");
return;
}
d.this.b(str, HZ);
d.this.f(str, HZ);
d.a(d.this);
d.this.bhi();
}
public final void onError(String str) {
f HZ = d.this.HZ(str);
if (HZ == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "onError player is null");
return;
}
int intValue;
Object obj;
d.this.b(str, HZ);
d dVar = d.this;
int i = HZ.isA;
if (dVar.lwK.containsKey(str)) {
intValue = ((Integer) dVar.lwK.get(str)).intValue();
} else {
intValue = 0;
}
if (intValue > 0) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "try it one time, don't try again");
dVar.lwK.remove(str);
} else if (66 != i) {
dVar.lwK.remove(str);
} else if (dVar.Ig(str)) {
dVar.lwK.put(str, Integer.valueOf(intValue + 1));
obj = 1;
if (obj == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "try to stop same url players and play again");
d.this.bhm();
d.this.a(str, null);
}
x.e("MicroMsg.Audio.AudioPlayerMgr", "not try to play again");
d.this.f(str, HZ);
d.a(d.this);
d.this.bhi();
return;
}
obj = null;
if (obj == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "not try to play again");
d.this.f(str, HZ);
d.a(d.this);
d.this.bhi();
return;
}
x.e("MicroMsg.Audio.AudioPlayerMgr", "try to stop same url players and play again");
d.this.bhm();
d.this.a(str, null);
}
};
private Runnable lwS = new Runnable() {
public final void run() {
x.i("MicroMsg.Audio.AudioPlayerMgr", "stopAudioDelayRunnable, run");
Iterator it = d.this.lwE.iterator();
while (it.hasNext()) {
String str = (String) it.next();
if (d.this.HY(str) == 0) {
d.this.Ia(str);
}
}
}
};
Runnable lwT = new Runnable() {
public final void run() {
x.i("MicroMsg.Audio.AudioPlayerMgr", "releaseAudioDelayRunnable, run");
Iterator it = d.this.lwE.iterator();
int i = 0;
while (it.hasNext()) {
int i2;
String str = (String) it.next();
if (d.this.HY(str) == 0) {
d dVar = d.this;
x.i("MicroMsg.Audio.AudioPlayerMgr", "destroyAllAudioPlayersAndSaveState, appId:%s", new Object[]{str});
LinkedList linkedList = (LinkedList) dVar.lwG.get(str);
if (linkedList == null || linkedList.size() == 0) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "there is no audioIds and players for this appId to stop");
} else {
synchronized (dVar.itk) {
Iterator it2 = linkedList.iterator();
while (it2.hasNext()) {
String str2 = (String) it2.next();
f fVar = (f) dVar.lwA.remove(str2);
dVar.lwB.remove(str2);
if (fVar != null) {
dVar.b(str2, fVar);
x.i("MicroMsg.Audio.AudioPlayerMgr", "destroy player");
if (fVar.dGA) {
d.d(str2, fVar);
} else {
d.c(str2, fVar);
}
}
}
Iterator it3 = linkedList.iterator();
while (it3.hasNext()) {
str = (String) it3.next();
f fVar2 = (f) dVar.lwC.remove(str);
dVar.lwD.remove(str);
if (fVar2 != null) {
dVar.b(str, fVar2);
x.i("MicroMsg.Audio.AudioPlayerMgr", "destroy recycled player");
if (fVar2.dGA) {
d.d(str, fVar2);
} else {
d.c(str, fVar2);
}
}
}
}
}
i2 = 1;
} else {
i2 = i;
}
i = i2;
}
if (i == 0) {
synchronized (d.this.itk) {
d.this.lwM = true;
}
d.this.lwO = System.currentTimeMillis();
ah.i(d.this.lwT, 1800000);
}
}
};
private LinkedList<String> lwz = new LinkedList();
static /* synthetic */ void a(d dVar) {
if (dVar.bhj() > 0) {
long currentTimeMillis = System.currentTimeMillis();
if (!dVar.lwN || currentTimeMillis - dVar.lwP >= 10000) {
synchronized (dVar.itk) {
dVar.lwN = true;
}
dVar.lwP = currentTimeMillis;
x.i("MicroMsg.Audio.AudioPlayerMgr", "stopAudioDelayIfPaused, delay_ms:%d", new Object[]{Integer.valueOf(600000)});
ah.M(dVar.lwS);
ah.i(dVar.lwS, 600000);
return;
}
return;
}
synchronized (dVar.itk) {
dVar.lwN = false;
}
ah.M(dVar.lwS);
}
public static synchronized void bhe() {
synchronized (d.class) {
if (lwQ == null) {
lwQ = new d();
}
}
}
public static d bhf() {
if (lwQ == null) {
lwQ = new d();
}
return lwQ;
}
private d() {
bhg();
}
public final void bhg() {
x.i("MicroMsg.Audio.AudioPlayerMgr", "_release");
this.lwz.clear();
synchronized (this.itk) {
String str;
Iterator it = this.lwB.iterator();
while (it.hasNext()) {
str = (String) it.next();
c(str, (f) this.lwA.remove(str));
}
this.lwB.clear();
this.lwA.clear();
it = this.lwD.iterator();
while (it.hasNext()) {
str = (String) it.next();
c(str, (f) this.lwC.remove(str));
}
this.lwD.clear();
this.lwC.clear();
}
Iterator it2 = this.lwE.iterator();
while (it2.hasNext()) {
LinkedList linkedList = (LinkedList) this.lwG.remove((String) it2.next());
if (linkedList != null) {
linkedList.clear();
}
}
this.lwE.clear();
this.lwF.clear();
this.lwG.clear();
this.lwH.clear();
this.lwI.clear();
this.lwK.clear();
this.lwL.clear();
ah.M(this.lwS);
ah.M(this.lwT);
this.lwM = false;
this.lwN = false;
}
private void dP(String str, String str2) {
if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(str2)) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "saveCreateId, appId:%s, audioId:%s", new Object[]{str, str2});
if (!this.lwE.contains(str)) {
this.lwE.add(str);
}
if (!this.lwz.contains(str2)) {
this.lwz.add(str2);
}
LinkedList linkedList = (LinkedList) this.lwG.get(str);
if (linkedList == null) {
linkedList = new LinkedList();
}
if (!linkedList.contains(str2)) {
linkedList.add(str2);
}
this.lwG.put(str, linkedList);
}
}
public final String dQ(String str, String str2) {
int i;
x.i("MicroMsg.Audio.AudioPlayerMgr", "createAudioPlayer");
LinkedList linkedList = (LinkedList) this.lwG.get(str);
synchronized (this.itk) {
if (linkedList != null) {
if (linkedList.contains(str2) && (this.lwB.contains(str2) || this.lwD.contains(str2))) {
i = 1;
}
}
i = 0;
}
int HY = HY(str);
if (TextUtils.isEmpty(str2)) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "createAudioPlayer fail, the audioId is empty!");
av(604, str2);
return null;
} else if (HY >= 10) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "now created QQAudioPlayer count %d arrive MAX_AUDIO_PLAYER_COUNT, save id and not send error event, not create player!", new Object[]{Integer.valueOf(HY)});
dP(str, str2);
return null;
} else if (i != 0) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "now created QQAudioPlayer fail, the audioId exist in mAudioIds");
av(603, str2);
return null;
} else {
dP(str, str2);
Id(str2);
f bhh = bhh();
bhh.a(this.lwR);
bhh.Ih(str2);
f(str2, bhh);
x.i("MicroMsg.Audio.AudioPlayerMgr", "create player success, appId:%s, audioId:%s", new Object[]{str, str2});
return str2;
}
}
public final boolean b(a aVar) {
boolean z = false;
if (aVar == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "startAudio, play param is null");
av(605, "");
return false;
} else if (TextUtils.isEmpty(aVar.bGW)) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "startAudio fail, the audioId is empty!");
av(604, aVar.bGW);
return false;
} else if (this.lwz.contains(aVar.bGW)) {
f HZ;
x.i("MicroMsg.Audio.AudioPlayerMgr", "startAudio");
String Ic = Ic(aVar.bGW);
a jE = jE(aVar.bGW);
if (HY(Ic) >= 10) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "startAudio now created QQAudioPlayer count %d arrive MAX_PLAY_AUDIO_PLAYER_COUNT, but save param!", new Object[]{Integer.valueOf(HY(Ic))});
this.lwH.put(aVar.bGW, aVar);
x.i("MicroMsg.Audio.AudioPlayerMgr", "autoPlay:%b", new Object[]{Boolean.valueOf(aVar.dGu)});
if (aVar.dGu && If(aVar.bGW)) {
bhm();
} else if (aVar.dGu) {
av(600, aVar.bGW);
return false;
} else {
x.e("MicroMsg.Audio.AudioPlayerMgr", "save param, do nothing ");
HZ = HZ(aVar.bGW);
if (HZ != null) {
HZ.c(aVar);
HZ.bhs();
}
return true;
}
}
Id(aVar.bGW);
f HZ2 = HZ(aVar.bGW);
if (HZ2 == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "startAudio, player is null, create new QQAudioPlayer with audioId:%s", new Object[]{aVar.bGW});
HZ = bhh();
HZ.a(this.lwR);
HZ.Ih(aVar.bGW);
HZ.c(aVar);
if (aVar.dGu) {
e(aVar.bGW, HZ);
aVar.dGw = System.currentTimeMillis();
HZ.d(aVar);
} else {
f(aVar.bGW, HZ);
HZ.bhs();
x.e("MicroMsg.Audio.AudioPlayerMgr", "new player autoplay false, not to play ");
}
} else {
x.i("MicroMsg.Audio.AudioPlayerMgr", "startAudio, audioId:%s", new Object[]{aVar.bGW});
if (aVar.dGu) {
e(aVar.bGW, HZ2);
aVar.dGw = System.currentTimeMillis();
HZ2.c(aVar);
if (jE != null && !jE.a(aVar)) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "param src change, do stop now and play new");
if (HZ2.PY() || HZ2.PZ() || HZ2.bhC() || HZ2.isPrepared() || HZ2.isPaused()) {
HZ2.stopPlay();
}
HZ2.d(aVar);
} else if (HZ2.PY()) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "is playing, do nothing");
} else if (HZ2.PZ() && HZ2.isPaused()) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "is paused, do resume");
HZ2.resume();
} else if (HZ2.isPrepared()) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "is isPrepared, do resume");
HZ2.resume();
} else if (HZ2.bhC()) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "is isPreparing, do nothing");
} else {
x.i("MicroMsg.Audio.AudioPlayerMgr", "is end or stop, do startPlay");
HZ2.d(aVar);
}
} else {
synchronized (this.itk) {
if (this.lwB.contains(aVar.bGW)) {
z = true;
}
}
if (z) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "don't mark player, is playing");
} else {
x.i("MicroMsg.Audio.AudioPlayerMgr", "mark player recycle");
f(aVar.bGW, HZ2);
}
HZ2.c(aVar);
if (!(jE == null || jE.a(aVar))) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "param src change, do stop now");
if (HZ2.PY() || HZ2.PZ() || HZ2.bhC() || HZ2.isPrepared() || HZ2.isPaused()) {
HZ2.stopPlay();
}
}
HZ2.bhs();
x.e("MicroMsg.Audio.AudioPlayerMgr", "autoplay false, not to play ");
}
}
this.lwF.put(Ic, aVar.processName);
this.lwH.put(aVar.bGW, aVar);
return true;
} else {
x.e("MicroMsg.Audio.AudioPlayerMgr", "startAudio fail, the audioId is not found!");
av(601, aVar.bGW);
return false;
}
}
public final boolean a(String str, a aVar) {
a aVar2 = (a) this.lwH.get(str);
if ((!this.lwz.contains(str) || aVar2 == null) && aVar != null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "resumeAudio, the audioId %s is not found or param is null, backupParam is exit", new Object[]{str});
if (aVar == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "restorePlayerParam param == null, audioId:%s", new Object[]{str});
} else {
x.i("MicroMsg.Audio.AudioPlayerMgr", "restorePlayerParam audioId:%s", new Object[]{str});
this.lwF.put(aVar.appId, aVar.processName);
this.lwH.put(aVar.bGW, aVar);
dP(aVar.appId, str);
this.lwK.remove(str);
}
if (aVar2 == null) {
aVar2 = aVar;
}
} else if (!this.lwz.contains(str)) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "resumeAudio fail, the audioId is not found!");
av(601, str);
return false;
} else if (aVar2 == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "resumeAudio fail, the param is not found!");
av(602, str);
return false;
}
x.i("MicroMsg.Audio.AudioPlayerMgr", "resumeAudio, audioId:%s", new Object[]{str});
if (HY(Ic(str)) >= 10) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "now created QQAudioPlayer count %d arrive MAX_PLAY_AUDIO_PLAYER_COUNT", new Object[]{Integer.valueOf(HY(Ic(str)))});
if (If(str)) {
bhm();
} else {
av(600, str);
return false;
}
}
f HZ = HZ(str);
if (HZ == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "resumeAudio, player is null");
Id(str);
x.i("MicroMsg.Audio.AudioPlayerMgr", "create new QQAudioPlayer with audioId %s to play", new Object[]{str});
HZ = bhh();
HZ.a(this.lwR);
HZ.Ih(str);
e(str, HZ);
aVar2.dGu = true;
aVar2.dGs = 0;
aVar2.dGw = System.currentTimeMillis();
HZ.d(aVar2);
return true;
}
e(str, HZ);
this.lwH.put(str, aVar2);
if (HZ.PZ() && !HZ.PY()) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "is pause, do resume");
HZ.resume();
} else if (HZ.isPrepared()) {
aVar2.dGu = true;
aVar2.dGw = System.currentTimeMillis();
x.i("MicroMsg.Audio.AudioPlayerMgr", "is prepared, do resume");
HZ.resume();
aVar2.dGs = 0;
HZ.c(aVar2);
} else if (HZ.bhC()) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "is preparing, do update param");
aVar2.dGu = true;
aVar2.dGw = System.currentTimeMillis();
HZ.c(aVar2);
} else if (HZ.PZ()) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "do nothing");
return false;
} else {
aVar2.dGu = true;
aVar2.dGw = System.currentTimeMillis();
x.i("MicroMsg.Audio.AudioPlayerMgr", "is stop, do startPlay");
HZ.d(aVar2);
aVar2.dGs = 0;
}
return true;
}
public final boolean HV(String str) {
f HZ = HZ(str);
if (HZ == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "stopAudio, player is null");
return false;
}
x.i("MicroMsg.Audio.AudioPlayerMgr", "stopAudio, audioId:%s", new Object[]{str});
HZ.stopPlay();
a aVar = (a) this.lwH.get(str);
if (aVar != null) {
aVar.dGs = 0;
aVar.dGu = true;
}
b(str, HZ);
f(str, HZ);
return true;
}
public final boolean HW(String str) {
f HZ = HZ(str);
if (HZ == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "destroyAudio, player is null");
return false;
}
x.i("MicroMsg.Audio.AudioPlayerMgr", "destroyAudio, audioId:%s", new Object[]{str});
c(str, HZ);
synchronized (this.itk) {
this.lwA.remove(str);
this.lwB.remove(str);
this.lwC.remove(str);
this.lwD.remove(str);
}
this.lwz.remove(str);
Iterator it = this.lwE.iterator();
while (it.hasNext()) {
String str2 = (String) it.next();
LinkedList linkedList = (LinkedList) this.lwG.get(str2);
if (linkedList != null && linkedList.contains(str)) {
linkedList.remove(str);
if (linkedList.size() == 0) {
this.lwG.remove(str2);
this.lwE.remove(str2);
this.lwF.remove(str2);
}
this.lwH.remove(str);
this.lwI.remove(str);
return true;
}
}
this.lwH.remove(str);
this.lwI.remove(str);
return true;
}
final boolean bK(String str, int i) {
a aVar = (a) this.lwH.get(str);
if (aVar == null) {
return false;
}
aVar.dGs = i;
return true;
}
public final c HX(String str) {
f HZ = HZ(str);
if (HZ != null) {
return HZ.bhF();
}
return (c) this.lwI.get(str);
}
public final int HY(String str) {
int size;
int bhj = bhj();
synchronized (this.itk) {
int size2 = this.lwz.size();
size = this.lwA.size();
int size3 = this.lwC.size();
LinkedList linkedList = (LinkedList) this.lwG.get(str);
int size4 = linkedList == null ? 0 : linkedList.size();
x.i("MicroMsg.Audio.AudioPlayerMgr", "getAudioPlayerCount, count:%d, player_count:%d, recycled_player_count:%d, audioIdsCount:%d, pause_count:%d", new Object[]{Integer.valueOf(size2), Integer.valueOf(size), Integer.valueOf(size3), Integer.valueOf(size4), Integer.valueOf(bhj)});
}
return size;
}
public final a jE(String str) {
if (this.lwH.containsKey(str)) {
return (a) this.lwH.get(str);
}
return null;
}
final f HZ(String str) {
if (this.lwA.containsKey(str)) {
return (f) this.lwA.get(str);
}
if (this.lwC.containsKey(str)) {
return (f) this.lwC.get(str);
}
return null;
}
public final void Ia(String str) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "pauseAllAudioPlayers, appId:%s", new Object[]{str});
LinkedList linkedList = (LinkedList) this.lwG.get(str);
if (linkedList == null || linkedList.size() == 0) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "there is no audioIds and players for this appId to pause");
} else if (this.lwA.isEmpty() && this.lwC.isEmpty()) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "there is no audioIds and players for this appId to pause");
} else {
Iterator it = linkedList.iterator();
while (it.hasNext()) {
String str2 = (String) it.next();
f fVar = (f) this.lwC.get(str2);
if (fVar != null) {
a(str2, fVar);
}
}
x.i("MicroMsg.Audio.AudioPlayerMgr", "playing player count:%d", new Object[]{Integer.valueOf(this.lwA.size())});
Iterator it2 = linkedList.iterator();
while (it2.hasNext()) {
String str3 = (String) it2.next();
f fVar2 = (f) this.lwA.get(str3);
if (fVar2 != null) {
a(str3, fVar2);
f(str3, fVar2);
}
}
}
}
public final void Ib(String str) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "destroyAllAudioPlayers, appId:%s", new Object[]{str});
LinkedList linkedList = (LinkedList) this.lwG.remove(str);
if (linkedList == null || linkedList.size() == 0) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "there is no audioIds and players for this appId to stop");
return;
}
synchronized (this.itk) {
String str2;
f fVar;
Iterator it = linkedList.iterator();
while (it.hasNext()) {
str2 = (String) it.next();
fVar = (f) this.lwA.remove(str2);
this.lwB.remove(str2);
x.i("MicroMsg.Audio.AudioPlayerMgr", "destroy playing player");
c(str2, fVar);
this.lwH.remove(str2);
this.lwI.remove(str2);
}
it = linkedList.iterator();
while (it.hasNext()) {
str2 = (String) it.next();
fVar = (f) this.lwC.remove(str2);
this.lwD.remove(str2);
x.i("MicroMsg.Audio.AudioPlayerMgr", "destroy recycled player");
c(str2, fVar);
this.lwH.remove(str2);
this.lwI.remove(str2);
}
}
this.lwz.removeAll(linkedList);
this.lwE.remove(str);
this.lwF.remove(str);
}
private void av(int i, String str) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "onErrorEvent with errCode:%d, audioId:%s", new Object[]{Integer.valueOf(i), str});
if (TextUtils.isEmpty(str)) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "audioId is empty");
str = b.Km();
}
t tVar = new t();
tVar.bHb.action = 4;
tVar.bHb.state = "error";
tVar.bHb.errCode = com.tencent.mm.plugin.music.b.a.d.tL(i);
tVar.bHb.Yy = com.tencent.mm.plugin.music.b.a.d.tM(i);
tVar.bHb.bGW = str;
tVar.bHb.appId = Ic(str);
com.tencent.mm.sdk.b.a.sFg.a(tVar, Looper.getMainLooper());
}
/* JADX WARNING: inconsistent code. */
/* Code decompiled incorrectly, please refer to instructions dump. */
private com.tencent.mm.plugin.music.a.f bhh() {
/*
r14 = this;
r0 = "MicroMsg.Audio.AudioPlayerMgr";
r1 = "createOrReusePlayer";
com.tencent.mm.sdk.platformtools.x.i(r0, r1);
r7 = r14.itk;
monitor-enter(r7);
r0 = r14.lwC; Catch:{ all -> 0x00c4 }
r0 = r0.size(); Catch:{ all -> 0x00c4 }
if (r0 != 0) goto L_0x001b;
L_0x0014:
r5 = new com.tencent.mm.plugin.music.a.f; Catch:{ all -> 0x00c4 }
r5.<init>(); Catch:{ all -> 0x00c4 }
monitor-exit(r7); Catch:{ all -> 0x00c4 }
L_0x001a:
return r5;
L_0x001b:
r5 = 0;
r4 = "";
r2 = 0;
r8 = java.lang.System.currentTimeMillis(); Catch:{ all -> 0x00c4 }
r0 = r14.lwD; Catch:{ all -> 0x00c4 }
r10 = r0.iterator(); Catch:{ all -> 0x00c4 }
L_0x002b:
r0 = r10.hasNext(); Catch:{ all -> 0x00c4 }
if (r0 == 0) goto L_0x0077;
L_0x0031:
r0 = r10.next(); Catch:{ all -> 0x00c4 }
r0 = (java.lang.String) r0; Catch:{ all -> 0x00c4 }
r1 = r14.lwC; Catch:{ all -> 0x00c4 }
r1 = r1.get(r0); Catch:{ all -> 0x00c4 }
r1 = (com.tencent.mm.plugin.music.a.f) r1; Catch:{ all -> 0x00c4 }
if (r1 == 0) goto L_0x002b;
L_0x0041:
r6 = r1.dGA; Catch:{ all -> 0x00c4 }
if (r6 != 0) goto L_0x0062;
L_0x0045:
r6 = r1.isCompleted(); Catch:{ all -> 0x00c4 }
if (r6 != 0) goto L_0x0062;
L_0x004b:
r6 = r1.isStopped(); Catch:{ all -> 0x00c4 }
if (r6 != 0) goto L_0x0062;
L_0x0051:
r6 = r1.lwZ; Catch:{ all -> 0x00c4 }
if (r6 == 0) goto L_0x0075;
L_0x0055:
r6 = r1.lwZ; Catch:{ all -> 0x00c4 }
r6 = r6.getPlayerState(); Catch:{ all -> 0x00c4 }
r11 = 9;
if (r6 != r11) goto L_0x0073;
L_0x005f:
r6 = 1;
L_0x0060:
if (r6 == 0) goto L_0x00d2;
L_0x0062:
r12 = 0;
r6 = (r2 > r12 ? 1 : (r2 == r12 ? 0 : -1));
if (r6 == 0) goto L_0x006e;
L_0x0068:
r12 = r1.dkh; Catch:{ all -> 0x00c4 }
r6 = (r12 > r2 ? 1 : (r12 == r2 ? 0 : -1));
if (r6 >= 0) goto L_0x00d2;
L_0x006e:
r2 = r1.dkh; Catch:{ all -> 0x00c4 }
L_0x0070:
r4 = r0;
r5 = r1;
goto L_0x002b;
L_0x0073:
r6 = 0;
goto L_0x0060;
L_0x0075:
r6 = 0;
goto L_0x0060;
L_0x0077:
if (r5 == 0) goto L_0x00ca;
L_0x0079:
r0 = r8 - r2;
r2 = 500; // 0x1f4 float:7.0E-43 double:2.47E-321;
r0 = (r0 > r2 ? 1 : (r0 == r2 ? 0 : -1));
if (r0 <= 0) goto L_0x00ca;
L_0x0081:
r0 = "MicroMsg.Audio.AudioPlayerMgr";
r1 = "player is be reuse to play again with other audio";
com.tencent.mm.sdk.platformtools.x.i(r0, r1); Catch:{ all -> 0x00c4 }
r0 = "MicroMsg.Audio.AudioPlayerMgr";
r1 = "unmarkPlayer, unmark player by audioId:%s";
r2 = 1;
r2 = new java.lang.Object[r2]; Catch:{ all -> 0x00c4 }
r3 = 0;
r2[r3] = r4; Catch:{ all -> 0x00c4 }
com.tencent.mm.sdk.platformtools.x.i(r0, r1, r2); Catch:{ all -> 0x00c4 }
r1 = r14.itk; Catch:{ all -> 0x00c4 }
monitor-enter(r1); Catch:{ all -> 0x00c4 }
r0 = r14.lwD; Catch:{ all -> 0x00c7 }
r0 = r0.contains(r4); Catch:{ all -> 0x00c7 }
if (r0 == 0) goto L_0x00ae;
L_0x00a4:
r0 = r14.lwC; Catch:{ all -> 0x00c7 }
r0.remove(r4); Catch:{ all -> 0x00c7 }
r0 = r14.lwD; Catch:{ all -> 0x00c7 }
r0.remove(r4); Catch:{ all -> 0x00c7 }
L_0x00ae:
r0 = r14.lwB; Catch:{ all -> 0x00c7 }
r0 = r0.contains(r4); Catch:{ all -> 0x00c7 }
if (r0 == 0) goto L_0x00c0;
L_0x00b6:
r0 = r14.lwB; Catch:{ all -> 0x00c7 }
r0.remove(r4); Catch:{ all -> 0x00c7 }
r0 = r14.lwA; Catch:{ all -> 0x00c7 }
r0.remove(r4); Catch:{ all -> 0x00c7 }
L_0x00c0:
monitor-exit(r1); Catch:{ all -> 0x00c7 }
monitor-exit(r7); Catch:{ all -> 0x00c4 }
goto L_0x001a;
L_0x00c4:
r0 = move-exception;
monitor-exit(r7); Catch:{ all -> 0x00c4 }
throw r0;
L_0x00c7:
r0 = move-exception;
monitor-exit(r1); Catch:{ all -> 0x00c7 }
throw r0; Catch:{ all -> 0x00c4 }
L_0x00ca:
monitor-exit(r7); Catch:{ all -> 0x00c4 }
r5 = new com.tencent.mm.plugin.music.a.f;
r5.<init>();
goto L_0x001a;
L_0x00d2:
r0 = r4;
r1 = r5;
goto L_0x0070;
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.music.a.d.bhh():com.tencent.mm.plugin.music.a.f");
}
private String Ic(String str) {
Iterator it = this.lwE.iterator();
while (it.hasNext()) {
String str2 = (String) it.next();
LinkedList linkedList = (LinkedList) this.lwG.get(str2);
if (linkedList != null && linkedList.contains(str)) {
return str2;
}
}
return "";
}
private void a(String str, f fVar) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "pausePlayerOnBackground, pause player on background by audioId:%s", new Object[]{str});
a aVar = (a) this.lwH.get(str);
if (aVar != null && fVar.PY() && fVar.PZ()) {
aVar.dGu = true;
aVar.dGs = fVar.bhE();
} else if (aVar != null && fVar.PZ()) {
aVar.dGu = true;
aVar.dGs = fVar.bhE();
} else if (aVar != null) {
aVar.dGu = true;
aVar.dGs = 0;
}
b(str, fVar);
c HX = HX(str);
if (HX != null && fVar.PY()) {
HX.dGz = true;
}
if (fVar.PY() || fVar.PZ() || fVar.bhC() || fVar.isPrepared() || fVar.isPaused()) {
x.i("MicroMsg.Audio.QQAudioPlayer", "pauseOnBackGround");
fVar.dGA = true;
fVar.bhD();
return;
}
x.i("MicroMsg.Audio.QQAudioPlayer", "setPauseOnBackground");
fVar.dGA = true;
fVar.lxc = true;
}
final void b(String str, f fVar) {
this.lwI.put(str, fVar.bhF());
}
static void c(String str, f fVar) {
if (fVar == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "destroyPlayer player is null for audioId:%s", new Object[]{str});
return;
}
if (fVar.PY() || fVar.PZ() || fVar.bhC() || fVar.isPrepared() || fVar.isPaused()) {
fVar.stopPlay();
}
fVar.release();
x.i("MicroMsg.Audio.AudioPlayerMgr", "destroyPlayer stop and release player by audioId:%s", new Object[]{str});
}
static void d(String str, f fVar) {
x.d("MicroMsg.Audio.AudioPlayerMgr", "releasePlayer");
c(str, fVar);
}
final void e(String str, f fVar) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "markPlayer, mark player by audioId:%s", new Object[]{str});
synchronized (this.itk) {
if (this.lwD.contains(str)) {
this.lwC.remove(str);
this.lwD.remove(str);
}
if (!this.lwB.contains(str)) {
this.lwB.add(str);
this.lwA.put(str, fVar);
}
}
}
final void f(String str, f fVar) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "markPlayerRecycled, mark player recycled by audioId:%s", new Object[]{str});
synchronized (this.itk) {
if (this.lwB.contains(str)) {
this.lwA.remove(str);
this.lwB.remove(str);
}
if (!this.lwD.contains(str)) {
this.lwD.add(str);
this.lwC.put(str, fVar);
}
}
}
public final void bhi() {
long currentTimeMillis = System.currentTimeMillis();
if (!this.lwM || currentTimeMillis - this.lwO >= 10000) {
this.lwO = currentTimeMillis;
synchronized (this.itk) {
this.lwM = true;
}
x.i("MicroMsg.Audio.AudioPlayerMgr", "releaseAudioDelayIfPaused, delay_ms:%d", new Object[]{Integer.valueOf(1800000)});
ah.M(this.lwT);
ah.i(this.lwT, 1800000);
}
}
private int bhj() {
int i;
synchronized (this.itk) {
Iterator it = this.lwD.iterator();
i = 0;
while (it.hasNext()) {
boolean z;
int i2;
String str = (String) it.next();
f HZ = HZ(str);
if (HZ == null) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "isPausedPlayer, player is null");
c HX = HX(str);
z = HX != null ? HX.dGz : false;
} else {
z = HZ.isPaused();
}
if (z) {
i2 = i + 1;
} else {
i2 = i;
}
i = i2;
}
}
return i;
}
private void Id(String str) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "recyclePlayer");
int size = this.lwA.size();
int size2 = this.lwC.size();
int bhj = bhj();
x.i("MicroMsg.Audio.AudioPlayerMgr", "start_player_count:%d, recycled_player_count:%d, paused_player_count:%d", new Object[]{Integer.valueOf(size), Integer.valueOf(size2), Integer.valueOf(bhj)});
if (size >= 10) {
bhk();
} else if (bhj >= 6) {
bhk();
} else if (size + bhj >= 8) {
bhk();
}
String Ic = Ic(str);
bhj = this.lwA.size();
size = this.lwC.size();
x.i("MicroMsg.Audio.AudioPlayerMgr", "start_player_count:%d, recycled_player_count:%d", new Object[]{Integer.valueOf(bhj), Integer.valueOf(size)});
Iterator it;
String str2;
if (size >= 50) {
it = this.lwE.iterator();
while (it.hasNext()) {
str2 = (String) it.next();
if (!(str2 == null || str2.equalsIgnoreCase(Ic))) {
Ie(str2);
}
}
} else if (size + bhj >= 50) {
it = this.lwE.iterator();
while (it.hasNext()) {
str2 = (String) it.next();
if (!(str2 == null || str2.equalsIgnoreCase(Ic))) {
Ie(str2);
}
}
} else {
x.i("MicroMsg.Audio.AudioPlayerMgr", "not do recycle player, condition is not satisfy to do recycleStopPlayerByAppId");
}
size = this.lwC.size();
x.i("MicroMsg.Audio.AudioPlayerMgr", "start_player_count:%d, recycled_player_count:%d", new Object[]{Integer.valueOf(bhj), Integer.valueOf(size)});
if (size >= 50) {
bhl();
} else if (size + bhj >= 50) {
bhl();
} else {
x.i("MicroMsg.Audio.AudioPlayerMgr", "not do recycle player, condition is not satisfy to do recycleAllStopPlayer");
}
}
private void bhk() {
x.i("MicroMsg.Audio.AudioPlayerMgr", "recyclePausedPlayer");
synchronized (this.itk) {
LinkedList linkedList = new LinkedList();
linkedList.addAll(this.lwD);
Iterator it = linkedList.iterator();
while (it.hasNext()) {
String str = (String) it.next();
f fVar = (f) this.lwC.get(str);
if (fVar != null && fVar.isPaused()) {
a(str, fVar);
}
}
}
}
private void bhl() {
x.i("MicroMsg.Audio.AudioPlayerMgr", "recycleStopPlayer");
synchronized (this.itk) {
LinkedList linkedList = new LinkedList();
linkedList.addAll(this.lwD);
Iterator it = linkedList.iterator();
while (it.hasNext()) {
String str = (String) it.next();
f fVar = (f) this.lwC.remove(str);
this.lwD.remove(str);
if (fVar != null) {
if (fVar.dGA) {
b(str, fVar);
d(str, fVar);
} else if (!fVar.isPaused()) {
b(str, fVar);
c(str, fVar);
}
}
}
}
}
private void Ie(String str) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "recycleStoppedPlayerByAppId");
x.i("MicroMsg.Audio.AudioPlayerMgr", "destroyAllStoppedAudioPlayersAndSaveStateByAppId, appId:%s", new Object[]{str});
LinkedList linkedList = (LinkedList) this.lwG.get(str);
if (linkedList == null || linkedList.size() == 0) {
x.e("MicroMsg.Audio.AudioPlayerMgr", "there is no audioIds and players for this appId to stop");
return;
}
synchronized (this.itk) {
Iterator it = linkedList.iterator();
while (it.hasNext()) {
String str2 = (String) it.next();
f fVar = (f) this.lwC.remove(str2);
this.lwD.remove(str2);
if (fVar != null) {
b(str2, fVar);
x.i("MicroMsg.Audio.AudioPlayerMgr", "destroy recycled player");
if (fVar.dGA) {
d(str2, fVar);
} else {
c(str2, fVar);
}
}
}
}
}
/* JADX WARNING: inconsistent code. */
/* Code decompiled incorrectly, please refer to instructions dump. */
private boolean If(java.lang.String r17) {
/*
r16 = this;
r5 = 0;
r3 = new java.util.ArrayList;
r3.<init>();
r7 = new java.util.HashMap;
r7.<init>();
r8 = new java.util.HashMap;
r8.<init>();
r0 = r16;
r4 = r0.itk;
monitor-enter(r4);
r0 = r16;
r1 = r0.lwA; Catch:{ all -> 0x0091 }
r9 = r1.size(); Catch:{ all -> 0x0091 }
r1 = 10;
if (r9 >= r1) goto L_0x003e;
L_0x0021:
r0 = r16;
r1 = r0.lwJ; Catch:{ all -> 0x0091 }
r1.clear(); Catch:{ all -> 0x0091 }
r1 = "MicroMsg.Audio.AudioPlayerMgr";
r2 = "playerCount:%d is not need to remove";
r3 = 1;
r3 = new java.lang.Object[r3]; Catch:{ all -> 0x0091 }
r5 = 0;
r6 = java.lang.Integer.valueOf(r9); Catch:{ all -> 0x0091 }
r3[r5] = r6; Catch:{ all -> 0x0091 }
com.tencent.mm.sdk.platformtools.x.i(r1, r2, r3); Catch:{ all -> 0x0091 }
r1 = 0;
monitor-exit(r4); Catch:{ all -> 0x0091 }
L_0x003d:
return r1;
L_0x003e:
r0 = r16;
r1 = r0.lwB; Catch:{ all -> 0x0091 }
r6 = r1.iterator(); Catch:{ all -> 0x0091 }
L_0x0046:
r1 = r6.hasNext(); Catch:{ all -> 0x0091 }
if (r1 == 0) goto L_0x00c6;
L_0x004c:
r1 = r6.next(); Catch:{ all -> 0x0091 }
r1 = (java.lang.String) r1; Catch:{ all -> 0x0091 }
r0 = r16;
r2 = r0.lwH; Catch:{ all -> 0x0091 }
r1 = r2.get(r1); Catch:{ all -> 0x0091 }
r1 = (com.tencent.mm.z.a) r1; Catch:{ all -> 0x0091 }
if (r1 == 0) goto L_0x0046;
L_0x005e:
r2 = r1.cfD; Catch:{ all -> 0x0091 }
if (r2 == 0) goto L_0x0046;
L_0x0062:
r2 = r1.cfD; Catch:{ all -> 0x0091 }
r2 = r7.containsKey(r2); Catch:{ all -> 0x0091 }
if (r2 != 0) goto L_0x0094;
L_0x006a:
r2 = r1.cfD; Catch:{ all -> 0x0091 }
r10 = 1;
r10 = java.lang.Integer.valueOf(r10); Catch:{ all -> 0x0091 }
r7.put(r2, r10); Catch:{ all -> 0x0091 }
r2 = new java.util.ArrayList; Catch:{ all -> 0x0091 }
r2.<init>(); Catch:{ all -> 0x0091 }
r10 = r1.bGW; Catch:{ all -> 0x0091 }
r2.add(r10); Catch:{ all -> 0x0091 }
r10 = r1.cfD; Catch:{ all -> 0x0091 }
r8.put(r10, r2); Catch:{ all -> 0x0091 }
L_0x0083:
r2 = r1.cfD; Catch:{ all -> 0x0091 }
r2 = r3.contains(r2); Catch:{ all -> 0x0091 }
if (r2 != 0) goto L_0x0046;
L_0x008b:
r1 = r1.cfD; Catch:{ all -> 0x0091 }
r3.add(r1); Catch:{ all -> 0x0091 }
goto L_0x0046;
L_0x0091:
r1 = move-exception;
monitor-exit(r4); Catch:{ all -> 0x0091 }
throw r1;
L_0x0094:
r2 = r1.cfD; Catch:{ all -> 0x0091 }
r2 = r7.get(r2); Catch:{ all -> 0x0091 }
r2 = (java.lang.Integer) r2; Catch:{ all -> 0x0091 }
r2 = r2.intValue(); Catch:{ all -> 0x0091 }
r2 = r2 + 1;
r10 = r1.cfD; Catch:{ all -> 0x0091 }
r2 = java.lang.Integer.valueOf(r2); Catch:{ all -> 0x0091 }
r7.put(r10, r2); Catch:{ all -> 0x0091 }
r2 = r1.cfD; Catch:{ all -> 0x0091 }
r2 = r8.get(r2); Catch:{ all -> 0x0091 }
r2 = (java.util.ArrayList) r2; Catch:{ all -> 0x0091 }
r10 = r1.bGW; Catch:{ all -> 0x0091 }
r10 = r2.contains(r10); Catch:{ all -> 0x0091 }
if (r10 != 0) goto L_0x00c0;
L_0x00bb:
r10 = r1.bGW; Catch:{ all -> 0x0091 }
r2.add(r10); Catch:{ all -> 0x0091 }
L_0x00c0:
r10 = r1.cfD; Catch:{ all -> 0x0091 }
r8.put(r10, r2); Catch:{ all -> 0x0091 }
goto L_0x0083;
L_0x00c6:
monitor-exit(r4); Catch:{ all -> 0x0091 }
r4 = "";
r6 = com.tencent.mm.plugin.music.cache.e.bhL();
r1 = "MicroMsg.Audio.AudioPlayerMgr";
r2 = "removePlayerGroupMinCount:%d";
r10 = 1;
r10 = new java.lang.Object[r10];
r11 = 0;
r12 = java.lang.Integer.valueOf(r6);
r10[r11] = r12;
com.tencent.mm.sdk.platformtools.x.d(r1, r2, r10);
r10 = r3.iterator();
r3 = r6;
L_0x00e6:
r1 = r10.hasNext();
if (r1 == 0) goto L_0x0121;
L_0x00ec:
r1 = r10.next();
r1 = (java.lang.String) r1;
r2 = r7.get(r1);
r2 = (java.lang.Integer) r2;
r2 = r2.intValue();
r11 = "MicroMsg.Audio.AudioPlayerMgr";
r12 = "count:%d, url:%s";
r13 = 2;
r13 = new java.lang.Object[r13];
r14 = 0;
r15 = java.lang.Integer.valueOf(r2);
r13[r14] = r15;
r14 = 1;
r13[r14] = r1;
com.tencent.mm.sdk.platformtools.x.d(r11, r12, r13);
if (r2 < r6) goto L_0x0240;
L_0x0114:
r5 = 1;
if (r3 >= r2) goto L_0x023d;
L_0x0117:
r4 = r1;
L_0x0118:
r3 = android.text.TextUtils.isEmpty(r4);
if (r3 == 0) goto L_0x011f;
L_0x011e:
r4 = r1;
L_0x011f:
r3 = r2;
goto L_0x00e6;
L_0x0121:
if (r5 == 0) goto L_0x023a;
L_0x0123:
r0 = r16;
r1 = r0.lwH;
r0 = r17;
r1 = r1.get(r0);
r1 = (com.tencent.mm.z.a) r1;
if (r1 == 0) goto L_0x023a;
L_0x0131:
if (r4 == 0) goto L_0x023a;
L_0x0133:
r1 = r1.cfD;
r1 = r4.equalsIgnoreCase(r1);
if (r1 == 0) goto L_0x023a;
L_0x013b:
r1 = "MicroMsg.Audio.AudioPlayerMgr";
r2 = "srcUrl is same, not remove and don't play again";
com.tencent.mm.sdk.platformtools.x.i(r1, r2);
r5 = 0;
r2 = r5;
L_0x0146:
if (r2 == 0) goto L_0x0229;
L_0x0148:
r1 = "MicroMsg.Audio.AudioPlayerMgr";
r3 = "need to remove player";
com.tencent.mm.sdk.platformtools.x.i(r1, r3);
r1 = r8.get(r4);
r1 = (java.util.ArrayList) r1;
if (r1 == 0) goto L_0x01fb;
L_0x0159:
r3 = r1.size();
if (r3 <= 0) goto L_0x01fb;
L_0x015f:
r3 = new java.util.LinkedList;
r3.<init>();
r4 = r1.iterator();
L_0x0168:
r1 = r4.hasNext();
if (r1 == 0) goto L_0x0184;
L_0x016e:
r1 = r4.next();
r1 = (java.lang.String) r1;
r0 = r16;
r5 = r0.lwH;
r1 = r5.get(r1);
r1 = (com.tencent.mm.z.a) r1;
if (r1 == 0) goto L_0x0168;
L_0x0180:
r3.add(r1);
goto L_0x0168;
L_0x0184:
r1 = new com.tencent.mm.plugin.music.a.d$a;
r0 = r16;
r1.<init>(r0);
java.util.Collections.sort(r3, r1);
r4 = new java.util.LinkedList;
r4.<init>();
r3 = r3.iterator();
L_0x0197:
r1 = r3.hasNext();
if (r1 == 0) goto L_0x01a9;
L_0x019d:
r1 = r3.next();
r1 = (com.tencent.mm.z.a) r1;
r1 = r1.bGW;
r4.add(r1);
goto L_0x0197;
L_0x01a9:
r1 = r9 + -10;
if (r1 <= 0) goto L_0x01fe;
L_0x01ad:
r3 = r4.size();
if (r3 <= r1) goto L_0x01fe;
L_0x01b3:
r1 = r1 + 1;
r3 = "MicroMsg.Audio.AudioPlayerMgr";
r5 = "removeCount should be %d";
r6 = 1;
r6 = new java.lang.Object[r6];
r7 = 0;
r8 = java.lang.Integer.valueOf(r1);
r6[r7] = r8;
com.tencent.mm.sdk.platformtools.x.i(r3, r5, r6);
r3 = r4.size();
r1 = r3 - r1;
if (r1 >= 0) goto L_0x01d1;
L_0x01d0:
r1 = 1;
L_0x01d1:
r0 = r16;
r3 = r0.lwJ;
r5 = r4.size();
r1 = r4.subList(r1, r5);
r3.addAll(r1);
L_0x01e0:
r1 = "MicroMsg.Audio.AudioPlayerMgr";
r3 = "need remove and stop player count : %d";
r4 = 1;
r4 = new java.lang.Object[r4];
r5 = 0;
r0 = r16;
r6 = r0.lwJ;
r6 = r6.size();
r6 = java.lang.Integer.valueOf(r6);
r4[r5] = r6;
com.tencent.mm.sdk.platformtools.x.i(r1, r3, r4);
L_0x01fb:
r1 = r2;
goto L_0x003d;
L_0x01fe:
if (r1 <= 0) goto L_0x0217;
L_0x0200:
r3 = r4.size();
if (r3 >= r1) goto L_0x0217;
L_0x0206:
r0 = r16;
r1 = r0.lwJ;
r3 = 1;
r5 = r4.size();
r3 = r4.subList(r3, r5);
r1.addAll(r3);
goto L_0x01e0;
L_0x0217:
r0 = r16;
r1 = r0.lwJ;
r3 = r4.size();
r3 = r3 + -1;
r3 = r4.get(r3);
r1.add(r3);
goto L_0x01e0;
L_0x0229:
r1 = "MicroMsg.Audio.AudioPlayerMgr";
r3 = "not need to remove player";
com.tencent.mm.sdk.platformtools.x.i(r1, r3);
r0 = r16;
r1 = r0.lwJ;
r1.clear();
goto L_0x01fb;
L_0x023a:
r2 = r5;
goto L_0x0146;
L_0x023d:
r2 = r3;
goto L_0x0118;
L_0x0240:
r2 = r3;
goto L_0x011f;
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.music.a.d.If(java.lang.String):boolean");
}
final void bhm() {
x.i("MicroMsg.Audio.AudioPlayerMgr", "removeAndStopPlayingAudioPlayer");
Iterator it = this.lwJ.iterator();
while (it.hasNext()) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "need remove and stop player audioId : %s", new Object[]{(String) it.next()});
HV(r0);
}
it = this.lwL.iterator();
while (it.hasNext()) {
x.i("MicroMsg.Audio.AudioPlayerMgr", "need remove and stop player for try audioId : %s", new Object[]{(String) it.next()});
HV(r0);
}
this.lwJ.clear();
this.lwL.clear();
}
/* JADX WARNING: inconsistent code. */
/* Code decompiled incorrectly, please refer to instructions dump. */
final boolean Ig(java.lang.String r14) {
/*
r13 = this;
r0 = "MicroMsg.Audio.AudioPlayerMgr";
r1 = "canRemoveAudioPlayerInPlayingListForTry";
com.tencent.mm.sdk.platformtools.x.i(r0, r1);
r4 = 0;
r5 = new java.util.ArrayList;
r5.<init>();
r6 = new java.util.HashMap;
r6.<init>();
r7 = new java.util.HashMap;
r7.<init>();
r2 = r13.itk;
monitor-enter(r2);
r0 = r13.lwA; Catch:{ all -> 0x008a }
r0 = r0.size(); Catch:{ all -> 0x008a }
r1 = 5;
if (r0 > r1) goto L_0x003b;
L_0x0025:
r1 = "MicroMsg.Audio.AudioPlayerMgr";
r3 = "playerCount:%d is not need to remove for try";
r4 = 1;
r4 = new java.lang.Object[r4]; Catch:{ all -> 0x008a }
r5 = 0;
r0 = java.lang.Integer.valueOf(r0); Catch:{ all -> 0x008a }
r4[r5] = r0; Catch:{ all -> 0x008a }
com.tencent.mm.sdk.platformtools.x.i(r1, r3, r4); Catch:{ all -> 0x008a }
r4 = 0;
monitor-exit(r2); Catch:{ all -> 0x008a }
L_0x003a:
return r4;
L_0x003b:
r0 = r13.lwB; Catch:{ all -> 0x008a }
r3 = r0.iterator(); Catch:{ all -> 0x008a }
L_0x0041:
r0 = r3.hasNext(); Catch:{ all -> 0x008a }
if (r0 == 0) goto L_0x00bf;
L_0x0047:
r0 = r3.next(); Catch:{ all -> 0x008a }
r0 = (java.lang.String) r0; Catch:{ all -> 0x008a }
r1 = r13.lwH; Catch:{ all -> 0x008a }
r0 = r1.get(r0); Catch:{ all -> 0x008a }
r0 = (com.tencent.mm.z.a) r0; Catch:{ all -> 0x008a }
if (r0 == 0) goto L_0x0041;
L_0x0057:
r1 = r0.cfD; Catch:{ all -> 0x008a }
if (r1 == 0) goto L_0x0041;
L_0x005b:
r1 = r0.cfD; Catch:{ all -> 0x008a }
r1 = r6.containsKey(r1); Catch:{ all -> 0x008a }
if (r1 != 0) goto L_0x008d;
L_0x0063:
r1 = r0.cfD; Catch:{ all -> 0x008a }
r8 = 1;
r8 = java.lang.Integer.valueOf(r8); Catch:{ all -> 0x008a }
r6.put(r1, r8); Catch:{ all -> 0x008a }
r1 = new java.util.ArrayList; Catch:{ all -> 0x008a }
r1.<init>(); Catch:{ all -> 0x008a }
r8 = r0.bGW; Catch:{ all -> 0x008a }
r1.add(r8); Catch:{ all -> 0x008a }
r8 = r0.cfD; Catch:{ all -> 0x008a }
r7.put(r8, r1); Catch:{ all -> 0x008a }
L_0x007c:
r1 = r0.cfD; Catch:{ all -> 0x008a }
r1 = r5.contains(r1); Catch:{ all -> 0x008a }
if (r1 != 0) goto L_0x0041;
L_0x0084:
r0 = r0.cfD; Catch:{ all -> 0x008a }
r5.add(r0); Catch:{ all -> 0x008a }
goto L_0x0041;
L_0x008a:
r0 = move-exception;
monitor-exit(r2); Catch:{ all -> 0x008a }
throw r0;
L_0x008d:
r1 = r0.cfD; Catch:{ all -> 0x008a }
r1 = r6.get(r1); Catch:{ all -> 0x008a }
r1 = (java.lang.Integer) r1; Catch:{ all -> 0x008a }
r1 = r1.intValue(); Catch:{ all -> 0x008a }
r1 = r1 + 1;
r8 = r0.cfD; Catch:{ all -> 0x008a }
r1 = java.lang.Integer.valueOf(r1); Catch:{ all -> 0x008a }
r6.put(r8, r1); Catch:{ all -> 0x008a }
r1 = r0.cfD; Catch:{ all -> 0x008a }
r1 = r7.get(r1); Catch:{ all -> 0x008a }
r1 = (java.util.ArrayList) r1; Catch:{ all -> 0x008a }
r8 = r0.bGW; Catch:{ all -> 0x008a }
r8 = r1.contains(r8); Catch:{ all -> 0x008a }
if (r8 != 0) goto L_0x00b9;
L_0x00b4:
r8 = r0.bGW; Catch:{ all -> 0x008a }
r1.add(r8); Catch:{ all -> 0x008a }
L_0x00b9:
r8 = r0.cfD; Catch:{ all -> 0x008a }
r7.put(r8, r1); Catch:{ all -> 0x008a }
goto L_0x007c;
L_0x00bf:
monitor-exit(r2); Catch:{ all -> 0x008a }
r0 = r13.lwH;
r0 = r0.get(r14);
r0 = (com.tencent.mm.z.a) r0;
r2 = r5.iterator();
L_0x00cc:
r1 = r2.hasNext();
if (r1 == 0) goto L_0x00f0;
L_0x00d2:
r1 = r2.next();
r1 = (java.lang.String) r1;
if (r0 == 0) goto L_0x00cc;
L_0x00da:
if (r1 == 0) goto L_0x00cc;
L_0x00dc:
r3 = r0.cfD;
r1 = r1.equalsIgnoreCase(r3);
if (r1 == 0) goto L_0x00cc;
L_0x00e4:
r0 = "MicroMsg.Audio.AudioPlayerMgr";
r1 = "srcUrl is same, not remove and don't play again for try";
com.tencent.mm.sdk.platformtools.x.i(r0, r1);
r4 = 0;
goto L_0x003a;
L_0x00f0:
r3 = "";
r0 = "MicroMsg.Audio.AudioPlayerMgr";
r1 = "removePlayerGroupMinCountForTry:%d";
r2 = 1;
r2 = new java.lang.Object[r2];
r8 = 0;
r9 = 2;
r9 = java.lang.Integer.valueOf(r9);
r2[r8] = r9;
com.tencent.mm.sdk.platformtools.x.d(r0, r1, r2);
r2 = 2;
r5 = r5.iterator();
L_0x010c:
r0 = r5.hasNext();
if (r0 == 0) goto L_0x0148;
L_0x0112:
r0 = r5.next();
r0 = (java.lang.String) r0;
r1 = r6.get(r0);
r1 = (java.lang.Integer) r1;
r1 = r1.intValue();
r8 = "MicroMsg.Audio.AudioPlayerMgr";
r9 = "count:%d, url:%s";
r10 = 2;
r10 = new java.lang.Object[r10];
r11 = 0;
r12 = java.lang.Integer.valueOf(r1);
r10[r11] = r12;
r11 = 1;
r10[r11] = r0;
com.tencent.mm.sdk.platformtools.x.d(r8, r9, r10);
r8 = 2;
if (r1 < r8) goto L_0x01d9;
L_0x013b:
r4 = 1;
if (r2 >= r1) goto L_0x01d6;
L_0x013e:
r3 = r0;
L_0x013f:
r2 = android.text.TextUtils.isEmpty(r3);
if (r2 == 0) goto L_0x0146;
L_0x0145:
r3 = r0;
L_0x0146:
r2 = r1;
goto L_0x010c;
L_0x0148:
if (r4 == 0) goto L_0x01cb;
L_0x014a:
r0 = "MicroMsg.Audio.AudioPlayerMgr";
r1 = "need to remove player";
com.tencent.mm.sdk.platformtools.x.i(r0, r1);
r0 = r7.get(r3);
r0 = (java.util.ArrayList) r0;
if (r0 == 0) goto L_0x003a;
L_0x015b:
r1 = r0.size();
if (r1 <= 0) goto L_0x003a;
L_0x0161:
r1 = new java.util.LinkedList;
r1.<init>();
r2 = r0.iterator();
L_0x016a:
r0 = r2.hasNext();
if (r0 == 0) goto L_0x0184;
L_0x0170:
r0 = r2.next();
r0 = (java.lang.String) r0;
r3 = r13.lwH;
r0 = r3.get(r0);
r0 = (com.tencent.mm.z.a) r0;
if (r0 == 0) goto L_0x016a;
L_0x0180:
r1.add(r0);
goto L_0x016a;
L_0x0184:
r0 = new com.tencent.mm.plugin.music.a.d$a;
r0.<init>(r13);
java.util.Collections.sort(r1, r0);
r2 = new java.util.LinkedList;
r2.<init>();
r1 = r1.iterator();
L_0x0195:
r0 = r1.hasNext();
if (r0 == 0) goto L_0x01a7;
L_0x019b:
r0 = r1.next();
r0 = (com.tencent.mm.z.a) r0;
r0 = r0.bGW;
r2.add(r0);
goto L_0x0195;
L_0x01a7:
r0 = r13.lwL;
r1 = r2.getLast();
r0.add(r1);
r0 = "MicroMsg.Audio.AudioPlayerMgr";
r1 = "need remove and stop player count for try: %d";
r2 = 1;
r2 = new java.lang.Object[r2];
r3 = 0;
r5 = r13.lwL;
r5 = r5.size();
r5 = java.lang.Integer.valueOf(r5);
r2[r3] = r5;
com.tencent.mm.sdk.platformtools.x.i(r0, r1, r2);
goto L_0x003a;
L_0x01cb:
r0 = "MicroMsg.Audio.AudioPlayerMgr";
r1 = "not need to remove player for try";
com.tencent.mm.sdk.platformtools.x.i(r0, r1);
goto L_0x003a;
L_0x01d6:
r1 = r2;
goto L_0x013f;
L_0x01d9:
r1 = r2;
goto L_0x0146;
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.music.a.d.Ig(java.lang.String):boolean");
}
}
|
package com.steatoda.commons.fields.demo.model.person;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import com.google.common.collect.Sets;
import com.steatoda.commons.fields.demo.model.boat.BoatDemoData;
/** Sample persons */
public abstract class PersonDemoData {
public static final String CapoId = "capo";
public static final String RonId = "ron";
public static final String PirateId = "pirate";
public static final String JohnId = "john";
public static final List<String> WandererCrewIds = IntStream.range(0, 7).mapToObj(i -> String.format("wanderer-sailor-%d", i)).collect(Collectors.toList());
public static final List<String> QueenAnnesRevengeCrewIds = IntStream.range(0, 300).mapToObj(i -> String.format("revenger-%d", i)).collect(Collectors.toList());
public static final List<String> AlphaCrewIds = IntStream.range(0, 4).mapToObj(i -> String.format("alpha-sailor-%d", i)).collect(Collectors.toList());
static class Record {
public Record(String id, String name, String email, Set<String> permissions, String boatId) {
this.id = id;
this.name = name;
this.email = email;
this.permissions = permissions;
this.boatId = boatId;
}
public String getId() { return id; }
String id;
String name;
String email;
Set<String> permissions;
String boatId;
}
public static List<Record> $() {
if ($ == null) {
$ = new ArrayList<>();
$.add(new Record(
CapoId,
"Capo Di Tutti Capi",
"capo@cosa-nostra.org",
Sets.newHashSet("admin"),
null
));
$.add(new Record(
RonId,
"Captain Ron",
"ron@pirates.org",
Sets.newHashSet("admin"),
BoatDemoData.WandererId
));
$.add(new Record(
PirateId,
"Blackbeard",
"blackbeard@caribbean.com",
Sets.newHashSet("read", "write", "steal"),
BoatDemoData.QueenAnnesRevengeId
));
$.add(new Record(
JohnId,
"John Doe",
"john.doe@acme.com",
Sets.newHashSet("read", "write"),
BoatDemoData.AlphaId
));
for (int i = 0; i < WandererCrewIds.size(); ++i)
$.add(new Record(
WandererCrewIds.get(i),
String.format("Wanderer %02d", i),
String.format("wanderer.%d@wanderer.com", i),
Sets.newHashSet("read"),
BoatDemoData.WandererId
));
for (int i = 0; i < QueenAnnesRevengeCrewIds.size(); ++i)
$.add(new Record(
QueenAnnesRevengeCrewIds.get(i),
String.format("Revenger %02d", i),
String.format("revenger.%d@caribbean.com", i),
Sets.newHashSet("read"),
BoatDemoData.QueenAnnesRevengeId
));
for (int i = 0; i < AlphaCrewIds.size(); ++i)
$.add(new Record(
AlphaCrewIds.get(i),
String.format("Alpha Crewman %02d", i),
String.format("alpha.%d@alpha.com", i),
Sets.newHashSet("read"),
BoatDemoData.AlphaId
));
}
return $;
}
private static List<Record> $ = null;
}
|
package de.zarncke.lib.data;
/**
* describes an Object, that has some kind of name (and can be ordered by it).
* implementing classes should implement compareTo() as follows:
*
* <pre>
* public int compareTo(HasName named) {
* return getName().compareTo(named.getName());
* }
* </pre>
*
* see {@link NamedObject} for an example.
*/
public interface HasName extends Comparable<HasName>
{
/**
* Get the name of this Object.
* @return the name as a String
*/
String getName();
}
|
package com.javaex.practice3;
import java.util.Scanner;
public class Ex13 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("숫자를 입력하세요");
int num = input.nextInt();
int output = 0;
for (int a = 1; a <= num; a++) {
output = output + a;
}
System.out.println("결과값: " + output);
input.close();
}
} |
/* SOFE 3650U Assignment 1
Course Group 23:
Adris Azimi, Abida Choudhury,
Daniel Gohara Kamel, Jessica Leishman */
public class ElectronicsFactory extends ProductFactory {
public Phone createProductA(){ // creates phone
return new Phone();
}
public Tablet createProductB(){ // creates tablet
return new Tablet();
}
}
|
package fr.lteconsulting;
public class Calculatrice
{
public void effectuerCalcul( Expression operation )
{
try
{
System.out.println( "DEBUT DU CALCUL DE " + operation.getDescription() );
double resultat = operation.getValeur();
System.out.println( "RESULTAT : " + resultat );
}
catch( CalculImpossibleException e )
{
System.out.println( "CALCUL IMPOSSIBLE CAR " + e.getMessage() );
}
}
}
|
package sysexp;
/**
* Classe representant une fabrique de jetons de la grammaire.
*
* @note Cette classe etant a usage interne, elle est invisible depuis
* l'exterieur du paquetage.
*/
class FabriqueJeton {
/**
* Retourne le jeton associe a la parenthese ouvrante.
*
* @return le jeton associe a la parenthese ouvrante.
*/
public static Jeton parentheseOuvrante() {
return parentheseOuvrante;
}
/**
* Retourne le jeton associe a la parenthese fermante.
*
* @return le jeton associe a la parenthese fermante.
*/
public static Jeton parentheseFermante() {
return parentheseFermante;
}
/**
* Retourne le jeton associe a l'operateur d'addition.
*
* @return le jeton associe a l'operateur d'addition.
*/
public static Jeton operateurPlus() {
return operateurPlus;
}
/**
* Retourne le jeton associe a l'operateur de soustraction.
*
* @return le jeton associe a l'operateur de soustraction.
*/
public static Jeton operateurMoins() {
return operateurMoins;
}
/**
* Retourne le jeton associe a l'operateur de multiplication.
*
* @return le jeton associe a l'operateur de multiplication.
*/
public static Jeton operateurMultiplie() {
return operateurMultiplie;
}
/**
* Retourne le jeton associe a l'operateur de division.
*
* @return le jeton associe a l'operateur de division.
*/
public static Jeton operateurDivise() {
return operateurDivise;
}
/**
* Retourne le jeton associe a l'operateur inferieur.
*
* @return le jeton associe a l'operateur inferieur.
*/
public static Jeton operateurInferieur() {
return operateurInferieur;
}
/**
* Retourne le jeton associe a l'operateur de superieur.
*
* @return le jeton associe a l'operateur superieur.
*/
public static Jeton operateurSuperieur() {
return operateurSuperieur;
}
/**
* Retourne le jeton associe a l'operateur inferieur ou egal.
*
* @return le jeton associe a l'operateur inferieur ou egal.
*/
public static Jeton operateurInferieurOuEgal() {
return operateurInferieurOuEgal;
}
/**
* Retourne le jeton associe a l'operateur superieur ou egal.
*
* @return le jeton associe a l'operateur superieur ou egal.
*/
public static Jeton operateurSuperieurOuEgal() {
return operateurSuperieurOuEgal;
}
/**
* Retourne le jeton associe a l'operateur egal.
*
* @return le jeton associe a l'operateur egal.
*/
public static Jeton operateurEgal() {
return operateurEgal;
}
/**
* Retourne le jeton associe a l'operateur different de.
*
* @return le jeton associe a l'operateur different de.
*/
public static Jeton operateurDifferentDe() {
return operateurDifferentDe;
}
/**
* Retourne le jeton associe a la declaration de fait booleen.
*
* @return le jeton associe a la declaration de fait booleen.
*/
public static Jeton declarationFaitBooleen() {
return declarationFaitBooleen;
}
/**
* Retourne le jeton associe a la declaration de fait symbolique.
*
* @return le jeton associe a la declaration de fait symbolique.
*/
public static Jeton declarationFaitSymoblique() {
return declarationFaitSymbolique;
}
/**
* Retourne le jeton associe a la declaration de fait entier.
*
* @return le jeton associe a la declaration de fait entier.
*/
public static Jeton declarationFaitEntier() {
return declarationFaitEntier;
}
/**
* Retourne le jeton associe a la declaration d'un si.
*
* @return le jeton associe a la declaration d'un si.
*/
public static Jeton si() {
return si;
}
/**
* Retourne le jeton associe a la virgule.
*
* @return le jeton associe a la virgule.
*/
public static Jeton virgule() {
return virgule;
}
/**
* Retourne le jeton associe au point virgule.
*
* @return le jeton associe au point virgule.
*/
public static Jeton pointVirgule() {
return pointVirgule;
}
/**
* Retourne le jeton associe a la fin d'expression.
*
* @return le jeton associe a la fin d'expression.
*/
public static Jeton finExpression() {
return finExpression;
}
/**
* Retourne le jeton associe a un entier.
*
* @param representation la representation de l'entier.
* @return le jeton associe a un entier.
*/
public static Jeton entier(String representation) {
return new Jeton(Jeton.Type.Entier, representation);
}
/**
* Retourne le jeton associe a une chaine de caracteres.
*
* @param representation la representation d'une chaine de caracteres.
* @return le jeton associe a un entier.
*/
public static Jeton chaineDeCaracteres(String representation) {
return new Jeton(Jeton.Type.ChaineDeCaracteres, representation);
}
/**
* Retourne le jeton associe a une representation inconnue.
*
* @param representation la representation inconnue.
* @return le jeton associe a une representation inconnue.
*/
public static Jeton inconnu(String representation) {
return new Jeton(Jeton.Type.Inconnu, representation);
}
/**
* Retourne le jeton associe a un fait booleen.
*
* @param representation d'un fait booleen.
* @return le jeton associe a unfait booleen
*/
public static Jeton faitBooleen(String representation) {
return new Jeton(Jeton.Type.FaitBooleen, representation);
}
/**
* Retourne le jeton associe a un fait entier.
*
* @param representation la representation inconnue.
* @return le jeton associe a une representation inconnue.
*/
public static Jeton faitEntier(String representation) {
return new Jeton(Jeton.Type.FaitEntier, representation);
}
/**
* Retourne le jeton associe a un fait symbolique.
*
* @param representation la representation inconnue.
* @return le jeton associe a une representation inconnue.
*/
public static Jeton faitSymbolique(String representation) {
return new Jeton(Jeton.Type.FaitSymbolique, representation);
}
/**
* Jeton associe a la parenthese ouvrante.
*/
protected static final Jeton parentheseOuvrante =
new Jeton(Jeton.Type.ParentheseOuvrante, "(");
/**
* Jeton associe a la parenthese fermante.
*/
protected static final Jeton parentheseFermante =
new Jeton(Jeton.Type.ParentheseFermante, ")");
/**
* Jeton associe a l'operateur d'addition.
*/
protected static final Jeton operateurPlus =
new Jeton(Jeton.Type.OperateurPlus, "+");
/**
* Jeton associe a l'operateur de soustraction.
*/
protected static final Jeton operateurMoins =
new Jeton(Jeton.Type.OperateurMoins, "-");
/**
* Jeton associe a l'operateur de multiplication.
*/
protected static final Jeton operateurMultiplie =
new Jeton(Jeton.Type.OperateurMultiplie, "*");
/**
* Jeton associe a l'operateur de division.
*/
protected static final Jeton operateurDivise =
new Jeton(Jeton.Type.OperateurDivise, "/");
/**
* Jeton associe a l'operateur inferieur.
*/
protected static final Jeton operateurInferieur =
new Jeton(Jeton.Type.OperateurInferieur, "<");
/**
* Jeton associe a l'operateur superieur.
*/
protected static final Jeton operateurSuperieur =
new Jeton(Jeton.Type.OperateurSuperieur, ">");
/**
* Jeton associe a l'operateur inferieur ou egal.
*/
protected static final Jeton operateurInferieurOuEgal =
new Jeton(Jeton.Type.OperateurInferieurOuEgal, "<=");
/**
* Jeton associe a l'operateur superieur ou egal.
*/
protected static final Jeton operateurSuperieurOuEgal =
new Jeton(Jeton.Type.OperateurSuperieurOuEgal, ">=");
/**
* Jeton associe a l'operateur egal.
*/
protected static final Jeton operateurEgal =
new Jeton(Jeton.Type.OperateurEgal, "=");
/**
* Jeton associe a l'operateur different de.
*/
protected static final Jeton operateurDifferentDe =
new Jeton(Jeton.Type.OperateurDifferentDe, "/=");
/**
* Jeton assoie a un fait booleen.
*/
protected static final Jeton declarationFaitBooleen =
new Jeton(Jeton.Type.DeclarationFaitBooleen, "faits_booleens");
/**
* Jeton assoie a un fait entier.
*/
protected static final Jeton declarationFaitEntier =
new Jeton(Jeton.Type.DeclarationFaitEntier, "faits_entiers");
/**
* Jeton assoie a un fait symbolique.
*/
protected static final Jeton declarationFaitSymbolique =
new Jeton(Jeton.Type.DeclarationFaitSymbolique, "faits_symboliques");
/**
* Jeton assoie a un si.
*/
protected static final Jeton si =
new Jeton(Jeton.Type.DeclarationFaitSymbolique, "si");
/**
* Jeton associe a l'operateur virgule.
*/
protected static final Jeton virgule =
new Jeton(Jeton.Type.Virgule, ",");
/**
* Jeton associe a l'operateur different point virgule.
*/
protected static final Jeton pointVirgule =
new Jeton(Jeton.Type.PointVirgule, ";");
/**
* Jeton assoie à la fin d'expression.
*/
protected static final Jeton finExpression =
new Jeton(Jeton.Type.FinExpression, "");
} |
package com.mideas.rpg.v2;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import javax.imageio.ImageIO;
public class PNGDecoder {
public static ByteBuffer decode(final File file) throws IOException {
final BufferedImage image = ImageIO.read(file);
final int width = image.getWidth();
final int height = image.getHeight();
final int[] pixels = new int[width*height];
final ByteBuffer buffer = ByteBuffer.allocateDirect(width*height*4).order(ByteOrder.nativeOrder());
image.getRGB(0, 0, width, height, pixels, 0, width);
int i = -1;
while(++i < pixels.length) {
buffer.put((byte)(pixels[i]>>16));
buffer.put((byte)(pixels[i]>>8));
buffer.put((byte) pixels[i]);
buffer.put((byte)(pixels[i]>>24));
}
buffer.position(0);
return buffer;
}
} |
package com.example.domain;
import com.example.data.ProductDataSource;
import com.example.data.model.Product;
public class ProfileViewUseCaseController {
ProductDataSource mProductDataSource;
public ProfileViewUseCaseController(ProductDataSource productDataSource) {
mProductDataSource = productDataSource;
}
public Product readUserInfo(String lang) {
return mProductDataSource.readUserInfo(lang);
}
}
|
package com.tencent.mm.plugin.readerapp.ui;
import com.tencent.mm.ui.r.a;
class ReaderAppUI$6 implements a {
final /* synthetic */ ReaderAppUI mnQ;
ReaderAppUI$6(ReaderAppUI readerAppUI) {
this.mnQ = readerAppUI;
}
public final void Xb() {
ReaderAppUI.d(this.mnQ).setIsTopShowAll(ReaderAppUI.b(this.mnQ).ayQ());
}
public final void Xa() {
}
}
|
/*
* 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 zumo;
/**
*
* @author Michael
* main del zumo
*/
public class Main {
public static void main(String[] args) {
acciones_Zumo(0.0);
}
/**
* @author MICHAEL
* @param peso devuelve el peso del zumo para posteriormente saber el precio
*/
public static void acciones_Zumo(double peso) {
Zumo depositoPomelo;
int relleno;
/*Creación de un depósito con zumo de pomelo, inicialmente contiene 20 litros, su capacidad máxima es de 40 litros
el precio del litro es 2€*/
depositoPomelo= new Zumo(20,2,"Pomelo",40);
try {
System.out.println("Vamos a tomar zumo");
depositoPomelo.sacarZumo(5, 20);//Se intentan comprar 5 litros de zumo con 20€
} catch (Exception e) {
System.out.println("Error al sacar zumo");
}
try {
System.out.println("Rellenando depósito");
depositoPomelo.rellenar(30);//Se intenta rellenar el deposito añadiendo 30 litros
} catch (Exception e) {
System.out.println("Fallo al rellenar el depósito");
}
relleno = depositoPomelo.obtenerLitros();
System.out.println("El depósito contiene " + relleno + " litros");
}
}
|
package ecutb.fishingtrip;
import ecutb.fishingtrip.data.AppUserRepository;
import ecutb.fishingtrip.data.AppUserRoleRepository;
import ecutb.fishingtrip.data.FishingTripRepository;
import ecutb.fishingtrip.data.SpeciesRepository;
import ecutb.fishingtrip.entity.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
@Component
public class Seeder {
private AppUserRepository appUserRepository;
private AppUserRoleRepository roleRepository;
private BCryptPasswordEncoder passwordEncoder;
private FishingTripRepository fishingTripRepository;
private SpeciesRepository speciesRepository;
@Autowired
public Seeder(AppUserRepository appUserRepository, AppUserRoleRepository roleRepository, BCryptPasswordEncoder passwordEncoder, FishingTripRepository fishingTripRepository, SpeciesRepository speciesRepository) {
this.appUserRepository = appUserRepository;
this.roleRepository = roleRepository;
this.passwordEncoder = passwordEncoder;
this.fishingTripRepository = fishingTripRepository;
this.speciesRepository = speciesRepository;
}
@PostConstruct
@Transactional
public void init(){
Set<AppUserRole> roles = Arrays.stream(UserRole.values())
.map(userRole -> roleRepository.save(new AppUserRole(userRole)))
.collect(Collectors.toSet());
AppUserRole user = roleRepository.findByRole(UserRole.USER).orElseThrow(() -> new IllegalArgumentException("Couldn't find role"));
Set<AppUserRole> userRole = new HashSet<>();
userRole.add(user);
// Create APP_ADMIN user:
AppUser appAdmin = new AppUser("admin", "Foo", "Bar", "foo.bar@admin.com", passwordEncoder.encode("admin1234"),LocalDate.now());
appAdmin.setAppUserRoles(roles);
appUserRepository.save(appAdmin);
// Create APP_USER user:
AppUser appUser = new AppUser("oscrj", "Oscar","Johanneson", "oscar.johanneson@gmail.com", passwordEncoder.encode("password1"), LocalDate.now());
appUser.setAppUserRoles(userRole);
appUserRepository.save(appUser);
AppUser appUser2 = new AppUser("test", "John","Doe", "john.doe@gmail.com", passwordEncoder.encode("password12"), LocalDate.now());
appUser2.setAppUserRoles(userRole);
appUserRepository.save(appUser2);
AppUser appUser3 = new AppUser("test2", "Jane","Doe", "jane.doe@gmail.com", passwordEncoder.encode("password123"), LocalDate.now());
appUser3.setAppUserRoles(userRole);
appUserRepository.save(appUser3);
FishingTrip trip = new FishingTrip("Spinning", "Lake", "Bergundasjön", LocalDate.now());
trip.setAppUser(appUser);
fishingTripRepository.save(trip);
FishingTrip trip2 = new FishingTrip("Fly Fishing", "Pond", "Secret spot", LocalDate.now().minusDays(5));
trip2.setAppUser(appUser);
fishingTripRepository.save(trip2);
FishingTrip trip3 = new FishingTrip("Trolling", "Ocean", "Kattegatt", LocalDate.now().minusDays(20));
trip3.setAppUser(appUser);
fishingTripRepository.save(trip3);
Species fish = new Species("Northern pike", 85, 6.7, "Wobbler", "Cloudy day", LocalDateTime.now().truncatedTo(ChronoUnit.MINUTES));
fish.setFishingTrip(trip);
speciesRepository.save(fish);
Species fish2 = new Species("Perch", 35, 1.2, "CrankBait", "Cloudy day", LocalDateTime.now().truncatedTo(ChronoUnit.MINUTES));
fish2.setFishingTrip(trip);
speciesRepository.save(fish2);
Species fish3 = new Species("Salmon", 65, 4.6, "Wobbler", "Sunny day", LocalDateTime.now().minusDays(20).truncatedTo(ChronoUnit.MINUTES));
fish3.setFishingTrip(trip3);
speciesRepository.save(fish3);
Species fish4 = new Species("Salmon", 35, 1.6, "Wobbler", "Sunny day", LocalDateTime.now().minusDays(20).truncatedTo(ChronoUnit.MINUTES));
fish4.setFishingTrip(trip3);
speciesRepository.save(fish4);
}
}
|
package com.graphic.RNCanvas;
import android.graphics.Paint;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.WritableMap;
import java.util.ArrayList;
import java.util.HashMap;
public class CanvasAPI extends ReactContextBaseJavaModule {
private static final Paint paint = new Paint();
public CanvasAPI(ReactApplicationContext paramReactApplicationContext) {
super(paramReactApplicationContext);
}
@ReactMethod(isBlockingSynchronousMethod = true)
public Integer drawSync(String paramString, ReadableArray paramReadableArray) {
if (paramReadableArray.size() == 0)
return Integer.valueOf(0);
ArrayList<HashMap> arrayList = CanvasConvert.convertActions(paramReadableArray);
CanvasTextureView canvasTextureView = CanvasViewManager.getCanvasView(paramString);
if (canvasTextureView != null) {
canvasTextureView.setActions(arrayList);
canvasTextureView.drawOutput();
}
return Integer.valueOf(1);
}
public String getName() {
return "CanvasAPI";
}
@ReactMethod(isBlockingSynchronousMethod = true)
public WritableMap measureText(String paramString, double paramDouble) {
HashMap<Object, Object> hashMap = new HashMap<Object, Object>();
paint.setTextSize((float)paramDouble);
hashMap.put("width", Float.valueOf(paint.measureText(paramString)));
return (WritableMap)Arguments.makeNativeMap(hashMap);
}
@ReactMethod
public void release(String paramString) {
CanvasViewManager.removeCanvasView(paramString);
}
}
/* Location: C:\Users\august\Desktop\tik\df_rn_kit\classes.jar.jar!\com\graphic\RNCanvas\CanvasAPI.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.1.3
*/ |
package classpackage;
class Course {
String Number;
public String getNumber() {
return Number;
}
public void setNumber(String number) {
Number = number;
}
String palce;
String teacher;
public String getPalce() {
return palce;
}
public void setPalce(String palce) {
this.palce = palce;
}
public String getTeacher() {
return teacher;
}
public void setTeacher(String teacher) {
this.teacher = teacher;
}
}
|
package com.xxl.job.executor.service;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.xxl.job.core.log.XxlJobLogger;
import com.xxl.job.executor.dao.VclLastSevenDao;
@Component
public class VclLastSevenService {
@Autowired
private VclLastSevenDao vclLastSevenDao;
@Value("${EngineWorkTime}")
private String EngineWorkTime;
@Value("${EngineIdeaOil}")
private String EngineIdeaOil;
@Value("${EngineIdeaWorkTime}")
private String EngineIdeaWorkTime;
@Value("${EngineOil}")
private String EngineOil;
@Value("${VclPreFiex}")
private String VclPreFiex;
/**
* 获取对应时区的设备
* @param condition(时区条件)
* @data 日期
* @return
*/
/**
* @param condition
* @return
* @throws ParseException
*/
public List<Map<String,Object>> getExecVcl(String condition,String BgnDate,String EndDate,String tableName){
//获取对应时区的设备自然月的值
List<Map<String,Object>>list=vclLastSevenDao.getExecVcl(condition,BgnDate,EndDate);
List<String>listsql=new ArrayList<String>();
//查询数据范围
if(list.size()>0){
for(Map<String,Object>mapResult:list){
String MsgESSLS_VclID=MapUtils.getString(mapResult,"msgess_vclid");
String MsgESSLS_WorkDay=MapUtils.getString(mapResult,"count");
String MsgESSLS_iWork=MapUtils.getString(mapResult,"MsgESS_iWork");
String MsgESSLS_iOilCons=MapUtils.getString(mapResult,"MsgESS_iOilCons");
String MsgESSLS_iIdleWorkTime_PGN=MapUtils.getString(mapResult,"MsgESS_iIdleWorkTime_PGN");
String MsgESSLS_iIdleWorkTime_UDS=MapUtils.getString(mapResult,"MsgESS_iIdleWorkTime_UDS");
//Msg_EquipmentState_Statistics_LastSeven
String sql="insert into "+tableName+" (MsgESSLS_VclID,MsgESSLS_WorkDay,MsgESSLS_iWork,MsgESSLS_iOilCons,MsgESSLS_iIdleWorkTime_PGN,MsgESSLS_iIdleWorkTime_UDS) "+
"Values ("+MsgESSLS_VclID+","+MsgESSLS_WorkDay+","+MsgESSLS_iWork+","+MsgESSLS_iOilCons+","+MsgESSLS_iIdleWorkTime_PGN+","+MsgESSLS_iIdleWorkTime_UDS+") "+
"ON DUPLICATE KEY UPDATE MsgESSLS_WorkDay="+MsgESSLS_WorkDay+",MsgESSLS_iWork="+MsgESSLS_iWork+",MsgESSLS_iOilCons="+MsgESSLS_iOilCons+","+
"MsgESSLS_iIdleWorkTime_PGN="+MsgESSLS_iIdleWorkTime_PGN+",MsgESSLS_iIdleWorkTime_UDS="+MsgESSLS_iIdleWorkTime_UDS;
listsql.add(sql);
}
XxlJobLogger.log("本次执行近七天条数:"+listsql.size()+"条");
String []strSql=new String[listsql.size()];
int i=0;
for(String sql:listsql){
strSql[i++]=sql;
}
vclLastSevenDao.execBatch(strSql);
}
return null;
}
/**
* @param condition
* @return
* @throws ParseException
*/
public List<Map<String,Object>> getLastThirtyExecVcl(String condition,String BgnDate,String EndDate,String tableName){
//获取对应时区的设备自然月的值
List<Map<String,Object>>list=vclLastSevenDao.getExecVcl(condition,BgnDate,EndDate);
List<String>listsql=new ArrayList<String>();
//查询数据范围
if(list.size()>0){
for(Map<String,Object>mapResult:list){
String MsgESSLT_VclID=MapUtils.getString(mapResult,"msgess_vclid");
String MsgESSLT_WorkDay=MapUtils.getString(mapResult,"count");
String MsgESSLT_iWork=MapUtils.getString(mapResult,"MsgESS_iWork");
String MsgESSLT_iOilCons=MapUtils.getString(mapResult,"MsgESS_iOilCons");
String MsgESSLT_iIdleWorkTime_PGN=MapUtils.getString(mapResult,"MsgESS_iIdleWorkTime_PGN");
String MsgESSLT_iIdleWorkTime_UDS=MapUtils.getString(mapResult,"MsgESS_iIdleWorkTime_UDS");
//Msg_EquipmentState_Statistics_LastSeven
String sql="insert into "+tableName+" (MsgESSLT_VclID,MsgESSLT_WorkDay,MsgESSLT_iWork,MsgESSLT_iOilCons,MsgESSLT_iIdleWorkTime_PGN,MsgESSLT_iIdleWorkTime_UDS) "+
"Values ("+MsgESSLT_VclID+","+MsgESSLT_WorkDay+","+MsgESSLT_iWork+","+MsgESSLT_iOilCons+","+MsgESSLT_iIdleWorkTime_PGN+","+MsgESSLT_iIdleWorkTime_UDS+") "+
"ON DUPLICATE KEY UPDATE MsgESSLT_WorkDay="+MsgESSLT_WorkDay+",MsgESSLT_iWork="+MsgESSLT_iWork+",MsgESSLT_iOilCons="+MsgESSLT_iOilCons+","+
"MsgESSLT_iIdleWorkTime_PGN="+MsgESSLT_iIdleWorkTime_PGN+",MsgESSLT_iIdleWorkTime_UDS="+MsgESSLT_iIdleWorkTime_UDS;
listsql.add(sql);
}
XxlJobLogger.log("本次执行近30天条数:"+listsql.size()+"条");
String []strSql=new String[listsql.size()];
int i=0;
for(String sql:listsql){
strSql[i++]=sql;
}
vclLastSevenDao.execBatch(strSql);
}
return null;
}
}
|
package ru.kirilushkin.housemanaging.service;
import org.springframework.stereotype.Service;
import ru.kirilushkin.housemanaging.entity.Apartment;
import ru.kirilushkin.housemanaging.repository.ApartmentRepository;
@Service
public class ApartmentService {
private final ApartmentRepository apartmentRepository;
public ApartmentService(ApartmentRepository apartmentRepository) {
this.apartmentRepository = apartmentRepository;
}
public void addApartment(Apartment apartment) {
apartmentRepository.save(apartment);
}
}
|
package com.app.gamaacademy.cabrasdoagrest.bankline.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import com.app.gamaacademy.cabrasdoagrest.bankline.models.PlanoConta;
public interface PlanoContaRepository extends JpaRepository<PlanoConta, Integer> {
//@Query(value = "SELECT id, nome, tipo, id_usuario FROM bankline.plano_conta WHERE id_usuario = ?1", nativeQuery = true)
//public List<PlanoConta> obterPlanoContasUsuario(int idUsuario);
public List<PlanoConta> findByUsuarioIdEquals(int idUsuario);
}
|
package com.kobotan.android.Vshkole.networking;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.ImageView;
import com.kobotan.android.Vshkole.database.DatabaseManager;
import com.kobotan.android.Vshkole.entities.Image;
import com.kobotan.android.Vshkole.utils.ImageUtil;
import com.kobotan.android.Vshkole.utils.URLUtil;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
/**
* Created by sancho on 25.03.15.
*/
public class MassiveImageLoader extends AsyncTask {
private String[] urls;
private Bitmap resultBitmap;
private ImageView imageView;
private boolean isBook;
public MassiveImageLoader(String[] urls, ImageView imageView, boolean isBook) {
this.urls = urls;
this.imageView = imageView;
this.isBook = isBook;
}
@Override
protected Object doInBackground(Object[] objects) {
Log.d("DEBUG", "Begin loading: " + String.valueOf(Arrays.toString(urls)));
if (!isBook) {
Image image = DatabaseManager.getInstance().getImageByURL(urls[0]);
if(image != null){
loadImageFromDatabase(image);
return null;
}
else {
try {
if (loadImageFromServer(urls)) return null;
}catch (OutOfMemoryError e){
Log.d("Error", "OutOfMemoryError");
}
}
} else {
BitmapLoader thread = new BitmapLoader(urls[0]);
thread.start();
Log.d("DEBUG", "Started: " + urls[0]);
try {
thread.join();
resultBitmap = thread.getBitmap();
Log.d("DEBUG", "Finished: " + urls[0]);
} catch (InterruptedException e) {
return null;
}
}
return null;
}
private void loadImageFromDatabase(Image image) {
resultBitmap = image.getBitmap();
for (int i = 1; i < urls.length; i++) {
Image next = DatabaseManager.getInstance().getImageByURL(urls[i]);
resultBitmap = ImageUtil.overlay(next.getBitmap(), resultBitmap);
}
}
private boolean loadImageFromServer(String[] urls) {
BitmapLoader[] threads = new BitmapLoader[urls.length];
for (int i = 0; i < urls.length; i++) {
threads[i] = new BitmapLoader(urls[i]);
threads[i].start();
}
for (int i = 0; i < urls.length; i++) {
try {
threads[i].join();
} catch (InterruptedException e) {
return true;
}
}
Log.d("DEBUG", "Loaded: " + String.valueOf(Arrays.toString(urls)));
resultBitmap = threads[0].getBitmap();
for (int i = 1; i < urls.length; i++) {
resultBitmap = threads[i].overlay(resultBitmap);
threads[i - 1].freeUpMemory();
threads[i].freeUpMemory();
}
Log.d("DEBUG", "Merged: " + String.valueOf(Arrays.toString(urls)));
return false;
}
@Override
protected void onPostExecute(Object o) {
imageView.setImageBitmap(resultBitmap);
}
}
class BitmapLoader extends Thread {
private String src;
private Bitmap bitmap;
public BitmapLoader(String src) {
this.src = src;
}
@Override
public void run() {
try {
URL url = URLUtil.getRealUrl(src);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("Accept-Charset", "UTF-8");
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.RGB_565;
bitmap = BitmapFactory.decodeStream(input, null, options);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public Bitmap getBitmap() {
return bitmap;
}
public Bitmap overlay(Bitmap firstBitmap) {
return ImageUtil.overlay(firstBitmap, bitmap);
}
public void freeUpMemory() {
if (bitmap != null) {
bitmap.recycle();
bitmap = null;
}
}
}
|
package com.javarush.task.task07.task0716;
import java.util.ArrayList;
/*
Р или Л
*/
public class Solution {
public static void main(String[] args) {
ArrayList<String> strings = new ArrayList<String>();
strings.add("роза");
strings.add("лоза");
strings.add("лира");
strings = fix(strings);
for (String string : strings) {
System.out.println(string);
}
}
public static ArrayList<String> fix(ArrayList<String> strings) {
String s = "рл";
char p = s.charAt(0);
char l = s.charAt(1);
int r = 0;
int k = 0;
ArrayList<String> list = new ArrayList<String>();
for (int i = 0; i < strings.size(); i++) {
for (int j = 0; j < strings.get(i).length(); j++) {
if (strings.get(i).charAt(j) == p) {
r++;
}
if (strings.get(i).charAt(j) == l) {
k++;
}
}
if (r > 0 && k > 0) {
list.add(strings.get(i));
r = 0;
k = 0;
} else if (r == 0 && k > 0) {
list.add(strings.get(i));
list.add(strings.get(i));
k = 0;
} else if (r > 0 && k == 0) {
r = 0;
} else {
list.add(strings.get(i));
}
}
return list;
}
}
|
package com.jim.multipos.ui.mainpospage.view;
import android.support.v4.app.Fragment;
import com.jim.multipos.config.scope.PerFragment;
import com.jim.multipos.ui.mainpospage.presenter.ProductInfoPresenterModule;
import dagger.Binds;
import dagger.Module;
/**
* Created by Sirojiddin on 27.10.2017.
*/
@Module(includes = {
ProductInfoPresenterModule.class
})
public abstract class ProductInfoFragmentModule {
@Binds
@PerFragment
abstract Fragment provideFragment(ProductInfoFragment infoFragment);
@Binds
@PerFragment
abstract ProductInfoView provideProductInfoView(ProductInfoFragment infoFragment);
} |
package br.vianna.aula.appteatro.controller.action.Salao;
import br.vianna.aula.appteatro.controller.commander.GenericCommander;
import br.vianna.aula.appteatro.domain.entities.Salao;
import br.vianna.aula.appteatro.infrastructure.dao.SalaoDao;
import java.io.IOException;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ViewListaSalaoAction extends GenericCommander {
public ViewListaSalaoAction(boolean isLogado) {
super(isLogado);
}
@Override
public void executa(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
RequestDispatcher rd = request.getRequestDispatcher("template.jsp");
List<Salao> salao = null;
if (request.getParameter("descricaoSalao") == null) {
salao = SalaoDao.buscarTodosSaloes();
} else if (!request.getParameter("descricaoSalao").equals("")) {
salao = SalaoDao.buscarPorFiltro(request.getParameter("descricaoSalao"));
} else {
salao = SalaoDao.buscarTodosSaloes();
}
request.setAttribute("page", "/Pages/Administracao/ListaSalao.jsp");
request.setAttribute("salao", salao);
rd.forward(request, response);
}
}
|
package lab10;
public class ex1 {
public static void B(int X){
System.out.println("Hello B"+X);
}//B
public static void main(String[] args) {
System.out.println("Hello Main");
A();
A();
B(10);
int s =C(10 , 20);
System.out.println(s);
System.out.println(C(50, 50)*5);
}//main
public static void A(){System.out.println("Hello A");}//A
public static int C (int x,int y){
int z = x+y;
System.out.println("Hello C " +z);
B(z);
return z;
}
}
|
package com.tencent.mm.ui.widget.a;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
class e$1 implements OnClickListener {
final /* synthetic */ c qIC;
final /* synthetic */ e$b uKr;
e$1(e$b e_b, c cVar) {
this.uKr = e_b;
this.qIC = cVar;
}
public final void onClick(DialogInterface dialogInterface, int i) {
if (this.uKr != null) {
this.uKr.b(true, this.qIC.cAJ());
}
}
}
|
package enduro.sorter.mvc.model;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
/**
* Denna klass beskriver en person som deltar i tävlingen
*
*
*/
public class Person {
private ArrayList<Calendar> startTime = new ArrayList<Calendar>();
private ArrayList<Calendar> goalTime = new ArrayList<Calendar>();
private String name = "";
private int id;
public Person(int id) {
this.id = id;
}
public Person(String id) {
this.id = Integer.valueOf(id);
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void registerStartTime(Calendar time) {
startTime.add(time);
}
public void registerGoalTime(Calendar time) {
goalTime.add(time);
}
public ArrayList<Calendar> getStartTimes() {
return new ArrayList<Calendar>(startTime);
}
public ArrayList<Calendar> getGoalTimes() {
Collections.sort(goalTime);
return new ArrayList<Calendar>(goalTime);
}
/**
* Varvtider sparas i goalTimes där den sista tiden i listan är sluttiden och
* varvtiderna ligger innan.
* @return Varvtider i en ArrayLista ifall det finns, annars en empty lista.
*/
public ArrayList<Calendar> getLapTimes() {
ArrayList<Calendar> laps = new ArrayList<Calendar>();
// Return en empty lista då det inte finns varvtider.
if (goalTime.size() <= 1){
return laps;
}
// Annars tar bort sluttiden och retunerar varvtiderna.
laps = goalTime;
Collections.sort(laps);
laps.remove(goalTime.size()-1);
return laps;
}
public int getID() {
return id;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Person other = (Person) obj;
if (id != other.id)
return false;
return true;
}
}
|
package com.rockwellcollins.atc.agree.analysis.extentions;
import java.util.Map;
import jkind.api.results.AnalysisResult;
import jkind.results.Counterexample;
import jkind.results.Property;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.emf.ecore.EObject;
import org.osate.aadl2.ComponentImplementation;
import org.osate.aadl2.instance.ComponentInstance;
import org.osate.annexsupport.AnnexHighlighter;
import org.osate.annexsupport.AnnexPlugin;
import com.rockwellcollins.atc.agree.analysis.AgreeLayout;
import com.rockwellcollins.atc.agree.analysis.AgreeRenaming;
import com.rockwellcollins.atc.agree.analysis.ast.AgreeProgram;
public class AgreeAutomaterProxy extends ExtensionProxy implements AgreeAutomater {
private AgreeAutomater extractor;
protected AgreeAutomaterProxy(IConfigurationElement configElem) {
super(configElem);
// TODO Auto-generated constructor stub
}
@Override
public AgreeProgram transform(AgreeProgram program) {
AgreeAutomater extractor = getAgreeAutomater();
if (extractor != null) {
return extractor.transform(program);
}
return null;
}
private AgreeAutomater getAgreeAutomater() {
if (extractor != null) {
return extractor;
}
try {
extractor = (AgreeAutomater) configElem.createExecutableExtension(ATT_CLASS);
} catch (Exception e) {
System.err.println("error instantiating agree automater in plugin "
+ configElem.getDeclaringExtension().getContributor().getName());
}
return extractor;
}
@Override
public AgreeRenaming rename(AgreeRenaming renaming) {
AgreeAutomater extractor = getAgreeAutomater();
if (extractor != null) {
return extractor.rename(renaming);
}
return null;
}
@Override
public AnalysisResult transformResult(AnalysisResult res) {
AgreeAutomater extractor = getAgreeAutomater();
if (extractor != null) {
return extractor.transformResult(res);
}
return null;
}
@Override
public AgreeLayout transformLayout(AgreeLayout layout) {
AgreeAutomater extractor = getAgreeAutomater();
if (extractor != null) {
return extractor.transformLayout(layout);
}
return null;
}
}
|
package projet;
import java.util.HashMap;
public class Main {
public static void main(String[] args) throws Exception {
EngineStatique engineStatique = new EngineStatique();
Transformation transformation = new Transformation();
EngineParallele engineParallele = new EngineParallele();
HashMap<String, Object> tags = new HashMap<String, Object>();
tags.put("n",5);
tags.put("n2",5);
tags.put("n3", 4);
tags.put("n4", 2);
tags.put("puiss",3);
tags.put("x", 100);
Calcul calc = new Calcul();
//engineStatique.execute("model/Calcul.xmi", calc, tags);
//engineStatique.execute("model/newCalculSeq.xmi", calc, tags);
engineStatique.execute("model/newCalculSeqComplique.xmi", calc, tags);
//transformation.transfo("model/Calcul.xmi");
//transformation.transfo("model/newCalculSeq.xmi");
transformation.transfo("model/newCalculSeqComplique.xmi");
engineParallele.execute("model/CalculPara.xmi", calc, tags);
}
}
|
package com.mystore.qa.pages;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.mystore.qa.base.TestBase;
public class ConfirmationPage extends TestBase {
@FindBy(xpath="//p[contains(text(),'Your order on My Store is complete.')]")
@CacheLookup
WebElement confirmationTag;
@FindBy(xpath="//*[@id=\"center_column\"]/p[2]/a")
@CacheLookup
WebElement backBtn;
//Initialization
public ConfirmationPage(){
PageFactory.initElements(driver, this);
}
public String validateConfirmationPageTitle(){
return driver.getTitle();
}
public boolean validateConfirmationPage(){
return confirmationTag.isDisplayed();
}
public OrderHistoryPage backToOrders() {
backBtn.click();
return new OrderHistoryPage();
}
}
|
package com.ds.algo.matters.bitmagic;
public class NumberToZero {
public static void main(String[] args){
int[] nums = {2, 5, 1, 3, 4, 7};
int n = 3;
shuffle(nums, n);
}
public static int[] shuffle(int[] nums, int n) {
int[] result = new int[2*n];
int l = nums.length;
int j = 0;
for(int i = 0; i < n; i++){
result[j++] = nums[i];
result[j++] = nums[n + i];
}
return result;
}
}
|
package com.hyty.tree.treejiegou.entity;
import com.alibaba.fastjson.annotation.JSONField;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
/**
* Created by czy on 2019/3/22.
*/
@Entity
public class TreeEntiy implements Serializable {
/**
* 主键
*/
@Id
@GenericGenerator(name = "system-uuid", strategy = "uuid")
@GeneratedValue(generator = "system-uuid")
@Column(length = 32, unique = true)
private String id;
/**
* 节点编号
*/
@NotNull(message = "节点编号不能为空")
@Column(name = "CODE", length = 200)
private String code;
/**
* 节点名称
*/
@NotNull(message = "节点名称名称不能为空")
@Column(name = "NAME", length = 200)
private String name;
/**
* 上级节点编号
*/
@Column(name = "SUPERIOR_CODE", length = 200)
private String superiorcode;
/**
* 状态(1 启用 0 禁用或删除)
*/
@Column(name = "STATE", length = 10)
private String state;
/**
* 创建人
*/
@Column(name = "FOUNDER", length = 200)
private String founder;
/**
* 创建时间
*/
@Column(name = "FOUNDER_TS", length = 200)
private String founderts;
/**
* 与员工关联
*/
@JSONField(serialize = false)
@OneToMany(mappedBy = "treeentiy", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private Set<Personnel> personnels = new HashSet<>(0);
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSuperiorcode() {
return superiorcode;
}
public void setSuperiorcode(String superiorcode) {
this.superiorcode = superiorcode;
}
public String getFounder() {
return founder;
}
public void setFounder(String founder) {
this.founder = founder;
}
public String getFounderts() {
return founderts;
}
public void setFounderts(String founderts) {
this.founderts = founderts;
}
public Set<Personnel> getPersonnels() {
return personnels;
}
public void setPersonnels(Set<Personnel> personnels) {
this.personnels = personnels;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}
|
package decorator;
public class ConcreteDecorator2 extends Decorator {
public ConcreteDecorator2() {
}
public ConcreteDecorator2(Component component) {
super(component);
}
@Override
public String methodA() {
return super.getComponent().methodA() + "ConcreteDecorator2 methodA()";
}
@Override
public String methodB() {
return super.getComponent().methodB() + "ConcreteDecorator2 methodB()";
}
}
|
package com.eres.waiter.waiter.model.events;
public class EventMessageInKitchen {
private boolean send;
public boolean isSend() {
return send;
}
public void setSend(boolean send) {
this.send = send;
}
public EventMessageInKitchen(boolean send) {
this.send = send;
}
}
|
package com.translator.domain.model.validation;
import com.translator.domain.model.numeral.RomanNumeral;
import org.junit.Test;
import java.util.Arrays;
import static com.translator.domain.model.numeral.RomanNumeral.*;
import static java.util.Arrays.asList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
public class NonRepeatableSymbolTest {
@Test
public void
numeralsValid_WhenNoNonRepeatableSymbols() {
assertSymbolCanBeRepeated(I,I);
assertSymbolCanBeRepeated(X,X);
assertSymbolCanBeRepeated(C,C);
assertSymbolCanBeRepeated(M,M);
}
@Test
public void
numeralsInvalid_WhenNonRepeatableSymbolsPresent() {
assertSymbolCannotRepeated(V,V);
assertSymbolCannotRepeated(L,L);
assertSymbolCannotRepeated(D,D);
}
private void assertSymbolCanBeRepeated(RomanNumeral... numerals) {
assertValid(true, "Checking Roman numerals " + Arrays.toString(numerals) + " are ok to be repeated", numerals);
}
private void assertSymbolCannotRepeated(RomanNumeral... numerals) {
assertValid(false, "Checking Roman numerals " + Arrays.toString(numerals) + " are not allow to be repeated ", numerals);
}
private void assertValid(boolean expected, String failureMessage, RomanNumeral... numerals) {
NonRepeatableSymbol nonRepeatableSymbol = new NonRepeatableSymbol();
assertThat(failureMessage, nonRepeatableSymbol.validate(asList(numerals)), is(expected));
}
}
|
package com.rofour.baseball.dao.officemanage.bean;
import java.io.Serializable;
import java.util.Date;
/**
* @ClassName: OfficeAuditBean
* @Description:
* @author ZXY
* @date 2016/10/17 18:55
*/
public class OfficeAuditBean implements Serializable {
private static final long serialVersionUID = 676859167884185634L;
private Long auditId;
private Integer optType;
private Long packetUserId;
private Long applyUserId;
private Integer auditState;
private Date applyTime;
private Long auditUserId;
private Date auditTime;
public Long getAuditId() {
return auditId;
}
public void setAuditId(Long auditId) {
this.auditId = auditId;
}
public Integer getOptType() {
return optType;
}
public void setOptType(Integer optType) {
this.optType = optType;
}
public Long getPacketUserId() {
return packetUserId;
}
public void setPacketUserId(Long packetUserId) {
this.packetUserId = packetUserId;
}
public Long getApplyUserId() {
return applyUserId;
}
public void setApplyUserId(Long applyUserId) {
this.applyUserId = applyUserId;
}
public Integer getAuditState() {
return auditState;
}
public void setAuditState(Integer auditState) {
this.auditState = auditState;
}
public Date getApplyTime() {
return applyTime;
}
public void setApplyTime(Date applyTime) {
this.applyTime = applyTime;
}
public Long getAuditUserId() {
return auditUserId;
}
public void setAuditUserId(Long auditUserId) {
this.auditUserId = auditUserId;
}
public Date getAuditTime() {
return auditTime;
}
public void setAuditTime(Date auditTime) {
this.auditTime = auditTime;
}
}
|
package things;
import things.entity.Bullet;
import things.entity.GameComponent;
import things.entity.observer.Observer;
import things.entity.singleton.FiredBullets;
import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.*;
import java.net.URL;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Set;
import static javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE;
import static javax.swing.WindowConstants.EXIT_ON_CLOSE;
/**
* This is the main JFrame class with the main method to run the game
*
* @author Darren Moriarty
* Created on 11/11/2016.
*
* This class inherits from JFrame
*/
public class GameMain implements Observer {
private JFrame frame = new JFrame();
private JPanel welcomeGUI = new WelcomeGUI();
private SpaceInvadersGUI spaceInvadersGUI;
private HighScores highscores;
private ClassLoader classLoader = getClass().getClassLoader();
private String startImage = classLoader.getResource("images/1280x960-space-invaders-press-start-wallpaper.jpg").getFile();
private ImageIcon imageIcon = new ImageIcon(startImage);
private JButton startGame = new JButton(imageIcon);
private String startImage2 = classLoader.getResource("images/high-scores.png").getFile();
private ImageIcon imageIcon2 = new ImageIcon(startImage2);
private JButton startGame2 = new JButton(imageIcon2);
private JMenuBar jmenuBar;
private JMenu jmenu;
private JMenu jmenuBack;
private JMenuItem itemBack;
private JMenuItem jmenuItem;
public LinkedList<Player> highScorers = new LinkedList<Player>();
private Set<Bullet> alienBulletsFired;
private Set<Bullet> tankBulletsFired;
public Set<Bullet> getAlienBulletsFired() {
return alienBulletsFired;
}
public Set<Bullet> getTankBulletsFired() {
return tankBulletsFired;
}
private static GameMain gameMain = new GameMain();
public static GameMain getGameMain() {
return gameMain;
}
// JFrame GUI constructor method
private GameMain(){
// Loads the highScores.dat file
loadScores();
alienBulletsFired = new HashSet<>();
tankBulletsFired = new HashSet<>();
FiredBullets.getAlienBullets().registerObserver(this);
FiredBullets.getTankBullets().registerObserver(this);
initialize();
}
private void initialize() {
// Super calls the JFrame constructor and sets the title
frame.setTitle("Space Invaders");
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.setLocation(200,0);
try{
GameComponent.playSound("sounds/spaceinvaders1.wav");
}
catch (Exception e) {e.printStackTrace();}
// JMenuBar components
jmenuBar = new JMenuBar();
jmenu = new JMenu("Info");
jmenuBack = new JMenu(("Back"));
itemBack = new JMenuItem("Back");
jmenuItem = new JMenuItem("History");
// adding Jmenu
jmenu.add(jmenuItem);
jmenuBack.add(itemBack);
jmenuBar.add(jmenu);
jmenuBar.add(jmenuBack);
frame.setJMenuBar(jmenuBar);
// listener for the history menu item
jmenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null,"Space Invaders " +
"is an arcade video game created by Tomohiro Nishikado and released in 1978.\n" +
"It was originally manufactured and sold by Taito in Japan, and was later licensed\n" +
"for production in the United States by the Midway division of Bally. Space Invaders is one of\n" +
"the earliest shooting games and the aim is to defeat waves of aliens with a laser\n" +
"cannon to earn as many points as possible. In designing the game, Nishikado drew\n" +
"inspiration from popular media: Breakout, The War of the Worlds, and Star Wars.\n" +
"To complete it, he had to design custom hardware and development tools.\n" +
"\nIt was one of the forerunners of modern video gaming and helped expand the\n" +
"video game industry from a novelty to a global industry (see golden age of video arcade games).\n" +
"When first released, Space Invaders was very successful.\n");
}
});
// listener for the back item to change the content pane
itemBack.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
changeContentPane2();
}
});
// adding the two buttons to the welcome screen
welcomeGUI.add(startGame);
welcomeGUI.add(startGame2);
// colouring the button borders black to make them look invisible
startGame.setBackground(Color.black);
startGame.setBorder(new LineBorder(Color.BLACK));
startGame2.setBackground(Color.BLACK);
startGame2.setBorder(new LineBorder(Color.BLACK));
// setting the content pane
frame.setContentPane(welcomeGUI);
// button to load the game
startGame.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// calling start game method
startGame();
System.out.println("new panel created");//for debugging purposes
// resetting the container
frame.validate();
frame.setVisible(true);
}
});
// Button for loading the high scores
startGame2.addActionListener(new ActionListener() {
//@Override
public void actionPerformed(ActionEvent e) {
viewHighScores();
}
});
// setting focus to the current pane
frame.getContentPane().setFocusable(true);
frame.getContentPane().requestFocusInWindow();
// This sets the size of the JFrame to whatever the size of the Component inside it is
frame.pack();
frame.setVisible(true);
//Changing the window closing, anonymous inner class
frame.addWindowListener(
new WindowAdapter(){
@Override
public void windowClosing(WindowEvent e){
int option = JOptionPane.showConfirmDialog(null,"Are you sure you want to quit the game?");
if(option == JOptionPane.YES_OPTION){
try{// saving the high scores when the window is closed
saveScores();
System.out.println("The save worked");
}
catch (IOException f){
f.printStackTrace();
}
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
}else{
frame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
}
}//end windowClosing
public void windowIconified(WindowEvent e){
JOptionPane.showMessageDialog(null,"Minimising the window");
}
public void windowDeiconified(WindowEvent e){
JOptionPane.showMessageDialog(null,"Restoring the window");
}
});
}
// adding a link to the highScorers
public void addToHighScorers(Player highScorers){
this.highScorers.add(highScorers);
}
// returns the size of the list
public int getHighScorersSize(){
return highScorers.size();
}
// prints the contents of the list
public void printHighScorers(){
for (Player player: highScorers) {
System.out.println(player);
}
}
// sorting the highScorers list
public void sortHighScorers(){
// using an insertion sort
int smallest;
for (int i = 0; i < highScorers.size(); i++) {
smallest = i;
for (int j = i + 1; j < highScorers.size(); j++) {
if (highScorers.get(j).getPlayerScore() < highScorers.get(smallest).getPlayerScore()) {
smallest = j;
}
}
if (smallest != i) {
final int tempScore = highScorers.get(i).getPlayerScore();
final String tempName = highScorers.get(i).getName();
highScorers.get(i).setPlayerScore(highScorers.get(smallest).getPlayerScore());
highScorers.get(i).setName(highScorers.get(smallest).getName());
highScorers.get(smallest).setPlayerScore(tempScore);
highScorers.get(smallest).setName(tempName);
}
}
for (Player player: highScorers) {
System.out.println(player.getName() + " has a score of " + player.getPlayerScore());
}
}
public void removeFirstLink(){
highScorers.remove(0);
}
// creates the instance of the GUI
public void startGame() {
spaceInvadersGUI = new SpaceInvadersGUI();
jmenuBar.setVisible(false);
changeScreen(spaceInvadersGUI);
frame.pack();
}
public void viewHighScores() {
highscores = new HighScores(this);
changeScreen(highscores);
frame.pack();
}
public void changeContentPane2() {
changeScreen(welcomeGUI);
jmenuBar.setVisible(true);
}
private void changeScreen(JPanel screen) {
frame.setContentPane(screen);
screen.requestFocusInWindow();
}
// method for saving scores
public void saveScores() throws IOException {
ObjectOutputStream oob = new ObjectOutputStream(new FileOutputStream("HighScores.dat"));
oob.writeObject(highScorers);
oob.close();
}
public void loadScores() {
try{
URL startImage = classLoader.getResource("HighScores.dat");
ObjectInputStream oobIn = new ObjectInputStream(new FileInputStream(startImage.getFile()));
highScorers = (LinkedList<Player>) oobIn.readObject();
oobIn.close();
} catch (Exception e){ e.printStackTrace(); }
}
// main method creates a new JFrame called GameMain
public static void main(String[] args) {
new GameMain();
}
@Override
public void updateObserver(GameComponent gameComponent) {
Bullet bullet = (Bullet) gameComponent;
if (bullet.isAlienBullet())
alienBulletsFired.add(bullet);
else
tankBulletsFired.add(bullet);
}
public void manageHighScores() {
//Create the player class
Player player = new Player(SpaceInvadersGUI.getPlayerScore(), JOptionPane.showInputDialog(null, "Your tank has been destroyed\nPlease enter your name: "));
SpaceInvadersGUI.setPlayerScore(0);
if(getHighScorersSize() < 11){
addToHighScorers(player);
sortHighScorers();
if(getHighScorersSize() == 11){
removeFirstLink();
}
}
initialize();
}
}
|
package Interface;
public class HistoriqueUtilisateur {
public String getTypeOperation() {
return TypeOperation;
}
public void setTypeOperation(String typeOperation) {
TypeOperation = typeOperation;
}
public String getDateHeure() {
return DateHeure;
}
public void setDateHeure(String dateHeure) {
DateHeure = dateHeure;
}
public String getDescription() {
return Description;
}
public void setDescription(String description) {
Description = description;
}
private String TypeOperation;
private String DateHeure;
private String Description;
@Override
public String toString() {
return "HistoriqueUtilisateur{" +
"TypeOperation='" + TypeOperation + '\'' +
", DateHeure='" + DateHeure + '\'' +
", Description='" + Description + '\'' +
'}';
}
public HistoriqueUtilisateur(String typeOperation, String dateHeure, String description) {
TypeOperation = typeOperation;
DateHeure = dateHeure;
Description = description;
}
}
|
package Programming;
import Enums.LiteraryAbilities;
import Enums.ProgrammerType;
public class JavaProgrammer extends Person {
// variaveis de instancia de JavaProgrammer
private int code;
private int programmingYears;
private String projectName;
private ProgrammerType programmerType;
// construtor default de JavaProgrammer
public JavaProgrammer() {
}
// construtor de JavaProgrammer
public JavaProgrammer(String name, String date, String address, int citizenCard, int vatNumber, int baseSalary, int code, int programmingYears, String projectName, ProgrammerType programmerType) {
super(name, date, address, citizenCard, vatNumber, baseSalary);
this.code = code;
this.programmingYears = programmingYears;
this.projectName = projectName;
this.programmerType = programmerType;
}
// GETTERS E SETTERS
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public int getProgrammingYears() {
return programmingYears;
}
public void setProgrammingYears(int programmingYears) {
this.programmingYears = programmingYears;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public ProgrammerType getProgrammerType() {
return programmerType;
}
public void setProgrammerType(ProgrammerType programmerType) {
this.programmerType = programmerType;
}
@Override
double calculateFinalSalary() {
if (this.programmerType == ProgrammerType.JUNIOR) {
return (getBaseSalary() + getBaseSalary() * 0.10 + getBaseSalary() * 0.05 * this.programmingYears);
} else if (this.programmerType == ProgrammerType.SENIOR) {
return (getBaseSalary() + getBaseSalary() * 0.20 + getBaseSalary() * 0.05 * this.programmingYears);
}
return getBaseSalary();
}
// metodo toString para imprimir
public String toString() {
System.out.print(super.toString());
String text = "Código de funcionário: " + code + "\n"
+ "Número de anos de programação Java : " + programmingYears + "\n"
+ "Nome do projeto que se encontra a desenvolver : " + projectName + "\n"
+ "Tipo de programador : " + programmerType + "\n";
return text;
}
public String printJavaProgrammer() {
return super.toString();
}
}
|
package com.kodilla.good.patterns.challenges.secondChallenge;
public class Order {
private final Item item;
private final Buyer buyer;
private final int quantity;
public Order(Item item, Buyer buyer, int quantity) {
this.item = item;
this.buyer = buyer;
this.quantity = quantity;
}
public Item getItem() {
return item;
}
public int getQuantity() {
return quantity;
}
public Buyer getBuyer() {
return buyer;
}
@Override
public String toString() {
return "Order{" +
"item=" + item +
", buyer=" + buyer.toString() +
", quantity=" + quantity +
'}';
}
}
|
package swexpert;
import java.util.Arrays;
import java.util.Scanner;
public class SWEA_1289_D3_원재의_메모리 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(System.in);
StringBuilder sb = new StringBuilder();
int TC =s.nextInt();
for (int i = 1; i <= TC; i++) {
int count= 0; // 카운트
sb.append("#").append(i).append(" ");
String[] memory = s.next().split(""); // 각 숫자를 하나씩 메모리에 저장
String check = memory[0]; // 메모리의 처음 수
if(check.equals("1")) count = 1; // 만약 처음수가 1이면 카운트를 1개 올려둔다
for (int j = 1; j < memory.length; j++) {
if(!memory[j].equals(check)) { // 다음수와 비교해서 다르면 카운트 올린다
check = memory[j];
count++;
}
}
sb.append(count).append("\n");
}
System.out.println(sb);
}
}
|
package main;
/*
* TopTenBrazilianWriters: Job que recupera o top ten
* brasileiros com maior quantidade de posts
*
*
* @author Edivaldo Mascarenhas Jr.
* @version 1.0
*/
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.MultipleInputs;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;
import mappers.PostMapper;
import mappers.TopTenBrazilianWritersMapper;
import mappers.UserMapper;
import reducers.TopTenBrazilianWritersCombiner;
import reducers.TopTenBrazilianWritersReducer;
import reducers.UserJoinReducer;
/**
* The Class TopTenBrazilianWriters.
*/
public class TopTenBrazilianWriters {
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
* @throws ClassNotFoundException the class not found exception
* @throws InterruptedException the interrupted exception
*/
public static void main(String args[]) throws IOException, ClassNotFoundException, InterruptedException {
Configuration conf = new Configuration();
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
if (otherArgs.length != 4) {
System.err.println("Usage: TopTenBrazilianWriters <input_file1> <input_file2> <output_dir>");
System.exit(2);
}
Path datasetUserPath = new Path(otherArgs[0]);
Path datasetPostPath = new Path(otherArgs[1]);
Path outputDirIntermediate = new Path(otherArgs[3] + "_int");
Path outputDirpPath = new Path(otherArgs[3]);
Job job = Job.getInstance(conf, "StackOverflow Top Ten Brazilian Post Writers P1");
job.getConfiguration().set("mapRegex", "(.*)bra[sz]il(.*)");
job.setJarByClass(TopTenBrazilianWriters.class);
MultipleInputs.addInputPath(job, datasetUserPath, TextInputFormat.class, UserMapper.class);
MultipleInputs.addInputPath(job, datasetPostPath, TextInputFormat.class, PostMapper.class);
job.getConfiguration().set("join.type", args[2]);
job.setReducerClass(UserJoinReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
FileOutputFormat.setOutputPath(job, outputDirIntermediate);
int code = job.waitForCompletion(true) ? 0 : 1;
if (code == 0) {
job = Job.getInstance(conf, "StackOverflow Top Ten Brazilian Post Writers P2");
job.setOutputKeyClass(NullWritable.class);
job.setOutputValueClass(Text.class);
job.setJarByClass(TopTenBrazilianWriters.class);
job.setMapperClass(TopTenBrazilianWritersMapper.class);
job.setCombinerClass(TopTenBrazilianWritersCombiner.class);
job.setReducerClass(TopTenBrazilianWritersReducer.class);
job.setNumReduceTasks(1);
FileInputFormat.addInputPath(job, outputDirIntermediate);
FileOutputFormat.setOutputPath(job, outputDirpPath);
code = job.waitForCompletion(true) ? 0 : 1;
}
FileSystem.get(conf).delete(outputDirIntermediate, true);
System.exit(code);
}
}
|
package com.automician.core.webdriverconfig;
import com.codeborne.selenide.WebDriverProvider;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
public class CustomFirefoxWebDriverProvider implements WebDriverProvider {
/*
* By default Selenium uses geckodriver for firefox
* in geckodriver there are some problems (such as https://github.com/mozilla/geckodriver/issues/233)
* it can be possible to use firefox driver (for Firefox v <= 47.0.1)
* this class ensure this
*/
@Override
public WebDriver createDriver(DesiredCapabilities capabilities) {
capabilities.setCapability("marionette", false);
return new FirefoxDriver(capabilities);
}
}
|
package test;
import java.util.Stack;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
/**关于java.util.Stack
*
* 栈是Vector的一个子类,它实现了一个标准的后进先出的栈。
* Stack()
*
* boolean empty() 测试堆栈是否为空。
* Object peek( ) 查看堆栈顶部的对象,但不从堆栈中移除它。
* Object pop( ) 移除堆栈顶部的对象,并作为此函数的值返回该对象。
* Object push(Object element) 把项压入堆栈顶部。
* int search(Object element) 返回对象在堆栈中的位置,以 1 为基数。
*
**/
public class ExpressionOperation {
/**
* 符号权重
* @param item 符号
* @return 权重int
*/
private static int heavy(String item) {
int heavy;
if ("(".equals(item) || ")".equals(item) ){
heavy = 0 ;
}else if("+".equals(item) || "-".equals(item)){
heavy = 1 ;
}else if("*".equals(item) || "/".equals(item)){
heavy = 2;
}else{
throw new IndexOutOfBoundsException ("存在没有设置权重的字符");
}
return heavy;
}
/**
* 中缀表达式转化为后缀表达式
* @param infix 中缀表达式列表
* @return 后缀表达式列表
*/
public static ArrayList<String> InfixToSuffix(ArrayList<String> infix){
//创建后缀表达式表
ArrayList<String> suffix = new ArrayList<String>();
//创建符号栈
Stack<String> operator = new Stack<>();
//对原中缀表达式进行循环
for (int i = 0 ; i < infix.size() ; i++){
String item = infix.get(i);
//如果是数字,直接入表
if (isNum(item)){
suffix.add(item);
//如果是括号
}else if ("(".equals(item) || ")".equals(item)){
//如果为(,直接入栈
if ("(".equals(item)){
operator.push(item);
//如果是),从栈顶依次向下出栈入表,直到遇到(
}else{
while (true){
//遇到(,只出栈,并跳出循环
if("(".equals(operator.peek())){
operator.pop();
break;
//遇到其他符号,出栈入表
}else{
suffix.add(operator.pop());
}
}
}
//如果遇到操作符
}else{
//如果栈为空栈,或当前符号权重大于前一个,入栈
if(operator.isEmpty() || heavy(item) > heavy(operator.peek())){
operator.push(item);
//若当前符号权重小于前一个,循环元素出栈入表,直至空栈,或遇到权重更小的操作符或(
}else{
while (!operator.isEmpty() && !"(".equals(operator.peek())){
if(heavy(item) <= heavy(operator.peek())){
suffix.add(operator.pop());
}
}
//当前操作符压栈
operator.push(item);
}
}
}
//如果最后一个是括号,会导致输出结果多出空的字符串
for (int i = 0 ; i<suffix.size() ; i++){
if ("".equals(suffix.get(i))){
suffix.remove(i);
}
}
//循环完毕,若栈不为空,依次出栈入表。
while (!operator.isEmpty()){
suffix.add(operator.pop());
}
return suffix;
}
/**
* 判断字符串是否为数字
* @param str 需判断的字符串
* @return true/false
*/
public static boolean isNum(String str){
for (int i = 0 ; i<str.length() ; i++){
if (!Character.isDigit(str.charAt(0))){
return false;
}
}
return true;
}
/**
* 字符串转化为ArrayList
* @param str 需转换的字符串
* @return ArrayList
*/
public static ArrayList<String> StringToList(String str){
//创建列表
ArrayList<String> list = new ArrayList<>();
String digit = "";
//对字符串进行循环
for (int i = 0 ; i < str.length() ; i++){
//储存当前循环的字符
String item = String.valueOf(str.charAt(i));
//如果是数字或小数点,储存到digit中
if (isNum(item) || ".".equals(item)){
digit+=String.valueOf(item);
//如果是符号
}else if("(".equals(item) || ")".equals(item) || "+".equals(item) || "-".equals(item) || "*".equals(item) || "/".equals(item)) {
//如果是第一个,即(,直接入表
if (i==0){
list.add(String.valueOf(item));
//否则将前一个数字入表,随后符号入表
}else{
if (!"".equals(digit)){
list.add(digit);
digit = "";
}
list.add(String.valueOf(item));
}
}else{
throw new IndexOutOfBoundsException ("非法字符");
}
}
//循环完毕,若还有储存的数字,入表。
list.add(String.valueOf(digit));
return list;
}
/**
* 根据后缀表达式suffix计算结果
* @param suffix 后缀表达式列表
* @return 结果
*/
private static double calculate(ArrayList<String> suffix) {
//创建数字栈
Stack<String> number = new Stack<>();
//对列表中元素进行循环
for(int i=0; i<suffix.size(); i++){
String item = suffix.get(i);
//如果是数字,入栈
if(isNum(item)){
number.push(item);
//如果是符号,取栈顶两个元素,运算后入栈
}else {
//String → double
double num2 = Double.parseDouble(number.pop());
double num1 = Double.parseDouble(number.pop());
double result = 0;
if(item.equals("+")){
result = num1 + num2;
}else if(item.equals("-")){
result = num1 - num2;
}else if(item.equals("*")){
result = num1 * num2;
}else if(item.equals("/")){
result = num1 / num2;
}else {
throw new RuntimeException("非法符号");
}
//double → String
number.push(String.valueOf(result));
}
}
//返回计算结果
return Double.parseDouble(number.pop());
}
/**
* 两个数字之间的运算
* @param x1 数字1
* @param x2 数字2
* @param item 运算符号
* @return 结果
*/
private static double calculate(double x1,double x2,String item){
//定义结果
double result ;
//根据运算符对两个数字进行运算
if (item.equals("+")){
result = x1+x2;
}else if (item.equals("-")){
result = x1-x2;
}else if (item.equals("*")){
result = x1*x2;
}else if (item.equals("/")){
result = x1/x2;
}else{
throw new IndexOutOfBoundsException ("表达式非法");
}
//返回
return result;
}
/**
* 中缀表达式的运算
* @param infix 中缀表达式的列表
* @return 结果
*/
public static double InFixOperation(ArrayList<String> infix){
//定义数字和操作符的栈
Stack<String> number = new Stack<>();
Stack<String> operator = new Stack<>();
//对中缀表达式进行循环
for (int i = 0 ; i<infix.size() ; i++){
//当前循环的符号
String item = infix.get(i);
//如果是数字,直接入数字栈
if (isNum(item)){
number.push(item);
//否则就是操作符
}else{
//如果是),将前面的数字和符号依次从后往前运算,直至(,并将结果入数字栈
if (")".equals(item)){
while (!operator.peek().equals("(")){
double num2 = Double.parseDouble(number.pop());
double num1 = Double.parseDouble(number.pop());
String oper = operator.pop();
number.push(String.valueOf(calculate(num1,num2,oper)));
}
operator.pop();
//如果是(,或操作栈为空,或当前运算符权重大于前者,直接入操作符栈
}else if ("(".equals(item) || operator.isEmpty() || heavy(item)>heavy(operator.peek()) ){
operator.push(item);
//否则,将前两个数字进行符号运算,结果入数字栈,操作符入操作栈
}else{
double num2 = Double.parseDouble(number.pop());
double num1 = Double.parseDouble(number.pop());
String oper = operator.pop();
number.push(String.valueOf(calculate(num1,num2,oper)));
operator.push(item);
}
}
}
//循环完毕,若符号栈不为空,则从后往前运算,并将结果入数字栈
if (!operator.isEmpty()){
double num2 = Double.parseDouble(number.pop());
double num1 = Double.parseDouble(number.pop());
String oper = operator.pop();
number.push(String.valueOf(calculate(num1,num2,oper)));
}
//返回结果
return Double.parseDouble(number.pop());
}
public static void main(String[] args){
//输入
//Scanner sc = new Scanner(System.in);
//String orgexp = sc.nextLine();
String orgexp="(0*1)+((2.5+3)*4.5)-50";
ArrayList<String> infix = StringToList(orgexp);
ArrayList<String> suffix = InfixToSuffix(infix);
System.out.print("中缀转化后缀为:");
for (int i = 0 ; i < suffix.size() ; i++){
if (i == suffix.size()-1){
System.out.print(suffix.get(i));
continue;
}
System.out.print(suffix.get(i)+",");
}
System.out.println();
System.out.print("最终结果:"+orgexp+"="+calculate(suffix));
System.out.print("最终结果:"+orgexp+"="+InFixOperation(infix));
}
}
|
package TCP;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import javax.swing.JOptionPane;
public class TCP
{
private Socket socket;
private BufferedReader br;
private BufferedWriter bw;
public TCP(String ip, int port)
{
try
{
socket = new Socket(ip, port);
} catch (Exception e)
{
JOptionPane.showMessageDialog(null, e, "Fehler", JOptionPane.ERROR_MESSAGE);
}
}
public void senden(String uebergabe)
{
try
{
bw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
bw.write(uebergabe);
bw.newLine();
bw.flush();
} catch (IOException e)
{
e.printStackTrace();
}
}
public String empfangen()
{
try
{
br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
return br.readLine();
} catch (IOException e)
{
e.printStackTrace();
}
return null;
}
} |
package net.jgp.labs.io.file;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class FileIO {
public static StringBuffer fileToStringBuffer(String filename) throws IOException {
StringBuffer sb = new StringBuffer();
File f = new File(filename);
FileInputStream fis = new FileInputStream(f);
//BufferedInputStream bif = new BufferedInputStream(fis);
byte b[] = new byte[4096];
while (fis.read(b) != -1) {
sb.append(new String(b));
}
fis.close();
return sb;
}
public static StringBuffer fileToStringBufferWithBuffer(String filename) throws IOException {
StringBuffer sb = new StringBuffer();
File f = new File(filename);
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bif = new BufferedInputStream(fis);
byte b[] = new byte[4096];
while (bif.read(b) != -1) {
sb.append(new String(b));
}
fis.close();
bif.close();
return sb;
}
}
|
package com.axellience.vueroutergwt.client.functions;
import com.axellience.vueroutergwt.client.Route;
import jsinterop.annotations.JsFunction;
/**
* @author Adrien Baron
*/
@FunctionalInterface
@JsFunction
public interface AfterEach {
void afterEach(Route to, Route from);
}
|
import java.util.Scanner;
public class Star {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("홀수를 입력해주세요: ");
int lineCount = sc.nextInt();
int mid = (int) (lineCount / 2) + 1;
for(int i = 1; i <= lineCount; i++) {
if(i <= mid) {
for(int j = 0; j < (mid-i); j++) {
System.out.print(" ");
}
for(int j = 0; j < (2*i-1); j++) {
System.out.print("*");
}
for(int j = 0; j < (mid-i); j++) {
System.out.print(" ");
}
System.out.println();
} else {
int temp = (lineCount - i) + 1;
; for(int j = 0; j < (mid-temp); j++) {
System.out.print(" ");
}
for(int j = 0; j < (2*temp-1); j++) {
System.out.print("*");
}
for(int j = 0; j < (mid-temp); j++) {
System.out.print(" ");
}
System.out.println();
}
}
}
} |
package com.androiddemo;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.androiddemo.adapter.ImageAdapter;
import com.androiddemo.com.androiddemo.listener.ItemClickListener;
import com.androiddemo.model.Resim;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
public class ImageListActivity extends AppCompatActivity {
private RecyclerView recyclerView;
public static final String EXTRA_URL = "imageUrl";
private RequestQueue mQueue;
private Context context = this;
private ImageAdapter adapter;
private ArrayList<Resim> resimList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.image_list);
recyclerView = findViewById(R.id.recyclerView);
mQueue = Volley.newRequestQueue(getApplicationContext());
getImageList();
}
public void getImageList(){
String url = "https://pixabay.com/api/?key=10466460-c02a7b278f618f22645a6a2a5&q=yellow+flowers&image_type=photo&pretty=true";
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
resimList = new ArrayList<>();
try {
JSONArray jsonArray = response.getJSONArray("hits");
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject hit = jsonArray.getJSONObject(i);
String imageUrl = hit.getString("webformatURL");
resimList.add(new Resim(imageUrl));
}
adapter = new ImageAdapter(getApplicationContext(), resimList, new ItemClickListener() {
@Override
public void onDetail(View view, int position) {
Resim resim = resimList.get(position);
Intent i = new Intent(ImageListActivity.this,Detail.class);
i.putExtra(EXTRA_URL,resim.getUrl());
startActivity(i);
}
});
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(ImageListActivity.this);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(adapter);
} catch (JSONException e) {
e.printStackTrace();
Toast.makeText(context, e+"", Toast.LENGTH_SHORT).show();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(context, "hata mesajı", Toast.LENGTH_SHORT).show();
}
});
mQueue.add(request);
}
}
|
package soft.chess.client;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.MalformedURLException;
import java.net.MulticastSocket;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import javax.swing.JFrame;
import javax.swing.JPanel;
import net.sf.json.JSONObject;
import soft.chess.action.RoomAction;
import soft.chess.client.GameHall.GameChatPanel;
import soft.chess.client.GameHall.GameHallMusicPlayerPanel;
import soft.chess.client.GameHall.GameHallSendMsgPanel;
import soft.chess.client.GameHall.GameRoomInfoPanel;
import soft.chess.client.GameHall.GameHallMainPanel;
import soft.chess.domain.Player;
import soft.chess.domain.RoomBean;
import soft.chess.receiveData.ReceiveDataFromHall;
import soft.chess.util.FrameUtil;
import soft.chess.util.RoomServerMsgUtil;
import soft.chess.util.SocketUtil;
import soft.chess.util.SoftConstant;
/**
*
* ClassName: GameHallClient
* @Description: 游戏大厅的主界面
* @author wangsuqi
* @date 2016年10月5日
* @see
*/
public class GameHallClient extends JFrame{
//单例模式
private static GameHallClient gameHall;
// //定义大厅组播里的MulticastSocket实例
// private static MulticastSocket socket = null;
//
// private DatagramPacket outPacket = null;
//发消息
private JPanel sendp;
//接收消息
private JPanel receivep;
//游戏房间桌面
private GameHallMainPanel roomtablep;
//音乐播放器
private GameHallMusicPlayerPanel musicPlayerp;
//接收大厅信号的线程
private ReceiveDataFromHall receiveInfoRun;
private Thread receiveInfoThread;
private GameHallClient() throws IOException{
setLayout(null);
setSize(1100, 700);
setTitle("欢迎进入游戏大厅");
sendp=new GameHallSendMsgPanel(this);
sendp.setBounds(5, 590,245, 85);
sendp.setBorder(SoftConstant.shadowborder);
receivep=new GameChatPanel();
receivep.setBounds(255, 590, 635, 85);
receivep.setBorder(SoftConstant.shadowborder);
musicPlayerp=new GameHallMusicPlayerPanel();
musicPlayerp.setBounds(890, 590, 207, 85);
musicPlayerp.setBorder(SoftConstant.shadowborder);
musicPlayerp.beginMusic();
roomtablep=new GameHallMainPanel(this);
roomtablep.setBounds(5, 5, 1090, 585);
roomtablep.setBorder(SoftConstant.shadowborder);
FrameUtil.baseSetFrame(this,sendp,receivep,roomtablep,musicPlayerp);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
roomtablep.hasLogout();
super.windowClosing(e);
}
});
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//启动接收信号线程
receiveInfoRun=new ReceiveDataFromHall(this);
receiveInfoThread=new Thread(receiveInfoRun);
receiveInfoThread.start();
}
public void BackToGameHall() throws MalformedURLException{
musicPlayerp.beginMusic();
}
//跳转进入游戏房间的回调方法
public void LeaveGameHall() throws IOException{
//关闭歌曲
musicPlayerp.stopMusic();
// //关闭输入框动画
// ((GameHallSendMsgPanel) sendp).exitHall();
//关闭接收大厅信号的线程
// receiveInfoRun.setReceive(false);
// receiveInfoThread.resume();
//关闭主界面
GameHallClient.this.setVisible(false);
//退出组播
// SocketUtil.leaveBroadcast(socket);
}
public static GameHallClient getInstance() throws IOException{
if(gameHall==null){
gameHall=new GameHallClient();
}
gameHall.setVisible(true);
return gameHall;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
getInstance();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public synchronized GameChatPanel getReceivep() {
return (GameChatPanel) receivep;
}
public synchronized GameHallMainPanel getRoomtablep() {
return roomtablep;
}
public synchronized GameHallSendMsgPanel getSendp() {
return (GameHallSendMsgPanel) sendp;
}
}
|
package com.example.hzq.onlookers.Notes;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import com.example.hzq.onlookers.R;
import java.util.ArrayList;
import java.util.List;
public class NotesActivity extends AppCompatActivity {
private List<Notes> notesList = new ArrayList<Notes>();//创建自定义好的适配器Artist
private MyDatabaseHelper myDb;
private Button btnadd;
private ListView lv_note;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_notes);
myDb = new MyDatabaseHelper(this);//实例化自己创建的数据库类
//获取控件
btnadd = (Button) findViewById(R.id.btn_add);
lv_note = (ListView) findViewById(R.id.lv_note);
//初始化函数
init();
}
public void init(){
List<Notes> notesList = new ArrayList<>();//创建Values类型的list保存数据库中的数据
SQLiteDatabase db = myDb.getReadableDatabase();//获得可读SQLiteDatabase对象
//查询数据库中的数据
Cursor cursor = db.query(MyDatabaseHelper.TABLE,null,null,null,null,null,null);
if(cursor.moveToFirst()){
Notes notes;
while (!cursor.isAfterLast()){
//实例化values对象
notes = new Notes();
//把数据库中的一个表中的数据赋值给notes
notes.setId(Integer.valueOf(cursor.getString(cursor.getColumnIndex(MyDatabaseHelper.ID))));
notes.setTitle(cursor.getString(cursor.getColumnIndex(MyDatabaseHelper.TITLE)));
notes.setContent(cursor.getString(cursor.getColumnIndex(MyDatabaseHelper.CONTENT)));
notes.setTime(cursor.getString(cursor.getColumnIndex(MyDatabaseHelper.TIME)));
//将notes对象存入list对象数组中
notesList.add(notes);
cursor.moveToNext();
}
}
cursor.close();
db.close();
//设置list组件adapter
final NotesAdapter myBaseAdapter = new NotesAdapter(this,R.layout.notes_item,notesList);
lv_note.setAdapter(myBaseAdapter);
//+按钮
btnadd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NotesActivity.this.finish();
Intent a = new Intent(NotesActivity.this, WriteDownActivity.class);
startActivity(a);
}
});
//单击查询
lv_note.setOnItemClickListener(new AdapterView.OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent b = new Intent(NotesActivity.this,BriefActivity.class);
Notes values = (Notes) lv_note.getItemAtPosition(position);
//传递数据
b.putExtra(MyDatabaseHelper.TITLE,values.getTitle().trim());
b.putExtra(MyDatabaseHelper.CONTENT,values.getContent().trim());
b.putExtra(MyDatabaseHelper.TIME,values.getTime().trim());
b.putExtra(MyDatabaseHelper.ID,values.getId().toString().trim());
NotesActivity.this.finish();//销毁界面
startActivity(b);
}
});
//长按删除
lv_note.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
final Notes values = (Notes) lv_note.getItemAtPosition(position);
//弹出提示框
new AlertDialog.Builder(NotesActivity.this)
.setTitle("提示框")
.setMessage("是否删除?")
.setPositiveButton("yes",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
SQLiteDatabase db = myDb.getWritableDatabase();
//删除数据库中相应数据
db.delete(MyDatabaseHelper.TABLE,MyDatabaseHelper.ID+"=?",new String[]{String.valueOf(values.getId())});
db.close();
myBaseAdapter.removeItem(position);
lv_note.post(new Runnable() {
@Override
public void run() {
myBaseAdapter.notifyDataSetChanged();
}
});
}
})
.setNegativeButton("no",null).show();//不作处理
return true;
}
});
}
} |
package com.epam.restaurant.dao.exception;
import com.epam.restaurant.dao.impl.UserSqlDao;
import com.epam.restaurant.entity.User;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
import org.testng.annotations.Test;
/**
* Test of DaoException thrown.
*/
public class DaoExceptionTest {
@Rule
public final ExpectedException exception = ExpectedException.none();
@Test
public void testDaoException() throws DaoException {
UserSqlDao dao = new UserSqlDao();
exception.expect(DaoException.class);
User user = dao.getByLogin("");
}
} |
package day17constructors;
public class Constructors02 {
//buyume () methodu bu class ta degil Constructors01 classinda .
// * peki baska class taki bir bilgiyi nasil kullanabilirz
// o class tan bir tane object olusturmaliyiz.
//o object sayesinde istedigimiz methodu kullanabiliriz.
public static void main(String[] args) {
//buyume methodu static oldugundan java object kullanarak buyume() methodunu
//cagirmamizi istemez ve kodun altini sari renkli cizer.
Constructors01 obj1 = new Constructors01();
obj1.buyume(33);
obj1.isimDegistir("Kemal Can");
Constructors01.isimDegistir("rabia zeynep");
System.out.println(obj1.isim);
System.out.println(obj1.yas);
System.out.println(Constructors03.ad);
System.out.println(Constructors03.kilo);
Constructors03.artirma(45);
Constructors03.degistirme("Merhaba Naci");
}
} |
package com.tencent.mm.storage.emotion;
import android.database.Cursor;
import com.tencent.mm.bt.g;
import com.tencent.mm.bt.g.a;
import com.tencent.mm.sdk.e.e;
import com.tencent.mm.sdk.e.i;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
public final class j extends i<i> implements a {
public static final String[] diD = new String[]{i.a(i.dhO, "EmotionDetailInfo")};
public e diF;
public j(e eVar) {
super(eVar, i.dhO, "EmotionDetailInfo", null);
this.diF = eVar;
}
public final String getTableName() {
return "EmotionDetailInfo";
}
public final int a(g gVar) {
if (gVar != null) {
this.diF = gVar;
}
return 0;
}
public final i ZE(String str) {
i iVar = null;
if (bi.oW(str)) {
x.w("MicroMsg.emoji.EmotionDetailInfoStorage", "getEmotionDetailRespnseByPID failed. productID is null.");
} else {
String[] strArr = new String[]{"content", "lan"};
String[] strArr2 = new String[]{str};
Cursor a = this.diF.a("EmotionDetailInfo", strArr, "productID=?", strArr2, null, null, null, 2);
if (a != null && a.moveToFirst()) {
iVar = new i();
iVar.field_content = a.getBlob(0);
iVar.field_lan = a.getString(1);
iVar.field_productID = str;
}
if (a != null) {
a.close();
}
}
return iVar;
}
}
|
package core.pages;
import core.setup.Driver;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.touch.TouchActions;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.FluentWait;
import org.openqa.selenium.support.ui.Wait;
import java.time.Duration;
public abstract class BasePage {
AndroidDriver driver = Driver.getInstance().getThreadLocalDriver();
protected Wait<AndroidDriver> wait;
public BasePage() {
PageFactory.initElements(driver, this);
}
protected void scrollToText(String text) {
driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"" + text + "\"));");
}
public void scroll(WebElement element) {
TouchActions action = new TouchActions(driver);
action.scroll(element, 10, 100);
action.perform();
element.click();
}
public boolean waitForElement(WebElement element) {
wait = getWait(120);
return wait.until(driver -> element != null && element.isEnabled() && element.isDisplayed());
}
private FluentWait getWait(int timeout) {
return new FluentWait<>(driver)
.pollingEvery(Duration.ofSeconds(2))
.withTimeout(Duration.ofSeconds(timeout))
.ignoring(NoSuchElementException.class)
.ignoring(StaleElementReferenceException.class);
}
}
|
package Manufacturing.CanEntity.CanState;
import Presentation.Protocol.IOManager;
/**
* 装填了内容,但是没有被封罐的状态
* @author 卓正一
*/
public class FilledCanState extends CanState{
@Override
public boolean isDisinfected() {
return true;
}
@Override
public boolean isFilled() {
return true;
}
@Override
public boolean isCanned() {
return false;
}
@Override
public CanState handleDisinfection() {
IOManager.getInstance().errorMassage(
"消毒已填充罐头,请检查流水线!",
"消毒已填充罐頭,請檢查流水線!",
"Filled (but not canned) can get disinfected, check the product line!"
);
return new ErrorCanState(true, false, true, "消毒已填充罐头");
}
@Override
public CanState handleFilling() {
// 允许填充多样内容物 TODO: 有没有可能被填满?
return this;
}
@Override
public CanState handleCanning() {
return new CannedCanState();
}
@Override
public String getCanDescription() {
return "装填了内容,但是没有被封罐";
}
}
|
package com.tencent.mm.g.a;
import com.tencent.mm.sdk.b.b;
public final class rt extends b {
public a ccE;
public static final class a {
public String bhd;
public String ccF;
public boolean ccG;
public byte[] ccH;
public String id;
public int type;
}
public rt() {
this((byte) 0);
}
private rt(byte b) {
this.ccE = new a();
this.sFm = false;
this.bJX = null;
}
}
|
import es.upm.babel.cclib.ConcIO;
public class Emisor extends Thread
{
private GestorDeEventos ge;
private int eid;
public Emisor(GestorDeEventos ge,
int eid) {
this.ge = ge;
this.eid = eid;
}
public void run() {
while (true) {
try {
Thread.sleep(1000 * (eid + 1));
} catch (Exception ex) {
ConcIO.printfnl("excepción capturada: " + ex);
ex.printStackTrace();
}
ConcIO.printfnl("Emitiendo evento " + eid);
ge.emitir(eid);
}
}
}
|
package com.teaman.accessstillwater.base;
import android.annotation.TargetApi;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.ColorRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.widget.FrameLayout;
import com.teaman.accessstillwater.R;
import butterknife.Bind;
import butterknife.ButterKnife;
/**
* <h1> [Insert class name here] </h1>
* <p>
* [Insert class description here]
* </p>
* <p>
* [Insert additional information here (links, code snippets, etc.)]
* </p>
*
* @author Aaron Weaver
* Team Andronerds
* waaronl@okstate.edu
* @version 1.0
* @since 1/31/16
*/
public abstract class BaseActivity extends AppCompatActivity {
protected FragmentManager mFragmentManager = null;
@Nullable
@Bind(R.id.toolbar)
protected Toolbar mToolbar;
@Nullable
@Bind(R.id.container)
protected FrameLayout mContainer;
protected boolean mIsBackNav = false;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getLayoutResource());
ButterKnife.bind(this); // Bind the views of this Activity
if(mToolbar != null) {
// Sets the SupportActionBar
setSupportActionBar(mToolbar);
}
if(mFragmentManager == null) {
mFragmentManager = getFragmentManager(); // Gets a reference to the FragmentManager
}
// getWindow().getDecorView().setSystemUiVisibility(
// View.SYSTEM_UI_FLAG_LAYOUT_STABLE
// | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
/**
* Method to enable back navigation, replacing the toolbar's menu icon with a back arrow.
*/
protected void enableBackNav() {
if(getSupportActionBar() != null) {
mIsBackNav = true;
getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
}
@LayoutRes
protected int getLayoutResource() {
return R.layout.base_activity;
}
/**
* Add a fragment to the FrameLayout container associated with the activity.
* @param fragment The Fragment to place within the container
* @param tag Tag of Fragment to be added
*/
protected void addFragmentToContainer(Fragment fragment, String tag) {
FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.container, fragment, tag).commit();
}
protected void overlayFragmentToContainer(Fragment fragment, String tag){
FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
fragmentTransaction.add(R.id.container, fragment, tag).commit();
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected void setStatusBarColor(@ColorRes int color) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark));
}
}
public void setActivityTitle(@NonNull String title) {
if(getSupportActionBar() != null) {
getSupportActionBar().setTitle(title);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == android.R.id.home && mIsBackNav) {
super.onBackPressed();
}
return super.onOptionsItemSelected(item);
}
/**
* Below are the Android Activity Lifecycle management methods.
* These do not have any custom code, I just leave them here for easy access
* when overriding methods in child classes.
*/
@Override
protected void onStart() {
super.onStart();
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onStop() {
super.onStop();
}
@Override
protected void onDestroy() {
super.onDestroy();
ButterKnife.unbind(this);
}
}
|
package com.tencent.f.a;
import com.tencent.f.d;
import com.tencent.f.e;
public final class c extends d<e> {
protected final /* bridge */ /* synthetic */ e[] cHo() {
return new e[20];
}
protected final /* synthetic */ e cHp() {
return new e();
}
}
|
package com.example.ventas;
public class RealizarVentaRequest {
}
|
import java.util.Arrays;
/**
* Created by Павлик Назарій on 19.05.2017.
*/
public class Insertion <T extends Comparable<T>> {
private T [] array;
public Insertion(T [] array){
this.array = array.clone();
}
public void sort(){
T value;
for(int i = 1,j; i < array.length; i++)
{
value = array[i];
for ( j = i - 1; j >= 0 && array[j].compareTo(value) > 0; j--)
{
array[j + 1] = array[j];
}
array[j + 1] = value;
}
}
public T[] getArray(){
return array;
}
public void printArray(){
for(T i : array){
System.out.print( i + "\t");
}
}
}
|
package programmers.level1;
public class StringToInt {
class Solution {
public int solution(String s) {
int answer = 0;
boolean sign = false;
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
if (ch == '-')
sign = true;
else if (ch != '+')
answer = answer * 10 + (ch - '0');
}
return sign ? -1 * answer : answer;
// return Integer.parseInt(s);
}
}
}
|
/*
* 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 modle;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXDialog;
import com.jfoenix.controls.JFXDialogLayout;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.geometry.Insets;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Paint;
import javafx.scene.text.Text;
/**
*
* @author RM.LasanthaRanga@gmail.com
*/
public class SuccessMessage extends Thread {
String title;
String message;
StackPane stackPane;
public SuccessMessage(String title, String message, StackPane stackPane) {
this.title = title;
this.message = message;
this.stackPane = stackPane;
}
@Override
public void run() {
System.out.println("ELA ELA");
JFXDialogLayout content = new JFXDialogLayout();
Text text = new Text(title);
content.setHeading(text);
content.setBackground(new Background(new BackgroundFill(Paint.valueOf("#4CAF50"), CornerRadii.EMPTY, Insets.EMPTY)));
content.setBody(new Text(message));
JFXButton button = new JFXButton("OK");
button.setBackground(new Background(new BackgroundFill(Paint.valueOf("#FAFAFA"), CornerRadii.EMPTY, Insets.EMPTY)));
JFXDialog jfxDialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.RIGHT);
button.setOnAction((e) -> {
jfxDialog.close();
});
content.setActions(button);
jfxDialog.show();
try {
this.sleep(4000);
} catch (InterruptedException ex) {
Logger.getLogger(SuccessMessage.class.getName()).log(Level.SEVERE, null, ex);
ex.printStackTrace();
}
jfxDialog.close();
}
}
|
import java.util.*;
import java.io.*;
public class PokerHand {
public static void main(String[] args) throws IOException {
Scanner nya = new Scanner(System.in);
TreeMap<Character,Integer> cat = new TreeMap();
for (int i = 0; i < 5; i++) {
char temp = nya.next().charAt(0);
if(!cat.containsKey(temp))
cat.put(temp, 1);
else
cat.put(temp,cat.get(temp)+1);
}
int max = -1;
for(int x:cat.values())
max = Math.max(max,x);
System.out.println(max);
}
}
|
package org.denevell.natch.jsp.post.edit;
import java.util.ArrayList;
public class EditPostJspInput {
private String id;
private String tags;
private String subject;
private String content;
private String page;
private String thread;
private boolean isEditingPost;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public String[] getTagArray() {
String[] tArray = null;
if(getTags()!=null) {
tArray = splitTags(tags);
}
return tArray;
}
public static String[] splitTags(String tags) {
String[] tagsArray = tags.split(",");
ArrayList<String> ta = new ArrayList<String>();
for (int i = 0; i < tagsArray.length; i++) {
if(tagsArray[i]!=null && tagsArray[i].length()>0) {
ta.add(tagsArray[i].trim());
}
}
return ta.toArray(new String[] {});
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
public String getThread() {
return thread;
}
public void setThread(String thread) {
this.thread = thread;
}
public boolean isEditingPost() {
return isEditingPost;
}
public void setEditingPost(boolean isEditingPost) {
this.isEditingPost = isEditingPost;
}
}
|
/*
* 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 com.jotaweb.crud;
import com.jotaweb.entity.Pessoa;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
/**
*
* @author Sermusa
*/
public class CrudAutorizacao extends AbstractCrud<com.jotaweb.entity.Autorizacao> {
private EntityManager em;
private static final String PU = "PipePU";
public CrudAutorizacao() {
super(com.jotaweb.entity.Autorizacao.class);
}
public List<com.jotaweb.entity.Autorizacao> getList(Pessoa responsavel) {
List<com.jotaweb.entity.Autorizacao> lista;
try {
lista= getEntityManager().createNamedQuery("Auto.findDate").setParameter("id_responsavel", responsavel.getId()).getResultList();
return lista;
} catch (Exception e) {
System.out.println(e.getMessage());
}
return null;
}
@Override
protected EntityManager getEntityManager() {
if (em == null) {
em = Persistence.createEntityManagerFactory(PU).createEntityManager();
}
return em;
}
}
|
package com.codyfjm.androidlib.activity;
import android.app.Activity;
import android.os.Bundle;
/**
* author:codyfjm on 18/3/5
* email:CodyFeng@lansion.cn
* company:MIDONG TECHENOLOGY
* Copyright © 2018 MIDONG TECHENOLOGY All rights reserved.
*/
public abstract class BaseActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initVariables();
initViews(savedInstanceState);
loadData();
}
protected abstract void initVariables();
protected abstract void initViews(Bundle savedInstanceState);
protected abstract void loadData();
}
|
package com.tencent.mm.plugin.game.gamewebview.e;
import com.tencent.mm.plugin.game.gamewebview.e.b.c;
class b$c$1 implements Runnable {
final /* synthetic */ c jKV;
b$c$1(c cVar) {
this.jKV = cVar;
}
public final void run() {
this.jKV.jKU.fs(true);
}
}
|
package request;
import com.google.gson.annotations.Expose;
import user.User;
import utils.WriterBiasedRWLock;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public abstract class Request implements RequestObservable {
protected static int lastUsedID = 0;
//Locking static variable lastUsedID for multiple admins
private static Lock idLock = new ReentrantLock();
@Expose
public final int ID;
@Expose
protected final long timeStamp;
protected WriterBiasedRWLock lock = new WriterBiasedRWLock();
@Expose
protected Requestable requestable;
@Expose
protected User requester;
@Expose
protected boolean open;
private ConcurrentHashMap<RequestObserver, Boolean> observers = new ConcurrentHashMap<>(); // a map backed hashset
/**
* Construct a Request Object with the following Parameters, especially without Id (next free Id is used):
*/
protected Request(Requestable topic, User requester, long timestamp) {
this(getNextID(), topic, requester, timestamp);
}
/**
* Construct a Request Object with the following Parameters, especially with fixed id:
*
* @param id the id of the request
* @param topic the topic or document the request refers to
* @param requester the requester
* @param timestamp the unix epoch of the time the request was submitted
*/
protected Request(int id, Requestable topic, User requester, long timestamp) {
try {
idLock.lock();
if(id > lastUsedID) {
lastUsedID = id;
}
this.ID = id;
this.requestable = topic;
this.requester = requester;
this.timeStamp = timestamp;
this.open = true;
} finally {
idLock.unlock();
}
}
/**
* Get next free ID to create Request.
*
* @return free ID
*/
protected static int getNextID() {
try {
idLock.lock();
lastUsedID++;
return lastUsedID;
} finally {
idLock.unlock();
}
}
public abstract void reopen();
/**
* Get the TimeStamp of the Request
*
* @return Timestamp
*/
public long getTimeStamp() {
return timeStamp;
}
/**
* Get the Requestable of the Request, for example Dokumentname or Agenda topic.
*
* @return Requestable
*/
public Requestable getRequestable() {
try {
lock.getReadAccess();
return requestable;
} catch (InterruptedException e) {
return null;
} finally {
lock.finishRead();
}
}
/**
* Get the user who submit the Requets.
*
* @return User
*/
public User getRequester() {
try {
lock.getReadAccess();
return this.requester;
} catch (InterruptedException e) {
return null;
} finally {
lock.finishRead();
}
}
/**
* Checks if the Request is still open or an Admin has closed the Request.
*
* @return true iff the Request is still open
*/
public boolean isOpen() {
try {
lock.getReadAccess();
return this.open;
} catch (InterruptedException e) {
return false;
} finally {
lock.finishRead();
}
}
public int getID() {
return ID;
}
public abstract Request shallowClone();
@Override
public void register(RequestObserver o) {
observers.put(o, true);
}
@Override
public void unregister(RequestObserver o) {
observers.remove(o);
}
@Override
public void notifyObservers() {
observers.forEachKey(2, o -> o.update(this));
}
}
|
package com.example.myoga;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.example.myoga.models.BooksSourceData;
import com.example.myoga.models.User;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import static com.example.myoga.models.DatabaseConnection.getMyogaUsers;
import static com.example.myoga.models.Utils.encryptPassword;
public class LoginActivity extends AppCompatActivity {
Button btnLogin;
Button btnRegister;
private static int PASSWORD_LENGTH = 6;
EditText etEmail;
EditText etPassword;
OnSuccessListener<AuthResult> successListener = authResult -> {
//onSuccess
Intent intent = new Intent(LoginActivity.this, SplashActivity.class);
startActivity(intent);
};
OnFailureListener failureListener = e -> {
//use a dialog instead:
Toast.makeText(LoginActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
};
private void writeNewUser(String userKey, String email, String password) {
getMyogaUsers().child(userKey).child("id").setValue(userKey);
getMyogaUsers().child(userKey).child("email").setValue(email);
getMyogaUsers().child(userKey).child("password").setValue(password);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
btnLogin = findViewById(R.id.btnLogin);
btnRegister = findViewById(R.id.btnRegister);
etEmail = findViewById(R.id.etEmail);
etPassword = findViewById(R.id.etPassword);
//click listeners:
btnRegister.setOnClickListener((v) -> {
if (getEmail().length() < 1 || getPassword().length() < 1) {
Toast.makeText(LoginActivity.this, "Please fill credentials to register", Toast.LENGTH_LONG).show();
} else if (getPassword().length() < PASSWORD_LENGTH) {
Toast.makeText(LoginActivity.this, "Password should contain atleast 6 figures", Toast.LENGTH_LONG).show();
} else {
FirebaseAuth.getInstance()
.createUserWithEmailAndPassword(getEmail(), getPassword())
.addOnSuccessListener(this, successListener)
.addOnFailureListener(this, failureListener);
// Add a new user to database -->
String key = getMyogaUsers().push().getKey();
writeNewUser(key, getEmail(), encryptPassword(getPassword())); // No one is allowed to view PASSWORD!
}
});
btnLogin.setOnClickListener(v -> {
if (getEmail().length() < 1 || getPassword().length() < 1) {
Toast.makeText(LoginActivity.this, "Please fill credentials to login", Toast.LENGTH_LONG).show();
} else {
FirebaseAuth.getInstance()
.signInWithEmailAndPassword(getEmail(), getPassword())
.addOnSuccessListener(this, successListener)
.addOnFailureListener(this, failureListener);
}
});
}
private String getEmail() {
return etEmail.getText().toString();
}
private String getPassword() {
return etPassword.getText().toString();
}
}
|
package com.example.ta.Adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.ta.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class HistoryAdapter extends RecyclerView.Adapter<HistoryAdapter.MyViewHolder> {
private JSONArray mData = new JSONArray();
public OnItemClickListener listener;
public HistoryAdapter(OnItemClickListener listener){
this.listener=listener;
}
public void setData(JSONArray items){
mData = items;
notifyDataSetChanged();
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
View mView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_row_history, viewGroup, false);
return new HistoryAdapter.MyViewHolder(mView);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
try {
holder.tv_classHistory.setText(mData.getJSONObject(position).getString("courses_name"));
holder.tv_classIdHistory.setText(mData.getJSONObject(position).getString("class_name"));
holder.tv_dateHistory.setText(mData.getJSONObject(position).getString("date"));
holder.tv_totalStudent.setText("Students : "+mData.getJSONObject(position).getString("total"));
holder.tv_presenceTotal.setText("Presence : "+mData.getJSONObject(position).getString("hadir"));
holder.tv_absenceTotal.setText("Absence : "+mData.getJSONObject(position).getString("tidak_hadir"));
holder.tv_permitTotal.setText("Permit : "+mData.getJSONObject(position).getString("izin"));
holder.bind(mData.getJSONObject(position), listener);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public int getItemCount() {
return mData.length();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
private TextView tv_classHistory;
private TextView tv_classIdHistory;
private TextView tv_dateHistory;
private TextView tv_totalStudent;
private TextView tv_presenceTotal;
private TextView tv_absenceTotal;
private TextView tv_permitTotal;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
tv_classHistory = itemView.findViewById(R.id.tv_classNameH);
tv_classIdHistory = itemView.findViewById(R.id.tv_classCodeH);
tv_dateHistory = itemView.findViewById(R.id.tv_dateH);
tv_totalStudent = itemView.findViewById(R.id.tv_totalStudent);
tv_presenceTotal = itemView.findViewById(R.id.tv_presenceTotal);
tv_absenceTotal = itemView.findViewById(R.id.tv_absenceTotal);
tv_permitTotal = itemView.findViewById(R.id.tv_permitTotal);
}
public void bind (final JSONObject item, final OnItemClickListener l){
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
listener.onItemClick(item);
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
}
public interface OnItemClickListener{
void onItemClick(JSONObject item) throws JSONException;
}
}
|
package com.example.entity.flight;
public enum FlightStatus {
BOARDING,
GATE_OPEN,
CANCELLED,
DELAYED,
CONFIRMED,
ESTIMATED,
LAST_CALL;
}
|
package com.sneaker.mall.api.model;
import java.util.Date;
import java.util.List;
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
* ERP出库单
*/
public class StockOut extends BaseModel<Long> {
/**
* ERP订单号
*/
private long order_id;
/**
* 出库公司ID
*/
private long cid;
/**
* 出库公司名称
*/
private String cname;
/**
* 仓库ID
*/
private long sid;
/**
* 出库仓库名称
*/
private String sname;
/**
* 客户公司ID
*/
private long in_cid;
/**
* 客户公司名称
*/
private String in_cname;
/**
* 总金额
*/
private long amount;
/**
* 总税额
*/
private long tax_amount;
/**
* 成本额
*/
private long cost_amount;
/**
* 状态\n1-未审核\n2-已预审\n3-缺货待配\n4-已审核\n9-已取消\n10-已冲正\n11-冲正单\n12-已修正\n13-修正单
*/
private int status;
/**
* 类型
*/
private int type;
/**
* 操作员工ID
*/
private long uid;
/**
* 操作员工名称
*/
private String uname;
/**
* 预审员工ID
*/
private long puid;
/**
* 预审员工名称
*/
private String puname;
/**
* 审核员工ID
*/
private long cuid;
/**
* 审核员工名称
*/
private String cuname;
/**
* 复核员工ID
*/
private long ruid;
/**
* 复核员工名称
*/
private String runame;
/**
* 业务员ID
*/
private long suid;
/**
* 业务员名称
*/
private String suname;
/**
* 负单单号
*/
private long negative_id;
/**
* 被修正单号
*/
private long repaired_id;
/**
* 结算单号
*/
private long settle_id;
/**
* 结算状态
*/
private long settle_status;
/**
* 结算
*/
private String memo;
/**
* 付款方式
*/
private int pay_type;
/**
* 最近更新时间
*/
private Date updatetime;
/**
* 创建时间
*/
private Date createtime;
/**
* 审核时间
*/
private Date checktime;
/**
* 结算时间
*/
private Date settletime;
/**
* 最终结算日期
*/
private Date lastdate;
/**
* 经营方式 1-经销 2-代销 3-联营 4-租赁
*/
private int business;
/**
* 订单哈希,依据该值判断是否修改过
*/
private String hash;
/**
* 分拣单ID
*/
private long sorting_id;
/**
* 派车的车牌号
*/
private String car_license;
/**
* 商城订单号
*/
private String mall_orderno;
/**
* 商城收获地址
*/
private String receipt;
/**
* 联系人
*/
private String contacts;
/**
* 联系电话
*/
private String phone;
private List<PayGateway.Glist> goodsList;
public List<PayGateway.Glist> getGoodsList() {
return goodsList;
}
public void setGoodsList(List<PayGateway.Glist> goodsList) {
this.goodsList = goodsList;
}
public long getOrder_id() {
return order_id;
}
public void setOrder_id(long order_id) {
this.order_id = order_id;
}
public long getCid() {
return cid;
}
public void setCid(long cid) {
this.cid = cid;
}
public String getCname() {
return cname;
}
public void setCname(String cname) {
this.cname = cname;
}
public long getSid() {
return sid;
}
public void setSid(long sid) {
this.sid = sid;
}
public String getSname() {
return sname;
}
public void setSname(String sname) {
this.sname = sname;
}
public long getIn_cid() {
return in_cid;
}
public void setIn_cid(long in_cid) {
this.in_cid = in_cid;
}
public String getIn_cname() {
return in_cname;
}
public void setIn_cname(String in_cname) {
this.in_cname = in_cname;
}
public long getAmount() {
return amount;
}
public void setAmount(long amount) {
this.amount = amount;
}
public long getTax_amount() {
return tax_amount;
}
public void setTax_amount(long tax_amount) {
this.tax_amount = tax_amount;
}
public long getCost_amount() {
return cost_amount;
}
public void setCost_amount(long cost_amount) {
this.cost_amount = cost_amount;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public long getUid() {
return uid;
}
public void setUid(long uid) {
this.uid = uid;
}
public String getUname() {
return uname;
}
public void setUname(String uname) {
this.uname = uname;
}
public long getPuid() {
return puid;
}
public void setPuid(long puid) {
this.puid = puid;
}
public String getPuname() {
return puname;
}
public void setPuname(String puname) {
this.puname = puname;
}
public long getCuid() {
return cuid;
}
public void setCuid(long cuid) {
this.cuid = cuid;
}
public String getCuname() {
return cuname;
}
public void setCuname(String cuname) {
this.cuname = cuname;
}
public long getRuid() {
return ruid;
}
public void setRuid(long ruid) {
this.ruid = ruid;
}
public String getRuname() {
return runame;
}
public void setRuname(String runame) {
this.runame = runame;
}
public long getSuid() {
return suid;
}
public void setSuid(long suid) {
this.suid = suid;
}
public String getSuname() {
return suname;
}
public void setSuname(String suname) {
this.suname = suname;
}
public long getNegative_id() {
return negative_id;
}
public void setNegative_id(long negative_id) {
this.negative_id = negative_id;
}
public long getRepaired_id() {
return repaired_id;
}
public void setRepaired_id(long repaired_id) {
this.repaired_id = repaired_id;
}
public long getSettle_id() {
return settle_id;
}
public void setSettle_id(long settle_id) {
this.settle_id = settle_id;
}
public long getSettle_status() {
return settle_status;
}
public void setSettle_status(long settle_status) {
this.settle_status = settle_status;
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public int getPay_type() {
return pay_type;
}
public void setPay_type(int pay_type) {
this.pay_type = pay_type;
}
public Date getUpdatetime() {
return updatetime;
}
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
public Date getChecktime() {
return checktime;
}
public void setChecktime(Date checktime) {
this.checktime = checktime;
}
public Date getSettletime() {
return settletime;
}
public void setSettletime(Date settletime) {
this.settletime = settletime;
}
public Date getLastdate() {
return lastdate;
}
public void setLastdate(Date lastdate) {
this.lastdate = lastdate;
}
public int getBusiness() {
return business;
}
public void setBusiness(int business) {
this.business = business;
}
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
public long getSorting_id() {
return sorting_id;
}
public void setSorting_id(long sorting_id) {
this.sorting_id = sorting_id;
}
public String getCar_license() {
return car_license;
}
public void setCar_license(String car_license) {
this.car_license = car_license;
}
public String getMall_orderno() {
return mall_orderno;
}
public void setMall_orderno(String mall_orderno) {
this.mall_orderno = mall_orderno;
}
public String getReceipt() {
return receipt;
}
public void setReceipt(String receipt) {
this.receipt = receipt;
}
public String getContacts() {
return contacts;
}
public void setContacts(String contacts) {
this.contacts = contacts;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
|
package com.flute.atp.domain.model.cc;
import com.alibaba.fastjson.JSON;
import com.flute.atp.common.ConfigScalar;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;
import java.util.Optional;
@Setter
@Getter
@Builder
@AllArgsConstructor
public class Configer<T> {
private boolean active;
private ConfigDescriptor<T> descriptor;
private ConfigValue value;
public static <T> Configer<T> apply(ConfigDescriptor<T> descriptor,ConfigValue value,boolean active){
return new Configer<T>(active,descriptor,value);
}
public static Configer apply(ConfigScalar scalar, String json){
ConfigDescriptor descriptor = ConfigDescriptor.apply(scalar);
ConfigValue value = ConfigValue.apply(json);
return Configer.apply(descriptor,value,true);
}
public Optional<T> obtainValue(){
if (StringUtils.isEmpty(value.json))
return Optional.<T>empty();
else
return Optional.ofNullable(JSON.<T>parseObject(value.json, descriptor.type.type));
}
public Configer deactive(){
this.active = false;
return this;
}
public Configer active(){
this.active = true;
return this;
}
}
|
package coordinates;
public class Coordinates {
public boolean coordinates(int x, int y) {
if ((((x >= -6 && x <= 6) && (y >= -3 && y <= 0)))
|| (((x >= -4 && x <= 4) && (y >= 0 && y <= 5)))) {
return true;
} else {
return false;
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.