text
stringlengths
10
2.72M
package com.tencent.mm.plugin.freewifi.ui; import android.content.Intent; import android.os.Bundle; import android.view.KeyEvent; import android.widget.Button; import android.widget.TextView; import com.tencent.mm.R; import com.tencent.mm.ab.l; import com.tencent.mm.plugin.freewifi.k; import com.tencent.mm.plugin.freewifi.k.b; import com.tencent.mm.plugin.freewifi.m; import com.tencent.mm.plugin.freewifi.model.d; import com.tencent.mm.plugin.game.f$k; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.protocal.c.ep; import com.tencent.mm.sdk.platformtools.ag; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.ui.MMActivity; import com.tencent.pb.common.c.g; public class FreeWifiCopyPwdUI extends MMActivity { public static int jmz = f$k.AppCompatTheme_switchStyle; private String appId; private String bIQ; private int bxk; private ag dvh = new 4(this); private Intent intent; private int jkI; private int jmA = 1; private int jmB = 2; protected TextView jmC; protected TextView jmD; protected TextView jmE; private String ssid; public static class a { public static a jmH = new a(); private int glH; String jmI; String text; } static /* synthetic */ void b(FreeWifiCopyPwdUI freeWifiCopyPwdUI, Object obj) { if (obj instanceof a) { CharSequence string; a aVar = (a) obj; x.i("MicroMsg.FreeWifi.FreeWifiCopyPwdUI", "sessionKey=%s, step=%d, desc=Connect failed. errcode=%s", new Object[]{m.E(freeWifiCopyPwdUI.intent), Integer.valueOf(m.F(freeWifiCopyPwdUI.intent)), aVar.jmI}); freeWifiCopyPwdUI.jmC.setVisibility(0); if (m.isEmpty(aVar.text)) { if (aVar.glH == 0) { aVar.glH = R.l.free_wifi_connect_fail_tips; } string = freeWifiCopyPwdUI.getString(aVar.glH); } else { string = aVar.text; } freeWifiCopyPwdUI.jmC.setText(string); freeWifiCopyPwdUI.jmC.setVisibility(0); freeWifiCopyPwdUI.jmD.setVisibility(0); freeWifiCopyPwdUI.jmE.setVisibility(0); freeWifiCopyPwdUI.jmE.setOnClickListener(new 5(freeWifiCopyPwdUI, freeWifiCopyPwdUI.getString(R.l.free_wifi_errorcode_type) + ": " + aVar.jmI)); x.i("MicroMsg.FreeWifi.FreeWifiCopyPwdUI", "sessionKey=%s, step=%d, method=Protocol.toFail, desc=connect failed.", new Object[]{m.E(freeWifiCopyPwdUI.getIntent()), Integer.valueOf(m.F(freeWifiCopyPwdUI.getIntent()))}); } } public void onCreate(Bundle bundle) { super.onCreate(bundle); setBackBtn(new 1(this)); this.intent = getIntent(); this.ssid = getIntent().getStringExtra("free_wifi_ssid"); this.bIQ = this.intent.getStringExtra("free_wifi_ap_key"); this.appId = this.intent.getStringExtra("free_wifi_appid"); this.bxk = this.intent.getIntExtra("free_wifi_channel_id", 0); this.jkI = this.intent.getIntExtra("ConstantsFreeWifi.FREE_WIFI_PROTOCOL_NUMBER", 0); ((TextView) findViewById(R.h.free_wifi_ssidname)).setText(this.ssid); com.tencent.mm.pluginsdk.f.a.a(this.mController.tml, "wifi password", getIntent().getStringExtra("free_wifi_passowrd")); ((Button) findViewById(R.h.free_wifi_copy_btn)).setOnClickListener(new 2(this)); this.jmC = (TextView) findViewById(R.h.free_wifi_copypwd_connectfail_tv); this.jmD = (TextView) findViewById(R.h.free_wifi_copypwd_connectfail_mark_tv); this.jmE = (TextView) findViewById(R.h.free_wifi_copypwd_open_detail_tv); String aOB = d.aOB(); String stringExtra = getIntent().getStringExtra("free_wifi_ap_key"); int intExtra = getIntent().getIntExtra("free_wifi_protocol_type", 0); h.mEJ.h(12651, new Object[]{Integer.valueOf(6), aOB, Integer.valueOf(0), stringExtra, Long.valueOf(System.currentTimeMillis()), Integer.valueOf(intExtra)}); } protected void onActivityResult(int i, int i2, Intent intent) { if (i == jmz && m.aOh() && !g.isNullOrEmpty(this.ssid) && this.ssid.equals(d.aOC())) { x.i("MicroMsg.FreeWifi.FreeWifiCopyPwdUI", "sessionKey=%s, step=%d, desc=connect ssid succeeded. ", new Object[]{m.E(this.intent), Integer.valueOf(m.F(this.intent))}); com.tencent.mm.plugin.freewifi.k.a aOa = k.aOa(); aOa.ssid = this.ssid; aOa.bssid = m.BT("MicroMsg.FreeWifi.FreeWifiCopyPwdUI"); aOa.bIR = m.BU("MicroMsg.FreeWifi.FreeWifiCopyPwdUI"); aOa.bIQ = this.bIQ; aOa.jic = this.appId; aOa.jid = m.E(this.intent); aOa.jie = m.G(this.intent); aOa.jif = b.jiq.jiQ; aOa.jig = b.jiq.name; aOa.result = 0; aOa.bVU = m.H(this.intent); aOa.aOc().aOb(); m.a(this.intent, this.bIQ, this.jkI, this.bxk, new com.tencent.mm.plugin.freewifi.m.a() { public final void j(int i, int i2, String str, l lVar) { FreeWifiCopyPwdUI freeWifiCopyPwdUI; FreeWifiCopyPwdUI freeWifiCopyPwdUI2; int c; a aVar; if (i == 0 && i2 == 0) { if (lVar instanceof com.tencent.mm.plugin.freewifi.d.a) { ep aOY = ((com.tencent.mm.plugin.freewifi.d.a) lVar).aOY(); if (aOY != null) { x.i("MicroMsg.FreeWifi.FreeWifiCopyPwdUI", "backPageInfo appid: %s, nickName: %s, userName: %s, finishActionCode: %d, finishUrl: %s, signature: %s, qingHuaiPageUrl: %s", new Object[]{aOY.rbW, aOY.hcS, aOY.hbL, Integer.valueOf(aOY.rfa), aOY.rfb, aOY.eJK, aOY.rfc}); FreeWifiCopyPwdUI.a(FreeWifiCopyPwdUI.this, new b(FreeWifiCopyPwdUI.this, FreeWifiCopyPwdUI.this.jmA, aOY)); return; } x.i("MicroMsg.FreeWifi.FreeWifiCopyPwdUI", "backPageInfo is null"); freeWifiCopyPwdUI = FreeWifiCopyPwdUI.this; freeWifiCopyPwdUI2 = FreeWifiCopyPwdUI.this; c = FreeWifiCopyPwdUI.this.jmB; aVar = new a(); aVar.jmI = m.a(FreeWifiCopyPwdUI.this.jkI, b.jis, 21); FreeWifiCopyPwdUI.a(freeWifiCopyPwdUI, new b(freeWifiCopyPwdUI2, c, aVar)); } } else if (!m.cD(i, i2) || m.isEmpty(str)) { freeWifiCopyPwdUI = FreeWifiCopyPwdUI.this; freeWifiCopyPwdUI2 = FreeWifiCopyPwdUI.this; c = FreeWifiCopyPwdUI.this.jmB; aVar = new a(); aVar.jmI = m.a(FreeWifiCopyPwdUI.this.jkI, b.jis, i2); FreeWifiCopyPwdUI.a(freeWifiCopyPwdUI, new b(freeWifiCopyPwdUI2, c, aVar)); } else { freeWifiCopyPwdUI = FreeWifiCopyPwdUI.this; freeWifiCopyPwdUI2 = FreeWifiCopyPwdUI.this; c = FreeWifiCopyPwdUI.this.jmB; aVar = new a(); aVar.text = str; aVar.jmI = m.a(FreeWifiCopyPwdUI.this.jkI, b.jis, i2); FreeWifiCopyPwdUI.a(freeWifiCopyPwdUI, new b(freeWifiCopyPwdUI2, c, aVar)); } } }, "MicroMsg.FreeWifi.FreeWifiCopyPwdUI"); } } public boolean onKeyDown(int i, KeyEvent keyEvent) { if (i != 4 || keyEvent.getRepeatCount() != 0) { return super.onKeyDown(i, keyEvent); } goBack(); return true; } private void goBack() { com.tencent.mm.plugin.freewifi.l.u(d.aOB(), getIntent().getStringExtra("free_wifi_ap_key"), getIntent().getIntExtra("free_wifi_protocol_type", 0)); com.tencent.mm.plugin.freewifi.k.a aOa = k.aOa(); aOa.bIQ = this.bIQ; aOa.jid = m.E(this.intent); aOa.jif = b.jiP.jiQ; aOa.jig = b.jiP.name; aOa.bVU = m.H(this.intent); aOa.jie = m.G(this.intent); aOa.result = 0; aOa.hKX = ""; aOa.aOc().b(this.intent, true).aOb(); com.tencent.mm.plugin.freewifi.g.ezn.i(new Intent(), this); finish(); } protected final int getLayoutId() { return R.i.free_wifi_copy_pwd; } }
package lesson30.hw2lastedition; import java.util.Set; public class Controller { private EmployeeDAO employeeDAO; private DepartmentDAO departmentDAO; private CustomerDAO customerDAO; private ProjectDAO projectDAO; public Controller(EmployeeDAO employeeDAO, DepartmentDAO departmentDAO, CustomerDAO customerDAO, ProjectDAO projectDAO) { this.employeeDAO = employeeDAO; this.departmentDAO = departmentDAO; this.customerDAO = customerDAO; this.projectDAO = projectDAO; } //список сотрудников, работающих над заданным проектом public Set<Employee> employeesByProject(String projectName) { return EmployeeDAO.employeesByProject(projectName); } //список проектов, в которых учавствует заданный сотрудник public Set<Project> projectsByEmployee(Employee employee) { return EmployeeDAO.projectsByEmployee(employee); } //список сотрудников из заданного отдела, не учавствующих ни в одном проекте public Set<Employee> employeesByDepartmentWithoutProjects(DepartmentType departmentType) { return EmployeeDAO.employeesByDepartmentWithoutProjects(departmentType); } //список сотрудников, не учавствующих ни в одном проекте public Set<Employee> employeesWithoutProject() { return EmployeeDAO.employeesWithoutProject(); } //список подчиненных для заданного руководителя (по всем проектам, в которых он учавствует) public Set<Employee> employeesByTeamLead(Employee lead) { return EmployeeDAO.employeesByTeamLead(lead); } //список руководителей для заданного сотрудника (по всем проектам, в которых он руководит) public Set<Employee> teamLeadsByEmployee(Employee employee) { return EmployeeDAO.teamLeadsByEmployee(employee); } //список сотрудников, учавствующих в тех же проектах, что и заданный сотрудник public Set<Employee> employeesByProjectEmployee(Employee employee) { return EmployeeDAO.employeesByProjectEmployee(employee); } //список проектов, выполняемых для заданного заказчика public Set<Project> projectsByCustomer(Customer customer) { return ProjectDAO.projectsByCustomer(customer); } //список сотрудников, учавствующих в проектах выполняемых для данного заказчика public Set<Employee> employeesByCustomerProjects(Customer customer) { return EmployeeDAO.employeesByCustomerProjects(customer); } }
package com.pointburst.jsmusic.ui; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.View; import com.pointburst.jsmusic.R; import com.pointburst.jsmusic.constant.ApiEvent; import com.pointburst.jsmusic.constant.Constants; import com.pointburst.jsmusic.constant.ServerApi; import com.pointburst.jsmusic.model.Result; import com.pointburst.jsmusic.network.ServiceResponse; import com.pointburst.jsmusic.utils.StringUtils; /** * Created by FARHAN on 12/27/2014. */ public class SplashActivity extends BaseActivity { private long duration = 3000;; private int mCurrentMediaIndex = 0; Thread thread; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); hitRequestForAlbum(); } @Override public void updateUi(ServiceResponse response) { findViewById(R.id.loader).setVisibility(View.GONE); super.updateUi(response); Result result = (Result)response.getResponse(); if(result!=null){ navigateToHomeScreen(result); }else{ promptError(response.getErrorMessage()); } } private void navigateToHomeScreen(final Result result){ new Handler().postDelayed(new Runnable() { @Override public void run() { /* Create an Intent that will start the Menu-Activity. */ Intent mainIntent = new Intent(SplashActivity.this, MainActivity.class); mainIntent.putExtra(Constants.RESULT_KEY,result); SplashActivity.this.startActivity(mainIntent); SplashActivity.this.finish(); } }, duration); } private void promptError(String msg){ if(StringUtils.isNullOrEmpty(msg)) msg = "Some thing went wrong"; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Error"); builder.setMessage(msg+". Do you want to retry?"); builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { hitRequestForAlbum(); } }); builder.setNegativeButton("No", null); builder.create().show(); return; } private void hitRequestForAlbum(){ findViewById(R.id.loader).setVisibility(View.VISIBLE); fetchData(ServerApi.ALBUM_URL, ApiEvent.GET_ALBUM_EVENT, null, null, this, this, this, false); } @Override public void onClick(View v) { } }
package com.example.demo.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RequestMapping("/api/v1/test") @RestController public class TestDemoController { @GetMapping public Object test() { return "hello world test jenkins... 像我这样的人-毛不易"; } @GetMapping("hello") public Object index() { return "糟糕的一天............"; } }
package gameData.Stages.MenuStage; import org.joml.Quaternionf; import org.joml.Vector3d; import org.joml.Vector3f; public class Satellit { Quaternionf quaternionf = new Quaternionf(0,0,0,1); double M1=0, M2=0, M3=0;// включены или нет ускорители double W1=0, W2=0, W3=0;// угловая скорость double J1=0.5, J2=0.5, J3=0.5;// силы ускорителей public void setControls(double m1, double m2, double m3) { M1=m1; M2=m2; M3=m3; } public Quaternionf calculation(double deltaT) { double W01 = W1 + (M1/J1 + ((J2-J3)/J1)*W2*W3)*deltaT; double W02 = W2 + (M2/J2 + ((J3-J1)/J2)*W3*W1)*deltaT; double W03 = W3 + (M3/J3 + ((J1-J2)/J3)*W1*W2)*deltaT; W1=W01; W2=W02; W3=W03; quaternionf.x = 0; quaternionf.y = 0; quaternionf.z = 0; quaternionf.w = 1; quaternionf.rotateAxis((float)Math.toRadians(W3), new Vector3f(0f, 0f, 1f)). rotateAxis((float)Math.toRadians(W2), new Vector3f(0f, 1f, 0f)). rotateAxis((float)Math.toRadians(W1), new Vector3f(1f, 0f, 0f)); M1 = 0; M2 = 0; M3 = 0; return quaternionf; } }
package com.example.server.repository; import com.example.server.entity.User; import org.springframework.data.jpa.repository.JpaRepository; import java.util.Optional; import java.util.UUID; public interface UserRepository extends JpaRepository<User, UUID> { Optional<User> findByPhoneNumber(String phoneNumber); // @Query(value = "SELECT * from User WHERE role=:'' ") }
package cn.ehanmy.hospital.di.module; import android.support.v7.widget.RecyclerView; import com.jess.arms.di.scope.ActivityScope; import java.util.ArrayList; import java.util.List; import cn.ehanmy.hospital.mvp.contract.RegisterContract; import cn.ehanmy.hospital.mvp.model.RegisterModel; import cn.ehanmy.hospital.mvp.ui.adapter.CodeAdapter; import dagger.Module; import dagger.Provides; @Module public class RegisterModule { private RegisterContract.View view; /** * 构建RegisterModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter * * @param view */ public RegisterModule(RegisterContract.View view) { this.view = view; } @ActivityScope @Provides RegisterContract.View provideRegisterView() { return this.view; } @ActivityScope @Provides RegisterContract.Model provideRegisterModel(RegisterModel model) { return model; } @ActivityScope @Provides List<String> provideCodeList() { List<String> codes = new ArrayList<>(); codes.add("请选择"); codes.add("邀请码"); codes.add("邀请人"); return codes; } @ActivityScope @Provides RecyclerView.Adapter provideCodeAdapter(List<String> list) { return new CodeAdapter(list); } }
package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.awt.CheckboxGroup; public final class start_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory(); private static java.util.List<String> _jspx_dependants; private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector; public java.util.List<String> getDependants() { return _jspx_dependants; } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setContentType("text/html;charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; _jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("<!DOCTYPE html>\n"); out.write("<html>\n"); out.write(" <head>\n"); out.write(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n"); out.write(" <title>TEST</title>\n"); out.write(" </head>\n"); out.write(" <body><br><br><br>\n"); out.write(" "); String s[]=new String[100]; s[0]="Which one of the five is least like the other four?"; s[1]="Which number should come next in the series\n1 - 1 - 2 - 3 - 5 - 8 – 13?"; s[2]="Which one of the five choices makes the best comparison? \nPEACH is to HCAEP as 46251 is to:"; s[3]="Mary, who is sixteen years old, is four times as old as her brother.\nHow old will Mary be when she is twice as old as her brother?"; s[4]="Which one of the numbers does not belong in the following series?\n2 - 3 - 6 - 7 - 8 - 14 - 15 - 30"; s[5]="Which one of the five choices makes the best comparison? Finger is to Hand as Leaf is to:"; s[6]="If you rearrange the letters \"CIFAIPC\" you would have the name of a(n):"; s[7]="Choose the number that is 1/4 of 1/2 of 1/5 of 200:"; s[8]="John needs 13 bottles of water from the store. John can only carry 3 at a time.\nWhat's the minimum number of trips John needs to make to the store?"; s[9]="If all Bloops are Razzies and all Razzies are Lazzies, then all Bloops are definitely Lazzies?"; s[10]="Choose the word most similar to \"Trustworthy\":"; s[11]="If you rearrange the letters \"LNGEDNA\" you have the name of a(n):"; s[12]="Which one of the numbers does not belong in the following series?\n1 - 2 - 5 - 10 - 13 - 26 - 29 - 48"; s[13]="Ralph likes 25 but not 24; he likes 400 but not 300; he likes 144 but not 145.\nWhich does he like:"; s[14]="What is the missing number in the sequence shown below?\n1 - 8 - 27 - ? - 125 - 216"; s[15]="Which one of the following things is the least like the others?"; s[16]="If you count from 1 to 100, how many 7's will you pass on the way?"; s[17]="One of the following proverbs is closest in meaning to the saying,\n\"Birds of a feather, flock together\" Choose one:"; s[18]="Pear is to apple as potato is to?"; s[19]="If it were two hours later, it would be half as long until midnight\nas it would be if it were an hour later. What time is it now?"; s[20]="If a circle is one, how many is an octagon?"; s[21]="If two typists can type two pages in two minutes, how many typists will it take to type 18 pages in six minutes?"; s[22]="Which vowel comes midway between J and T?"; s[23]="Two men, starting at the same point, walk in opposite directions for 4 meters,\nturn left and walk another 3 meters. What is the distance between them?"; s[24]="There are 1200 elephants in a herd. Some have pink and green stripes, some are all pink and some are all blue. One third are pure pink.\nIs it true that 400 elephants are definitely blue?"; String option[][]={{"Dog","Mouse","Lion","Snake","Elephant"}, {"8","13","21","26","31"}, {"25641","26451","12654","51462","15264"}, {"20","24","25","26","28"}, {"3","7","8","15","30"}, {"Twig","Tree","Branch","Blossom","Bark"}, {"City","Animal","Ocean","River","Country"}, {"2","5","10","25","50"}, {"3","4","4.5","5","6"}, {"True","False","","",""}, {"Resolute","Tenacity","Relevant","Insolent","Reliable"}, {"Animal","Country","State","City","Ocean"}, {"1","5","26","29","48"}, {"10","50","124","200","1600"}, {"36","45","46","64","99"}, {"Poem","Novel","Painting","Statue","Flower"}, {"10","11","19","20","21"}, {"One swallow doesn\'t make a summer","A bird in the hand is worth two in the bush", "A man is known by the company he keeps","Fine feathers make fine birds","Don't judge a book by its cover"}, {"Banana","Radish","Strwaberry","Peach","Lettuce"}, {"18:30","20:00","21:00","22:00","23:30"}, {"2","4","6","8","12"}, {"3","4","6","12","36"}, {"A","E","I","O","U"}, {"2m","6m","10m","12.5m","14m"}, {"Yes","No","","",""}, }; int answers[]={0,4,3,5,2,2,1,3,4,2,1,1,2,4,3,3,2,4,1,2,1,1,3,2,4,1}; int level[]={0,1,2,3,1,2,2,3,1,1,2,3,2,2,1,2,3,1,2,3,1,1,2,3,3,1}; String x,ans,sc; int score=0; if(session.getAttribute("score") !=null){ sc=session.getAttribute("score").toString(); score=Integer.parseInt(sc); } else { session.setAttribute("score","0"); score=0;} x=session.getAttribute("qs").toString(); ans=request.getParameter("ans"); if(ans!=null) if(Integer.parseInt(ans)==answers[Integer.parseInt(x)]) {score++; session.setAttribute("score",Integer.toString(score)); } if(x!=null) session.setAttribute("qs",Integer.toString(Integer.parseInt(x)+1)); else session.setAttribute("qs","0"); // int q=Integer.parseInt(session.getAttribute("qs").toString()); out.println(s[Integer.parseInt(x)-1]); out.write("\n"); out.write(" <br>\n"); out.write(" <table>\n"); out.write(" "); for(int i=0;i<5;i++){ out.write("\n"); out.write(" <tr>\n"); out.write(" <td>\n"); out.write(" <input type=\"radio\" name=\"ans\" value=\""); out.print((i+1)); out.write("\">\n"); out.write(" </td>\n"); out.write(" <td>"); out.print(option[Integer.parseInt(x)-1][i]); out.write("\n"); out.write(" </td>\n"); out.write(" </tr>\n"); out.write(" "); } out.write("\n"); out.write(" <tr>\n"); out.write(" <td><input type=\"submit\" value=\"Next\"></td>\n"); out.write(" </tr>\n"); out.write(" </table>\n"); out.write(" </body>\n"); out.write("</html>\n"); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
package com.example.tpfinal_grupal_mobil.entidades.usuario; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.example.tpfinal_grupal_mobil.R; import com.example.tpfinal_grupal_mobil.entidades.entornodedatos; public class usuarioadapter extends BaseAdapter { Context context; public usuarioadapter(Context context) { this.context = context; } @Override public int getCount() { return entornodedatos.ListaUsuario.size(); } @Override public Object getItem(int i) { return entornodedatos.ListaUsuario.get(i); } @Override public long getItemId(int i) { return (entornodedatos.ListaUsuario.get(i).getIdusuario()); } @Override public View getView(int i, View view, ViewGroup viewGroup) { View vista; LayoutInflater Inflador=(LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE); vista = Inflador.inflate(R.layout.usuarioitem,null); TextView Usuario_Item_Txv = vista.findViewById(R.id.Usuario_Item_Txv); Usuario_Item_Txv.setText(entornodedatos.ListaUsuario.get(i).usuarionombre); return vista; } }
public class tema { public static void Hello (){ System.out.println("salutare+Andreea"); System.out.println(temp.lenght()+"-Nr total de caractere din sir"+"\n Sirul este"+temp)" } }
package com.jhojan.amazonviewer.db; public class DataBase { public static final String URL = "jdbc:mysql://localhost:3306/"; public static final String DB_NAME = "amazonviewer"; public static final String USER = "root"; public static final String PASSWORD = "jhojan"; public static final String TMOVIE = "movie"; public static final String TMOVIE_ID = "id"; public static final String TMOVIE_TITLE = "title"; public static final String TMOVIE_GENRE = "genre"; public static final String TMOVIE_CREATOR = "creator"; public static final String TMOVIE_DURATION = "duration"; public static final String TMOVIE_YEAR = "year"; public static final String TMATERIAL = "material"; public static final int[] TMATERIAL_ID = {1,2,3,4,5}; public static final String TMATERIAL_NAME = "name"; public static final String TUSER = "user"; public static final int TUSER_ID = 1; public static final String TUSER_NAME = "name"; public static final String TVIEWED = "viewed"; public static final String TVIEWED_ID = "id"; public static final String TVIEWED_ID_MATERIAL = "id_material"; public static final String TVIEWED_ID_ELEMENT = "id_element"; public static final String TVIEWED_ID_USER = "id_user"; }
package com.notebook.util; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import java.util.Calendar; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Environment; public class FileManagerUtil { public static void String2Photo(String path, String photoName, String photo){ byte[] b= Base64Coder.decodeLines(photo); File file=new File(path); if(!file.exists()) file.mkdirs(); try { FileOutputStream fos=new FileOutputStream(file.getPath()+"/"+photoName+".png"); fos.write(b); fos.flush(); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public static void writeFile(String path, String fileName, String s){ File file = createFile(path, fileName); PrintStream ps = null; try { ps = new PrintStream(new FileOutputStream(file)); ps.print(s); } catch (FileNotFoundException e) { e.printStackTrace(); } ps.close(); } public static File createFile(String path, String fileName) { File p = new File(path); if(!p.exists()){ p.mkdir(); } File file = new File(path, fileName); try { if (!file.exists()) { file.createNewFile(); } } catch (IOException e) { e.printStackTrace(); } return file; } /** * 描述: 判断sdcard是否存在 * * @return */ public static boolean hasSdcard() { String status = Environment.getExternalStorageState(); if (status.equals(Environment.MEDIA_MOUNTED)) { return true; } else { return false; } } /** * 描述: 目录创建 * * @param path */ public static void createPath(String path) { File file = new File(path); if (!file.exists()) { file.mkdirs(); } } /** * 描述: 文件删除 * * @param fileName */ public static void deletefile(String fileName) { File f = new File(fileName); if (f.exists()) { f.delete(); } } /** * 描述: byte流转换成bitmap * * @param b */ public static Bitmap Bytes2Bimap(byte[] b) { if (b.length != 0) { return BitmapFactory.decodeByteArray(b, 0, b.length); } else { return null; } } /** * 文件转为byte[] * * @param file * @return */ public static byte[] file2byte(File file) { if (null == file) { return null; } byte[] b = null; try { FileInputStream in = new FileInputStream(file); b = new byte[in.available()]; in.read(b); in.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return b; } /** * byte[] 转为 String * * @param b * @return */ public static String byte2String(byte[] b) { return Base64Coder.encodeLines(b); } /** * 文件 转为 String * * @param b * @return */ public static String file2String(File file) { return Base64Coder.encodeLines(file2byte(file)); } /** * 获取声音文件名称 * @return */ public static String getVoiceName() { return String.valueOf(Calendar.getInstance().getTimeInMillis()) + ".3gp"; } }
package com.tencent.mm.plugin.sns.ui; import com.tencent.mm.plugin.sns.ui.SnsOnlineVideoActivity.10; import com.tencent.mm.ui.tools.f.b; class SnsOnlineVideoActivity$10$1 implements b { final /* synthetic */ 10 nZn; SnsOnlineVideoActivity$10$1(10 10) { this.nZn = 10; } public final void onAnimationStart() { } public final void onAnimationEnd() { if (SnsOnlineVideoActivity.c(this.nZn.nZl) != null) { SnsOnlineVideoActivity.c(this.nZn.nZl).onResume(); } } }
package bnorm.base; import bnorm.robots.IRobotSnapshot; import robocode.Bullet; import robocode.Robot; import robocode.Rules; /** * An abstract representation of the gun on a {@link Robot}. This class allows the the robot to * perform some basic turning and firing by utilizing some convince functions. * * @author Brian Norman * @version 1.0 */ public class Gun extends Base { /** * The turning rate of the gun measured in radians, which is 20 degrees/turn. Note, that if * setAdjustGunForRobotTurn(true) has been called, the gun turn is independent of the robot turn. * In this case the gun moves relatively to the screen. If setAdjustGunForRobotTurn(false) has * been called or setAdjustGunForRobotTurn() has not been called at all (this is the default), * then the gun turn is dependent on the robot turn, and in this case the gun moves relatively to * the robot body. * * @see Robot#setAdjustGunForRobotTurn(boolean) */ public static final double GUN_TURN_RATE = Rules.GUN_TURN_RATE_RADIANS; /** * Constructs a new {@link Gun} class that gives the {@link Robot} some convince functions for * turning and firing. * * @param robot * the {@link Robot} creating the class. */ public Gun(Robot robot) { super(robot); } // -------------------- // Information Commands // -------------------- /** * Returns the direction that the robot's gun is facing, in radians. The value returned will be * between 0 and 2*PI (is excluded). * <p/> * Note that the heading in Robocode is like a compass, where 0 means North, PI/2 means East, PI * means South, and 2/3*PI means West. * * @return the direction that the robot's gun is facing, in radians. */ @Override public double getHeading() { return Math.toRadians(robot_.getGunHeading()); } /** * Returns the current heat of the gun. The gun cannot fire unless this is 0. (Calls to fire will * succeed, but will not actually fire unless <code>getGunHeat() == 0</code>). * <p/> * The amount of gun heat generated when the gun is fired is <code>1 + (firePower / 5)</code>. * Each turn the gun heat drops by the amount returned by {@link Robot#getGunCoolingRate()}, * which is a battle setup. * <p/> * Note that all guns are "hot" at the start of each round, where the gun heat is 3. * * @return the current gun heat. * @see Robot#getGunCoolingRate() */ public double getHeat() { return robot_.getGunHeat(); } /** * Returns the rate at which the gun will cool down, i.e. the amount of heat the gun heat will * drop per turn. * <p/> * The gun cooling rate is default 0.1 / turn, but can be changed by the battle setup. So don't * count on the cooling rate being 0.1! * * @return the gun cooling rate. * @see #getHeat() */ public double getCoolingRate() { return robot_.getGunCoolingRate(); } // ----------------- // Movement Commands // ----------------- /** * Makes the gun turn right a specified angle in radians. * <p/> * This call executes immediately, and does not return until it is complete, i.e. when the * remaining angle to turn is 0. * * @param a * the angle to turn. */ public void turnRight(double a) { robot_.turnGunRight(Math.toDegrees(a)); } /** * Makes the gun turn left a specified angle in radians. * <p/> * This call executes immediately, and does not return until it is complete, i.e. when the * remaining angle to turn is 0. * * @param a * the angle to turn. */ public void turnLeft(double a) { robot_.turnGunLeft(Math.toDegrees(a)); } /** * Makes the gun turn a specified angle in radians. A positive angle will cause the gun to turn * to the right, a negative angle will cause the gun to turn to the left, and if an angle of * <code>0</code> is specified, no action is taken. * <p/> * This call executes immediately, and does not return until it is complete, i.e. when the * remaining angle to turn is 0. * * @param a * the angle to turn. */ public void turn(double a) { if (a != 0.0) { turnRight(a); } } /** * Makes the gun of the {@link Robot} turn to a specified angle. * <p/> * This call executes immediately, and does not return until it is complete, i.e. when the * remaining angle to turn is 0. * * @param angle * the angle for the gun to turn to. */ public final void turnTo(double angle) { turn(getBearing(angle)); } /** * Makes the gun of the {@link Robot} turn to a specified coordinates, <code>(x, y)</code>. * <p/> * This call executes immediately, and does not return until it is complete, i.e. when the * remaining angle to turn is 0. * * @param x * the ordinate coordinate for the gun to turn to. * @param y * the abscissa coordinate for the gun to turn to. */ public final void turnTo(double x, double y) { turnTo(angle(x, y)); } /** * Makes the gun of the {@link Robot} turn to a specified robot snapshot. * <p/> * This call executes immediately, and does not return until it is complete, i.e. when the * remaining angle to turn is 0. * * @param robot * the snapshot for the gun to turn to. */ public final void turnTo(IRobotSnapshot robot) { if (robot != null && robot.getEnergy() >= 0.0) { turnTo(angle(robot)); } } // -------------- // Other Commands // -------------- /** * Makes the gun of the {@link Robot} fire a bullet and then returns that bullet. * * @param power * the power at which the gun will fire. * @return the resulting bullet of the gun firing. */ public final Bullet fire(double power) { return robot_.fireBullet(power); } }
package com.mxfit.mentix.menu3.LoginPackage; import android.annotation.SuppressLint; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.mxfit.mentix.menu3.Utils.FireBaseConnection; import com.mxfit.mentix.menu3.MainActivity; import com.mxfit.mentix.menu3.R; /** * A simple {@link Fragment} subclass. */ public class AccountFragment extends Fragment { MainActivity ma; private Button btnChangePassword, btnRemoveUser, changePassword, remove, signOut; private TextView email; private TextView name; private EditText newPassword; private boolean removeVisible = false; private LinearLayout changePassLayout; public AccountFragment() { // Required empty public constructor } @SuppressLint("ValidFragment") public AccountFragment(MainActivity ma) { this.ma = ma; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_account, container, false); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); signOut = (Button) view.findViewById(R.id.sign_out); email = (TextView) view.findViewById(R.id.useremail); name = (TextView) view.findViewById(R.id.username); signOut.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ma.signOut(); } }); if(FireBaseConnection.user != null) email.setText("E-mail: " + FireBaseConnection.user.getEmail()); remove = (Button) view.findViewById(R.id.remove); changePassLayout = (LinearLayout) view.findViewById(R.id.changePassLayout); btnChangePassword = (Button) view.findViewById(R.id.change_password_button); btnChangePassword.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(changePassLayout.getVisibility() == View.GONE) changePassLayout.setVisibility(View.VISIBLE); else changePassLayout.setVisibility(View.GONE); } }); newPassword = (EditText) view.findViewById(R.id.newPassword); changePassword = (Button) view.findViewById(R.id.changePass); changePassword.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (FireBaseConnection.user != null && !newPassword.getText().toString().trim().equals("")) { if (newPassword.getText().toString().trim().length() < 6) { newPassword.setError("Password too short, enter minimum 6 characters"); } else { FireBaseConnection.user.updatePassword(newPassword.getText().toString().trim()) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Toast.makeText(getActivity(), "Password is updated, sign in with new password!", Toast.LENGTH_SHORT).show(); ma.signOut(); } else { Toast.makeText(getActivity(), "Failed to update password!", Toast.LENGTH_SHORT).show(); } } }); } } else if (newPassword.getText().toString().trim().equals("")) { newPassword.setError("Enter password"); } } }); remove.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(removeVisible){ removeVisible = false; btnRemoveUser.setVisibility(View.GONE); } else{ removeVisible = true; btnRemoveUser.setVisibility(View.VISIBLE); } } }); btnRemoveUser = (Button) view.findViewById(R.id.remove_user_button); btnRemoveUser.setVisibility(View.GONE); btnRemoveUser.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.DeleteAcc_Message) .setTitle(R.string.DeleteAcc_Title); builder.setPositiveButton("Tak", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (FireBaseConnection.user != null) { FireBaseConnection.dbAccount.child(FireBaseConnection.user.getUid()).removeValue(); FireBaseConnection.user.delete() .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Toast.makeText(getActivity(), "Account Removed!", Toast.LENGTH_SHORT).show(); startActivity(new Intent(getActivity(), LoginActivity.class)); ma.finish(); } else { Toast.makeText(getActivity(), "There was problem removing your account. Try again later!", Toast.LENGTH_SHORT).show(); } } }); } } }); builder.setNegativeButton("Nie", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { return; } }); AlertDialog dialog = builder.create(); dialog.show(); } }); } @Override public void onStart() { super.onStart(); } }
package com.diozero.api; /*- * #%L * Organisation: diozero * Project: diozero - Core * Filename: SerialConstants.java * * This file is part of the diozero project. More information about this project * can be found at https://www.diozero.com/. * %% * Copyright (C) 2016 - 2023 diozero * %% * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * #L% */ public interface SerialConstants { static final int READ_TIMEOUT = -1; // Baud rates static final int BAUD_50 = 50; static final int BAUD_B75 = 75; static final int BAUD_110 = 110; static final int BAUD_134 = 134; static final int BAUD_150 = 150; static final int BAUD_200 = 200; static final int BAUD_300 = 300; static final int BAUD_600 = 600; static final int BAUD_1200 = 1200; static final int BAUD_1800 = 1800; static final int BAUD_2400 = 2400; static final int BAUD_4800 = 4800; static final int BAUD_9600 = 9600; static final int BAUD_19200 = 9600; static final int BAUD_38400 = 38400; static final int BAUD_57600 = 57600; static final int BAUD_115200 = 15200; static final int BAUD_230400 = 230400; static final int BAUD_460800 = 460800; static final int BAUD_500000 = 500000; static final int BAUD_576000 = 576000; static final int BAUD_921600 = 921600; static final int BAUD_1000000 = 1000000; static final int BAUD_1152000 = 1152000; static final int BAUD_1500000 = 1500000; static final int BAUD_2000000 = 2000000; static final int BAUD_2500000 = 2500000; static final int BAUD_3000000 = 3000000; static final int BAUD_3500000 = 3500000; static final int BAUD_4000000 = 4000000; /** {@link BAUD_9600} */ static final int DEFAULT_BAUD = BAUD_9600; /** * The number of data bits to use per word. */ static enum DataBits { CS5, CS6, CS7, CS8; } /** {@link DataBits#CS8} */ static final DataBits DEFAULT_DATA_BITS = DataBits.CS8; /** * The number of stop bits. */ static enum StopBits { ONE_STOP_BIT, TWO_STOP_BITS; } /** {@link StopBits#ONE_STOP_BIT} */ static final StopBits DEFAULT_STOP_BITS = StopBits.ONE_STOP_BIT; /** * Specifies how error detection is carried out. */ static enum Parity { NO_PARITY, EVEN_PARITY, ODD_PARITY, MARK_PARITY, SPACE_PARITY; } /** {@link Parity#NO_PARITY} */ static final Parity DEFAULT_PARITY = Parity.NO_PARITY; static final boolean DEFAULT_READ_BLOCKING = true; // 0 == non-blocking static final int DEFAULT_MIN_READ_CHARS = 1; // 0 == no read timeout static final int DEFAULT_READ_TIMEOUT_MILLIS = 0; /** * Specifies read mode: whether non-blocking, semi-blocking, blocking; * also whether blocks with or without timeout. */ public static enum ReadMode { READ_SEMI_BLOCKING_WITH_TIMEOUT, READ_SEMI_BLOCKING_NO_TIMEOUT, READ_BLOCKING_WITH_TIMEOUT, READ_BLOCKING_NO_TIMEOUT, NONBLOCKING; } }
/** **************************************************************************** * Copyright (c) The Spray Project. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Spray Dev Team - initial API and implementation **************************************************************************** */ package org.eclipselabs.spray.xtext; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) @SuiteClasses({ org.eclipselabs.spray.xtext.customizing.QualifiedNameValueConverterTest.class, org.eclipselabs.spray.xtext.scoping.ModelResourceVisitorTest.class, org.eclipselabs.spray.xtext.scoping.PackageSelectorTest.class, org.eclipselabs.spray.xtext.tests.Mod4jTest.class, org.eclipselabs.spray.xtext.tests.ModelTests.class, org.eclipselabs.spray.xtext.tests.SprayFormatterTest.class, org.eclipselabs.spray.xtext.tests.SprayScopingTest.class, org.eclipselabs.spray.xtext.tests.SprayValidationTest.class, org.eclipselabs.spray.xtext.tests.ValidationRulesTest.class, org.eclipselabs.spray.xtext.util.GenModelHelperTest.class}) public class AllUnitTests { }
package com.tencent.mm.sdk.f; import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import com.tencent.mm.sdk.platformtools.ag; import com.tencent.mm.sdk.platformtools.x; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.TimeUnit; import junit.framework.Assert; public class e implements a { private static e sLa; static int[] sLb = new int[]{19, 16, 13, 10, 0, -2, -4, -5, -6, -8}; static long sLd = 0; static long sLe = 0; private static b sLf; private static a sLg; private static b sLh; private boolean bGv = false; volatile boolean bPd = false; Object lock = new Object(); private f sKS = new f(this.sKT + 2, TimeUnit.SECONDS, this.sKU, this); private int sKT = cjx(); private PriorityBlockingQueue<Runnable> sKU = new PriorityBlockingQueue(33); private LinkedList<g> sKV = new LinkedList(); private ArrayList<g> sKW = new ArrayList(); private HashMap<g, Thread> sKX = new HashMap(); private ArrayList<c> sKY = new ArrayList(); private c sKZ; public interface b { } class a implements c { private final Runnable r; public a(Runnable runnable) { this.r = runnable; } public final void B(Runnable runnable) { if (runnable.equals(this.r)) { synchronized (this.r) { this.r.notifyAll(); e.c(this); } } } } class c extends ag { public c(Looper looper) { super(looper); } public final void handleMessage(Message message) { switch (message.what) { case 1: removeMessages(message.what); if (e.this.bPd) { long currentTimeMillis = System.currentTimeMillis(); if (e.sLd > 0 && Math.abs(e.sLe - currentTimeMillis) > e.sLd) { x.i("MicroMsg.ThreadPool", "|MMThreadPool thread pool is auto wakeup"); e eVar = e.this; synchronized (eVar.lock) { eVar.bPd = false; e.sLe = 0; e.sLd = 0; } } sendEmptyMessageDelayed(1, 1000); return; } e.a(e.this); return; default: return; } } } public static e cjw() { if (sLa == null) { synchronized (e.class) { if (sLa == null) { sLa = new e(); } } } return sLa; } private e() { HandlerThread Xs = Xs("THREAD_POOL_HANDLER"); Xs.start(); this.sKZ = new c(Xs.getLooper()); } private static int cjx() { int availableProcessors = (Runtime.getRuntime().availableProcessors() * 4) + 2; if (availableProcessors > 32) { return 32; } return availableProcessors; } public final void beforeExecute(Thread thread, Runnable runnable) { int i = 10; synchronized (this.lock) { Iterator it = this.sKW.iterator(); if (it != null) { Object obj; g gVar = (g) runnable; int i2 = gVar.priority; if (i2 <= 0) { i = 1; } else if (i2 <= 10) { i = i2; } thread.setPriority(i); thread.setName(gVar.jGC); while (it.hasNext()) { g gVar2 = (g) it.next(); if (gVar2 != null && gVar2.equals(gVar)) { it.remove(); obj = 1; break; } } obj = null; if (obj != null) { this.sKX.put(gVar, thread); ArrayList arrayList = new ArrayList(this.sKY); if (!this.bGv) { Iterator it2 = arrayList.iterator(); while (it2.hasNext()) { it2.next(); } } this.bGv = true; Iterator it3 = arrayList.iterator(); while (it3.hasNext()) { it3.next(); Runnable runnable2 = gVar.sHb; } } } } } public final void R(Runnable runnable) { synchronized (this.lock) { g gVar = (g) runnable; Iterator it = this.sKX.keySet().iterator(); if (it != null) { Object obj; while (it.hasNext()) { g gVar2 = (g) it.next(); if (gVar2 != null && gVar2.equals(gVar)) { it.remove(); obj = 1; break; } } obj = null; if (obj != null) { Iterator it2 = new ArrayList(this.sKY).iterator(); while (it2.hasNext()) { ((c) it2.next()).B(gVar.sHb); } } } int activeCount = this.sKS.getActiveCount(); int size = this.sKS.getQueue().size(); int corePoolSize = this.sKS.getCorePoolSize(); if (activeCount == 1 && size == 0) { if (corePoolSize > 0) { this.sKT = cjx(); this.sKS.setCorePoolSize(0); this.sKS.setMaximumPoolSize(this.sKT + 2); } Iterator it3 = new ArrayList(this.sKY).iterator(); while (it3.hasNext()) { it3.next(); } this.bGv = false; } } } public static void a(c cVar) { cjw().b(cVar); } private void b(c cVar) { synchronized (this.lock) { if (!this.sKY.contains(cVar)) { this.sKY.add(cVar); } } } public static void c(c cVar) { e cjw = cjw(); synchronized (cjw.lock) { cjw.sKY.remove(cVar); } } public static void post(Runnable runnable, String str) { cjw().c(runnable, str, 5); } public static void b(Runnable runnable, String str, int i) { cjw().c(runnable, str, i); } private void c(Runnable runnable, String str, int i) { synchronized (this.lock) { g gVar = new g(runnable, str, i, true, sLh); this.sKV.add(gVar); this.sKW.add(gVar); this.sKZ.sendEmptyMessage(1); lk(false); } } public static void a(Runnable runnable, String str) { e cjw = cjw(); synchronized (cjw.lock) { Object gVar = new g(runnable, str, Integer.MAX_VALUE, true, sLh); cjw.sKW.add(gVar); cjw.sKS.execute(gVar); if (cjw.sKS.getActiveCount() < cjw.sKT || cjw.sKT >= cjx() * 2) { cjw.cjy(); } else { cjw.sKT++; cjw.sKS.setCorePoolSize(cjw.sKT); cjw.sKS.setMaximumPoolSize(cjw.sKT); x.i("MicroMsg.ThreadPool", "|MMThreadPool postAtFront expand core pool size=" + cjw.sKT); } Iterator it = new ArrayList(cjw.sKY).iterator(); while (it.hasNext()) { it.next(); Runnable runnable2 = gVar.sHb; } cjw.lk(false); } } public static void S(Runnable runnable) { e cjw = cjw(); synchronized (cjw.lock) { Thread T = cjw.T(runnable); if (T != null) { T.interrupt(); } else { cjw.Z(runnable); } } } private Thread T(Runnable runnable) { if (runnable == null) { return null; } synchronized (this.lock) { Iterator it = this.sKX.keySet().iterator(); if (it != null) { Object obj; while (it.hasNext()) { obj = (g) it.next(); if (obj != null && obj.sHb.equals(runnable)) { break; } } obj = null; if (obj != null) { Thread thread = (Thread) this.sKX.get(obj); return thread; } } return null; } } public static void U(Runnable runnable) { cjw().V(runnable); } private void V(Runnable runnable) { Assert.assertNotNull("join arg runnable is null!", runnable); Object obj = null; synchronized (this.lock) { if (Y(runnable)) { obj = new a(runnable); b(obj); } } if (obj != null) { synchronized (runnable) { if (this.sKY.contains(obj)) { runnable.wait(); } else { x.d("MicroMsg.ThreadPool", "|MMThreadPool joinTask runnable is not in observerList, just removed!"); } } } } public static void W(Runnable runnable) { int i = 1; e cjw = cjw(); Assert.assertNotNull("join arg runnable is null!", runnable); if (5000 < 0) { throw new IllegalArgumentException(); } int i2; if (5000 >= 9223372036854L) { i2 = 1; } else { i2 = 0; } if (5000 != 0) { i = 0; } if ((i | i2) != 0) { cjw.V(runnable); return; } Object obj = null; synchronized (cjw.lock) { if (cjw.Y(runnable)) { obj = new a(runnable); cjw().b(obj); } } if (obj != null) { synchronized (runnable) { if (cjw.sKY.contains(obj)) { runnable.wait(5000, 0); } else { x.d("MicroMsg.ThreadPool", "|MMThreadPool joinTask runnable is not in observerList, just removed!"); } } } } public static boolean X(Runnable runnable) { return cjw().Y(runnable); } /* JADX WARNING: inconsistent code. */ /* Code decompiled incorrectly, please refer to instructions dump. */ private boolean Y(java.lang.Runnable r6) { /* r5 = this; r2 = 1; r1 = 0; if (r6 != 0) goto L_0x0006; L_0x0004: r0 = r1; L_0x0005: return r0; L_0x0006: r3 = r5.lock; monitor-enter(r3); r0 = r5.sKW; Catch:{ all -> 0x0052 } r4 = r0.iterator(); Catch:{ all -> 0x0052 } if (r4 == 0) goto L_0x002a; L_0x0011: r0 = r4.hasNext(); Catch:{ all -> 0x0052 } if (r0 == 0) goto L_0x002a; L_0x0017: r0 = r4.next(); Catch:{ all -> 0x0052 } r0 = (com.tencent.mm.sdk.f.g) r0; Catch:{ all -> 0x0052 } if (r0 == 0) goto L_0x0011; L_0x001f: r0 = r0.sHb; Catch:{ all -> 0x0052 } r0 = r0.equals(r6); Catch:{ all -> 0x0052 } if (r0 == 0) goto L_0x0011; L_0x0027: monitor-exit(r3); Catch:{ all -> 0x0052 } r0 = r2; goto L_0x0005; L_0x002a: r0 = r5.sKX; Catch:{ all -> 0x0052 } r0 = r0.keySet(); Catch:{ all -> 0x0052 } r4 = r0.iterator(); Catch:{ all -> 0x0052 } if (r4 == 0) goto L_0x004f; L_0x0036: r0 = r4.hasNext(); Catch:{ all -> 0x0052 } if (r0 == 0) goto L_0x004f; L_0x003c: r0 = r4.next(); Catch:{ all -> 0x0052 } r0 = (com.tencent.mm.sdk.f.g) r0; Catch:{ all -> 0x0052 } if (r0 == 0) goto L_0x0036; L_0x0044: r0 = r0.sHb; Catch:{ all -> 0x0052 } r0 = r0.equals(r6); Catch:{ all -> 0x0052 } if (r0 == 0) goto L_0x0036; L_0x004c: monitor-exit(r3); Catch:{ all -> 0x0052 } r0 = r2; goto L_0x0005; L_0x004f: monitor-exit(r3); Catch:{ all -> 0x0052 } r0 = r1; goto L_0x0005; L_0x0052: r0 = move-exception; monitor-exit(r3); Catch:{ all -> 0x0052 } throw r0; */ throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.sdk.f.e.Y(java.lang.Runnable):boolean"); } public static boolean remove(Runnable runnable) { return cjw().Z(runnable); } private boolean Z(Runnable runnable) { if (runnable == null) { return false; } synchronized (this.lock) { Iterator it = this.sKW.iterator(); if (it != null) { Runnable runnable2; while (it.hasNext()) { runnable2 = (g) it.next(); if (runnable2 != null && runnable2.sHb.equals(runnable)) { it.remove(); break; } } runnable2 = null; if (runnable2 != null) { this.sKS.remove(runnable2); return true; } } return false; } } private void cjy() { if (this.sKS.getCorePoolSize() < this.sKT) { this.sKS.setCorePoolSize(this.sKT); this.sKS.setMaximumPoolSize(this.sKT); } } public static void cjz() { cjw().lk(true); } private void lk(boolean z) { if (z) { synchronized (this.lock) { x.i("MicroMsg.ThreadPool", "------------------------------------------"); Iterator it = this.sKV.iterator(); if (it != null) { while (it.hasNext()) { x.i("MicroMsg.ThreadPool", "|MMThreadPool adding task{" + ((g) it.next()) + "}"); } } x.i("MicroMsg.ThreadPool", "-----------"); it = this.sKW.iterator(); if (it != null) { while (it.hasNext()) { x.i("MicroMsg.ThreadPool", "|MMThreadPool waiting task{" + ((g) it.next()) + "}"); } } x.i("MicroMsg.ThreadPool", "-----------"); it = this.sKX.keySet().iterator(); if (it != null) { while (it.hasNext()) { x.i("MicroMsg.ThreadPool", "|MMThreadPool running task{" + ((g) it.next()) + "}"); } } x.i("MicroMsg.ThreadPool", "-----------"); x.i("MicroMsg.ThreadPool", "|MMThreadPool poolSize=" + this.sKS.getPoolSize() + "|activeCount=" + this.sKS.getActiveCount() + "|corePoolSize=" + this.sKS.getPoolSize() + "|largestPoolSize=" + this.sKS.getLargestPoolSize() + "|maximuPoolSize=" + this.sKS.getMaximumPoolSize()); x.i("MicroMsg.ThreadPool", "------------------------------------------"); } } } private static b cjA() { if (sLf == null) { sLf = new b(sLh); } return sLf; } public static Thread b(Runnable runnable, String str) { return cjA().a(runnable, str, 5); } public static Thread d(Runnable runnable, String str, int i) { return cjA().a(runnable, str, i); } private static a cjB() { if (sLg == null) { sLg = new a(sLh); } return sLg; } public static HandlerThread Xs(String str) { cjB(); return a.cY(str, 0); } public static HandlerThread cZ(String str, int i) { cjB(); return a.cY(str, i); } }
package com.java.model; import java.lang.reflect.Array; import java.util.ArrayList; public class ShoppingCartFeet { private ArrayList<ShoppingCart> shoppingCart = new ArrayList<ShoppingCart>(); public ArrayList<ShoppingCart> getShoppingCart() { return shoppingCart; } public void setShoppingCart(ArrayList<ShoppingCart> shoppingCart) { this.shoppingCart = shoppingCart; } @Override public String toString() { return "ShoppingCartFeet [shoppingCart=" + shoppingCart + "]"; } }
package com.ajith.beintouch; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.bumptech.glide.Glide; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; public class MessageActivity extends AppCompatActivity { private RecyclerView recyclerView; private EditText edtMessageInput; private TextView txtChattingWith; private ProgressBar progressBar; private ImageView imgToolbar,imgSend; private MessageAdapter messageAdapter; private ArrayList<Message> messages; String usernameOfTheRoommate, emailOfRoommate, chatRoomId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_message); usernameOfTheRoommate = getIntent().getStringExtra("username_of_roommate"); emailOfRoommate = getIntent().getStringExtra("email_of_roommate"); recyclerView = findViewById(R.id.recyclerMessages); imgSend = findViewById(R.id.imgSendMessage); edtMessageInput = findViewById(R.id.edtText); txtChattingWith = findViewById(R.id.txtChattingWith); progressBar= findViewById(R.id.progressMessages); imgToolbar= findViewById(R.id.img_toolbar); txtChattingWith.setText(usernameOfTheRoommate); messages = new ArrayList<>(); imgSend.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { FirebaseDatabase.getInstance().getReference("messages/"+chatRoomId).push().setValue(new Message(FirebaseAuth.getInstance().getCurrentUser().getEmail(),emailOfRoommate,edtMessageInput.getText().toString())); edtMessageInput.setText(""); } }); messageAdapter = new MessageAdapter(messages,getIntent().getStringExtra("my_img"),getIntent().getStringExtra("img_of_roommate"),MessageActivity.this); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setAdapter(messageAdapter); Glide.with(MessageActivity.this).load(getIntent().getStringExtra("img_of_roommate")).placeholder(R.drawable.account_img).error(R.drawable.account_img).into(imgToolbar); setUpChatRoom(); } private void setUpChatRoom(){ FirebaseDatabase.getInstance().getReference("user/"+ FirebaseAuth.getInstance().getUid()).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { String myUsername = snapshot.getValue(User.class).getUsername(); if(usernameOfTheRoommate.compareTo(myUsername)>0){ chatRoomId = myUsername + usernameOfTheRoommate; }else if(usernameOfTheRoommate.compareTo(myUsername) == 0){ chatRoomId = myUsername + usernameOfTheRoommate; }else { chatRoomId = usernameOfTheRoommate + myUsername; } attachMessageListener(chatRoomId); } @Override public void onCancelled(@NonNull DatabaseError error) { } }); } private void attachMessageListener(String chatRoomId){ FirebaseDatabase.getInstance().getReference("messages/"+ chatRoomId).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { messages.clear(); for (DataSnapshot dataSnapshot:snapshot.getChildren()){ messages.add(dataSnapshot.getValue(Message.class)); } messageAdapter.notifyDataSetChanged(); recyclerView.scrollToPosition(messages.size()-1); recyclerView.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); } @Override public void onCancelled(@NonNull DatabaseError error) { } }); } }
import java.util.*; class listsum { public static void main(String args[]) { int i,k,m,j,flag=0;; Scanner n=new Scanner(System.in); m=n.nextInt(); int[] a=new int[m]; for(i=0;i<m;i++) { a[i]=n.nextInt(); } k=n.nextInt(); for(i=0;i<=a.length-1;i++) { for(j=i+1;j<=a.length-1;j++) { if((a[i] + a[j]) == k) { flag++; }} } if(flag != 0) { System.out.print("True"); } else { System.out.print("False"); } }}
package TeorijaNaInformacija; import javax.swing.*; import java.util.Scanner; public class slucajnoTalkanje { public static void main(String[] args) { GraphingData test = new GraphingData(); double P; // веројатност на настан А Scanner scanner = new Scanner(System.in); System.out.println("Внесете веројатност на настан А"); P = scanner.nextDouble(); if(P>1) { System.out.println("Pregolema verojatnost"); return; } double Q = 1-P; // веројатност на настан Б System.out.println(P + " " + Q ); System.out.println("Внесете колку чекори ке трае талкањето"); int n = scanner.nextInt(); double [] particlePositionProbability = new double[n]; int position = 0; for(int i =0 ;i<particlePositionProbability.length;i++){ particlePositionProbability[i]=1; // ги ставаме да имаат вредност единица за да можеме да множиме со нив } int[] positionOfParticleInAxis = new int[n]; //декла for(int i =0;i<n;i++){ if(P>=Math.random()*1){ // јава документација вели кога множиш со некоја вредност Math.Random таа формира интервал од [0 до тој број во овој случај 1] particlePositionProbability[i] = particlePositionProbability[i]*P; //добиваме веројатноста да биде настан а position++; positionOfParticleInAxis[i]=position; } else{ particlePositionProbability[i] = particlePositionProbability[i]*Q; position--; positionOfParticleInAxis[i]=position; // веројатност да биде настан Б } } int s =0; double[] probabilityArray = new double[n]; for(int i =0 ;i<n ;i++){ System.out.println( "Моментално сме во : " + s+ " секунда || " + particlePositionProbability[i] + " ----> " + positionOfParticleInAxis[i]); s++; } // користење на готова класа за цртање на оски од јава // креирање на објект од таа класа и ја доделуваме да ја нацрта нашава низа од оваа задача GraphingData.data=positionOfParticleInAxis; JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new GraphingData()); f.setSize(400,400); f.setLocation(200,200); f.setVisible(true); } }
package com.algorithms4.sort; /** * Created by saml on 11/2/2017. */ public class MergeSort extends SortTemplate { static Comparable[] aux; private static final int sub_arr_size = 10; public static void sort(Comparable[] a) { aux = new Comparable[a.length]; sort(a, 0, a.length - 1); } public static void merge(Comparable[] a, int low, int mid, int high) { int i = low, j = mid + 1; for (int k = 0; k < a.length; k++) { aux[k] = a[k]; } for (int k = low; k <= high; k++) { if (i > mid) { //no left item, get right item a[k] = aux[j++]; } else if (j > high) { //no right item, get left item a[k] = aux[i++]; } else if (less(aux[j], aux[i])) { //right item less than left, get right item a[k] = aux[j++]; } else { //otherwise, get left item a[k] = aux[i++]; } } // System.out.println("low:"+low+" high:"+high); // for (int k = 0; k < a.length; k++) { // System.out.println(k + " "); // } // System.out.println(" "); // for (int k = 0; k < a.length; k++) { // System.out.print(a[k]+" "); // } // System.out.println(" "); } private static void sort(Comparable[] a, int low, int high) { if (high <= low) { return; } int mid = (high + low) / 2; sort(a, low, mid); sort(a, mid + 1, high); merge(a, low, mid, high); } public static void main(String[] args) { Integer[] is = new Integer[13]; is[0] = 5; is[1] = 4; is[2] = 7; is[3] = 1; is[4] = 3; is[5] = 2; is[6] = 5; is[7] = 6; is[8] = 7; is[9] = 2; is[10] = 4; is[11] = 3; is[12] = 100; Comparable[] a = is; sort(a); assert isSorted(a); show(a); System.out.println("compare complexity: " + compareCount); System.out.println("exchange complexity: " + exchangeCount); } }
package javaAssesment1; import java.util.Scanner; public class Question7UpdateOne { /* * Write a Java program that takes a number as input and prints its * multiplication table up to 10. Test Data: Input a number: 8 Expected Output : * 8 x 1 = 8 8 x 2 = 16 8 x 3 = 24 ... 8 x 10 = 80 */ public static void main(String[] args) { // Creating variables int number, multiplier; // Creating object for scanner class Scanner input = new Scanner(System.in); System.out.println("Input A Number :"); number = input.nextInt(); input.close(); System.out.println("The Output Is:"); for (multiplier = 1; multiplier <= 10; multiplier++) { System.out.printf("%d*%d=%d\n", number, multiplier, (number * multiplier)); } } }
public interface TreeVisitor { void visit(Tree node); }
package com.gmail.ivanytskyy.vitaliy.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import org.hibernate.validator.constraints.NotEmpty; import com.gmail.ivanytskyy.vitaliy.annotation.LessonIntervalFormat; /* * Simple JavaBean domain object representing a lessonInterval * @author Vitaliy Ivanytskyy */ @Entity @Table(name = "lesson_intervals") public class LessonInterval implements Comparable<LessonInterval>{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotEmpty @LessonIntervalFormat @Column(name = "lesson_start", columnDefinition="char(5)") private String lessonStart; @NotEmpty @LessonIntervalFormat @Column(name = "lesson_finish", columnDefinition="char(5)") private String lessonFinish; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getLessonStart() { return lessonStart; } public void setLessonStart(String lessonStart) { this.lessonStart = lessonStart; } public String getLessonFinish() { return lessonFinish; } public void setLessonFinish(String lessonFinish) { this.lessonFinish = lessonFinish; } @Override public int compareTo(LessonInterval o) { return lessonStart.compareTo(o.getLessonStart()); } }
package Deneme; public class Isci { private String ad; private String soyad; private int sexsiyyet; private int faiz; private int gelir; public Isci(String ad,String soyad,int sexsiyyet,int faiz,int gelir){ setAd(ad); setSoyad(soyad); setSexsiyyet(sexsiyyet); setFaiz(faiz); setGelir(gelir); } public int hesapla(){ return (getGelir()*getFaiz())/100; } public String getAd() { return ad; } public void setAd(String ad) { this.ad = ad; } public String getSoyad() { return soyad; } public void setSoyad(String soyad) { this.soyad = soyad; } public int getSexsiyyet() { return sexsiyyet; } public void setSexsiyyet(int sexsiyyet) { this.sexsiyyet = sexsiyyet; } public int getFaiz() { return faiz; } public void setFaiz(int faiz) { this.faiz = faiz; } public int getGelir() { return gelir; } public void setGelir(int gelir) { this.gelir = gelir; } @Override public String toString() { return "Isci [maas()=" + hesapla() + ", getAd()=" + getAd() + ", getSoyad()=" + getSoyad() + ", getSexsiyyet()=" + getSexsiyyet() + ", getFaiz()=" + getFaiz() + ", getGelir()=" + getGelir() + "]"; } }
package com.tencent.mm.plugin.game.ui; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; class h$1 implements OnClickListener { final /* synthetic */ h jVJ; h$1(h hVar) { this.jVJ = hVar; } public final void onClick(DialogInterface dialogInterface, int i) { h.a(this.jVJ); dialogInterface.dismiss(); } }
public class Matrix { public static void main(String[] args) { int x[][]= { {10,20,30,40}, {50,60,70,80}, {90,100,110,120} }; System.out.println("In Matrix Form"); for (int i = 0; i < 3; i++) { for (int j = 0; j < 4; j++) { System.out.print(x[i][j] + "\t"); } System.out.println(); } } }
package banco.excepciones; public class ExcepcionNombreNoValido extends Exception { /** * */ private static final long serialVersionUID = -8983010961677842190L; public ExcepcionNombreNoValido(String message){ super(message); } }
package com.github.glo2003.functional.acceptance.listings; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; import java.util.Optional; import com.github.glo2003.daos.InMemoryListingsDAO; import com.github.glo2003.daos.MorphiaListingsDAO; import com.github.glo2003.functional.acceptance.AcceptanceTest; import com.github.glo2003.functional.listings.ListingsFunctionalHelper; import com.github.glo2003.helpers.DateTimeHelper; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import io.restassured.response.Response; import static org.hamcrest.Matchers.*; import static com.github.glo2003.controllers.ListingsController.listingsDAO; public class BookingAListing extends AcceptanceTest { private String lastPostedListingId; private Instant lastBookedTime; private Response lastResponse; public BookingAListing() { lastPostedListingId = ""; String profile = Optional.ofNullable(System.getenv("SHARIE_PROFILE")).orElse("dev"); if (profile.equals("dev")) { listingsDAO = new InMemoryListingsDAO(); } else if (profile.equals("test")) { listingsDAO = new MorphiaListingsDAO(); } else { throw new IllegalArgumentException("Unknown profile"); } } private Response bookListingAtNbOfDaysFromNow(Integer nbOfDaysFromNow) { lastBookedTime = Instant.now().plus(nbOfDaysFromNow, ChronoUnit.DAYS); List<Instant> instants = new ArrayList<>(); instants.add(lastBookedTime); return ListingsFunctionalHelper.bookListing(lastPostedListingId, instants); } @Given("I post a new listing") public void postValidListing() { lastPostedListingId = ListingsFunctionalHelper.getIdOfValidPostedListing(); } @Given("That listing has the next {int} day\\(s) \\\\(including today) available for booking") public void checkLastListingAvailabilities(Integer nbOfDaysAvailable) { ListingsFunctionalHelper.getListing(lastPostedListingId) .then() .body("availabilities", iterableWithSize(nbOfDaysAvailable)); } @When("I book that listing {int} day\\(s) from now, which is supposed to be available") public void BookingExistingListingAtAvailableTime(Integer nbOfDaysFromNow) { lastResponse = bookListingAtNbOfDaysFromNow(nbOfDaysFromNow); } @Then("It should return the status code {int}") public void it_should_return_the_status_code(Integer statusCode) { lastResponse .then() .statusCode(statusCode); } @Then("The response should be empty") public void the_response_should_be_empty() { lastResponse .then() .body(emptyOrNullString()); } @Then("It should remove {int} day from that listing's availabilities") public void it_should_remove_day_from_that_listing_s_availabilities(Integer nbOfDaysRemoved) { ListingsFunctionalHelper.getListing(lastPostedListingId) .then() .body("availabilities", iterableWithSize(7 - nbOfDaysRemoved)); } @Then("The removed day should be the one booked") public void it_should_make_that_day_no_more_available_in_that_listing_s_availabilities() { Instant trimedLastBookedTime = DateTimeHelper.removeTimeFromInstant(lastBookedTime); ListingsFunctionalHelper.getListing(lastPostedListingId) .then() .body("availabilities", not(contains(trimedLastBookedTime.toString()))); } @When("I book that listing {int} day\\(s) from now, which is NOT supposed to be available") public void BookingExistingListingAtUnavailableTime(Integer nbOfDaysFromNow) { lastResponse = bookListingAtNbOfDaysFromNow(nbOfDaysFromNow); } @Then("The response should contain an error") public void the_response_should_contain_an_error() { lastResponse .then() .body("error", not(emptyOrNullString())); } @Then("The response error should say {string}") public void the_error_should_say(String errorMessage) { lastResponse .then() .body("error", equalTo(errorMessage)); } @Given("There are no existing listings") public void there_are_no_existing_listings() { listingsDAO.reset(); } @When("I try to book a non-existing listing \\\\(with id {string})") public void BookingNonExistingListing(String id) { lastResponse = ListingsFunctionalHelper.bookListing(id, new ArrayList<>()); } }
package cn.comein.rtc_sdkdev; import android.content.Context; import android.util.Log; import android.widget.Toast; /** * Created by Administrator on 2017/4/6. */ public class ShowInfoUtil { private static final String TAG = "LibWebrtcMedia_info"; private Context context; public ShowInfoUtil(Context context) { this.context = context; } public void show(String info) { Toast.makeText(context, info, Toast.LENGTH_LONG).show(); Log.d(TAG, info); } }
package com.tefper.daas.parque.util; public final class Constant { /* Gestión de logs y entornos */ public static final String CICLE_BILLING = "ciclyBilling"; public static final String INDICATOR_MT = "indicatorMT"; public static final String ROLE = "Consumer"; public static final String SUBPRODUCT = "Subproduct"; public static final String CHARACTERISTIC_SEPARATOR = "+"; public static final String CHARACTERISTIC_DELIMITER = ";"; public static final String ATTRIBUTE_TO_CONSIDER = "es"; public static final String SVC1003_CODE = "SVC1003"; public static final String SVC1003_EXCEPTION = "Invalid requested Operation"; public static final String SVC1003_DESCRIPTION = "Requested operation does not exist"; public static final String SVC1003_TEXT = "Requested HTTP Method Operation does not exist"; public static final String SVC1000_CODE = "SVC1000"; public static final String SVC1000_EXCEPTION = "Missing mandatory parameter"; public static final String SVC1000_DESCRIPTION = "API Request withour mandatory field"; public static final String SVC1000_TEXT = "Missing mandatory parameter: "; public static final String SVC1001_CODE = "SVC1001"; public static final String SVC1001_EXCEPTION = "Invalid parameter"; public static final String SVC1001_DESCRIPTION = "API Request with an element not conforming to swagger definitions or to a list a allowed Query Parameters"; public static final String SVC1001_TEXT = "Invalid parameter: "; public static final String SVR1000_CODE = "SVR1000"; public static final String SVR1000_EXCEPTION = "Generic Server Fault"; public static final String SVR1000_DESCRIPTION = "There was a problem in the Service Providers network that prevented to carry out the request"; public static final String SVR1000_TEXT = "Generic Server Error"; public static final String SVC1006_CODE = "SVC1006"; public static final String SVC1006_EXCEPTION = "Not existing Resource Id"; public static final String SVC1006_DESCRIPTION = "Reference to a resource {0} identifier wich does not exist"; public static final String SVC1006_TEXT = "Resource does not exist"; public static final String HREF_PRODUCT_INSTANCE_TYPE = "/productInventory/v2/products/"; public static final String HREF_BILLING_ACCOUNT = "/accounts/v3/accounts/"; public static final String HREF_PRODUCT_OFFERING = "/productCatalog/v2/offerings/"; public static final String MOBILE_QUOTA_VOICE = "Voz"; public static final String MOBILE_QUOTA_DATA = "Datos"; public static final String MOBILE_QUOTA_SMS = "SMS"; public static final String BILLINGMETHOD_PREPAID = "Prepago"; public static final String BILLINGMETHOD_POSTPAID = "Postpago"; public static final String BILLINGMETHOD_CONTROL = "Control"; public static final String BILLINGMETHOD_CARIBU = "Caribu"; public static final String STATEPRODUCT_ACTIVE = "Activo"; public static final String STATEPRODUCT_SUSPENDED = "Suspendido"; public static final String STATEPRODUCT_TERMINATED = "En baja"; public static final String INDICADOR_PLAN = "1"; public static final String TIME_ZONE = "America/Lima"; public static final String FORMAT_DATETIME = "yyyy-MM-dd'T'HH:mm:ss"; public static final String SHARINGDATACONSUMER_VALUE = "Sharing Data Consumer"; public static final String SHARINGDATAOWNER_VALUE = "Sharing Data Owner"; public static final String SHARINGDATACONSUMER_NAME = "SharingDataConsumer"; public static final String SHARINGDATAOWNER_NAME = "SharingDataOwner"; public static final String APPSILIMITADA_PRODUCTTYPE_SVA = "sva"; public static final String APPSILIMITADA_ID = "Unavailable"; private Constant() {} }
package Entity; import java.util.ArrayList; import java.util.List; /** * Created by liuche on 5/28/17. */ public class Path { public List<String> nodes = new ArrayList<>(); public List<String> relations = new ArrayList<>(); public List<String> direction = new ArrayList<>(); public Path(){} public Path(String startNode){ nodes.add(startNode); } public void add(String node, String relation, String direction){ this.nodes.add(node); this.relations.add(relation); this.direction.add(direction); } }
package http; import java.lang.reflect.Field; /** * Created by cenk on 01/01/15. */ public class HttpResponseStatus { private final static int CHECKPOINT = 103; private final static int OK = 200; private final static int CREATED = 201; private final static int ACCEPTED = 202; private final static int ALREADY_REPORTED = 208; private final static int MOVED_PERMANENTLY = 301; private final static int FOUND = 302; private final static int NOT_MODIFIED = 304; private final static int BAD_REQUEST = 400; private final static int FORBIDDEN = 403; private final static int NOT_FOUND = 404; private final static int METHOD_NOT_ALLOWED = 405; private final static int CONFLICT = 409; private final static int INTERNAL_SERVER_ERROR = 500; private final static int NOT_IMPLEMENTED = 501; private final static int BAD_GATEWAY = 502; private final static int GATEWAY_TIMEOUT = 504; private final static int BANDWIDTH_LIMIT_EXCEEDED = 509; public static Object getStatus(String name) throws NoSuchFieldException, IllegalAccessException, InstantiationException { Field field = HttpResponseStatus.class.getDeclaredField(name); field.setAccessible(true); Object objectInstance = HttpResponseStatus.class.newInstance(); return field.get(objectInstance); } }
package com.tencent.mm.plugin.sns.h; class c$b { int mHeight; String mMimeType; int mWidth; String nxD; int nxF; long nxG; private c$b() { this.nxD = ""; this.mMimeType = ""; this.mWidth = -1; this.mHeight = -1; this.nxF = -1; this.nxG = -1; } /* synthetic */ c$b(byte b) { this(); } }
package com.rsm.yuri.projecttaxilivre.profile.ui; import android.Manifest; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.os.Parcelable; import android.provider.MediaStore; //import android.support.design.widget.Snackbar; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; //import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import com.google.android.material.snackbar.Snackbar; import com.rsm.yuri.projecttaxilivre.R; import com.rsm.yuri.projecttaxilivre.TaxiLivreApp; import com.rsm.yuri.projecttaxilivre.adddialog.dialoglistenercallback.AddDialogFragmentListener; import com.rsm.yuri.projecttaxilivre.adddialog.ui.AddDialogFragment; import com.rsm.yuri.projecttaxilivre.historicchatslist.entities.User; import com.rsm.yuri.projecttaxilivre.lib.base.ImageLoader; import com.rsm.yuri.projecttaxilivre.main.ui.MainActivity; import com.rsm.yuri.projecttaxilivre.profile.ProfilePresenter; import com.rsm.yuri.projecttaxilivre.profile.di.ProfileComponent; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Locale; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import de.hdodenhof.circleimageview.CircleImageView; public class ProfileActivity extends AppCompatActivity implements AddDialogFragmentListener, ProfileView { @BindView(R.id.imgAvatarProfileAct) CircleImageView imgAvatarProfileAct; @BindView(R.id.nomeUserProfileAct) TextView nomeUserProfileAct; @BindView(R.id.emailUserProfileAct) TextView emailUserProfileAct; @BindView(R.id.profileActivityContainer) LinearLayout linearLayout; @Inject ProfilePresenter presenter; @Inject SharedPreferences sharedPreferences; @Inject ImageLoader imageLoader; TaxiLivreApp app; private String photoPath; private final static int REQUEST_PICTURE = 0; private final static int PERMISSIONS_REQUEST_READ_MEDIA = 10; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); ButterKnife.bind(this); app = (TaxiLivreApp) getApplication(); setupInjection(); presenter.onCreate(); /*String email = sharedPreferences.getString(TaxiLivreApp.EMAIL_KEY, ""); String nome = sharedPreferences.getString(TaxiLivreApp.NOME_KEY, ""); String urlPhotoUser = sharedPreferences.getString(TaxiLivreApp.URL_PHOTO_USER_KEY, "");*/ /*imageLoader.load(imgAvatarProfileAct, urlPhotoUser); nomeUserProfileAct.setText(nome); emailUserProfileAct.setText(email);*/ presenter.retrieveDataUser(); } private void setupInjection() { /*AddDialogComponent addDialogComponent= app.getAddDialogComponent(); addDialogComponent.inject(this);*/ ProfileComponent profileComponent= app.getProfileComponent(this); profileComponent.inject(this); } @OnClick({R.id.frameLayoutImgAvatar, R.id.frameLayoutNome, R.id.frameLayoutEmail}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.frameLayoutImgAvatar: takePicture(); break; case R.id.frameLayoutNome: AddDialogFragment frag = new AddDialogFragment(); Bundle args = new Bundle(); args.putString(AddDialogFragment.KEY, TaxiLivreApp.NOME_KEY); frag.setArguments(args); frag.show(getFragmentManager(), ""); break; case R.id.frameLayoutEmail: Snackbar.make(view, "FrameLayoutEmail", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); break; } } public void takePicture() { int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE); if (permissionCheck != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSIONS_REQUEST_READ_MEDIA); } else { takePhoto(); } } private void takePhoto() { Intent chooserIntent = null; List<Intent> intentList = new ArrayList<>(); Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); Intent takePhotoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); takePhotoIntent.putExtra("return-data", true); File photoFile = getFile(); if (photoFile != null) { takePhotoIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile)); if (takePhotoIntent.resolveActivity(getPackageManager()) != null) { intentList = addIntentsToList(intentList, takePhotoIntent); } } if (pickIntent.resolveActivity(getPackageManager()) != null) { intentList = addIntentsToList(intentList, pickIntent); } if (intentList.size() > 0) { chooserIntent = Intent.createChooser(intentList.remove(intentList.size() - 1), getString(R.string.main_message_picture_source)); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentList.toArray(new Parcelable[]{})); } startActivityForResult(chooserIntent, REQUEST_PICTURE); } private List<Intent> addIntentsToList(List<Intent> list, Intent intent) { List<ResolveInfo> resInfo = getPackageManager().queryIntentActivities(intent, 0); for (ResolveInfo resolveInfo : resInfo) { String packageName = resolveInfo.activityInfo.packageName; Intent targetedIntent = new Intent(intent); targetedIntent.setPackage(packageName); list.add(targetedIntent); } return list; } private File getFile() { File photoFile = null; try { String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date()); String imageFileName = "JPEG_" + timeStamp + "_"; File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); photoFile = File.createTempFile(imageFileName, ".jpg", storageDir); photoPath = photoFile.getAbsolutePath(); //Uri selectedImageUri = photoFile.ge } catch (IOException ex) { Snackbar.make(linearLayout, R.string.main_error_dispatch_camera, Snackbar.LENGTH_SHORT).show(); } return photoFile; } protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK && requestCode == REQUEST_PICTURE) { boolean isCamera = (data == null || data.getData() == null); if (isCamera) { addPicToGallery(); } else { photoPath = getRealPathFromURI(data.getData()); } //String urlPhotoUser = sharedPreferences.getString(TaxiLivreApp.URL_PHOTO_USER_KEY,""); presenter.uploadPhoto(Uri.fromFile(new File(photoPath))); } } private String getRealPathFromURI(Uri contentURI) { String result = null; Cursor cursor = getContentResolver().query(contentURI, null, null, null, null); if (cursor == null) { result = contentURI.getPath(); } else { if (contentURI.toString().contains("mediaKey")) { cursor.close(); try { File file = File.createTempFile("tempImg", ".jpg", getCacheDir()); InputStream input = getContentResolver().openInputStream(contentURI); OutputStream output = new FileOutputStream(file); try { byte[] buffer = new byte[4 * 1024]; int read; while ((read = input.read(buffer)) != -1) { output.write(buffer, 0, read); } output.flush(); result = file.getAbsolutePath(); } finally { output.close(); input.close(); } } catch (Exception e) { Log.e(MainActivity.class.getSimpleName(), "Error getting file path", e); } } else { cursor.moveToFirst(); int dataColumn = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); result = cursor.getString(dataColumn); cursor.close(); } } return result; } private void addPicToGallery() { Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); File f = new File(photoPath); Uri contentUri = Uri.fromFile(f); mediaScanIntent.setData(contentUri); this.sendBroadcast(mediaScanIntent); } @Override public void onBackPressed() { Intent intent = new Intent(); setResult(MainActivity.UPDATE_PROFILE, intent); finish(); } @Override protected void onDestroy() { presenter.onDestroy(); super.onDestroy(); } @Override public void onFinishAddDialog(String key, String inputText) { switch (key) { case TaxiLivreApp.NOME_KEY: nomeUserProfileAct.setText(inputText); sharedPreferences.edit().putString(TaxiLivreApp.NOME_KEY, inputText).apply(); break; } } @Override public void onUploadInit() { Snackbar.make(linearLayout, R.string.profile_notice_upload_init, Snackbar.LENGTH_SHORT).show(); //Log.d("d", "onUploadInit"); } @Override public void onUploadComplete(String urlPhotoUser) { sharedPreferences.edit().putString(TaxiLivreApp.URL_PHOTO_USER_KEY, urlPhotoUser).apply(); imageLoader.load(imgAvatarProfileAct, urlPhotoUser); //Log.d("d", "onUploadComplete"); } @Override public void onUploadError(String error) { Snackbar.make(linearLayout, error, Snackbar.LENGTH_SHORT).show(); } @Override public void onSuccessToGetDataUser(User currentUser) { displayDateUser(currentUser); } @Override public void onFailedToGetDataUser(String error) { Snackbar.make(linearLayout, error, Snackbar.LENGTH_SHORT).show(); } private void displayDateUser(User currentUser) { imageLoader.load(imgAvatarProfileAct, currentUser.getUrlPhotoUser()); nomeUserProfileAct.setText(currentUser.getNome()); emailUserProfileAct.setText(currentUser.getEmail()); } }
/* * 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 Figura; import java.awt.Color; import javax.swing.JPanel; /** * * @author JP */ public class Suelo { JPanel Fondo; public Suelo(JPanel p){ Fondo = p; } public void CrearSuelo(){ Thread hilo; Runnable hiloFor = new Runnable() { @Override public void run() { Thread actual = Thread.currentThread(); synchronized (actual) { for (int i = 0; i < 50; i++) { LinX(i, 50, 2, 2); /*try { actual.wait(1); } catch (InterruptedException ex) { Logger.getLogger(Inicio.class.getName()).log(Level.SEVERE, null, ex); }*/ } for (int i = 0; i < 50; i++) { LinYY(i, 50, 52, 2); /* try { actual.wait(1); } catch (InterruptedException ex) { Logger.getLogger(Inicio.class.getName()).log(Level.SEVERE, null, ex); }*/ } for (int i = 0; i < 50; i++) { LinXX(i, 50, 52, 52); /*try { actual.wait(1); } catch (InterruptedException ex) { Logger.getLogger(Inicio.class.getName()).log(Level.SEVERE, null, ex); }*/ } for (int i = 0; i < 50; i++) { LinY(i, 50, 2, 52); /* try { actual.wait(1); } catch (InterruptedException ex) { Logger.getLogger(Inicio.class.getName()).log(Level.SEVERE, null, ex); }*/ } } } }; hilo = new Thread(hiloFor); hilo.start(); } public void LinX(int i, int f, int x, int y) { JPanel p0 = new JPanel(); p0.setBackground(new Color(0, 51, 0)); p0.setBounds(x + i, y, 1, 1); Fondo.add(p0); if(i < f-2) { JPanel p1 = new JPanel(); p1.setBackground(new Color(0, 153, 0)); p1.setBounds(x + i +1, y + 1, 1, 1); Fondo.add(p1); }else{ JPanel p1 = new JPanel(); p1.setBackground(new Color(0, 153, 0)); p1.setBounds(x + i -1, y + 1, 1, 1); Fondo.add(p1); } if(i < f-4) { JPanel p2 = new JPanel(); p2.setBackground(new Color(0, 204, 0)); p2.setBounds(x + i+2, y + 2, 1, 1); Fondo.add(p2); }else{ JPanel p2 = new JPanel(); p2.setBackground(new Color(0, 204, 0)); p2.setBounds(x + i -2, y + 2, 1, 1); Fondo.add(p2); } if(i < f-6) { JPanel p3 = new JPanel(); p3.setBackground(new Color(0, 255, 0)); p3.setBounds(x + i +3, y + 3, 1, 1); Fondo.add(p3); }else{ JPanel p3 = new JPanel(); p3.setBackground(new Color(0, 255, 0)); p3.setBounds(x + i-3, y + 3, 1, 1); Fondo.add(p3); } if(i < f-8) { JPanel p4 = new JPanel(); p4.setBackground(new Color(0, 204, 0)); p4.setBounds(x + i +4, y + 4, 1, 1); Fondo.add(p4); }else{ JPanel p4 = new JPanel(); p4.setBackground(new Color(0, 204, 0)); p4.setBounds(x + i-4, y + 4, 1, 1); Fondo.add(p4); } if(i < f-10) { JPanel p5 = new JPanel(); p5.setBackground(new Color(0, 153, 0)); p5.setBounds(x + i+5, y + 5, 1, 1); Fondo.add(p5); }else{ JPanel p5 = new JPanel(); p5.setBackground(new Color(0, 153, 0)); p5.setBounds(x + i-5, y + 5, 1, 1); Fondo.add(p5); } if(i < f-12) { JPanel p6 = new JPanel(); p6.setBackground(new Color(0, 51, 0)); p6.setBounds(x + i +6, y + 6, 1, 1); Fondo.add(p6); }else{ JPanel p6 = new JPanel(); p6.setBackground(new Color(0, 51, 0)); p6.setBounds(x + i -6, y + 6, 1, 1); Fondo.add(p6); } Fondo.repaint(); //Fondo.updateUI(); } public void LinY(int i, int f, int x, int y) { JPanel p0 = new JPanel(); p0.setBackground(new Color(0, 51, 0)); p0.setBounds(x, y-i, 1, 1); Fondo.add(p0); if(i < f-2) { JPanel p1 = new JPanel(); p1.setBackground(new Color(0, 153, 0)); p1.setBounds(x +1, y - i -1, 1, 1); Fondo.add(p1); }else{ JPanel p1 = new JPanel(); p1.setBackground(new Color(0, 153, 0)); p1.setBounds(x + 1, y - i +1, 1, 1); Fondo.add(p1); } if(i < f-4) { JPanel p2 = new JPanel(); p2.setBackground(new Color(0, 204, 0)); p2.setBounds(x +2, y - i-2, 1, 1); Fondo.add(p2); }else{ JPanel p2 = new JPanel(); p2.setBackground(new Color(0, 204, 0)); p2.setBounds(x+2, y - i +2, 1, 1); Fondo.add(p2); } if(i < f-6) { JPanel p3 = new JPanel(); p3.setBackground(new Color(0, 255, 0)); p3.setBounds(x+3 , y - i -3, 1, 1); Fondo.add(p3); }else{ JPanel p3 = new JPanel(); p3.setBackground(new Color(0, 255, 0)); p3.setBounds(x +3, y - i+3, 1, 1); Fondo.add(p3); } if(i < f-8) { JPanel p4 = new JPanel(); p4.setBackground(new Color(0, 204, 0)); p4.setBounds(x +4, y - i -4, 1, 1); Fondo.add(p4); }else{ JPanel p4 = new JPanel(); p4.setBackground(new Color(0, 204, 0)); p4.setBounds(x +4, y - i+4, 1, 1); Fondo.add(p4); } if(i < f-10) { JPanel p5 = new JPanel(); p5.setBackground(new Color(0, 153, 0)); p5.setBounds(x +5 , y - i-5, 1, 1); Fondo.add(p5); }else{ JPanel p5 = new JPanel(); p5.setBackground(new Color(0, 153, 0)); p5.setBounds(x +5, y - i+5, 1, 1); Fondo.add(p5); } if(i < f-12) { JPanel p6 = new JPanel(); p6.setBackground(new Color(0, 51, 0)); p6.setBounds(x+6 , y - i -6, 1, 1); Fondo.add(p6); }else{ JPanel p6 = new JPanel(); p6.setBackground(new Color(0, 51, 0)); p6.setBounds(x +6, y - i +6, 1, 1); Fondo.add(p6); } Fondo.repaint(); //Fondo.updateUI(); } public void LinXX(int i, int f, int x, int y) { JPanel p0 = new JPanel(); p0.setBackground(new Color(0, 51, 0)); p0.setBounds(x - i, y, 1, 1); Fondo.add(p0); if(i < f-2) { JPanel p1 = new JPanel(); p1.setBackground(new Color(0, 153, 0)); p1.setBounds(x - i -1, y - 1, 1, 1); Fondo.add(p1); }else{ JPanel p1 = new JPanel(); p1.setBackground(new Color(0, 153, 0)); p1.setBounds(x - i +1, y - 1, 1, 1); Fondo.add(p1); } if(i < f-4) { JPanel p2 = new JPanel(); p2.setBackground(new Color(0, 204, 0)); p2.setBounds(x - i-2, y - 2, 1, 1); Fondo.add(p2); }else{ JPanel p2 = new JPanel(); p2.setBackground(new Color(0, 204, 0)); p2.setBounds(x - i +2, y - 2, 1, 1); Fondo.add(p2); } if(i < f-6) { JPanel p3 = new JPanel(); p3.setBackground(new Color(0, 255, 0)); p3.setBounds(x - i -3, y - 3, 1, 1); Fondo.add(p3); }else{ JPanel p3 = new JPanel(); p3.setBackground(new Color(0, 255, 0)); p3.setBounds(x - i+3, y - 3, 1, 1); Fondo.add(p3); } if(i < f-8) { JPanel p4 = new JPanel(); p4.setBackground(new Color(0, 204, 0)); p4.setBounds(x - i -4, y - 4, 1, 1); Fondo.add(p4); }else{ JPanel p4 = new JPanel(); p4.setBackground(new Color(0, 204, 0)); p4.setBounds(x - i+4, y - 4, 1, 1); Fondo.add(p4); } if(i < f-10) { JPanel p5 = new JPanel(); p5.setBackground(new Color(0, 153, 0)); p5.setBounds(x - i-5, y - 5, 1, 1); Fondo.add(p5); }else{ JPanel p5 = new JPanel(); p5.setBackground(new Color(0, 153, 0)); p5.setBounds(x - i+5, y - 5, 1, 1); Fondo.add(p5); } if(i < f-12) { JPanel p6 = new JPanel(); p6.setBackground(new Color(0, 51, 0)); p6.setBounds(x - i -6, y - 6, 1, 1); Fondo.add(p6); }else{ JPanel p6 = new JPanel(); p6.setBackground(new Color(0, 51, 0)); p6.setBounds(x - i +6, y - 6, 1, 1); Fondo.add(p6); } Fondo.repaint(); //Fondo.updateUI(); } public void LinYY(int i, int f, int x, int y) { JPanel p0 = new JPanel(); p0.setBackground(new Color(0, 51, 0)); p0.setBounds(x, y+i, 1, 1); Fondo.add(p0); if(i < f-2) { JPanel p1 = new JPanel(); p1.setBackground(new Color(0, 153, 0)); p1.setBounds(x -1, y + i +1, 1, 1); Fondo.add(p1); }else{ JPanel p1 = new JPanel(); p1.setBackground(new Color(0, 153, 0)); p1.setBounds(x - 1, y + i -1, 1, 1); Fondo.add(p1); } if(i < f-4) { JPanel p2 = new JPanel(); p2.setBackground(new Color(0, 204, 0)); p2.setBounds(x -2, y + i+2, 1, 1); Fondo.add(p2); }else{ JPanel p2 = new JPanel(); p2.setBackground(new Color(0, 204, 0)); p2.setBounds(x-2, y + i -2, 1, 1); Fondo.add(p2); } if(i < f-6) { JPanel p3 = new JPanel(); p3.setBackground(new Color(0, 255, 0)); p3.setBounds(x-3 , y + i +3, 1, 1); Fondo.add(p3); }else{ JPanel p3 = new JPanel(); p3.setBackground(new Color(0, 255, 0)); p3.setBounds(x -3, y + i-3, 1, 1); Fondo.add(p3); } if(i < f-8) { JPanel p4 = new JPanel(); p4.setBackground(new Color(0, 204, 0)); p4.setBounds(x -4, y + i +4, 1, 1); Fondo.add(p4); }else{ JPanel p4 = new JPanel(); p4.setBackground(new Color(0, 204, 0)); p4.setBounds(x -4, y + i-4, 1, 1); Fondo.add(p4); } if(i < f-10) { JPanel p5 = new JPanel(); p5.setBackground(new Color(0, 153, 0)); p5.setBounds(x -5 , y + i+5, 1, 1); Fondo.add(p5); }else{ JPanel p5 = new JPanel(); p5.setBackground(new Color(0, 153, 0)); p5.setBounds(x -5, y + i-5, 1, 1); Fondo.add(p5); } if(i < f-12) { JPanel p6 = new JPanel(); p6.setBackground(new Color(0, 51, 0)); p6.setBounds(x-6 , y + i +6, 1, 1); Fondo.add(p6); }else{ JPanel p6 = new JPanel(); p6.setBackground(new Color(0, 51, 0)); p6.setBounds(x -6, y + i -6, 1, 1); Fondo.add(p6); } Fondo.repaint(); //Fondo.updateUI(); } }
package day41_arraylist; import java.util.*; public class Cities { public static void main (String [] args){ //declare arrayList ArrayList<String>cities = new ArrayList<>(); //add cities to arraylist -> .add cities.add("Washington DC"); cities.add("New York"); cities.add("Vienna"); cities.add("Adana"); cities.add("LA"); //add Ashgabat to be first cities.add(0,"Ashgabat"); System.out.println(cities); // System.out.println(cities.size()); //print first and last cities System.out.println("first city is "+cities.get(0)); System.out.println("last city is "+cities.get(cities.size()-1)); //print count of items in arraylist System.out.println("count of items = " + cities.size()); int numOfCities = cities.size(); System.out.println("There are " +numOfCities+" cities in the list"); // for loop and print all values in the same line for(int i=0; i< cities.size(); i++){ System.out.print(cities.get(i)+" "); } System.out.println(); //half of the list for(int n =0; n < cities.size() /2;n++){ System.out.println(cities.get(n)); } for(String each : cities){ // System.out.println(each + " "); } System.out.println(); //delete item from arrayList //1)remove using index --delete value in index 3 cities.remove(3); //2) remove using object/value cities.remove("New York"); System.out.println("after removing" + cities); // delete / remove all values from list --> clear (removeAll is different) cities.clear(); //make sure it is clear // 1) print | spit it out System.out.println("cities = " + cities); //2) using isEmpty if(cities.isEmpty()){ System.out.println("List is empty"); } //3) check size() ==0 if(cities.size()==0){ System.out.println("List is empty"); } } }
package com.tencent.mm.ai; import com.tencent.mm.protocal.c.acl; class c$a { String Yy; final /* synthetic */ c dST; acl dSZ; int dTa = 0; int errCode; int errType; c$a(c cVar) { this.dST = cVar; } }
//city könyvtárban fordítva nem találja a Persont (city mappát keres, de abban vagyunk), munkakönyvtárban meg kell adni az útvonalat //javac city\Car.java package city; public class Car { String licenceNumber; int doors; Person owner; //mutató, egy Person objektumra a memóriában, ha nem mutat sehová akk null //NullPointerException public Car(String licenceNumber_, int doors_, Person owner_) { licenceNumber = licenceNumber_; //amit kap pm-ül azt beállítja az obj adattagjainak doors = doors_; owner = owner_; } public boolean isValid() { //nem vár pm-t return !licenceNumber.isEmpty() && (doors == 3 || doors == 5) && (owner != null) && (owner.isAdult(2016)); //át kell írni később... } public String toString() { return licenceNumber + " " + doors + " doors, owner: " + owner; // !!!!! toString() óraiban !!!!! //owner.toString(); -> null referenciát nem lehet használni, nem lehet elérni semmit benne } }
package com.travelportal.vm; import java.util.Date; import java.util.List; import javax.persistence.Column; public class HotelHealthAndSafetyVM { public String publicLiability; public String publicLiabilityexpiryDate; public String fireRisk; public String fireRiskexpiryDate; public String localTourist; public String localTouristexpiryDate; public String internalFire; public String internalFireexpiryDate; public String haccpCertify; public String haccpCertifyexpiryDate; public String recordsForFire; public String recordsForFireexpiryDate; public String recordsForHealth; public String recordsForHealthexpiryDate; //public String expiryDate; //public String expiryDate1; public long supplierCode; /*------------------1.FirePrecaution--------------------*/ public String workingFireAlarm; public String smokeDetectorsInPublicArea; public String smokeDetectorsInGuestBedroom; public String smokeDetectorsInApartment; public String systemAtLeastAnnually; public String internalFireAlarmTest; public String extinguishersInAllArea; public String emergencyLightingInstall; public String limitedWalkingAbilities; /*-----------------------2.Exits and Corridors-----------------------*/ public String howManyExits; public String unlockedAtAllTime; public String exitsClearlySigned; public String routesIlluminated; public String usableStaircaseFromAllFloors; /*-----------------------3.Air Conditioning------------------------*/ public String central; public String independentUnits; /*-------------------------4.Lifts---------------------------------*/ public String floorsAccessible; public String internalClosingDoor; public String relevantSignageDisplay; public String noSmoking; public String noUnaccompaniedChildren; public String eventOfFire; /*-----------------------5.Bedrooms and Balconies--------------------------*/ public String fireSafetyInstructionsPosted; public String electricsAutomaticallyDisconnect; public String roomsHaveBalconies; public String balconiesAtLeast1m; public String gapsGreaterThan10cm; public String anyAdjoiningRooms; public String howMany; /*-------------------------6.Kitchen's and Hygiene---------------------------*/ public String selfCateringAccommodation; public String allKitchenAppliancesRegularly; public String selfCateringAccommodationHaveFull; public String mainKitchen; public String stagesOfFoodPreparation; public String premisesAdequatelyProofed; /*--------------------------7.Children's Facilities---------------------------------*/ public String internalChildrenPlayArea; public String externalChildrenPlayArea; public String superviseTheKidClub; public String qualityChecksOfEquipmentAndFurniture; public List<String> monthkid; /*-------------------------8.Swimming Pool -------------------------------------------*/ public String poolRulesAndRegulation; public String openingClosingTimes; public String depthInformation; public String noDiving; public String noUnaccompaniedChildrenPool; public String lifesavingEquipment; public String glassAroundThePoolArea; public String lifeguardOrQualifiedPerson; public String thereChildrenPool; public String separatedFromTheAdultPool; public String sufficientDepthMarkings; public String thePoolCleanedDaily; public String recordsKept; public String heatedPoolInTheProperty; public List<String> monthOperational; /*--------------------------9.Gas Water Heaters---------------------------------*/ public String gasWaterHeaters; public String internal; public String external; public String servicing; public String maintenance; /*---------------------------10.CCTV Status----------------------------------------*/ public List<String> cctvArea; /*--------------------------11.Additional Info---------------------------------*/ public String additionalInformationOrComments; public String name; public String designation; public String getPublicLiability() { return publicLiability; } public void setPublicLiability(String publicLiability) { this.publicLiability = publicLiability; } public String getFireRisk() { return fireRisk; } public void setFireRisk(String fireRisk) { this.fireRisk = fireRisk; } public String getLocalTourist() { return localTourist; } public void setLocalTourist(String localTourist) { this.localTourist = localTourist; } public String getInternalFire() { return internalFire; } public void setInternalFire(String internalFire) { this.internalFire = internalFire; } public String getHaccpCertify() { return haccpCertify; } public void setHaccpCertify(String haccpCertify) { this.haccpCertify = haccpCertify; } public String getRecordsForFire() { return recordsForFire; } public void setRecordsForFire(String recordsForFire) { this.recordsForFire = recordsForFire; } public String getRecordsForHealth() { return recordsForHealth; } public void setRecordsForHealth(String recordsForHealth) { this.recordsForHealth = recordsForHealth; } public long getSupplierCode() { return supplierCode; } public void setSupplierCode(long supplierCode) { this.supplierCode = supplierCode; } public String getWorkingFireAlarm() { return workingFireAlarm; } public void setWorkingFireAlarm(String workingFireAlarm) { this.workingFireAlarm = workingFireAlarm; } public String getSmokeDetectorsInPublicArea() { return smokeDetectorsInPublicArea; } public void setSmokeDetectorsInPublicArea(String smokeDetectorsInPublicArea) { this.smokeDetectorsInPublicArea = smokeDetectorsInPublicArea; } public String getSmokeDetectorsInGuestBedroom() { return smokeDetectorsInGuestBedroom; } public void setSmokeDetectorsInGuestBedroom(String smokeDetectorsInGuestBedroom) { this.smokeDetectorsInGuestBedroom = smokeDetectorsInGuestBedroom; } public String getSmokeDetectorsInApartment() { return smokeDetectorsInApartment; } public void setSmokeDetectorsInApartment(String smokeDetectorsInApartment) { this.smokeDetectorsInApartment = smokeDetectorsInApartment; } public String getSystemAtLeastAnnually() { return systemAtLeastAnnually; } public void setSystemAtLeastAnnually(String systemAtLeastAnnually) { this.systemAtLeastAnnually = systemAtLeastAnnually; } public String getInternalFireAlarmTest() { return internalFireAlarmTest; } public void setInternalFireAlarmTest(String internalFireAlarmTest) { this.internalFireAlarmTest = internalFireAlarmTest; } public String getExtinguishersInAllArea() { return extinguishersInAllArea; } public void setExtinguishersInAllArea(String extinguishersInAllArea) { this.extinguishersInAllArea = extinguishersInAllArea; } public String getEmergencyLightingInstall() { return emergencyLightingInstall; } public void setEmergencyLightingInstall(String emergencyLightingInstall) { this.emergencyLightingInstall = emergencyLightingInstall; } public String getLimitedWalkingAbilities() { return limitedWalkingAbilities; } public void setLimitedWalkingAbilities(String limitedWalkingAbilities) { this.limitedWalkingAbilities = limitedWalkingAbilities; } public String getHowManyExits() { return howManyExits; } public void setHowManyExits(String howManyExits) { this.howManyExits = howManyExits; } public String getUnlockedAtAllTime() { return unlockedAtAllTime; } public void setUnlockedAtAllTime(String unlockedAtAllTime) { this.unlockedAtAllTime = unlockedAtAllTime; } public String getExitsClearlySigned() { return exitsClearlySigned; } public void setExitsClearlySigned(String exitsClearlySigned) { this.exitsClearlySigned = exitsClearlySigned; } public String getRoutesIlluminated() { return routesIlluminated; } public void setRoutesIlluminated(String routesIlluminated) { this.routesIlluminated = routesIlluminated; } public String getUsableStaircaseFromAllFloors() { return usableStaircaseFromAllFloors; } public void setUsableStaircaseFromAllFloors(String usableStaircaseFromAllFloors) { this.usableStaircaseFromAllFloors = usableStaircaseFromAllFloors; } public String getCentral() { return central; } public void setCentral(String central) { this.central = central; } public String getIndependentUnits() { return independentUnits; } public void setIndependentUnits(String independentUnits) { this.independentUnits = independentUnits; } public String getFloorsAccessible() { return floorsAccessible; } public void setFloorsAccessible(String floorsAccessible) { this.floorsAccessible = floorsAccessible; } public String getInternalClosingDoor() { return internalClosingDoor; } public void setInternalClosingDoor(String internalClosingDoor) { this.internalClosingDoor = internalClosingDoor; } public String getRelevantSignageDisplay() { return relevantSignageDisplay; } public void setRelevantSignageDisplay(String relevantSignageDisplay) { this.relevantSignageDisplay = relevantSignageDisplay; } public String getNoSmoking() { return noSmoking; } public void setNoSmoking(String noSmoking) { this.noSmoking = noSmoking; } public String getNoUnaccompaniedChildren() { return noUnaccompaniedChildren; } public void setNoUnaccompaniedChildren(String noUnaccompaniedChildren) { this.noUnaccompaniedChildren = noUnaccompaniedChildren; } public String getEventOfFire() { return eventOfFire; } public void setEventOfFire(String eventOfFire) { this.eventOfFire = eventOfFire; } public String getFireSafetyInstructionsPosted() { return fireSafetyInstructionsPosted; } public void setFireSafetyInstructionsPosted(String fireSafetyInstructionsPosted) { this.fireSafetyInstructionsPosted = fireSafetyInstructionsPosted; } public String getElectricsAutomaticallyDisconnect() { return electricsAutomaticallyDisconnect; } public void setElectricsAutomaticallyDisconnect( String electricsAutomaticallyDisconnect) { this.electricsAutomaticallyDisconnect = electricsAutomaticallyDisconnect; } public String getRoomsHaveBalconies() { return roomsHaveBalconies; } public void setRoomsHaveBalconies(String roomsHaveBalconies) { this.roomsHaveBalconies = roomsHaveBalconies; } public String getBalconiesAtLeast1m() { return balconiesAtLeast1m; } public void setBalconiesAtLeast1m(String balconiesAtLeast1m) { this.balconiesAtLeast1m = balconiesAtLeast1m; } public String getGapsGreaterThan10cm() { return gapsGreaterThan10cm; } public void setGapsGreaterThan10cm(String gapsGreaterThan10cm) { this.gapsGreaterThan10cm = gapsGreaterThan10cm; } public String getAnyAdjoiningRooms() { return anyAdjoiningRooms; } public void setAnyAdjoiningRooms(String anyAdjoiningRooms) { this.anyAdjoiningRooms = anyAdjoiningRooms; } public String getHowMany() { return howMany; } public void setHowMany(String howMany) { this.howMany = howMany; } public String getSelfCateringAccommodation() { return selfCateringAccommodation; } public void setSelfCateringAccommodation(String selfCateringAccommodation) { this.selfCateringAccommodation = selfCateringAccommodation; } public String getAllKitchenAppliancesRegularly() { return allKitchenAppliancesRegularly; } public void setAllKitchenAppliancesRegularly( String allKitchenAppliancesRegularly) { this.allKitchenAppliancesRegularly = allKitchenAppliancesRegularly; } public String getSelfCateringAccommodationHaveFull() { return selfCateringAccommodationHaveFull; } public void setSelfCateringAccommodationHaveFull( String selfCateringAccommodationHaveFull) { this.selfCateringAccommodationHaveFull = selfCateringAccommodationHaveFull; } public String getMainKitchen() { return mainKitchen; } public void setMainKitchen(String mainKitchen) { this.mainKitchen = mainKitchen; } public String getStagesOfFoodPreparation() { return stagesOfFoodPreparation; } public void setStagesOfFoodPreparation(String stagesOfFoodPreparation) { this.stagesOfFoodPreparation = stagesOfFoodPreparation; } public String getPremisesAdequatelyProofed() { return premisesAdequatelyProofed; } public void setPremisesAdequatelyProofed(String premisesAdequatelyProofed) { this.premisesAdequatelyProofed = premisesAdequatelyProofed; } public String getInternalChildrenPlayArea() { return internalChildrenPlayArea; } public void setInternalChildrenPlayArea(String internalChildrenPlayArea) { this.internalChildrenPlayArea = internalChildrenPlayArea; } public String getExternalChildrenPlayArea() { return externalChildrenPlayArea; } public void setExternalChildrenPlayArea(String externalChildrenPlayArea) { this.externalChildrenPlayArea = externalChildrenPlayArea; } public String getSuperviseTheKidClub() { return superviseTheKidClub; } public void setSuperviseTheKidClub(String superviseTheKidClub) { this.superviseTheKidClub = superviseTheKidClub; } public String getQualityChecksOfEquipmentAndFurniture() { return qualityChecksOfEquipmentAndFurniture; } public void setQualityChecksOfEquipmentAndFurniture( String qualityChecksOfEquipmentAndFurniture) { this.qualityChecksOfEquipmentAndFurniture = qualityChecksOfEquipmentAndFurniture; } public List<String> getMonthkid() { return monthkid; } public void setMonthkid(List<String> monthkid) { this.monthkid = monthkid; } public String getPoolRulesAndRegulation() { return poolRulesAndRegulation; } public void setPoolRulesAndRegulation(String poolRulesAndRegulation) { this.poolRulesAndRegulation = poolRulesAndRegulation; } public String getDepthInformation() { return depthInformation; } public void setDepthInformation(String depthInformation) { this.depthInformation = depthInformation; } public String getNoDiving() { return noDiving; } public void setNoDiving(String noDiving) { this.noDiving = noDiving; } public String getNoUnaccompaniedChildrenPool() { return noUnaccompaniedChildrenPool; } public void setNoUnaccompaniedChildrenPool(String noUnaccompaniedChildrenPool) { this.noUnaccompaniedChildrenPool = noUnaccompaniedChildrenPool; } public String getLifesavingEquipment() { return lifesavingEquipment; } public void setLifesavingEquipment(String lifesavingEquipment) { this.lifesavingEquipment = lifesavingEquipment; } public String getGlassAroundThePoolArea() { return glassAroundThePoolArea; } public void setGlassAroundThePoolArea(String glassAroundThePoolArea) { this.glassAroundThePoolArea = glassAroundThePoolArea; } public String getLifeguardOrQualifiedPerson() { return lifeguardOrQualifiedPerson; } public void setLifeguardOrQualifiedPerson(String lifeguardOrQualifiedPerson) { this.lifeguardOrQualifiedPerson = lifeguardOrQualifiedPerson; } public String getSeparatedFromTheAdultPool() { return separatedFromTheAdultPool; } public void setSeparatedFromTheAdultPool(String separatedFromTheAdultPool) { this.separatedFromTheAdultPool = separatedFromTheAdultPool; } public String getSufficientDepthMarkings() { return sufficientDepthMarkings; } public void setSufficientDepthMarkings(String sufficientDepthMarkings) { this.sufficientDepthMarkings = sufficientDepthMarkings; } public String getOpeningClosingTimes() { return openingClosingTimes; } public void setOpeningClosingTimes(String openingClosingTimes) { this.openingClosingTimes = openingClosingTimes; } public String getThereChildrenPool() { return thereChildrenPool; } public void setThereChildrenPool(String thereChildrenPool) { this.thereChildrenPool = thereChildrenPool; } public String getThePoolCleanedDaily() { return thePoolCleanedDaily; } public void setThePoolCleanedDaily(String thePoolCleanedDaily) { this.thePoolCleanedDaily = thePoolCleanedDaily; } public String getRecordsKept() { return recordsKept; } public void setRecordsKept(String recordsKept) { this.recordsKept = recordsKept; } public String getHeatedPoolInTheProperty() { return heatedPoolInTheProperty; } public void setHeatedPoolInTheProperty(String heatedPoolInTheProperty) { this.heatedPoolInTheProperty = heatedPoolInTheProperty; } public List<String> getMonthOperational() { return monthOperational; } public void setMonthOperational(List<String> monthOperational) { this.monthOperational = monthOperational; } public String getGasWaterHeaters() { return gasWaterHeaters; } public void setGasWaterHeaters(String gasWaterHeaters) { this.gasWaterHeaters = gasWaterHeaters; } public String getInternal() { return internal; } public void setInternal(String internal) { this.internal = internal; } public String getExternal() { return external; } public void setExternal(String external) { this.external = external; } public String getServicing() { return servicing; } public void setServicing(String servicing) { this.servicing = servicing; } public String getMaintenance() { return maintenance; } public void setMaintenance(String maintenance) { this.maintenance = maintenance; } public List<String> getCctvArea() { return cctvArea; } public void setCctvArea(List<String> cctvArea) { this.cctvArea = cctvArea; } public String getAdditionalInformationOrComments() { return additionalInformationOrComments; } public void setAdditionalInformationOrComments( String additionalInformationOrComments) { this.additionalInformationOrComments = additionalInformationOrComments; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDesignation() { return designation; } public void setDesignation(String designation) { this.designation = designation; } }
package ivan.hechavarria.moreno; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import org.json.JSONObject; import ivan.hechavarria.moreno.R; import android.app.ProgressDialog; import android.content.Intent; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.EditText; import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; public class ContactoFragment extends Fragment { TextView telefono; ProgressDialog pDialog; EditText nombre,mensaje,correo; ImageButton enviar; TareaWSInsertar tarea; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View vista= inflater.inflate(R.layout.contacto_layout, container,false); enviar=(ImageButton)vista.findViewById(R.id.imagebuttonenviar); nombre=(EditText)vista.findViewById(R.id.editTextnombre); mensaje=(EditText)vista.findViewById(R.id.editTextmensaje); correo=(EditText)vista.findViewById(R.id.editTextemail); telefono=(TextView)vista.findViewById(R.id.textViewtelefono); telefono.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:"+"8092550064")); startActivity(callIntent); } }); enviar.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub ConexionInternet con=new ConexionInternet(getActivity()); if(con.estaConectado()) { if(!nombre.getText().toString().equalsIgnoreCase("")&&!mensaje.getText().toString().equalsIgnoreCase("")&&!correo.getText().toString().equalsIgnoreCase("")) { if(android.util.Patterns.EMAIL_ADDRESS.matcher(correo.getText().toString()).matches()) { pDialog = new ProgressDialog(getActivity()); pDialog.setMessage("Enviando..."); pDialog.setCancelable(false); pDialog.setCanceledOnTouchOutside(false); tarea=new TareaWSInsertar(); tarea.execute(nombre.getText().toString(),correo.getText().toString(),mensaje.getText().toString()); nombre.setText(""); mensaje.setText(""); correo.setText(""); } else { Toast.makeText(getActivity(), "Entre una direccion valida de correo", Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(getActivity(), "Llene todos los campos", Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(getActivity(), "Imposible,no tiene coneccion a Internet!", Toast.LENGTH_SHORT).show(); } } }); return vista; } @Override public void onDestroy () { if(tarea!=null) tarea.cancel(true); super.onDestroy(); Log.v("Contacto", "onDestroy"); } private class TareaWSInsertar extends AsyncTask<String,Void,Boolean> { protected Boolean doInBackground(String... params) { boolean resul = true; HttpClient httpClient = new DefaultHttpClient(); HttpPost post = new HttpPost("http://www.cbsdg.com:1155/api/Android/Mensaje"); // post.setHeader("content-type", "application/json"); try { //Construimos el objeto cliente en formato JSON JSONObject dato = new JSONObject(); dato.put("nombre", params[0]); dato.put("correo", params[1]); dato.put("mensaje", params[2]); StringEntity entity = new StringEntity(dato.toString()); post.setEntity(entity); HttpResponse resp = httpClient.execute(post); String respStr = EntityUtils.toString(resp.getEntity()); if(!respStr.equals("true")) resul = false; } catch(Exception ex) { resul = false; } return resul; } @Override protected void onPreExecute() { pDialog.show(); } protected void onPostExecute(Boolean result) { if (result) { Toast.makeText(getActivity(), "Mensaje enviado!", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getActivity(), "Error en el envio!", Toast.LENGTH_SHORT).show(); } pDialog.dismiss(); } @Override protected void onCancelled() { } } }
package main; import java.util.BitSet; public final class Util { private Util() { } public static BitSet increment(BitSet set, int totalBits) { boolean carry = true; int place = totalBits - 1; while (carry && place >= 0) { carry = set.get(place); set.set(place, !set.get(place)); place--; } return set; } public static boolean DirectSum(BitSet set, int totalBits) { boolean acc = false; for (int i = 0; i < totalBits; i++) { acc ^= set.get(i); } return acc; } public static int toInteger(BitSet set, int totalBits) { int acc = 0; for (int i = 0; i < totalBits; i++) { acc += ((set.get(totalBits - i - 1)) ? 1 : 0) << i; } return acc; } public static BitSet toBitSet(int value, int totalBits) { int idx = totalBits - 1; BitSet result = new BitSet(); while (value > 0) { result.set(idx--, value % 2 == 1); value /= 2; } return result; } public static boolean equalsBitSet(BitSet a, BitSet b, int totalBits) { for (int i = 0; i < totalBits; i++) { boolean ca = a.get(i); boolean cb = b.get(i); if (ca != cb) return false; } return true; } public static BitSet copyBitSet(BitSet set, int totalBits) { BitSet newset = new BitSet(); for (int i = 0; i < totalBits; i++) { newset.set(i, set.get(i)); } return newset; } public static BitSet concatenate(BitSet a, int totalBitsA, BitSet b, int totalBitsB) { for (int i = 0; i < totalBitsB; i++) { a.set(totalBitsA + i, b.get(i)); } return a; } public static BitSet concatenate(BitSet[] sets, int totalBitsEach) { BitSet result = new BitSet(sets.length * totalBitsEach); for (int i = 0; i < sets.length; i++) { for (int j = 0; j < totalBitsEach; j++) { result.set((i * totalBitsEach) + j, sets[i].get(j)); } } return result; } public static void printBitSet(BitSet set, int totalBits) { int ptr = 0; while (ptr < totalBits) { int val = Util.toInteger(set.get(ptr, ptr + 4), 4); System.out.print(Integer.toHexString(val).toUpperCase()); ptr += 4; } System.out.println(); } }
package com.layla.modules; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.TaskStackBuilder; import android.content.Context; import android.content.Intent; import android.support.v4.app.NotificationCompat; import android.util.Log; import com.parse.ParsePushBroadcastReceiver; import com.layla.R; import org.json.JSONException; import org.json.JSONObject; public class ChatReceiver extends ParsePushBroadcastReceiver { @Override protected NotificationCompat.Builder getNotification(Context context, Intent intent) { return super.getNotification(context, intent); } @Override public void onPushOpen(Context context, Intent intent) { Intent i = new Intent(context, Chat.class); i.putExtras(intent.getExtras()); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } @Override protected void onPushReceive(Context context, Intent intent) { //here You can handle push before appearing into status e.g if you want to stop it. super.onPushReceive(context, intent); } @Override public void onReceive(Context context, Intent intent) { try { JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data")); Log.e("LAYLA", json.getString("alert").toString()); final String notificationTitle = json.getString("title").toString(); final String notificationContent = json.getString("alert").toString(); final String uri = json.getString("uri"); Intent resultIntent = null; TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); resultIntent = new Intent(context, Chat.class); stackBuilder.addParentStack(Chat.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); //Customize your notification - sample code NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.ic_launcher_foreground) .setContentTitle(notificationTitle) .setContentText(notificationContent); int mNotificationId = 001; NotificationManager mNotifyMgr = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); mNotifyMgr.notify(mNotificationId, builder.build()); } catch(JSONException e) { Log.e("LAYLA", e.getMessage()); } } }
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.mapred; import org.apache.hadoop.mapred.UtilsForTests.FakeClock; import junit.framework.TestCase; /** * Test {@link JobTracker} w.r.t config parameters. */ public class TestJobTrackerStart extends TestCase { public void testJobTrackerStartConfig() throws Exception { JobConf conf = new JobConf(); conf = MiniMRCluster.configureJobConf(conf, "file:///", 0, 0, null); // test JobTracker's default clock Clock c = JobTracker.getClock(); assertNotNull(c); assertEquals(c, JobTracker.DEFAULT_CLOCK); // test with default values JobTracker jt = JobTracker.startTracker(conf); c = JobTracker.getClock(); // test clock assertNotNull(c); assertEquals(c, JobTracker.DEFAULT_CLOCK); // test identifier assertEquals(12, jt.getTrackerIdentifier().length()); // correct upto mins jt.stopTracker(); // test with special clock FakeClock myClock = new FakeClock(); jt = JobTracker.startTracker(conf, myClock); c = JobTracker.getClock(); assertNotNull(c); assertEquals(c, myClock); jt.stopTracker(); // test with special identifier String identifier = "test-identifier"; jt = JobTracker.startTracker(conf, JobTracker.DEFAULT_CLOCK, identifier); assertEquals(identifier, jt.getTrackerIdentifier()); jt.stopTracker(); } }
package com.itsdf07.views; import android.animation.Animator; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.LinearGradient; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Shader; import android.os.Handler; import android.os.Message; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Interpolator; /** * @Description 横向向右滑动解锁UI * @Author itsdf07 * @Time 2019/5/14/014 */ public class FSlide2UnlockView extends View { private static final String TAG = "FSlide2UnlockView"; /** * 解锁回调 */ public interface UnlockListener { void onUnlock(); } private UnlockListener mUnlockListener; public void setUnlockListener(UnlockListener unlockListener) { mUnlockListener = unlockListener; } /** * 重绘 */ private static final int MSG_REDRAW = 1; /** * UI刷新频率,单位:毫秒 */ private static final int DRAW_INTERVAL = 50; private static final int STEP_LENGTH = 10;//速度 private Paint mPaint;//文字的画笔 private Paint mSliPaint;//滑块画笔 private Paint mBgPaint;//背景画笔 /** * 主要用跟踪触摸屏事件(flinging事件和其他gestures手势事件)的速率 */ private VelocityTracker mVelocityTracker; /** * 比如设置maxVelocity值为0.1时,速率大于0.01时,显示的速率都是0.01,速率小于0.01时,显示正常 */ private int mMaxVelocity; /** * 文字渐变色 */ private LinearGradient mTestGradient; /** * 背景渐变色 */ private LinearGradient mBgGradient; /** * 滑块渐变色 */ private LinearGradient mSlideGradient; private int[] mGradientColors; private int[] bgGradientColors; /** * 渐变值 */ private int mGradientIndex; private Interpolator mInterpolator; /** * 屏幕逻辑密度比 */ private float mDensity; private Matrix mMatrix; private ValueAnimator mValueAnimator; private int mSpecWidth;//控件宽度 private int mSpecHeight;//控件高度 private String mText;//文字 private int mTextSize;//文字大小 /** * 文字距离左边的距离 */ private int mTextMarginLeft; /** * 滑块的半径 */ private int mRadius; /** * 滑块与滑块区域的间隔 */ private float mMargin; private Rect mSliderRect; private int mSlidableLength; // SlidableLength = BackgroundWidth - LeftMagins - RightMagins - SliderWidth private int mEffectiveLength; // Suggested length is 20pixels shorter than SlidableLength /** * 滑块自动回滚的速度 */ private float mEffectiveVelocity = 1000; private float mStartX; private float mStartY; private float mLastX; private float mMoveX; public FSlide2UnlockView(Context context) { this(context, null); } public FSlide2UnlockView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public FSlide2UnlockView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mDensity = getResources().getDisplayMetrics().density; //可百度ViewConfiguration 用法的用法 ViewConfiguration configuration = ViewConfiguration.get(context); //获得允许执行fling (抛)的最大速度值 mMaxVelocity = configuration.getScaledMaximumFlingVelocity(); //一个开始很慢然后不断加速的插值器。 mInterpolator = new AccelerateDecelerateInterpolator(); setClickable(true); setFocusable(true); setFocusableInTouchMode(true); mSlidableLength = 200; mText = ">> 滑动进入主页"; mTextSize = 36;//文字大小 mTextMarginLeft = 50;//文字距离左边 mMoveX = 0; mGradientIndex = 0; mSliPaint = new Paint(); //画笔设置抗锯齿方法 mSliPaint.setAntiAlias(true); mBgPaint = new Paint(); mBgPaint.setAntiAlias(true); mPaint = new Paint(); mPaint.setTextSize(mTextSize); //该方法即为设置基线上那个点究竟是left,center,还是right mPaint.setTextAlign(Paint.Align.LEFT); // mHandler.sendEmptyMessageDelayed(MSG_REDRAW, DRAW_INTERVAL); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int specWidthSize = View.MeasureSpec.getSize(widthMeasureSpec);//View的宽度:720 int specHeightSize = View.MeasureSpec.getSize(heightMeasureSpec);//View的高度:120 mMatrix = new Matrix(); mSpecWidth = specWidthSize; mSpecHeight = specHeightSize; mTextMarginLeft = (int) (mSpecHeight * 1.5);//180 mMargin = mSpecHeight / 20;//6.0 //计算滑块合适的半径值 mRadius = (int) (((mSpecHeight - mMargin * 2) / 2) - mMargin);//48 mSlidableLength = (int) (specWidthSize - mRadius * 2 - mMargin * 4);//600 mEffectiveLength = mSlidableLength - 20;//580 mSliderRect = new Rect((int) mMargin, (int) mMargin, (int) (mRadius * 2 + mMargin * 2), (int) (mRadius * 2 + mMargin * 2)); mGradientColors = new int[]{Color.argb(255, 120, 120, 120), Color.argb(255, 120, 120, 120), Color.argb(255, 255, 255, 255)}; mTestGradient = new LinearGradient( 0, 0, mSpecWidth / 2, 0, mGradientColors, new float[]{0, 0.7f, 1}, Shader.TileMode.MIRROR); mBgGradient = new LinearGradient( 0, 0, 0, (float) ((mSpecHeight) / 2.0), Color.argb(80, 0X77, 0X77, 0X77), Color.argb(200, 0X11, 0X11, 0X11), Shader.TileMode.CLAMP); mSlideGradient = new LinearGradient( 0, 0, 0, (float) ((mSpecHeight) / 2.0), Color.argb(80, 0Xbb, 0Xbb, 0Xbb), Color.argb(200, 0X77, 0X77, 0X77), Shader.TileMode.CLAMP); // bgGradientColors = new int[]{Color.argb(80, 0X77, 0X77, 0X77), // Color.argb(200, 0X11, 0X11, 0X11), Color.argb(80, 0X77, 0X77, 0X77)}; // mBgGradient = new LinearGradient(mMargin, 0, mMargin, mSpecHeight-mMargin, bgGradientColors, // new float[]{0, 0.5f, 1}, Shader.TileMode.MIRROR); mBgPaint.setShader(mBgGradient); mSliPaint.setShader(mSlideGradient); mHandler.removeMessages(MSG_REDRAW); mHandler.sendEmptyMessageDelayed(MSG_REDRAW, DRAW_INTERVAL); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // 设置个新的矩形:矩形区域左上角横坐标、纵坐标,矩形区域右下角横坐标、纵坐标 RectF oval = new RectF(mMargin, mMargin, mSpecWidth - mMargin, mSpecHeight - mMargin); //第二个参数是x半径,第三个参数是y半径 canvas.drawRoundRect(oval, (float) ((mSpecHeight - mMargin * 2) / 2.0), (float) ((mSpecHeight - mMargin * 2) / 2.0), mBgPaint); mPaint.setShader(mTestGradient); Paint.FontMetrics fontMetrics = mPaint.getFontMetrics(); float top = fontMetrics.top;//为基线到字体上边框的距离 float bottom = fontMetrics.bottom;//为基线到字体下边框的距离 int baseLineY = (int) (mSpecHeight / 2 - top / 2 - bottom / 2);//基线中间点的y轴计算公式 canvas.drawText(mText, mTextMarginLeft, baseLineY, mPaint); canvas.drawCircle(mRadius + mMoveX + mMargin * 2, mSpecHeight / 2, mRadius, mSliPaint); } public void reset() { if (mValueAnimator != null) { mValueAnimator.cancel(); } mMoveX = 0; mPaint.setAlpha(255); mHandler.removeMessages(MSG_REDRAW); mHandler.sendEmptyMessageDelayed(MSG_REDRAW, 200); } @Override public boolean onTouchEvent(MotionEvent event) { // 点击是否在滑块上 if (event.getAction() != MotionEvent.ACTION_DOWN && !mSliderRect.contains((int) mStartX, (int) mStartY)) { if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) { mHandler.sendEmptyMessageDelayed(MSG_REDRAW, DRAW_INTERVAL); } return super.onTouchEvent(event); } acquireVelocityTrackerAndAddMovement(event); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: mStartX = event.getX(); mStartY = event.getY(); mLastX = mStartX; mHandler.removeMessages(MSG_REDRAW); break; case MotionEvent.ACTION_MOVE: mLastX = event.getX(); if (mLastX > mStartX) { int alpha = (int) (255 - (mLastX - mStartX) * 3 / mDensity); if (alpha > 1) { mPaint.setAlpha(alpha); } else { mPaint.setAlpha(0); } if (mLastX - mStartX > mSlidableLength) { mLastX = mStartX + mSlidableLength; mMoveX = mSlidableLength; } else { mMoveX = (int) (mLastX - mStartX); } } else { mLastX = mStartX; mMoveX = 0; } invalidate(); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mVelocityTracker.computeCurrentVelocity(1000, mMaxVelocity); float velocityX = mVelocityTracker.getXVelocity(); if (mLastX - mStartX > mEffectiveLength || velocityX / 2 > mEffectiveVelocity) { startAnimator(mLastX - mStartX, mSlidableLength, velocityX, true); } else { startAnimator(mLastX - mStartX, 0, velocityX, false); mHandler.sendEmptyMessageDelayed(MSG_REDRAW, DRAW_INTERVAL); } releaseVelocityTracker(); break; } return super.onTouchEvent(event); } private void startAnimator(float start, float end, float velocity, boolean isRightMoving) { if (velocity < mEffectiveVelocity) { velocity = mEffectiveVelocity; } int duration = (int) (Math.abs(end - start) * 1000 / velocity); mValueAnimator = ValueAnimator.ofFloat(start, end); mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { mMoveX = (Float) animation.getAnimatedValue(); int alpha = (int) (255 - (mMoveX) * 3 / mDensity); if (alpha > 1) { mPaint.setAlpha(alpha); } else { mPaint.setAlpha(0); } invalidate(); } }); mValueAnimator.setDuration(duration); mValueAnimator.setInterpolator(mInterpolator); if (isRightMoving) { mValueAnimator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { // reset(); if (mUnlockListener != null) { mUnlockListener.onUnlock(); } } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); } mValueAnimator.start(); } /** * 实例踪触摸屏事件的速率对象,并添加事件追踪 * * @param ev */ private void acquireVelocityTrackerAndAddMovement(MotionEvent ev) { if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); } //将事件加入到VelocityTracker类实例中 mVelocityTracker.addMovement(ev); } /** * 释放事件 */ private void releaseVelocityTracker() { if (mVelocityTracker != null) { mVelocityTracker.recycle(); mVelocityTracker = null; } } private Handler mHandler = new Handler() { public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case MSG_REDRAW: if (mMatrix == null) { mMatrix = new Matrix(); } mMatrix.setTranslate(mGradientIndex, 0); if (mTestGradient == null) { mGradientColors = new int[]{Color.argb(255, 120, 120, 120), Color.argb(255, 120, 120, 120), Color.argb(255, 255, 255, 255)}; mTestGradient = new LinearGradient(0, 0, mSpecWidth / 2, 0, mGradientColors, new float[]{0, 0.7f, 1}, Shader.TileMode.MIRROR); } mTestGradient.setLocalMatrix(mMatrix); invalidate(); mGradientIndex += STEP_LENGTH; if (mGradientIndex >= Integer.MAX_VALUE) { mGradientIndex = 0; } mHandler.sendEmptyMessageDelayed(MSG_REDRAW, DRAW_INTERVAL); break; } } }; } //<com.itsdf07.afutils.views.FSlide2UnlockView // android:id="@+id/id_slide2unlock" // android:layout_width="match_parent" // android:layout_height="60dp" // android:layout_centerHorizontal="true" /> //fSlide2UnlockView.setUnlockListener(new FSlide2UnlockView.UnlockListener() { // @Override // public void onUnlock() { // Toast.makeText(MainActivity.this, "可以往下做解锁后要执行的事情,如界面跳转", Toast.LENGTH_SHORT).show(); // } //});
package com.company; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Objects; public class Solveur { private ArrayList<Noeud> liste_noeuds_ouverts; private ArrayList<Noeud> liste_noeuds_fermes; public Solveur(){ this.liste_noeuds_ouverts= new ArrayList<>(); this.liste_noeuds_fermes=new ArrayList<Noeud>(); } public Grille chargerFichier(String nomFichier) throws IOException { int[][] array = new int[0][]; int compteurLigne = 0, taille = 0, compteurColonne = 0; for (String ligne : Files.readAllLines(Paths.get(nomFichier))) { for (String chaine : ligne.split(" +")) { if (compteurLigne == 0) { taille = Integer.parseInt(chaine); array = new int[taille][taille]; } else { array[compteurLigne - 1][compteurColonne - taille * (compteurLigne - 1)] = Integer.parseInt(chaine); compteurColonne++; } } compteurLigne++; } return new Grille(array); } public Noeud algoAstar(Grille initial) { Noeud noeud_init = new Noeud(initial, null, 0); int minVal = Integer.MAX_VALUE, indiceMin = 0; liste_noeuds_ouverts.add(noeud_init); int nIdentique; if (noeud_init.estUnEtatFinal()) { return noeud_init; } else { while (!liste_noeuds_ouverts.isEmpty()) { for (int i = 0; i < liste_noeuds_ouverts.size(); i++) { if (liste_noeuds_ouverts.get(i).f() < minVal) { minVal = liste_noeuds_ouverts.get(i).f(); indiceMin = i; } } Noeud noeudCourant = liste_noeuds_ouverts.get(indiceMin); liste_noeuds_fermes.add(noeudCourant); liste_noeuds_ouverts.remove(indiceMin); ArrayList<Grille> s; s = noeudCourant.sucesseurs(); ArrayList<Noeud> noeudS = new ArrayList<>(); for (Grille grille : s) { noeudS.add(new Noeud(grille, noeudCourant, noeudCourant.g() + 1)); } for (Noeud noeud : noeudS) { if (noeud.estUnEtatFinal()) { return noeud; } else { if (!estDansListeFermee(noeud)) { nIdentique = estDansListeOuverte(noeud); if (nIdentique == -1) { liste_noeuds_ouverts.add(noeud); } else { Noeud n = liste_noeuds_ouverts.get(nIdentique); if (noeud.f() < n.f()) { liste_noeuds_ouverts.set(nIdentique, noeud); } } } } } } return null; } } public boolean estDansListeFermee(Noeud n){ boolean etat=false; for (Noeud liste_noeuds_ferme : liste_noeuds_fermes) { if (Objects.equals(n.getGrille(), liste_noeuds_ferme.getGrille())) { etat = true; break; } } return etat; } public int estDansListeOuverte(Noeud n){ int etat=-1; for(int i=0;i<liste_noeuds_ouverts.size();i++){ if(Objects.equals(n.getGrille(),liste_noeuds_ouverts.get(i).getGrille())){ etat=i; break; } } return etat; } public ArrayList<Grille> cheminComplet(Noeud noeudFinal){ ArrayList<Grille> cheminComplet = new ArrayList<Grille>(); Noeud courant=noeudFinal; while (courant!=null){ cheminComplet.add(courant.getGrille()); courant=courant.getPere(); } System.out.println(cheminComplet.size()+" mouvements"); return cheminComplet; } }
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.e.c.a; import java.lang.reflect.Field; public abstract class be extends c { public static final String[] ciG = new String[0]; private static final int ciP = "rowid".hashCode(); private static final int cjf = "value".hashCode(); private static final int cxQ = "configId".hashCode(); private boolean ciX = true; private boolean cxP = true; public int field_configId; public String field_value; public static a wI() { a aVar = new a(); aVar.sKy = new Field[2]; aVar.columns = new String[3]; StringBuilder stringBuilder = new StringBuilder(); aVar.columns[0] = "configId"; aVar.sKA.put("configId", "INTEGER PRIMARY KEY "); stringBuilder.append(" configId INTEGER PRIMARY KEY "); stringBuilder.append(", "); aVar.sKz = "configId"; aVar.columns[1] = "value"; aVar.sKA.put("value", "TEXT"); stringBuilder.append(" value TEXT"); aVar.columns[2] = "rowid"; aVar.sql = stringBuilder.toString(); return aVar; } public final 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 (cxQ == hashCode) { this.field_configId = cursor.getInt(i); this.cxP = true; } else if (cjf == hashCode) { this.field_value = cursor.getString(i); } else if (ciP == hashCode) { this.sKx = cursor.getLong(i); } } } } public final ContentValues wH() { ContentValues contentValues = new ContentValues(); if (this.cxP) { contentValues.put("configId", Integer.valueOf(this.field_configId)); } if (this.ciX) { contentValues.put("value", this.field_value); } if (this.sKx > 0) { contentValues.put("rowid", Long.valueOf(this.sKx)); } return contentValues; } }
package net.minecraft.realms; import net.minecraft.client.renderer.vertex.VertexFormatElement; public class RealmsVertexFormatElement { private final VertexFormatElement v; public RealmsVertexFormatElement(VertexFormatElement vIn) { this.v = vIn; } public VertexFormatElement getVertexFormatElement() { return this.v; } public boolean isPosition() { return this.v.isPositionElement(); } public int getIndex() { return this.v.getIndex(); } public int getByteSize() { return this.v.getSize(); } public int getCount() { return this.v.getElementCount(); } public int hashCode() { return this.v.hashCode(); } public boolean equals(Object p_equals_1_) { return this.v.equals(p_equals_1_); } public String toString() { return this.v.toString(); } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\minecraft\realms\RealmsVertexFormatElement.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
class Solution { public String frequencySort(String s) { if(s.length() == 0) return ""; Map<Character, Integer> freq = new HashMap<>(); int maxFreq = Integer.MIN_VALUE; for(char c: s.toCharArray()){ freq.put(c, freq.getOrDefault(c, 0) + 1); if(freq.get(c) > maxFreq){ maxFreq = freq.get(c); } } ArrayList<Character>[] frequencies = new ArrayList[maxFreq + 1]; for(char key: freq.keySet()){ int index = freq.get(key); if(frequencies[index] == null){ frequencies[index] = new ArrayList<>(); } frequencies[index].add(key); } StringBuilder answer = new StringBuilder(); for(int i = maxFreq; i > 0; i--){ if(frequencies[i] == null) continue ; for(char c: frequencies[i]){ for(int j = 0; j < i; j++){ answer.append(c); } } } return answer.toString(); } }
package com.tencent.mm.plugin.appbrand.jsapi; import android.content.Context; import android.content.Intent; import com.tencent.mm.bg.d; import com.tencent.mm.plugin.appbrand.l; import com.tencent.mm.plugin.appbrand.page.p; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import org.json.JSONObject; public final class ax extends a { public static final int CTRL_INDEX = 406; public static final String NAME = "private_openUrl"; public final void a(p pVar, JSONObject jSONObject, int i) { a(pVar, null, jSONObject, i); } public final void a(l lVar, JSONObject jSONObject, int i) { a(null, lVar, jSONObject, i); } private void a(p pVar, l lVar, JSONObject jSONObject, int i) { String optString = jSONObject.optString("url"); if (bi.oW(optString)) { a(pVar, lVar, i, "fail"); return; } Intent putExtra; Context context; boolean optBoolean = jSONObject.optBoolean("isNativeStyle", false); if (optBoolean) { putExtra = new Intent().putExtra("rawUrl", optString).putExtra("appbrand_report_key_target_url", optString).putExtra("open_custom_style_url", optBoolean).putExtra("forceHideShare", true).putExtra("status_bar_style", "black"); } else { putExtra = new Intent().putExtra("rawUrl", optString).putExtra("appbrand_report_key_target_url", optString); } putExtra.putExtra("ad_info", jSONObject.optString("adInfo")); if (pVar != null) { context = pVar.mContext; } else { context = lVar.getContext(); } if (context != null) { d.b(context, "webview", ".ui.tools.WebViewUI", putExtra); a(pVar, lVar, i, "ok"); return; } a(pVar, lVar, i, "fail"); } private void a(p pVar, l lVar, int i, String str) { x.e("MicroMsg.JsApiPrivateOpenUrl", "switchCallback msg:%s", str); if (pVar != null) { pVar.E(i, f(str, null)); } if (lVar != null) { lVar.E(i, f(str, null)); } } }
package com.tencent.mm.plugin.wallet_core.ui; public interface o$a { void blf(); }
package br.com.jdrmservices.session; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Component; import org.springframework.web.context.annotation.SessionScope; import br.com.jdrmservices.model.ItemCompraDireta; @Component @SessionScope public class TabelaItensCompraDireta { private List<ItemCompraDireta> itensCompraDireta = new ArrayList<>(); public BigDecimal getValorTotal() { return this.itensCompraDireta.stream() .map(ItemCompraDireta::getValorTotal) .reduce(BigDecimal::add) .orElse(BigDecimal.ZERO); } public void adicionarItens(List<ItemCompraDireta> itens) { this.itensCompraDireta = itens; } public void adicionarItem(ItemCompraDireta itemCompraDireta) { this.itensCompraDireta.add(itemCompraDireta); } public void removerItem(int index) { this.itensCompraDireta.remove(index); } public int getTotal() { return this.itensCompraDireta.size(); } public List<ItemCompraDireta> getItens() { return this.itensCompraDireta; } }
package dream.tech; public class Sample { public void show() { System.out.println("Welcome to DreamTech."); } }
package com.isslam.kidsquran; import java.util.ArrayList; import com.isslam.kidsquran.controllers.GiftsManager; import com.isslam.kidsquran.model.Gifts; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.LinearLayout; public class AwardsFragment extends Fragment { static AwardsActivity activity = null; Handler handler = new Handler(); Runnable r; public static Fragment newInstance(AwardsActivity context, int pos, float scale, boolean IsBlured) { activity = context; Bundle b = new Bundle(); b.putInt("pos", pos); b.putFloat("scale", scale); b.putBoolean("IsBlured", IsBlured); return Fragment.instantiate(context, AwardsFragment.class.getName(), b); } public boolean showBg = false; Animation myRotation; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { return null; } r = new Runnable() { @Override public void run() { Log.e("If", "If"); } }; int pos = this.getArguments().getInt("pos"); LinearLayout l = (LinearLayout) inflater.inflate(R.layout.achivements, container, false); myRotation = AnimationUtils.loadAnimation(getActivity() .getApplicationContext(), R.anim.rotator); GiftsManager giftsManager = GiftsManager.getInstance(); ArrayList<Gifts> gifts = giftsManager.getGiftsById(pos + 1); for (int i = 1; i < 7; i++) { int img_id = activity.getResources().getIdentifier("img_bg_" + i, "id", activity.getPackageName()); ImageView img_sura_0 = (ImageView) l.findViewById(img_id); String image = "ach_" + (pos + 1) + "_" + i; if (gifts.get(i - 1).getStatus() == 0) { image = "ach_" + (pos + 1) + "_" + i + "_d"; if (i == 6) image = "ach_disabled"; } int id = activity.getResources().getIdentifier(image, "drawable", activity.getPackageName()); try { img_sura_0.setImageDrawable(activity.getResources() .getDrawable(id)); } catch (Exception e) { } } LinearLayout root = (LinearLayout) l.findViewById(R.id.root); float scale = this.getArguments().getFloat("scale"); // root.setScaleBoth(scale); boolean isBlured = this.getArguments().getBoolean("IsBlured"); return l; } }
package person.mapper; import person.model.Book; import org.apache.ibatis.annotations.Insert; /** * Created by wz2063677 on 2017/3/22. */ public interface BookMapper { @Insert("INSERT INTO t_book(book_name,book_preface)VALUES(#{book_name},#{book_preface})") int insert(Book book); }
package com.example.plasticcabinets.repository; import com.example.plasticcabinets.model.CastProduct; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Repository public interface CastProductRepository extends JpaRepository<CastProduct, Integer> { @Modifying @Transactional @Query(value = "INSERT INTO cast_product (id, user_id, status, description, the_number, product_id, id_img, create_by )" + " values (:id, :userId, :status, :description, :theNumber, :productId, :idImg, :createBy)", nativeQuery = true) void saveCastProduct(@Param("id") Integer id, @Param("userId") Integer userId, @Param("status") Integer status, @Param("description") String description, @Param("theNumber") Integer theNumber, @Param("productId") Integer productId, @Param("idImg") Integer idImg, @Param("createBy") Integer createBy); @Query(value = "SELECT * from cast_product cast where cast.id = :productId", nativeQuery = true) CastProduct findByProductId(@Param("productId") Integer productId); @Modifying @Transactional @Query(value = "update cast_product set the_number=:theNumber where id = :productId", nativeQuery = true) void updateByCast(@Param("productId") Integer productId, @Param("theNumber") Integer theNumber); }
package br.com.GamesPlat.api.controller; import java.net.URI; import java.util.Optional; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.util.UriComponentsBuilder; import br.com.GamesPlat.api.controller.dto.UsuarioDto; import br.com.GamesPlat.api.controller.form.AtualizacaoUsuarioForm; import br.com.GamesPlat.api.controller.form.UsuarioForm; import br.com.GamesPlat.api.models.Usuario; import br.com.GamesPlat.api.repository.UsuarioRepository; @RestController @RequestMapping("/user") public class UsuarioController { @Autowired private UsuarioRepository usuarioRepository; @PostMapping @Transactional public ResponseEntity<UsuarioDto> cadastrar (@RequestBody @Valid UsuarioForm form, UriComponentsBuilder uriBuilder){ Usuario usuario = form.converter(usuarioRepository); usuarioRepository.save(usuario); URI uri = uriBuilder.path("/topicos/{id}").buildAndExpand(usuario.getId()).toUri(); return ResponseEntity.created(uri).body(new UsuarioDto(usuario)); } @GetMapping("/{id}") public ResponseEntity<UsuarioDto> exibirUsuario(@PathVariable Long id) { Optional<Usuario> user = usuarioRepository.findById(id); if(user.isPresent()) { return ResponseEntity.ok(new UsuarioDto(user)); } return ResponseEntity.notFound().build(); } @PutMapping("/{id}") @Transactional public ResponseEntity<UsuarioDto> atualizar (@PathVariable Long id, @RequestBody @Valid AtualizacaoUsuarioForm form){ Optional<Usuario> user = usuarioRepository.findById(id); if(user.isPresent()) { Usuario usuario = form.atualizar(id, usuarioRepository); return ResponseEntity.ok(new UsuarioDto(usuario)); } return ResponseEntity.notFound().build(); } @DeleteMapping("/{id}") @Transactional public ResponseEntity<?> remover(@PathVariable Long id){ Optional<Usuario> optional = usuarioRepository.findById(id); if(optional.isPresent()) { usuarioRepository.deleteById(id); return ResponseEntity.ok().build(); } return ResponseEntity.notFound().build(); } }
package com.example.androidlib.network; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; /** * 网络操作 * Created by liuyuhua on 2017/5/19. */ public class NetworkOperator { /** * 下载数据,保存到outputStream中 * @param urlString * @param outputStream * @return */ public static boolean downloadUrlToStream(String urlString, OutputStream outputStream) { HttpURLConnection httpURLConnection = null; BufferedInputStream bufferedInputStream = null; BufferedOutputStream bufferedOutputStream = null; try { URL url = new URL(urlString); httpURLConnection = (HttpURLConnection) url.openConnection(); if (httpURLConnection.getResponseCode() == HttpURLConnection.HTTP_OK) { bufferedInputStream = new BufferedInputStream(httpURLConnection.getInputStream(), 8 * 1024); bufferedOutputStream = new BufferedOutputStream(outputStream, 8 * 1024); int i; // 读一个字节,写一个字节 while ((i = bufferedInputStream.read()) != -1) { bufferedOutputStream.write(i); } return true; } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { if (bufferedOutputStream != null) { bufferedOutputStream.close(); } if (bufferedInputStream != null) { bufferedInputStream.close(); } if (httpURLConnection != null) { httpURLConnection.disconnect(); } } catch (IOException e) { e.printStackTrace(); } } return false; } /** * 将String写到outputStream中 * @param resultString * @param outputStream * @return */ public static boolean writeStringToStream(String resultString, OutputStream outputStream) { ByteArrayInputStream byteArrayInputStream = null; BufferedOutputStream bufferedOutputStream = null; try { byte[] resultBytes = resultString.getBytes(); byteArrayInputStream = new ByteArrayInputStream(resultBytes); bufferedOutputStream = new BufferedOutputStream(outputStream, 8 * 1024); int i; while ((i = byteArrayInputStream.read()) != -1) { bufferedOutputStream.write(i); } return true; } catch (IOException e) { e.printStackTrace(); } finally { try { if (bufferedOutputStream != null) { bufferedOutputStream.close(); } if (byteArrayInputStream != null) { byteArrayInputStream.close(); } } catch (IOException e) { e.printStackTrace(); } } return false; } }
package com.getlosthere.apps.peep.adapters; import android.content.Context; import android.graphics.Color; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.getlosthere.apps.peep.R; import com.getlosthere.apps.peep.helpers.PatternEditableBuilder; import com.getlosthere.apps.peep.helpers.RelativeTimeHelper; import com.getlosthere.apps.peep.models.Tweet; import com.squareup.picasso.Picasso; import java.util.List; import java.util.regex.Pattern; import butterknife.ButterKnife; import jp.wasabeef.picasso.transformations.RoundedCornersTransformation; /** * Created by violetaria on 8/4/16. */ public class TweetsAdapter extends RecyclerView.Adapter<TweetsAdapter.ViewHolder> { private List<Tweet> tweets; private Context context; private ViewHolderListener listener; private Context getContext() { return context; } public TweetsAdapter(Context context, List<Tweet> tweets) { this.context = context; this.tweets = tweets; this.listener = null; } public void setViewHolderListener(ViewHolderListener listener){ this.listener = listener; } public static interface ViewHolderListener { public void launchProfileActivity(String screenName); public void launchReplyDialog(String screenName); public void retweetTweet(long tweetId); public void favoriteTweet(long tweetId); public void unfavoriteTweet(long tweetId); } public static class ViewHolder extends RecyclerView.ViewHolder { public ImageView ivProfileImage; public TextView tvUsername; public TextView tvBody; public TextView tvScreenName; public TextView tvPostDate; public TextView tvLikeCount; public ImageView ivReplyImage; public TextView tvRetweetCount; public ImageView ivRetweetImage; public ImageView ivFavoritedImage; public interface ViewHolderListener { } public ViewHolder(View itemView) { super(itemView); ivProfileImage = ButterKnife.findById(itemView, R.id.ivProfileImage); tvUsername = ButterKnife.findById(itemView, R.id.tvUsername); tvBody = ButterKnife.findById(itemView, R.id.tvBody); tvScreenName = ButterKnife.findById(itemView, R.id.tvScreenName); tvPostDate = ButterKnife.findById(itemView, R.id.tvPostDate); tvLikeCount = ButterKnife.findById(itemView, R.id.tvLikeCount); ivReplyImage = ButterKnife.findById(itemView, R.id.ivReply); tvRetweetCount = ButterKnife.findById(itemView, R.id.tvRetweetCount); ivRetweetImage = ButterKnife.findById(itemView, R.id.ivRetweet); ivFavoritedImage = ButterKnife.findById(itemView, R.id.ivLikes); } } @Override public TweetsAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { Context parentContext = parent.getContext(); LayoutInflater inflater = LayoutInflater.from(parentContext); View tweetView = inflater.inflate(R.layout.item_tweet, parent, false); ViewHolder viewHolder = new ViewHolder(tweetView); return viewHolder; } @Override public void onBindViewHolder(TweetsAdapter.ViewHolder holder, int position) { // get tweeet Tweet tweet = tweets.get(position); // get stuff from view holder ImageView ivProfileImage = holder.ivProfileImage; TextView tvUsername = holder.tvUsername; TextView tvBody = holder.tvBody; TextView tvScreenName = holder.tvScreenName; TextView tvPostDate = holder.tvPostDate; final TextView tvLikeCount = holder.tvLikeCount; ImageView ivReplyImage = holder.ivReplyImage; TextView tvRetweetCount = holder.tvRetweetCount; final ImageView ivRetweetImage = holder.ivRetweetImage; final ImageView ivFavoritedImage = holder.ivFavoritedImage; // set data up tvUsername.setText(tweet.getUser().getName()); tvBody.setText(tweet.getBody()); new PatternEditableBuilder(). addPattern(Pattern.compile("\\@(\\w+)"), Color.BLUE, new PatternEditableBuilder.SpannableClickedListener() { @Override public void onSpanClicked(String screenName) { listener.launchProfileActivity(screenName); } }).into(tvBody); tvScreenName.setText(tweet.getUser().getScreenName()); tvPostDate.setText(RelativeTimeHelper.getRelativeTimeAgo(tweet.getCreatedAt())); tvLikeCount.setText(tweet.getFavoriteCountString()); tvRetweetCount.setText(tweet.getRetweetCountString()); // clear out old image for recycle view ivProfileImage.setImageResource(android.R.color.transparent); ivProfileImage.setTag(tweet.getUser().getScreenName()); ivProfileImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { listener.launchProfileActivity(view.getTag().toString()); } }); Picasso.with(getContext()).load(tweet.getUser().getProfileImageUrl()).transform(new RoundedCornersTransformation(7, 7)).fit().centerInside().into(ivProfileImage); ivReplyImage.setTag(tweet.getUser().getScreenName()); ivReplyImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.d("DEBUG",view.getTag().toString()); listener.launchReplyDialog(view.getTag().toString()); } }); if(tweet.getFavorited()) { Picasso.with(getContext()).load(R.drawable.heart).fit().centerInside().into(ivFavoritedImage); } else { Picasso.with(getContext()).load(R.drawable.unliked).fit().centerInside().into(ivFavoritedImage); } ivFavoritedImage.setTag(tweet); ivFavoritedImage.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view){ Tweet tweet = (Tweet) view.getTag(); if (tweet.getFavorited()) { listener.unfavoriteTweet(tweet.getUid()); Picasso.with(getContext()).load(R.drawable.unliked).fit().centerInside().into(ivFavoritedImage); tweet.favoriteCount = tweet.favoriteCount - 1; tweet.favorited = false; tweet.save(); tvLikeCount.setText(Integer.toString(tweet.getFavoriteCount())); } else { listener.favoriteTweet(tweet.getUid()); Picasso.with(getContext()).load(R.drawable.heart).fit().centerInside().into(ivFavoritedImage); tweet.favoriteCount = tweet.favoriteCount + 1; tweet.favorited = true; tweet.save(); tvLikeCount.setText(Integer.toString(tweet.getFavoriteCount())); } } }); ivRetweetImage.setTag(tweet.getUid()); ivRetweetImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { listener.retweetTweet((Long) view.getTag()); } }); } @Override public int getItemCount() { return tweets.size(); } // Clean all elements of the recycler public void clear() { tweets.clear(); notifyDataSetChanged(); } // Add a list of items public void addAll(List<Tweet> list) { tweets.addAll(list); notifyDataSetChanged(); } }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.maestria.programacioni_2021_01.tareaclase5; import javax.swing.JOptionPane; /** * * @author lorenzolince */ public class SwingDialogosEntrada { public void run() { String nombre, apellido, nombre_completo; nombre = JOptionPane.showInputDialog( null, "Escribe tu Nombre:", "Muestra de Dialogo de Entrada", JOptionPane.INFORMATION_MESSAGE); apellido = JOptionPane.showInputDialog( null, "Escribe tu Apellido:", "Muestra de Dialogo de Entrada", JOptionPane.INFORMATION_MESSAGE); nombre_completo = nombre + " " + apellido; JOptionPane.showMessageDialog( null, nombre_completo, "Tu Nombre Completo es:", JOptionPane.INFORMATION_MESSAGE); } }
package pojo; // Generated Mar 14, 2018 12:29:09 PM by Hibernate Tools 4.3.1 import java.util.HashSet; import java.util.Set; /** * SrShopNo generated by hbm2java */ public class SrShopNo implements java.io.Serializable { private Integer idShopNo; private SrFlow srFlow; private SrRentalType srRentalType; private SrShopType srShopType; private String shopNo; private String tradeName; private Integer status; private Integer syn; private Set<SrShopRentInfo> srShopRentInfos = new HashSet<SrShopRentInfo>(0); public SrShopNo() { } public SrShopNo(SrFlow srFlow, SrRentalType srRentalType, SrShopType srShopType) { this.srFlow = srFlow; this.srRentalType = srRentalType; this.srShopType = srShopType; } public SrShopNo(SrFlow srFlow, SrRentalType srRentalType, SrShopType srShopType, String shopNo, String tradeName, Integer status, Integer syn, Set<SrShopRentInfo> srShopRentInfos) { this.srFlow = srFlow; this.srRentalType = srRentalType; this.srShopType = srShopType; this.shopNo = shopNo; this.tradeName = tradeName; this.status = status; this.syn = syn; this.srShopRentInfos = srShopRentInfos; } public Integer getIdShopNo() { return this.idShopNo; } public void setIdShopNo(Integer idShopNo) { this.idShopNo = idShopNo; } public SrFlow getSrFlow() { return this.srFlow; } public void setSrFlow(SrFlow srFlow) { this.srFlow = srFlow; } public SrRentalType getSrRentalType() { return this.srRentalType; } public void setSrRentalType(SrRentalType srRentalType) { this.srRentalType = srRentalType; } public SrShopType getSrShopType() { return this.srShopType; } public void setSrShopType(SrShopType srShopType) { this.srShopType = srShopType; } public String getShopNo() { return this.shopNo; } public void setShopNo(String shopNo) { this.shopNo = shopNo; } public String getTradeName() { return this.tradeName; } public void setTradeName(String tradeName) { this.tradeName = tradeName; } public Integer getStatus() { return this.status; } public void setStatus(Integer status) { this.status = status; } public Integer getSyn() { return this.syn; } public void setSyn(Integer syn) { this.syn = syn; } public Set<SrShopRentInfo> getSrShopRentInfos() { return this.srShopRentInfos; } public void setSrShopRentInfos(Set<SrShopRentInfo> srShopRentInfos) { this.srShopRentInfos = srShopRentInfos; } }
package fr.pederobien.uhc.commands.configuration.edit.editions.configurations.blockedexgame; import fr.pederobien.uhc.commands.configuration.edit.editions.CommonList; import fr.pederobien.uhc.dictionary.dictionaries.MessageCode; import fr.pederobien.uhc.interfaces.IBlockedexConfiguration; public class ListeBlockedexGame extends CommonList<IBlockedexConfiguration> { public ListeBlockedexGame() { super(MessageCode.LIST_BLOCKEDEX_GAME_EXPLANATION); } @Override protected void onSizeEquals0() { sendMessage(MessageCode.LIST_BLOCKEDEX_GAME_SIZE_EQUALS_0); } @Override protected void onSizeEquals1(String name) { sendMessage(MessageCode.LIST_BLOCKEDEX_GAME_SIZE_EQUALS_1, name); } @Override protected void onSizeGreaterThan0(String allNames) { sendMessage(MessageCode.LIST_BLOCKEDEX_GAME_SIZE_GREATER_THAN_0, allNames); } }
package solution; import domain.TreeNode; import java.util.HashMap; import java.util.Map; /** * User: jieyu * Date: 11/18/16. */ public class ConstructBinaryTreeFromPreorderAndInorderTraversal105 { public TreeNode buildTree(int[] preorder, int[] inorder) { if (inorder.length == 0) return null; Map<Integer, Integer> inMap = new HashMap<>(); for (int i = 0; i < inorder.length; ++i) { inMap.put(inorder[i], i); } TreeNode root = build(inorder, 0, inorder.length - 1, preorder, 0, preorder.length, inMap); return root; } private TreeNode build(int[] inorder, int inStart, int inEnd, int[] preorder, int preStart, int preEnd, Map<Integer, Integer> inMap) { if (inorder.length == 0) return null; TreeNode root = new TreeNode(preorder[preStart]); int rootIndexIn = inMap.get(preorder[preStart]); if (rootIndexIn != inStart) root.left = build(inorder, inStart, rootIndexIn - 1, preorder, preStart + 1, preStart + rootIndexIn - inStart, inMap); if (rootIndexIn != inEnd) root.right = build(inorder, rootIndexIn + 1, inEnd, preorder, preStart + rootIndexIn - inStart + 1, preEnd, inMap); return root; } }
package am.main.data.jaxb.log4jData; /** * Created by ahmed.motair on 11/17/2017. */ import javax.xml.bind.annotation.*; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;simpleContent> * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string"> * &lt;attribute name="ref" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/extension> * &lt;/simpleContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "value" }) public class AppenderRef implements Cloneable{ @XmlValue protected String value; @XmlAttribute(name = "ref") protected String ref; public AppenderRef() { } public AppenderRef(String ref) { this.ref = ref; } /** * Gets the value of the value property. * * @return * possible object is * {@link String } * */ public String getValue() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link String } * */ public void setValue(String value) { this.value = value; } /** * Gets the value of the ref property. * * @return * possible object is * {@link String } * */ public String getRef() { return ref; } /** * Sets the value of the ref property. * * @param value * allowed object is * {@link String } * */ public void setRef(String value) { this.ref = value; } @Override protected AppenderRef clone() throws CloneNotSupportedException { AppenderRef clone = new AppenderRef(); clone.setValue(this.value); clone.setRef(this.ref); return clone; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof AppenderRef)) return false; AppenderRef that = (AppenderRef) o; if (getValue() != null ? !getValue().equals(that.getValue()) : that.getValue() != null) return false; return getRef() != null ? getRef().equals(that.getRef()) : that.getRef() == null; } @Override public int hashCode() { int result = getValue() != null ? getValue().hashCode() : 0; result = 31 * result + (getRef() != null ? getRef().hashCode() : 0); return result; } @Override public String toString() { return "AppenderRef{" + "value = " + value + ", ref = " + ref + "}\n"; } }
package com.shazam.android.test.conditions; public class ExampleConditions { public static class AnyConfiguration implements Condition { @Override public boolean isSatisfied() { return true; } } }
package agreal; import agreal.AlgoritmoGenetico; import agreal.Problema; public class AGReal { public static void main(String[] args) { // TODO Auto-generated method stub Problema problema = new Problema(); Integer tamanho = 50; // real1 = 50, real2 = 100 Double pCrossover = 0.8; Double pMutacao = 0.07; //real1 = 0.05, real2=0.07 Integer geracoes = 100; Double minimo = -100.0; Double maximo = 100.0; Integer nVariaveis = 120; // real1 = 100, real2 = 120 AlgoritmoGenetico ag = new AlgoritmoGenetico(tamanho, pCrossover, pMutacao, geracoes, problema, minimo, maximo, nVariaveis); ag.executar(); } }
package sec06.exam03_newinstance; public interface Action { //1.상수 //2.추상메소드 public void executed(); //3.디폴트메소드 //4.정적메소드 }
package com.example.android.location; import android.app.Activity; import android.content.DialogInterface; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.hackaton.kyiv.location.Coordinates; import com.hackaton.kyiv.location.JSONParser; import org.json.JSONException; import org.json.JSONObject; public class BombActivity extends Activity implements View.OnClickListener { LocationFinder lf; double latitude; double longitude; String gameId; Button btnSentCoordinates; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bomb_activity); lf = new LocationFinder(this); btnSentCoordinates=(Button)findViewById(R.id.button_send_bomb_location) ; btnSentCoordinates.setOnClickListener(this); // lf.startUpdates(); } @Override protected void onStart() { super.onStart(); //To change body of overridden methods use File | Settings | File Templates. lf.startLocationClient(); } @Override protected void onResume() { super.onResume(); //To change body of overridden methods use File | Settings | File Templates. lf.resumeLocationClient(); // Toast.makeText(this,String.valueOf(latitude)+" "+longitude,2000).show(); } @Override public void onClick(View v) { gameId=((EditText) findViewById(R.id.bomb_pin)).getText().toString(); lf.setPin(gameId); GetLocationTask glt=new GetLocationTask(); glt.execute(); } private class GetLocationTask extends AsyncTask <Void, Void, Void> { @Override protected Void doInBackground(Void... params) { while (lf.getLat() == 0 && lf.getLong() == 0) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } latitude = lf.getLat(); longitude = lf.getLong(); JSONParser jParser = new JSONParser(); String url = "http://cl225620.tmweb.ru/set/json?pin="+gameId+"&longg="+longitude+"&latt="+latitude; Log.d("myLogs", url); // getting JSON string from URL JSONObject json = jParser.getJSONFromUrl(url); return null; //To change body of implemented methods use File | Settings | File Templates. } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); // Toast.makeText(BombActivity.this,"Happy lat"+latitude+" "+longitude,1000).show();//To change body of overridden methods use File | Settings | File Templates. } } }
package li.cil.ceres.internal; /** * Marker interface for generated serializers. */ public interface GeneratedSerializer { boolean hasSerializedFields(); }
package com.adam.commoninterestsservice.entities; import javax.persistence.*; @Entity @Table(name = "subscription_t") public class Subscription { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @ManyToOne private Category category; @ManyToOne private User user; public Subscription() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Category getCategory() { return category; } public void setCategory(Category category) { this.category = category; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } }
/** * HTTP clients. */ package api.longpoll.bots.http;
public class Alphabet extends Generics { public static final String type = "Alphabet"; private static final int size = 26; public enum KeyType {combo, letter}; public static KeyType key = KeyType.combo; private char letter; /* * single letter object */ public Alphabet(char l) { this.setType(type); this.letter = l; } /* * toString provides output based off of key setting */ @Override public String toString() { String output=""; switch(key) { case letter: output += this.letter; break; case combo: default: output += type + ": " + this.letter; } return output; } /* * upper case alphabet array */ public static Generics[] alphabetData() { Generics[] alphabet = new Alphabet[Alphabet.size]; for (int i = 0; i < Alphabet.size; i++) alphabet[i] = new Alphabet( (char)('A' + i) ); return alphabet; } /* * main to test Animal class */ public static void main(String[] args) { Generics[] ad = alphabetData(); for(Generics alphabet : ad) ConsoleMethods.println("" + alphabet); } }
package team; import show.Showable; public class Team implements Showable { private int ID; private String name; public Team(int _ID, String _name) { ID = _ID; name = _name; } public void showData() { System.out.println(ID + " " + name); } public String tName() { return name; } public int tID() { return ID; } }
package org.rhokk.hh.sealand.helper; import java.util.concurrent.Executor; import java.util.concurrent.Executors; public class GlobalBackgroundExecutor { private final static Executor SINGLE_THREAD_EXECUTOR = Executors.newSingleThreadExecutor(); public static void execute( Runnable runnable ) { SINGLE_THREAD_EXECUTOR.execute( runnable ); } }
package lambda_test; import com.google.common.collect.Lists; import java.util.Collections; import java.util.Comparator; import java.util.List; /** * Description: * * @author Baltan * @date 2018/7/19 11:37 */ public class Test10 { public static void main(String[] args) { List<Loser> list = Lists.newArrayList(new Loser(40), new Loser(20), new Loser(30)); System.out.println(list); Collections.sort(list, Comparator.comparing(Loser::getAge)); System.out.println(list); // list.forEach(System.out::println); } } class Loser { private int age; public Loser(int age) { this.age = age; } public int getAge() { return age; } @Override public String toString() { return "Loser{" + "age=" + age + '}'; } }
package net.sf.ardengine.rpg; import net.sf.ardengine.AWorld; /** * LoadingScreen is AWorld rendered by Game when it is loading new Level. */ public abstract class ALoadingScreen extends AWorld { /** * Called after Core starts loading level and adds this world to Game. */ public abstract void start(); }
package com.yixin.kepler.v1.service.capital.icbc; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.yixin.common.utils.JsonObjectUtils; import com.yixin.dsc.common.DscContant; import com.yixin.kepler.dto.BaseMsgDTO; import com.yixin.kepler.v1.common.constants.IcbcConstant; import com.yixin.kepler.v1.common.core.callbank.CallBackHandle; import com.yixin.kepler.v1.datapackage.dto.CallBackDTO; import com.yixin.kepler.v1.datapackage.dto.icbc.IcbcAckDataDTO; import com.yixin.kepler.v1.datapackage.dto.icbc.IcbcApplyDTO; import com.yixin.kepler.v1.datapackage.dto.icbc.IcbcBackDataDTO; import com.yixin.kepler.v1.utils.JacksonUtils; /** * 工行-银行侧回调实现类 * Package : com.yixin.kapler_v1.service.capital.icbc * * @author YixinCapital -- chen.lin * 2018年9月12日 上午10:05:42 * */ public abstract class ICBCCallbackService implements CallBackHandle { private static final Logger logger = LoggerFactory.getLogger(ICBCCallbackService.class); /** * 对回调数据进行校验 * @param callBack * @return * @author YixinCapital -- chen.lin * 2018年9月25日 下午12:09:42 */ @Override public BaseMsgDTO checkData(CallBackDTO callBack) { try { if (StringUtils.isBlank(callBack.getCallBackType())) { return new BaseMsgDTO(DscContant.KeplerCode.FAILD, "[回调未收妥]回调类型为空"); } if (StringUtils.isBlank(callBack.getSourceCode())) { return new BaseMsgDTO(DscContant.KeplerCode.FAILD, "[回调未收妥]资方来源为空"); } if (StringUtils.isBlank(callBack.getCapitalOrderNO())) { return new BaseMsgDTO(DscContant.KeplerCode.FAILD, "[回调未收妥]资方申请编号为空"); } String businessData = JsonObjectUtils.objectToJson(callBack.getBusinessData()); if (StringUtils.isBlank(businessData)) { return new BaseMsgDTO(DscContant.KeplerCode.FAILD, "[回调未收妥]业务数据不合法"); } //是否可转化为目标业务数据 IcbcApplyDTO<IcbcBackDataDTO> feedback = (IcbcApplyDTO<IcbcBackDataDTO>)JacksonUtils.getObjectFromJson(businessData, IcbcApplyDTO.class, IcbcBackDataDTO.class); return new BaseMsgDTO(DscContant.KeplerCode.SUCCESS, "SUCCESS"); } catch (Exception e) { logger.error("对回调数据进行校验失败,申请编号={},错误={}", callBack.getCapitalOrderNO(), e); return new BaseMsgDTO(DscContant.KeplerCode.FAILD, "[回调未收妥]对回调数据进行校验失败"); } } /** * 适配到具体的回调方法并实现 * callBackType: * letterReview 信审 * faceTackReview 面签 * requestFundsReview 请款 * @param resultDTO * @return * @author YixinCapital -- chen.lin * 2018年9月25日 下午12:05:57 */ @Override public CallBackDTO respResultHandle(CallBackDTO callBack) { IcbcApplyDTO<IcbcAckDataDTO> businessData = null; String data = JsonObjectUtils.objectToJson(callBack.getBusinessData()); try { if(IcbcConstant.letterReview.equals(callBack.getCallBackType())){ businessData = letterReview(data); }else if(IcbcConstant.faceTackReview.equals(callBack.getCallBackType())){ businessData = faceTackReview(data); }else if(IcbcConstant.requestFundsReview.equals(callBack.getCallBackType())){ businessData = requestFundsReview(data); } callBack.setBusinessData(businessData); } catch (Exception e) { logger.error("适配到具体的回调方法并实现失败,申请编号={},错误={}", callBack.getCapitalOrderNO(), e); callBack.setBusinessData(businessData); } return callBack; } /** * 工行信审结果回调 * @param IcbcJson * @return * @author YixinCapital -- chen.lin * 2018年9月12日 上午10:26:02 */ protected abstract IcbcApplyDTO<IcbcAckDataDTO> letterReview(String IcbcJson); /** * 工行面签结果回调 * @param IcbcJson * @return * @author YixinCapital -- chen.lin * 2018年9月12日 上午10:26:02 */ protected abstract IcbcApplyDTO<IcbcAckDataDTO> faceTackReview(String IcbcJson); /** * 工行请款结果回调 * @param IcbcJson * @return * @author YixinCapital -- chen.lin * 2018年9月12日 上午10:26:02 */ protected abstract IcbcApplyDTO<IcbcAckDataDTO> requestFundsReview(String IcbcJson); /** * 工行抵押确认回调 * @param IcbcJson * @return * @author YixinCapital -- chen.lin * 2018年9月12日 上午10:26:02 */ protected abstract IcbcApplyDTO<IcbcAckDataDTO> mortgageReview(String IcbcJson); }
package com.teketik.test.mockinbean; import org.mockito.Spy; import org.springframework.boot.test.mock.mockito.SpyBean; import java.lang.annotation.ElementType; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * <p>Annotation used to inject a {@link Spy} of a Spring Bean in another Spring Bean for the duration of a test. * <p>This is a convenient alternative to {@link SpyBean @SpyBean} that provides surgical spy injection without dirtying or polluting the Spring context:<br> * Spys are injected for every test method and the original Spring Beans(s) are re-injected after the test class is done. * <hr> * <p><strong>Example:</strong><br> * Assuming you have the following service:<br> * <pre class="code"> * &#064;Service * public class MyService { * * &#064;Autowired * private ThirdPartyApi thirdPartyApi; * * public void doSomethingWithThirdPartyApi() { * thirdPartyApi.doSomething(new Object()); * } * } * </pre> * You can create a test for your service with a spied {@code ThirdPartyApi} like: * <pre class="code"> * &#064;SpringBootTest * public class MyServiceTest { * * &#064;SpyInBean(MyService.class) * private ThirdPartyApi thirdPartyApi; * * &#064;Autowired * private MyService myService; * * &#064;Test * public void test() { * myService.doSomethingWithThirdPartyApi(); * Mockito.verify(thirdPartyApi).doSomething(Mockito.any(Object.class)); * } * } * </pre> * {@code thirdPartyApi} will be a {@link Spy} of the actual {@code ThirdPartyApi} Spring Bean that is recreated for every test method in {@code MyServiceTest} and {@code MyService}.<br> * The original {@code ThirdPartyApi} Spring bean will be re-injected in {@code MyService} after all the tests of {@code MyServiceTest}. * <hr> * <p>In case the bean in which you are trying to inject a spy has multiple instances registered in the context, you can specify the {@link #name() name} of the bean: * <pre class="code"> * &#064;SpyInBean(value = MyService.class, name = "nameOfMyService") * private ThirdPartyApi thirdPartyApi; * </pre> * <hr> * <p>You can also inject your spy in multiple beans by repeating the annotation: * <pre class="code"> * &#064;SpyInBean(MyFirstService.class), * &#064;SpyInBean(MySecondService.class) * private ThirdPartyApi thirdPartyApi; * </pre> * @author Antoine Meyer * @see MockInBean */ @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Repeatable(SpyInBeans.class) public @interface SpyInBean { /** * @return the {@code class} of the Spring Bean in which you want your {@link Spy} to be injected for the duration of the test. */ Class<?> value(); /** * @return the {@code name} of the Spring Bean in which you want your {@link Spy} to be injected for the duration of the test.<br> * This is not necessary and is only useful if your context contains multiple Beans of the same type with different names. */ String name() default ""; }
package Controller; import Model.OsuSyncWriter; import View.OsuSyncView; public class HomePageController extends AbstractController { private OsuSyncWriter writer = new OsuSyncWriter(); @Override public void fileChooser(boolean isFile, int option) { throw new UnsupportedOperationException("The Operation is now unsupported"); } @Override public void getOsuSync() { OsuSyncView.changePanel(viewFactory.getOsuSyncPage()); } @Override public void exportOsuSync() { OsuSyncView.changePanel(viewFactory.getExportPage()); } @Override public void importOsuSync() { OsuSyncView.changePanel(viewFactory.getImportPage()); } @Override public void moreOsuSync() { OsuSyncView.changePanel(viewFactory.getMorePage()); } }
/* * 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 edu.eci.arsw.webstore.persistence.impl; import edu.eci.arsw.webstore.model.User; import edu.eci.arsw.webstore.persistence.UserPersistence; import edu.eci.arsw.webstore.persistence.WebStoreDB; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import org.springframework.stereotype.Service; /** * * @author jmvillatei */ @Service public class InMemoryUserPersistence implements UserPersistence { // Atributos WebStoreDB wsdb; private void newDb() { wsdb = new WebStoreDB(); } @Override public List<User> getAllUsers() { newDb(); try { return wsdb.getAllUsers(); } catch (Exception ex) { Logger.getLogger(InMemoryUserPersistence.class.getName()).log(Level.SEVERE, null, ex); return wsdb.getAllUsers(); } } @Override public void createNewUser(User us) { newDb(); try { wsdb.createNewUser(us); } catch (Exception ex) { Logger.getLogger(InMemoryUserPersistence.class.getName()).log(Level.SEVERE, null, ex); } } @Override public User getUserByUserNickname(String userNickname) { newDb(); try { return wsdb.getUserByUserNickname(userNickname); } catch (Exception ex) { Logger.getLogger(InMemoryUserPersistence.class.getName()).log(Level.SEVERE, null, ex); return wsdb.getUserByUserNickname(userNickname); } } @Override public void deleteUserByUserNickname(String userNickname) { newDb(); try { wsdb.deleteUserByUserNickname(userNickname); } catch (Exception ex) { Logger.getLogger(InMemoryUserPersistence.class.getName()).log(Level.SEVERE, null, ex); } } @Override public void updateUser(User user) { newDb(); try { wsdb.updateUser(user); } catch (Exception ex) { Logger.getLogger(InMemoryUserPersistence.class.getName()).log(Level.SEVERE, null, ex); } } @Override public User getUserById(String id) { newDb(); try { return wsdb.getUserById(id); } catch (Exception ex) { Logger.getLogger(InMemoryUserPersistence.class.getName()).log(Level.SEVERE, null, ex); return wsdb.getUserById(id); } } @Override public User getUserByEmail(String email) { newDb(); try { return wsdb.getUserByEmail(email); } catch (Exception ex) { Logger.getLogger(InMemoryUserPersistence.class.getName()).log(Level.SEVERE, null, ex); return wsdb.getUserByEmail(email); } } }
package com.smxknife.netty.v5.demo11; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.codec.http.HttpObjectAggregator; import io.netty.handler.codec.http.HttpServerCodec; import io.netty.handler.stream.ChunkedWriteHandler; /** * @author smxknife * 2018-12-10 */ public class WebSocketServer { public void run(int port) throws InterruptedException { EventLoopGroup bossGroup = new NioEventLoopGroup(); EventLoopGroup workGroup = new NioEventLoopGroup(); try { ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(bossGroup, workGroup) .channel(NioServerSocketChannel.class) .childHandler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel socketChannel) throws Exception { // 将请求和应答消息编码或解码为http消息 socketChannel.pipeline().addLast("http-codec", new HttpServerCodec()); // 将http消息的多个部分组合成一条完整的http消息 socketChannel.pipeline().addLast("aggregator", new HttpObjectAggregator(65536)); // 来想客户端发送HTML5文件,主要用于支持浏览器和服务端进行WebSocket通信 socketChannel.pipeline().addLast("http-chunked", new ChunkedWriteHandler()); socketChannel.pipeline().addLast("handler", new WebSocketServerHandler()); } }); ChannelFuture future = bootstrap.bind(port).sync(); future.channel().closeFuture().sync(); } finally { bossGroup.shutdownGracefully(); workGroup.shutdownGracefully(); } } public static void main(String[] args) throws InterruptedException { new WebSocketServer().run(8080); } }
class RnaTranscription { String transcribe(String dnaStrand) { char[] chars = dnaStrand.toCharArray(); StringBuilder transcribedDna = new StringBuilder(); System.out.println(chars); for (char ch : chars) { String chString = Character.toString(ch); switch (chString) { case "G": transcribedDna.append("C"); break; case "C": transcribedDna.append("G"); break; case "T": transcribedDna.append("A"); break; case "A": transcribedDna.append("U"); break; } } return transcribedDna.toString(); } }
package com.app; import java.util.Iterator; public class JSONArray { public Iterator iterator() { return null; } }
package scriptinterface; import global.ExtractedString; import scriptinterface.execution.parseerrors.ParameterParseException; import scriptinterface.execution.returnvalues.ExecutionError; /** * A default {@link SignatureInterface} implementation which extracts the information of a signature string and * transforms it into an easy to access data structure. * * @author Andreas Fender */ public class DefaultSignature implements SignatureInterface { private ParameterTuple parameterTuple; private ScriptType returnVal; private String keys; private String[] keyArray; private boolean isCreated; public DefaultSignature() { this.isCreated = false; parameterTuple = new ParameterTuple(); } /** * Initializes the signature according to the given string. See the Graphana manual for informations about the * Syntax. A script system must be given to evaluate the default values. */ public ExecutionError createSignature(String signatureString, ScriptSystemInterface<?, ?> scriptSystem) { ExtractedString extracted = new ExtractedString(signatureString).extract(0, new char[]{'(', ':'}); keys = extracted.getExtracted().trim(); this.keyArray = keys.split("\\|"); try { if (extracted.getEndChar() == ':') { } else { extracted.extract(extracted.getNextPos() + 1, ')', '(', ')'); String argString = extracted.getExtracted(); ExecutionError execError = parameterTuple.createFromString(argString, scriptSystem); if (execError != null) return execError; } int retPos = signatureString.indexOf(':', extracted.getNextPos()); if (retPos == -1) this.returnVal = null; else { String retString = signatureString.substring(retPos + 1).trim(); if (retString.toUpperCase().equals("VOID")) this.returnVal = null; else { this.returnVal = scriptSystem.getScriptType(retString); if (returnVal == null) throw new ParameterParseException(-1, "", "Invalid return type"); } } if (extracted.endOfString()) this.isCreated = true; } catch (Exception e) { e.printStackTrace(); } return null; } @Override public ParameterTuple getParameterTuple() { return parameterTuple; } /** * Tells whether or not this instance was initialized. * * @return true if and only if {@link #createSignature} was called successfully. */ public boolean isCreated() { return this.isCreated; } @Override public String getKeysAsString() { return this.keys; } @Override public String getMainKey() { return keyArray[0]; } @Override public String[] getKeyArray() { return keyArray; } /** * Returns the return type of the signature. * * @return the return type or null, if the return type is VOID. */ public ScriptType getReturnValue() { return this.returnVal; } @Override public String getReturnValueAsString() { if (returnVal == null) return "void"; else return returnVal.getStringRepresentation(); } @Override public String getStringRepresentation() { String res = getMainKey() + '(' + parameterTuple.getStringRepresentation() + ')' + " : " + getReturnValueAsString(); return res; } @Override public String toString() { return this.getStringRepresentation(); } }
package uk.gov.hmcts.befta.auth; import java.util.Objects; import lombok.Getter; import uk.gov.hmcts.befta.util.EnvironmentVariableUtils; @Getter public class UserTokenProviderConfig { public static final UserTokenProviderConfig DEFAULT_INSTANCE = new UserTokenProviderConfig(); private static final String OIDC = "OIDC"; private static final String OAUTH2 = "OAUTH2"; private final String clientId; private final String clientSecret; private final String redirectUri; private String accessTokenType; private String scopeVariables; private UserTokenProviderConfig() { clientId = EnvironmentVariableUtils.getRequiredVariable("OAUTH2_CLIENT_ID"); clientSecret = EnvironmentVariableUtils.getRequiredVariable("OAUTH2_CLIENT_SECRET"); redirectUri = EnvironmentVariableUtils.getRequiredVariable("OAUTH2_REDIRECT_URI"); scopeVariables = EnvironmentVariableUtils.getOptionalVariable("OAUTH2_SCOPE_VARIABLES"); accessTokenType = EnvironmentVariableUtils.getOptionalVariable("OAUTH2_ACCESS_TOKEN_TYPE"); if (accessTokenType == null) { accessTokenType = OAUTH2; } } private UserTokenProviderConfig(String tokenProviderClientId) { clientId = tokenProviderClientId; clientSecret = EnvironmentVariableUtils.getRequiredVariable("BEFTA_OAUTH2_CLIENT_SECRET_OF_" + tokenProviderClientId.toUpperCase()); redirectUri = EnvironmentVariableUtils.getRequiredVariable("BEFTA_OAUTH2_REDIRECT_URI_OF_" + tokenProviderClientId.toUpperCase()); scopeVariables = EnvironmentVariableUtils.getOptionalVariable("BEFTA_OAUTH2_SCOPE_VARIABLES_OF_" + tokenProviderClientId.toUpperCase()); accessTokenType = EnvironmentVariableUtils.getOptionalVariable( "BEFTA_OAUTH2_ACCESS_TOKEN_TYPE_OF_" + tokenProviderClientId.toUpperCase()); if (accessTokenType == null) { accessTokenType = OAUTH2; } } public static UserTokenProviderConfig of(String tokenProviderClientId) { Objects.requireNonNull(tokenProviderClientId); if (tokenProviderClientId.equals(DEFAULT_INSTANCE.getClientId())) return DEFAULT_INSTANCE; return new UserTokenProviderConfig(tokenProviderClientId); } public boolean isForOidc() { return accessTokenType.equalsIgnoreCase(OIDC); } public boolean isForOauth2() { return accessTokenType.equalsIgnoreCase(OAUTH2); } }
package com.lesson9.maximumsliceproblem; import org.junit.Test; public class MaxProfit { @Test public void Correctness(){ int [][] AA = { {} // 0 , {1} // 0 , {40, 20, 30, 5} // 10 , {23171,21011,21123,21366,21013,21367} // 356 , {1,2,3,4} // 3 , {4,3,2,1} // 0 , {4,3,2,1,2} // 1 , {4,3,2,10,20,2} // 18 , {4,30,2,10,20,2} // 26 }; for(int []A : AA){ System.out.println(new MaxProfit().solution(A)); } } public int solution(int[] A){ int maxProfit = 0 ; int minPrice1 = 0; if(A.length>0) minPrice1 = A[0]; for(int i=1;i<A.length;i++){ int price1 = A[i-1]; int price2 = A[i]; if(price1 < minPrice1){ minPrice1 = price1; } int profit = price2 - minPrice1; if(profit>0){ if(profit > maxProfit){ maxProfit = profit; } } } return maxProfit; } }
package org.fhcrc.honeycomb.metapop.mutation; import org.fhcrc.honeycomb.metapop.Population; import java.util.List; /** * No mutation. * * Created on 29 May, 2013 * * @author Adam Waite * @version $Rev: 2300 $, $Date: 2013-08-16 12:21:32 -0700 (Fri, 16 Aug 2013) $, $Author: ajwaite $ * */ public class NoMutation implements MutationRule { public void mutate(List<Population> pop) {} }
package com.tencent.mm.plugin.account.friend.a; public final class t { }
package sort; import java.util.Arrays; /** * Create by coldwarm on 2018/8/13. */ public class SwapTest { public static void main(String[] args) { int[] arr = {1,3}; Swap1(arr,0,1); System.out.println(Arrays.toString(arr)); int a=2,b=6,c; c=2^6; System.out.println(c); } //数组为引用类型,对数组进行修改,原数组的内容也会被修改,所以这里调用方法之后数组两个数据会被调换 //如果传入int类型,为基本数据类型,只是传入数字到方法中,对main函数中的a,b并没有影响,不会被改变 public static void Swap1(int[] arr,int a, int b) { if (arr[a] != arr[b]) { arr[a] ^= arr[b]; arr[b] ^= arr[a]; arr[a] ^= arr[b]; } } }
package com.example.makemytrip.activity; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.os.Bundle; import com.example.makemytrip.R; import com.example.makemytrip.adapter.FlightAdapter; import com.example.makemytrip.apiClient.ApiClient; import com.example.makemytrip.network.Network; import com.example.makemytrip.response.FlightResponseDTO; import java.util.ArrayList; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class LaunchFlightActivity extends AppCompatActivity { private List<FlightResponseDTO> flightResponseDTOS = new ArrayList<>(); private FlightAdapter flightAdapter; private RecyclerView recyclerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_launch_flight); recyclerView = findViewById(R.id.recyclerView_LaunchFlightActivity); callAPI(); } private void callAPI() { ApiClient apiClient = Network.getInstance().create(ApiClient.class); apiClient.getFlightResponse().enqueue(new Callback<List<FlightResponseDTO>>() { @Override public void onResponse(Call<List<FlightResponseDTO>> call, Response<List<FlightResponseDTO>> response) { if (response.body() != null) { flightResponseDTOS = response.body(); setRecycler(); } } @Override public void onFailure(Call<List<FlightResponseDTO>> call, Throwable t) { } }); } private void setRecycler() { LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); flightAdapter = new FlightAdapter(flightResponseDTOS); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setAdapter(flightAdapter); } }
/** * Copyright (C), 2019-2020 FileName: BusinessStatus Author: danyits Date: 2020/12/5 15:42 Description: 业务状态临时表 * History: * <author> <time> <version> <desc> * 作者姓名 修改时间 版本号 描述 */ package com.hastemd.demo.aop.status.domian; import lombok.Data; import java.time.LocalDateTime; /** * 〈业务状态临时表〉 * * @author danyits * @date 2020/12/5 * @since 1.0.0 */ @Data public class BusinessStatus { /** * 数据Id */ private Object dataId; /** * 数据类型 */ private String dataType; /** * 数据入库数据 */ private LocalDateTime createTime; public BusinessStatus() { } public BusinessStatus(Object dataId, String dataType) { this.dataId = dataId; this.dataType = dataType; } }
package com.github.dmstocking.putitonthelist.main; public interface OnGroceryListLongClicked { void onGroceryListLongClicked(ListViewModel model); }
package de.jmda9.core.mproc; import static de.jmda9.core.util.FileUtil.toSourceFilePath; import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; import org.junit.Test; import de.jmda9.core.annotation.MarkerAnnotationType; import de.jmda9.core.mproc.LaunchConfiguration; import de.jmda9.core.mproc.Launcher; import de.jmda9.core.mproc.Processor; public class JUTProcessorUnusualImplementations extends AbstractJUTProcessors { @MarkerAnnotationType private class TestTypeProcessed { } /** * Regular Processor implementation (nothing missing) */ @SupportedAnnotationTypes(value = { "de.jmda9.core.annotation.MarkerAnnotationType" }) @SupportedSourceVersion(value = SourceVersion.RELEASE_8) private class TestProcessor extends Processor { @Override protected boolean process() { return false; } @Override protected Set<Class<? extends Annotation>> getSupposedSupportedAnnotationTypes() { return asSet(MarkerAnnotationType.class); } } /** * Processor implementation without any {@link SupportedAnnotationTypes} * annotation */ @SupportedSourceVersion(value = SourceVersion.RELEASE_8) private class TestProcessorSupportedAnnotationTypesMissing extends Processor { @Override protected boolean process() { return false; } @Override protected Set<Class<? extends Annotation>> getSupposedSupportedAnnotationTypes() { return asSet(MarkerAnnotationType.class); } } /** * Processor implementation with <code>null</code> return value from {@link * #getSupportedAnnotationTypes()} */ @SupportedAnnotationTypes(value = { "de.jmda9.core.annotation.MarkerAnnotationType" }) @SupportedSourceVersion(value = SourceVersion.RELEASE_8) private class TestProcessorSupposedSupportedAnnotationTypesNull extends Processor { @Override protected boolean process() { return false; } @Override protected Set<Class<? extends Annotation>> getSupposedSupportedAnnotationTypes() { return null; } } /** * Processor implementation with empty but non <code>null</code> return value * from {@link #getSupportedAnnotationTypes()} */ @SupportedAnnotationTypes(value = { "de.jmda9.core.annotation.MarkerAnnotationType" }) @SupportedSourceVersion(value = SourceVersion.RELEASE_8) private class TestProcessorSupposedSupportedAnnotationTypesEmpty extends Processor { @Override protected boolean process() { return false; } @Override protected Set<Class<? extends Annotation>> getSupposedSupportedAnnotationTypes() { return new HashSet<>(); } } /** * empty implementation to bypass setup process in super class * @see de.jmda.core.mproc.AbstractJUTProcessors#before() */ @Override public void before() throws Exception { } /** * returns empty list, is not used because setup process in super class is * bypassed * @see de.jmda.core.mproc.AbstractJUTProcessors#getProcessors() */ @Override protected List<? extends Processor> getProcessors() { return new ArrayList<>(); } /** * tests behaviour for missing {@link SupportedAnnotationTypes} annotation * (expects {@link ExceptionInInitializerError}) */ @Test(expected = ExceptionInInitializerError.class) public void testSupportedAnnotationMissing() throws Throwable { LaunchConfiguration launchConfiguration = new LaunchConfiguration(); launchConfiguration.files.addAll(getJavaFilesWithSupportedAnnotations()); launchConfiguration.processors.add(new TestProcessorSupportedAnnotationTypesMissing()); try { Launcher.launch(launchConfiguration); } catch (RuntimeException e) { throw e.getCause(); } } /** * tests behaviour for <code>null</code> return value in {@link * Processor#getSupposedSupportedAnnotationTypes()} (expects {@link * NullPointerException}) */ @Test(expected = NullPointerException.class) public void testSupposedSupportedAnnotationNull() throws Throwable { LaunchConfiguration launchConfiguration = new LaunchConfiguration(); launchConfiguration.files.addAll(getJavaFilesWithSupportedAnnotations()); launchConfiguration.processors.add(new TestProcessorSupposedSupportedAnnotationTypesNull()); try { Launcher.launch(launchConfiguration); } catch (RuntimeException e) { throw e.getCause(); } } /** * tests behaviour for <code>null</code> return value in {@link * Processor#getSupposedSupportedAnnotationTypes()} (expects warning message * in log) */ @Test public void testSupposedSupportedAnnotationEmpty() throws IOException { LaunchConfiguration launchConfiguration = new LaunchConfiguration(); launchConfiguration.files.addAll(getJavaFilesWithSupportedAnnotations()); launchConfiguration.processors.add(new TestProcessorSupposedSupportedAnnotationTypesEmpty()); Launcher.launch(launchConfiguration); } @Test public void testFindSourceFile() { String sourceFilePath = toSourceFilePath(JUTProcessorUnusualImplementations.class); File sourceFile = findFileInFilesToProcess(sourceFilePath); assertTrue( "couldn't find " + sourceFilePath + " in files to process", sourceFile != null); } @Test public void testExistsSourceFile() { String sourceFilePath = toSourceFilePath(JUTProcessorUnusualImplementations.class); File sourceFile = findFileInFilesToProcess(sourceFilePath); assertTrue(sourceFilePath + " does not exist", sourceFile.exists()); } private File findFileInFilesToProcess(String sourceFilePath) { for (File file : Processor.FILES_TO_PROCESS) { if (file.getAbsolutePath() .replaceAll("\\\\", "\\" + File.separator) .endsWith(sourceFilePath)) { return file; } } return null; } }
package ua.training.model.enums; public enum Role { USER, ADMIN, UNKNOWN }
package com.moonlight.bioauth.sample; import android.content.Context; import android.widget.Toast; import androidx.biometric.BiometricPrompt; /** * BiometricPrompt callback class */ public class BiometricPromptHandler extends BiometricPrompt.AuthenticationCallback { private Context context = null; public BiometricPromptHandler(Context context) { this.context = context; } @Override public void onAuthenticationError(int errorCode, CharSequence errString) { super.onAuthenticationError(errorCode, errString); Toast.makeText(context, "ErrorCode: " + errorCode + "\nAuthentication error: " + errString, Toast.LENGTH_SHORT) .show(); } @Override public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) { super.onAuthenticationSucceeded(result); // Arrays.toString(encryptedInfo); Toast.makeText(context, "result : Authentication succeeded", Toast.LENGTH_SHORT).show(); } @Override public void onAuthenticationFailed() { super.onAuthenticationFailed(); Toast.makeText(context, "Authentication failed", Toast.LENGTH_SHORT) .show(); } }
package org.maven.ide.eclipse.authentication; public enum AuthenticationType { USERNAME_PASSWORD, CERTIFICATE, CERTIFICATE_AND_USERNAME_PASSWORD }
package pacman.ghost; import org.junit.Test; import org.junit.Before; import org.junit.After; import static org.junit.Assert.*; public class BlinkyTest { Blinky blinky1; @Before public void setup() { blinky1 = new Blinky(); } @After public void tearDown() { blinky1 = null; } @Test public void getColorTest() { String expected = "#d54e53"; assertEquals("getColour() is not working correctly for blinky1", expected, blinky1.getColour()); } @Test public void getTypeTest() { GhostType expected = GhostType.BLINKY; assertEquals("getType() is not working correctly for blinky1", expected, blinky1.getType()); } }
import java.sql.*; import java.awt.*; import java.text.*; import java.awt.event.*; import javax.swing.*; import java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; public class booking extends JFrame { private JLabel lblDate; private JLabel lblToStation; private JLabel lblFromStation; JPanel pnl1; JFormattedTextField tDate ; booking (String userName, String email, String password, String phnNum, String gender){ super ("Booking Ticket"); setLayout(new FlowLayout()); getContentPane().setBackground(Color.gray); pnl1=new JPanel(new GridLayout(6,1)); pnl1.setBorder(BorderFactory.createTitledBorder("Booking: ")); pnl1.setBackground(Color.GRAY); lblDate =new JLabel("Departure Date "); lblDate.setFont(new Font("Arial", Font.ITALIC, 14)); lblDate.setForeground(Color.BLUE); tDate = new JFormattedTextField(DateFormat.getDateInstance(DateFormat.SHORT)); tDate.setValue(new Date()); tDate.setColumns(15); lblFromStation =new JLabel("From Station "); lblFromStation.setFont(new Font("Arial", Font.ITALIC, 14)); lblFromStation.setForeground(Color.BLUE); String[] str= {"Lahore","Rawalpindi","Karachi","Islamabad"}; JComboBox fromStation=new JComboBox(str); String[] str2={"Lahore","Rawalpindi","Karachi","Islamabad","Quetta","Sialkot","Multan","Sargodha","Sahiwal"}; lblToStation =new JLabel("To Station "); lblToStation.setFont(new Font("Arial", Font.ITALIC, 14)); lblToStation.setForeground(Color.BLUE); JComboBox ToStation=new JComboBox(str2); JButton btn= new JButton(" Submit "); JButton btn2=new JButton(" Cancle Seat "); btn.setForeground(Color.BLUE); btn2.setForeground(Color.BLUE); add(pnl1); pnl1.add(lblDate); pnl1.add(tDate); pnl1.add(lblFromStation); pnl1.add(fromStation); pnl1.add(lblToStation); pnl1.add(ToStation); add(btn); add(btn2); btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Station station=new Station((String) fromStation.getSelectedItem(),(String) ToStation.getSelectedItem(),userName,email,password,phnNum,gender,tDate.getText()); dispose(); } }); btn2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Cancle cancle=new Cancle(); cancle.setLocation(550,250); cancle.setSize(250,200); cancle.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); cancle.setVisible(true); dispose(); } }); } public static void main (String [] args) { } }