text
stringlengths
10
2.72M
package fr.lteconsulting.servlet.vue; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet( "/creationPartie.html" ) public class CreationPartieServlet extends VueServlet { private static final long serialVersionUID = 1L; @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException { vueCreationPartie( req, resp ); } }
import java.util.Scanner; public class BookClub { public static void main(String[] args) { int books; int points; Scanner key = new Scanner(System.in); System.out.println("How many books have you purcased? " ); books = key.nextInt(); if (books < 1) points = 0; else if(books == 1) points = 5; else if(books == 2) points = 15; else if(books == 3) points = 30; else points = 60; System.out.println("You've earned " + points + " points"); } }
package com.quickblox.sample.videochatwebrtcnew.activities; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.Toast; import com.crashlytics.android.Crashlytics; import com.quickblox.auth.QBAuth; import com.quickblox.auth.model.QBSession; import com.quickblox.chat.QBChatService; import com.quickblox.core.QBEntityCallbackImpl; import com.quickblox.core.QBSettings; import com.quickblox.sample.videochatwebrtcnew.R; import com.quickblox.sample.videochatwebrtcnew.User; import com.quickblox.sample.videochatwebrtcnew.adapters.UsersAdapter; import com.quickblox.sample.videochatwebrtcnew.definitions.Consts; import com.quickblox.sample.videochatwebrtcnew.holder.DataHolder; import com.quickblox.users.model.QBUser; import java.util.ArrayList; import java.util.List; import io.fabric.sdk.android.Fabric; /** * Created by tereha on 25.01.15. */ public class ListUsersActivity extends Activity { private static final String TAG = "ListUsersActivity"; private UsersAdapter usersListAdapter; private ListView usersList; private ProgressBar loginPB; private Context context; private static QBChatService chatService; private static ArrayList<User> users = DataHolder.createUsersList(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fabric.with(this, new Crashlytics()); setContentView(R.layout.activity_login); initUI(); QBSettings.getInstance().fastConfigInit(Consts.APP_ID, Consts.AUTH_KEY, Consts.AUTH_SECRET); if (getActionBar() != null) { getActionBar().setTitle(getResources().getString(R.string.opponentsListActionBarTitle)); } if (!QBChatService.isInitialized()) { QBChatService.init(this); chatService = QBChatService.getInstance(); } initUsersList(); } private void initUI() { usersList = (ListView) findViewById(R.id.usersListView); loginPB = (ProgressBar) findViewById(R.id.loginPB); loginPB.setVisibility(View.INVISIBLE); } public static int resourceSelector(int number) { int resStr = -1; switch (number) { case 0: resStr = R.drawable.shape_oval_spring_bud; break; case 1: resStr = R.drawable.shape_oval_orange; break; case 2: resStr = R.drawable.shape_oval_water_bondi_beach; break; case 3: resStr = R.drawable.shape_oval_blue_green; break; case 4: resStr = R.drawable.shape_oval_lime; break; case 5: resStr = R.drawable.shape_oval_mauveine; break; case 6: resStr = R.drawable.shape_oval_gentianaceae_blue; break; case 7: resStr = R.drawable.shape_oval_blue; break; case 8: resStr = R.drawable.shape_oval_blue_krayola; break; case 9: resStr = R.drawable.shape_oval_coral; break; default: resStr = resourceSelector(number % 10); } return resStr; } public static int selectBackgrounForOpponent(int number) { int resStr = -1; switch (number) { case 0: resStr = R.drawable.rectangle_rounded_spring_bud; break; case 1: resStr = R.drawable.rectangle_rounded_orange; break; case 2: resStr = R.drawable.rectangle_rounded_water_bondi_beach; break; case 3: resStr = R.drawable.rectangle_rounded_blue_green; break; case 4: resStr = R.drawable.rectangle_rounded_lime; break; case 5: resStr = R.drawable.rectangle_rounded_mauveine; break; case 6: resStr = R.drawable.rectangle_rounded_gentianaceae_blue; break; case 7: resStr = R.drawable.rectangle_rounded_blue; break; case 8: resStr = R.drawable.rectangle_rounded_blue_krayola; break; case 9: resStr = R.drawable.rectangle_rounded_coral; break; default: resStr = selectBackgrounForOpponent(number % 10); } return resStr; } public static int getUserIndex(int id) { int index = 0; for (User usr : users) { if (usr.getId().equals(id)) { index = (users.indexOf(usr)) + 1; break; } } return index; } private void initUsersList() { usersListAdapter = new UsersAdapter(this, users); usersList.setAdapter(usersListAdapter); usersList.setChoiceMode(ListView.CHOICE_MODE_SINGLE); usersList.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String login = usersListAdapter.getItem(position).getLogin(); String password = usersListAdapter.getItem(position).getPassword(); createSession(login, password); } }); } private void createSession(final String login, final String password) { loginPB.setVisibility(View.VISIBLE); final QBUser user = new QBUser(login, password); QBAuth.createSession(login, password, new QBEntityCallbackImpl<QBSession>() { @Override public void onSuccess(QBSession session, Bundle bundle) { Log.d(TAG, "onSuccess create session with params"); user.setId(session.getUserId()); loginPB.setVisibility(View.INVISIBLE); if (chatService.isLoggedIn()){ startCallActivity(login); } else { chatService.login(user, new QBEntityCallbackImpl<QBUser>() { @Override public void onSuccess(QBUser result, Bundle params) { Log.d(TAG, "onSuccess login to chat with params"); startCallActivity(login); } @Override public void onSuccess() { Log.d(TAG, "onSuccess login to chat"); startCallActivity(login); } @Override public void onError(List errors) { loginPB.setVisibility(View.INVISIBLE); Toast.makeText(ListUsersActivity.this, "Error when login", Toast.LENGTH_SHORT).show(); for (Object error : errors) { Log.d(TAG, error.toString()); } } }); } } @Override public void onSuccess() { super.onSuccess(); Log.d(TAG, "onSuccess create session"); } @Override public void onError(List<String> errors) { loginPB.setVisibility(View.INVISIBLE); Toast.makeText(ListUsersActivity.this, "Error when login, check test users login and password", Toast.LENGTH_SHORT).show(); } }); } private void startCallActivity(String login) { Intent intent = new Intent(ListUsersActivity.this, CallActivity.class); intent.putExtra("login", login); startActivityForResult(intent, Consts.CALL_ACTIVITY_CLOSE); } @Override protected void onStart() { super.onStart(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == Consts.CALL_ACTIVITY_CLOSE){ if (resultCode == Consts.CALL_ACTIVITY_CLOSE_WIFI_DISABLED) { Toast.makeText(this, getString(R.string.WIFI_DISABLED),Toast.LENGTH_LONG).show(); } } } }
package com.tencent.mm.ui.chatting.i; import android.content.Context; import android.view.View; import com.tencent.mm.kernel.g; import com.tencent.mm.plugin.messenger.a.e; import java.lang.ref.WeakReference; import java.util.LinkedList; import java.util.Map; import junit.framework.Assert; public abstract class a { WeakReference<b> tYP = null; public interface b { void a(View view, a aVar); void ay(LinkedList<String> linkedList); } abstract CharSequence a(Map<String, String> map, String str, WeakReference<Context> weakReference); abstract String cxK(); public a(b bVar) { Assert.assertNotNull(bVar); this.tYP = new WeakReference(bVar); ((e) g.l(e.class)).a(cxK(), new 1(this)); } public final void release() { ((e) g.l(e.class)).Gs(cxK()); } }
/** * Copyright 2008 Jens Dietrich Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package example.nz.org.take.compiler.example2; import nz.org.take.rt.ResultSet; import example.nz.org.take.compiler.example2.generated.CategorizeCustomers; import example.nz.org.take.compiler.example2.generated.CustomerCategory; /** * Script that queries the generated kb. * @author <a href="http://www-ist.massey.ac.nz/JBDietrich/">Jens Dietrich</a> */ public class Example { /** * Generate the sources for the example. * @param args */ public static void main(String[] args) throws Exception { CategorizeCustomers kb = new CategorizeCustomers(); Customer c = new Customer(); ResultSet<CustomerCategory> rs = kb.getCategory(c); CustomerCategory r1 = rs.next(); System.out.println(r1.category); } }
package com.dxt2.dagger4demo55; import android.widget.TextView; import java.util.Random; import dagger.Subcomponent; import dagger.android.AndroidInjector; /** * Created by Administrator on 2018/6/6 0006. */ // MainActivity中User对象的注入 //1.创建MainActicitySubComponent //MainActicitySubComponent是MainActicity对应的Component,它是应用层级Component的子Component,所以用@Subcomponent注解 //AndroidInjector是Activity的核心类,可以完成对Activity或Fragment的成员变量的注入, //可以用Builder类来创建MainActicitySubComponent的实例 /*@Subcomponent public interface MainActicitySubComponent extends AndroidInjector<MainActivity> { @Subcomponent.Builder abstract class Builder extends AndroidInjector.Builder<MainActivity> { } //在MainActicitySubCompont 内部类Builder中实现seedInstance(),并创建抽象方法textViewModule //接收TextViewModule对象作为参数,在seedInstance() 调用textViewModule()传入 TextViewModule实例 //这时 MainActicitySubCompont 就具有TextView的能力 }*/ @Subcomponent(modules = TextViewModule.class) public interface MainActicitySubComponent extends AndroidInjector<MainActivity> { @Subcomponent.Builder abstract class Builder extends AndroidInjector.Builder<MainActivity> { abstract void textViewModule(TextViewModule textViewModule); public void seedInstance(MainActivity instance) { textViewModule(new TextViewModule(instance)); } //TextView的注入 //在MainActicitySubCompont 内部类Builder中实现seedInstance(),并创建抽象方法textViewModule //接收TextViewModule对象作为参数,在seedInstance() 调用textViewModule()传入 TextViewModule实例 //这时 MainActicitySubCompont 就具有TextView的能力 //Fragment的注入 /* * Activity对应的注入器一般作为Application对应的注入器SubComponent, * 而Fragment对用的注入器可以是其他Activity Fragment 或者Application 对应Component的SubComponent, *这要看Fragment的Module是安装到哪个Component上 * * 在MainActivity的内部MainFragment中也注入一个User对象 * */ } }
package shahi.m.s.com.listviewcontextmenu; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.ContextMenu; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { private ListView listView; private List<String> list = new ArrayList<>(); private ArrayAdapter<String> adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = (ListView) findViewById(R.id.listView); list.add("1 Pritom"); list.add("2 Mustafiz"); list.add("3 Fuad"); list.add("4 Anik"); list.add("5 Mithun"); list.add("6 Komol"); list.add("7 Pankaj"); list.add("8 Mijan"); list.add("9 Hridoy"); list.add("10 Shahi"); adapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, list); listView.setAdapter(adapter); // registerForContextMenu(listView); } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.delete_context, menu); } @Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case R.id.delete_context: list.remove(info.position); adapter.notifyDataSetChanged(); return true; default: return super.onContextItemSelected(item); } } }
package pers.th.idea; import com.jcraft.jsch.Channel; import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Scanner; /** * Created by Tianhao on 2018-3-16. * {@link SSHConnect} */ public class SSHConnect { private Channel channel; private Session session; private InputStream input; private OutputStream output; public void authorization(String user) throws Exception { send("sudo chown " + user + " * -R"); send("sudo chmod 777 * -R"); } public String send(String cmd) throws Exception { output.write(cmd.concat("\n").getBytes()); output.flush(); byte[] buffer = new byte[1024]; int length = -1; Thread.sleep(500); StringBuilder response = new StringBuilder(); while (input.available() != 0 && (length = input.read(buffer)) != -1) { response.append(new String(buffer, 0, length, "utf-8")); } if (response.toString().trim().endsWith("[sudo] password for user:") || response.toString().trim().endsWith("Password:")) { send("version"); } Notif.alert("Tomcat Restart",response.toString()); return response.toString(); } public void call() throws Exception { Scanner scanner = new Scanner(System.in); do { byte[] buffer = new byte[1024]; int length = -1; Thread.sleep(300); StringBuffer response = new StringBuffer(); while (input.available() != 0 && (length = input.read(buffer)) != -1) { response.append(new String(buffer, 0, length, "utf-8")); } System.out.print(response); if (response.toString().trim().endsWith("[sudo] password for user:") || response.toString().trim().endsWith("Password:")) { output.write("version\n".getBytes()); } else { output.write(scanner.nextLine().concat("\n").getBytes()); } output.flush(); Thread.sleep(300); } while (input.available() != 0); scanner.close(); } public void close() throws IOException { session.disconnect(); channel.disconnect(); close(input); close(output); } public void close(Closeable closeable) throws IOException { if (closeable != null) { closeable.close(); } } public void session(String host, String user, String pwd, int port) throws Exception { session = new JSch().getSession(user, host, port); session.setPassword(pwd); session.setConfig("StrictHostKeyChecking", "no"); session.connect(30000); channel = session.openChannel("shell"); channel.connect(1000); input = channel.getInputStream(); output = channel.getOutputStream(); } }
package com.bytedance.sandboxapp.c.a.a; import d.f.b.g; import d.f.b.l; public abstract class b { public static final b Companion = new b(null); public final com.bytedance.sandboxapp.protocol.service.api.a.a apiRuntime; public final com.bytedance.sandboxapp.b.a context; private b mNextHandler; public b(com.bytedance.sandboxapp.protocol.service.api.a.a parama) { this.apiRuntime = parama; this.context = this.apiRuntime.getContext(); } public final void addApiPreHandlerAtLast(b paramb) { // Byte code: // 0: aload_0 // 1: monitorenter // 2: aload_0 // 3: getfield mNextHandler : Lcom/bytedance/sandboxapp/c/a/a/b; // 6: ifnonnull -> 17 // 9: aload_0 // 10: aload_1 // 11: putfield mNextHandler : Lcom/bytedance/sandboxapp/c/a/a/b; // 14: aload_0 // 15: monitorexit // 16: return // 17: aload_0 // 18: getfield mNextHandler : Lcom/bytedance/sandboxapp/c/a/a/b; // 21: astore_2 // 22: aload_2 // 23: ifnull -> 72 // 26: aload_2 // 27: getfield mNextHandler : Lcom/bytedance/sandboxapp/c/a/a/b; // 30: astore_3 // 31: goto -> 34 // 34: aload_3 // 35: ifnull -> 46 // 38: aload_2 // 39: getfield mNextHandler : Lcom/bytedance/sandboxapp/c/a/a/b; // 42: astore_2 // 43: goto -> 22 // 46: aload_2 // 47: ifnull -> 58 // 50: aload_2 // 51: aload_1 // 52: putfield mNextHandler : Lcom/bytedance/sandboxapp/c/a/a/b; // 55: aload_0 // 56: monitorexit // 57: return // 58: aload_0 // 59: monitorexit // 60: return // 61: astore_1 // 62: aload_0 // 63: monitorexit // 64: goto -> 69 // 67: aload_1 // 68: athrow // 69: goto -> 67 // 72: aconst_null // 73: astore_3 // 74: goto -> 34 // Exception table: // from to target type // 2 14 61 finally // 17 22 61 finally // 26 31 61 finally // 38 43 61 finally // 50 55 61 finally } public final com.bytedance.sandboxapp.protocol.service.api.entity.b continuePreHandleApi(a parama) { l.b(parama, "blockHandleApiInfo"); b b1 = this.mNextHandler; if (b1 != null) { com.bytedance.sandboxapp.protocol.service.api.entity.b b2 = b1.triggerPreHandleApi(parama.a, parama.b); } else { b1 = null; } return (com.bytedance.sandboxapp.protocol.service.api.entity.b)((b1 != null) ? b1 : parama.b.handleApiInvoke(parama.a)); } protected abstract com.bytedance.sandboxapp.protocol.service.api.entity.b preHandleApi(com.bytedance.sandboxapp.protocol.service.api.entity.a parama, a parama1); public final com.bytedance.sandboxapp.protocol.service.api.entity.b triggerPreHandleApi(com.bytedance.sandboxapp.protocol.service.api.entity.a parama, a parama1) { l.b(parama, "apiInvokeInfo"); l.b(parama1, "apiHandler"); for (b b1 = this; b1 != null; b1 = b1.mNextHandler) { com.bytedance.sandboxapp.protocol.service.api.entity.b b2 = b1.preHandleApi(parama, parama1); if (b2 != null) return b2; } return null; } public final class a { public final com.bytedance.sandboxapp.protocol.service.api.entity.a a; public final a b; public a(b this$0, com.bytedance.sandboxapp.protocol.service.api.entity.a param1a, a param1a1) { this.a = param1a; this.b = param1a1; Boolean bool = this.b.apiInfoEntity.F; l.a(bool, "mApiHandler.apiInfoEntity.syncCall"); if (bool.booleanValue()) com.bytedance.sandboxapp.b.a.a.b.b.logOrThrow("AbsApiPreHandler", new Object[] { "只有异步 Api 才可以被 Block 执行" }); } } public static final class b { private b() {} } } /* Location: C:\Users\august\Desktop\tik\df_miniapp\classes.jar!\com\bytedance\sandboxapp\c\a\a\b.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
package exercise.testexercise.model; import com.sun.istack.NotNull; import lombok.Data; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import java.util.UUID; @Data @Entity public class Point { @Id @GeneratedValue @Column(columnDefinition = "uuid", updatable = false) private UUID id; @NotNull private double x; @NotNull private double y; }
package com.smxknife.java2.classloader.interfaceInDifferentClassloader; /** * @author smxknife * 2019/12/29 */ public interface InterfaceDemo { }
import java.io.FileNotFoundException; import org.json.simple.JSONObject; import org.testng.annotations.Test; import io.restassured.response.Response; public class PostReq extends BaseClass { @Test public void postcall() throws FileNotFoundException { Response res=BaseClass.request("POST","https://reqres.in/api/users"); System.out.println(res.asString()); } }
package com.tencent.mm.plugin.sns.a.b; import android.util.Base64; import com.tencent.mm.modelsns.d; import com.tencent.mm.modelstat.p; import com.tencent.mm.plugin.sns.model.af; import com.tencent.mm.plugin.sns.storage.e; import com.tencent.mm.plugin.sns.storage.n; import com.tencent.mm.protocal.c.bqw; import com.tencent.mm.protocal.c.bqx; import com.tencent.mm.protocal.c.bsu; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import java.io.IOException; public final class f { public static void a(String str, d dVar) { n Nk = af.byo().Nk(str); if (Nk != null) { bsu bAJ = Nk.bAJ(); if (bAJ != null) { p.a(bAJ.nNV, dVar); return; } x.v("SnsAdExtUtil", "timeLineObject null, snsId %s", new Object[]{str}); return; } x.v("SnsAdExtUtil", "snsInfo null, snsId %s", new Object[]{str}); } public static String a(long j, Object... objArr) { af.byi(); StringBuilder stringBuilder = new StringBuilder(i.n(objArr)); a(j, stringBuilder); return stringBuilder.toString(); } public static void a(long j, StringBuilder stringBuilder) { e eZ = af.byr().eZ(j); if (eZ != null) { bsu bAJ = eZ.bAJ(); if (bAJ != null) { bqx nn = p.nn(bAJ.nNV); stringBuilder.append(",").append(nn == null ? -1 : nn.source); stringBuilder.append(",").append(p.a(nn)); return; } x.v("SnsAdExtUtil", "l timeLineObject null, snsId %d", new Object[]{Long.valueOf(j)}); stringBuilder.append(",,"); return; } x.v("SnsAdExtUtil", "l snsInfo null, snsId %d", new Object[]{Long.valueOf(j)}); stringBuilder.append(",,"); } public static String a(bsu bsu) { if (bsu != null) { return Lu(bsu.nNV); } x.v("SnsAdExtUtil", "getSnsStatExt timeLineObject null"); return null; } private static String Lu(String str) { if (bi.oW(str)) { return ""; } byte[] decode = Base64.decode(str, 0); bqw bqw = new bqw(); try { bqw.aG(decode); return p.a(bqw.soW); } catch (IOException e) { x.e("SnsAdExtUtil", "", new Object[]{e}); return ""; } } }
package com.tencent.mm.plugin.webview.modelcache; import android.net.Uri; import android.webkit.URLUtil; import com.tencent.mm.a.g; import com.tencent.mm.modelsfs.FileOp; import com.tencent.mm.opensdk.modelmsg.WXMediaMessage; import com.tencent.mm.plugin.appbrand.jsapi.appdownload.JsApiPauseDownloadTask; import com.tencent.mm.plugin.webview.ui.tools.jsapi.i; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.FileNotFoundException; import java.net.HttpURLConnection; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; public final class p { public static boolean vN(String str) { return !bi.oW(str) && (URLUtil.isHttpsUrl(str) || URLUtil.isHttpUrl(str)); } public static String QB(String str) { String str2; if (!vN(str)) { return null; } try { URI uri = new URI(str); String toLowerCase = bi.oV(uri.getScheme()).toLowerCase(); String toLowerCase2 = bi.oV(uri.getHost()).toLowerCase(); if (bi.oW(toLowerCase2)) { return null; } int port = uri.getPort() == -1 ? toLowerCase.equalsIgnoreCase("http") ? 80 : JsApiPauseDownloadTask.CTRL_INDEX : uri.getPort(); str = toLowerCase + "://" + toLowerCase2 + ":" + port + "/" + bi.oV(uri.getPath()) + (bi.oW(uri.getQuery()) ? "" : "?" + uri.getQuery()) + (bi.oW(uri.getFragment()) ? "" : "#" + uri.getFragment()); if (str.endsWith("/")) { str = str + "/"; } return QC(str); } catch (URISyntaxException e) { str2 = str; x.e("MicroMsg.WebViewCacheUtils", "getFormattedHttpURL URISyntaxException : %s", new Object[]{e.getMessage()}); return str2; } catch (Exception e2) { str2 = str; x.e("MicroMsg.WebViewCacheUtils", "getFormattedHttpURL normal : %s", new Object[]{e2.getMessage()}); return str2; } } private static String QC(String str) { Uri parse = Uri.parse(str); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(parse.getScheme()).append("://"); stringBuilder.append(parse.getHost()).append(":").append(parse.getPort()); if (bi.cX(parse.getPathSegments())) { stringBuilder.append("/"); } else { for (String append : parse.getPathSegments()) { stringBuilder.append("/").append(append); } } if (!bi.oW(parse.getQuery())) { stringBuilder.append("?").append(parse.getQuery()); } if (!bi.oW(parse.getFragment())) { stringBuilder.append("#").append(parse.getFragment()); } if (str.endsWith("/")) { stringBuilder.append("/"); } return stringBuilder.toString(); } public static String QD(String str) { String QB = QB(str); if (bi.oW(QB)) { return null; } return Uri.parse(QB).getHost(); } public static String QE(String str) { String QF = QF(str); return bi.oW(QF) ? null : QF.replaceAll("http://", "").replaceAll("https://", ""); } public static String QF(String str) { String QB = QB(str); if (bi.oW(QB)) { x.e("MicroMsg.WebViewCacheUtils", "evaluateResURLWithScheme, original url is invalid = %s", new Object[]{str}); return null; } Uri parse = Uri.parse(QB); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(parse.getScheme()).append("://").append(parse.getHost()).append(":").append(parse.getPort()); if (!bi.cX(parse.getPathSegments())) { for (String QB2 : parse.getPathSegments()) { stringBuilder.append("/").append(bi.oV(QB2)); } } if (str.endsWith("/")) { stringBuilder.append("/"); } return stringBuilder.toString(); } public static byte[] QG(String str) { Exception e; Throwable th; Closeable byteArrayOutputStream; Closeable inputStream; try { byteArrayOutputStream = new ByteArrayOutputStream(); try { HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection(); httpURLConnection.setRequestMethod("GET"); int responseCode = httpURLConnection.getResponseCode(); int contentLength = httpURLConnection.getContentLength(); x.d("MicroMsg.WebViewCacheUtils", "getBytesFromURL, url = %s, statusCode = %d, contentLength = %d", new Object[]{str, Integer.valueOf(responseCode), Integer.valueOf(contentLength)}); inputStream = httpURLConnection.getInputStream(); if (inputStream != null) { try { byte[] bArr = new byte[WXMediaMessage.DESCRIPTION_LENGTH_LIMIT]; while (true) { contentLength = inputStream.read(bArr); if (contentLength != -1) { byteArrayOutputStream.write(bArr, 0, contentLength); } else { bArr = byteArrayOutputStream.toByteArray(); bi.d(inputStream); bi.d(byteArrayOutputStream); return bArr; } } } catch (Exception e2) { e = e2; try { x.e("MicroMsg.WebViewCacheUtils", "getBytesFromURL, url = %s, e = %s", new Object[]{str, e}); bi.d(inputStream); bi.d(byteArrayOutputStream); return null; } catch (Throwable th2) { th = th2; bi.d(inputStream); bi.d(byteArrayOutputStream); throw th; } } } bi.d(inputStream); bi.d(byteArrayOutputStream); return null; } catch (Exception e3) { e = e3; inputStream = null; } catch (Throwable th3) { th = th3; inputStream = null; bi.d(inputStream); bi.d(byteArrayOutputStream); throw th; } } catch (Exception e4) { e = e4; byteArrayOutputStream = null; inputStream = null; x.e("MicroMsg.WebViewCacheUtils", "getBytesFromURL, url = %s, e = %s", new Object[]{str, e}); bi.d(inputStream); bi.d(byteArrayOutputStream); return null; } catch (Throwable th4) { th = th4; byteArrayOutputStream = null; inputStream = null; bi.d(inputStream); bi.d(byteArrayOutputStream); throw th; } } public static String QH(String str) { FileNotFoundException e; Throwable th; Exception e2; String str2 = null; if (FileOp.cn(str)) { Closeable openRead; try { int mI = (int) FileOp.mI(str); openRead = FileOp.openRead(str); try { str2 = g.b(openRead, mI); bi.d(openRead); } catch (FileNotFoundException e3) { e = e3; try { x.e("MicroMsg.WebViewCacheUtils", "getContentMd5, localPath = %s, exception = %s", new Object[]{str, e}); bi.d(openRead); return str2; } catch (Throwable th2) { th = th2; bi.d(openRead); throw th; } } catch (Exception e4) { e2 = e4; x.e("MicroMsg.WebViewCacheUtils", "getContentMd5, localPath = %s, exception = %s", new Object[]{str, e2}); bi.d(openRead); return str2; } } catch (FileNotFoundException e5) { e = e5; openRead = str2; } catch (Exception e6) { e2 = e6; openRead = str2; x.e("MicroMsg.WebViewCacheUtils", "getContentMd5, localPath = %s, exception = %s", new Object[]{str, e2}); bi.d(openRead); return str2; } catch (Throwable th3) { th = th3; openRead = str2; bi.d(openRead); throw th; } } return str2; } public static int a(i iVar) { if (!bi.oV(iVar.qkl).equals("cache")) { return -1; } if (!Boolean.parseBoolean((String) iVar.mcy.get("async")) || bi.oW((String) iVar.mcy.get("src"))) { return !bi.oW((String) iVar.mcy.get("resourceList")) ? 1 : -1; } else { return 2; } } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package tictactoe_ab_pruning; /** * * @author mnemonic */ public class Cell { public Seed content; public Cell() { this.content = Seed.EMPTY; } }
package com.muryang.sureforprice.crawler; public class HttpResponseHeader { }
/** * */ package com.cnk.travelogix.supplier.core.daos; import java.util.List; import com.cnk.travelogix.masterdata.core.enums.PolicyDefinedByType; import com.cnk.travelogix.supplier.masterdata.core.model.AccoDynamicPolicyModel; /** * Find FlightProduct for given to fetch from, to , percentage * */ public interface AccoDynamicPolicyDao { public List<AccoDynamicPolicyModel> fetchFromToAndPercentage(final Double chargesInPercentage, final Integer fromDaysHour, final Integer toDaysHour); /** * @param fromDaysHour * @param toDaysHour * @return */ List<AccoDynamicPolicyModel> fetchSlabOfDayAndHour(Integer fromDaysHour, Integer toDaysHour); /** * @param chargeNight * @return */ List<AccoDynamicPolicyModel> checkDuplicacyOfChargeNight(Double chargeNight); /** * @param chargesAmount * @return */ List<AccoDynamicPolicyModel> checkDuplicacyOfChargeAmout(Double chargesAmount); /** * @param chargesInPercentage * @return */ List<AccoDynamicPolicyModel> checkDuplicacyOfChargeInPer(Double chargesInPercentage); public AccoDynamicPolicyModel checkContinuationOfSlab(Integer fromDaysHour, Integer toDaysHour, PolicyDefinedByType definedBy); }
package com.tencent.mm.plugin.sns.model; import android.os.Looper; import com.tencent.mm.ab.b; import com.tencent.mm.ab.b.a; import com.tencent.mm.ab.e; import com.tencent.mm.ab.l; import com.tencent.mm.kernel.g; import com.tencent.mm.network.k; import com.tencent.mm.network.q; import com.tencent.mm.platformtools.ab; import com.tencent.mm.plugin.appbrand.jsapi.f.m; import com.tencent.mm.plugin.sns.a.b.f; import com.tencent.mm.plugin.sns.i$l; import com.tencent.mm.plugin.sns.storage.i; import com.tencent.mm.plugin.sns.storage.n; import com.tencent.mm.protocal.c.bhy; import com.tencent.mm.protocal.c.bny; import com.tencent.mm.protocal.c.bob; import com.tencent.mm.protocal.c.bog; import com.tencent.mm.protocal.c.bon; import com.tencent.mm.protocal.c.box; import com.tencent.mm.protocal.c.boy; import com.tencent.mm.protocal.c.bpb; import com.tencent.mm.protocal.c.bpc; import com.tencent.mm.protocal.c.bpd; import com.tencent.mm.protocal.c.bpe; import com.tencent.mm.protocal.c.bpf; import com.tencent.mm.protocal.c.bpl; import com.tencent.mm.sdk.platformtools.ag; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.storage.aa; import java.util.Iterator; import java.util.LinkedList; public final class r extends l implements k { private b diG; public e diJ; private ag handler; public int nkZ; private long nod; private bon noe; private Object nof; private int nog; public int type; public r(long j, int i) { this(j, i, null, null); } public r(long j, int i, Object obj) { this(j, i, null, obj); } public r(long j, int i, bon bon) { this(j, i, bon, null); } private r(long j, int i, bon bon, Object obj) { this.type = -1; this.nod = 0; this.nkZ = -1; this.nog = 0; this.handler = new ag(Looper.getMainLooper()); this.noe = bon; this.type = i; this.nod = j; this.nof = obj; x.i("MicroMsg.NetSceneSnsObjectOp", "snsId : " + j + " op : " + i); if (bon != null) { x.i("MicroMsg.NetSceneSnsObjectOp", bon.smh + " " + bon.smk); } a aVar = new a(); aVar.dIG = new bpe(); aVar.dIH = new bpf(); aVar.uri = "/cgi-bin/micromsg-bin/mmsnsobjectop"; aVar.dIF = 218; aVar.dII = i$l.AppCompatTheme_editTextStyle; aVar.dIJ = 1000000104; this.diG = aVar.KT(); bpe bpe = (bpe) this.diG.dID.dIL; n fi = af.byo().fi(j); if (fi != null) { this.nkZ = fi.nJc; } bpb a = a(j, i, this.noe, obj); LinkedList linkedList = new LinkedList(); linkedList.add(a); bpe.snh = linkedList; bpe.sng = linkedList.size(); } public r(long j, int i, int i2, String str) { this.type = -1; this.nod = 0; this.nkZ = -1; this.nog = 0; this.handler = new ag(Looper.getMainLooper()); this.noe = null; this.type = 9; this.nod = j; x.i("MicroMsg.NetSceneSnsObjectOp", "snsId : " + j + " op : " + this.type); a aVar = new a(); aVar.dIG = new bpe(); aVar.dIH = new bpf(); aVar.uri = "/cgi-bin/micromsg-bin/mmsnsobjectop"; aVar.dIF = 218; aVar.dII = i$l.AppCompatTheme_editTextStyle; aVar.dIJ = 1000000104; this.diG = aVar.KT(); bpe bpe = (bpe) this.diG.dID.dIL; n fi = af.byo().fi(j); if (fi != null) { this.nkZ = fi.nJc; } bpb y = y(j, this.type); bpd bpd = new bpd(); bpd.otY = i; bpd.sne = i2; bpd.snf = ab.oT(str); try { y.sbD = new bhy().bq(bpd.toByteArray()); } catch (Throwable e) { x.printErrStackTrace("MicroMsg.NetSceneSnsObjectOp", e, "", new Object[0]); } LinkedList linkedList = new LinkedList(); linkedList.add(y); bpe.snh = linkedList; bpe.sng = linkedList.size(); } private static bpb a(long j, int i, bon bon, Object obj) { n nVar; String str; bpb y = y(j, i); x.i("MicroMsg.NetSceneSnsObjectOp", "getSnsObjectOp " + i + " " + (obj == null ? "" : obj.toString())); String str2 = ""; if (i == 8 || i == 10 || i == 7 || i == 8 || i == 6) { n bAL; com.tencent.mm.plugin.sns.storage.e eZ = af.byr().eZ(j); if (eZ != null) { bAL = eZ.bAL(); } else { bAL = null; } if (bAL == null || !bAL.xb(32)) { nVar = bAL; } else { com.tencent.mm.plugin.sns.storage.a bAH = bAL.bAH(); str = bAH == null ? "" : bAH.ntU; x.i("MicroMsg.NetSceneSnsObjectOp", "aduxinfo " + str); str2 = str; nVar = bAL; } } else { nVar = null; } if (i == 6) { if (bon == null || (bon.smh == 0 && bon.smk == 0)) { return y; } bog bog = new bog(); bog.smd = bon.smk; bog.slT = ab.oT(bi.aG(str2, "")); try { y.sbD = new bhy().bq(bog.toByteArray()); } catch (Throwable e) { x.printErrStackTrace("MicroMsg.NetSceneSnsObjectOp", e, "", new Object[0]); } } else if (i == 7) { bny bny = new bny(); bny.slT = ab.oT(bi.aG(str2, "")); try { y.sbD = new bhy().bq(bny.toByteArray()); } catch (Throwable e2) { x.printErrStackTrace("MicroMsg.NetSceneSnsObjectOp", e2, "", new Object[0]); } } else if (i == 8) { int i2 = (obj == null || !(obj instanceof com.tencent.mm.plugin.sns.storage.a.b.a)) ? 0 : 1; if (i2 != 0) { com.tencent.mm.plugin.sns.storage.a.b.a aVar = (com.tencent.mm.plugin.sns.storage.a.b.a) obj; str = bi.aG(str2, "") + ("&" + aVar.nkJ + "|" + aVar.nyC); } else { str = str2; } bob bob = new bob(); bob.slT = ab.oT(bi.aG(str, "")); if (nVar != null) { bob.rdq = nVar.bBq(); nVar = af.byo().Nk(nVar.bAK()); if (nVar != null) { str = f.a(nVar.bAJ()); } else { x.v("SnsAdExtUtil", "getSnsStatExtBySnsId snsInfo null, snsId %s", new Object[]{str}); str = ""; } bob.slV = ab.oT(bi.aG(str, "")); } if (i2 == 0 || ((com.tencent.mm.plugin.sns.storage.a.b.a) obj).nyB != com.tencent.mm.plugin.sns.storage.a.b.a.nyx) { af.byr().delete(j); af.byt().fd(j); i.fc(j); if (i2 != 0) { bob.slW = ((com.tencent.mm.plugin.sns.storage.a.b.a) obj).nyB; } } else { bob.slW = com.tencent.mm.plugin.sns.storage.a.b.a.nyx; } try { y.sbD = new bhy().bq(bob.toByteArray()); } catch (Throwable e22) { x.printErrStackTrace("MicroMsg.NetSceneSnsObjectOp", e22, "", new Object[0]); } } else if (i == 4) { if (bon == null || (bon.smh == 0 && bon.smk == 0)) { return y; } bpc bpc = new bpc(); bpc.smh = bon.smh; try { y.sbD = new bhy().bq(bpc.toByteArray()); } catch (Throwable e222) { x.printErrStackTrace("MicroMsg.NetSceneSnsObjectOp", e222, "", new Object[0]); } } else if (i == 10) { bpl bpl = new bpl(); if (obj instanceof com.tencent.mm.bk.b) { com.tencent.mm.bk.b bVar = (com.tencent.mm.bk.b) obj; bpl.snz = ab.O(bVar.lR); x.i("MicroMsg.NetSceneSnsObjectOp", "NetSceneSnsObjectOpticket " + bVar.lR.length); } else { x.e("MicroMsg.NetSceneSnsObjectOp", "error ticket"); } try { byte[] toByteArray = bpl.toByteArray(); y.sbD = new bhy().bq(toByteArray); x.i("MicroMsg.NetSceneSnsObjectOp", "opFree " + toByteArray.length); } catch (Throwable e2222) { x.e("MicroMsg.NetSceneSnsObjectOp", "error ticket " + e2222.getMessage()); x.printErrStackTrace("MicroMsg.NetSceneSnsObjectOp", e2222, "", new Object[0]); } } else if (i == 12) { if (obj instanceof box) { box box = (box) obj; try { y.sbD = ab.O(box.toByteArray()); x.i("MicroMsg.NetSceneSnsObjectOp", "snsMetionBlockOp, switch:%d " + box.smG); } catch (Exception e3) { x.e("MicroMsg.NetSceneSnsObjectOp", "error snsMetionBlockOp " + e3.getMessage()); } } else { x.e("MicroMsg.NetSceneSnsObjectOp", "error snsMetionBlockOp"); } } return y; } private static bpb y(long j, int i) { bpb bpb = new bpb(); bpb.sbD = new bhy(); bpb.rlK = j; bpb.jRb = i; return bpb; } public final int a(com.tencent.mm.network.e eVar, e eVar2) { this.diJ = eVar2; return a(eVar, this.diG, this); } public final int getType() { return 218; } public final void a(int i, int i2, int i3, String str, q qVar, byte[] bArr) { x.i("MicroMsg.NetSceneSnsObjectOp", "netId : " + i + " errType :" + i2 + " errCode: " + i3 + " errMsg :" + str); if (i2 == 0 && i3 == 0) { n fi; boy boy; Iterator it; Object obj; switch (this.type) { case 1: af.byn().eT(this.nod); af.byo().delete(this.nod); break; case 2: fi = af.byo().fi(this.nod); if (fi != null) { fi.field_pravited = 1; fi.bAY(); af.byo().b(this.nod, fi); break; } break; case 3: fi = af.byo().fi(this.nod); if (fi != null) { fi.field_pravited = 0; fi.field_localPrivate = 0; fi.bBb(); af.byo().b(this.nod, fi); break; } break; case 4: n fi2 = af.byo().fi(this.nod); if (fi2 != null) { try { boy = (boy) new boy().aG(fi2.field_attrBuf); it = boy.smO.iterator(); while (it.hasNext()) { obj = (bon) it.next(); if (this.noe != null && obj.smh == this.noe.smh) { if (obj != null) { boy.smO.remove(obj); } fi2.aK(boy.toByteArray()); af.byo().z(fi2); af.byt().d(fi2.field_snsId, (long) this.noe.smh, this.noe.hcE); break; } } obj = null; if (obj != null) { boy.smO.remove(obj); } fi2.aK(boy.toByteArray()); af.byo().z(fi2); af.byt().d(fi2.field_snsId, (long) this.noe.smh, this.noe.hcE); } catch (Throwable e) { x.printErrStackTrace("MicroMsg.NetSceneSnsObjectOp", e, "", new Object[0]); break; } } break; case 5: af.byn().eV(this.nod); break; case 6: com.tencent.mm.plugin.sns.storage.e eZ = af.byr().eZ(this.nod); if (eZ != null) { try { boy = (boy) new boy().aG(eZ.field_attrBuf); it = boy.smO.iterator(); while (it.hasNext()) { obj = (bon) it.next(); if (this.noe != null && obj.smk == this.noe.smk) { if (obj != null) { boy.smO.remove(obj); } eZ.aK(boy.toByteArray()); af.byr().a(eZ); af.byt().d(eZ.field_snsId, this.noe.smk, this.noe.hcE); break; } } obj = null; if (obj != null) { boy.smO.remove(obj); } eZ.aK(boy.toByteArray()); af.byr().a(eZ); af.byt().d(eZ.field_snsId, this.noe.smk, this.noe.hcE); } catch (Throwable e2) { x.printErrStackTrace("MicroMsg.NetSceneSnsObjectOp", e2, "", new Object[0]); break; } } break; case 7: af.byn().eV(this.nod); break; case 8: if (!(this.nof != null && (this.nof instanceof com.tencent.mm.plugin.sns.storage.a.b.a) && ((com.tencent.mm.plugin.sns.storage.a.b.a) this.nof).nyB == com.tencent.mm.plugin.sns.storage.a.b.a.nyx)) { af.byr().delete(this.nod); af.byt().fd(this.nod); i.fc(this.nod); break; } case 9: fi = af.byo().fi(this.nod); if (fi != null) { fi.xc(2); af.byo().b(this.nod, fi); break; } break; case 11: x.i("MicroMsg.NetSceneSnsObjectOp", "scene end switch " + this.nog); if (this.nog == 0) { g.Ek(); g.Ei().DT().a(aa.a.sSw, Boolean.valueOf(true)); } else if (this.nog == 1) { g.Ek(); g.Ei().DT().a(aa.a.sSw, Boolean.valueOf(false)); } g.Ek(); int intValue = ((Integer) g.Ei().DT().get(aa.a.sSy, Integer.valueOf(0))).intValue(); g.Ek(); g.Ei().DT().a(aa.a.sSy, Integer.valueOf(intValue + 1)); g.Ek(); intValue = ((Integer) g.Ei().DT().get(aa.a.sSz, Integer.valueOf(0))).intValue(); int i4; if (this.nog == 0) { intValue++; i4 = (intValue * 2) + 198; if (i4 >= 216) { i4 = 216; } if (i4 >= m.CTRL_INDEX) { com.tencent.mm.plugin.sns.lucky.a.b.kB(i4); } x.i("MicroMsg.NetSceneSnsObjectOp", "opcount open " + i4 + " " + intValue); } else if (this.nog == 1) { intValue++; i4 = ((intValue * 2) + 198) + 1; if (i4 >= 217) { i4 = 217; } if (i4 >= 201) { com.tencent.mm.plugin.sns.lucky.a.b.kB(i4); } x.i("MicroMsg.NetSceneSnsObjectOp", "opcount close " + i4 + " " + intValue); } g.Ek(); g.Ei().DT().a(aa.a.sSz, Integer.valueOf(intValue)); break; case 12: if (this.nof != null && (this.nof instanceof box)) { af.byt().s(this.nod, ((box) this.nof).smG == 1); x.i("MicroMsg.NetSceneSnsObjectOp", "remind update [snsId:%d] ->isSilence: %b", new Object[]{Long.valueOf(this.nod), Boolean.valueOf(r0)}); break; } } af.byn().bxP(); this.diJ.a(i2, i3, str, this); return; } if (i2 == 4 && this.type == 1) { switch (this.type) { case 1: af.byn().eT(this.nod); break; case 5: case 7: af.byn().eV(this.nod); break; } } this.diJ.a(i2, i3, str, this); } }
package com.mideas.rpg.v2.render; import static org.lwjgl.opengl.GL11.GL_DST_COLOR; import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA; import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_COLOR; import static org.lwjgl.opengl.GL11.GL_QUADS; import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA; import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D; import static org.lwjgl.opengl.GL11.glBegin; import static org.lwjgl.opengl.GL11.glDisable; import static org.lwjgl.opengl.GL11.glEnable; import static org.lwjgl.opengl.GL11.glEnd; import static org.lwjgl.opengl.GL14.GL_FUNC_ADD; import static org.lwjgl.opengl.GL14.glBlendFuncSeparate; import static org.lwjgl.opengl.GL20.glBlendEquationSeparate; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.ArrayList; import javax.imageio.ImageIO; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.GL11; import com.mideas.rpg.v2.Mideas; public final class Texture { private final static ArrayList<Texture> textureSetLoadOnStart = new ArrayList<Texture>(); private final static ArrayList<Texture> textureSetLoadAsync = new ArrayList<Texture>(); public static volatile boolean asyncTextureLoadFinished; public static boolean generatingTextureIdAsync; private static int currentTextureLoadAsyncIndex; private ByteBuffer textureDatas; private static boolean textureLoaded = false; private int textureID; private int height; private int width; private File file; public Texture(String string, boolean directLoad, boolean loadOnStart) { this(new File(string), directLoad, loadOnStart); } public Texture(String string, boolean loadOnStart) { this(new File(string), loadOnStart); } public Texture(final File file, boolean loadOnStart) { this.file = file; if (loadOnStart) { textureSetLoadOnStart.add(this); } else textureSetLoadAsync.add(this); /*try { BufferedImage image = ImageIO.read(file); final int width = image.getWidth(); final int height = image.getHeight(); final int[] pixels = new int[width*height]; final ByteBuffer buffer = ByteBuffer.allocateDirect(width*height*4).order(ByteOrder.nativeOrder()); image.getRGB(0, 0, width, height, pixels, 0, width); int i = -1; while(++i < pixels.length) { buffer.put((byte)(pixels[i]>>16)); buffer.put((byte)(pixels[i]>>8)); buffer.put((byte) pixels[i]); buffer.put((byte)(pixels[i]>>24)); } buffer.position(0); this.textureID = OpenGL.glGenTextures(); OpenGL.glBindTexture(OpenGL.GL_TEXTURE_2D, this.textureID); OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_LINEAR); OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_LINEAR); //OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_NEAREST); //OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_NEAREST); OpenGL.glTexImage2D(OpenGL.GL_TEXTURE_2D, 0, OpenGL.GL_RGBA8, width, height, 0, OpenGL.GL_RGBA, OpenGL.GL_UNSIGNED_BYTE, buffer); this.height = height; this.width = width; } catch (IOException e) { e.printStackTrace(); this.height = 0; this.width = 0; this.textureID = 0; }*/ } public Texture(final File file, boolean directLoad, boolean loadOnStart) { if (directLoad) { try { BufferedImage image = ImageIO.read(file); final int width = image.getWidth(); final int height = image.getHeight(); final int[] pixels = new int[width*height]; final ByteBuffer buffer = ByteBuffer.allocateDirect(width*height*4).order(ByteOrder.nativeOrder()); image.getRGB(0, 0, width, height, pixels, 0, width); int i = -1; while(++i < pixels.length) { buffer.put((byte)(pixels[i]>>16)); buffer.put((byte)(pixels[i]>>8)); buffer.put((byte) pixels[i]); buffer.put((byte)(pixels[i]>>24)); } buffer.position(0); this.textureID = OpenGL.glGenTextures(); OpenGL.glBindTexture(OpenGL.GL_TEXTURE_2D, this.textureID); OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_LINEAR); OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_LINEAR); //OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_NEAREST); //OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_NEAREST); OpenGL.glTexImage2D(OpenGL.GL_TEXTURE_2D, 0, OpenGL.GL_RGBA8, width, height, 0, OpenGL.GL_RGBA, OpenGL.GL_UNSIGNED_BYTE, buffer); this.height = height; this.width = width; } catch (IOException e) { e.printStackTrace(); this.height = 0; this.width = 0; this.textureID = 0; } } else { this.file = file; if (loadOnStart) textureSetLoadOnStart.add(this); else textureSetLoadAsync.add(this); } } public void loadTextureDatasAsync() { try { BufferedImage image = ImageIO.read(this.file); final int width = image.getWidth(); final int height = image.getHeight(); final int[] pixels = new int[width*height]; this.textureDatas = ByteBuffer.allocateDirect(width*height*4).order(ByteOrder.nativeOrder()); image.getRGB(0, 0, width, height, pixels, 0, width); int i = -1; while(++i < pixels.length) { this.textureDatas.put((byte)(pixels[i]>>16)); this.textureDatas.put((byte)(pixels[i]>>8)); this.textureDatas.put((byte) pixels[i]); this.textureDatas.put((byte)(pixels[i]>>24)); } this.textureDatas.position(0); this.width = width; this.height = height; } catch (IOException e) { this.height = 0; this.width = 0; e.printStackTrace(); } } private void generateTextureIdAsync() { this.textureID = OpenGL.glGenTextures(); OpenGL.glBindTexture(OpenGL.GL_TEXTURE_2D, this.textureID); OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_LINEAR); OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_LINEAR); //OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_NEAREST); //OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_NEAREST); OpenGL.glTexImage2D(OpenGL.GL_TEXTURE_2D, 0, OpenGL.GL_RGBA8, this.width, this.height, 0, OpenGL.GL_RGBA, OpenGL.GL_UNSIGNED_BYTE, this.textureDatas); } public static void loadAllTextureDatasAsync() { Thread thread = new Thread(new LoadTextureRunnable()); thread.start(); generatingTextureIdAsync = true; } public static void generateNextTextureIdAsync() { if (!asyncTextureLoadFinished) return; int i = -1; while (++i < 10) { if (currentTextureLoadAsyncIndex < textureSetLoadAsync.size()) { textureSetLoadAsync.get(currentTextureLoadAsyncIndex).generateTextureIdAsync(); ++currentTextureLoadAsyncIndex; } else break; } if (currentTextureLoadAsyncIndex == textureSetLoadAsync.size()) { System.out.println("Texture id generation done"); generatingTextureIdAsync = false; } } private void loadTexture() { try { BufferedImage image = ImageIO.read(this.file); final int width = image.getWidth(); final int height = image.getHeight(); final int[] pixels = new int[width*height]; final ByteBuffer buffer = ByteBuffer.allocateDirect(width*height*4).order(ByteOrder.nativeOrder()); image.getRGB(0, 0, width, height, pixels, 0, width); int i = -1; while(++i < pixels.length) { buffer.put((byte)(pixels[i]>>16)); buffer.put((byte)(pixels[i]>>8)); buffer.put((byte) pixels[i]); buffer.put((byte)(pixels[i]>>24)); } buffer.position(0); this.textureID = OpenGL.glGenTextures(); OpenGL.glBindTexture(OpenGL.GL_TEXTURE_2D, this.textureID); OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_LINEAR); OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_LINEAR); //OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_NEAREST); //OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_NEAREST); OpenGL.glTexImage2D(OpenGL.GL_TEXTURE_2D, 0, OpenGL.GL_RGBA8, width, height, 0, OpenGL.GL_RGBA, OpenGL.GL_UNSIGNED_BYTE, buffer); this.height = height; this.width = width; } catch (IOException e) { e.printStackTrace(); this.height = 0; this.width = 0; this.textureID = 0; } } public static void loadAllTexture(boolean fastReload) { if (!textureLoaded) { textureLoaded = true; } Mideas.context2D(); if (fastReload) Display.setVSyncEnabled(false); Display.sync(1000); Mideas.updateDisplayFactor(); int i = -1; float barWidth = 700 * Mideas.getDisplayXFactor(); while (++i < textureSetLoadOnStart.size()) { if(Display.wasResized()) { Mideas.context2D(); Mideas.updateDisplayFactor(); barWidth = 700 * Mideas.getDisplayXFactor(); } textureSetLoadOnStart.get(i).loadTexture(); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); Draw.drawQuadBG(Sprites.loading_screen); Draw.drawQuad(Sprites.loading_screen_bar_progress, Display.getWidth() / 2 - barWidth / 2 + 25 * Mideas.getDisplayXFactor(), Display.getHeight() / 2 + 350 * Mideas.getDisplayYFactor() + 7, (int)(barWidth * i / textureSetLoadOnStart.size()) - 55 * Mideas.getDisplayXFactor(), 20); Draw.drawQuad(Sprites.loading_screen_bar, Display.getWidth() / 2 - barWidth / 2, Display.getHeight() / 2 + 350 * Mideas.getDisplayYFactor(), barWidth, 40 * Mideas.getDisplayYFactor()); Display.update(); Display.sync(1000); } if (fastReload) Display.setVSyncEnabled(true); } /*public Texture(final File file) throws IOException { final GZIPInputStream stream = new GZIPInputStream(new FileInputStream(file)); final byte[] dimensions = new byte[8]; int i = 0; while((i+= stream.read(dimensions, i, 8-i)) < 8) { //Wait for the dimensions to load } final int width = ((Byte.MAX_VALUE-dimensions[0])<<24)+((Byte.MAX_VALUE-dimensions[1])<<16)+((Byte.MAX_VALUE-dimensions[2])<<8)+(Byte.MAX_VALUE-dimensions[3]); final int height = ((Byte.MAX_VALUE-dimensions[4])<<24)+((Byte.MAX_VALUE-dimensions[5])<<16)+((Byte.MAX_VALUE-dimensions[6])<<8)+(Byte.MAX_VALUE-dimensions[7]); final byte[] pixels = new byte[width*height*4]; int total = 0; i = 0; final ByteBuffer buffer = ByteBuffer.allocateDirect(width*height*4).order(ByteOrder.nativeOrder()); while((total+= stream.read(pixels, total, pixels.length-total)) < pixels.length || i < total) { while(i < total) { buffer.put((pixels[i++])); } } stream.close(); buffer.position(0); this.textureID = OpenGL.glGenTextures(); OpenGL.glBindTexture(OpenGL.GL_TEXTURE_2D, this.textureID); OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_LINEAR); OpenGL.glTexParameteri(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_LINEAR); OpenGL.glTexImage2D(OpenGL.GL_TEXTURE_2D, 0, OpenGL.GL_RGBA8, width, height, 0, OpenGL.GL_RGBA, OpenGL.GL_UNSIGNED_BYTE, buffer); this.height = height; this.width = width; }*/ public final void drawBegin() { bind(); OpenGL.glColor4f(1, 1, 1, 1); OpenGL.glBegin(OpenGL.GL_QUADS); } @SuppressWarnings("static-method") public final void drawEnd() { OpenGL.glEnd(); } public final void drawBlendBegin() { glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA, GL_DST_COLOR); glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD); drawBegin(); } public final void drawBlendEnd() { drawEnd(); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } public final static void drawColorQuadBegin() { glDisable(GL_TEXTURE_2D); glBegin(GL_QUADS); } public final static void drawColorQuadEnd() { glEnd(); glEnable(GL_TEXTURE_2D); } public final void bind() { OpenGL.glBindTexture(OpenGL.GL_TEXTURE_2D, this.textureID); } public final int getImageWidth() { return this.width; } public final int getImageHeight() { return this.height; } public final int getWidth() { return this.width; } public final int getHeight() { return this.height; } public final int getTextureID() { return this.textureID; } public final static ArrayList<Texture> getAsynTextureList() { return (textureSetLoadAsync); } }
package com.university.wanstudy.model; /** * Created by dkk on 2016/4/20. */ public class IndexHot { private int id; private String updatedAt; private String name; private String description; private String shortDescription; private String teacherName; private String file; private String teacherDescription; private String logoUrl; private String teacherAvatarUrl; private String smallImgUrl; private String bigImgUrl; private String smallImgMobileUrl; private String homeSmallImgUrl; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUpdatedAt() { return updatedAt; } public void setUpdatedAt(String updatedAt) { this.updatedAt = updatedAt; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getShortDescription() { return shortDescription; } public void setShortDescription(String shortDescription) { this.shortDescription = shortDescription; } public String getTeacherName() { return teacherName; } public void setTeacherName(String teacherName) { this.teacherName = teacherName; } public String getFile() { return file; } public void setFile(String file) { this.file = file; } public String getTeacherDescription() { return teacherDescription; } public void setTeacherDescription(String teacherDescription) { this.teacherDescription = teacherDescription; } public String getLogoUrl() { return logoUrl; } public void setLogoUrl(String logoUrl) { this.logoUrl = logoUrl; } public String getTeacherAvatarUrl() { return teacherAvatarUrl; } public void setTeacherAvatarUrl(String teacherAvatarUrl) { this.teacherAvatarUrl = teacherAvatarUrl; } public String getSmallImgUrl() { return smallImgUrl; } public void setSmallImgUrl(String smallImgUrl) { this.smallImgUrl = smallImgUrl; } public String getBigImgUrl() { return bigImgUrl; } public void setBigImgUrl(String bigImgUrl) { this.bigImgUrl = bigImgUrl; } public String getSmallImgMobileUrl() { return smallImgMobileUrl; } public void setSmallImgMobileUrl(String smallImgMobileUrl) { this.smallImgMobileUrl = smallImgMobileUrl; } public String getHomeSmallImgUrl() { return homeSmallImgUrl; } public void setHomeSmallImgUrl(String homeSmallImgUrl) { this.homeSmallImgUrl = homeSmallImgUrl; } }
import com.espertech.esper.common.client.EventBean; import com.espertech.esper.runtime.client.EPRuntime; import com.espertech.esper.runtime.client.EPStatement; import com.espertech.esper.runtime.client.UpdateListener; /** 实现UpdateListener接口,来定义事件的后置处理过程 **/ public class Listener implements UpdateListener { public void update(EventBean[] eventBeans, EventBean[] eventBeans1, EPStatement epStatement, EPRuntime epRuntime) { try { System.out.println("event: ts-"+eventBeans[0].get("ts") + " company-"+eventBeans[0].get("company") + " px-"+eventBeans[0].get("px")); }catch(Exception e) { e.printStackTrace(); } } }
package com.jim.multipos.ui.customers.customer; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import com.jim.multipos.config.scope.PerFragment; import com.jim.multipos.ui.customers.adapter.CustomersAdapter; import dagger.Binds; import dagger.Module; import dagger.Provides; @Module(includes = CustomerFragmentPresenterModule.class) public abstract class CustomerFragmentModule { @Binds @PerFragment abstract Fragment provideFragment(CustomerFragment fragment); @Binds @PerFragment abstract CustomerFragmentView provideCustomerFragmentView(CustomerFragment fragment); @Provides @PerFragment static CustomersAdapter provideCustomersAdapter(AppCompatActivity context){ return new CustomersAdapter(context); } }
package com.example.myapplicationi; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; public class recycleradapter extends RecyclerView.Adapter<recycleradapter.countryholder> { String[] mCountries; String[] mstate; private LayoutInflater mInflater; public recycleradapter(String[] countries, String[] state, Context context){ mCountries = countries; mstate = state; mInflater = LayoutInflater.from(context); } @NonNull @Override public countryholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View mItemView = mInflater.inflate(R.layout.recycle_row, parent, false);//12 return new countryholder(mItemView); } @Override public void onBindViewHolder(@NonNull countryholder holder, int position) { holder.countryText.setText(mCountries[position]); //holder.countrypic.setImageIcon(); holder.countryname.setText(mstate[position]); } @Override public int getItemCount() { return mCountries.length; } public class countryholder extends RecyclerView.ViewHolder{ public TextView countryText; public ImageView countrypic; public TextView countryname; public countryholder(@NonNull View itemView) { super(itemView); countryText = itemView.findViewById(R.id.textViewcountry); countrypic = itemView.findViewById(R.id.imageView); countryname=itemView.findViewById(R.id.textViewstate); } } }
package com.tencent.mm.plugin.aa.a; import com.tencent.mm.vending.c.b; public final class g implements b<f> { protected f eAr; public final a eAs; public final /* bridge */ /* synthetic */ Object VT() { return this.eAr; } public g() { this(new f()); } private g(f fVar) { this.eAs = new a(this); this.eAr = fVar; } public final f VY() { return this.eAr; } }
package Pojos; // Generated Sep 19, 2015 12:30:29 PM by Hibernate Tools 4.3.1 import java.util.Date; /** * FacturaConsulta generated by hbm2java */ public class FacturaConsulta implements java.io.Serializable { private Integer idFactura; private Cajero cajero; private Consulta consulta; private int numfactura; private Date fecha; private float total; private float pago; private float cambio; public FacturaConsulta() { } public FacturaConsulta(Cajero cajero, Consulta consulta, int numfactura, Date fecha, float total, float pago, float cambio) { this.cajero = cajero; this.consulta = consulta; this.numfactura = numfactura; this.fecha = fecha; this.total = total; this.pago = pago; this.cambio = cambio; } public Integer getIdFactura() { return this.idFactura; } public void setIdFactura(Integer idFactura) { this.idFactura = idFactura; } public Cajero getCajero() { return this.cajero; } public void setCajero(Cajero cajero) { this.cajero = cajero; } public Consulta getConsulta() { return this.consulta; } public void setConsulta(Consulta consulta) { this.consulta = consulta; } public int getNumfactura() { return this.numfactura; } public void setNumfactura(int numfactura) { this.numfactura = numfactura; } public Date getFecha() { return this.fecha; } public void setFecha(Date fecha) { this.fecha = fecha; } public float getTotal() { return this.total; } public void setTotal(float total) { this.total = total; } public float getPago() { return this.pago; } public void setPago(float pago) { this.pago = pago; } public float getCambio() { return this.cambio; } public void setCambio(float cambio) { this.cambio = cambio; } }
package com.mx.profuturo.bolsa.model.graphics.adapters; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.Map; import java.util.Map.Entry; public class BarChartAdapter { private String axisX; private String axisY; private String title; private HashMap<String, Integer> bars = new LinkedHashMap<>(); private HashMap<String, Integer> barChartCounter = new LinkedHashMap<>(); private HashMap<String, Integer> sortedBarChartCounter = new LinkedHashMap<>(); private Integer totalHits; public String getAxisX() { return axisX; } public void setAxisX(String axisX) { this.axisX = axisX; } public String getAxisY() { return axisY; } public void setAxisY(String axisY) { this.axisY = axisY; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public HashMap<String, Integer> getBars() { return bars; } public void setBars(HashMap<String, Integer> bars) { this.bars = bars; } public HashMap<String, Integer> getBarChartCounter() { return barChartCounter; } public void setBarChartCounter(HashMap<String, Integer> barChartCounter) { this.barChartCounter = barChartCounter; } public Integer getTotalHits() { return totalHits; } public void setTotalHits(Integer totalHits) { this.totalHits = totalHits; } public void barChartCount(String hit) { if(null == barChartCounter.get(hit)) { barChartCounter.put(hit, 1); }else { Integer count = barChartCounter.get(hit); count++; barChartCounter.put(hit, count); } } public void assignBarMembers(int limit, String otros) { this.sortedBarChartCounter = this.sortByValue(this.barChartCounter); int i = 0; int count = 0; for (Entry<String, Integer> entry : this.sortedBarChartCounter.entrySet()) { if(i<limit) { this.bars.put(entry.getKey(), entry.getValue()); count+=entry.getValue(); }else break; } if(count<this.totalHits) { this.bars.put(otros, (this.totalHits - count)); } } public HashMap<String, Integer> sortByValue(HashMap<String, Integer> hm) { // Create a list from elements of HashMap LinkedList<Map.Entry<String, Integer> > list = new LinkedList<Map.Entry<String, Integer> >(hm.entrySet()); // Sort the list Collections.sort(list, new Comparator<Map.Entry<String, Integer> >() { public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) { return (o2.getValue()).compareTo(o1.getValue()); } }); // put data from sorted list to hashmap HashMap<String, Integer> temp = new LinkedHashMap<String, Integer>(); for (Map.Entry<String, Integer> aa : list) { temp.put(aa.getKey(), aa.getValue()); } return temp; } }
package mechanics; import static mechanics.MechanicsSimulator.*; import static mechanics.Simulation.*; public class Loop { public class LogicLoop implements Runnable { @Override public void run(){ while(!simulation.isPaused){ for(int b = 0; b < simulation.bindex; ++b) simulation.blocks[b].move(); try { Thread.sleep(lsleept); } catch(InterruptedException e){} } } } public class GraphicsLoop implements Runnable { @Override public void run(){ while(!simulation.isPaused){ simulation.repaint(); try { Thread.sleep(lsleept); } catch(InterruptedException e){} } } } }
package com; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.hibernate.Query; import java.util.List; import java.util.Iterator; public class Login { public static User main(String email,String password) { User u=null; Configuration cfg=new Configuration(); cfg.configure(); SessionFactory factory=cfg.buildSessionFactory(); Session session=factory.openSession(); Transaction t=session.beginTransaction(); Query query=session.createQuery("from User where email=:e and password=:p"); query.setParameter("e",email); query.setParameter("p",password); List list=query.list(); Iterator itr=list.iterator(); if(itr.hasNext()) { u=(User)itr.next(); } return u; } }
package org.rec.sample1; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; import org.apache.mahout.cf.taste.common.NoSuchUserException; import org.apache.mahout.cf.taste.common.TasteException; import org.apache.mahout.cf.taste.impl.common.LongPrimitiveIterator; import org.apache.mahout.cf.taste.impl.recommender.svd.Factorization; import org.apache.mahout.cf.taste.impl.recommender.svd.RatingSGDFactorizer; import org.apache.mahout.cf.taste.model.DataModel; public class MakeFeatureSet extends ItemRecommender{ double itemFeatures[][]; double userFeatures[][]; Factorization fact; public void getFeatures() throws TasteException, IOException{ RatingSGDFactorizer factorizer = new RatingSGDFactorizer(model, 15, 10); fact = factorizer.factorize(); itemFeatures = fact.allItemFeatures(); userFeatures = fact.allUserFeatures(); FileWriter fw = new FileWriter(new File("Data/userLatentFeatures.csv")); int nOfUsers = userFeatures.length; for(int i=0; i<nOfUsers; i++){ String featureSet = ""; for(int j=3; j<18; j++){ featureSet = featureSet + (Math.round(userFeatures[i][j]*1000)) / 1000.0 + ","; } fw.write(featureSet+"\n"); } fw.close(); fw = new FileWriter(new File("Data/itemLatentFeatures.csv")); int nOfItems = itemFeatures.length; for(int i=0; i<nOfItems; i++){ String featureSet = ""; for(int j=3; j<18; j++){ featureSet = featureSet + (Math.round(itemFeatures[i][j]*1000)) / 1000.0 + ","; } fw.write(featureSet+"\n"); } fw.close(); } int labels[]; int nOfLabels; public void setLabels(File f) throws FileNotFoundException{ labels = new int[10000]; Scanner sc = new Scanner(f); int i =0; while(sc.hasNext()){ int label = Integer.parseInt(sc.next()); labels[i++] = label; } nOfLabels = i; sc.close(); } Map<Long,List<Long>> similarUsersMap = new HashMap<Long, List<Long>>(); public List<Long> getSimilarUsers(long userid) throws TasteException{ List<Long> similarUsers = new ArrayList<Long>(); int indx = fact.userIndex(userid); System.out.println(indx); int userlabel = labels[indx]; LongPrimitiveIterator iter = model.getUserIDs(); while(iter.hasNext()){ long user = iter.nextLong(); int useridx = fact.userIndex(user); if(labels[useridx] == userlabel){ System.out.println(user+","+userlabel); similarUsers.add(user); } } similarUsersMap.put(userid, similarUsers); return similarUsers; } /*public static void main(String args[]) throws IOException, TasteException{ MakeFeatureSet f1 = new MakeFeatureSet(); f1.makeModel(new File("Data/movies.csv")); f1.getFeatures(); f1.setLabels(new File("Data/labels.txt")); f1.getSimilarUsers(1); }/*/ }
package ve.com.mastercircuito.test; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class ConnectionDB { /*** * */ private String driver; private String db; // private String mastercircuito; private String url; private Connection conn = null; // ------------------------------------------ /*** * Constructor */ public ConnectionDB( String driver, String db, String url ) { this.driver = driver; this.db = db; // this.db = mastercircuito; this.url = url; } // ------------------------------------------- /*** * */ public void connect() { try { Class.forName( this.driver ); // conn = DriverManager.getConnection( this.url + this.db, "root", "123" ); conn = DriverManager.getConnection( this.url + this.db, "mc", "m4st3rc1rcu1t0" ); } catch ( ClassNotFoundException e ) { e.printStackTrace(); } catch( SQLException e) { e.printStackTrace(); } } // ------------------------------------------- /*** * */ public void disconnect() { try { conn.close(); conn = null; } catch (Exception ex) { ex.printStackTrace(); } } /*** * */ public void getStateConnection() { try { if( !this.conn.isClosed() ) javax.swing.JOptionPane.showMessageDialog( null, "conectado" ); else javax.swing.JOptionPane.showMessageDialog( null, "desconectado" ); } catch ( SQLException e ) { e.printStackTrace(); } } //---------------------------------------- /*** * Getter para conexion */ public Connection getConn() { return this.conn; } }
package com.Xls2Json.model; public class AttributeAndValue { }
package com.example.tarea1; import com.google.android.gms.maps.GoogleMap; import Fragments.Content_fragment; import Fragments.Fragment_list_view_images; import Fragments.Images; import Fragments.mapa; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class MainActivity extends ActionBarActivity{ Store datos; Intent detalle; Intent intent; private DrawerLayout drawerlayout; private ListView drawerList; private String[] drawerOptions; private Fragment[] fragments = new Fragment[]{ new Images(), new Content_fragment(), new Fragment_list_view_images()}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); drawerList = (ListView)findViewById(R.id.leftDrawer); drawerlayout = (DrawerLayout) findViewById(R.id.drawerLayout); drawerOptions = getResources().getStringArray(R.array.drawer_options); drawerList.setAdapter(new ArrayAdapter<String>(this,R.layout.drawer_list_item,drawerOptions)); drawerList.setItemChecked(0, true); drawerList.setOnItemClickListener(new DrawerItemClickListener()); FragmentManager manager = getSupportFragmentManager(); manager.beginTransaction() .add(R.id.contentFrame, fragments[0]) .add(R.id.contentFrame, fragments[1]) .add(R.id.contentFrame, fragments[2]) .hide(fragments[1]) .hide(fragments[2]) .commit(); } public void SetContent(int index){ Fragment toHide = null; Fragment toshow = null; Fragment toHide2 = null; ActionBar actionBar = getSupportActionBar(); if(index == 0){ toHide = fragments[1]; toshow = fragments[0]; toHide2 = fragments[2]; actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); }else if(index == 1){ toHide = fragments[0]; toshow = fragments[1]; toHide2 = fragments[2]; actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); }else if(index==2){ toHide = fragments[0]; toHide2 = fragments[1]; toshow = fragments[2]; actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); } FragmentManager manager = getSupportFragmentManager(); manager.beginTransaction().hide(toHide).show(toshow).hide(toHide2).commit(); drawerList.setItemChecked(index, true); drawerlayout.closeDrawer(drawerList); } class DrawerItemClickListener implements ListView.OnItemClickListener{ @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { SetContent(position); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.maps_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int item_id = item.getItemId(); if(item_id == R.id.Normal){ mapa.modo_mapa(GoogleMap.MAP_TYPE_NORMAL); } if(item_id == R.id.Hibrido){ mapa.modo_mapa(GoogleMap.MAP_TYPE_HYBRID); }else if(item_id == R.id.Terreno){ mapa.modo_mapa(GoogleMap.MAP_TYPE_TERRAIN); }else if(item_id == R.id.Satelital){ mapa.modo_mapa(GoogleMap.MAP_TYPE_SATELLITE); } return true; } }
package pe.edu.upeu.hotel.dao; import java.util.List; import pe.edu.upeu.hotel.entity.Alquiler; import pe.edu.upeu.hotel.entity.ReporteAlquiler; public interface AlquilerDao { int create (Alquiler alqui); List<ReporteAlquiler> readReporte(); }
/** * * This is the driver program to make a bouny ball. * * @author k1w1 * */ import java.awt.*; import java.applet.*; import java.util.Scanner; import java.util.Timer; import java.util.TimerTask; @SuppressWarnings("serial") public class BouncyBall extends Applet { private static Timer timer; private static Scanner s = new Scanner(System.in); private static double ballxpos = 0; private static double ballypos = 0; private static double ballxvel = 0; private static double ballyvel = 0; public void init() { System.out.println("The dimensions of the applet are 950x950, enter dimensions to fit the applet."); System.out.print("Enter the initial x-velocity: "); ballxvel = s.nextInt(); System.out.print("Enter the initial y-velocity: "); ballyvel = s.nextInt(); System.out.print("Enter the initial x position: "); ballxpos = s.nextInt(); System.out.print("Enter the initial y position: "); ballypos = s.nextInt(); setSize(1000, 1000); timer = new Timer(); timer.schedule(new TimerTask() { public void run() { ballxpos += ballxvel / 1000; ballypos += ballyvel / 1000; if ((int)ballxpos >= 950) ballxvel = -ballxvel; if ((int)ballxpos <= 0) ballxvel = -ballxvel; if ((int)ballypos >= 950) ballyvel = -ballyvel; if ((int)ballypos <= 0) ballyvel = -ballyvel; repaint(); } }, 0, 1); } public void paint(Graphics g) { g.fillOval((int)ballxpos, (int)ballypos, 50, 50); } }
package com.demo.test.deadlock; public class DeadLock2 implements Runnable { public static void main(String[] args) { DeadLock2 d1 = new DeadLock2(); DeadLock2 d2 = new DeadLock2(); d1.flag = 1; d2.flag = 0; new Thread(d1, "A Thread").start(); new Thread(d2, "B Thread").start(); } public int flag; private static Object o1 = new Object(), o2 = new Object(); @Override public void run() { System.out.println(Thread.currentThread().getName() +" flag = " + flag); if (flag == 1) { synchronized(o1) { System.out.println(Thread.currentThread().getName() + " lock o1."); try { Thread.sleep(200); System.out.println(Thread.currentThread().getName() + " is waiting for unlock o2."); } catch (InterruptedException e) { e.printStackTrace(); } synchronized (o2) { System.out.println(Thread.currentThread().getName() + " lock o2."); } } } if (flag == 0) { synchronized(o2) { System.out.println(Thread.currentThread().getName() + " lock o2."); try { Thread.sleep(200); System.out.println(Thread.currentThread().getName() + " is waiting for unlock o1."); } catch (InterruptedException e) { e.printStackTrace(); } synchronized (o1) { System.out.println(Thread.currentThread().getName() + " lock o1."); } } } } }
/* * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package com.hybris.backoffice.cockpitng.core.user.impl; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; import org.mockito.runners.MockitoJUnitRunner; import org.zkoss.zk.ui.Session; import com.hybris.cockpitng.core.user.CockpitUserService; import com.hybris.cockpitng.core.user.impl.AuthorityGroup; @RunWith(MockitoJUnitRunner.class) public class AdminModeAuthorityGroupServiceTest { private static final String TEST_USER_ID = "TestUserId"; @InjectMocks @Spy private AdminModeAuthorityGroupService adminModeAuthorityGroupService; @Mock private CockpitUserService cockpitUserService; @Mock private Session session; @Mock private AuthorityGroup authorityGroup; @Before public void init() { doReturn(session).when(adminModeAuthorityGroupService).getCurrentSession(); } @Test public void testGetActiveAuthorityGroupForNonAdminUser() { // given when(cockpitUserService.isAdmin(TEST_USER_ID)).thenReturn(Boolean.FALSE); when(session.getAttribute(AdminModeAuthorityGroupService.IMPERSONATED_AUTHORITY_GROUP)).thenReturn(authorityGroup); // when final AuthorityGroup outputAuthorityGroup = adminModeAuthorityGroupService.getActiveAuthorityGroupForUser(TEST_USER_ID); // then assertThat(outputAuthorityGroup).isNull(); } @Test public void testGetActiveAuthorityGroupForAdminUser() { // given when(cockpitUserService.isAdmin(TEST_USER_ID)).thenReturn(Boolean.TRUE); when(session.getAttribute(AdminModeAuthorityGroupService.IMPERSONATED_AUTHORITY_GROUP)).thenReturn(authorityGroup); // when final AuthorityGroup outputAuthorityGroup = adminModeAuthorityGroupService.getActiveAuthorityGroupForUser(TEST_USER_ID); // then assertThat(authorityGroup).isSameAs(outputAuthorityGroup); } @Test public void testSetActiveAuthorityGroupForUser() { // when adminModeAuthorityGroupService.setActiveAuthorityGroupForUser(authorityGroup); // then verify(session).setAttribute(AdminModeAuthorityGroupService.IMPERSONATED_AUTHORITY_GROUP, authorityGroup); } }
package repository.jpa; import java.util.List; import javax.persistence.TypedQuery; import org.springframework.stereotype.Repository; import repository.AlumnoRepository; import domain.Alumno; @Repository public class JpaAlumnoRepository extends JpaBaseRepository<Alumno, Long> implements AlumnoRepository { public List<Alumno> findAll() { String jpaQuery = "SELECT * FROM alumno"; TypedQuery<Alumno> query = entityManager.createQuery(jpaQuery, Alumno.class); return query.getResultList(); } public Alumno findOne(Long codigo) { String jpaQuery = "SELECT * FROM alumno WHERE alumno.id = :codigo"; TypedQuery<Alumno> query = entityManager.createQuery(jpaQuery, Alumno.class); query.setParameter("codigo", codigo); return getFirstResult(query); } }
package com.bfchengnuo.security.demo.web.async; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.util.concurrent.TimeUnit; /** * 模拟消息队列 * 当 completeOrder 有值时,代表订单处理完毕 * * @author Created by 冰封承諾Andy on 2019/7/14. */ @Data @Component @Slf4j public class MockQueue { private String placeOrder; private String completeOrder; public void setPlaceOrder(String placeOrder) { // 模拟处理订单 new Thread(()->{ log.info("收到下单请求:" + placeOrder); try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } log.info(placeOrder + "订单处理完毕"); this.completeOrder = placeOrder; }, "thread-order-1").start(); } }
/** * */ package com.refunited.utils; import javax.servlet.http.HttpServletRequest; /** * @author Elena * */ public class ProcessingUtils { /** * Method that processes the string for display in the jsp pages. * * @param strField * the field value to process * @return the processed value * */ public static String processField(final String strField) { if (strField == null || Constants.NULL.equalsIgnoreCase(strField)) { return Constants.EMPTY; } else return strField; } /** * Method that checks for empty values. * * @param value * the value to check * @return true if not empty * */ public static boolean isNotEmpty(final String value) { return (value != null && value.length() != 0 && !Constants.NULL .equalsIgnoreCase(value)); } /** * Method that gets the value of the parameter named by name * * @param request * the http request * @param name * the name of the parameter * @return the value * */ public static String getRequestParamValue(final HttpServletRequest request, final String name) { return String.valueOf(request.getParameter(name)); } /** * Method that creates a String array from a field. * * @param the * field value * @return the array reference * */ public String[] createArrayFromField(String field) { return new String[] { processField(field) }; } }
import java.util.*; import java.math.*; class Problem10 { public static void main(String[] args) { Date start = new Date(); System.out.println(start); new Problem10().test_solve(); Date end = new Date(); System.out.println(end); System.out.println("Took " + (end.getTime() - start.getTime()) + "ms"); } boolean isPrime(BigInteger num, List<BigInteger> primes) { BigInteger factor = findFactor(num, primes); boolean isPrime = factor == null; if(isPrime) { primes.add(num); } return isPrime; } BigInteger findFactor(BigInteger num, List<BigInteger> primes) { if(primes.isEmpty()) { return null; } int i = 0; BigInteger f = primes.get(i); BigInteger max = num.add(BigInteger.ONE); while(f.pow(2).compareTo(max) == -1) { if(num.mod(f) == BigInteger.ZERO) { return f; } f = primes.get(++i); } return null; } BigInteger sumPrimesBelow(BigInteger num) { BigInteger max = num.add(BigInteger.ONE); List<BigInteger> primes = new ArrayList<BigInteger>(); BigInteger i = new BigInteger("2"); BigInteger sum = BigInteger.ZERO; while(i.compareTo(max) == -1) { if(isPrime(i, primes)) { sum = sum.add(i); } i = i.add(BigInteger.ONE); } return sum; } BigInteger sumPrimesBelowCheat(BigInteger num) { BigInteger next = new BigInteger("2"); BigInteger sum = BigInteger.ZERO; while(next.compareTo(num) == -1) { sum = sum.add(next); next = next.nextProbablePrime(); } return sum; } BigInteger big(Integer i) { return new BigInteger(i.toString()); } void test_solve() { System.out.println("Answer is" + sumPrimesBelow(big(2000000))); System.out.println("Answer should be 142913828922"); } }
package com.nta.lc_server.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.nta.lc_server.R; import com.nta.lc_server.model.DiscountModel; import java.text.SimpleDateFormat; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; public class MyDiscountAdapter extends RecyclerView.Adapter<MyDiscountAdapter.MyViewHolder> { Context context; List<DiscountModel> discountModelList; SimpleDateFormat simpleDateFormat; public MyDiscountAdapter(Context context, List<DiscountModel> discountModelList) { this.context = context; this.discountModelList = discountModelList; simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); } @NonNull @Override public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return new MyViewHolder(LayoutInflater.from(context).inflate(R.layout.layout_discount_item, parent, false)); } @Override public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { holder.txt_code.setText(new StringBuilder("Code: ").append(discountModelList.get(position).getKey())); holder.txt_percent.setText(new StringBuilder("Phần trăm: ").append(discountModelList.get(position).getPercent()).append("%")); holder.txt_valid.setText(new StringBuilder("Hạn sử dụng: ").append(simpleDateFormat.format(discountModelList.get(position).getUntilDate()))); } @Override public int getItemCount() { return discountModelList.size(); } public class MyViewHolder extends RecyclerView.ViewHolder { @BindView(R.id.txt_code) TextView txt_code; @BindView(R.id.txt_percent) TextView txt_percent; @BindView(R.id.txt_valid) TextView txt_valid; private Unbinder unbinder; public MyViewHolder(@NonNull View itemView) { super(itemView); unbinder = ButterKnife.bind(this, itemView); } } }
package com.smxknife.datastructure.stack; /** * @author smxknife * 2019-05-10 */ public final class LinkedStack<T> extends AbsLinkedStack<T> { }
package cn.bs.zjzc.model; import cn.bs.zjzc.base.IBaseModel; import cn.bs.zjzc.model.bean.OrderListRequestBody; import cn.bs.zjzc.model.callback.HttpTaskCallback; import cn.bs.zjzc.model.response.OrderListResponse; /** * Created by Ming on 2016/6/29. */ public interface IMyOrderModel extends IBaseModel{ void getOrderList(OrderListRequestBody requestBody, HttpTaskCallback<OrderListResponse.DataBean> callback); }
package com.jiuzhe.app.hotel.service.aliyun; import com.aliyun.opensearch.sdk.generated.commons.OpenSearchClientException; import com.aliyun.opensearch.sdk.generated.commons.OpenSearchException; import com.aliyun.opensearch.sdk.generated.document.Command; import com.jiuzhe.app.hotel.module.OpenSearchQuery; import java.util.List; import java.util.Map; public interface OpenSearch { String searchDocuments(OpenSearchQuery searchQuery); void operateDocuments(String appName, String tableName, Command cmd, List<Map<String, Object>> docs) throws IllegalArgumentException, OpenSearchClientException, OpenSearchException; }
package de.jmda.fx.sandbox.graph.uml; public class Front extends Point implements de.jmda.fx.sandbox.graph.Front { public Front(int x, int y) { super(x, y); } public String asString() { return getPoint().toString(); } }
package servlet; import java.io.IOException; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import controlers.CtrlABMRegistro; import entity.Registro; import entity.Usuario; import util.Componentes; /** * Servlet implementation class ReporteEstadisticasAnuales */ @WebServlet({ "/ReporteEstadisticasAnuales", "/reporte-estadisticas-anuales", "/reportes/estadisticas-anuales", "/reportes/estadisticasAnuales" }) public class ReporteEstadisticasAnuales extends HttpServlet { private static final long serialVersionUID = 1L; private Usuario user; /** * @see HttpServlet#HttpServlet() */ public ReporteEstadisticasAnuales() { super(); } /** * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response) */ protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { if(!Componentes.estaLogeado(request, response)) { throw new Exception("No es un usuario activo. Por favor, vuelva a ingresar."); } this.user = (Usuario) request.getSession().getAttribute("usuario"); String method = request.getMethod(); if (method.equals("GET")) { doGet(request, response); } else if (method.equals("POST")) { doPost(request, response); } } catch (Exception e) { System.out.println(e.getMessage()); request.getSession().setAttribute("mensaje", e.getMessage()); response.sendRedirect("../login"); } } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { Registro filtro = new Registro(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm"); Date fechaHora = null; if(request.getParameter("fdesde") != null && request.getParameter("fdesde") != "") { fechaHora = dateFormat.parse(request.getParameter("fdesde") + " 00:00"); filtro.setFdesde(new Timestamp(fechaHora.getTime())); } if(request.getParameter("fhasta") != null && request.getParameter("fhasta") != "") { fechaHora = dateFormat.parse(request.getParameter("fhasta") + " 23:59"); filtro.setFhasta(new Timestamp(fechaHora.getTime())); } //Seteo a mano las 2 fechas, hasta que este el filtro fechaHora = dateFormat.parse("01/01/2018 00:00"); filtro.setFdesde(new Timestamp(fechaHora.getTime())); fechaHora = dateFormat.parse("31/12/2018 23:59"); filtro.setFhasta(new Timestamp(fechaHora.getTime())); CtrlABMRegistro ctrlRegistros = new CtrlABMRegistro(); ArrayList<Registro> registros; registros = ctrlRegistros.reporte(this.user, filtro); request.setAttribute("registros", registros); Map<String, Float> grafico; grafico = ctrlRegistros.reporteAnual(this.user, filtro); request.setAttribute("grafico", grafico); for (Map.Entry<String, Float> entry : grafico.entrySet()) { System.out.println("clave=" + entry.getKey() + ", valor=" + entry.getValue()); } request.getRequestDispatcher("/reports/estadisticas_anuales.jsp").forward(request, response); } catch (Exception e) { System.out.println(e.getMessage()); request.getSession().setAttribute("mensaje", e.getMessage()); response.sendRedirect("../home/"); } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { doGet(request, response); } catch (Exception e) { System.out.println(e.getMessage()); request.getSession().setAttribute("mensaje", e.getMessage()); doGet(request, response); } finally { } } }
package main; import controlador.Controlador; import vista.Ventana; public class Main { public static void main(String[] args) { Ventana window = new Ventana(); new Controlador(window); } }
package colorswitch; public class TwoRoundedCircles extends RoundedCircle { /** * Les attributs de RoundedCircle : circle1,2 pour les deux cercles qui s'intersectent en formant l'Entité * TwoRoundedCircles, x1,2 .... qui représente les coordonnées de chacune, le rayon, la largeur originale, max, * difference de largeur puisque les deux cercles vont changer de largeur. La couleur de la première et la deuxième. * Finalement, le ratio auquel le cercle augmente ou diminue en largeur(circleGrowRate). * L'attribut circleGrowRate est static puisqu'on va assigner un growRate(+1) pour chaque TwoRoundedCircles * instancié au jeu, pour augmenter le taux et la vitesse d'augmentation/diminution de grandeur(difficulté) en * passant par les niveaux. */ private RoundedCircle circle1, circle2; private double x1, x2, y1, y2, width, timeSinceColorChange = 0, maxWidth, originalWidth, deltaWidth; private int level, color1, color2; protected static double circleGrowRate = 1; /** * Constructeur : il appele le constructeur de RoundedCircle pour assigner la position initiale du grand cercle qu'on * va utiliser pour dessiner les deux autres cercles de l'Entity. On va dessiner circle1(à un nouveau point x situé * un demi rayon avant le point x original de l'Entity en paramètre), circle2(un demi rayon après) pour faire une * intersection entre les deux cercles qui va contenir le Mushroom à réclamer. * La largeur Maximale sera une fraction de niveau dans lequel on est + 1 et multipliée par la largeur originale. * Le changement de largeur sera 0.027 multiplié par le circleGrowRate. (Pour augmenter la difficulté). * @param x position centrale de l'Entity à dessiner. * @param y position y sur le canvas selon le screenHeight. * @param width la largeur de cercle TwoRoundedCircles qu'on va utiliser pour dessiner les deux cercles. * @param level Le niveau actuel(j'ai décidé d'avoir cette obstacle à partir de niveau 4) donc le niveau de cette * obstacle sera 1 au niveau 4 et ainsi de suite. */ public TwoRoundedCircles (double x, double y, double width, int level) { super(x, y, width, level); circle1 = new RoundedCircle(x - width/4, y, width, level); circle2 = new RoundedCircle(x + width/4, y, width, level); this.renderer = new TwoRoundedCirclesRenderer(circle1, circle2); this.width = width; this.originalWidth = width; this.maxWidth = (1 + (double)level/4) * width; this.deltaWidth = 0.027 * circleGrowRate; this.level = level; circleGrowRate++; } /** * À chaque changement de frame(canvas), le tick va faire un changement de largeur en appelant la méthode * growingObstacle(classe abstraite Entity) pour calculer la variation en largeur qui sera utilisé en dessinant * l'ostacle. x1,..,y2 sont les coordonnées des deux cercles. Width sera (la nouvelle largeur) des deux cercles. * Et donc au nouveau frame la largeur sera +/- le changement en width. * timeSinceColorChange, c'est pour les changements des couleurs dans un intervalle de deux secondes pour chaque * couleur. * @param dt C'est la différence de temps (now - lastTime) en nanosecondes * 1e-9 pour l'avoir en secondes. */ @Override public void tick(double dt) { timeSinceColorChange += dt; x1 = this.circle1.getX(); x2 = this.circle2.getX(); y1 = this.circle1.getY(); y2 = this.circle2.getY(); width = growingOstacle(this.width, this.maxWidth, this.originalWidth, this.deltaWidth); circle1.setWidth(width); circle2.setWidth(width); if (timeSinceColorChange > 2) { circle1.setColor((int) (Math.random() * 4)); circle2.setColor((int) (Math.random() * 4)); color1 = circle1.getColor(); color2 = circle2.getColor(); timeSinceColorChange = 0; } } /** * La méthode checkIntersection se trouve dans la classe abstraite Entity. * @param player La sorcière représente par un cercle. * @return Retourne vrai s'il intersecte une des deux, faux s'il n'intersecte aucune des deux. */ @Override public boolean intersects(Player player) { return (circle1.intersects(player) && circle2.intersects(player)); } }
package com.example.administrator.study; import android.content.Context; import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.List; /** * Created by Administrator on 2018/1/23. */ public class ListAdapter extends ArrayAdapter<Listt> { private int resourceId; public ListAdapter(@NonNull Context context, int resource,List<Listt> objects) { super(context, resource, objects); resourceId=resource; } public View getView(int position,View convertView,ViewGroup parent){ Listt list=getItem(position); //View view= LayoutInflater.from(getContext()).inflate(resourceId,parent,false); View view; ViewHolder viewHolder; if (convertView==null){ view=LayoutInflater.from(getContext()).inflate(resourceId,parent,false); viewHolder=new ViewHolder(); viewHolder.img=(ImageView)view.findViewById(R.id.item_imgId); viewHolder.name=view.findViewById(R.id.item_name); view.setTag(viewHolder); }else{ view=convertView; viewHolder=(ViewHolder)view.getTag(); } viewHolder.img.setImageResource(list.getImgId()); viewHolder.name.setText(list.getName()); // ImageView img=(ImageView)view.findViewById(R.id.item_imgId); // TextView name=(TextView)view.findViewById(R.id.item_name); //img.setImageResource(list.getImgId()); // name.setText(list.getName()); return view; } private class ViewHolder { ImageView img; TextView name; } }
package com.zlsoft.my.shop.web.admin.dao; import com.zlsoft.my.shop.domain.TbUser; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface TbUserDao { /** * 查询全部用户信息 * @return */ public List<TbUser> selectAll(); /** * 增加 * @param tbUser */ public void insert(TbUser tbUser); /** * 删除 * @param tbUser */ void delete(TbUser tbUser); /** * 根据id查询 * @param id * @return */ TbUser getById(long id); /** * 修改 * @param tbUser */ void update(TbUser tbUser); /** * 根据username模糊查询 * @param username * @return */ List<TbUser> selectByName(String username); TbUser selectByEmail(String email); }
package com.tencent.mm.plugin.account.bind.ui; import android.content.Intent; import com.tencent.mm.plugin.account.bind.ui.d.1; import com.tencent.mm.ui.MMActivity.a; class d$1$3 implements a { final /* synthetic */ 1 eIF; final /* synthetic */ com.tencent.mm.plugin.account.friend.a.a eIx; d$1$3(1 1, com.tencent.mm.plugin.account.friend.a.a aVar) { this.eIF = 1; this.eIx = aVar; } public final void b(int i, int i2, Intent intent) { if (i == 1 && i2 == -1) { ((MobileFriendUI) d.d(this.eIF.eIE)).b(this.eIx); } } }
package com.im.domain; import java.net.SocketAddress; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; public class Request { public int id; public SelectionKey requestKey; public ByteBuffer buffer; public long startTime; public SocketAddress address; public volatile long requestDequeueTimeMs = -1L; public volatile long apiLocalCompleteTimeMs = -1L; public volatile long responseCompleteTimeMs = -1L; public volatile long responseDequeueTimeMs = -1L; public Request(int id, SelectionKey key, ByteBuffer buffer, long startTime, SocketAddress address) { this.id = id; this.requestKey = key; this.buffer = buffer; this.startTime = startTime; this.address = address; } }
/* * [y] hybris Platform * * Copyright (c) 2000-2016 SAP SE * All rights reserved. * * This software is the confidential and proprietary information of SAP * Hybris ("Confidential Information"). You shall not disclose such * Confidential Information and shall use it only in accordance with the * terms of the license agreement you entered into with SAP Hybris. */ package com.cnk.travelogix.operations.services.impl; import java.util.Collections; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import com.cnk.travelogix.masterdata.core.c2l.model.ContinentModel; import com.cnk.travelogix.operation.daos.ContinentDao; import com.cnk.travelogix.operations.services.ContinentService; /** * Implementation class of ContinentService Interface. * * @author C5244543 */ public class DefaultContinentService implements ContinentService { @Autowired private ContinentDao continentDao; @Override public ContinentModel findContinentByIsocode(final String isocode) { return continentDao.findContinentByIsocode(isocode); } @Override public List<ContinentModel> findContinents() { final List<ContinentModel> continentModels = continentDao.findContinents(); if (continentModels != null && !continentModels.isEmpty()) { return continentModels; } return Collections.emptyList(); } }
package org.japo.java.basics.main; public class JornadaLaboral { public static void main(String[] args) { // Duración jornada laboral final int H = 8; final int M = 0; final int S = 0; // Entrada int he = 9; int me = 30; int se = 0; // Salida int hs = 23; int ms = 59; int ss = 59; // Conversion a segundos int segIni = he * 3600 + me * 60 + se; int segFin = hs * 3600 + ms * 60 + ss; int segJor = H * 3600 + M * 60 + S; // Análisis: true > SI cumplida - falae > NO cumplida boolean testOK = segFin - segIni >= segJor; // Generar mensaje String mensaje = testOK ? "SI cumplida" : "NO cumplida"; // Mostrar resultados System.out.printf("Hora entrada .....: %02d:%02d:%02d\n", he, me, se); System.out.printf("Hora salida ......: %02d:%02d:%02d\n", hs, ms, S); System.out.printf("Duración jornada .: %02d:%02d:%02d\n", H, M, S); System.out.printf("Jornada laboral ..: %s\n", mensaje); } }
package ru.brainworkout.braingym; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.support.v7.app.AppCompatActivity; import android.view.Gravity; import android.view.View; import android.widget.Button; import android.widget.Chronometer; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; import java.util.ArrayList; import java.util.Random; public class NumberSearchActivity extends AppCompatActivity { private Chronometer mChronometer; private final String TAG = this.getClass().getSimpleName(); private boolean mChronometerIsWorking = false; private long mChronometerCount = 0; private SharedPreferences mSettings; private String mNumberSearchLang; private int mTextSize = 0; private int mNumberSearchSize; private int mNumberSearchNumberSymbols; private int mNumberSearchFontSizeChange; private int mNumberSearchMaxTime; private int mNumberSearchExampleTime; private int mTextSizeDirection; private int mHeight = 0; private int mWidth = 0; private ArrayList<Integer> alphabetColors = new ArrayList<>(); ArrayList<NumberSearchExample> matrix = new ArrayList<>(); ArrayList<Integer> ElementsWithFontSizeChanges = new ArrayList<>(); private String Question; private int indAnswer; private int mCountRightAnswers = 0; private int mCountAllAnswers = 0; private long mNumberSearchExBeginTime = 0; private long elapsedMillis; //алфавиты private ArrayList<String> AlphabetRu; private ArrayList<String> AlphabetEn; @Override protected void onCreate(Bundle savedInstanceState) { //id - 600 +i super.onCreate(savedInstanceState); setContentView(R.layout.activity_number_search); //matrixClear(); mChronometer = (Chronometer) findViewById(R.id.chronometer_number_search); AlphabetRu= Utils.AlphabetRu(); AlphabetEn= Utils.AlphabetEn(); } public void NumberSearchСlear_onClick(View view) { //matrixClear(); timerStop(false); } private void timerStop(boolean auto) { mChronometer.setBase(SystemClock.elapsedRealtime()); mChronometer.stop(); mChronometerCount = 0; mChronometerIsWorking = false; mCountRightAnswers = 0; mCountAllAnswers = 0; mNumberSearchExBeginTime = 0; ChangeButtonText("buttonNumberSearchStartPause", "Старт"); int timerMaxID = getResources().getIdentifier("tvNumberSearchTimerMaxTime", "id", getPackageName()); TextView txtTimerMaxTime = (TextView) findViewById(timerMaxID); if (txtTimerMaxTime != null) { txtTimerMaxTime.setTextSize(mTextSize); String txt; if (!auto) { txt = "Тест: " + String.valueOf(mNumberSearchMaxTime); } else { txt = "Тест окончен"; } txtTimerMaxTime.setText(txt); } int answerID = getResources().getIdentifier("tvNumberSearchAnswers", "id", getPackageName()); TextView txtAnswer = (TextView) findViewById(answerID); if (txtAnswer != null) { txtAnswer.setTextSize(mTextSize); if (!auto) { txtAnswer.setText(""); } } int exID = getResources().getIdentifier("tvNumberSearchExample", "id", getPackageName()); TextView txtExample = (TextView) findViewById(exID); if (txtExample != null) { txtExample.setTextSize(mTextSize); txtExample.setText(""); } int mCountNumberSearch = mNumberSearchSize * mNumberSearchSize; for (int i = 1; i <= mCountNumberSearch; i++) { //int resID=getResources().getIdentifier("txt"+String.valueOf(300+i), "id", getPackageName()); //TextView txt = (TextView) findViewById(resID); Button but = (Button) findViewById(600 + i); //txt.setVisibility(View.INVISIBLE); if (but != null) { but.setText(""); but.setTextSize(mTextSize); but.setBackgroundResource(R.drawable.textview_border); //txt.setVisibility(View.GONE); // } } if (mNumberSearchExampleTime != 0) { int timerExID = getResources().getIdentifier("tvNumberSearchTimerExTime", "id", getPackageName()); TextView txtTimerExTime = (TextView) findViewById(timerExID); if (txtTimerExTime != null) { String txt; if (!auto) { txt = "Пример: " + String.valueOf(mNumberSearchExampleTime); } else { txt = ""; } txtTimerExTime.setText(txt); txtTimerExTime.setTextSize(mTextSize); } } } private void numberSearchClear() { int mCountNumberSearch = mNumberSearchSize * mNumberSearchSize; for (int i = 1; i <= mCountNumberSearch; i++) { //int resID=getResources().getIdentifier("txt"+String.valueOf(300+i), "id", getPackageName()); //TextView txt = (TextView) findViewById(resID); Button but = (Button) findViewById(600 + i); //txt.setVisibility(View.INVISIBLE); if (but != null) { but.setText(""); but.setTextSize(mTextSize); but.setBackgroundResource(R.drawable.textview_border); //txt.setVisibility(View.GONE); // } } TableLayout frame = (TableLayout) findViewById(R.id.tableNumberSearch); if (frame != null) { frame.removeAllViews(); frame.setStretchAllColumns(true); } int resID = getResources().getIdentifier("tvNumberSearchExample", "id", getPackageName()); TextView txt = (TextView) findViewById(resID); if (txt != null) { if (frame != null) { mHeight = (frame.getHeight()+txt.getHeight()) / (mNumberSearchSize+1); mWidth = frame.getWidth() / (mNumberSearchSize); int divider=16; switch (mNumberSearchLang) { case "Digit": divider=divider; break; case "Ru": divider+=3; break; case "En": divider+=3; break; } switch (mNumberSearchNumberSymbols) { case 3: divider+=1; break; case 4: divider+=3; break; case 5: divider+=7; break; } switch (mNumberSearchSize) { case 5: divider+=1; break; case 6: divider+=3; break; case 7: divider+=5; break; } mTextSize = (int) (Math.min(mWidth, mHeight)*(mNumberSearchSize) / divider / getApplicationContext().getResources().getDisplayMetrics().density); } txt.setText(" "); txt.setTextSize(mTextSize); txt.setHeight(mHeight); txt.setTextColor(Color.parseColor("#FF6D6464")); } int trowID = getResources().getIdentifier("trowNumberSearch", "id", getPackageName()); TableRow trow1 = (TableRow) findViewById(trowID); if (trow1 != null) { trow1.setBackgroundResource(R.drawable.rounded_corners1); } //ChangeButtonText("buttonMatrixStartPause", "Старт"); } private void changeTimer(long elapsedMillis) { for (int i = 0; i < ElementsWithFontSizeChanges.size(); i++) { Button but = (Button) findViewById(600 + ElementsWithFontSizeChanges.get(i)); if (but != null) { float mButTextSize = but.getTextSize() / getApplicationContext().getResources().getDisplayMetrics().density; if (mButTextSize == mTextSize) { but.setTextSize(mButTextSize - 1); mTextSizeDirection = 2; } else if (mButTextSize == mTextSize - 5) { but.setTextSize(mButTextSize + 1); mTextSizeDirection = 8; } else if (mTextSizeDirection == 8) { but.setTextSize(mButTextSize + 1); } else if (mTextSizeDirection == 2) { but.setTextSize(mButTextSize - 1); } } } int timerMaxID = getResources().getIdentifier("tvNumberSearchTimerMaxTime", "id", getPackageName()); TextView txtTimerMaxTime = (TextView) findViewById(timerMaxID); if (txtTimerMaxTime != null) { int time = (int) (mNumberSearchMaxTime - (elapsedMillis / 1000)); String txt = "Тест: " + String.valueOf(time); txtTimerMaxTime.setText(txt); txtTimerMaxTime.setTextSize(mTextSize); } if (mNumberSearchExampleTime != 0) { int timerExID = getResources().getIdentifier("tvNumberSearchTimerExTime", "id", getPackageName()); TextView txtTimerExTime = (TextView) findViewById(timerExID); if (txtTimerExTime != null) { int time = (mNumberSearchExampleTime - ((int) (((elapsedMillis - mNumberSearchExBeginTime) / 1000)) % mNumberSearchExampleTime)); //System.out.println("mStrupeExampleTime=" + mStrupExampleTime + ", time=" + time + ", elapsed millis=" + elapsedMillis + ", mStrupExBeginTime=" + mStrupExBeginTime); if (time == mNumberSearchExampleTime) { //новый пример String txt = "Пример: " + String.valueOf(time); txtTimerExTime.setText(txt); txtTimerExTime.setTextSize(mTextSize); mCountAllAnswers++; int answerID = getResources().getIdentifier("tvNumberSearchAnswers", "id", getPackageName()); TextView txtAnswer = (TextView) findViewById(answerID); if (txtAnswer != null) { String txt1 = String.valueOf(mCountRightAnswers) + "/" + String.valueOf(mCountAllAnswers); txtAnswer.setText(txt1); txtAnswer.setTextSize(mTextSize); } createExample(); } else { String txt = "Пример: " + String.valueOf(time); txtTimerExTime.setText(txt); txtTimerExTime.setTextSize(mTextSize); } } } else { int timerExID = getResources().getIdentifier("tvNumberSearchTimerExTime", "id", getPackageName()); TextView txtTimerExTime = (TextView) findViewById(timerExID); if (txtTimerExTime != null) { txtTimerExTime.setText(" "); txtTimerExTime.setTextSize(mTextSize); } } } public void startPause_onClick(View view) { start_pause(); } private void start_pause() { if (!mChronometerIsWorking) { if (mChronometerCount == 0) { mChronometer.setBase(SystemClock.elapsedRealtime()); getPreferencesFromFile(); numberSearchClear(); int timerID = getResources().getIdentifier("tvNumberSearchTimerMaxTime", "id", getPackageName()); TextView txtTimerMaxTime = (TextView) findViewById(timerID); if (txtTimerMaxTime != null) { txtTimerMaxTime.setTextSize(mTextSize); String txt = "Тест: " + String.valueOf(mNumberSearchMaxTime); txtTimerMaxTime.setText(txt); } mChronometer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() { @Override public void onChronometerTick(Chronometer chronometer) { elapsedMillis = SystemClock.elapsedRealtime() - mChronometer.getBase(); if (mNumberSearchMaxTime - (elapsedMillis / 1000) < 1) { timerStop(true); } if (elapsedMillis > 1000) { changeTimer(elapsedMillis); //elapsedMillis=0; } } }); createExample(); } else { mChronometer.setBase(SystemClock.elapsedRealtime() - mChronometerCount); } mChronometer.start(); mChronometerIsWorking = true; ChangeButtonText("buttonNumberSearchStartPause", "Пауза"); } else { //mChronometerBase=mChronometer.getBase(); mChronometerCount = SystemClock.elapsedRealtime() - mChronometer.getBase(); mChronometer.stop(); mChronometerIsWorking = false; ChangeButtonText("buttonNumberSearchStartPause", "Старт"); } } private void createExample() { Random random = new Random(); int mCountAnswers = Math.abs(random.nextInt(10) + 7); String txtNum = ""; int num; matrix.clear(); while (matrix.size() != mCountAnswers) { txtNum = ""; for (int i = 0; i < mNumberSearchNumberSymbols; i++) { switch (mNumberSearchLang) { case "Digit": num = random.nextInt(10); txtNum += String.valueOf(num); break; case "Ru": num = random.nextInt(AlphabetRu.size()); txtNum += AlphabetRu.get(num); break; case "En": num = random.nextInt(AlphabetEn.size()); txtNum += AlphabetEn.get(num); break; } } int indColor1 = Math.abs(random.nextInt() % 7); int indColor2 = Math.abs(random.nextInt() % 7); int indColor3 = Math.abs(random.nextInt() % 7); //тип 0 - обычная кнопка //тип 1 - мигающая кнопка //тип 2 - увеличивающаяся кнопка int indType = Math.abs(random.nextInt() % (mNumberSearchNumberSymbols-1)); NumberSearchExample Ex = new NumberSearchExample(txtNum, indColor1, indColor2,indColor3, indType); matrix.add(Ex); } int mMatrixSize = mNumberSearchSize * mNumberSearchSize; while (matrix.size() != mMatrixSize) { int indPlace = random.nextInt(matrix.size()); matrix.add(indPlace % matrix.size(), null); } boolean AnswerIsFound = false; while (!AnswerIsFound) { indAnswer = Math.abs(random.nextInt() % mMatrixSize); if (matrix.get(indAnswer) != null) { AnswerIsFound = true; Question = matrix.get(indAnswer).getWord(); } } drawExamplesAndAnswers(); } private void drawExamplesAndAnswers() { Random random = new Random(); TableLayout layout = (TableLayout) findViewById(R.id.tableNumberSearch); //layout.removeAllViews(); layout.setStretchAllColumns(true); layout.setShrinkAllColumns(true); //layout.setBackgroundColor(Color.BLACK); for (Integer numString = 1; numString <= mNumberSearchSize; numString++) { System.out.println("numString:" + String.valueOf(numString)); TableRow row = new TableRow(this); row.setMinimumHeight(mHeight); row.setMinimumWidth(mWidth); row.setGravity(Gravity.CENTER); for (int numColumn = 1; numColumn <= mNumberSearchSize; numColumn++) { System.out.println("numColumn:" + String.valueOf(numColumn)); Button but = (Button) findViewById(600 + (numString - 1) * mNumberSearchSize + numColumn); if (but == null) { but = new Button(this); but.setId(600 + (numString - 1) * mNumberSearchSize + numColumn); but.setMinimumHeight(mHeight); but.setWidth(mWidth); but.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT, 1f)); //but.setPadding(5,5,5,5); row.addView(but); } but.setTextSize(mTextSize); NumberSearchExample Ex = matrix.get((numString - 1) * mNumberSearchSize + numColumn - 1); System.out.println("Число:" + String.valueOf((numString - 1) * mNumberSearchSize + numColumn - 1)); if (Ex == null) { but.setText("0000"); but.setTextColor(Color.WHITE); but.setBackgroundResource(R.drawable.textview_border); } else { but.setText(String.valueOf(Ex.getWord())); //but.setBackgroundColor(Ex.getColor()); int type = Ex.getType(); if (type == 1) { final AnimationDrawable drawable = new AnimationDrawable(); final Handler handler = new Handler(); int ms1 = Math.abs(random.nextInt() % 1000); int ms2 = Math.abs(random.nextInt() % 1000); int ms3 = Math.abs(random.nextInt() % 1000); drawable.addFrame(new ColorDrawable(alphabetColors.get(Ex.getColor1())), ms1); drawable.addFrame(new ColorDrawable(alphabetColors.get(Ex.getColor2())), ms2); drawable.addFrame(new ColorDrawable(alphabetColors.get(Ex.getColor3())), ms3); drawable.setOneShot(false); but.setBackgroundDrawable(drawable); handler.postDelayed(new Runnable() { @Override public void run() { drawable.start(); } }, 100); } else if (type == 0) { but.setBackgroundColor(alphabetColors.get(Ex.getColor1())); } else if (type == 2) { ElementsWithFontSizeChanges.add((numString - 1) * mNumberSearchSize + numColumn - 1); but.setBackgroundColor(alphabetColors.get(Ex.getColor1())); } //mNumberSearchTextSize = (int) (Math.min(mWidth, mHeight) / 3 / getApplicationContext().getResources().getDisplayMetrics().density) + mNumberSearchFontSizeChange; but.setTextSize(mTextSize); but.setGravity(Gravity.CENTER); //but.setBackgroundResource(R.drawable.textview_border); but.setTextColor(Color.WHITE); but.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { button_onClick(v); } }); } } layout.addView(row); } int exampleID = getResources().getIdentifier("tvNumberSearchExample", "id", getPackageName()); TextView txtExample = (TextView) findViewById(exampleID); if (txtExample != null) { txtExample.setText("Ищем слово: "+Question); txtExample.setTextSize(mTextSize+2); } } public void button_onClick(View view) { if (mChronometerIsWorking) { //int a = Integer.valueOf(String.valueOf(((AppCompatTextView) view).getText().charAt(0))); int a = view.getId() % 100; if (a - 1 == indAnswer) { mCountRightAnswers++; } mCountAllAnswers++; mNumberSearchExBeginTime = elapsedMillis; int timerExID = getResources().getIdentifier("tvNumberSearchTimerExTime", "id", getPackageName()); TextView txtTimerExTime = (TextView) findViewById(timerExID); if (mNumberSearchExampleTime != 0) { if (txtTimerExTime != null) { String txt = "Пример: " + String.valueOf(mNumberSearchExampleTime); txtTimerExTime.setText(txt); txtTimerExTime.setTextSize(mTextSize); } } int answerID = getResources().getIdentifier("tvNumberSearchAnswers", "id", getPackageName()); TextView txtAnswer = (TextView) findViewById(answerID); if (txtAnswer != null) { String txt = String.valueOf(mCountRightAnswers) + "/" + String.valueOf(mCountAllAnswers); txtAnswer.setText(txt); txtAnswer.setTextSize(mTextSize); } createExample(); } } public void NumberSearchOptions_onClick(View view) { Intent intent = new Intent(NumberSearchActivity.this, NumberSearchActivityOptions.class); intent.putExtra("mNumberSearchTextSize", mTextSize - mNumberSearchFontSizeChange); startActivity(intent); } private void ChangeButtonText(String ButtonID, String ButtonText) { int resID = getResources().getIdentifier(ButtonID, "id", getPackageName()); Button but = (Button) findViewById(resID); if (but != null) { but.setText(ButtonText); } } public void buttonHome_onClick(View view) { Intent intent = new Intent(getApplicationContext(), MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } private void getPreferencesFromFile() { mSettings = getSharedPreferences(MainActivity.APP_PREFERENCES, Context.MODE_PRIVATE); if (mSettings.contains(MainActivity.APP_PREFERENCES_NUMBER_SEARCH_FONT_SIZE_CHANGE)) { // Получаем язык из настроек mNumberSearchFontSizeChange = mSettings.getInt(MainActivity.APP_PREFERENCES_NUMBER_SEARCH_FONT_SIZE_CHANGE, 0); } else { mNumberSearchFontSizeChange = 0; } mNumberSearchLang = "Digit"; if (mSettings.contains(MainActivity.APP_PREFERENCES_NUMBER_SEARCH_LANGUAGE)) { // Получаем язык из настроек try { mNumberSearchLang = mSettings.getString(MainActivity.APP_PREFERENCES_NUMBER_SEARCH_LANGUAGE, "Digit"); } catch (Exception e) { mNumberSearchLang = "Digit"; } } else { mNumberSearchLang = "Digit"; } if (mSettings.contains(MainActivity.APP_PREFERENCES_NUMBER_SEARCH_SIZE)) { // Получаем язык из настроек try { mNumberSearchSize = mSettings.getInt(MainActivity.APP_PREFERENCES_NUMBER_SEARCH_SIZE, 5); } catch (Exception e) { mNumberSearchSize = 5; } } else { mNumberSearchSize = 5; } if (mSettings.contains(MainActivity.APP_PREFERENCES_NUMBER_SEARCH_NUMBER_SYMBOLS)) { // Получаем язык из настроек try { mNumberSearchNumberSymbols = mSettings.getInt(MainActivity.APP_PREFERENCES_NUMBER_SEARCH_NUMBER_SYMBOLS, 4); } catch (Exception e) { mNumberSearchNumberSymbols = 4; } } else { mNumberSearchNumberSymbols = 4; } if (mSettings.contains(MainActivity.APP_PREFERENCES_NUMBER_SEARCH_TEST_TIME)) { mNumberSearchMaxTime = mSettings.getInt(MainActivity.APP_PREFERENCES_NUMBER_SEARCH_TEST_TIME, 60); } else { mNumberSearchMaxTime = 60; } if (mSettings.contains(MainActivity.APP_PREFERENCES_NUMBER_SEARCH_EXAMPLE_TIME)) { mNumberSearchExampleTime = mSettings.getInt(MainActivity.APP_PREFERENCES_NUMBER_SEARCH_EXAMPLE_TIME, 0); } else { mNumberSearchExampleTime = 0; } alphabetColors.add(Color.RED); alphabetColors.add(Color.parseColor("#FFA500")); alphabetColors.add(Color.parseColor("#53b814")); alphabetColors.add(Color.parseColor("#FF7B15CE")); alphabetColors.add(Color.BLUE); alphabetColors.add(Color.parseColor("#EE82EE")); alphabetColors.add(Color.parseColor("#8B4513")); //MainActivity.MyLogger(TAG,"Тест"); } private class NumberSearchExample { private String word; private int color1; private int color2; private int color3; private int type; public NumberSearchExample(String word, int color1, int color2,int color3, int type) { this.word = word; this.color1 = color1; this.color2 = color2; this.color3 = color3; this.type = type; } public String getWord() { return word; } public void setWord(String word) { this.word = word; } public int getColor1() { return color1; } public void setColor1(int color1) { this.color1 = color1; } public int getColor2() { return color2; } public void setColor2(int color2) { this.color2 = color2; } public int getType() { return type; } public void setType(int type) { this.type = type; } public int getColor3() { return color3; } public void setColor3(int color3) { this.color3 = color3; } } }
package com.mysql.cj; import com.mysql.cj.exceptions.FeatureNotAvailableException; import com.mysql.cj.util.StringUtils; import java.math.BigDecimal; import java.math.BigInteger; import java.sql.Date; import java.sql.SQLType; import java.sql.Time; import java.sql.Timestamp; public enum MysqlType implements SQLType { DECIMAL("DECIMAL", 3, BigDecimal.class, 64, true, Long.valueOf(65L), "[(M[,D])] [UNSIGNED] [ZEROFILL]"), DECIMAL_UNSIGNED("DECIMAL UNSIGNED", 3, BigDecimal.class, 96, true, Long.valueOf(65L), "[(M[,D])] [UNSIGNED] [ZEROFILL]"), TINYINT("TINYINT", -6, Integer.class, 64, true, Long.valueOf(3L), "[(M)] [UNSIGNED] [ZEROFILL]"), TINYINT_UNSIGNED("TINYINT UNSIGNED", -6, Integer.class, 96, true, Long.valueOf(3L), "[(M)] [UNSIGNED] [ZEROFILL]"), BOOLEAN("BOOLEAN", 16, Boolean.class, 0, false, Long.valueOf(3L), ""), SMALLINT("SMALLINT", 5, Integer.class, 64, true, Long.valueOf(5L), "[(M)] [UNSIGNED] [ZEROFILL]"), SMALLINT_UNSIGNED("SMALLINT UNSIGNED", 5, Integer.class, 96, true, Long.valueOf(5L), "[(M)] [UNSIGNED] [ZEROFILL]"), INT("INT", 4, Integer.class, 64, true, Long.valueOf(10L), "[(M)] [UNSIGNED] [ZEROFILL]"), INT_UNSIGNED("INT UNSIGNED", 4, Long.class, 96, true, Long.valueOf(10L), "[(M)] [UNSIGNED] [ZEROFILL]"), FLOAT("FLOAT", 7, Float.class, 64, true, Long.valueOf(12L), "[(M,D)] [UNSIGNED] [ZEROFILL]"), FLOAT_UNSIGNED("FLOAT UNSIGNED", 7, Float.class, 96, true, Long.valueOf(12L), "[(M,D)] [UNSIGNED] [ZEROFILL]"), DOUBLE("DOUBLE", 8, Double.class, 64, true, Long.valueOf(22L), "[(M,D)] [UNSIGNED] [ZEROFILL]"), DOUBLE_UNSIGNED("DOUBLE UNSIGNED", 8, Double.class, 96, true, Long.valueOf(22L), "[(M,D)] [UNSIGNED] [ZEROFILL]"), NULL("NULL", 0, Object.class, 0, false, Long.valueOf(0L), ""), TIMESTAMP("TIMESTAMP", 93, Timestamp.class, 0, false, Long.valueOf(26L), "[(fsp)]"), BIGINT("BIGINT", -5, Long.class, 64, true, Long.valueOf(19L), "[(M)] [UNSIGNED] [ZEROFILL]"), BIGINT_UNSIGNED("BIGINT UNSIGNED", -5, BigInteger.class, 96, true, Long.valueOf(20L), "[(M)] [UNSIGNED] [ZEROFILL]"), MEDIUMINT("MEDIUMINT", 4, Integer.class, 64, true, Long.valueOf(7L), "[(M)] [UNSIGNED] [ZEROFILL]"), MEDIUMINT_UNSIGNED("MEDIUMINT UNSIGNED", 4, Integer.class, 96, true, Long.valueOf(8L), "[(M)] [UNSIGNED] [ZEROFILL]"), DATE("DATE", 91, Date.class, 0, false, Long.valueOf(10L), ""), TIME("TIME", 92, Time.class, 0, false, Long.valueOf(16L), "[(fsp)]"), DATETIME("DATETIME", 93, Timestamp.class, 0, false, Long.valueOf(26L), "[(fsp)]"), YEAR("YEAR", 91, Date.class, 0, false, Long.valueOf(4L), "[(4)]"), VARCHAR("VARCHAR", 12, String.class, 0, false, Long.valueOf(65535L), "(M) [CHARACTER SET charset_name] [COLLATE collation_name]"), VARBINARY("VARBINARY", -3, null, 0, false, Long.valueOf(65535L), "(M)"), BIT("BIT", -7, Boolean.class, 0, true, Long.valueOf(1L), "[(M)]"), JSON("JSON", -1, String.class, 0, false, Long.valueOf(1073741824L), ""), ENUM("ENUM", 1, String.class, 0, false, Long.valueOf(65535L), "('value1','value2',...) [CHARACTER SET charset_name] [COLLATE collation_name]"), SET("SET", 1, String.class, 0, false, Long.valueOf(64L), "('value1','value2',...) [CHARACTER SET charset_name] [COLLATE collation_name]"), TINYBLOB("TINYBLOB", -3, null, 0, false, Long.valueOf(255L), ""), TINYTEXT("TINYTEXT", 12, String.class, 0, false, Long.valueOf(255L), " [CHARACTER SET charset_name] [COLLATE collation_name]"), MEDIUMBLOB("MEDIUMBLOB", -4, null, 0, false, Long.valueOf(16777215L), ""), MEDIUMTEXT("MEDIUMTEXT", -1, String.class, 0, false, Long.valueOf(16777215L), " [CHARACTER SET charset_name] [COLLATE collation_name]"), LONGBLOB("LONGBLOB", -4, null, 0, false, Long.valueOf(4294967295L), ""), LONGTEXT("LONGTEXT", -1, String.class, 0, false, Long.valueOf(4294967295L), " [CHARACTER SET charset_name] [COLLATE collation_name]"), BLOB("BLOB", -4, null, 0, false, Long.valueOf(65535L), "[(M)]"), TEXT("TEXT", -1, String.class, 0, false, Long.valueOf(65535L), "[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]"), CHAR("CHAR", 1, String.class, 0, false, Long.valueOf(255L), "[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]"), BINARY("BINARY", -2, null, 0, false, Long.valueOf(255L), "(M)"), GEOMETRY("GEOMETRY", -2, null, 0, false, Long.valueOf(65535L), ""), UNKNOWN("UNKNOWN", 1111, null, 0, false, Long.valueOf(65535L), ""); private final String name; protected int jdbcType; protected final Class<?> javaClass; private final int flagsMask; private final boolean isDecimal; private final Long precision; private final String createParams; public static final int FIELD_FLAG_NOT_NULL = 1; public static final int FIELD_FLAG_PRIMARY_KEY = 2; public static final int FIELD_FLAG_UNIQUE_KEY = 4; public static final int FIELD_FLAG_MULTIPLE_KEY = 8; public static final int FIELD_FLAG_BLOB = 16; public static final int FIELD_FLAG_UNSIGNED = 32; public static final int FIELD_FLAG_ZEROFILL = 64; public static final int FIELD_FLAG_BINARY = 128; public static final int FIELD_FLAG_AUTO_INCREMENT = 512; private static final boolean IS_DECIMAL = true; private static final boolean IS_NOT_DECIMAL = false; public static final int FIELD_TYPE_DECIMAL = 0; public static final int FIELD_TYPE_TINY = 1; public static final int FIELD_TYPE_SHORT = 2; public static final int FIELD_TYPE_LONG = 3; public static final int FIELD_TYPE_FLOAT = 4; public static final int FIELD_TYPE_DOUBLE = 5; public static final int FIELD_TYPE_NULL = 6; public static final int FIELD_TYPE_TIMESTAMP = 7; public static final int FIELD_TYPE_LONGLONG = 8; public static final int FIELD_TYPE_INT24 = 9; public static final int FIELD_TYPE_DATE = 10; public static final int FIELD_TYPE_TIME = 11; public static final int FIELD_TYPE_DATETIME = 12; public static final int FIELD_TYPE_YEAR = 13; public static final int FIELD_TYPE_VARCHAR = 15; public static final int FIELD_TYPE_BIT = 16; public static final int FIELD_TYPE_JSON = 245; public static final int FIELD_TYPE_NEWDECIMAL = 246; public static final int FIELD_TYPE_ENUM = 247; public static final int FIELD_TYPE_SET = 248; public static final int FIELD_TYPE_TINY_BLOB = 249; public static final int FIELD_TYPE_MEDIUM_BLOB = 250; public static final int FIELD_TYPE_LONG_BLOB = 251; public static final int FIELD_TYPE_BLOB = 252; public static final int FIELD_TYPE_VAR_STRING = 253; public static final int FIELD_TYPE_STRING = 254; public static final int FIELD_TYPE_GEOMETRY = 255; public static MysqlType getByName(String fullMysqlTypeName) { String typeName = ""; if (fullMysqlTypeName.indexOf("(") != -1) { typeName = fullMysqlTypeName.substring(0, fullMysqlTypeName.indexOf("(")).trim(); } else { typeName = fullMysqlTypeName; } if (StringUtils.indexOfIgnoreCase(typeName, "DECIMAL") != -1 || StringUtils.indexOfIgnoreCase(typeName, "DEC") != -1 || StringUtils.indexOfIgnoreCase(typeName, "NUMERIC") != -1 || StringUtils.indexOfIgnoreCase(typeName, "FIXED") != -1) return (StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "UNSIGNED") != -1) ? DECIMAL_UNSIGNED : DECIMAL; if (StringUtils.indexOfIgnoreCase(typeName, "TINYBLOB") != -1) return TINYBLOB; if (StringUtils.indexOfIgnoreCase(typeName, "TINYTEXT") != -1) return TINYTEXT; if (StringUtils.indexOfIgnoreCase(typeName, "TINYINT") != -1 || StringUtils.indexOfIgnoreCase(typeName, "TINY") != -1 || StringUtils.indexOfIgnoreCase(typeName, "INT1") != -1) return (StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "UNSIGNED") != -1 || StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "ZEROFILL") != -1) ? TINYINT_UNSIGNED : TINYINT; if (StringUtils.indexOfIgnoreCase(typeName, "MEDIUMINT") != -1 || StringUtils.indexOfIgnoreCase(typeName, "INT24") != -1 || StringUtils.indexOfIgnoreCase(typeName, "INT3") != -1 || StringUtils.indexOfIgnoreCase(typeName, "MIDDLEINT") != -1) return (StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "UNSIGNED") != -1 || StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "ZEROFILL") != -1) ? MEDIUMINT_UNSIGNED : MEDIUMINT; if (StringUtils.indexOfIgnoreCase(typeName, "SMALLINT") != -1 || StringUtils.indexOfIgnoreCase(typeName, "INT2") != -1) return (StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "UNSIGNED") != -1 || StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "ZEROFILL") != -1) ? SMALLINT_UNSIGNED : SMALLINT; if (StringUtils.indexOfIgnoreCase(typeName, "BIGINT") != -1 || StringUtils.indexOfIgnoreCase(typeName, "SERIAL") != -1 || StringUtils.indexOfIgnoreCase(typeName, "INT8") != -1) return (StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "UNSIGNED") != -1 || StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "ZEROFILL") != -1) ? BIGINT_UNSIGNED : BIGINT; if (StringUtils.indexOfIgnoreCase(typeName, "POINT") != -1) return GEOMETRY; if (StringUtils.indexOfIgnoreCase(typeName, "INT") != -1 || StringUtils.indexOfIgnoreCase(typeName, "INTEGER") != -1 || StringUtils.indexOfIgnoreCase(typeName, "INT4") != -1) return (StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "UNSIGNED") != -1 || StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "ZEROFILL") != -1) ? INT_UNSIGNED : INT; if (StringUtils.indexOfIgnoreCase(typeName, "DOUBLE") != -1 || StringUtils.indexOfIgnoreCase(typeName, "REAL") != -1 || StringUtils.indexOfIgnoreCase(typeName, "FLOAT8") != -1) return (StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "UNSIGNED") != -1 || StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "ZEROFILL") != -1) ? DOUBLE_UNSIGNED : DOUBLE; if (StringUtils.indexOfIgnoreCase(typeName, "FLOAT") != -1) return (StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "UNSIGNED") != -1 || StringUtils.indexOfIgnoreCase(fullMysqlTypeName, "ZEROFILL") != -1) ? FLOAT_UNSIGNED : FLOAT; if (StringUtils.indexOfIgnoreCase(typeName, "NULL") != -1) return NULL; if (StringUtils.indexOfIgnoreCase(typeName, "TIMESTAMP") != -1) return TIMESTAMP; if (StringUtils.indexOfIgnoreCase(typeName, "DATETIME") != -1) return DATETIME; if (StringUtils.indexOfIgnoreCase(typeName, "DATE") != -1) return DATE; if (StringUtils.indexOfIgnoreCase(typeName, "TIME") != -1) return TIME; if (StringUtils.indexOfIgnoreCase(typeName, "YEAR") != -1) return YEAR; if (StringUtils.indexOfIgnoreCase(typeName, "LONGBLOB") != -1) return LONGBLOB; if (StringUtils.indexOfIgnoreCase(typeName, "LONGTEXT") != -1) return LONGTEXT; if (StringUtils.indexOfIgnoreCase(typeName, "MEDIUMBLOB") != -1 || StringUtils.indexOfIgnoreCase(typeName, "LONG VARBINARY") != -1) return MEDIUMBLOB; if (StringUtils.indexOfIgnoreCase(typeName, "MEDIUMTEXT") != -1 || StringUtils.indexOfIgnoreCase(typeName, "LONG VARCHAR") != -1 || StringUtils.indexOfIgnoreCase(typeName, "LONG") != -1) return MEDIUMTEXT; if (StringUtils.indexOfIgnoreCase(typeName, "VARCHAR") != -1 || StringUtils.indexOfIgnoreCase(typeName, "NVARCHAR") != -1 || StringUtils.indexOfIgnoreCase(typeName, "NATIONAL VARCHAR") != -1 || StringUtils.indexOfIgnoreCase(typeName, "CHARACTER VARYING") != -1) return VARCHAR; if (StringUtils.indexOfIgnoreCase(typeName, "VARBINARY") != -1) return VARBINARY; if (StringUtils.indexOfIgnoreCase(typeName, "BINARY") != -1 || StringUtils.indexOfIgnoreCase(typeName, "CHAR BYTE") != -1) return BINARY; if (StringUtils.indexOfIgnoreCase(typeName, "LINESTRING") != -1) return GEOMETRY; if (StringUtils.indexOfIgnoreCase(typeName, "STRING") != -1 || StringUtils.indexOfIgnoreCase(typeName, "CHAR") != -1 || StringUtils.indexOfIgnoreCase(typeName, "NCHAR") != -1 || StringUtils.indexOfIgnoreCase(typeName, "NATIONAL CHAR") != -1 || StringUtils.indexOfIgnoreCase(typeName, "CHARACTER") != -1) return CHAR; if (StringUtils.indexOfIgnoreCase(typeName, "BOOLEAN") != -1 || StringUtils.indexOfIgnoreCase(typeName, "BOOL") != -1) return BOOLEAN; if (StringUtils.indexOfIgnoreCase(typeName, "BIT") != -1) return BIT; if (StringUtils.indexOfIgnoreCase(typeName, "JSON") != -1) return JSON; if (StringUtils.indexOfIgnoreCase(typeName, "ENUM") != -1) return ENUM; if (StringUtils.indexOfIgnoreCase(typeName, "SET") != -1) return SET; if (StringUtils.indexOfIgnoreCase(typeName, "BLOB") != -1) return BLOB; if (StringUtils.indexOfIgnoreCase(typeName, "TEXT") != -1) return TEXT; if (StringUtils.indexOfIgnoreCase(typeName, "GEOM") != -1 || StringUtils.indexOfIgnoreCase(typeName, "POINT") != -1 || StringUtils.indexOfIgnoreCase(typeName, "POLYGON") != -1) return GEOMETRY; return UNKNOWN; } public static MysqlType getByJdbcType(int jdbcType) { switch (jdbcType) { case -5: return BIGINT; case -2: return BINARY; case -7: return BIT; case 16: return BOOLEAN; case -15: case 1: return CHAR; case 91: return DATE; case 2: case 3: return DECIMAL; case 6: case 8: return DOUBLE; case 4: return INT; case -4: case 2000: case 2004: return BLOB; case -16: case -1: case 2005: case 2011: return TEXT; case 0: return NULL; case 7: return FLOAT; case 5: return SMALLINT; case 92: return TIME; case 93: return TIMESTAMP; case -6: return TINYINT; case -3: return VARBINARY; case -9: case 12: case 70: case 2009: return VARCHAR; case 2012: throw new FeatureNotAvailableException("REF_CURSOR type is not supported"); case 2013: throw new FeatureNotAvailableException("TIME_WITH_TIMEZONE type is not supported"); case 2014: throw new FeatureNotAvailableException("TIMESTAMP_WITH_TIMEZONE type is not supported"); } return UNKNOWN; } public static boolean supportsConvert(int fromType, int toType) { switch (fromType) { case -4: case -3: case -2: case -1: case 1: case 12: switch (toType) { case -6: case -5: case -4: case -3: case -2: case -1: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 12: case 91: case 92: case 93: case 1111: return true; } return false; case -7: return false; case -6: case -5: case 2: case 3: case 4: case 5: case 6: case 7: case 8: switch (toType) { case -6: case -5: case -4: case -3: case -2: case -1: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 12: return true; } return false; case 0: return false; case 1111: switch (toType) { case -4: case -3: case -2: case -1: case 1: case 12: return true; } return false; case 91: switch (toType) { case -4: case -3: case -2: case -1: case 1: case 12: return true; } return false; case 92: switch (toType) { case -4: case -3: case -2: case -1: case 1: case 12: return true; } return false; case 93: switch (toType) { case -4: case -3: case -2: case -1: case 1: case 12: case 91: case 92: return true; } return false; } return false; } public static boolean isSigned(MysqlType type) { switch (type) { case DECIMAL: case TINYINT: case SMALLINT: case INT: case BIGINT: case MEDIUMINT: case FLOAT: case DOUBLE: return true; } return false; } MysqlType(String mysqlTypeName, int jdbcType, Class<?> javaClass, int allowedFlags, boolean isDec, Long precision, String createParams) { this.name = mysqlTypeName; this.jdbcType = jdbcType; this.javaClass = javaClass; this.flagsMask = allowedFlags; this.isDecimal = isDec; this.precision = precision; this.createParams = createParams; } public String getName() { return this.name; } public int getJdbcType() { return this.jdbcType; } public boolean isAllowed(int flag) { return ((this.flagsMask & flag) > 0); } public String getClassName() { if (this.javaClass == null) return "[B"; return this.javaClass.getName(); } public boolean isDecimal() { return this.isDecimal; } public Long getPrecision() { return this.precision; } public String getCreateParams() { return this.createParams; } public String getVendor() { return "com.mysql.cj"; } public Integer getVendorTypeNumber() { return Integer.valueOf(this.jdbcType); } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\com\mysql\cj\MysqlType.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
package springjpa.repository; import org.springframework.data.jpa.repository.JpaRepository; import springjpa.entity.Dept; public interface DeptRepository extends JpaRepository<Dept, Long>{ }
package adp.group10.roomates.activities; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.ChildEventListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import adp.group10.roomates.R; import adp.group10.roomates.backend.FirebaseHandler; import adp.group10.roomates.backend.model.AvailableItem; import adp.group10.roomates.backend.model.User; public class CreateGroupActivity extends AppCompatActivity { public static class Group { public String GroupDesc; public String GroupName; public Group(String GroupDesc) { this.GroupDesc = GroupDesc; } public Group(String GroupDesc, String GroupName) { this.GroupDesc = GroupDesc; this.GroupName = GroupName; } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create_group); } public void onClick_CreateGroup(View view) { final EditText etGroupname = (EditText) findViewById(R.id.etGroupName); final EditText etGroupdesc = (EditText) findViewById(R.id.etGroupdesc); if (etGroupname.getText().toString().length() == 0) { etGroupname.setError("Group name is required"); etGroupname.requestFocus(); } else { final FirebaseDatabase database = FirebaseDatabase.getInstance(); final DatabaseReference groupsRef = FirebaseDatabase.getInstance().getReference().child("GROUPS"); groupsRef.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if ( dataSnapshot.child(etGroupname.getText().toString()).getValue() != null) { etGroupname.setError( "Group already exists"); } else if (etGroupname.getText().toString().length() > 8) { etGroupname.setError( "Max length is 8 characters"); } else { // add the group Map<String, CreateGroupActivity.Group> GROUPS = new HashMap<String, CreateGroupActivity.Group>(); CreateGroupActivity.Group vgroup = new CreateGroupActivity.Group( etGroupdesc.getText().toString()); groupsRef.child(etGroupname.getText().toString()).setValue(vgroup); final DatabaseReference groupsRef = FirebaseDatabase.getInstance().getReference().child("GROUPS"); final DatabaseReference groupList = FirebaseDatabase.getInstance().getReference( FirebaseHandler.KEY_GROUPUSER + "/" + etGroupname.getText().toString() + "/" + LoginActivity.currentuser); final DatabaseReference userRef = FirebaseDatabase.getInstance().getReference( "users/" + LoginActivity.currentuser + "/groups"); JoinGroupActivity.GROUPUSER newUser = new JoinGroupActivity.GROUPUSER( "0", "0"); groupList.setValue(newUser); userRef.push().setValue(new RegisterActivity.User(etGroupname.getText().toString())); DatabaseReference availableItemsRef = FirebaseDatabase.getInstance().getReference( "available-items" + "/" + etGroupname.getText()); LoginActivity.currentGroup = etGroupname.getText().toString(); for (AvailableItem item : standardItems) { availableItemsRef.push().setValue(item); } // TODO This will override an existing group //groupsRef.child(etGroupname.getText().toString()).getValue(vgroup); finish(); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } } private final static AvailableItem[] standardItems = new AvailableItem[] { new AvailableItem("Bread"), new AvailableItem("Milk"), new AvailableItem("Pasta"), new AvailableItem("Apple"), new AvailableItem("Cheese"), new AvailableItem("Eggs"), new AvailableItem("Corn Flakes"), new AvailableItem("Chicken"), new AvailableItem("Tomatoes") }; }
package com.healthyfish.healthyfish.ui.fragment; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.healthyfish.healthyfish.POJO.BeanHospDeptListReq; import com.healthyfish.healthyfish.POJO.BeanHospDeptListRespItem; import com.healthyfish.healthyfish.ui.activity.SearchResult; import com.healthyfish.healthyfish.utils.DividerGridItemDecoration; import com.healthyfish.healthyfish.R; import com.healthyfish.healthyfish.adapter.InterrogationRvAdapter; import com.healthyfish.healthyfish.utils.MyRecyclerViewOnItemListener; import com.healthyfish.healthyfish.ui.activity.interrogation.ChoiceDoctor; import com.healthyfish.healthyfish.utils.MyToast; import com.healthyfish.healthyfish.utils.OkHttpUtils; import com.healthyfish.healthyfish.utils.RetrofitManagerUtils; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; import okhttp3.ResponseBody; import rx.Subscriber; /** * A simple {@link Fragment} subclass. */ public class InterrogationFragment extends Fragment { @BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.iv_search) ImageView ivSearch; @BindView(R.id.et_search) EditText etSearch; @BindView(R.id.rv_choice_department) RecyclerView rvChoiceDepartment; Unbinder unbinder; private Context mContext; View rootView; private InterrogationRvAdapter mRvAdapter; private List<BeanHospDeptListRespItem> DeptList = new ArrayList<>(); public InterrogationFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mContext = getActivity(); rootView = inflater.inflate(R.layout.fragment_interrogation, container, false); unbinder = ButterKnife.bind(this, rootView); rvListener(); initRecycleView(); searchListener(); return rootView; } /** * 搜索功能 */ private void searchListener() { etSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { Intent intent = new Intent(getActivity(), SearchResult.class); Bundle bundle = new Bundle(); bundle.putString("SEARCH_KEY",etSearch.getText().toString()); intent.putExtras(bundle); startActivity(intent); } return true; } }); } /** * RecyclerView的监听 */ private void rvListener() { rvChoiceDepartment.addOnItemTouchListener(new MyRecyclerViewOnItemListener(mContext, rvChoiceDepartment, new MyRecyclerViewOnItemListener.OnItemClickListener() { @Override public void onItemClick(View view, int position) { //跳转到该科室的医生列表,需要发送科室信息到后台获取科室医生列表信息,传入下一个页面 Intent intent = new Intent(mContext,ChoiceDoctor.class); Bundle bundle = new Bundle(); bundle.putString("DepartmentName",DeptList.get(position).getDEPT_NAME()); bundle.putString("DepartmentCode",DeptList.get(position).getDEPT_CODE()); intent.putExtras(bundle); startActivity(intent); } @Override public void onItemLongClick(View view, int position) { MyToast.showToast(mContext,"长按"+String.valueOf(position)); } })); } /** * 初始化科室数据 */ private void initRecycleView() { final List<String> mDepartments = new ArrayList<>(); final List<Integer> mDepartmentIcons = new ArrayList<>(); final int[] icons = new int[]{R.mipmap.ic_chinese_medicine}; BeanHospDeptListReq beanHospDeptListReq = new BeanHospDeptListReq(); beanHospDeptListReq.setHosp("lzzyy"); RetrofitManagerUtils.getInstance(getActivity(), null) .getHealthyInfoByRetrofit(OkHttpUtils.getRequestBody(beanHospDeptListReq), new Subscriber<ResponseBody>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { } @Override public void onNext(ResponseBody responseBody) { String jsonStr = null; try { jsonStr = responseBody.string(); } catch (IOException e) { e.printStackTrace(); } List<JSONObject> beanHospDeptListResp = JSONArray.parseObject(jsonStr,List.class); for (JSONObject object :beanHospDeptListResp){ String jsonString = object.toJSONString(); BeanHospDeptListRespItem beanHospDeptListRespItem = JSON.parseObject(jsonString,BeanHospDeptListRespItem.class); DeptList.add(beanHospDeptListRespItem); mDepartments.add(beanHospDeptListRespItem.getDEPT_NAME()); mDepartmentIcons.add(icons[0]); } mRvAdapter.notifyDataSetChanged(); } }); GridLayoutManager gridLayoutManager=new GridLayoutManager(mContext,4); rvChoiceDepartment.setLayoutManager(gridLayoutManager); mRvAdapter = new InterrogationRvAdapter(mContext,mDepartments,mDepartmentIcons); rvChoiceDepartment.setAdapter(mRvAdapter); rvChoiceDepartment.addItemDecoration(new DividerGridItemDecoration(mContext)); } @Override public void onDestroyView() { super.onDestroyView(); unbinder.unbind(); } }
import java.awt.Color; import java.util.HashMap; import java.util.Map; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot.Plot; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.DefaultXYDataset; import org.jfree.data.xy.IntervalXYDataset; import org.jfree.data.xy.XYBarDataset; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; /** * * @author Slaush */ public class GeneradorDeGraphicas { private static final int AXIS = 2; //EJES EN EL PLANO! private static GeneradorDeGraphicas instance; private GeneradorDeGraphicas(){} public static GeneradorDeGraphicas getInstance() { if(instance == null) instance = new GeneradorDeGraphicas(); return instance; } public JFreeChart drawSignal(IEvaluableEnTiempo s, int from, int to,double unidad) { int frames = to - from; double [][] matrix = new double[AXIS][frames]; DefaultXYDataset dataset = new DefaultXYDataset(); fillMatrix(matrix,to,from,unidad); fillMatrix(matrix,s,frames); dataset.addSeries(s.getTipo(), matrix); JFreeChart chart = ChartFactory.createXYLineChart ( "", // The chart title "t(seg)", // x axis label "A(V)", // y axis label dataset, // The dataset for the chart PlotOrientation.VERTICAL, true, // Is a legend required? true, // Use tooltips false // Configure chart to generate URLs? ); XYPlot plot = chart.getXYPlot(); plot.getRenderer().setSeriesPaint(0, new Color(60,76,92)); return chart; } private void fillMatrix(double [][] matrix, IEvaluableEnTiempo e,int frames) { for (int i = 0;i<frames ; i++) { matrix[1][i]=e.evaluate(matrix[0][i]); } } private void fillMatrix(double[][] matrix, int to, int from, double unidad) { int frames = to - from; for(int i = 0; i<frames; i++) { matrix[0][i]=(double)(to-i)/unidad; } } public JFreeChart drawSpectro(HashMap<Double,Double> spectro) { IntervalXYDataset dataset = createBarDataSet(spectro); JFreeChart chart = ChartFactory.createXYBarChart ( "Espectro de Frecuencias", // The chart title "Hz", // x axis label false, // y axis label "V", dataset, // The dataset for the chart PlotOrientation.VERTICAL, false, // Is a legend required? false, // Use tooltips true // Configure chart to generate URLs? ); XYPlot plot = chart.getXYPlot(); for(int i = 0; i<spectro.size(); i++) { plot.getRenderer().setSeriesPaint(i, new Color(60,76,92)); } return chart; } private IntervalXYDataset createBarDataSet(HashMap<Double, Double> spectro) { XYSeriesCollection collection = new XYSeriesCollection(); String unit = evualuateSpectroUnit(spectro); Double value = 1.0; double valForSpectroUnit1 = -1; double spectroUnit2 = -2; for (Map.Entry<Double,Double> map : spectro.entrySet()) { value = map.getKey()/ConversorDeUnidades.getInstance().convertir(1, unit); XYSeries jn = new XYSeries(value); jn.add(Math.abs(map.getKey()),Math.abs(map.getValue())); collection.addSeries(jn); if(spectroUnit2 == -1) { spectroUnit2 = map.getKey(); } if(valForSpectroUnit1 == -1) { valForSpectroUnit1 = map.getKey(); spectroUnit2++; } } return new XYBarDataset(collection,(spectroUnit2-valForSpectroUnit1)/spectro.size()+0.5); } private String evualuateSpectroUnit(HashMap<Double, Double> spectro) { double minValue = Double.MAX_VALUE; for (Map.Entry<Double,Double> map : spectro.entrySet()) { if(map.getKey() < minValue) minValue = map.getKey(); } if(minValue > 1000000) return "MHz"; else if(minValue>1000) return "KHz"; else return "Hz"; } }
package com.ncr.terminal; /** * This Enum defines the states for a terminal. */ public enum Statuses { ACTIVE, ERROR, PENDING }
/* * 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 demo; import java.applet.Applet; import java.awt.Graphics; /** * * @author xubo */ public class DrawSin extends Applet { /** * Initialization method that will be called after the applet is loaded into * the browser. */ // public void init() { // // TODO start asynchronous download of heavy resources // } public void paint(Graphics g) { super.paint(g); double d, tx; int x, y, x0, y0; d = Math.PI / 100; x0 = y0 = 0; for (tx = 0, x = 20; tx <= 2 * Math.PI; tx += d,x++) { y = 120 - (int)(Math.sin(tx) * 50 + 60); if (x > 20) g.drawLine(x0, y0, x, y); // g.drawLine(x0, y0, x0, y0); x0 = x; y0 = y; g.drawString("y = sin (x)", 10, 70); } } // TODO overwrite start(), stop() and destroy() methods }
package Task1; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class JDBCExampleTest { @Test void dbInit() { JDBCExample.dbInit(); } @Test void updateMovie() { JDBCExample.updateMovie(2, "Fear and Loathing in SPb", "Kamil Yagafarov", 2018); assertEquals(JDBCExample.getMovie(2), "\"Fear and Loathing in SPb\", Kamil Yagafarov (2018)"); } @Test void getMovie() { assertEquals(JDBCExample.getMovie(1), "\"The Terminator\", James Francis Cameron (1984)"); } }
package com.sporsimdi.model.entity; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.ManyToOne; import javax.persistence.Table; import com.sporsimdi.model.base.ExtendedModel; @Table @Entity public class Ilce extends ExtendedModel { private static final long serialVersionUID = 8986161490957095179L; private String adi; @ManyToOne(fetch = FetchType.EAGER, optional = false) private Il il; public String getAdi() { return adi; } public void setAdi(String adi) { this.adi = adi; } public Il getIl() { return il; } public void setIl(Il il) { this.il = il; } }
/* * 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 gerenciador.funcionario; /** * * @author Raiane */ public class AlteraFuncionarioGUI extends javax.swing.JFrame { /** * Creates new form AlteraFuncionario */ public AlteraFuncionarioGUI() { initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { lblAnterior = new javax.swing.JLabel(); lblEdita = new javax.swing.JLabel(); lblInicio = new javax.swing.JLabel(); lblMinimiza = new javax.swing.JLabel(); lblBusca = new javax.swing.JLabel(); edtNome = new javax.swing.JTextField(); edtMatricula = new javax.swing.JTextField(); lblConfirma = new javax.swing.JLabel(); lblProximo = new javax.swing.JLabel(); lblHora = new javax.swing.JLabel(); lblData = new javax.swing.JLabel(); lblFecha = new javax.swing.JLabel(); jTabbedPane1 = new javax.swing.JTabbedPane(); paInfAdicionais = new javax.swing.JPanel(); jPanel9 = new javax.swing.JPanel(); laExame = new javax.swing.JLabel(); txCalExame = new javax.swing.JTextField(); txCalAvaliacao = new javax.swing.JTextField(); laAvaliacao = new javax.swing.JLabel(); jScrollPane3 = new javax.swing.JScrollPane(); atxObs1 = new javax.swing.JTextArea(); laObs1 = new javax.swing.JLabel(); laSituacao1 = new javax.swing.JLabel(); jComboBox7 = new javax.swing.JComboBox(); laDebito1 = new javax.swing.JLabel(); txDebito1 = new javax.swing.JTextField(); jCheckBox3 = new javax.swing.JCheckBox(); jPanel6 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); txPai = new javax.swing.JTextField(); laPai = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); paDados = new javax.swing.JPanel(); jPanel13 = new javax.swing.JPanel(); txCep = new javax.swing.JFormattedTextField(); jLabel7 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox(); jLabel5 = new javax.swing.JLabel(); jComboBox3 = new javax.swing.JComboBox(); jComboBox2 = new javax.swing.JComboBox(); jLabel4 = new javax.swing.JLabel(); jPanel14 = new javax.swing.JPanel(); txTelRes = new javax.swing.JTextField(); txNome = new javax.swing.JTextField(); txTelCom = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); txEndereco = new javax.swing.JTextField(); jLabel18 = new javax.swing.JLabel(); txIdentidade = new javax.swing.JTextField(); jLabel16 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel19 = new javax.swing.JLabel(); txCPF = new javax.swing.JTextField(); txCel = new javax.swing.JTextField(); jLabel17 = new javax.swing.JLabel(); txEmail = new javax.swing.JTextField(); jLabel8 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); txDataNascimento = new javax.swing.JFormattedTextField(); jLabel12 = new javax.swing.JLabel(); jComboBox6 = new javax.swing.JComboBox(); jPanel4 = new javax.swing.JPanel(); jLabel21 = new javax.swing.JLabel(); sexo_masc = new javax.swing.JRadioButton(); sexo_fem = new javax.swing.JRadioButton(); lblPesquisa = new javax.swing.JLabel(); lblFundo = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setUndecorated(true); setResizable(false); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); lblAnterior.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseEntered(java.awt.event.MouseEvent evt) { lblAnteriorMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { lblAnteriorMouseExited(evt); } }); getContentPane().add(lblAnterior, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 655, 117, 47)); lblEdita.setToolTipText(""); lblEdita.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseEntered(java.awt.event.MouseEvent evt) { lblEditaMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { lblEditaMouseExited(evt); } }); getContentPane().add(lblEdita, new org.netbeans.lib.awtextra.AbsoluteConstraints(295, 655, 117, 47)); lblInicio.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { lblInicioMouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { lblInicioMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { lblInicioMouseExited(evt); } }); getContentPane().add(lblInicio, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 655, 117, 47)); lblMinimiza.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { lblMinimizaMouseClicked(evt); } }); getContentPane().add(lblMinimiza, new org.netbeans.lib.awtextra.AbsoluteConstraints(1310, 40, 15, 15)); getContentPane().add(lblBusca, new org.netbeans.lib.awtextra.AbsoluteConstraints(1270, 90, 70, 60)); edtNome.setBorder(null); edtNome.setSelectionColor(new java.awt.Color(0, 153, 0)); getContentPane().add(edtNome, new org.netbeans.lib.awtextra.AbsoluteConstraints(1110, 90, 140, 20)); edtMatricula.setBorder(null); edtMatricula.setSelectionColor(new java.awt.Color(0, 153, 0)); getContentPane().add(edtMatricula, new org.netbeans.lib.awtextra.AbsoluteConstraints(1170, 115, 85, 23)); lblConfirma.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseEntered(java.awt.event.MouseEvent evt) { lblConfirmaMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { lblConfirmaMouseExited(evt); } }); getContentPane().add(lblConfirma, new org.netbeans.lib.awtextra.AbsoluteConstraints(657, 655, 117, 47)); lblProximo.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseEntered(java.awt.event.MouseEvent evt) { lblProximoMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { lblProximoMouseExited(evt); } }); getContentPane().add(lblProximo, new org.netbeans.lib.awtextra.AbsoluteConstraints(835, 651, 117, 47)); lblHora.setForeground(new java.awt.Color(255, 255, 255)); lblHora.setText("..."); getContentPane().add(lblHora, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 730, 200, 30)); lblData.setForeground(new java.awt.Color(255, 255, 255)); lblData.setText("..."); getContentPane().add(lblData, new org.netbeans.lib.awtextra.AbsoluteConstraints(860, 730, 220, 30)); lblFecha.setToolTipText(""); lblFecha.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { lblFechaMouseClicked(evt); } }); getContentPane().add(lblFecha, new org.netbeans.lib.awtextra.AbsoluteConstraints(1330, 40, 15, 15)); jTabbedPane1.setBackground(new java.awt.Color(153, 255, 153)); paInfAdicionais.setBackground(new java.awt.Color(255, 255, 255)); jPanel9.setBackground(new java.awt.Color(255, 255, 255)); laExame.setText("Validade do Exame Medico"); laAvaliacao.setText("Validade da Avaliação Fisica"); atxObs1.setColumns(20); atxObs1.setRows(5); jScrollPane3.setViewportView(atxObs1); laObs1.setText("Observações"); laSituacao1.setText("Pacote Contratado:"); jComboBox7.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); laDebito1.setText("Data Vencimento:"); jCheckBox3.setBackground(new java.awt.Color(255, 255, 255)); jCheckBox3.setText(" Menor de Idade"); jCheckBox3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBox3ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9); jPanel9.setLayout(jPanel9Layout); jPanel9Layout.setHorizontalGroup( jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup() .addGap(20, 20, 20) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(laExame) .addComponent(txCalExame, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel9Layout.createSequentialGroup() .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txDebito1) .addComponent(jComboBox7, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(laDebito1) .addComponent(laSituacao1, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jCheckBox3))) .addGap(24, 24, 24) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txCalAvaliacao) .addComponent(laAvaliacao) .addComponent(laObs1) .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel9Layout.setVerticalGroup( jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup() .addGap(22, 22, 22) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(laExame) .addComponent(laAvaliacao)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txCalExame, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txCalAvaliacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup() .addGap(29, 29, 29) .addComponent(laObs1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel9Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(laSituacao1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jComboBox7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(laDebito1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txDebito1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jCheckBox3)))) .addContainerGap(38, Short.MAX_VALUE)) ); jPanel6.setBackground(new java.awt.Color(255, 255, 255)); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 711, Short.MAX_VALUE) ); jPanel6Layout.setVerticalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 162, Short.MAX_VALUE) ); jPanel7.setBackground(new java.awt.Color(255, 255, 255)); laPai.setText("Nome Responsavel:"); jButton1.setText("Pesquisar"); jButton2.setText("Cadastrar"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout.setHorizontalGroup( jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(laPai) .addGroup(jPanel7Layout.createSequentialGroup() .addComponent(txPai, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel7Layout.setVerticalGroup( jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(laPai) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txPai, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton1)) .addGap(18, 18, 18) .addComponent(jButton2) .addGap(19, 19, 19)) ); javax.swing.GroupLayout paInfAdicionaisLayout = new javax.swing.GroupLayout(paInfAdicionais); paInfAdicionais.setLayout(paInfAdicionaisLayout); paInfAdicionaisLayout.setHorizontalGroup( paInfAdicionaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(paInfAdicionaisLayout.createSequentialGroup() .addGap(136, 136, 136) .addGroup(paInfAdicionaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); paInfAdicionaisLayout.setVerticalGroup( paInfAdicionaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, paInfAdicionaisLayout.createSequentialGroup() .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(paInfAdicionaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(paInfAdicionaisLayout.createSequentialGroup() .addGap(40, 40, 40) .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(paInfAdicionaisLayout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(143, Short.MAX_VALUE)) ); jTabbedPane1.addTab("Informações Adicionais", paInfAdicionais); paDados.setBackground(new java.awt.Color(255, 255, 255)); paDados.setPreferredSize(new java.awt.Dimension(800, 600)); jPanel13.setBackground(new java.awt.Color(255, 255, 255)); txCep.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txCepActionPerformed(evt); } }); jLabel7.setText("CEP"); jLabel3.setText("Bairro"); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); jLabel5.setText("Estado"); jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); jLabel4.setText("Cidade"); javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13); jPanel13.setLayout(jPanel13Layout); jPanel13Layout.setHorizontalGroup( jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7) .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jComboBox1, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jComboBox2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel13Layout.createSequentialGroup() .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5) .addComponent(jLabel4) .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(74, 74, 74))) .addComponent(txCep, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel13Layout.setVerticalGroup( jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel13Layout.createSequentialGroup() .addComponent(jLabel5) .addGap(11, 11, 11) .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE) .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txCep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); jPanel14.setBackground(new java.awt.Color(255, 255, 255)); txNome.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txNomeActionPerformed(evt); } }); jLabel2.setText("Endereço"); jLabel18.setText("Identidade"); jLabel16.setText("Fone Com.:"); jLabel1.setText("Nome"); jLabel15.setText("Fone Res.:"); jLabel19.setText("CPF"); jLabel17.setText("Fone Cel.:"); jLabel8.setText("Email"); jLabel6.setText("Data Nascimento"); txDataNascimento.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txDataNascimentoActionPerformed(evt); } }); jLabel12.setText(" Estado Civil"); jComboBox6.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14); jPanel14.setLayout(jPanel14Layout); jPanel14Layout.setHorizontalGroup( jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel14Layout.createSequentialGroup() .addContainerGap(20, Short.MAX_VALUE) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6) .addComponent(jLabel8) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel2) .addComponent(txEndereco) .addComponent(jLabel17) .addComponent(txNome, javax.swing.GroupLayout.PREFERRED_SIZE, 370, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1) .addGroup(jPanel14Layout.createSequentialGroup() .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel18) .addComponent(txIdentidade, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE) .addComponent(txDataNascimento)) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup() .addGap(22, 22, 22) .addComponent(jLabel19)) .addGroup(jPanel14Layout.createSequentialGroup() .addGap(18, 18, 18) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup() .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox6, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE)) .addComponent(txCPF))))) .addGroup(jPanel14Layout.createSequentialGroup() .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txTelRes, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel15)) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(txTelCom, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel14Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jLabel16)))) .addComponent(txCel, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txEmail))) .addContainerGap()) ); jPanel14Layout.setVerticalGroup( jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel14Layout.createSequentialGroup() .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel14Layout.createSequentialGroup() .addComponent(txNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(10, 10, 10) .addComponent(jLabel18) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txIdentidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(txCPF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel14Layout.createSequentialGroup() .addComponent(jLabel19) .addGap(26, 26, 26))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txDataNascimento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel14Layout.createSequentialGroup() .addComponent(jLabel12) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jComboBox6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel16) .addComponent(jLabel15)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txTelRes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txTelCom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(5, 5, 5) .addComponent(jLabel17) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txCel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); jPanel4.setBackground(new java.awt.Color(255, 255, 255)); jLabel21.setText("sexo"); sexo_masc.setBackground(new java.awt.Color(255, 255, 255)); sexo_masc.setSelected(true); sexo_masc.setText("Masculino"); sexo_masc.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); sexo_masc.setMargin(new java.awt.Insets(0, 0, 0, 0)); sexo_masc.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sexo_mascActionPerformed(evt); } }); sexo_fem.setBackground(new java.awt.Color(255, 255, 255)); sexo_fem.setText("Feminino"); sexo_fem.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); sexo_fem.setMargin(new java.awt.Insets(0, 0, 0, 0)); sexo_fem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sexo_femActionPerformed(evt); } }); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addContainerGap(17, Short.MAX_VALUE) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel21) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(sexo_masc) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(sexo_fem))) .addGap(18, 18, 18)) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addGap(6, 6, 6) .addComponent(jLabel21) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(sexo_fem) .addComponent(sexo_masc)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout paDadosLayout = new javax.swing.GroupLayout(paDados); paDados.setLayout(paDadosLayout); paDadosLayout.setHorizontalGroup( paDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(paDadosLayout.createSequentialGroup() .addGap(34, 34, 34) .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(paDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(100, 100, 100)) ); paDadosLayout.setVerticalGroup( paDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(paDadosLayout.createSequentialGroup() .addGroup(paDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(paDadosLayout.createSequentialGroup() .addGap(54, 54, 54) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(88, 88, 88) .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(paDadosLayout.createSequentialGroup() .addGap(45, 45, 45) .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(177, Short.MAX_VALUE)) ); jTabbedPane1.addTab("Dados Cadastrais", paDados); getContentPane().add(jTabbedPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 30, 840, 610)); lblPesquisa.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/Telas Pequenas/tela pesquisa.png"))); // NOI18N getContentPane().add(lblPesquisa, new org.netbeans.lib.awtextra.AbsoluteConstraints(1010, 40, 350, 160)); lblFundo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/Telas Fundo/BackgroudAltera.jpg"))); // NOI18N getContentPane().add(lblFundo, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1390, -1)); pack(); }// </editor-fold>//GEN-END:initComponents private void lblInicioMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblInicioMouseClicked this.dispose(); }//GEN-LAST:event_lblInicioMouseClicked private void lblAnteriorMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblAnteriorMouseEntered gerenciador.telas.ultilidades.Style.styleBorderEntered(lblAnterior); }//GEN-LAST:event_lblAnteriorMouseEntered private void lblAnteriorMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblAnteriorMouseExited gerenciador.telas.ultilidades.Style.styleBorderExited(lblAnterior); }//GEN-LAST:event_lblAnteriorMouseExited private void lblEditaMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblEditaMouseEntered gerenciador.telas.ultilidades.Style.styleBorderEntered(lblEdita); }//GEN-LAST:event_lblEditaMouseEntered private void lblInicioMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblInicioMouseEntered gerenciador.telas.ultilidades.Style.styleBorderEntered(lblInicio); }//GEN-LAST:event_lblInicioMouseEntered private void lblConfirmaMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblConfirmaMouseEntered gerenciador.telas.ultilidades.Style.styleBorderEntered(lblConfirma); }//GEN-LAST:event_lblConfirmaMouseEntered private void lblProximoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblProximoMouseEntered gerenciador.telas.ultilidades.Style.styleBorderEntered(lblProximo); }//GEN-LAST:event_lblProximoMouseEntered private void lblEditaMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblEditaMouseExited gerenciador.telas.ultilidades.Style.styleBorderExited(lblEdita); }//GEN-LAST:event_lblEditaMouseExited private void lblInicioMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblInicioMouseExited gerenciador.telas.ultilidades.Style.styleBorderExited(lblInicio); }//GEN-LAST:event_lblInicioMouseExited private void lblConfirmaMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblConfirmaMouseExited gerenciador.telas.ultilidades.Style.styleBorderExited(lblConfirma); }//GEN-LAST:event_lblConfirmaMouseExited private void lblProximoMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblProximoMouseExited gerenciador.telas.ultilidades.Style.styleBorderExited(lblProximo); }//GEN-LAST:event_lblProximoMouseExited private void lblFechaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblFechaMouseClicked System.exit(0); }//GEN-LAST:event_lblFechaMouseClicked private void lblMinimizaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblMinimizaMouseClicked this.dispose(); }//GEN-LAST:event_lblMinimizaMouseClicked private void txCepActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txCepActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txCepActionPerformed private void txNomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txNomeActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txNomeActionPerformed private void txDataNascimentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txDataNascimentoActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txDataNascimentoActionPerformed private void sexo_mascActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sexo_mascActionPerformed String sexo = "M"; }//GEN-LAST:event_sexo_mascActionPerformed private void sexo_femActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sexo_femActionPerformed String sexo = "F"; }//GEN-LAST:event_sexo_femActionPerformed private void jCheckBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox3ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jCheckBox3ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jButton2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(AlteraFuncionarioGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(AlteraFuncionarioGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(AlteraFuncionarioGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(AlteraFuncionarioGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new AlteraFuncionarioGUI().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextArea atxObs1; private javax.swing.JTextField edtMatricula; private javax.swing.JTextField edtNome; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JCheckBox jCheckBox3; private javax.swing.JComboBox jComboBox1; private javax.swing.JComboBox jComboBox2; private javax.swing.JComboBox jComboBox3; private javax.swing.JComboBox jComboBox6; private javax.swing.JComboBox jComboBox7; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel21; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JPanel jPanel13; private javax.swing.JPanel jPanel14; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel7; private javax.swing.JPanel jPanel9; private javax.swing.JScrollPane jScrollPane3; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JLabel laAvaliacao; private javax.swing.JLabel laDebito1; private javax.swing.JLabel laExame; private javax.swing.JLabel laObs1; private javax.swing.JLabel laPai; private javax.swing.JLabel laSituacao1; private javax.swing.JLabel lblAnterior; private javax.swing.JLabel lblBusca; private javax.swing.JLabel lblConfirma; private javax.swing.JLabel lblData; private javax.swing.JLabel lblEdita; private javax.swing.JLabel lblFecha; private javax.swing.JLabel lblFundo; private javax.swing.JLabel lblHora; private javax.swing.JLabel lblInicio; private javax.swing.JLabel lblMinimiza; private javax.swing.JLabel lblPesquisa; private javax.swing.JLabel lblProximo; private javax.swing.JPanel paDados; private javax.swing.JPanel paInfAdicionais; private javax.swing.JRadioButton sexo_fem; private javax.swing.JRadioButton sexo_masc; private javax.swing.JTextField txCPF; private javax.swing.JTextField txCalAvaliacao; private javax.swing.JTextField txCalExame; private javax.swing.JTextField txCel; private javax.swing.JFormattedTextField txCep; private javax.swing.JFormattedTextField txDataNascimento; private javax.swing.JTextField txDebito1; private javax.swing.JTextField txEmail; private javax.swing.JTextField txEndereco; private javax.swing.JTextField txIdentidade; private javax.swing.JTextField txNome; private javax.swing.JTextField txPai; private javax.swing.JTextField txTelCom; private javax.swing.JTextField txTelRes; // End of variables declaration//GEN-END:variables }
package com.tencent.mm.plugin.sns.model; import android.os.Message; import android.support.design.a$i; import com.tencent.mm.kernel.g; import com.tencent.mm.plugin.sns.model.u.a; import com.tencent.mm.protocal.c.bpq; import com.tencent.mm.protocal.c.bpr; import com.tencent.mm.protocal.c.pm; import com.tencent.mm.protocal.z; import com.tencent.mm.sdk.platformtools.ag; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; class u$a$1 extends ag { final /* synthetic */ a noD; u$a$1(a aVar) { this.noD = aVar; } public final void handleMessage(Message message) { if (this.noD.iWX == null || this.noD.iWX.isEmpty()) { u uVar = this.noD.noA; bpr bpr = (bpr) uVar.diG.dIE.dIL; bpq bpq = (bpq) uVar.diG.dID.dIL; byte[] g = z.g(bpq.rny.siK.toByteArray(), bpr.rny.siK.toByteArray()); if (g != null && g.length > 0) { g.Ek(); g.Ei().DT().set(8195, bi.bE(g)); } bpq.rny.bq(g); if ((bpr.rlm & bpq.rnx) == 0) { uVar.diJ.a(0, 0, "", uVar); return; } else { uVar.a(uVar.dIX, uVar.diJ); return; } } final pm pmVar = (pm) this.noD.iWX.getFirst(); x.d("MicroMsg.NetSceneNewSyncAlbum", "cmdId = " + pmVar.rtM); this.noD.iWX.removeFirst(); switch (pmVar.rtM) { case a$i.AppCompatTheme_actionDropDownStyle /*45*/: af.bxY().post(new Runnable() { public final void run() { if (!u$a$1.this.noD.noA.a(pmVar, u$a$1.this.noD.iWY)) { u$a$1.this.noD.iWY.sendEmptyMessage(0); } } }); return; case a$i.AppCompatTheme_dropdownListPreferredItemHeight /*46*/: af.bxY().post(new 2(this, pmVar)); return; default: return; } } }
package utils.decorator; import java.awt.Component; public interface IModeDecorator { public void assamble(Component c); }
package com.saswat.mycovidapplication; import android.content.Intent; import android.os.Bundle; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; public class DetailStateActivity extends AppCompatActivity { int position; private TextView stateNameIndia,stateCases,stateDeath,stateRecovered; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail_state); stateNameIndia = (TextView)findViewById(R.id.detail_state); stateCases = (TextView)findViewById(R.id.no_cases_state); stateRecovered = (TextView)findViewById(R.id.no_recovered_state); stateDeath = (TextView)findViewById(R.id.no_death_state); Intent intent = getIntent(); position = intent.getIntExtra("position",0); stateNameIndia.setText(StatesFragment.statesModelList.get(position).getStateName()); stateCases.setText(StatesFragment.statesModelList.get(position).getStateCases()); stateRecovered.setText(StatesFragment.statesModelList.get(position).getStateRecovered()); stateDeath.setText(StatesFragment.statesModelList.get(position).getStateDeath()); } }
public interface List { //add element to the list public void add(String element); //remove element from the list public void remove(String element); //check if the list is empty public boolean isEmpty(); //get the total number of reference counts public long getRefCount(); //get the total number of comparison counts public long getCompCount(); //reset the comparison count and the reference count public void reset(); //get the total unique words public int totalWords(); //get the total words public int totalNumWords(); }
package com.rc.portal.dao; import java.sql.SQLException; import java.util.List; import com.rc.portal.vo.TMemberCollect; import com.rc.portal.vo.TMemberCollectExample; public interface TMemberCollectDAO { int countByExample(TMemberCollectExample example) throws SQLException; int deleteByExample(TMemberCollectExample example) throws SQLException; int deleteByPrimaryKey(Long id) throws SQLException; Long insert(TMemberCollect record) throws SQLException; Long insertSelective(TMemberCollect record) throws SQLException; List selectByExample(TMemberCollectExample example) throws SQLException; TMemberCollect selectByPrimaryKey(Long id) throws SQLException; int updateByExampleSelective(TMemberCollect record, TMemberCollectExample example) throws SQLException; int updateByExample(TMemberCollect record, TMemberCollectExample example) throws SQLException; int updateByPrimaryKeySelective(TMemberCollect record) throws SQLException; int updateByPrimaryKey(TMemberCollect record) throws SQLException; }
package com.tencent.mm.ui.chatting; import com.tencent.mm.ui.chatting.b.b.ac; class y$7 implements Runnable { final /* synthetic */ y tMm; y$7(y yVar) { this.tMm = yVar; } public final void run() { ((ac) this.tMm.bAG.O(ac.class)).ad(new 1(this)); } }
package lesson17.task1; import lesson11.task1.Book; import lesson8.task2.Person; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class HeavyBox { public static void main(String[] args) { List<Person> arrayList = new ArrayList<>(); arrayList.add(new Person()); arrayList.add(new Person("fdf","23")); for (Person str : arrayList) { System.out.println("Value is: " + str); } } }
package com.workshops.database; import com.workshops.database.WS_USER; import java.io.Serializable; import java.util.List; public class WS_TEAM implements Serializable { /** * */ private static final long serialVersionUID = 1L; private int TEAM_ID; private String TEAM_NAME; private String TEAM_COLOR; private String TEAM_IMAGE; private int counting_player = 0; private int sum_hunting = 0; private List<WS_USER> list_WS_USER; public int getSum_hunting() { return sum_hunting; } public void setSum_hunting(int sum_hunting) { this.sum_hunting = sum_hunting; } public int getCounting_player() { return counting_player; } public void setCounting_player(int counting_player) { this.counting_player = counting_player; } public List<WS_USER> getList_WS_USER() { return list_WS_USER; } public void setList_WS_USER(List<WS_USER> list_WS_USER) { this.list_WS_USER = list_WS_USER; } public int getTEAM_ID() { return TEAM_ID; } public void setTEAM_ID(int tEAM_ID) { TEAM_ID = tEAM_ID; } public String getTEAM_NAME() { return TEAM_NAME; } public void setTEAM_NAME(String tEAM_NAME) { TEAM_NAME = tEAM_NAME; } public String getTEAM_COLOR() { return TEAM_COLOR; } public void setTEAM_COLOR(String tEAM_COLOR) { TEAM_COLOR = tEAM_COLOR; } public String getTEAM_IMAGE() { return TEAM_IMAGE; } public void setTEAM_IMAGE(String tEAM_IMAGE) { TEAM_IMAGE = tEAM_IMAGE; } }
/** */ package org.ecsoya.yamail.model.impl; import java.lang.reflect.InvocationTargetException; import java.util.Collection; import java.util.Collections; import java.util.Set; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.emf.query.conditions.eobjects.structuralfeatures.EObjectAttributeValueCondition; import org.eclipse.emf.query.conditions.strings.StringValue; import org.eclipse.emf.query.statements.FROM; import org.eclipse.emf.query.statements.IQueryResult; import org.eclipse.emf.query.statements.SELECT; import org.eclipse.emf.query.statements.WHERE; import org.ecsoya.yamail.model.FolderType; import org.ecsoya.yamail.model.Yamail; import org.ecsoya.yamail.model.YamailFolder; import org.ecsoya.yamail.model.YamailPackage; /** * <!-- begin-user-doc --> An implementation of the model object ' * <em><b>Folder</b></em>'. <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.ecsoya.yamail.model.impl.YamailFolderImpl#getName <em>Name * </em>}</li> * <li>{@link org.ecsoya.yamail.model.impl.YamailFolderImpl#getMails <em>Mails * </em>}</li> * <li>{@link org.ecsoya.yamail.model.impl.YamailFolderImpl#isSystem <em>System * </em>}</li> * <li>{@link org.ecsoya.yamail.model.impl.YamailFolderImpl#getType <em>Type * </em>}</li> * </ul> * </p> * * @generated */ public class YamailFolderImpl extends MinimalEObjectImpl.Container implements YamailFolder { /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getMails() <em>Mails</em>}' containment * reference list. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getMails() * @generated * @ordered */ protected EList<Yamail> mails; /** * The default value of the '{@link #isSystem() <em>System</em>}' attribute. * <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #isSystem() * @generated * @ordered */ protected static final boolean SYSTEM_EDEFAULT = false; /** * The cached value of the '{@link #isSystem() <em>System</em>}' attribute. * <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #isSystem() * @generated * @ordered */ protected boolean system = SYSTEM_EDEFAULT; /** * The default value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getType() * @generated * @ordered */ protected static final FolderType TYPE_EDEFAULT = FolderType.INBOX; /** * The cached value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getType() * @generated * @ordered */ protected FolderType type = TYPE_EDEFAULT; /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ protected YamailFolderImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override protected EClass eStaticClass() { return YamailPackage.Literals.YAMAIL_FOLDER; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public String getName() { return name; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, YamailPackage.YAMAIL_FOLDER__NAME, oldName, name)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public EList<Yamail> getMails() { if (mails == null) { mails = new EObjectContainmentEList<Yamail>(Yamail.class, this, YamailPackage.YAMAIL_FOLDER__MAILS); } return mails; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public boolean isSystem() { return system; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void setSystem(boolean newSystem) { boolean oldSystem = system; system = newSystem; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, YamailPackage.YAMAIL_FOLDER__SYSTEM, oldSystem, system)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public FolderType getType() { return type; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void setType(FolderType newType) { FolderType oldType = type; type = newType == null ? TYPE_EDEFAULT : newType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, YamailPackage.YAMAIL_FOLDER__TYPE, oldType, type)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated NOT */ public Yamail getMailById(String id) { EObjectAttributeValueCondition condition = new EObjectAttributeValueCondition( YamailPackage.Literals.YAMAIL__ID, new StringValue(id)); SELECT statement = new SELECT(SELECT.UNBOUNDED, false, new FROM( Collections.singleton(this)), new WHERE(condition), new NullProgressMonitor()); IQueryResult results = statement.execute(); if (!results.isEmpty()) { Set<? extends EObject> eObjects = results.getEObjects(); for (EObject eObject : eObjects) { if (eObject instanceof Yamail) { return (Yamail) eObject; } } } return null; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case YamailPackage.YAMAIL_FOLDER__MAILS: return ((InternalEList<?>) getMails()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case YamailPackage.YAMAIL_FOLDER__NAME: return getName(); case YamailPackage.YAMAIL_FOLDER__MAILS: return getMails(); case YamailPackage.YAMAIL_FOLDER__SYSTEM: return isSystem(); case YamailPackage.YAMAIL_FOLDER__TYPE: return getType(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case YamailPackage.YAMAIL_FOLDER__NAME: setName((String) newValue); return; case YamailPackage.YAMAIL_FOLDER__MAILS: getMails().clear(); getMails().addAll((Collection<? extends Yamail>) newValue); return; case YamailPackage.YAMAIL_FOLDER__SYSTEM: setSystem((Boolean) newValue); return; case YamailPackage.YAMAIL_FOLDER__TYPE: setType((FolderType) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case YamailPackage.YAMAIL_FOLDER__NAME: setName(NAME_EDEFAULT); return; case YamailPackage.YAMAIL_FOLDER__MAILS: getMails().clear(); return; case YamailPackage.YAMAIL_FOLDER__SYSTEM: setSystem(SYSTEM_EDEFAULT); return; case YamailPackage.YAMAIL_FOLDER__TYPE: setType(TYPE_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case YamailPackage.YAMAIL_FOLDER__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT .equals(name); case YamailPackage.YAMAIL_FOLDER__MAILS: return mails != null && !mails.isEmpty(); case YamailPackage.YAMAIL_FOLDER__SYSTEM: return system != SYSTEM_EDEFAULT; case YamailPackage.YAMAIL_FOLDER__TYPE: return type != TYPE_EDEFAULT; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { switch (operationID) { case YamailPackage.YAMAIL_FOLDER___GET_MAIL_BY_ID__STRING: return getMailById((String) arguments.get(0)); } return super.eInvoke(operationID, arguments); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); result.append(name); result.append(", system: "); result.append(system); result.append(", type: "); result.append(type); result.append(')'); return result.toString(); } } // YamailFolderImpl
package com.mysql.cj.result; import com.mysql.cj.Messages; import com.mysql.cj.WarningListener; import com.mysql.cj.conf.PropertySet; import com.mysql.cj.exceptions.DataReadException; import com.mysql.cj.protocol.InternalDate; import com.mysql.cj.protocol.InternalTime; import com.mysql.cj.protocol.InternalTimestamp; import java.time.LocalDate; public class LocalDateValueFactory extends AbstractDateTimeValueFactory<LocalDate> { private WarningListener warningListener; public LocalDateValueFactory(PropertySet pset) { super(pset); } public LocalDateValueFactory(PropertySet pset, WarningListener warningListener) { this(pset); this.warningListener = warningListener; } public LocalDate localCreateFromDate(InternalDate idate) { if (idate.getYear() == 0 && idate.getMonth() == 0 && idate.getDay() == 0) throw new DataReadException(Messages.getString("ResultSet.InvalidZeroDate")); return LocalDate.of(idate.getYear(), idate.getMonth(), idate.getDay()); } public LocalDate localCreateFromTimestamp(InternalTimestamp its) { if (this.warningListener != null) this.warningListener.warningEncountered(Messages.getString("ResultSet.PrecisionLostWarning", new Object[] { getTargetTypeName() })); return createFromDate((InternalDate)its); } LocalDate localCreateFromTime(InternalTime it) { return unsupported("TIME"); } public String getTargetTypeName() { return LocalDate.class.getName(); } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\com\mysql\cj\result\LocalDateValueFactory.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
package com.espendwise.manta.util.validation.resolvers; import com.espendwise.manta.spi.ValidationResolver; import com.espendwise.manta.util.alert.ArgumentedMessage; import com.espendwise.manta.util.trace.ApplicationExceptionCode; import com.espendwise.manta.util.trace.ExceptionReason; import com.espendwise.manta.util.validation.ValidationException; import java.util.ArrayList; import java.util.List; import java.util.Map; public abstract class AbstractSiteHierarchyValidationCodeResolver implements ValidationResolver<ValidationException> { public List<? extends ArgumentedMessage> resolve(ValidationException exception) { List<ArgumentedMessage> errors = new ArrayList<ArgumentedMessage>(); ApplicationExceptionCode[] codes = exception.getExceptionCodes(); if (codes != null) { for (ApplicationExceptionCode code : codes) { if (code.getReason() instanceof ExceptionReason.SiteHierarchyUpdateReason) { switch ((ExceptionReason.SiteHierarchyUpdateReason) code.getReason()) { case MULTIPLE_SITE_CONFIGURATION: errors.add(multipleSiteConfiguration(code, (Long) code.getArguments()[0].get())); break; case DUPLICATED_NAME: errors.add(duplicatedName(code, (String) code.getArguments()[0].get())); break; case SITE_HIER_ERROR_SUB_LEVEL_CONFIG: errors.add(errorSubLevelConfig(code, (String) code.getArguments()[0].get())); break; case SITE_HIER_ERROR_TOP_LEVEL_CONFIG: errors.add(errorTopLevelConfig(code, (String) code.getArguments()[0].get())); break; case SITE_HIER_ERROR_HIGHER_LEVEL_CONFIG: errors.add(errorHigherLevelConfig(code, (String) code.getArguments()[0].get())); break; case SITE_HIER_ERROR_OVERLAPING_SITE_CONFIG: errors.add(errorOverlapingSiteConfig(code, (Map) code.getArguments()[0].get())); break; } } } } return errors; } protected abstract ArgumentedMessage errorOverlapingSiteConfig(ApplicationExceptionCode code, Map map); protected abstract ArgumentedMessage errorTopLevelConfig(ApplicationExceptionCode code, String s); protected abstract ArgumentedMessage errorHigherLevelConfig(ApplicationExceptionCode code, String s); protected abstract ArgumentedMessage errorSubLevelConfig(ApplicationExceptionCode code, String s); protected abstract ArgumentedMessage duplicatedName(ApplicationExceptionCode code, String name); protected abstract ArgumentedMessage multipleSiteConfiguration(ApplicationExceptionCode code, Long locationId); }
package com.netbanking.database; import java.io.File; import java.io.FileInputStream; import org.hibernate.Session; import com.netbanking.database.userinfo.UserStatus; import com.netbanking.database.userinfo.UserType; import com.netbanking.database.util.CertificateHandler; import com.netbanking.database.util.UserDBHandler; import com.netbanking.util.OTPGenerator; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; public class h_test { public static void main(String[] args) { // TODO Auto-generated method stub /* SessionFactory SF = new Configuration().configure().buildSessionFactory(); Session session = SF.openSession(); session.beginTransaction();*/ //session.save(usr); //session.getTransaction().commit(); //session.close(); //userinfo usr2 = new userinfo(); //usr2 = (userinfo)session.get(userinfo.class, "Arpan"); /* userinfo usr = new userinfo(); account acc = new account(); authsender auth = new authsender(); //sitekeywarehouse secW = new sitekeywarehouse(); //quwarehouse QW = new quwarehouse(); systemlog sysL = new systemlog(); trandetails tr = new trandetails(); usersec uSec = new usersec(); piidbrequest pii = new piidbrequest(); //secwarehouse sec = new secwarehouse(); paymentrequest pym = new paymentrequest(); session.getTransaction().commit(); session.close();*/ //LoginDBHandler ld = new LoginDBHandler(); //System.out.println(ld.LoginCheck("Arpan", "123")); /*DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); Date date = new Date(); userinfo usr = new userinfo("Prachi","123","ABC","XYZ","123456789",UserType.CUSTOMER,"Uni Dr",date,"abc@gmail",1234567890,Gender.MALE,UserStatus.LIVE,0); boolean flag = UserDBHandler.userSignUp(usr); System.out.println(flag);*/ //String abc = Encryptor.codeSSN("123456789"); //System.out.println(abc); //System.out.println(Encryptor.codeSSN(abc)); /*DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); Date date = new Date(); userinfo usr = new userinfo("Arpan","ABC","XYZ","123456789",UserType.CUSTOMER,"Uni Dr",date,"arpan.here.i.am@gmail.com",1234567890,Gender.MALE,UserStatus.LIVE,0); usersec uSec = new usersec("Arpan","123","Q1","ABC","Q2","DEF","Q3","GHT",0); account acc=new account(1000,"Arpan",date,date,1000,AccountStatus.OPEN,AccountType.CHECKING); boolean flag = UserDBHandler.userSignUp(usr,uSec,acc);*/ /*quwarehouse QW = new quwarehouse("Q1","What is your mother's maiden name"); quwarehouse QW2 = new quwarehouse("Q2","What is your pet's name"); quwarehouse QW3 = new quwarehouse("Q3","What is your favourite colour"); quwarehouse QW4 = new quwarehouse("Q4","What is your first car's model"); quwarehouse QW5 = new quwarehouse("Q5","What is your favourite movie"); session.save(QW); session.save(QW2); session.save(QW3); session.save(QW4); session.save(QW5); session.getTransaction().commit(); session.close();*/ /*account acc = new account(); acc.setAccNum(AccountDBHandler.getLastAcctNum()+1); acc.setAccStatus(AccountStatus.OPEN); acc.setDateOfClose(null); DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); Date date = new Date(); acc.setDateOfOpen(date); acc.setAccType(AccountType.SAVING); acc.setBalance(555); acc.setUserId("Priyanka"); session.save(acc); session.getTransaction().commit(); session.close();*/ /*Query query=session.createQuery("update account set balance= balance + :amt where accNum = :num"); query.setParameter("num",12345679); query.setParameter("amt",100.00); int r=query.executeUpdate(); session.getTransaction().commit();*/ //System.out.println(UserDBHandler.addAuthorizedUser("priya.cummins@gmail.com", 12345678, "Amol")); try{ /*OTPGenerator OTP = new OTPGenerator(); OTP.sendCertificate("Abc", "arpan.here.i.am@gmail.com",12345678);*/ /*System.out.println("Verifying"); byte[] publicKeyBytes = IOUtils.toByteArray(new FileInputStream(new File("x_publicKey"))); byte[] privateKeyBytes = IOUtils.toByteArray(new FileInputStream(new File("Arpan_privateKey"))); byte[] certBytes = IOUtils.toByteArray(new FileInputStream(new File("x_cert.crt"))); System.out.println(CertificateHandler.verifySignature(privateKeyBytes, publicKeyBytes, certBytes));*/ }catch(Exception e){ } userinfo user = new userinfo(); usersec usec = new usersec(); user.setUserId("arpan"); user.seteMail("arpan.ghosh@asu.edu"); user.setUserType(UserType.MANAGER); user.setUserStatus(UserStatus.LIVE); user.setSsn("123456789"); usec.setEnabled(true); usec.setUserId("arpan"); usec.setAns1("A1"); usec.setAns2("A2"); usec.setAns3("A3"); usec.setQues1("Q1"); usec.setQues2("Q2"); usec.setQues3("Q3"); usec.setPasswd("ead5642f9585bf046d8fd2f7bd4465d0"); System.out.println(UserDBHandler.userSignUp(user, usec, null).isResult()); } }
package com.saven.batch.domain.util; import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by nrege on 1/30/2017. */ public class RegexUtils { public static boolean matches(String text, String regex) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(text); return matcher.matches(); } public static String replaceVarWithVal(String text, String regex, Function<String, String> replacer, String defaultValue) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(text); while (matcher.find()) { String group = matcher.group(); String replacement = replacer.apply(group); text = text.replace(group, replacement); } return text; } }
package com.tt.miniapp.audio; import android.content.Context; import android.util.SparseArray; import com.tt.miniapphost.AppBrandLogger; import com.tt.miniapphost.AppbrandApplication; import com.tt.miniapphost.entity.ApiErrorInfoEntity; import java.util.Map; import org.json.JSONObject; public abstract class AudioManager { public static BgSendMsgStateListener bgSendMsgStateListener; protected static boolean isAppInBackground; public static boolean isAudioFocusChangePause; public static boolean isBgAudio; protected SparseArray<AudioStateModule> playingAudioId = new SparseArray(); public static AudioManager getInst() { // Byte code: // 0: ldc com/tt/miniapp/audio/AudioManager // 2: monitorenter // 3: getstatic com/tt/miniapp/audio/AudioManager$Holder.INSTANCE : Lcom/tt/miniapp/audio/AudioManager; // 6: astore_0 // 7: ldc com/tt/miniapp/audio/AudioManager // 9: monitorexit // 10: aload_0 // 11: areturn // 12: astore_0 // 13: ldc com/tt/miniapp/audio/AudioManager // 15: monitorexit // 16: aload_0 // 17: athrow // Exception table: // from to target type // 3 7 12 finally } public static void preload(Context paramContext) { getInst(); } protected static void sendMsgState(int paramInt, String paramString) { sendMsgState(paramInt, paramString, null); } protected static void sendMsgState(int paramInt, String paramString, Map<String, Object> paramMap) { isAudioFocusChangePause = false; if (isBgAudio) { BgSendMsgStateListener bgSendMsgStateListener = bgSendMsgStateListener; if (bgSendMsgStateListener != null) { bgSendMsgStateListener.onSendMsgState(paramInt, paramString); return; } } try { JSONObject jSONObject = new JSONObject(); jSONObject.put("audioId", paramInt); jSONObject.put("state", paramString); if (paramMap != null) for (String str : paramMap.keySet()) jSONObject.put(str, paramMap.get(str)); AppBrandLogger.d("tma_AudioManager", new Object[] { "sendMsgState ", paramString }); AppbrandApplication.getInst().getJsBridge().sendMsgToJsCore("onAudioStateChange", jSONObject.toString()); return; } catch (Exception exception) { AppBrandLogger.e("tma_AudioManager", new Object[] { "", exception }); return; } } public abstract AudioState getAudioState(int paramInt, ApiErrorInfoEntity paramApiErrorInfoEntity); public abstract void onEnterBackground(); public abstract void onEnterForeground(); public abstract void pause(int paramInt, TaskListener paramTaskListener); public abstract void play(int paramInt, TaskListener paramTaskListener); public abstract void releaseAllPlayers(); public abstract boolean releaseAudio(int paramInt, ApiErrorInfoEntity paramApiErrorInfoEntity); public abstract void seek(int paramInt1, int paramInt2, TaskListener paramTaskListener); public abstract void setAudioState(AudioStateModule paramAudioStateModule, TaskListener paramTaskListener); public abstract void stop(int paramInt, TaskListener paramTaskListener); public static class AudioState { public boolean autoplay; public int buffered; public long currentTime; public long duration; public boolean loop; public boolean obeyMuteSwitch; public boolean paused; public String src; public long startTime; public float volume; public String toString() { StringBuilder stringBuilder = new StringBuilder("AudioState{src='"); stringBuilder.append(this.src); stringBuilder.append('\''); stringBuilder.append(", startTime="); stringBuilder.append(this.startTime); stringBuilder.append(", paused="); stringBuilder.append(this.paused); stringBuilder.append(", currentTime="); stringBuilder.append(this.currentTime); stringBuilder.append(", duration="); stringBuilder.append(this.duration); stringBuilder.append(", obeyMuteSwitch="); stringBuilder.append(this.obeyMuteSwitch); stringBuilder.append(", buffered="); stringBuilder.append(this.buffered); stringBuilder.append(", autoplay="); stringBuilder.append(this.autoplay); stringBuilder.append(", loop="); stringBuilder.append(this.loop); stringBuilder.append(", volume="); stringBuilder.append(this.volume); stringBuilder.append('}'); return stringBuilder.toString(); } } public static class BaseMedia { public int audioId; public boolean autoPlay; public int buffer; public boolean isBgAudio; public boolean isPlayToSeek; public boolean isPreparing; public boolean loop; public android.media.AudioManager.OnAudioFocusChangeListener mAudioFocusChangeListener; public boolean obeyMuteSwitch; public String src; public boolean startByUser; public volatile int state; public float volume; } public static interface BgSendMsgStateListener { void onSendMsgState(int param1Int, String param1String); } static interface Holder { public static final AudioManager INSTANCE = new TTVideoAudio(); } public static interface TaskListener { void onFail(String param1String, Throwable param1Throwable); void onSuccess(); } } /* Location: C:\Users\august\Desktop\tik\df_miniapp\classes.jar!\com\tt\miniapp\audio\AudioManager.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
package com.example.mand.crudsqliteandroid; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.EditText; import android.widget.Toast; import BSHELPER.sqlite; public class EditarActivity extends AppCompatActivity{ private int usuarioEditar; private EditText nombre,apellidos,edad; public void onCreate(Bundle b){ super.onCreate(b); setContentView(R.layout.activity_editar); Bundle extras = this.getIntent().getExtras(); if(extras!=null){ usuarioEditar = extras.getInt("id"); } nombre = (EditText) findViewById(R.id.ETEditarNombre); apellidos = (EditText) findViewById(R.id.ETEditarApellidos); edad = (EditText) findViewById(R.id.ETEditarEdad); reflejarCampos(); } public void reflejarCampos(){ sqlite bh = new sqlite(EditarActivity.this,"usuarios",null,1); if(bh!=null){ SQLiteDatabase db = bh.getReadableDatabase(); Cursor c = db.rawQuery("SELECT * FROM usuarios WHERE idusuario = "+usuarioEditar,null); try{ if(c.moveToNext()){ nombre.setText(c.getString(1)); apellidos.setText(c.getString(2)); edad.setText(c.getString(3)); } }finally { } } } public void editar(View v){ sqlite bh = new sqlite(EditarActivity.this,"usuarios",null,1); if(bh!=null){ SQLiteDatabase db = bh.getWritableDatabase(); ContentValues val = new ContentValues(); val.put("nombre",nombre.getText().toString()); val.put("apellidos",apellidos.getText().toString()); val.put("edad",Integer.parseInt(edad.getText().toString())); long response = db.update("usuarios",val,"idusuario="+usuarioEditar,null); if(response>0){ Toast.makeText(EditarActivity.this,"Editado con exito",Toast.LENGTH_LONG).show(); nombre.setText(""); apellidos.setText(""); edad.setText(""); }else{ Toast.makeText(EditarActivity.this,"Ocurrio un error",Toast.LENGTH_LONG).show(); } } } }
/** * Created on 2020/3/18. * * @author ray */ public class LengthOfLIS { public static int lengthOfLIS(int[] nums) { if (nums.length <= 1) { return nums.length; } int[] dp = new int[nums.length]; dp[0] = 1; int globalMax = 1; for (int i = 1; i < nums.length; i++) { int max = 0; for (int j = 0; j < i; j++) { if (nums[j] < nums[i]) { if (max == 0) { max = dp[j]; } else if (max < dp[j]) { max = dp[j]; } } } if (globalMax < max + 1) { globalMax = max + 1; } dp[i] = max + 1; } return globalMax; } public static void main(String[] args) { int[] nums = {10, 9, 2, 5, 3, 7, 101, 18}; System.out.println(lengthOfLIS(nums)); } }
package com.reactnativesmaatoad; import android.content.Context; import android.view.View; import androidx.annotation.NonNull; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.WritableMap; import com.facebook.react.uimanager.events.RCTEventEmitter; import com.facebook.react.views.view.ReactViewGroup; import com.smaato.sdk.banner.ad.BannerAdSize; import com.smaato.sdk.banner.widget.BannerError; import com.smaato.sdk.banner.widget.BannerView; import com.smaato.sdk.core.LatLng; import com.smaato.sdk.core.SmaatoSdk; public class BannerAd extends ReactViewGroup { private static String TAG = "GGADS"; private BannerAdSize AdSize = BannerAdSize.XX_LARGE_320x50; private String AdId = "130626424"; private double lat = 0.0; private double lon = 0.0; private float acc = 0; private long time = 0; private final Runnable measureRunnable = () -> { for (int i = 0;i < getChildCount();i++) { View child = getChildAt(i); child.measure( MeasureSpec.makeMeasureSpec(getMeasuredWidth(),MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(getMeasuredHeight(),MeasureSpec.EXACTLY) ); child.layout(0,0,child.getMeasuredWidth(),child.getMeasuredHeight()); } }; public BannerAd(Context context) { super(context); } private void attachNewAdView() { final BannerView bannerView = new BannerView(getContext()); BannerView oldView = (BannerView) getChildAt(0); if (oldView != null) { oldView.destroy(); } addView(bannerView); setupAd(); } private void setupAd() { final BannerView bannerView = (BannerView) getChildAt(0); //SmaatoSdk.setLatLng(new LatLng(-31.083332,150.916672,0,0)); SmaatoSdk.setLatLng(new LatLng(lat,lon,acc,time)); bannerView.loadAd(AdId,AdSize); bannerView.setEventListener(eventListener); } BannerView.EventListener eventListener = new BannerView.EventListener() { @Override public void onAdLoaded(@NonNull BannerView bannerView) { WritableMap map = Arguments.createMap(); map.putInt("height",bannerView.getBannerAdSize().adDimension.getHeight()); map.putInt("width", bannerView.getBannerAdSize().adDimension.getWidth()); map.putDouble("aspectRatio",(float) bannerView.getBannerAdSize().adDimension.getAspectRatio()); map.putString("sessionId",bannerView.getSessionId()); map.putString("creativeId",bannerView.getCreativeId()); map.putInt("autoReloadTime",bannerView.getAutoReloadInterval().getSeconds()); map.putDouble("latitude",SmaatoSdk.getLatLng().getLatitude()); map.putDouble("longitude",SmaatoSdk.getLatLng().getLongitude()); map.putDouble("accuracy",SmaatoSdk.getLatLng().getLocationAccuracy()); map.putDouble("timestamp",SmaatoSdk.getLatLng().getLocationTimestamp()); getEmitter().receiveEvent(getId(),"onAdLoaded",map); } @Override public void onAdFailedToLoad(@NonNull BannerView bannerView, @NonNull BannerError bannerError) { WritableMap map = Arguments.createMap(); map.putString("error",bannerError.toString()); getEmitter().receiveEvent(getId(),"onAdFailedToLoad",map); } @Override public void onAdImpression(@NonNull BannerView bannerView) { getEmitter().receiveEvent(getId(),"onAdImpression",null); } @Override public void onAdClicked(@NonNull BannerView bannerView) { getEmitter().receiveEvent(getId(),"onAdClicked",null); } @Override public void onAdTTLExpired(@NonNull BannerView bannerView) { getEmitter().receiveEvent(getId(),"onAdTTLExpired",null); } }; public void setAdId(String a) { if (AdId != null && a != null) { AdId = a; } attachNewAdView(); } public void setLat(double l) { lat = l; attachNewAdView(); } public void setLong(double l) { lon = l; attachNewAdView(); } public void setAdSize(String index) { switch (index) { case "MEDIUM_RECTANGLE_300x250": AdSize = BannerAdSize.MEDIUM_RECTANGLE_300x250; break; case "LEADERBOARD_728x90": AdSize = BannerAdSize.LEADERBOARD_728x90; break; case "SKYSCRAPER_120x600": AdSize = BannerAdSize.SKYSCRAPER_120x600; break; default: AdSize = BannerAdSize.XX_LARGE_320x50; } attachNewAdView(); } private RCTEventEmitter getEmitter() { ReactContext context = (ReactContext) getContext(); return context.getJSModule(RCTEventEmitter.class); } @Override public void requestLayout() { super.requestLayout(); post(measureRunnable); } }
package my.sheshenya.samplespringdatajdbc; import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface AuthorRepository extends CrudRepository<Author, Long> { @Query("select count(*) from Author") int countAuthors(); }
package com.ssm.lab.bean; import org.springframework.web.multipart.MultipartFile; import java.util.List; public class Course { private Integer id; private String cno; private String cname; private String property; private String precourse; private Byte totalperiod; private Float credit; private Byte theperiod; private Byte expperiod; private String level; private String specialty; private String dlurl; private String bookurl; private String content; private MultipartFile dlurlFile; private MultipartFile bookurlFile; private List<CourseItem> courseItems; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getCno() { return cno; } public void setCno(String cno) { this.cno = cno == null ? null : cno.trim(); } public String getCname() { return cname; } public void setCname(String cname) { this.cname = cname == null ? null : cname.trim(); } public String getProperty() { return property; } public void setProperty(String property) { this.property = property == null ? null : property.trim(); } public String getPrecourse() { return precourse; } public void setPrecourse(String precourse) { this.precourse = precourse == null ? null : precourse.trim(); } public Byte getTotalperiod() { return totalperiod; } public void setTotalperiod(Byte totalperiod) { this.totalperiod = totalperiod; } public Float getCredit() { return credit; } public void setCredit(Float credit) { this.credit = credit; } public Byte getTheperiod() { return theperiod; } public void setTheperiod(Byte theperiod) { this.theperiod = theperiod; } public Byte getExpperiod() { return expperiod; } public void setExpperiod(Byte expperiod) { this.expperiod = expperiod; } public String getLevel() { return level; } public void setLevel(String level) { this.level = level == null ? null : level.trim(); } public String getSpecialty() { return specialty; } public void setSpecialty(String specialty) { this.specialty = specialty == null ? null : specialty.trim(); } public String getDlurl() { return dlurl; } public void setDlurl(String dlurl) { this.dlurl = dlurl == null ? null : dlurl.trim(); } public String getBookurl() { return bookurl; } public void setBookurl(String bookurl) { this.bookurl = bookurl == null ? null : bookurl.trim(); } public String getContent() { return content; } public void setContent(String content) { this.content = content == null ? null : content.trim(); } public MultipartFile getDlurlFile() { return dlurlFile; } public void setDlurlFile(MultipartFile dlurlFile) { this.dlurlFile = dlurlFile; } public MultipartFile getBookurlFile() { return bookurlFile; } public void setBookurlFile(MultipartFile bookurlFile) { this.bookurlFile = bookurlFile; } public List<CourseItem> getCourseItems() { return courseItems; } public void setCourseItems(List<CourseItem> courseItems) { this.courseItems = courseItems; } }
package com.tencent.mm.modelmulti; import com.tencent.mm.ab.b; import com.tencent.mm.ab.b.a; import com.tencent.mm.ab.e; import com.tencent.mm.ab.l; import com.tencent.mm.network.k; import com.tencent.mm.network.q; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.protocal.c.aaf; import com.tencent.mm.protocal.c.aag; import com.tencent.mm.protocal.c.ane; import com.tencent.mm.protocal.c.ang; import com.tencent.mm.sdk.platformtools.x; import java.util.List; public final class d extends l implements k { public final b dZf; private e diJ; public d(List<ane> list, long j, ang ang) { a aVar = new a(); aVar.dIG = new aaf(); aVar.dIH = new aag(); aVar.uri = "/cgi-bin/mmo2o-bin/getbeaconspushmessage"; aVar.dIF = 1708; aVar.dII = 0; aVar.dIJ = 0; this.dZf = aVar.KT(); aaf aaf = (aaf) this.dZf.dID.dIL; aaf.rFH.addAll(list); aaf.rFK = j; aaf.rFJ = ang; x.i("MicroMsg.NetSceneGetBeaconsPushMessage", "[kevinkma]getBeaconsPushMessageReq.beacons.size:%d", new Object[]{Integer.valueOf(aaf.rFH.size())}); } public final void a(int i, int i2, int i3, String str, q qVar, byte[] bArr) { x.i("MicroMsg.NetSceneGetBeaconsPushMessage", "[kevinkma][NetSceneGetBeaconsPushMessage]:netId:%s,errType:%s,errCode:%s,errMsg:%s", new Object[]{Integer.valueOf(i), Integer.valueOf(i2), Integer.valueOf(i3), str}); this.diJ.a(i2, i3, str, this); aaf aaf = (aaf) this.dZf.dID.dIL; ane ane = (ane) aaf.rFH.get(0); ang ang = aaf.rFJ; aag aag = (aag) ((b) qVar).dIE.dIL; if (i2 == 0 && i3 == 0) { if (aag.result != 0) { h.mEJ.h(12659, new Object[]{Integer.valueOf(1), Integer.valueOf(r2.size()), ane.fMk, Integer.valueOf(ane.major), Integer.valueOf(ane.minor), String.valueOf(ang.latitude), String.valueOf(ang.longitude), Integer.valueOf(2), Integer.valueOf(aag.result)}); } x.d("MicroMsg.NetSceneGetBeaconsPushMessage", "[kevinkma][NetSceneGetBeaconsPushMessage]:net end ok"); return; } h.mEJ.h(12659, new Object[]{Integer.valueOf(1), Integer.valueOf(r2.size()), ane.fMk, Integer.valueOf(ane.major), Integer.valueOf(ane.minor), String.valueOf(ang.latitude), String.valueOf(ang.longitude), Integer.valueOf(1), Integer.valueOf(aag.result)}); x.d("MicroMsg.NetSceneGetBeaconsPushMessage", "[kevinkma][NetSceneGetBeaconsPushMessage]:net end not ok"); } public final int getType() { return 1708; } public final int a(com.tencent.mm.network.e eVar, e eVar2) { this.diJ = eVar2; return a(eVar, this.dZf, this); } }
package com.yida.utils; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.nutz.dao.entity.annotation.Comment; import org.nutz.dao.entity.annotation.Id; import org.nutz.dao.entity.annotation.Name; import freemarker.template.Configuration; import freemarker.template.Template; import freemarker.template.TemplateException; import freemarker.template.TemplateExceptionHandler; /** ********************* * @author yangke * @version 1.0 * @created 2018年9月15日 下午4:08:59 *********************** */ public class FreemarkerUtils { @SuppressWarnings("rawtypes") public static void createDatagridFileWithEntity(String templatePath, String targetPath, Class entity) { Map<String, Object> paramMap = getParamMapWithPojo(entity); createFile(templatePath, targetPath, paramMap); } public static void createFile(String templatePath, String targetPath, Map<String, Object> paramMap) { Template template = getTemplate(templatePath); try { Writer writer = new OutputStreamWriter(new FileOutputStream(new File(targetPath)), "UTF-8"); template.process(paramMap, writer); } catch (IOException e) { e.printStackTrace(); } catch (TemplateException e) { e.printStackTrace(); } } private static Template getTemplate(String templatePath) { File file = new File(templatePath); String name = file.getName(); File parentFile = file.getParentFile(); Configuration cfg = new Configuration(Configuration.VERSION_2_3_22); try { cfg.setDirectoryForTemplateLoading(parentFile); cfg.setDefaultEncoding("UTF-8"); cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); Template template = cfg.getTemplate(name); return template; } catch (IOException e) { e.printStackTrace(); } return null; } @SuppressWarnings("rawtypes") private static Map<String, Object> getParamMapWithPojo(Class clazz) { List<Class> classes = new ArrayList<>(); getClasses(clazz, classes); List<Map<String, Object>> list = new ArrayList<>(); for (Class class1 : classes) { Field[] fields = class1.getDeclaredFields(); for (Field field : fields) { field.isAccessible(); String name = field.getName(); Id id = field.getAnnotation(Id.class); boolean idField = false; String value = null; if (id == null) { Name namePk = field.getAnnotation(Name.class); if (namePk != null) { idField = true; } } else { idField = true; } Comment comment = field.getAnnotation(Comment.class); if (comment != null) { value = comment.value(); } Map<String, Object> map = new HashMap<>(); map.put("idField", idField); map.put("comment", value); map.put("name", name); list.add(map); } } Map<String, Object> map = new HashMap<>(); map.put("fields", list); return map; } @SuppressWarnings("rawtypes") private static void getClasses(Class clazz, List<Class> classes) { if (clazz != Object.class) { classes.add(clazz); Class superclass = clazz.getSuperclass(); getClasses(superclass, classes); } } }
package com.example.room1.db; import androidx.room.TypeConverter; import com.google.gson.Gson; public class Converts { @TypeConverter public String fromUserToString (User user){ return new Gson().toJson(user); } @TypeConverter public User fromStringToUser(String stringUser){ return new Gson().fromJson(stringUser,User.class); } }
package com.tencent.mm.modelcontrol; import android.content.Context; import android.text.format.DateFormat; import com.tencent.mm.bt.h.d; import com.tencent.mm.kernel.g; import com.tencent.mm.model.ar; import com.tencent.mm.model.bd.b; import com.tencent.mm.model.p; import com.tencent.mm.plugin.zero.b.a; import com.tencent.mm.pointers.PInt; import com.tencent.mm.sdk.platformtools.ad; import com.tencent.mm.sdk.platformtools.ao; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.storage.aa; import com.tencent.mm.storage.bd; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; public class c implements ar { public static synchronized c NM() { c cVar; synchronized (c.class) { cVar = (c) p.v(c.class); } return cVar; } public static boolean o(bd bdVar) { if (bdVar == null) { x.w("MicroMsg.SubCoreAutoDownload", "this message is null, can not auto download."); return false; } else if (!bdVar.ckA()) { x.w("MicroMsg.SubCoreAutoDownload", "this message is not image, please tell cash."); return false; } else if (p(bdVar)) { return NN(); } else { x.i("MicroMsg.SubCoreAutoDownload", "this message need control, can not auto download C2C image."); return false; } } public static boolean NN() { String value = ((a) g.l(a.class)).AT().getValue("C2CImgNotAutoDownloadTimeRange"); x.i("MicroMsg.BusyTimeControlLogic", "C2CImgNotAutoDownloadTimeRange value: " + value); if (b.lz(value)) { x.i("MicroMsg.SubCoreAutoDownload", "it is busy time now , do not auto download C2C image."); return false; } int i = bi.getInt(((a) g.l(a.class)).AT().getValue("ChatImgAutoDownload"), 1); if (i == 3) { x.i("MicroMsg.SubCoreAutoDownload", "settings is not auto download C2C image. ChatImgAutoDownload : " + i); return false; } Context context = ad.getContext(); if (i == 2 && ao.isWifi(context)) { x.i("MicroMsg.SubCoreAutoDownload", "it is wifi now, auto download C2C image."); return true; } else if (i == 1 && ao.isWifi(context)) { x.i("MicroMsg.SubCoreAutoDownload", "it is wifi now, auto download C2C image."); return true; } else { long j = (long) bi.getInt(((a) g.l(a.class)).AT().getValue("ChatImgAutoDownloadMax"), 0); long a = bi.a((Long) g.Ei().DT().get(aa.a.sPH, null), 0); long WV = bi.WV((String) DateFormat.format("M", System.currentTimeMillis())); long a2 = bi.a((Long) g.Ei().DT().get(aa.a.sPI, null), 0); x.d("MicroMsg.SubCoreAutoDownload", "currentmonth " + WV + " month " + a2 + " maxcount " + j + " current " + a + " downloadMode: " + i); if (WV != a2) { x.i("MicroMsg.SubCoreAutoDownload", "update month %d ", new Object[]{Long.valueOf(WV)}); g.Ei().DT().a(aa.a.sPH, Long.valueOf(0)); g.Ei().DT().a(aa.a.sPI, Long.valueOf(WV)); a2 = 0; } else { a2 = a; } if (a2 > j && j > 0) { x.i("MicroMsg.SubCoreAutoDownload", "this month had auto download " + a2 + " C2C image, can not auto download."); return false; } else if (i == 1 && (ao.isWifi(context) || ao.is3G(context) || ao.is4G(context))) { x.i("MicroMsg.SubCoreAutoDownload", "it is wifi or 3,4G now, auto download C2C image."); return true; } else { x.i("MicroMsg.SubCoreAutoDownload", "default can not auto download C2C image."); return false; } } } public static boolean NO() { String value = ((a) g.l(a.class)).AT().getValue("SnsImgPreLoadingAroundTimeLimit"); x.i("MicroMsg.BusyTimeControlLogic", "SnsImgPreLoadingAroundTimeLimit value: " + value); if (b.lz(value)) { x.i("MicroMsg.SubCoreAutoDownload", "it is busy time now, can not auto download SNS image."); return false; } x.i("MicroMsg.SubCoreAutoDownload", "it is not busy time, can auto download SNS image."); return true; } public static boolean a(PInt pInt, PInt pInt2, PInt pInt3) { pInt.value = 0; int i = bi.getInt(((a) g.l(a.class)).AT().getValue("SIGHTAutoLoadNetwork"), 1); pInt2.value = i; if (i == 3) { x.i("MicroMsg.SubCoreAutoDownload", "user settings can not auto download SNS short video"); return false; } boolean isWifi = ao.isWifi(ad.getContext()); if (i == 2 && !isWifi) { x.i("MicroMsg.SubCoreAutoDownload", "it is not wifi now, and status_only_wifi, not auto download SNS short video."); return false; } else if (ao.is2G(ad.getContext())) { x.i("MicroMsg.SubCoreAutoDownload", "it is 2G now, can not auto download SNS short video."); return false; } else { String value = ((a) g.l(a.class)).AT().getValue("SnsSightNoAutoDownload"); if (!bi.oW(value)) { try { x.i("MicroMsg.SubCoreAutoDownload", "dynamicConfigValSeq " + value); long j = bi.getLong(new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()), 0) - ((((long) (((int) b.NL()) - 8)) * 60) / 1000); String[] split = value.split(","); long j2 = bi.getLong(split[0], 0); if (j <= bi.getLong(split[1], 0) && j >= j2) { x.i("MicroMsg.SubCoreAutoDownload", "config settings can not auto download SNS short video"); pInt3.value = 1; return false; } } catch (Exception e) { x.e("MicroMsg.SubCoreAutoDownload", "paser error %s msg: %s", new Object[]{value, e.getMessage()}); } } String value2 = ((a) g.l(a.class)).AT().getValue("SnsSightNotAutoDownloadTimeRange"); x.i("MicroMsg.BusyTimeControlLogic", "SnsSightNotAutoDownloadTimeRange value: " + value2); if (b.lz(value2)) { int i2; x.i("MicroMsg.SubCoreAutoDownload", "it is busy time now, can not auto download(but need check again) SNS short video"); if (i == 2) { i2 = 2; } else { i2 = 1; } pInt.value = i2; return false; } x.i("MicroMsg.SubCoreAutoDownload", "skip all not auto download case, then auto download."); return true; } } public static boolean a(PInt pInt, PInt pInt2) { pInt.value = 0; int i = bi.getInt(((a) g.l(a.class)).AT().getValue("SIGHTAutoLoadNetwork"), 1); pInt2.value = i; if (i == 3) { x.i("MicroMsg.SubCoreAutoDownload", "user settings can not auto download SNS short video[AD]"); return false; } boolean isWifi = ao.isWifi(ad.getContext()); if (i == 2 && !isWifi) { x.i("MicroMsg.SubCoreAutoDownload", "it is not wifi now, and status_only_wifi, not auto download SNS short video[AD]."); return false; } else if (ao.is2G(ad.getContext())) { x.i("MicroMsg.SubCoreAutoDownload", "it is 2G now, can not auto download SNS short video[AD]."); return false; } else { String value = ((a) g.l(a.class)).AT().getValue("SnsAdSightNotAutoDownloadTimeRange"); x.i("MicroMsg.BusyTimeControlLogic", "isSnsAdSightNotAutoDownload value: " + value); if (b.lz(value)) { int i2; x.i("MicroMsg.SubCoreAutoDownload", "it is busy time now, can not auto(but need check again) download SNS short video[AD]"); if (i == 2) { i2 = 2; } else { i2 = 1; } pInt.value = i2; return false; } x.i("MicroMsg.SubCoreAutoDownload", "skip all not auto download case, then auto download[AD]."); return true; } } public static boolean p(bd bdVar) { if (bdVar == null) { x.w("MicroMsg.SubCoreAutoDownload", "this message is null."); return false; } b iF = com.tencent.mm.model.bd.iF(bdVar.cqb); if (iF == null) { x.i("MicroMsg.SubCoreAutoDownload", "this message had no msg source."); return true; } String str = iF.dCy; if (bi.oW(str)) { x.i("MicroMsg.SubCoreAutoDownload", "this message had no not auto download time range config."); return true; } else if (b.lz(str)) { x.i("MicroMsg.SubCoreAutoDownload", "this message need control, can not auto download. timeRange : " + str); return false; } else { x.i("MicroMsg.SubCoreAutoDownload", "this message need control, but it is not the time. timeRange: " + str); return true; } } public final HashMap<Integer, d> Ci() { return null; } public final void gi(int i) { } public final void bn(boolean z) { } public final void bo(boolean z) { } public final void onAccountRelease() { } }
package example.logging; import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; public class Logger { private DataOutputStream outputStream; // ... private Logger(OutputStream outputStream) { this.outputStream = new DataOutputStream(outputStream); } public void error(String message) { write("ERROR", message); } // ... private void write(String type, String message) { try { outputStream.writeChars("[" + type + "] - " + message + "\n"); } catch (IOException error) { throw new RuntimeException(error); } } // ... private static final Logger STANDARD = new Logger(System.out); private static final Logger NULL = new Logger(new NullOutputStream()); public static Logger getLogger() { return ApplicationSettings.shouldLog() ? STANDARD : NULL; } public void debug(String message) { write("DEBUG", message); } public void info(String message) { write("INFO", message); } public void warning(String message) { write("WARNING", message); } }
package com.service; import com.bean.NoticeRcd; import java.util.List; public interface NoticeRcdService { List<NoticeRcd> getNoticeRcd(NoticeRcd noticeRcd); }
package main; import Mapeable; public class Unidad implements Mapeable{ private String nombre; private int transporte; private int vision; private int costo; private int tiempoDeCreacion; private int daņo; private int suministro; private int rangoAtaque; private int vida; public Unidad colocarContenido(){ return null; } }
package com.tencent.mm.ui.widget.listview; import android.util.SparseArray; import android.view.View; import android.view.View.MeasureSpec; import android.view.ViewGroup; import android.view.animation.Animation; import android.widget.AbsListView.LayoutParams; import android.widget.BaseExpandableListAdapter; import android.widget.ExpandableListView; import com.tencent.mm.ui.widget.listview.AnimatedExpandableListView.d; public abstract class AnimatedExpandableListView$a extends BaseExpandableListAdapter { private SparseArray<d> uKA = new SparseArray(); private AnimatedExpandableListView uKB; public abstract View d(int i, int i2, View view); public abstract int xv(int i); static /* synthetic */ void a(AnimatedExpandableListView$a animatedExpandableListView$a, int i, int i2) { d Gy = animatedExpandableListView$a.Gy(i); Gy.jEL = true; Gy.uKM = i2; Gy.uKL = false; } final d Gy(int i) { d dVar = (d) this.uKA.get(i); if (dVar != null) { return dVar; } dVar = new d((byte) 0); this.uKA.put(i, dVar); return dVar; } public final int getChildType(int i, int i2) { if (Gy(i).jEL) { return 0; } return 1; } public final int getChildTypeCount() { return 2; } public final View getChildView(int i, int i2, boolean z, View view, ViewGroup viewGroup) { d Gy = Gy(i); if (!Gy.jEL) { return d(i, i2, view); } View view2; if (view instanceof AnimatedExpandableListView$b) { view2 = view; } else { view2 = new AnimatedExpandableListView$b(viewGroup.getContext(), (byte) 0); view2.setLayoutParams(new LayoutParams(-1, 0)); } if (i2 < Gy.uKM) { view2.getLayoutParams().height = 0; return view2; } int i3; ExpandableListView expandableListView = (ExpandableListView) viewGroup; AnimatedExpandableListView$b animatedExpandableListView$b = (AnimatedExpandableListView$b) view2; animatedExpandableListView$b.uKG.clear(); AnimatedExpandableListView$b.a(animatedExpandableListView$b, expandableListView.getDivider(), viewGroup.getMeasuredWidth(), expandableListView.getDividerHeight()); int makeMeasureSpec = MeasureSpec.makeMeasureSpec(viewGroup.getWidth(), 1073741824); int makeMeasureSpec2 = MeasureSpec.makeMeasureSpec(0, 0); int i4 = 0; int height = viewGroup.getHeight(); int xv = xv(i); for (i3 = Gy.uKM; i3 < xv; i3++) { View d = d(i, i3, null); d.measure(makeMeasureSpec, makeMeasureSpec2); i4 += d.getMeasuredHeight(); if (i4 >= height) { animatedExpandableListView$b.dT(d); i4 += ((xv - i3) - 1) * (i4 / (i3 + 1)); break; } animatedExpandableListView$b.dT(d); } Object tag = animatedExpandableListView$b.getTag(); if (tag == null) { i3 = 0; } else { i3 = ((Integer) tag).intValue(); } Animation animatedExpandableListView$c; if (Gy.uKL && r2 != 1) { animatedExpandableListView$c = new AnimatedExpandableListView$c(animatedExpandableListView$b, 0, i4, Gy); animatedExpandableListView$c.setDuration((long) AnimatedExpandableListView.a(this.uKB)); animatedExpandableListView$c.setAnimationListener(new 1(this, i, animatedExpandableListView$b)); animatedExpandableListView$b.startAnimation(animatedExpandableListView$c); animatedExpandableListView$b.setTag(Integer.valueOf(1)); return view2; } else if (Gy.uKL || r2 == 2) { return view2; } else { if (Gy.uKN == -1) { Gy.uKN = i4; } animatedExpandableListView$c = new AnimatedExpandableListView$c(animatedExpandableListView$b, Gy.uKN, 0, Gy); animatedExpandableListView$c.setDuration((long) AnimatedExpandableListView.a(this.uKB)); animatedExpandableListView$c.setAnimationListener(new 2(this, i, expandableListView, Gy, animatedExpandableListView$b)); animatedExpandableListView$b.startAnimation(animatedExpandableListView$c); animatedExpandableListView$b.setTag(Integer.valueOf(2)); return view2; } } public final int getChildrenCount(int i) { d Gy = Gy(i); if (Gy.jEL) { return Gy.uKM + 1; } return xv(i); } }
package com.example.mark.pollmeads; import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; import android.graphics.Typeface; import android.location.Criteria; import android.location.Location; import android.location.LocationManager; import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.DisplayMetrics; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.Spinner; import android.widget.TextView; import com.firebase.client.Firebase; import com.firebase.client.FirebaseError; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; public class CreatePollActivity extends Activity implements View.OnClickListener { private Firebase mFirebaseRef; private EditText etQuestion, etAnswer1, etAnswer2, etAnswer3, etAnswer4, etAnswer5, etPassword; private TextView tvCategory; private Button bSubmitPoll, bAddAnswer, bRemoveAnswer; private Spinner spinCategory; private CheckBox cbPassword, cbLocation; private String longitude, latitude; private LocationManager locationManager = null; private String provider; private LinearLayout linScroll; private int answers = 2; private Typeface typeface; private static final String REPO_URL = "XXXXX"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.createpoll); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); typeface = Typeface.createFromAsset(getApplicationContext().getAssets(), "Roboto-Thin.ttf"); Firebase.setAndroidContext(this); initializeLayout(); } private void initializeLayout() { linScroll = (LinearLayout) findViewById(R.id.linScroll); bAddAnswer = (Button) findViewById(R.id.bAddAnswer); bAddAnswer.setOnClickListener(this); bRemoveAnswer = (Button) findViewById(R.id.bRemoveAnswer); bRemoveAnswer.setOnClickListener(this); bRemoveAnswer.setVisibility(View.INVISIBLE); etQuestion = (EditText) findViewById(R.id.etQuestion); etQuestion.setTypeface(typeface); etAnswer1 = (EditText) findViewById(R.id.etAnswer1); etAnswer1.setTypeface(typeface); etAnswer2 = (EditText) findViewById(R.id.etAnswer2); etAnswer2.setTypeface(typeface); etAnswer3 = (EditText) findViewById(R.id.etAnswer3); etAnswer3.setTypeface(typeface); etAnswer3.setVisibility(View.INVISIBLE); etAnswer4 = (EditText) findViewById(R.id.etAnswer4); etAnswer4.setTypeface(typeface); etAnswer4.setVisibility(View.INVISIBLE); etAnswer5 = (EditText) findViewById(R.id.etAnswer5); etAnswer5.setTypeface(typeface); etAnswer5.setVisibility(View.INVISIBLE); tvCategory = (TextView) findViewById(R.id.tvCategory); tvCategory.setTypeface(typeface); latitude = "Location not available"; longitude = "Location not available"; cbPassword = (CheckBox) findViewById(R.id.cbPassword); cbPassword.setTypeface(typeface); cbPassword .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { etPassword.setVisibility(View.VISIBLE); } else { etPassword.setVisibility(View.INVISIBLE); } } }); etPassword = (EditText) findViewById(R.id.etPassword); etPassword.setTypeface(typeface); etPassword.setVisibility(View.INVISIBLE); bSubmitPoll = (Button) findViewById(R.id.bSubmitPoll); bSubmitPoll.setOnClickListener(this); bSubmitPoll.setTypeface(typeface); spinCategory = (Spinner) findViewById(R.id.spinCategory); String[] cats = {"Select Category", "Business", "Electronics", "Entertainment", "Food", "Health & Fitness", "Misc", "Sports"}; ArrayAdapter<String> adapter_cats = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, cats) { public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); ((TextView) v).setTypeface(typeface); return v; } public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = super.getDropDownView(position, convertView, parent); ((TextView) v).setTypeface(typeface); v.setBackgroundColor(Color.WHITE); return v; } }; adapter_cats.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinCategory.setAdapter(adapter_cats); cbLocation = (CheckBox) findViewById(R.id.cbLocation); cbLocation.setTypeface(typeface); cbLocation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked && isLocationEnabled(getApplicationContext())) { //if checkbox pressed and location services enabled locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); provider = locationManager.getBestProvider(criteria, false); Location location = locationManager.getLastKnownLocation(provider); //get the last known location if (location == null) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(CreatePollActivity.this); alertDialogBuilder.setMessage("Sorry. Your location could not be determined. Please try again later."); //inform the user alertDialogBuilder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() { @Override public void onClick( DialogInterface arg0, int arg1) { cbLocation.setChecked(false); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); cbLocation.setChecked(false); latitude = "Location not available"; //otherwise no location has been set longitude = "Location not available"; } else { onLocationChanged(location); } } else if (isChecked && !isLocationEnabled(getApplicationContext())) { //if checkbox pressed and no location services AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(CreatePollActivity.this); alertDialogBuilder.setMessage("To view local polls you must enable location services on your device."); //inform the user alertDialogBuilder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() { @Override public void onClick( DialogInterface arg0, int arg1) { cbLocation.setChecked(false); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } else { latitude = "Location not available"; //otherwise no location has been set longitude = "Location not available"; } } }); } public void onLocationChanged(Location location) { double lat = (location.getLatitude()); double lng = (location.getLongitude()); longitude = String.valueOf(lng); latitude = String.valueOf(lat); } @SuppressLint("InlinedApi") @SuppressWarnings("deprecation") public static boolean isLocationEnabled(Context context) { int locationMode = 0; String locationProviders; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { try { locationMode = Settings.Secure.getInt( context.getContentResolver(), Settings.Secure.LOCATION_MODE); } catch (Settings.SettingNotFoundException e) { e.printStackTrace(); } return locationMode != Settings.Secure.LOCATION_MODE_OFF; } else { locationProviders = Settings.Secure.getString( context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); return !TextUtils.isEmpty(locationProviders); } } @Override public void onClick(View arg0) { switch (arg0.getId()) { case (R.id.bSubmitPoll): if (errorCheck()) { final TelephonyManager tm = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE); final String deviceId = tm.getDeviceId(); String sCategory = spinCategory.getSelectedItem().toString(); String sQuestion = etQuestion.getText().toString(); String sAns1 = etAnswer1.getText().toString(); String sAns2 = etAnswer2.getText().toString(); String sAns3 = etAnswer3.getText().toString(); String sAns4 = etAnswer4.getText().toString(); String sAns5 = etAnswer5.getText().toString(); String sPassword = etPassword.getText().toString(); mFirebaseRef = new Firebase("https://brilliant-inferno-4839.firebaseio.com/"); Firebase postRef = mFirebaseRef.child("polls"); Firebase newPostRef = postRef.push(); // Add some data to the new location Map<String, String> post1 = new HashMap<>(); post1.put("deviceId", deviceId); post1.put("category", sCategory); post1.put("latitude", latitude); post1.put("longitude", longitude); post1.put("question", sQuestion); post1.put("answer1", sAns1); post1.put("answer2", sAns2); post1.put("answer3", sAns3); post1.put("answer4", sAns4); post1.put("answer5", sAns5); if (cbPassword.isChecked()) { post1.put("privacy", "true"); post1.put("password", sPassword); } else { post1.put("privacy", "false"); post1.put("password", "NA"); } newPostRef.setValue(post1); // Get the unique ID generated by push() String pollId = newPostRef.getKey(); Firebase resultRef = mFirebaseRef.child("results").child(pollId); com.example.mark.pollmeads.Results result = new com.example.mark.pollmeads.Results(0, 0, 0, 0, 0); resultRef.setValue(result); Firebase historyRef = new Firebase(REPO_URL + "history/" + pollId); Firebase posthistoryRef = historyRef.push(); posthistoryRef.setValue("00000000initial"); Firebase userRef = new Firebase(REPO_URL + "mypolls/" + deviceId); Firebase userpostRef = userRef.push(); userpostRef.setValue(pollId); final String email = deviceId + "@firebase.com"; final String password = "firebasepass"; mFirebaseRef.createUser(email, password, new Firebase.ResultHandler() { @Override public void onSuccess() { mFirebaseRef.authWithPassword(email, password, null); } @Override public void onError(FirebaseError firebaseError) { mFirebaseRef.authWithPassword(email, password, null); } }); Intent intentHome = new Intent(".Home"); startActivity(intentHome); } break; case (R.id.bAddAnswer): if (answers > 5) { bAddAnswer.setVisibility(View.INVISIBLE); } else { answers++; } if (answers == 3) { bRemoveAnswer.setVisibility(View.VISIBLE); etAnswer3.setVisibility(View.VISIBLE); etAnswer3.setHintTextColor(Color.WHITE); DisplayMetrics displayMetrics = getApplicationContext() .getResources().getDisplayMetrics(); int px = Math .round(140 * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, px); int px2 = Math .round(10 * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); lp.setMargins(0, 0, 0, px2); linScroll.setLayoutParams(lp); } if (answers == 4) { bRemoveAnswer.setVisibility(View.VISIBLE); etAnswer4.setVisibility(View.VISIBLE); etAnswer4.setHintTextColor(Color.WHITE); DisplayMetrics displayMetrics = getApplicationContext() .getResources().getDisplayMetrics(); int px = Math .round(190 * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, px); int px2 = Math .round(10 * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); lp.setMargins(0, 0, 0, px2); linScroll.setLayoutParams(lp); } else if (answers == 5) { etAnswer5.setVisibility(View.VISIBLE); etAnswer5.setHintTextColor(Color.WHITE); DisplayMetrics displayMetrics = getApplicationContext() .getResources().getDisplayMetrics(); int px = Math .round(240 * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, px); int px2 = Math .round(10 * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); lp.setMargins(0, 0, 0, px2); linScroll.setLayoutParams(lp); bAddAnswer.setVisibility(View.INVISIBLE); } break; case (R.id.bRemoveAnswer): if (answers == 3) { answers--; etAnswer3.setVisibility(View.INVISIBLE); etAnswer3.setText(""); DisplayMetrics displayMetrics = getApplicationContext() .getResources().getDisplayMetrics(); int px = Math .round(90 * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, px); int px2 = Math .round(10 * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); lp.setMargins(0, 0, 0, px2); linScroll.setLayoutParams(lp); bRemoveAnswer.setVisibility(View.INVISIBLE); } else if (answers == 4) { answers--; etAnswer4.setVisibility(View.INVISIBLE); etAnswer4.setText(""); DisplayMetrics displayMetrics = getApplicationContext() .getResources().getDisplayMetrics(); int px = Math .round(140 * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, px); int px2 = Math .round(10 * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); lp.setMargins(0, 0, 0, px2); linScroll.setLayoutParams(lp); } else if (answers == 5) { answers--; etAnswer5.setVisibility(View.INVISIBLE); etAnswer5.setText(""); DisplayMetrics displayMetrics = getApplicationContext() .getResources().getDisplayMetrics(); int px = Math .round(190 * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, px); int px2 = Math .round(10 * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); lp.setMargins(0, 0, 0, px2); linScroll.setLayoutParams(lp); bAddAnswer.setVisibility(View.VISIBLE); } break; } } private boolean errorCheck() { boolean allOk = false; ArrayList<EditText> allEditTexts = new ArrayList<>(); allEditTexts.add(etQuestion); allEditTexts.add(etAnswer1); allEditTexts.add(etAnswer2); if (etAnswer3.isShown()) { allEditTexts.add(etAnswer3); } if (etAnswer4.isShown()) { allEditTexts.add(etAnswer4); } if (etAnswer5.isShown()) { allEditTexts.add(etAnswer5); } if (etPassword.isShown()) { allEditTexts.add(etPassword); } for (final EditText editTest : allEditTexts) { if (editTest.getText().toString().trim().equals("")) { editTest.setText(""); } } if (etQuestion.getText().toString().trim().equals("") || etAnswer1.getText().toString().trim().equals("") || etAnswer2.getText().toString().trim().equals("") || etAnswer3.isShown() && etAnswer3.getText().toString().trim().equals("") || etAnswer4.isShown() && etAnswer4.getText().toString().trim().equals("") || etAnswer5.isShown() && etAnswer5.getText().toString().trim().equals("") || cbPassword.isChecked() && etPassword.getText().toString().equals("")) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setMessage("Fields with red text have not been filled out. Please do so to submit the poll."); alertDialogBuilder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { etQuestion.setHintTextColor(Color.RED); etAnswer1.setHintTextColor(Color.RED); etAnswer2.setHintTextColor(Color.RED); etAnswer3.setHintTextColor(Color.RED); etAnswer4.setHintTextColor(Color.RED); etAnswer5.setHintTextColor(Color.RED); etPassword.setHintTextColor(Color.RED); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } else if (etQuestion.getText().toString().equals(etAnswer1.getText().toString()) || etQuestion.getText().toString().equals(etAnswer2.getText().toString()) || etQuestion.getText().toString().equals(etAnswer3.getText().toString()) || etQuestion.getText().toString().equals(etAnswer4.getText().toString()) || etQuestion.getText().toString().equals(etAnswer5.getText().toString())) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setMessage("An answer must not be the same as the question. Please change to submit the poll"); alertDialogBuilder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } else if (etAnswer1.getText().toString() .equals(etAnswer2.getText().toString()) || etAnswer3.isShown() && etAnswer1.getText().toString().equals(etAnswer3.getText().toString()) || etAnswer4.isShown() && etAnswer1.getText().toString().equals(etAnswer4.getText().toString()) || etAnswer5.isShown() && etAnswer1.getText().toString().equals(etAnswer5.getText().toString()) || etAnswer3.isShown() && etAnswer2.getText().toString().equals(etAnswer3.getText().toString()) || etAnswer4.isShown() && etAnswer2.getText().toString().equals(etAnswer4.getText().toString()) || etAnswer5.isShown() && etAnswer2.getText().toString().equals(etAnswer5.getText().toString()) || etAnswer4.isShown() && etAnswer3.getText().toString().equals(etAnswer4.getText().toString()) || etAnswer5.isShown() && etAnswer3.getText().toString().equals(etAnswer5.getText().toString()) || etAnswer5.isShown() && etAnswer4.getText().toString().equals(etAnswer5.getText().toString())) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setMessage("All answers must be different from one another. Please change to submit the poll."); alertDialogBuilder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } else if (etQuestion.getText().toString().trim().length() > 65) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setMessage("Questions can only have a maximum of 65 characters. Please change to submit the poll."); alertDialogBuilder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } else if (etAnswer1.getText().toString().trim().length() > 25 || etAnswer2.getText().toString().trim().length() > 25 || etAnswer3.isShown() && etAnswer3.getText().toString().trim().length() > 25 || etAnswer4.isShown() && etAnswer4.getText().toString().trim().length() > 25 || etAnswer5.isShown() && etAnswer5.getText().toString().trim().length() > 25) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setMessage("Answers can only have a maximum of 25 characters. Please change to submit the poll."); alertDialogBuilder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } else if (spinCategory.getSelectedItem().equals("Select Category")) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setMessage("Please select a cateogry for the poll."); alertDialogBuilder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } else { allOk = true; } return allOk; } @Override protected void onDestroy() { super.onDestroy(); } }
@ParentPackage("right") @Namespace("/right") package com.xu.easyweb.action.right; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.ParentPackage;
package com.ifre.service.impl.brms; import java.util.ArrayList; import java.util.List; import org.jeecgframework.core.common.service.impl.CommonServiceImpl; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.ifre.entity.brms.RuleProdEntity; import com.ifre.entity.ruleengin.BrmsConditionDetailEntity; import com.ifre.entity.ruleengin.BrmsRuleConditionEntity; import com.ifre.entity.ruleengin.BrmsRuleTableEntity; import com.ifre.exception.IfreException; import com.ifre.form.api.Model; import com.ifre.form.api.ModelElement; import com.ifre.form.api.ModelElementItem; import com.ifre.service.brms.RuleProdServiceI; @Service("ruleProdService") @Transactional public class RuleProdServiceImpl extends CommonServiceImpl implements RuleProdServiceI { /** * 根据组织ID查询决策产品 * @author 王传圣 * @param String orgId 组织ID * @return List<RuleProdEntity> 决策产品 * @throws IfreException */ public List<RuleProdEntity> findRuleProdEntityByOrgId(String orgId) throws IfreException { List<RuleProdEntity> result = null; try { StringBuffer hql = new StringBuffer(); hql.append(" from RuleProdEntity where orgId = ? "); result = this.findHql(hql.toString(),new Object[]{orgId}); } catch (Exception ex) { throw new IfreException(100000,"根据组织ID查询决策产品异常",ex); } return result; } @Override public void updateProductStatus(String prodId, String status) { String sql = "update brms_rule_prod set status = ? where id = ?"; executeSql(sql, new Object[]{status,prodId}); } @Override public Model getModelByProdId(String prodId) throws IfreException { Model model = new Model(); model.setProdId(prodId); //第一步根据prodId获取对应的所有决策表信息 String hql = "from BrmsRuleTableEntity where prodId = ? order by salience desc"; List<BrmsRuleTableEntity> propList = this.findHql(hql,prodId); if(propList != null && propList.size() > 0){ String hqlcondition = "from BrmsRuleConditionEntity where ruleTableId = ?"; List<BrmsRuleConditionEntity> conditionList = this.findHql(hqlcondition, propList.get(0).getId()); try{ List<List<BrmsConditionDetailEntity>> conditionTotalList = new ArrayList<List<BrmsConditionDetailEntity>>(); for (int i = 0; i < conditionList.size(); i++) { BrmsRuleConditionEntity condition = conditionList.get(i); String hqlConditionDetails = "from BrmsConditionDetailEntity where condId = ? and ruleTableId = ? "; List<BrmsConditionDetailEntity> conditionDetails = this.findHql(hqlConditionDetails,condition.getId(),condition.getRuleTableId()); conditionTotalList.add(conditionDetails); } String[][] total = new String[conditionTotalList.get(0).size()][conditionList.size()]; //获取变量信息 for (int i = 0; i < conditionTotalList.size(); i++) { for (int j = 0; j < conditionTotalList.get(i).size(); j++) { total[j][i] = conditionTotalList.get(i).get(j).getCondValue(); } } //根据变量名排序保证相同变量名相邻,作用是保存时相同变量的属性不一定是相邻的 String[] temps; for (int row = 0; row < total.length; row++) { for (int rowCompare = row+1; rowCompare < total.length; rowCompare++) { if(total[row][3] != null&& total[rowCompare][3] != null && total[row][3].compareTo(total[rowCompare][3]) > 0){ //列交换 temps = total[rowCompare]; total[rowCompare] = total[row]; total[row] = temps; } } } List<ModelElement> modelElement = new ArrayList<ModelElement>(); ModelElement element; List<ModelElementItem> modelElementItem = null; ModelElementItem item; String temp = ""; for (int row = 0; row < total.length; row++) { if(temp != null && total[row][3] != null && !temp.equals(total[row][3])){ element = new ModelElement(); element.setName(total[row][3]); element.setValue(total[row][2]); modelElementItem = new ArrayList<ModelElementItem>(); item = new ModelElementItem(); item.setCodeValue(total[row][4]); item.setValue(total[row][1]); modelElementItem.add(item); element.setModelElementItem(modelElementItem); modelElement.add(element); temp = total[row][3]; }else if(total[row][3] != null && modelElementItem != null){ item = new ModelElementItem(); item.setCodeValue(total[row][4]); item.setValue(total[row][1]); modelElementItem.add(item); } } if(total.length > 0){ model.setModelType(total[0][5]); } model.setModelElement(modelElement); System.out.println(total); } catch (Exception ex) { ex.printStackTrace(); } }else{ throw new IfreException("未创建模型"); } return model; } @Override public List<RuleProdEntity> findRuleProdList(String orgCode) throws IfreException { try { String status = "3"; String hql; if(!"A01".equals(orgCode)){ hql = " from RuleProdEntity where status = ? AND rightStatus = 1 AND orgCode = ? "; return this.findHql(hql, status,orgCode); }else{ hql = " from RuleProdEntity where status = ? AND rightStatus = 1 "; return this.findHql(hql, status); } } catch (Exception e) { throw new IfreException(100000, "获取产品列表信息异常", e); } } @Override public List<RuleProdEntity> findRuleProdList(String orgCode,boolean isDuressFilter) throws IfreException { try { String status = "3"; String hql; if(isDuressFilter || !"A01".equals(orgCode)){ hql = " from RuleProdEntity where status = ? AND rightStatus = 1 AND orgCode = ? "; return this.findHql(hql, status,orgCode); }else{ hql = " from RuleProdEntity where status = ? AND rightStatus = 1 "; return this.findHql(hql, status); } } catch (Exception e) { throw new IfreException(100000, "获取产品列表信息异常", e); } } }
package cn.xyz.mianshi.service.impl; import java.util.ArrayList; import java.util.List; import java.util.Random; import org.bson.types.ObjectId; import org.mongodb.morphia.query.Query; import org.mongodb.morphia.query.UpdateOperations; import org.mongodb.morphia.query.UpdateResults; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.mongodb.BasicDBObject; import com.mongodb.DBCollection; import com.mongodb.DBObject; import cn.xyz.commons.support.mongo.MongoOperator; import cn.xyz.commons.utils.DateUtil; import cn.xyz.commons.utils.StringUtil; import cn.xyz.commons.vo.PublicNumVo; import cn.xyz.commons.vo.ResultInfo; import cn.xyz.commons.vo.UpublicDto; import cn.xyz.mianshi.service.PublicNumManager; import cn.xyz.mianshi.vo.PublicNum; import cn.xyz.mianshi.vo.PublicNumDvo; import cn.xyz.mianshi.vo.UPublicNum; import cn.xyz.mianshi.vo.User; import cn.xyz.repository.PublicNumRepository; import cn.xyz.repository.UPublicNumRepository; @Service(PublicNumManagerImpl.BEAN_ID) public class PublicNumManagerImpl extends MongoRepository<PublicNum, Integer> implements PublicNumManager { public static final String BEAN_ID = "PublicNumManagerImpl"; @Autowired private PublicNumRepository publicNumRepository; @Autowired private UPublicNumRepository uPublicNumRepository; /** * * <p>Title: createPublicId</p> * <p>Description: 用与生成新的公众号ID</p> * @return */ public synchronized Integer createPublicId() { DBCollection collection = dsForRW.getDB().getCollection("idx_public"); if (null == collection) return createIdxPublicCollection(collection, 0); DBObject obj = collection.findOne(); if (null != obj) { Integer id = new Integer(obj.get("id").toString()); id += 1; // 将id加1 collection.update(new BasicDBObject("_id", obj.get("_id")), new BasicDBObject(MongoOperator.INC, new BasicDBObject("id", 1))); return id; } else { return createIdxPublicCollection(collection, 0); } } /** * * <p>Title: createIdxPublicCollection</p> * <p>Description:将最大公众号id存入数据库 </p> * @param collection * @param publicId * @return */ private Integer createIdxPublicCollection(DBCollection collection, long publicId) { if (null == collection) collection = dsForRW.getDB().createCollection("idx_public", new BasicDBObject()); BasicDBObject init = new BasicDBObject(); Integer id = getMaxPublicId(); if (0 == id || id < 2000000) id = new Integer("20000001"); id += 1; init.append("id", id); init.append("stub", "id"); init.append("call", 300000); init.append("videoMeetingNo", 350000); collection.insert(init); return id; } /** * * <p>Title: getMaxPublicId</p> * <p>Description:获取最大公众号id </p> * @return */ private Integer getMaxPublicId() { BasicDBObject projection = new BasicDBObject("publicId", 1); DBObject dbobj = dsForRW.getDB().getCollection("publicNum").findOne(null, projection, new BasicDBObject("publicNum", -1)); if (null == dbobj) return 0; Integer id = new Integer(dbobj.get("publicId").toString()); return id; } /** * 创建新的公众号 */ @Override public PublicNum createPublicNum() { PublicNum num = new PublicNum(); num.setPublicId(createPublicId()); return num; } /** * 添加公众号,如果公众号已经存在,则添加一条记录在数据库,如果不存在,则创建该公众号 */ @Override public ResultInfo<Integer> addPublicNum(PublicNum publicNum) { ResultInfo<Integer> result = new ResultInfo<>(); Integer integer = publicNum.getPublicId(); if (null == integer) { publicNum.setPublicId(createPublicId()); }//判断该数据是否已经存在,如果存在则修改 Query<PublicNum> query = dsForRW.createQuery(PublicNum.class).field("publicId") .equal(publicNum.getPublicId()).field("csUserId").equal(publicNum.getCsUserId()); PublicNum findOne = this.findOne(query); //如果不为空则更新 if(findOne!=null){ this.updatePub(publicNum); result.setCode("1000"); result.setData(publicNum.getPublicId()); result.setMsg("更新成功"); return result; } publicNum.setIsDel(0); publicNum.setCreateTime(DateUtil.currentTimeSeconds()); publicNum.setUpdateTime(DateUtil.currentTimeSeconds()); Integer publicId = publicNumRepository.addPublicNum(publicNum); result.setCode("1000"); result.setData(publicId); result.setMsg("创建成功"); return result; } /** * 获取用户已经关注的公众号列表 */ @Override // 获取公众号列表 public ResultInfo<UpublicDto> getAttentionList(Integer userId) { ResultInfo<UpublicDto> result = new ResultInfo<>(); UpublicDto dto = new UpublicDto(); List<UPublicNum> list = uPublicNumRepository.getPublicNumByUserId(userId); if (!list.isEmpty()) { dto.setList(list); result.setCode("1000"); result.setData(dto); result.setMsg("获取成功"); return result; } result.setCode("1001"); result.setData(dto); result.setMsg("未关注公众号"); return result; } /** * 用户添加关注公众号 */ @Override // 添加关注 public ResultInfo<String> addAttention(Integer userId, Integer publicId) { ResultInfo<String> result = new ResultInfo<>(); PublicNum publicNum = publicNumRepository.getPublicNum(publicId); if (null == publicNum) { result.setCode("1001"); result.setMsg("公众号不存在"); result.setData(""); return result; } // 判断原来是否关注过 UPublicNum up = uPublicNumRepository.getUpublicNum(userId, publicId); Object objectId=null; // 如果数据库存在,则修改isAtt为1 if (null != up) { up.setIsAtt(1); objectId = uPublicNumRepository.addAttention(up); } else { UPublicNum uPub = new UPublicNum(); uPub.setIsAtt(1); uPub.setPublicId(publicId); uPub.setUserId(userId); uPub.setTime(DateUtil.currentTimeSeconds()); uPub.setPortraitUrl(publicNum.getPortraitUrl()); uPub.setPublicName(publicNum.getNickname()); uPub.setType(publicNum.getType()); objectId = uPublicNumRepository.addAttention(uPub); } if (null != objectId) { result.setCode("1000"); result.setMsg("关注成功"); result.setData(objectId.toString()); return result; }else{ result.setCode("1001"); result.setMsg("关注失败"); result.setData(""); return result; } } /** * 获取公众号详情 */ @Override public ResultInfo<PublicNum> getDetail(Integer publicId) { ResultInfo<PublicNum> result = new ResultInfo<>(); PublicNum publicNum = this.findOne("publicId", publicId); if (null == publicNum) { result.setCode("1001"); result.setData(publicNum); result.setMsg("公众号不存在"); return result; } result.setCode("1000"); result.setData(publicNum); result.setMsg("获取成功"); return result; } /** * 根据公众号名称搜索公众号 */ @Override public ResultInfo<PublicNumDvo> getByName(Integer userId,String nickname) { ResultInfo<PublicNumDvo> result = new ResultInfo<>(); Query<PublicNum> query = dsForRW.createQuery(PublicNum.class).field("nickname") .equal(nickname).field("isDel").equal(0); PublicNum publicNum = this.findOne(query); PublicNumDvo dvo=new PublicNumDvo(); if (null == publicNum) { result.setCode("1001"); result.setData(dvo); result.setMsg("公众号不存在"); return result; } dvo.setNickname(nickname); dvo.setIndexUrl(publicNum.getIndexUrl()); dvo.setIndexUrlTital(publicNum.getIndexUrlTital()); dvo.setMessage(publicNum.getMessage()); dvo.setMessageUrl(publicNum.getMessageUrl()); dvo.setPublicId(publicNum.getPublicId()); dvo.setIntroduce(publicNum.getIntroduce()); dvo.setType(publicNum.getType()); dvo.setPortraitUrl(publicNum.getPortraitUrl()); //判断是否已经关注 boolean att = uPublicNumRepository.isAtt(userId, nickname); if(att){ dvo.setIsAtt(1); }else{ dvo.setIsAtt(0); } result.setCode("1000"); result.setData(dvo); result.setMsg("获取成功"); return result; } /** * 获取客服id */ @Override public ResultInfo<Integer> getServiceId(Integer publicId) { ResultInfo<Integer> result = new ResultInfo<>(); List<Integer> list = publicNumRepository.getServiceIds(publicId); if (list.isEmpty()) { result.setCode("1001"); result.setData(0); result.setMsg("获取失败"); return result; } else { // 如果只有一个客服 if (list.size() == 1) { result.setCode("1000"); result.setData(list.get(0)); result.setMsg("获取成功"); return result; } // 多过一个则随机选择客服 int i = (int) (Math.random() * (list.size() - 1)); result.setCode("1000"); result.setData(list.get(i)); result.setMsg("获取成功"); return result; } } /** * 获取用户已经绑定的公众号列表 */ @Override public ResultInfo<PublicNumVo> getPublicNumListForCS(Integer csUserId) { ResultInfo<PublicNumVo> result = new ResultInfo<>(); PublicNumVo vo = new PublicNumVo(); List<PublicNum> list = publicNumRepository.getPublcNumListForCS(csUserId); if (!list.isEmpty()) { vo.setList(list); result.setCode("1000"); result.setData(vo); result.setMsg("获取成功"); return result; } else { result.setCode("1001"); result.setData(vo); result.setMsg("该用户不是客服"); return result; } } /** * 取消关注公众号 */ @Override public ResultInfo<String> cancelAttention(Integer userId, Integer publicId) { ResultInfo<String> result = new ResultInfo<>(); PublicNum publicNum = publicNumRepository.getPublicNum(publicId); if (null == publicNum) { result.setCode("1001"); result.setMsg("公众号不存在"); result.setData(""); return result; } Object objectId = uPublicNumRepository.cancelAttention(userId, publicId); if (null == objectId) { result.setCode("1001"); result.setMsg("取消关注失败"); result.setData(""); return result; } result.setCode("1000"); result.setMsg("取消成功"); result.setData(objectId.toString()); return result; } @Override public ResultInfo<String> removePublicNum(Integer publicId, Integer csUserId) { ResultInfo<String> result=new ResultInfo<>(); PublicNum publicNum = publicNumRepository.removePublicNum(publicId,csUserId); if(null==publicNum){ result.setCode("1001"); result.setData("失败"); result.setMsg("删除客服失败"); return result; }else{ result.setCode("1000"); result.setData(publicNum.toString()); result.setMsg("删除客服成功"); return result; } } @Override public ResultInfo<String> deletePublicNum(Integer publicId) { ResultInfo<String> result=new ResultInfo<>(); //将用户已经关注过该公众号设为未关注 uPublicNumRepository.removeAtt(publicId); UpdateResults update= publicNumRepository.deletePublicNum(publicId); if(null==update){ result.setCode("1001"); result.setData("失败"); result.setMsg("删除公众号失败"); return result; }else{ result.setCode("1000"); result.setData(update.toString()); result.setMsg("删除公众号成功"); return result; } } @Override public boolean isAtt(Integer userId, String nickName) { boolean boo =uPublicNumRepository.isAtt(userId,nickName); return false; } @Override public void deleteByObjectId(ObjectId id) { Query<PublicNum> query = dsForRW.createQuery(PublicNum.class).field("_id") .equal(id); UpdateOperations<PublicNum> ops=this.createUpdateOperations(); ops.set("isDel", 1); this.update(query, ops); } public void updatePub(PublicNum publicNum){ Query<PublicNum> query = dsForRW.createQuery(PublicNum.class).field("_id") .equal(publicNum.getId()); UpdateOperations<PublicNum> ops=this.createUpdateOperations(); if(null!=publicNum.getPublicId()){ ops.set("publicId", publicNum.getPublicId()); } if(!StringUtil.isEmpty(publicNum.getNickname())){ ops.set("nickname", publicNum.getNickname()); } if(null!=publicNum.getCsUserId()){ ops.set("csUserId", publicNum.getCsUserId()); } if(!StringUtil.isEmpty(publicNum.getMessage())){ ops.set("message", publicNum.getMessage()); } if(!StringUtil.isEmpty(publicNum.getMessageUrl())){ ops.set("messageUrl", publicNum.getMessageUrl()); } if(!StringUtil.isEmpty(publicNum.getIntroduce())){ ops.set("introduce", publicNum.getIntroduce()); } if(!StringUtil.isEmpty(publicNum.getIndexUrlTital())){ ops.set("indexUrlTital", publicNum.getIndexUrlTital()); } if(!StringUtil.isEmpty(publicNum.getIndexUrl())){ ops.set("indexUrl", publicNum.getIndexUrl()); } if(!StringUtil.isEmpty(publicNum.getPortraitUrl())){ ops.set("portraitUrl", publicNum.getPortraitUrl()); } if(0!=DateUtil.currentTimeSeconds()){ ops.set("updateTime", DateUtil.currentTimeSeconds()); } if(null!=publicNum.getIsDel()){ ops.set("isDel", publicNum.getIsDel()); } ops.set("type", publicNum.getType()); if(null!=publicNum.getPhone()){ ops.set("phone", publicNum.getPhone()); } this.update(query, ops); } public PublicNum getbyObjectId(ObjectId objId) { Query<PublicNum> query = dsForRW.createQuery(PublicNum.class).field("_id") .equal(objId); return this.findOne(query); } public int judgeCS(Integer csUserId) { Query<PublicNum> query = dsForRW.createQuery(PublicNum.class).field("csUserId") .equal(csUserId).field("isDel").equal(0); List<PublicNum> asList = query.asList(); if(asList.isEmpty()){ return 0; }else{ return asList.size(); } } }
package com.zmyaro.ltd; import android.app.ActivityManager.TaskDescription; import android.content.DialogInterface; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Point; import android.os.Build; import android.os.Bundle; import android.support.design.widget.NavigationView; import android.support.v4.content.ContextCompat; import android.support.v4.view.GravityCompat; import android.support.v4.view.ViewCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.view.Display; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; public class GameActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { DrawerLayout mDrawerLayout; GameView mGameView; ImageButton mActionButton; TextView mHUDMoney; ViewGroup mNextLevelDialog; ImageView mNextLevelImage; TextView mNextLevelEnemyName; TextView mNextLevelQuote; TextView mNextLevelSpecialWarning; Button mLevelStartButton; Button mForfeitButton; LinearLayout mCostDialog; TextView mCostDialogAction; TextView mCostDialogCost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); // Set up the action drawer. NavigationView navigationView = (NavigationView) findViewById(R.id.turret_select_view); navigationView.setNavigationItemSelectedListener(this); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); // Set up the HUD elements. mHUDMoney = (TextView) findViewById(R.id.hud_money); mHUDMoney.setText("$" + GameView.START_MONEY); // Set up the cost dialog. mCostDialog = (LinearLayout) findViewById(R.id.cost_dialog); mCostDialogAction = (TextView) findViewById(R.id.cost_dialog_action); mCostDialogCost = (TextView) findViewById(R.id.cost_dialog_cost); mCostDialogAction.setText("Basic Turret"); mCostDialog.setVisibility(View.GONE); // Get the screen size. Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); // Use getWidth and getHeight on older versions of Android. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { display.getSize(size); } else { size.x = display.getWidth(); size.y = display.getHeight(); } // Create the game view. mGameView = new GameView(this, size.x, size.y); mGameView.setGameStateListener(new GameStateListener() { @Override public void onLevelTransition(final int levelNum) { runOnUiThread(new Runnable() { @Override public void run() { if (levelNum < Level.LEVELS.length) { mGameView.initLevel(); showNextLevelDialog(levelNum); updateRecentsColor(levelNum); } } }); } @Override public void onMoneyChanged(final int money) { runOnUiThread(new Runnable() { @Override public void run() { mHUDMoney.setText("$" + money); } }); } @Override public void onCostDialogEnabled(final int color, final String message) { runOnUiThread(new Runnable() { @Override public void run() { mCostDialog.setBackgroundColor(color); mCostDialogCost.setText(message); mCostDialog.setVisibility(View.VISIBLE); } }); } @Override public void onCostDialogMoved(final float x, final float y, final boolean showToLeft) { runOnUiThread(new Runnable() { @Override public void run() { float dispX = x; if (showToLeft) { dispX -= mCostDialog.getWidth(); } ViewCompat.setTranslationX(mCostDialog, dispX); ViewCompat.setTranslationY(mCostDialog, y); } }); } @Override public void onCostDialogDisabled() { runOnUiThread(new Runnable() { @Override public void run() { mCostDialog.setVisibility(View.GONE); } }); } @Override public void onGameEnded(final int score) { runOnUiThread(new Runnable() { @Override public void run() { AlertDialog resultsDialog = new AlertDialog.Builder(GameActivity.this).create(); resultsDialog.setTitle("Game Over"); resultsDialog.setMessage("You saved " + score + " tower" + (score == 1 ? "" : "s") + "."); resultsDialog.setButton(AlertDialog.BUTTON_POSITIVE, "Done", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); resultsDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { finish(); } }); resultsDialog.show(); } }); } }); RelativeLayout contentView = (RelativeLayout) findViewById(R.id.game_view_holder); contentView.addView(mGameView, 0); // Get next level dialog buttons. mNextLevelDialog = (ViewGroup) findViewById(R.id.next_level_dialog); mNextLevelImage = (ImageView) findViewById(R.id.next_level_enemy_image); mNextLevelEnemyName = (TextView) findViewById(R.id.next_level_enemy_name); mNextLevelQuote = (TextView) findViewById(R.id.next_level_quote); mNextLevelSpecialWarning = (TextView) findViewById(R.id.next_level_special_warning); mLevelStartButton = (Button) findViewById(R.id.level_start_button); mForfeitButton = (Button) findViewById(R.id.forfeit_button); mForfeitButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO: Make this go to the results screen. finish(); } }); mNextLevelDialog.setVisibility(View.GONE); // Set up the action menu button. mActionButton = (ImageButton) findViewById(R.id.current_action_button); mActionButton.setImageDrawable(ContextCompat.getDrawable(GameActivity.this, R.drawable.ic_turret_basic)); mActionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) { mDrawerLayout.closeDrawer(GravityCompat.START); } else { mDrawerLayout.openDrawer(GravityCompat.START); } } }); final ImageView instructions = (ImageView) findViewById(R.id.instructions); instructions.setImageDrawable(ContextCompat.getDrawable(GameActivity.this, R.drawable.instructions)); instructions.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Hide the instructions. instructions.setVisibility(View.GONE); // Show the first level dialog. showNextLevelDialog(0); } }); instructions.bringToFront(); } private void showNextLevelDialog(int levelNum) { Level nextLevel = Level.LEVELS[levelNum]; //mLevelStartButton.setText("Start Level " + (levelNum + 1)); mLevelStartButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mGameView.startLevel(); mNextLevelDialog.setVisibility(View.GONE); } }); mNextLevelImage.setImageDrawable(ContextCompat.getDrawable(GameActivity.this, nextLevel.getEnemyDrawableId())); mNextLevelEnemyName.setText(nextLevel.getEnemyName()); mNextLevelQuote.setText(nextLevel.getQuote()); if (ExplosiveEnemy.class.isAssignableFrom(nextLevel.getEnemyClass()) && !Trump.class.isAssignableFrom(nextLevel.getEnemyClass())) { // Mark explosive enemies (except Trump). mNextLevelSpecialWarning.setText("EXPLOSIVE!"); } else if (WormEnemy.class.isAssignableFrom(nextLevel.getEnemyClass())) { // Mark worm enemies. mNextLevelSpecialWarning.setText("WORM!"); } else { mNextLevelSpecialWarning.setText(""); } mNextLevelDialog.setVisibility(View.VISIBLE); } private void updateRecentsColor(int levelNum) { if (Build.VERSION.SDK_INT < 21) { return; } String appName = getString(R.string.app_name); Bitmap icon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher); int colorId = getResources().getIdentifier(Level.LEVELS[levelNum].getSkyDrawableName(), "color", getPackageName()); int color = ContextCompat.getColor(GameActivity.this, colorId); TaskDescription newDesc = new TaskDescription(appName, icon, color); setTaskDescription(newDesc); } @Override protected void onPause() { super.onPause(); mGameView.pause(); } @Override protected void onResume() { super.onResume(); mGameView.resume(); } @Override public void onBackPressed() { if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) { mDrawerLayout.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); // TODO: Capture back button. } } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); switch (id) { case R.id.turret_select_basic: mGameView.setAction(GameView.ACTION_TURRET_BASIC); mActionButton.setImageDrawable(ContextCompat.getDrawable(GameActivity.this, R.drawable.ic_turret_basic)); mCostDialogAction.setText("Basic Turret"); break; case R.id.turret_select_rapid: mGameView.setAction(GameView.ACTION_TURRET_RAPID); mActionButton.setImageDrawable(ContextCompat.getDrawable(GameActivity.this, R.drawable.ic_turret_rapid)); mCostDialogAction.setText("Rapid Turret"); break; /*case R.id.turret_select_flame: mGameView.setAction(GameView.ACTION_TURRET_FLAME); mActionButton.setImageDrawable(ContextCompat.getDrawable(GameActivity.this, R.drawable.ic_turret_flame)); mCostDialogAction.setText("Flame Turret"); break; case R.id.turret_select_missile: mGameView.setAction(GameView.ACTION_TURRET_MISSILE); mActionButton.setImageDrawable(ContextCompat.getDrawable(GameActivity.this, R.drawable.ic_turret_missile)); mCostDialogAction.setText("Missile Turret"); break;*/ case R.id.turret_upgrade: mGameView.setAction(GameView.ACTION_TURRET_UPGRADE); mActionButton.setImageDrawable(ContextCompat.getDrawable(GameActivity.this, R.drawable.ic_turret_upgrade)); mCostDialogAction.setText("Upgrade Turret"); break; } mDrawerLayout.closeDrawer(GravityCompat.START); return true; } }
package pms.dao; //pms.dao.RiskDao import java.util.ArrayList; import java.util.HashMap; import org.springframework.stereotype.Repository; import pms.dto.RiskBoard; import pms.dto.RiskFile; import pms.dto.UptStatus; @Repository public interface RiskDao { public ArrayList<RiskBoard> rBoard(int project_no); public ArrayList<RiskBoard> rBoard_request(int project_no); public ArrayList<RiskBoard> rBoardAll(); public ArrayList<RiskBoard> rBoard_requestwk(String risk_writer); public void insertBoard(RiskBoard insert); public RiskBoard getBoard(int risk_no); public void uptStatus(UptStatus upt_satus); public void insertRiskFile(RiskFile riskfile); public ArrayList<RiskFile> getRiskFile(int fno); public ArrayList<RiskFile> fileInfo(int fno); public void updateRisk(RiskBoard upt); public void updateFile(HashMap<String, String> hs); public void deleteRisk(int risk_no); public void deleteFile(int risk_no); }
/* * UniTime 3.4 - 3.5 (University Timetabling Application) * Copyright (C) 2012 - 2013, UniTime LLC, and individual contributors * as indicated by the @authors tag. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. * */ package org.unitime.timetable.server.instructor; import org.unitime.localization.impl.Localization; import org.unitime.timetable.defaults.ApplicationProperty; import org.unitime.timetable.defaults.CommonValues; import org.unitime.timetable.defaults.UserProperty; import org.unitime.timetable.gwt.client.instructor.InstructorAvailabilityWidget.InstructorAvailabilityModel; import org.unitime.timetable.gwt.client.instructor.InstructorAvailabilityWidget.InstructorAvailabilityRequest; import org.unitime.timetable.gwt.command.server.GwtRpcImplementation; import org.unitime.timetable.gwt.command.server.GwtRpcImplements; import org.unitime.timetable.gwt.resources.GwtConstants; import org.unitime.timetable.gwt.resources.GwtMessages; import org.unitime.timetable.gwt.shared.RoomInterface; import org.unitime.timetable.gwt.shared.RoomInterface.RoomSharingOption; import org.unitime.timetable.model.DepartmentalInstructor; import org.unitime.timetable.model.Preference; import org.unitime.timetable.model.PreferenceLevel; import org.unitime.timetable.model.TimePref; import org.unitime.timetable.model.dao.DepartmentalInstructorDAO; import org.unitime.timetable.security.SessionContext; import org.unitime.timetable.webutil.RequiredTimeTable; /** * @author Tomas Muller */ @GwtRpcImplements(InstructorAvailabilityRequest.class) public class InstructorAvailabilityBackend implements GwtRpcImplementation<InstructorAvailabilityRequest, InstructorAvailabilityModel>{ protected static final GwtConstants CONSTANTS = Localization.create(GwtConstants.class); protected static final GwtMessages MESSAGES = Localization.create(GwtMessages.class); @Override public InstructorAvailabilityModel execute(InstructorAvailabilityRequest request, SessionContext context) { InstructorAvailabilityModel model = new InstructorAvailabilityModel(); for (int i = 0; true; i++) { String mode = ApplicationProperty.RoomSharingMode.value(String.valueOf(1 + i), i < CONSTANTS.roomSharingModes().length ? CONSTANTS.roomSharingModes()[i] : null); if (mode == null || mode.isEmpty()) break; model.addMode(new RoomInterface.RoomSharingDisplayMode(mode)); } model.setDefaultEditable(true); for (PreferenceLevel pref: PreferenceLevel.getPreferenceLevelList()) { if (PreferenceLevel.sRequired.equals(pref.getPrefProlog())) continue; RoomSharingOption option = new RoomSharingOption(model.char2id(PreferenceLevel.prolog2char(pref.getPrefProlog())), pref.prefcolor(), "", pref.getPrefName(), true); model.addOption(option); if (PreferenceLevel.sNeutral.equals(pref.getPrefProlog())) model.setDefaultOption(option); } String defaultGridSize = RequiredTimeTable.getTimeGridSize(context.getUser()); if (defaultGridSize != null) for (int i = 0; i < model.getModes().size(); i++) { if (model.getModes().get(i).getName().equals(defaultGridSize)) { model.setDefaultMode(i); break; } } model.setDefaultHorizontal(CommonValues.HorizontalGrid.eq(context.getUser().getProperty(UserProperty.GridOrientation))); model.setNoteEditable(false); if (request.getInstructorId() != null) { if (request.getInstructorId().length() > 200) { model.setPattern(request.getInstructorId()); } else { DepartmentalInstructor instructor = DepartmentalInstructorDAO.getInstance().get(Long.valueOf(request.getInstructorId())); for (Preference pref: instructor.getPreferences()) { if (pref instanceof TimePref) { model.setPattern(((TimePref) pref).getPreference()); break; } } } } return model; } }
package com.pkjiao.friends.mm.adapter; import java.util.ArrayList; import java.util.HashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; import android.graphics.Bitmap; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Animation; import android.view.animation.AnticipateOvershootInterpolator; import android.view.animation.BounceInterpolator; import android.view.animation.RotateAnimation; import android.view.animation.ScaleAnimation; import android.widget.BaseAdapter; import android.widget.CheckBox; import android.widget.GridView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.pkjiao.friends.mm.R; import com.pkjiao.friends.mm.activity.ContactsInfoActivity; import com.pkjiao.friends.mm.activity.EditCommentsActivity; import com.pkjiao.friends.mm.activity.ReplyListsActivity; import com.pkjiao.friends.mm.activity.ViewPhotoActivity; import com.pkjiao.friends.mm.base.AsyncHeadPicBitmapLoader; import com.pkjiao.friends.mm.base.AsyncImageViewBitmapLoader; import com.pkjiao.friends.mm.base.CommentsItem; import com.pkjiao.friends.mm.base.ContactsInfo; import com.pkjiao.friends.mm.base.ReplysItem; import com.pkjiao.friends.mm.common.CommonDataStructure; import com.pkjiao.friends.mm.database.MarrySocialDBHelper; import com.pkjiao.friends.mm.roundedimageview.RoundedImageView; import com.pkjiao.friends.mm.services.DeleteCommentsAndBravosAndReplysIntentServices; import com.pkjiao.friends.mm.services.DownloadCommentsIntentService; import com.pkjiao.friends.mm.services.UploadCommentsAndBravosAndReplysIntentService; import com.pkjiao.friends.mm.utils.Utils; public class DynamicInfoListAdapter extends BaseAdapter { @SuppressWarnings("unused") private static final String TAG = "DynamicInfoListAdapter"; private static final String[] COMMENTS_PROJECTION = { MarrySocialDBHelper.KEY_UID, MarrySocialDBHelper.KEY_COMMENT_ID }; private Context mContext; private LayoutInflater mInflater; private ScaleAnimation mBravoScaleAnimation; private ScaleAnimation mReplyScaleAnimation; private RotateAnimation mRefreshAnimation; private String mUid; private String mAuthorName; private MarrySocialDBHelper mDBHelper; private ExecutorService mExecutorService; private AsyncImageViewBitmapLoader mAsyncBitmapLoader; private AsyncHeadPicBitmapLoader mHeadPicBitmapLoader; private boolean mIsInContactsInfoActivity = false; private ArrayList<CommentsItem> mCommentsData = new ArrayList<CommentsItem>(); private HashMap<String, String> mBravoEntrys = new HashMap<String, String>(); private HashMap<String, ArrayList<ReplysItem>> mReplyEntrys = new HashMap<String, ArrayList<ReplysItem>>(); private HashMap<String, ContactsInfo> mUserInfoEntrys = new HashMap<String, ContactsInfo>(); private onReplyBtnClickedListener mReplyBtnClickedListener; public static interface onReplyBtnClickedListener { public void onReplyBtnClicked(int position); } public void setReplyBtnClickedListener(onReplyBtnClickedListener listener) { mReplyBtnClickedListener = listener; } public DynamicInfoListAdapter(Context context) { mContext = context; mInflater = LayoutInflater.from(mContext); mBravoScaleAnimation = new ScaleAnimation(0.1f, 1.0f, 0.1f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mBravoScaleAnimation.setInterpolator(new BounceInterpolator()); mBravoScaleAnimation.setDuration(100); mBravoScaleAnimation.setFillAfter(true); mBravoScaleAnimation.setFillBefore(true); mReplyScaleAnimation = new ScaleAnimation(0.1f, 1.0f, 0.1f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mReplyScaleAnimation.setInterpolator(new BounceInterpolator()); mReplyScaleAnimation.setDuration(100); mReplyScaleAnimation.setFillAfter(true); mReplyScaleAnimation.setFillBefore(true); mRefreshAnimation = new RotateAnimation(0f, 1440f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mRefreshAnimation.setDuration(4000); SharedPreferences prefs = mContext.getSharedPreferences( CommonDataStructure.PREFS_LAIQIAN_DEFAULT, mContext.MODE_PRIVATE); mUid = prefs.getString(CommonDataStructure.UID, ""); mAuthorName = prefs.getString(CommonDataStructure.AUTHOR_NAME, ""); mAsyncBitmapLoader = new AsyncImageViewBitmapLoader(mContext); mHeadPicBitmapLoader = new AsyncHeadPicBitmapLoader(mContext); mDBHelper = MarrySocialDBHelper.newInstance(mContext); mExecutorService = Executors.newFixedThreadPool(Runtime.getRuntime() .availableProcessors() * CommonDataStructure.THREAD_POOL_SIZE); } public void setCommentDataSource(ArrayList<CommentsItem> source) { mCommentsData = source; } public void setBravoDataSource(HashMap<String, String> source) { mBravoEntrys = source; } public void setReplyDataSource(HashMap<String, ArrayList<ReplysItem>> source) { mReplyEntrys = source; } public void setUserInfoDataSource(HashMap<String, ContactsInfo> source) { mUserInfoEntrys = source; } public void setEnterInContactsInfoActivity(boolean status) { mIsInContactsInfoActivity = status; } public void clearHeadPicsCache() { if (mHeadPicBitmapLoader != null) { mHeadPicBitmapLoader.clearCache(); } } @Override public int getCount() { return mCommentsData.size(); } @Override public Object getItem(int position) { return mCommentsData.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { convertView = mInflater.inflate(R.layout.dynamic_info_item_layout, parent, false); holder = initViewHolder(convertView); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } setViewHolderLoyout(holder, position); return convertView; } private void setViewHolderLoyout(final ViewHolder holder, final int position) { holder.mNickName.setText(mCommentsData.get(position).getNickName()); holder.mDynamicBravo.setEnabled(!CommonDataStructure.INVALID_STR .equalsIgnoreCase(mCommentsData.get(position).getCommentId())); holder.mDynamicBravo.setChecked(mCommentsData.get(position).isBravo()); holder.mDynamicBravo.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { holder.mDynamicBravo.startAnimation(mBravoScaleAnimation); mExecutorService.execute(new UpdateBravoStatus(mCommentsData .get(position), holder.mDynamicBravo.isChecked())); } }); holder.mReplyBtn.setEnabled(!CommonDataStructure.INVALID_STR .equalsIgnoreCase(mCommentsData.get(position).getCommentId())); holder.mReplyBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { holder.mReplyBtn.startAnimation(mReplyScaleAnimation); mReplyBtnClickedListener.onReplyBtnClicked(position); } }); holder.mRefreshBtn.clearAnimation(); holder.mRefreshBtn.setVisibility(View.GONE); if (mCommentsData.get(position).getCurrrentStatus() == MarrySocialDBHelper.NEED_UPLOAD_TO_CLOUD || mCommentsData.get(position).getCurrrentStatus() == MarrySocialDBHelper.UPLOAD_TO_CLOUD_FAIL) { holder.mRefreshBtn.setVisibility(View.VISIBLE); holder.mRefreshBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { holder.mRefreshBtn.startAnimation(mRefreshAnimation); uploadCommentsToCloud(CommonDataStructure.KEY_COMMENTS, mCommentsData.get(position).getBucketId()); } }); } holder.mReplyTipsTitle.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showAllReplys(position); } }); holder.mAddedTime.setText(mCommentsData.get(position).getAddTime()); holder.mContents.setText(mCommentsData.get(position).getContents()); if (mIsInContactsInfoActivity || mUid.equalsIgnoreCase(mCommentsData.get(position).getUid())) { holder.mDynamicInfoFriends.setVisibility(View.INVISIBLE); holder.mHeadPic.setClickable(false); holder.mNickName.setClickable(false); } else { if (mUserInfoEntrys.get(mCommentsData.get(position).getUid()) != null) { holder.mDynamicInfoFriends.setVisibility(View.VISIBLE); holder.mDynamicInfoFriends.setText(String.format(mContext .getResources().getString(R.string.contacts_detail_more), mUserInfoEntrys.get(mCommentsData.get(position).getUid()) .getFirstDirectFriend())); } holder.mHeadPic.setClickable(true); holder.mNickName.setClickable(true); holder.mHeadPic.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { startToViewContactsInfo(mCommentsData.get(position) .getUid()); } }); holder.mNickName.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { startToViewContactsInfo(mCommentsData.get(position) .getUid()); } }); } mHeadPicBitmapLoader.loadImageBitmap(holder.mHeadPic, mCommentsData .get(position).getUid()); setCommentPicsVisibleIfNeed(holder, position); setCommentPicsOnClickListener(holder, position); setBravosVisibleIfNeed(holder, position); setReplysVisibleIfNeed(holder, position); holder.mDynamicBravo.clearAnimation(); holder.mReplyBtn.clearAnimation(); } class ViewHolder { RoundedImageView mHeadPic; CheckBox mDynamicBravo; ImageView mReplyBtn; ImageView mRefreshBtn; TextView mNickName; TextView mAddedTime; TextView mContents; TextView mBravosAuthorNames; TextView mDynamicInfoFriends; ImageView mCommentPics01; ImageView mCommentPics02; ImageView mCommentPics03; ImageView mCommentPics04; ImageView mCommentPics05; ImageView mCommentPics06; ImageView mCommentPics07; ImageView mCommentPics08; ImageView mCommentPics09; LinearLayout mReply01; TextView mReplyAuthor01; TextView mReplyContent01; LinearLayout mReply02; TextView mReplyAuthor02; TextView mReplyContent02; LinearLayout mReply03; TextView mReplyAuthor03; TextView mReplyContent03; LinearLayout mReply04; TextView mReplyAuthor04; TextView mReplyContent04; LinearLayout mReply05; TextView mReplyAuthor05; TextView mReplyContent05; LinearLayout mBravoTips; TextView mBravoTipsTitle; LinearLayout mReplyTips; TextView mReplyTipsTitle; } private ViewHolder initViewHolder(View convertView) { ViewHolder holder = new ViewHolder(); holder.mHeadPic = (RoundedImageView) convertView .findViewById(R.id.dynamic_info_person_pic); holder.mNickName = (TextView) convertView .findViewById(R.id.dynamic_info_name); holder.mDynamicBravo = (CheckBox) convertView .findViewById(R.id.dynamic_info_bravo); holder.mReplyBtn = (ImageView) convertView .findViewById(R.id.dynamic_info_pinglun); holder.mRefreshBtn = (ImageView) convertView .findViewById(R.id.dynamic_info_refresh); holder.mAddedTime = (TextView) convertView .findViewById(R.id.dynamic_info_time); holder.mContents = (TextView) convertView .findViewById(R.id.dynamic_info_contents); holder.mBravosAuthorNames = (TextView) convertView .findViewById(R.id.dynamic_info_bravo_authors); holder.mDynamicInfoFriends = (TextView) convertView .findViewById(R.id.dynamic_info_friend); holder.mCommentPics01 = (ImageView) convertView .findViewById(R.id.comments_pics_01); holder.mCommentPics02 = (ImageView) convertView .findViewById(R.id.comments_pics_02); holder.mCommentPics03 = (ImageView) convertView .findViewById(R.id.comments_pics_03); holder.mCommentPics04 = (ImageView) convertView .findViewById(R.id.comments_pics_04); holder.mCommentPics05 = (ImageView) convertView .findViewById(R.id.comments_pics_05); holder.mCommentPics06 = (ImageView) convertView .findViewById(R.id.comments_pics_06); holder.mCommentPics07 = (ImageView) convertView .findViewById(R.id.comments_pics_07); holder.mCommentPics08 = (ImageView) convertView .findViewById(R.id.comments_pics_08); holder.mCommentPics09 = (ImageView) convertView .findViewById(R.id.comments_pics_09); holder.mReply01 = (LinearLayout) convertView .findViewById(R.id.dynamic_info_reply_01); holder.mReplyAuthor01 = (TextView) convertView .findViewById(R.id.dynamic_info_reply_author_01); holder.mReplyContent01 = (TextView) convertView .findViewById(R.id.dynamic_info_reply_content_01); holder.mReply02 = (LinearLayout) convertView .findViewById(R.id.dynamic_info_reply_02); holder.mReplyAuthor02 = (TextView) convertView .findViewById(R.id.dynamic_info_reply_author_02); holder.mReplyContent02 = (TextView) convertView .findViewById(R.id.dynamic_info_reply_content_02); holder.mReply03 = (LinearLayout) convertView .findViewById(R.id.dynamic_info_reply_03); holder.mReplyAuthor03 = (TextView) convertView .findViewById(R.id.dynamic_info_reply_author_03); holder.mReplyContent03 = (TextView) convertView .findViewById(R.id.dynamic_info_reply_content_03); holder.mReply04 = (LinearLayout) convertView .findViewById(R.id.dynamic_info_reply_04); holder.mReplyAuthor04 = (TextView) convertView .findViewById(R.id.dynamic_info_reply_author_04); holder.mReplyContent04 = (TextView) convertView .findViewById(R.id.dynamic_info_reply_content_04); holder.mReply05 = (LinearLayout) convertView .findViewById(R.id.dynamic_info_reply_05); holder.mReplyAuthor05 = (TextView) convertView .findViewById(R.id.dynamic_info_reply_author_05); holder.mReplyContent05 = (TextView) convertView .findViewById(R.id.dynamic_info_reply_content_05); holder.mBravoTips = (LinearLayout) convertView .findViewById(R.id.dynamic_info_bravo_tips); holder.mBravoTipsTitle = (TextView) convertView .findViewById(R.id.dynamic_info_bravo_tips_title); holder.mReplyTips = (LinearLayout) convertView .findViewById(R.id.dynamic_info_reply_tips); holder.mReplyTipsTitle = (TextView) convertView .findViewById(R.id.dynamic_info_reply_tips_title); return holder; } private void setCommentPicsVisibleIfNeed(ViewHolder holder, int position) { holder.mCommentPics01 .setBackgroundResource(R.color.gray_background_color); holder.mCommentPics01.setImageBitmap(null); holder.mCommentPics01.setVisibility(View.GONE); holder.mCommentPics02 .setBackgroundResource(R.color.gray_background_color); holder.mCommentPics02.setImageBitmap(null); holder.mCommentPics02.setVisibility(View.GONE); holder.mCommentPics03 .setBackgroundResource(R.color.gray_background_color); holder.mCommentPics03.setImageBitmap(null); holder.mCommentPics03.setVisibility(View.GONE); holder.mCommentPics04 .setBackgroundResource(R.color.gray_background_color); holder.mCommentPics04.setImageBitmap(null); holder.mCommentPics04.setVisibility(View.GONE); holder.mCommentPics05 .setBackgroundResource(R.color.gray_background_color); holder.mCommentPics05.setImageBitmap(null); holder.mCommentPics05.setVisibility(View.GONE); holder.mCommentPics06 .setBackgroundResource(R.color.gray_background_color); holder.mCommentPics06.setImageBitmap(null); holder.mCommentPics06.setVisibility(View.GONE); holder.mCommentPics07 .setBackgroundResource(R.color.gray_background_color); holder.mCommentPics07.setImageBitmap(null); holder.mCommentPics07.setVisibility(View.GONE); holder.mCommentPics08 .setBackgroundResource(R.color.gray_background_color); holder.mCommentPics08.setImageBitmap(null); holder.mCommentPics08.setVisibility(View.GONE); holder.mCommentPics09 .setBackgroundResource(R.color.gray_background_color); holder.mCommentPics09.setImageBitmap(null); holder.mCommentPics09.setVisibility(View.GONE); ArrayList<ImageView> commentPics = new ArrayList<ImageView>(); commentPics.add(holder.mCommentPics01); commentPics.add(holder.mCommentPics02); commentPics.add(holder.mCommentPics03); commentPics.add(holder.mCommentPics04); commentPics.add(holder.mCommentPics05); commentPics.add(holder.mCommentPics06); commentPics.add(holder.mCommentPics07); commentPics.add(holder.mCommentPics08); commentPics.add(holder.mCommentPics09); String uId = mCommentsData.get(position).getUid(); String bucketId = mCommentsData.get(position).getBucketId(); String commentId = mCommentsData.get(position).getCommentId(); int count = mCommentsData.get(position).getPhotoCount(); for (int index = 0; index < count; index++) { String url = uId + "_" + bucketId + "_" + commentId + "_" + (index + 1); commentPics.get(index).setVisibility(View.VISIBLE); mAsyncBitmapLoader.loadImageBitmap(commentPics.get(index), url, AsyncImageViewBitmapLoader.NEED_DECODE_FROM_CLOUD); } } private void setCommentPicsOnClickListener(ViewHolder holder, final int position) { holder.mCommentPics01.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startToViewPhoto(0, position); } }); holder.mCommentPics02.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startToViewPhoto(1, position); } }); holder.mCommentPics03.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startToViewPhoto(2, position); } }); holder.mCommentPics04.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startToViewPhoto(3, position); } }); holder.mCommentPics05.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startToViewPhoto(4, position); } }); holder.mCommentPics06.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startToViewPhoto(5, position); } }); holder.mCommentPics07.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startToViewPhoto(6, position); } }); holder.mCommentPics08.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startToViewPhoto(7, position); } }); holder.mCommentPics09.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startToViewPhoto(8, position); } }); } private void startToViewPhoto(int photoIndex, int position) { Intent intent = new Intent(mContext, ViewPhotoActivity.class); intent.putExtra(MarrySocialDBHelper.KEY_UID, mCommentsData .get(position).getUid()); intent.putExtra(MarrySocialDBHelper.KEY_BUCKET_ID, mCommentsData.get(position).getBucketId()); intent.putExtra(MarrySocialDBHelper.KEY_COMMENT_ID, mCommentsData.get(position).getCommentId()); intent.putExtra(MarrySocialDBHelper.KEY_PHOTO_POS, photoIndex); mContext.startActivity(intent); } private void setBravosVisibleIfNeed(ViewHolder holder, int position) { holder.mBravoTips.setVisibility(View.GONE); holder.mBravosAuthorNames.setVisibility(View.GONE); String bravoAuthorsName = mBravoEntrys.get(mCommentsData.get(position) .getCommentId()); if (bravoAuthorsName != null && bravoAuthorsName.length() != 0) { holder.mBravosAuthorNames.setVisibility(View.VISIBLE); holder.mBravosAuthorNames.setText(bravoAuthorsName); String[] names = bravoAuthorsName.trim().split(" "); if (names != null && names.length >= 0) { holder.mBravoTips.setVisibility(View.VISIBLE); String title = String.format( mContext.getString(R.string.dynamic_bravo_tips_title), names.length); holder.mBravoTipsTitle.setText(title); } } } private void setReplysVisibleIfNeed(ViewHolder holder, int position) { ArrayList<LinearLayout> replysFather = new ArrayList<LinearLayout>(); ArrayList<TextView> authors = new ArrayList<TextView>(); ArrayList<TextView> contents = new ArrayList<TextView>(); replysFather.add(holder.mReply01); replysFather.add(holder.mReply02); replysFather.add(holder.mReply03); replysFather.add(holder.mReply04); replysFather.add(holder.mReply05); authors.add(holder.mReplyAuthor01); authors.add(holder.mReplyAuthor02); authors.add(holder.mReplyAuthor03); authors.add(holder.mReplyAuthor04); authors.add(holder.mReplyAuthor05); contents.add(holder.mReplyContent01); contents.add(holder.mReplyContent02); contents.add(holder.mReplyContent03); contents.add(holder.mReplyContent04); contents.add(holder.mReplyContent05); for (int index = 0; index < 5; index++) { replysFather.get(index).setVisibility(View.GONE); authors.get(index).setText(null); contents.get(index).setText(null); } holder.mReplyTips.setVisibility(View.GONE); ArrayList<ReplysItem> replys = mReplyEntrys.get(mCommentsData.get( position).getCommentId()); if (replys == null || replys.size() <= 0) { return; } int replysCount = replys.size(); if (replysCount > 0) { holder.mReplyTips.setVisibility(View.VISIBLE); String title = String.format( mContext.getString(R.string.dynamic_reply_tips_title), replysCount); holder.mReplyTipsTitle.setText(title); } if (replysCount <= 5) { for (int index = 0; index < replysCount; index++) { replysFather.get(index).setVisibility(View.VISIBLE); authors.get(index).setText(replys.get(index).getNickname()); contents.get(index).setText( replys.get(index).getReplyContents()); } } else { ArrayList<ReplysItem> top5Replys = new ArrayList<ReplysItem>(); for (int index = 5; index > 0; index--) { top5Replys.add(replys.get(replysCount - index)); } for (int index = 0; index < top5Replys.size(); index++) { replysFather.get(index).setVisibility(View.VISIBLE); authors.get(index).setText(top5Replys.get(index).getNickname()); contents.get(index).setText( top5Replys.get(index).getReplyContents()); } } } class UpdateBravoStatus implements Runnable { private CommentsItem comment; private boolean isChecked; public UpdateBravoStatus(CommentsItem comment, boolean isChecked) { this.comment = comment; this.isChecked = isChecked; } @Override public void run() { updateBravoStatusOfCommentsDB(comment, isChecked); if (isChecked) { insertBravoStatusToBravosDB(comment); uploadBravosToCloud(CommonDataStructure.KEY_BRAVOS, comment.getCommentId()); } else { updateBravoStatusToBravosDB(comment); // if (Integer.valueOf(comment.getCommentId()) != -1) { deleteBravosFromCloud(CommonDataStructure.KEY_BRAVOS); // } } } } private void updateBravoStatusOfCommentsDB(CommentsItem comment, boolean isChecked) { String whereClause = null; // if (Integer.valueOf(comment.getCommentId()) == -1) { // whereClause = MarrySocialDBHelper.KEY_BUCKET_ID + " = " // + comment.getBucketId(); // } else { whereClause = MarrySocialDBHelper.KEY_COMMENT_ID + " = " + comment.getCommentId(); // } ContentValues values = new ContentValues(); values.put(MarrySocialDBHelper.KEY_BRAVO_STATUS, isChecked ? MarrySocialDBHelper.BRAVO_CONFIRM : MarrySocialDBHelper.BRAVO_CANCEL); try { mDBHelper.update(MarrySocialDBHelper.DATABASE_COMMENTS_TABLE, values, whereClause, null); } catch (Exception exp) { exp.printStackTrace(); } } private void insertBravoStatusToBravosDB(CommentsItem comment) { if (!isCommentIdAndUidExist(comment.getCommentId())) { ContentValues insertValues = new ContentValues(); insertValues.put(MarrySocialDBHelper.KEY_UID, mUid); insertValues.put(MarrySocialDBHelper.KEY_BUCKET_ID, comment.getBucketId()); insertValues.put(MarrySocialDBHelper.KEY_COMMENT_ID, comment.getCommentId()); insertValues.put(MarrySocialDBHelper.KEY_AUTHOR_NICKNAME, mAuthorName); insertValues.put(MarrySocialDBHelper.KEY_ADDED_TIME, Long.toString(System.currentTimeMillis() / 1000)); insertValues.put(MarrySocialDBHelper.KEY_CURRENT_STATUS, MarrySocialDBHelper.NEED_UPLOAD_TO_CLOUD); try { ContentResolver resolver = mContext.getContentResolver(); resolver.insert(CommonDataStructure.BRAVOURL, insertValues); } catch (Exception exp) { exp.printStackTrace(); } } else { String whereClause = null; // if (Integer.valueOf(comment.getCommentId()) == -1) { // whereClause = MarrySocialDBHelper.KEY_BUCKET_ID + " = " // + comment.getBucketId() + " AND " // + MarrySocialDBHelper.KEY_UID + " = " + mUid; // } else { whereClause = MarrySocialDBHelper.KEY_COMMENT_ID + " = " + comment.getCommentId() + " AND " + MarrySocialDBHelper.KEY_UID + " = " + mUid; // } ContentResolver resolver = mContext.getContentResolver(); ContentValues values = new ContentValues(); values.put(MarrySocialDBHelper.KEY_CURRENT_STATUS, MarrySocialDBHelper.NEED_UPLOAD_TO_CLOUD); try { resolver.update(CommonDataStructure.BRAVOURL, values, whereClause, null); } catch (Exception exp) { exp.printStackTrace(); } } } private void updateBravoStatusToBravosDB(CommentsItem comment) { String whereClause = null; ContentResolver resolver = mContext.getContentResolver(); // if (Integer.valueOf(comment.getCommentId()) == -1) { // whereClause = MarrySocialDBHelper.KEY_BUCKET_ID + " = " // + comment.getBucketId() + " AND " // + MarrySocialDBHelper.KEY_UID + " = " + mUid; // resolver.delete(CommonDataStructure.BRAVOURL, whereClause, null); // } else { whereClause = MarrySocialDBHelper.KEY_COMMENT_ID + " = " + comment.getCommentId() + " AND " + MarrySocialDBHelper.KEY_UID + " = " + mUid; ContentValues values = new ContentValues(); values.put(MarrySocialDBHelper.KEY_CURRENT_STATUS, MarrySocialDBHelper.NEED_DELETE_FROM_CLOUD); try { resolver.update(CommonDataStructure.BRAVOURL, values, whereClause, null); } catch (Exception exp) { exp.printStackTrace(); } // } } public boolean isCommentIdAndUidExist(String commentId) { Cursor cursor = null; try { String whereclause = MarrySocialDBHelper.KEY_COMMENT_ID + " = " + commentId + " AND " + MarrySocialDBHelper.KEY_UID + " = " + mUid; cursor = mDBHelper.query(MarrySocialDBHelper.DATABASE_BRAVOS_TABLE, COMMENTS_PROJECTION, whereclause, null, null, null, null, null); if (cursor == null || cursor.getCount() == 0) { return false; } } catch (Exception e) { e.printStackTrace(); } finally { if (cursor != null) { cursor.close(); } } return true; } private void showAllReplys(int position) { String commentId = mCommentsData.get(position).getCommentId(); Intent intent = new Intent(mContext, ReplyListsActivity.class); intent.putExtra(MarrySocialDBHelper.KEY_COMMENT_ID, commentId); mContext.startActivity(intent); } private void startToViewContactsInfo(String uid) { Intent intent = new Intent(mContext, ContactsInfoActivity.class); intent.putExtra(MarrySocialDBHelper.KEY_UID, uid); mContext.startActivity(intent); } private void uploadBravosToCloud(int uploadType, String comment_id) { Intent serviceIntent = new Intent(mContext, UploadCommentsAndBravosAndReplysIntentService.class); serviceIntent.putExtra(CommonDataStructure.KEY_UPLOAD_TYPE, uploadType); serviceIntent.putExtra(MarrySocialDBHelper.KEY_COMMENT_ID, comment_id); mContext.startService(serviceIntent); } private void deleteBravosFromCloud(int uploadType) { Intent serviceIntent = new Intent(mContext, DeleteCommentsAndBravosAndReplysIntentServices.class); serviceIntent.putExtra(CommonDataStructure.KEY_DELETE_TYPE, uploadType); mContext.startService(serviceIntent); } private void uploadCommentsToCloud(int uploadType, String bucket_id) { Intent serviceIntent = new Intent(mContext, UploadCommentsAndBravosAndReplysIntentService.class); serviceIntent.putExtra(CommonDataStructure.KEY_UPLOAD_TYPE, uploadType); serviceIntent.putExtra(MarrySocialDBHelper.KEY_BUCKET_ID, bucket_id); mContext.startService(serviceIntent); } }