text
stringlengths
10
2.72M
// ********************************************************************** // This file was generated by a TAF parser! // TAF version 3.2.1.6 by WSRD Tencent. // Generated from `/data/jcetool/taf//upload/opalli/AppPITUInterface.jce' // ********************************************************************** package PituClientInterface; public final class stReturnCodes extends com.qq.taf.jce.JceStruct { public java.util.Map<String, Integer> mainCategoryRetCodes = null; public int bannerRetCode = 0; public int opRetCode = 0; public int catRetCode = 0; public stReturnCodes() { } public stReturnCodes(java.util.Map<String, Integer> mainCategoryRetCodes, int bannerRetCode, int opRetCode, int catRetCode) { this.mainCategoryRetCodes = mainCategoryRetCodes; this.bannerRetCode = bannerRetCode; this.opRetCode = opRetCode; this.catRetCode = catRetCode; } public void writeTo(com.qq.taf.jce.JceOutputStream _os) { _os.write(mainCategoryRetCodes, 0); _os.write(bannerRetCode, 1); _os.write(opRetCode, 2); _os.write(catRetCode, 3); } static java.util.Map<String, Integer> cache_mainCategoryRetCodes; static { cache_mainCategoryRetCodes = new java.util.HashMap<String, Integer>(); String __var_5 = ""; Integer __var_6 = 0; cache_mainCategoryRetCodes.put(__var_5, __var_6); } public void readFrom(com.qq.taf.jce.JceInputStream _is) { this.mainCategoryRetCodes = (java.util.Map<String, Integer>) _is.read(cache_mainCategoryRetCodes, 0, true); this.bannerRetCode = (int) _is.read(bannerRetCode, 1, true); this.opRetCode = (int) _is.read(opRetCode, 2, true); this.catRetCode = (int) _is.read(catRetCode, 3, false); } }
package test.frame07; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; public class MainFrame extends JFrame implements ActionListener{ //콤보 박스의 문자열 아이템을 String[] 로 미리 준비하기 String[] usergame= {"가위","바위","보"}; JComboBox<String> combo; JLabel lab1; JLabel lab2; //생성자 public MainFrame(String title) { super(title); //레이아웃 법칙 지정(BorderLayout) setLayout(new BorderLayout()); //콤보 박스 객체를 생성하면서 아이템 배열을 생성자의 인자로 전달 combo= new JComboBox<String>(usergame); //문자열을 출력할 레이블 객체 2개 생성하고 초기 문자열은 빈문자열로 지정 lab1 = new JLabel(""); lab2 = new JLabel(""); //콤보박스는 프레임의 북쪽에 배치 add(combo, BorderLayout.NORTH); //레이블은 서쪽과 동쪽에 배치 add(lab1, BorderLayout.WEST); add(lab2, BorderLayout.EAST); //콤보 박스에 액션 리스너 등록 combo.addActionListener(this); } //콤보 박스를 선택했을때 호출되는 메소드 @Override public void actionPerformed(ActionEvent e) { // 랜덤 객체 생성 Random ran=new Random(); //컴퓨터의 패로 사용할 값 0, 1, 2 중에 하나의 숫자를 랜덤하게 얻어내기 int ranNum=ran.nextInt(3); // "가위", "바위", "보" 문자열 String com=usergame[ranNum]; lab2.setText("Computer: "+com); //플레이어가 선택한 패 읽어오기 String user=combo.getSelectedItem().toString(); lab1.setText("Player: "+user); //결과를 저장할 result 지역변수를 미리 만든다. String result=null; //이긴경우의수, 비긴경우, 나머지는 진경우 if(com.equals("가위") && user.equals("바위")) {//플레이어가 이긴경우 result="이겼습니다."; }else if(com.equals("바위") && user.equals("보")) {//플레이어가 이긴경우 result="이겼습니다."; }else if(com.equals("보") && user.equals("가위")) {//플레이어가 이긴경우 result="이겼습니다."; }else if(com.equals(user)) {//비긴경우 result="비겼습니다."; }else {//나머지는 진경우 result="졌습니다."; } JOptionPane.showMessageDialog(this, result); } public static void main(String[] args) { MainFrame f=new MainFrame("가위,바위,보 게임"); f.setBounds(100, 100, 300, 300); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } }
package com.harris.mobihoc; import android.content.Context; import android.content.BroadcastReceiver; import android.content.IntentFilter; import android.content.Intent; import android.net.wifi.ScanResult; import android.net.wifi.p2p.WifiP2pConfig; import android.net.wifi.p2p.WifiP2pDevice; import android.net.wifi.p2p.WifiP2pGroup; import android.net.wifi.p2p.WifiP2pInfo; import android.net.wifi.p2p.WifiP2pManager; import android.net.wifi.p2p.WifiP2pManager.ConnectionInfoListener; import android.net.wifi.p2p.WifiP2pManager.GroupInfoListener; import android.net.wifi.p2p.WifiP2pManager.DnsSdServiceResponseListener; import android.net.wifi.p2p.WifiP2pManager.DnsSdTxtRecordListener; import android.net.wifi.p2p.WifiP2pManager.ActionListener; import android.net.wifi.p2p.WifiP2pDeviceList; import android.net.wifi.p2p.WifiP2pManager.Channel; import android.net.wifi.p2p.WifiP2pDevice; import android.net.wifi.p2p.WifiP2pManager.ChannelListener; import android.net.wifi.p2p.WifiP2pManager.PeerListListener; import android.net.wifi.p2p.nsd.WifiP2pServiceInfo; import android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceInfo; import android.net.wifi.p2p.nsd.WifiP2pServiceRequest; import android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceRequest; import android.net.wifi.WpsInfo; import android.util.Log; import android.view.View; import android.widget.TextView; //import com.ucb.gemcloudsaint2.DeviceListFragment.DeviceActionListener; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.util.Hashtable; import java.util.Map; import java.util.HashMap; import java.util.List; import java.util.ArrayList; public class WifiP2p implements PeerListListener, ChannelListener, DnsSdTxtRecordListener, DnsSdServiceResponseListener, GroupInfoListener, ConnectionInfoListener{ private WifiP2pManager manager; private static String GOAdd = "192.168.49.1"; private Channel channel; private Context context; private final IntentFilter intentFilter = new IntentFilter(); private boolean retryChannel = false; private static boolean Connected = false; private static boolean D2D_enabled = false; private static boolean isGO = false; private mobiHoc activity; private Hashtable<String, WifiP2pConfig> cache = new Hashtable<String, WifiP2pConfig>(); public WiFiDirectBroadcastReceiver receiver; private String TAG = "NSD TEST"; private WifiP2pDnsSdServiceInfo serviceInfo = null; public static String SSID = null; public static String psk = null; private static void setRole(boolean status){ isGO = !status; } public static String getOwnerAddress(){ return GOAdd; } public static boolean getRole(){ return isGO; } public WifiP2p(mobiHoc activity, WifiP2pManager manager, Channel channel){ this.activity = activity; /* */ intentFilter.addAction(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION); intentFilter.addAction(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION); intentFilter.addAction(WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION); intentFilter.addAction(WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION); //manager = (WifiP2pManager) activity.getSystemService(Context.WIFI_P2P_SERVICE); //channel = manager.initialize(activity, activity.getMainLooper(), null); this.manager = manager; this.channel = channel; disconnect(); registerService(); //Create(); } private final String decoder(int value){ String reason = null; switch(value){ case 0: reason = "ERROR"; case 1: reason = "P2P UNSUPPORTED"; case 2: reason = "BUSY"; default: reason = "UNKNOWN"; } return reason; } public void Discover(){ Log.d("COLIN", "SEARCHING"); manager.discoverPeers(channel, new WifiP2pManager.ActionListener(){ @Override public void onSuccess(){ Log.d("WIFIDIRECT", "Currently Looking for peers"); } @Override public void onFailure(int reasonCode){ String reason = decoder(reasonCode); Log.d("WIFIDIRECT", "Failed to Discover peers. Reason: "+reason); } }); } @Override public void onDnsSdServiceAvailable(String instanceName, String registrationType, WifiP2pDevice srcDevice) { //Log.d(TAG, "SERVICE FOUND " + srcDevice.deviceAddress); Log.d(TAG + " SERVICE", "FOUND " + instanceName); Log.d(TAG + " SERVICE", "FOUND " + registrationType); printInfo(new File("/mnt/sdcard/DCIM/WDScan.txt"), "Found Service on " + srcDevice.deviceName + ", At " + activity.getTimeSinceMidnight() + ", At time " + System.currentTimeMillis() + ", "+ " device details: " + srcDevice.toString() + "\n" , 0); } private void printInfo(File file, String Info, int trial){ BufferedWriter fos = null; //create fileOutputStream; try{ fos = new BufferedWriter(new FileWriter(file, true)); fos.write(Info); fos.flush(); fos.close(); }catch(Exception e){ e.printStackTrace(); } //write data } @Override public void onPeersAvailable(WifiP2pDeviceList peerList){ //call public method to populate the list we see //this method will also display what nodes are in our group (hopefully) List<WifiP2pDevice> ListenerList = new ArrayList<WifiP2pDevice>(peerList.getDeviceList()); Log.d("COLIN", "PEERS IS " + peerList.getDeviceList().size()); Log.d("COLIN", "List is " + ListenerList.size()); boolean noService = true; if(activity.lightMode){ printInfo(new File("/mnt/sdcard/DCIM/WiFiDirect_peers.txt"), "At " + activity.getTimeSinceMidnight() + ", At time " + System.currentTimeMillis() + ", "+ " found " + ListenerList.size()+ " peers\n", 0); }else{ for(WifiP2pDevice device : ListenerList){ printInfo(new File("/mnt/sdcard/DCIM/WiFiDirect_peers.txt"), "At " + activity.getTimeSinceMidnight() + ", At time " + System.currentTimeMillis() + ", "+ " found the following peers " + device.toString() + "\n", 0); if(device.isGroupOwner()){ noService = !noService; break; } } } /* if(ListenerList.size() == 0){ Create(); } */ //list.UpdatePeerList(ListenerList); } @Override public void onDnsSdTxtRecordAvailable(String fullDomainName, Map<String, String> record, WifiP2pDevice device) { Log.d(TAG, device.deviceName + " is " + record.toString()); if((!Connected) && (record.get("GEMCLOUD").equalsIgnoreCase("SAINT2"))){ //printInfo(new File("/mnt/sdcard/DCIM/WDServiceScan.txt"), "Found Service on " + device.deviceName + " At " + System.currentTimeMillis() + " device details: " + device.toString() + "\n", 0); printInfo(new File("/mnt/sdcard/DCIM/WDServiceScan.txt"), "Found Service on " + device.deviceName + " At " + activity.getTimeSinceMidnight() + ", At time " + System.currentTimeMillis() + ", "+ " device details: " + device.toString() + "\n", 0); //Discover(); //connect(device); } } private void clearService(){ manager.clearServiceRequests(channel, new WifiP2pManager.ActionListener(){ @Override public void onSuccess(){} @Override public void onFailure(int code){Log.d("COLIN", "COULD NOT CLEAR SERVICE REQUESTS");} }); } //private void discoverService() { public void findTDP() { /* * Register listeners for DNS-SD services. These are callbacks invoked * by the system when a service is actually discovered. */ Log.i("GEMCloudService", "LOOKING FOR SERVICE"); /* manager.setDnsSdResponseListeners(channel, this, this); //Discover(); // After attaching listeners, create a service request and initiate // discovery. WifiP2pDnsSdServiceRequest serviceRequest = WifiP2pDnsSdServiceRequest.newInstance(); //why manager.addServiceRequest(channel, serviceRequest, new ActionListener() { @Override public void onSuccess() {} @Override public void onFailure(int arg0) {Log.d(TAG+" SERVICE", "FAILED TO REGISTER SERVICE LISTENER " + arg0);} }); //end why /* */ startService(); manager.discoverServices(channel, new ActionListener() { @Override public void onSuccess() {} @Override public void onFailure(int arg0) {Log.d(TAG, "FAILED TO REGISTER LISTENER " + arg0);} }); } public void findServices(){ manager.setDnsSdResponseListeners(channel, this, this); manager.discoverServices(channel, new ActionListener() { @Override public void onSuccess() {} @Override public void onFailure(int arg0) {Log.d(TAG, "FAILED TO REGISTER LISTENER " + arg0);} }); } /* public void unregisterService(){ if(serviceInfo != null){ manager.removeLocalService(channel, serviceInfo, new ActionListener(){ @Override public void onSuccess(){} @Override public void onFailure(int code){Log.d(TAG, "FAILED to remove service because of " + code);} }); } } */ public void registerService(){ //test method and stuffs will change once verified it is working; Map record = new HashMap(); record.put("listenport", String.valueOf(50000)); record.put("GEMCLOUD", "SAINT2"); record.put("buddyName", "John Doe"); record.put("available", "visible"); serviceInfo = WifiP2pDnsSdServiceInfo.newInstance("_test", "_presence._tcp", record); manager.addLocalService(channel, serviceInfo, new ActionListener(){ @Override public void onSuccess(){} @Override public void onFailure(int code){Log.d("WIFIDIRECT", "FAILED REGISTER SERVICE REASON: " + code);} }); Log.d("WIFIDIRECT", "GEMCLOUD SERVICE REGISTERED"); } public void removeService(){ manager.removeLocalService(channel, serviceInfo, new ActionListener(){ @Override public void onSuccess(){} @Override public void onFailure(int code){Log.d("WIFIDIRECT", "FAILED TO REMOVE SERVICE REASON: " + code);} }); } public void Add(String position){ //get current wifiP2p Config or grroup owner mac //make wifiP2pConfig WifiP2pConfig config = new WifiP2pConfig(); config.deviceAddress = " "; config.wps.setup = WpsInfo.PBC; //add to cache cache.put(position, config); //for checking purposes printTable(); } public void printTable(){ for(int i = 0; i < cache.size(); i++){ Log.d("MultiHop", "The Current Status of the table is " + cache.get(i).deviceAddress + "\n"); } } //see netmon deviceListFragment for more details on implementation //create a function to enable and disable auto scan and connect //probably can directly call activity.wm /* public static List<ScanResult> APScan(){ List<ScanResult> ApScan = new ArrayList<ScanResult>(); if(GEMCloudService.wm.startScan()){ ApScan = GEMCloudService.wm.getScanResults(); } return findDirect(ApScan); } */ private static List<ScanResult> findDirect(List<ScanResult> ActiveAps){ List<ScanResult> DirectAps = new ArrayList<ScanResult>(); String[] SSID=null; String Direct = "DIRECT"; int j = 0; for(int i = 0; i < ActiveAps.size(); i++){ SSID = ActiveAps.get(i).SSID.split("-"); if(SSID[0].equals(Direct)){ DirectAps.add(j++, ActiveAps.get(i)); } } ActiveAps.clear(); return DirectAps; } public void Create(){ //startService(); Log.d("Multi", "Creating a group"); manager.createGroup(channel, new WifiP2pManager.ActionListener(){ @Override public void onSuccess(){ Log.d("WIFIDIRECT", "SUCCESSED IN MAKING GROUP"); } @Override public void onFailure(int reasonCode){ String reason = decoder(reasonCode); Log.d("WIFIDIRECT", "Failed to Create Group. Reason: "+reason); Log.d("WIFIDIRECT_PROXY", "TRIED TO RECREATE GROUP"); } }); setRole(false); } public void startService(){ manager.setDnsSdResponseListeners(channel, this, this); WifiP2pDnsSdServiceRequest serviceRequest = WifiP2pDnsSdServiceRequest.newInstance(); //why manager.addServiceRequest(channel, serviceRequest, new ActionListener() { @Override public void onSuccess() {} @Override public void onFailure(int arg0) {Log.d(TAG+" SERVICE", "FAILED TO REGISTER SERVICE LISTENER " + arg0);} }); /* */ } @Override public void onConnectionInfoAvailable(final WifiP2pInfo info){ if(info != null){ if(info.groupOwnerAddress != null){ GOAdd = info.groupOwnerAddress.getHostAddress(); } } } @Override public void onGroupInfoAvailable(final WifiP2pGroup group){ if(group != null){ SSID = group.getNetworkName(); psk = group.getPassphrase(); Log.d("Multi", SSID + " " + psk); }else{ Log.d("Multi", "GROUP IS DNE"); } } private WifiP2pConfig getConfig(String address){ if(cache.containsKey(address)){ return cache.get(address); }else{ WifiP2pConfig config = new WifiP2pConfig(); config.deviceAddress = address; config.wps.setup = WpsInfo.PBC; return config; } } public void connect(WifiP2pDevice device){ WifiP2pConfig config = new WifiP2pConfig(); config.deviceAddress = device.deviceAddress; config.wps.setup = WpsInfo.PBC; connect(config); } public void connect(String Address){ WifiP2pConfig config = getConfig(Address); connect(config); } public void setConnected(boolean status){ Connected = status; } public void setD2D(boolean status){ D2D_enabled = status; } private void connect(WifiP2pConfig config){ final String location = config.deviceAddress; manager.connect(channel, config, new ActionListener(){ @Override public void onSuccess(){ Log.d("WIFIDIRECT", "TRYING TO CONNECT TO " + location); } @Override public void onFailure(int reasonCode){ String reason = decoder(reasonCode); Log.d("WIFIDIRECT", "Failed to Connect. Reason: " + reason); } }); } public void disconnect(){ manager.removeGroup(channel, new ActionListener(){ @Override public void onSuccess(){ Log.d("WIFIDIRECT", "Successfully disconnected from prior group"); } @Override public void onFailure(int reasonCode){ String reason = decoder(reasonCode); Log.d("WIFIDIRECT", "FAILED to disconnect. Reason: " + reason); } }); } public void showDetails(WifiP2pDevice device){ setRole(device.isGroupOwner()); } public void cancelDisconnect(){ } public void resetData(){ } @Override public void onChannelDisconnected(){ if(manager != null && !retryChannel){ Log.d("WIFIDIRECT", "CHANNEL LOST"); resetData(); retryChannel = true; }else{ Log.d("WIFIDIRECT", "CHANNEL IS PERMANTLY LOST"); } } public void restart() { receiver = new WiFiDirectBroadcastReceiver(manager, channel, activity); activity.registerReceiver(receiver, intentFilter); //activity.lock.acquire(); //activity.wifi_lock.acquire(); } public void stop() { activity.unregisterReceiver(receiver); //unregisterService(); disconnect(); //activity.lock.release(); //activity.wifi_lock.release(); } }
package zm.gov.moh.common.submodule.form.model.widgetModel; public abstract class AbstractConceptWidgetModel extends OpenmrsEntity implements ConceptWidgetModel,LabelModel,FormEditTextModel,WidgetModel{ @Deprecated private long conceptId; private String dataType; private String label; private int textSize; private String hint; private String text; private String style; protected String futureDate; public String getFutureDate() { return futureDate; } public void setFutureDate(String futureDate) { this.futureDate = futureDate; } @Override public long getConceptId() { return conceptId; } @Override public void setConceptId(long id) { this.conceptId = id; } @Override public String getDataType() { return dataType; } @Override public void setDataType(String dataType) { this.dataType = dataType; } @Override public void setLabel(String label) { this.label = label; } @Override public String getLabel() { return label; } @Override public void setTextSize(int textSize) { this.textSize = textSize; } @Override public int getTextSize() { return this.textSize; } @Override public void setHint(String hint) { this.hint = hint; } @Override public String getHint() { return hint; } @Override public void setText(String text) { this.text = text; } @Override public String getText() { return text; } @Override public String getStyle() { return style; } @Override public void setStyle(String style) { this.style = style; } }
package com.example.medicalprocess; import java.security.NoSuchAlgorithmException; import java.sql.Date; import java.sql.SQLException; import java.util.List; import classes.Consultation; import classes.Utilisateur; import android.os.AsyncTask; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.widget.DatePicker; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; public class AddNewConsultationActivity extends Activity { List<Utilisateur> doctors; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_new_consultation); new ShowDoctorsAsyncTask().execute(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.add_new_consultation, menu); return super.onCreateOptionsMenu(menu); } public void addNewConsultation(View view) { EditText patient = (EditText)findViewById(R.id.patientId_edit_text); Spinner doctorConsultation = (Spinner)findViewById(R.id.doctorNewConsultation_spinner); DatePicker dateConsultation = (DatePicker)findViewById(R.id.dateNewConsultation_datePicker); int patientId = Integer.parseInt(patient.getText().toString()); int doctorId = doctors.get(doctorConsultation.getSelectedItemPosition()-1).getUid(); @SuppressWarnings("deprecation") Date dateCons = new Date(dateConsultation.getYear(), dateConsultation.getMonth(), dateConsultation.getDayOfMonth()); new AddNewConsultationAsyncTask().execute(this,patientId,doctorId,dateCons); } public void init() { EditText patient = (EditText)findViewById(R.id.patientId_edit_text); Spinner doctorConsultation = (Spinner)findViewById(R.id.doctorNewConsultation_spinner); DatePicker dateConsultation = (DatePicker)findViewById(R.id.dateNewConsultation_datePicker); patient.setText(""); doctorConsultation.setSelection(0); //// Revoir la mise à jour de la date dateConsultation.updateDate(0, 0, 0); } public class AddNewConsultationAsyncTask extends AsyncTask<Object, Void, Void> { AddNewConsultationActivity activity; int patientId; int doctorId; Date dateConsultation; @Override protected Void doInBackground(Object... params) { activity = (AddNewConsultationActivity) params[0]; patientId = (Integer) params[1]; doctorId = (Integer) params[2]; dateConsultation = (Date) params[3]; return null; } protected void onPostExecute(Void result) { try { Consultation.add(patientId, doctorId, dateConsultation); activity.finish(); } catch (NoSuchAlgorithmException e) { Toast.makeText(activity, e.getMessage(), Toast.LENGTH_LONG).show(); activity.init(); } catch (SQLException e) { Toast.makeText(activity, e.getMessage(), Toast.LENGTH_LONG).show(); activity.init(); } } } }
package com.tencent.tencentmap.mapsdk.a; public interface ah { String a(); boolean a(int i); int b(); int c(); }
/* * Copyright © 2014 YAOCHEN Corporation, All Rights Reserved. */ package com.yaochen.address.data.domain.address; public class AdLevel { /** 层级 */ private Integer levelNum; /** 层级名称 */ private String levelName; /** 层级描述 */ private String levelDesc; /** 层级配置示例 */ private String levelExample; public Integer getLevelNum() { return levelNum; } public void setLevelNum(Integer levelNum) { this.levelNum = levelNum; } public String getLevelName() { return levelName; } public void setLevelName(String levelName) { this.levelName = levelName == null ? null : levelName.trim(); } public String getLevelDesc() { return levelDesc; } public void setLevelDesc(String levelDesc) { this.levelDesc = levelDesc == null ? null : levelDesc.trim(); } public String getLevelExample() { return levelExample; } public void setLevelExample(String levelExample) { this.levelExample = levelExample == null ? null : levelExample.trim(); } }
package com.simha.SpringbootAWSSNSExe; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.support.MessageBuilder; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.amazonaws.services.sns.AmazonSNSClient; import com.amazonaws.services.sns.model.PublishRequest; import com.amazonaws.services.sns.model.SubscribeRequest; import com.amazonaws.services.sqs.AmazonSQSAsync; import io.awspring.cloud.messaging.listener.annotation.SqsListener; @RestController @RequestMapping("/sqs") public class SQSCOntroller { @Autowired private AmazonSNSClient amazonsnsAsyncsds; /* @Value("${cloud.aws.end-point.url}") */ private final String sqsEndpoint = "https://sqs.ap-south-1.amazonaws.com/787588272122/mysqsUque"; private String arn="arn:aws:sns:ap-south-1:787588272122:myjavatopic"; @GetMapping("/subscription/{email}") public void createSubscription(@PathVariable("email") String email) { SubscribeRequest scribeRequest=new SubscribeRequest(arn,"email",email); amazonsnsAsyncsds.subscribe(scribeRequest); } @RequestMapping("/message") public void sendingMessageTotopic() { PublishRequest prequest=new PublishRequest(arn,"hello hii"); amazonsnsAsyncsds.publish(prequest); } }
package simplejava.concurrent.lock; import java.util.HashMap; import java.util.Map; /** * 可重入的读写锁 <p> * <li> 读重入: * <li> 写重入: * @author Administrator * */ public class ReentrantReadWriteLock { private Map<Thread, Integer> readerMap = new HashMap<>( ); private Thread currentWriter; private int writerRequests; public synchronized void lockRead() throws InterruptedException { Thread t = Thread.currentThread(); while(! accessRead(t)) this.wait(); readerMap.put(t, getReaderAccess(t) + 1); } private boolean accessRead(Thread t) { if(isWriter()) return true; if(currentWriter != null) return false; if(isReader()) return true; if(writerRequests > 0) return false; return true; } public synchronized void unlockRead() { Thread callThread = Thread.currentThread(); int accesses = getReaderAccess(callThread); if(accesses == 1) { readerMap.remove(callThread); } else { readerMap.put(callThread, accesses - 1); } this.notify(); } public synchronized void lockWrite() throws InterruptedException { ++ writerRequests; Thread t = Thread.currentThread(); while(! accessWrite(t)) this.wait(); currentWriter = t; -- writerRequests; } private boolean accessWrite(Thread t) { if(isOnlyReader()) return true; if(isWriter()) return true; if(currentWriter != null || readerMap.size() > 0) return false; return true; } public synchronized void unlockWrite() { Thread callThread = Thread.currentThread(); if(callThread != currentWriter) { throw new IllegalStateException(); } currentWriter = null; notifyAll(); } private int getReaderAccess(Thread t) { Integer count = readerMap.get(t); return (count == null) ? 0 : count; } private boolean isWriter() { return Thread.currentThread() == currentWriter; } private boolean isOnlyReader() { return readerMap.size() == 1 && readerMap.containsKey(Thread.currentThread()); } private boolean isReader() { return readerMap.containsKey(Thread.currentThread()); } }
package Model; import java.sql.Timestamp; public class Address { private int addressId; private int cityId; private City city; private String address; private String address2; private String postalCode; private String phone; private String createdBy; private String lastUpdatedBy; private Timestamp createDate; public Address( int cityId, String address, String address2, String postalCode, String phone, String createdBy, String lastUpdatedBy, Timestamp createDate ) { this.cityId = cityId; this.city = getCity(cityId); this.address = address; this.address2 = address2; this.postalCode = postalCode; this.phone = phone; this.createdBy = createdBy; this.lastUpdatedBy = lastUpdatedBy; this.createDate = createDate; } Address( int addressId, int cityId, String address, String address2, String postalCode, String phone, String createdBy, String lastUpdateBy, Timestamp createDate ) { this.addressId = addressId; this.cityId = cityId; this.city = getCity(cityId); this.address = address; this.address2 = address2; this.postalCode = postalCode; this.phone = phone; this.createdBy = createdBy; this.lastUpdatedBy = lastUpdateBy; this.createDate = createDate; } Address( int addressId, City city, String address, String address2, String postalCode, String phone, String createdBy, String lastUpdateBy, Timestamp createDate ) { this.addressId = addressId; this.city = city; this.cityId = city.getCityId(); this.address = address; this.address2 = address2; this.postalCode = postalCode; this.phone = phone; this.createdBy = createdBy; this.lastUpdatedBy = lastUpdateBy; this.createDate = createDate; } Address( int addressId, City city, Country country, String address, String address2, String postalCode, String phone, String createdBy, String lastUpdateBy, Timestamp createDate ) { this.addressId = addressId; this.city = city; this.cityId = city.getCityId(); this.address = address; this.address2 = address2; this.postalCode = postalCode; this.phone = phone; this.createdBy = createdBy; this.lastUpdatedBy = lastUpdateBy; this.createDate = createDate; } public int getAddressId() { return addressId; } public int getCityId() { return cityId; } public City getCity(int cityId) { return city; } public String getAddress() { return address; } public String getAddress2() { return address2; } public String getPostalCode() { return postalCode; } public String getPhone() { return phone; } public String getCreatedBy() { return createdBy; } public String getLastUpdatedBy() { return lastUpdatedBy; } public Timestamp getCreateDate() { return createDate; } }
package io.peppermint100.server.entity.Response.CartItem; import io.peppermint100.server.entity.CartItem; import lombok.AllArgsConstructor; import lombok.Data; import org.springframework.http.HttpStatus; import java.util.List; @Data @AllArgsConstructor public class GetAllCartItemResponse { private HttpStatus httpStatus; private String message; private List<CartItem> cartItems; }
package mygroup; import java.util.*; import javax.xml.crypto.dsig.keyinfo.KeyValue; // labuladong的算法小抄 3.2.3 public class LFUCache { HashMap<Integer, Integer> keyToVal; HashMap<Integer, Integer> keyToFreq; HashMap<Integer, LinkedHashSet<Integer>> freqToKeys; int minFreq; int cap; public LFUCache(int capacity) { keyToVal = new HashMap<>(); keyToFreq = new HashMap<>(); freqToKeys = new HashMap<>(); cap = capacity; minFreq = 0; } private void removeMinFreqKey() { // freqToKeys 最小的key列表 LinkedHashSet<Integer> keyList = freqToKeys.get(minFreq); // 其中最先被插入的那个key就是该被淘汰的key int deletedKey = keyList.iterator().next(); // 更新fk keyList.remove(deletedKey); if (keyList.isEmpty()) { freqToKeys.remove(minFreq); // 这里没必要更新minFreq, 因为插入新key的时候一定会把minFreq更新成1, 及时minFreq变了, 我们也不需要管它 } keyToVal.remove(deletedKey); keyToFreq.remove(deletedKey); } private void increaseFreq(int key) { int freq = keyToFreq.get(key); keyToFreq.put(key, freq + 1); // 将key从freq对应的列表中删除 freqToKeys.get(freq).remove(key); // 将key加入freq + 1对应的列表中 freqToKeys.putIfAbsent(freq + 1, new LinkedHashSet<>()); freqToKeys.get(freq + 1).add(key); // 如果freq对应的列表空了, 移除这个freq if (freqToKeys.get(freq).isEmpty()) { freqToKeys.remove(freq); if (freq == minFreq) { minFreq++; } } } public int get(int key) { if (!keyToVal.containsKey(key)) { return -1; } increaseFreq(key); return keyToVal.get(key); } public void put(int key, int val) { if (cap <= 0) return; // 若key已存在, 修改对应的val即可 if(keyToVal.containsKey(key)) { keyToVal.put(key, val); increaseFreq(key); return; } // key不存在, 需要插入 // 容量已满的话, 需要淘汰一个freq最小的key if(cap <= keyToVal.size()) { removeMinFreqKey(); } keyToVal.put(key, val); keyToFreq.put(key, 1); freqToKeys.putIfAbsent(1, new LinkedHashSet<>()); freqToKeys.get(1).add(key); // 插入新key吼最小的freq肯定是1 minFreq = 1; } }
package com.example.customer.po; import org.hibernate.validator.constraints.Range; public class Customer { private String name; @Range(min=1, max=2) private long number; public String getName() { return name; } public void setName(String name) { this.name = name; } public long getNumber() { return number; } public void setNumber(long number) { this.number = number; } }
package action17_task; public class Car { public Car(Human human){ System.out.println("Директор в машине"); } }
package com.kush.lib.expressions.evaluators; import com.kush.lib.expressions.ExpressionException; import com.kush.lib.expressions.clauses.FieldExpression; public interface FieldExpressionEvaluatorFactory<T> { FieldExpressionEvaluator<T> create(FieldExpression expression) throws ExpressionException; }
package com.darichey.blockgame.entity.block; import com.darichey.blockgame.reference.TextureReference; /** * Stone Block. */ public class BlockStone extends Block { public BlockStone() { this.name = "Stone"; this.texture = TextureReference.stone; } }
package org.fao.unredd.api.model.geostore; import it.geosolutions.geostore.core.model.Resource; import it.geosolutions.geostore.services.dto.search.AndFilter; import it.geosolutions.geostore.services.dto.search.BaseField; import it.geosolutions.geostore.services.dto.search.CategoryFilter; import it.geosolutions.geostore.services.dto.search.FieldFilter; import it.geosolutions.geostore.services.dto.search.SearchFilter; import it.geosolutions.geostore.services.dto.search.SearchOperator; import it.geosolutions.geostore.services.rest.GeoStoreClient; import it.geosolutions.geostore.services.rest.model.RESTResource; import it.geosolutions.unredd.geostore.model.UNREDDCategories; import it.geosolutions.unredd.geostore.model.UNREDDLayer; import java.util.List; import javax.ws.rs.WebApplicationException; import org.apache.commons.collections.CollectionUtils; import org.fao.unredd.api.json.AddLayerRequest; import org.fao.unredd.api.json.LayerRepresentation; import org.fao.unredd.api.model.Layer; import org.fao.unredd.api.model.Layers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.google.common.base.Function; import com.google.common.collect.Iterables; import com.sun.jersey.api.client.UniformInterfaceException; @Component public class GeostoreLayers implements Layers { @Autowired private GeoStoreClient geostoreClient; @Override public Iterable<LayerRepresentation> getJSON() { SearchFilter filter = new CategoryFilter( UNREDDCategories.LAYER.getName(), SearchOperator.EQUAL_TO); List<Resource> resources = geostoreClient.searchResources(filter, null, null, true, true).getList(); return Iterables.transform(resources, new Function<Resource, LayerRepresentation>() { public LayerRepresentation apply(Resource resource) { return new GeostoreLayer(resource, geostoreClient) .getJSON(); } }); } @Override public long addLayer(AddLayerRequest addLayerRequest) { RESTResource layerRestResource = toRESTResource(addLayerRequest); long id = geostoreClient.insert(layerRestResource); return id; } private RESTResource toRESTResource(AddLayerRequest addLayerRequest) { UNREDDLayer unreddLayer = new UNREDDLayer(); unreddLayer.setAttribute(UNREDDLayer.Attributes.LAYERTYPE, addLayerRequest.getType().name()); unreddLayer.setAttribute(UNREDDLayer.Attributes.MOSAICPATH, addLayerRequest.getStgMosaicPath()); unreddLayer.setAttribute(UNREDDLayer.Attributes.DISSMOSAICPATH, addLayerRequest.getDissMosaicPath()); unreddLayer.setAttribute(UNREDDLayer.Attributes.ORIGDATADESTPATH, addLayerRequest.getDestOrigAbsPath()); unreddLayer.setAttribute(UNREDDLayer.Attributes.RASTERPIXELHEIGHT, Integer.toString(addLayerRequest.getPixelHeight())); unreddLayer.setAttribute(UNREDDLayer.Attributes.RASTERPIXELWIDTH, Integer.toString(addLayerRequest.getPixelWidth())); unreddLayer.setAttribute(UNREDDLayer.Attributes.RASTERX0, Double.toString(addLayerRequest.getMinx())); unreddLayer.setAttribute(UNREDDLayer.Attributes.RASTERX1, Double.toString(addLayerRequest.getMaxx())); unreddLayer.setAttribute(UNREDDLayer.Attributes.RASTERY0, Double.toString(addLayerRequest.getMiny())); unreddLayer.setAttribute(UNREDDLayer.Attributes.RASTERY1, Double.toString(addLayerRequest.getMaxy())); RESTResource layerRestResource = unreddLayer.createRESTResource(); layerRestResource.setName(addLayerRequest.getName()); return layerRestResource; } @Override public Layer getLayer(String id) throws IllegalArgumentException { SearchFilter filter = new AndFilter(new CategoryFilter( UNREDDCategories.LAYER.getName(), SearchOperator.EQUAL_TO), new FieldFilter(BaseField.ID, id, SearchOperator.EQUAL_TO)); List<Resource> resourceList = geostoreClient.searchResources(filter, null, null, true, true).getList(); if (CollectionUtils.isEmpty(resourceList)) { throw new IllegalArgumentException(); } Resource layerResource = resourceList.get(0); return new GeostoreLayer(layerResource, geostoreClient); } @Override public void updateLayer(String id, AddLayerRequest layer) throws IllegalArgumentException { try { geostoreClient.updateResource(Long.parseLong(id), toRESTResource(layer)); } catch (UniformInterfaceException e) { manageGeostoreServiceException(id, e); } } @Override public void deleteLayer(String id) { try { geostoreClient.deleteResource(Long.parseLong(id)); } catch (UniformInterfaceException e) { manageGeostoreServiceException(id, e); } } /** * To follow the contract of the Layers interface we need to throw IAE in * case of an nonexistent id. Just propagate the exception to the client * otherwise * * @param id * id of the referred layer * @param e * exception got * @throws IllegalArgumentException * If the exception is due to a 404 * @throws WebApplicationException * If the exception is not a 404 */ private void manageGeostoreServiceException(String id, UniformInterfaceException e) throws IllegalArgumentException, WebApplicationException { if (e.getResponse().getStatus() == 404) { throw new IllegalArgumentException("Layer not found: " + id); } else { throw new WebApplicationException(e, e.getResponse().getStatus()); } } }
package com.fnsvalue.skillshare.dao; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.orm.ibatis.SqlMapClientTemplate; import org.springframework.stereotype.Component; import com.fnsvalue.skillshare.dto.User; @Component public class LoginDAOImpl implements LoginDAO { @Autowired private SqlMapClientTemplate sqlMapClientTemplate; public User findByUserIdAndPassword(String user_id_pk, String user_pw) { Map<String, String> paramMap = new HashMap<String, String>(); paramMap.put("user_id_pk", user_id_pk); paramMap.put("user_pw", user_pw); return (User) sqlMapClientTemplate.queryForObject("login.selectLoginUser", paramMap); } }
package com.tencent.mm.g.c; import android.content.ContentValues; import android.database.Cursor; import com.tencent.mm.sdk.e.c; import com.tencent.mm.sdk.platformtools.u; import com.tencent.mm.sdk.platformtools.x; public abstract class ai extends c { public static final String[] ciG = new String[]{"CREATE INDEX IF NOT EXISTS deleteflag_index ON Contact(deleteFlag)"}; private static final int ciP = "rowid".hashCode(); private static final int cke = "type".hashCode(); private static final int cli = "username".hashCode(); private static final int cmw = "lvbuff".hashCode(); private static final int cpI = "nickname".hashCode(); private static final int csj = "alias".hashCode(); private static final int csk = "conRemark".hashCode(); private static final int csl = "domainList".hashCode(); private static final int csm = "pyInitial".hashCode(); private static final int csn = "quanPin".hashCode(); private static final int cso = "showHead".hashCode(); private static final int csp = "weiboFlag".hashCode(); private static final int csq = "weiboNickname".hashCode(); private static final int csr = "conRemarkPYFull".hashCode(); private static final int css = "conRemarkPYShort".hashCode(); private static final int cst = "verifyFlag".hashCode(); private static final int csu = "encryptUsername".hashCode(); private static final int csv = "chatroomFlag".hashCode(); private static final int csw = "deleteFlag".hashCode(); private static final int csx = "contactLabelIds".hashCode(); private static final int csy = "descWordingId".hashCode(); private static final int csz = "openImAppid".hashCode(); public String bTi; private boolean cjI = false; private boolean clZ = false; private boolean clg = false; private boolean cpE = false; private boolean crS = false; private boolean crT = false; private boolean crU = false; private boolean crV = false; private boolean crW = false; private boolean crX = false; private boolean crY = false; private boolean crZ = false; public int csA; public String csB; public long csC; public String csD; public int csE; public int csF; public String csG; public String csH; public int csI; public int csJ; private String csK; private String csL; public String csM; public int csN; public String csO; public String csP; public String csQ; public int csR; public int csS; public String csT; public String csU; public String csV; public String csW; public String csX; public String csY; public String csZ; private boolean csa = false; private boolean csb = false; private boolean csc = false; private boolean csd = false; private boolean cse = false; private boolean csf = false; private boolean csg = false; private boolean csh = false; private boolean csi = false; public String cta; private int ctb; private String ctc; public int ctd; public String cte; private String field_alias; public int field_chatroomFlag; public String field_conRemark; public String field_conRemarkPYFull; public String field_conRemarkPYShort; public String field_contactLabelIds; public int field_deleteFlag; public String field_descWordingId; public String field_domainList; public String field_encryptUsername; public byte[] field_lvbuff; public String field_nickname; public String field_openImAppid; private String field_pyInitial; private String field_quanPin; public int field_showHead; public int field_type; public String field_username; public int field_verifyFlag; public int field_weiboFlag; public String field_weiboNickname; public int sex; public String signature; private int source; public int uin; public void setUsername(String str) { this.field_username = str; this.clg = true; } public final String getUsername() { return this.field_username; } public void du(String str) { this.field_alias = str; this.crS = true; } public String wM() { return this.field_alias; } public void dv(String str) { this.field_conRemark = str; this.crT = true; } public final String wN() { return this.field_conRemark; } public void dw(String str) { this.field_domainList = str; this.crU = true; } public void dx(String str) { this.field_nickname = str; this.cpE = true; } public final String wO() { return this.field_nickname; } public void dy(String str) { this.field_pyInitial = str; this.crV = true; } public String wP() { return this.field_pyInitial; } public void dz(String str) { this.field_quanPin = str; this.crW = true; } public String wQ() { return this.field_quanPin; } public void eD(int i) { this.field_showHead = i; this.crX = true; } public void setType(int i) { this.field_type = i; this.cjI = true; } public void eE(int i) { this.field_weiboFlag = i; this.crY = true; } public void dA(String str) { this.field_weiboNickname = str; this.crZ = true; } public void dB(String str) { this.field_conRemarkPYFull = str; this.csa = true; } public void dC(String str) { this.field_conRemarkPYShort = str; this.csb = true; } public void B(byte[] bArr) { this.field_lvbuff = bArr; this.clZ = true; } public void eF(int i) { this.field_verifyFlag = i; this.csc = true; } public void dD(String str) { this.field_encryptUsername = str; this.csd = true; } public final String wR() { return this.field_encryptUsername; } public void eG(int i) { this.field_chatroomFlag = i; this.cse = true; } public void eH(int i) { this.field_deleteFlag = i; this.csf = true; } public void dE(String str) { this.field_contactLabelIds = str; this.csg = true; } public final void dF(String str) { this.field_descWordingId = str; this.csh = true; } public final void dG(String str) { this.field_openImAppid = str; this.csi = true; } public void d(Cursor cursor) { String[] columnNames = cursor.getColumnNames(); if (columnNames != null) { int length = columnNames.length; for (int i = 0; i < length; i++) { int hashCode = columnNames[i].hashCode(); if (cli == hashCode) { this.field_username = cursor.getString(i); this.clg = true; } else if (csj == hashCode) { this.field_alias = cursor.getString(i); } else if (csk == hashCode) { this.field_conRemark = cursor.getString(i); } else if (csl == hashCode) { this.field_domainList = cursor.getString(i); } else if (cpI == hashCode) { this.field_nickname = cursor.getString(i); } else if (csm == hashCode) { this.field_pyInitial = cursor.getString(i); } else if (csn == hashCode) { this.field_quanPin = cursor.getString(i); } else if (cso == hashCode) { this.field_showHead = cursor.getInt(i); } else if (cke == hashCode) { this.field_type = cursor.getInt(i); } else if (csp == hashCode) { this.field_weiboFlag = cursor.getInt(i); } else if (csq == hashCode) { this.field_weiboNickname = cursor.getString(i); } else if (csr == hashCode) { this.field_conRemarkPYFull = cursor.getString(i); } else if (css == hashCode) { this.field_conRemarkPYShort = cursor.getString(i); } else if (cmw == hashCode) { this.field_lvbuff = cursor.getBlob(i); } else if (cst == hashCode) { this.field_verifyFlag = cursor.getInt(i); } else if (csu == hashCode) { this.field_encryptUsername = cursor.getString(i); } else if (csv == hashCode) { this.field_chatroomFlag = cursor.getInt(i); } else if (csw == hashCode) { this.field_deleteFlag = cursor.getInt(i); } else if (csx == hashCode) { this.field_contactLabelIds = cursor.getString(i); } else if (csy == hashCode) { this.field_descWordingId = cursor.getString(i); } else if (csz == hashCode) { this.field_openImAppid = cursor.getString(i); } else if (ciP == hashCode) { this.sKx = cursor.getLong(i); } } wS(); } } public final ContentValues wH() { try { if (this.clZ) { u uVar = new u(); uVar.chE(); uVar.CZ(this.csA); uVar.CZ(this.sex); uVar.Wj(this.csB); uVar.fX(this.csC); uVar.CZ(this.uin); uVar.Wj(this.csD); uVar.Wj(this.bTi); uVar.CZ(this.csE); uVar.CZ(this.csF); uVar.Wj(this.csG); uVar.Wj(this.csH); uVar.CZ(this.csI); uVar.CZ(this.csJ); uVar.Wj(this.signature); uVar.Wj(this.csK); uVar.Wj(this.csL); uVar.Wj(this.csM); uVar.CZ(this.csN); uVar.CZ(this.source); uVar.Wj(this.csO); uVar.CZ(this.field_verifyFlag); uVar.Wj(this.csP); uVar.Wj(this.csQ); uVar.CZ(this.csR); uVar.CZ(this.csS); uVar.Wj(this.csT); uVar.Wj(this.csU); uVar.Wj(this.csV); uVar.Wj(this.csW); uVar.Wj(this.csX); uVar.Wj(this.csY); uVar.Wj(this.csZ); uVar.Wj(this.cta); uVar.CZ(this.ctb); uVar.Wj(this.ctc); uVar.CZ(this.ctd); uVar.Wj(this.cte); this.field_lvbuff = uVar.chF(); } } catch (Exception e) { x.e("MicroMsg.SDK.BaseContact", "get value failed, %s", e.getMessage()); } ContentValues contentValues = new ContentValues(); if (this.field_username == null) { this.field_username = ""; } if (this.clg) { contentValues.put("username", this.field_username); } if (this.field_alias == null) { this.field_alias = ""; } if (this.crS) { contentValues.put("alias", this.field_alias); } if (this.field_conRemark == null) { this.field_conRemark = ""; } if (this.crT) { contentValues.put("conRemark", this.field_conRemark); } if (this.field_domainList == null) { this.field_domainList = ""; } if (this.crU) { contentValues.put("domainList", this.field_domainList); } if (this.field_nickname == null) { this.field_nickname = ""; } if (this.cpE) { contentValues.put("nickname", this.field_nickname); } if (this.field_pyInitial == null) { this.field_pyInitial = ""; } if (this.crV) { contentValues.put("pyInitial", this.field_pyInitial); } if (this.field_quanPin == null) { this.field_quanPin = ""; } if (this.crW) { contentValues.put("quanPin", this.field_quanPin); } if (this.crX) { contentValues.put("showHead", Integer.valueOf(this.field_showHead)); } if (this.cjI) { contentValues.put("type", Integer.valueOf(this.field_type)); } if (this.crY) { contentValues.put("weiboFlag", Integer.valueOf(this.field_weiboFlag)); } if (this.field_weiboNickname == null) { this.field_weiboNickname = ""; } if (this.crZ) { contentValues.put("weiboNickname", this.field_weiboNickname); } if (this.field_conRemarkPYFull == null) { this.field_conRemarkPYFull = ""; } if (this.csa) { contentValues.put("conRemarkPYFull", this.field_conRemarkPYFull); } if (this.field_conRemarkPYShort == null) { this.field_conRemarkPYShort = ""; } if (this.csb) { contentValues.put("conRemarkPYShort", this.field_conRemarkPYShort); } if (this.clZ) { contentValues.put("lvbuff", this.field_lvbuff); } if (this.csc) { contentValues.put("verifyFlag", Integer.valueOf(this.field_verifyFlag)); } if (this.field_encryptUsername == null) { this.field_encryptUsername = ""; } if (this.csd) { contentValues.put("encryptUsername", this.field_encryptUsername); } if (this.cse) { contentValues.put("chatroomFlag", Integer.valueOf(this.field_chatroomFlag)); } if (this.csf) { contentValues.put("deleteFlag", Integer.valueOf(this.field_deleteFlag)); } if (this.field_contactLabelIds == null) { this.field_contactLabelIds = ""; } if (this.csg) { contentValues.put("contactLabelIds", this.field_contactLabelIds); } if (this.field_descWordingId == null) { this.field_descWordingId = ""; } if (this.csh) { contentValues.put("descWordingId", this.field_descWordingId); } if (this.csi) { contentValues.put("openImAppid", this.field_openImAppid); } if (this.sKx > 0) { contentValues.put("rowid", Long.valueOf(this.sKx)); } return contentValues; } public void eI(int i) { this.csA = i; this.clZ = true; } public void eJ(int i) { this.sex = i; this.clZ = true; } public void dH(String str) { this.csB = str; this.clZ = true; } public void ar(long j) { this.csC = j; this.clZ = true; } public void eK(int i) { this.uin = i; this.clZ = true; } public void dI(String str) { this.csD = str; this.clZ = true; } public void dJ(String str) { this.bTi = str; this.clZ = true; } public void eL(int i) { this.csE = i; this.clZ = true; } public void eM(int i) { this.csF = i; this.clZ = true; } public void dK(String str) { this.csG = str; this.clZ = true; } public void dL(String str) { this.csH = str; this.clZ = true; } public void eN(int i) { this.csI = i; this.clZ = true; } public void eO(int i) { this.csJ = i; this.clZ = true; } public void dM(String str) { this.signature = str; this.clZ = true; } public String getProvince() { return this.csK; } public void dN(String str) { this.csK = str; this.clZ = true; } public String getCity() { return this.csL; } public void dO(String str) { this.csL = str; this.clZ = true; } public void dP(String str) { this.csM = str; this.clZ = true; } public void eP(int i) { this.csN = i; this.clZ = true; } public int getSource() { return this.source; } public void setSource(int i) { this.source = i; this.clZ = true; } public void dQ(String str) { this.csO = str; this.clZ = true; } public void dR(String str) { this.csP = str; this.clZ = true; } public void dS(String str) { this.csQ = str; this.clZ = true; } public void eQ(int i) { this.csR = i; this.clZ = true; } public void eR(int i) { this.csS = i; this.clZ = true; } public void dT(String str) { this.csT = str; this.clZ = true; } public void dU(String str) { this.csU = str; this.clZ = true; } public void dV(String str) { this.csV = str; this.clZ = true; } public void dW(String str) { this.csW = str; this.clZ = true; } public void dX(String str) { this.csX = str; this.clZ = true; } public void dY(String str) { this.csY = str; this.clZ = true; } public void dZ(String str) { this.csZ = str; this.clZ = true; } public void ea(String str) { this.cta = str; this.clZ = true; } public final void eS(int i) { this.ctb = i; this.clZ = true; } public final void eT(int i) { this.ctd = i; this.clZ = true; } public final void eb(String str) { this.cte = str; this.clZ = true; } public final void wS() { try { if (this.field_lvbuff != null && this.field_lvbuff.length != 0) { u uVar = new u(); int by = uVar.by(this.field_lvbuff); if (by != 0) { x.e("MicroMsg.SDK.BaseContact", "parse LVBuffer error:" + by); return; } this.csA = uVar.getInt(); this.sex = uVar.getInt(); this.csB = uVar.getString(); this.csC = uVar.getLong(); this.uin = uVar.getInt(); this.csD = uVar.getString(); this.bTi = uVar.getString(); this.csE = uVar.getInt(); this.csF = uVar.getInt(); this.csG = uVar.getString(); this.csH = uVar.getString(); this.csI = uVar.getInt(); this.csJ = uVar.getInt(); this.signature = uVar.getString(); this.csK = uVar.getString(); this.csL = uVar.getString(); this.csM = uVar.getString(); this.csN = uVar.getInt(); this.source = uVar.getInt(); this.csO = uVar.getString(); this.field_verifyFlag = uVar.getInt(); this.csP = uVar.getString(); if (!uVar.chD()) { this.csQ = uVar.getString(); } if (!uVar.chD()) { this.csR = uVar.getInt(); } if (!uVar.chD()) { this.csS = uVar.getInt(); } if (!uVar.chD()) { this.csT = uVar.getString(); } if (!uVar.chD()) { this.csU = uVar.getString(); } if (!uVar.chD()) { this.csV = uVar.getString(); } if (!uVar.chD()) { this.csW = uVar.getString(); } if (!uVar.chD()) { this.csX = uVar.getString(); } if (!uVar.chD()) { this.csY = uVar.getString(); } if (!uVar.chD()) { this.csZ = uVar.getString(); } if (!uVar.chD()) { this.cta = uVar.getString(); } if (!uVar.chD()) { this.ctb = uVar.getInt(); } if (!uVar.chD()) { this.ctc = uVar.getString(); } if (!uVar.chD()) { this.ctd = uVar.getInt(); } if (!uVar.chD()) { this.cte = uVar.getString(); } } } catch (Exception e) { x.e("MicroMsg.SDK.BaseContact", "get value failed"); } } }
package com.example.passadicosspot.Fragments; import android.content.Intent; import android.os.Bundle; import androidx.fragment.app.Fragment; import androidx.navigation.Navigation; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.example.passadicosspot.Adapters.FeedAdapter; import com.example.passadicosspot.MainActivity_Navigation; import com.example.passadicosspot.R; import com.example.passadicosspot.SignInActivity; import com.example.passadicosspot.classes.Imagem; import com.firebase.ui.firestore.FirestoreRecyclerOptions; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.firestore.FirebaseFirestore; import com.google.firebase.firestore.Query; public class ProfileFragment extends Fragment { private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; private String mParam1; private String mParam2; private ImageView logout; private ImageButton user_profile_photo; private TextView user_profile_name; private TextView user_type; private FirebaseFirestore db= FirebaseFirestore.getInstance(); //RecyclerView stuff private RecyclerView recyclerView; private LinearLayoutManager linearLayoutManager; private FeedAdapter feedAdapter; public ProfileFragment() { // Required empty public constructor } public static ProfileFragment newInstance(String param1, String param2) { ProfileFragment fragment = new ProfileFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_profile, container, false); user_profile_name = view.findViewById(R.id.user_profile_name); user_profile_name.setText(((MainActivity_Navigation)getActivity()).getUsername()); user_profile_photo= view.findViewById(R.id.user_profile_photo); FirebaseUser User = ((MainActivity_Navigation)getActivity()).getmFirebaseUser(); if (User.getPhotoUrl() == null) { Glide.with(view).load(R.drawable.ic_baseline_account_circle_24).into(user_profile_photo); } else { Glide.with(view) .load(User.getPhotoUrl()) .into(user_profile_photo); } logout = view.findViewById(R.id.logoutIcon); logout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { logout(); } }); user_type=view.findViewById(R.id.user_type); user_type.setText(((MainActivity_Navigation)getActivity()).getTypeUser()); recyclerView= view.findViewById(R.id.recyclerview); linearLayoutManager = new LinearLayoutManager(getContext()); linearLayoutManager.setStackFromEnd(true); recyclerView.setLayoutManager(linearLayoutManager); Query query = FirebaseFirestore.getInstance().collection("Imagens").whereEqualTo("username",((MainActivity_Navigation)getActivity()).getUsername()); FirestoreRecyclerOptions<Imagem> options = new FirestoreRecyclerOptions.Builder<Imagem>().setQuery(query, Imagem.class).build(); feedAdapter = new FeedAdapter(options, new FeedAdapter.OnRecyclerItemClickListener() { @Override public void OnRecyclerItemClick(Imagem i) { Bundle bundle = new Bundle(); bundle.putSerializable("param1", i); bundle.putSerializable("param2", ((MainActivity_Navigation) getActivity()).getUser()); Navigation.findNavController(getActivity().findViewById(R.id.nav_host_fragment)).navigate(R.id.action_profileFragment_to_postFragment, bundle); } }); feedAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { @Override public void onItemRangeInserted(int positionStart, int itemCount) { recyclerView.scrollToPosition(feedAdapter.getItemCount()-1); } }); recyclerView.setAdapter(feedAdapter); return view; } private void logout(){ ((MainActivity_Navigation)getActivity()).getAuth().signOut(); //mFirebaseAuth.signOut(); ((MainActivity_Navigation)getActivity()).getClient().signOut(); //((MainActivity_Navigation)getActivity()).getUsename()= "anonymous" ; startActivity(new Intent(this.getContext(), SignInActivity.class)); } @Override public void onStart() { super.onStart(); feedAdapter.startListening(); } @Override public void onStop() { super.onStop(); feedAdapter.stopListening(); } }
package co.paikama.wfa; import org.springframework.web.reactive.function.server.ServerRequest; import org.springframework.web.reactive.function.server.ServerResponse; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import static org.springframework.http.MediaType.APPLICATION_JSON; import static org.springframework.web.reactive.function.BodyInserters.fromObject; public class PersonHandler { private final PersonRepository repository; public PersonHandler(PersonRepository repository) { this.repository = repository; } public Mono<ServerResponse> get(ServerRequest request) { final Integer id = Integer.valueOf(request.pathVariable("id")); final Mono<ServerResponse> notFound = ServerResponse.notFound().build(); final Mono<Person> personMono = repository.get(id); return personMono.flatMap(person -> ServerResponse.ok().contentType(APPLICATION_JSON).body(fromObject(person)) ).switchIfEmpty(notFound); } public Mono<ServerResponse> all(ServerRequest request) { final Flux<Person> personFlux = repository.all(); return ServerResponse.ok().contentType(APPLICATION_JSON).body(personFlux, Person.class); } public Mono<ServerResponse> save(ServerRequest request) { final Mono<Person> personMono = request.bodyToMono(Person.class); return ServerResponse.ok().build(repository.save(personMono)); } }
package ro.ase.cts.program; import ro.ase.cts.clase.Bilet; import ro.ase.cts.clase.BiletAdapter; import ro.ase.cts.clase.BiletAdaptorClase; import ro.ase.cts.clase.IBiletOnline; public class Main { public static void rezervaSiAfiseazaBiletLaCasa(Bilet bilet) { bilet.rezervare(); bilet.vanzare(); } public static void rezervaSiAfiseazaBiletOnline(IBiletOnline bilet) { bilet.rezervaBiletOnline(); bilet.vindeBiletOnline(); } public static void main(String[] args) { Bilet bilet = new Bilet(300); rezervaSiAfiseazaBiletLaCasa(bilet); IBiletOnline adaptor = new BiletAdapter(bilet); rezervaSiAfiseazaBiletOnline(adaptor); IBiletOnline adaptorClase = new BiletAdaptorClase(500); rezervaSiAfiseazaBiletOnline(adaptorClase); } }
package com.itsdf07.fcommon.example; import android.widget.Button; import android.widget.Toast; import com.itsdf07.R; import com.itsdf07.fcommon.mvp.BaseMvpActivity; import butterknife.BindView; import butterknife.OnClick; /** * @Description * @Author itsdf07 * @Time 2018/10/16/016 */ public class ExampleActivity extends BaseMvpActivity<ExamplePresenterImpl, ExampleModelImpl> implements ExampleContract.View { @BindView(R.id.btn_test) Button btnTest; @Override public void initPresenter() { presenter.setVM(this, model); } @Override public void initDataBeforeView() { } @Override public void initView() { } @Override public void initDataAfterView() { } @Override public int getLayoutId() { return R.layout.activity_example; } @OnClick(R.id.btn_test) public void onViewClicked() { Toast.makeText(this, presenter.textMethod(), Toast.LENGTH_SHORT).show(); } }
package com.werth; import java.util.*; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.Stream; public class Streams { public static void main(String[] args) { // // TODO: 1/5/21 Use .get() if an optional is returned // // TODO: 1/2/21 Create a HashMap using Streams String[] arr = {"this", "is", "a", "string", "is", "a"}; Map<String, Long> map = Arrays.stream(arr) .collect(Collectors.groupingBy( //You could also add a .filter(String::length) <- Method Reference word -> word, //Or you can call Function.identity() instead of word->word Collectors.counting() )); System.out.println(map); // TODO: 1/4/21 Sorting Using A Comparator List<String> strings = new ArrayList<>(); strings.add("1234567"); strings.add("123"); strings.add("12"); strings.add("12345"); strings.add("123456789"); Comparator<String> compareLength = (l1, l2) -> l1.length() - l2.length(); strings.stream() .sorted(compareLength) .forEach(System.out::println); // .... OR .... strings.stream() .sorted(Comparator.comparing(String::length)) .forEach(System.out::println); // TODO: 1/4/21 Map From String To Int MapToInt(String::length) String[] strs = {"Hello", "I", "Am", "String", "Which", "String", "is", "longest"}; //String[] noStrs = {}; Arrays.stream(strs) .sorted(compareLength) .mapToInt(String::length) .forEach(System.out::println); //// TODO: 1/4/21 Optionals using .get() to retrieve value - .orElse("Do something else!") System.out.println(Optional.of(Arrays.stream(strs) .max(Comparator.comparingInt(String::length)) .orElse("Not Found")) .get()); // TODO: 1/4/21 ifPresent() do something.. / findFirst() instance of something.. Stream.of(1,2,3,4,5,6) .filter(e -> e > 2) .findFirst() .ifPresent(System.out::println); //If present will resolve our stream if the item is present! System.out.println(" --- --- --- "); // TODO: 1/5/21 .distinct() - limits to only one instance of the element - Strings, Integers etc. Integer[] integers = {1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6}; Stream.of(integers) .distinct() .forEach(System.out::println); String[] strings1 = {"hi", "hi", "hello", "hello", "you", "you", "look", "nice"}; Stream.of(strings1) .distinct() .forEach(System.out::println); System.out.println(" --- --- --- "); // TODO: 1/5/21 using .rangeClosed you can gain access to element at i List<String> strings2 = Arrays.asList(strings1); IntStream.rangeClosed(1, strings2.size()) .mapToObj(i -> String.format("%d. %s", i, strings2.get(i - 1))) .forEach(System.out::println); System.out.println(" --- --- --- "); // TODO: 1/5/21 Stepping through with Streams, using i List<String> str5000 = new ArrayList<>(); str5000.add("andy"); str5000.add("zach"); str5000.add("barb"); str5000.add("ying"); str5000.add("candice"); str5000.add("xi"); IntStream.iterate(0, i -> i + 1) .mapToObj(i -> String.format("%d. %s", i + 1, str5000.get(i))) .limit(str5000.size()) .forEach(System.out::println); System.out.println(" --- --- --- "); // TODO: 1/5/21 .peek() great for debugging. str5000.stream() .peek(name -> System.out.println("=======>" + name)) .filter(letter -> letter.startsWith("b")) .forEach(System.out::println); System.out.println(" --- --- --- "); // Follows Open Closed Principle - you are able to keep your variables encapsulated by passing a function - // instead of modifying your existing code base. // TODO: 1/5/21 Higher Order Functions - functions that take other functions ArrayList<XTree> xForest = XTreeActions.createSetOfTrees(1, 1, "Evergreen", true); xForest.add(new XTree(1, "Apple", false)); xForest.add(new XTree(1, "Pear", true)); xForest.add(new XTree(1, "Cherry", false)); xForest.add(new XTree(1, "Chestnut", false)); xForest.add(new XTree(1, "Cherry", true)); xForest.add(new XTree(1, "Maple", false)); xForest.add(new XTree(1, "Dogwood", true)); Predicate<XTree> checkCherry = xTree -> xTree.getTreeType().equals("Cherry"); Predicate<XTree> checkHealth = xTree -> xTree.getTreeInGoodHealth().equals(true); XTree cherry = xForest.stream() .filter(checkCherry.and(checkHealth)) .findFirst() .orElseThrow(NullPointerException::new); functionTest(cherry, checkCherry); functionTest(cherry, checkCherry.and(checkHealth)); } public static void functionTest(XTree xTree, Predicate<XTree> checker) { if(checker.test(xTree)) { System.out.println(xTree.returnAllTreeInfo()); } } }
package com.finddreams.androidnewstack.mvp.presenter; import com.finddreams.androidnewstack.mvp.view.IView; /** * Created by lx on 2016/10/14. */ public abstract class BasePresenter<T extends IView> implements IPresenter<T> { protected static final String TAG = "BasePresenter"; protected T mView; @Override public void attachView(T view) { mView = view; } @Override public void detachView() { mView = null; } public boolean isViewAttached() { return mView != null; } public T getView() { return mView; } }
package exercise; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** * Created by acedric on 20/04/2017. */ public class Sample2 { WebDriver driver; @DataProvider public Object[][] testData(){ Object[][] data = new Object[2][2]; data[0][0] = "cedricarno@gmail.com"; data[0][1] = "Cedric"; data[0][0] = "cedricarno@gmail.com"; data[0][1] = "Cedric"; return data; } @BeforeClass public void setUp(){ System.setProperty("webdriver.chrome.driver", "C:\\Workspace\\execise\\src\\test\\java\\jooqexercise\\chromedriver.exe"); driver = new ChromeDriver(); driver.get("http://gmail.com"); // PageFactory.initElements(driver, this); } @Test(dataProvider = "testData") public void test(String name, String name2){ driver.findElement(By.id("identifierId")).sendKeys(name); } }
package com.argentinatecno.checkmanager.main.fragment_checks.events; import com.argentinatecno.checkmanager.entities.Check; import java.util.List; public class FragmentChecksEvent { private int type; private Check check; private List<Check> checksList; private String error; private String sucess; private String empty; public static final int deleteType = 0; public static final int selectType = 1; public static final int updateType = 2; public static final int updateBackType = 3; public static final int selectSearchType = 4; public static final String sucessDelete = "Cheque eliminado."; public static final String errorDelete = "Error al intentar eliminar el cheque."; public static final String sucessUpdate = "Cheque entregado."; public static final String errorUpdate = "Error al intentar realizar la entrega del cheque."; public static final String sucessBackUpdate = "Cheque actualizado."; public static final String errorBackUpdate = "Error al intentar actualizar al cheque."; public static final String errorEmpty = "Ingrese el destino del cheque."; public static final String searchEmpty = "No se encontrarón cheques."; public List<Check> getChecksList() { return checksList; } public void setChecksList(List<Check> checksList) { this.checksList = checksList; } public String getSucess() { return sucess; } public void setSucess(String sucess) { this.sucess = sucess; } public int getType() { return type; } public void setType(int type) { this.type = type; } public Check getCheck() { return check; } public void setCheck(Check check) { this.check = check; } public String getError() { return error; } public void setError(String error) { this.error = error; } public String getEmpty() { return empty; } public void setEmpty(String empty) { this.empty = empty; } }
package com.nju.edu.cn.service.impl; import com.nju.edu.cn.dao.CommentRepository; import com.nju.edu.cn.dao.ContractRepository; import com.nju.edu.cn.dao.MessageRepository; import com.nju.edu.cn.dao.UserRepository; import com.nju.edu.cn.entity.Comment; import com.nju.edu.cn.entity.Contract; import com.nju.edu.cn.entity.Message; import com.nju.edu.cn.entity.User; import com.nju.edu.cn.exception.InvalidRequestException; import com.nju.edu.cn.model.CommentModel; import com.nju.edu.cn.service.CommentService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * Created by shea on 2018/9/7. */ @Service public class CommentServiceImpl implements CommentService { @Autowired private CommentRepository commentRepository; @Autowired private ContractRepository contractRepository; @Autowired private UserRepository userRepository; @Autowired private MessageRepository messageRepository; @Override public List<CommentModel> getComments(Long contractId, Long userId, Integer page, Integer pageNum) { Sort sort = new Sort(Sort.Direction.DESC, "createTime"); PageRequest pageRequest = new PageRequest(page, pageNum, sort); Page<Comment> commentPage = commentRepository.findByContract_ContractId(contractId, pageRequest); List<Comment> comments = commentPage.getContent(); List<CommentModel> commentModels = new ArrayList<>(); comments.forEach(comment -> { CommentModel commentModel = new CommentModel(); BeanUtils.copyProperties(comment, commentModel); commentModels.add(commentModel); }); return commentModels; } @Override public void reply(Long contractId, Long userId, Long commentId, String content) { Comment fatherComment = commentRepository.findByCommentId(commentId); Contract contract = contractRepository.findByContractId(contractId); if (contract == null) throw new InvalidRequestException("合约不存在"); User user = userRepository.findByUserId(userId); if (user == null) throw new InvalidRequestException("评论用户不存在"); User fatherCommentUser = userRepository.findByUserId(fatherComment.getUserId()); if (fatherCommentUser == null) throw new InvalidRequestException("被回复用户不存在"); Comment comment = new Comment(); comment.setContent(content); comment.setContract(contract); comment.setUser(user); comment.setUserId(userId); comment.setFatherComment(fatherComment); comment.setCreateTime(new Date(System.currentTimeMillis())); comment = commentRepository.save(comment); //向被回复者发送消息 Message message = new Message(); message.setComment(comment); message.setReceiver(fatherCommentUser); message.setHasRead(false); messageRepository.save(message); } @Override public void postComment(Long contractId, Long userId, String content) { Contract contract = contractRepository.findByContractId(contractId); if (contract == null) throw new InvalidRequestException("合约不存在"); User user = userRepository.findByUserId(userId); if (user == null) throw new InvalidRequestException("评论用户不存在"); Comment comment = new Comment(); comment.setContent(content); comment.setContract(contract); comment.setContractId(contractId); comment.setUser(user); comment.setCreateTime(new Date(System.currentTimeMillis())); commentRepository.save(comment); } @Override public Integer getPageNum(Long contractId) { return commentRepository.countByContractId(contractId); } }
/* * Created on Apr 11, 2007 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package com.ibm.ive.tools.japt; import com.ibm.jikesbt.BT_Accessor; import com.ibm.jikesbt.BT_AccessorVector; import com.ibm.jikesbt.BT_Class; import com.ibm.jikesbt.BT_ClassVector; import com.ibm.jikesbt.BT_CodeAttribute; import com.ibm.jikesbt.BT_Field; import com.ibm.jikesbt.BT_Ins; import com.ibm.jikesbt.BT_InsVector; import com.ibm.jikesbt.BT_LoadLocalIns; import com.ibm.jikesbt.BT_LocalIns; import com.ibm.jikesbt.BT_Member; import com.ibm.jikesbt.BT_Method; import com.ibm.jikesbt.BT_MethodCallSite; import com.ibm.jikesbt.BT_MethodCallSiteVector; import com.ibm.jikesbt.BT_MethodSignature; import com.ibm.jikesbt.BT_Repository; public class AccessorMethod { final BT_Member target; final BT_Class throughClass; public final BT_Method method; AccessorMethod(BT_Class declaringClass, BT_Method toMethod, BT_Class throughClass, boolean isSpecial) { method = createMethod(declaringClass, toMethod, throughClass, isSpecial); target = toMethod; this.throughClass = throughClass; } AccessorMethod(BT_Class inClass, BT_Field toField, BT_Class throughClass, boolean isGetter) { method = createMethod(inClass, toField, throughClass, isGetter); target = toField; this.throughClass = throughClass; } AccessorMethod(BT_Method method, BT_Member target, BT_Class throughClass) { this.method = method; this.target = target; this.throughClass = throughClass; } public String toString() { StringBuffer buffer = new StringBuffer("Accessor "); buffer.append(method.useName()); if(isFieldGetter()) { buffer.append(" for read access to "); } else if(isFieldSetter()) { buffer.append(" for write access to "); } else if(isSpecialInvocation()) { buffer.append(" for special invocation of "); } else { buffer.append(" for invocation of "); } buffer.append(throughClass.useName()); buffer.append('.'); buffer.append(target.qualifiedName()); return buffer.toString(); } /** * if the given method is an accessor method, returns an AccessorMethod object * for that method. Otherwise returns null. * @param method * @return */ static AccessorMethod getAccessor(BT_Method method) { if(!method.isSynthetic()) { return null; } BT_CodeAttribute code = method.getCode(); if(code == null) { return null; } BT_MethodCallSiteVector calledMethods = code.calledMethods; if(calledMethods.size() > 1) { return null; } BT_AccessorVector accessedFields = code.accessedFields; if(calledMethods.size() == 1) { if(accessedFields.size() != 0) { return null; } return getMethodAccessor(method, calledMethods.elementAt(0)); } if(accessedFields.size() != 1) { return null; } return getFieldAccessor(method, accessedFields.elementAt(0)); } static AccessorMethod getFieldAccessor(BT_Method method, BT_Accessor accessor) { BT_Field targetField = accessor.getTarget(); BT_Class throughClass = accessor.getClassTarget(); BT_Repository rep = method.getDeclaringClass().getRepository(); BT_CodeAttribute code = accessor.from; BT_InsVector instructions = code.getInstructions(); if(instructions.size() < 2) { return null; } BT_Ins secondLastInstruction = instructions.elementAt(instructions.size() - 2); if(secondLastInstruction != accessor.getInstruction()) { return null; } BT_Ins lastInstruction = instructions.lastElement(); if(!lastInstruction.isReturnIns()) { return null; } int returnOpcode = lastInstruction.opcode; BT_Ins firstInstruction = instructions.firstElement(); BT_Class fieldType = targetField.getFieldType(); BT_MethodSignature sig = method.getSignature(); if(returnOpcode == fieldType.getOpcodeForReturn()) { //check for a getter if(targetField.isStatic()) { //check for a getStatic if(!method.isStatic()) { return null; } if(firstInstruction != secondLastInstruction) { return null; } if(firstInstruction.opcode != BT_Ins.opc_getstatic) { return null; } if(!sig.returnType.equals(fieldType) || sig.types.size() != 0) { return null; } return new AccessorMethod(method, targetField, throughClass); } else { //check for a getField if(method.isStatic()) { return null; } BT_Ins secondInstruction = instructions.elementAt(1); if(secondInstruction != secondLastInstruction) { return null; } if(secondInstruction.opcode != BT_Ins.opc_getfield) { return null; } if(BT_LocalIns.getBaseOpcode(firstInstruction.opcode) != targetField.getDeclaringClass().getOpcodeForLoadLocal()) { return null; } BT_LoadLocalIns loadLocalIns = (BT_LoadLocalIns) firstInstruction; if(loadLocalIns.target.localNr != 0) { return null; } if(!sig.returnType.equals(fieldType) || sig.types.size() != 0) { return null; } return new AccessorMethod(method, targetField, throughClass); } } else if(returnOpcode == targetField.getDeclaringClass().getRepository().getVoid().getOpcodeForReturn()) { BT_Ins secondInstruction = instructions.elementAt(1); //check for a setter if(targetField.isStatic()) { //check for a putstatic if(!method.isStatic()) { return null; } if(secondInstruction != secondLastInstruction) { return null; } if(secondInstruction.opcode != BT_Ins.opc_putstatic) { return null; } if(BT_LocalIns.getBaseOpcode(firstInstruction.opcode) != fieldType.getOpcodeForLoadLocal()) { return null; } BT_LoadLocalIns localIns = (BT_LoadLocalIns) firstInstruction; if(localIns.target.localNr != 0) { return null; } if(!sig.returnType.equals(rep.getVoid()) || sig.types.size() != 1 || !sig.types.elementAt(0).equals(fieldType)) { return null; } return new AccessorMethod(method, targetField, throughClass); } else { //check for a putfield if(method.isStatic()) { return null; } BT_Ins thirdInstruction = instructions.elementAt(2); if(thirdInstruction != secondLastInstruction) { return null; } if(thirdInstruction.opcode != BT_Ins.opc_putfield) { return null; } if(BT_LocalIns.getBaseOpcode(secondInstruction.opcode) != fieldType.getOpcodeForLoadLocal()) { return null; } BT_LoadLocalIns localIns = (BT_LoadLocalIns) secondInstruction; if(localIns.target.localNr != 1) { return null; } if(BT_LocalIns.getBaseOpcode(firstInstruction.opcode) != targetField.getDeclaringClass().getOpcodeForLoadLocal()) { return null; } localIns = (BT_LoadLocalIns) firstInstruction; if(localIns.target.localNr != 0) { return null; } if(!sig.returnType.equals(rep.getVoid()) || sig.types.size() != 1 || !sig.types.elementAt(0).equals(fieldType)) { return null; } return new AccessorMethod(method, targetField, throughClass); } } return null; } static AccessorMethod getMethodAccessor(BT_Method method, BT_MethodCallSite accessor) { if(!method.isPublic()) { return null; } BT_Method target = accessor.getTarget(); boolean isStatic = target.isStatic(); if(isStatic) { if(!method.isStatic()) { return null; } } else { if(method.isStatic()) { return null; } } BT_MethodSignature sig = method.getSignature(); BT_MethodSignature targetSignature = target.getSignature(); if(!sig.equals(targetSignature)) { return null; } BT_Class throughClass = accessor.getClassTarget(); BT_CodeAttribute code = accessor.from; BT_InsVector instructions = code.getInstructions(); if(instructions.size() < 2) { return null; } BT_Ins secondLastInstruction = instructions.elementAt(instructions.size() - 2); if(secondLastInstruction != accessor.getInstruction()) { return null; } BT_Ins lastInstruction = instructions.lastElement(); if(!lastInstruction.isReturnIns()) { return null; } int returnOpcode = lastInstruction.opcode; if(returnOpcode != sig.returnType.getOpcodeForReturn()) { return null; } BT_Ins firstInstruction = instructions.firstElement(); int sigSize = sig.types.size(); int virtualSigSize; int i; if(isStatic) { i = 0; virtualSigSize = sigSize; } else { if(BT_LocalIns.getBaseOpcode(firstInstruction.opcode) != target.getDeclaringClass().getOpcodeForLoadLocal()) { return null; } i = 1; virtualSigSize = sigSize + 1; } if(virtualSigSize != instructions.size() - 2) { return null; } for(int j=0; i<virtualSigSize; i++,j++) { BT_Ins instruction = instructions.elementAt(i); BT_Class type = sig.types.elementAt(j); if(BT_LocalIns.getBaseOpcode(instruction.opcode) != type.getOpcodeForLoadLocal()) { return null; } } return new AccessorMethod(method, target, throughClass); } public BT_Member getTarget() { return target; } public boolean removeIfUnused() { if(method.callSites.size() == 0) { remove(); return true; } return false; } /** * @param declaringClass * @param toMethod * @param isSuper */ private static BT_Method createMethod(BT_Class declaringClass, BT_Method toMethod, BT_Class throughClass, boolean isSpecial) { BT_MethodSignature signature = toMethod.getSignature(); String name = getMethodAccessorName(toMethod, signature, throughClass, isSpecial); short accessFlags = BT_Method.PUBLIC | BT_Method.SYNTHETIC; if(toMethod.isStatic()) { if(isSpecial) { throw new IllegalArgumentException(); } accessFlags |= BT_Method.STATIC; } BT_Method method = BT_Method.createMethod(declaringClass, accessFlags, signature, name); method.replaceBodyWithMethodCall(toMethod, throughClass, isSpecial); return method; } /** * @param clazz * @param toField * @param isGetter */ private static BT_Method createMethod(BT_Class inClass, BT_Field toField, BT_Class throughClass, boolean isGetter) { BT_Repository rep = inClass.getRepository(); BT_Method method; if(isGetter) { BT_MethodSignature signature = BT_MethodSignature.create( toField.getFieldType(), BT_ClassVector.emptyVector, rep); method = createFieldAccessorMethod(inClass, toField, throughClass, signature, isGetter); method.replaceBodyWithGetField(toField, throughClass); } else { BT_MethodSignature signature = BT_MethodSignature.create( rep.getVoid(), new BT_ClassVector(new BT_Class[] {toField.getFieldType()}), rep); method = createFieldAccessorMethod(inClass, toField, throughClass, signature, isGetter); method.replaceBodyWithSetField(toField, throughClass); } return method; } private static String makeUniqueNameInternal(BT_Class inClass, String name, BT_MethodSignature signature) { return makeUniqueName(inClass, name, signature); } public static String makeUniqueName(BT_Class inClass, String name, BT_MethodSignature signature) { while (inClass.findInheritedMethod(name, signature) != null) { name += '_'; } return name; } private static String getMethodAccessorName(BT_Method method, BT_MethodSignature signature, BT_Class throughClass, boolean isSpecial) { StringBuffer ret = getPrefix(method, throughClass); if(method.isConstructor()) { ret.append("init$"); } else { if(isSpecial) { ret.append("spec$"); } ret.append(method.getName()); } String name = ret.toString(); return makeUniqueNameInternal(throughClass, name, signature); } private static StringBuffer getPrefix(BT_Member member, BT_Class throughClass) { StringBuffer ret = new StringBuffer(); String className = throughClass.getName().replace('.', '$'); ret.append(className); ret.append('$'); return ret; } private static String getFieldAccessorName(BT_Field field, BT_MethodSignature signature, BT_Class throughClass, boolean isGetter) { StringBuffer ret = getPrefix(field, throughClass); ret.append(isGetter ? 'g' : 's'); ret.append('$'); ret.append(field.getName()); String name = ret.toString(); return makeUniqueNameInternal(throughClass, name, signature); } private static BT_Method createFieldAccessorMethod(BT_Class inClass, BT_Field toField, BT_Class throughClass, BT_MethodSignature signature, boolean isGetter) { String name = getFieldAccessorName(toField, signature, throughClass, isGetter); short accessFlags = BT_Method.PUBLIC | BT_Method.SYNTHETIC; if(toField.isStatic()) { accessFlags |= BT_Method.STATIC; } return BT_Method.createMethod(inClass, accessFlags, signature, name); } public boolean invokesSpecial(BT_Method target, BT_Class throughClass) { return target.equals(this.target) && throughClass.equals(this.throughClass) && isSpecialInvocation(); } public boolean invokes(BT_Method target, BT_Class throughClass) { return target.equals(this.target) && throughClass.equals(this.throughClass) && isRegularInvocation(); } public boolean sets(BT_Field target, BT_Class throughClass) { return target.equals(this.target) && throughClass.equals(this.throughClass) && isFieldSetter(); } public boolean gets(BT_Field target, BT_Class throughClass) { return target.equals(this.target) && throughClass.equals(this.throughClass) && isFieldGetter(); } private boolean isFieldGetter() { BT_AccessorVector accessedFields = method.getCode().accessedFields; if(accessedFields.size() > 0) { BT_Accessor accessor = accessedFields.firstElement(); return accessor.instruction.isFieldReadIns(); } return false; } private boolean isFieldSetter() { BT_AccessorVector accessedFields = method.getCode().accessedFields; if(accessedFields.size() > 0) { BT_Accessor accessor = accessedFields.firstElement(); return accessor.instruction.isFieldWriteIns(); } return false; } private boolean isSpecialInvocation() { BT_MethodCallSiteVector calledMethods = method.getCode().calledMethods; if(calledMethods.size() > 0) { BT_MethodCallSite site = calledMethods.firstElement(); return site.instruction.isInvokeSpecialIns(); } return false; } private boolean isRegularInvocation() { BT_MethodCallSiteVector calledMethods = method.getCode().calledMethods; if(calledMethods.size() > 0) { /* access to constructors and private methods is also by invokespecial. * * For others, a regular invocation is by invokevirtual, invokeinterface, or invokestatic. */ BT_MethodCallSite site = calledMethods.firstElement(); BT_Method target = site.getTarget(); if(target.isConstructor() || target.isPrivate() || target.isStatic()) { return true; } return !site.instruction.isInvokeSpecialIns(); } return false; } public boolean isUnused() { return method.callSites == null || method.callSites.size() == 0; } public void remove() { method.remove(); BT_Class declaringClass = method.getDeclaringClass(); JaptRepository repository = (JaptRepository) declaringClass.getRepository(); AccessorMethodGenerator gen = repository.getAccessorMethodGenerator(declaringClass); gen.removeAccessor(this); } }
package com.codegym.model; import com.codegym.model.khachhang.KhachHang; import java.util.ArrayList; public class History extends ArrayList<KhachHang> { }
package day34_Constructor_Encapsulation; public class Calculator1 { Floor1 floor1; Carpet1 carpet1; public Calculator1(Floor1 floor1, Carpet1 carpet1) { this.floor1=floor1; this.carpet1=carpet1; } public double getTotalCost() { return floor1.getArea()*carpet1.getCost(); } }
package com.simha.SpringbootAWSSNSExe; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.services.sns.AmazonSNSAsyncClientBuilder; import com.amazonaws.services.sns.AmazonSNSClient; @Configuration public class SqsQueueSender { /*@Value("${cloud.aws.region.static}")*/ private final String region="ap-south-1"; /* @Value("${cloud.aws.credentials.access-key}")*/ private final String awsAccessKey="AKIA3OX7LJ75MOMKP5O3"; /*@Value("${cloud.aws.credentials.secret-key}")*/ private String awsSecretKey="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"; @Bean @Primary public AmazonSNSClient amazonSqs() { return (AmazonSNSClient)AmazonSNSAsyncClientBuilder.standard().withRegion(region).withCredentials (new AWSStaticCredentialsProvider(new BasicAWSCredentials(awsAccessKey, awsSecretKey))).build(); } }
package it.polito.tdp.artsmia.model; import java.util.HashMap; import java.util.Map; public class ExhibitionIDMap { private Map<Integer, Exhibition> map; public ExhibitionIDMap() { this.map = new HashMap<>(); } public Exhibition get(int id) { return map.get(id); } public Exhibition get(Exhibition e) { Exhibition old = map.get(e.getId()); if (old == null) { map.put(e.getId(), e); return e; } return old; } public void put(int id, Exhibition e) { map.put(id, e); } }
package edu.oakland; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.HashMap; import java.util.logging.Level; import java.util.logging.Logger; public class Account implements Serializable { private Calendar calendar; private transient static final Logger logger = Logger.getLogger(Account.class.getName()); private transient static HashMap<String, Account> accounts = new HashMap<>(); private transient static final File ACCOUNT_FILE = new File(Main.DATA_DIR, "accounts.dat"); private String userName; private String name; private String passwordHash; private String[] securityQuestions; private Account(String userName, String password, String name, String[] securityQuestions) { this.userName = userName; this.name = name; this.securityQuestions = securityQuestions; calendar = new Calendar(); setPassword(password); } /** * Called when the System attempts to create a new account * * @param user Account username * @param pass Account password * @return Returns true if successfully created, else false */ public static boolean createAccount(String user, String pass, String name, String[] securityQuestions) { if (accounts.containsKey(user) || user == null) { return false;} Account acc = new Account(user, pass, name, securityQuestions); //Todo manage email and questions accounts.put(user, acc); saveAccounts(); return true; } /** * Remove an account from the map of current accounts, and save to disk. * * @param userName the user name of the account to remove * @return True if the account was removed */ public static boolean removeAccount(String userName) { if (!accounts.containsKey(userName)) { return false; } accounts.remove(userName); saveAccounts(); return true; } /** * Try and change this Account's password. * * @param oldPassword the old password (not hash) * @param newPassword the new password (not hash) * @return True if the password was changed */ public boolean changePassword(String oldPassword, String newPassword) { return checkPassword(oldPassword) && setPassword(newPassword); } /** * Try and reset this Account's password. * * @param newPassword the new password (not hash) * @param securityQuestionAnswers the answers to the saved security questions * @return True if the password was changed */ public boolean resetPassword(String newPassword, String[] securityQuestionAnswers) { //Check the answers if (this.securityQuestions.length != securityQuestionAnswers.length) { return false; } for (int i = 0; i < this.securityQuestions.length; i++){ if(!this.securityQuestions[i].equals(securityQuestionAnswers[i])){ return false; } } return setPassword(newPassword); } /** * Update this account's password hash and save to disk. * * @param password the new password * @return True if the password changed */ private boolean setPassword(String password) { try { this.passwordHash = PasswordStorage.createHash(password); saveAccounts(); return true; } catch (PasswordStorage.CannotPerformOperationException e) { logger.log(Level.SEVERE, "Can't make password hash", e); //todo If the hash can't be made it will probably end up being written to disk as null } return false; } /** * Checks if an account with the given username exists * * @param user Username * @return True if an account with this username exists, else false */ public static boolean accountExists(String user) { return accounts.containsKey(user); } /** * Get the account object for the given username, or null if one does not exist. * * @param userName the userName of the account * @return the Account */ public static Account getAccount(String userName) { if (!accountExists(userName)) { return null; } return accounts.get(userName); } /** * Gets the user account's real name * * @param userName the userName of the account * @return real name */ public static String getName(String userName) { if (!accountExists(userName)) { return null; } Account acc = accounts.get(userName); return acc.name; } /** * Checks if a given username and password combination exists in the System * * @param user Username * @param pass Password * @return True if the account exists and the information is correct, else false */ public static boolean checkCredentials(String user, String pass) { Account acc = accounts.get(user); return acc != null && acc.checkPassword(pass); } /** * Check if the given password is valid for this account. * * @param password the password to check * @return True if it matches the Account's stored password hash */ public boolean checkPassword(String password) { if (password == null) { return false; } try { return PasswordStorage.verifyPassword(password, passwordHash); } catch (PasswordStorage.CannotPerformOperationException | PasswordStorage.InvalidHashException e) { logger.log(Level.SEVERE, "Can't check password hash", e); } return false; } /** * Load accounts from the given file to the current HashMap of accounts, overwriting it * * @param fromFile the File to load from * @return true iff the load was successful */ public static boolean loadAccounts(File fromFile) { if (!fromFile.exists()) { logger.info("Wanted to load accounts but the file didn't exist"); return false; } try { FileInputStream fis = new FileInputStream(fromFile); ObjectInputStream ois = new ObjectInputStream(fis); accounts = (HashMap<String, Account>) ois.readObject(); logger.finest("Loaded accounts"); fis.close(); ois.close(); return true; } catch (IOException | ClassNotFoundException | ClassCastException e) { logger.log(Level.SEVERE, "Could not load accounts", e); return false; } } /** * Load accounts from default file to the current HashMap of accounts, overwriting it * * @return true iff the load was successful */ public static boolean loadAccounts() { return loadAccounts(ACCOUNT_FILE); } /** * Write the current HashMap of accounts to the given file, overwriting it * * @param toFile the File to write to * @return true iff the save was successful */ public static boolean saveAccounts(File toFile) { if (!toFile.exists()) { logger.fine("Creating new account file"); } try { FileOutputStream fos = new FileOutputStream(toFile); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(accounts); logger.finer("Saved accounts"); fos.close(); oos.close(); return true; } catch (IOException e) { logger.log(Level.SEVERE, "Could not save accounts", e); return false; } } /** * Write the current HashMap of accounts to default file, overwriting it * * @return true iff the save was successful */ public static boolean saveAccounts() { return saveAccounts(ACCOUNT_FILE); } /** * Gets this Account's security question answers * * @return answers to the security questions */ public String[] getSecurityQuestions() { return this.securityQuestions; } public String getUserName() { return userName; } public String getName() { return name; } public Calendar getCalendar() { return calendar; } public void setCalendar(Calendar calendar) { this.calendar = calendar; } public static File getAccountFile() { return ACCOUNT_FILE; } public static HashMap<String, Account> getAccountMap() { return accounts; } }
package com.example.demorestrepo; import com.example.demorestrepo.entity.Customer; import com.example.demorestrepo.entity.CustomerGroup; import org.junit.Before; 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.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import java.net.URL; @RunWith(SpringRunner.class) @SpringBootTest(classes = DemoRestRepoApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @TestPropertySource(locations = "classpath:application.properties") public class HelloControllerTest { @LocalServerPort private int port; private URL base; @Autowired private TestRestTemplate restTemplate; @Before public void setUp() throws Exception { String url = String.format("http://localhost:%d/", port); System.out.println(String.format("port is : [%d]", port)); this.base = new URL(url); } @Test public void test1() throws Exception { ResponseEntity<String> configMsg = this.restTemplate.getForEntity( this.base.toString() + "/configMsg", String.class); System.out.println(String.format("测试结果get configMsg为:%s", configMsg.getBody()+"|"+configMsg.getHeaders())); //save customer with group CustomerGroup cg1 = new CustomerGroup(); cg1.setGroupName("group1"); ResponseEntity<CustomerGroup> responseCusg = this.restTemplate.postForEntity( this.base.toString() + "/customerGroups", cg1, CustomerGroup.class); System.out.println(String.format("测试结果post CustomerGroup 为:%s", responseCusg.getBody()+"|"+responseCusg.getHeaders())); Customer cus1 = new Customer(); cus1.setFirstname("fn1"); cus1.setLastname("ln1"); cus1.setGroupId(responseCusg.getBody().getId()); ResponseEntity<Customer> responseCus = this.restTemplate.postForEntity( this.base.toString() + "/customers", cus1, Customer.class); System.out.println(String.format("测试结果post cus 为:%s", responseCus.getBody()+"|"+responseCus.getHeaders())); //update group for just post customer cus1 = responseCus.getBody(); HttpEntity<Customer> requestEntity = new HttpEntity<>(cus1); ResponseEntity<Customer> responseUpdate = restTemplate.exchange( this.base.toString() + "/customers"+"/"+cus1.getId(), HttpMethod.PUT, requestEntity, Customer.class ); System.out.println(String.format("测试结果update cus 为:%s", responseUpdate.getBody())); cus1 = responseUpdate.getBody(); requestEntity = new HttpEntity<>(cus1); responseUpdate = restTemplate.exchange( this.base.toString() + "/customers"+"/"+cus1.getId(), HttpMethod.PUT, requestEntity, Customer.class ); System.out.println(String.format("测试结果update cus 为:%s", responseUpdate.getBody())); restTemplate.delete( this.base.toString() + "/customerGroups/2"); ResponseEntity<String> response4 = this.restTemplate.getForEntity( this.base.toString() + "/customerGroups", String.class); System.out.println(String.format("测试结果customerGroups为:%s", response4.getBody())); // ResponseEntity<CustomerGroup> response4cg = this.restTemplate.getForEntity( // this.base.toString() + "/customerGroups/1", CustomerGroup.class); // System.out.println(String.format("测试结果/customerGroups/1为:%s", response4cg.getBody())); ResponseEntity<String> responseGetBySearch = this.restTemplate.getForEntity( this.base.toString() + "/customers/search/findByLastname?name=Matthews", String.class); System.out.println(String.format("测试结果/customers/search/findByLastname?name=Matthews为:%s", responseGetBySearch.getBody())); responseGetBySearch = this.restTemplate.getForEntity( this.base.toString() + "/customers/search", String.class); System.out.println(String.format("测试结果/customers/search为:%s", responseGetBySearch.getBody())); responseGetBySearch = this.restTemplate.getForEntity( this.base.toString() + "/profile/customers", String.class); System.out.println(String.format("测试结果/profile/customers为:%s", responseGetBySearch.getBody())); responseGetBySearch = this.restTemplate.getForEntity( this.base.toString() + "/customerGroups/search/findByGroupName?name=group1", String.class); System.out.println(String.format("测试结果/customerGroups/search/findByGroupName?name=group1:%s", responseGetBySearch.getBody())); ResponseEntity<String> response = this.restTemplate.getForEntity( this.base.toString() + "/configMsg", String.class); System.out.println(String.format("测试结果configMsg为:%s", response.getBody())); ResponseEntity<String> response1 = this.restTemplate.getForEntity( this.base.toString() + "/customers", String.class); System.out.println(String.format("测试结果customers为:%s", response1.getBody())); ResponseEntity<String> response2 = this.restTemplate.getForEntity( this.base.toString() + "/customers/1", String.class); System.out.println(String.format("测试结果customers/1为:%s", response2.getBody())); } }
package fiscal; // Generated 10/07/2009 10:49:54 by Hibernate Tools 3.2.0.b9 import java.util.ArrayList; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; /** * Perfil generated by hbm2java */ @Entity @Table(name = "TBPERFIL") public class FiscalPerfil implements java.io.Serializable { private Long id; private String descricao; private String nome; @Column(name = "NOME") public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } private List<FiscalParticipante> participantes = new ArrayList<FiscalParticipante>(0); private List<FiscalPermissaoPerfil> permissaoPerfils = new ArrayList<FiscalPermissaoPerfil>(0); public FiscalPerfil() { } public FiscalPerfil(Long id, String descricao) { this.id = id; this.descricao = descricao; } public FiscalPerfil(Long id, String descricao, List<FiscalParticipante> participantes, List<FiscalPermissaoPerfil> permissaoPerfils) { this.id = id; this.descricao = descricao; this.participantes = participantes; this.permissaoPerfils = permissaoPerfils; } public FiscalPerfil(Long id) { this.id = id; } @Id @GeneratedValue @Column(name = "PERFIL_ID", unique = true, nullable = false, precision = 22, scale = 0) public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } @Column(name = "DESCRICAO", nullable = false, length = 100) public String getDescricao() { return this.descricao; } public void setDescricao(String descricao) { this.descricao = descricao; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "perfil") public List<FiscalParticipante> getParticipantes() { return this.participantes; } public void setParticipantes(List<FiscalParticipante> participantes) { this.participantes = participantes; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "perfil") public List<FiscalPermissaoPerfil> getPermissaoPerfils() { return this.permissaoPerfils; } public void setPermissaoPerfils(List<FiscalPermissaoPerfil> permissaoPerfils) { this.permissaoPerfils = permissaoPerfils; } // The following is extra code specified in the hbm.xml files private static final long serialVersionUID = 1L; // end of extra code specified in the hbm.xml files }
package moe.pinkd.twentyone.core; import moe.pinkd.twentyone.Config; import moe.pinkd.twentyone.player.Player; public class Game { private GameManager gameManager; private OperationExecutor operationExecutor; public Game(Player player1, Player player2) { this(new Player[]{player1, player2}); } public Game(Player[] players) { gameManager = new GameManager(players); operationExecutor = new OperationExecutor(gameManager); } public Player play() { gameManager.init(); while (!gameManager.isGameOver()) { gameManager.round(operationExecutor); } Player winner = gameManager.getWinner(); if (winner == null) { if (Config.DEBUG) { gameManager.notifyMessage("It's a draw"); } return null; } else { if (Config.DEBUG) { gameManager.notifyMessage("Winner is " + winner); gameManager.notifyMessage("-------------------------"); } return winner; } } }
import java.io.*; class Control3 { public static void main (String[ ]args) { String str=args[0]; char [] s=str.toCharArray(); int l=str.length(); int i=0,st=0; while(i<=l-1) { if(s[i]!=s[l-1]) { st=1; break; } i++; l--; } if(st==0) System.out.println("palindrome"); else System.out.println("not a palindrome"); } }
package chess; public class Globals { public static final int[] COLORS = {0, 1}; public static final int WHITE = 0; public static final int BLACK = 1; public static final int NO_COLOR_MASK = (~BLACK) & 255; public static final byte EMPTY_FIELD = 0; public static final byte PAWN = (byte) ('P' << 1); public static final byte BISHOP = (byte) ('B' << 1); public static final byte KNIGHT = (byte) ('N' << 1); public static final byte ROOK = (byte) ('R' << 1); public static final byte QUEEN = (byte) ('Q' << 1); public static final byte KING = (byte) ('K' << 1); public static final double[] PIECE_VALUE = new double[255]; static { PIECE_VALUE[EMPTY_FIELD] = 0; PIECE_VALUE[PAWN & NO_COLOR_MASK] = 1.0; PIECE_VALUE[BISHOP & NO_COLOR_MASK] = 3.3; PIECE_VALUE[KNIGHT & NO_COLOR_MASK] = 3.3; PIECE_VALUE[ROOK & NO_COLOR_MASK] = 5.0; PIECE_VALUE[QUEEN & NO_COLOR_MASK] = 9.0; PIECE_VALUE[KING & NO_COLOR_MASK] = 1_000.0; } public static final String EMPTY = " "; public static final String WHITE_STRING = "w"; public static final String BLACK_STRING = "b"; public static final byte[] COLOR_FORWARD = {1, -1}; public static final byte[] PAWN_ATTACKING_MOVES = {-1, 1}; public static final byte[][] QUEEN_MOVE_DIRECTIONS = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1}}; public static final byte[][] ROOK_MOVE_DIRECTIONS = {{0, -1}, {0, 1}, {-1, 0}, {1, 0}}; public static final byte[][] BISHOP_MOVE_DIRECTIONS = {{-1, -1}, {-1, 1}, {1, -1}, {1, 1}}; public static final byte[][] KNIGHT_MOVES = {{-2, -1}, {-2, 1}, {-1, -2}, {-1, 2}, {1, -2}, {1, 2}, {2, -1}, {2, 1}}; public static final int MIN_IDX = 0; public static final int MAX_IDX = 7; public static final int[] COLOR_HOME_ROW = {0, 7}; public static final int[] COLOR_PAWN_ROW = {1, 6}; public static final int[] COLOR_PAWN_ADVANCE_ROW = {3, 4}; public static final int KING_POSITION = 4; public static final int KING_QUEENSSIDE_CASTLING = 2; public static final int ROOK_QUEENSSIDE_CASTLING = 3; public static final int KING_KINGSSIDE_CASTLING = 6; public static final int ROOK_KINGSSIDE_CASTLING = 5; }
package org.sbbs.app.gen.service; import org.sbbs.base.service.BaseManager; import org.sbbs.app.gen.model.GenEntity; public interface GenEntityManager extends BaseManager<GenEntity, Long> { }
package business; import java.io.Serializable; import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; public class Cart implements Serializable { private List<LineItem> items; public Cart() { items = new ArrayList<LineItem>(); } public List<LineItem> getItems() { return items; } public int getCount() { return items.size(); } public void addItem(LineItem item) { int productID = item.getProduct().getProductID(); int quantity = item.getQuantity(); for (int i = 0; i < items.size(); i++) { LineItem lineItem = items.get(i); if (lineItem.getProduct().getProductID() == productID) { lineItem.setQuantity(lineItem.getQuantity() + quantity); return; } } items.add(item); } public void updateItem(LineItem item) { int productID = item.getProduct().getProductID(); int quantity = item.getQuantity(); for (int i = 0; i < items.size(); i++) { LineItem lineItem = items.get(i); if (lineItem.getProduct().getProductID() == productID) { lineItem.setQuantity(quantity); return; } } items.add(item); } public void removeItem(LineItem item) { int productID = item.getProduct().getProductID(); for (int i = 0; i < items.size(); i++) { LineItem lineItem = items.get(i); if (lineItem.getProduct().getProductID() == productID) { items.remove(i); return; } } } public String getCartTotalFormatted() { double total = 0; for (LineItem item : items) { total += item.getTotal(); } NumberFormat currency = NumberFormat.getCurrencyInstance(); return currency.format(total); } }
package patterns.decorators; public interface Car { public void assemble(); }
package com.microlecture.bean; public class TaskNotifyBean { private int taskId; //作业id private String task; //作业安排 private String taskSubmitTime; //作业上交时间 private String updateTime; //更新时间 private int courseId; //课程id private String courseName; //课程名 public void setCourseName(String courseName) { this.courseName = courseName; } public int getTaskId() { return taskId; } public void setTaskId(int taskId) { this.taskId = taskId; } public String getTask() { return task; } public void setTask(String task) { this.task = task; } public String getTaskSubmitTime() { return taskSubmitTime; } public void setTaskSubmitTime(String taskSubmitTime) { this.taskSubmitTime = taskSubmitTime; } public String getUpdateTime() { return updateTime; } public void setUpdateTime(String updateTime) { this.updateTime = updateTime; } public int getCourseId() { return courseId; } public void setCourseId(int courseId) { this.courseId = courseId; } public String getCourseName() { return courseName; } public StringBuilder getJson(){ StringBuilder json = new StringBuilder(); json.append("[{"); json.append("courseId:\"").append(this.courseId).append(","); json.append("courseName:\"").append(this.courseName).append("\","); json.append("task:\"").append(this.task).append("\","); json.append("taskId:\"").append(this.taskId).append("\","); json.append("taskSubmitTime:\"").append(this.taskSubmitTime).append("\","); json.append("updateTime:\"").append(this.updateTime).append("\""); json.append("}]").append(","); return json; } }
package com.example.gourav_chawla.taskready; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListView; import java.util.Arrays; import java.util.zip.Inflater; public class taskFragment extends Fragment { ListView listView; public String[] duedatedb ; public String[] duetimedb ; public String[] titledb ; public String[] discripdb ; public String[] reminderdb ; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.activity_task_fragment,container,false); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); listView = (ListView)getActivity().findViewById(R.id.listview); sqltaskhelper sqltaskhelper = new sqltaskhelper(getActivity()); SQLiteDatabase db = sqltaskhelper.getReadableDatabase(); String format[] = {"title" , "discrip" , "duedate" , "duetime" , "reminder" }; Cursor c = db.query("task" , format , null , null , null , null ,null); int taskrows = c.getCount(); titledb = new String[taskrows]; discripdb = new String[taskrows]; duedatedb = new String[taskrows]; duetimedb = new String[taskrows]; reminderdb = new String[taskrows]; c.moveToPosition(taskrows-1); for(int i=0;i<=taskrows-1;i++){ System.out.println("inside cursor"); titledb[i] = c.getString(0); discripdb[i] = c.getString(1); duedatedb[i] = c.getString(2); duetimedb[i] = c.getString(3); reminderdb[i] = c.getString(4); c.moveToPrevious(); } if(taskrows!=0) { Myadapter myadapter = new Myadapter(getActivity(),titledb,discripdb,duedatedb,duetimedb,reminderdb); listView.setAdapter(myadapter); } } }
package com.tencent.xweb.extension.video; import android.view.View; import android.view.View.OnClickListener; import android.webkit.ValueCallback; class c$14 implements OnClickListener { final /* synthetic */ c vCb; c$14(c cVar) { this.vCb = cVar; } public final void onClick(View view) { c.b(this.vCb).evaluateJavascript("xwebVideoBridge.xwebToJS_Video_ExitFullscreen();", new ValueCallback<String>() { public final /* bridge */ /* synthetic */ void onReceiveValue(Object obj) { } }); } }
package com.mysql.cj.protocol.a.result; import com.mysql.cj.exceptions.ExceptionInterceptor; import com.mysql.cj.protocol.a.NativePacketPayload; import com.mysql.cj.protocol.result.AbstractResultsetRow; public abstract class AbstractBufferRow extends AbstractResultsetRow { protected NativePacketPayload rowFromServer; protected int homePosition = 0; protected int lastRequestedIndex = -1; protected int lastRequestedPos; protected AbstractBufferRow(ExceptionInterceptor exceptionInterceptor) { super(exceptionInterceptor); } abstract int findAndSeekToOffset(int paramInt); } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\com\mysql\cj\protocol\a\result\AbstractBufferRow.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
package ru.startandroid.places.web; import java.io.IOException; import dagger.Module; import dagger.Provides; import okhttp3.HttpUrl; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.CallAdapter; import retrofit2.Converter; import retrofit2.Retrofit; import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; import ru.startandroid.places.BuildConfig; import ru.startandroid.places.app.AppScope; import ru.startandroid.places.base.Constants; @Module public class WebModule { private static final String BASE_URL = "https://places.cit.api.here.com/places/v1/"; @AppScope @Provides ApiService provideApiService(Retrofit retrofit) { return retrofit.create(ApiService.class); } @Provides Retrofit provideRetrofit(@BaseUrl String baseUrl, Converter.Factory converterFactory, CallAdapter.Factory callAdapterFactory, OkHttpClient client) { return new Retrofit.Builder() .baseUrl(baseUrl) .addConverterFactory(converterFactory) .addCallAdapterFactory(callAdapterFactory) .client(client) .build(); } @BaseUrl @Provides String provideBaseUrl() { return BASE_URL; } @Provides Converter.Factory provideConverterFactory() { return GsonConverterFactory.create(); } @Provides CallAdapter.Factory provideCallAdapterFactory() { return RxJavaCallAdapterFactory.create(); } @Provides OkHttpClient provideOkHttpClient(HttpLoggingInterceptor httpLoggingInterceptor, Interceptor requestInterceptor) { return new OkHttpClient.Builder() .addInterceptor(requestInterceptor) .addInterceptor(httpLoggingInterceptor) .build(); } @Provides HttpLoggingInterceptor provideHttpLoggingInterceptor() { HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.setLevel(BuildConfig.DEBUG ? HttpLoggingInterceptor.Level.BODY : HttpLoggingInterceptor.Level.NONE); return interceptor; } @Provides Interceptor provideRequestInterceptor() { return new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request original = chain.request(); HttpUrl originalHttpUrl = original.url(); HttpUrl url = originalHttpUrl.newBuilder() .addQueryParameter("app_id", Constants.APP_ID) .addQueryParameter("app_code", Constants.APP_CODE) .build(); Request.Builder requestBuilder = original.newBuilder() .url(url); Request request = requestBuilder.build(); return chain.proceed(request); } }; } }
package com.smxknife.druid.demo01; import java.sql.*; import java.util.Properties; /** * @author smxknife * 2020/8/18 */ public class Main { public static void main(String[] args) { // Connect to /druid/v2/sql/avatica/ on your Broker. String url = "jdbc:avatica:remote:url=http://localhost:8082/druid/v2/sql/avatica/"; // Set any connection context parameters you need here (see "Connection context" below). // Or leave empty for default behavior. Properties connectionProperties = new Properties(); try (Connection connection = DriverManager.getConnection(url, connectionProperties)) { try ( final PreparedStatement statement = connection.prepareStatement("select * from ent_Data"); final ResultSet resultSet = statement.executeQuery() ) { while (resultSet.next()) { System.out.println(String.format("__time = %s | count = %d | dataCode = %s | entCode = %s | statType = %s | value = %f", resultSet.getString(1), resultSet.getInt(2), resultSet.getString(3), resultSet.getString(4), resultSet.getString(5), resultSet.getDouble(6))); } } } catch (SQLException throwables) { throwables.printStackTrace(); } } }
/* * * [y] hybris Platform * * Copyright (c) 2000-2016 SAP SE * All rights reserved. * * This software is the confidential and proprietary information of SAP * Hybris ("Confidential Information"). You shall not disclose such * Confidential Information and shall use it only in accordance with the * terms of the license agreement you entered into with SAP Hybris. * */ package com.cnk.travelogix.common.core.payment.data; /** * @author i323727 * */ public class PaymentModeInfo { // refer to PaymentModes private String paymentMode; // icic/ visa/... private String cardType; // payment gateway fee private MsfFee pgEnablerFee; // payment acquirer bank fee private MsfFee pgAcquirerFee; // client paying fee private MsfFee clientFee; /** * @return the paymentMode */ public String getPaymentMode() { return paymentMode; } /** * @param paymentMode * the paymentMode to set */ public void setPaymentMode(final String paymentMode) { this.paymentMode = paymentMode; } /** * @return the cardType */ public String getCardType() { return cardType; } /** * @param cardType * the cardType to set */ public void setCardType(final String cardType) { this.cardType = cardType; } /** * @return the pgEnablerFee */ public MsfFee getPgEnablerFee() { return pgEnablerFee; } /** * @param pgEnablerFee * the pgEnablerFee to set */ public void setPgEnablerFee(final MsfFee pgEnablerFee) { this.pgEnablerFee = pgEnablerFee; } /** * @return the pgAcquirerFee */ public MsfFee getPgAcquirerFee() { return pgAcquirerFee; } /** * @param pgAcquirerFee * the pgAcquirerFee to set */ public void setPgAcquirerFee(final MsfFee pgAcquirerFee) { this.pgAcquirerFee = pgAcquirerFee; } /** * @return the clientFee */ public MsfFee getClientFee() { return clientFee; } /** * @param clientFee * the clientFee to set */ public void setClientFee(final MsfFee clientFee) { this.clientFee = clientFee; } }
package com.tencent.mm.v; import com.eclipsesource.a.a; import com.eclipsesource.a.b; import com.eclipsesource.a.h; import junit.framework.Assert; public final class j implements a { private b dpi; public j() { this.dpi = new b(); } public j(String str) { this.dpi = a.U(str).hQ(); if (this.dpi == null) { throw new f(String.format("JSONArray string(%s) parse error.", new Object[]{str})); } } j(b bVar) { Assert.assertNotNull(bVar); this.dpi = bVar; } public final int length() { return this.dpi.abz.size(); } public final a bq(boolean z) { this.dpi.ad(z); return this; } public final a o(double d) { this.dpi.m(d); return this; } public final a gv(int i) { this.dpi.bY(i); return this; } public final a aO(long j) { this.dpi.l(j); return this; } public final a aB(Object obj) { i.a(this.dpi, obj); return this; } public final boolean isNull(int i) { return i < 0 || i >= length() || this.dpi.bZ(i) == null; } public final Object get(int i) { int length = length(); if (i < 0 || i >= length) { throw new f(String.format("index(%d) out of range(0, %d).", new Object[]{Integer.valueOf(i), Integer.valueOf(length)})); } h bZ = this.dpi.bZ(i); if (bZ == null) { return null; } if (bZ.isNumber()) { return bZ.toString(); } if (bZ.isBoolean()) { return Boolean.valueOf(bZ.hR()); } if (bZ.isArray()) { return new j(bZ.hQ()); } if (bZ.isObject()) { return new k(bZ.hV()); } if (bZ.isString()) { return bZ.ie(); } return null; } public final Object opt(int i) { int length = length(); if (i < 0 || i >= length) { return null; } h bZ = this.dpi.bZ(i); if (bZ == null) { return null; } if (bZ.isNumber()) { return bZ.toString(); } if (bZ.isBoolean()) { return Boolean.valueOf(bZ.hR()); } if (bZ.isArray()) { return new j(bZ.hQ()); } if (bZ.isObject()) { return new k(bZ.hV()); } if (bZ.isString()) { return bZ.ie(); } return null; } public final Object remove(int i) { int length = length(); if (i < 0 || i >= length) { return null; } b bVar = this.dpi; bVar.abz.remove(i); if (bVar == null) { return null; } if (bVar.isNumber()) { return bVar.toString(); } if (bVar.isBoolean()) { return Boolean.valueOf(bVar.hR()); } if (bVar.isArray()) { return new j(bVar.hQ()); } if (bVar.isObject()) { return new k(bVar.hV()); } if (bVar.isString()) { return bVar.ie(); } return null; } public final boolean getBoolean(int i) { int length = length(); if (i < 0 || i >= length) { throw new f(String.format("index(%d) out of range(0, %d).", new Object[]{Integer.valueOf(i), Integer.valueOf(length)})); } h bZ = this.dpi.bZ(i); if (bZ == null) { throw new f(String.format("getBoolean(%d) return null.", new Object[]{Integer.valueOf(i)})); } else if (bZ.isBoolean()) { return bZ.hR(); } else { if (bZ.isString()) { String ie = bZ.ie(); if ("true".equals(ie)) { return true; } if ("false".equals(ie)) { return false; } } throw new f(String.format("getBoolean(%d) error, value : %s.", new Object[]{Integer.valueOf(i), bZ})); } } public final boolean optBoolean(int i) { return optBoolean(i, false); } public final boolean optBoolean(int i, boolean z) { int length = length(); if (i < 0 || i >= length) { return z; } h bZ = this.dpi.bZ(i); if (bZ == null) { return z; } if (bZ.isBoolean()) { return bZ.hR(); } if (!bZ.isString()) { return z; } String ie = bZ.ie(); if ("true".equals(ie)) { return true; } if ("false".equals(ie)) { return false; } return z; } public final double getDouble(int i) { int length = length(); if (i < 0 || i >= length) { throw new f(String.format("index(%d) out of range(0, %d).", new Object[]{Integer.valueOf(i), Integer.valueOf(length)})); } h bZ = this.dpi.bZ(i); if (bZ == null) { throw new f(String.format("getDouble(%d) return null.", new Object[]{Integer.valueOf(i)})); } try { if (bZ.isNumber()) { return bZ.hU(); } if (bZ.isString()) { return Double.parseDouble(bZ.ie()); } throw new f(String.format("getDouble(%d) error, value : %s.", new Object[]{Integer.valueOf(i), bZ})); } catch (Exception e) { } } public final double optDouble(int i) { return optDouble(i, 0.0d); } public final double optDouble(int i, double d) { int length = length(); if (i < 0 || i >= length) { return d; } h bZ = this.dpi.bZ(i); if (bZ == null) { return d; } try { if (bZ.isNumber()) { return bZ.hU(); } if (bZ.isString()) { return Double.parseDouble(bZ.ie()); } return d; } catch (Exception e) { return d; } } public final int getInt(int i) { int length = length(); if (i < 0 || i >= length) { throw new f(String.format("index(%d) out of range(0, %d).", new Object[]{Integer.valueOf(i), Integer.valueOf(length)})); } Object bZ = this.dpi.bZ(i); if (bZ == null) { throw new f(String.format("getInteger(%d) return null.", new Object[]{Integer.valueOf(i)})); } try { if (bZ.isNumber()) { try { return bZ.hS(); } catch (Exception e) { return (int) bZ.hU(); } } if (bZ.isString()) { return (int) Double.parseDouble(bZ.ie()); } throw new f(String.format("getInt(%d) error, value : %s.", new Object[]{Integer.valueOf(i), bZ})); } catch (Exception e2) { } } public final int optInt(int i) { return optInt(i, 0); } public final int optInt(int i, int i2) { int length = length(); if (i < 0 || i >= length) { return i2; } h bZ = this.dpi.bZ(i); if (bZ == null) { return i2; } try { if (bZ.isNumber()) { try { return bZ.hS(); } catch (Exception e) { return (int) bZ.hU(); } } else if (bZ.isString()) { return (int) Double.parseDouble(bZ.ie()); } else { return i2; } } catch (Exception e2) { return i2; } } public final long getLong(int i) { int length = length(); if (i < 0 || i >= length) { throw new f(String.format("index(%d) out of range(0, %d).", new Object[]{Integer.valueOf(i), Integer.valueOf(length)})); } Object bZ = this.dpi.bZ(i); if (bZ == null) { throw new f(String.format("getLong(%d) return null.", new Object[]{Integer.valueOf(i)})); } try { if (bZ.isNumber()) { try { return bZ.hT(); } catch (Exception e) { return (long) bZ.hU(); } } if (bZ.isString()) { return (long) Double.parseDouble(bZ.ie()); } throw new f(String.format("getLong(%d) error, value : %s.", new Object[]{Integer.valueOf(i), bZ})); } catch (Exception e2) { } } public final long optLong(int i) { return optLong(i, 0); } public final long optLong(int i, long j) { int length = length(); if (i < 0 || i >= length) { return j; } h bZ = this.dpi.bZ(i); if (bZ == null) { return j; } try { if (bZ.isNumber()) { try { return bZ.hT(); } catch (Exception e) { return (long) bZ.hU(); } } else if (bZ.isString()) { return (long) Double.parseDouble(bZ.ie()); } else { return j; } } catch (Exception e2) { return j; } } public final String getString(int i) { int length = length(); if (i < 0 || i >= length) { throw new f(String.format("index(%d) out of range(0, %d).", new Object[]{Integer.valueOf(i), Integer.valueOf(length)})); } h bZ = this.dpi.bZ(i); if (bZ == null) { throw new f(String.format("getString(%d) return null.", new Object[]{Integer.valueOf(i)})); } else if (bZ.isString()) { return bZ.ie(); } else { return bZ.toString(); } } public final String optString(int i) { return optString(i, null); } public final String optString(int i, String str) { int length = length(); if (i < 0 || i >= length) { return str; } h bZ = this.dpi.bZ(i); if (bZ == null) { return str; } if (bZ.isString()) { return bZ.ie(); } return bZ.toString(); } public final a gw(int i) { int length = length(); if (i < 0 || i >= length) { throw new f(String.format("index(%d) out of range(0, %d).", new Object[]{Integer.valueOf(i), Integer.valueOf(length)})); } h bZ = this.dpi.bZ(i); if (bZ != null) { return new j(bZ.hQ()); } throw new f(String.format("getJSONArray(%d) return null.", new Object[]{Integer.valueOf(i)})); } public final a gx(int i) { int length = length(); if (i < 0 || i >= length) { return null; } h bZ = this.dpi.bZ(i); if (bZ != null) { return new j(bZ.hQ()); } return null; } public final c gy(int i) { int length = length(); if (i < 0 || i >= length) { throw new f(String.format("index(%d) out of range(0, %d).", new Object[]{Integer.valueOf(i), Integer.valueOf(length)})); } h bZ = this.dpi.bZ(i); if (bZ != null) { return new k(bZ.hV()); } throw new f(String.format("getJSONObject(%d) return null.", new Object[]{Integer.valueOf(i)})); } public final c gz(int i) { int length = length(); if (i < 0 || i >= length) { return null; } h bZ = this.dpi.bZ(i); if (bZ != null) { return new k(bZ.hV()); } return null; } public final String toString() { return this.dpi.toString(); } }
package team1699.utils.controllers; import com.ctre.phoenix.motorcontrol.ControlMode; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class SpeedControllerGroup { private BetterSpeedController master; private List<BetterSpeedController> controllers; public SpeedControllerGroup(final BetterSpeedController master) { this.master = master; controllers = new ArrayList<>(); } public SpeedControllerGroup(final BetterSpeedController master, BetterSpeedController... controllers) { this.master = master; this.controllers = new ArrayList<>(); this.controllers.addAll(Arrays.asList(controllers)); } public void set(final double percent) { this.master.set(percent); for (BetterSpeedController controller : controllers) { if (controller != null) { controller.set(percent); } } } //Should only be used when it is known the controller is a talon public void set(final ControlMode mode, final double out) { //TODO Try catch cast master.getTalon().set(mode, out); } public double get() { return this.master.get(); } public BetterSpeedController getMaster() { return master; } }
package in.co.maxxwarez.skynet.ui.devices; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.Switch; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import in.co.maxxwarez.skynet.R; /** * A simple {@link Fragment} subclass. * Use the {@link DeviceDetail#newInstance} factory method to * create an instance of this fragment. */ public class DeviceDetail extends Fragment { private static final String TAG = "SkyNet"; public String deviceID; public String swStt; FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); final DatabaseReference ref = FirebaseDatabase.getInstance().getReference(); public DeviceDetail() { // Required empty public constructor } // TODO: Rename and change types and number of parameters public static DeviceDetail newInstance(String param1, String param2) { DeviceDetail fragment = new DeviceDetail(); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_device_detail, container, false); // Inflate the layout for this fragment Switch sw = (Switch) v.findViewById(R.id.switch0); Log.i(TAG, "SwitchState " + "state"); DatabaseReference mReference = ref.child("users").child(user.getUid()).child("deviceID"); mReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange (@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot ds : dataSnapshot.getChildren()) { Log.i(TAG, "Key= " + ds.getKey() + " Value= " + ds.getValue()); deviceID = ds.getKey(); Log.i(TAG, "SwitchState deviceID " + deviceID); DatabaseReference dReference = ref.child("Device").child(deviceID).child("State").child("switch0"); dReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { Log.i(TAG, "SwitchState1 " + snapshot.getValue()); swStt = String.valueOf(snapshot.getValue()); if(swStt.equals("true")) sw.setChecked(true); else sw.setChecked(false); Log.i(TAG, "SwitchState000 " + swStt); } @Override public void onCancelled(@NonNull DatabaseError error) { } }); } } @Override public void onCancelled (@NonNull DatabaseError error) { } }); sw.setOnCheckedChangeListener((buttonView, isChecked) -> { if (isChecked) { ref.child("Device").child(deviceID).child("State").child("switch0").setValue(true); // The toggle is enabled Log.i(TAG, "SwitchState 222" +"true" + deviceID); } else { ref.child("Device").child(deviceID).child("State").child("switch0").setValue(false); Log.i(TAG, "SwitchState 222" + "false" + deviceID); } }); return v; } }
package cn.czfshine.network.im.dto; import lombok.Data; import java.io.Serializable; /** * @author:czfshine * @date:2019/6/9 15:01 */ @Data public class FileSend extends Message implements Serializable { private String filename; private long fileLength; }
package com.train.ioc; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class TestIOCWithAnnotation { public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext("beansWithAnnotation.xml"); Knight knight = (Knight) ctx.getBean("knight"); knight.fight(); } }
package com.website.managers.file; import java.io.File; import java.io.IOException; import java.net.URLDecoder; import java.nio.file.Files; 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 org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; /** * The files servlet.</br> * Lets to use files stored on the server. * * @author Jérémy Pansier */ @WebServlet("/FilesServlet/*") public class FilesServlet extends HttpServlet { /** The serial version UID. */ private static final long serialVersionUID = 3941269080059840455L; /** The logger. */ private static final Logger LOGGER = LogManager.getLogger(); /* (non-Javadoc) * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ @Override protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { try { final String filename = URLDecoder.decode(request.getPathInfo().substring(1), "UTF-8"); final File file = Uploader.createUploadedFile(filename); response.setHeader("Content-Type", getServletContext().getMimeType(filename)); response.setHeader("Content-Length", String.valueOf(file.length())); Files.copy(file.toPath(), response.getOutputStream()); } catch (final Exception e) { LOGGER.error("File upload issue", e); } } }
/* * Copyright (c) 2009-2011 by Bjoern Kolbeck, * Zuse Institute Berlin * * Licensed under the BSD License, see LICENSE file for details. * */ package org.xtreemfs.osd.operations; import java.io.IOException; import java.util.List; import org.xtreemfs.common.Capability; import org.xtreemfs.common.ReplicaUpdatePolicies; import org.xtreemfs.common.uuids.ServiceUUID; import org.xtreemfs.common.xloc.InvalidXLocationsException; import org.xtreemfs.common.xloc.StripingPolicyImpl; import org.xtreemfs.common.xloc.XLocations; import org.xtreemfs.foundation.logging.Logging; import org.xtreemfs.foundation.pbrpc.client.RPCAuthentication; import org.xtreemfs.foundation.pbrpc.client.RPCResponse; import org.xtreemfs.foundation.pbrpc.generatedinterfaces.RPC.ErrorType; import org.xtreemfs.foundation.pbrpc.generatedinterfaces.RPC.POSIXErrno; import org.xtreemfs.foundation.pbrpc.generatedinterfaces.RPC.RPCHeader.ErrorResponse; import org.xtreemfs.foundation.pbrpc.utils.ErrorUtils; import org.xtreemfs.osd.OSDRequest; import org.xtreemfs.osd.OSDRequestDispatcher; import org.xtreemfs.osd.rwre.RWReplicationStage; import org.xtreemfs.osd.stages.StorageStage.TruncateCallback; import org.xtreemfs.pbrpc.generatedinterfaces.GlobalTypes.OSDWriteResponse; import org.xtreemfs.pbrpc.generatedinterfaces.OSD.truncateRequest; import org.xtreemfs.pbrpc.generatedinterfaces.OSDServiceConstants; public final class TruncateOperation extends OSDOperation { final String sharedSecret; final ServiceUUID localUUID; public TruncateOperation(OSDRequestDispatcher master) { super(master); sharedSecret = master.getConfig().getCapabilitySecret(); localUUID = master.getConfig().getUUID(); } @Override public int getProcedureId() { return OSDServiceConstants.PROC_ID_TRUNCATE; } @Override public void startRequest(final OSDRequest rq) { final truncateRequest args = (truncateRequest) rq.getRequestArgs(); if (args.getNewFileSize() < 0) { rq.sendError(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EINVAL, "new_file_size for truncate must be >= 0"); return; } if (!rq.getLocationList().getLocalReplica().getHeadOsd().equals(localUUID)) { rq.sendError(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EINVAL, "truncate must be executed at the head OSD (first OSD in replica)"); return; } if (rq.getLocationList().getReplicaUpdatePolicy().equals(ReplicaUpdatePolicies.REPL_UPDATE_PC_RONLY)) { // file is read only rq.sendError(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EPERM, "Cannot write on read-only files."); return; } if ((rq.getLocationList().getReplicaUpdatePolicy().length() == 0) || (rq.getLocationList().getNumReplicas() == 1)) { master.getStorageStage().truncate(args.getFileId(), args.getNewFileSize(), rq.getLocationList().getLocalReplica().getStripingPolicy(), rq.getLocationList().getLocalReplica(), rq.getCapability().getEpochNo(), rq.getCowPolicy(), null, false, rq, new TruncateCallback() { @Override public void truncateComplete(OSDWriteResponse result, ErrorResponse error) { step2(rq, args, result, error); } }); } else { rwReplicatedTruncate(rq, args); } } public void rwReplicatedTruncate(final OSDRequest rq, final truncateRequest args) { master.getRWReplicationStage().prepareOperation(args.getFileCredentials(), rq.getLocationList(), 0, 0, RWReplicationStage.Operation.TRUNCATE, new RWReplicationStage.RWReplicationCallback() { @Override public void success(final long newObjectVersion) { final StripingPolicyImpl sp = rq.getLocationList().getLocalReplica().getStripingPolicy(); //FIXME: ignore canExecOperation for now... master.getStorageStage().truncate(args.getFileId(), args.getNewFileSize(), rq.getLocationList().getLocalReplica().getStripingPolicy(), rq.getLocationList().getLocalReplica(), rq.getCapability().getEpochNo(), rq.getCowPolicy(), newObjectVersion, true, rq, new TruncateCallback() { @Override public void truncateComplete(OSDWriteResponse result, ErrorResponse error) { replicateTruncate(rq, newObjectVersion, args, result, error); } }); } @Override public void redirect(String redirectTo) { rq.getRPCRequest().sendRedirect(redirectTo); } @Override public void failed(ErrorResponse err) { rq.sendError(err); } }, rq); } public void replicateTruncate(final OSDRequest rq, final long newObjVersion, final truncateRequest args, final OSDWriteResponse result, ErrorResponse error) { if (error != null) step2(rq, args, result, error); else { master.getRWReplicationStage().replicateTruncate(args.getFileCredentials(), rq.getLocationList(),args.getNewFileSize(), newObjVersion, new RWReplicationStage.RWReplicationCallback() { @Override public void success(long newObjectVersion) { step2(rq, args, result, null); } @Override public void redirect(String redirectTo) { rq.getRPCRequest().sendRedirect(redirectTo); } @Override public void failed(ErrorResponse err) { rq.sendError(err); } }, rq); } } public void step2(final OSDRequest rq, final truncateRequest args, OSDWriteResponse result, ErrorResponse error) { if (error != null) { rq.sendError(error); } else { //check for striping if (rq.getLocationList().getLocalReplica().isStriped()) { //disseminate internal truncate to all other OSDs disseminateTruncates(rq, args, result); } else { //non-striped sendResponse(rq, result); } } } private void disseminateTruncates(final OSDRequest rq, final truncateRequest args, final OSDWriteResponse result) { try { final List<ServiceUUID> osds = rq.getLocationList().getLocalReplica().getOSDs(); final RPCResponse[] gmaxRPCs = new RPCResponse[osds.size() - 1]; int cnt = 0; for (ServiceUUID osd : osds) { if (!osd.equals(localUUID)) { gmaxRPCs[cnt++] = master.getOSDClient().xtreemfs_internal_truncate(osd.getAddress(), RPCAuthentication.authNone,RPCAuthentication.userService, args.getFileCredentials(), args.getFileId(), args.getNewFileSize()); } } this.waitForResponses(gmaxRPCs, new ResponsesListener() { @Override public void responsesAvailable() { analyzeTruncateResponses(rq, result, gmaxRPCs); } }); } catch (IOException ex) { rq.sendInternalServerError(ex); } catch (Throwable ex) { rq.sendInternalServerError(ex); Logging.logError(Logging.LEVEL_ERROR, this, ex); return; } } private void analyzeTruncateResponses(OSDRequest rq, OSDWriteResponse result, RPCResponse[] gmaxRPCs) { //analyze results try { for (int i = 0; i < gmaxRPCs.length; i++) { gmaxRPCs[i].get(); } sendResponse(rq, result); } catch (IOException ex) { rq.sendInternalServerError(ex); } catch (Throwable ex) { rq.sendInternalServerError(ex); Logging.logError(Logging.LEVEL_ERROR, this, ex); } finally { for (RPCResponse r : gmaxRPCs) { r.freeBuffers(); } } } public void sendResponse(OSDRequest rq, OSDWriteResponse result) { rq.sendSuccess(result,null); } @Override public ErrorResponse parseRPCMessage(OSDRequest rq) { try { truncateRequest rpcrq = (truncateRequest)rq.getRequestArgs(); rq.setFileId(rpcrq.getFileId()); rq.setCapability(new Capability(rpcrq.getFileCredentials().getXcap(), sharedSecret)); rq.setLocationList(new XLocations(rpcrq.getFileCredentials().getXlocs(), localUUID)); return null; } catch (InvalidXLocationsException ex) { return ErrorUtils.getErrorResponse(ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EINVAL, ex.toString()); } catch (Throwable ex) { return ErrorUtils.getInternalServerError(ex); } } @Override public boolean requiresCapability() { return true; } @Override public void startInternalEvent(Object[] args) { throw new UnsupportedOperationException("Not supported yet."); } }
package rs.jug.rx.resultset.dao.function; import java.sql.ResultSet; import java.sql.SQLException; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.ResultSetExtractor; import rs.jug.rx.resultset.dao.Customer; public class CustomerResultSetExtractor implements ResultSetExtractor<Customer> { @Override public Customer extractData(ResultSet rs) throws SQLException, DataAccessException { return new Customer(rs.getLong("id"), rs.getString("first_name"), rs.getString("last_name")); } }
package com.kranjcecni.fingerprintdemo; import android.app.Activity; import android.hardware.fingerprint.FingerprintManager; import android.support.v4.hardware.fingerprint.FingerprintManagerCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Base64; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import org.w3c.dom.Text; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; public class Testactivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_testactivity); } }
package net.acomputerdog.lccontroller.gui.message; public class StopScriptMessage implements Message { }
package org.newdawn.slick.geom; import java.util.ArrayList; public class GeomUtil { public float EPSILON = 1.0E-4F; public float EDGE_SCALE = 1.0F; public int MAX_POINTS = 10000; public GeomUtilListener listener; public Shape[] subtract(Shape target, Shape missing) { target = target.transform(new Transform()); missing = missing.transform(new Transform()); int count = 0; for (int i = 0; i < target.getPointCount(); i++) { if (missing.contains(target.getPoint(i)[0], target.getPoint(i)[1])) count++; } if (count == target.getPointCount()) return new Shape[0]; if (!target.intersects(missing)) return new Shape[] { target }; int found = 0; int j; for (j = 0; j < missing.getPointCount(); j++) { if (target.contains(missing.getPoint(j)[0], missing.getPoint(j)[1]) && !onPath(target, missing.getPoint(j)[0], missing.getPoint(j)[1])) found++; } for (j = 0; j < target.getPointCount(); j++) { if (missing.contains(target.getPoint(j)[0], target.getPoint(j)[1]) && !onPath(missing, target.getPoint(j)[0], target.getPoint(j)[1])) found++; } if (found < 1) return new Shape[] { target }; return combine(target, missing, true); } private boolean onPath(Shape path, float x, float y) { for (int i = 0; i < path.getPointCount() + 1; i++) { int n = rationalPoint(path, i + 1); Line line = getLine(path, rationalPoint(path, i), n); if (line.distance(new Vector2f(x, y)) < this.EPSILON * 100.0F) return true; } return false; } public void setListener(GeomUtilListener listener) { this.listener = listener; } public Shape[] union(Shape target, Shape other) { target = target.transform(new Transform()); other = other.transform(new Transform()); if (!target.intersects(other)) return new Shape[] { target, other }; boolean touches = false; int buttCount = 0; int i; for (i = 0; i < target.getPointCount(); i++) { if (other.contains(target.getPoint(i)[0], target.getPoint(i)[1]) && !other.hasVertex(target.getPoint(i)[0], target.getPoint(i)[1])) { touches = true; break; } if (other.hasVertex(target.getPoint(i)[0], target.getPoint(i)[1])) buttCount++; } for (i = 0; i < other.getPointCount(); i++) { if (target.contains(other.getPoint(i)[0], other.getPoint(i)[1]) && !target.hasVertex(other.getPoint(i)[0], other.getPoint(i)[1])) { touches = true; break; } } if (!touches && buttCount < 2) return new Shape[] { target, other }; return combine(target, other, false); } private Shape[] combine(Shape target, Shape other, boolean subtract) { if (subtract) { ArrayList<Shape> shapes = new ArrayList(); ArrayList<Vector2f> used = new ArrayList(); int j; for (j = 0; j < target.getPointCount(); j++) { float[] point = target.getPoint(j); if (other.contains(point[0], point[1])) { used.add(new Vector2f(point[0], point[1])); if (this.listener != null) this.listener.pointExcluded(point[0], point[1]); } } for (j = 0; j < target.getPointCount(); j++) { float[] point = target.getPoint(j); Vector2f pt = new Vector2f(point[0], point[1]); if (!used.contains(pt)) { Shape result = combineSingle(target, other, true, j); shapes.add(result); for (int k = 0; k < result.getPointCount(); k++) { float[] kpoint = result.getPoint(k); Vector2f kpt = new Vector2f(kpoint[0], kpoint[1]); used.add(kpt); } } } return shapes.<Shape>toArray(new Shape[0]); } for (int i = 0; i < target.getPointCount(); i++) { if (!other.contains(target.getPoint(i)[0], target.getPoint(i)[1]) && !other.hasVertex(target.getPoint(i)[0], target.getPoint(i)[1])) { Shape shape = combineSingle(target, other, false, i); return new Shape[] { shape }; } } return new Shape[] { other }; } private Shape combineSingle(Shape target, Shape missing, boolean subtract, int start) { Shape current = target; Shape other = missing; int point = start; int dir = 1; Polygon poly = new Polygon(); boolean first = true; int loop = 0; float px = current.getPoint(point)[0]; float py = current.getPoint(point)[1]; while (!poly.hasVertex(px, py) || first || current != target) { first = false; loop++; if (loop > this.MAX_POINTS) break; poly.addPoint(px, py); if (this.listener != null) this.listener.pointUsed(px, py); Line line = getLine(current, px, py, rationalPoint(current, point + dir)); HitResult hit = intersect(other, line); if (hit != null) { Line hitLine = hit.line; Vector2f pt = hit.pt; px = pt.x; py = pt.y; if (this.listener != null) this.listener.pointIntersected(px, py); if (other.hasVertex(px, py)) { point = other.indexOf(pt.x, pt.y); dir = 1; px = pt.x; py = pt.y; Shape shape = current; current = other; other = shape; continue; } float dx = hitLine.getDX() / hitLine.length(); float dy = hitLine.getDY() / hitLine.length(); dx *= this.EDGE_SCALE; dy *= this.EDGE_SCALE; if (current.contains(pt.x + dx, pt.y + dy)) { if (subtract) { if (current == missing) { point = hit.p2; dir = -1; } else { point = hit.p1; dir = 1; } } else if (current == target) { point = hit.p2; dir = -1; } else { point = hit.p2; dir = -1; } Shape shape = current; current = other; other = shape; continue; } if (current.contains(pt.x - dx, pt.y - dy)) { if (subtract) { if (current == target) { point = hit.p2; dir = -1; } else { point = hit.p1; dir = 1; } } else if (current == missing) { point = hit.p1; dir = 1; } else { point = hit.p1; dir = 1; } Shape shape = current; current = other; other = shape; continue; } if (subtract) break; point = hit.p1; dir = 1; Shape temp = current; current = other; other = temp; point = rationalPoint(current, point + dir); px = current.getPoint(point)[0]; py = current.getPoint(point)[1]; continue; } point = rationalPoint(current, point + dir); px = current.getPoint(point)[0]; py = current.getPoint(point)[1]; } poly.addPoint(px, py); if (this.listener != null) this.listener.pointUsed(px, py); return poly; } public HitResult intersect(Shape shape, Line line) { float distance = Float.MAX_VALUE; HitResult hit = null; for (int i = 0; i < shape.getPointCount(); i++) { int next = rationalPoint(shape, i + 1); Line local = getLine(shape, i, next); Vector2f pt = line.intersect(local, true); if (pt != null) { float newDis = pt.distance(line.getStart()); if (newDis < distance && newDis > this.EPSILON) { hit = new HitResult(); hit.pt = pt; hit.line = local; hit.p1 = i; hit.p2 = next; distance = newDis; } } } return hit; } public static int rationalPoint(Shape shape, int p) { while (p < 0) p += shape.getPointCount(); while (p >= shape.getPointCount()) p -= shape.getPointCount(); return p; } public Line getLine(Shape shape, int s, int e) { float[] start = shape.getPoint(s); float[] end = shape.getPoint(e); Line line = new Line(start[0], start[1], end[0], end[1]); return line; } public Line getLine(Shape shape, float sx, float sy, int e) { float[] end = shape.getPoint(e); Line line = new Line(sx, sy, end[0], end[1]); return line; } public class HitResult { public Line line; public int p1; public int p2; public Vector2f pt; } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\org\newdawn\slick\geom\GeomUtil.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
package com.selesgames.weave.ui.main; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.inject.Inject; import rx.Observable; import rx.Scheduler; import rx.functions.Action0; import rx.functions.Action1; import rx.functions.Func1; import timber.log.Timber; import android.content.Context; import android.os.Bundle; import android.os.Parcelable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.view.ViewPager; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ProgressBar; import butterknife.InjectView; import com.selesgames.weave.ForActivity; import com.selesgames.weave.OnComputationThread; import com.selesgames.weave.OnMainThread; import com.selesgames.weave.R; import com.selesgames.weave.WeavePrefs; import com.selesgames.weave.api.UserService; import com.selesgames.weave.model.CategoryNews; import com.selesgames.weave.model.Feed; import com.selesgames.weave.model.News; import com.selesgames.weave.ui.BaseFragment; import com.selesgames.weave.ui.main.NewsGroup.NewsItem; import com.selesgames.weave.view.VerticalViewPager; import com.squareup.picasso.Picasso; public class CategoryFragment extends BaseFragment { private static final String KEY_CATEGORY_ID = CategoryFragment.class.getCanonicalName() + ".category_id"; private static final String KEY_NEWS_GROUPS = CategoryFragment.class.getCanonicalName() + ".news_groups"; private static final String KEY_FEEDS = CategoryFragment.class.getCanonicalName() + ".feeds"; private static final int NEWS_ITEM_TAKE = 20; /** Number of pages away from end before more news loads */ private static final int LOAD_MORE_THRESHOLD = 4; public static CategoryFragment newInstance(String categoryId) { Bundle b = new Bundle(); b.putString(KEY_CATEGORY_ID, categoryId); CategoryFragment f = new CategoryFragment(); f.setArguments(b); return f; } @Inject @ForActivity Context mContext; @Inject CategoryController mController; @Inject @OnMainThread Scheduler mMainScheduler; @Inject @OnComputationThread Scheduler mComputationScheduler; @Inject WeavePrefs mPrefs; @Inject UserService mUserService; @Inject Picasso mPicasso; @InjectView(R.id.pager) VerticalViewPager mViewPager; @InjectView(R.id.progress) ProgressBar mProgress; private Adapter mAdapter; private String mCategoryId; private List<Feed> mFeeds; private Map<String, Feed> mFeedMap; private List<NewsGroup> mNewsGroups; private int mLastPage; private boolean mLoading; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle b = getArguments(); mCategoryId = b.getString(KEY_CATEGORY_ID); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_category, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mFeedMap = new HashMap<String, Feed>(); boolean restoreState = savedInstanceState == null || mCategoryId.equals(savedInstanceState.getString(KEY_CATEGORY_ID)); if (savedInstanceState == null || !restoreState) { mNewsGroups = new ArrayList<NewsGroup>(); mFeeds = new ArrayList<Feed>(); } else { mNewsGroups = savedInstanceState.getParcelableArrayList(KEY_NEWS_GROUPS); mFeeds = savedInstanceState.getParcelableArrayList(KEY_FEEDS); populateFeedMap(mFeeds); } mAdapter = new Adapter(getChildFragmentManager(), mNewsGroups, getResources().getInteger(R.integer.display_ad_every_n_news), restoreState); mViewPager.setAdapter(mAdapter); // mAdapter.notifyDataSetChanged(); } @Override public void onViewStateRestored(Bundle savedInstanceState) { super.onViewStateRestored(savedInstanceState); // The page change listener is set here because setting it before the // view is restored will trigger a page change. We can remove this hack // if we maintain better state in the controller and be more selective // in handling this event. (i.e. page change when restoring state, but // we don't want the article loaded) mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { if (mAdapter.isNewsItemPosition(position)) { NewsGroup group = mNewsGroups.get(mAdapter.getOffsetNewsPosition(position)); if (group.getNews().size() == 1) { NewsItem item = group.getNews().get(0); mController.onNewsFocussed(item.feed, item.news); } else { mController.onNewsUnfocussed(); } } else { mController.onNewsUnfocussed(); } // Load more if (mAdapter.getCount() - 1 - position < LOAD_MORE_THRESHOLD && !mLoading) { mLoading = true; loadNews(++mLastPage).observeOn(mMainScheduler).subscribe(new Action1<List<NewsGroup>>() { @Override public void call(List<NewsGroup> groups) { mNewsGroups.addAll(groups); mAdapter.notifyDataSetChanged(); } }, new Action1<Throwable>() { @Override public void call(Throwable t) { Timber.e("Could not load news", t); } }, new Action0() { @Override public void call() { mLoading = false; } }); ; } } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageScrollStateChanged(int state) { } }); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(KEY_CATEGORY_ID, mCategoryId); outState.putParcelableArrayList(KEY_NEWS_GROUPS, (ArrayList<NewsGroup>) mNewsGroups); outState.putParcelableArrayList(KEY_FEEDS, (ArrayList<Feed>) mFeeds); } @Override public void onStart() { super.onStart(); if (mNewsGroups.isEmpty()) { // Load first page mLoading = true; loadNews(0).observeOn(mMainScheduler).subscribe(new Action1<List<NewsGroup>>() { @Override public void call(List<NewsGroup> groups) { mProgress.setVisibility(View.GONE); mNewsGroups.addAll(groups); mAdapter.notifyDataSetChanged(); // Focus the first item NewsGroup group = mNewsGroups.get(0); if (group.getNews().size() == 1) { NewsItem item = group.getNews().get(0); mController.onNewsFocussed(item.feed, item.news); } } }, new Action1<Throwable>() { @Override public void call(Throwable t) { Log.e("WEAVE", "Could not load news", t); } }, new Action0() { @Override public void call() { mLoading = false; } }); } else { mProgress.setVisibility(View.GONE); } } private Observable<List<NewsGroup>> loadNews(int page) { return mUserService .getFeedsForCategory(mPrefs.getUserId(), mCategoryId, "Mark", NEWS_ITEM_TAKE * page, NEWS_ITEM_TAKE) .observeOn(mComputationScheduler).map(new Func1<CategoryNews, List<NewsGroup>>() { @Override public List<NewsGroup> call(CategoryNews categoryNews) { List<NewsGroup> groups = new ArrayList<NewsGroup>(); List<Feed> feeds = categoryNews.getFeeds(); mFeeds.removeAll(feeds); mFeeds.addAll(feeds); populateFeedMap(categoryNews.getFeeds()); List<News> news = categoryNews.getNews(); for (News n : categoryNews.getNews()) { Picasso.with(mContext).load(n.getImageUrl()).fetch(); } int i = 0; while (i < news.size()) { NewsGroup group = new NewsGroup(); News n = news.get(i); // Check next two items News newsOne = null; News newsTwo = null; if (i + 1 < news.size()) { newsOne = news.get(i + 1); } if (i + 2 < news.size()) { newsTwo = news.get(i + 2); } // Always add first news item group.addNews(n, mFeedMap.get(n.getFeedId())); boolean emptyZero = TextUtils.isEmpty(n.getImageUrl()); boolean emptyOne = newsOne != null && TextUtils.isEmpty(newsOne.getImageUrl()); boolean emptyTwo = newsTwo != null && TextUtils.isEmpty(newsTwo.getImageUrl()); if (emptyZero || emptyOne || emptyTwo) { if (newsOne != null) { group.addNews(newsOne, mFeedMap.get(newsOne.getFeedId())); } if (newsTwo != null) { group.addNews(newsTwo, mFeedMap.get(newsTwo.getFeedId())); } } groups.add(group); i += group.getNews().size(); } return groups; } }); } private void populateFeedMap(List<Feed> feeds) { for (Feed f : feeds) { mFeedMap.put(f.getId(), f); } } private static class Adapter extends FragmentStatePagerAdapter { private List<NewsGroup> mNewsGroups; private int mDistanceBetweenAds; private boolean mRestoreState; public Adapter(FragmentManager fm, List<NewsGroup> newsGroups, int distanceBetweenAds, boolean restoreState) { super(fm); mNewsGroups = newsGroups; mDistanceBetweenAds = distanceBetweenAds; mRestoreState = restoreState; } @Override public Fragment getItem(int position) { Fragment f; if (isNewsItemPosition(position)) { int newsPosition = getOffsetNewsPosition(position); NewsGroup group = mNewsGroups.get(newsPosition); List<NewsItem> items = group.getNews(); if (items.size() == 1) { NewsItem item = items.get(0); f = NewsFragment.newInstance(item.feed, item.news); } else { f = NewsGroupFragment.newInstance(group); } } else { f = AdFragment.newInstance(); } return f; } @Override public int getCount() { int newsCount = mNewsGroups.size(); int adCount = mDistanceBetweenAds > 0 ? newsCount / mDistanceBetweenAds : 0; return newsCount + adCount; } @Override public void restoreState(Parcelable state, ClassLoader loader) { if (mRestoreState) { super.restoreState(state, loader); } } public boolean isNewsItemPosition(int position) { return position == 0 || mDistanceBetweenAds == 0 || position % mDistanceBetweenAds != 0; } public int getOffsetNewsPosition(int position) { int newsOffset = mDistanceBetweenAds > 0 ? position / mDistanceBetweenAds : 0; return position - newsOffset; } } }
package com.class02; import org.testng.annotations.Test; public class DisablingEnableInTestng { @Test(priority=2, enabled = true) public static void FirstTest() { System.out.println("This is the Test Case number Two because of Priority #2"); } @Test(priority=1, enabled = true) public static void SecondTest() { System.out.println("This is the Test Case number One because of Priority #1"); } @Test(enabled = false) public static void SkippedTest() { System.out.println("This is the Skipped Test Case because this has been disabled"); } @Test(enabled = true) public static void FinalTest() { System.out.println("This is the Final Test Case, which is enabled and has no Priority"); } }
package com.github.emailtohl.integration.web.service.cms.entities; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.JoinColumn; import javax.persistence.Lob; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.validation.constraints.NotNull; import com.github.emailtohl.integration.core.user.entities.EmployeeRef; import com.github.emailtohl.integration.core.user.entities.UserRef; import com.github.emailtohl.lib.jpa.EntityBase; /** * 评论实体类,评论可以是针对于文章的,也可以是针对于评论的 * @author HeLei */ @org.hibernate.envers.Audited @org.hibernate.search.annotations.Indexed @org.hibernate.annotations.BatchSize(size = 10)// 因n+1查询问题,盲猜优化,一次性加载size个代理 @Entity @Table(name = "article_comment") public class Comment extends EntityBase implements Comparable<Comment> { private static final long serialVersionUID = 2074688008515735092L; @NotNull private String content; private UserRef reviewer; /** * 针对于文章 */ private Article article; /** * 针对于评论 */ private Comment comment; private Boolean approved; private EmployeeRef approver; private Boolean canComment; @org.hibernate.search.annotations.Field @org.hibernate.annotations.Type(type = "org.hibernate.type.TextType") @Lob public String getContent() { return content; } public void setContent(String content) { this.content = content; } @org.hibernate.search.annotations.IndexedEmbedded(depth = 1) @ManyToOne @JoinColumn(name = "reviewer_user_id") public UserRef getReviewer() { return reviewer; } public void setReviewer(UserRef reviewer) { this.reviewer = reviewer; } @org.hibernate.envers.NotAudited @org.hibernate.search.annotations.ContainedIn @ManyToOne @JoinColumn(name = "article_id") public Article getArticle() { return article; } public void setArticle(Article article) { this.article = article; } @org.hibernate.envers.NotAudited @ManyToOne @JoinColumn(name = "target_comment_id") public Comment getComment() { return comment; } public void setComment(Comment comment) { this.comment = comment; } public Boolean getApproved() { return approved; } public void setApproved(Boolean approved) { this.approved = approved; } @org.hibernate.search.annotations.IndexedEmbedded(depth = 1) @ManyToOne @JoinColumn(name = "approver_employee_id") public EmployeeRef getApprover() { return approver; } public void setApprover(EmployeeRef approver) { this.approver = approver; } @Column(name = "can_comment") public Boolean getCanComment() { return canComment; } public void setCanComment(Boolean canComment) { this.canComment = canComment; } @Override public int compareTo(Comment o) { return getCreateTime().compareTo(o.getCreateTime()); } @Override public String toString() { return "Comment [content=" + content + ", reviewer=" + reviewer + "]"; } }
package ba.bitcamp.LabS06D03; public class KrugTest { public static void main(String[] args) { // Krug a = new Krug(); // System.out.println(a); Tacka aa = new Tacka(1, 2); Krug b = new Krug(aa, 1); // System.out.println(b); Tacka bb = new Tacka(2, 4); Krug c = new Krug(bb, 1); // System.out.println(c); // System.out.println(a.equals(b)); // Krug d = new Krug(b); // System.out.println(d); // System.out.println(b); // b = a; // System.out.println(a); // System.out.println(b); System.out.println(c.sjekuLiSe(b)); } }
package io.github.lonamiwebs.klooni.client; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.backends.gwt.GwtApplication; import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration; import io.github.lonamiwebs.klooni.Klooni; public class HtmlLauncher extends GwtApplication { @Override public GwtApplicationConfiguration getConfig () { return new GwtApplicationConfiguration(Klooni.GAME_WIDTH, Klooni.GAME_HEIGHT); } @Override public ApplicationListener createApplicationListener () { return new Klooni(null); } }
package com.takshine.wxcrm.message.sugar; import com.takshine.wxcrm.base.common.ErrCode; /** * 基础传输模块 * @author liulin * */ public class BaseCrm { private String crmaccount;//crm账户号 private String type ;//查询类型 private String modeltype ;//模块类型 private String orgId; private String orgUrl; private String errcode = ErrCode.ERR_CODE_0; private String errmsg = ErrCode.ERR_MSG_SUCC; private String licinfosign = "";//用户公司部门 签名 private String licinfostr = "";//用户基本信息 private String orderString; private String openId; public String getOpenId() { return openId; } public void setOpenId(String openId) { this.openId = openId; } public String getOrgUrl() { return orgUrl; } public void setOrgUrl(String orgUrl) { this.orgUrl = orgUrl; } public String getOrderString() { return orderString; } public void setOrderString(String orderString) { this.orderString = orderString; } public String getCrmaccount() { return crmaccount; } public void setCrmaccount(String crmaccount) { this.crmaccount = crmaccount; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getModeltype() { return modeltype; } public void setModeltype(String modeltype) { this.modeltype = modeltype; } public String getOrgId() { return orgId; } public void setOrgId(String orgId) { this.orgId = orgId; } public String getErrcode() { return errcode; } public void setErrcode(String errcode) { this.errcode = errcode; } public String getErrmsg() { return errmsg; } public void setErrmsg(String errmsg) { this.errmsg = errmsg; } public String getLicinfosign() { return licinfosign; } public void setLicinfosign(String licinfosign) { this.licinfosign = licinfosign; } public String getLicinfostr() { return licinfostr; } public void setLicinfostr(String licinfostr) { this.licinfostr = licinfostr; } }
package br.edu.ifpb.followup.validator; import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; import javax.faces.component.UIInput; import javax.faces.context.FacesContext; import javax.faces.validator.FacesValidator; import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; @FacesValidator("validator.confirmarSenha") public class ConfirmarSenhaValidator implements Validator { @Override public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { String senha = value.toString(); UIInput uiInputConfirmPassword = (UIInput) component.getAttributes().get("confSenha"); String confSenha = uiInputConfirmPassword.getSubmittedValue().toString(); if (senha == null || confSenha == null) { return; // Deixa o validador Required funcionar } if (senha.length()<4) { FacesMessage msg = new FacesMessage("Senha muito curta (mínimo 4 caracteres)"); msg.setSeverity(FacesMessage.SEVERITY_ERROR); throw new ValidatorException(msg); } if (!senha.equals(confSenha)) { FacesMessage msg = new FacesMessage("Senhas diferentes"); msg.setSeverity(FacesMessage.SEVERITY_ERROR); throw new ValidatorException(msg); } } }
package com.kiseki.test; import org.junit.Test; import org.redisson.api.RBitSet; import java.util.Random; public class BitMapTest extends BaseTest{ @Test public void test(){ this.flushdb(); RBitSet bitmapTest2020 = redissonClient.getBitSet("bitmapTest2020"); int count = 0; for (int i = 0; i < 356; i++) { boolean flag = new Random().nextBoolean(); if(flag){ count++; } bitmapTest2020.set(i, flag); } long cardinality = bitmapTest2020.cardinality(); System.out.println(count); System.out.println(cardinality); } }
package ex1.Main; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Iterator; import java.util.Scanner; import java.util.Vector; import ex1.Banca; import ex1.Client; import ex1.ContBancar; public class ClientiiBancilor { public static void main(String[] args) throws IOException { Vector<Banca> banci = new Vector<Banca>(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); @SuppressWarnings("resource") Scanner scanner = new Scanner(System.in); int optiune = 0; do { System.out.println("\n1. Adaugare banci, clienti, conturi"); System.out.println("2. Afisare date introduse."); System.out.println("3. Depunerea unei sume in cont."); System.out.println("4. Extragerea unei sume din cont."); System.out.println("5. Transfer de bani intre doua conturi."); System.out.print("\nOptiunea dvs : "); optiune = scanner.nextInt(); switch (optiune) { case 1: adaugare(banci); break; case 2: afisare(banci); break; case 3: { float suma = 0; String cont = ""; System.out.println("\nIn ce cont depuneti bani? : "); cont = br.readLine(); System.out.println("Ce suma depuneti in cont? : "); suma = scanner.nextFloat(); depunere(suma, cont, banci); } break; case 4: { float suma = 0; String cont = ""; System.out.println("\nDin ce cont extrageti bani? : "); cont = br.readLine(); System.out.println("Ce suma extrageti din cont? : "); suma = scanner.nextFloat(); extragere(suma, cont, banci); } break; case 5: { float suma = 0; String contDepunere = ""; String contExtragere = ""; System.out.println("\nDin ce cont transferati bani? : "); contExtragere = br.readLine(); System.out.println("\nIn ce cont transferati bani? : "); contDepunere = br.readLine(); System.out.println("\nCe suma transferati? : "); suma = scanner.nextFloat(); extragere(suma, contExtragere, banci); depunere(suma, contDepunere, banci); } break; default: System.out.println("\nOptiunea aleasa nu exista, mai incearca!"); break; } } while (optiune != 0); } private static void adaugare(Vector<Banca> banci) throws IOException { @SuppressWarnings("resource") Scanner scanner = new Scanner(System.in); BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); int optiuneMeniu = 0; do { System.out.println("\n1. Acceseaza banca existenta"); System.out.println("2. Adauga banca noua"); System.out.println("0. Intoarcere la meniul anterior"); optiuneMeniu = scanner.nextInt(); switch (optiuneMeniu) { case 1: if(banci.size() == 0) { // Daca lista este goala System.out.println("\nLista de banci este goala."); break; } // Daca lista nu este goala procesam cererea System.out.println("\nMeniul carei banci vreti sa il accesati: "); for (int i=0;i<banci.size();i++) System.out.println( i + ": " + banci.elementAt(i)); int optiuneBancaAleasa = scanner.nextInt(); banci.elementAt(optiuneBancaAleasa).meniu(); break; case 2: System.out.println("\nNumele bancii: "); String denumireBanca = buffer.readLine(); Banca banca = new Banca(denumireBanca); banci.add(banca); System.out.println("\nBanca a fost adaugata cu succes! \n " + banca); break; } }while(optiuneMeniu != 0); } private static void afisare(Vector<Banca> banci) { System.out.println(""); for (int i = 0; i < banci.size(); i++) { System.out.println(banci.elementAt(i).toString()); //afisare banca Iterator<Client> itClient = banci.elementAt(i).getListClient().iterator(); while(itClient.hasNext()) { Client client = itClient.next(); System.out.println(client.toString()); Iterator<ContBancar>itContBancar = client.getSetCont().iterator(); while(itContBancar.hasNext()) { ContBancar cont = itContBancar.next(); System.out.println(cont.toString()); } System.out.print("\n"); } System.out.print("\n"); } } private static void depunere(float suma, String numarCont, Vector<Banca> banci) { for (int i = 0; i < banci.size(); i++) { Iterator<Client> itClient = banci.elementAt(i).getListClient().iterator(); while(itClient.hasNext()) { Client client = itClient.next(); Iterator<ContBancar>itContBancar = client.getSetCont().iterator(); while(itContBancar.hasNext()) { ContBancar cont = itContBancar.next(); if(cont.getNumarCont().equals(numarCont)) { cont.depunere(suma); } } } } } private static void extragere(float suma, String numarCont, Vector<Banca> banci) { for (int i = 0; i < banci.size(); i++) { Iterator<Client> itClient = banci.elementAt(i).getListClient().iterator(); while(itClient.hasNext()) { Client client = itClient.next(); Iterator<ContBancar>itContBancar = client.getSetCont().iterator(); while(itContBancar.hasNext()) { ContBancar cont = itContBancar.next(); if(cont.getNumarCont().equals(numarCont)) { cont.extragere(suma); } } } } } }
// CIIC_4010 Advanced Programming // First Project: Classic Minesweeper //Isaac H. Lopez Diaz; Pedro A. Rodriguez Velez // October/14/2016 import java.awt.Color; import java.awt.Graphics; import java.awt.Insets; import java.util.Random; import javax.swing.JPanel; public class MyPanel extends JPanel { private static final long serialVersionUID = 3426940946811133635L; private static final int GRID_X = 25; private static final int GRID_Y = 25; private static final int INNER_CELL_SIZE = 29; private static final int TOTAL_COLUMNS = 9; private static final int TOTAL_ROWS = 9; public int x = -1; public int y = -1; public int mouseDownGridX = 0; public int mouseDownGridY = 0; public Color[][] colorArray = new Color[TOTAL_COLUMNS][TOTAL_ROWS]; public Integer[][] numsArray = new Integer[TOTAL_COLUMNS][TOTAL_ROWS]; public MyPanel() { //This is the constructor... this code runs first to initialize if (INNER_CELL_SIZE + (new Random()).nextInt(1) < 1) { //Use of "random" to prevent unwanted Eclipse warning throw new RuntimeException("INNER_CELL_SIZE must be positive!"); } if (TOTAL_COLUMNS + (new Random()).nextInt(1) < 2) { //Use of "random" to prevent unwanted Eclipse warning throw new RuntimeException("TOTAL_COLUMNS must be at least 2!"); } if (TOTAL_ROWS + (new Random()).nextInt(1) < 3) { //Use of "random" to prevent unwanted Eclipse warning throw new RuntimeException("TOTAL_ROWS must be at least 3!"); } for (int x = 0; x < TOTAL_COLUMNS; x++) { //The rest of the grid for (int y = 0; y < TOTAL_ROWS; y++) { colorArray[x][y] = Color.GRAY; } } for (int i = 0; i < TOTAL_COLUMNS; i++){ for (int j = 0; j < TOTAL_ROWS; j++){ numsArray[i][j] = 0; } } } public void paintComponent(Graphics g) { super.paintComponent(g); //Compute interior coordinates Insets myInsets = getInsets(); int x1 = myInsets.left; int y1 = myInsets.top; int x2 = getWidth() - myInsets.right - 1; int y2 = getHeight() - myInsets.bottom - 1; int width = x2 - x1; int height = y2 - y1; //Paint the background g.setColor(Color.LIGHT_GRAY); g.fillRect(x1, y1, width + 1, height + 1); //By default, the grid will be 10x10 (see above: TOTAL_COLUMNS and TOTAL_ROWS) g.setColor(Color.BLACK); for (int y = 0; y <= TOTAL_ROWS; y++) { g.drawLine(x1 + GRID_X, y1 + GRID_Y + (y * (INNER_CELL_SIZE + 1)), x1 + GRID_X + ((INNER_CELL_SIZE + 1) * TOTAL_COLUMNS), y1 + GRID_Y + (y * (INNER_CELL_SIZE + 1))); } for (int x = 0; x <= TOTAL_COLUMNS; x++) { g.drawLine(x1 + GRID_X + (x * (INNER_CELL_SIZE + 1)), y1 + GRID_Y, x1 + GRID_X + (x * (INNER_CELL_SIZE + 1)), y1 + GRID_Y + ((INNER_CELL_SIZE + 1) * (TOTAL_ROWS))); } //Paint cell colors for (int x = 0; x < TOTAL_COLUMNS; x++) { for (int y = 0; y < TOTAL_ROWS; y++) { Color c = colorArray[x][y]; g.setColor(c); g.fillRect(x1 + GRID_X + (x * (INNER_CELL_SIZE + 1)) + 1, y1 + GRID_Y + (y * (INNER_CELL_SIZE + 1)) + 1, INNER_CELL_SIZE, INNER_CELL_SIZE); } } //Show numbers all numbers // for (int x = 0; x < TOTAL_COLUMNS; x++) { // for (int y = 0; y < TOTAL_ROWS; y++) { // Integer d = numbersArray[x][y]; // g.setColor(Color.GRAY); // g.drawString(String.valueOf(d),x1 + GRID_X + (x * (INNER_CELL_SIZE + 1)) + 1, y1 + GRID_Y + (y * (INNER_CELL_SIZE + 1)) + 29); // } // } for (int x = 0; x < TOTAL_COLUMNS; x++) { for (int y = 0; y < TOTAL_ROWS; y++) { Integer d = numsArray[x][y]; if (colorArray[x][y] == Color.WHITE){ g.setColor(Color.GRAY); if (d > 0 && d < 9){ g.drawString(String.valueOf(d),x1 + GRID_X + (x * (INNER_CELL_SIZE + 1)) + (29/2), y1 + GRID_Y + (y * (INNER_CELL_SIZE + 1)) + 25); } } } } //Bomb Counter int bombCounter = 0; for (int x = 0; x < TOTAL_COLUMNS; x++) { for (int y = 0; y < TOTAL_ROWS; y++) { if (numsArray[x][y] == 9){ bombCounter++; } } } g.setColor(Color.BLACK); g.drawString(String.valueOf(bombCounter) + " bombs", 300, 340); } public int getGridX(int x, int y) { Insets myInsets = getInsets(); int x1 = myInsets.left; int y1 = myInsets.top; x = x - x1 - GRID_X; y = y - y1 - GRID_Y; if (x < 0) { //To the left of the grid return -1; } if (y < 0) { //Above the grid return -1; } if ((x % (INNER_CELL_SIZE + 1) == 0) || (y % (INNER_CELL_SIZE + 1) == 0)) { //Coordinate is at an edge; not inside a cell return -1; } x = x / (INNER_CELL_SIZE + 1); y = y / (INNER_CELL_SIZE + 1); if (x < 0 || x > TOTAL_COLUMNS - 1 || y < 0 || y > TOTAL_ROWS - 1) { //Outside the rest of the grid return -1; } return x; } public int getGridY(int x, int y) { Insets myInsets = getInsets(); int x1 = myInsets.left; int y1 = myInsets.top; x = x - x1 - GRID_X; y = y - y1 - GRID_Y; if (x < 0) { //To the left of the grid return -1; } if (y < 0) { //Above the grid return -1; } if ((x % (INNER_CELL_SIZE + 1) == 0) || (y % (INNER_CELL_SIZE + 1) == 0)) { //Coordinate is at an edge; not inside a cell return -1; } x = x / (INNER_CELL_SIZE + 1); y = y / (INNER_CELL_SIZE + 1); if (x < 0 || x > TOTAL_COLUMNS - 1 || y < 0 || y > TOTAL_ROWS - 1) { //Outside the rest of the grid return -1; } return y; } }
#include<iostream> using namespace std; int main() { string dir; int rail; cin>>dir; cin>>rail; if(dir=="front") { if(rail==1) cout<<"Left Handed"; else cout<<"Right Handed"; } else if(dir=="rear") { if(rail==1) cout<<"Right Handed"; else cout<<"Left Handed"; } }
package com.cmpickle.volumize.view.dialogs; import com.cmpickle.volumize.data.dto.ScheduleEventInfo; import com.cmpickle.volumize.domain.ScheduleEventService; import com.cmpickle.volumize.domain.VolumeService; import com.cmpickle.volumize.view.BasePresenter; import org.joda.time.DateTime; import javax.inject.Inject; /** * @author Cameron Pickle * Copyright (C) Cameron Pickle (cmpickle) on 5/3/2017. */ public class VolumeRestorePresenter extends BasePresenter<VolumeRestoreView> { ScheduleEventService scheduleEventService; VolumeService volumeService; VolumeRestoreView view; @Inject public VolumeRestorePresenter(ScheduleEventService scheduleEventService, VolumeService volumeService) { this.scheduleEventService = scheduleEventService; this.volumeService = volumeService; } @Override protected void setView(VolumeRestoreView view) { this.view = view; } public void onCreate() { view.setMaxVolumeRestoreSeekBar(volumeService.getRingToneMaxVolume()); } public void onRestoreClicked(int hour, int minute, int level) { ScheduleEventInfo event = new ScheduleEventInfo(); event.setOption(1); event.setAmount(level); event.setVibrate(true); event.setDays(0); DateTime dateTime = new DateTime(); event.setHour(hour+dateTime.getHourOfDay()); event.setMinute(minute+dateTime.getMinuteOfHour()); event.setRepeatWeekly(false); event.setActive(true); scheduleEventService.saveTempEvent(event); } }
package org.alienideology.jcord.internal.object.message; import org.alienideology.jcord.handle.emoji.Emoji; import org.alienideology.jcord.handle.guild.IGuildEmoji; import org.alienideology.jcord.handle.message.IMessage; import org.alienideology.jcord.handle.message.IReaction; import org.alienideology.jcord.internal.object.DiscordObject; import org.alienideology.jcord.internal.object.IdentityImpl; /** * @author AlienIdeology */ public final class Reaction extends DiscordObject implements IReaction { private Message message; private int reactedTimes; private boolean selfReacted; private Emoji emoji; private IGuildEmoji guildEmoji; /** * Constructor for Emoji */ public Reaction(IdentityImpl identity, Message message, int reactedTimes, boolean selfReacted, Emoji emoji) { super(identity); this.message = message; this.reactedTimes = reactedTimes; this.selfReacted = selfReacted; this.emoji = emoji; this.guildEmoji = null; } /** * Constructor for GuildEmoji */ public Reaction(IdentityImpl identity, Message message, int reactedTimes, boolean selfReacted, IGuildEmoji guildEmoji) { super(identity); this.message = message; this.reactedTimes = reactedTimes; this.selfReacted = selfReacted; this.emoji = null; this.guildEmoji = guildEmoji; } @Override public IMessage getMessage() { return message; } @Override public int getReactedTimes() { return reactedTimes; } @Override public Emoji getEmoji() { return emoji; } @Override public IGuildEmoji getGuildEmoji() { return guildEmoji; } @Override public boolean isSelfReacted() { return selfReacted; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Reaction)) return false; if (!super.equals(o)) return false; Reaction reaction = (Reaction) o; if (reactedTimes != reaction.reactedTimes) return false; return selfReacted == reaction.selfReacted; } @Override public int hashCode() { int result = super.hashCode(); result = 31 * result + reactedTimes; result = 31 * result + (selfReacted ? 1 : 0); return result; } @Override public String toString() { return "Reaction{" + "reactedTimes=" + reactedTimes + ", emoji=" + emoji + ", guildEmoji=" + guildEmoji + '}'; } }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package bus; import java.io.File; import java.lang.reflect.Field; import java.util.Arrays; import java.util.Properties; //import lemurproject.indri.QueryAnnotation; //import lemurproject.indri.QueryEnvironment; //import lemurproject.indri.ScoredExtentResult; /** * * @author ntson */ public class QueryTest { static { try { System.setProperty("java.library.path", "/Users/ntson/Downloads/lemur-installed/lib"); Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths"); fieldSysPath.setAccessible(true); fieldSysPath.set(null, null); Properties props = System.getProperties(); System.out.println("java.library.path=" + props.get("java.library.path")); } catch (Exception e) { } } // public static String query() throws Exception { //// Field field = ClassLoader.class.getDeclaredField("usr_paths"); //// field.setAccessible(true); //// //// String s = "/Users/ntson/Downloads/lemur-installed/lib"; //// System.setProperty("java.library.path", System.getProperty("java.library.path") + File.pathSeparator + s); // // //System.setProperty("java.library.path", "/Users/ntson/Downloads/lemur-installed/lib"); // //Field fieldSysPath = ClassLoader.class.getDeclaredField( "sys_paths" ); // //fieldSysPath.setAccessible( true ); // //fieldSysPath.set( null, null ); // QueryEnvironment env = new QueryEnvironment(); // env.addIndex("/Users/ntson/Downloads/000lemur-index"); // // QueryAnnotation results = env.runAnnotatedQuery("This code", 10); // //System.out.println(results.); // // ScoredExtentResult[] scored = results.getResults(); // System.out.println(scored[0].document); // // String[] names; // try { // names = env.documentMetadata(scored, "docno"); // } catch (Exception exc1) { // // no titles, something bad happened. // names = new String[scored.length]; // // error(exc.toString()); // // } // return Arrays.toString(names); // } // // public static String query2() throws Exception { // // TODO code application logic here // String s = bus.QueryTest.query(); // return s; // } }
package com.cse308.sbuify.customer; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.persistence.*; import com.cse308.sbuify.common.Queueable; import com.cse308.sbuify.common.api.Decorable; import com.cse308.sbuify.song.Song; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @Entity public class PlayQueue implements Serializable, Decorable { @Id @GeneratedValue private Integer id; // Note: fetch type necessary to solve org.hibernate.LazyInitializationException @ManyToMany(fetch = FetchType.EAGER, cascade = { CascadeType.REMOVE, CascadeType.PERSIST }) @JoinTable(inverseJoinColumns = @JoinColumn(name = "song_id")) private List<Song> songs = new ArrayList<>(); public PlayQueue() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public List<Song> getSongs() { return songs; } public void setSongs(List<Song> songs) { this.songs = songs; } /** * Replace the songs in the play queue with the songs in the given collection. * @param collection */ public void update(Collection<Song> collection) { songs = new ArrayList<>(); addAll(collection); } /** * Add all songs in a Queueable to the back of the play queue. * @param queueable */ public void addAll(Queueable queueable) { Collection<Song> songs = queueable.getItems(); addAll(songs); } /** * Remove all songs in a Queueable from the play queue. * @param queueable */ public void removeAll(Queueable queueable) { Collection<Song> songs = queueable.getItems(); removeAll(songs); } /** * Add all songs in a collection to the back of the play queue. * @param collection */ public void addAll(Collection<Song> collection) { songs.addAll(collection); } /** * Remove all songs in a collection from the play queue. * @param collection */ public void removeAll(Collection<Song> collection) { songs.removeAll(collection); } /** * Add a song to the back of the play queue. * @param song */ public void addSong(Song song){ songs.add(song); } /** * Add a song to the front of the play queue. * @param song */ public void addSongToFront(Song song) { songs.add(0, song); } /** * Add a collection of songs to the front of the play queue. * @param collection */ public void addAllToFront(Collection<Song> collection){ songs.addAll(0, collection); } @Override public String toString() { ObjectMapper mapper = new ObjectMapper(); String jsonString = ""; try { mapper.enable(SerializationFeature.INDENT_OUTPUT); jsonString = mapper.writeValueAsString(this); } catch (JsonProcessingException e) { e.printStackTrace(); } return jsonString; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PlayQueue playQueue = (PlayQueue) o; if (!id.equals(playQueue.id)) return false; if (songs.size() != playQueue.songs.size()) return false; for (int i = 0; i < songs.size(); i++) { Song thisSong = songs.get(i); Song thatSong = playQueue.songs.get(i); if (thisSong == null ? thatSong != null : !thisSong.equals(thatSong)) return false; } return true; } @Override public int hashCode() { int result = id.hashCode(); result = 31 * result + songs.hashCode(); return result; } }
import java.awt.*; /** * Created by C on 5/18/2017. */ public class Particle2D extends Particle{ private Color color = Color.WHITE; public Particle2D(double radius, double stepSize, double[]startPos) { if(startPos.length > 2) { throw new IllegalArgumentException(startPos.length + " dimensions were provided, but 2 were expected."); } velocity = new double[]{0, 0}; this.radius = radius; this.stepSize = stepSize; position = new double[3]; System.arraycopy(startPos, 0, position, 0, startPos.length); } public Particle2D(double radius, double stepSize) { this(radius, stepSize, new double[]{0, 0}); } public Particle2D(){ this(1, 1); } @Override public void randomStep() { double polarAngle = 2 * Math.PI * Math.random(); velocity[0] = radius * Math.cos(polarAngle); velocity[1] = radius * Math.sin(polarAngle); position[0] += velocity[0]; position[1] += velocity[1]; } @Override public void randomStep(Boundary bounds) { double polarAngle = 2 * Math.PI * Math.random(); velocity[0] = radius * Math.cos(polarAngle); velocity[1] = radius * Math.sin(polarAngle); bounds.onBoundCollision(this); } }
package com.jam.demo; import android.app.Application; import android.content.Context; import android.content.SharedPreferences; import androidx.annotation.NonNull; import androidx.lifecycle.AndroidViewModel; import androidx.lifecycle.LiveData; import androidx.lifecycle.SavedStateHandle; public class MyViewModel extends AndroidViewModel { private SavedStateHandle handle; private String key_exhaust = getApplication().getResources().getString(R.string.exhaust_level); private String key_social = getApplication().getResources().getString(R.string.social_level); private String shared_name = getApplication().getResources().getString(R.string.shared_name); public MyViewModel(@NonNull Application application, SavedStateHandle handle) { super(application); this.handle = handle; if(!(handle.contains(key_exhaust) && handle.contains(key_social))){ loadData(); } } public LiveData<Integer> getExhaustLevel() { return handle.getLiveData(key_exhaust); } public LiveData<Integer> getSocialLevel() { return handle.getLiveData(key_social); } public void saveData(){ SharedPreferences shp = getApplication().getSharedPreferences(shared_name, Context.MODE_PRIVATE); SharedPreferences.Editor editor = shp.edit(); editor.putInt(key_exhaust, getExhaustLevel().getValue()); editor.putInt(key_social, getSocialLevel().getValue()); editor.apply(); } public void loadData(){ SharedPreferences shp = getApplication().getSharedPreferences(shared_name, Context.MODE_PRIVATE); int exhaust_level = shp.getInt(key_exhaust, 5); int social_level = shp.getInt(key_social, 5); handle.set(key_exhaust, exhaust_level); handle.set(key_social, social_level); } }
package com.jpro.flashCardsUi.domain; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor public class FetchedUser { private Long id; private String name; private String password; private String email; private Language language; private UserAppColor userAppColor; }
package ua.nure.makieiev.brainfuck.command.impl; import ua.nure.makieiev.brainfuck.command.Command; import ua.nure.makieiev.brainfuck.model.Memory; import static ua.nure.makieiev.brainfuck.util.constant.BrainFuckConstant.ZERO; /** * The command is responsible for decrementing (decrease by one) the byte at the data pointer. */ public class MinusCommand implements Command { /** * This method decrements the byte at the data pointer * * @param memory is an object with an array on which certain actions are performed in specific commands */ @Override public void execute(Memory memory) { if (isPositiveCell(memory)) { memory.getMemory()[memory.getPosition()]--; } } private boolean isPositiveCell(Memory memory) { return memory.getMemory()[memory.getPosition()] > ZERO; } }
/* * [y] hybris Platform * * Copyright (c) 2000-2016 SAP SE * All rights reserved. * * This software is the confidential and proprietary information of SAP * Hybris ("Confidential Information"). You shall not disclose such * Confidential Information and shall use it only in accordance with the * terms of the license agreement you entered into with SAP Hybris. */ package com.cnk.travelogix.suppliers.acco.service.impl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import com.cnk.travelogix.suppliers.acco.converter.AccoCreateBookingConverter; import com.cnk.travelogix.suppliers.acco.converter.AddPassengerConverter; import com.cnk.travelogix.suppliers.acco.converter.AddRoomConverter; import com.cnk.travelogix.suppliers.acco.converter.AncillaryBookingConverter; import com.cnk.travelogix.suppliers.acco.converter.AvailabilityAndPriceConverter; import com.cnk.travelogix.suppliers.acco.converter.CancelPassengerConverter; import com.cnk.travelogix.suppliers.acco.converter.CancelRoomConverter; import com.cnk.travelogix.suppliers.acco.converter.ChangePeriodOfStayConverter; import com.cnk.travelogix.suppliers.acco.converter.GetDetailsConverter; import com.cnk.travelogix.suppliers.acco.converter.GetPoliciesConverter; import com.cnk.travelogix.suppliers.acco.converter.HotelCancelConverter; import com.cnk.travelogix.suppliers.acco.converter.OnRequestBookingUpdateConverter; import com.cnk.travelogix.suppliers.acco.converter.RePricingConverter; import com.cnk.travelogix.suppliers.acco.converter.RetrieveBookingConverter; import com.cnk.travelogix.suppliers.acco.converter.RetrieveBookingListConverter; import com.cnk.travelogix.suppliers.acco.converter.UpdatePassengerConverter; import com.cnk.travelogix.suppliers.acco.converter.UpdateRoomConverter; import com.cnk.travelogix.suppliers.acco.data.AddRoomHotelResModifyRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.AddRoomHotelResModifyResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.AncillaryBookingHotelResModifyRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.AncillaryBookingHotelResModifyResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.CancelHotelResModifyRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.CancelHotelResModifyResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.CancelRoomRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.CancelRoomResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.ChangePeriodOfStayHotelResModifyRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.ChangePeriodOfStayHotelResModifyResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.CreateBookingRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.GetDetailsRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.GetDetailsResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.GetPoliciesRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.GetPoliciesResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.HotelAvailRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.HotelAvailResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.HotelCancelResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.HotelCancelWrapper; import com.cnk.travelogix.suppliers.acco.data.HotelResModifyRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.HotelResModifyResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.HotelResResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.OnRequestBookingUpdateRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.OnRequestBookingUpdateResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.RePricingRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.RePricingResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.RetrieveBookingListRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.RetrieveBookingListResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.RetrieveBookingResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.RetrieveBookingWrapper; import com.cnk.travelogix.suppliers.acco.data.UpdateHotelResModifyRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.UpdateHotelResModifyResponseWrapper; import com.cnk.travelogix.suppliers.acco.data.UpdateRoomHotelResModifyRequestWrapper; import com.cnk.travelogix.suppliers.acco.data.UpdateRoomHotelResModifyResponseWrapper; import com.cnk.travelogix.suppliers.acco.service.SupplierAccoService; import com.cnk.travelogix.suppliers.client.SupplierClient; import com.coxandkings.integ.suppl.accointerface.AccoInterfaceRQ; import com.coxandkings.integ.suppl.accointerface.AccoInterfaceRS; import com.cnk.travelogix.suppliers.acco.converter.AccoCreateBookingConverter; import de.hybris.platform.servicelayer.config.ConfigurationService; /** * @author I077988 */ public class SupplierAccoServiceImpl implements SupplierAccoService { private static final Logger LOG = LoggerFactory.getLogger(SupplierAccoServiceImpl.class); @Autowired(required = true) private SupplierClient supplierClient; @Autowired private ConfigurationService configurationService; @Autowired private RePricingConverter rePricing; @Autowired private AddRoomConverter addRoomConverter; @Autowired private GetDetailsConverter getDetailsConverter; @Autowired private UpdateRoomConverter updateRoomConverter; @Autowired(required = true) private CancelRoomConverter cancelRoomConverter; @Autowired(required = true) private GetPoliciesConverter getPoliciesConverter; @Autowired(required = true) private HotelCancelConverter hotelCancelConverter; @Autowired(required = true) private AddPassengerConverter addPassengerConverter; @Autowired(required = true) private UpdatePassengerConverter updatePassengerConverter; @Autowired(required = true) private CancelPassengerConverter cancelPassengerConverter; @Autowired(required = true) private RetrieveBookingConverter retrieveBookingConverter; @Autowired private AncillaryBookingConverter ancillaryBookingConverter; @Autowired private AccoCreateBookingConverter accoCreateBookingConverter; @Autowired private ChangePeriodOfStayConverter changePeriodOfStayConverter; @Autowired(required = true) private RetrieveBookingListConverter retrieveBookingListConverter; @Autowired(required = true) private AvailabilityAndPriceConverter availabilityAndPriceConverter; @Autowired(required = true) private OnRequestBookingUpdateConverter onRequestBookingUpdateConverter; @Override public HotelAvailResponseWrapper otaAccoGetAvailabilityAndPrice(HotelAvailRequestWrapper request) { LOG.info("#otaAccoGetAvailabilityAndPrice - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoGetAvailabilityAndPrice.url"); final AccoInterfaceRQ accoInterfaceRQ = availabilityAndPriceConverter.toOTAHotelAvailRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); HotelAvailResponseWrapper response = availabilityAndPriceConverter.fromOTAHotelAvailRS(accoInterfaceRS); LOG.info("#otaAccoGetAvailabilityAndPrice - Finish"); return response; } @Override public GetDetailsResponseWrapper otaAccoGetDetails(GetDetailsRequestWrapper request) { LOG.info("#otaAccoGetDetails - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoGetDetails.url"); final AccoInterfaceRQ accoInterfaceRQ = getDetailsConverter.toOTAGetDetailRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); GetDetailsResponseWrapper response = getDetailsConverter.fromOTAGetDetailRS(accoInterfaceRS); LOG.info("#otaAccoGetDetails - Finish"); return response; } @Override public RePricingResponseWrapper otaAccoRepricing(RePricingRequestWrapper request) { LOG.info("#otaAccoRepricing - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoRepricing.url"); final AccoInterfaceRQ accoInterfaceRQ = rePricing.toOTARePricingRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); RePricingResponseWrapper response = rePricing.fromOTARePricingRS(accoInterfaceRS); LOG.info("#otaAccoRepricing - Finish"); return response; } @Override public GetPoliciesResponseWrapper otaAccoGetPolicies(GetPoliciesRequestWrapper request) { LOG.info("#otaAccoGetPolicies - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoGetPolicies.url"); final AccoInterfaceRQ accoInterfaceRQ = getPoliciesConverter.toOTAHotelGetCancellationPolicyRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); GetPoliciesResponseWrapper response = getPoliciesConverter.fromOTAHotelGetCancellationPolicyRS(accoInterfaceRS); LOG.info("#otaAccoGetPolicies - Finish"); return response; } @Override public HotelResResponseWrapper otaAccoCreateBooking(final CreateBookingRequestWrapper request) { LOG.info("#otaAccoCreateBooking - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoCreateBooking.url"); final AccoInterfaceRQ accoInterfaceRQ = accoCreateBookingConverter.toOTAHotelResRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); final HotelResResponseWrapper response = accoCreateBookingConverter.fromOTAHotelResRS(accoInterfaceRS); LOG.info("#otaAccoCreateBooking - Finish"); return response; } @Override public HotelCancelResponseWrapper otaAccoCancelBooking(HotelCancelWrapper request) { LOG.info("#otaAccoCancelBooking - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoCancelBooking.url"); final AccoInterfaceRQ accoInterfaceRQ = hotelCancelConverter.toOTACancelRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); HotelCancelResponseWrapper response = hotelCancelConverter.fromOTACancelRS(accoInterfaceRS); LOG.info("#otaAccoCancelBooking - Finish"); return response; } @Override public RetrieveBookingResponseWrapper otaAccoRetrieveBooking(RetrieveBookingWrapper request) { LOG.info("#otaAccoRetrieveBooking - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoRetrieveBooking.url"); final AccoInterfaceRQ accoInterfaceRQ = retrieveBookingConverter.toOTAReadRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); RetrieveBookingResponseWrapper response = retrieveBookingConverter.fromOTAReadRS(accoInterfaceRS); LOG.info("#otaAccoRetrieveBooking - Finish"); return response; } @Override public RetrieveBookingListResponseWrapper otaAccoRetrieveBookingList(RetrieveBookingListRequestWrapper request) { LOG.info("#otaAccoRetrieveBookingList - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoRetrieveBookingList.url"); final AccoInterfaceRQ accoInterfaceRQ = retrieveBookingListConverter.toOTAReadRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); RetrieveBookingListResponseWrapper response = retrieveBookingListConverter.fromOTAReadRS(accoInterfaceRS); LOG.info("#otaAccoRetrieveBookingList - Finish"); return response; } @Override public HotelResModifyResponseWrapper otaAccoAddPassenger(HotelResModifyRequestWrapper request) { LOG.info("#otaAccoAddPassenger - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoAddPassenger.url"); final AccoInterfaceRQ accoInterfaceRQ = addPassengerConverter.toOTAHotelResModifyRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); HotelResModifyResponseWrapper response = addPassengerConverter.fromOTAHotelResModifyRS(accoInterfaceRS); LOG.info("#otaAccoAddPassenger - Finish"); return response; } @Override public UpdateHotelResModifyResponseWrapper otaAccoUpdatePassenger(UpdateHotelResModifyRequestWrapper request) { LOG.info("#otaAccoUpdatePassenger - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoUpdatePassenger.url"); final AccoInterfaceRQ accoInterfaceRQ = updatePassengerConverter.toOTAHotelResModifyRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); UpdateHotelResModifyResponseWrapper response = updatePassengerConverter.fromOTAHotelResModifyRS(accoInterfaceRS); LOG.info("#otaAccoUpdatePassenger - Finish"); return response; } @Override public CancelHotelResModifyResponseWrapper otaAccoCancelPassenger(CancelHotelResModifyRequestWrapper request) { LOG.info("#otaAccoCancelPassenger - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoCancelPassenger.url"); final AccoInterfaceRQ accoInterfaceRQ = cancelPassengerConverter.toOTAHotelResModifyRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); CancelHotelResModifyResponseWrapper response = cancelPassengerConverter.fromOTAHotelResModifyRS(accoInterfaceRS); LOG.info("#otaAccoCancelPassenger - Finish"); return response; } @Override public AddRoomHotelResModifyResponseWrapper otaAccoAddRoom(AddRoomHotelResModifyRequestWrapper request) { LOG.info("#otaAccoAddRoom - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoAddRoom.url"); final AccoInterfaceRQ accoInterfaceRQ = addRoomConverter.toOTAHotelResModifyRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); AddRoomHotelResModifyResponseWrapper response = addRoomConverter.fromOTAHotelResModifyRS(accoInterfaceRS); LOG.info("#otaAccoAddRoom - Finish"); return response; } @Override public UpdateRoomHotelResModifyResponseWrapper otaAccoUpdateRoom(UpdateRoomHotelResModifyRequestWrapper request) { LOG.info("#otaAccoUpdateRoom - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoUpdateRoom.url"); final AccoInterfaceRQ accoInterfaceRQ = updateRoomConverter.toOTAHotelResModifyRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); UpdateRoomHotelResModifyResponseWrapper response = updateRoomConverter.fromOTAHotelResModifyRS(accoInterfaceRS); LOG.info("#otaAccoUpdateRoom - Finish"); return response; } @Override public CancelRoomResponseWrapper otaAccoCancelRoom(CancelRoomRequestWrapper request) { LOG.info("#otaAccoCancelRoom - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoCancelRoom.url"); final AccoInterfaceRQ accoInterfaceRQ = cancelRoomConverter.toOTACancelRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); CancelRoomResponseWrapper response = cancelRoomConverter.fromOTACancelRS(accoInterfaceRS); LOG.info("#otaAccoCancelRoom - Finish"); return response; } @Override public ChangePeriodOfStayHotelResModifyResponseWrapper otaAccoChangePeriodOfStay(ChangePeriodOfStayHotelResModifyRequestWrapper request) { LOG.info("#otaAccoChangePeriodOfStay - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoChangePeriodOfStay.url"); final AccoInterfaceRQ accoInterfaceRQ = changePeriodOfStayConverter.toOTAHotelResModifyRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); ChangePeriodOfStayHotelResModifyResponseWrapper response = changePeriodOfStayConverter.fromOTAHotelResModifyRS(accoInterfaceRS); LOG.info("#otaAccoChangePeriodOfStay - Finish"); return response; } @Override public AncillaryBookingHotelResModifyResponseWrapper otaAccoAncillaryBooking(AncillaryBookingHotelResModifyRequestWrapper request) { LOG.info("#otaAccoAncillaryAmendment - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaAccoAncillaryAmendment.url"); final AccoInterfaceRQ accoInterfaceRQ = ancillaryBookingConverter.toOTAHotelResModifyRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); AncillaryBookingHotelResModifyResponseWrapper response = ancillaryBookingConverter.fromOTAHotelResModifyRS(accoInterfaceRS); LOG.info("#otaAccoAncillaryAmendment - Finish"); return response; } @Override public OnRequestBookingUpdateResponseWrapper otaOnRequestBookingUpdate(OnRequestBookingUpdateRequestWrapper request) { LOG.info("#otaOnRequestBookingUpdate - Start"); final String url = configurationService.getConfiguration().getString("supplier.ota.otaOnRequestBookingUpdate.url"); final AccoInterfaceRQ accoInterfaceRQ = onRequestBookingUpdateConverter.toOTAReadRQ(request); final AccoInterfaceRS accoInterfaceRS = supplierClient.postForAccoInterface(url, accoInterfaceRQ); OnRequestBookingUpdateResponseWrapper response = onRequestBookingUpdateConverter.fromOTAReadRS(accoInterfaceRS); LOG.info("#otaOnRequestBookingUpdate - Finish"); return response; } }
import com.sun.jna.Memory; import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.image.PixelFormat; import javafx.scene.image.PixelWriter; import javafx.scene.image.WritablePixelFormat; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; import uk.co.caprica.vlcj.component.DirectMediaPlayerComponent; import uk.co.caprica.vlcj.player.direct.BufferFormat; import uk.co.caprica.vlcj.player.direct.BufferFormatCallback; import uk.co.caprica.vlcj.player.direct.DefaultDirectMediaPlayer; import uk.co.caprica.vlcj.player.direct.format.RV32BufferFormat; import java.nio.ByteBuffer; /** * Created by thomasfouan on 16/03/2016. */ public abstract class JavaFXDirectRendering extends Application { /** * Filename of the video to play. */ private static final String VIDEO_FILE = "/Users/thomasfouan/Desktop/music.mp3"; //"/Users/thomasfouan/Desktop/video.mp4" /** * Set this to <code>true</code> to resize the display to the dimensions of the * video, otherwise it will use {@link #WIDTH} and {@link #HEIGHT}. */ private static final boolean useSourceSize = true; /** * Target width, unless {@link #useSourceSize} is set. */ private static final int WIDTH = 720; /** * Target height, unless {@link #useSourceSize} is set. */ private static final int HEIGHT = 576; /** * Lightweight JavaFX canvas, the video is rendered here. */ private final Canvas canvas; /** * Pixel writer to update the canvas. */ private final PixelWriter pixelWriter; /** * Pixel format. */ private final WritablePixelFormat<ByteBuffer> pixelFormat; /** * */ private final BorderPane borderPane; /** * The vlcj direct rendering media player component. */ private final DirectMediaPlayerComponent mediaPlayerComponent; /** * */ private Stage stage; /** * */ private Scene scene; /** * */ public JavaFXDirectRendering() { canvas = new Canvas(); pixelWriter = canvas.getGraphicsContext2D().getPixelWriter(); pixelFormat = PixelFormat.getByteBgraInstance(); borderPane = new BorderPane(); borderPane.setCenter(canvas); mediaPlayerComponent = new TestMediaPlayerComponent(); } @Override public final void start(Stage primaryStage) throws Exception { this.stage = primaryStage; stage.setTitle("vlcj JavaFX Direct Rendering"); scene = new Scene(borderPane); primaryStage.setScene(scene); primaryStage.show(); mediaPlayerComponent.getMediaPlayer().playMedia(VIDEO_FILE); mediaPlayerComponent.getMediaPlayer().setPosition(0.0f); startTimer(); } @Override public final void stop() throws Exception { stopTimer(); mediaPlayerComponent.getMediaPlayer().stop(); mediaPlayerComponent.getMediaPlayer().release(); } /** * Implementation of a direct rendering media player component that renders * the video to a JavaFX canvas. */ private class TestMediaPlayerComponent extends DirectMediaPlayerComponent { public TestMediaPlayerComponent() { super(new TestBufferFormatCallback()); } } /** * Callback to get the buffer format to use for video playback. */ private class TestBufferFormatCallback implements BufferFormatCallback { @Override public BufferFormat getBufferFormat(int sourceWidth, int sourceHeight) { final int width; final int height; if (useSourceSize) { width = sourceWidth; height = sourceHeight; } else { width = WIDTH; height = HEIGHT; } Platform.runLater(new Runnable () { @Override public void run() { canvas.setWidth(width); canvas.setHeight(height); stage.setWidth(width); stage.setHeight(height); } }); return new RV32BufferFormat(width, height); } } /** * */ protected final void renderFrame() { Memory[] nativeBuffers = mediaPlayerComponent.getMediaPlayer().lock(); if (nativeBuffers != null) { // FIXME there may be more efficient ways to do this... // Since this is now being called by a specific rendering time, independent of the native video callbacks being // invoked, some more defensive conditional checks are needed Memory nativeBuffer = nativeBuffers[0]; if (nativeBuffer != null) { ByteBuffer byteBuffer = nativeBuffer.getByteBuffer(0, nativeBuffer.size()); BufferFormat bufferFormat = ((DefaultDirectMediaPlayer) mediaPlayerComponent.getMediaPlayer()).getBufferFormat(); if (bufferFormat.getWidth() > 0 && bufferFormat.getHeight() > 0) { pixelWriter.setPixels(0, 0, bufferFormat.getWidth(), bufferFormat.getHeight(), pixelFormat, byteBuffer, bufferFormat.getPitches()[0]); } } } mediaPlayerComponent.getMediaPlayer().unlock(); } /** * */ protected abstract void startTimer(); /** * */ protected abstract void stopTimer(); }
package com.smelending.config.model; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlValue; @XmlRootElement public class Server { private String classs; private String Logger; private String name; private Attr attr; private Channel channel; private RequestListener requestlistener; public RequestListener getRequestlistener() { return requestlistener; } @XmlElement(name="request-listener") public void setRequestlistener(RequestListener requestlistener) { this.requestlistener = requestlistener; } public Channel getChannel() { return channel; } @XmlElement public void setChannel(Channel channel) { this.channel = channel; } public String getClasss() { return classs; } @XmlAttribute(name="class") public void setClasss(String classs) { this.classs = classs; } public String getLogger() { return Logger; } @XmlAttribute public void setLogger(String logger) { Logger = logger; } public String getName() { return name; } @XmlAttribute public void setName(String name) { this.name = name; } public Attr getAttr() { return attr; } @XmlElement() public void setAttr(Attr attr) { this.attr = attr; } public static class Attr{ private String name; private String type; private String value; public String getValue() { return value; } @XmlValue public void setValue(String value) { this.value = value; } public String getName() { return name; } @XmlAttribute public void setName(String name) { this.name = name; } public String getType() { return type; } @XmlAttribute public void setType(String type) { this.type = type; } public Attr(String name, String type, String value){ this.name=name; this.type=type; this.value=value; } public Attr(){ } } public static class Channel{ private String classes; private String header; private String logger; private String packager; public String getClasses() { return classes; } @XmlAttribute(name="class") public void setClasses(String classes) { this.classes = classes; } public String getHeader() { return header; } @XmlAttribute public void setHeader(String header) { this.header = header; } public String getLogger() { return logger; } @XmlAttribute public void setLogger(String logger) { this.logger = logger; } public String getPackager() { return packager; } @XmlAttribute public void setPackager(String packager) { this.packager = packager; } public Channel(String classes, String header, String logger, String packager){ this.classes=classes; this.header=header; this.logger=logger; this.packager=packager; } public Channel(){ } } }
package org.alienideology.jcord.handle.modifiers; import org.alienideology.jcord.handle.audit.AuditAction; import org.alienideology.jcord.handle.channel.IGuildChannel; import org.alienideology.jcord.handle.channel.ITextChannel; import org.alienideology.jcord.handle.channel.IVoiceChannel; import org.alienideology.jcord.handle.guild.IGuild; import java.util.List; /** * IChannelModifier - A modifier that modifies both {@link ITextChannel} and {@link IVoiceChannel}. * * @author AlienIdeology */ public interface IChannelModifier extends IModifier<AuditAction<Void>> { /** * Get the guild this channel modifier belongs to. * * @return The guild. */ default IGuild getGuild() { return getGuildChannel().getGuild(); } /** * Get the guild channel this channel modifier modifies. * * @return The guild channel. */ IGuildChannel getGuildChannel(); /** * Modify the channel's name. * Use empty or {@code null} string to reset the name. * * @exception org.alienideology.jcord.internal.exception.PermissionException * <ul> * <li>If the identity do not have {@code Manage Channels} permission.</li> * <li>If the name is shorter than {@value IGuildChannel#NAME_LENGTH_MIN} or longer than {@value IGuildChannel#NAME_LENGTH_MAX}.</li> * </ul> * @exception IllegalArgumentException * If the name is not valid. See {@link IGuildChannel#isValidChannelName(String)}. * * @param name The name. * @return IChannelModifier for chaining. */ IChannelModifier name(String name); /** * Modify the channel's position. * The position of a channel can be calculated by counting down the channel list, starting from 1. * Note that voice channels is a separate list than text channels in a guild. * @see IGuildChannel#getPosition() * * If the {@code position} is 0, then it will be the first in the channel list. * Use {@link IGuild#getTextChannels()} or {@link IGuild#getVoiceChannels()}, then {@link List#size()} to get the last * position in the channel list. * * Note that there are no limits to the position. If the position is too small or large, no exception will be thrown. * The channel will simply by placed at the start or the end of the channel list, respectively. * * @exception org.alienideology.jcord.internal.exception.PermissionException * If the identity do not have {@code Manage Channels} permission. * * @param position The position. * @return IChannelModifier for chaining. */ IChannelModifier position(int position); /** * Modify the {@link ITextChannel}'s topic. * Use empty or {@code null} string to reset the topic. * * @exception org.alienideology.jcord.internal.exception.PermissionException * If the identity do not have {@code Manage Channels} permission. * @exception IllegalArgumentException * <ul> * <li>If the channel managers manages a {@link IVoiceChannel}.</li> * <li>If the topic is longer than {@value ITextChannel#TOPIC_LENGTH_MAX}.</li> * </ul> * * @param topic The topic. * @return IChannelModifier for chaining. */ IChannelModifier topic(String topic); /** * Modify the {@link IVoiceChannel}'s bitrate. * * If the guild is a normal guild, the bitrate cannot be higher than {@value IVoiceChannel#BITRATE_MAX}. * If the guild is a VIP guild, then the bitrate limit is {@value IVoiceChannel#VOICE_CHANNEL_BITRATE_VIP_MAX}. * @see IVoiceChannel#getBitrate() For more information on bitrate. * @see IGuild#getSplash() Normal guilds' splash will always be null. * * @exception org.alienideology.jcord.internal.exception.PermissionException * If the identity do not have {@code Manage Channels} permission. * @exception IllegalArgumentException * <ul> * <li>If the channel managers manages a {@link ITextChannel}.</li> * <li>If the bitrate is not valid. See {@link IVoiceChannel#isValidBitrate(int, IGuild)} with VIP guild..</li> * </ul> * * @param bitrate The new bitrate. * @return IChannelModifier for chaining. */ IChannelModifier bitrate(int bitrate); /** * Modify the {@link IVoiceChannel}'s user limit. * Use 0 for no user limits. Note that negative limits will throw {@link IllegalArgumentException}. * @see IVoiceChannel#getUserLimit() For more information on user limit. * * @exception org.alienideology.jcord.internal.exception.PermissionException * If the identity do not have {@code Manage Channels} permission. * @exception IllegalArgumentException * If the user limit is not valid. See {@link IVoiceChannel#isValidUserLimit(int)}. * * @param limit The new limit. * @return A void {@link AuditAction}, used to attach reason to the modify action. */ IChannelModifier userLimit(int limit); /** * Get the name attribute, used to modify the channel's name. * * @return The name attribute. */ Attribute<IChannelModifier, String> getNameAttr(); /** * Get the position attribute, used to modify the channel's position. * * @return The position attribute. */ Attribute<IChannelModifier, Integer> getPositionAttr(); /** * Get the topic attribute, used to modify the {@link ITextChannel}'s topic. * * @return The topic attribute. */ Attribute<IChannelModifier, String> getTopicAttr(); /** * Get the bitrate attribute, used to modify the {@link IVoiceChannel}'s bitrate. * * @return The bitrate attribute. */ Attribute<IChannelModifier, Integer> getBitrateAttr(); /** * Get the user limit attribute, used to modify the {@link IVoiceChannel}'s user limit. * * @return The user limit attribute. */ Attribute<IChannelModifier, Integer> getUserLimitAttr(); }
package com.example.invite_friends; import com.example.invite_friends.adapter.InviteVpAdapter; import com.example.mvp.IView; public interface InviteFriendsView extends IView { void loadVP(InviteVpAdapter adapter, int size); }
package shawn.designpattern.adapter; public interface MicroUSBChargable extends Chargable { void connect(); }
package queryProcessing; import java.util.LinkedList; import java.util.Map; import java.util.Map.Entry; import org.apache.commons.lang.StringUtils; import queryProcessing.Query.Edge; import com.google.common.collect.Maps; public class Utils { public static void main(String[] args) { Query q = new Query(); // q.addEdge("?manager", "?club"); // q.addEdge("?club", "footballClub"); // q.addEdge("?club", "Barcelona"); q.addEdge("?a", "data"); q.addEdge("?a", "?y"); q.addEdge("?a", "?n"); q.addEdge("?b", "?n"); //q.addEdge("?b", "?n"); q.addEdge("?b", "data2"); // q.addEdge("?c2", "?lat"); // q.addEdge("?c2", "?long"); String core = StringUtils.EMPTY; core = isPWOC(q); } public static String isPWOC(Query query) { String core = StringUtils.EMPTY; int dofe = Integer.MAX_VALUE; for (String node : query.getNodes()) { int tempDofe = DoEF(query, node); if (tempDofe < dofe) { dofe = tempDofe; core = node; } } if (dofe <= 2) return core; return StringUtils.EMPTY; } private static int DoEF(Query query, String vertex) { Map<Query.Edge, Integer> dists = Maps.newHashMap(); DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(query); dijkstra.execute(vertex); for (Query.Edge edge : query.getEdges()) { if (!dists.containsKey(edge)) { int min = Math.min(distance(dijkstra, vertex, edge.getSource()), distance(dijkstra, vertex, edge.getTarget())) + 1; dists.put(edge, min); } } int max = -1; for (Entry<Edge, Integer> di : dists.entrySet()) { if (di.getValue() > max) max = di.getValue(); } return max; } private static int distance(DijkstraAlgorithm dijkstra, String source, String target) { if (source == target) return 0; LinkedList<String> path = dijkstra.getPath(target); if (path == null) return Integer.MAX_VALUE; return path.size() - 1; } }
package com.tencent.mm.plugin.card.ui.a; import com.tencent.mm.ui.MMActivity; public final class c extends a { public c(MMActivity mMActivity) { super(mMActivity); } public final boolean azu() { return this.hHc; } public final boolean azx() { return false; } public final boolean azy() { return this.hHc && super.azy(); } public final boolean azC() { return false; } public final boolean azD() { return false; } }
package test3.param.basics1; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Parameters; import org.testng.annotations.Test; public class T3 { @BeforeMethod @Parameters(value = {"userName","password"}) public void before(String name,String password) { System.out.println(name); System.out.println(password); } @Test public void t3() { System.out.println("In t3"); } @Test public void t4() { System.out.println("In t4"); } }
package app.extension; import app.MenuItem; import magnet.DependencyScope; import magnet.Implementation; @Implementation( forType = MenuItem.class, forTarget = "main-menu" ) class HomePageMenuItem implements MenuItem { HomePageMenuItem(DependencyScope dependencyScope) { } @Override public int getId() { return 1; } }
package com.box.androidsdk.content.models; import com.eclipsesource.json.JsonArray; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; /** * An object representing a url link. */ public class BoxEmbedLink extends BoxJsonObject { private static final String FIELD_URL = "url"; public BoxEmbedLink() { super(); } public String getUrl(){ return getPropertyAsString(FIELD_URL); } }
package com.example.battleroyale; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.content.ContextCompat; import android.animation.ObjectAnimator; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.provider.ContactsContract; import android.util.DisplayMetrics; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import android.widget.ImageView; import android.view.Window; import android.widget.LinearLayout; import android.widget.TextView; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.lang.Math; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import io.github.controlwear.virtual.joystick.android.JoystickView; public class GameActivity extends AppCompatActivity{ //Text view initialization for username reference private static final String FILE_NAME = "example.txt"; TextView textView3; TextView textView7; String text; FileInputStream fis; ImageView playerIcon; ImageView bullet1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //sets game to full screen getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_game); playerIcon = findViewById(R.id.playerIcon); bullet1 = findViewById(R.id.bulletView1); bullet1.setVisibility(bullet1.GONE); // //Initialize profile name to show up in game through textview textView3 = findViewById(R.id.textView3); Intent resultsIntent = getIntent(); ArrayList<String> results = resultsIntent.getStringArrayListExtra("Results"); textView7 = findViewById(R.id.textView7); textView7.setText("UI" + "\n" + results); if (results == null){ textView7.setVisibility(View.INVISIBLE); } try { fis = openFileInput(FILE_NAME); } catch (FileNotFoundException e) { e.printStackTrace(); } InputStreamReader isr = new InputStreamReader(fis); BufferedReader br = new BufferedReader(isr); StringBuilder sb = new StringBuilder(); while (true){ try { if (!((text = br.readLine()) != null)) break; } catch (IOException e) { e.printStackTrace(); } sb.append(text).append("\n"); textView7.setVisibility(View.VISIBLE); } if (((sb) == null)){ sb.append("Player"); } textView3.setText("User: " + sb.toString()); //Left Joystick final JoystickView joystickLeft = findViewById(R.id.joystickView_left); //Create movement listener joystickLeft.setOnTouchListener(handleMove); // Right Joystick final JoystickView joystickRight = findViewById(R.id.joystickView_right); //Create rotation listener joystickRight.setOnTouchListener(handleShoot); //HashMap to keep track of objects on the screen HashMap<Object,ImageView> objectList = new HashMap<Object,ImageView>(); //Testing for presentation Shotgun shotgun = new Shotgun(500f, 500f); Pistol pistol = new Pistol(310f,300f); Player player = new Player(150f,150f,"User1"); AmmoBox ammoBox = new AmmoBox(0f,0f); HealthPack healthPack = new HealthPack(500F,50f); addObjectToScreen(pistol,objectList); addObjectToScreen(shotgun, objectList); addObjectToScreen(player, objectList); addObjectToScreen(ammoBox, objectList); addObjectToScreen(healthPack,objectList); player.pickUpAmmoBox(ammoBox); Log.i("testCollision", "Player colliding with ammoBox is " + checkCollision(ammoBox,player)); Log.i("testCollision", "Player colliding with healthPack is " + checkCollision(healthPack,player)); Log.i("testCollision", "Player colliding with ammoBox is " + checkCollision(shotgun,player)); Log.i("testCollision","Player colliding with pistol is " + checkCollision(pistol,player)); //gameStatus(objectList); Log.i("testCollision",player.toString()); } private View.OnTouchListener handleMove = new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { final float x = event.getX(); final float y = event.getY(); if (event.getAction() == MotionEvent.ACTION_MOVE) { final float buttonCenterX = ((float) v.getWidth()) / 2; final float buttonCenterY = ((float) v.getHeight()) / 2; final float deltaX = x - buttonCenterX; final float deltaY = y - buttonCenterY; playerIcon.setX(playerIcon.getX() + deltaX * 0.1f); playerIcon.setY(playerIcon.getY() + deltaY * 0.1f); float PlayerX = playerIcon.getX(); float PlayerY = playerIcon.getY(); DisplayMetrics display = getResources().getDisplayMetrics(); final float topBound = -90; final float bottomBound = display.heightPixels - 375f; final float rightBound = display.widthPixels - 150f; final float leftBound = -85f; if (PlayerX < leftBound) { playerIcon.setX(leftBound); } if (PlayerX > rightBound) { playerIcon.setX(rightBound); } if (PlayerY < topBound) { playerIcon.setY(topBound); } if (PlayerY > bottomBound) { playerIcon.setY(bottomBound); } } return false; } }; private View.OnTouchListener handleShoot = new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { final float x = event.getX(); final float y = event.getY(); final float buttonCenterX = ((float) v.getWidth()) / 2; final float buttonCenterY = ((float) v.getHeight()) / 2; final float deltaX = x - buttonCenterX; final float deltaY = y - buttonCenterY; float bulletX = bullet1.getX(); float bulletY = bullet1.getY(); float bulletWidth = bullet1.getWidth(); float bulletHeight = bullet1.getHeight(); float translationX = bulletX + deltaX ; float translationY = bulletY + deltaY ; bullet1.setX(playerIcon.getX() + (bulletWidth * .85f)); bullet1.setY(playerIcon.getY() + (bulletHeight * 1.1f)); if (event.getAction() == MotionEvent.ACTION_MOVE) { ObjectAnimator bulletStream1X = ObjectAnimator.ofFloat(bullet1,"translationX", translationX); bulletStream1X.setDuration(1000); ObjectAnimator bulletStream1Y = ObjectAnimator.ofFloat(bullet1,"translationY", translationY); bulletStream1Y.setDuration(1000); bulletStream1X.start(); bulletStream1Y.start(); bullet1.setVisibility(bullet1.VISIBLE); DisplayMetrics display = getResources().getDisplayMetrics(); final float topBound = -90; final float bottomBound = display.heightPixels - 375f; final float rightBound = display.widthPixels - 150f; final float leftBound = -85f; if (bulletX < leftBound || bulletX > rightBound || bulletY < topBound || bulletY > bottomBound) { bullet1.setVisibility(View.GONE); } } return false; } }; public ConstraintLayout callLayout(){ final ConstraintLayout layout = findViewById(R.id.gameLayout); return layout; } //adds imageView for object public void addObjectToScreen(Object object, HashMap objectList){ final ImageView image = new ImageView(this); image.setBackgroundResource(object.getImage()); image.setX(object.getXLocation()); image.setY(object.getYLocation()); callLayout().addView(image); image.getLayoutParams().width = object.getWidth(); image.getLayoutParams().height = object.getHeight(); //found from https://stackoverflow.com/questions/44614271/android-resize-imageview-programmatically image.requestLayout(); image.invalidate(); objectList.put(object,image); } public boolean checkCollision(Object object, Object playerObject){ boolean Collision = false; float xDifference = playerObject.getXLocation() - object.getXLocation(); float yDifference = playerObject.getYLocation() - object.getYLocation(); float PlayerXDifference = object.getXLocation() - playerObject.getXLocation(); float PlayerYDifference = object.getYLocation() - playerObject.getYLocation(); if(xDifference <= object.xBuffer && xDifference >= 0 && yDifference <= object.yBuffer && yDifference >= 0) Collision = true; else if (PlayerXDifference <= playerObject.getxBuffer() && PlayerXDifference >= 0 && PlayerYDifference <= playerObject.getyBuffer() && PlayerYDifference >= 0) Collision = true; return Collision; } public void collisionType(Object object, Player player, HashMap<Object,ImageView> objectList){ if (object.getObjectType() == 2){ try{ player.pickUpAmmoBox((AmmoBox) object); Log.i("testCollision","Got ammo"); callLayout().removeView(objectList.get(object)); } catch(Exception e){ Log.i("testCollision", "Unable to add ammo."); } } else if (object.getObjectType() == 1){ try{ player.pickUpWeapon((Weapon) object); Log.i("testCollision","Weapon was picked up"); callLayout().removeView(objectList.get(object)); } catch (Exception e){ Log.i("testCollision","Unable to pick up weapon"); } } else if (object.getObjectType() == 3){ try{ player.pickUpHealthPack((HealthPack)object); Log.i("testCollision","Picked up health"); callLayout().removeView(objectList.get(object)); }catch (Exception e){ Log.i("testCollision", "Unable to pick up health"); } } } public void gameStatus(HashMap<Object,ImageView> objectList){ for (Object i : objectList.keySet()){ if(i.getObjectType() == 0){ for (Object j : objectList.keySet()){ if(checkCollision(j,i)){ collisionType(j,(Player) i,objectList); } } } } } }
package day24_loops; import javax.swing.*; public class Alphabet { public static void main(String[] args) { char abc='a'; // System.out.println("abc = " + abc); // abc++; // System.out.println("abc = " + abc); while(abc <='a'){ System.out.print( abc+""); abc++; } System.out.println("*****************************"); abc='z'; while(abc >='a'){ System.out.print(abc+" "); abc--; } } }
package com.tencent.xweb.x5; import com.jg.EType; import com.jg.JgClassChecked; import com.tencent.smtt.export.external.interfaces.WebResourceResponse; import com.tencent.xweb.m; @JgClassChecked(author = 30, fComment = "checked", lastDate = "20171020", reviewer = 30, vComment = {EType.JSEXECUTECHECK}) public final class g { public static m a(WebResourceResponse webResourceResponse) { if (webResourceResponse == null) { return null; } return new m(webResourceResponse.getMimeType(), webResourceResponse.getEncoding(), webResourceResponse.getStatusCode(), webResourceResponse.getReasonPhrase(), webResourceResponse.getResponseHeaders(), webResourceResponse.getData()); } }
package com.daralisdan.dao; import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Param; import com.daralisdan.bean.Employee; public interface EmployeeMapper { // 查询 单个参数 public Employee getEmpId(Integer id); // 增加 public void addEmp(Employee employee); // 修改 // public void updateEmp(Employee employee); public boolean updateEmp(Employee employee); // 删除 public void deleteEmpById(Integer id); // 多个参数时 // public Employee getEmpIdAndLastName(Integer id, String lastName); // @Param("lastName")该注解指定map封装中key的值 public Employee getEmpIdAndLastName(@Param("id") Integer id, @Param("lastName") String lastName); // 多个参数不是业务模型中的数据,可以传入map public Employee getEmpByMap(Map<String, Object> map); // 返回的是集合类型 查询 public List<Employee> getEmpByLastNameLike(String lastName); // 返回一条记录的map,key就是列名,值就是对应的值 public Map<String, Object> getEmpByIdReturnMap(Integer id); // 多条记录封装一个map, Map<String, Employee> 键是这条记录的主键,值是封装后的javaBean // 告诉mybatis封装这个map时使用哪个属性作为主键(map的key) //@MapKey("id")//获取到的id作为主键key @MapKey("lastName") //获取到的名字作为主键key public Map<String, Employee> getEmpByLastNameLikeReturnMap(String lastName); }
package com.uhope.template.web; import com.uhope.base.constants.Constant; import com.uhope.base.dto.PageInfo; import com.uhope.base.result.Result; import com.uhope.uip.dto.UserDTO; import com.uhope.uip.service.UserService; 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.RequestParam; import org.springframework.web.bind.annotation.RestController; /** * 描述: * 测试封装方法 * * @author a4994 * @create 2018-09-07 14:05 */ @RestController @RequestMapping("/v1/userController") public class UserController { @Autowired private UserService userService; @GetMapping("/hello") public Result<PageInfo<UserDTO>> hello(@RequestParam(defaultValue = "") String var1, @RequestParam(defaultValue = "") Long var2, @RequestParam(defaultValue = "") String var3, @RequestParam(defaultValue = "") String var4, @RequestParam(defaultValue = Constant.DEFAULT_PAGE_NUMBER) int var5, @RequestParam(defaultValue = Constant.DEFAULT_PAGE_SIZE) int var6){ return userService.queryUserList(var1,var2,var3,var4,var5,var6); } }
package com.example.codetribe1.constructionappsuite.util; import android.content.Context; import android.os.Vibrator; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.example.codetribe1.constructionappsuite.R; public class ToastUtil { public static void toast(Context ctx, String message, int durationSeconds, int gravity) { Vibrator vb = (Vibrator) ctx.getSystemService(Context.VIBRATOR_SERVICE); vb.vibrate(30); LayoutInflater inf = (LayoutInflater) ctx .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View main = inf.inflate(R.layout.toast, null); TextView msg = (TextView) main.findViewById(R.id.txtTOASTMessage); msg.setText(message); CustomToast toast = new CustomToast(ctx, durationSeconds); toast.setGravity(gravity, 0, 0); toast.setView(main); toast.show(); } public static void toast(Context ctx, String message) { Vibrator vb = (Vibrator) ctx.getSystemService(Context.VIBRATOR_SERVICE); vb.vibrate(30); LayoutInflater inf = (LayoutInflater) ctx .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View main = inf.inflate(R.layout.toast, null); TextView msg = (TextView) main.findViewById(R.id.txtTOASTMessage); msg.setText(message); CustomToast toast = new CustomToast(ctx, 3); toast.setGravity(Gravity.CENTER, 0, 0); toast.setView(main); toast.show(); } public static void errorToast(Context ctx, String message) { if (message == null) { Log.e("ToastUtil", "Error message is NULL"); return; } Vibrator vb = (Vibrator) ctx.getSystemService(Context.VIBRATOR_SERVICE); vb.vibrate(50); LayoutInflater inf = (LayoutInflater) ctx .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View main = inf.inflate(R.layout.toast_error, null); TextView msg = (TextView) main.findViewById(R.id.txtTOASTMessage); msg.setText(message); Toast toast = new Toast(ctx); toast.setGravity(Gravity.CENTER, 0, 0); toast.setDuration(Toast.LENGTH_LONG); toast.setView(main); toast.show(); Log.e("ToastUtil", message); } public static void noNetworkToast(Context ctx) { Vibrator vb = (Vibrator) ctx.getSystemService(Context.VIBRATOR_SERVICE); vb.vibrate(50); LayoutInflater inf = (LayoutInflater) ctx .getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout main = (LinearLayout) inf.inflate(R.layout.toast_error, null); TextView msg = (TextView) main.findViewById(R.id.txtTOASTMessage); msg.setText("Network not available. Please check your network settings and your reception signal.\n" + "Please try again."); Toast toast = new Toast(ctx); toast.setGravity(Gravity.CENTER, 0, 0); toast.setDuration(Toast.LENGTH_LONG); toast.setView(main); toast.show(); } public static void serverUnavailable(Context ctx) { Util.showErrorToast(ctx, "Server is not available or reachable at " + "this time. Please try later or contact GhostPractice support."); } public static void memoryUnavailable(Context ctx) { Util.showErrorToast(ctx, "Memory required is not available"); } /* * public static void locationUnavailable(Context ctx,int languageCode) { * Util.showToast(ctx, TX.translate(languageCode, * "GPS coordinates are not available.\nPlease check Location Settings on your phone" * , ctx), Toast.LENGTH_LONG, Gravity.CENTER); } public static void * underConstruction(Context ctx,int languageCode) { LayoutInflater inf = * (LayoutInflater)ctx.getSystemService( Context.LAYOUT_INFLATER_SERVICE); * LinearLayout main = (LinearLayout) inf.inflate(R.layout.toast, null); * ImageView img = (ImageView)main.findViewById(R.id.imgTOASTOK); Drawable d * = ctx.getResources().getDrawable(R.drawable.under_construction); * img.setImageDrawable(d); * * String message = TX.translate(languageCode, * "Sorry, function under construction. Please try later", ctx); TextView * msg = (TextView)main.findViewById(R.id.txtTOASTMessage); * msg.setText(message); * * Toast toast = new Toast(ctx); toast.setGravity(Gravity.CENTER,0,0); * toast.setDuration(Toast.LENGTH_SHORT); toast.setView(main); toast.show(); * } public static void storageProblem(Context ctx,int languageCode) { * LayoutInflater inf = (LayoutInflater)ctx.getSystemService( * Context.LAYOUT_INFLATER_SERVICE); LinearLayout main = (LinearLayout) * inf.inflate(R.layout.toast, null); ImageView img = * (ImageView)main.findViewById(R.id.imgTOASTOK); Drawable d = * ctx.getResources().getDrawable(R.drawable.more); img.setImageDrawable(d); * * String message = TX.translate(languageCode, * "Sorry, You may not have an SD memory card", ctx); TextView msg = * (TextView)main.findViewById(R.id.txtTOASTMessage); msg.setText(message); * * Toast toast = new Toast(ctx); toast.setGravity(Gravity.CENTER,0,0); * toast.setDuration(Toast.LENGTH_SHORT); toast.setView(main); toast.show(); * } public static void cameraProblem(Context ctx,int languageCode) { * LayoutInflater inf = (LayoutInflater)ctx.getSystemService( * Context.LAYOUT_INFLATER_SERVICE); LinearLayout main = (LinearLayout) * inf.inflate(R.layout.toast, null); ImageView img = * (ImageView)main.findViewById(R.id.imgTOASTOK); Drawable d = * ctx.getResources().getDrawable(R.drawable.cam_nikon); * img.setImageDrawable(d); * * String message = TX.translate(languageCode, * "Sorry, Camera problem. Please try later", ctx); TextView msg = * (TextView)main.findViewById(R.id.txtTOASTMessage); msg.setText(message); * * Toast toast = new Toast(ctx); toast.setGravity(Gravity.CENTER,0,0); * toast.setDuration(Toast.LENGTH_SHORT); toast.setView(main); toast.show(); * } public static void imageDownloadProblem(Context ctx,int languageCode) { * LayoutInflater inf = (LayoutInflater)ctx.getSystemService( * Context.LAYOUT_INFLATER_SERVICE); LinearLayout main = (LinearLayout) * inf.inflate(R.layout.toast, null); ImageView img = * (ImageView)main.findViewById(R.id.imgTOASTOK); Drawable d = * ctx.getResources().getDrawable(R.drawable.cam_nikon); * img.setImageDrawable(d); * * String message = TX.translate(languageCode, * "Sorry, unable to download image", ctx); TextView msg = * (TextView)main.findViewById(R.id.txtTOASTMessage); msg.setText(message); * * Toast toast = new Toast(ctx); toast.setGravity(Gravity.CENTER,0,0); * toast.setDuration(Toast.LENGTH_SHORT); toast.setView(main); toast.show(); * } */ }
package behavioralPatterns.commandPattern; /** * @Author:Jack * @Date: 2021/9/9 - 23:26 * @Description: behavioralPatterns.commandPattern * @Version: 1.0 */ public class PageGroup extends Group{ @Override public void add() { } @Override public void find() { } @Override public void delete() { System.out.println("delete a page"); } @Override public void change() { } @Override public void plan() { } }
package com.b2b.credit.manageweb.mapper; import com.b2b.credit.bean.NplmContractAttribute; import tk.mybatis.mapper.common.Mapper; public interface NplmContractAttributeMapper extends Mapper<NplmContractAttribute> { }
package com.tencent.mm.ui; import android.content.DialogInterface; import android.content.Intent; import com.tencent.mm.bg.d; import com.tencent.mm.model.au; import com.tencent.mm.model.c; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.ui.base.s; import com.tencent.mm.ui.j.5; class j$5$1 implements Runnable { final /* synthetic */ DialogInterface tjh; final /* synthetic */ 5 tji; j$5$1(5 5, DialogInterface dialogInterface) { this.tji = 5; this.tjh = dialogInterface; } public final void run() { au.HU(); if (c.isSDCardAvailable()) { Intent intent = new Intent(); intent.putExtra("had_detected_no_sdcard_space", true); d.b(this.tji.tjf.tiY, "clean", ".ui.CleanUI", intent); } else { s.gH(this.tji.tjf.tiY); } this.tjh.dismiss(); h.mEJ.a(282, 1, 1, false); } }
/** * All the interfaces provided by the RMI services implemented * plus the implementation of the server that holds the session. */ package rmi_servers;