text
stringlengths
10
2.72M
package com.sharezone.controllers; import java.io.IOException; import java.util.ArrayList; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.sharezone.bean.OrderDetailsBean; import com.sharezone.bean.RatingBean; import com.sharezone.bean.SignUpBean; import com.sharezone.bean.WorkspaceDetailsBean; import com.sharezone.implementation.MainServiceImpl; import com.sharezone.services.MainService; import com.sharezone.vo.OrderDetailsVo; import com.sharezone.vo.WorkspaceVo; /** * Servlet implementation class MainController */ @WebServlet("/MainController") public class MainController extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public MainController() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.getWriter().append("Served at: ").append(request.getContextPath()); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); String actionFinder=request.getParameter("actionFinder"); MainService service=new MainServiceImpl(); HttpSession sessions=request.getSession(); if(actionFinder.equals("SignUp")){ String firstname=request.getParameter("fname"); String lastname=request.getParameter("lname"); String gender=request.getParameter("gender"); String email=request.getParameter("emailid"); String password=request.getParameter("pwd1"); String confirmpassword=request.getParameter("pwd2"); String usertype=request.getParameter("useType"); SignUpBean signup=new SignUpBean(); signup.setFirstname(firstname); signup.setLastname(lastname); signup.setGender(gender); signup.setEmail(email); signup.setPassword(password); signup.setUsertype(usertype); MainService mainService=new MainServiceImpl(); String resp=mainService.setSignUp(signup); if(resp.equals("Success")){ request.getRequestDispatcher("login.jsp").forward(request, response); } else { request.getRequestDispatcher("signup.jsp").forward(request, response); } } else if(actionFinder.equals("login")){ String email=request.getParameter("email"); String password=request.getParameter("pwd"); SignUpBean sess=new SignUpBean(); sess.setEmail(email); sess.setPassword(password); MainService mainservice2=new MainServiceImpl(); String resp=mainservice2.setlogin(sess); String usertype=sess.getUsertype(); sessions.setAttribute("userid",sess.getId()); if(resp.equals("success")){ if(usertype.equals("user")){ ArrayList<WorkspaceVo>list=service.getWorkspaceList(); System.out.println(list.size()); request.setAttribute("wospacelist", list); request.getRequestDispatcher("user.jsp").forward(request, response); } else if(usertype.equals("manager")){ ArrayList<WorkspaceDetailsBean>list=service.getWorkspaceListForManager(sess.getId()); request.setAttribute("man", list); request.getRequestDispatcher("manager.jsp").forward(request, response); } else if(usertype.equals("admin")){ ArrayList <WorkspaceVo>list=mainservice2.getWorkspaceList(); request.setAttribute("wslist", list); request.getRequestDispatcher("admin.jsp").forward(request, response); } } else { request.getRequestDispatcher("login.jsp").forward(request, response); } } else if(actionFinder.equals("Create")){ String Workspacename=request.getParameter("wsname"); String Location=request.getParameter("loc"); String Description=request.getParameter("desc"); String Facilities=request.getParameter("facilities"); int TotalChairs=Integer.parseInt(request.getParameter("no")); int ManagerId=Integer.parseInt(request.getParameter("managerid")); String username=request.getParameter("txt"); String password=request.getParameter("pwd"); WorkspaceDetailsBean workspaceDetails=new WorkspaceDetailsBean(); workspaceDetails.setWorkspacename(Workspacename); workspaceDetails.setLocation(Location); workspaceDetails.setDescription(Description); workspaceDetails.setFacilities(Facilities); workspaceDetails.setTotalchairs(TotalChairs); workspaceDetails.setManagerid(ManagerId); workspaceDetails.setUsername(username); workspaceDetails.setPassword(password); MainService mainservice3=new MainServiceImpl(); String resp3=mainservice3.setWorkspaceDetails(workspaceDetails); if(resp3.equals("Success")){ request.getRequestDispatcher("SZHome.jsp").forward(request, response); } else { ArrayList<SignUpBean>list=service.getManagerList(); request.setAttribute("managerlist", list); request.getRequestDispatcher("admincreate.jsp").forward(request, response); } } else if(actionFinder.equals("Addworkspace")){ ArrayList<SignUpBean>list=service.getManagerList(); for(int i=0;i<list.size();i++){ System.out.println(list.get(i).getId()); System.out.println(list.get(i).getFirstname()); System.out.println(list.get(i).getLastname()); } request.setAttribute("managerlist", list); request.getRequestDispatcher("admincreate.jsp").forward(request, response); } else if(actionFinder.equals("showmanagers")){ ArrayList<SignUpBean>list=service.getManagers(); request.setAttribute("managers", list); request.getRequestDispatcher("managers.jsp").forward(request,response); } else if(actionFinder.equals("bookMySpace")){ String workspaceId=request.getParameter("workspaceFinder"); Integer userId=(Integer)sessions.getAttribute("userid"); OrderDetailsBean obj=new OrderDetailsBean(); obj.setUserId(userId); obj.setWorkspaceId(Integer.valueOf(workspaceId)); obj.setActive(1); String setOrder=service.setOrder(obj); } else if(actionFinder.equals("newreq")){ Integer managerId=(Integer)sessions.getAttribute("userid"); ArrayList<OrderDetailsVo>list=service.getRequestList(managerId); System.out.println(list.size()); request.setAttribute("req", list); request.getRequestDispatcher("managerwsl.jsp").forward(request, response); } else if(actionFinder.equals("approve")){ String orderId=request.getParameter("orderFinder"); String approveRequest=service.setapproveRequest(orderId); } else if(actionFinder.equals("reject")){ String orderId=request.getParameter("orderFinder"); String rejectRequest=service.setrejectRequest(orderId); } else if(actionFinder.equals("expired")){ String ordersId=request.getParameter("ordersFinder"); String expire=service.setexpireRequest(ordersId); } else if(actionFinder.equals("rateme")){ Integer userid=(Integer)sessions.getAttribute("userid"); String workspaceid=request.getParameter("workspaceFinder"); String rating=request.getParameter("rate"); System.out.println(userid + workspaceid +rating); RatingBean obj=new RatingBean(); obj.setUserid(Integer.valueOf(userid)); obj.setWorkspaceid(Integer.valueOf(workspaceid)); obj.setRating(Integer.valueOf(rating)); String setrateMe=service.setrateMe(obj); ArrayList<RatingBean>list=service.getAllReviews(workspaceid); float totalrating=0; float avgrating=0; for(int i=0;i<list.size();i++){ totalrating=list.get(i).getRating()+totalrating; avgrating=totalrating/list.size(); } System.out.println(avgrating); String updateRating=service.updateRating(workspaceid,avgrating); request.getRequestDispatcher("admininfo.jsp").forward(request, response); } } }
package com.atguigu.gmall.search.controller; import com.atguigu.core.bean.Resp; import com.atguigu.gmall.search.service.SearchServices; import com.atguigu.gmall.search.vo.SearchParamVO; import com.atguigu.gmall.search.vo.SearchResponseAttrVO; import com.atguigu.gmall.search.vo.SearchResponseVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("search") public class SearchController { @Autowired private SearchServices searchService; @GetMapping public Resp<SearchResponseVO> search(SearchParamVO searchParamVO){ // 查询业务方法 SearchResponseVO searchResponseVO = this.searchService.search(searchParamVO); // ,返回查询结果,给前端 return Resp.ok(searchResponseVO); } }
/*  * created 20-Feb-2006  * * Copyright 2009, ByteRefinery * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html  *  * $Id: AbstractDependencyDialog.java 231 2006-02-20 23:04:58Z cse $  */ package com.byterefinery.rmbench.dialogs; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IconAndMessageDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; /** * Abstract class for generating confirm dialogs which show indirect actions * triggered by an action (e.g. deletion of modelelemnt) * @author Hannes Niederhausen * */ public abstract class AbstractDependencyDialog extends IconAndMessageDialog { private static final int MAX_LINES = 30; private Button detailsButton; private Text detailsText; private boolean detailsCreated; public AbstractDependencyDialog(Shell parentShell) { super(parentShell); detailsCreated=false; } /** * @return the detail message, which is shown in a collapseable, read-only text area * below the message */ protected abstract String getDetails(); /** * @return the message the message of the dialog, which is shown alongside the dialog icon */ protected String getMessage() { return Messages.DependencyDialog_defaultMessage; } /** * @return the icon image for this dialog. By default, this is the warning icon */ protected Image getImage() { return getInfoImage(); } /** * In this method, you can add some widgets to the dialog. * @param parent * @return */ protected Control getDialogAreaAdditions(Composite parent) { return null; } protected final Control createDialogArea(Composite parent) { createMessageArea(parent); Composite composite = new Composite(parent, SWT.NONE); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.horizontalSpan = 2; composite.setLayoutData(gd); GridLayout layout = new GridLayout(); composite.setLayout(layout); composite.setFont(parent.getFont()); // allow subclasses to add custom controls createOptionsArea(composite); return composite; } /** * create the options area * * @param parent the parent composite */ protected void createOptionsArea(Composite parent) { } protected void configureShell(Shell shell) { super.configureShell(shell); shell.setText(Messages.DependencyDialog_title); } protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true); detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, IDialogConstants.SHOW_DETAILS_LABEL, false); } protected void buttonPressed(int id) { if (id == IDialogConstants.DETAILS_ID) { // was the details button pressed? toggleDetailsArea(); } else { super.buttonPressed(id); } } private void toggleDetailsArea() { Point windowSize = getShell().getSize(); Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); if (detailsCreated) { detailsText.dispose(); detailsCreated = false; detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL); } else { detailsText = createDetailsText((Composite) getContents()); detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); } Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); getShell() .setSize( new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y))); } protected Text createDetailsText(Composite parent) { // create the list detailsText = new Text( parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY | SWT.MULTI); // fill the list detailsText.setText(getDetails()); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL); data.heightHint = Math.min(detailsText.getLineCount(), MAX_LINES) * detailsText.getLineHeight(); data.horizontalSpan = 2; detailsText.setLayoutData(data); detailsText.setFont(parent.getFont()); detailsCreated=true; return detailsText; } protected Control createMessageArea(Composite composite) { message = getMessage(); return super.createMessageArea(composite); } protected void setDetailsText(String details) { if ( (detailsText==null) || (detailsText.isDisposed())) return; detailsText.setText(details); } }
package com.commercetools.sunrise.shoppingcart.checkout.payment; import com.commercetools.sunrise.common.models.ModelBean; public class CheckoutPaymentFormSettingsBean extends ModelBean { private PaymentMethodFormFieldBean paymentMethod; public CheckoutPaymentFormSettingsBean() { } public PaymentMethodFormFieldBean getPaymentMethod() { return paymentMethod; } public void setPaymentMethod(final PaymentMethodFormFieldBean paymentMethod) { this.paymentMethod = paymentMethod; } }
package hbi.core.salesOrder.dto; import com.fasterxml.jackson.annotation.JsonFormat; import com.hand.hap.core.BaseConstants; import org.hibernate.validator.constraints.NotEmpty; import javax.persistence.*; import java.util.Date; /** * Created by ASpiralMoon on 2017/1/13. */ @Table(name = "hap_om_order_headers") public class Headers { @Id @GeneratedValue private Long headerId; @NotEmpty private String orderNumber; @NotEmpty private Long companyId; @NotEmpty private Date orderDate; @NotEmpty private String orderStatus; @NotEmpty private Long customerId; private Long objectVersionNumber; private Long requestId; private Long programId; private Date creationDate; private Long createdBy; private Long lastUpdateBy; @JsonFormat(pattern = BaseConstants.DATE_TIME_FORMAT) private Date lastUpdateDate; private Long lastUpdateLogin; @Transient private Integer page = 1; @Transient private Integer pagesize = 10; private String companyName; private String customerName; private Long lineId; private Long inventoryItemId; private Long orderdQuantity; private String orderQuantityUom; private Long unitSellingPrice; private String description; private Double orderAmount; public Long getHeaderId() { return headerId; } public void setHeaderId(Long headerId) { this.headerId = headerId; } public String getOrderNumber() { return orderNumber; } public void setOrderNumber(String orderNumber) { this.orderNumber = orderNumber; } public Long getCompanyId() { return companyId; } public void setCompanyId(Long companyId) { this.companyId = companyId; } public Date getOrderDate() { return orderDate; } public void setOrderDate(Date orderDate) { this.orderDate = orderDate; } public String getOrderStatus() { return orderStatus; } public void setOrderStatus(String orderStatus) { this.orderStatus = orderStatus; } public Long getCustomerId() { return customerId; } public void setCustomerId(Long customerId) { this.customerId = customerId; } public Long getObjectVersionNumber() { return objectVersionNumber; } public void setObjectVersionNumber(Long objectVersionNumber) { this.objectVersionNumber = objectVersionNumber; } public Long getRequestId() { return requestId; } public void setRequestId(Long requestId) { this.requestId = requestId; } public Long getProgramId() { return programId; } public void setProgramId(Long programId) { this.programId = programId; } public Date getCreationDate() { return creationDate; } public void setCreationDate(Date creationDate) { this.creationDate = creationDate; } public Long getCreatedBy() { return createdBy; } public void setCreatedBy(Long createdBy) { this.createdBy = createdBy; } public Long getLastUpdateBy() { return lastUpdateBy; } public void setLastUpdateBy(Long lastUpdateBy) { this.lastUpdateBy = lastUpdateBy; } public Date getLastUpdateDate() { return lastUpdateDate; } public void setLastUpdateDate(Date lastUpdateDate) { this.lastUpdateDate = lastUpdateDate; } public Long getLastUpdateLogin() { return lastUpdateLogin; } public void setLastUpdateLogin(Long lastUpdateLogin) { this.lastUpdateLogin = lastUpdateLogin; } public Integer getPage() { return page; } public void setPage(Integer page) { this.page = page; } public Integer getPagesize() { return pagesize; } public void setPagesize(Integer pagesize) { this.pagesize = pagesize; } public String getCompanyName() { return companyName; } public void setCompanyName(String companyName) { this.companyName = companyName; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName; } public Long getLineId() { return lineId; } public void setLineId(Long lineId) { this.lineId = lineId; } public Long getInventoryItemId() { return inventoryItemId; } public void setInventoryItemId(Long inventoryItemId) { this.inventoryItemId = inventoryItemId; } public Long getOrderdQuantity() { return orderdQuantity; } public void setOrderdQuantity(Long orderdQuantity) { this.orderdQuantity = orderdQuantity; } public String getOrderQuantityUom() { return orderQuantityUom; } public void setOrderQuantityUom(String orderQuantityUom) { this.orderQuantityUom = orderQuantityUom; } public Long getUnitSellingPrice() { return unitSellingPrice; } public void setUnitSellingPrice(Long unitSellingPrice) { this.unitSellingPrice = unitSellingPrice; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Double getOrderAmount() { return orderAmount; } public void setOrderAmount(Double orderAmount) { this.orderAmount = orderAmount; } }
package com.cardniu.sele; import org.openqa.selenium.server.SeleniumServer; /** * Hello world! * */ public class App { public static void main( String[] args ) throws Exception { SeleniumServer.main(new String[]{}); } }
package yincheng.gggithub.mvp.model; import android.os.Parcel; import android.os.Parcelable; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; /** * Created by yincheng on 2018/5/25/11:47. * github:luoyincheng */ @Getter @Setter @NoArgsConstructor public class AccessTokenModel implements Parcelable { // TODO: 2018/5/25 getter setter NoArgsConstructor 测试 private long id; private String token; private String hashedToken; private String accessToken; private String tokenType; public static Creator<AccessTokenModel> getCREATOR() { return CREATOR; } protected AccessTokenModel(Parcel in) { this.id = in.readLong(); this.token = in.readString(); this.hashedToken = in.readString(); this.accessToken = in.readString(); this.tokenType = in.readString(); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeLong(this.id); dest.writeString(this.token); dest.writeString(this.hashedToken); dest.writeString(this.accessToken); dest.writeString(this.tokenType); } @Override public int describeContents() { return 0; } public static final Creator<AccessTokenModel> CREATOR = new Creator<AccessTokenModel>() { @Override public AccessTokenModel createFromParcel(Parcel in) { return new AccessTokenModel(in); } @Override public AccessTokenModel[] newArray(int size) { return new AccessTokenModel[size]; } }; @Override public String toString() { return "AccessTokenModel{" + "id=" + id + ", token='" + token + '\'' + ", hashedToken='" + hashedToken + '\'' + ", accessToken='" + accessToken + '\'' + ", tokenType='" + tokenType + '\'' + '}'; } }
package net.tyas.laundry.data.prefs; import android.content.Context; import android.content.SharedPreferences; import javax.inject.Inject; import javax.inject.Singleton; import net.tyas.laundry.di.ApplicationContext; import net.tyas.laundry.di.PreferenceInfo; /** * Copyright 2017 Winnerawan T * Unauthorized copying of this file, via any medium is strictly * prohibited Proprietary and confidential * Written by Winnerawan T <winnerawan@gmail.com>, June 2017 */ @Singleton public class AppPreferencesHelper implements PreferencesHelper { private static final String KEY_LOGGED_IN = "KEY_LOGGED_IN"; private static final String KEY_CLIENT_ID = "KEY_CLIENT_ID"; private static final String KEY_CLIENT_SECRET = "KEY_CLIENT_SECRET"; private static final String KEY_CONTENT_TYPE = "KEY_CONTENT_TYPE"; private static final String KEY_FIRST_TIME = "KEY_FIRST_TIME"; private static final String KEY_REWARD = "KEY_REWARD"; private static final String KEY_BANNER = "KEY_BANNER"; private static final String KEY_INTERS = "KEY_INTERS"; private final SharedPreferences mPrefs; @Inject public AppPreferencesHelper(@ApplicationContext Context context, @PreferenceInfo String prefFileName) { mPrefs = context.getSharedPreferences(prefFileName, Context.MODE_PRIVATE); } @Override public boolean isLoggedIn() { return mPrefs.getBoolean(KEY_LOGGED_IN, false); } @Override public void setLoggedIn(boolean loggedIn) { mPrefs.edit().putBoolean(KEY_LOGGED_IN, loggedIn).apply(); } @Override public boolean isFirstTime() { return mPrefs.getBoolean(KEY_FIRST_TIME, true); } @Override public void setFirstTime(boolean isFirstTime) { mPrefs.edit().putBoolean(KEY_FIRST_TIME, isFirstTime).apply(); } @Override public void setBanner(String banner) { mPrefs.edit().putString(KEY_BANNER, banner).apply(); } @Override public void setInters(String inters) { mPrefs.edit().putString(KEY_INTERS, inters).apply(); } @Override public void setReward(String reward) { mPrefs.edit().putString(KEY_REWARD, reward).apply(); } @Override public String getBanner() { return mPrefs.getString(KEY_BANNER, "ca-app-pub-9400864410179150/8823258458"); } @Override public String getInters() { return mPrefs.getString(KEY_INTERS, "ca-app-pub-9400864410179150/8631686768"); } @Override public String getReward() { return mPrefs.getString(KEY_REWARD, "ca-app-pub-9400864410179150/1281995578"); } }
package com.espendwise.manta.service; import com.espendwise.manta.model.data.GroupAssocData; import com.espendwise.manta.model.data.GroupData; import com.espendwise.manta.model.view.EntityHeaderView; import com.espendwise.manta.model.view.GroupConfigAllListView; import com.espendwise.manta.model.view.GroupConfigListView; import com.espendwise.manta.model.view.GroupFunctionListView; import com.espendwise.manta.model.view.GroupHeaderView; import com.espendwise.manta.model.view.GroupListView; import com.espendwise.manta.model.view.GroupReportListView; import com.espendwise.manta.model.view.GroupView; import com.espendwise.manta.util.criteria.ApplicationFunctionSearchCriteria; import com.espendwise.manta.util.criteria.GroupConfigSearchCriteria; import com.espendwise.manta.util.criteria.GroupSearchCriteria; import com.espendwise.manta.util.criteria.ReportSearchCriteria; import java.util.List; import java.util.Map; public interface GroupService { public List<GroupData> findGroupsByCriteria(GroupSearchCriteria criteria); public List<GroupListView> findGroupViewsByCriteria(GroupSearchCriteria criteria); public GroupView saveGroup(GroupView groupView) throws DatabaseUpdateException, IllegalDataStateException; public GroupHeaderView findGroupHeader(Long groupId); public GroupView getGroupView(Long groupId); public List<GroupReportListView> findGroupReportViewsByCriteria(ReportSearchCriteria criteria); public void configureGroupReports(Long groupId, List<Long> configuredIds, List<Long> notConfiguredIds); public Map<String, List<GroupFunctionListView>> findGroupFunctionMapByCriteria(ApplicationFunctionSearchCriteria criteria); public void configureGroupFunctions(Long groupId, List<String> configuredFunctions, List<String> notConfiguredFunctions); public List<GroupConfigListView> findGroupConfigByCriteria(GroupConfigSearchCriteria criteria); public void configureGroupAssocioation(Long groupId, List configured,List unConfigured, String groupAssocCd); public List<GroupConfigAllListView> findGroupConfigAllByCriteria(GroupConfigSearchCriteria criteria); public List<String> getStoreAssociations(Long groupId, String groupTypeCd, Long storeIdExcluded); public List<GroupAssocData> getGroupAssociation(Long groupId, String groupAssocCd); }
package net.sf.ardengine.renderer.opengl.lib.shader; import static org.lwjgl.opengl.GL20.*; import java.nio.FloatBuffer; import javafx.scene.paint.Color; import org.lwjgl.BufferUtils; public abstract class Uniform<T>{ /**Name of uniform in shader*/ protected String name; /**GL handle for this uniform*/ protected int id; /**Uniform value*/ protected T value; /**Target shader*/ protected Shader shader; /** * @param name Name of uniform in shader * @param program GL handle for this uniform */ public Uniform(String name, Shader program){ this.name = name; this.shader = program; this.id = glGetUniformLocation(program.getProgramID(), name); if (this.id==-1) { System.out.println("Variable \""+name+"\" is not found in shader"); } } /** * @return name of this uniform */ public String getName() { return name; } /** * binds this uniform for its shader program */ public abstract void bind(); /** * Changes value of this uniform and makes GL call, if needed. * @param value new value of uniform */ public void setValue(T value) { if(this.value != value){ this.value = value; if(shader.isBound()){ //refreshes this uniform for shader bind(); } } } public static class Float extends Uniform<java.lang.Float>{ public Float(String name, Shader program) { super(name, program); } @Override public void bind() { glUniform1f(id, value); } } public static class Int extends Uniform<java.lang.Integer>{ public Int(String name, Shader program) { super(name, program); } @Override public void bind() { glUniform1i(id, value); } } public abstract static class Matrix extends Uniform<net.sf.ardengine.renderer.opengl.lib.shader.Matrix>{ public Matrix(String name, Shader program) { super(name, program); } } public static class Matrix4x4 extends Matrix{ public Matrix4x4(String name, Shader program) { super(name, program); } @Override public void bind() { FloatBuffer data = BufferUtils.createFloatBuffer(16); data.put(value.getValues()); data.flip(); glUniformMatrix4fv(id, false, data); } } public static class Vec3f extends Uniform<float[]>{ public Vec3f(String name, Shader program) { super(name, program); } @Override public void bind() { glUniform3f(id, value[0], value[1], value[2]); } } public static class Colorf extends Uniform<Color>{ public Colorf(String name, Shader program) { super(name, program); } @Override public void bind() { glUniform3f(id, (float)value.getRed(), (float)value.getGreen(), (float)value.getBlue()); } } }
package pack; public class Addition { private double d1,d2; public Addition(double a,double b) { d1=a; d2=b; } public void sum() { System.out.println("Sum= "+(d1+d2)); } }
package com.techlab.basicsofjava; public class Menudriven1 { }
package com.wukker.sb.eventconnectionfortopmobile.model.methods; import android.os.AsyncTask; import android.widget.Toast; import com.wukker.sb.eventconnectionfortopmobile.model.methods.HTTPMethod; import com.wukker.sb.eventconnectionfortopmobile.model.methods.HelperParams; import com.wukker.sb.eventconnectionfortopmobile.ui.activities.VisitorRegActivity; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; /** * Created by sb on 02.11.15. */ public class URLHelper extends AsyncTask<HelperParams, Void, String> { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected void onPostExecute(String response) { super.onPostExecute(response); } @Override protected void onProgressUpdate(Void... values) { super.onProgressUpdate(values); } @Override protected void onCancelled(String response) { super.onCancelled(response); } @Override protected void onCancelled() { super.onCancelled(); } @Override protected String doInBackground(HelperParams[] helperParamses) { String response = " "; for (HelperParams helperParams: helperParamses) { try { HttpURLConnection httpURLConnection = (HttpURLConnection) helperParams.getUrl().openConnection(); httpURLConnection.setConnectTimeout((int)Constants.enough); switch (helperParams.getHttpMethod()) { case POST: { httpURLConnection.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); httpURLConnection.setRequestMethod(HTTPMethod.POST.toString()); httpURLConnection.setDoOutput(true); httpURLConnection.setDoInput(true); httpURLConnection.setUseCaches(false); DataOutputStream postToURL = new DataOutputStream(httpURLConnection.getOutputStream()); postToURL.write(helperParams.getJsonObject().toString().getBytes("UTF-8")); postToURL.flush(); postToURL.close(); BufferedReader reader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream())); StringBuilder sb = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { sb.append(line); } response = sb.toString(); reader.close(); httpURLConnection.disconnect(); break; } case POSTFORM: { httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); httpURLConnection.setRequestMethod(HTTPMethod.POST.toString()); httpURLConnection.setDoOutput(true); httpURLConnection.setUseCaches(false); DataOutputStream postToURL = new DataOutputStream(httpURLConnection.getOutputStream()); postToURL.write(helperParams.getString().getBytes("UTF-8")); postToURL.flush(); response = httpURLConnection.getResponseCode() + ""; postToURL.close(); httpURLConnection.disconnect(); break; } case GET: { httpURLConnection.connect(); BufferedReader reader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream())); StringBuilder sb = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { sb.append(line); } response = sb.toString(); reader.close(); httpURLConnection.disconnect(); break; } case PUT: { httpURLConnection.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); httpURLConnection.setRequestMethod(HTTPMethod.PUT.toString()); httpURLConnection.setDoOutput(true); httpURLConnection.setUseCaches(false); DataOutputStream postToURL = new DataOutputStream(httpURLConnection.getOutputStream()); postToURL.write(helperParams.getJsonObject().toString().getBytes("UTF-8")); postToURL.flush(); postToURL.close(); response = httpURLConnection.getResponseMessage()+""; httpURLConnection.disconnect(); break; } default: break; } } catch (NullPointerException e) { //TODO e.printStackTrace(); } catch (IOException e) { //TODO e.printStackTrace(); } } return response; } }
package cn.xyz.repository.mongo; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.apache.commons.codec.digest.DigestUtils; import org.bson.types.ObjectId; import org.mongodb.morphia.query.Query; import org.mongodb.morphia.query.UpdateOperations; import org.springframework.stereotype.Service; import com.mongodb.BasicDBObject; import cn.xyz.commons.ex.ServiceException; import cn.xyz.commons.utils.DateUtil; import cn.xyz.commons.utils.ReqUtil; import cn.xyz.commons.utils.StringUtil; import cn.xyz.commons.utils.ValueUtil; import cn.xyz.mianshi.service.impl.UserManagerImpl; import cn.xyz.mianshi.vo.CommonText; import cn.xyz.mianshi.vo.CompanyVO; import cn.xyz.mianshi.vo.Customer; import cn.xyz.mianshi.vo.Employee; import cn.xyz.mianshi.vo.User; import cn.xyz.repository.CustomerRepository; import cn.xyz.repository.UserRepository; /** * 客服模块数据操纵接口的实现 * @author hsg * */ @Service public class CustomerRepositoryImpl extends BaseRepositoryImpl<CompanyVO, ObjectId> implements CustomerRepository { public static CustomerRepositoryImpl getInstance(){ return new CustomerRepositoryImpl(); } @Resource private UserManagerImpl userManager; @Resource private UserRepository userRepository; @Override public Map<String, Object> addCustomer(Customer customer) { BasicDBObject jo = new BasicDBObject(); jo.put("customerId", customer.getCustomerId());// 索引 jo.put("userKey", DigestUtils.md5Hex(customer.getIp())); jo.put("ip",customer.getIp());// 索引 jo.put("macAddress",""); jo.put("createTime", DateUtil.currentTimeSeconds()); jo.put("companyId", customer.getCompanyId()); // 1、新增客户记录 dsForRW.getDB().getCollection("customer").save(jo); try { //2、缓存用户认证数据到 Map<String, Object> data = userRepository.saveAT(customer.getCustomerId(), jo.getString("userKey")); data.put("customerId", customer.getCustomerId()); //data.put("nickname",jo.getString("nickname")); return data; } catch (Exception e) { e.printStackTrace(); } return null; } @Override public Integer findUserByIp(String ip) { Query<Customer> query = dsForRW.createQuery(Customer.class); if (!StringUtil.isEmpty(ip)){ query.field("userKey").equal(DigestUtils.md5Hex(ip)); } if(query.get()!=null){ return query.get().getCustomerId(); }else{ return null; } } /** * 获取处于可分配态的客服人员 */ @Override public Map<Integer,Integer> findWaiter(ObjectId companyId,ObjectId departmentId){ Map<Integer,Integer> map = new HashMap<Integer,Integer>(); Query<Employee> query = dsForRW.createQuery(Employee.class).field("companyId").equal(companyId) .field("departmentId").equal(departmentId).field("isPause").equal(1); if(query == null) return null; List<Employee> emps= query.asList(); for(Iterator<Employee> iter = emps.iterator(); iter.hasNext(); ){ Employee emp = iter.next(); map.put(emp.getUserId(), emp.getChatNum()); } return map; } /** * 添加常用语 */ @Override public CommonText commonTextAdd(CommonText commonText) { commonText.setCreateTime(DateUtil.currentTimeSeconds());//创建时间 commonText.setCreateUserId(ReqUtil.getUserId());//创建人 commonText.setModifyUserId(ReqUtil.getUserId());//修改人 dsForRW.save(commonText); return commonText; } /** * 删除常用语 */ @Override public boolean deleteCommonText(String commonTextId) { ObjectId commonTextIds = new ObjectId(commonTextId); Query<CommonText> query = dsForRW.createQuery(CommonText.class).filter("_id", commonTextIds); //CommonText commonText = query.get();获取查询出的对象 dsForRW.delete(query); return true; } /** * 查询常用语 */ @Override public List<CommonText> commonTextGet(String companyId, int pageIndex, int pageSize) { ObjectId companyIds = new ObjectId(companyId); Query<CommonText> query = dsForRW.createQuery(CommonText.class); query.filter("companyId", companyIds); //根据创建时间倒叙 List<CommonText> commonTextList = query.offset(pageIndex * pageSize).limit(pageSize).order("-createTime").asList(); return commonTextList; } /** * 修改常用语 */ @Override public CommonText commonTextModify(CommonText commonText) { if (!StringUtil.isEmpty(commonText.getId().toString())) { //根据常用语id来查询出数据 Query<CommonText> query = dsForRW.createQuery(CommonText.class).field("_id").equal(commonText.getId()); //修改 UpdateOperations<CommonText> uo = dsForRW.createUpdateOperations(CommonText.class); //赋值 if (null!=commonText.getContent()) { uo.set("content", commonText.getContent()); } uo.set("modifyUserId", ReqUtil.getUserId()); uo.set("createTime", DateUtil.currentTimeSeconds()); commonText = dsForRW.findAndModify(query, uo); } return commonText; } }
package com.company.entities; /** * Created by Администратор on 25.01.2016. */ public class Driver { private Human human; private DriverLicense driverLicense; public Driver() { } public Driver(Human human, DriverLicense driverLicense) { this.human = human; this.driverLicense = driverLicense; } public Human getHuman() { return human; } public void setHuman(Human human) { this.human = human; } public DriverLicense getDriverLicense() { return driverLicense; } public void setDriverLicense(DriverLicense driverLicense) { this.driverLicense = driverLicense; } @Override public String toString() { return "Driver{" + "human=" + human + ", driverLicense=" + driverLicense + '}'; } }
package com.auction.controller; import com.auction.entity.User; import com.auction.service.UserService; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.springframework.context.MessageSource; import org.springframework.ui.ModelMap; import org.springframework.validation.BindingResult; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import static org.mockito.Matchers.*; import static org.mockito.Mockito.*; public class AppControllerTest { @Mock UserService service; @Mock MessageSource message; @InjectMocks AppController appController; @Spy List<User> users = new ArrayList<User>(); @Spy ModelMap model; @Mock BindingResult result; @BeforeClass public void setUp(){ MockitoAnnotations.initMocks(this); users = getUsersList(); } @Test public void listUsers(){ when(service.findAllUsers()).thenReturn(users); Assert.assertEquals(appController.listUsers(model), "alleusers"); Assert.assertEquals(model.get("users"), users); verify(service, atLeastOnce()).findAllUsers(); } public List<User> getUsersList(){ User user1 = new User(); user1.setLogin("Alex"); User user2 = new User(); user2.setLogin("Jeremy"); users.add(user1); users.add(user2); return users; } }
package moe.vergo.seasonalseiyuuapi.adapter.in.web; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class WebInputConfig { @Bean WebMvcConfigurer configurer () { return new WebMvcConfigurer() { @Override public void addResourceHandlers (ResourceHandlerRegistry registry) { registry.addResourceHandler("/static/**"). addResourceLocations("classpath:/static/"); } }; } }
package eu.ibisba.hub.backend.ISA; import java.util.ArrayList; public class Investigation { private String description; private ArrayList<Study> study = new ArrayList<>(); public Investigation(String value) { setDescription(value); } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public ArrayList<Study> getStudy() { return study; } public void addStudy(Study study) { this.study.add(study); } }
package com.accp.mapper; import com.accp.domain.Keclassify; import com.accp.domain.KeclassifyExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface KeclassifyMapper { int countByExample(KeclassifyExample example); int deleteByExample(KeclassifyExample example); int deleteByPrimaryKey(String keyid); int insert(Keclassify record); int insertSelective(Keclassify record); List<Keclassify> selectByExample(KeclassifyExample example); Keclassify selectByPrimaryKey(String keyid); int updateByExampleSelective(@Param("record") Keclassify record, @Param("example") KeclassifyExample example); int updateByExample(@Param("record") Keclassify record, @Param("example") KeclassifyExample example); int updateByPrimaryKeySelective(Keclassify record); int updateByPrimaryKey(Keclassify record); }
package bot.action; import lejos.hardware.port.Port; import lejos.hardware.sensor.EV3IRSensor; import lejos.hardware.sensor.SensorMode; import lejos.robotics.RangeFinderAdaptor; public class IrScanner { private final EV3IRSensor irSensor; private RangeFinderAdaptor adaptor = null; // Base line for accurate object detection public static final float MAX_RELIABLE_SCAN_DISTANCE = 7.0F; private static final float MAX_DISTANCE_FOR_COLOR_DETECTION = 1F; public IrScanner(Port irSensorPort) { irSensor = new EV3IRSensor(irSensorPort); SensorMode sensorMode = irSensor.getDistanceMode(); adaptor = new RangeFinderAdaptor(sensorMode); } public synchronized boolean objectDetected() { float currentDistance = getCurrentScanDistance(); // within our scanning range? return currentDistance != 0 && (getCurrentScanDistance() <= MAX_RELIABLE_SCAN_DISTANCE); } public synchronized boolean isWithinColorRange() { float currentDistance = getCurrentScanDistance(); return currentDistance != 0 && (getCurrentDistanceFromObject() <= MAX_DISTANCE_FOR_COLOR_DETECTION); } public void close() { irSensor.close(); } private synchronized float getCurrentScanDistance() { float currentDistance = getCurrentDistanceFromObject(); float[] sample = adaptor.getRanges(); System.out.println("Scan current distance from sensor adaptor: " + currentDistance); float[] irSample = new float[irSensor.sampleSize()]; // get the raw sample data irSensor.getDistanceMode().fetchSample(irSample, 0); // calculate average of scanned distances float scanDistance = findAverageScanDistance(sample); return scanDistance; } private float findAverageScanDistance(float[] sample) { float average = 0; for (float scanDistance : sample) { average += scanDistance; } average = average / sample.length; System.out.println("Average scan distance: " + average); return average; } private float getCurrentDistanceFromObject() { return adaptor.getRange(); } }
package misc; public class HBgenerate { static int count; public static void main(String[] args) { BSTNode root = buildHBO(3); inOrder(root); } public static void inOrder(BSTNode root) { if(root == null) { return; } inOrder(root.left); System.out.print(root.data + " "); inOrder(root.right); } public static BSTNode buildHBO(int h) { BSTNode temp; if(h == 0) { return null; } temp = new BSTNode(); temp.left = buildHBO(h-1); temp.data = count++; temp.right = buildHBO(h-1); return temp; } } class BSTNode { int data; BSTNode left; BSTNode right; }
import java.sql.*; public class DBMD_ex1_oracle { static String driverClassName = "oracle.jdbc.OracleDriver" ; static String url = "jdbc:oracle:thin:@192.168.6.21:1521:dblabs" ; static Connection dbConnection = null; static String username = "jordan"; static String passwd = "12345"; static Statement statement = null; static ResultSet rs = null; static DatabaseMetaData dbmd = null; public static void main (String[] argv) throws Exception { Class.forName (driverClassName); dbConnection = DriverManager.getConnection (url, username, passwd); dbmd = dbConnection.getMetaData(); String dbmsName = dbmd.getDatabaseProductName(); rs = dbmd.getTableTypes(); System.out.print("Οι παρακάτω τύποι πινάκων είναι διαθέσιμοι "); System.out.println("στην " + dbmsName + ": "); while (rs.next()) { String tableType = rs.getString("TABLE_TYPE"); System.out.println(" " + tableType); } dbConnection.close(); } }
package com.tencent.mm.modelappbrand.b; public interface c { String Ke(); }
package kh.cocoa.dto; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data @NoArgsConstructor public class PositionDTO { private int code; private String name; @Builder public PositionDTO(int code, String name) { super(); this.code = code; this.name = name; } }
public class Menu { public void show() { System.out.println("\nMENU"); System.out.println("Enter:\n1 : Add word to dictionary\n2 : Translate from English to Russia\n3 : Translate from Russia to English" + "\n4 : Show dictionary\n0 : Exit "); } }
package oop1; import java.util.Scanner; public class OrderDemo1 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); Order[] orders = new Order[100]; int savePosition = 0; while(true) { System.out.println("=================================================="); System.out.println("1.조회 2.검색 3.입력 4.종료"); System.out.println("=================================================="); System.out.print("메뉴를 선택해주세요: "); int menuNum = scanner.nextInt(); if (menuNum==4) { System.out.println("프로그램을 종료합니다."); break; } else if (menuNum==1) { Order orderMenu1 = new Order(); System.out.println(); System.out.println("[ 조 회 ]"); if(savePosition==0) { System.out.println("고객 주문내용이 존재하지 않습니다."); } else { System.out.println("고객명\t고객등급\t총구매금액\t적립포인트\t사은품"); System.out.println("=================================================="); for (int i=0; i<savePosition; i++) { orderMenu1 = orders[i]; System.out.print(orderMenu1.name + "\t"); System.out.print(orderMenu1.grade + "\t"); System.out.print(orderMenu1.price + "\t"); System.out.print(orderMenu1.point + "\t"); System.out.println(orderMenu1.gift); } } System.out.println(); } else if (menuNum==2) { Order orderMenu2 = new Order(); System.out.println("[ 검 색 ]"); System.out.print("검색조건을 입력하세요(이름:N/사은품:G): "); String searchCon = scanner.next(); System.out.print("검색어를 입력하세요: "); String searchKey = scanner.next(); System.out.println("고객명\t고객등급\t총구매금액\t적립포인트\t사은품"); System.out.println("=================================================="); for (int i=0; i<savePosition; i++) { orderMenu2 = orders[i]; boolean isFound = false; if (searchCon.equals("N")&&searchKey.equals(orderMenu2.name)) { isFound = true; } else if (searchCon.equals("G")&&searchKey.equals(orderMenu2.gift)) { isFound = true; } if (isFound) { System.out.print(orderMenu2.name + "\t"); System.out.print(orderMenu2.grade + "\t"); System.out.print(orderMenu2.price + "\t"); System.out.print(orderMenu2.point + "\t"); System.out.println(orderMenu2.gift); } else { System.out.println("검색조건에 일치하는 결과가 없습니다."); } } } else if (menuNum==3) { Order orderMenu3 = new Order(); System.out.println("[ 입 력 ]"); System.out.println("=================================================="); System.out.print("고객명을 입력해주세요: "); orderMenu3.name = scanner.next(); System.out.print("고객등급을 입력해주세요: "); orderMenu3.grade = scanner.next(); System.out.print("총 구매금액을 입력해주세요: "); orderMenu3.price = scanner.nextInt(); if (orderMenu3.grade.equals("프리미어")) { orderMenu3.point = (int)(orderMenu3.price*0.05); } else if (orderMenu3.grade.equals("에이스")) { orderMenu3.point = (int)(orderMenu3.price*0.03); } else if(orderMenu3.grade.equals("베스트")) { orderMenu3.point = (int)(orderMenu3.price*0.02); } else if (orderMenu3.grade.equals("클래식")) { orderMenu3.point = (int)(orderMenu3.price*0.01); } else { orderMenu3.point = 0; } // orderMenu3.point(if~else if) end if (orderMenu3.price >=5_000_000) { orderMenu3.gift = "숙박권"; } else if (orderMenu3.price >=1_000_000){ orderMenu3.gift = "상품권"; } else if (orderMenu3.price>=500_000) { orderMenu3.gift = "할인권"; } else { orderMenu3.gift = "주차권"; } // orderMenu3.price (if~else if) end orders[savePosition]=orderMenu3; savePosition++; } // menu (if~else if) end }//while end scanner.close(); } }
package com.unterr.truex.scapegoat.elements; import android.app.ActionBar; import android.content.Context; import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.squareup.picasso.Picasso; import com.unterr.truex.scapegoat.R; import com.unterr.truex.scapegoat.models.MoneyProcess; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Locale; public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.CustomViewHolder> { private ArrayList<MoneyProcess> data; // Provide a reference to the views for each data item // Complex data items may need more than one view per item, and // you provide access to all the views for a data item in a view holder public static class CustomViewHolder extends RecyclerView.ViewHolder { // each data item is just a string in this case public final View view; public final TextView name; public final TextView reqLvl; public final TextView inputPrice; public final TextView productPrice; public final TextView profitPer; public final TextView xpPer; public final TextView profitPerHr; public final ImageView image; public final ImageView imageSkill; public CustomViewHolder(View view) { super(view); this.view = view; name = view.findViewById (R.id.name); reqLvl = view.findViewById (R.id.reqLvl); inputPrice = view.findViewById (R.id.inputPrice); productPrice = view.findViewById (R.id.productPrice); profitPer = view.findViewById (R.id.profitPer); xpPer = view.findViewById (R.id.xpPer); profitPerHr = view.findViewById (R.id.profitPerHr); image = view.findViewById (R.id.image); imageSkill = view.findViewById (R.id.imageSkill); } } // Provide a suitable constructor (depends on the kind of dataset) public CustomAdapter(ArrayList<MoneyProcess> _data) { this.data = _data; } // Create new views (invoked by the layout manager) @Override public CustomAdapter.CustomViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // create a new view View v = (View) LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_process, parent, false); CustomViewHolder viewHolder = new CustomViewHolder(v); return viewHolder; } // Replace the contents of a view (invoked by the layout manager) @Override public void onBindViewHolder(CustomViewHolder holder, int position) { // - get element from your dataset at this position // - replace the contents of the view with that element //Temporary solution. Icon needs to be added to drawable //String skillIcon = ("herblore"); //Drawable myDrawable = getResources().getDrawable(R.drawable.icon.herblore); MoneyProcess process = data.get(position); NumberFormat numberFormat = NumberFormat.getNumberInstance (Locale.US); if (process.getProfitPer () < 0){ holder.profitPer.setTextColor (Color.rgb (124,27,16)); holder.profitPerHr.setTextColor (Color.rgb (124,27,16)); } else{ holder.profitPer.setTextColor (Color.rgb(33, 132, 38)); holder.profitPerHr.setTextColor (Color.rgb(33, 132, 38)); } if (process.getReqLvlMet () == false){ holder.reqLvl.setTextColor (Color.rgb (124,27,16)); holder.name.setTextColor (Color.rgb (124,27,16)); } else{ holder.reqLvl.setTextColor (Color.rgb(33, 132, 38)); holder.name.setTextColor (Color.rgb(33, 132, 38)); } holder.name.setText (process.getProcessName ()); holder.reqLvl.setText (String.format("%.0f", process.getReqLvl ())); holder.inputPrice.setText (numberFormat.format(process.getInputTradePrice ()) + "gp"); holder.productPrice.setText (numberFormat.format(process.getProductTradePrice ()) + "gp"); holder.profitPer.setText (numberFormat.format(process.getProfitPer ()) + "gp"); holder.xpPer.setText (process.getXpPer ().toString ()); holder.profitPerHr.setText (numberFormat.format(process.getProfitTotal ()) + "gp"); Picasso.get().load(process.getIconUrl()).into(holder.image); //Temporary solution. Icon needs to be added to drawable and called if (process.categoryID == 1 || process.categoryID == 2){ holder.imageSkill.setImageResource(R.drawable.herblore); }if (process.categoryID == 3){ holder.imageSkill.setImageResource(R.drawable.farming); }if (process.categoryID == 4 || process.categoryID == 5 || process.categoryID == 6){ holder.imageSkill.setImageResource(R.drawable.fletching); }if (process.categoryID == 7){ holder.imageSkill.setImageResource(R.drawable.smithing); } } // Return the size of your dataset (invoked by the layout manager) @Override public int getItemCount() { if (data != null){ return data.size(); } else { return 0; } } }
import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JColorChooser; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.MouseInfo; import java.awt.Point; import javax.swing.JTextField; import javax.swing.JLabel; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.border.BevelBorder; import javax.swing.border.LineBorder; import javax.swing.JFileChooser; import javax.swing.JMenuBar; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.ImageIcon; import javax.swing.Timer; import java.awt.event.MouseMotionAdapter; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseWheelListener; import java.awt.event.MouseWheelEvent; import javax.swing.JSlider; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; import java.io.File; import javax.swing.event.ChangeListener; import javax.swing.event.ChangeEvent; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileSystemView; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import javax.swing.JRadioButton; import javax.swing.JList; public class newgui { private JFrame frmPaint; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { newgui window = new newgui(); window.frmPaint.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. * * @wbp.parser.entryPoint */ public newgui() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frmPaint = new JFrame(); frmPaint.setTitle("Paint"); frmPaint.setResizable(false); frmPaint.setBounds(100, 100, 700, 700); frmPaint.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.setBackground(new Color(153, 153, 153)); panel.setToolTipText(""); frmPaint.getContentPane().add(panel, BorderLayout.CENTER); panel.setLayout(null); JLabel lblNewLabel = new JLabel("New label"); lblNewLabel.setBounds(0, 0, 694, 672); panel.add(lblNewLabel); JFileChooser file = new JFileChooser(); file.setCurrentDirectory(new File(System.getProperty("user.home"))); //filter the files FileNameExtensionFilter filter = new FileNameExtensionFilter("*.Images", "jpg","gif","png"); file.addChoosableFileFilter(filter); int result = file.showSaveDialog(null); //if the user click on save in Jfilechooser if(result == JFileChooser.APPROVE_OPTION){ File selectedFile = file.getSelectedFile(); String path = selectedFile.getAbsolutePath(); ImageIcon icon = new ImageIcon(path); Image scaleImage = icon.getImage().getScaledInstance(28, 28,Image.SCALE_DEFAULT); } }}
package com.example.ty_en.ires; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.GridView; import android.widget.ImageView; import android.widget.TextView; import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; public class OrderDoneActivity extends AppCompatActivity implements View.OnClickListener{ private MenuItemAdapter menuItemAdapter ; private ArrayList<MenuItem> menuItemList ; private GridView orderGridView ; private static Bundle imageBundle = new Bundle() ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_order_done); //Intentからメニューリストを取得 Intent intent = getIntent() ; menuItemList = (ArrayList<MenuItem>)intent.getSerializableExtra("menuItemList") ; //GridView用のAdapter生成 menuItemAdapter = new MenuItemAdapter(getApplicationContext(),R.id.order_list,menuItemList) ; //Adapter設定 orderGridView = (GridView)findViewById(R.id.order_list) ; orderGridView.setAdapter(menuItemAdapter); //Gridビューの編集 //スクロールバーを非表示 orderGridView.setVerticalScrollBarEnabled(false); //カード部分をselectorにするため、リストのselectorは透明に orderGridView.setSelector(android.R.color.transparent); //DoneButton Button orderDoneButton = (Button)findViewById(R.id.ordered_button) ; orderDoneButton.setOnClickListener(this) ; } @Override protected void onStop(){ super.onStop(); System.out.println("STOPしたよ") ; orderGridView.setAdapter(null); menuItemAdapter = null; orderGridView = null ; imageBundle = null ; } @Override public void onClick(View v) { //Intentにリストを登録 Intent intent = new Intent(getApplicationContext(),EatFlow.class) ; intent.putExtra("menuItemList",menuItemList) ; startActivity(intent) ; } private class MenuItemAdapter extends ArrayAdapter<MenuItem> { private LayoutInflater inflater; public MenuItemAdapter(Context context, int resource, List<MenuItem> objects) { super(context, resource, objects); inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public View getView(int position, View convertView, ViewGroup parent) { //ビューの取得 View view = inflater.inflate(R.layout.order_confirm_row_layout, null, false); //メニュー情報取得 final MenuItem menuItem = getItem(position) ; //メニュー画像 final ImageView menuImageView = (ImageView)view.findViewById(R.id.menu_image); //menuImageView.setImageBitmap((Bitmap)imageBundle.getParcelable(menuItem.getMenuImageKey())); //メニュー画像取得スレッド後に画像設定Listener //設定すべき画像がなければメニュー画像を別スレッドで取得 if(imageBundle.get(menuItem.getMenuImageKey()) == null){ System.out.println(menuItem.getMenuImageKey()+"Load") ; ImageFileInFactory imageFileInFactory = new ImageFileInFactory(getApplicationContext(),menuItem.getMenuImageKey()) ; (new AsyncTask<ImageFileInFactory,Void,Bitmap>(){ @Override protected Bitmap doInBackground(ImageFileInFactory... ifofs){ return ifofs[0].readBitmap() ; } protected void onPostExecute(Bitmap resultBitMap){ imageBundle.putParcelable(menuItem.getMenuImageKey(),resultBitMap); menuImageView.setImageBitmap(resultBitMap); resultBitMap = null ; cancel(true); } }).execute(imageFileInFactory) ; } menuImageView.setImageBitmap((Bitmap)imageBundle.getParcelable(menuItem.getMenuImageKey())); //メニュー名 final TextView menuNameView = (TextView)view.findViewById(R.id.menu_name) ; menuNameView.setText(menuItem.getMenuName()); //メニューオーダー数 TextView menuOrderCountView = (TextView)view.findViewById(R.id.menu_order_count) ; menuOrderCountView.setText(String.valueOf(menuItem.getMenuOrderCount())); //メニュー金額 NumberFormat numberFormat = NumberFormat.getCurrencyInstance() ; TextView menuPriceView = (TextView)view.findViewById(R.id.menu_price) ; menuPriceView.setText(numberFormat.format(menuItem.getMenuPrice())); return view; } } }
package sarong.discouraged; import sarong.LightRNG; import sarong.LinnormRNG; import sarong.SkippingRandomness; import sarong.StatefulRandomness; import sarong.util.StringKit; import java.io.Serializable; /** * A 64-bit generator that should be like {@link LightRNG} but faster; period is 2 to the 64, Stateful and Skipping. * One-dimensionally equidistributed. Passes at least 2TB of PractRand with no anomalies. Speed is very close to * {@link LinnormRNG}, but this has more features (just {@link #skip(long)}, really). {@link #determine(long)} should * also be a good alternative to {@link LinnormRNG#determine(long)}, and about 10% faster (which is hard to attain). * <br> * This implements SkippingRandomness and StatefulRandomness, meaning you can skip forwards or backwards from * any given state in constant time, as well as set the state or get the current state as a long. * <br> * Created by Tommy Ettinger on 11/9/2017. */ public final class MotorRNG implements StatefulRandomness, SkippingRandomness, Serializable { private static final long serialVersionUID = 6L; /** * Can be any long value. */ private long state; /** * Creates a new generator seeded using Math.random. */ public MotorRNG() { this((long) ((Math.random() - 0.5) * 0x10000000000000L) ^ (long) (((Math.random() - 0.5) * 2.0) * 0x8000000000000000L)); } public MotorRNG(long seed) { state = seed; } /** * Get the current internal state of this MotorRNG as a long. * * @return the current internal state of this object. */ public long getState() { return state; } /** * Set the current internal state of this MotorRNG with a long. * @param state any 64-bit long */ public void setState(long state) { this.state = state; } /** * Using this method, any algorithm that might use the built-in Java Random * can interface with this randomness source. * * @param bits the number of bits to be returned * @return the integer containing the appropriate number of bits */ @Override public final int next(final int bits) { final long y = (state += 0x9E3779B97F4A7C15L); final long z = (y ^ (y << 23 | y >>> 41) ^ (y << 29 | y >>> 35)) * 0xDB4F0B9175AE2165L; return (int) ((z ^ (z << 11 | z >>> 53) ^ (z << 19 | z >>> 45)) >>> 64 - bits); // final long y = (state += 0x9E3779B97F4A7C15L); // final long z = (y ^ y >>> 28) * 0xD2B74407B1CE6E93L; // return (int) ((z ^ (z << 21 | z >>> 43) ^ (z << 41 | z >>> 23)) >>> 64 - bits); // long z = (state += 0x9E3779B97F4A7C15L); // z = (z ^ z >>> 21) + 0xC6BC279692B5CC85L; // z = (z ^ z >>> 19) + 0x6C8E9CF970932BD5L; // return (int) ((z ^ z >>> 25) >>> 64 - bits); // final long z = (state += 0x9E3779B97F4A7C15L), x = (z ^ (z << 18 | z >>> 46) ^ (z << 47 | z >>> 17)) * 0x41C64E6DL; // return (int) ((x ^ (x << 25 | x >>> 39) ^ (x << 38 | x >>> 26)) >>> (64 - bits)); // long z = (state += 0x6C8E9CF970932BD5L); // z = (z ^ z >>> 25) * 0x2545F4914F6CDD1DL; // z ^= ((z << 19) | (z >>> 45)) ^ ((z << 53) | (z >>> 11)); // return (int)( // (z ^ (z >>> 25)) // >>> (64 - bits)); } /** * Using this method, any algorithm that needs to efficiently generate more * than 32 bits of random data can interface with this randomness source. * <p> * Get a random long between Long.MIN_VALUE and Long.MAX_VALUE (both inclusive). * * @return a random long between Long.MIN_VALUE and Long.MAX_VALUE (both inclusive) */ @Override public final long nextLong() {//0xD1B54A32D192ED03L, 0xABC98388FB8FAC02L, 0x8CB92BA72F3D8DD7L final long l = (state += 0x9E3779B97F4A7C15L); final long z = (l ^ l >>> 28 ^ 0xDB4F0B9175AE2165L) * 0xC6BC279692B5CC83L + 0x632BE59BD9B4E019L; return (z ^ (z << 46 | z >>> 18) ^ (z << 19 | z >>> 45)); // return z ^ z >>> 26; // return determineBare(state += 0x9E3779B97F4A7C15L); // long s = (state += 0x9E3779B97F4A7C15L); // return ((s = (s ^ (s << 13 | s >>> 51) ^ (s << 29 | s >>> 35)) * 0xDB4F0B9175AE2165L) ^ s >>> 28); // final long y = (state += 0x9E3779B97F4A7C15L); // final long z = (y ^ (y << 13 | y >>> 51) ^ (y << 29 | y >>> 35)) * 0xDB4F0B9175AE2165L; // return (z ^ z >>> 28); // final long z = (y ^ (y << 23 | y >>> 41) ^ (y << 29 | y >>> 35)) * 0xDB4F0B9175AE2165L; // return (z ^ (z << 11 | z >>> 53) ^ (z << 19 | z >>> 45)); // final long z = (y ^ y >>> 28) * 0xD2B74407B1CE6E93L; // return (z ^ (z << 21 | z >>> 43) ^ (z << 41 | z >>> 23)); // z = (z ^ z >>> 31 ^ 0xC6BC279692B5CC85L) * 0x41C64E6BL + 0x6C8E9CF970932BD5L; // return z ^ z >>> 31; // final long y = state; // final long z = y ^ (state += 0xC6BC279692B5CC85L); // final long r = (y - (z << 29 | z >>> 35)) * z; // return r ^ r >>> 28; // final long z = (state += 0x9E3779B97F4A7C15L), // x = (z ^ (z << 18 | z >>> 46) ^ (z << 47 | z >>> 17)) * 0x41C64E6DL; // return (x ^ (x << 25 | x >>> 39) ^ (x << 38 | x >>> 26)); // long z = (state += 0x6C8E9CF970932BD5L); // z = (z ^ z >>> 25) * 0x2545F4914F6CDD1DL; // z ^= ((z << 19) | (z >>> 45)) ^ ((z << 53) | (z >>> 11)); // return z ^ (z >>> 25); // long a = (state = state * 0x369DEA0F31A53F85L + 1L); // a ^= Long.reverseBytes(a) ^ a >>> 29; // return a ^ a >>> 25; // final long z = (state += 0x6C8E9CF970932BD5L); // return (z ^ z >>> 25) ^ Long.reverseBytes(z) * 0x59071D96D81ECD35L; //(z ^ z >>> 25) * 0x59071D96D81ECD35L ^ ((z << 12) | (z >>> 52)) ^ ((z << 47) | (z >>> 17)); } /** * Call with {@code MotorRNG.determine(++state)}, where state can be any long; this will act like a MotorRNG * constructed with {@link #MotorRNG(long)}, but the state of a MotorRNG won't be the same as the s parameter here. * You can use {@code MotorRNG.determine(--state)} to go backwards. If you have control over state, you may prefer * {@link #determineBare(long)}, which requires adding a specific large number to each parameter but may be faster. * @param s any long; increment while calling with {@code ++state} * @return a pseudo-random long obtained from the given state and stream deterministically */ public static long determine(long s) { // return (s = ((s = ((s *= 0x9E3779B97F4A7C15L) << 35 | s >>> 29) * 0xD1B54A32D192ED03L) << 17 | s >>> 47) * 0xABC98388FB8FAC03L) ^ s >>> 28; // return ((s = ((s *= 0x9E3779B97F4A7C15L) ^ (s << 13 | s >>> 51) ^ (s << 29 | s >>> 35)) * 0xDB4F0B9175AE2165L) ^ s >>> 28); return ((s = ((s *= 0x9E3779B97F4A7C15L) ^ s >>> 25 ^ 0xDB4F0B9175AE2165L) * 0xC6BC279692B5CC83L + 0x632BE59BD9B4E019L) ^ (s << 46 | s >>> 18) ^ (s << 19 | s >>> 45)); // return ((s = ((s *= 0x9E3779B97F4A7C15L) ^ (s << 23 | s >>> 41) ^ (s << 29 | s >>> 35)) * 0xDB4F0B9175AE2165L) ^ (s << 11 | s >>> 53) ^ (s << 19 | s >>> 45)); } /** * Call with {@code MotorRNG.determineBare(state += 0x9E3779B97F4A7C15L)}, where state can be any long; and the * number added to state should usually be fairly similar to 0x9E3779B97F4A7C15L (not many bits should differ, and * the number must be odd). If the assignment to state has stayed intact on the next time this is called in the same * way, it will have the same qualities as MotorRNG normally does, though if the increment has been changed a lot * from {@code 0x9E3779B97F4A7C15L}, then it may have very different quality that MotorRNG should have. * <br> * You can probably experiment with different increments for stream. The number 0x9E3779B97F4A7C15L is 2 to the 64 * divided by the golden ratio and adjusted to be an odd number, but it's just a Weyl sequence increment, which * means its bit structure is as unpredictable as an irrational number in fixed-point form. * @param s any long; increment while calling with {@code state += 0x9E3779B97F4A7C15L} * @return a pseudo-random long obtained from the given state deterministically */ public static long determineBare(long s) { return ((s = (s ^ (s << 13 | s >>> 51) ^ (s << 29 | s >>> 35)) * 0xDB4F0B9175AE2165L) ^ s >>> 28); // return ((s = (s ^ (s << 23 | s >>> 41) ^ (s << 29 | s >>> 35)) * 0xDB4F0B9175AE2165L) ^ (s << 11 | s >>> 53) ^ (s << 19 | s >>> 45)); } /** * Advances or rolls back the MotorRNG's state without actually generating each number. Skips forward * or backward a number of steps specified by advance, where a step is equal to one call to nextLong(), * and returns the random number produced at that step (you can get the state with {@link #getState()}). * * @param advance Number of future generations to skip over; can be negative to backtrack, 0 gets the most-recently-generated number * @return the random long generated after skipping forward or backwards by {@code advance} numbers */ @Override public final long skip(long advance) { final long y = (state += 0x9E3779B97F4A7C15L * advance); final long z = (y ^ (y << 23 | y >>> 41) ^ (y << 29 | y >>> 35)) * 0xDB4F0B9175AE2165L; return (z ^ (z << 11 | z >>> 53) ^ (z << 19 | z >>> 45)); // final long y = (state += 0x9E3779B97F4A7C15L * advance); // final long z = (y ^ y >>> 28) * 0xD2B74407B1CE6E93L; // return (z ^ (z << 21 | z >>> 43) ^ (z << 41 | z >>> 23)); // final long y = (state += 0xC6BC279692B5CC85L * advance) - 0xC6BC279692B5CC85L; // final long z = y ^ state; // final long r = (y - (z << 29 | z >>> 35)) * z; // return r ^ r >>> 28; // final long z = (state += 0x9E3779B97F4A7C15L * advance), x = (z ^ (z << 18 | z >>> 46) ^ (z << 47 | z >>> 17)) * 0x41C64E6DL; // return (x ^ (x << 25 | x >>> 39) ^ (x << 38 | x >>> 26)); // long z = (state += 0x6C8E9CF970932BD5L * advance); // z = (z ^ z >>> 25) * 0x2545F4914F6CDD1DL; // z ^= ((z << 19) | (z >>> 45)) ^ ((z << 53) | (z >>> 11)); // return z ^ (z >>> 25); } /** * Produces a copy of this RandomnessSource that, if next() and/or nextLong() are called on this object and the * copy, both will generate the same sequence of random numbers from the point copy() was called. This just need to * copy the state so it isn't shared, usually, and produce a new value with the same exact state. * * @return a copy of this RandomnessSource */ @Override public MotorRNG copy() { return new MotorRNG(state); } @Override public String toString() { return "MotorRNG with state 0x" + StringKit.hex(state) + "L"; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MotorRNG motorRNG = (MotorRNG) o; return state == motorRNG.state; } @Override public int hashCode() { return (int) ((state ^ state >>> 32)); } // public static void main(String[] args) // { // /* // cd target/classes // java -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly sarong/MotorRNG > motor_asm.txt // */ // long seed = 1L, state = 1L, stream = 11L; // //MotorRNG rng = new MotorRNG(seed); // for (int r = 0; r < 10; r++) { // for (int i = 0; i < 1000000007; i++) { // seed += determineBare(state += 0x6C8E9CF970932BD5L); // //seed += rng.nextLong(); // } // } // System.out.println(seed); // // } }
package aparnagpt.blogapp.service; import aparnagpt.blogapp.model.Blog; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Component; import org.springframework.web.server.ResponseStatusException; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; @Component public class BlogService { @Autowired private JdbcTemplate jdbcTemplate; public void createBlog(Blog blog) { jdbcTemplate.update("INSERT INTO BLOG (TITLE, TEXT, DATE) VALUES (?, ?, NOW())", blog.getTitle(), blog.getText()); } public List<Blog> getBlogs() { return jdbcTemplate.query("SELECT ID, TITLE, DATE FROM BLOG ORDER BY DATE", (rs, i) -> new Blog(rs.getInt("id"), rs.getString("title"), rs.getDate("date").toLocalDate())); } public Blog getBlog(String id) { return jdbcTemplate.query("SELECT ID, TITLE, TEXT, DATE FROM BLOG WHERE ID = ?", BlogService::mapToBlog, id) .stream() .findAny() .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); } public void deleteBlog(String id) { jdbcTemplate.update("DELETE FROM BLOG WHERE ID = ?", id); } private static Blog mapToBlog(ResultSet rs, int index) throws SQLException { return new Blog(rs.getInt("id"), rs.getString("title"), rs.getString("text"), rs.getDate("date").toLocalDate()); } }
package xdpm.nhom11.angrybirdsproject.xmlbird; import xdpm.nhom11.angrybirdsproject.entities.Pig; import xdpm.nhom11.angrybirdsproject.entities.Pig.PigType; public class DTOPig { public String id; public float lifevalue; public int score; public float x; public float y; public Pig getPig() { return new Pig(id, PigType.NORMAL, x, y, 0, 5000, null); } }
/* * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hazelcast.client; import com.hazelcast.core.EntryAdapter; import com.hazelcast.core.EntryEvent; import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.core.IMap; import com.hazelcast.core.LifecycleEvent; import com.hazelcast.core.LifecycleListener; import com.hazelcast.test.HazelcastSerialClassRunner; import com.hazelcast.test.HazelcastTestSupport; import com.hazelcast.test.annotation.QuickTest; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import java.util.concurrent.CountDownLatch; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @RunWith(HazelcastSerialClassRunner.class) @Category(QuickTest.class) public class ClientReconnectTest extends HazelcastTestSupport { @After @Before public void cleanup() throws Exception { HazelcastClient.shutdownAll(); Hazelcast.shutdownAll(); } @Test public void testClientReconnectOnClusterDown() throws Exception { final HazelcastInstance h1 = Hazelcast.newHazelcastInstance(); final HazelcastInstance client = HazelcastClient.newHazelcastClient(); final CountDownLatch connectedLatch = new CountDownLatch(2); client.getLifecycleService().addLifecycleListener(new LifecycleListener() { @Override public void stateChanged(LifecycleEvent event) { connectedLatch.countDown(); } }); IMap<String, String> m = client.getMap("default"); h1.shutdown(); Hazelcast.newHazelcastInstance(); assertOpenEventually(connectedLatch, 10); assertNull(m.put("test", "test")); assertEquals("test", m.get("test")); } @Test public void testClientReconnectOnClusterDownWithEntryListeners() throws Exception { HazelcastInstance h1 = Hazelcast.newHazelcastInstance(); final HazelcastInstance client = HazelcastClient.newHazelcastClient(); final CountDownLatch connectedLatch = new CountDownLatch(2); client.getLifecycleService().addLifecycleListener(new LifecycleListener() { @Override public void stateChanged(LifecycleEvent event) { connectedLatch.countDown(); } }); final IMap<String, String> m = client.getMap("default"); final CountDownLatch latch = new CountDownLatch(1); final EntryAdapter<String, String> listener = new EntryAdapter<String, String>() { public void onEntryEvent(EntryEvent<String, String> event) { latch.countDown(); } }; m.addEntryListener(listener, true); h1.shutdown(); Hazelcast.newHazelcastInstance(); assertOpenEventually(connectedLatch, 10); m.put("key", "value"); assertOpenEventually(latch, 10); } }
package valida; import java.io.Serializable; import exception.CheckinInvalidoException; public class verificaCheckin implements Serializable{ private static final long serialVersionUID = 1L; /** * Metodo que verifica se a quantidade de dias da estadia eh valida * @param quant * @throws CheckinInvalidoException */ public static void verificaQuantDiasInvalidaCheckin(int quant) throws CheckinInvalidoException { if (quant <= 0) { throw new CheckinInvalidoException ("Quantidade de dias esta invalida."); } } /** * Metodo que verifica se o id do quarto eh valido * @param id * @throws CheckinInvalidoException */ public static void verificaIdInvalidaCheckin(String id) throws CheckinInvalidoException { if(!(id.matches("[a-zA-Z0-9]+"))) { throw new CheckinInvalidoException("ID do quarto invalido, use apenas numeros ou letras."); } } /** * Metodo que verifica se o tipo passado do quarto eh valido * * @param tipoQuarto * @throws CheckinInvalidoException */ public static void verificaTipoQuartoValido(String tipoQuarto) throws CheckinInvalidoException { if (!(tipoQuarto.equalsIgnoreCase("luxo") || tipoQuarto.equalsIgnoreCase("simples") || tipoQuarto.equalsIgnoreCase("presidencial"))) { throw new CheckinInvalidoException("Tipo de quarto invalido."); } } /** * Metodo que verifica se o email do hospede eh valido * @param id * @throws CheckinInvalidoException */ public static void verificaEmailFrmInvalidoCheckin(String email) throws CheckinInvalidoException { if (!email.matches("[a-zA-Z]+@[a-z]+\\.[a-z|\\.a-z+\\.a-z]+")) { throw new CheckinInvalidoException ("Email do(a) hospede esta invalido."); } } /** * Metodo que verifica se o email eh nulo * @param email * @throws CheckinInvalidoException */ public static void verificaEmailInvalidoCheckin(String email) throws CheckinInvalidoException { if (email.trim().isEmpty()) { throw new CheckinInvalidoException("Email do(a) hospede nao pode ser vazio."); } } }
package com.jk.jkproject.ui.inter; public interface OnItemClickLitener { void onItemClick(); void onItemLongCLick(String paramString, boolean paramBoolean); void onItemNameClick(String paramString); }
package Database; import org.sqlite.SQLiteException; import java.sql.*; public class DatabaseConnection implements Connectable { protected Connection connection = null; protected int currentProcess; protected Statement statement = null; public DatabaseConnection(int currentProcess, String driver) { try { this.currentProcess = currentProcess; Class.forName(driver); this.connection = DriverManager.getConnection(this.getConnectionString()); this.connection.setAutoCommit(false); } catch (SQLException | ClassNotFoundException e) { e.printStackTrace(); } } @Override public boolean insert(String table, String[] values) { try { this.statement = this.connection.createStatement(); String st = this.generateInsertStatement(table,values); if(st == null) { return false; } this.statement.executeUpdate(st); this.statement.close(); this.connection.commit(); return true; } catch (SQLException e) { return false; } } @Override public ResultSet select(String query) { ResultSet resultSet = null; try { this.statement = this.connection.createStatement(); resultSet = this.statement.executeQuery(query); } catch (SQLException e) { e.printStackTrace(); } return resultSet; } @Override public int max(String table, String identifier) { ResultSet resultSet = this.select("SELECT MAX(" + identifier + ") AS maxId FROM " + table); if(resultSet == null) { return -1; } try { return resultSet.getInt("maxId"); } catch (SQLException e) { e.printStackTrace(); } return -1; } private String getConnectionString(){ return ( ("jdbc:sqlite:src/DBFiles/DB").concat(Integer.toString(currentProcess)) ).concat(".db"); } private String generateInsertStatement(String table, String[] values){ String query = "INSERT INTO " + table + " VALUES"; int higherIdentifier = this.max(table,"ID") + 1; if(higherIdentifier == -1) { return null; } int size = values.length; int i = 0; String endOfLine = ","; for(String value : values) { if( i++ == size - 1) { endOfLine = ""; } query = query.concat("(" + Integer.toString(higherIdentifier) + ",'" + value + "')" + endOfLine); higherIdentifier++; } return query; } }
package auth; import java.io.StringReader; import java.util.List; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.*; import org.xml.sax.InputSource; import org.w3c.dom.*; import org.w3c.dom.NodeList; /** * * Factoria de Mensajes, determina y crea el tipo concreto de mensaje que corresponda */ public class CreadorMensaje extends FactoryMensaje { /** * Crea un nuevo mensaje del tipo correspondiente al contenido del xml * @param xml Contenido del mensaje, en fomato XML * @param ip Direccion del equipo remoto que envio la solicitud * @return Mensaje Respuesta a la solicitud enviada */ public Mensaje crearMensaje(String xml, String ip) { Mensaje mensaje = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); StringReader sr = new StringReader(xml); InputSource is = new InputSource(sr); Document document = builder.parse(is); XPath xPath = XPathFactory.newInstance().newXPath(); String tipo = null; tipo = document.getDocumentElement().getAttributes().getNamedItem("TYPE").getNodeValue(); if (tipo.equals("LIST-AUT")) mensaje = new ListAuthentications(document); if (tipo.equals("LIST-USERS")) mensaje = new ListUsers(document); if (tipo.equals("ADD")) mensaje = new Add(document); if (tipo.equals("REMOVE")) mensaje = new Remove(document); if (tipo.equals("MODIFY")) mensaje = new Modify(document); if (tipo.equals("AUTHENTICATE")) mensaje = new Authenticate(document, ip); } catch(Exception e) { e.printStackTrace(); } return mensaje; } }
package gcodeviewer.toolpath; //tagging interface? public interface GCodeEvent { }
/** * GameGrame.java * a class where the game run * By Vincent Zhang * 2018/1/18 * Teacher: Mr.Mangat * */ import javax.swing.JPanel; import java.awt.Point; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.util.Queue; import java.util.LinkedList; import javax.imageio.ImageIO; import java.io.File; class GameFrame extends JPanel{ //create varible Boolean moved; Boolean[][] visited; int round; int winner; int mapSizeX; int mapSizeY; int winSizeY=FinnalGame.winy; int winSizeX=FinnalGame.winx; Character c; Character[][] map2; Character currentDisplayCharacter; MapObject[][] map; MapObject currentDisplayLand; static Queue<String>q; //constructor GameFrame(Character[] player1, Character[] player2, MapObject[][]map, int mapx, int mapy) { //set the varibles moved=false; winner=-1; round=0; q=new LinkedList<String>(); visited=new Boolean[mapx][mapy]; //set the map mapSizeX=mapx; mapSizeY=mapy; map2=new Character[mapSizeX][mapSizeY]; for(int i=0;i<mapSizeX;i++){ for(int e=0;e<mapSizeY;e++){ map2[i][e]=new TempCharacter(); } } this.map=map; //loop the character list and added it to the map for(int i=1;i<=player1.length;i++){ player1[i-1].setXPosition(i); player1[i-1].setYPosition(1); map2[i][1]=player1[i-1]; if(map[i][1] instanceof Wall){ map[i][1]=new Grass(); } } for(int i=1;i<=player2.length;i++){ player2[i-1].setXPosition(mapSizeX-i); player2[i-1].setYPosition(mapSizeY-2); map2[mapSizeX-i][mapSizeY-2]=player2[i-1]; if(map[mapSizeX-i][mapSizeY-2] instanceof Wall){ map[mapSizeX-i][mapSizeY-2]=new Grass(); } } }//end /* * * showMovingRange method *a method that draw the color of a box, depend on if the character can path through it * by Vincent Zhang * 2018/1/18 * Teacher: Mr.Mangat * */ public void showMovingRange(int x,int y,Graphics g){ //if not drawed. then draw. after draw, turn the visit to true, so it will not draw again if(!visited[x][y]){ visited[x][y]=true; g.setColor(new Color(0,0,255, 100)); try{ if(c.getXPosition()==x&&c.getYPosition()==y){ g.setColor(new Color(0,0,255, 50)); } }catch(Exception e){} //draw g. fillRect(winSizeX/mapSizeX*x,winSizeY/mapSizeY*y,winSizeX/mapSizeX,winSizeY/mapSizeY); g.setColor(Color.red); g. drawRect(winSizeX/mapSizeX*x,winSizeY/mapSizeY*y,winSizeX/mapSizeX,winSizeY/mapSizeY); } } /* * *drawMovingRange method *a method that recursed through the map, finding the moveing range of a character, and call showMovingRange method * by Vincent Zhang * 2018/1/18 * Teacher: Mr.Mangat * */ public void drawMoveRange(Point currentPoint, int round, Graphics g){ //getting the current point int x=(int)currentPoint.getX(); int y=(int)currentPoint.getY(); //if reach the edge of the map, return if(x<0||x>=FinnalGame.mapx||y<0||y>=FinnalGame.mapy){ return; } //if reach enemy, return if(!(map2[x][y] instanceof TempCharacter)){ if(map2[x][y].getTeam() !=c.getTeam()){ return; } } //if reach wall, return if((map[x][y] instanceof Wall)){ return; } //if it goes bigger then the moving range of a character, then return if(round>c.getMove()){ return; } //draw it showMovingRange(x, y, g); //calculate the cost of moving a box int addRound=c.checkMoveCost(map[x][y]); //recurse drawMoveRange(new Point(x+1, y), round+addRound, g); drawMoveRange(new Point(x-1, y), round+addRound,g); drawMoveRange(new Point(x, y+1), round+addRound,g); drawMoveRange(new Point(x, y-1), round+addRound,g); } //overwrite public void paintComponent(Graphics g) { super.paintComponent(g); //required //if the winner is someone, then display if the user win or lose, else draw the game if(winner!=-1){ g.setFont(new Font("TimesRoman", Font.PLAIN, 200)); if(winner==FinnalGame.playerNumber){ g.setColor(new Color(255,210,0,50)); g.fillRect(0, 0, winSizeX+300, winSizeY); g.setColor(Color.black); g.drawString("You Lose", 100, winSizeY-300); }else{ g.setColor(new Color(255,0,0,50)); g.fillRect(0, 0, winSizeX+300, winSizeY); g.setColor(Color.black); g.drawString("You Win",100,winSizeY-300); } }else{ //reset the visited varible for(int i=0;i<mapSizeX;i++){ for(int e =0;e<mapSizeY;e++){ visited[i][e]=false; } } //a for loop to draw types of land for(int i=0;i<mapSizeX;i++){ for(int e=0;e<mapSizeY;e++){ drawRecObject(i, e, g); //call method that draw different type of land } } g.setColor(Color.black); //set color to black ////draw the black box in the map to tell the different between different part of land for(int i=0;i<mapSizeX;i++){ for(int e=0;e<mapSizeY;e++){ g. drawRect(winSizeX/mapSizeX*i,winSizeY/mapSizeY*e,winSizeX/mapSizeX,winSizeY/mapSizeY); } } //if moved, then draw attack range, if not moved, then draw moveing range if(moved){ drawAttackingRange(g); } if(!moved){ drawMoveRange(new Point(c.getXPosition(), c.getYPosition()), 0, g); } //draw characters in to the map for(int i=0;i<mapSizeX;i++){ for(int e=0;e<mapSizeY;e++){ if(!(map2[i][e] instanceof TempCharacter)){ drawCharacter(i, e, g); } } } //draw the box to show character's attack, health, and type g.setColor(Color.black); g.drawRect(0, 0, winSizeX+300-1, winSizeY-1); g.drawLine(winSizeX+300-1, (winSizeY-1)/4,winSizeX-1, (winSizeY-1)/4); g.drawLine(winSizeX+300-1, (winSizeY-1)/2,winSizeX-1, (winSizeY-1)/2); g.drawLine(winSizeX+300-1, (winSizeY-1)/4*3,winSizeX-1, (winSizeY-1)/4*3); g.drawString("Round pass:"+round, winSizeX+50, 160); // if it is temp character, then show nothing there if(currentDisplayCharacter instanceof TempCharacter){ g.drawString("Nothings there", winSizeX+75, winSizeY/4+25); }else{ // show character's attack, health, and type... g.drawImage(currentDisplayCharacter.getImageDis(), winSizeX, 1, 150,150,this); g.drawString("Class: "+currentDisplayCharacter.getClass()+", move "+currentDisplayCharacter.getMove(), winSizeX+25, winSizeY/4+25); g.drawString("Health: "+currentDisplayCharacter.getHealth()+"/"+currentDisplayCharacter.getMaxHealth(), winSizeX+75, winSizeY/4+40); g.drawString("Attack: "+currentDisplayCharacter.getAttack(),winSizeX+77, winSizeY/4+55); g.drawString("Defence: "+currentDisplayCharacter.getDefence(),winSizeX+73, winSizeY/4+75); g.drawString("Speed: "+currentDisplayCharacter.getSpeed(), winSizeX+73, winSizeY/4+90); g.drawString("Position: "+currentDisplayCharacter.getXPosition()+":"+currentDisplayCharacter.getYPosition(), winSizeX+73, winSizeY/4+110); } //show the type of land, is nothing, then put nothings there g.drawImage(currentDisplayLand.getImage(), winSizeX+10, winSizeY/2+7, 150, 150,this); if(currentDisplayLand instanceof Grass){ g.drawString("Grass", winSizeX+75, winSizeY/4+ winSizeY/2+25); }else{ g.drawString("Type: "+currentDisplayLand.getClass(),winSizeX+75, winSizeY/4+ winSizeY/2+25); g.drawString("Position: "+currentDisplayLand.getX()+":"+currentDisplayLand.getY(),winSizeX+75, winSizeY/4+ winSizeY/2+45); if(currentDisplayLand instanceof Wall){ g.drawString("Health "+((Wall)(currentDisplayLand)).getHealth(),winSizeX+75, winSizeY/4+ winSizeY/2+65); } } //draw event happened in the game //poll and display everything in a q untail it is "", and put it to another q, at the end, put it back String s=""; Queue<String> q2=new LinkedList<String> (); int i=0; try{ while(!q.isEmpty()){ s=q.poll(); g.drawString(s, winSizeX+5,winSizeY-10*i-5 ); q2.add(s); i++; } while(!q2.isEmpty()){ s=q2.poll(); q.add(s); i++; } }catch(Exception e){} } } /* * * drawRecObject method * a method draw the different types of map land * by Vincent Zhang * 2018/1/18 * Teacher: Mr.Mangat * */ public void drawRecObject(int i, int e, Graphics g){ g.drawImage(map[i][e].getImage(),winSizeX/mapSizeX*i,winSizeY/mapSizeY*e,winSizeX/mapSizeX,winSizeY/mapSizeY, this); } /* * * drawAttackingRange method * a method draw the attack range of current character * by Vincent Zhang * 2018/1/18 * Teacher: Mr.Mangat * */ public void drawAttackingRange (Graphics g){ //loop through map for(int i=0;i<mapSizeX;i++){ for(int e=0;e<mapSizeY;e++){ //set color depand on different thing on the map g.setColor(new Color(Color.orange.getRed(),Color.orange.getGreen(),Color.orange.getBlue(),100 )); if(!(map2[i][e] instanceof TempCharacter)){ if(map2[i][e].getTeam()!=c.getTeam()){ g.setColor(new Color(255,0,0,150)); }else{ g.setColor(new Color(0, 0, 0, 0)); } if(c instanceof Caster){ g.setColor(new Color(0, 255, 0, 150)); } } if(map[i][e] instanceof Wall){ g.setColor(new Color(255,0,0,150)); } // if it is in the attack range, then draw it if((Math.abs(i-c.getXPosition())+Math.abs(e-c.getYPosition())>=c.getMinRange())&&(Math.abs(i-c.getXPosition())+Math.abs(e-c.getYPosition())<c.getMaxRange())){ g.fillRect(winSizeX/mapSizeX*i,winSizeY/mapSizeY*e,winSizeX/mapSizeX,winSizeY/mapSizeY); } } } g.setColor(Color.black ); } /* * * drawCharacter method * a method draw image of characters * by Vincent Zhang * 2018/1/18 * Teacher: Mr.Mangat * */ public void drawCharacter(int i, int e, Graphics g){ //if the character drawing is taking turn, draw a different image if(!map2[i][e].equals(c)){ g.drawImage(map2[i][e].getImageDis(),winSizeX/mapSizeX*i+(int)(winSizeX/mapSizeX*0.1),winSizeY/mapSizeY*e+(int)(winSizeY/mapSizeY*0.1),winSizeX/mapSizeX-(int)(winSizeX/mapSizeX*0.2),winSizeY/mapSizeY-(int)(winSizeY/mapSizeY*0.2), this); }else{ g.drawImage(c.getImage(), winSizeX/mapSizeX*i,winSizeY/mapSizeY*e,winSizeX/mapSizeX,winSizeY/mapSizeY, this); } } /* * *animate method * the looping method of the game, everything other then graphics of running game * by Vincent Zhang * 2018/1/18 * Teacher: Mr.Mangat * */ public void animate(){ while(winner==-1){ //if there is no winner, the game continu //count round round++; //set the displaying object currentDisplayLand=new Grass(); currentDisplayCharacter=new TempCharacter(); //check whose turn is it c=getMinMove(); //repaint, and wait for imput this.repaint(); int moveToX=0; int moveToY=0; moved=false; Boolean attack=false; while(!moved){ if(c.getTeam()==FinnalGame.team){ //make user choose a place, untail it is within the movement range of a character do{ checkMouse(); FinnalGame.mousePressed=false; try{ Thread.sleep(1); }catch(Exception e){}; moveToX=(int)((mapSizeX*1.0/winSizeX)* FinnalGame.p.getX()); moveToY=(int)((mapSizeY*1.0/winSizeX)* FinnalGame.p.getY()); }while(moveToX<0||moveToX>=FinnalGame.mapx||moveToY<0||moveToY>=FinnalGame.mapy); FinnalGame.outPutCommands(moveToX); FinnalGame.outPutCommands(moveToY); }else{ checkMouse2(); try{ moveToX=Integer.valueOf(FinnalGame.input.readLine()); moveToY=Integer.valueOf(FinnalGame.input.readLine()); }catch(Exception e){}; } //if click on it self, skip the move if(moveToX==c.getXPosition()&&moveToY==c.getYPosition()){ moved=true; //put in event to queue if(c.getTeam()==1){ q.add("Character from team red stay"); }else{ q.add("Character from team blue stay"); } if(q.size()>8){ q.poll(); } } //check moving range if(c.callCheckMoveRange(moveToX,moveToY, map, map2)){ //if it is not character if((map2[moveToX][moveToY] instanceof TempCharacter)){ //move map2=c.changePosition(map2, moveToX, moveToY); moved=true; //added it to event if(c.getTeam()==1){ q.add("Character from team red moved"); }else{ q.add("Character from team blue moved"); } if(q.size()>8){ q.poll(); } } } } //repaint, and goes to attack this.repaint(); currentDisplayLand=new Grass(); currentDisplayCharacter=new TempCharacter(); //loop until the user make a successful attack or skip the round while(!attack){ int attackToX=-1; int attackToY=-1; int doubleDamage=0; //if the character is on the player's team, choose a position, or else, wail for input if(c.getTeam()==FinnalGame.team){ do{ checkMouse(); FinnalGame.mousePressed=false; attackToX=(int)((mapSizeX*1.0/winSizeX)* FinnalGame.p.getX()); attackToY=(int)((mapSizeY*1.0/winSizeX)* FinnalGame.p.getY()); } while((attackToX<0||attackToX>=FinnalGame.mapx||attackToY<0||attackToY>=FinnalGame.mapy)); //10% of double damage if(Math.random()*100>=90){ doubleDamage=1; } FinnalGame.outPutCommands( attackToX); FinnalGame.outPutCommands( attackToY); FinnalGame.outPutCommands(doubleDamage); }else{ checkMouse2(); try{ attackToX=Integer.valueOf(FinnalGame.input.readLine()); attackToY=Integer.valueOf(FinnalGame.input.readLine()); doubleDamage=Integer.valueOf(FinnalGame.input.readLine()); }catch(Exception e){}; } //if there are characters in the place, then attack if(Math.abs(attackToX-c.getXPosition())+Math.abs(attackToY-c.getYPosition())>=c.getMinRange()&&Math.abs(attackToX-c.getXPosition())+ Math.abs(attackToY-c.getYPosition())<c.getMaxRange()){ if(!(map2[attackToX][attackToY] instanceof TempCharacter)) { if(map[attackToX][attackToY] instanceof Forest){ c.attack(map2,attackToX,attackToY, 1.3, doubleDamage ); }else{ c.attack(map2,attackToX,attackToY, 1.0, doubleDamage); } //see is it dead if(map2[attackToX][attackToY].getHealth()<=0){ q.add("Character "+map2[attackToX][attackToY].getClass()+" dead"); if(q.size()>8){ q.poll(); } map2[attackToX][attackToY]=new TempCharacter(); } attack=true; }else if(map[attackToX][attackToY] instanceof Wall){ //attack walls ((Wall)map[attackToX][attackToY]).setHealth(((Wall)map[attackToX][attackToY]).getHealth()-c.getAttack()); q.add(this.getClass()+" deal "+c.getAttack()+" damage to Wall"); if(q.size()>8){ q.poll(); } if(((Wall)map[attackToX][attackToY]).getHealth()<=0){ map[attackToX][attackToY]=new Grass(); q.add(this.getClass()+" distory Wall"); if(q.size()>8){ q.poll(); } } attack=true; } } //if click on it self, cancle the attack if(attackToX==c.getXPosition()&&attackToY==c.getYPosition()){ attack=true; if(c.getTeam()==1){ q.add("Character from team red cancle attack"); }else{ q.add("Character from team blue cancle attack"); } if(q.size()>8){ q.poll(); } } } FinnalGame.mousePressed=false; //reset the character's speed c.upDateSpeed(); //check win winner=checkWin(); } this.repaint(); } /** * checkwin method * check the winner of the game * By Vincent Zhang * 2018/1/18 * Teacher: Mr.Mangat * */ public int checkWin(){ //loop over the map, and if int count1=0; int count2=0; for(int i=0;i<mapSizeX;i++){ for(int e=0;e<mapSizeY;e++){ if(!(map2[i][e] instanceof TempCharacter)){ if(map2[i][e].getTeam()==1){ count1++; }else{ count2++; } } } } if(count1>0&&count2>0){ return -1; }else if(count1==0){ return 1; } return 2; } /* * * checkMove method * a method wait for input of mouse, and see what the user click * by Vincent Zhang * 2018/1/18 * Teacher: Mr.Mangat * */ public void checkMouse(){ //wait for input while((!FinnalGame.mousePressed)){ //this.repaint(); try{ Thread.sleep(1); }catch(Exception e){} //if right mouse clicked, then display it using repaint(edit the currentDisplaying character/land) if(FinnalGame.mousePressed2){ int movex=(int)((mapSizeX*1.0/winSizeX)*FinnalGame.displayPoint.getX()); int movey=(int)((mapSizeX*1.0/winSizeX)*FinnalGame.displayPoint.getY()); if( movex>=0&& movex<FinnalGame.mapx&& movey>=0&& movey<FinnalGame.mapy){ currentDisplayCharacter=map2[movex][movey]; currentDisplayLand=map[movex][movey]; this.repaint(); FinnalGame.mousePressed2=false; } } } FinnalGame.mousePressed=false; } /* * * checkMove method * a method wait for the input of another user, and see what the user click while waiting * by Vincent Zhang * 2018/1/18 * Teacher: Mr.Mangat * */ public void checkMouse2(){ //wait for input of another user try{ while((!FinnalGame.input.ready())){ this.repaint(); try{ Thread.sleep(1); }catch(Exception e){} //if right mouse clicked, then display it using repaint(edit the currentDisplaying character/land) if(FinnalGame.mousePressed2){ int movex=(int)((mapSizeX*1.0/winSizeX)*FinnalGame.displayPoint.getX()); int movey=(int)((mapSizeX*1.0/winSizeX)*FinnalGame.displayPoint.getY()); if( movex>=0&& movex<FinnalGame.mapx&& movey>=0&& movey<FinnalGame.mapy){ currentDisplayCharacter=map2[movex][movey]; currentDisplayLand=map[movex][movey]; this.repaint(); FinnalGame.mousePressed2=false; } } } FinnalGame.mousePressed=false; }catch(Exception e){} } /* * * getMinMove method * a method get which character's turn is it * by Vincent Zhang * 2018/1/18 * Teacher: Mr.Mangat * */ public Character getMinMove(){ int minMove=3000; Character min=null; //loop over and see the character who has minimum speed, and return it for(int i=0;i<mapSizeX;i++){ for(int e=0;e<mapSizeY;e++){ if(!(map2[i][e] instanceof TempCharacter)){ if(map2[i][e].getCurrentSpeed()<minMove){ min=map2[i][e]; minMove=map2[i][e].getCurrentSpeed(); } }else{ } } } //change the move of all the character, so make them moved for(int i=0;i<mapSizeX;i++){ for(int e=0;e<mapSizeY;e++){ if(!(map2[i][e] instanceof TempCharacter)){ map2[i][e].setCurrentSpeed(map2[i][e].getCurrentSpeed()-minMove); } } } return min; } }
package java2.businesslogic.registration.userregistration; import java2.businesslogic.registration.RegistrationRequest; import java2.businesslogic.registration.RegistrationResponse; public interface UserRegistrationService { RegistrationResponse register(RegistrationRequest request); }
package superintendent.apis.discord.channels; import java.util.List; import superintendent.apis.discord.DiscordMessage; import superintendent.apis.discord.InsufficientPermissionsException; public interface DiscordTextChannel extends DiscordChannel { static final int DEFAULT_PREV_MESSAGE_LIST_SIZE = 50; /** * Gets a list of previous DiscordMessages posted in the channel, with the * default number of entries. This list will be ordered from most to least * recent. * * @return a list of messages */ public default List<DiscordMessage> getPreviousMessages() { return getPreviousMessages(DEFAULT_PREV_MESSAGE_LIST_SIZE); }; /** * Gets a list of previous DiscordMessages posted in the channel, with a * specified number of entries. This list will be ordered from most to least * recent. * * @param numOfMessages the number of messages to get * @return a list of messages */ public List<DiscordMessage> getPreviousMessages(int numOfMessages); /** * Posts a message with the given content on the channel. * * @param content the text content of the message * @throws InsufficientPermissionsException if the bot can't post here */ public void post(String content) throws InsufficientPermissionsException; @Override public default boolean isTextChannel() { return false; } @Override public default boolean isVoiceChannel() { return true; } }
package flashcards; import java.io.*; import java.util.*; class FlashCard { private final String term; private final String definition; FlashCard(String term, String definition) { this.term = term; this.definition = definition; } public String getTerm() { return term; } public String getDefinition() { return definition; } } class FlashCardSet{ private final Map<FlashCard, Integer> flashCardMap; protected final Scanner scanner; private final List<String> logList; FlashCardSet() { this.flashCardMap = new HashMap<>(); this.scanner = new Scanner(System.in); this.logList = new ArrayList<>(); } public void add() { System.out.println("The card:"); writeToLog("The card:"); String term = scanner.nextLine(); writeToLog(term); if (!containsTerm(term)) { System.out.println("The definition of the card:"); writeToLog("The definition of the card:"); String definition = scanner.nextLine(); writeToLog(definition); if(!containsDefinition(definition)) { FlashCard flashCard = new FlashCard(term, definition); flashCardMap.put(flashCard, 0); System.out.println("The pair (\"" + term + "\":" + "\"" + definition + "\") has been added."); writeToLog("The pair (\"" + term + "\":" + "\"" + definition + "\") has been added."); } else { System.out.println("The definition \"" + definition + "\" already exists."); writeToLog("The definition \"" + definition + "\" already exists."); } } else { System.out.println("The card \"" + term + "\" already exists."); writeToLog("The card \"" + term + "\" already exists."); } } private boolean containsDefinition(String definition) { for (FlashCard flashCard : flashCardMap.keySet()) { if (flashCard.getDefinition().equals(definition)) { return true; } } return false; } private boolean containsTerm(String term) { for (FlashCard flashCard : flashCardMap.keySet()) { if (flashCard.getTerm().equals(term)) { return true; } } return false; } public void remove() { System.out.println("The card:"); writeToLog("The card:"); String term = scanner.nextLine(); writeToLog(term); if (containsTerm(term)) { for (FlashCard flashCard : flashCardMap.keySet()) { if (flashCard.getTerm().equals(term)) { flashCardMap.remove(flashCard); System.out.println("The card has been removed"); writeToLog("The card has been removed"); return; } } } else { System.out.println("Can't remove \"" + term + "\": there is no such card."); writeToLog("Can't remove \"" + term + "\": there is no such card."); } } public void importFile(String fileName) { try(Scanner fileScanner = new Scanner(new File(fileName))) { int count = 0; while (fileScanner.hasNextLine()) { String string = fileScanner.nextLine(); writeToLog(string); String[] card = string.split(":"); String keyTerm = card[0]; String keyDefinition = card[1]; Integer value = Integer.parseInt(card[2]); for (FlashCard flashCard : flashCardMap.keySet()) { if (keyTerm.equals(flashCard.getTerm())) { flashCardMap.remove(flashCard); break; } } FlashCard flashCard = new FlashCard(keyTerm, keyDefinition); flashCardMap.put(flashCard, value); count++; } System.out.println(count + " cards have been loaded."); writeToLog(count + " cards have been loaded."); } catch (FileNotFoundException e) { System.out.println( "File not found."); writeToLog( "File not found."); } } public void importFile() { System.out.println("File name:"); writeToLog("File name:"); String fileName = scanner.nextLine(); writeToLog(fileName); importFile(fileName); } public void exportFile(String fileName) { try(PrintWriter printWriter = new PrintWriter(new File(fileName))) { flashCardMap.forEach((key, value) -> printWriter.println(key.getTerm() + ":" + key.getDefinition() + ":" + value)); System.out.println(flashCardMap.size() + " cards have been saved"); writeToLog(flashCardMap.size() + " cards have been saved"); } catch (IOException e) { System.out.println(e.getMessage()); writeToLog(e.getMessage()); } } public void exportFile() { System.out.println("File name:"); writeToLog("File name:"); String fileName = scanner.nextLine(); writeToLog(fileName); exportFile(fileName); } public FlashCard flashCardWithThisTerm(String term) { for (FlashCard flashCard : flashCardMap.keySet()) { if (flashCard.getTerm().equals(term)) { return flashCard; } } return new FlashCard("", ""); } public FlashCard flashCardWithThisDefinition(String definition) { for (FlashCard flashCard : flashCardMap.keySet()) { if (flashCard.getDefinition().equals(definition)) { return flashCard; } } return new FlashCard("", ""); } public void ask() { System.out.println("How many times to ask?"); writeToLog("How many times to ask?"); int count = Integer.parseInt(scanner.nextLine()); writeToLog(String.valueOf(count)); Random random = new Random(); for (int i = 0; i < count; i++) { int itemNumber = random.nextInt(flashCardMap.size()); int index = 0; for (FlashCard flashCard : flashCardMap.keySet()) { if (itemNumber == index) { System.out.println("Print the definition of \"" + flashCard.getTerm() + "\":"); writeToLog("Print the definition of \"" + flashCard.getTerm() + "\":"); String definition = scanner.nextLine(); writeToLog(definition); if (flashCard.getDefinition().equals(definition)) { System.out.println("Correct answer."); writeToLog("Correct answer."); } else if (containsDefinition(definition)) { System.out.println("Wrong answer. The correct one is \"" + flashCardWithThisTerm(flashCard.getTerm()).getDefinition() + "\", you've just written the " + "definition of \"" + flashCardWithThisDefinition(definition).getTerm() + "\"."); writeToLog("Wrong answer. The correct one is \"" + flashCardWithThisTerm(flashCard.getTerm()).getDefinition() + "\", you've just written the " + "definition of \"" + flashCardWithThisDefinition(definition).getTerm() + "\"."); flashCardMap.replace(flashCard, flashCardMap.get(flashCard) + 1); } else { System.out.println("Wrong answer. The correct one is \"" + flashCardWithThisTerm(flashCard.getTerm()).getDefinition() + "\"."); writeToLog("Wrong answer. The correct one is \"" + flashCardWithThisTerm(flashCard.getTerm()).getDefinition() + "\"."); flashCardMap.replace(flashCard, flashCardMap.get(flashCard) + 1); } break; } else { index++; } } } } public void writeToLog(String string) { logList.add(string); } public void log() { System.out.println("File name"); writeToLog("File name"); String fileName = scanner.nextLine(); writeToLog(fileName); try(PrintWriter printWriter = new PrintWriter(new File(fileName))) { logList.forEach(printWriter::println); System.out.println("The log has been saved"); writeToLog("The log has been saved"); } catch (IOException e) { System.out.println(e.getMessage()); writeToLog(e.getMessage()); } } public void hardestCard() { List<String> result = new ArrayList<>(); int maxCount = 1; for (FlashCard flashCard : flashCardMap.keySet()) { int currMax = flashCardMap.get(flashCard); if (currMax > maxCount) { maxCount = currMax; result.clear(); result.add(flashCard.getTerm()); } else if (currMax == maxCount) { result.add(flashCard.getTerm()); } } switch (result.size()) { case 0: System.out.println("There are no cards with errors."); writeToLog("There are no cards with errors."); break; case 1: System.out.println("The hardest card is \"" + result.get(0) + "\". You have " + maxCount + " errors answering it."); writeToLog("The hardest card is \"" + result.get(0) + "\". You have " + maxCount + " errors answering it."); break; default: StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < result.size(); i++) { if (i < result.size() - 1) { stringBuilder.append("\"").append(result.get(i)).append("\", "); } else { stringBuilder.append("\"").append(result.get(i)).append("\". "); } } System.out.println("The hardest cards are " + stringBuilder.toString() + "You have " + maxCount + " errors answering them."); writeToLog("The hardest cards are " + stringBuilder.toString() + "You have " + maxCount + " errors answering them."); break; } } public void reset() { flashCardMap.replaceAll((f, v) -> 0); System.out.println("Card statistics has been reset."); writeToLog("Card statistics has been reset."); } } public class Main { public static void main(String[] args) { FlashCardSet flashCardSet = new FlashCardSet(); String exportFileName = ""; for (int i = 0, argsLength = args.length; i + 1 < argsLength; i++) { String arg = args[i]; if (arg.equals("-import")) { flashCardSet.importFile(args[i + 1]); } else if (arg.equals("-export")) { exportFileName = args[i + 1]; } } String choice; do { System.out.println("Input the action (add, remove, import, export, ask, exit, log, hardest card, reset stats): "); flashCardSet.writeToLog("Input the action (add, remove, import, export, ask, exit, log, hardest card, reset stats): "); choice = flashCardSet.scanner.nextLine(); flashCardSet.writeToLog(choice); switch (choice) { case "add": flashCardSet.add(); break; case "remove": flashCardSet.remove(); break; case "import": flashCardSet.importFile(); break; case "export": flashCardSet.exportFile(); break; case "ask": flashCardSet.ask(); break; case "exit": System.out.println("Bye bye!"); if (!exportFileName.equals("")) { flashCardSet.exportFile(exportFileName); } return; case "log": flashCardSet.log(); break; case "hardest card": flashCardSet.hardestCard(); break; case "reset stats": flashCardSet.reset(); break; default: throw new IllegalStateException("Unexpected value: " + choice); } } while (true); } }
package com.ai.slp.order.service.business.interfaces; import com.ai.opt.base.exception.BusinessException; import com.ai.opt.base.exception.SystemException; import com.ai.slp.order.api.aftersaleorder.param.OrderReturnRequest; public interface IOrderAfterSaleBusiSV { public void back(OrderReturnRequest request) throws BusinessException, SystemException; public void exchange(OrderReturnRequest request) throws BusinessException, SystemException; public void refund(OrderReturnRequest request) throws BusinessException, SystemException; }
package heloworld; public class Hello { public static void main(String[] args) { System.out.println("Helo1"); System.out.println("Helo2"); System.out.println("Helo3"); } }
package com.xuecheng.learning.mq; import com.alibaba.fastjson.JSON; import com.xuecheng.framework.domain.task.XcTask; import com.xuecheng.framework.model.response.ResponseResult; import com.xuecheng.learning.config.RabbitMQConfig; import com.xuecheng.learning.service.ILearningService; import lombok.extern.slf4j.Slf4j; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; @Component @Slf4j public class ChooseCourseTask { @Autowired private ILearningService learningService; @Autowired private RabbitTemplate rabbitTemplate; @RabbitListener(queues = RabbitMQConfig.XC_LEARNING_ADDCHOOSECOURSE) public void receiveChoosecourseTask(XcTask xcTask) { log.info("receive choose course task,taskId:{}", xcTask.getId()); //接收到 的消息id String id = xcTask.getId(); //解析消息 try { String requestBody = xcTask.getRequestBody(); Map map = JSON.parseObject(requestBody, Map.class); String userId = (String) map.get("userId"); String courseId = (String) map.get("courseId"); // String valid = (String) map.get("valid"); // String charge = (String) map.get("charge"); // Float price = (Float) map.get("price"); Date startTime = null; Date endTime = null; SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY‐MM‐dd HH:mm:ss"); if(map.get("startTime")!=null){ startTime =dateFormat.parse((String) map.get("startTime")); } if(map.get("endTime")!=null){ endTime =dateFormat.parse((String) map.get("endTime")); } ResponseResult responseResult = learningService.addcourse(userId, courseId, null, null, null, startTime, endTime, xcTask); //发选课完成的消息 if (responseResult.isSuccess()) { //开始发消息 rabbitTemplate.convertAndSend(RabbitMQConfig.EX_LEARNING_ADDCHOOSECOURSE, RabbitMQConfig.XC_LEARNING_FINISHADDCHOOSECOURSE_KEY, xcTask); } } catch (Exception e) { e.printStackTrace(); log.error("send finish choose course taskId:{}", id); } } }
package Modelo; public class Serie { //CONSTANTE public static final int CantActores = 1000; //ATRIBUTOS private String nombre; private int CantidadCapitulo; private int DuracionCapitulo; private String genero; private String ClasAudiencia; private int temporada; //RELACIONES private Actor Actores; Actor[] = new Actores[CantActores]; //METODOS public Serie(String elNombre, int cantCaps, int duraCaps, String gen, String clasificaAud, int temp) { nombre = elNombre; CantidadCapitulo = cantCaps; DuracionCapitulo = duraCaps; genero = gen; ClasAudiencia = clasificaAud; temporada = temp; } public String darNombre() { return nombre; } public void modificarNombre(String elNombre) { nombre = elNombre; } public int darCantidadCapitulo() { return CantidadCapitulo; } public void modificarCantidadCapitulo(int cantCaps) { CantidadCapitulo = cantCaps; } public int darDuracionCapitulo() { return DuracionCapitulo; } public void modificarDuracionCapitulo(int duraCaps) { DuracionCapitulo = duraCaps; } public String darGenero() { return genero; } public void modificarGenero(String gen) { genero = gen; } public String darClasAudiencia() { return ClasAudiencia; } public void modificarClasAudiencia(String clasificaAud) { ClasAudiencia = clasificaAud; } public int darTemporada() { return temporada; } public void modificarTemporada(int temp) { temporada = temp; } //RELACIONES METODOS //PRESUPUESTO public double calcularPresupuestoSerie(){ int duracionTotal = CantidadCapitulo * DuracionCapitulo; double presupuesto = (duracionTotal * (25+11+11)); presupuesto = presupuesto +10000; return presupuesto; } }
package br.ufmg.ppgee.orcslab.upmsp.algorithm; import br.ufmg.ppgee.orcslab.upmsp.problem.Problem; import br.ufmg.ppgee.orcslab.upmsp.problem.Solution; import java.util.Map; import java.util.Random; /** * Common interface implemented by all algorithms that solves the unrelated parallel * machine scheduling problem with setup times dependent on the sequence and machine. */ public interface Algorithm { /** * Solve the problem and return the solution found. * @param problem Instance of the problem to be solved. * @param random A random number generator. * @param parameters Algorithm parameters. * @param callback A callback object. * @return A solution to the problem. */ Solution solve(Problem problem, Random random, Map<String, Object> parameters, Callback callback); }
package com.hyw.producer.rabbit; import com.hyw.producer.rabbit.broker.ProducerClient; import com.hyw.producer.rabbit.constant.BrokerMessageStatusEnum; import com.hyw.rabbit.api.Message; import com.hyw.rabbit.api.MessageType; import org.hibernate.validator.internal.engine.messageinterpolation.parser.MessageState; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.HashMap; import java.util.Map; import java.util.UUID; /** * Project:rabbit-parent @author 源伟 * DateTime:2020/3/24 9:37 * Description:TODO */ @RunWith(SpringRunner.class) @SpringBootTest public class ApplicationTests { @Autowired private ProducerClient producerClient; @Test public void testProducerClient() throws InterruptedException { for (int i = 0; i < 1; i++) { String uniqueId = UUID.randomUUID().toString(); Map<String, Object> attributes = new HashMap<>(); attributes.put("name", "张三"); attributes.put("age", "18"); Message message = new Message.Builder("exchange-1", "springboot.abc") .withMessageId(uniqueId) .withAttributes(attributes) .withMessageType(MessageType.RELIANT.getType()) .withDelayMills(5000).build(); producerClient.send(message); } Thread.sleep(100000); } }
package com.youthchina.service.user; import com.youthchina.dao.Qinghong.ApplicantMapper; import com.youthchina.dao.qingyang.CompanyMapper; import com.youthchina.dao.qingyang.JobMapper; import com.youthchina.dao.qingyang.ResumeJsonMapper; import com.youthchina.domain.Qinghong.*; import com.youthchina.domain.qingyang.Company; import com.youthchina.domain.qingyang.Job; import com.youthchina.domain.qingyang.ResumeJson; import com.youthchina.domain.qingyang.ResumePDF; import com.youthchina.dto.application.EmailSendingDTO; import com.youthchina.exception.zhongyang.exception.ClientException; import com.youthchina.exception.zhongyang.exception.NotFoundException; import com.youthchina.service.application.JobServiceImpl; import com.youthchina.service.application.LocationServiceImpl; import com.youthchina.service.application.ResumePDFServiceImpl; import com.youthchina.service.util.MessageSendService; import com.youthchina.service.util.StaticFileService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.net.URL; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * @program: youthchina * @description: 学生实体Service层实现 * @author: Qinghong Wang * @create: 2018-11-29 17:11 **/ @Service public class StudentServiceImpl implements StudentService { @Autowired private ApplicantMapper applicantMapper; @Autowired private JobMapper jobMapper; @Autowired private CompanyMapper companyMapper; @Autowired private LocationServiceImpl locationService; @Autowired private JobServiceImpl jobService; @Autowired private ResumeJsonMapper resumeJsonMapper; @Autowired private StudentService studentService; @Autowired private MessageSendService messageSendService; @Autowired private ResumePDFServiceImpl resumePDFService; @Autowired private StaticFileService staticFileService; /** * @Description: 通过user_id获得学生的所有信息,如何该id为空,则抛出异常 * @Param: [id] use_id * @return: com.youthchina.domain.Qinghong.Student * @Author: Qinghong Wang * @Date: 2018/12/19 */ @Override public Student get(Integer id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + id);//todo } else { Student student = new Student(); student.setEducationInfos(studentService.getEducations(id)); student.setActivities(studentService.getActivities(id)); student.setWorks(studentService.getWorks(id)); student.setCertificates(studentService.getCertificates(id)); student.setProjects(studentService.getProjects(id)); return student; } } @Override public void delete(Integer id) throws NotFoundException { } @Override public Student update(Student student) throws NotFoundException { return null; } @Override public Student add(Student entity) { if (applicantMapper.getStudentInfo(entity.getId()) != null) { Student student = applicantMapper.getStudentInfo(entity.getId()); // for (EducationInfo educationInfo : student.getEducationInfos()) { // Location location = locationService.getLocation(educationInfo.getLocation().getRegion_num()); // educationInfo.setLocation(location); // } for (Work work : student.getWorks()) { Location location = locationService.getLocation(work.getLocation().getRegionId()); work.setLocation(location); } return student; } applicantMapper.updateUserInfo(entity); applicantMapper.insertStuInfo(entity); BaseInfo baseInfo = applicantMapper.getBaseInfo(entity.getId()); Integer stu_id = baseInfo.getStu_id(); for (LabelInfo labelInfo : entity.getLabelInfos()) { AdvantageLabel label = new AdvantageLabel(); label.setStu_id(stu_id); label.setLabel_code(labelInfo.getLabel_code()); applicantMapper.insertStuLabel(label); } // for (EducationInfo educationInfo : entity.getEducationInfos()) { // educationInfo.setStu_id(stu_id); // Location location = locationService.getLocation(educationInfo.getLocation().getRegion_num()); // educationInfo.setLocation(location); // Integer integer = applicantMapper.insertEduInfo(educationInfo); // } for (Project project : entity.getProjects()) { project.setStu_id(stu_id); Integer integer = applicantMapper.insertStuProject(project); } for (Work work : entity.getWorks()) { work.setStu_id(stu_id); Location location = locationService.getLocation(work.getLocation().getRegionId()); work.setLocation(location); applicantMapper.insertStuWork(work); } for (Activity activity : entity.getActivities()) { activity.setStu_id(stu_id); applicantMapper.insertStuActivity(activity); } for (Certificate certificate : entity.getCertificates()) { certificate.setStu_id(stu_id); applicantMapper.insertStuCertificate(certificate); } Student student = applicantMapper.getStudentInfo(entity.getId()); //分离service并不能实现location // for (EducationInfo educationInfo : student.getEducationInfos()) { // Location location = locationService.getLocation(educationInfo.getLocation().getRegion_num()); // educationInfo.setLocation(location); // } for (Work work : student.getWorks()) { Location location = locationService.getLocation(work.getLocation().getRegionId()); work.setLocation(location); } return student; } /** * @Description: 通过user_id找到该用户的所有基本注册信息 * @Param: [id] * @return: com.youthchina.domain.Qinghong.UserInfo * @Author: Qinghong Wang * @Date: 2018/12/20 */ public UserInfo getContacts(Integer id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + id);//todo } else return userInfo; } /** * @Description: 通过user_id找到所有该id下所有的教育信息 * @Param: [id] * @return: java.util.List<com.youthchina.domain.Qinghong.EducationInfo> * @Author: Qinghong Wang * @Date: 2018/12/19 */ public List<EducationInfo> getEducations(Integer id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + id);//todo } else { List<EducationInfo> educationInfos = applicantMapper.getEducations(id); return educationInfos; } } /** * @Description: 通过user_id找到该id下所有的工作经历 * @Param: [id] * @return: java.util.List<com.youthchina.domain.Qinghong.Work> * @Author: Qinghong Wang * @Date: 2018/12/19 */ public List<Work> getWorks(Integer id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + id);//todo } else { List<Work> works = applicantMapper.getWorks(id); for (Work work : works) { if (work.getLocation() != null && work.getLocation().getRegionId() != null) { Location location = locationService.getLocation(work.getLocation().getRegionId()); work.setLocation(location); } } return works; } } @Override public Student addStudent(Student student) { return null; } /** * @Description: 通过user_id找到该id下的所有课外活动经历 * @Param: [id] * @return: java.util.List<com.youthchina.domain.Qinghong.Activity> * @Author: Qinghong Wang * @Date: 2018/12/19 */ public List<Activity> getActivities(Integer id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + id);//todo } else { List<Activity> activities = applicantMapper.getActivities(id); return activities; } } /** * @Description: 通过user_id找到该id下所有的认证信息 * @Param: [id] * @return: java.util.List<com.youthchina.domain.Qinghong.Certificate> * @Author: Qinghong Wang * @Date: 2018/12/22 */ public List<Certificate> getCertificates(Integer id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + id);//todo } else { List<Certificate> certificates = applicantMapper.getCertificates(id); return certificates; } } /** * @Description: 通过user_id找到该id下所有的项目经历 * @Param: [id] * @return: java.util.List<com.youthchina.domain.Qinghong.Project> * @Author: Qinghong Wang * @Date: 2018/12/19 */ public List<Project> getProjects(Integer id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + id);//todo } else { List<Project> projects = applicantMapper.getProjects(id); return projects; } } @Override public List<AdvantageLabel> getAdvantageLabel(Integer id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(id); if (userInfo == null) { throw new NotFoundException(404, 404, "cannot find user with id " + id); } else { List<AdvantageLabel> advantageLabels = applicantMapper.getAdvantageLabels(id); return advantageLabels; } } /** * @Description: 通过job_id和user_id来将申请的职位信息加入申请表中, 已通过测试 * @Param: [job_id, user_id] * @return: com.youthchina.domain.Qinghong.JobApply * @Author: Qinghong Wang * @Date: 2018/12/19 */ public JobApply jobApply(Integer job_id, Integer user_id, Integer resume_id) throws NotFoundException, ClientException { Job job = jobMapper.selectJobByJobId(job_id); if (job.getCvReceiMail() == null) { throw new NotFoundException(4000, 404, "email does not exist"); } if (job == null) { throw new NotFoundException(4042, 404, "cannot find job with id " + job_id); } else { Date time = job.getJobEndTime(); if (time.before(new Date())) { throw new NotFoundException(4032, 403, "cannot apply for job because it has passed deadline"); } else { JobApply jobApply2 = applicantMapper.getOneJobApply(job_id, user_id); if (jobApply2 != null) { throw new ClientException("this job has already been applied"); } else { ResumePDF resumePDF = resumePDFService.get(resume_id); JobApply jobApply = new JobApply(); if (resumePDF == null) { throw new NotFoundException(4032, 403, "this resume do not exist"); } else { jobApply.setStu_id(user_id); jobApply.setJob_id(job_id); jobApply.setJob_cv_send(1); jobApply.setJob_apply_status("已申请"); jobApply.setDocu_local_id(resumePDF.getDocuLocalId()); Integer integer = applicantMapper.addApply(jobApply); JobApply jobApply1 = applicantMapper.getOneJobApply(job_id, user_id); Job job1 = jobService.get(jobApply1.getJob_id()); jobService.setJobLocation(job1); jobApply1.setJob(job1); return jobApply1; } } } } } @Override public void sendingEmail(EmailSendingDTO emailSendingDTO, Integer resume_id) throws NotFoundException { ResumePDF resumePDF = resumePDFService.get(resume_id); URL url = staticFileService.getFileUrl(resumePDF.getDocuLocalId()); emailSendingDTO.setUrl(url); emailSendingDTO.setFileName(resumePDF.getResumeName() + ".pdf"); messageSendService.sendMessage(emailSendingDTO); } /** * @Description: 通过user_id找到该id下所有申请职位的信息, 通过测试 * @Param: [user_id] * @return: java.util.List<com.youthchina.domain.Qinghong.JobApply> * @Author: Qinghong Wang * @Date: 2018/12/19 */ public List<JobApply> getJobApplies(Integer user_id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(user_id); if (userInfo == null) { throw new NotFoundException(4041, 404, "cannot find user with id " + user_id); } else { List<JobApply> jobApplies = applicantMapper.getJobApplies(user_id); for (JobApply jobApply : jobApplies) { Job job = jobService.get(jobApply.getJob_id()); jobApply.setJob(job); } return jobApplies; } } /** * @Description: 通过user_id找到该id下所有的职位收藏信息 * @Param: [user_id] * @return: java.util.List<com.youthchina.domain.Qinghong.JobCollect> * @Author: Qinghong Wang * @Date: 2019/1/9 */ public List<JobCollect> getJobCollect(Integer user_id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(user_id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { List<JobCollect> jobCollects = applicantMapper.getJobCollects(user_id); List<JobCollect> result = new ArrayList<>(); for (JobCollect jobCollect : jobCollects) { try { Job job = jobService.get(jobCollect.getJob_id()); jobCollect.setJob(job); //设置一个job所有location jobService.setJobLocation(job); jobCollect.setJob(job); result.add(jobCollect); } catch (NotFoundException ignore) { } } return result; } } /** * @Description: 通过user_id找到该id下所有的公司收藏信息, 通过测试 * @Param: [user_id] * @return: java.util.List<com.youthchina.domain.Qinghong.CompCollect> * @Author: Qinghong Wang * @Date: 2019/1/9 */ public List<CompCollect> getCompCollect(Integer user_id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(user_id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { List<CompCollect> compCollects = applicantMapper.getCompCollects(user_id); for (CompCollect compCollect : compCollects) { Location location = locationService.getLocation(compCollect.getCompany().getLocation().getRegionId()); compCollect.getCompany().setLocation(location); } return compCollects; } } /** * @Description: 通过job_id user_id添加一个职位收藏 * @Param: [job_id, user_id] * @return: java.lang.Integer * @Author: Qinghong Wang * @Date: 2019/1/9 */ public Integer addJobCollection(Integer job_id, Integer user_id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(user_id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { JobCollect jobCollect = applicantMapper.getOneJobCollect(job_id, user_id); if (jobCollect != null) { throw new NotFoundException(4040, 404, "不能收藏该职位,因为已经收藏");//todo } else { Job job = jobMapper.selectJobByJobId(job_id); if (job == null) { throw new NotFoundException(4000, 404, "cannot collect this job,maybe the job has already delete");//todo } else { JobCollect jobCollect1 = new JobCollect(); jobCollect1.setStu_id(userInfo.getUser_id()); jobCollect1.setJob_id(job_id); Integer integer = applicantMapper.addJobCollect(jobCollect1); return integer; } } } } /** * @Description: 通过collect_id删除收藏的信息,通过假删除实现 * @Param: [id] * @return: java.lang.Integer * @Author: Qinghong Wang * @Date: 2018/12/21 */ public Integer deleteCollect(Integer id) throws NotFoundException { Integer num1 = applicantMapper.deleteJobCollect(id); Integer num2 = applicantMapper.deleteCompCollect(id); if (num1 == 0 && num2 == 0) { throw new NotFoundException(4040, 404, "没有删除任何一条收藏信息");//todo } else return num1 + num2; } /** * @Description: 通过collect_id删除职位收藏 * @Param: [id] * @return: java.lang.Integer * @Author: Qinghong Wang * @Date: 2019/2/16 */ public Integer deleteJobCollect(Integer collect_id) throws NotFoundException { if (applicantMapper.getJobCollectById(collect_id) == null) { throw new NotFoundException(4040, 404, "cannot find this jobCollect"); } Integer num = applicantMapper.deleteJobCollect(collect_id); return num; } /** * @Description: 通过collect_id删除公司收藏 * @Param: [id] * @return: java.lang.Integer * @Author: Qinghong Wang * @Date: 2019/2/16 */ public Integer deleteCompCollect(Integer collect_id) throws NotFoundException { if (applicantMapper.getCompCollectById(collect_id) == null) { throw new NotFoundException(4040, 404, "cannot find this CompCollect"); } Integer num = applicantMapper.deleteCompCollect(collect_id); return num; } /** * @Description: 通过company_id和user_id添加公司收藏信息 * @Param: [company_id, user_id] * @return: java.lang.Integer * @Author: Qinghong Wang * @Date: 2019/2/16 */ @Override public Integer addCompCollect(Integer company_id, Integer user_id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(user_id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { CompCollect compCollect2 = applicantMapper.getOneCompCollect(company_id, user_id); if (compCollect2 != null) { throw new NotFoundException(4040, 404, "不能收藏该公司,因为已经收藏");//todo } else { Company company = companyMapper.selectCompany(company_id); if (company == null) { throw new NotFoundException(4000, 400, "cannot collect this company,maybe the company has already deleted");//todo } else { CompCollect compCollect = new CompCollect(); compCollect.setCompany_id(company_id); compCollect.setStu_id(user_id); Integer integer = applicantMapper.addCompCollect(compCollect); return integer; } } } } /** * @Description: 单个插入教育信息,通过user_id实现 * @Param: [educationInfo, user_id] * @return: java.util.List<com.youthchina.domain.Qinghong.EducationInfo> * @Author: Qinghong Wang * @Date: 2019/3/24 */ @Override public EducationInfo insertEducation(EducationInfo educationInfo, Integer user_id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(user_id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { educationInfo.setStu_id(user_id); Integer integer = applicantMapper.insertEduInfo(educationInfo); return applicantMapper.getEducationById(educationInfo.getEdu_id()); // for (EducationInfo educationInfo1 : educationInfos) { // Location location = locationService.getLocation(educationInfo1.getLocation().getRegion_num()); // educationInfo1.setLocation(location); // } } } /** * @Description: 完成工作信息的单个插入 * @Param: [work, user_id] * @return: java.util.List<com.youthchina.domain.Qinghong.Work> * @Author: Qinghong Wang * @Date: 2019/3/24 */ @Override public Work insertWork(Work work, Integer user_id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(user_id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { work.setStu_id(user_id); Integer integer = applicantMapper.insertStuWork(work); Work work1 = applicantMapper.getWorkById(work.getWork_id()); if (work1.getLocation() != null && work1.getLocation().getRegionId() != null) { Location location = locationService.getLocation(work1.getLocation().getRegionId()); work1.setLocation(location); } return work1; } } /** * @Description: 实现项目信息的单个插入 * @Param: [project, user_id] * @return: java.util.List<com.youthchina.domain.Qinghong.Project> * @Author: Qinghong Wang * @Date: 2019/3/24 */ @Override public Project insertProject(Project project, Integer user_id) throws NotFoundException { UserInfo baseInfo = applicantMapper.getUserInfo(user_id); if (baseInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { project.setStu_id(user_id); Integer integer = applicantMapper.insertStuProject(project); Project project1 = applicantMapper.getProjectById(project.getProj_id()); return project1; } } /** * @Description: 实现对于活动信息的单个插入 * @Param: [activity, user_id] * @return: java.util.List<com.youthchina.domain.Qinghong.Activity> * @Author: Qinghong Wang * @Date: 2019/3/24 */ @Override public Activity insertActivity(Activity activity, Integer user_id) throws NotFoundException { UserInfo baseInfo = applicantMapper.getUserInfo(user_id); if (baseInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { activity.setStu_id(user_id); Integer integer = applicantMapper.insertStuActivity(activity); Activity activity1 = applicantMapper.getActivityById(activity.getAct_id()); return activity1; } } /** * @Description: 实现对于证书信息的单个插入 * @Param: [certificate, user_id] * @return: java.util.List<com.youthchina.domain.Qinghong.Certificate> * @Author: Qinghong Wang * @Date: 2019/3/24 */ @Override public Certificate insertCertificate(Certificate certificate, Integer user_id) throws NotFoundException { UserInfo baseInfo = applicantMapper.getUserInfo(user_id); if (baseInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { certificate.setStu_id(user_id); Integer integer = applicantMapper.insertStuCertificate(certificate); Certificate certificate1 = applicantMapper.getCertificateById(certificate.getCertificate_id()); return certificate1; } } @Override public AdvantageLabel insertLabel(AdvantageLabel advantageLabel, Integer user_id) throws NotFoundException { UserInfo userInfo = applicantMapper.getUserInfo(user_id); if (userInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id" + user_id);//todo } else { advantageLabel.setStu_id(user_id); Integer integer = applicantMapper.insertStuLabel(advantageLabel); AdvantageLabel advantageLabel1 = applicantMapper.getAdvantageLabelById(advantageLabel.getLabel_id()); return advantageLabel1; } } @Override public Integer deleteEducation(Integer id) throws NotFoundException { if (applicantMapper.getEducationById(id) == null) { throw new NotFoundException(4040, 404, "can not find this education"); } Integer integer = applicantMapper.deleteEduInfo(id); return integer; } @Override public Integer deleteWork(Integer id) throws NotFoundException { if (applicantMapper.getWorkById(id) == null) { throw new NotFoundException(4040, 404, "can not find this Work"); } Integer integer = applicantMapper.deleteWork(id); return integer; } @Override public Integer deleteProject(Integer id) throws NotFoundException { if (applicantMapper.getProjectById(id) == null) { throw new NotFoundException(4040, 404, "can not find this Project"); } Integer integer = applicantMapper.deleteProject(id); return integer; } @Override public Integer deleteActivity(Integer id) throws NotFoundException { if (applicantMapper.getActivityById(id) == null) { throw new NotFoundException(4040, 404, "can not find this activity"); } Integer integer = applicantMapper.deleteActivity(id); return integer; } @Override public Integer deleteCertificate(Integer id) throws NotFoundException { if (applicantMapper.getCertificateById(id) == null) { throw new NotFoundException(4040, 404, "can not find this certificate"); } Integer integer = applicantMapper.deleteCertificate(id); return integer; } @Override public Integer deleteLabel(Integer id) throws NotFoundException { if (applicantMapper.getAdvantageLabelById(id) == null) { throw new NotFoundException(4040, 404, "can not find this skills"); } Integer integer = applicantMapper.deleteSkill(id); return integer; } @Override public List<EducationInfo> insertEducations(List<EducationInfo> educationInfos, Integer user_id) throws NotFoundException { BaseInfo baseInfo = applicantMapper.getBaseInfo(user_id); if (baseInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { Integer EduNum = applicantMapper.deleteAllEduInfo(baseInfo.getStu_id()); for (EducationInfo educationInfo : educationInfos) { educationInfo.setStu_id(baseInfo.getStu_id()); applicantMapper.insertEduInfo(educationInfo); } List<EducationInfo> educationInfoList = applicantMapper.getStudentInfo(user_id).getEducationInfos(); // for (EducationInfo educationInfo : educationInfoList) { // Location location = locationService.getLocation(educationInfo.getLocation().getRegion_num()); // educationInfo.setLocation(location); // // } return educationInfoList; } } @Override public List<Work> insertWorks(List<Work> works, Integer user_id) throws NotFoundException { BaseInfo baseInfo = applicantMapper.getBaseInfo(user_id); if (baseInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { Integer num = applicantMapper.deleteAllWork(baseInfo.getStu_id()); for (Work work : works) { work.setStu_id(baseInfo.getStu_id()); applicantMapper.insertStuWork(work); } List<Work> works1 = applicantMapper.getStudentInfo(user_id).getWorks(); for (Work work : works1) { Location location = locationService.getLocation(work.getLocation().getRegionId()); work.setLocation(location); } return works1; } } @Override public List<Project> insertProjects(List<Project> projects, Integer user_id) throws NotFoundException { BaseInfo baseInfo = applicantMapper.getBaseInfo(user_id); if (baseInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { Integer num = applicantMapper.deleteAllProject(baseInfo.getStu_id()); for (Project project : projects) { project.setStu_id(baseInfo.getStu_id()); applicantMapper.insertStuProject(project); } List<Project> projects1 = applicantMapper.getStudentInfo(user_id).getProjects(); return projects1; } } @Override public List<Activity> insertActivities(List<Activity> activities, Integer user_id) throws NotFoundException { BaseInfo baseInfo = applicantMapper.getBaseInfo(user_id); if (baseInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { Integer num = applicantMapper.deleteAllActivity(baseInfo.getStu_id()); for (Activity activity : activities) { activity.setStu_id(baseInfo.getStu_id()); applicantMapper.insertStuActivity(activity); } List<Activity> activities1 = applicantMapper.getStudentInfo(user_id).getActivities(); return activities1; } } @Override public List<Certificate> insertCertificates(List<Certificate> certificates, Integer user_id) throws NotFoundException { BaseInfo baseInfo = applicantMapper.getBaseInfo(user_id); if (baseInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { Integer num = applicantMapper.deleteAllCertificate(baseInfo.getStu_id()); for (Certificate certificate : certificates) { certificate.setStu_id(baseInfo.getStu_id()); applicantMapper.insertStuCertificate(certificate); } List<Certificate> certificates1 = applicantMapper.getStudentInfo(user_id).getCertificates(); return certificates1; } } @Override public List<LabelInfo> insertLabels(List<String> label_codes, Integer user_id) throws NotFoundException { BaseInfo baseInfo = applicantMapper.getBaseInfo(user_id); if (baseInfo == null) { throw new NotFoundException(4040, 404, "cannot find user with id " + user_id);//todo } else { Integer num = applicantMapper.deleteAllSkills(baseInfo.getStu_id()); for (String label_code : label_codes) { AdvantageLabel advantageLabel = new AdvantageLabel(); advantageLabel.setLabel_code(label_code); advantageLabel.setStu_id(baseInfo.getStu_id()); applicantMapper.insertAdvantageSkills(advantageLabel); } List<LabelInfo> labelInfos = applicantMapper.getStudentInfo(user_id).getLabelInfos(); return labelInfos; } } @Override public List<LabelInfo> getAllSkills() throws NotFoundException { List<LabelInfo> labelInfos = applicantMapper.getAllSkills(); return labelInfos; } @Override public ResumeJson getResumeJson(Integer resume_id) throws NotFoundException { return resumeJsonMapper.selectResumeJson(resume_id); } @Override public ResumeJson insertResumeJson(ResumeJson resumeJson) throws NotFoundException { Integer id = resumeJsonMapper.insertResumeJson(resumeJson); return resumeJsonMapper.selectResumeJson(resumeJson.getResumeId()); } @Override public Integer deleteResumeJson(Integer id) throws NotFoundException { return resumeJsonMapper.deleteResumeJson(id); } @Override public List<ResumeJson> selectResumeJsonByStuId(Integer id) throws NotFoundException { return resumeJsonMapper.selectResumeJsonByStuId(id); } @Override public EducationInfo updateEducationInfo(EducationInfo educationInfo) throws NotFoundException { Integer integer = applicantMapper.updateEducation(educationInfo); EducationInfo educationInfo1 = applicantMapper.getEducationById(educationInfo.getEdu_id()); if (educationInfo1 == null) { throw new NotFoundException(4040, 404, "can not find this education");//todo } return educationInfo1; } @Override public Project updateProject(Project project) throws NotFoundException { Integer integer = applicantMapper.updateProject(project); Project project1 = applicantMapper.getProjectById(project.getProj_id()); if (project1 == null) { throw new NotFoundException(4040, 404, "can not find this project");//todo } return project1; } @Override public Work updateWork(Work work) throws NotFoundException { Integer integer = applicantMapper.updateWork(work); Work work1 = applicantMapper.getWorkById(work.getWork_id()); if (work1 == null) { throw new NotFoundException(4040, 404, "cannot find this work");//todo } if (work.getLocation().getRegionId() != null) { Location location = locationService.getLocation(work1.getLocation().getRegionId()); work1.setLocation(location); } return work1; } @Override public Certificate updateCertificate(Certificate certificate) throws NotFoundException { Integer integer = applicantMapper.updateCertificate(certificate); Certificate certificate1 = applicantMapper.getCertificateById(certificate.getCertificate_id()); if (certificate1 == null) { throw new NotFoundException(4040, 404, "can not find this certificate");//todo } return certificate1; } @Override public Activity updateActivity(Activity activity) throws NotFoundException { Integer integer = applicantMapper.updateActivity(activity); Activity activity1 = applicantMapper.getActivityById(activity.getAct_id()); if (activity1 == null) { throw new NotFoundException(4040, 404, "can not find this activity");//todo } return activity1; } public Integer getCollectionByJobId(Integer company_id, Integer user_id) { return applicantMapper.getCollectionByJobId(company_id, user_id); } @Override public Integer getCollectionByCompanyId(Integer company_id, Integer user_id) { return applicantMapper.getCompanyByCompanyId(company_id, user_id); } }
package com.tencent.mm.plugin.voip.ui; import android.annotation.SuppressLint; import android.app.KeyguardManager; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.os.PowerManager; import android.telephony.TelephonyManager; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.tencent.map.lib.gl.model.GLIcon; import com.tencent.mm.R; import com.tencent.mm.al.b; import com.tencent.mm.g.a.ih; import com.tencent.mm.k.g; import com.tencent.mm.model.au; import com.tencent.mm.model.q; import com.tencent.mm.plugin.game.f$k; import com.tencent.mm.plugin.game.gamewebview.jsapi.biz.GameJsApiGetGameCommInfo; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.plugin.voip.HeadsetPlugReceiver; import com.tencent.mm.plugin.voip.model.i; import com.tencent.mm.plugin.voip.model.j; import com.tencent.mm.plugin.voip.model.o; import com.tencent.mm.plugin.voip.model.r; import com.tencent.mm.plugin.voip.model.s; import com.tencent.mm.plugin.voip.ui.d.d; import com.tencent.mm.plugin.voip.video.CaptureView; import com.tencent.mm.plugin.voip.video.e; import com.tencent.mm.plugin.voip.video.k; import com.tencent.mm.plugin.webview.ui.tools.widget.m; import com.tencent.mm.pointers.PBool; import com.tencent.mm.pointers.PInt; import com.tencent.mm.pointers.PString; import com.tencent.mm.sdk.b.c; import com.tencent.mm.sdk.platformtools.SensorController; import com.tencent.mm.sdk.platformtools.ad; import com.tencent.mm.sdk.platformtools.ag; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.storage.ab; import com.tencent.mm.storage.bd; import com.tencent.mm.ui.MMActivity; import com.tencent.mm.ui.ak; import com.tencent.mm.ui.base.MMSuperAlert; import com.tencent.mm.ui.base.a; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; @a(3) @SuppressLint({"SimpleDateFormat"}) public class VideoActivity extends MMActivity implements b, d { private String cYO; private ag guJ; private boolean iTN = false; private boolean mIsMute = false; private int mStatus; private CaptureView oLP; private ab oLT; private boolean oLU; private boolean oLV; private int oLZ = 1; private d oQc; private WeakReference<c> oQd; private long oQe = -1; private long oQf = 0; private boolean oQg = false; private int oQh = 1; private boolean oQi = false; private boolean oQj = false; private c oQk = new 1(this); private TelephonyManager oQl = null; private long oQm; static /* synthetic */ void a(VideoActivity videoActivity, int i) { int i2; x.d("MicroMsg.Voip.VideoActivity", "getHintByErrorCode " + i); if (i == 235) { i2 = R.l.voip_errorhint_notsupport; } else if (i == 233) { i.bJI().bKX(); i2 = R.l.voip_errorhint_notcontact; } else { i2 = i == 237 ? (!b.PD() || videoActivity.oLV) ? R.l.voip_errorhint_plugclose : R.l.voip_errorhint_voice_plugclose_for_oversea : i == 236 ? R.l.voip_inblacklist : i == 211 ? R.l.voip_errorhint_userbusy : 0; } if (i2 != 0 || videoActivity.oQc == null) { if (i2 == 0) { i2 = R.l.voip_disconnect_tip; } MMSuperAlert.j(videoActivity, R.l.app_tip, i2); return; } videoActivity.oQc.co(videoActivity.getString(R.l.voip_disconnect_tip), -1); } public void onCreate(Bundle bundle) { Object obj; super.onCreate(bundle); if (!com.tencent.mm.plugin.voip.b.d.em(this.mController.tml)) { com.tencent.mm.plugin.voip.b.d.en(this.mController.tml); } x.i("MicroMsg.Voip.VideoActivity", "VideoActivity onCreate start"); getSupportActionBar().hide(); getWindow().setSoftInputMode(3); getWindow().addFlags(6815872); if (au.HX()) { i.bJI().F(false, false); } this.guJ = new ag(); PBool pBool = new PBool(); PBool pBool2 = new PBool(); PString pString = new PString(); PInt pInt = new PInt(); pString.value = getIntent().getStringExtra("Voip_User"); pBool.value = getIntent().getBooleanExtra("Voip_Outcall", true); pBool2.value = getIntent().getBooleanExtra("Voip_VideoCall", true); this.oQm = getIntent().getLongExtra("Voip_LastPage_Hash", 0); pInt.value = com.tencent.mm.plugin.voip.b.b.I(pBool.value, pBool2.value); if (pBool.value) { try { if (bgx()) { Toast.makeText(this, R.l.in_phone_tip, 0).show(); x.i("MicroMsg.Voip.VideoActivity", "this phone is on a call"); super.finish(); return; } } catch (Exception e) { x.e("MicroMsg.Voip.VideoActivity", "not ready now!"); } } r bJI = i.bJI(); if (bJI.oNb != null) { x.i("MicroMsg.Voip.VoipService", "voipMgr is not null"); pString.value = bJI.oNb.cYO; pBool.value = bJI.oNb.oLU; pBool2.value = bJI.oNb.oLV; pInt.value = bJI.oNb.oLL.mState; } else { if (pString.value == null) { x.e("MicroMsg.Voip.VoipService", "username is null, can't start voip"); obj = null; } else if (pBool.value || bJI.oNa.bJP()) { String str; o oVar; List F; k kVar; IntentFilter intentFilter; bJI.oNb = new o(); o oVar2 = bJI.oNb; String str2 = pString.value; boolean z = pBool.value; boolean z2 = pBool2.value; x.i("MicroMsg.Voip.VoipMgr", "start VoIP, userName: %s, isOutCall: %b, isVideoCall: %b", new Object[]{str2, Boolean.valueOf(z), Boolean.valueOf(z2)}); oVar2.oMn = true; oVar2.cYO = str2; oVar2.oLU = z; oVar2.oLV = z2; au.HU(); oVar2.oLT = com.tencent.mm.model.c.FR().Yg(oVar2.cYO); oVar2.guJ = new ag(); if (oVar2.oMt == null) { oVar2.oMt = new e(); } oVar2.oMu = 0; oVar2.oLW = bi.getInt(g.AT().getValue("VOIPCameraSwitch"), 1) == 0; if (!oVar2.oLV) { oVar2.oLW = false; } int I = com.tencent.mm.plugin.voip.b.b.I(z, z2); if (oVar2.oLW) { if (I == 0) { I = 1; } else if (GLIcon.TOP == I) { I = 257; } } if (z) { oVar2.oLL = com.tencent.mm.plugin.voip.b.b.yT(I); } else { oVar2.oLL = com.tencent.mm.plugin.voip.b.b.yS(I); } boolean zT = com.tencent.mm.compatible.f.b.zT(); boolean zV = com.tencent.mm.compatible.f.b.zV(); if (Build.MANUFACTURER.equalsIgnoreCase("meizu")) { h hVar; Object[] objArr; if (!zT) { hVar = h.mEJ; objArr = new Object[2]; objArr[0] = Integer.valueOf(oVar2.oLV ? 0 : 1); objArr[1] = Integer.valueOf(1); hVar.h(11306, objArr); } if (!zV) { hVar = h.mEJ; objArr = new Object[2]; objArr[0] = Integer.valueOf(oVar2.oLV ? 0 : 1); objArr[1] = Integer.valueOf(0); hVar.h(11306, objArr); } } if (!(zV && zT)) { String str3 = null; str = null; if (!zT && !zV) { str3 = getString(R.l.app_special_no_audio_camera_permission); str = getString(R.l.app_need_audio_and_camera_title); } else if (!zT) { str3 = getString(R.l.app_special_no_record_audio_permission); str = getString(R.l.app_need_audio_title); } else if (!zV) { str3 = getString(R.l.app_special_no_open_camera_permission); str = getString(R.l.app_need_camera_title); } com.tencent.mm.ui.base.h.a(this, str3, str, getString(R.l.app_need_show_settings_button), true, new o$11(oVar2, this)); } x.i("MicroMsg.Voip.VoipMgr", "initMgr"); au.vv().xv(); au.HV().b(oVar2); au.HV().a(oVar2); au.HV().yB(); oVar2.bEL = new com.tencent.mm.compatible.util.b(ad.getContext()); oVar2.bEL.requestFocus(); if (oVar2.oLV) { i.bJI().a(true, true, oVar2.cYO); } else { i.bJI().a(true, false, oVar2.cYO); } if (oVar2.oLU) { i.bJI().oNa.bLf(); if ((oVar2.oLV ? i.bJI().oNa.cn(oVar2.oLT.field_username, 0) : i.bJI().oNa.cn(oVar2.oLT.field_username, 1)) < 0) { oVar2.fr(false); } } oVar2.oLM = new HeadsetPlugReceiver(); oVar2.oLM.a(ad.getContext(), oVar2.oMA); r bJI2 = i.bJI(); Context context = ad.getContext(); s sVar = bJI2.oNa; sVar.oHa.gKE = context; sVar.oHa.oJY = oVar2; com.tencent.mm.plugin.voip.b.a.eV("MicroMsg.Voip.VoipServiceEx", "attach ui........"); oVar2.knT = (TelephonyManager) ad.getContext().getSystemService("phone"); oVar2.knT.listen(oVar2.knU, 32); i.bJI().l(R.k.phonering, oVar2.oLV ? 0 : 1, oVar2.oLU); if (au.HV().yK()) { I = 3; oVar = oVar2; } else if (au.HV().yE()) { I = 4; oVar = oVar2; } else if (oVar2.oLV) { I = 1; oVar = oVar2; } else { I = 2; oVar = oVar2; } oVar.oLZ = I; oVar2.oMs = false; if (oVar2.oLV) { oVar2.oMc = true; } else { oVar2.oMc = false; } str2 = "voip_recent_contact" + q.GF(); SharedPreferences sharedPreferences = ad.getContext().getSharedPreferences("voip_plugin_prefs", 0); str = sharedPreferences.getString(str2, null); if (str != null) { F = bi.F(str.split(";")); if (F != null) { int size = F.size(); if (F.contains(oVar2.cYO)) { if (size > 1) { F.remove(oVar2.cYO); } sharedPreferences.edit().putString(str2, bi.c(F, ";")).commit(); com.tencent.mm.sdk.b.a.sFg.b(oVar2.oMB); com.tencent.mm.sdk.b.a.sFg.b(oVar2.knV); kVar = oVar2.oMg; if (!kVar.hfT.contains(oVar2)) { kVar.hfT.add(oVar2); } intentFilter = new IntentFilter(); intentFilter.addAction("android.intent.action.SCREEN_ON"); intentFilter.addAction("android.intent.action.SCREEN_OFF"); intentFilter.addAction("android.intent.action.USER_PRESENT"); ad.getContext().registerReceiver(oVar2.oMz, intentFilter); oVar2.hlW = new SensorController(oVar2.getContext()); x.i("MicroMsg.Voip.VoipMgr", "initMgr setSensorCallBack"); oVar2.hlW.a(oVar2); } else if (4 == size) { F.remove(size - 1); } F.add(0, oVar2.cYO); sharedPreferences.edit().putString(str2, bi.c(F, ";")).commit(); com.tencent.mm.sdk.b.a.sFg.b(oVar2.oMB); com.tencent.mm.sdk.b.a.sFg.b(oVar2.knV); kVar = oVar2.oMg; if (kVar.hfT.contains(oVar2)) { kVar.hfT.add(oVar2); } intentFilter = new IntentFilter(); intentFilter.addAction("android.intent.action.SCREEN_ON"); intentFilter.addAction("android.intent.action.SCREEN_OFF"); intentFilter.addAction("android.intent.action.USER_PRESENT"); ad.getContext().registerReceiver(oVar2.oMz, intentFilter); oVar2.hlW = new SensorController(oVar2.getContext()); x.i("MicroMsg.Voip.VoipMgr", "initMgr setSensorCallBack"); oVar2.hlW.a(oVar2); } } F = new ArrayList(); F.add(0, oVar2.cYO); sharedPreferences.edit().putString(str2, bi.c(F, ";")).commit(); com.tencent.mm.sdk.b.a.sFg.b(oVar2.oMB); com.tencent.mm.sdk.b.a.sFg.b(oVar2.knV); kVar = oVar2.oMg; if (kVar.hfT.contains(oVar2)) { kVar.hfT.add(oVar2); } intentFilter = new IntentFilter(); intentFilter.addAction("android.intent.action.SCREEN_ON"); intentFilter.addAction("android.intent.action.SCREEN_OFF"); intentFilter.addAction("android.intent.action.USER_PRESENT"); ad.getContext().registerReceiver(oVar2.oMz, intentFilter); oVar2.hlW = new SensorController(oVar2.getContext()); x.i("MicroMsg.Voip.VoipMgr", "initMgr setSensorCallBack"); oVar2.hlW.a(oVar2); } else { x.e("MicroMsg.Voip.VoipService", "is out call, but kenerl is not working"); com.tencent.mm.plugin.voip.model.q.a(pString.value, pBool2.value ? bd.tby : bd.tbx, pBool.value ? 1 : 0, 4, ad.getContext().getString(R.l.voip_call_cancel_msg_from)); obj = null; } if (obj != null) { x.e("MicroMsg.Voip.VideoActivity", "unable to init VoipMgr"); super.finish(); } this.oQd = new WeakReference(obj); this.cYO = pString.value; this.oLV = pBool2.value; this.oLU = pBool.value; this.mStatus = pInt.value; au.HU(); this.oLT = com.tencent.mm.model.c.FR().Yg(this.cYO); Bundle bundle2 = new Bundle(); bundle2.putString("key_username", this.oLT.field_username); bundle2.putBoolean("key_isoutcall", this.oLU); bundle2.putInt("key_status", com.tencent.mm.plugin.voip.b.b.I(this.oLU, this.oLV)); if (com.tencent.mm.plugin.voip.b.b.yV(this.mStatus)) { this.oQc = new e(); } else { this.oQc = new f(); } this.oQc.setArguments(bundle2); getSupportFragmentManager().bk().b(R.h.voip_container, this.oQc).commit(); setTitleVisibility(8); if (com.tencent.mm.plugin.voip.b.b.yW(this.mStatus) && this.oLU) { this.guJ.postDelayed(new 4(this), 20000); } this.oQc.setVoipUIListener((c) this.oQd.get()); this.oQc.a(this); this.oQc.yN(this.oLZ); this.oQc.setMute(this.mIsMute); if (i.bJI().oNb.oMr != null) { OH(i.bJI().oNb.oMr); } if (!(this.oQd == null || this.oQd.get() == null)) { ((c) this.oQd.get()).a(this, 1); } x.i("MicroMsg.Voip.VideoActivity", "VideoActivity onCreate end isOutCall:%b isVideoCall:%b username:%s state:%d", new Object[]{Boolean.valueOf(this.oLU), Boolean.valueOf(this.oLV), this.cYO, Integer.valueOf(this.mStatus)}); boolean a; if (com.tencent.mm.plugin.voip.b.b.yV(this.mStatus)) { a = com.tencent.mm.pluginsdk.permission.a.a(this, "android.permission.CAMERA", 19, "", ""); x.i("MicroMsg.Voip.VideoActivity", "summerper checkPermission checkCamera[%b], stack[%s], activity[%s]", new Object[]{Boolean.valueOf(a), bi.cjd(), this}); a = com.tencent.mm.pluginsdk.permission.a.a(this, "android.permission.RECORD_AUDIO", 19, "", ""); x.i("MicroMsg.Voip.VideoActivity", "summerper checkPermission checkmicrophone[%b], stack[%s], activity[%s]", new Object[]{Boolean.valueOf(a), bi.cjd(), this}); } else { a = com.tencent.mm.pluginsdk.permission.a.a(this, "android.permission.RECORD_AUDIO", 82, "", ""); x.i("MicroMsg.Voip.VideoActivity", "summerper checkPermission checkmicrophone[%b], stack[%s], activity[%s]", new Object[]{Boolean.valueOf(a), bi.cjd(), this}); } com.tencent.mm.sdk.b.a.sFg.b(this.oQk); return; } obj = bJI.oNb; if (obj != null) { this.oQd = new WeakReference(obj); this.cYO = pString.value; this.oLV = pBool2.value; this.oLU = pBool.value; this.mStatus = pInt.value; au.HU(); this.oLT = com.tencent.mm.model.c.FR().Yg(this.cYO); Bundle bundle22 = new Bundle(); bundle22.putString("key_username", this.oLT.field_username); bundle22.putBoolean("key_isoutcall", this.oLU); bundle22.putInt("key_status", com.tencent.mm.plugin.voip.b.b.I(this.oLU, this.oLV)); if (com.tencent.mm.plugin.voip.b.b.yV(this.mStatus)) { this.oQc = new e(); } else { this.oQc = new f(); } this.oQc.setArguments(bundle22); getSupportFragmentManager().bk().b(R.h.voip_container, this.oQc).commit(); setTitleVisibility(8); if (com.tencent.mm.plugin.voip.b.b.yW(this.mStatus) && this.oLU) { this.guJ.postDelayed(new 4(this), 20000); } this.oQc.setVoipUIListener((c) this.oQd.get()); this.oQc.a(this); this.oQc.yN(this.oLZ); this.oQc.setMute(this.mIsMute); if (i.bJI().oNb.oMr != null) { OH(i.bJI().oNb.oMr); } if (!(this.oQd == null || this.oQd.get() == null)) { ((c) this.oQd.get()).a(this, 1); } x.i("MicroMsg.Voip.VideoActivity", "VideoActivity onCreate end isOutCall:%b isVideoCall:%b username:%s state:%d", new Object[]{Boolean.valueOf(this.oLU), Boolean.valueOf(this.oLV), this.cYO, Integer.valueOf(this.mStatus)}); boolean a2; if (com.tencent.mm.plugin.voip.b.b.yV(this.mStatus)) { a2 = com.tencent.mm.pluginsdk.permission.a.a(this, "android.permission.CAMERA", 19, "", ""); x.i("MicroMsg.Voip.VideoActivity", "summerper checkPermission checkCamera[%b], stack[%s], activity[%s]", new Object[]{Boolean.valueOf(a2), bi.cjd(), this}); a2 = com.tencent.mm.pluginsdk.permission.a.a(this, "android.permission.RECORD_AUDIO", 19, "", ""); x.i("MicroMsg.Voip.VideoActivity", "summerper checkPermission checkmicrophone[%b], stack[%s], activity[%s]", new Object[]{Boolean.valueOf(a2), bi.cjd(), this}); } else { a2 = com.tencent.mm.pluginsdk.permission.a.a(this, "android.permission.RECORD_AUDIO", 82, "", ""); x.i("MicroMsg.Voip.VideoActivity", "summerper checkPermission checkmicrophone[%b], stack[%s], activity[%s]", new Object[]{Boolean.valueOf(a2), bi.cjd(), this}); } com.tencent.mm.sdk.b.a.sFg.b(this.oQk); return; } x.e("MicroMsg.Voip.VideoActivity", "unable to init VoipMgr"); super.finish(); } private static boolean bgx() { Exception e; boolean z; try { TelephonyManager telephonyManager = (TelephonyManager) ad.getContext().getSystemService("phone"); if (telephonyManager == null) { return false; } switch (telephonyManager.getCallState()) { case 0: z = false; break; case 1: case 2: z = true; break; default: z = false; break; } try { x.i("MicroMsg.Voip.VideoActivity", "TelephoneManager.callState is %d", new Object[]{Integer.valueOf(r2)}); return z; } catch (Exception e2) { e = e2; } } catch (Exception e3) { e = e3; z = false; x.e("MicroMsg.Voip.VideoActivity", "get callState error , errMsg is %s", new Object[]{e.getLocalizedMessage()}); return z; } } protected final int getForceOrientation() { return 1; } private void bKx() { this.guJ.postDelayed(new 5(this), 2000); } public final void dQ(int i, int i2) { this.mStatus = i2; if (1 != this.oQh && i2 != 8 && i2 != 262) { x.i("MicroMsg.Voip.VideoActivity", "activity is not normal, can't transform"); } else if (this.oQc == null) { x.i("MicroMsg.Voip.VideoActivity", "mBaseFragment is null ,already close,now return."); } else { this.oQc.dQ(i, i2); switch (i2) { case 1: case 3: case 7: case 257: case 261: if (this.oQc == null || !(this.oQc instanceof f)) { if (this.oQc != null) { this.oQc.uninit(); getSupportFragmentManager().bk().a(this.oQc).commit(); this.oQc = null; } x.i("MicroMsg.Voip.VideoActivity", "switch to voice fragment"); Bundle bundle = new Bundle(); bundle.putString("key_username", this.oLT.field_username); bundle.putBoolean("key_isoutcall", this.oLU); bundle.putInt("key_status", this.mStatus); this.oQc = new f(); this.oQc.setArguments(bundle); this.oQc.setVoipUIListener((c) this.oQd.get()); this.oQc.fw(this.oQe); this.oQc.a(this); this.oQc.yN(this.oLZ); this.oQc.setMute(this.mIsMute); this.oQc.a(this.oLP); getSupportFragmentManager().bk().b(R.h.voip_container, this.oQc).commit(); return; } return; case 8: case 262: switch (i) { case 4098: this.guJ.postDelayed(new 6(this), 50); break; case 4099: if (this.oLU) { this.oQc.co(this.oLV ? getString(R.l.voip_video_call_rejected) : getString(R.l.voip_audio_call_rejected), -1); } bKx(); break; case 4103: case 4104: bKx(); break; case 4106: this.guJ.post(new 9(this)); break; case 4107: finish(); break; case 4109: this.guJ.post(new 10(this)); break; } bKx(); return; default: return; } } } public boolean onKeyDown(int i, KeyEvent keyEvent) { if (keyEvent.getKeyCode() == 4) { return true; } if (i == 25) { if (i.bJI().bKY() || this.oLU) { au.HV().fE(au.HV().yE() ? au.HV().yQ() : aXI()); } else { i.bJI().stopRing(); } return true; } else if (i != 24) { return super.onKeyDown(i, keyEvent); } else { if (i.bJI().bKY() || this.oLU) { au.HV().fD(au.HV().yE() ? au.HV().yQ() : aXI()); } else { i.bJI().stopRing(); } return true; } } protected void onDestroy() { this.oQh = 4; x.i("MicroMsg.Voip.VideoActivity", "onDestroy, status: %s", new Object[]{com.tencent.mm.plugin.voip.b.b.yR(this.mStatus)}); if (!this.oQj) { finish(); } if (!(this.oQd == null || this.oQd.get() == null)) { ((c) this.oQd.get()).a(this); } com.tencent.mm.sdk.b.a.sFg.c(this.oQk); setScreenEnable(true); super.onDestroy(); } protected void onStop() { this.oQh = 2; x.i("MicroMsg.Voip.VideoActivity", "onStop, status: %s", new Object[]{com.tencent.mm.plugin.voip.b.b.yR(this.mStatus)}); super.onStop(); if (262 != this.mStatus && 8 != this.mStatus && this.oQi && !this.oQj && this.oQd != null && this.oQd.get() != null && ((c) this.oQd.get()).iP(false)) { H(false, true); if (com.tencent.mm.plugin.voip.b.b.yU(this.mStatus)) { h hVar = h.mEJ; Object[] objArr = new Object[2]; objArr[0] = Integer.valueOf(com.tencent.mm.plugin.voip.b.b.yV(this.mStatus) ? 2 : 3); objArr[1] = Integer.valueOf(2); hVar.h(11618, objArr); } } } public void onStart() { super.onStart(); if (!this.oQj) { x.i("MicroMsg.Voip.VideoActivity", "onStart"); this.oQh = 1; dQ(GLIcon.LEFT, this.mStatus); } } public void finish() { boolean z; this.oQh = 3; x.i("MicroMsg.Voip.VideoActivity", "finish, finishBczMinimize: %b, status: %s", new Object[]{Boolean.valueOf(this.oQg), com.tencent.mm.plugin.voip.b.b.yR(this.mStatus)}); if (!(this.oQg || !com.tencent.mm.plugin.voip.b.b.yU(this.mStatus) || 4 == this.oQh)) { x.i("MicroMsg.Voip.VideoActivity", "finish VideoActivity, start ChattingUI"); Intent intent = new Intent(); intent.addFlags(67108864); intent.putExtra("Chat_User", this.cYO); com.tencent.mm.plugin.voip.a.a.ezn.e(intent, this); } setScreenEnable(true); if (this.oQc != null) { if (this.oQc.oQu == 4105) { z = true; } else { z = false; } this.oQc.uninit(); this.oQc = null; } else { z = false; } this.oQd = null; this.oLP = null; this.oQj = true; super.finish(); ih ihVar; if (z) { ihVar = new ih(); ihVar.bRN.bRQ = true; ihVar.bRN.bRP = this.oQm; com.tencent.mm.sdk.b.a.sFg.m(ihVar); } else { ihVar = new ih(); ihVar.bRN.bRQ = false; ihVar.bRN.bRP = 0; com.tencent.mm.sdk.b.a.sFg.m(ihVar); } d.oQv = -1; } protected void onNewIntent(Intent intent) { x.i("MicroMsg.Voip.VideoActivity", "onNewIntent"); super.onNewIntent(intent); } public void onPause() { super.onPause(); PowerManager powerManager = (PowerManager) ad.getContext().getSystemService("power"); boolean z = (hasWindowFocus() || !((KeyguardManager) ad.getContext().getSystemService("keyguard")).inKeyguardRestrictedInputMode()) && powerManager.isScreenOn(); this.oQi = z; x.i("MicroMsg.Voip.VideoActivity", "onPause, status: %s, screenOn: %b, hasWindowFocus: %s, isScreenLocked: %s, isScreenOn: %s", new Object[]{com.tencent.mm.plugin.voip.b.b.yR(this.mStatus), Boolean.valueOf(this.oQi), Boolean.valueOf(r5), Boolean.valueOf(r4), Boolean.valueOf(r1)}); m.Bk(2); } public void onResume() { int i = 0; x.i("MicroMsg.Voip.VideoActivity", "onResume, status: %s", new Object[]{com.tencent.mm.plugin.voip.b.b.yR(this.mStatus)}); au.getNotification().cancel(40); j jVar = i.bJI().oNa.oHa; if (jVar.oJJ) { jVar.oJJ = false; } super.onResume(); setScreenEnable(true); this.oQf = bi.VG(); if (this.oLU && com.tencent.mm.plugin.voip.b.b.yW(this.mStatus) && i.bJI().bKY()) { if (!this.oLV) { i = 1; } i.bJI().l(R.k.phonering, i, this.oLU); } m.Bk(1); } public final void a(byte[] bArr, long j, int i, int i2, int i3, int i4, int i5, int i6) { if (this.oQc != null) { this.oQc.a(bArr, j, i, i2, i3, i4, i5, i6); } } public final void aL(int i, String str) { x.i("MicroMsg.Voip.VideoActivity", "onError, errCode:%d, isVideoCall:%s", new Object[]{Integer.valueOf(i), Boolean.valueOf(this.oLV)}); this.iTN = true; if (i == GameJsApiGetGameCommInfo.CTRL_BYTE) { com.tencent.mm.ui.base.h.b(this, str, null, true); } else { this.guJ.post(new 7(this, i)); } } public final void OH(String str) { if (this.oQc != null) { this.guJ.post(new 8(this, str)); } } protected final int getLayoutId() { return R.i.voip_main; } protected final void dealContentView(View view) { ak.d(ak.a(getWindow(), null), this.mController.tlX); ((ViewGroup) getWindow().getDecorView()).addView(view, 0); } private int aXI() { int bJx; if (com.tencent.mm.plugin.voip.b.b.yU(this.mStatus)) { bJx = i.bJI().bJx(); } else { bJx = au.HV().yE() ? 0 : 2; if (this.oLU) { if (this.oLV) { bJx = 3; if (com.tencent.mm.compatible.e.q.deN.dcb >= 0) { bJx = com.tencent.mm.compatible.e.q.deN.dcb; } } else if (com.tencent.mm.compatible.e.q.deN.dce >= 0) { bJx = com.tencent.mm.compatible.e.q.deN.dce; } else { bJx = 0; } } if (!au.HV().yE() && com.tencent.mm.compatible.e.q.deN.dcg >= 0) { bJx = com.tencent.mm.compatible.e.q.deN.dcg; } } x.d("MicroMsg.Voip.VideoActivity", "Current StreamType:%d", new Object[]{Integer.valueOf(bJx)}); return bJx; } public final void yN(int i) { this.oLZ = i; if (this.oQc != null) { this.oQc.yN(i); } } public final void setMute(boolean z) { this.mIsMute = z; if (this.oQc != null) { this.oQc.setMute(z); } } public final void c(int i, int i2, int[] iArr) { if (this.oQc != null) { this.oQc.c(i, i2, iArr); } } public final void bKB() { if (this.oQc != null) { this.oQc.bKB(); } } public final void setHWDecMode(int i) { if (this.oQc != null) { this.oQc.setHWDecMode(i); } } public final Context bLD() { return this.mController.tml; } public final void uninit() { if (this.oQc != null) { this.oQc.uninit(); } } public final void setConnectSec(long j) { this.oQe = j; if (this.oQc != null) { this.oQc.fw(this.oQe); } } public final void bLE() { x.d("MicroMsg.Voip.VideoActivity", "tryShowNetStatusWarning"); if (this.oQc != null) { this.oQc.bLF(); } } public final void aYv() { x.d("MicroMsg.Voip.VideoActivity", "dismissNetStatusWarning"); if (this.oQc != null) { this.oQc.bLG(); } } public final void H(boolean z, boolean z2) { this.oQg = z2; if (z) { bKx(); } else { finish(); } } public final void setCaptureView(CaptureView captureView) { this.oLP = captureView; if (this.oQc != null) { this.oQc.a(captureView); } } public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) { if (strArr == null || strArr.length == 0 || iArr == null || iArr.length == 0) { x.e("MicroMsg.Voip.VideoActivity", "onRequestPermissionsResult %d data is invalid", new Object[]{Integer.valueOf(i)}); return; } x.i("MicroMsg.Voip.VideoActivity", "summerper onRequestPermissionsResult requestCode[%d],grantResults[%d] tid[%d]", new Object[]{Integer.valueOf(i), Integer.valueOf(iArr[0]), Long.valueOf(Thread.currentThread().getId())}); switch (i) { case 19: if (iArr[0] != 0) { com.tencent.mm.ui.base.h.a(this, getString("android.permission.CAMERA".equals(strArr[0]) ? R.l.permission_camera_request_again_msg : R.l.permission_microphone_request_again_msg), getString(R.l.permission_tips_title), getString(R.l.jump_to_settings), getString(R.l.cancel), false, new OnClickListener() { public final void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); VideoActivity.this.startActivity(new Intent("android.settings.MANAGE_APPLICATIONS_SETTINGS")); } }, new 2(this)); return; } return; case f$k.AppCompatTheme_colorPrimary /*82*/: if (iArr[0] != 0) { com.tencent.mm.ui.base.h.a(this, getString(R.l.permission_microphone_request_again_msg), getString(R.l.permission_tips_title), getString(R.l.jump_to_settings), getString(R.l.cancel), false, new 3(this), null); return; } return; default: return; } } }
package Parser; import Game.Player; public class LookCommand implements VerbCommand { @Override public String exec(Player player,String[] input) { String output = "You see"; return output + ":" + player.look(); } }
package couchbase.sample.loader.loadgen; import java.util.Date; import java.util.Random; import couchbase.sample.to.CustomerTO; import couchbase.sample.to.TransactionTO; import couchbase.sample.util.DateFormatter; import couchbase.sample.vo.Address; import couchbase.sample.vo.CreditCard; import io.codearte.jfairy.Fairy; import io.codearte.jfairy.producer.person.Person; import io.codearte.jfairy.producer.person.PersonProperties; public class DataGen { public static String CUSTOMER_SCHEMA = "1.0"; public static String CUSTOMER_TYPE = "cust"; public static int CUSTOMER_VERSION = 1; /** * This method returns transaction details when credit card number is passed * @param cardNumber Credit card number that need to be associated to this transaction * @return Transaction object */ public TransactionTO getTransactionData(long cardNumber) { TransactionTO txn = new TransactionTO(); Random rand = new Random(); String formatedDate = DateFormatter.getFormatedDate(new Date()); //create a random vendor detail Fairy fairy = Fairy.create(); Person vendor = fairy.person(); //set transaction details txn.setVendor(vendor.getFullName()); txn.setAmount(rand.nextInt(100) + 1); txn.setCardNumber(cardNumber); txn.setTxnTime(DateFormatter.getEpocTime(formatedDate)); txn.setTxnTimeAsString(formatedDate); return txn; }//getTransactionData /** * This method is used to populate some meaning information into CustomerTO. This method * is CPU intensive and should not be called often while running the performance test. * @return CustomerTO */ public CustomerTO getCustomerData() { CustomerTO customerTO = new CustomerTO(); Address address = null; CreditCard creditCard = null; io.codearte.jfairy.producer.person.Address personAddress = null; io.codearte.jfairy.producer.payment.CreditCard cardGen = null; //set metadata attributes first customerTO.setSchema(CUSTOMER_SCHEMA); customerTO.setVersion(CUSTOMER_VERSION); customerTO.setType(CUSTOMER_TYPE); //create a random adult person object Fairy fairy = Fairy.create(); Person person = fairy.person(PersonProperties.ageBetween(20, 40)); //generate credit-card details cardGen = fairy.creditCard(); //assign person details into customer object customerTO.setFirstName(person.getFirstName()); customerTO.setLastName(person.getLastName()); customerTO.setEmail(person.getEmail()); customerTO.setGender(person.getSex().toString()); customerTO.setDob(person.getDateOfBirth().toString()); //create customer address address = new Address(); //create random address for the person personAddress = person.getAddress(); //assign details to address POJO address.setStreet(personAddress.getStreet()); address.setStreetNumber(personAddress.getStreetNumber()); address.setCity(personAddress.getCity()); address.setZip(personAddress.getPostalCode()); //set address to customer object customerTO.addAddress(address); //Now create a credit-card detail creditCard = new CreditCard(); creditCard.setVendor(cardGen.getVendor()); creditCard.setNumber(new Date().getTime()); creditCard.setExpiryDate(cardGen.getExpiryDateAsString()); //add creditcard number to customer customerTO.addCreditCard(creditCard); /* try { System.out.println("Printing 10 transactions for each card number"); //wait for key press System.in.read(); //generate 10 txn per card number long cardNumber = 0; int counter=0; TransactionTO transaction = null; for(int i=0;i<numberOfObjects;i++) { cardNumber = cardNumbers[i]; //now print 10 txn each for(int j=0;j<10;j++) { transaction = DataGen.getTransactionData(cardNumber); jsonString = transaction.toJson(); System.out.println("Transaction: " + ++counter + "\n" + jsonString); //upsert transaction information into the txn_sample bucket txnDAO.upsert(transaction.getId(), jsonString); }//eof for(j) }//eof for(i) } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } */ return customerTO; }//EOF getCustomerData() }
package rontikeky.beraspakone; import android.content.Intent; import android.support.annotation.NonNull; import android.support.design.widget.BottomNavigationView; import android.support.design.widget.TabLayout; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.CardView; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.Spinner; import android.widget.TableLayout; import android.widget.TextView; public class HistoryPembelian extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_history); } public void history(View view) { TextView dateHistory = (TextView) findViewById(R.id.txtDate); TableLayout History = (TableLayout) findViewById(R.id.tblHistory); Button btnDetil = (Button) findViewById(R.id.btnDetailHistory); Spinner comboBulan = (Spinner) findViewById(R.id.cmbBulan); Spinner comboTahun = (Spinner) findViewById(R.id.cmbTahun); if (History.getVisibility() == View.VISIBLE) { comboBulan.setEnabled(false); comboTahun.setEnabled(false); dateHistory.setVisibility(view.INVISIBLE); History.setVisibility(view.INVISIBLE); btnDetil.setVisibility(view.INVISIBLE); }else{ comboBulan.setEnabled(true); comboTahun.setEnabled(true); dateHistory.setVisibility(view.VISIBLE); History.setVisibility(view.VISIBLE); btnDetil.setVisibility(view.VISIBLE); } } public void DetailHistory (View view) { TableLayout DetHistory = (TableLayout) findViewById(R.id.tblDetHistory); DetHistory.setVisibility(view.VISIBLE); } }
package com.lingnet.vocs.service.equipment; import com.lingnet.common.service.BaseService; import com.lingnet.util.Pager; import com.lingnet.vocs.entity.EquipmentBase; public interface EquipmentBaseService extends BaseService<EquipmentBase, String> { /** * 设备基础信息编辑保存 * * @Title: saveOrUpdate * @param equipment * @return * @throws Exception * String * @author wanl * @since 2017年6月28日 V 1.0 */ public String saveOrUpdate(EquipmentBase equipmentBase) throws Exception; /** * 设备基础信息列表展示 * * @Title: getListData * @param pager * @param key * @param partnerId * @return String * @author wanl * @since 2017年6月28日 V 1.0 */ public String getListData(Pager pager, String partnerId); /** * 设备基础信息删除 * * @Title: remove * @param inspectId * @return * @throws Exception * String * @author wanl * @since 2017年6月28日 V 1.0 */ public String remove(String equipmentBaseId) throws Exception; }
import java.util.Scanner; public class armstrong3 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter 3 digit number :"); int num = sc.nextInt(); sc.close(); int originalNumber, remainder, result = 0; originalNumber = num; if(num >=100 && num <= 999) { while (originalNumber != 0) { remainder = originalNumber % 10; result += Math.pow(remainder, 3); originalNumber /= 10; } if(result == num) System.out.println(num + " is an Armstrong number."); else System.out.println(num + " is not an Armstrong number."); } else{ System.out.println("Enter 3 digit number only."); } } }
package Controller; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import DAO.categoryDAO; import DAO.countryDAO; import VO.categoryVO; import VO.countryVO; /** * Servlet implementation class categoryController */ @WebServlet("/categoryController") public class categoryController extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public categoryController() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String categoryName=request.getParameter("categoryName"); String categoryDescription=request.getParameter("categoryDescription"); HttpSession session = request.getSession(); categoryVO v1=new categoryVO(); v1.setCategoryName(categoryName); v1.setCategoryDescription(categoryDescription); categoryDAO d1=new categoryDAO(); d1.InsertCategory(v1); response.sendRedirect("admin/category.jsp"); } }
package com.stem.entity; import java.math.BigDecimal; public class Statement extends StatementKey { private String customername; private String phone; private String customerid; private String fundtype; private BigDecimal netvalue; private BigDecimal purchaseamount; private BigDecimal totalpurchaseamount; private BigDecimal exchangerate; private BigDecimal addvalueofassert; private Integer purchaseshares; private BigDecimal currentbalance; private Integer redemptionshares; private BigDecimal redemptionamount; private BigDecimal totalredemptionamount; private Integer totalshares; private BigDecimal totalamount; private BigDecimal totalbalance; private BigDecimal totalreturn; private BigDecimal totalrate; private BigDecimal currentreturn; private BigDecimal currentrate; private BigDecimal currentdividend; public String getCustomername() { return customername; } public void setCustomername(String customername) { this.customername = customername; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getCustomerid() { return customerid; } public void setCustomerid(String customerid) { this.customerid = customerid; } public String getFundtype() { return fundtype; } public void setFundtype(String fundtype) { this.fundtype = fundtype; } public BigDecimal getNetvalue() { return netvalue; } public void setNetvalue(BigDecimal netvalue) { this.netvalue = netvalue; } public BigDecimal getPurchaseamount() { return purchaseamount; } public void setPurchaseamount(BigDecimal purchaseamount) { this.purchaseamount = purchaseamount; } public BigDecimal getTotalpurchaseamount() { return totalpurchaseamount; } public void setTotalpurchaseamount(BigDecimal totalpurchaseamount) { this.totalpurchaseamount = totalpurchaseamount; } public BigDecimal getExchangerate() { return exchangerate; } public void setExchangerate(BigDecimal exchangerate) { this.exchangerate = exchangerate; } public BigDecimal getAddvalueofassert() { return addvalueofassert; } public void setAddvalueofassert(BigDecimal addvalueofassert) { this.addvalueofassert = addvalueofassert; } public Integer getPurchaseshares() { return purchaseshares; } public void setPurchaseshares(Integer purchaseshares) { this.purchaseshares = purchaseshares; } public BigDecimal getCurrentbalance() { return currentbalance; } public void setCurrentbalance(BigDecimal currentbalance) { this.currentbalance = currentbalance; } public Integer getRedemptionshares() { return redemptionshares; } public void setRedemptionshares(Integer redemptionshares) { this.redemptionshares = redemptionshares; } public BigDecimal getRedemptionamount() { return redemptionamount; } public void setRedemptionamount(BigDecimal redemptionamount) { this.redemptionamount = redemptionamount; } public BigDecimal getTotalredemptionamount() { return totalredemptionamount; } public void setTotalredemptionamount(BigDecimal totalredemptionamount) { this.totalredemptionamount = totalredemptionamount; } public Integer getTotalshares() { return totalshares; } public void setTotalshares(Integer totalshares) { this.totalshares = totalshares; } public BigDecimal getTotalamount() { return totalamount; } public void setTotalamount(BigDecimal totalamount) { this.totalamount = totalamount; } public BigDecimal getTotalbalance() { return totalbalance; } public void setTotalbalance(BigDecimal totalbalance) { this.totalbalance = totalbalance; } public BigDecimal getTotalreturn() { return totalreturn; } public void setTotalreturn(BigDecimal totalreturn) { this.totalreturn = totalreturn; } public BigDecimal getTotalrate() { return totalrate; } public void setTotalrate(BigDecimal totalrate) { this.totalrate = totalrate; } public BigDecimal getCurrentreturn() { return currentreturn; } public void setCurrentreturn(BigDecimal currentreturn) { this.currentreturn = currentreturn; } public BigDecimal getCurrentrate() { return currentrate; } public void setCurrentrate(BigDecimal currentrate) { this.currentrate = currentrate; } public BigDecimal getCurrentdividend() { return currentdividend; } public void setCurrentdividend(BigDecimal currentdividend) { this.currentdividend = currentdividend; } }
package com.rana.snptextviewdemo; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Color; import android.graphics.Typeface; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; public class SnpTextView extends LinearLayout { private static final String TYPEFACE_PATH_FONTELLO = "fonts/fontello.ttf"; private static final String TYPEFACE_PATH_DOSIS_BOOK = "fonts/Dosis-Book.ttf"; private static final String TYPEFACE_PATH_DOSIS_BOLD = "fonts/Dosis-Bold.ttf"; private static final String TYPEFACE_PATH_DOSIS_LIGHT = "fonts/Dosis-Light.ttf"; private static final String TYPEFACE_PATH_DOSIS_MEDIUM = "fonts/Dosis-Medium.ttf"; private static final String TYPEFACE_PATH_DOSIS_SEMI_BOLD = "fonts/Dosis-SemiBold.ttf"; private String snp_icon, snp_icon_size, snp_icon_color, snp_text, snp_text_size, snp_text_color; private View view; private TextView tvIcon, tvText; public SnpTextView(Context context) { super(context); initializeComponents(context, null); } public SnpTextView(Context context, AttributeSet attrs) { super(context, attrs); initializeComponents(context, attrs); } public SnpTextView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initializeComponents(context, attrs); } /** * Initialize basic components like your layout view and its objects * * @param context Context * @param attrs AttributeSet */ private void initializeComponents(Context context, AttributeSet attrs) { try { view = LayoutInflater.from(context).inflate(R.layout.snp_text_view, null); tvIcon = (TextView) view.findViewById(R.id.tvIcon); tvText = (TextView) view.findViewById(R.id.tvText); } catch (Exception e) { e.printStackTrace(); } initializeAttributeComponents(context, attrs); setAttributesForIcon(); setAttributesForText(); addView(view); } /** * Function to initialize all attributes of the view * * @param context Context * @param attrs AttributeSet */ private void initializeAttributeComponents(Context context, AttributeSet attrs) { TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.SnpTextView, 0, 0); try { setSnpIcon(typedArray.getString(R.styleable.SnpTextView_snp_icon)); setSnpIconColor(typedArray.getString(R.styleable.SnpTextView_snp_icon_color)); setSnpIconSize(typedArray.getString(R.styleable.SnpTextView_snp_icon_size)); setSnpText(typedArray.getString(R.styleable.SnpTextView_snp_text)); setSnpTextColor(typedArray.getString(R.styleable.SnpTextView_snp_text_color)); setSnpTextSize(typedArray.getString(R.styleable.SnpTextView_snp_text_size)); } finally { typedArray.recycle(); } } /** * Function to set attributes for icon. */ private void setAttributesForIcon() { try { setValueSnpIcon(getSnpIcon()); setValueSnpIconColor(getSnpIconColor()); setValueSnpIconSize(getSnpIconSize()); } catch (NullPointerException e) { e.printStackTrace(); tvIcon.setVisibility(View.GONE); } } public void setValueSnpIcon(String snpIcon) { try { tvIcon.setText(snpIcon); tvIcon.setTypeface(Typeface.createFromAsset(getContext().getAssets(), TYPEFACE_PATH_FONTELLO)); } catch (NullPointerException e) { e.printStackTrace(); } } public void setValueSnpIconColor(String snpIconColor) { try { tvIcon.setTextColor(Color.parseColor(snpIconColor)); } catch (NullPointerException e) { e.printStackTrace(); } } public void setValueSnpIconSize(String snpIconSize) { try { tvIcon.setTextSize(getSize(snpIconSize)); } catch (NullPointerException e) { e.printStackTrace(); } } private int getSize(String snpIconSize) { int size = Integer.parseInt(snpIconSize.substring(0, snpIconSize.length() - 2)); return dpToPx(size); } /** * Function to convert dp to px. * * @param dp int * @return px */ public int dpToPx(int dp) { DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics(); int px = Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); return px; } /** * Function to set attributes for text. */ private void setAttributesForText() { try { setValueSnpText(getSnpText()); setValueSnpTextColor(getSnpTextColor()); setValueSnpTextSize(getSnpTextSize()); } catch (NullPointerException e) { e.printStackTrace(); tvText.setVisibility(View.GONE); } } public void setValueSnpText(String snpText) { try { tvText.setTypeface(Typeface.createFromAsset(getContext().getAssets(), TYPEFACE_PATH_DOSIS_MEDIUM)); tvText.setText(snpText); } catch (NullPointerException e) { e.printStackTrace(); } } public void setValueSnpTextColor(String snpTextColor) { try { tvText.setTextColor(Color.parseColor(snpTextColor)); } catch (NullPointerException e) { e.printStackTrace(); } } public void setValueSnpTextSize(String snpTextSize) { try { tvText.setTextSize(getSize(snpTextSize)); } catch (NullPointerException e) { e.printStackTrace(); } } private String getSnpIcon() { return snp_icon; } private void setSnpIcon(String snp_icon) { this.snp_icon = snp_icon; } private String getSnpIconSize() { return snp_icon_size; } private void setSnpIconSize(String icon_size) { this.snp_icon_size = icon_size; } private String getSnpIconColor() { return snp_icon_color; } private void setSnpIconColor(String icon_color) { this.snp_icon_color = icon_color; } private String getSnpText() { return snp_text; } private void setSnpText(String snp_text) { this.snp_text = snp_text; } private String getSnpTextSize() { return snp_text_size; } private void setSnpTextSize(String text_size) { this.snp_text_size = text_size; } private String getSnpTextColor() { return snp_text_color; } private void setSnpTextColor(String text_color) { this.snp_text_color = text_color; } }
package org.ms.iknow.assertion; import org.junit.Assert; import org.ms.iknow.core.type.Relation; public abstract class StandardAssertionKit { public void assertEquals(Relation expected, Relation actual) { assertEquals(expected.toString(), actual.toString()); } public void assertEquals(String expected, String actual) { Assert.assertEquals(getMessageEquals(expected, actual), expected, actual); } public void assertNotNull(Object object) { Assert.assertNotNull(getMessageNotNull(), object); } public void assertNotNull(String text, Object object) { Assert.assertNotNull(getMessageNotNull(text), object); } public void assertTrue(int expected, int actual) { Assert.assertTrue(getMessageTrue(expected, actual), expected == actual); } public String getMessage(Object expected, Object actual) { return "Expected " + expected + " but found " + actual + "."; } public String getMessageTrue(int expected, int actual) { return getMessageEquals(String.valueOf(expected), String.valueOf(actual)); } public String getMessageTrue(String expected, String actual) { return getMessageEquals(expected, actual); } public String getMessageEquals(int expected, int actual) { return getMessageEquals(String.valueOf(expected), String.valueOf(actual)); } public String getMessageEquals(String expected, String actual) { return "Expected " + expected + " but found " + actual + "."; } public String getMessageNotNull() { return getMessageNotNull("an object"); } public String getMessageNotNull(String text) { return "Expected " + text + " but was null."; } }
package com.edu.miusched.service.impl; import com.edu.miusched.dao.CourseDao; import com.edu.miusched.domain.Course; import com.edu.miusched.service.CourseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class CourseServiceImpl implements CourseService { @Autowired CourseDao courseDao; @Override public List<Course> findAll() { return courseDao.findAll(); } @Override public List<Course> findAllPrerequsite() { return courseDao.findPreRequisiteCourses(); } @Override public Course save(Course coursde) { return courseDao.save(coursde); } @Override public Course findCoursebyId(Long id) { return courseDao.findCourseById(id); } @Override public void deleteCourse(Long id) { courseDao.deleteById(id); } @Override public Course findCourseByCode(String code) { return null; } }
/******************************************************************************* * Copyright (c) 2012, All Rights Reserved. * * Generation Challenge Programme (GCP) * * * This software is licensed for use under the terms of the GNU General Public * License (http://bit.ly/8Ztv8M) and the provisions of Part F of the Generation * Challenge Programme Amended Consortium Agreement (http://bit.ly/KQX1nL) * *******************************************************************************/ package org.generationcp.browser.study.containers; import java.util.ArrayList; import org.generationcp.browser.application.Message; import org.generationcp.commons.exceptions.InternationalizableException; import org.generationcp.middleware.exceptions.MiddlewareQueryException; import org.generationcp.middleware.manager.Database; import org.generationcp.middleware.manager.Operation; import org.generationcp.middleware.manager.Season; import org.generationcp.middleware.manager.api.StudyDataManager; import org.generationcp.middleware.manager.api.TraitDataManager; import org.generationcp.middleware.pojos.Factor; import org.generationcp.middleware.pojos.Scale; import org.generationcp.middleware.pojos.Study; import org.generationcp.middleware.pojos.Trait; import org.generationcp.middleware.pojos.TraitMethod; import org.generationcp.middleware.pojos.Variate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.vaadin.data.Container; import com.vaadin.data.Item; import com.vaadin.data.util.IndexedContainer; public class StudyDataIndexContainer{ private static final Logger LOG = LoggerFactory.getLogger(StudyDataIndexContainer.class); // Factor Object private static final Object FACTOR_NAME = "factorName"; private static final Object VARIATE_NAME = "variateName"; private static final Object DESCRIPTION = "description"; private static final Object PROPERTY_NAME = "propertyName"; private static final Object SCALE_NAME = "scaleName"; private static final Object METHOD_NAME = "methodName"; private static final Object DATATYPE = "dataType"; public static final String STUDY_ID = "ID"; public static final String STUDY_NAME = "NAME"; private StudyDataManager studyDataManager; private TraitDataManager traitDataManager; private int studyId; public StudyDataIndexContainer(StudyDataManager studyDataManager, TraitDataManager traitDataManager, int studyId) { this.studyDataManager = studyDataManager; this.traitDataManager = traitDataManager; this.studyId = studyId; } public IndexedContainer getStudyFactor() throws InternationalizableException { try { IndexedContainer container = new IndexedContainer(); // Create the container properties container.addContainerProperty(FACTOR_NAME, String.class, ""); container.addContainerProperty(DESCRIPTION, String.class, ""); container.addContainerProperty(PROPERTY_NAME, String.class, ""); container.addContainerProperty(SCALE_NAME, String.class, ""); container.addContainerProperty(METHOD_NAME, String.class, ""); container.addContainerProperty(DATATYPE, String.class, ""); ArrayList<Factor> query = (ArrayList<Factor>) studyDataManager.getFactorsByStudyID(studyId); for (Factor f : query) { String description = getFactorDescription(f.getTraitId()); String propertyName = getProperty(f.getTraitId()); String scaleName = getScaleName(f.getScaleId()); String methodName = getMethodName(f.getMethodId()); addFactorData(container, f.getName(), description, propertyName, scaleName, methodName, f.getDataType()); } return container; } catch (MiddlewareQueryException e) { throw new InternationalizableException(e, Message.ERROR_DATABASE, Message.ERROR_IN_GETTING_STUDY_FACTOR); } } private static void addFactorData(Container container, String factorName, String description, String propertyName, String scale, String method, String datatype) { Object itemId = container.addItem(); Item item = container.getItem(itemId); item.getItemProperty(FACTOR_NAME).setValue(factorName); item.getItemProperty(DESCRIPTION).setValue(description); item.getItemProperty(PROPERTY_NAME).setValue(propertyName); item.getItemProperty(SCALE_NAME).setValue(scale); item.getItemProperty(METHOD_NAME).setValue(method); item.getItemProperty(DATATYPE).setValue(datatype); } public IndexedContainer getStudyVariate() throws InternationalizableException { try { IndexedContainer container = new IndexedContainer(); // Create the container properties container.addContainerProperty(VARIATE_NAME, String.class, ""); container.addContainerProperty(DESCRIPTION, String.class, ""); container.addContainerProperty(PROPERTY_NAME, String.class, ""); container.addContainerProperty(SCALE_NAME, String.class, ""); container.addContainerProperty(METHOD_NAME, String.class, ""); container.addContainerProperty(DATATYPE, String.class, ""); ArrayList<Variate> query; query = (ArrayList<Variate>) studyDataManager.getVariatesByStudyID(studyId); for (Variate v : query) { String description = getFactorDescription(v.getTraitId()); String propertyName = getProperty(v.getTraitId()); String scaleName = getScaleName(v.getScaleId()); String methodName = getMethodName(v.getMethodId()); addVariateData(container, v.getName(), description, propertyName, scaleName, methodName, v.getDataType()); } return container; } catch (MiddlewareQueryException e) { throw new InternationalizableException(e, Message.ERROR_DATABASE, Message.ERROR_IN_GETTING_STUDY_VARIATE); } } private static void addVariateData(Container container, String variateName, String description, String propertyName, String scale, String method, String datatype) { Object itemId = container.addItem(); Item item = container.getItem(itemId); item.getItemProperty(VARIATE_NAME).setValue(variateName); item.getItemProperty(DESCRIPTION).setValue(description); item.getItemProperty(PROPERTY_NAME).setValue(propertyName); item.getItemProperty(SCALE_NAME).setValue(scale); item.getItemProperty(METHOD_NAME).setValue(method); item.getItemProperty(DATATYPE).setValue(datatype); } private String getFactorDescription(int traitId) throws MiddlewareQueryException{ String factorDescription = ""; Trait trait = traitDataManager.getTraitById(traitId); if (!(trait == null)) { factorDescription = trait.getDescripton(); } return factorDescription; } private String getProperty(int traitId) throws MiddlewareQueryException { String propertyName = ""; Trait trait = traitDataManager.getTraitById(traitId); if (!(trait == null)) { propertyName = trait.getName(); } return propertyName; } private String getScaleName(int scaleId) throws MiddlewareQueryException { String scaleName = ""; Scale scale = traitDataManager.getScaleByID(scaleId); if (!(scale == null)) { scaleName = scale.getName(); } return scaleName; } private String getMethodName(int methodId) throws MiddlewareQueryException{ String methodName = ""; TraitMethod method = traitDataManager.getTraitMethodById(methodId); if (!(method == null)) { methodName = method.getName(); } return methodName; } public IndexedContainer getStudies(String name, String country, Season season, Integer date) throws InternationalizableException { IndexedContainer container = new IndexedContainer(); // Create the container properties container.addContainerProperty(STUDY_ID, Integer.class, ""); container.addContainerProperty(STUDY_NAME, String.class, ""); ArrayList<Study> studies = new ArrayList<Study>(); try { if (date != null) { // Get from central studies.addAll(studyDataManager.getStudyBySDate(date, 0, (int) studyDataManager.countStudyBySDate(date, Operation.EQUAL, Database.CENTRAL), Operation.EQUAL, Database.CENTRAL)); // Get from central studies.addAll(studyDataManager.getStudyBySDate(date, 0, (int) studyDataManager.countStudyBySDate(date, Operation.EQUAL, Database.LOCAL), Operation.EQUAL, Database.LOCAL)); } if (name != null) { // Get from central studies.addAll(studyDataManager.getStudyByName(name, 0, (int) studyDataManager.countStudyByName(name, Operation.EQUAL, Database.CENTRAL), Operation.EQUAL, Database.CENTRAL)); // Get from central studies.addAll(studyDataManager.getStudyByName(name, 0, (int) studyDataManager.countStudyByName(name, Operation.EQUAL, Database.LOCAL), Operation.EQUAL, Database.LOCAL)); } if (country != null) { // Get from central studies.addAll(studyDataManager.getStudyByCountry(country, 0, (int) studyDataManager.countStudyByCountry(country, Operation.EQUAL, Database.CENTRAL), Operation.EQUAL, Database.CENTRAL)); // Get from central studies.addAll(studyDataManager.getStudyByCountry(country, 0, (int) studyDataManager.countStudyByCountry(country, Operation.EQUAL, Database.LOCAL), Operation.EQUAL, Database.LOCAL)); } if (season != null) { // Get from central studies.addAll(studyDataManager.getStudyBySeason(season, 0, (int) studyDataManager.countStudyBySeason(season, Database.CENTRAL), Database.CENTRAL)); // Get from central studies.addAll(studyDataManager.getStudyBySeason(season, 0, (int) studyDataManager.countStudyBySeason(season, Database.LOCAL), Database.LOCAL)); } } catch (MiddlewareQueryException e) { LOG.error("Error encountered while searching for studies", e); throw new InternationalizableException(e, Message.ERROR_DATABASE, Message.ERROR_PLEASE_CONTACT_ADMINISTRATOR); } for (Study study : studies) { addStudyData(container, study.getId(), study.getName()); } return container; } private static void addStudyData(Container container, Integer id, String name) { Object itemId = container.addItem(); Item item = container.getItem(itemId); item.getItemProperty(STUDY_ID).setValue(id); item.getItemProperty(STUDY_NAME).setValue(name); } }
package com.ahmetkizilay.yatlib4j.streaming; import com.ahmetkizilay.yatlib4j.oauthhelper.OAuthHolder; public class GetSiteStream { private static final String BASE_URL = "https://sitestream.twitter.com/1.1/site.json"; private static final String HTTP_METHOD = "GET"; public static GetSiteStream.Response sendRequest(GetSiteStream.Parameters params, OAuthHolder oauthHolder) { throw new UnsupportedOperationException(); } public static class Response { } public static class Parameters { } }
package org.timer.read; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; /** * @Description * @Author: Administrator * @Date : 2019/10/18 14 18 */ @RestController @RefreshScope public class ProperController { @Value("${info.from}") String from; @GetMapping("/proper") public String dc(){ return "dd"+from; } }
package com.lti.collections; import java.util.TreeMap; public class TreeMapExample { public static void main(String[] args) { System.out.println("Tree Map Example!"); TreeMap <Integer,String> tMap= new TreeMap<Integer,String>(); tMap.put(1,"Sunday"); tMap.put(2,"Monday"); tMap.put(3,"Tuesday"); tMap.put(4,"Wednesday"); tMap.put(5,"Thursday"); tMap.put(6,"Friday"); System.out.println("keys of tree map: "+tMap.keySet()); System.out.println("Values of tree map: "+tMap.values()); System.out.println("Key: 5 value:" +tMap.get(5)+"\n"); System.out.println("Removing first data: " + tMap.remove(tMap.firstKey())); System.out.println("Now the tree map Keys: " + tMap.keySet()); System.out.println("Now the tree map contain: " + tMap.values() + "\n"); System.out.println("Removing last data: " + tMap.remove(tMap.lastKey())); System.out.println("Now the tree map Keys: " + tMap.keySet()); System.out.println("Now the tree map contain: " + tMap.values()); } }
package com.yt.s_server.home; import android.content.Context; import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.yt.s_server.R; import java.util.ArrayList; public class LeaveAdapter extends ArrayAdapter<Leave> { private int resourceId; public LeaveAdapter(Context context, int textViewResourceId, final ArrayList<Leave> objects, boolean dm) { super(context, textViewResourceId, objects); resourceId = textViewResourceId; } @Override public View getView(int position, View convertView, ViewGroup parent) { final Leave leave = getItem(position); View view; if (convertView == null) { view = LayoutInflater.from(getContext()).inflate(resourceId, parent, false); } else { view = convertView; } TextView type = view.findViewById(R.id.tv_leaveType); TextView id = view.findViewById(R.id.tv_leaveId); TextView status = view.findViewById(R.id.tv_leaveStatus); TextView time = view.findViewById(R.id.tv_leaveTime); TextView reason = view.findViewById(R.id.tv_leaveReason); switch (leave.getType()) { case "1": type.setText("事假"); break; case "2": type.setText("病假"); break; case "3": type.setText("公假"); break; default: type.setText("未知"); } id.setText(leave.getId()); //格式转换时间 String[] arr = leave.getDateCreated().split(String.valueOf('T')); String[] darr = arr[1].split(String.valueOf('Z')); String shijian = arr[0] + "\n" + darr[0]; time.setText(shijian); reason.setText(leave.getReason()); switch (leave.getStatus()){ case "CREATED": status.setText("未提交"); status.setBackgroundColor(Color.rgb(185,185,185)); break; case "SUBMITTED": status.setText("待审核"); status.setBackgroundColor(Color.rgb(240,180,100)); break; case "APPROVED": status.setText("已审批"); status.setBackgroundColor(Color.rgb(94,169,128)); break; case "REJECTED": status.setText("退回"); status.setBackgroundColor(Color.rgb(200,65,70)); break; case "FINISHED": status.setText("完成"); status.setBackgroundColor(Color.rgb(33,127,67)); break; default: status.setText("未知"); status.setBackgroundColor(Color.rgb(69,75,79)); } return view; } }
package cn.yhd.base; import com.github.pagehelper.PageInfo; import org.apache.ibatis.annotations.Param; import java.util.List; public interface IBaseV2Service<Recode,Condition> { /** * @param record 记录 * @return */ int insert(Recode record); /** * @param condition 条件 * @return */ List<Recode> selectByCondition(Condition condition); /** * @param id 主键 * @return */ <T> Recode selectById(T id); /** * @param record 根据主键更新 * @return */ int update(Recode record); /** * @param id 主键 * @return */ <T> int delete(T id); /** * @param condition 调价 * @param pageNo 页码 * @param pageSize 单页数 * @return */ PageInfo<Recode> selectByConditionForPage(Condition condition, Integer pageNo, Integer pageSize); }
package com.tencent.mm.ac; import android.net.Uri; import com.tencent.mm.kernel.g; import com.tencent.mm.modelgeo.a.a; import com.tencent.mm.modelgeo.c; import com.tencent.mm.modelstat.o; import com.tencent.mm.plugin.messenger.foundation.a.i; import com.tencent.mm.protocal.c.pd; import com.tencent.mm.sdk.e.m.b; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.storage.bd; import com.tencent.mm.y.l; import com.tencent.mm.y.m; import java.util.Iterator; import java.util.LinkedList; public final class k { private a cXs; int dMl; private c dMm; private int dMn; int dMo; boolean dMp; b dMq; String userName; protected k() { this.userName = null; this.dMl = 0; this.dMn = 2; this.dMo = 10; this.dMp = false; this.dMq = new 1(this); this.cXs = new a() { long lastReportTime = 0; public final boolean a(boolean z, float f, float f2, int i, double d, double d2, double d3) { if (!z) { return true; } x.i("MicroMsg.ReportLocation", "LBSManager notify. lat:%f, lng:%f", new Object[]{Float.valueOf(f2), Float.valueOf(f)}); if (bi.VE() >= this.lastReportTime + ((long) k.this.dMo)) { k.a(k.this.userName, 11, 0, f2, f, (int) d2, null); this.lastReportTime = bi.VE(); } if (k.this.dMl == 2) { k.this.MR(); } if (!k.this.dMp) { k.this.dMp = true; o.a(2013, f, f2, (int) d2); } return true; } }; this.dMo = bi.getInt(((com.tencent.mm.plugin.zero.b.a) g.l(com.tencent.mm.plugin.zero.b.a.class)).AU().G("BrandService", "continueLocationReportInterval"), 5); if (this.dMo < this.dMn) { this.dMo = this.dMn; } x.i("MicroMsg.ReportLocation", "reportLocation interval %d", new Object[]{Integer.valueOf(this.dMo)}); } public final void b(final String str, final bd bdVar) { if (bdVar == null || !bdVar.cky()) { a(str, 10, 0, 0.0f, 0.0f, 0, null); } else { g.Em().H(new Runnable() { public final void run() { LinkedList linkedList = new LinkedList(); l wS = ((com.tencent.mm.plugin.biz.a.a) g.l(com.tencent.mm.plugin.biz.a.a.class)).wS(bdVar.field_content); if (wS == null || bi.cX(wS.dzs)) { k.a(str, 10, 0, 0.0f, 0.0f, 0, null); return; } Iterator it = wS.dzs.iterator(); while (it.hasNext()) { m mVar = (m) it.next(); String str = mVar.url; if (!bi.oW(str)) { Uri parse = Uri.parse(str); try { String queryParameter = parse.getQueryParameter("mid"); str = parse.getQueryParameter("idx"); pd pdVar = new pd(); pdVar.rty = bi.getLong(queryParameter, 0); pdVar.mQH = bi.getInt(str, 0); pdVar.bPS = mVar.dzH; pdVar.path = mVar.dzE; linkedList.add(pdVar); } catch (UnsupportedOperationException e) { x.w("MicroMsg.ReportLocation", "UnsupportedOperationException %s", new Object[]{e.getMessage()}); } } } k.a(str, 10, 0, 0.0f, 0.0f, 0, linkedList); } }); } } public static void kS(String str) { a(str, 12, 0, 0.0f, 0.0f, 0, null); } public final void kT(String str) { x.i("MicroMsg.ReportLocation", "Start report"); this.userName = str; d kH = f.kH(str); if (kH != null) { if (this.dMl != 0) { MR(); } this.dMl = 0; if (kH.LS()) { x.i("MicroMsg.ReportLocation", "need update contact %s", new Object[]{str}); com.tencent.mm.aa.c.jN(str); } d.b bG = kH.bG(false); if (bG == null) { return; } if (bG.LU() && kH.LR()) { this.dMm = c.OB(); bG = kH.bG(false); if (bG.dKT != null) { boolean z; if (bi.getInt(bG.dKT.optString("ReportLocationType"), 0) == 2) { z = true; } else { z = false; } bG.dLg = z; } this.dMl = bG.dLg ? 3 : 2; if (c.OC() || c.OD()) { this.dMm.a(this.cXs, true); } else { a(str, 11, 2, 0.0f, 0.0f, 0, null); } } else if (bG.LU() && !kH.LR()) { a(str, 11, 1, 0.0f, 0.0f, 0, null); } } } public final void MR() { x.i("MicroMsg.ReportLocation", "Stop report"); this.dMl = 0; if (this.dMm != null) { this.dMm.c(this.cXs); } if (g.Eg().Dx()) { ((i) g.l(i.class)).FR().b(this.dMq); } } private static void a(String str, int i, int i2, float f, float f2, int i3, LinkedList<pd> linkedList) { String str2; if (i2 == 3) { str2 = "<event></event>"; } else { str2 = String.format("<event><location><errcode>%d</errcode><data><latitude>%f</latitude><longitude>%f</longitude><precision>%d</precision></data></location></event>", new Object[]{Integer.valueOf(i2), Float.valueOf(f), Float.valueOf(f2), Integer.valueOf(i3)}); } x.i("MicroMsg.ReportLocation", "doScene, info: %s", new Object[]{str2}); g.Eh().dpP.a(new q(str, i, str2, linkedList), 0); } }
package com.anibal.educational.rest_service.comps.service; import com.anibal.educational.rest_service.comps.util.RestServiceException; @SuppressWarnings("serial") public class SubprojectServiceException extends RestServiceException{ public SubprojectServiceException() { } public SubprojectServiceException(String message) { super(message); } public SubprojectServiceException(Throwable cause) { super(cause); } public SubprojectServiceException(String message, Throwable cause) { super(message, cause); } }
package br.com.jogoaps; import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class Pergunta33 extends JFrame implements ActionListener { /** * */ private static final long serialVersionUID = 8926880932667440251L; private JButton imagemSair; private JButton respostaA; private JButton respostaB; private JButton respostaC; private JButton respostaD; private JPanel tela; private JLabel imagem; private JLabel pergunta; private double pontuacao = 0; private String nomeJogador; public Pergunta33(double pontuacao, String nomeJogador) { this.pontuacao = pontuacao; this.nomeJogador = nomeJogador; setTitle("33º PERGUNTA"); setSize(900, 600); setResizable(false); setLocation(50, 50); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ImageIcon icon = new ImageIcon(getClass().getClassLoader().getResource("z1.jpg")); imagem = new JLabel(icon); imagem.setLocation(0, 0); imagem.setSize(900, 600); pergunta = new JLabel( "<html>33 - Considerando a riqueza dos recursos hídricos brasileiros, uma grave crise de<br>" + "água em nosso país poderia ser motivada por ?</htmal>"); pergunta.setLocation(20, 20); pergunta.setSize(800, 200); pergunta.setFont(new Font("arial", Font.BOLD, 20)); pergunta.setForeground(Color.black); ImageIcon img3 = new ImageIcon(getClass().getClassLoader().getResource("b.png")); imagemSair = new JButton("", img3); imagemSair.setSize(120, 50); imagemSair.setLocation(380, 480); imagemSair.addActionListener(this); imagemSair.setFont(new Font("arial", Font.BOLD, 22)); imagemSair.setBackground(Color.red); imagemSair.setFocusable(false); imagemSair.setContentAreaFilled(false); imagemSair.setForeground(Color.red); imagemSair.setContentAreaFilled(false); imagemSair.setBorderPainted(false); respostaA = new JButton( "A) Ausência de reservas de águas subterrâneas"); respostaA.setSize(600, 50); respostaA.setLocation(25, 160); respostaA.addActionListener(this); respostaA.setFont(new Font("arial", Font.BOLD, 22)); respostaA.setBackground(Color.red); respostaA.setFocusable(false); respostaA.setContentAreaFilled(false); respostaA.setForeground(Color.black); respostaA.setBorderPainted(false); respostaB = new JButton( "B) Escassez de rios e de grandes bacias hidrográficas"); respostaB.setSize(600, 50); respostaB.setLocation(55, 220); respostaB.addActionListener(this); respostaB.setFont(new Font("arial", Font.BOLD, 22)); respostaB.setBackground(Color.red); respostaB.setFocusable(false); respostaB.setContentAreaFilled(false); respostaB.setForeground(Color.black); respostaB.setBorderPainted(false); respostaC = new JButton( "C) Falta de tecnologia para retirar o sal da água do mar"); respostaC.setSize(600, 50); respostaC.setLocation(55, 280); respostaC.addActionListener(this); respostaC.setFont(new Font("arial", Font.BOLD, 22)); respostaC.setBackground(Color.green); respostaC.setFocusable(false); respostaC.setContentAreaFilled(false); respostaC.setForeground(Color.black); respostaC.setBorderPainted(false); respostaD = new JButton( "D) Degradação dos mananciais e desperdício no consumo");// VERDADE respostaD.setSize(700, 50); respostaD.setLocation(20, 340); respostaD.addActionListener(this); respostaD.setFont(new Font("arial", Font.BOLD, 22)); respostaD.setBackground(Color.red); respostaD.setFocusable(false); respostaD.setContentAreaFilled(false); respostaD.setForeground(Color.black); respostaD.setBorderPainted(false); tela = new JPanel(); tela.setSize(900, 600); tela.setLocation(0, 0); tela.setBackground(Color.black); tela.setLayout(null); getContentPane().setLayout(null); tela.add(pergunta); getContentPane().add(imagemSair); getContentPane().add(respostaA); getContentPane().add(respostaB); getContentPane().add(respostaC); getContentPane().add(respostaD); getContentPane().add(tela); tela.add(imagem); } public void actionPerformed(ActionEvent e) { if (e.getSource() == respostaA) { Pergunta34 obj35 = new Pergunta34(pontuacao, nomeJogador); obj35.setVisible(true); dispose(); } if (e.getSource() == respostaB) { Pergunta34 obj35 = new Pergunta34(pontuacao, nomeJogador); obj35.setVisible(true); dispose(); } if (e.getSource() == respostaC) { Pergunta34 obj35 = new Pergunta34(pontuacao, nomeJogador); obj35.setVisible(true); dispose(); } if (e.getSource() == respostaD) { pontuacao += 2.5; Pergunta34 obj35 = new Pergunta34(pontuacao, nomeJogador); obj35.setVisible(true); dispose(); } if (e.getSource() == imagemSair) { System.exit(0); } } }
package Initial; public class RuntimeException extends Exception { }
package com.mch.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import lombok.extern.slf4j.Slf4j; @Slf4j @Controller @RequestMapping(value="person") public class PersonController { @RequestMapping("/index") public String index(){ return "index"; } }
package extra_Practices; public class colours { public void draw() { System.out.println("Drawig picure with colours"); } } class purble extends colours { public void draw () { System.out.println("Drawing picture with purble colour"); } }
package model; import java.util.Date; import java.util.Map; public class Recruitment { private String MPReqId; private String candidateId; private String recPhase; private Date phaseDate; private String interviewerId; private String remark; private String result; public String getResult() { return result; } public void setResult(String result) { this.result = result; } public String getMPReqId() { return MPReqId; } public void setMPReqId(String mPReqId) { MPReqId = mPReqId; } public String getCandidateId() { return candidateId; } public void setCandidateId(String candidateId) { this.candidateId = candidateId; } public String getRecPhase() { return recPhase; } public void setRecPhase(String recPhase) { this.recPhase = recPhase; } public Date getPhaseDate() { return phaseDate; } public void setPhaseDate(Date phaseDate) { this.phaseDate = phaseDate; } public String getInterviewerId() { return interviewerId; } public void setInterviewerId(String interviewerId) { this.interviewerId = interviewerId; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public void convertFromMap(Map<String, Object> m) { MPReqId = (String) m.get("ID"); candidateId = (String) m.get("CandidateNo"); recPhase = (String) m.get("Phase"); phaseDate = (Date) m.get("PhaseDate"); interviewerId = (String) m.get("Interview"); result = (String) m.get("Result"); remark = (String) m.get("Remarks"); } }
package org.wicket_sapporo.workshop01.page.template.replace_pattern.panel; import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.markup.html.panel.Panel; import org.wicket_sapporo.workshop01.page.template.replace_pattern.BasePage; import org.wicket_sapporo.workshop01.page.template.replace_pattern.Content03Page; import org.wicket_sapporo.workshop01.page.template.replace_pattern.Content04Page; public class MenuPanel extends Panel { private static final long serialVersionUID = -3774804441628004438L; public MenuPanel(String id) { super(id); add(new Link<Void>("toBasePage") { private static final long serialVersionUID = -1750685177996860329L; @Override public void onClick() { setResponsePage(BasePage.class); } }); add(new Link<Void>("toContent03Page") { private static final long serialVersionUID = 5375534238825665828L; @Override public void onClick() { setResponsePage(Content03Page.class); } }); add(new Link<Void>("toContent04Page") { private static final long serialVersionUID = 7756105161688137033L; @Override public void onClick() { setResponsePage(Content04Page.class); } }); } }
package edu.kit.pse.osip.core.io.networking; import static org.junit.Assert.assertEquals; import org.junit.Test; /** * Test class for RemoteMachine. * * @author Maximilian Schwarzmann * @version 1.0 */ public class RemoteMachineTest { /** * Tests getter of host name. */ @Test public void testHostnameGetter() { RemoteMachine machine = new RemoteMachine("mac", 10); assertEquals("mac", machine.getHostname()); } /** * Tests getter of port. */ @Test public void testPortGetter() { RemoteMachine machine = new RemoteMachine("mac", 10); assertEquals(10, machine.getPort()); } }
package com.yoyuapp.sqlbuilder; public class SelectTableSegment extends QuerySql{ private boolean joinedTable; public WhereSql where (WhereSegment conj){ WhereSql orderBy = new WhereSql(); orderBy.sb = this.sb; orderBy.sb.append(" WHERE ").append(conj.sb); orderBy.params = this.params; orderBy.params.addAll(conj.getParams()); return orderBy; } public SelectTableSegment leftJoin(SqlTable table, SqlColumn onColumn1, SqlColumn onColumn2){ return toJoin(" LEFT JOIN ", table, onColumn1, onColumn2); } public SelectTableSegment rightJoin(SqlTable table, SqlColumn onColumn1, SqlColumn onColumn2){ return toJoin(" RIGHT JOIN ", table, onColumn1, onColumn2); } public SelectTableSegment join(SqlTable table, SqlColumn onColumn1, SqlColumn onColumn2){ return toJoin(" JOIN ", table, onColumn1, onColumn2); } private SelectTableSegment toJoin(String joinSymbol, SqlTable table, SqlColumn onColumn1, SqlColumn onColumn2){ if (joinedTable){ sb.append(","); } sb.append(joinSymbol).append(table.getName()).append(" ON ").append(onColumn1.sb).append(" = ").append(onColumn2.sb); joinedTable = true; return this; } }
package com.example.demo.ocp.bad; public class Square { private Point[] points; private int size = 0; public Square(Point p1, Point p2, Point p3, Point p4) { this.points = new Point[4]; this.points[0] = p1; this.points[1] = p2; this.points[2] = p3; this.points[3] = p4; this.size = 4; } public Square(Point p1, Point p2, Point p3) { this.points = new Point[3]; this.points[0] = p1; this.points[1] = p2; this.points[2] = p3; this.size = 3; } public String getType(){ if(this.size == 3 ) return "triangle"; else return "carré"; } }
package com.chongmeng.chongmeng.wxapi; import com.jarvan.fluwx.wxapi.FluwxWXEntryActivity; import com.umeng.socialize.weixin.view.WXCallbackActivity; //public class WXEntryActivity extends FluwxWXEntryActivity { public class WXEntryActivity extends WXCallbackActivity { }
package com.mx.profuturo.bolsa.model.reports.response; /* * * por nivel de puesto * por analista * por mes * */ public class HiringsResponse extends AbstractFiltersResponse{ private String tituloVacante; private String fecha; private String contratacion; private String nivelPuesto; private String analista; private String mes; public String getTituloVacante() { return tituloVacante; } public void setTituloVacante(String tituloVacante) { this.tituloVacante = tituloVacante; } public String getFecha() { return fecha; } public void setFecha(String fecha) { this.fecha = fecha; } public String getContratacion() { return contratacion; } public void setContratacion(String contratacion) { this.contratacion = contratacion; } public String getNivelPuesto() { return nivelPuesto; } public void setNivelPuesto(String nivelPuesto) { this.nivelPuesto = nivelPuesto; } public String getAnalista() { return analista; } public void setAnalista(String analista) { this.analista = analista; } public String getMes() { return mes; } public void setMes(String mes) { this.mes = mes; } }
package org.dmonix.net; import java.io.*; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; /** * The class is used to parse out information from a HTTP POST body. * <p> * Copyright: Copyright (c) 2005 * </p> * <p> * Company: dmonix.org * </p> * * @author Peter Nerg * @since 1.0 */ public class HTTPRequestParser { /** The logger instance for this class */ private static final Logger log = Logger.getLogger(HTTPRequestParser.class.getName()); private DataInputStream istream; private long contentLength; private Hashtable<String, String> requestParameters = new Hashtable<String, String>(); private Vector<String> fileNameList = new Vector<String>(); private int totalBytesRead = 0; private File fileDir = null; public HTTPRequestParser(InputStream istream, long contentLength) throws IOException { this(istream, contentLength, null); } public HTTPRequestParser(InputStream istream, long contentLength, File fileDir) throws IOException { log.fine("ContentLength = " + contentLength); this.istream = new DataInputStream(istream); this.contentLength = contentLength; this.fileDir = fileDir; parseStream(); } /** * Get the value of a specified parameter * * @param name * The parameter * @return the value of null if not found */ public String getParameter(String name) { Object o = requestParameters.get(name); if (o == null) return null; else return o.toString(); } /** * Get a list of all parameter names * * @return The parameter names */ public Enumeration getParameterNames() { return this.requestParameters.keys(); } /** * Retruns a list with the names of all files that where stored from the request body. * * @return The file names */ public Enumeration getFileNames() { return this.fileNameList.elements(); } private void parseStream() throws IOException { while (readStreamUntilDelimiter().length() != 0 && totalBytesRead < contentLength) { parseParameter(); } } private void parseParameter() throws IOException { if (log.isLoggable(Level.FINE)) log.fine("found parameter to parse at byte " + totalBytesRead); String dataType = readStreamUntilDelimiter(); /** * It's a file */ if (dataType.indexOf("filename=\"") > 0 && fileDir != null) { parseFile(dataType.substring(dataType.indexOf("filename=\"") + 10, dataType.lastIndexOf("\""))); } /** * It's a parameter */ else { String name = dataType.substring(dataType.indexOf("name=\"") + 6, dataType.lastIndexOf("\"")); /** * If the parameter has a content-type declaration then read that line and then read the last two CRLF characters Otherwise the first read has * already remove the CRLF characters. */ if (readStreamUntilDelimiter().length() > 0) { readStreamUntilDelimiter(); } String value = readStreamUntilDelimiter().trim(); requestParameters.put(name, value); } } /** * Parse the file data from the stream and store the file * * @param fileName * The name of the file * @throws IOException */ private void parseFile(String fileName) throws IOException { // in case the name is specified with a path then remove the path int index = fileName.lastIndexOf("\\"); if (index > -1) { fileName = fileName.substring(index + 1); } this.fileNameList.add(fileName); if (log.isLoggable(Level.FINE)) log.fine("found file to parse at byte " + totalBytesRead + " : " + fileName); readStreamUntilDelimiter(); skipBytes(2); byte[] dataArray = new byte[] { -1, -1, -1, -1 }; int imageSize = 0; int readCounter = 0; File ouputFile = new File(fileDir, fileName); BufferedOutputStream ostream = new BufferedOutputStream(new FileOutputStream(ouputFile)); while (totalBytesRead < contentLength) { totalBytesRead++; for (int i = 0; i < 3; i++) { dataArray[i] = dataArray[i + 1]; } dataArray[3] = istream.readByte(); readCounter++; if (dataArray[0] == 0x0D && dataArray[1] == 0x0A && dataArray[2] == 0x2D && dataArray[3] == 0x2D) { ostream.flush(); ostream.close(); if (log.isLoggable(Level.FINE)) log.fine("Wrote " + imageSize + " bytes for the image"); return; } else if (readCounter >= 4) { ostream.write(dataArray[0]); imageSize++; } } log.log(Level.WARNING, "Exceeded input buffer size, deleting output file!"); ostream.flush(); ostream.close(); ouputFile.delete(); } /** * Read the stream until #0D and #0A are encountered. * * @return Return the string representation of the read data * @throws IOException */ private String readStreamUntilDelimiter() throws IOException { StringBuffer sb = new StringBuffer(); byte currentByte = 0, prevByte; while (totalBytesRead < contentLength) { totalBytesRead++; prevByte = currentByte; if ((currentByte = istream.readByte()) == 0x0A && prevByte == 0x0D) break; sb.append(new String(new byte[] { currentByte })); } if (log.isLoggable(Level.FINE)) log.fine("readStreamUntilDelimiter\n" + sb.toString().trim()); return sb.toString().trim(); } /** * Skips a specified number of bytes in the input stream * * @param bytesToSkip * Number of bytes to skip * @throws IOException */ private void skipBytes(int bytesToSkip) throws IOException { for (int i = 0; i < bytesToSkip; i++) { istream.read(); totalBytesRead++; } } }
package com.tencent.mm.ui.transmit; import android.view.View; import android.view.View.OnClickListener; class ShareImageSelectorUI$1 implements OnClickListener { final /* synthetic */ ShareImageSelectorUI uET; ShareImageSelectorUI$1(ShareImageSelectorUI shareImageSelectorUI) { this.uET = shareImageSelectorUI; } public final void onClick(View view) { ShareImageSelectorUI.a(this.uET); } }
package asu.shell.sh; import asu.shell.sh.commands.Cmd; import asu.shell.sh.commands.Command; import asu.shell.sh.commands.JsCommandWrapper; import asu.shell.sh.commands.ShellCommandWrapper; import asu.shell.sh.util.EnvManager; import java.io.File; import java.io.FileFilter; import java.util.*; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; import me.asu.util.ClassUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class RegisterCommand { private static final Logger log = LoggerFactory.getLogger(RegisterCommand.class); private static Lock lock = new ReentrantLock(); private static Map<String, Command> commands = new HashMap<String, Command>(); static { initial(); } public static void register(String key, Command cmd) { lock.lock(); commands.put(key, cmd); lock.unlock(); } public static void unregister(String key) { lock.lock(); if (commands.containsKey(key)) { commands.remove(key); } lock.unlock(); } public static Command getCommand(String key) { return commands.get(key); } public static String[] getCommandList() { String[] keys = commands.keySet().toArray(new String[0]); return keys; } public static void removeAllCommands() { lock.lock(); commands.clear(); lock.unlock(); } public static void reload() { // URL[] externalURLs = new URL[]{ new URL( // "file:../TestHotDeployImpl/bin/" )}; // cl = new URLClassLoader(externalURLs); // catClass = cl.loadClass( "com.unmi.CatImpl" ); // FIXME: 没有重新加载类。 removeAllCommands(); initial(); } public static void initial() { initJavaCommands(); initScriptCommands(); initShellCommands(); initLinuxToolsInWindowsCommands(); } private static void initLinuxToolsInWindowsCommands() { String os = (String) EnvManager.getContextValue("os.name"); if (os != null && os.contains("Windows")) { // load the linux programs File f = new File("linuxtools"); if (f.isDirectory()) { File[] shfiles = f.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.getName().endsWith(".exe") || !pathname.getName().contains("."); } }); if (shfiles != null) { for (File file : shfiles) { try { ShellCommandWrapper cmd = new ShellCommandWrapper(file.getAbsolutePath()); String name = file.getName(); int lastdot = name.lastIndexOf('.'); if (lastdot != -1) { name = name.substring(0, lastdot); } register(name, cmd); } catch (Exception e) { log.error("", e); } } } } } } private static void initShellCommands() { File f = new File("shell"); if (f.isDirectory()) { File[] shfiles = f.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.getName().endsWith(".sh") || pathname.getName().endsWith(".bat"); } }); if (shfiles != null) { for (File file : shfiles) { try { ShellCommandWrapper cmd = new ShellCommandWrapper(file.getAbsolutePath()); String name = file.getName(); int lastdot = name.lastIndexOf('.'); if (lastdot != -1) { name = name.substring(0, lastdot); } register(name, cmd); } catch (Exception e) { log.error("", e); } } } } } private static void initScriptCommands() { // load the scripts File f = new File("script"); if (f.isDirectory()) { File[] jsfiles = f.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.getName().endsWith(".js"); } }); if (jsfiles != null) { for (File js : jsfiles) { try { JsCommandWrapper cmd = new JsCommandWrapper(js.getAbsolutePath()); String name = cmd.getCmd(); register(name, cmd); } catch (Exception e) { log.error("", e); } } } } } private static void initJavaCommands() { Set<Class<?>> cmds = ClassUtils.getClasses("asu.shell.sh.commands"); if (!cmds.isEmpty() ) { List<Class<?>> collect = cmds.stream() .filter(clazz -> clazz.isAnnotationPresent(Cmd.class)) .collect(Collectors.toList()); if (!collect.isEmpty()) { for (Class<?> clazz : cmds) { Cmd a = clazz.getAnnotation(Cmd.class); if (a == null) { continue; } String name = a.value(); if (StringUtils.isEmpty(name)) { name = clazz.getSimpleName().toLowerCase(); } try { Command cmd = (Command) ClassUtils.newInstance(clazz); register(name, cmd); } catch (Exception e) { log.error("", e); } } } } } }
package com.example.libreriaparcial.entities; import lombok.*; import org.hibernate.envers.Audited; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; @Entity @Table(name = "autor") @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Builder @Audited public class Autor extends Base { @Column(name = "nombre") private String nombre; @Column(name = "apellido") private String apellido; @Column(name = "biografia", length = 1500) private String biografia; }
package com.edinarobotics.zeppelin.subsystems; import com.ctre.CANTalon; import com.edinarobotics.utils.subsystems.Subsystem1816; import edu.wpi.first.wpilibj.Solenoid; public class Collector extends Subsystem1816 { private CANTalon collector; private CollectorState state; private Solenoid solenoid; public Collector(int collector, int pcmID, int solenoidPort) { this.collector = new CANTalon(collector); this.collector.setInverted(true); this.solenoid = new Solenoid(pcmID, solenoidPort); this.solenoid.set(false); state = CollectorState.OFF; } public void setCollectorState(CollectorState state) { this.state = state; update(); } public void actuateCollector(boolean value) { solenoid.set(value); } @Override public void update() { collector.set(state.getSpeed()); } public enum CollectorState { OFF(0.0), FORWARDS(1.0), REVERSE(-1.0); private double speed; CollectorState(double speed) { this.speed = speed; } public double getSpeed() { return speed; } } }
package com.tencent.mm.e.a; import android.content.Context; import com.tencent.mm.compatible.b.f; import com.tencent.mm.compatible.e.q; import com.tencent.mm.e.a.a.3; import com.tencent.mm.plugin.f.a; import com.tencent.mm.sdk.platformtools.ah; import com.tencent.mm.sdk.platformtools.as; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; class a$3$1 implements Runnable { final /* synthetic */ 3 bCX; a$3$1(3 3) { this.bCX = 3; } public final void run() { try { if (q.deN.dbH == 1) { Thread.sleep(300); } x.i("MicroMsg.SceneVoicePlayer", "onCompletion, intOnCompletion: %s, shouldPlayComplete: %s", new Object[]{a.e(this.bCX.bCV), Boolean.valueOf(a.f(this.bCX.bCV))}); ah.A(new Runnable() { public final void run() { f.yz().e(a.g(a$3$1.this.bCX.bCV), false, false); if (a.f(a$3$1.this.bCX.bCV)) { as$b as_b; Context h = a.h(a$3$1.this.bCX.bCV); int i = a.f.play_completed; boolean g = a.g(a$3$1.this.bCX.bCV); 1 1 = new 1(this); if (g) { as_b = as$b.ON; } else { as_b = as$b.OFF; } as.a(h, i, as_b, 1); } else { x.i("MicroMsg.SceneVoicePlayer", "play sound end onCompletion"); if (!a$3$1.this.bCX.bCV.isPlaying()) { f.yz().b(a$3$1.this.bCX.bCV); x.i("MicroMsg.SceneVoicePlayer", "onCompletion() continuousPlay:%s", new Object[]{Boolean.valueOf(a.i(a$3$1.this.bCX.bCV))}); if (!a.i(a$3$1.this.bCX.bCV)) { f.yz().yC(); } a.j(a$3$1.this.bCX.bCV); a.c(a$3$1.this.bCX.bCV); f.yz().setMode(0); x.i("MicroMsg.SceneVoicePlayer", "onCompletion() resetSpeaker"); } } if (a.e(a$3$1.this.bCX.bCV) != null) { x.i("MicroMsg.SceneVoicePlayer", "intOnCompletion onCompletion()"); a.e(a$3$1.this.bCX.bCV).wd(); return; } x.e("MicroMsg.SceneVoicePlayer", "intOnCompletion is null!!!"); } }); } catch (Throwable e) { x.e("MicroMsg.SceneVoicePlayer", "exception:%s", new Object[]{bi.i(e)}); } } }
package ru.kappers.model.dto.leon; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.util.List; @Data @Builder @AllArgsConstructor @NoArgsConstructor public class RunnerLeonDTO { private long id; private String name; private boolean open; private int r; private int c; private List<String> tags; private double price; }
package org.jboss.forge.plugin.gitignore; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import javax.inject.Inject; import org.apache.commons.io.IOUtils; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.lib.RepositoryBuilder; import org.eclipse.jgit.lib.TextProgressMonitor; import org.jboss.forge.env.Configuration; import org.jboss.forge.env.ConfigurationScope; import org.jboss.forge.parser.java.util.Strings; import org.jboss.forge.project.facets.BaseFacet; import org.jboss.forge.project.services.ResourceFactory; import org.jboss.forge.resources.DirectoryResource; import org.jboss.forge.resources.FileResource; import org.jboss.forge.resources.Resource; import org.jboss.forge.resources.ResourceFilter; import org.jboss.forge.shell.Shell; import org.jboss.forge.shell.ShellMessages; public class GitIgnoreFacetDefault extends BaseFacet implements GitIgnoreFacet { private static final String GLOBAL_TEMPLATES = "Global"; @Inject private Configuration config; @Inject private ResourceFactory factory; @Inject private Shell shell; @Override public boolean install() { try { DirectoryResource cloneDir = cloneDir(); String repo = repoUrl(); ShellMessages.info(shell, "Cloning " + repo + " into " + cloneDir.getFullyQualifiedName()); Git.cloneRepository().setURI(repo) .setDirectory(cloneDir.getUnderlyingResourceObject()) .call(); return true; } catch (Exception e) { ShellMessages.error(shell, "Failed to checkout gitignore: " + e); return false; } } @Override public boolean isInstalled() { String location = config.getString(CLONE_LOCATION_KEY); if (Strings.isNullOrEmpty(location)) { return false; } File clone = new File(location); Resource<File> cloneDir = factory.getResourceFrom(clone); return cloneDir.exists() && cloneDir.getChild(".git").exists(); } @Override public List<GitIgnoreGroup> list() { List<GitIgnoreGroup> result = new ArrayList<GitIgnoreGroup>(2); DirectoryResource languages = cloneDir(); result.add(new GitIgnoreGroup("Languages", listGitignores(languages))); result.add(new GitIgnoreGroup("Globals", listGitignores(languages.getChildDirectory(GLOBAL_TEMPLATES)))); return result; } @Override @SuppressWarnings("unchecked") public String contentOf(String template) throws IOException { DirectoryResource[] candidates = new DirectoryResource[] { cloneDir(), cloneDir().getChildDirectory(GLOBAL_TEMPLATES) }; for (DirectoryResource dir : candidates) { if (listGitignores(dir).contains(template)) { FileResource<?> file = dir.getChildOfType(FileResource.class, template + GITIGNORE); return IOUtils.toString(file.getResourceInputStream()); } } return ""; } @Override public void update() throws IOException, GitAPIException { RepositoryBuilder db = new RepositoryBuilder().findGitDir(cloneDir().getUnderlyingResourceObject()); Git git = new Git(db.build()); git.pull() .setTimeout(10000) .setProgressMonitor(new TextProgressMonitor()) .call(); } private List<String> listGitignores(DirectoryResource dir) { List<String> result = new LinkedList<String>(); ResourceFilter filter = new ResourceFilter() { @Override public boolean accept(Resource<?> resource) { return resource.getName().endsWith(GITIGNORE); } }; for (Resource<?> resource : dir.listResources(filter)) { String name = resource.getName(); String cut = name.substring(0, name.indexOf(GITIGNORE)); result.add(cut); } return result; } private DirectoryResource cloneDir() { return new DirectoryResource(factory, cloneLocation()); } private File cloneLocation() { return new File(config.getScopedConfiguration(ConfigurationScope.USER).getString(CLONE_LOCATION_KEY)); } private String repoUrl() { return config.getScopedConfiguration(ConfigurationScope.USER).getString(REPOSITORY_KEY); } }
package ba.bitcamp.LabS06D02; public class AvionTest { public static void main(String[] args) { Avion a = new Avion(); Package[] packages = a.getPackages(); for (int i = 0; i < packages.length; i++) { packages[i] = getPackage(); } for (Package p : packages) { //for each System.out.println(p); } System.out.printf("Ukupna tezina aviona: %.2f kg", a.getTotalWeight()); } public static Package getPackage() { Package pack = new Package(); System.out.print("Unesite sirinu: "); pack.setWidth(TextIO.getlnDouble()); System.out.print("Unesite visinu: "); pack.setHeigth(TextIO.getlnDouble()); System.out.print("Unesite duzinu: "); pack.setLength(TextIO.getlnDouble()); System.out.print("Unesite tezinu: "); pack.setWeight(TextIO.getlnDouble()); return pack; } }
package com.sinotao.util; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; public class TelnetUtil { public static boolean telnet(String ip, int port) throws IOException { boolean flag = false; Socket server = null; try { server = new Socket(); InetSocketAddress address = new InetSocketAddress(ip, port); server.connect(address, 5000); flag = true; } finally { if (server != null) server.close(); } return flag; } public static void main(String[] args) throws IOException{ String ip = "182.50.8.68"; int port = 7004; boolean b = TelnetUtil.telnet(ip, port); System.out.println("=="+b); } }
package zuoshen.list; public class 合并两个有序的单链表 { public Node merge(Node head1, Node head2){ if(head1==null){ return head2; } if(head2==null){ return head1; } Node res=null; if(head1.value>head2.value){ res=head2; res.next=merge(head1,head2.next); }else { res=head1; res.next=merge(head1.next,head2); } return res; } public Node merge_no(Node head1,Node head2){ if(head1==null){ return head2; } if(head2==null){ return head1; } Node mergehead=null; Node cur = null; while (head1!=null&&head2!=null){ if(head1.value<head2.value){ if(mergehead==null){ mergehead= cur =head1; }else { cur.next=head1; cur = cur.next; } head1=head1.next; }else if(head1.value>head2.value){ if(mergehead==null){ mergehead= cur =head2; }else { cur.next=head2; cur = cur.next; } head2=head2.next; } } if(head1==null){ cur.next=head2; } if(head2==null){ cur.next=head1; } return mergehead; } }
/* * LumaQQ - Java QQ Client * * Copyright (C) 2004 luma <stubma@163.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package edu.tsinghua.lumaqq.qq.packets.in; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; import edu.tsinghua.lumaqq.qq.QQ; import edu.tsinghua.lumaqq.qq.beans.AdvancedUserInfo; import edu.tsinghua.lumaqq.qq.beans.QQUser; import edu.tsinghua.lumaqq.qq.packets.BasicInPacket; import edu.tsinghua.lumaqq.qq.packets.PacketParseException; /** * <pre> * 高级搜索的回复包 * 头部 * ------- 加密开始(会话密钥)----------- * 用户类型,1字节 * 回复码,1字节,0x00表示还有数据,0x01表示没有更多数据了,当为0x01时,后面没有内容了,当为0x00时,后面才有内容 * 页号,从1开始,2字节,如果页号后面没有内容了,那也说明是搜索结束了 * --------- AdvancedUserInfo Start (Repeat) --------- * QQ号,4字节 * 性别,1字节,表示下拉框索引 * 年龄,2字节 * 在线,1字节,0x01表示在线,0x00表示离线 * 昵称长度,1字节 * 昵称 * 省份索引,2字节 * 城市索引,2字节,这个索引是以"不限"为0开始算的,shit * 头像索引,2字节 * 未知1字节 * ---------- AdvancedUserInfo End ---------- * -------- 加密结束 ----------- * 尾部 * </pre> * * @author luma */ public class AdvancedSearchUserReplyPacket extends BasicInPacket { public byte userType; public byte replyCode; public int page; public List<AdvancedUserInfo> users; public boolean finished; /** * @param buf * @param length * @throws PacketParseException */ public AdvancedSearchUserReplyPacket(ByteBuffer buf, int length, QQUser user) throws PacketParseException { super(buf, length, user); } /* (non-Javadoc) * @see edu.tsinghua.lumaqq.qq.packets.OutPacket#getPacketName() */ @Override public String getPacketName() { return "Advanced Search User Reply Packet"; } /* (non-Javadoc) * @see edu.tsinghua.lumaqq.qq.packets.InPacket#parseBody(java.nio.ByteBuffer) */ @Override protected void parseBody(ByteBuffer buf) throws PacketParseException { userType = buf.get(); replyCode = buf.get(); if(replyCode == QQ.QQ_REPLY_OK) { page = buf.getChar(); // read all user info users = new ArrayList<AdvancedUserInfo>(); while(buf.hasRemaining()) { AdvancedUserInfo aui = new AdvancedUserInfo(); aui.readBean(buf); users.add(aui); } finished = users.isEmpty(); } else finished = true; } }
package com.gtfs.action; import java.io.IOException; import java.io.OutputStream; import java.io.Serializable; import java.text.Format; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.apache.poi.hssf.usermodel.HSSFFont; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.util.CellRangeAddress; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import com.gtfs.bean.LicHubMst; import com.gtfs.bean.LicOblApplicationMst; import com.gtfs.bean.LicPaymentDtls; import com.gtfs.bean.LicPremApplMapping; import com.gtfs.bean.LicPremPaymentDtls; import com.gtfs.bean.LicPremiumListDtls; import com.gtfs.bean.PicBranchMst; import com.gtfs.service.interfaces.LicPaymentDtlsService; import com.gtfs.service.interfaces.LicPremiumListService; import com.gtfs.service.interfaces.PicBranchMstService; @Component @Scope("session") public class PremiumListReportAction implements Serializable{ private Logger log = Logger.getLogger(PremiumListReportAction.class); @Autowired private LoginAction loginAction; @Autowired private LicPremiumListService licPremiumListService; @Autowired private LicPaymentDtlsService licPaymentDtlsService; private Date businessFromDate; private Date businessToDate; private Long premListNo; private Boolean renderedPanel; private Double totalAmount; private List<LicOblApplicationMst> licOblApplicationMstList = new ArrayList<LicOblApplicationMst>(); private List<Long> premListNos = new ArrayList<Long>(); public void refresh(){ if(premListNos != null){ premListNos.clear(); } if(licOblApplicationMstList!=null){ licOblApplicationMstList.clear(); } businessFromDate = null; businessToDate = null; renderedPanel = false; } public String onLoad(){ refresh(); return "/licHubActivity/premiumListReport.xhtml"; } public void businessDateChangeListener(){ premListNos = licPremiumListService.findPremiumListByBusinessDate(loginAction.findHubForProcess("OBL"),businessFromDate, businessToDate); } public void onSearch(){ try{ totalAmount = 0.0; licOblApplicationMstList = licPremiumListService.findPremiumListReport(loginAction.findHubForProcess("OBL"), businessFromDate, businessToDate,premListNo); if(licOblApplicationMstList == null || licOblApplicationMstList.size() == 0 || licOblApplicationMstList.contains(null)){ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error : ", "No Record(s) Found")); renderedPanel = false; return; } for(LicOblApplicationMst obj : licOblApplicationMstList){ List<LicPaymentDtls> licPaymentDtlses = licPaymentDtlsService.findLicPaymentDtlsByPayId(obj.getLicBusinessTxn().getLicPaymentMst()); for(LicPaymentDtls ob : licPaymentDtlses){ if((ob.getPayeeName() == null || ob.getPayeeName().equals("SARADA INSURANCE CONSULTANCY LTD"))){ totalAmount = totalAmount + ob.getAmount(); } } obj.getLicBusinessTxn().getLicPaymentMst().setLicPaymentDtlses(licPaymentDtlses); } renderedPanel = true; }catch(Exception e){ log.info("PremiumListAction search Error : ", e); } } public void exportToExcel() throws IOException { try { Workbook wb = new HSSFWorkbook(); Sheet sheet = wb.createSheet("Premium Detail Data Entry Report"); /* Start Style */ /* Header */ Font headerFont = wb.createFont(); headerFont.setFontHeightInPoints((short) 12); headerFont.setColor(HSSFColor.RED.index); headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); CellStyle headerStyle = wb.createCellStyle(); headerStyle.setFont(headerFont); headerStyle.setAlignment(headerStyle.ALIGN_CENTER); /* Sub Header */ Font subHeaderFont = wb.createFont(); subHeaderFont.setFontHeightInPoints((short) 10); subHeaderFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); CellStyle subHeaderStyle = wb.createCellStyle(); subHeaderStyle.setFont(subHeaderFont); subHeaderStyle.setAlignment(subHeaderStyle.ALIGN_CENTER); /* End Style */ /* Premium Details Start */ Row row = null; Iterator<LicOblApplicationMst> licOblApplicationMstIterator = licOblApplicationMstList.iterator(); int rowIndex = 0; /* Start Header */ row = sheet.createRow(rowIndex++); Cell premListHeaderCell0 = row.createCell(0); premListHeaderCell0.setCellStyle(headerStyle); premListHeaderCell0.setCellValue("Premium List Report"); sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 7)); row = sheet.createRow(rowIndex++); Cell premDtlsSubHeaderCell0 = row.createCell(0); premDtlsSubHeaderCell0.setCellStyle(subHeaderStyle); premDtlsSubHeaderCell0.setCellValue("Application No"); /* Start Sub-Header */ Cell premListSubHeaderCell1 = row.createCell(1); premListSubHeaderCell1.setCellStyle(subHeaderStyle); premListSubHeaderCell1.setCellValue("Business Date"); Cell premListSubHeaderCell2 = row.createCell(2); premListSubHeaderCell2.setCellStyle(subHeaderStyle); premListSubHeaderCell2.setCellValue("Insured Name"); Cell premListSubHeaderCell3 = row.createCell(3); premListSubHeaderCell3.setCellStyle(subHeaderStyle); premListSubHeaderCell3.setCellValue("Proposer Name"); Cell premListSubHeaderCell4 = row.createCell(4); premListSubHeaderCell4.setCellStyle(subHeaderStyle); premListSubHeaderCell4.setCellValue("LIC Branch Name"); Cell premListSubHeaderCell5 = row.createCell(5); premListSubHeaderCell5.setCellStyle(subHeaderStyle); premListSubHeaderCell5.setCellValue("Sum Assured"); Cell premListSubHeaderCell6 = row.createCell(6); premListSubHeaderCell6.setCellStyle(subHeaderStyle); premListSubHeaderCell6.setCellValue("Total"); Cell premListSubHeaderCell7 = row.createCell(7); premListSubHeaderCell7.setCellStyle(subHeaderStyle); premListSubHeaderCell7.setCellValue("Cash Amount"); Cell premListSubHeaderCell8 = row.createCell(8); premListSubHeaderCell8.setCellStyle(subHeaderStyle); premListSubHeaderCell8.setCellValue("DD/Cheque Amount"); Cell premListSubHeaderCell9 = row.createCell(9); premListSubHeaderCell9.setCellStyle(subHeaderStyle); premListSubHeaderCell9.setCellValue("DD/Cheque No"); Cell premListSubHeaderCell10 = row.createCell(10); premListSubHeaderCell10.setCellStyle(subHeaderStyle); premListSubHeaderCell10.setCellValue("Bank Name"); Cell premListSubHeaderCell11 = row.createCell(11); premListSubHeaderCell11.setCellStyle(subHeaderStyle); premListSubHeaderCell11.setCellValue("Payee Name"); /* End Sub-Header */ /* End header */ while (licOblApplicationMstIterator.hasNext()) { LicOblApplicationMst obj = licOblApplicationMstIterator.next(); row = sheet.createRow(rowIndex++); row.createCell(0).setCellValue(obj.getOblApplNo()); row.createCell(1).setCellValue(formatDateToString(obj.getBusinessDate())); row.createCell(2).setCellValue(obj.getLicInsuredDtls().getName()); row.createCell(3).setCellValue(obj.getLicProposerDtls().getName()); row.createCell(4).setCellValue(obj.getPicBranchMstId().getPicBranchName()); row.createCell(5).setCellValue(obj.getLicProductValueMst().getSumAssured()); row.createCell(6).setCellValue(obj.getLicBusinessTxn().getLicPaymentMst().getTotalReceived()); double cashAmount = 0.0; double chqDdAmount = 0.0; String chqDDNo = ""; String bankName = ""; String payeeName = ""; for(LicPaymentDtls dtls : obj.getLicBusinessTxn().getLicPaymentMst().getLicPaymentDtlses()){ if(dtls.getPayMode().equals("C")){ cashAmount = cashAmount + dtls.getAmount(); }else{ chqDdAmount = chqDdAmount + dtls.getAmount(); chqDDNo = chqDDNo + dtls.getDraftChqNo() + " , "; bankName = bankName + dtls.getDraftChqBank() + " , "; payeeName = payeeName + dtls.getPayeeName() + " , "; } } row.createCell(7).setCellValue(cashAmount); row.createCell(8).setCellValue(chqDdAmount); row.createCell(9).setCellValue(chqDDNo); row.createCell(10).setCellValue(bankName); row.createCell(11).setCellValue(payeeName); } row = sheet.createRow(rowIndex++); Cell footerCell7 = row.createCell(7); footerCell7.setCellStyle(subHeaderStyle); footerCell7.setCellValue(totalAmount); /* Premium Details End */ HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); // response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition", "attachment;filename=download.xls"); OutputStream out = response.getOutputStream(); wb.write(out); out.flush(); out.close(); FacesContext.getCurrentInstance().responseComplete(); } catch (Exception e) { log.info("Error", e); } } public String formatDateToString(Date date) { Format formatter = new SimpleDateFormat("dd-MM-yyyy"); return formatter.format(date); } /* GETTER SETTER */ public Date getBusinessFromDate() { return businessFromDate; } public void setBusinessFromDate(Date businessFromDate) { this.businessFromDate = businessFromDate; } public Date getBusinessToDate() { return businessToDate; } public void setBusinessToDate(Date businessToDate) { this.businessToDate = businessToDate; } public Boolean getRenderedPanel() { return renderedPanel; } public void setRenderedPanel(Boolean renderedPanel) { this.renderedPanel = renderedPanel; } public List<LicOblApplicationMst> getLicOblApplicationMstList() { return licOblApplicationMstList; } public void setLicOblApplicationMstList( List<LicOblApplicationMst> licOblApplicationMstList) { this.licOblApplicationMstList = licOblApplicationMstList; } public List<Long> getPremListNos() { return premListNos; } public void setPremListNos(List<Long> premListNos) { this.premListNos = premListNos; } public Long getPremListNo() { return premListNo; } public void setPremListNo(Long premListNo) { this.premListNo = premListNo; } public Double getTotalAmount() { return totalAmount; } public void setTotalAmount(Double totalAmount) { this.totalAmount = totalAmount; } }
/** * OpenKM, Open Document Management System (http://www.openkm.com) * Copyright (c) 2006-2015 Paco Avila & Josep Llort * * No bytes were intentionally harmed during the development of this application. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package com.openkm.frontend.client.bean.extension; import java.util.Date; import com.google.gwt.user.client.rpc.IsSerializable; /** * GWTRoom * * @author jllort * */ public class GWTRoom implements IsSerializable { public static final int TYPE_CONFERENCE = 1; // public static final int TYPE_AUDIENCE = 2; Deprecated type public static final int TYPE_RESTRICTED = 3; public static final int TYPE_INTERVIEW = 4; private int id = 0; private String name; private int type = 0; // Room type private boolean pub = false; // Is Publicç private Date start; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getType() { return type; } public void setType(int type) { this.type = type; } public boolean isPub() { return pub; } public void setPub(boolean pub) { this.pub = pub; } public Date getStart() { return start; } public void setStart(Date start) { this.start = start; } }
package model.handler; public class SpaceHandler { }
package com.qr_market; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; /** * @author Kemal Sami KARACA * @since 05.03.2015 * @version v1.01 */ public class Guppy { public static String url_scheme = "http://"; public static String url_server = url_scheme + "193.140.63.162"; //193.140.63.162 public static String url_serverPort = url_server + ":8080"; public static String url = url_serverPort + "/QR_Market_Web"; public static String url_Servlet_Auth = url + "/Auth"; public static String url_Servlet_Order = url + "/OrderServlet"; public static String url_Servlet_Product = url + "/ProductServlet"; public static String url_Servlet_IMAGE = url + "/images"; public static String url_Servlet_Sample = url_serverPort + "/Sample_WebApplication_3_Upload/SampleServlet"; // OPERATION KEYS public static String http_Map_OP_TYPE = "opType"; public static String http_Map_OP_URL = "opUrl"; public static boolean checkInternetConnection(Context context){ ConnectivityManager con=(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo nf=con.getActiveNetworkInfo(); if(con.getActiveNetworkInfo()==null || !nf.isConnected()){ return false; } return true; } }
package com.bigdata.app.bolt; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Collection; import java.util.ArrayList; import java.util.*; import java.lang.Double; import org.apache.storm.task.OutputCollector; import org.apache.storm.task.TopologyContext; import org.apache.storm.topology.OutputFieldsDeclarer; import org.apache.storm.topology.base.BaseRichBolt; import org.apache.storm.tuple.Fields; import org.apache.storm.tuple.Tuple; import org.apache.storm.tuple.Values; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import com.google.common.base.Splitter; import javax.json.*; /** * Breaks each tweet into words and gets the location of each tweet and * assocaites its value to hashtag * * @author - centos */ public final class GeoParsingBolt extends BaseRichBolt { private static final Logger LOGGER = LoggerFactory .getLogger(GeoParsingBolt.class); private static final long serialVersionUID = -5094673458112835122L; private OutputCollector collector; private String path; public GeoParsingBolt() { LOGGER.info("geoparsing bolt is initialized..........."); } private Map<String, Integer> afinnSentimentMap = new HashMap<String, Integer>(); public final void prepare(final Map map, final TopologyContext topologyContext, final OutputCollector collector) { this.collector = collector; // Bolt will read the AFINN Sentiment file [which is in the classpath] // and stores the key, value pairs to a Map. } public final void declareOutputFields( final OutputFieldsDeclarer outputFieldsDeclarer) { outputFieldsDeclarer.declare(new Fields("locations", "hashtag")); } public final void execute(final Tuple input) { try { String hashtag = (String) input.getValueByField("hashtag"); String date = (String) input.getValueByField("created_at"); Collection<Float> location = new ArrayList<Float>(); if (input.getValueByField("user") != null) { LinkedHashMap user = (LinkedHashMap) input.getValueByField("user"); if (user.get("derived") != null) { LinkedHashMap derived = (LinkedHashMap) user.get("derived"); if (derived.get("locations") != null) { List<LinkedHashMap> locations = (List<LinkedHashMap>) derived.get("locations"); for (int i = 0; i < locations.size(); i++) { LinkedHashMap o = (LinkedHashMap)locations.get(i); if (o.get("geo") != null) { LinkedHashMap geo = (LinkedHashMap) o.get("geo"); if (geo.get("coordinates") != null) { ArrayList<Object> loc = (ArrayList<Object>) geo.get("coordinates"); Double lat = (Double)(loc.get(1)); Double lon = (Double)(loc.get(0)); String str = "\"" + date + "\": {\"latitude\": " + String.valueOf(lat) + ", \"longitude\": " + String.valueOf(lon) + "}"; ArrayList<String> s = new ArrayList<String>(); s.add(str); collector.emit(new Values(s, hashtag)); } } } } } } this.collector.ack(input); } catch (Exception exception) { exception.printStackTrace(); this.collector.fail(input); } } }
package primeirosProgramas; import javax.swing.JOptionPane; public class LacoComBreakEContinue { public static void main(String []agrs) { while(true) { String opcao = JOptionPane.showInputDialog("Digite uma opção: \n1.Jogar\n2.Ranking\n3.Sair"); if (opcao.equals("1")) { System.out.println("Entrando no jogo..."); } else if (opcao.equals("2")) { System.out.println("Mostrando Ranking"); } else if (opcao.equals("3")) { break; } else { System.out.println("Opção inválida!"); continue; } System.out.println("Você está jogando o jogo X"); } System.out.println("Até mais!"); } }
package com.tencent.mm.plugin.aa; import com.tencent.mm.bt.h.d; import com.tencent.mm.plugin.aa.a.b.b; class b$8 implements d { b$8() { } public final String[] xb() { return b.diD; } }
package com.tencent.mm.plugin.appbrand.jsapi; import android.content.Intent; import com.tencent.mm.bg.d; import com.tencent.mm.plugin.appbrand.config.AppBrandSysConfig; import com.tencent.mm.plugin.appbrand.l; import com.tencent.mm.plugin.appbrand.ui.AppBrandAuthorizeUI; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.ui.MMActivity; import org.json.JSONObject; public final class au extends a { public static final int CTRL_INDEX = 192; public static final String NAME = "openSetting"; public final void a(l lVar, JSONObject jSONObject, int i) { x.d("MicroMsg.JsApiOpenSetting", "jumpToSettingView!"); AppBrandSysConfig appBrandSysConfig = lVar.fdO.fcu; if (appBrandSysConfig == null) { x.e("MicroMsg.JsApiOpenSetting", "config is null!"); lVar.E(i, f("fail", null)); return; } MMActivity c = e.c(lVar); if (c == null) { lVar.E(i, f("fail", null)); x.e("MicroMsg.JsApiOpenSetting", "mmActivity is null, invoke fail!"); return; } c.geJ = new 1(this, lVar, i); Intent putExtra = new Intent(lVar.getContext(), AppBrandAuthorizeUI.class).putExtra("key_username", appBrandSysConfig.bGy); putExtra.putExtra("key_app_authorize_jsapi", true); d.b(c, "appbrand", ".ui.AppBrandAuthorizeUI", putExtra, 1); } }
package GsonDefinitions; /** * @author michael.hug@fiserv.com */ public class entity { public String name; public String billing_enabled; public String quota_definition_guid; public String status; public String default_isolation_segment_guid; public String quota_definition_url; public String spaces_url; public String domains_url; public String private_domains_url; public String users_url; public String managers_url; public String billing_managers_url; public String auditors_url; public String app_events_url; public String space_quota_definitions_url; //public String name; public String organization_guid; public String space_quota_definition_guid; public String isolation_segment_guid; public String allow_ssh; public String organization_url; public String developers_url; //public String managers_url; //public String auditors_url; public String apps_url; public String routes_url; //public String domains_url; public String service_instances_url; //public String app_events_url; public String events_url; public String security_groups_url; public String staging_security_groups_url; public String admin; public String active; public String default_space_guid; public String username; //public String spaces_url; public String organizations_url; public String managed_organizations_url; public String billing_managed_organizations_url; public String audited_organizations_url; public String managed_spaces_url; public String audited_spaces_url; }